playbook_ui_docs 12.24.0.pre.alpha.railsmultilevelimprovements742 → 12.24.0.pre.alpha.railsmultilevelimprovements749

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 +2 -2
data/dist/playbook-doc.js CHANGED
@@ -18,7 +18,7 @@ a.version="2.29.4",t=xt,a.fn=gn,a.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 a=!("undefined"==typeof window||!window.document||!window.document.createElement),i={canUseDOM:a,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:a&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:a&&!!window.screen};void 0===(r=function(){return i}.call(t,n,t,e))||(e.exports=r)}()},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(5);t.a=function(e){var t=e.size,n=void 0===t?"lg":t,r=e.widths,i=void 0===r?[1]:r,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 a.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,r){return a.a.createElement("div",{className:o()("pb_distribution_width",t[r]?"color_".concat(t[r]):""),key:r,style:{width:"".concat(100*e/n,"%")}})}))}(u,c))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(52),l=n(2),c=n(5),u=n(14),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,r=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),r),_=Object(l.c)(m),y=new s.a({value:b||new Date(h),zone:f});return a.a.createElement("div",Object.assign({className:g},_),a.a.createElement(u.a,{className:o()("pb_time_stacked","time-spacing"),color:"light",dark:i},a.a.createElement("time",null,y.toTimeWithMeridian(),a.a.createElement(d.a,{className:"pb_time_stacked",color:"light",dark:i,tag:"span",text:y.toTimezone()}))))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),u=n(8);t.a=function(e){var t=e.align,n=void 0===t?"left":t,r=e.aria,i=void 0===r?{}:r,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 a.a.createElement("div",Object.assign({},_,y,{className:M,id:f}),a.a.createElement(c.a,{color:"light",dark:p},a.a.createElement(u.a,{dark:p,fixedWidth:!0,icon:h}),g))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(105),u=n(17);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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),r);return a.a.createElement("div",Object.assign({},g,_,{className:y,id:p}),a.a.createElement(u.a,{className:"pb_label_pill_label",text:m}),a.a.createElement(c.a,{className:"pb_label_pill_pill",text:b,variant:f}))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(33),u=n(14),d=n(11),p=n(30),m=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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||r,j=E?"pb_message_kit_avatar":"pb_message_kit",W=o()(Object(s.b)(j),Object(l.c)(e),g);return a.a.createElement("div",Object.assign({},N,q,{className:W,id:M}),E&&a.a.createElement(c.a,{imageUrl:h,name:r,size:"xs",status:b}),a.a.createElement("div",{className:"content_wrapper"},a.a.createElement(d.a,{justify:"left"===w?"none":"between",orientation:"row"},v&&a.a.createElement(m.a,{className:"message_title",size:4,text:v}),a.a.createElement(p.a,{className:"pull-".concat(w," ").concat(k?"message_humanized_time":null),text:O,timestamp:"",timezone:A}),k&&a.a.createElement(p.a,{className:"pull-".concat(w," message_timestamp"),text:"",timestamp:k,timezone:A})),z&&a.a.createElement(u.a,{className:"pb_message_body",text:z}),f))}},function(e,t,n){"use strict";e.exports=n(391)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(a=r.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 r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?i:String(i)),r)}var a,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,r=l(e);if(t){var a=l(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.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 r(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,r=0;r<n;r++)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])}))}))}))}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n(59).a)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(a=r.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 r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?i:String(i)),r)}var a,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,r=l(e);if(t){var a=l(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.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 r(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)}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n(59).a)},function(e,t,n){"use strict";var r=n(0),a=n.n(r);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:r,floating:a}=e;const c=r.x+r.width/2-a.width/2,u=r.y+r.height/2-a.height/2,d=l(t),p=o(d),m=r[p]/2-a[p]/2,b="x"===d;let h;switch(s(t)){case"top":h={x:c,y:r.y-a.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-a.width,y:u};break;default:h={x:r.x,y:r.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:r,y:a,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:r,y:a}: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:r=0}=e||{},{x:a,y:s,placement:c,rects:d,platform:p,elements:m}=t;if(null==n)return{};const b=u(r),f={x:a,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 r=i(e),a=l(e),s=o(a);let c="x"===a?r===(n?"end":"start")?"right":"left":"start"===r?"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:r,middlewareData:a,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(r),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,r){const a=i(e);let o=function(e,t,n){const r=["left","right"],a=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?a:r:t?r:a;case"left":case"right":return t?i:o;default:return[]}}(s(e),"start"===n,r);return a&&(o=o.map(e=>e+"-"+a),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=a.flip)?void 0:n.overflows)||[];if(d&&N.push(w[z]),m){const{main:e,cross:t}=y(r,o,k);N.push(w[e],w[t])}if(q=[...q,{placement:r,overflows:N}],!N.every(e=>e<=0)){var E,j;const e=((null==(E=a.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(r!==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:r}=t,a=await async function(e,t){const{placement:n,platform:r,elements:a}=e,o=await(null==r.isRTL?void 0:r.isRTL(a.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+a.x,y:r+a.y,data:a}}}};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:r,display:a}=x(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(a)}function T(e){return["table","td","th"].includes(N(e))}function C(e){const t=/firefox/i.test(E()),n=x(e),r=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!r&&"none"!==r||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),r=parseFloat(t.height);const a=j(e),i=a?e.offsetWidth:n,o=a?e.offsetHeight:r,s=I(n)!==i||I(r)!==o;return s&&(n=i,r=o),{width:n,height:r,fallback:s}}function F(e){return W(e)?e:e.contextElement}const Y={x:1,y:1};function X(e){const t=F(e);if(!j(t))return Y;const n=t.getBoundingClientRect(),{width:r,height:a,fallback:i}=$(t);let o=(i?I(n.width):n.width)/r,s=(i?I(n.height):n.height)/a;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}function H(e,t,n,r){var a,i;void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),s=F(e);let l=Y;t&&(r?W(r)&&(l=X(r)):l=X(e));const c=s?A(s):window,u=R()&&n;let p=(o.left+(u&&(null==(a=c.visualViewport)?void 0:a.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=r&&W(r)?A(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=X(n),t=n.getBoundingClientRect(),r=getComputedStyle(n);t.x+=(n.clientLeft+parseFloat(r.paddingLeft))*e.x,t.y+=(n.clientTop+parseFloat(r.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 V(e){return((w(e)?e.ownerDocument:e.document)||window.document).documentElement}function U(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function G(e){return H(V(e)).left+U(e).scrollLeft}function K(e){if("html"===N(e))return e;const t=e.assignedSlot||e.parentNode||L(e)&&e.host||V(e);return L(t)?t.host:t}function J(e,t){var n;void 0===t&&(t=[]);const r=function e(t){const n=K(t);return D(n)?n.ownerDocument.body:j(n)&&S(n)?n:e(n)}(e),a=r===(null==(n=e.ownerDocument)?void 0:n.body),i=A(r);return a?t.concat(i,i.visualViewport||[],S(r)?r:[]):t.concat(r,J(r))}function Z(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=A(e),r=V(e),a=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,s=0,l=0;if(a){i=a.width,o=a.height;const e=R();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,l=a.offsetTop)}return{width:i,height:o,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=V(e),n=U(e),r=e.ownerDocument.body,a=B(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=B(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+G(e);const s=-n.scrollTop;return"rtl"===x(r).direction&&(o+=B(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:s}}(V(e));else if(W(t))r=function(e,t){const n=H(e,!0,"fixed"===t),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=j(e)?X(e):{x:1,y:1};return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:a*i.x,y:r*i.y}}(t,n);else{const n={...t};if(R()){var a,i;const t=A(e);n.x-=(null==(a=t.visualViewport)?void 0:a.offsetLeft)||0,n.y-=(null==(i=t.visualViewport)?void 0:i.offsetTop)||0}r=n}return d(r)}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 r=Q(e,t);for(;r&&T(r)&&"static"===x(r).position;)r=Q(r,t);return r&&("html"===N(r)||"body"===N(r)&&"static"===x(r).position&&!C(r))?n:r||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 r=j(t),a=V(t),i=H(e,!0,"fixed"===n,t);let o={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==N(t)||S(a))&&(o=U(t)),j(t)){const e=H(t,!0);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else a&&(s.x=G(a));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:r,strategy:a}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=J(e).filter(e=>W(e)&&"body"!==N(e)),a=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)a=null;else{(i?!t&&!a:!t&&"static"===e.position&&!!a&&["absolute","fixed"].includes(a.position))?r=r.filter(e=>e!==o):a=e}o=K(o)}return t.set(e,r),r}(t,this._c):[].concat(n),r],o=i[0],s=i.reduce((e,n)=>{const r=Z(t,n,a);return e.top=B(r.top,e.top),e.right=P(r.right,e.right),e.bottom=P(r.bottom,e.bottom),e.left=B(r.left,e.left),e},Z(t,o,a));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:r}=e;const a=j(n),i=V(n);if(n===i)return t;let o={scrollLeft:0,scrollTop:0},s={x:1,y:1};const l={x:0,y:0};if((a||!a&&"fixed"!==r)&&(("body"!==N(n)||S(i))&&(o=U(n)),j(n))){const e=H(n);s=X(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:V,getScale:X,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e;const a=this.getOffsetParent||ee,i=this.getDimensions;return{reference:te(t,await a(n),r),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===x(e).direction};const re=(e,t,n)=>{const r=new Map,a={platform:ne,...n},i={...a.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:a="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:a}),{x:d,y:p}=c(u,r,l),m=r,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:r,placement:m,strategy:a,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:a}):M.rects),({x:d,y:p}=c(u,m,l))),n=-1)}return{x:d,y:p,placement:m,strategy:a,middlewareData:b}})(e,t,{...a,platform:i})};var ae=n(28);const ie=e=>{const{element:t,padding:n}=e;return{name:"arrow",options:e,fn(e){return r=t,Object.prototype.hasOwnProperty.call(r,"current")?null!=t.current?f({element:t.current,padding:n}).fn(e):{}:t?f({element:t,padding:n}).fn(e):{};var r}}};var oe="undefined"!=typeof document?r.useLayoutEffect:r.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,r,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;0!=r--;)if(!se(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,a[r]))return!1;for(r=n;0!=r--;){const n=a[r];if(("_owner"!==n||!e.$$typeof)&&!se(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function le(e){const t=r.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?r.useLayoutEffect:r.useEffect;let de=!1,pe=0;const me=()=>"floating-ui-"+pe++;const be=r["useId".toString()]||function(){const[e,t]=r.useState(()=>de?me():void 0);return ue(()=>{null==e&&t(me())},[]),r.useEffect(()=>{de||(de=!0)},[]),e};function he(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}const fe=r.createContext(null),ge=r.createContext(null),_e=()=>{var e;return(null==(e=r.useContext(fe))?void 0:e.id)||null},ye=()=>r.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&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof ve(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var r;return!1}function Ae(e){const t=Object(r.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:a,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=r.useRef(),v=r.useRef(),z=r.useRef(),O=r.useRef(),k=r.useRef(!0),A=r.useRef(!1),x=r.useRef(()=>{}),w=r.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]);r.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]),r.useEffect(()=>{if(!u||!_.current||!n)return;function e(){w()&&a(!1)}const t=Me(l).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[l,n,a,u,_,i,w]);const N=r.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(()=>a(!1),t)):e&&(clearTimeout(v.current),a(!1))}),[y,a]),q=r.useCallback(()=>{x.current(),z.current=void 0},[]),E=r.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 r.useEffect(()=>{if(u&&ze(s)){const e=s;return n&&e.addEventListener("mouseleave",c),null==l||l.addEventListener("mouseleave",c),h&&e.addEventListener("mousemove",r,{once:!0}),e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",o),()=>{n&&e.removeEventListener("mouseleave",c),null==l||l.removeEventListener("mouseleave",c),h&&e.removeEventListener("mousemove",r),e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",o)}}function t(){return!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)}function r(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(()=>{a(!0)},t):a(!0)}function o(r){if(t())return;x.current();const a=Me(l);if(clearTimeout(O.current),_.current){n||clearTimeout(v.current),z.current=_.current({...e,tree:f,x:r.clientX,y:r.clientY,onClose(){E(),q(),N()}});const t=z.current;return a.addEventListener("mousemove",t),void(x.current=()=>{a.removeEventListener("mousemove",t)})}("touch"!==M.current||!ke(l,r.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,a,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,r;const e=s,n=null==f||null==(t=f.nodesRef.current.find(e=>e.id===g))||null==(r=t.context)?void 0:r.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]),r.useEffect(()=>()=>{q(),clearTimeout(v.current),clearTimeout(O.current),E()},[u,q,E]),r.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||a(!0)},b))}},floating:{onMouseEnter(){clearTimeout(v.current)},onMouseLeave(){o.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),N(!1)}}}},[o,u,b,n,a,N])};function Ne(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),r=n;for(;r.length;)r=e.filter(e=>{var t;return null==(t=r)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(r);return n}function qe(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Ee=r["useInsertionEffect".toString()]||(e=>e());function je(e){const t=r.useRef(()=>{0});return Ee(()=>{t.current=e}),r.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}function We(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:a=!1}=void 0===e?{}:e,i=!1,o=!1;const s=e=>{let{x:a,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==a||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=a>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&&a>=v.right-1||"right"===O&&a<=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 a=z.width>v.width,i=z.height>v.height;switch(O){case"top":return[[a?t+r/2:k?t+4*r:t-4*r,n+r+1],[a?t-r/2:k?t+4*r:t-4*r,n+r+1],...[[z.left,k||a?z.bottom-r:z.top],[z.right,k?a?z.bottom-r:z.top:z.bottom-r]]];case"bottom":return[[a?t+r/2:k?t+4*r:t-4*r,n-r],[a?t-r/2:k?t+4*r:t-4*r,n-r],...[[z.left,k||a?z.top+r:z.bottom],[z.right,k?a?z.top+r:z.bottom:z.top+r]]];case"left":{const e=[t+r+1,i?n+r/2:A?n+4*r:n-4*r],a=[t+r+1,i?n-r/2:A?n+4*r:n-4*r];return[...[[A||i?z.right-r:z.left,z.top],[A?i?z.right-r:z.left:z.right-r,z.bottom]],e,a]}case"right":return[[t-r,i?n+r/2:A?n+4*r:n-4*r],[t-r,i?n-r/2:A?n+4*r:n-4*r],...[[A||i?z.left+r:z.right,z.top],[A?i?z.left+r:z.right:z.left+r,z.bottom]]]}}([a,s]);return i?void 0:o&&!x?m():void(!function(e,t){const[n,r]=e;let a=!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>=r!=c>=r&&n<=(l-i)*(r-s)/(c-s)+i&&(a=!a)}return a}([b,h],N)?m():n&&!o&&(t=setTimeout(m,n)))}};return s.__options={blockPointerEvents:a},s}function Le(e){void 0===e&&(e={});const{open:t=!1,onOpenChange:n,nodeId:a}=e,i=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:i,whileElementsMounted:o,open:s}=e,[l,c]=r.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,d]=r.useState(a);se(u,a)||d(a);const p=r.useRef(null),m=r.useRef(null),b=r.useRef(l),h=le(o),f=le(i),[g,_]=r.useState(null),[y,M]=r.useState(null),v=r.useCallback(e=>{p.current!==e&&(p.current=e,_(e))},[]),z=r.useCallback(e=>{m.current!==e&&(m.current=e,M(e))},[]),O=r.useCallback(()=>{if(!p.current||!m.current)return;const e={placement:t,strategy:n,middleware:u};f.current&&(e.platform=f.current),re(p.current,m.current,e).then(e=>{const t={...e,isPositioned:!0};k.current&&!se(b.current,t)&&(b.current=t,ae.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=r.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=r.useMemo(()=>({reference:p,floating:m,setReference:v,setFloating:z}),[v,z]),x=r.useMemo(()=>({reference:g,floating:y}),[g,y]);return r.useMemo(()=>({...l,update:O,refs:A,elements:x,reference:v,floating:z}),[l,O,A,x,v,z])}(e),o=ye(),s=r.useRef(null),l=r.useRef({}),c=r.useState(()=>he())[0],u=be(),[d,p]=r.useState(null),m=r.useCallback(e=>{const t=ze(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;i.refs.setReference(t)},[i.refs]),b=r.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=r.useMemo(()=>({...i.refs,setReference:b,setPositionReference:m,domReference:s}),[i.refs,b,m]),f=r.useMemo(()=>({...i.elements,domReference:d}),[i.elements,d]),g=je(n),_=r.useMemo(()=>({...i,refs:h,elements:f,dataRef:l,nodeId:a,floatingId:u,events:c,open:t,onOpenChange:g}),[i,a,u,c,t,g,h,f]);return ue(()=>{const e=null==o?void 0:o.nodesRef.current.find(e=>e.id===a);e&&(e.context=_)}),r.useMemo(()=>({...i,context:_,refs:h,elements:f,reference:b,positionReference:m}),[i,h,f,_,b,m])}function Se(e,t,n){const r=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,a]=t;var i;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof a&&(null==(i=r.get(n))||i.push(a),e[n]=function(){for(var e,t=arguments.length,a=new Array(t),i=0;i<t;i++)a[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map(e=>e(...a)).find(e=>void 0!==e)})):e[n]=a}),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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 r,a,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=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}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,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Fe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}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(r.useState)(!1),2),S=L[0],T=L[1],C=Object(r.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:r,placement:a}=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:r},m=await p(e,u),b=l(s(a)),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-r}}}})],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,Y=R.placement,X=R.reference,H=R.strategy,V=R.x,U=R.y,G=function(e){void 0===e&&(e=[]);const t=e,n=r.useCallback(t=>Se(t,e,"reference"),t),a=r.useCallback(t=>Se(t,e,"floating"),t),i=r.useCallback(t=>Se(t,e,"item"),e.map(e=>null==e?void 0:e.item));return r.useMemo(()=>({getReferenceProps:n,getFloatingProps:a,getItemProps:i}),[n,a,i])}([we(D,{delay:b,handleClose:y?We({blockPointerEvents:!1}):null})]).getFloatingProps,K={bottom:"top",left:"right",right:"left",top:"bottom"}[Y.split("-")[0]];return a.a.createElement(a.a.Fragment,null,a.a.createElement("div",Object.assign({className:"pb_tooltip_kit ".concat(W),ref:X,role:"tooltip_trigger",style:{display:"inline-flex"}},j,E),c),S&&a.a.createElement("div",Object.assign({},G({className:"tooltip_tooltip ".concat(Y," visible"),ref:P,role:"tooltip",style:{position:H,top:null!=U?U:0,left:null!=V?V:0,zIndex:null!=N?N:0}})),a.a.createElement(Pe.a,{align:"center",gap:"xs"},g&&a.a.createElement("i",{className:"pb_icon_kit far fa-".concat(g," fa-fw")}),w),a.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 r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5);function c(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(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){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var p=function e(t,n){var r,a=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}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}}}}(t);try{for(a.s();!(r=a.n()).done;){var i=r.value;if(i.id===n)return i;if(i.children){var o=e(i.children,n);if(o)return o}}}catch(e){a.e(e)}finally{a.f()}return null},m=function e(t,n,r,a){t&&(t.checked=!0,t.expanded=a,n.push(t),t.children&&t.children.map((function(t){e(t,n,r,a)})),r(c(n)))},b=function e(t,n,r,a){if(t){t.checked=!1,t.expanded=!1;var i=n.filter((function(e){return e.id!==t.id}));t.children&&t.children.map((function(t){e(t,n,r,a)})),r(c(i))}},h=function e(t,n){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=0;a<n.length;a++){var i=n[a];if(i.id===t)return[].concat(c(r),[i.id]);if(i.children&&i.children.length>0){var o=e(t,i.children,[].concat(c(r),[i.id]));if(o)return o}}return null},f=n(207),g=n.n(f),_=(n(364),function(e){var t=e.id,n=e.treeData,r=e.onChange,i=e.treeMode;return a.a.createElement(g.a,{data:n,id:t,keepOpenOnSelect:!0,keepTreeOnSearch:!0,keepChildrenOnSearch:!0,onChange:r,texts:{placeholder:"Select..."},mode:i?"hierarchical":"multiSelect"})});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 r,a,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=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}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,r=new Array(t);n<t;n++)r[n]=e[n];return r}t.a=function(e){var t=e.aria,n=void 0===t?{}:t,i=e.className,c=e.data,u=void 0===c?{}:c,d=e.id,f=e.returnAllSelected,g=void 0!==f&&f,M=e.treeData,v=e.onSelect,z=void 0===v?function(){}:v,O=Object(s.a)(n),k=Object(s.c)(u),A=o()(Object(s.b)("pb_multi_level_select"),Object(l.c)(e),i),x=y(Object(r.useState)(M),2),w=x[0],N=x[1],q=y(Object(r.useState)([]),2),E=q[0],j=q[1],W=y(Object(r.useState)([]),2),L=W[0],S=W[1];Object(r.useEffect)((function(){if(g){var e=E.filter((function(e){return e.checked})).filter((function(e,t,n){return t===n.findIndex((function(t){return t.id===e.id}))}));S(e)}}),[E]),Object(r.useEffect)((function(){var e,t,n=document.getElementById("pb_data_wrapper_".concat(d));n&&n.setAttribute("data-tree",JSON.stringify(L)),e=L,(t=document.getElementById("pb_data_wrapper_input_".concat(d)))&&(t.value=JSON.stringify(e)),g&&z(L)}),[L]);var T=Object(r.useMemo)((function(){return a.a.createElement(_,Object.assign({treeData:w,onChange:function(e,t){S(t),z(t)},id:d},e))}),[w]);return a.a.createElement("div",Object.assign({},O,k,{className:A,id:d}),a.a.createElement("input",{type:"hidden",id:"pb_data_wrapper_input_".concat(d),name:"pb_data_wrapper_input_".concat(d),value:""}),g?a.a.createElement(_,Object.assign({treeData:w,treeMode:g,id:d,onChange:function(e){var t=w.map((function(t){if(t.id===e._id)e.checked?m(t,E,j,!1):b(t,E,j,!1);else if(t.children){var n=p(t.children,e._id);if(n)if(e.checked){if(m(n,E,j,!1),e._parent)h(e._parent,w).forEach((function(e){p(w,e).expanded=!0}))}else if(b(n,E,j,!1),e._parent)h(e._parent,w).forEach((function(e){p(w,e).expanded=!0}))}return t}));N(t)}},e)):a.a.createElement(a.a.Fragment,null,T))}},function(e,t,n){"use strict";var r=n(186),a=n(202),i=n.n(a),o=n(203),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 r=document.createElement("input"),a="datePicker-".concat(t.element.id,"-").concat(e);r.className="datePicker-AMPM",r.id=a,r.name="datepicker-ampm",r.type="radio",r.value=e;var i=document.createElement("label"),o=document.createElement("div");return i.className="label-".concat(e.toLowerCase()),i.setAttribute("for",a),o.className="buffer",o.innerHTML=e,i.append(o),n.prepend(r),n.append(i),n},r=function(e){if(t.selectedDates.length){var n="pb_selectable_card_kit_checked_enabled",r=document.getElementById("datePicker-".concat(t.element.id,"-AM")),a=document.getElementById("datePicker-".concat(t.element.id,"-PM")),i=t.selectedDates[0].getHours()<12?"AM":"PM";e&&(r.checked=!1,a.checked=!1,a.checked="PM"===i,r.checked="AM"===i),"PM"===i?(a.parentElement.className=n,r.parentElement.className="pb_selectable_card_kit_enabled"):"AM"===i&&(r.parentElement.className=n,a.parentElement.className="pb_selectable_card_kit_enabled")}};return{onValueUpdate:function(){r(!0)},onOpen:function(){r(!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 a=document.createElement("div");a.className="pb_caption_kit_md",a.innerHTML=null==e?void 0:e.caption,t.timeContainer.prepend(a)}if(function(){t.amPM.style.display="none";var e=document.createElement("div");e.className="pb_form_group_kit";var r=n("AM");r.addEventListener("click",(function(){t.selectedDates[0].setHours(t.selectedDates[0].getHours()%12+0),t.setDate(t.selectedDates[0],!0)}));var a=n("PM");a.addEventListener("click",(function(){t.selectedDates[0].setHours(t.selectedDates[0].getHours()%12+12),t.setDate(t.selectedDates[0],!0)})),e.prepend(r),e.append(a);var i=document.createElement("div");i.className="meridiem",i.append(e),t.timeContainer.append(i)}(),r(!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,a,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(r.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(){X()}],plugins:(a=[],"month"===E||A.length>0?a.push(i()({shorthand:!0,dateFormat:"F Y",altFormat:"F Y"})):"week"===E&&a.push(s()()),h&&a.push(l({caption:T,showTimezone:j})),a),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 Y=document.querySelector("#year-".concat(k));Y.innerHTML=$,Y.value=B.currentYear,Y.addEventListener("input",(function(e){B.changeYear(Number(e.target.value))})),B.input.form&&B.input.form.addEventListener("reset",(function(){setTimeout((function(){Y.value=B.currentYear,B.monthsDropdownContainer.value=B.currentMonth,d&&(B.setDate(d),X())}),0)}));var X=function(){Y.value=B.currentYear};if(Y.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 r=n(0),a=n.n(r),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,r=new Array(t);n<t;n++)r[n]=e[n];return r}t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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",r]);return a.a.createElement("div",Object.assign({},f,g,{className:_,id:m}),!p&&a.a.createElement("div",{className:"pb_star_rating_number"},h),a.a.createElement("div",{className:"pb_star_rating_wrapper"},a.a.createElement("div",{className:"pb_star_rating_highlight"},c(Array(Math.floor(h))).map((function(e,t){return a.a.createElement(l.a,{fixedWidth:!1,icon:"star",key:t})})),h%1!=0&&a.a.createElement(l.a,{fixedWidth:!1,icon:"star-half"})),a.a.createElement("div",{className:"pb_star_rating_base"},a.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),a.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),a.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),a.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),a.a.createElement(l.a,{fixedWidth:!1,icon:"star"}))))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=function(){return r.createElement("svg",{viewBox:"0 0 200 250",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg"},r.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"}),r.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"}),r.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"}),r.createElement("path",{d:"M99.3 101.1h99.3v24.3H99.3z",fill:"#FFF"}))},u=function(){return r.createElement("svg",{viewBox:"0 0 242.9 242.9",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg"},r.createElement("circle",{cx:121.5,cy:121.5,r:121.5}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"a",x1:42.483,x2:200.309,y1:35.645,y2:35.645},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.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)"}}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"b",x1:17.407,x2:44.897,y1:132.179,y2:132.179},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.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)"}}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"c",x1:52.914,x2:189.715,y1:212.573,y2:212.573},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.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)"}}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"d",x1:31.123,x2:207.766,y1:136.159,y2:136.159},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.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)"}}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"e",x1:30.453,x2:213.794,y1:63.629,y2:63.629},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.createElement("path",{d:"M30.5 60.6h183.3v6.1H30.5z",style:{fill:"url(#e)"}}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"f",x1:196.676,x2:225.538,y1:132.923,y2:132.923},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.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,r=e.badge,i=void 0===r?"million-dollar":r,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?a.a.createElement(u,null):a.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 a.a.createElement("div",Object.assign({},_,y,{className:M,id:b}),a.a.createElement("div",{className:"pb_user_badge_wrapper"},g))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(52),u=n(14),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,r=e.dark,i=void 0!==r&&r,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 a.a.createElement(a.a.Fragment,null,n&&a.a.createElement(a.a.Fragment,null,a.a.createElement(u.a,{color:"light",key:Math.random(),tag:"span"},a.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 a.a.createElement("time",{dateTime:(n=e,new c.a({value:n}).toIso())},(t=new Date,M.getFullYear()==v.getFullYear()&&M.getFullYear()==t.getFullYear()?a.a.createElement(a.a.Fragment,null," ".concat(m(e,!1)," ")):a.a.createElement(a.a.Fragment,null," ".concat(m(e,!0)," "))));var t,n};return a.a.createElement("div",Object.assign({},A,{className:o()(k,Object(s.c)(e),z)}),a.a.createElement("div",{className:"pb_date_range_inline_wrapper"},"xs"==h&&a.a.createElement(a.a.Fragment,null,O(),a.a.createElement(d.a,{dark:i,tag:"span"},x(M)),a.a.createElement(d.a,{dark:i,tag:"span"},a.a.createElement(p.a,{className:"pb_date_range_inline_arrow",fixedWidth:!0,icon:"long-arrow-right"})),a.a.createElement(d.a,{dark:i,tag:"span"},x(v))),"sm"==h&&a.a.createElement(a.a.Fragment,null,O(),a.a.createElement(u.a,{dark:i,tag:"span"},x(M)),a.a.createElement(u.a,{color:"light",dark:i,tag:"span"},a.a.createElement(p.a,{className:"pb_date_range_inline_arrow",dark:i,fixedWidth:!0,icon:"long-arrow-right"})),a.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 r,a=n(146);var i=((r=a)&&r.__esModule?r:{default:r}).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 r=function(){};e.exports=r},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(14),u=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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),r);return a.a.createElement("div",Object.assign({},h,f,{className:g,id:m}),a.a.createElement(c.a,{className:"pb_person_first",tag:"span"},p),b&&a.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 r=n(98),a=n(132),i=n(133),o=n(135),s=n(136),l=[a.a,i.a,o.a,s.a],c=Object(r.a)({defaultModifiers:l})},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),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,r=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),r);return a.a.createElement("div",Object.assign({},_,y,{className:M,id:g}),a.a.createElement(c.a,{className:"pb_contact_kit",color:"light",tag:"span"},a.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,""),r=n.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/);return"extension"==t?n.match(/^\d{4}$/):r?[r[1]?"+1 ":"","(",r[2],") ",r[3],"-",r[4]].join(""):null}(b,m)," "),i&&a.a.createElement(u.a,{size:"xs",tag:"span",text:i})))}},function(e,t,n){"use strict";var r=n(43),a=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=a.h.reduce((function(e,n){return e[n]=function(e,t,n){var i=Object(r.a)(e),o=[a.f,a.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,[a.f,a.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 r={left:"right",right:"left",bottom:"top",top:"bottom"};function a(e){return e.replace(/left|right|bottom|top/g,(function(e){return r[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(71),u=n(12);t.a={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._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?[a(z)]:function(e){if(Object(i.a)(e)===u.a)return[];var t=a(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,r=n.placement,a=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)(r),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:a,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=a(D));var P=a(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[r]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}}},function(e,t,n){"use strict";var r=n(12),a=n(43),i=n(99);var o=n(91),s=n(103),l=n(78),c=n(63),u=n(71),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(a.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?r.m:r.f,I="y"===E?r.c:r.k,$="y"===E?"height":"width",F=W[E],Y=F+x[B],X=F-x[I],H=O?-S[$]/2:0,V=N===r.l?L[$]:S[$],U=N===r.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:V-ee-Z-C.mainAxis,ne=q?-L[$]/2+H+ee+Q+C.mainAxis:U+ee+Q+C.mainAxis,re=t.elements.arrow&&Object(l.a)(t.elements.arrow),ae=re?"y"===E?re.clientTop||0:re.clientLeft||0:0,ie=null!=(P=null==R?void 0:R[E])?P:0,oe=F+te-ie-ae,se=F+ne-ie,le=Object(o.a)(O?Object(p.b)(Y,oe):Y,F,O?Object(p.a)(X,se):X);W[E]=le,D[E]=le-F}if(g){var ce,ue="x"===E?r.m:r.f,de="x"===E?r.c:r.k,pe=W[j],me="y"===j?"height":"width",be=pe+x[ue],he=pe-x[de],fe=-1!==[r.m,r.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 r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),u=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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),r);return a.a.createElement("div",Object.assign({},y,M,{className:O,id:f}),a.a.createElement(c.a,{color:m?"lighter":"light"},a.a.createElement("span",{className:"".concat(v?"pb_legend_indicator_circle_custom":"pb_legend_indicator_circle"),style:z}),g&&a.a.createElement(u.a,{dark:m,size:4,tag:"span",text:" ".concat(g," ")})," ".concat(_," ")))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(2),o=n(5),s=n(11),l=n(16),c=n(54),u=n(148),d=n(65);t.a=function(e){e.date&&Object(o.a)("Date Time Stacked",["date"]);var t=e.date,n=e.datetime,r=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 a.a.createElement(s.a,Object.assign({inline:!1,vertical:"stretch"},e),a.a.createElement(l.a,null,a.a.createElement(d.a,{align:"right",bold:!0,dark:r,date:t||n})),a.a.createElement(c.a,{className:"date-time-padding",orientation:"vertical"}),a.a.createElement(l.a,null,a.a.createElement(u.a,{className:b,dark:r,date:t||n,timeZone:m})))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(11),u=n(54);t.a=function(e){var t=e.children,n=e.padding,r=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:r,paddingBottom:d,paddingX:m});return a.a.createElement(a.a.Fragment,null,_&&a.a.createElement(u.a,null),a.a.createElement("div",{className:"dialog-pseudo-footer"}),a.a.createElement(c.a,{className:o()(y,M,b),spacing:f},t))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5);t.a=function(e){var t=e.children,n=e.padding,r=void 0===n?"sm":n,i=e.className,c=Object(s.b)("dialog_body"),u=Object(l.c)(e,{padding:r});return a.a.createElement("div",{className:o()(c,u,i)},t)}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(8),u=function(e){var t=e.onClose;return a.a.createElement("div",{className:"pb_dialog_close_icon",onClick:t},a.a.createElement(c.a,{fixedWidth:!0,icon:"times"}))},d=n(131),p=n(11),m=n(54);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(r.useContext)(d.a),w=Object(s.b)("dialog_header"),N=Object(l.c)(e,{padding:g});return a.a.createElement("div",{className:"dialog_sticky_header"},a.a.createElement(p.a,Object.assign({},k,A,{className:o()(w,N,c),spacing:y}),i,v&&a.a.createElement(u,{onClose:x.onClose})),O&&a.a.createElement(m.a,null))}},function(e,t,n){e.exports=function(){"use strict";var e,t,n;function r(r,a){if(e)if(t){var i="var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk);",o={};e(o),n=a(o),"undefined"!=typeof window&&(n.workerUrl=window.URL.createObjectURL(new Blob([i],{type:"text/javascript"})))}else t=a;else e=a}return r(0,(function(e){var t=n;function n(e,t,n,r){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*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}function r(e,n,r,a){const i=new t(e,n,r,a);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,r=0;r<8;r++){var a=this.sampleCurveX(n)-e;if(Math.abs(a)<t)return n;var i=this.sampleCurveDerivativeX(n);if(Math.abs(i)<1e-6)break;n-=a/i}var o=0,s=1;for(n=e,r=0;r<20&&(a=this.sampleCurveX(n),!(Math.abs(a-e)<t));r++)e>a?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};const a=r(.25,.1,.25,1);function i(e,t,n){return Math.min(n,Math.max(t,e))}function o(e,t,n){const r=n-t,a=((e-t)%r+r)%r+t;return a===t?n:a}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 r={};for(const a in e)r[a]=t.call(n||this,e[a],a,e);return r}function d(e,t,n){const r={};for(const a in e)t.call(n||this,e[a],a,e)&&(r[a]=e[a]);return r}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,r,a=0,i=e.length,o=i-1;a<i;o=a++)n=e[a],r=e[o],t+=(r.x-n.x)*(n.y+r.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,r,a)=>{const i=r||a;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"),r=n.getContext("2d");if(!r)throw new Error("failed to create canvas 2d context");return n.width=e.width,n.height=e.height,r.drawImage(e,0,0,e.width,e.height),r.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),r=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=r,this},_rotateAround:function(e,t){var n=Math.cos(e),r=Math.sin(e),a=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=a,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,r){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=r}}const $=g()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function F(e,t){const n=new AbortController,r=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:$(),signal:n.signal});let a=!1,i=!1;return"json"===e.type&&r.headers.set("Accept","application/json"),i||(Date.now(),fetch(r).then(n=>n.ok?((n,r,o)=>{("arrayBuffer"===e.type?n.arrayBuffer():"json"===e.type?n.json():n.text()).then(e=>{i||(a=!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(r=>t(new I(n.status,n.statusText,e.url,r)))).catch(e=>{20!==e.code&&t(new Error(e.message))})),{cancel:()=>{i=!0,a||n.abort()}}}const Y=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 r=n.response;if("json"===e.type)try{r=JSON.parse(n.response)}catch(e){return t(e)}t(null,r,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else{const r=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});t(new I(n.status,n.statusText,e.url,r))}},n.send(e.body),{cancel:()=>n.abort()}}(e,t)},X=function(e,t){return Y(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 V="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let U,G;U=[],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 U.push(n),n}G++;let n=!1;const r=()=>{if(!n)for(n=!0,G--;U.length&&G<w.MAX_PARALLEL_IMAGE_REQUESTS;){const e=U.shift(),{requestParameters:t,callback:n,cancelled:r}=e;r||(e.cancel=K(t,n).cancel)}},a=X(e,(e,n,a,i)=>{r(),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=V})},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 r=new Blob([new Uint8Array(e)],{type:"image/png"});n.src=e.byteLength?URL.createObjectURL(r):V}(e,t)}(n,(e,n)=>{null!=e?t(e):null!=n&&t(null,n,{cacheControl:a,expires:i})})});return{cancel:()=>{a.cancel(),r()}}};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 r=n[e].indexOf(t);-1!==r&&n[e].splice(r,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 r=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const t of r)Z(n,t,this._oneTimeListeners),t.call(this,e);const a=this._eventedParent;a&&(s(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),a.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 re{constructor(e,t,n,r){this.message=(e?e+": ":"")+n,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function ae(e){const t=e.value;return t?[new re(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 r=n.indexOf("("),a=n.indexOf(")");if(-1!==r&&a+1===n.length){var i=n.substr(0,r),o=n.substr(r+1,a-(r+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,r=1){this.r=e,this.g=t,this.b=n,this.a=r}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,r]=this.toArray();return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(n)},${r})`}toArray(){const{r:e,g:t,b:n,a:r}=this;return 0===r?[0,0,0,0]:[255*e/r,255*t/r,255*n/r,r]}}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,r,a){this.text=e,this.image=t,this.scale=n,this.fontStack=r,this.textColor=a}}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,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,n,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,n,r]:[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 r=Ie(n);const a=t.expectedType;return"array"!==r.kind||0!==r.N||!a||"array"!==a.kind||"number"==typeof a.N&&0!==a.N||(r=a),new Fe(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Ye{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Xe={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,r=1;const a=e[0];if("array"===a){let a,i;if(e.length>2){const n=e[1];if("string"!=typeof n||!(n in Xe)||"object"===n)return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=Xe[n],r++}else a=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],r++}n=ve(a,i)}else{if(!Xe[a])throw new Error("Types doesn't contain name = "+a);n=Xe[a]}const i=[];for(;r<e.length;r++){const n=t.parse(e[r],r,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 Ye(`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 Ve={"to-boolean":me,"to-color":be,"to-number":de,"to-string":pe};class Ue{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(!Ve[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 r=Ve[n],a=[];for(let n=1;n<e.length;n++){const r=t.parse(e[n],n,fe);if(!r)return null;a.push(r)}return new Ue(r,a)}evaluate(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){let t,n;for(const r of this.args){if(t=r.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 Ye(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 r=Re.parse(t);if(r)return r}throw new Ye(`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 r=Number(t);if(!isNaN(r))return r}throw new Ye(`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,r){this.name=e,this.type=t,this._evaluate=n,this.args=r}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],r=Je.definitions[n];if(!r)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const a=Array.isArray(r)?r[0]:r.type,i=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=i.filter(([t])=>!Array.isArray(t)||t.length===e.length-1);let s=null;for(const[r,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],a=Array.isArray(r)?r[t-1]:r.type,i=s.parse(n,1+o.length,a);if(!i){l=!0;break}o.push(i)}if(!l)if(Array.isArray(r)&&r.length!==o.length)s.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){const t=Array.isArray(r)?r[e]:r.type,n=o[e];s.concat(e+1).checkSubtype(t,n.type)}if(0===s.errors.length)return new Je(n,a,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(" | "),r=[];for(let n=1;n<e.length;n++){const a=t.parse(e[n],1+r.length);if(!a)return null;r.push(ze(a.type))}t.error(`Expected arguments of type ${n}, but found (${r.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 r=t.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,me);if(!r)return null;const a=t.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,me);if(!a)return null;let i=null;return n.locale&&(i=t.parse(n.locale,1,pe),!i)?null:new Ze(r,a,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,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,a=Math.pow(2,t.z);return[Math.round(n*a*Qe),Math.round(r*a*Qe)]}function rt(e,t,n){const r=e[0]-t[0],a=e[1]-t[1],i=e[0]-n[0],o=e[1]-n[1];return r*o-i*a==0&&r*i<=0&&a*o<=0}function at(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(rt(e,s[t],s[t+1]))return!1;(a=s[t])[1]>(r=e)[1]!=(i=s[t+1])[1]>r[1]&&r[0]<(i[0]-a[0])*(r[1]-a[1])/(i[1]-a[1])+a[0]&&(n=!n)}}var r,a,i;return n}function it(e,t){for(let n=0;n<t.length;n++)if(at(e,t[n]))return!0;return!1}function ot(e,t,n,r){const a=r[0]-n[0],i=r[1]-n[1],o=(e[0]-n[0])*i-a*(e[1]-n[1]),s=(t[0]-n[0])*i-a*(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=[(a=t)[0]-(r=e)[0],a[1]-r[1]])[1]-s[1]*l[0]&&ot(r,a,i,o)&&ot(i,o,r,a))return!0;var r,a,i,o,s,l;return!1}function lt(e,t){for(let n=0;n<e.length;++n)if(!at(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 r=[];for(let a=0;a<e.length;a++){const i=[];for(let r=0;r<e[a].length;r++){const o=nt(e[a][r],n);et(t,o),i.push(o)}r.push(i)}return r}function dt(e,t,n){const r=[];for(let a=0;a<e.length;a++){const i=ut(e[a],t,n);r.push(i)}return r}function pt(e,t,n,r){if(e[0]<n[0]||e[0]>n[2]){const t=.5*r;let a=e[0]-n[0]>t?-r:n[0]-e[0]>t?r:0;0===a&&(a=e[0]-n[2]>t?-r:n[2]-e[0]>t?r:0),e[0]+=a}et(t,e)}function mt(e,t,n,r){const a=Math.pow(2,r.z)*Qe,i=[r.x*Qe,r.y*Qe],o=[];for(const r of e)for(const e of r){const r=[e.x+i[0],e.y+i[1]];pt(r,t,n,a),o.push(r)}return o}function bt(e,t,n,r){const a=Math.pow(2,r.z)*Qe,i=[r.x*Qe,r.y*Qe],o=[];for(const n of e){const e=[];for(const r of n){const n=[r.x+i[0],r.y+i[1]];et(t,n),e.push(n)}o.push(e)}if(t[2]-t[0]<=a/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const e of o)for(const r of e)pt(r,t,n,a)}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],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if("Polygon"===t.type){const i=ut(t.coordinates,r,a),o=mt(e.geometry(),n,r,a);if(!tt(n,r))return!1;for(const e of o)if(!at(e,i))return!1}if("MultiPolygon"===t.type){const i=dt(t.coordinates,r,a),o=mt(e.geometry(),n,r,a);if(!tt(n,r))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],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if("Polygon"===t.type){const i=ut(t.coordinates,r,a),o=bt(e.geometry(),n,r,a);if(!tt(n,r))return!1;for(const e of o)if(!lt(e,i))return!1}if("MultiPolygon"===t.type){const i=dt(t.coordinates,r,a),o=bt(e.geometry(),n,r,a);if(!tt(n,r))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,r=new ce,a=[]){this.registry=e,this.path=t,this.key=t.map(e=>`[${e}]`).join(""),this.scope=r,this.errors=a,this.expectedType=n}parse(e,t,n,r,a={}){return t?this.concat(t,n,r)._parse(e,a):this._parse(e,a)}_parse(e,t){function n(e,t,n){return"assert"===n?new He(t,[e]):"coerce"===n?new Ue(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 r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const a=this.registry[r];if(a){let r=a.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,a=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==a.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==a.kind&&"string"!==a.kind)if("padding"!==e.kind||"value"!==a.kind&&"number"!==a.kind&&"array"!==a.kind){if(this.checkSubtype(e,a))return null}else r=n(r,e,t.typeAnnotation||"coerce");else r=n(r,e,t.typeAnnotation||"coerce");else r=n(r,e,t.typeAnnotation||"assert")}if(!(r instanceof Fe)&&"resolvedImage"!==r.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 Ue||t instanceof He;let r=!0;return t.eachChild(t=>{r=n?r&&e(t):r&&t instanceof Fe}),!!r&&ft(t)&&_t(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(r)){const t=new Ke;try{r=new Fe(r.type,r.evaluate(t))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". 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 r="number"==typeof e?this.path.concat(e):this.path,a=n?this.scope.concat(n):this.scope;return new Mt(this.registry,r,t||null,a,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 r,a,i=0,o=n,s=0;for(;i<=o;)if(s=Math.floor((i+o)/2),r=e[s],a=e[s+1],r<=t){if(s===n||t<a)return s;i=s+1}else{if(!(r>t))throw new Ye("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 r=[];let a=null;t.expectedType&&"value"!==t.expectedType.kind&&(a=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(r.length&&r[r.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,a);if(!c)return null;a=a||c.type,r.push([i,c])}return new zt(a,n,r)}evaluate(e){const t=this.labels,n=this.outputs;if(1===t.length)return n[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);const a=t.length;return r>=t[a-1]?n[a-1].evaluate(e):n[vt(t,r)].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,r)=>Ot(e,t[r],n))},padding:function(e,t,n){const r=e.values,a=t.values;return new Re([Ot(r[0],a[0],n),Ot(r[1],a[1],n),Ot(r[2],a[2],n),Ot(r[3],a[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),r=jt(e.b),a=Nt((.4124564*t+.3575761*n+.1804375*r)/.95047),i=Nt((.2126729*t+.7151522*n+.072175*r)/1);return{l:116*i-16,a:500*(a-i),b:200*(i-Nt((.0193339*t+.119192*n+.9503041*r)/1.08883)),alpha:e.a}}function Lt(e){let t=(e.l+16)/116,n=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*qt(t),n=.95047*qt(n),r=1.08883*qt(r),new Le(Et(3.2404542*n-1.5371385*t-.4985314*r),Et(-.969266*n+1.8760108*t+.041556*r),Et(.0556434*n-.2040259*t+1.0572252*r),e.alpha)}function St(e,t,n){const r=t-e;return e+n*(r>180||r<-180?r-360*Math.round(r/360):r)}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:r}=Wt(e),a=Math.atan2(r,n)*wt;return{h:a<0?a+360:a,c:Math.sqrt(n*n+r*r),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,r,a){this.type=e,this.operator=t,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of a)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,n,r,a){let i=0;if("exponential"===e.name)i=Pt(n,e.base,r,a);else if("linear"===e.name)i=Pt(n,1,r,a);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,r,a))}return i}static parse(e,t){let[n,r,a,...i]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error("Unknown interpolation type "+String(r[0]),1,0);{const e=r.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);r={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(a=t.parse(a,2,de),!a)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],r=i[e+1],a=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.',a);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.',a);const c=t.parse(r,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,r,a,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 r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);const a=t.length;if(r>=t[a-1])return n[a-1].evaluate(e);const i=vt(t,r),o=Dt.interpolationFactor(this.interpolation,r,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,r){const a=r-n,i=e-n;return 0===a?0:1===t?i/a:(Math.pow(t,i)-1)/(Math.pow(t,a)-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 r=t.expectedType;r&&"value"!==r.kind&&(n=r);const a=[];for(const r of e.slice(1)){const e=t.parse(r,1+a.length,n,void 0,{typeAnnotation:"omit"});if(!e)return null;n=n||e.type,a.push(e)}if(!n)throw new Error("No output type");const i=r&&a.some(e=>ke(r,e.type));return new Bt(i?fe:n,a)}evaluate(e){let t,n=null,r=0;for(const a of this.args)if(r++,n=a.evaluate(e),n&&n instanceof De&&!n.available&&(t||(t=n.name),n=null,r===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 r=1;r<e.length-1;r+=2){const a=e[r];if("string"!=typeof a)return t.error(`Expected string, but found ${typeof a} instead.`,r);if(/[^a-zA-Z0-9_]/.test(a))return t.error("Variable names must contain only alphanumeric characters or '_'.",r);const i=t.parse(e[r+1],r+1);if(!i)return null;n.push([a,i])}const r=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return r?new It(n,r):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),r=t.parse(e[2],2,ve(t.expectedType||fe));return n&&r?new $t(r.type.itemType,n,r):null}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new Ye(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new Ye(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new Ye(`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),r=t.parse(e[2],2,fe);return n&&r?Ae(n.type,[me,pe,de,ue,fe])?new Ft(n,r):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 Ye(`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 Ye(`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 Yt{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),r=t.parse(e[2],2,fe);if(!n||!r)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 a=t.parse(e[3],3,de);return a?new Yt(n,r,a):null}return new Yt(n,r)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!xe(t,["boolean","string","number","null"]))throw new Ye(`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 Ye(`Expected second argument to be of type array or string, but found ${ze(Ie(n))} instead.`);if(this.fromIndex){const r=this.fromIndex.evaluate(e);return n.indexOf(t,r)}return n.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Xt{constructor(e,t,n,r,a,i){this.inputType=e,this.type=t,this.input=n,this.cases=r,this.outputs=a,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,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const a={},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!==a[String(e)])return c.error("Branch labels must be unique.");a[String(e)]=i.length}const u=t.parse(l,o,r);if(!u)return null;r=r||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,r);return s?"value"!==o.type.kind&&t.concat(1).checkSubtype(n,o.type)?null:new Xt(n,r,o,a,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 r=[];for(let a=1;a<e.length-1;a+=2){const i=t.parse(e[a],a,me);if(!i)return null;const o=t.parse(e[a+1],a+1,n);if(!o)return null;r.push([i,o]),n=n||o.type}const a=t.parse(e[e.length-1],e.length-1,n);if(!a)return null;if(!n)throw new Error("Can't infer output type");return new Ht(n,r,a)}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 Vt{constructor(e,t,n,r){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=r}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),r=t.parse(e[2],2,de);if(!n||!r)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 a=t.parse(e[3],3,de);return a?new Vt(n.type,n,r,a):null}return new Vt(n.type,n,r)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!xe(t,["string","array"]))throw new Ye(`Expected first argument to be of type array or string, but found ${ze(Ie(t))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(e);return t.slice(n,r)}return t.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ut(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,r){return 0===r.compare(t,n)}function Kt(e,t,n){const r="=="!==e&&"!="!==e;return class a{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(!Ut(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(!Ut(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)}'.`);r&&("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 a(i,o,s)}evaluate(a){const i=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(r&&this.hasUntypedArgument){const t=Ie(i),n=Ie(o);if(t.kind!==n.kind||"string"!==t.kind&&"number"!==t.kind)throw new Ye(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=Ie(i),n=Ie(o);if("string"!==e.kind||"string"!==n.kind)return t(a,i,o)}return this.collator?n(a,i,o,this.collator.evaluate(a)):t(a,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,r){return!Gt(0,t,n,r)})),Qt=Kt("<",(function(e,t,n){return t<n}),(function(e,t,n,r){return r.compare(t,n)<0})),en=Kt(">",(function(e,t,n){return t>n}),(function(e,t,n,r){return r.compare(t,n)>0})),tn=Kt("<=",(function(e,t,n){return t<=n}),(function(e,t,n,r){return r.compare(t,n)<=0})),nn=Kt(">=",(function(e,t,n){return t>=n}),(function(e,t,n,r){return r.compare(t,n)>=0}));class rn{constructor(e,t,n,r,a){this.type=pe,this.number=e,this.locale=t,this.currency=n,this.minFractionDigits=r,this.maxFractionDigits=a}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 r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let a=null;if(r.locale&&(a=t.parse(r.locale,1,pe),!a))return null;let i=null;if(r.currency&&(i=t.parse(r.currency,1,pe),!i))return null;let o=null;if(r["min-fraction-digits"]&&(o=t.parse(r["min-fraction-digits"],1,de),!o))return null;let s=null;return r["max-fraction-digits"]&&(s=t.parse(r["max-fraction-digits"],1,de),!s)?null:new rn(n,a,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 an{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 r=[];let a=!1;for(let n=1;n<=e.length-1;++n){const i=e[n];if(a&&"object"==typeof i&&!Array.isArray(i)){a=!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=r[r.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'.");a=!0,r.push({content:i,scale:null,font:null,textColor:null})}}return new an(r)}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 Ye(`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:an,image:on,in:Ft,"index-of":Yt,interpolate:Dt,"interpolate-hcl":Dt,"interpolate-lab":Dt,length:sn,let:It,literal:Fe,match:Xt,number:He,"number-format":rn,object:He,slice:Vt,step:zt,string:He,"to-boolean":Ue,"to-color":Ue,"to-number":Ue,"to-string":Ue,var:yt,within:ht};function cn(e,[t,n,r,a]){t=t.evaluate(e),n=n.evaluate(e),r=r.evaluate(e);const i=a?a.evaluate(e):1,o=Pe(t,n,r,i);if(o)throw new Ye(o);return new Le(t/255*i,n/255*i,r/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,r,a){return vn(typeof n===a?r[n]:void 0,e.default,t.default)}function On(e,t,n){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 a=vt(e.stops.map(e=>e[0]),n);return e.stops[a][1]}function kn(e,t,n){const r=void 0!==e.base?e.base:1;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 i=vt(e.stops.map(e=>e[0]),n),o=function(e,t,n,r){const a=r-n,i=e-n;return 0===a?0:1===t?i/a:(Math.pow(t,i)-1)/(Math.pow(t,a)-1)}(n,r,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 Ye(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 r of t)n+=r.evaluate(e);return n}],"*":[de,pn(de),(e,t)=>{let n=1;for(const r of t)n*=r.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 r=e.properties()[t.value],a=n.value;return typeof r==typeof a&&r<a}],"filter-id-<":[me,[fe],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n<r}],"filter->":[me,[pe,fe],(e,[t,n])=>{const r=e.properties()[t.value],a=n.value;return typeof r==typeof a&&r>a}],"filter-id->":[me,[fe],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n>r}],"filter-<=":[me,[pe,fe],(e,[t,n])=>{const r=e.properties()[t.value],a=n.value;return typeof r==typeof a&&r<=a}],"filter-id-<=":[me,[fe],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n<=r}],"filter->=":[me,[pe,fe],(e,[t,n])=>{const r=e.properties()[t.value],a=n.value;return typeof r==typeof a&&r>=a}],"filter-id->=":[me,[fe],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n>=r}],"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,r){for(;n<=r;){const a=n+r>>1;if(t[a]===e)return!0;t[a]>e?r=a-1:n=a+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,r,a,i){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=i,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,r,a,i){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=a||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 Ye(`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),r=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?mn(new xn(r,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,r,a,i){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,a,i)}evaluate(e,t,n,r,a,i){return this._styleExpression.evaluate(e,t,n,r,a,i)}}class En{constructor(e,t,n,r){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent="camera"!==e&&!gt(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,n,r,a,i){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,a,i)}evaluate(e,t,n,r,a,i){return this._styleExpression.evaluate(e,t,n,r,a,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 r=n.value.expression,a=ft(r);if(!a&&!hn(t))return bn([new le("","data expressions not supported")]);const i=_t(r,["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 r of t.args)if(n=e(r),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 r=e(t);r instanceof le?n=r:!n&&r?n=new le("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&r&&n!==r&&(n=new le("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}(r);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(a?"camera":"composite",n.value,o.labels,o instanceof Dt?o.interpolation:void 0):new qn(a?"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 r="color"===n.type,a=t.stops&&"object"==typeof t.stops[0][0],i=a||!(a||void 0!==t.property),o=t.type||(gn(n)?"exponential":"interval");if(r||"padding"===n.type){const e=r?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(a){const r={},a=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],i=n[0].zoom;void 0===r[i]&&(r[i]={zoom:i,type:t.type,property:t.property,default:t.default,stops:[]},a.push(i)),r[i].stops.push([n[0].value,n[1]])}const i=[];for(const t of a)i.push([r[t].zoom,e(r[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},r)=>kn({stops:i,base:t.base},n,e).evaluate(e,r)}}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,r){const a=r&&r.properties?r.properties[t.property]:void 0;return void 0===a?vn(t.default,n.default):s(t,n,a,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,r=e.valueSpec||{},a=e.objectElementValidators||{},i=e.style,o=e.styleSpec;let s=[];const l=_n(n);if("object"!==l)return[new re(t,n,`object expected, ${l} found`)];for(const e in n){const l=e.split(".")[0],c=r[l]||r["*"];let u;if(a[l])u=a[l];else if(r[l])u=or;else if(a["*"])u=a["*"];else{if(!r["*"]){s.push(new re(t,n[e],`unknown property "${e}"`));continue}u=or}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 r)a[e]||r[e].required&&void 0===r[e].default&&void 0===n[e]&&s.push(new re(t,n,`missing required property "${e}"`));return s}function Sn(e){const t=e.value,n=e.valueSpec,r=e.style,a=e.styleSpec,i=e.key,o=e.arrayElementValidator||or;if("array"!==_n(t))return[new re(i,t,`array expected, ${_n(t)} found`)];if(n.length&&t.length!==n.length)return[new re(i,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new re(i,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let s={type:n.value,values:n.values};a.$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:r,styleSpec:a,key:`${i}[${e}]`}));return l}function Tn(e){const t=e.key,n=e.value,r=e.valueSpec;let a=_n(n);return"number"===a&&n!=n&&(a="NaN"),"number"!==a?[new re(t,n,`number expected, ${a} found`)]:"minimum"in r&&n<r.minimum?[new re(t,n,`${n} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&n>r.maximum?[new re(t,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]}function Cn(e){const t=e.valueSpec,n=oe(e.value.type);let r,a,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 re(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const r=e.value;return t=t.concat(Sn({key:e.key,value:r,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:d})),"array"===_n(r)&&0===r.length&&t.push(new re(e.key,r,"array must have at least one stop")),t},default:function(e){return or({key:e.key,value:e.value,valueSpec:t,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===n&&s&&u.push(new re(e.key,e.value,'missing required property "property"')),"identity"===n||e.value.stops||u.push(new re(e.key,e.value,'missing required property "stops"')),"exponential"===n&&e.valueSpec.expression&&!gn(e.valueSpec)&&u.push(new re(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!hn(e.valueSpec)?u.push(new re(e.key,e.value,"property functions not supported")):s&&!fn(e.valueSpec)&&u.push(new re(e.key,e.value,"zoom functions not supported"))),"categorical"!==n&&!c||void 0!==e.value.property||u.push(new re(e.key,e.value,'"property" property is required')),u;function d(e){let n=[];const r=e.value,s=e.key;if("array"!==_n(r))return[new re(s,r,`array expected, ${_n(r)} found`)];if(2!==r.length)return[new re(s,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==_n(r[0]))return[new re(s,r,`object expected, ${_n(r[0])} found`)];if(void 0===r[0].zoom)return[new re(s,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new re(s,r,"object stop key must have value")];if(i&&i>oe(r[0].zoom))return[new re(s,r[0].zoom,"stop zoom values must appear in ascending order")];oe(r[0].zoom)!==i&&(i=oe(r[0].zoom),a=void 0,o={}),n=n.concat(Ln({key:s+"[0]",value:r[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Tn,value:p}}))}else n=n.concat(p({key:s+"[0]",value:r[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},r));return wn(se(r[1]))?n.concat([new re(s+"[1]",r[1],"expressions are not allowed in function stops.")]):n.concat(or({key:s+"[1]",value:r[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(r){if(s!==r)return[new re(e.key,c,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new re(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==n){let r=`number expected, ${s} found`;return hn(t)&&void 0===n&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new re(e.key,c,r)]}return"categorical"!==n||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===s&&void 0!==a&&l<a?[new re(e.key,c,"stop domain values must appear in ascending order")]:(a=l,"categorical"===n&&l in o?[new re(e.key,c,"stop domain values must be unique")]:(o[l]=!0,[])):[new re(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 re(`${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 re(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 re(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!gt(n))return[new re(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 re(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!ft(n))return[new re(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,r=e.valueSpec,a=[];return Array.isArray(r.values)?-1===r.values.indexOf(oe(n))&&a.push(new re(t,n,`expected one of [${r.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(r.values).indexOf(oe(n))&&a.push(new re(t,n,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(n)} found`)),a}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=Yn(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,r)=>t.value.evaluate(e,n,{},r),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 Yn(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?Xn(e[1],e[2],"=="):"!="===t?Un(Xn(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?Xn(e[1],e[2],t):"any"===t?(n=e.slice(1),["any"].concat(n.map(Yn))):"all"===t?["all"].concat(e.slice(1).map(Yn)):"none"===t?["all"].concat(e.slice(1).map(Yn).map(Un)):"in"===t?Hn(e[1],e.slice(2)):"!in"===t?Un(Hn(e[1],e.slice(2))):"has"===t?Vn(e[1]):"!has"===t?Un(Vn(e[1])):"within"!==t||e;var n}function Xn(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 Vn(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Un(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,r=t.key;if("array"!==_n(n))return[new re(r,n,`array expected, ${_n(n)} found`)];const a=t.styleSpec;let i,o=[];if(n.length<1)return[new re(r,n,"filter array must have at least 1 element")];switch(o=o.concat(Dn({key:r+"[0]",value:n[0],valueSpec:a.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 re(r,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":3!==n.length&&o.push(new re(r,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 re(r+"[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:`${r}[${e}]`,value:n[e],valueSpec:a.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&o.push(new re(`${r}[${e}]`,n[e],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let a=1;a<n.length;a++)o=o.concat(e({key:`${r}[${a}]`,value:n[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=_n(n[1]),2!==n.length?o.push(new re(r,n,`filter array for "${n[0]}" operator must have 2 elements`)):"string"!==i&&o.push(new re(r+"[1]",n[1],`string expected, ${i} found`));break;case"within":i=_n(n[1]),2!==n.length?o.push(new re(r,n,`filter array for "${n[0]}" operator must have 2 elements`)):"object"!==i&&o.push(new re(r+"[1]",n[1],`object expected, ${i} found`))}return o}(e)}function Kn(e,t){const n=e.key,r=e.style,a=e.styleSpec,i=e.value,o=e.objectKey,s=a[`${t}_${e.layerType}`];if(!s)return[];const l=o.match(/^(.*)-transition$/);if("paint"===t&&l&&s[l[1]]&&s[l[1]].transition)return or({key:n,value:i,valueSpec:a.transition,style:r,styleSpec:a});const c=e.valueSpec||s[o];if(!c)return[new re(n,i,`unknown property "${o}"`)];let u;if("string"===_n(i)&&hn(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(i)))return[new re(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&&r&&!r.glyphs&&d.push(new re(n,i,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&yn(se(i))&&"identity"===oe(i.type)&&d.push(new re(n,i,'"text-font" does not support identity functions'))),d.concat(or({key:e.key,value:i,valueSpec:c,style:r,styleSpec:a,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,r=e.key,a=e.style,i=e.styleSpec;n.type||n.ref||t.push(new re(r,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=a.layers[o];oe(e.id)===i&&t.push(new re(r,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 re(r,n[e],`"${e}" is prohibited for ref layers`))}),a.layers.forEach(t=>{oe(t.id)===s&&(e=t)}),e?e.ref?t.push(new re(r,n.ref,"ref cannot reference another ref layer")):o=oe(e.type):t.push(new re(r,n.ref,`ref layer "${s}" not found`))}else if("background"!==o)if(n.source){const e=a.sources&&a.sources[n.source],i=e&&oe(e.type);e?"vector"===i&&"raster"===o?t.push(new re(r,n.source,`layer "${n.id}" requires a raster source`)):"raster"===i&&"raster"!==o?t.push(new re(r,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==i||n["source-layer"]?"raster-dem"===i&&"hillshade"!==o?t.push(new re(r,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 re(r,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new re(r,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new re(r,n.source,`source "${n.source}" not found`))}else t.push(new re(r,n,'missing required property "source"'));return t=t.concat(Ln({key:r,value:n,valueSpec:i.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=>[],type:()=>or({key:r+".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 er(e){const t=e.value,n=e.key,r=_n(t);return"string"!==r?[new re(n,t,`string expected, ${r} found`)]:[]}const tr={promoteId:function({key:e,value:t}){if("string"===_n(t))return er({key:e,value:t});{const n=[];for(const r in t)n.push(...er({key:`${e}.${r}`,value:t[r]}));return n}}};function nr(e){const t=e.value,n=e.key,r=e.styleSpec,a=e.style;if(!t.type)return[new re(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:r["source_"+i.replace("-","_")],style:e.style,styleSpec:r,objectElementValidators:tr}),o;case"geojson":if(o=Ln({key:n,value:t,valueSpec:r.source_geojson,style:a,styleSpec:r,objectElementValidators:tr}),t.cluster)for(const e in t.clusterProperties){const[r,a]=t.clusterProperties[e],i="string"==typeof r?[r,["accumulated"],["get",e]]:r;o.push(...Rn({key:`${n}.${e}.map`,value:a,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:r.source_video,style:a,styleSpec:r});case"image":return Ln({key:n,value:t,valueSpec:r.source_image,style:a,styleSpec:r});case"canvas":return[new re(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:a,styleSpec:r})}}function rr(e){const t=e.value,n=e.styleSpec,r=n.light,a=e.style;let i=[];const o=_n(t);if(void 0===t)return i;if("object"!==o)return i=i.concat([new re("light",t,`object expected, ${o} found`)]),i;for(const e in t){const o=e.match(/^(.*)-transition$/);i=i.concat(o&&r[o[1]]&&r[o[1]].transition?or({key:e,value:t[e],valueSpec:n.transition,style:a,styleSpec:n}):r[e]?or({key:e,value:t[e],valueSpec:r[e],style:a,styleSpec:n}):[new re(e,t[e],`unknown property "${e}"`)])}return i}function ar(e){const t=e.value,n=e.styleSpec,r=n.terrain,a=e.style;let i=[];const o=_n(t);if(void 0===t)return i;if("object"!==o)return i=i.concat([new re("terrain",t,`object expected, ${o} found`)]),i;for(const e in t)i=i.concat(r[e]?or({key:e,value:t[e],valueSpec:r[e],style:a,styleSpec:n}):[new re(e,t[e],`unknown property "${e}"`)]);return i}const ir={"*":()=>[],array:Sn,boolean:function(e){const t=e.value,n=e.key,r=_n(t);return"boolean"!==r?[new re(n,t,`boolean expected, ${r} found`)]:[]},number:Tn,color:function(e){const t=e.key,n=e.value,r=_n(n);return"string"!==r?[new re(t,n,`color expected, ${r} found`)]:null===we(n)?[new re(t,n,`color expected, "${n}" found`)]:[]},constants:ae,enum:Dn,filter:Gn,function:Cn,layer:Qn,object:Ln,source:nr,light:rr,terrain:ar,string:er,formatted:function(e){return 0===er(e).length?[]:Rn(e)},resolvedImage:function(e){return 0===er(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 re(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];const e={type:"number"};let r=[];for(let a=0;a<n.length;a++)r=r.concat(or({key:`${t}[${a}]`,value:n[a],valueSpec:e}));return r}return Tn({key:t,value:n,valueSpec:{}})}};function or(e){const t=e.value,n=e.valueSpec,r=e.styleSpec;return n.expression&&yn(oe(t))?Cn(e):n.expression&&wn(se(t))?Rn(e):n.type&&ir[n.type]?ir[n.type](e):Ln(ie({},e,{valueSpec:n.type?r[n.type]:n}))}function sr(e){const t=e.value,n=e.key,r=er(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new re(n,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new re(n,t,'"glyphs" url must include a "{range}" token'))),r}function lr(e,t=ne){let n=[];return n=n.concat(or({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:sr,"*":()=>[]}})),e.constants&&(n=n.concat(ae({key:"constants",value:e.constants,style:e,styleSpec:t}))),cr(n)}function cr(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function ur(e){return function(...t){return cr(e.apply(this,t))}}lr.source=ur(nr),lr.light=ur(rr),lr.terrain=ur(ar),lr.layer=ur(Qn),lr.filter=ur(Gn),lr.paintProperty=ur(Jn),lr.layoutProperty=ur(Zn);const dr=lr,pr=dr.light,mr=dr.paintProperty,br=dr.layoutProperty;function hr(e,t){let n=!1;if(t&&t.length)for(const r of t)e.fire(new ee(new Error(r.message))),n=!0;return n}class fr{constructor(e,t,n){const r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const a=new Int32Array(this.arrayBuffer);e=a[0],this.d=(t=a[1])+2*(n=a[2]);for(let e=0;e<this.d*this.d;e++){const t=a[3+e],n=a[3+e+1];r.push(t===n?null:a.subarray(t,n))}const i=a[3+r.length+1];this.keys=a.subarray(a[3+r.length],i),this.bboxes=a.subarray(i),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let e=0;e<this.d*this.d;e++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;const a=n/t*e;this.min=-a,this.max=e+a}insert(e,t,n,r,a){this._forEachCell(t,n,r,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(a)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,n,r,a,i){this.cells[a].push(i)}query(e,t,n,r,a){const i=this.min,o=this.max;if(e<=i&&t<=i&&o<=n&&o<=r&&!a)return Array.prototype.slice.call(this.keys);{const i=[];return this._forEachCell(e,t,n,r,this._queryCell,i,{},a),i}}_queryCell(e,t,n,r,a,i,o,s){const l=this.cells[a];if(null!==l){const a=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]&&r>=c[l+1])?(o[d]=!0,i.push(a[d])):o[d]=!1}}}}_forEachCell(e,t,n,r,a,i,o,s){const l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(n),d=this._convertToCellCoord(r);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)))&&a.call(this,e,t,n,r,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 r=new Int32Array(t+n+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let a=t;for(let t=0;t<e.length;t++){const n=e[t];r[3+t]=a,r.set(n,a),a+=n.length}return r[3+e.length]=a,r.set(this.keys,a),a+=this.keys.length,r[3+e.length+1]=a,r.set(this.bboxes,a),a+=this.bboxes.length,r.buffer}static serialize(e,t){const n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new fr(e.buffer)}}const gr={};function _r(e,t,n={}){if(gr[e])throw new Error(e+" is already registered.");Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),gr[e]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}_r("Object",Object),_r("TransferableGridIndex",fr),_r("Color",Le),_r("Error",Error),_r("AJAXError",I),_r("ResolvedImage",De),_r("StylePropertyFunction",Wn),_r("StyleExpression",xn,{omit:["_evaluator"]}),_r("ZoomDependentExpression",En),_r("ZoomConstantExpression",qn),_r("CompoundExpression",Je,{omit:["_evaluate"]});for(const e in ln)ln[e]._classRegistryKey||_r("Expression_"+e,ln[e]);function yr(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function Mr(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(yr(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 r of e)n.push(Mr(r,t));return n}if("object"==typeof e){const n=e.constructor,r=n._classRegistryKey;if(!r)throw new Error("can't serialize object of unregistered class");if(!gr[r])throw new Error(r+" is not registered.");const a=n.serialize?n.serialize(e,t):{};if(n.serialize){if(t&&a===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(gr[r].omit.indexOf(n)>=0)continue;const i=e[n];a[n]=gr[r].shallow.indexOf(n)>=0?i:Mr(i,t)}e instanceof Error&&(a.message=e.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(a.$name=r),a}throw new Error("can't serialize object of type "+typeof e)}function vr(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||yr(e)||O(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(vr);if("object"==typeof e){const t=e.$name||"Object";if(!gr[t])throw new Error("can't deserialize unregistered class "+t);const{klass:n}=gr[t];if(!n)throw new Error("can't deserialize unregistered class "+t);if(n.deserialize)return n.deserialize(e);const r=Object.create(n.prototype);for(const n of Object.keys(e)){if("$name"===n)continue;const a=e[n];r[n]=gr[t].shallow.indexOf(n)>=0?a:vr(a)}return r}throw new Error("can't deserialize object of type "+typeof e)}class zr{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 Or={"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 kr(e){for(const t of e)if(wr(t.charCodeAt(0)))return!0;return!1}function Ar(e){for(const t of e)if(!xr(t.charCodeAt(0)))return!1;return!0}function xr(e){return!(Or.Arabic(e)||Or["Arabic Supplement"](e)||Or["Arabic Extended-A"](e)||Or["Arabic Presentation Forms-A"](e)||Or["Arabic Presentation Forms-B"](e))}function wr(e){return!(746!==e&&747!==e&&(e<4352||!(Or["Bopomofo Extended"](e)||Or.Bopomofo(e)||Or["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||Or["CJK Compatibility Ideographs"](e)||Or["CJK Compatibility"](e)||Or["CJK Radicals Supplement"](e)||Or["CJK Strokes"](e)||!(!Or["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||Or["CJK Unified Ideographs Extension A"](e)||Or["CJK Unified Ideographs"](e)||Or["Enclosed CJK Letters and Months"](e)||Or["Hangul Compatibility Jamo"](e)||Or["Hangul Jamo Extended-A"](e)||Or["Hangul Jamo Extended-B"](e)||Or["Hangul Jamo"](e)||Or["Hangul Syllables"](e)||Or.Hiragana(e)||Or["Ideographic Description Characters"](e)||Or.Kanbun(e)||Or["Kangxi Radicals"](e)||Or["Katakana Phonetic Extensions"](e)||Or.Katakana(e)&&12540!==e||!(!Or["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)||!(!Or["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||Or["Unified Canadian Aboriginal Syllabics"](e)||Or["Unified Canadian Aboriginal Syllabics Extended"](e)||Or["Vertical Forms"](e)||Or["Yijing Hexagram Symbols"](e)||Or["Yi Syllables"](e)||Or["Yi Radicals"](e))))}function Nr(e){return!(wr(e)||function(e){return!!(Or["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||Or["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)||Or["Letterlike Symbols"](e)||Or["Number Forms"](e)||Or["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)||Or["Control Pictures"](e)&&9251!==e||Or["Optical Character Recognition"](e)||Or["Enclosed Alphanumerics"](e)||Or["Geometric Shapes"](e)||Or["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Or["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Or["CJK Symbols and Punctuation"](e)||Or.Katakana(e)||Or["Private Use Area"](e)||Or["CJK Compatibility Forms"](e)||Or["Small Form Variants"](e)||Or["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 qr(e){return e>=1424&&e<=2303||Or["Arabic Presentation Forms-A"](e)||Or["Arabic Presentation Forms-B"](e)}function Er(e,t){return!(!t&&qr(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||Or.Khmer(e))}function jr(e){for(const t of e)if(qr(t.charCodeAt(0)))return!0;return!1}const Wr="deferred",Lr="loading",Sr="loaded";let Tr=null,Cr="unavailable",Rr=null;const Dr=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(Cr="error"),Tr&&Tr(e)};function Pr(){Br.fire(new Q("pluginStateChange",{pluginStatus:Cr,pluginURL:Rr}))}const Br=new te,Ir=function(){return Cr},$r=function(){if(Cr!==Wr||!Rr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Cr=Lr,Pr(),Rr&&X({url:Rr},e=>{e?Dr(e):(Cr=Sr,Pr())})},Fr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Cr===Sr||null!=Fr.applyArabicShaping,isLoading:()=>Cr===Lr,setState(e){if(!g())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Cr=e.pluginStatus,Rr=e.pluginURL},isParsed(){if(!g())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=Fr.applyArabicShaping&&null!=Fr.processBidirectionalText&&null!=Fr.processStyledBidirectionalText},getPluginURL(){if(!g())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Rr}};class Yr{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 zr,this.transition={})}isSupportedScript(e){return function(e,t){for(const n of e)if(!Er(n.charCodeAt(0),t))return!1;return!0}(e,Fr.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 Xr{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 Hr{constructor(e){this.property=e,this.value=new Xr(e,void 0)}transitioned(e,t){return new Ur(this.property,this.value,t,s({},e.transition,this.transition),e.now)}untransitioned(){return new Ur(this.property,this.value,null,{},0)}}class Vr{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 Hr(this._values[e].property)),this._values[e].value=new Xr(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 Hr(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 r=this.getTransition(t);void 0!==r&&(e[t+"-transition"]=r)}return e}transitioned(e,t){const n=new Gr(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].transitioned(e,t._values[r]);return n}untransitioned(){const e=new Gr(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Ur{constructor(e,t,n,r,a){this.property=e,this.value=t,this.begin=a+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){const r=e.now||0,a=this.value.possiblyEvaluate(e,t,n),i=this.prior;if(i){if(r>this.end)return this.prior=null,a;if(this.value.isDataDriven())return this.prior=null,a;if(r<this.begin)return i.possiblyEvaluate(e,t,n);{const o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(i.possiblyEvaluate(e,t,n),a,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 a}}class Gr{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){const r=new Zr(this._properties);for(const a of Object.keys(this._values))r._values[a]=this._values[a].possiblyEvaluate(e,t,n);return r}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Kr{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 Xr(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 r=new Zr(this._properties);for(const a of Object.keys(this._values))r._values[a]=this._values[a].possiblyEvaluate(e,t,n);return r}}class Jr{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,r){return this.property.evaluate(this.value,this.parameters,e,t,n,r)}}class Zr{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Qr{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 r=kt[this.specification.type];return r?r(e,t,n):e}}class ea{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,r){return new Jr(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},n,r)}: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 Jr(this,{kind:"constant",value:void 0},e.parameters);const r=kt[this.specification.type];return r?new Jr(this,{kind:"constant",value:r(e.value.value,t.value.value,n)},e.parameters):e}evaluate(e,t,n,r,a,i){return"constant"===e.kind?e.value:e.evaluate(t,n,r,a,i)}}class ta extends ea{possiblyEvaluate(e,t,n,r){if(void 0===e.value)return new Jr(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){const a=e.expression.evaluate(t,null,{},n,r),i="resolvedImage"===e.property.specification.type&&"string"!=typeof a?a.name:a,o=this._calculate(i,i,i,t);return new Jr(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 Jr(this,{kind:"constant",value:n},t)}return new Jr(this,e.expression,t)}evaluate(e,t,n,r,a,i){if("source"===e.kind){const o=e.evaluate(t,n,r,a,i);return this._calculate(o,o,o,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,r),e.evaluate({zoom:Math.floor(t.zoom)},n,r),e.evaluate({zoom:Math.floor(t.zoom)+1},n,r),t):e.value}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class na{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){if(void 0!==e.value){if("constant"===e.expression.kind){const a=e.expression.evaluate(t,null,{},n,r);return this._calculate(a,a,a,t)}return this._calculate(e.expression.evaluate(new Yr(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Yr(Math.floor(t.zoom),t)),e.expression.evaluate(new Yr(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class ra{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){return!!e.expression.evaluate(t,null,{},n,r)}interpolate(){return!1}}class aa{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 r=this.defaultPropertyValues[t]=new Xr(n,void 0),a=this.defaultTransitionablePropertyValues[t]=new Hr(n);this.defaultTransitioningPropertyValues[t]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}_r("DataDrivenProperty",ea),_r("DataConstantProperty",Qr),_r("CrossFadedDataDrivenProperty",ta),_r("CrossFadedProperty",na),_r("ColorRampProperty",ra);const ia="-transition";class oa 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 Kr(t.layout)),t.paint)){this._transitionablePaint=new Vr(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 Zr(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(br,`layers.${this.id}.layout.${e}`,e,t,n)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return e.endsWith(ia)?this._transitionablePaint.getTransition(e.slice(0,-ia.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(null!=t&&this._validate(mr,`layers.${this.id}.paint.${e}`,e,t,n))return!1;if(e.endsWith(ia))return this._transitionablePaint.setTransition(e.slice(0,-ia.length),t||void 0),!1;{const n=this._transitionablePaint._values[e],r="cross-faded-data-driven"===n.property.specification["property-type"],a=n.value.isDataDriven(),i=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const o=this._transitionablePaint._values[e].value;return o.isDataDriven()||a||r||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,r,a={}){return(!a||!1!==a.validate)&&hr(this,e.call(dr,{key:t,layerType:this.type,objectKey:n,value:r,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 Jr&&hn(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}const sa={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class la{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 ca{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 ua(e,t=1){let n=0,r=0;return{members:e.map(e=>{const a=sa[e.type].BYTES_PER_ELEMENT,i=n=da(n,Math.max(t,a)),o=e.components||1;return r=Math.max(r,a),n+=a*o,{name:e.name,type:e.type,components:o,offset:i}}),size:da(n,Math.max(r,t)),alignment:t}}function da(e,t){return Math.ceil(e/t)*t}class pa extends ca{_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 r=2*e;return this.int16[r+0]=t,this.int16[r+1]=n,e}}pa.prototype.bytesPerElement=4,_r("StructArrayLayout2i4",pa);class ma extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r)}emplace(e,t,n,r,a){const i=4*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=r,this.int16[i+3]=a,e}}ma.prototype.bytesPerElement=8,_r("StructArrayLayout4i8",ma);class ba extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,a,i)}emplace(e,t,n,r,a,i,o){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=a,this.int16[s+4]=i,this.int16[s+5]=o,e}}ba.prototype.bytesPerElement=12,_r("StructArrayLayout2i4i12",ba);class ha extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,a,i)}emplace(e,t,n,r,a,i,o){const s=4*e,l=8*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.uint8[l+4]=r,this.uint8[l+5]=a,this.uint8[l+6]=i,this.uint8[l+7]=o,e}}ha.prototype.bytesPerElement=8,_r("StructArrayLayout2i4ub8",ha);class fa extends ca{_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 r=2*e;return this.float32[r+0]=t,this.float32[r+1]=n,e}}fa.prototype.bytesPerElement=8,_r("StructArrayLayout2f8",fa);class ga extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a,i,o,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,n,r,a,i,o,s,l,c)}emplace(e,t,n,r,a,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]=r,this.uint16[d+3]=a,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}}ga.prototype.bytesPerElement=20,_r("StructArrayLayout10ui20",ga);class _a extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a,i,o,s,l,c,u,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,r,a,i,o,s,l,c,u,d)}emplace(e,t,n,r,a,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]=r,this.int16[m+3]=a,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}}_a.prototype.bytesPerElement=24,_r("StructArrayLayout4i4ui4i24",_a);class ya extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){const a=3*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=r,e}}ya.prototype.bytesPerElement=12,_r("StructArrayLayout3f12",ya);class Ma extends ca{_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}}Ma.prototype.bytesPerElement=4,_r("StructArrayLayout1ul4",Ma);class va extends ca{_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,r,a,i,o,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,r,a,i,o,s,l)}emplace(e,t,n,r,a,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]=r,this.int16[u+3]=a,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}}va.prototype.bytesPerElement=20,_r("StructArrayLayout6i1ul2ui20",va);class za extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,a,i)}emplace(e,t,n,r,a,i,o){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=a,this.int16[s+4]=i,this.int16[s+5]=o,e}}za.prototype.bytesPerElement=12,_r("StructArrayLayout2i2i2i12",za);class Oa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r,a)}emplace(e,t,n,r,a,i){const o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=r,this.int16[s+6]=a,this.int16[s+7]=i,e}}Oa.prototype.bytesPerElement=16,_r("StructArrayLayout2f1f2i16",Oa);class ka extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r)}emplace(e,t,n,r,a){const i=12*e,o=3*e;return this.uint8[i+0]=t,this.uint8[i+1]=n,this.float32[o+1]=r,this.float32[o+2]=a,e}}ka.prototype.bytesPerElement=12,_r("StructArrayLayout2ub2f12",ka);class Aa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){const a=3*e;return this.uint16[a+0]=t,this.uint16[a+1]=n,this.uint16[a+2]=r,e}}Aa.prototype.bytesPerElement=6,_r("StructArrayLayout3ui6",Aa);class xa extends ca{_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,r,a,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,r,a,i,o,s,l,c,u,d,p,m,b,h,f)}emplace(e,t,n,r,a,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]=r,this.uint16[_+3]=a,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}}xa.prototype.bytesPerElement=48,_r("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xa);class wa extends ca{_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,r,a,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,r,a,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,r,a,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]=r,this.int16[q+3]=a,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}}wa.prototype.bytesPerElement=68,_r("StructArrayLayout8i15ui1ul4f68",wa);class Na extends ca{_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}}Na.prototype.bytesPerElement=4,_r("StructArrayLayout1f4",Na);class qa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){const a=3*e;return this.int16[a+0]=t,this.int16[a+1]=n,this.int16[a+2]=r,e}}qa.prototype.bytesPerElement=6,_r("StructArrayLayout3i6",qa);class Ea extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){const a=4*e;return this.uint32[2*e+0]=t,this.uint16[a+2]=n,this.uint16[a+3]=r,e}}Ea.prototype.bytesPerElement=8,_r("StructArrayLayout1ul2ui8",Ea);class ja extends ca{_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 r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=n,e}}ja.prototype.bytesPerElement=4,_r("StructArrayLayout2ui4",ja);class Wa extends ca{_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}}Wa.prototype.bytesPerElement=2,_r("StructArrayLayout1ui2",Wa);class La extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r)}emplace(e,t,n,r,a){const i=4*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,this.float32[i+3]=a,e}}La.prototype.bytesPerElement=16,_r("StructArrayLayout4f16",La);class Sa extends la{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)}}Sa.prototype.size=20;class Ta extends va{get(e){return new Sa(this,e)}}_r("CollisionBoxArray",Ta);class Ca extends la{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]}}Ca.prototype.size=48;class Ra extends xa{get(e){return new Ca(this,e)}}_r("PlacedSymbolArray",Ra);class Da extends la{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]}}Da.prototype.size=68;class Pa extends wa{get(e){return new Da(this,e)}}_r("SymbolInstanceArray",Pa);class Ba extends Na{getoffsetX(e){return this.float32[1*e+0]}}_r("GlyphOffsetArray",Ba);class Ia extends qa{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}_r("SymbolLineVertexArray",Ia);class $a extends la{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]}}$a.prototype.size=8;class Fa extends Ea{get(e){return new $a(this,e)}}_r("FeatureIndexArray",Fa);class Ya extends pa{}class Xa extends pa{}class Ha extends pa{}class Va extends ba{}class Ua extends ha{}class Ga extends fa{}class Ka extends ga{}class Ja extends _a{}class Za extends ya{}class Qa extends Ma{}class ei extends za{}class ti extends ka{}class ni extends Aa{}class ri extends ja{}const ai=ua([{name:"a_pos",components:2,type:"Int16"}],4),{members:ii}=ai;class oi{constructor(e=[]){this.segments=e}prepareSegment(e,t,n,r){let a=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}`),(!a||a.vertexLength+e>oi.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==r)&&(a={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==r&&(a.sortKey=r),this.segments.push(a)),a}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,r){return new oi([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:r,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,_r("SegmentVector",oi);const li=ua([{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,r,a,i,o,s,l,c;for(r=e.length-(n=3&e.length),a=t,o=3432918353,s=461845907,c=0;c<r;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,a=27492+(65535&(i=5*(65535&(a=(a^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>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:a^=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 a^=e.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0};var di={exports:{}};di.exports=function(e,t){for(var n,r=e.length,a=t^r,i=0;r>=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),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++i;switch(r){case 3:a^=(255&e.charCodeAt(i+2))<<16;case 2:a^=(255&e.charCodeAt(i+1))<<8;case 1:a=1540483477*(65535&(a^=255&e.charCodeAt(i)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>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,r){this.ids.push(hi(e)),this.positions.push(t,n,r)}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,r=this.ids.length-1;for(;n<r;){const e=n+r>>1;this.ids[e]>=t?r=e:n=e+1}const a=[];for(;this.ids[n]===t;)a.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return a}static serialize(e,t){const n=new Float64Array(e.ids),r=new Uint32Array(e.positions);return function e(t,n,r,a){for(;r<a;){const i=t[r+a>>1];let o=r-1,s=a+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-r<a-s?(e(t,n,r,s),r=s+1):(e(t,n,s+1,a),a=s)}}(n,r,0,n.length-1),t&&t.push(n.buffer,r.buffer),{ids:n,positions:r}}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 r=e[t];e[t]=e[n],e[n]=r}_r("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,r){const a="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;a&&e.set(a)}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,r){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 r}populatePaintArray(e,t,n,r,a){const i=this.paintVertexArray.length,o=this.expression.evaluate(new Yr(0),t,{},r,[],a);this.paintVertexArray.resize(e),this._setPaintValue(i,e,o)}updatePaintArray(e,t,n,r){const a=this.expression.evaluate({zoom:0},n,r);this._setPaintValue(e,t,a)}_setPaintValue(e,t,n){if("color"===this.type){const r=zi(n);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,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,r,a,i){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=n,this.useIntegerZoom=r,this.zoom=a,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,r,a){const i=this.expression.evaluate(new Yr(this.zoom),t,{},r,[],a),o=this.expression.evaluate(new Yr(this.zoom+1),t,{},r,[],a),s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(s,e,i,o)}updatePaintArray(e,t,n,r){const a=this.expression.evaluate({zoom:this.zoom},n,r),i=this.expression.evaluate({zoom:this.zoom+1},n,r);this._setPaintValue(e,t,a,i)}_setPaintValue(e,t,n,r){if("color"===this.type){const a=zi(n),i=zi(r);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,a[0],a[1],i[0],i[1])}else{for(let a=e;a<t;a++)this.paintVertexArray.emplace(a,n,r);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){const n=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=i(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,n){return new _i(e,t)}}class wi{constructor(e,t,n,r,a,i){this.expression=e,this.type=t,this.useIntegerZoom=n,this.zoom=r,this.layerId=i,this.zoomInPaintVertexArray=new a,this.zoomOutPaintVertexArray=new a}populatePaintArray(e,t,n){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,t.patterns&&t.patterns[this.layerId],n)}updatePaintArray(e,t,n,r,a){this._setPaintValues(e,t,n.patterns&&n.patterns[this.layerId],a)}_setPaintValues(e,t,n,r){if(!r||!n)return;const{min:a,mid:i,max:o}=n,s=r[a],l=r[i],c=r[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 r=[];for(const a in e.paint._values){if(!n(a))continue;const i=e.paint.get(a);if(!(i instanceof Jr&&hn(i.property.specification)))continue;const o=Ei(a,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[a]=d?new ki(s.value,o):new Oi(s.value,o,l),r.push("/u_"+a);else if("source"===s.kind||d){const n=ji(a,l,"source");this.binders[a]=d?new wi(s,l,c,t,n,e.id):new Ai(s,o,l,n),r.push("/a_"+a)}else{const e=ji(a,l,"composite");this.binders[a]=new xi(s,o,l,c,t,e),r.push("/z_"+a)}}this.cacheKey=r.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof Ai||t instanceof xi?t.maxValue:0}populatePaintArrays(e,t,n,r,a){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,r,a)}}setConstantPatternPositions(e,t){for(const n in this.binders){const r=this.binders[n];r instanceof ki&&r.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,n,r,a){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=r.paint.get(n);l.expression=c.value,l.updatePaintArray(t.start,t.end,s,e[o],a),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 r in this.binders){const a=this.binders[r];if(a instanceof Oi||a instanceof ki||a instanceof xi)for(const i of a.uniformNames)if(t[i]){const o=a.getBinding(e,t[i],i);n.push({name:i,property:r,binding:o})}}return n}setUniforms(e,t,n,r){for(const{name:e,property:a,binding:i}of t)this.binders[a].setUniform(i,r,n.get(a),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 r of e)this.programConfigurations[r.id]=new Ni(r,t,n);this.needsUpload=!1,this._featureMap=new bi,this._bufferOffset=0}populatePaintArrays(e,t,n,r,a,i){for(const n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,r,a,i);void 0!==t.id&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,r){for(const a of n)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(e,this._featureMap,t,a,r)||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 r={color:{source:fa,composite:La},number:{source:Na,composite:fa}},a=function(e){return{"line-pattern":{source:Ka,composite:Ka},"fill-pattern":{source:Ka,composite:Ka},"fill-extrusion-pattern":{source:Ka,composite:Ka}}[e]}(e);return a&&a[n]||r[t][n]}_r("ConstantBinder",Oi),_r("CrossFadedConstantBinder",ki),_r("SourceExpressionBinder",Ai),_r("CrossFadedCompositeBinder",wi),_r("CompositeExpressionBinder",xi),_r("ProgramConfiguration",Ni,{omit:["_buffers"]}),_r("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 r=n[e];for(let e=0;e<r.length;e++){const n=r[e],a=Math.round(n.x*t),o=Math.round(n.y*t);n.x=i(a,Si,Li),n.y=i(o,Si,Li),(a<n.x||a>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,r,a){e.emplaceBack(2*t+(r+1)/2,2*n+(a+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 Xa,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 r=this.layers[0],a=[];let i=null,o=!1;"circle"===r.type&&(i=r.layout.get("circle-sort-key"),o=!i.isConstant());for(const{feature:t,id:r,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Ci(t,e);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),c,n))continue;const u=o?i.evaluate(c,{},n):void 0,d={id:r,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:Ti(t),patterns:{},sortKey:u};a.push(d)}o&&a.sort((e,t)=>e.sortKey-t.sortKey);for(const r of a){const{geometry:a,index:i,sourceLayerIndex:o}=r,s=e[i].feature;this.addFeature(r,a,i,n),t.featureIndex.insert(s,a,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,r){for(const n of t)for(const t of n){const n=t.x,r=t.y;if(n<0||n>=Wi||r<0||r>=Wi)continue;const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),i=a.vertexLength;Ri(this.layoutVertexArray,n,r,-1,-1),Ri(this.layoutVertexArray,n,r,1,-1),Ri(this.layoutVertexArray,n,r,1,1),Ri(this.layoutVertexArray,n,r,-1,1),this.indexArray.emplaceBack(i,i+1,i+2),this.indexArray.emplaceBack(i,i+3,i+2),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},r)}}function Pi(e,t){for(let n=0;n<e.length;n++)if(Ui(t,e[n]))return!0;for(let n=0;n<t.length;n++)if(Ui(e,t[n]))return!0;return!!Fi(e,t)}function Bi(e,t,n){return!!Ui(e,t)||!!Xi(t,e,n)}function Ii(e,t){if(1===e.length)return Vi(t,e[0]);for(let n=0;n<t.length;n++){const r=t[n];for(let t=0;t<r.length;t++)if(Ui(e,r[t]))return!0}for(let n=0;n<e.length;n++)if(Vi(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 r=0;r<t.length;r++)if(Xi(t[r],e,n))return!0}for(let r=0;r<e.length;r++)if(Xi(e[r],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 r=e[n],a=e[n+1];for(let e=0;e<t.length-1;e++)if(Yi(r,a,t[e],t[e+1]))return!0}return!1}function Yi(e,t,n,r){return h(e,n,r)!==h(t,n,r)&&h(e,t,n)!==h(e,t,r)}function Xi(e,t,n){const r=n*n;if(1===t.length)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++)if(Hi(e,t[n-1],t[n])<r)return!0;return!1}function Hi(e,t,n){const r=t.distSqr(n);if(0===r)return e.distSqr(t);const a=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/r;return e.distSqr(a<0?t:a>1?n:n.sub(t)._mult(a)._add(t))}function Vi(e,t){let n,r,a,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++)r=n[e],a=n[o],r.y>t.y!=a.y>t.y&&t.x<(a.x-r.x)*(t.y-r.y)/(a.y-r.y)+r.x&&(i=!i)}return i}function Ui(e,t){let n=!1;for(let r=0,a=e.length-1;r<e.length;a=r++){const i=e[r],o=e[a];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(n=!n)}return n}function Gi(e,t,n){const r=n[0],a=n[2];if(e.x<r.x&&t.x<r.x||e.x>a.x&&t.x>a.x||e.y<r.y&&t.y<r.y||e.y>a.y&&t.y>a.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 r=t.paint.get(e).value;return"constant"===r.kind?r.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,r,a){if(!t[0]&&!t[1])return e;const i=A.convert(t)._mult(a);"viewport"===n&&i._rotate(-r);const o=[];for(let t=0;t<e.length;t++)o.push(e[t].sub(i));return o}_r("CircleBucket",Di,{omit:["layers"]});const Qi=new aa({"circle-sort-key":new ea(ne.layout_circle["circle-sort-key"])});var eo={paint:new aa({"circle-radius":new ea(ne.paint_circle["circle-radius"]),"circle-color":new ea(ne.paint_circle["circle-color"]),"circle-blur":new ea(ne.paint_circle["circle-blur"]),"circle-opacity":new ea(ne.paint_circle["circle-opacity"]),"circle-translate":new Qr(ne.paint_circle["circle-translate"]),"circle-translate-anchor":new Qr(ne.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Qr(ne.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Qr(ne.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ea(ne.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ea(ne.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ea(ne.paint_circle["circle-stroke-opacity"])}),layout:Qi},to=1e-6,no="undefined"!=typeof Float32Array?Float32Array:Array;function ro(){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 ao(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 r=t[0],a=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*r+M*s+v*d+z*h,e[1]=y*a+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])*r+(M=n[5])*s+(v=n[6])*d+(z=n[7])*h,e[5]=y*a+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])*r+(M=n[9])*s+(v=n[10])*d+(z=n[11])*h,e[9]=y*a+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])*r+(M=n[13])*s+(v=n[14])*d+(z=n[15])*h,e[13]=y*a+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 r=new no(3);return r[0]=e,r[1]=t,r[2]=n,r}function uo(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*a+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*a+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*a+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*a+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(),ro(),function(){var e;e=new no(2),no!=Float32Array&&(e[0]=0,e[1]=0)}();class bo extends Di{}_r("HeatmapBucket",bo,{omit:["layers"]});var ho={paint:new aa({"heatmap-radius":new ea(ne.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ea(ne.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Qr(ne.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ra(ne.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Qr(ne.paint_heatmap["heatmap-opacity"])})};function fo(e,{width:t,height:n},r,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t*n*r)throw new RangeError(`mismatched image size. expected: ${a.length} but got: ${t*n*r}`)}else a=new Uint8Array(t*n*r);return e.width=t,e.height=n,e.data=a,e}function go(e,{width:t,height:n},r){if(t===e.width&&n===e.height)return;const a=fo({},{width:t,height:n},r);_o(e,a,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,n)},r),e.width=t,e.height=n,e.data=a.data}function _o(e,t,n,r,a,i){if(0===a.width||0===a.height)return t;if(a.width>e.width||a.height>e.height||n.x>e.width-a.width||n.y>e.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||r.x>t.width-a.width||r.y>t.height-a.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<a.height;l++){const c=((n.y+l)*e.width+n.x)*i,u=((r.y+l)*t.width+r.x)*i;for(let e=0;e<a.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,r,a){_o(e,t,n,r,a,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,r,a){_o(e,t,n,r,a,4)}}function vo(e){const t={},n=e.resolution||256,r=e.clips?e.clips.length:1,a=e.image||new Mo({width:n,height:r});if(Math.log(n)/Math.LN2%1!=0)throw new Error("width is not a power of 2 - "+n);const i=(n,r,i)=>{t[e.evaluationKey]=i;const o=e.expression.evaluate(t);a.data[n+r+0]=Math.floor(255*o.r/o.a),a.data[n+r+1]=Math.floor(255*o.g/o.a),a.data[n+r+2]=Math.floor(255*o.b/o.a),a.data[n+r+3]=Math.floor(255*o.a)};if(e.clips)for(let t=0,a=0;t<r;++t,a+=4*n)for(let r=0,o=0;r<n;r++,o+=4){const s=r/(n-1),{start:l,end:c}=e.clips[t];i(a,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 a}_r("AlphaImage",yo),_r("RGBAImage",Mo);var zo={paint:new aa({"hillshade-illumination-direction":new Qr(ne.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Qr(ne.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Qr(ne.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Qr(ne.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Qr(ne.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Qr(ne.paint_hillshade["hillshade-accent-color"])})};const Oo=ua([{name:"a_pos",components:2,type:"Int16"}],4),{members:ko}=Oo;var Ao={exports:{}};function xo(e,t,n){n=n||2;var r,a,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,r){var a,i,o,s=[];for(a=0,i=t.length;a<i;a++)(o=wo(e,t[a]*r,a<i-1?t[a+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(Do(o));for(s.sort(So),a=0;a<s.length;a++)n=To(s[a],n);return n}(e,t,p,n)),e.length>80*n){r=i=e[0],a=o=e[1];for(var b=n;b<d;b+=n)(s=e[b])<r&&(r=s),(l=e[b+1])<a&&(a=l),s>i&&(i=s),l>o&&(o=l);c=0!==(c=Math.max(i-r,o-a))?32767/c:0}return qo(p,m,n,r,a,c,0),m}function wo(e,t,n,r,a){var i,o;if(a===Jo(e,t,n,r)>0)for(i=t;i<n;i+=r)o=Uo(i,e[i],e[i+1],o);else for(i=n-r;i>=t;i-=r)o=Uo(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,r=e;do{if(n=!1,r.steiner||!$o(r,r.next)&&0!==Io(r.prev,r,r.next))r=r.next;else{if(Go(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function qo(e,t,n,r,a,i,o){if(e){!o&&i&&function(e,t,n,r){var a=e;do{0===a.z&&(a.z=Ro(a.x,a.y,t,n,r)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==e);a.prevZ.nextZ=null,a.prevZ=null,function(e){var t,n,r,a,i,o,s,l,c=1;do{for(n=e,e=null,i=null,o=0;n;){for(o++,r=n,s=0,t=0;t<c&&(s++,r=r.nextZ);t++);for(l=c;s>0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(a=n,n=n.nextZ,s--):(a=r,r=r.nextZ,l--),i?i.nextZ=a:e=a,a.prevZ=i,i=a;n=r}i.nextZ=null,c*=2}while(o>1)}(a)}(e,r,a,i);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,i?jo(e,r,a,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,r,a,i,2):2===o&&Lo(e,t,n,r,a,i):qo(No(e),t,n,r,a,i,1);break}}}function Eo(e){var t=e.prev,n=e,r=e.next;if(Io(t,n,r)>=0)return!1;for(var a=t.x,i=n.x,o=r.x,s=t.y,l=n.y,c=r.y,u=a<i?a<o?a:o:i<o?i:o,d=s<l?s<c?s:c:l<c?l:c,p=a>i?a>o?a:o:i>o?i:o,m=s>l?s>c?s:c:l>c?l:c,b=r.next;b!==t;){if(b.x>=u&&b.x<=p&&b.y>=d&&b.y<=m&&Po(a,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,r){var a=e.prev,i=e,o=e.next;if(Io(a,i,o)>=0)return!1;for(var s=a.x,l=i.x,c=o.x,u=a.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,r),_=Ro(h,f,t,n,r),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!==a&&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!==a&&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!==a&&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!==a&&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 r=e;do{var a=r.prev,i=r.next.next;!$o(a,i)&&Fo(a,r,r.next,i)&&Ho(a,i)&&Ho(i,a)&&(t.push(a.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),Go(r),Go(r.next),r=e=i),r=r.next}while(r!==e);return No(r)}function Lo(e,t,n,r,a,i){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Bo(o,s)){var l=Vo(o,s);return o=No(o,o.next),l=No(l,l.next),qo(o,t,n,r,a,i,0),void qo(l,t,n,r,a,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,r=t,a=e.x,i=e.y,o=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=a&&s>o&&(o=s,n=r.x<r.next.x?r:r.next,s===a))return n}r=r.next}while(r!==t);if(!n)return null;var l,c=n,u=n.x,d=n.y,p=1/0;r=n;do{a>=r.x&&r.x>=u&&a!==r.x&&Po(i<d?a:o,i,u,d,i<d?o:a,i,r.x,r.y)&&(l=Math.abs(i-r.y)/(a-r.x),Ho(r,e)&&(l<p||l===p&&(r.x>n.x||r.x===n.x&&Co(n,r)))&&(n=r,p=l)),r=r.next}while(r!==c);return n}(e,t);if(!n)return t;var r=Vo(n,e);return No(r,r.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,r,a){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*a|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,r,a,i,o,s){return(a-o)*(t-s)>=(e-o)*(i-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(i-s)>=(a-o)*(r-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,r=!1,a=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&a<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(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,r){var a=Xo(Io(e,t,n)),i=Xo(Io(e,t,r)),o=Xo(Io(n,r,e)),s=Xo(Io(n,r,t));return a!==i&&o!==s||!(0!==a||!Yo(e,n,t))||!(0!==i||!Yo(e,r,t))||!(0!==o||!Yo(n,e,r))||!(0!==s||!Yo(n,t,r))}function Yo(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 Xo(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 Vo(e,t){var n=new Ko(e.i,e.x,e.y),r=new Ko(t.i,t.x,t.y),a=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=a,a.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function Uo(e,t,n,r){var a=new Ko(e,t,n);return r?(a.next=r.next,a.prev=r,r.next.prev=a,r.next=a):(a.prev=a,a.next=a),a}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,r){for(var a=0,i=t,o=n-r;i<n;i+=r)a+=(e[o]-e[i])*(e[i+1]+e[o+1]),o=i;return a}function Zo(e,t,n,r,a){!function e(t,n,r,a,i){for(;a>r;){if(a-r>600){var o=a-r+1,s=n-r+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(r,Math.floor(n-s*c/o+u)),Math.min(a,Math.floor(n+(o-s)*c/o+u)),i)}var d=t[n],p=r,m=a;for(Qo(t,r,n),i(t[a],d)>0&&Qo(t,r,a);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[r],d)?Qo(t,r,m):Qo(t,++m,a),m<=n&&(r=m+1),n<=m&&(a=m-1)}}(e,t,n||0,r||e.length-1,a||es)}function Qo(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}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 r=[];let a,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?(a&&r.push(a),a=[e[t]]):a.push(e[t]))}if(a&&r.push(a),t>1)for(let e=0;e<r.length;e++)r[e].length<=t||(Zo(r[e],t,1,r[e].length-1,ns),r[e]=r[e].slice(0,t));return r}function ns(e,t){return t.area-e.area}function rs(e,t,n){const r=n.patternDependencies;let a=!1;for(const n of t){const t=n.paint.get(e+"-pattern");t.isConstant()||(a=!0);const i=t.constantOr(null);i&&(a=!0,r[i.to]=!0,r[i.from]=!0)}return a}function as(e,t,n,r,a){const i=a.patternDependencies;for(const o of t){const t=o.paint.get(e+"-pattern").value;if("constant"!==t.kind){let e=t.evaluate({zoom:r-1},n,{},a.availableImages),s=t.evaluate({zoom:r},n,{},a.availableImages),l=t.evaluate({zoom:r+1},n,{},a.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,r){var a=t&&t.length,i=Math.abs(Jo(e,0,a?t[0]*n:e.length,n));if(a)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<r.length;o+=3){var c=r[o]*n,u=r[o+1]*n,d=r[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},r=0,a=0;a<e.length;a++){for(var i=0;i<e[a].length;i++)for(var o=0;o<t;o++)n.vertices.push(e[a][i][o]);a>0&&n.holes.push(r+=e[a-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 Ha,this.indexArray=new ni,this.indexArray2=new ri,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=rs("fill",this.layers,t);const r=this.layers[0].layout.get("fill-sort-key"),a=!r.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 Yr(this.zoom),u,n))continue;const d=a?r.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)}a&&i.sort((e,t)=>e.sortKey-t.sortKey);for(const r of i){const{geometry:a,index:i,sourceLayerIndex:o}=r;if(this.hasPattern){const e=as("fill",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,a,i,n,{});t.featureIndex.insert(e[i].feature,a,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,r,a){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),r=n.vertexLength,a=[],i=[];for(const t of e){if(0===t.length)continue;t!==e[0]&&i.push(a.length/2);const n=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),r=n.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(r+t.length-1,r),a.push(t[0].x),a.push(t[0].y);for(let e=1;e<t.length;e++)this.layoutVertexArray.emplaceBack(t[e].x,t[e].y),this.indexArray2.emplaceBack(r+e-1,r+e),a.push(t[e].x),a.push(t[e].y);n.vertexLength+=t.length,n.primitiveLength+=t.length}const o=Ao.exports(a,i);for(let e=0;e<o.length;e+=3)this.indexArray.emplaceBack(r+o[e],r+o[e+1],r+o[e+2]);n.vertexLength+=t,n.primitiveLength+=o.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,a,r)}}_r("FillBucket",is,{omit:["layers","patternFeatures"]});const os=new aa({"fill-sort-key":new ea(ne.layout_fill["fill-sort-key"])});var ss={paint:new aa({"fill-antialias":new Qr(ne.paint_fill["fill-antialias"]),"fill-opacity":new ea(ne.paint_fill["fill-opacity"]),"fill-color":new ea(ne.paint_fill["fill-color"]),"fill-outline-color":new ea(ne.paint_fill["fill-outline-color"]),"fill-translate":new Qr(ne.paint_fill["fill-translate"]),"fill-translate-anchor":new Qr(ne.paint_fill["fill-translate-anchor"]),"fill-pattern":new ta(ne.paint_fill["fill-pattern"])}),layout:os};const ls=ua([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),cs=ua([{name:"a_centroid",components:2,type:"Int16"}],4),{members:us}=ls;var ds={},ps=A,ms=bs;function bs(e,t,n,r,a){this.properties={},this.extent=n,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=a,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 r=t._keys[e.readVarint()],a=t._values[e.readVarint()];t.properties[r]=a}}(n,t):3==e?t.type=n.readVarint():4==e&&(t._geometry=n.pos)}function fs(e){for(var t,n,r=0,a=0,i=e.length,o=i-1;a<i;o=a++)r+=((n=e[o]).x-(t=e[a]).x)*(t.y+n.y);return r}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,r=1,a=0,i=0,o=0,s=[];e.pos<n;){if(a<=0){var l=e.readVarint();r=7&l,a=l>>3}if(a--,1===r||2===r)i+=e.readSVarint(),o+=e.readSVarint(),1===r&&(t&&s.push(t),t=[]),t.push(new ps(i,o));else{if(7!==r)throw new Error("unknown command "+r);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,r=0,a=0,i=0,o=1/0,s=-1/0,l=1/0,c=-1/0;e.pos<t;){if(r<=0){var u=e.readVarint();n=7&u,r=u>>3}if(r--,1===n||2===n)(a+=e.readSVarint())<o&&(o=a),a>s&&(s=a),(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 r,a,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(r=0;r<l.length;r++)d[r]=l[r][0];u(l=d);break;case 2:for(r=0;r<l.length;r++)u(l[r]);break;case 3:for(l=function(e){var t=e.length;if(t<=1)return[e];for(var n,r,a=[],i=0;i<t;i++){var o=fs(e[i]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(n&&a.push(n),n=[e[i]]):n.push(e[i]))}return n&&a.push(n),a}(l),r=0;r<l.length;r++)for(a=0;a<l[r].length;a++)u(l[r][a])}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 r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}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 r=new vs(n,n.readVarint()+n.pos);r.length&&(t[r.name]=r)}}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,r,a,i,o,s){e.emplaceBack(t,n,2*Math.floor(r*ks)+o,a*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 Va,this.centroidVertexArray=new Ya,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=rs("fill-extrusion",this.layers,t);for(const{feature:r,id:a,index:i,sourceLayerIndex:o}of e){const e=this.layers[0]._featureFilter.needGeometry,s=Ci(r,e);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),s,n))continue;const l={id:a,sourceLayerIndex:o,index:i,geometry:e?s.geometry:Ti(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(as("fill-extrusion",this.layers,l,this.zoom,t)):this.addFeature(l,l.geometry,i,n,{}),t.featureIndex.insert(r,l.geometry,i,o,this.index,!0)}}addFeatures(e,t,n){for(const e of this.features){const{geometry:r}=e;this.addFeature(e,r,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,r,a){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 r=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 a=e[n];if(n>=1){const o=e[n-1];if(!ws(a,o)){r.vertexLength+4>oi.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const e=a.sub(o)._perp()._unit(),n=o.dist(a);t+n>32768&&(t=0),As(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,0,t),As(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,1,t),i.x+=2*a.x,i.y+=2*a.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=r.vertexLength;this.indexArray.emplaceBack(s,s+2,s+1),this.indexArray.emplaceBack(s+1,s+2,s+3),r.vertexLength+=4,r.primitiveLength+=2}}}}if(r.vertexLength+t>oi.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray)),"Polygon"!==Os[e.type])continue;const a=[],o=[],s=r.vertexLength;for(const e of n)if(0!==e.length){e!==n[0]&&o.push(a.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,a.push(n.x),a.push(n.y)}}const l=Ao.exports(a,o);for(let e=0;e<l.length;e+=3)this.indexArray.emplaceBack(s+l[e],s+l[e+2],s+l[e+1]);r.primitiveLength+=l.length/3,r.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,a,r)}}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)}_r("FillExtrusionBucket",xs,{omit:["layers","features"]});var qs={paint:new aa({"fill-extrusion-opacity":new Qr(ne["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ea(ne["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Qr(ne["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Qr(ne["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ta(ne["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ea(ne["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ea(ne["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Qr(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 r=t[n++];let a;for(;!a||r.equals(a);)if(a=t[n++],!a)return 1/0;for(;n<t.length;n++){const i=t[n],o=e[0],s=a.sub(r),l=i.sub(r),c=o.sub(r),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,_=r.z*(1-f-g)+a.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=ua([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Ls}=Ws,Ss=ua([{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 Ua,this.layoutVertexArray2=new Ga,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=rs("line",this.layers,t);const r=this.layers[0].layout.get("line-sort-key"),a=!r.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 Yr(this.zoom),c,n))continue;const u=a?r.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)}a&&i.sort((e,t)=>e.sortKey-t.sortKey);for(const r of i){const{geometry:a,index:i,sourceLayerIndex:o}=r;if(this.hasPattern){const e=as("line",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,a,i,n,{});t.featureIndex.insert(e[i].feature,a,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,r,a){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,a,r)}addLine(e,t,n,r,a,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&&(a=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":r;if(O&&"round"===k&&(y<i?k="miter":y<=2&&(k="fakeround")),"miter"===k&&y>a&&(k="bevel"),"bevel"===k&&(y>2&&(k="flipbevel"),y<a&&(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 r=h.sub(b)._mult(n)._add(b)._unit()._mult(z?-1:1);this.addHalfVertex(d,r.x,r.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,r,a,i=!1){const o=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,i,!1,n,a),this.addHalfVertex(e,o,s,i,!0,-r,a),this.distance>Ds/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(e,t,n,r,a,i))}addHalfVertex({x:e,y:t},n,r,a,i,o,s){const l=.5*(this.lineClips?this.scaledDistance*(Ds-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(a?1:0),(t<<1)+(i?1:0),Math.round(63*n)+128,Math.round(63*r)+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()}}_r("LineBucket",Ps,{omit:["layers","patternFeatures"]});const Bs=new aa({"line-cap":new Qr(ne.layout_line["line-cap"]),"line-join":new ea(ne.layout_line["line-join"]),"line-miter-limit":new Qr(ne.layout_line["line-miter-limit"]),"line-round-limit":new Qr(ne.layout_line["line-round-limit"]),"line-sort-key":new ea(ne.layout_line["line-sort-key"])});var Is={paint:new aa({"line-opacity":new ea(ne.paint_line["line-opacity"]),"line-color":new ea(ne.paint_line["line-color"]),"line-translate":new Qr(ne.paint_line["line-translate"]),"line-translate-anchor":new Qr(ne.paint_line["line-translate-anchor"]),"line-width":new ea(ne.paint_line["line-width"]),"line-gap-width":new ea(ne.paint_line["line-gap-width"]),"line-offset":new ea(ne.paint_line["line-offset"]),"line-blur":new ea(ne.paint_line["line-blur"]),"line-dasharray":new na(ne.paint_line["line-dasharray"]),"line-pattern":new ta(ne.paint_line["line-pattern"]),"line-gradient":new ra(ne.paint_line["line-gradient"])}),layout:Bs};const $s=new class extends ea{possiblyEvaluate(e,t){return t=new Yr(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,r){return t=s({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,r)}}(Is.paint.properties["line-width"].specification);function Fs(e,t){return t>0?t+2*e:e}$s.useIntegerZoom=!0;const Ys=ua([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xs=ua([{name:"a_projected_pos",components:3,type:"Float32"}],4);ua([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Hs=ua([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ua([{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 Vs=ua([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Us=ua([{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 r=t.layout.get("text-transform").evaluate(n,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),Fr.applyArabicShaping&&(e=Fr.applyArabicShaping(e)),e}(e.text,t,n)}),e}ua([{name:"triangle",components:3,type:"Uint16"}]),ua([{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"}]),ua([{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"}]),ua([{type:"Float32",name:"offsetX"}]),ua([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Ks={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Js=el,Zs=function(e,t,n,r,a){var i,o,s=8*a-r-1,l=(1<<s)-1,c=l>>1,u=-7,d=n?a-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+=r;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,r),i-=c}return(m?-1:1)*o*Math.pow(2,i-r)},Qs=function(e,t,n,r,a,i){var o,s,l,c=8*i-a-1,u=(1<<c)-1,d=u>>1,p=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,m=r?0:i-1,b=r?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,a),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,a),o=0));a>=8;e[n+m]=255&s,m+=b,s/=256,a-=8);for(o=o<<a|s,c+=a;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,rl=1/nl,al="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 r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(r);for(var a=n.pos-1;a>=e;a--)n.buf[a+r]=n.buf[a]}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:r,width:a,height:i,left:o,top:s,advance:l}=n.readMessage(zl,{});t.push({id:e,bitmap:new yo({width:a+6,height:i+6},r),metrics:{width:a,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 r of e)t+=r.w*r.h,n=Math.max(n,r.w);e.sort((e,t)=>t.h-e.h);const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}];let a=0,i=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const n=r[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),a=Math.max(a,t.x+t.w),t.w===n.w&&t.h===n.h){const t=r.pop();e<r.length&&(r[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):(r.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:a,h:i,fill:t/(a*i)||0}}el.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),a=r>>3,i=this.pos;this.type=7&r,e(a,t,this),this.pos===i&&this.skip(r)}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,r=this.buf;return t=127&(n=r[this.pos++]),n<128?t:(t|=(127&(n=r[this.pos++]))<<7,n<128?t:(t|=(127&(n=r[this.pos++]))<<14,n<128?t:(t|=(127&(n=r[this.pos++]))<<21,n<128?t:function(e,t,n){var r,a,i=n.buf;if(r=(112&(a=i[n.pos++]))>>4,a<128)return ol(e,r,t);if(r|=(127&(a=i[n.pos++]))<<3,a<128)return ol(e,r,t);if(r|=(127&(a=i[n.pos++]))<<10,a<128)return ol(e,r,t);if(r|=(127&(a=i[n.pos++]))<<17,a<128)return ol(e,r,t);if(r|=(127&(a=i[n.pos++]))<<24,a<128)return ol(e,r,t);if(r|=(1&(a=i[n.pos++]))<<31,a<128)return ol(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(n=r[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&&al?function(e,t,n){return al.decode(e.subarray(t,n))}(this.buf,t,e):function(e,t,n){for(var r="",a=t;a<n;){var i,o,s,l=e[a],c=null,u=l>239?4:l>223?3:l>191?2:1;if(a+u>n)break;1===u?l<128&&(c=l):2===u?128==(192&(i=e[a+1]))&&(c=(31&l)<<6|63&i)<=127&&(c=null):3===u?(o=e[a+2],128==(192&(i=e[a+1]))&&128==(192&o)&&((c=(15&l)<<12|(63&i)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(o=e[a+2],s=e[a+3],128==(192&(i=e[a+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,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),a+=u}return r}(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*rl),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*rl),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,r=r+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)))))}(r,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 r,a,i=0;i<t.length;i++){if((r=t.charCodeAt(i))>55295&&r<57344){if(!a){r>56319||i+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):a=r;continue}if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,a=r;continue}r=a-55296<<10|r-56320|65536,a=null}else a&&(e[n++]=239,e[n++]=191,e[n++]=189,a=null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|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 r=this.pos-n;r>=128&&sl(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},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:r,stretchY:a,content:i}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=a,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={},r={};this.haveRenderCallbacks=[];const a=[];this.addImages(e,n,a),this.addImages(t,r,a);const{w:i,h:o}=Ol(a),s=new Mo({width:i||1,height:o||1});for(const t in e){const r=e[t],a=n[t].paddedRect;Mo.copy(r.data,s,{x:0,y:0},{x:a.x+1,y:a.y+1},r.data)}for(const e in t){const n=t[e],a=r[e].paddedRect,i=a.x+1,o=a.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=r}addImages(e,t,n){for(const r in e){const a=e[r],i={x:0,y:0,w:a.data.width+2,h:a.data.height+2};n.push(i),t[r]=new kl(i,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}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[r,a]=e.tl;n.update(t.data,void 0,{x:r,y:a})}}_r("ImagePosition",kl),_r("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 r=0;r<e.sections.length;r++){const a=e.sections[r];a.image?n.addImageSection(a):n.addTextSection(a,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 r=e.charCodeAt(n+1)||null,a=e.charCodeAt(n-1)||null;t+=r&&Nr(r)&&!Ks[e[n+1]]||a&&Nr(a)&&!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,r,a,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}=Fr;if(y&&1===g.sections.length){_=[];const e=y(g.toString(),Tl(g,u,o,n,a,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,a,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=[],r=e.text;let a=0;for(const r of t)n.push(e.substring(a,r)),a=r;return a<r.length&&n.push(e.substring(a,r.length)),n}(g,Tl(g,u,o,n,a,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,r,a,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&&!wr(g)||d&&(ql[g]||(y=g,Or.Arabic(y)||Or["Arabic Supplement"](y)||Or["Arabic Extended-A"](y)||Or["Arabic Presentation Forms-A"](y)||Or["Arabic Presentation Forms-B"](y))));if(h.imageName){const e=a[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 r=x?n[0]*h.scale-24*i:n[1]*h.scale-24*i;r>0&&r>z&&(z=r)}else{const e=r[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,r,a,i,o,s,l){const c=(t-n)*a;let u=0;u=i!==o?-s*r- -17:(-r*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,r,a,_,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,r,a,i){if(t.imageName){const e=r[t.imageName];return e?e.displaySize[0]*t.scale*24/i+a:0}{const r=n[t.fontStack],i=r&&r[e];return i?i.metrics.advance*t.scale+a:0}}function Wl(e,t,n,r){const a=Math.pow(e-t,2);return r?e<t?a/2:2*a:a+Math.abs(n)*n}function Ll(e,t,n){let r=0;return 10===e&&(r-=1e4),n&&(r+=150),40!==e&&65288!==e||(r+=50),41!==t&&65289!==t||(r+=50),r}function Sl(e,t,n,r,a,i){let o=null,s=Wl(t,n,a,i);for(const e of r){const r=Wl(t-e.x,n,a,i)+e.badness;r<=s&&(o=e,s=r)}return{index:e,x:t,priorBreak:o,badness:s}}function Tl(e,t,n,r,a,i,o){if("point"!==i)return[];if(!e)return[];const s=[],l=function(e,t,n,r,a,i){let o=0;for(let n=0;n<e.length();n++){const s=e.getSection(n);o+=jl(e.getCharCode(n),s,r,a,t,i)}return o/Math.max(1,Math.ceil(o/n))}(e,t,n,r,a,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,r,a,t,o)),n<e.length()-1){const t=!((d=p)<11904||!(Or["Bopomofo Extended"](d)||Or.Bopomofo(d)||Or["CJK Compatibility Forms"](d)||Or["CJK Compatibility Ideographs"](d)||Or["CJK Compatibility"](d)||Or["CJK Radicals Supplement"](d)||Or["CJK Strokes"](d)||Or["CJK Symbols and Punctuation"](d)||Or["CJK Unified Ideographs Extension A"](d)||Or["CJK Unified Ideographs"](d)||Or["Enclosed CJK Letters and Months"](d)||Or["Halfwidth and Fullwidth Forms"](d)||Or.Hiragana(d)||Or["Ideographic Description Characters"](d)||Or["Kangxi Radicals"](d)||Or["Katakana Phonetic Extensions"](d)||Or.Katakana(d)||Or["Vertical Forms"](d)||Or["Yi Radicals"](d)||Or["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,r,a){if(!r&&!a)return;const i=e[n],o=(e[n].x+i.metrics.advance*i.scale)*r;for(let r=t;r<=n;r++)e[r].x-=o,e[r].y+=a}function Dl(e,t,n){const{horizontalAlign:r,verticalAlign:a}=Cl(n),i=t[0]-e.displaySize[0]*r,o=t[1]-e.displaySize[1]*a;return{image:e,top:o,bottom:o+e.displaySize[1],left:i,right:i+e.displaySize[0]}}function Pl(e,t,n,r,a,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=a[0]+l-r[3],d=a[0]+c+r[1]):(m=a[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=a[1]+b-r[0],p=a[1]+h+r[2]):(u=a[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 Yr(e+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:r}=n;let a=0;for(;a<t.length&&t[a]<=e;)a++;a=Math.max(0,a-1);let i=a;for(;i<t.length&&t[i]<e+1;)i++;i=Math.min(t.length-1,i);const o=t[a],s=t[i];return"composite"===n.kind?{kind:"composite",minZoom:o,maxZoom:s,interpolationType:r}:{kind:"camera",minZoom:o,maxZoom:s,minSize:n.evaluate(new Yr(o)),maxSize:n.evaluate(new Yr(s)),interpolationType:r}}}class $l extends A{constructor(e,t,n,r){super(e,t),this.angle=n,void 0!==r&&(this.segment=r)}clone(){return new $l(this.x,this.y,this.angle,this.segment)}}function Fl(e,t,n,r,a){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>r;)c-=l.shift().angleDelta;if(c>a)return!1;o++,s+=t.dist(n)}return!0}function Yl(e){let t=0;for(let n=0;n<e.length-1;n++)t+=e[n].dist(e[n+1]);return t}function Xl(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 Vl(e,t,n,r,a,i){const o=Xl(n,a,i),s=Hl(n,r)*i;let l=0;const c=Yl(e)/2;for(let n=0;n<e.length-1;n++){const r=e[n],a=e[n+1],i=r.dist(a);if(l+i>c){const u=(c-l)/i,d=Ot(r.x,a.x,u),p=Ot(r.y,a.y,u),m=new $l(d,p,a.angleTo(r),n);return m._round(),!o||Fl(e,m,s,o,t)?m:void 0}l+=i}}function Ul(e,t,n,r,a,i,o,s,l){const c=Xl(r,i,o),u=Hl(r,a),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,r,a,i,o,s,l,c){const u=o/2,d=Yl(t);let p=0,m=n-r,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+r<p+l;){m+=r;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(),a&&!Fl(t,n,o,a,i)||b.push(n)}}p+=l}return l||b.length||s||(b=e(t,p/2,r,a,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,r,a){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>=r&&c.x>=r||(o.x>=r?o=new A(r,o.y+(r-o.x)/(c.x-o.x)*(c.y-o.y))._round():c.x>=r&&(c=new A(r,o.y+(r-o.x)/(c.x-o.x)*(c.y-o.y))._round()),o.y>=a&&c.y>=a||(o.y>=a?o=new A(o.x+(a-o.y)/(c.y-o.y)*(c.x-o.x),a)._round():c.y>=a&&(c=new A(o.x+(a-o.y)/(c.y-o.y)*(c.x-o.x),a)._round()),l&&o.equals(l[l.length-1])||(l=[o],i.push(l)),l.push(c)))))}}return i}function Kl(e,t,n,r){const a=[],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&&r){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=(r,a,s,l)=>{const d=Ql(r.stretch-_,y,c,e.left),p=ec(r.fixed-z,O,r.stretch,b),m=Ql(a.stretch-M,v,u,e.top),f=ec(a.fixed-k,x,a.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=r.stretch+r.fixed,D=a.stretch+a.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(r&&(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 r=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)a.push(w(r,t[e],i,t[e+1]))}}else a.push(w({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));return a}function Jl(e,t,n){let r=0;for(const a of e)r+=Math.max(t,Math.min(n,a[1]))-Math.max(t,Math.min(n,a[0]));return r}function Zl(e,t,n){const r=[{fixed:-1,stretch:0}];for(const[t,n]of e){const e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(n-t)})}return r.push({fixed:t+1,stretch:n}),r}function Ql(e,t,n,r){return e/t*n+r}function ec(e,t,n,r){return e-t*n/r}_r("Anchor",$l);class tc{constructor(e,t,n,r,a,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 r=t-e;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}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),r=new A(p,u),a=c*Math.PI/180;e._rotate(a),t._rotate(a),n._rotate(a),r._rotate(a),d=Math.min(e.x,t.x,n.x,r.x),p=Math.max(e.x,t.x,n.x,r.x),l=Math.min(e.y,t.y,n.y,r.y),u=Math.max(e.y,t.y,n.y,r.y)}e.emplaceBack(t.x,t.y,d,l,p,u,n,r,a)}this.boxEndIndex=e.length}}class nc{constructor(e=[],t=rc){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,r=t[e];for(;e>0;){const a=e-1>>1,i=t[a];if(n(r,i)>=0)break;t[e]=i,e=a}t[e]=r}_down(e){const{data:t,compare:n}=this,r=this.length>>1,a=t[e];for(;e<r;){let r=1+(e<<1),i=t[r];const o=r+1;if(o<this.length&&n(t[o],i)<0&&(r=o,i=t[o]),n(i,a)>=0)break;t[e]=i,e=r}t[e]=a}}function rc(e,t){return e<t?-1:e>t?1:0}function ac(e,t=1,n=!1){let r=1/0,a=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<r)&&(r=t.x),(!e||t.y<a)&&(a=t.y),(!e||t.x>i)&&(i=t.x),(!e||t.y>o)&&(o=t.y)}const l=Math.min(i-r,o-a);let c=l/2;const u=new nc([],ic);if(0===l)return new A(r,a);for(let t=r;t<i;t+=l)for(let n=a;n<o;n+=l)u.push(new oc(t+c,n+c,c,e));let d=function(e){let t=0,n=0,r=0;const a=e[0];for(let e=0,i=a.length,o=i-1;e<i;o=e++){const i=a[e],s=a[o],l=i.x*s.y-s.x*i.y;n+=(i.x+s.x)*l,r+=(i.y+s.y)*l,t+=3*l}return new oc(n/t,r/t,0,e)}(e),p=u.length;for(;u.length;){const r=u.pop();(r.d>d.d||!d.d)&&(d=r,n&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,p)),r.max-d.d<=t||(c=r.h/2,u.push(new oc(r.p.x-c,r.p.y-c,c,e)),u.push(new oc(r.p.x+c,r.p.y-c,c,e)),u.push(new oc(r.p.x-c,r.p.y+c,c,e)),u.push(new oc(r.p.x+c,r.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,r){this.p=new A(e,t),this.h=n,this.d=function(e,t){let n=!1,r=1/0;for(let a=0;a<t.length;a++){const i=t[a];for(let t=0,a=i.length,o=a-1;t<a;o=t++){const a=i[t],s=i[o];a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(n=!n),r=Math.min(r,Hi(e,a,s))}}return(n?1:-1)*Math.sqrt(r)}(this.p,r),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 r=0,a=0;switch(t=Math.abs(t),n=Math.abs(n),e){case"top-right":case"top-left":case"top":a=n-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-n}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}return[r,a]}(e,t[0],t[1]):function(e,t){let n=0,r=0;t<0&&(t=0);const a=t/Math.sqrt(2);switch(e){case"top-right":case"top-left":r=a-7;break;case"bottom-right":case"bottom-left":r=7-a;break;case"bottom":r=7-t;break;case"top":r=t-7}switch(e){case"top-right":case"bottom-right":n=-a;break;case"top-left":case"bottom-left":n=a;break;case"left":n=t;break;case"right":n=-t}return[n,r]}(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,r,a,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(r.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,r=1){const a=e.get("icon-padding").evaluate(t,{},n),i=a&&a.values;return[i[0]*r,i[1]*r,i[2]*r,i[3]*r]}(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;a&&"none"!==q&&(t.allowVerticalPlacement&&r.vertical&&(E=Pl(a,r.vertical,q,m.get("icon-text-fit-padding"),h,g)),f&&(a=Pl(a,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,r,a,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,r);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&&a.vertical){const e=l.layout.get("text-rotate").evaluate(z,{},A)+90;E=new tc(c,n,u,d,p,a.vertical,m,h,f,e),s&&(j=new tc(c,n,u,d,p,s,_,y,f,e))}if(i){const r=l.layout.get("icon-rotate").evaluate(z,{}),a="none"!==l.layout.get("icon-text-fit"),o=Kl(i,r,k,a),m=s?Kl(s,r,k,a):void 0;q=new tc(c,n,u,d,p,i,_,y,!1,r),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(a.horizontal);for(const r of $){const i=a.horizontal[r];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,a.vertical?e.WritingMode.horizontal:e.WritingMode.horizontalOnly,s?$:[r],D,C,O,A),s)break}a.vertical&&(T+=pc(t,n,a.vertical,o,l,f,z,g,w,e.WritingMode.vertical,["vertical"],D,R,O,A));const F=N?N.boxStartIndex:t.collisionBoxArray.length,Y=N?N.boxEndIndex:t.collisionBoxArray.length,X=E?E.boxStartIndex:t.collisionBoxArray.length,H=E?E.boxEndIndex:t.collisionBoxArray.length,V=q?q.boxStartIndex:t.collisionBoxArray.length,U=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,Y,X,H,V,U,G,K,u,S,T,W,L,Q,0,m,B,I,J)}(t,p,l,r,a,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=Ul(e,v,k,r.vertical||f,a,24,y,t.overscaling,Wi);for(const r of n){const n=f;n&&bc(t,n.text,N,r)||j(e,r)}}else if("line-center"===w){for(const e of n.geometry)if(e.length>1){const t=Vl(e,k,r.vertical||f,a,24,y);t&&j(e,t)}}else if("Polygon"===n.type)for(const e of ts(n.geometry,0)){const t=ac(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,r,a,i,o,s,l,c,u,d,p,m,h){const f=function(e,t,n,r,a,i,o,s){const l=r.layout.get("text-rotate").evaluate(i,{})*Math.PI/180,c=[];for(const e of t.positionedLines)for(const r of e.positionedGlyphs){if(!r.rect)continue;const i=r.rect||{};let u=4,d=!0,p=1,m=0;const b=(a||s)&&r.vertical,h=r.metrics.advance*r.scale/2;if(s&&t.verticalizable){const t=24*(r.scale-1),n=(24-r.metrics.width*r.scale)/2;m=e.lineOffset/2-(r.imageName?-n:t)}if(r.imageName){const e=o[r.imageName];d=e.sdf,p=e.pixelRatio,u=1/p}const f=a?[r.x+h,r.y]:[0,0];let g=a?[0,0]:[r.x+h+n[0],r.y+n[1]-m],_=[0,0];b&&(_=g,g=[0,0]);const y=(r.metrics.left-u)*r.scale-h+g[0],M=(-r.metrics.top-u)*r.scale+g[1],v=y+i.w*r.scale/p,z=M+i.h*r.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,a=new A(22-n,-(r.imageName?n:0)),i=new A(..._);O._rotateAround(t,e)._add(a)._add(i),k._rotateAround(t,e)._add(a)._add(i),x._rotateAround(t,e)._add(a)._add(i),w._rotateAround(t,e)._add(a)._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:r.sectionIndex,isSDF:d,pixelOffsetTL:N,pixelOffsetBR:q,minFontScaleX:0,minFontScaleY:0})}return c}(0,n,s,a,i,o,r,e.allowVerticalPlacement),g=e.textSizeData;let _=null;"source"===g.kind?(_=[Bl*a.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,r){const a=e.compareText;if(t in a){const e=a[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<n)return!0}else a[t]=[];return a[t].push(r),!1}const hc=ds.VectorTileFeature.types,fc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function gc(e,t,n,r,a,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*r),Math.round(32*a),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(jr(t.text))return!0;return!1}class Mc{constructor(e){this.layoutVertexArray=new Ja,this.indexArray=new ni,this.programConfigurations=e,this.segments=new oi,this.dynamicLayoutVertexArray=new Za,this.opacityVertexArray=new Qa,this.placedSymbolArray=new Ra}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,n,r){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ys.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Xs.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,fc,!0),this.opacityVertexBuffer.itemSize=1),(n||r)&&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())}}_r("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())}}_r("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=ao([]),this.placementViewportMatrix=ao([]);const n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Il(this.zoom,n["text-size"]),this.iconSizeData=Il(this.zoom,n["icon-size"]);const r=this.layers[0].layout,a=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.canOverlap="never"!==wc(r,"text-overlap","text-allow-overlap")||"never"!==wc(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&!a.isConstant(),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map(t=>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 Ba,this.lineVertexArray=new Ia,this.symbolInstances=new Pa}calculateGlyphDependencies(e,t,n,r,a){for(let i=0;i<e.length;i++)if(t[e.charCodeAt(i)]=!0,(n||r)&&a){const n=Ks[e.charAt(i)];n&&(t[n.charCodeAt(0)]=!0)}}populate(t,n,r){const a=this.layers[0],i=a.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 Yr(this.zoom);for(const{feature:n,id:s,index:l,sourceLayerIndex:f}of t){const t=a._featureFilter.needGeometry,g=Ci(n,t);if(!a._featureFilter.filter(h,g,r))continue;let _,y;if(t||(g.geometry=Ti(n)),c){const e=a.getValueAndResolveTokens("text-field",g,r,b),t=Ce.factory(e);yc(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Ir()||this.hasRTLText&&Fr.isParsed())&&(_=Gs(t,a,g))}if(u){const e=a.getValueAndResolveTokens("icon-image",g,r,b);y=e instanceof De?e:De.fromString(e)}if(!_&&!y)continue;const M=this.sortFeaturesByKey?d.evaluate(g,{},r):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,{},r).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 r=kr(_.toString()),a=e.fontStack||t,i=m[a]=m[a]||{};this.calculateGlyphDependencies(e.text,i,n,this.allowVerticalPlacement,r)}}}"line"===i.get("symbol-placement")&&(this.features=function(e){const t={},n={},r=[];let a=0;function i(t){r.push(e[t]),a++}function o(e,t,a){const i=n[e];return delete n[e],n[t]=i,r[i].geometry[0].pop(),r[i].geometry[0]=r[i].geometry[0].concat(a[0]),i}function s(e,n,a){const i=t[n];return delete t[n],t[e]=i,r[i].geometry[0].shift(),r[i].geometry[0]=a[0].concat(r[i].geometry[0]),i}function l(e,t,n){const r=n?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.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),a=o(m,b,r[e].geometry);delete t[m],delete n[b],n[l(p,r[a].geometry,!0)]=a,r[e].geometry=null}else m in n?o(m,b,d):b in t?s(m,b,d):(i(c),t[m]=a-1,n[b]=a-1)}return r.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]),r=e.dist(t[e.segment]);const a={};for(let r=e.segment+1;r<t.length;r++)a[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:n},r<t.length-1&&(n+=t[r+1].dist(t[r]));for(let n=e.segment||0;n>=0;n--)a[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:r},n>0&&(r+=t[n-1].dist(t[n]));for(let e=0;e<t.length;e++){const t=a[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,n,r,a,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:a,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,a.x,A+a.y,u.x,u.y,r,z,d.x,d.y,g,M),gc(b,l.x,l.y,i.x,A+i.y,u.x+u.w,u.y,r,z,f.x,d.y,g,M),gc(b,l.x,l.y,s.x,A+s.y,u.x,u.y+u.h,r,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,r,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,r?r[0]:0,r?r[1]:0,a[0],a[1],s,0,!1,0,d)}_addCollisionDebugVertex(e,t,n,r,a,i){return t.emplaceBack(0,0),e.emplaceBack(n.x,n.y,r,a,Math.round(i.x),Math.round(i.y))}addCollisionDebugVertices(e,t,n,r,a,i,o){const s=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=s.vertexLength,c=a.layoutVertexArray,u=a.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,r)),this._addCollisionDebugVertex(c,u,i,d,p,new A(e,r)),s.vertexLength+=4;const m=a.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,r){for(let a=e;a<t;a++){const e=this.collisionBoxArray.get(a);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,r?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new vc(ei,Vs.members,ri),this.iconCollisionBox=new vc(ei,Vs.members,ri);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,r,a,i,o,s,l){const c={};for(let r=t;r<n;r++){const t=e.get(r);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=r;t<a;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),r=n.vertexStartIndex+4*n.numGlyphs;for(let t=n.vertexStartIndex;t<r;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),r=[],a=[],i=[];for(let e=0;e<this.symbolInstances.length;++e){i.push(e);const o=this.symbolInstances.get(e);r.push(0|Math.round(t*o.anchorX+n*o.anchorY)),a.push(o.featureIndex)}return i.sort((e,t)=>r[e]-r[t]||a[t]-a[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)}}}_r("SymbolBucket",zc,{omit:["layers","collisionBoxArray","features","compareText"]}),zc.MAX_GLYPHS=65535,zc.addDynamicAttributes=_c;const Oc=new aa({"symbol-placement":new Qr(ne.layout_symbol["symbol-placement"]),"symbol-spacing":new Qr(ne.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Qr(ne.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ea(ne.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Qr(ne.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Qr(ne.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Qr(ne.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Qr(ne.layout_symbol["icon-ignore-placement"]),"icon-optional":new Qr(ne.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Qr(ne.layout_symbol["icon-rotation-alignment"]),"icon-size":new ea(ne.layout_symbol["icon-size"]),"icon-text-fit":new Qr(ne.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Qr(ne.layout_symbol["icon-text-fit-padding"]),"icon-image":new ea(ne.layout_symbol["icon-image"]),"icon-rotate":new ea(ne.layout_symbol["icon-rotate"]),"icon-padding":new ea(ne.layout_symbol["icon-padding"]),"icon-keep-upright":new Qr(ne.layout_symbol["icon-keep-upright"]),"icon-offset":new ea(ne.layout_symbol["icon-offset"]),"icon-anchor":new ea(ne.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Qr(ne.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Qr(ne.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Qr(ne.layout_symbol["text-rotation-alignment"]),"text-field":new ea(ne.layout_symbol["text-field"]),"text-font":new ea(ne.layout_symbol["text-font"]),"text-size":new ea(ne.layout_symbol["text-size"]),"text-max-width":new ea(ne.layout_symbol["text-max-width"]),"text-line-height":new Qr(ne.layout_symbol["text-line-height"]),"text-letter-spacing":new ea(ne.layout_symbol["text-letter-spacing"]),"text-justify":new ea(ne.layout_symbol["text-justify"]),"text-radial-offset":new ea(ne.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Qr(ne.layout_symbol["text-variable-anchor"]),"text-anchor":new ea(ne.layout_symbol["text-anchor"]),"text-max-angle":new Qr(ne.layout_symbol["text-max-angle"]),"text-writing-mode":new Qr(ne.layout_symbol["text-writing-mode"]),"text-rotate":new ea(ne.layout_symbol["text-rotate"]),"text-padding":new Qr(ne.layout_symbol["text-padding"]),"text-keep-upright":new Qr(ne.layout_symbol["text-keep-upright"]),"text-transform":new ea(ne.layout_symbol["text-transform"]),"text-offset":new ea(ne.layout_symbol["text-offset"]),"text-allow-overlap":new Qr(ne.layout_symbol["text-allow-overlap"]),"text-overlap":new Qr(ne.layout_symbol["text-overlap"]),"text-ignore-placement":new Qr(ne.layout_symbol["text-ignore-placement"]),"text-optional":new Qr(ne.layout_symbol["text-optional"])});var kc={paint:new aa({"icon-opacity":new ea(ne.paint_symbol["icon-opacity"]),"icon-color":new ea(ne.paint_symbol["icon-color"]),"icon-halo-color":new ea(ne.paint_symbol["icon-halo-color"]),"icon-halo-width":new ea(ne.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ea(ne.paint_symbol["icon-halo-blur"]),"icon-translate":new Qr(ne.paint_symbol["icon-translate"]),"icon-translate-anchor":new Qr(ne.paint_symbol["icon-translate-anchor"]),"text-opacity":new ea(ne.paint_symbol["text-opacity"]),"text-color":new ea(ne.paint_symbol["text-color"],{runtimeType:be,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new ea(ne.paint_symbol["text-halo-color"]),"text-halo-width":new ea(ne.paint_symbol["text-halo-width"]),"text-halo-blur":new ea(ne.paint_symbol["text-halo-blur"]),"text-translate":new Qr(ne.paint_symbol["text-translate"]),"text-translate-anchor":new Qr(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}}_r("FormatSectionOverride",Ac,{omit:["defaultValue"]});class xc extends oa{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,r){const a=this.layout.get(e).evaluate(t,{},n,r),i=this._unevaluatedLayout._values[e];return i.isDataDriven()||wn(i.value)||!a?a:function(e,t){return t.replace(/{([^{}]+)}/g,(t,n)=>n in e?String(e[n]):"")}(t.properties,a)}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),r=new xn(n,t.property.specification);let a=null;a="constant"===t.value.kind||"source"===t.value.kind?new qn("source",r):new En("composite",r,t.value.zoomStops),this.paint._values[e]=new Jr(t.property,a,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"),r=kc.paint.properties[t];let a=!1;const i=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(a=!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=>{a||(t instanceof Fe&&Ie(t.value)===_e?i(t.value.sections):t instanceof an?i(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return a}}function wc(e,t,n){let r="never";const a=e.get(t);return a?r=a:e.get(n)&&(r="always"),r}var Nc={paint:new aa({"background-color":new Qr(ne.paint_background["background-color"]),"background-pattern":new na(ne.paint_background["background-pattern"]),"background-opacity":new Qr(ne.paint_background["background-opacity"])})},qc={paint:new aa({"raster-opacity":new Qr(ne.paint_raster["raster-opacity"]),"raster-hue-rotate":new Qr(ne.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Qr(ne.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Qr(ne.paint_raster["raster-brightness-max"]),"raster-saturation":new Qr(ne.paint_raster["raster-saturation"]),"raster-contrast":new Qr(ne.paint_raster["raster-contrast"]),"raster-resampling":new Qr(ne.paint_raster["raster-resampling"]),"raster-fade-duration":new Qr(ne.paint_raster["raster-fade-duration"])})};class Ec extends oa{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 oa{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,r,a,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 r)for(const t of e){const e=u?t:mo(t,s);let n=p;const r=uo([],[t.x,t.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?n*=r[3]/i.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(n*=i.cameraToCenterDistance/r[3]),Bi(d,e,n))return!0}return!1}},heatmap:class extends oa{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 oa{constructor(e){super(e,zo)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends oa{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,r,a,i,o){return Ii(Zi(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),i.angle,o),r)}isTileClipped(){return!0}},"fill-extrusion":class extends oa{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,r,a,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,r){const a=[];for(const n of e){const e=[n.x,n.y,0,1];uo(e,e,t),a.push(new A(e[0]/e[3],e[1]/e[3]))}return a}(l,s),p=function(e,t,n,r){const a=[],i=[],o=r[8]*t,s=r[9]*t,l=r[10]*t,c=r[11]*t,u=r[8]*n,d=r[9]*n,p=r[10]*n,m=r[11]*n;for(const t of e){const e=[],n=[];for(const a of t){const t=a.x,i=a.y,b=r[0]*t+r[4]*i+r[12],h=r[1]*t+r[5]*i+r[13],f=r[2]*t+r[6]*i+r[14],g=r[3]*t+r[7]*i+r[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)}a.push(e),i.push(n)}return[a,i]}(r,u,c,s);return function(e,t,n){let r=1/0;Ii(n,t)&&(r=js(n,t[0]));for(let a=0;a<t.length;a++){const i=t[a],o=e[a];for(let e=0;e<i.length-1;e++){const t=i[e],a=[t,i[e+1],o[e+1],o[e],t];Pi(n,a)&&(r=Math.min(r,js(n,a)))}}return r!==1/0&&r}(p[0],p[1],d)}},line:class extends oa{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)),r=Ki("line-offset",this,t);return n/2+Math.abs(r)+Ji(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,n,r,a,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&&(r=function(e,t){const n=[];for(let r=0;r<e.length;r++){const a=e[r],i=[];for(let e=0;e<a.length;e++){const n=a[e-1],r=a[e],o=a[e+1],s=0===e?new A(0,0):r.sub(n)._unit()._perp(),l=e===a.length-1?new A(0,0):o.sub(r)._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(r))}n.push(i)}return n}(r,c*o)),function(e,t,n){for(let r=0;r<t.length;r++){const a=t[r];if(e.length>=3)for(let t=0;t<a.length;t++)if(Ui(e,a[t]))return!0;if($i(e,a,n))return!0}return!1}(s,r,l)}isTileClipped(){return!0}},symbol:xc,background:class extends oa{constructor(e){super(e,Nc)}},raster:class extends oa{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,r=e.lat*t,a=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return Lc*Math.acos(Math.min(a,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 r,a;if(e instanceof Sc)r=e,a=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(r=e._sw,a=e._ne,!r||!a)return this}return t||n?(t.lng=Math.min(r.lng,t.lng),t.lat=Math.min(r.lat,t.lat),n.lng=Math.max(a.lng,n.lng),n.lat=Math.max(a.lat,n.lat)):(this._sw=new Sc(r.lng,r.lat),this._ne=new Sc(a.lng,a.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 r=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&r}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 r=2*Math.PI*6378137/256/Math.pow(2,n);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class Yc{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=Vc(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 r=(i=this.y,o=this.z,s=Fc(256*(a=this.x),256*(i=Math.pow(2,o)-i-1),o),l=Fc(256*(a+1),256*(i+1),o),s[0]+","+s[1]+","+l[0]+","+l[1]);var a,i,o,s,l;const c=function(e,t,n){let r,a="";for(let i=e;i>0;i--)r=1<<i-1,a+=(t&r?1:0)+(n&r?2:0);return a}(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,r)}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 Xc{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Vc(e,t.z,t.z,t.x,t.y)}}class Hc{constructor(e,t,n,r,a){if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Yc(n,+r,+a),this.key=Vc(t,e,n,r,a)}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?Vc(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Vc(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,r=2*this.canonical.y;return[new Hc(t,this.wrap,t,n,r),new Hc(t,this.wrap,t,n+1,r),new Hc(t,this.wrap,t,n,r+1),new Hc(t,this.wrap,t,n+1,r+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 Xc(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 Vc(e,t,n,r,a){(e*=2)<0&&(e=-1*e-1);const i=1<<n;return(i*i*e+i*a+r).toString(36)+n.toString(36)+t.toString(36)}_r("CanonicalTileID",Yc),_r("OverscaledTileID",Hc,{omit:["posMatrix"]});class Uc{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 r=this.dim=t.height-2;this.data=new Uint32Array(t.data.buffer),this.encoding=n||"mapbox";for(let e=0;e<r;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(r,e)]=this.data[this._idx(r-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,r)]=this.data[this._idx(e,r-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(r,-1)]=this.data[this._idx(r-1,0)],this.data[this._idx(-1,r)]=this.data[this._idx(0,r-1)],this.data[this._idx(r,r)]=this.data[this._idx(r-1,r-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let e=0;e<r;e++)for(let t=0;t<r;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),r=4*this._idx(e,t);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(n[r],n[r+1],n[r+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 r=t*this.dim,a=t*this.dim+this.dim,i=n*this.dim,o=n*this.dim+this.dim;switch(t){case-1:r=a-1;break;case 1:a=r+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=r;n<a;n++)this.data[this._idx(n,t)]=e.data[this._idx(n+s,t+l)]}}_r("DEMData",Uc);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,r,a){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=n,e._y=r,this.properties=e.properties,this.id=a}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 fr(Wi,16,0),this.grid3D=new fr(Wi,16,0),this.featureIndexArray=new Fa,this.promoteId=t}insert(e,t,n,r,a,i){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,r,a);const s=i?this.grid3D:this.grid;for(let e=0;e<t.length;e++){const n=t[e],r=[1/0,1/0,-1/0,-1/0];for(let e=0;e<n.length;e++){const t=n[e];r[0]=Math.min(r[0],t.x),r[1]=Math.min(r[1],t.y),r[2]=Math.max(r[2],t.x),r[3]=Math.max(r[3],t.y)}r[0]<Wi&&r[1]<Wi&&r[2]>=0&&r[3]>=0&&s.insert(o,r[0],r[1],r[2],r[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,r){this.loadVTLayers();const a=e.params||{},i=Wi/e.tileSize/e.scale,o=In(a.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,r,a)=>function(e,t,n,r,a){for(const i of e)if(t<=i.x&&n<=i.y&&r>=i.x&&a>=i.y)return!0;const i=[new A(t,n),new A(t,a),new A(r,a),new A(r,n)];if(e.length>2)for(const t of i)if(Ui(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,r+l,a+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,a.layers,a.availableImages,t,n,r,(t,n,r)=>(p||(p=Ti(t)),n.queryIntersectsFeature(s,t,r,p,this.z,e.transform,i,e.pixelPosMatrix)))}return m}loadMatchingFeature(e,t,n,r,a,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(r);if(a.needGeometry){const e=Ci(b,!0);if(!a.filter(new Yr(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!a.filter(new Yr(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 a=l[n];if(!a)continue;let m={};h&&u&&(m=u.getState(a.sourceLayer||"_geojsonTileLayer",h));const f=s({},c[n]);f.paint=Zc(f.paint,a.paint,b,m,o),f.layout=Zc(f.layout,a.layout,b,m,o);const g=!d||d(b,a,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:r,feature:_,intersectionZ:g})}}lookupSymbolFeatures(e,t,n,r,a,i,o,s){const l={};this.loadVTLayers();const c=In(a);for(const a of e)this.loadMatchingFeature(l,n,r,a,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,r,a){return u(e,(e,i)=>{const o=t instanceof Zr?t.get(i):null;return o&&o.evaluate?o.evaluate(n,r,a):o})}function Qc(e){let t=1/0,n=1/0,r=-1/0,a=-1/0;for(const i of e)t=Math.min(t,i.x),n=Math.min(n,i.y),r=Math.max(r,i.x),a=Math.max(a,i.y);return{minX:t,minY:n,maxX:r,maxY:a}}function eu(e,t){return t-e}var tu;_r("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,ru=[];const au=1e3/30,iu={mark(e){performance.mark(e)},frame(e){const t=e;null!=nu&&ru.push(t-nu),nu=t},clearMetrics(){nu=null,ru=[],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,r=ru.length,a=1/(ru.reduce((e,t)=>e+t,0)/r/1e3),i=ru.filter(e=>e>au).reduce((e,t)=>e+(t-au)/au,0);return{loadTime:t,fullLoadTime:n,fps:a,percentDroppedFrames:i/(r+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,r,a=!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:r,mustQueue:a,sourceMapId:this.mapId,data:Mr(t,o)},o),{cancel:()=>{n&&delete this.callbacks[i],this.target.postMessage({id:i,type:"<cancel>",targetMapId:r,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(vr(t.error)):n(null,vr(t.data)))}else{let n=!1;const r=z(this.globalScope)?void 0:[],a=t.hasCallback?(t,a)=>{n=!0,delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:t?Mr(t):null,data:Mr(a,r)},r)}:e=>{n=!0};let i=null;const o=vr(t.data);if(this.parent[t.type])i=this.parent[t.type](t.sourceMapId,o,a);else if(this.parent.getWorkerSource){const e=t.type.split(".");i=this.parent.getWorkerSource(t.sourceMapId,e[0],o.source)[e[1]](o,a)}else a(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=Yc,e.CollisionBoxArray=Ta,e.CollisionCircleLayoutArray=class extends Oa{},e.Color=Le,e.DEMData=Uc,e.DataConstantProperty=Qr,e.DictionaryCoder=Gc,e.EXTENT=Wi,e.ErrorEvent=ee,e.EvaluationParameters=Yr,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 Wa{},e.LngLat=Sc,e.LngLatBounds=Tc,e.MercatorCoordinate=$c,e.ONE_EM=24,e.OverscaledTileID=Hc,e.PerformanceUtils=iu,e.PosArray=Ya,e.Properties=aa,e.QuadTriangleArray=class extends Aa{},e.RGBAImage=Mo,e.RasterBoundsArray=class extends ma{},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=Vr,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=Xc,e.ValidationError=re,e.ZoomHistory=zr,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 r=e.length;const a=new Array(e.length);let i=null;e.forEach((e,o)=>{t(e,(e,t)=>{e&&(i=e),a[o]=t,0==--r&&n(i,a)})})},e.bezier=r,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=Us,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=ro,e.createExpression=Nn,e.createFilter=In,e.createLayout=ua,e.createStyleLayer=function(e){return"custom"===e.type?new Ec(e):new jc[e.type](e)},e.cross=function(e,t,n){var r=t[0],a=t[1],i=t[2],o=n[0],s=n[1],l=n[2];return e[0]=a*l-i*s,e[1]=i*o-r*l,e[2]=r*s-a*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=a,e.emitValidationErrors=hr,e.enforceCacheSizeLimit=function(e){W(),q&&q.then(t=>{t.keys().then(n=>{for(let r=0;r<n.length-e;r++)t.delete(n[r])})})},e.equals=function(e,t){var n=e[0],r=e[1],a=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(r-y)<=to*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-M)<=to*Math.max(1,Math.abs(a),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:r,upperSize:a}){return"source"===e.kind?r/Bl:"composite"===e.kind?Ot(r/Bl,a/Bl,n):t},e.evaluateSizeForZoom=function(e,t){let n=0,r=0;if("constant"===e.kind)r=e.layoutSize;else if("source"!==e.kind){const{interpolationType:a,minZoom:o,maxZoom:s}=e,l=a?i(Dt.interpolationFactor(a,t,o,s),0,1):0;"camera"===e.kind?r=Ot(e.minSize,e.maxSize,l):n=l}return{uSizeT:n,uSize:r}},e.evaluateVariableOffset=lc,e.evented=Br,e.exported=k,e.exported$1=S,e.extend=s,e.filterObject=d,e.fromRotation=function(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=-n,e[4]=r,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=X,e.getImage=K,e.getJSON=function(e,t){return Y(s(e,{type:"json"}),t)},e.getOverlapMode=wc,e.getRTLTextPluginStatus=Ir,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 r=window.document.createElement("source");H(e[t])||(n.crossOrigin="Anonymous"),r.src=e[t],n.appendChild(r)}return{cancel:()=>{}}},e.identity=ao,e.invert=function(e,t){var n=t[0],r=t[1],a=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-r*o,y=n*l-a*o,M=n*c-i*o,v=r*l-a*s,z=r*c-i*s,O=a*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]=(a*N-r*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-a*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]=(r*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-r*A+a*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 r in e)r in t||n.push(r);return n},e.lazyLoadRTLTextPlugin=function(){Fr.isLoading()||Fr.isLoaded()||"deferred"!==Ir()||$r()},e.makeRequest=Y,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],r=t[1],a=t[2],i=n*n+r*r+a*a;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,r,a,i,o){var s=1/(t-n),l=1/(r-a),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]=(a+r)*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,r=t.bucket.layers[0]._unevaluatedLayout._values,a={layoutIconSize:r["icon-size"].possiblyEvaluate(new Yr(t.bucket.zoom+1),t.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Yr(t.bucket.zoom+1),t.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Yr(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:n}=t.bucket.textSizeData;a.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Yr(e),t.canonical),r["text-size"].possiblyEvaluate(new Yr(n),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:n}=t.bucket.iconSizeData;a.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Yr(e),t.canonical),r["icon-size"].possiblyEvaluate(new Yr(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 r of t.bucket.features){const c=n.get("text-font").evaluate(r,{},t.canonical).join(","),u=l.evaluate(r,{},t.canonical),d=a.layoutTextSize.evaluate(r,{},t.canonical),p=a.layoutIconSize.evaluate(r,{},t.canonical),m={horizontal:{},vertical:void 0},h=r.text;let f,g=[0,0];if(h){const a=h.toString(),l=24*n.get("text-letter-spacing").evaluate(r,{},t.canonical),p=Ar(a)?l:0,b=n.get("text-anchor").evaluate(r,{},t.canonical),f=n.get("text-variable-anchor");if(!f){const e=n.get("text-radial-offset").evaluate(r,{},t.canonical);g=e?lc(b,[24*e,sc]):n.get("text-offset").evaluate(r,{},t.canonical).map(e=>24*e)}let _=o?"center":n.get("text-justify").evaluate(r,{},t.canonical);const y=n.get("symbol-placement"),M="point"===y?24*n.get("text-max-width").evaluate(r,{},t.canonical):0,v=()=>{t.bucket.allowVerticalPlacement&&kr(a)&&(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 r=!1;for(let a=0;a<n.length;a++){const o=n[a];if(!m.horizontal[o])if(r)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,r=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(),kr(a)&&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(r.icon&&r.icon.name){const e=t.imageMap[r.icon.name];e&&(f=Dl(t.imagePositions[r.icon.name],n.get("icon-offset").evaluate(r,{},t.canonical),n.get("icon-anchor").evaluate(r,{},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,r,m,f,t.imageMap,a,d,p,g,_,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.perspective=function(e,t,n,r,a){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!=a&&a!==1/0?(e[10]=(a+r)*(i=1/(r-a)),e[14]=2*a*r*i):(e[10]=-1,e[14]=-2*r),e},e.pick=function(e,t){const n={};for(let r=0;r<t.length;r++){const a=t[r];a in e&&(n[a]=e[a])}return n},e.plugin=Fr,e.pointGeometry=A,e.polygonIntersectsPolygon=Pi,e.potpack=Ol,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.register=_r,e.registerForPluginStateChange=function(e){return e({pluginStatus:Cr,pluginURL:Rr}),Br.on("pluginStateChange",e),e},e.renderColorRamp=vo,e.rotateX=function(e,t,n){var r=Math.sin(n),a=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*a+c*r,e[5]=o*a+u*r,e[6]=s*a+d*r,e[7]=l*a+p*r,e[8]=c*a-i*r,e[9]=u*a-o*r,e[10]=d*a-s*r,e[11]=p*a-l*r,e},e.rotateZ=function(e,t,n){var r=Math.sin(n),a=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*a+c*r,e[1]=o*a+u*r,e[2]=s*a+d*r,e[3]=l*a+p*r,e[4]=c*a-i*r,e[5]=u*a-o*r,e[6]=d*a-s*r,e[7]=p*a-l*r,e},e.scale=function(e,t,n){var r=n[0],a=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,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(Cr===Wr||Cr===Lr||Cr===Sr)throw new Error("setRTLTextPlugin cannot be called multiple times.");Rr=k.resolveURL(e),Cr=Wr,Tr=t,Pr(),n||$r()},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 r=t[0],a=t[1],i=t[2];return e[0]=r*n[0]+a*n[3]+i*n[6],e[1]=r*n[1]+a*n[4]+i*n[7],e[2]=r*n[2]+a*n[5]+i*n[8],e},e.transformMat4=uo,e.transformMat4$1=function(e,t,n){var r=t[0],a=t[1];return e[0]=n[0]*r+n[4]*a+n[12],e[1]=n[1]*r+n[5]*a+n[13],e},e.translate=function(e,t,n){var r,a,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]):(a=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]=r=t[0],e[1]=a,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]=r*h+s*f+d*g+t[12],e[13]=a*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=Dr,e.unicodeBlockLookup=Or,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=pr,e.validateStyle=dr,e.vectorTile=ds,e.warnOnce=b,e.wrap=o})),r(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 r of e)n+=t(r)+",";return n+"]"}const r=Object.keys(e).sort();let a="{";for(let n=0;n<r.length;n++)a+=`${JSON.stringify(r[n])}:${t(e[r[n]])},`;return a+"}"}function n(n){let r="";for(const a of e.refProperties)r+="/"+t(n[a]);return r}class r{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,r){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 r)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const a=function(e,t){const r={};for(let a=0;a<e.length;a++){const i=t&&t[e[a].id]||n(e[a]);t&&(t[e[a].id]=i);let o=r[i];o||(o=r[i]=[]),o.push(e[a])}const a=[];for(const e in r)a.push(r[e]);return a}(Object.values(this._layerConfigs),this.keyCache);for(const e of a){const t=e.map(e=>this._layers[e.id]),n=t[0];if("none"===n.visibility)continue;const r=n.source||"";let a=this.familiesBySource[r];a||(a=this.familiesBySource[r]={});const i=n.sourceLayer||"_geojsonTileLayer";let o=a[i];o||(o=a[i]=[]),o.push(t)}}}class a{constructor(t){const n={},r=[];for(const e in t){const a=t[e],i=n[e]={};for(const e in a){const t=a[+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};r.push(n),i[e]={rect:n,metrics:t.metrics}}}const{w:a,h:i}=e.potpack(r),o=new e.AlphaImage({width:a||1,height:i||1});for(const r in t){const a=t[r];for(const t in a){const i=a[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const s=n[r][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",a);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,r,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:r},p=n.familiesBySource[this.source];for(const n in p){const a=t.layers[n];if(!a)continue;1===a.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<a.length;e++){const t=a.feature(e),r=c.getId(t,n);s.push({feature:t,id:r,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,r),(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 a(b),n=new e.ImageAtlas(h,f);for(const a in u){const i=u[a];i instanceof e.SymbolBucket?(o(i.layers,this.zoom,r),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,r),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,r){const a=new e.EvaluationParameters(n);for(const e of t)e.recalculate(a,r)}function s(t,n){const r=e.getArrayBuffer(t.request,(t,r,a,i)=>{t?n(t):r&&n(null,{vectorTile:new e.vectorTile.VectorTile(new e.pbf(r)),rawData:r,cacheControl:a,expires:i})});return()=>{r.cancel(),n()}}class l{constructor(e,t,n,r){this.actor=e,this.layerIndex=t,this.availableImages=n,this.loadVectorData=r||s,this.loading={},this.loaded={}}loadTile(t,n){const r=t.uid;this.loading||(this.loading={});const a=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request),o=this.loading[r]=new i(t);o.abort=this.loadVectorData(t,(t,i)=>{if(delete this.loading[r],t||!i)return o.status="done",this.loaded[r]=o,n(t);const s=i.rawData,l={};i.expires&&(l.expires=i.expires),i.cacheControl&&(l.cacheControl=i.cacheControl);const c={};if(a){const e=a.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)))}o.vectorTile=i.vectorTile,o.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,(t,r)=>{if(t||!r)return n(t);n(null,e.extend({rawTileData:s.slice(0)},r,l,c))}),this.loaded=this.loaded||{},this.loaded[r]=o})}reloadTile(e,t){const n=this.loaded,r=e.uid,a=this;if(n&&n[r]){const i=n[r];i.showCollisionBoxes=e.showCollisionBoxes;const o=(e,n)=>{const r=i.reloadCallback;r&&(delete i.reloadCallback,i.parse(i.vectorTile,a.layerIndex,this.availableImages,a.actor,r)),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,r=e.uid;n&&n[r]&&n[r].abort&&(n[r].abort(),delete n[r]),t()}removeTile(e,t){const n=this.loaded,r=e.uid;n&&n[r]&&delete n[r],t()}}class c{constructor(){this.loaded={}}loadTile(t,n){const{uid:r,encoding:a,rawImageData:i}=t,o=e.isImageBitmap(i)?this.getImageData(i):i,s=new e.DEMData(r,o,a);this.loaded=this.loaded||{},this.loaded[r]=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,r=0,a=0,i=e.length,o=i-1;a<i;o=a++){var s=(e[a][0]-e[o][0])*(e[o][1]+e[a][1]),l=n+s;r+=Math.abs(n)>=Math.abs(s)?n-l+s:s-l+n,n=l}n+r>=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 r=[];for(const t of n)r.push(new e.pointGeometry(t[0],t[1]));t.push(r)}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],r=[],a=0;a<n.length;a++)r.push(new f(n[a][0],n[a][1]));this.geometry.push(r)}return this.geometry},M.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,n=-1/0,r=1/0,a=-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),r=Math.min(r,l.y),a=Math.max(a,l.y)}return[t,r,n,a]},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 r={keys:[],values:[],keycache:{},valuecache:{}};for(n=0;n<e.length;n++)r.feature=e.feature(n),t.writeMessage(2,A,r);var a=r.keys;for(n=0;n<a.length;n++)t.writeStringField(3,a[n]);var i=r.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,r=e.keys,a=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&&(r.push(s),i[s]=c=r.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&&(a.push(l),o[d]=p=a.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(),r=e.type,a=0,i=0,o=n.length,s=0;s<o;s++){var l=n[s],c=1;1===r&&(c=l.length),t.writeVarint(w(1,c));for(var u=3===r?l.length-1:l.length,d=0;d<u;d++){1===d&&1!==r&&t.writeVarint(w(2,u-1));var p=l[d].x-a,m=l[d].y-i;t.writeVarint(N(p)),t.writeVarint(N(m)),a+=p,i+=m}3===r&&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,r,a,i){if(a-r<=n)return;const o=r+a>>1;(function e(t,n,r,a,i,o){for(;i>a;){if(i-a>600){const s=i-a+1,l=r-a+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,r,Math.max(a,Math.floor(r-l*u/s+d)),Math.min(i,Math.floor(r+(s-l)*u/s+d)),o)}const s=n[2*r+o];let l=a,c=i;for(W(t,n,a,r),n[2*i+o]>s&&W(t,n,a,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*a+o]===s?W(t,n,a,c):(c++,W(t,n,c,i)),c<=r&&(a=c+1),r<=c&&(i=c-1)}})(e,t,o,r,a,i%2),j(e,t,n,r,o-1,i+1),j(e,t,n,o+1,a,i+1)}function W(e,t,n,r){L(e,n,r),L(t,2*n,2*r),L(t,2*n+1,2*r+1)}function L(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function S(e,t,n,r){const a=e-n,i=t-r;return a*a+i*i}h.exports=O,h.exports.fromVectorTileJs=O,h.exports.fromGeojsonVt=function(e,t){t=t||{};var n={};for(var r in e)n[r]=new z(e[r].features,t),n[r].name=r,n[r].version=t.version,n[r].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,r=64,a=Float64Array){this.nodeSize=r,this.points=e;const i=e.length<65536?Uint16Array:Uint32Array,o=this.ids=new i(e.length),s=this.coords=new a(2*e.length);for(let r=0;r<e.length;r++)o[r]=r,s[2*r]=t(e[r]),s[2*r+1]=n(e[r]);j(o,s,r,0,o.length-1,0)}range(e,t,n,r){return function(e,t,n,r,a,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<=a&&u>=r&&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<=a&&u>=r&&u<=i&&l.push(e[b]);const h=(d+1)%2;(0===d?n<=c:r<=u)&&(s.push(m),s.push(b-1),s.push(h)),(0===d?a>=c:i>=u)&&(s.push(b+1),s.push(p),s.push(h))}return l}(this.ids,this.coords,e,t,n,r,this.nodeSize)}within(e,t,n){return function(e,t,n,r,a,i){const o=[0,e.length-1,0],s=[],l=a*a;for(;o.length;){const c=o.pop(),u=o.pop(),d=o.pop();if(u-d<=i){for(let a=d;a<=u;a++)S(t[2*a],t[2*a+1],n,r)<=l&&s.push(e[a]);continue}const p=Math.floor((d+u)/2),m=t[2*p],b=t[2*p+1];S(m,b,n,r)<=l&&s.push(e[p]);const h=(c+1)%2;(0===c?n-a<=m:r-a<=b)&&(o.push(d),o.push(p-1),o.push(h)),(0===c?n+a>=m:r+a>=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:r,nodeSize:a}=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[r+1]=new R(o,K,J,a,Float32Array),t&&console.timeEnd(i);for(let e=r;e>=n;e--){const n=+Date.now();o=this._cluster(o,e),this.trees[e]=new R(o,K,J,a,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 r=Math.max(-90,Math.min(90,e[1]));let a=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,a=180;else if(n>a){const e=this.getClusters([n,r,180,i],t),o=this.getClusters([-180,r,a,i],t);return e.concat(o)}const o=this.trees[this._limitZoom(t)],s=o.range(H(n),V(i),H(a),V(r)),l=[];for(const e of s){const t=o.points[e];l.push(t.numPoints?Y(t):this.points[t.index])}return l}getChildren(e){const t=this._getOriginId(e),n=this._getOriginZoom(e),r="No cluster with the specified id.",a=this.trees[n];if(!a)throw new Error(r);const i=a.points[t];if(!i)throw new Error(r);const o=this.options.radius/(this.options.extent*Math.pow(2,n-1)),s=a.within(i.x,i.y,o),l=[];for(const t of s){const n=a.points[t];n.parentId===e&&l.push(n.numPoints?Y(n):this.points[n.index])}if(0===l.length)throw new Error(r);return l}getLeaves(e,t,n){const r=[];return this._appendLeaves(r,e,t=t||10,n=n||0,0),r}getTile(e,t,n){const r=this.trees[this._limitZoom(e)],a=Math.pow(2,e),{extent:i,radius:o}=this.options,s=o/i,l=(n-s)/a,c=(n+1+s)/a,u={features:[]};return this._addTileFeatures(r.range((t-s)/a,l,(t+1+s)/a,c),r.points,t,n,a,u),0===t&&this._addTileFeatures(r.range(1-s/a,l,1,c),r.points,a,n,a,u),t===a-1&&this._addTileFeatures(r.range(0,l,s/a,c),r.points,-1,n,a,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,r,a){const i=this.getChildren(t);for(const t of i){const i=t.properties;if(i&&i.cluster?a+i.point_count<=r?a+=i.point_count:a=this._appendLeaves(e,i.cluster_id,n,r,a):a<r?a++:e.push(t),e.length===n)break}return a}_addTileFeatures(e,t,n,r,a,i){for(const o of e){const e=t[o],s=e.numPoints;let l,c,u;if(s)l=X(e),c=e.x,u=e.y;else{const t=this.points[e.index];l=t.properties,c=H(t.geometry.coordinates[0]),u=V(t.geometry.coordinates[1])}const d={type:1,geometry:[[Math.round(this.options.extent*(c*a-n)),Math.round(this.options.extent*(u*a-r))]],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:r,extent:a,reduce:i,minPoints:o}=this.options,s=r/(a*Math.pow(2,t));for(let r=0;r<e.length;r++){const a=e[r];if(a.zoom<=t)continue;a.zoom=t;const l=this.trees[t+1],c=l.within(a.x,a.y,s),u=a.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=a.x*u,o=a.y*u,s=i&&u>1?this._map(a,!0):null;const p=(r<<5)+(t+1)+this.points.length;for(const n of c){const r=l.points[n];if(r.zoom<=t)continue;r.zoom=t;const c=r.numPoints||1;e+=r.x*c,o+=r.y*c,r.parentId=p,i&&(s||(s=this._map(a,!0)),i(s,this._map(r)))}a.parentId=p,n.push($(e/d,o/d,p,d,s))}else if(n.push(a),d>1)for(const e of c){const r=l.points[e];r.zoom<=t||(r.zoom=t,n.push(r))}}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,r=this.options.map(n);return t&&r===n?G({},r):r}}function $(e,t,n,r,a){return{x:P(e),y:P(t),zoom:1/0,id:n,parentId:-1,numPoints:r,properties:a}}function F(e,t){const[n,r]=e.geometry.coordinates;return{x:P(H(n)),y:P(V(r)),zoom:1/0,index:t,parentId:-1}}function Y(e){return{type:"Feature",id:e.id,properties:X(e),geometry:{type:"Point",coordinates:[(t=e.x,360*(t-.5)),U(e.y)]}};var t}function X(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 V(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 U(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,r,a,i){var o=a-n,s=i-r;if(0!==o||0!==s){var l=((e-n)*o+(t-r)*s)/(o*o+s*s);l>1?(n=a,r=i):l>0&&(n+=o*l,r+=s*l)}return(o=e-n)*o+(s=t-r)*s}function Q(e,t,n,r){var a={id:void 0===e?null:e,type:t,geometry:n,tags:r,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 r=0;r<t.length;r++)ee(e,t[r]);else if("MultiPolygon"===n)for(r=0;r<t.length;r++)for(var a=0;a<t[r].length;a++)ee(e,t[r][a])}(a),a}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,r){if(t.geometry){var a=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=r||0),"Point"===i)ne(a,s);else if("MultiPoint"===i)for(var c=0;c<a.length;c++)ne(a[c],s);else if("LineString"===i)re(a,s,o,!1);else if("MultiLineString"===i){if(n.lineMetrics){for(c=0;c<a.length;c++)re(a[c],s=[],o,!1),e.push(Q(l,"LineString",s,t.properties));return}ae(a,s,o,!1)}else if("Polygon"===i)ae(a,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,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(c=0;c<a.length;c++){var u=[];ae(a[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 re(e,t,n,r){for(var a,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+=r?(a*c-l*i)/2:Math.sqrt(Math.pow(l-a,2)+Math.pow(c-i,2))),a=l,i=c}var u=t.length-3;t[2]=1,function e(t,n,r,a){for(var i,o=a,s=r-n>>1,l=r-n,c=t[n],u=t[n+1],d=t[r],p=t[r+1],m=n+3;m<r;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>a&&(i-n>3&&e(t,n,i,a),t[i+2]=o,r-i>3&&e(t,i,r,a))}(t,0,u,n),t[u+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function ae(e,t,n,r){for(var a=0;a<e.length;a++){var i=[];re(e[a],i,n,r),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,r,a,i,o,s){if(r/=t,i>=(n/=t)&&o<r)return e;if(o<n||i>=r)return null;for(var l=[],c=0;c<e.length;c++){var u=e[c],d=u.geometry,p=u.type,m=0===a?u.minX:u.minY,b=0===a?u.maxX:u.maxY;if(m>=n&&b<r)l.push(u);else if(!(b<n||m>=r)){var h=[];if("Point"===p||"MultiPoint"===p)le(d,h,n,r,a);else if("LineString"===p)ce(d,h,n,r,a,!1,s.lineMetrics);else if("MultiLineString"===p)de(d,h,n,r,a,!1);else if("Polygon"===p)de(d,h,n,r,a,!0);else if("MultiPolygon"===p)for(var f=0;f<d.length;f++){var g=[];de(d[f],g,n,r,a,!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,r,a){for(var i=0;i<e.length;i+=3){var o=e[i+a];o>=n&&o<=r&&(t.push(e[i]),t.push(e[i+1]),t.push(e[i+2]))}}function ce(e,t,n,r,a,i,o){for(var s,l,c=ue(e),u=0===a?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===a?m:b,y=0===a?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)):_>r?y<r&&(l=u(c,m,b,f,g,r),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>r&&_<=r&&(l=u(c,m,b,f,g,r),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===a?m:b)>=n&&_<=r&&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,r,a,i){for(var o=0;o<e.length;o++)ce(e[o],t,n,r,a,i,!1)}function pe(e,t,n,r){e.push(t),e.push(n),e.push(r)}function me(e,t,n,r,a,i){var o=(i-t)/(r-t);return e.push(i),e.push(n+(a-n)*o),e.push(1),o}function be(e,t,n,r,a,i){var o=(i-n)/(a-n);return e.push(t+(r-t)*o),e.push(i),e.push(1),o}function he(e,t){for(var n=[],r=0;r<e.length;r++){var a,i=e[r],o=i.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=fe(i.geometry,t);else if("MultiLineString"===o||"Polygon"===o){a=[];for(var s=0;s<i.geometry.length;s++)a.push(fe(i.geometry[s],t))}else if("MultiPolygon"===o)for(a=[],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));a.push(l)}n.push(Q(i.id,o,a,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 r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}function ge(e,t){if(e.transformed)return e;var n,r,a,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(r=0;r<c.length;r+=2)l.geometry.push(_e(c[r],c[r+1],t,i,o,s));else for(r=0;r<c.length;r++){var d=[];for(a=0;a<c[r].length;a+=2)d.push(_e(c[r][a],c[r][a+1],t,i,o,s));l.geometry.push(d)}}return e.transformed=!0,e}function _e(e,t,n,r,a,i){return[Math.round(n*(e*r-a)),Math.round(n*(t*r-i))]}function ye(e,t,n,r,a){for(var i=t===a.maxZoom?0:a.tolerance/((1<<t)*a.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:r,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,a);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,r){var a=t.geometry,i=t.type,o=[];if("Point"===i||"MultiPoint"===i)for(var s=0;s<a.length;s+=3)o.push(a[s]),o.push(a[s+1]),e.numPoints++,e.numSimplified++;else if("LineString"===i)ve(o,a,e,n,!1,!1);else if("MultiLineString"===i||"Polygon"===i)for(s=0;s<a.length;s++)ve(o,a[s],e,n,"Polygon"===i,0===s);else if("MultiPolygon"===i)for(var l=0;l<a.length;l++){var c=a[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&&r.lineMetrics){for(var d in u={},t.tags)u[d]=t.tags[d];u.mapbox_clip_start=a.start/a.size,u.mapbox_clip_end=a.end/a.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,r,a,i){var o=r*r;if(r>0&&t.size<(a?o:r))n.numPoints+=t.length/3;else{for(var s=[],l=0;l<t.length;l+=3)(0===r||t[l+2]>o)&&(n.numSimplified++,s.push(t[l]),s.push(t[l+1])),n.numPoints++;a&&function(e,t){for(var n=0,r=0,a=e.length,i=a-2;r<a;i=r,r+=2)n+=(e[r]-e[i])*(e[r+1]+e[i+1]);if(n>0===t)for(r=0,a=e.length;r<a/2;r+=2){var o=e[r],s=e[r+1];e[r]=e[a-2-r],e[r+1]=e[a-1-r],e[a-2-r]=o,e[a-1-r]=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 r=function(e,t){var n=[];if("FeatureCollection"===e.type)for(var r=0;r<e.features.length;r++)te(n,e.features[r],t,r);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),(r=function(e,t){var n=t.buffer/t.extent,r=e,a=se(e,1,-1-n,n,0,-1,2,t),i=se(e,1,1-n,2+n,0,-1,2,t);return(a||i)&&(r=se(e,1,-n,1+n,0,-1,2,t)||[],a&&(r=he(a,1).concat(r)),i&&(r=r.concat(he(i,-1)))),r}(r,t)).length&&this.splitTile(r,0,0,0),n&&(r.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 r=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!r)return t(null,null);const a=new b(r.features);let i=h.exports(a);0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),t(null,{vectorTile:a,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,r,a,i,o){for(var s=[e,t,n,r],l=this.options,c=l.debug;s.length;){r=s.pop(),n=s.pop(),t=s.pop(),e=s.pop();var u=1<<t,d=Oe(t,n,r),p=this.tiles[d];if(!p&&(c>1&&console.time("creation"),p=this.tiles[d]=ye(e,t,n,r,l),this.tileCoords.push({z:t,x:n,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,r,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,a){if(t===l.maxZoom||t===a)continue;var b=1<<a-t;if(n!==Math.floor(i/b)||r!==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,r-v,r+O,1,p.minY,p.maxY,l),f=se(y,u,r+z,r+k,1,p.minY,p.maxY,l),y=null),M&&(g=se(M,u,r-v,r+O,1,p.minY,p.maxY,l),_=se(M,u,r+z,r+k,1,p.minY,p.maxY,l),M=null),c>1&&console.timeEnd("clipping"),s.push(h||[],t+1,2*n,2*r),s.push(f||[],t+1,2*n,2*r+1),s.push(g||[],t+1,2*n+1,2*r),s.push(_||[],t+1,2*n+1,2*r+1)}}},ze.prototype.getTile=function(e,t,n){var r=this.options,a=r.extent,i=r.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],a);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],a):null):null};class Ae extends l{constructor(e,t,n,r){super(e,t,n,ke),r&&(this.loadGeoJSON=r)}loadData(t,n){var r;null===(r=this._pendingRequest)||void 0===r||r.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const a=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request);this._pendingCallback=n,this._pendingRequest=this.loadGeoJSON(t,(r,i)=>{if(delete this._pendingCallback,delete this._pendingRequest,r||!i)return n(r);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 r,a=t&&t.type;if("FeatureCollection"===a)for(r=0;r<t.features.length;r++)e(t.features[r],n);else if("GeometryCollection"===a)for(r=0;r<t.geometries.length;r++)e(t.geometries[r],n);else if("Feature"===a)e(t.geometry,n);else if("Polygon"===a)u(t.coordinates,n);else if("MultiPolygon"===a)for(r=0;r<t.coordinates.length;r++)u(t.coordinates[r],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 r=i.features.filter(e=>n.value.evaluate({zoom:0},e));i={type:"FeatureCollection",features:r}}this._geoJSONIndex=t.cluster?new I(function({superclusterOptions:t,clusterProperties:n}){if(!n||!t)return t;const r={},a={},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);r[t]=s.value,a[t]=l.value}return t.map=e=>{o.properties=e;const t={};for(const e of s)t[e]=r[e].evaluate(i,o);return t},t.reduce=(e,t)=>{o.properties=t;for(const t of s)i.accumulated=e[t],e[t]=a[t].evaluate(i,o)},t}(t)).load(i.features):function(e,t){return new ze(e,t)}(i,t.geojsonVtOptions)}catch(r){return n(r)}this.loaded={};const o={};if(a){const e=a.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 r=this.workerSources[e][n];for(const e in r)r[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 r=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==r.removeSource?r.removeSource(t,n):n()}loadWorkerSource(e,t,n){try{this.self.importScripts(t.url),n()}catch(e){n(e.toString())}}syncRTLPluginState(t,n,r){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();r(n?void 0:new Error("RTL Text Plugin failed to import scripts from "+t),n)}}catch(e){r(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 r),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 r={send:(t,n,r)=>{this.actor.send(t,n,r,e)}};this.workerSources[e][t][n]=new this.workerSourceTypes[t](r,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})),r(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"}),r=URL.createObjectURL(n);try{t=new Worker(r),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(r),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===r[t=e&&e.failIfMajorPerformanceCaveat]&&(r[t]=function(e){var t,r=function(e){var t=document.createElement("canvas"),r=Object.create(n.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=e,t.getContext("webgl",r)||t.getContext("experimental-webgl",r)}(e);if(!r)return!1;try{t=r.createShader(r.VERTEX_SHADER)}catch(e){return!1}return!(!t||r.isContextLost())&&(r.shaderSource(t,"void main() {}"),r.compileShader(t),!0===r.getShaderParameter(t,r.COMPILE_STATUS))}(t)),r[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 r={};function a(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(!a(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(!a(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 r=window.document.createElement(e);return void 0!==t&&(r.className=t),n&&n.appendChild(r),r}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,r={}){e.addEventListener(t,n,"passive"in r?r:r.capture)}static removeEventListener(e,t,n,r={}){e.removeEventListener(t,n,"passive"in r?r:r.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 r=t.getBoundingClientRect();return new e.pointGeometry(n.clientX-r.left-t.clientLeft,n.clientY-r.top-t.clientTop)}static touchPos(t,n){const r=t.getBoundingClientRect(),a=[];for(let i=0;i<n.length;i++)a.push(new e.pointGeometry(n[i].clientX-r.left-t.clientLeft,n[i].clientY-r.top-t.clientTop));return a}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 r=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 r.path+=`${t}${n}`,function(e){const t=e.params.length?"?"+e.params.join("&"):"";return`${e.protocol}://${e.authority}${e.path}${t}`}(r)}setTransformRequest(e){this._transformRequestFn=e}}const s=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class l{constructor(e,t,n,r){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(t,r)}update(t,n,r){const{width:a,height:i}=t,o=!(this.size&&this.size[0]===a&&this.size[1]===i||r),{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=[a,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,a,i,0,this.format,l.UNSIGNED_BYTE,t.data);else{const{x:n,y:o}=r||{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,a,i,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(e,t,n){const{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_2D,this.texture),n!==a.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=a.LINEAR),e!==this.filter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,t),a.texParameteri(a.TEXTURE_2D,a.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 r=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),r=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),r=!1),this._validateContent(n.content,n)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let n=0;for(const r of e){if(r[0]<n||r[1]<r[0]||t<r[1])return!1;n=r[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 r={};for(const n of t){this.images[n]||this.fire(new e.Event("styleimagemissing",{id:n}));const t=this.images[n];t?r[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,r)}getPixelSize(){const{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(t){const n=this.patterns[t],r=this.getImage(t);if(!r)return null;if(n&&n.position.version===r.version)return n.position;if(n)n.position.version=r.version;else{const n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},a=new e.ImagePosition(n,r);this.patterns[t]={bin:n,position:a}}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:r}=e.potpack(t),a=this.atlasImage;a.resize({width:n||1,height:r||1});for(const t in this.patterns){const{bin:n}=this.patterns[t],r=n.x+1,i=n.y+1,o=this.images[t].data,s=o.width,l=o.height;e.RGBAImage.copy(o,a,{x:0,y:0},{x:r,y:i},{width:s,height:l}),e.RGBAImage.copy(o,a,{x:0,y:l-1},{x:r,y:i-1},{width:s,height:1}),e.RGBAImage.copy(o,a,{x:0,y:0},{x:r,y:i+l},{width:s,height:1}),e.RGBAImage.copy(o,a,{x:s-1,y:0},{x:r-1,y:i},{width:1,height:l}),e.RGBAImage.copy(o,a,{x:0,y:0},{x:r+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,r,a,i,o,s,l){for(let c=t;c<t+r;c++)m(e,n*i+c,i,a,o,s,l);for(let c=n;c<n+a;c++)m(e,c*i+t,1,r,o,s,l)}function m(e,t,n,r,a,i,o){i[0]=0,o[0]=-d,o[1]=d,a[0]=e[t];for(let s=1,l=0,c=0;s<r;s++){a[s]=e[t+s*n];const r=s*s;do{const e=i[l];c=(a[s]-a[e]+r-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<r;s++){for(;o[l+1]<s;)l++;const r=i[l],c=s-r;e[t+s*n]=a[r]+c*c}}class b{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}getGlyphs(t,n){const r=[];for(const e in t)for(const n of t[e])r.push({stack:e,id:n});e.asyncAll(r,({stack:e,id:t},n)=>{let r=this.entries[e];r||(r=this.entries[e]={glyphs:{},requests:{},ranges:{}});let a=r.glyphs[t];if(void 0!==a)return void n(null,{stack:e,id:t,glyph:a});if(a=this._tinySDF(r,e,t),a)return r.glyphs[t]=a,void n(null,{stack:e,id:t,glyph:a});const i=Math.floor(t/256);if(256*i>65535)return void n(new Error("glyphs > 65535 not supported"));if(r.ranges[i])return void n(null,{stack:e,id:t,glyph:a});let o=r.requests[i];o||(o=r.requests[i]=[],b.loadGlyphRange(e,i,this.url,this.requestManager,(e,t)=>{if(t){for(const e in t)this._doesCharSupportLocalGlyph(+e)||(r.glyphs[+e]=t[+e]);r.ranges[i]=!0}for(const n of o)n(e,t);delete r.requests[i]})),o.push((r,a)=>{r?n(r):a&&n(null,{stack:e,id:t,glyph:a[t]||null})})},(e,t)=>{if(e)n(e);else if(t){const e={};for(const{stack:n,id:r,glyph:a}of t)(e[n]||(e[n]={}))[r]=a&&{id:a.id,bitmap:a.bitmap.clone(),metrics:a.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,r){const a=this.localIdeographFontFamily;if(!a)return;if(!this._doesCharSupportLocalGlyph(r))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:a,fontWeight:e})}const o=i.draw(String.fromCharCode(r));return{id:r,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,r,a,i){const o=256*n,s=o+255,l=a.transformRequest(r.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 r of e.parseGlyphPbf(n))t[r.id]=r;i(null,t)}})},b.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:r=.25,fontFamily:a="sans-serif",fontWeight:i="normal",fontStyle:o="normal"}={}){this.buffer=t,this.cutoff=r,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 ${a}`,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:r,actualBoundingBoxLeft:a,actualBoundingBoxRight:i}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.min(this.size-this.buffer,Math.ceil(i-a)),l=Math.min(this.size-this.buffer,o+Math.ceil(r)),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 r=(e+g)*c+t+g;if(1===n)y[r]=0,_[r]=d;else{const e=.5-n;y[r]=e>0?e*e:0,_[r]=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,r){return{x:e.number(t.x,n.x,r),y:e.number(t.y,n.y,r),z:e.number(t.z,n.z,r)}}},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,r){return(!r||!1!==r.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 r=[];let a=e.length%2==1?-e[e.length-1]*n:0,i=e[0]*n,o=!0;r.push({left:a,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];a=s*n,s+=l,i=s*n,r.push({left:a,right:i,isDash:o,zeroLength:0===l})}return r}addRoundDash(e,t,n){const r=t/2;for(let t=-n;t<=n;t++){const a=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*(r+1);if(o.isDash){const e=r-Math.abs(p);d=Math.sqrt(u*u+e*e)}else d=r-Math.sqrt(u*u+p*p);this.data[a+s]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){const n=e[t],r=e[t+1];n.zeroLength?e.splice(t,1):r&&r.isDash===n.isDash&&(r.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 r=this.width*this.nextRow;let a=0,i=e[a];for(let t=0;t<this.width;t++){t/i.right>1&&(i=e[++a]);const n=Math.abs(t-i.left),o=Math.abs(t-i.right),s=Math.min(n,o);this.data[r+t]=Math.max(0,Math.min(255,(i.isDash?s:-s)+128))}}addDash(t,n){const r=n?7:0,a=2*r+1;if(this.nextRow+a>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,a=this.getDashRanges(t,this.width,e);n?this.addRoundDash(a,e,r):this.addRegularDash(a)}const o={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:i};return this.nextRow+=a,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 r=this.workerPool.acquire(this.id);for(let e=0;e<r.length;e++){const t=new y.Actor(r[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,r){e.asyncAll(this.actors,(e,r)=>{e.send(t,n,r)},r=r||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,r){const a=function(n,a){if(n)return r(n);if(a){const n=e.pick(e.extend(a,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);a.vector_layers&&(n.vectorLayers=a.vector_layers,n.vectorLayerIds=n.vectorLayers.map(e=>e.id)),r(null,n)}};return t.url?e.getJSON(n.transformRequest(t.url,e.ResourceType.Source),a):e.exported.frame(()=>a(null,t))}y.Actor=e.Actor;class v{constructor(t,n,r){this.bounds=e.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=r||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),r=Math.floor(e.mercatorXfromLng(this.bounds.getWest())*n),a=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>=r&&t.x<i&&t.y>=a&&t.y<o}}class z extends e.Evented{constructor(t,n,r,a){if(super(),this.id=t,this.dispatcher=r,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(a)}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 r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(r,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(r,a){return delete t.request,t.aborted?n(null):r&&404!==r.status?n(r):(a&&a.resourceTiming&&(t.resourceTiming=a.resourceTiming),this.map._refreshExpiredTiles&&a&&t.setExpiryData(a),t.loadVectorData(a,this.map.painter),e.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}a.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state?"loading"===t.state?t.reloadCallback=n:t.request=t.actor.send("reloadTile",a,i.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",a,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,r,a){super(),this.id=t,this.dispatcher=r,this.setEventedParent(a),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 r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=e.getImage(this.map._requestManager.transformRequest(r,e.ResourceType.Tile),(r,a,i)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(r)t.state="errored",n(r);else if(a){this.map._refreshExpiredTiles&&t.setExpiryData(i);const r=this.map.painter.context,o=r.gl;t.texture=this.map.painter.getTileTexture(a.width),t.texture?t.texture.update(a,{useMipmap:!0}):(t.texture=new l(r,a,o.RGBA,{useMipmap:!0}),t.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),r.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.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,r,a){super(t,n,r,a),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 r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function a(e,r){e&&(t.state="errored",n(e)),r&&(t.dem=r,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=e.getImage(this.map._requestManager.transformRequest(r,e.ResourceType.Tile),function(r,i){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(r)t.state="errored",n(r);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),r={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",r,a.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,r=Math.pow(2,n.z),a=(n.x-1+r)%r,i=0===n.x?t.wrap-1:t.wrap,o=(n.x+1+r)%r,s=n.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.OverscaledTileID(t.overscaledZ,i,n.z,a,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,a,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<r&&(l[new e.OverscaledTileID(t.overscaledZ,i,n.z,a,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,r,a){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=r.getActor(),this.setEventedParent(a),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,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:t,offset:n},r),this}_updateWorkerData(t){const n=e.extend({},this.workerOptions),r=this._data;"string"==typeof r?(n.request=this.map._requestManager.transformRequest(e.exported.resolveURL(r),e.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(r),this._pendingLoads++,this.fire(new e.Event("dataloading",{dataType:"source"})),this.actor.send(this.type+".loadData",n,(n,r)=>{if(this._pendingLoads--,this._removed||r&&r.abandoned)return void this.fire(new e.Event("dataabort",{dataType:"source",sourceDataType:t}));let a=null;if(r&&r.resourceTiming&&r.resourceTiming[this.id]&&(a=r.resourceTiming[this.id].slice(0)),n)return void this.fire(new e.ErrorEvent(n));const i={dataType:"source",sourceDataType:t};this._collectResourceTiming&&a&&a.length>0&&e.extend(i,{resourceTiming:a}),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 r={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.request=this.actor.send(n,r,(r,a)=>(delete e.request,e.unloadVectorData(),e.aborted?t(null):r?t(r):(e.loadVectorData(a,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,r){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(r),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),(r,a)=>{this._loaded=!0,r?this.fire(new e.ErrorEvent(r)):a&&(this.image=a,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,r=1/0,a=-1/0,i=-1/0;for(const e of t)n=Math.min(n,e.x),r=Math.min(r,e.y),a=Math.max(a,e.x),i=Math.max(i,e.y);const o=Math.max(a-n,i-r),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),l=Math.pow(2,s);return new e.CanonicalTileID(s,Math.floor((n+a)/2*l),Math.floor((r+i)/2*l))}(n),this.minzoom=this.maxzoom=this.tileID.z;const r=n.map(e=>this.tileID.getTilePoint(e)._round());return this._boundsArray=new e.RasterBoundsArray,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,e.EXTENT,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,e.EXTENT),this._boundsArray.emplaceBack(r[2].x,r[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,r){super(e,t,n,r),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,r,a){super(t,n,r,a),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,r=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,r.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 r=e.create();return e.translate(r,r,[1,1,0]),e.scale(r,r,[.5*t.width,.5*t.height,1]),e.multiply(r,r,t.calculatePosMatrix(n.toUnwrapped()))}function L(e,t,n,r,a,i){const o=function(e,t,n){if(e)for(const r of e){const e=t[r];if(e&&e.source===n&&"fill-extrusion"===e.type)return!0}else for(const e in t){const r=t[e];if(r.source===n&&"fill-extrusion"===r.type)return!0}return!1}(a&&a.layers,t,e.id),s=i.maxPitchScaleFactor(),l=e.tilesIn(r,s,o);l.sort(S);const c=[];for(const r of l)c.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,n,e._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,a,i,s,W(e.transform,r.tileID))});const u=function(e){const t={},n={};for(const r of e){const e=r.queryResults,a=r.wrappedTileID,i=n[a]=n[a]||{};for(const n in e){const r=e[n],a=i[n]=i[n]||{},o=t[n]=t[n]||[];for(const e of r)a[e.featureIndex]||(a[e.featureIndex]=!0,o.push(e))}}return t}(c);for(const t in u)u[t].forEach(t=>{const n=t.feature,r=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=r});return u}function S(e,t){const n=e.tileID,r=t.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.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,r){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 r of e){const e=r.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(const t of e)n[t.id]=r}}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,!r)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,r,a,i,o,s,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:a,scale:i,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:o,queryPadding:this.queryPadding*l},e,t,n):{}}querySourceFeatures(t,n){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const a=r.loadVTLayers(),i=n?n.sourceLayer:"",o=a._geojsonTileLayer||a[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 a=o.feature(n);if(s.needGeometry){const t=e.toEvaluationFeature(a,!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),a))continue;const p=r.getId(a,i),m=new e.GeoJSONFeature(a,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 r=this.expirationTime-n;r?this.expirationTime=e+Math.max(r,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 r in this.buckets){if(!t.style.hasLayer(r))continue;const a=this.buckets[r],i=a.layers[0].sourceLayer||"_geojsonTileLayer",o=n[i],s=e[i];if(!o||!s||0===Object.keys(s).length)continue;a.update(s,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=t&&t.style&&t.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(a)))}}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 r=e.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const a={value:t,timeout:void 0};if(void 0!==n&&(a.timeout=setTimeout(()=>{this.remove(e,a)},n)),this.data[r].push(a),this.order.push(r),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,r=void 0===t?0:this.data[n].indexOf(t),a=this.data[n][r];return this.data[n].splice(r,1),a.timeout&&clearTimeout(a.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(a.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 r of this.data[n])e(r.value)||t.push(r);for(const e of t)this.remove(e.value.tileID,e)}}class R{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,r){const a=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][a]=this.stateChanges[t][a]||{},e.extend(this.stateChanges[t][a],r),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==a&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][a]){this.deletedStates[t][a]={};for(const e in this.state[t][a])r[e]||(this.deletedStates[t][a][e]=null)}else for(const e in r)this.deletedStates[t]&&this.deletedStates[t][a]&&null===this.deletedStates[t][a][e]&&delete this.deletedStates[t][a][e]}removeFeatureState(e,t,n){if(null===this.deletedStates[e])return;const r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][n]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(n in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][n]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(t,n){const r=String(n),a=e.extend({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);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 a[t]}return a}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(t,n){const r={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const n={};for(const r in this.stateChanges[t])this.state[t][r]||(this.state[t][r]={}),e.extend(this.state[t][r],this.stateChanges[t][r]),n[r]=this.state[t][r];r[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]}r[t]=r[t]||{},e.extend(r[t],n)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const e in t)t[e].setFeatureState(r,n)}}class D extends e.Evented{constructor(t,n,r){super(),this.id=t,this.dispatcher=r,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,r,a){const i=new j[n.type](t,n,r,a);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,r,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 r=t.tileID,a=n.tileID,i=new e.pointGeometry(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),o=new e.pointGeometry(a.canonical.x,a.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-a.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,r,a){if(a)return t.state="errored",void(404!==a.status?this._source.fire(new e.ErrorEvent(a,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=e.exported.now(),"expired"===r&&(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 r=0;r<t.length;r++){const a=t[r];if(e.neighboringTiles&&e.neighboringTiles[a]){const t=this.getTileByID(a);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 r=t.tileID.canonical.y-e.tileID.canonical.y,a=Math.pow(2,e.tileID.canonical.z),i=t.tileID.key;0===n&&0===r||Math.abs(r)>1||(Math.abs(n)>1&&(1===Math.abs(n+a)?n+=a:1===Math.abs(n-a)&&(n-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,r),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,r){for(const a in this._tiles){let i=this._tiles[a];if(r[a]||!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]){r[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),r=this._getLoadedTile(t);if(r)return r}}_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,r=Math.floor(t*n*5),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(a)}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 r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}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 r;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new e.OverscaledTileID(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(r=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&&(r=r.filter(e=>this._source.hasTile(e)))):r=[];const a=t.coveringZoomLevel(this._source),i=Math.max(a-D.maxOverzooming,this._source.minzoom),o=Math.max(a+D.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const e={};for(const t of r)if(t.canonical.z>this._source.minzoom){const n=t.scaledTo(t.canonical.z-1);e[n.key]=n;const r=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[r.key]=r}r=r.concat(Object.values(e))}const s=this._updateRetainedTiles(r,a);if(B(this._source.type)){const t={},l={},c=Object.keys(s);for(const n of c){const r=s[n],a=this._tiles[n];if(!a||a.fadeEndTime&&a.fadeEndTime<=e.exported.now())continue;const o=this.findLoadedParent(r,i);o&&(this._addTile(o.tileID),t[o.tileID.key]=o.tileID),l[n]=r}this._retainLoadedChildren(l,a,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 r)this._tiles[n.key].hasData()?e[n.key]=n:t[n.key]=n;for(const n in t){const r=t[n].children(this._source.maxzoom);this._tiles[r[0].key]&&this._tiles[r[1].key]&&this._tiles[r[2].key]&&this._tiles[r[3].key]&&(e[r[0].key]=s[r[0].key]=r[0],e[r[1].key]=s[r[1].key]=r[1],e[r[2].key]=s[r[2].key]=r[2],e[r[3].key]=s[r[3].key]=r[3],delete t[n])}for(const n in t){const r=this.findLoadedParent(t[n],this._source.minzoom);if(r){e[r.tileID.key]=s[r.tileID.key]=r.tileID;for(const t in e)e[t].isChildOf(r.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={},r={},a=Math.max(t-D.maxOverzooming,this._source.minzoom),i=Math.max(t+D.maxUnderzooming,this._source.minzoom),o={};for(const r of e){const e=this._addTile(r);n[r.key]=r,e.hasData()||t<this._source.maxzoom&&(o[r.key]=r)}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>=a;--t){const a=i.scaledTo(t);if(r[a.key])break;if(r[a.key]=!0,e=this.getTile(a),!e&&o&&(e=this._addTile(a)),e&&(n[a.key]=a,o=e.wasRequested(),e.hasData()))break}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let n,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){n=this._loadedParentTiles[r.key];break}t.push(r.key);const e=r.scaledTo(r.overscaledZ-1);if(n=this._getLoadedTile(e),n)break;r=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 r=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,r||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,r){const a=[],i=this.transform;if(!i)return a;const o=r?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 r=this._tiles[c[t]];if(r.holdingForFade())continue;const o=r.tileID,b=Math.pow(2,i.zoom-r.tileID.overscaledZ),h=n*r.queryPadding*e.EXTENT/r.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));a.push({tile:r,tileID:o,queryGeometry:e,cameraQueryGeometry:t,scale:b})}}return a}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 r=this._tiles[e];r&&r.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),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-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(Ma.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 Y;function X(){return Y||(Y=new $),Y}function H(t,n){const r={};for(const e in t)"ref"!==e&&(r[e]=t[e]);return e.refProperties.forEach(e=>{e in n&&(r[e]=n[e])}),r}function V(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 U={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:U.addSource,args:[e,t[e]]})}function K(e,t,n){t.push({command:U.removeSource,args:[e]}),n[e]=!0}function J(e,t,n,r){K(e,n,r),G(e,t,n)}function Z(e,t,n){let r;for(r in e[n])if(Object.prototype.hasOwnProperty.call(e[n],r)&&"data"!==r&&!a(e[n][r],t[n][r]))return!1;for(r in t[n])if(Object.prototype.hasOwnProperty.call(t[n],r)&&"data"!==r&&!a(e[n][r],t[n][r]))return!1;return!0}function Q(e,t,n,r,i,o){let s;for(s in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,s)&&(a(e[s],t[s])||n.push({command:o,args:[r,s,t[s],i]}));for(s in t)Object.prototype.hasOwnProperty.call(t,s)&&!Object.prototype.hasOwnProperty.call(e,s)&&(a(e[s],t[s])||n.push({command:o,args:[r,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,r=this._distances[n];const a=t*this.paddedLength+this.padding;for(;r<a&&n<this._distances.length;)r=this._distances[++n];const i=n-1,o=this._distances[i],s=r-o,l=s>0?(a-o)/s:0;return this.points[i].mult(1-l).add(this.points[n].mult(l))}}function re(e,t){let n=!0;return"always"===e||"never"!==e&&"never"!==t||(n=!1),n}class ae{constructor(e,t,n){const r=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),a.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,r,a){this._forEachCell(t,n,r,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(a)}insertCircle(e,t,n,r){this._forEachCell(t-r,n-r,t+r,n+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(r)}_insertBoxCell(e,t,n,r,a,i){this.boxCells[a].push(i)}_insertCircleCell(e,t,n,r,a,i){this.circleCells[a].push(i)}_query(e,t,n,r,a,i,o){if(n<0||e>this.width||r<0||t>this.height)return[];const s=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(a)return[{key:null,x1:e,y1:t,x2:n,y2:r}];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],r=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-r,y1:n-r,x2:t+r,y2:n+r})}}else this._forEachCell(e,t,n,r,this._queryCell,s,{hitTest:a,overlapMode:i,seenUids:{box:{},circle:{}}},o);return s}query(e,t,n,r){return this._query(e,t,n,r,!1,null)}hitTest(e,t,n,r,a,i){return this._query(e,t,n,r,!0,a,i).length>0}hitTestCircle(e,t,n,r,a){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:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},a),c.length>0}_queryCell(e,t,n,r,a,i,o,s){const{seenUids:l,hitTest:c,overlapMode:u}=o,d=this.boxCells[a];if(null!==d){const a=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<=a[d+2]&&t<=a[d+3]&&n>=a[d+0]&&r>=a[d+1]&&(!s||s(p))&&(!c||!re(u,p.overlapMode))&&(i.push({key:p,x1:a[d],y1:a[d+1],x2:a[d+2],y2:a[d+3]}),c))return!0}}const p=this.circleCells[a];if(null!==p){const a=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(a[d],a[d+1],a[d+2],e,t,n,r)&&(!s||s(p))&&(!c||!re(u,p.overlapMode))){const e=a[d],t=a[d+1],n=a[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,r,a,i,o,s){const{circle:l,seenUids:c,overlapMode:u}=o,d=this.boxCells[a];if(null!==d){const e=this.bboxes;for(const t of d)if(!c.box[t]){c.box[t]=!0;const n=4*t,r=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(r))&&!re(u,r.overlapMode))return i.push(!0),!0}}const p=this.circleCells[a];if(null!==p){const e=this.circles;for(const t of p)if(!c.circle[t]){c.circle[t]=!0;const n=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[n],e[n+1],e[n+2],l.x,l.y,l.radius)&&(!s||s(r))&&!re(u,r.overlapMode))return i.push(!0),!0}}}_forEachCell(e,t,n,r,a,i,o,s){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(r);for(let p=l;p<=u;p++)for(let l=c;l<=d;l++)if(a.call(this,e,t,n,r,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,r,a,i){const o=r-e,s=a-t,l=n+i;return l*l>o*o+s*s}_circleAndRectCollide(e,t,n,r,a,i,o){const s=(i-r)/2,l=Math.abs(e-(r+s));if(l>s+n)return!1;const c=(o-a)/2,u=Math.abs(t-(a+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,r,a,i){const o=e.create();return n?(e.scale(o,o,[1/i,1/i,1]),r||e.rotateZ(o,o,a.angle)):e.multiply(o,a.labelPlaneMatrix,t),o}function oe(t,n,r,a,i){if(n){const n=e.clone(t);return e.scale(n,n,[i,i,1]),r||e.rotateZ(n,n,-a.angle),n}return a.glCoordMatrix}function se(t,n,r){let a;r?(a=[t.x,t.y,r(t.x,t.y),1],e.transformMat4(a,a,n)):(a=[t.x,t.y,0,1],_e(a,a,n));const i=a[3];return{point:new e.pointGeometry(a[0]/i,a[1]/i),signedDistanceFromCamera:i}}function le(e,t){return.5+e/t*.5}function ce(e,t){const n=e[0]/e[3],r=e[1]/e[3];return n>=-t[0]&&n<=t[0]&&r>=-t[1]&&r<=t[1]}function ue(t,n,r,a,i,o,s,l,c,u){const d=a?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(d,r.transform.zoom),m=[256/r.width*2+1,256/r.height*2+1],b=a?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;b.clear();const h=t.lineVertexArray,f=a?t.text.placedSymbolArray:t.icon.placedSymbolArray,g=r.transform.width/r.transform.height;let _=!1;for(let a=0;a<f.length;a++){const y=f.get(a);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(r.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)}a?t.text.dynamicLayoutVertexBuffer.updateData(b):t.icon.dynamicLayoutVertexBuffer.updateData(b)}function de(e,t,n,r,a,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,r,a,i,o,s.segment,b,h,l,c,u,d,p);if(!_)return null;const y=he(e*g,n,r,a,i,o,s.segment,b,h,l,c,u,d,p);return y?{first:_,last:y}:null}function pe(t,n,r,a){return t===e.WritingMode.horizontal&&Math.abs(r.y-n.y)>Math.abs(r.x-n.x)*a?{useVertical:!0}:(t===e.WritingMode.vertical?n.y<r.y:n.x>r.x)?{needsFlipping:!0}:null}function me(t,n,r,a,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,r,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(a&&!r){const e=pe(t.writingMode,v,z,b);if(e)return e}M=[u.first];for(let a=t.glyphStartIndex+1;a<e-1;a++)M.push(he(g*l.getoffsetX(a),_,y,r,d,p,t.segment,n,i,c,o,m,h,f));M.push(u.last)}else{if(a&&!r){const n=se(p,i,f).point,r=t.lineStartIndex+t.segment+1,a=new e.pointGeometry(c.getx(r),c.gety(r)),o=se(a,i,f),s=o.signedDistanceFromCamera>0?o.point:be(p,a,n,1,i,f),l=pe(t.writingMode,n,s,b);if(l)return l}const n=he(g*l.getoffsetX(t.glyphStartIndex),_,y,r,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,r,a,i){const o=se(e.add(e.sub(t)._unit()),a,i).point,s=n.sub(o);return n.add(s._mult(r/s.mag()))}function he(t,n,r,a,i,o,s,l,c,u,d,p,m,b){const h=a?t-n:t+n;let f=h>0?1:-1,g=0;a&&(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(r*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 r=t[0],a=t[1];return e[0]=n[0]*r+n[4]*a+n[12],e[1]=n[1]*r+n[5]*a+n[13],e[3]=n[3]*r+n[7]*a+n[15],e}const ye=100;class Me{constructor(e,t=new ae(e.width+200,e.height+200,25),n=new ae(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,r,a,i){const o=this.projectAndGetPerspectiveRatio(r,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,a)||o.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,c,u,d],offscreen:this.isOffscreen(l,c,u,d)}}placeCollisionCircles(t,n,r,a,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,a,n.lineOffsetX*y,n.lineOffsetY*y,!1,M,f,n,r,s,{},!1,b);let z=!1,O=!1,k=!0;if(v){const n=.5*p*_+m,r=new e.pointGeometry(-100,-100),a=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>=r.x&&n.x<=a.x&&t.y>=r.y&&n.y<=a.y?[u]:n.x<r.x||t.x>a.x||n.y<r.y||t.y>a.y?[]:e.clipLine([u],r.x,r.y,a.x,a.y)}for(const e of g){i.reset(e,.25*n);let r=0;r=i.length<=.5*n?1:Math.ceil(i.paddedLength/f)+1;for(let e=0;e<r;e++){const a=e/Math.max(r-1,1),o=i.lerp(a),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 r=1/0,a=1/0,i=-1/0,o=-1/0;for(const s of t){const t=new e.pointGeometry(s.x+ye,s.y+ye);r=Math.min(r,t.x),a=Math.min(a,t.y),i=Math.max(i,t.x),o=Math.max(o,t.y),n.push(t)}const s=this.grid.query(r,a,i,o).concat(this.ignoredGrid.query(r,a,i,o)),l={},c={};for(const t of s){const r=t.key;if(void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;const a=[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,a)&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(e,t,n,r,a,i){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:a,collisionGroupID:i,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,r,a,i){const o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:a,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,r,a){let i;return a?(i=[n,r,a(n,r),1],e.transformMat4(i,i,t)):(i=[n,r,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,r){return n<ye||e>=this.screenRightBoundary||r<ye||t>this.screenBottomBoundary}isInsideGrid(e,t,n,r){return n>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const t=e.identity([]);return e.translate(t,t,[-100,-100,0]),t}}function ve(t,n,r){return n*(e.EXTENT/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}class ze{constructor(e,t,n,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&n?1:0,this.placed=n}isHidden(){return 0===this.opacity&&!this.placed}}class Oe{constructor(e,t,n,r,a){this.text=new ze(e?e.text:null,t,n,a),this.icon=new ze(e?e.icon:null,t,r,a)}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,r,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=r,this.tileID=a}}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,r,a,i){const{horizontalAlign:o,verticalAlign:s}=e.getAnchorAlignment(t),l=-(o-.5)*n,c=-(s-.5)*r,u=e.evaluateVariableOffset(t,a);return new e.pointGeometry(l+u[0]*i,c+u[1]*i)}function qe(t,n,r,a,i,o){const{x1:s,x2:l,y1:c,y2:u,anchorPointX:d,anchorPointY:p}=t,m=new e.pointGeometry(n,r);return a&&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,r,a){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(r),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,r,a){const i=r.getBucket(n),o=r.latestFeatureIndex;if(!i||!o||n.id!==i.layerIds[0])return;const s=r.collisionBoxArray,l=i.layers[0].layout,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),u=r.tileSize/e.EXTENT,d=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),m="map"===l.get("text-rotation-alignment"),b=ve(r,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,r.tileID);const g={bucket:i,layout:l,posMatrix:d,textLabelPlaneMatrix:h,labelToScreenMatrix:f,scale:c,textPixelRatio:u,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:e.evaluateSizeForZoom(i.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(i.sourceID)};if(a)for(const e of i.sortKeyRanges){const{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:a}=e;t.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:a,parameters:g})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:i.symbolInstances.length,parameters:g})}attemptAnchorPlacement(e,t,n,r,a,i,o,s,l,c,u,d,p,m,b,h){const f=[d.textOffset0,d.textOffset1],g=Ne(e,n,r,f,a),_=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:r,anchor:e,textBoxScale:a,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,r){const{bucket:a,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||!a.hasIconData()||h),A=y&&(g||!a.hasTextData()||b);!a.collisionArrays&&d&&a.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[a.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 r=e.WritingMode.horizontal;if(a.allowVerticalPlacement&&!n&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,r=e,this.markUsedOrientation(a,r,t))}return r},r=(n,r)=>{if(a.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const t of a.writingModes)if(t===e.WritingMode.vertical?(N=r(),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,r)=>{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,a,r,d,R);if(b&&(p=b.placedGlyphBoxes,p&&p.box&&p.box.length)){y=!0,w=b.shift;break}}return p};r(()=>l(D,d.iconBox,e.WritingMode.horizontal),()=>{const n=d.verticalTextBox;return a.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(a,e.anchor,t,u))}}else{const i=(e,n)=>{const r=this.collisionIndex.placeCollisionBox(e,f,c,o,m.predicate,R);return r&&r.box&&r.box.length&&(this.markUsedOrientation(a,n,t),this.placedOrientations[t.crossTileID]=n),r};r(()=>i(D,e.WritingMode.horizontal),()=>{const n=d.verticalTextBox;return a.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=a.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),c=e.evaluateSizeForFeature(a.textSizeData,p,n),u=i.get("text-padding");j=this.collisionIndex.placeCollisionCircles(f,n,a.lineVertexArray,a.glyphOffsetArray,c,o,s,l,r,v,m.predicate,t.collisionCircleDiameter,u,R),j.circles.length&&j.collisionDetected&&!r&&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"),a.bucketInstanceId,q&&q.box&&S?S:L,m.ID),O&&W&&this.collisionIndex.insertCollisionBox(W.box,_,i.get("icon-ignore-placement"),a.bucketInstanceId,T,m.ID),j&&(y&&this.collisionIndex.insertCollisionCircles(j.circles,f,i.get("text-ignore-placement"),a.bucketInstanceId,L,m.ID),r)){const e=a.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===a.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new ke(y||k,O||A,x||a.justReloaded),n[t.crossTileID]=!0};if(O){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const e=a.getSortedSymbolIndexes(this.transform.angle);for(let t=e.length-1;t>=0;--t){const n=e[t];x(a.symbolInstances.get(n),a.collisionArrays[n])}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)x(a.symbolInstances.get(e),a.collisionArrays[e]);if(r&&a.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[a.bucketInstanceId];e.invert(t.invProjMatrix,o),t.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1}markUsedJustification(t,n,r,a){let i;i=a===e.WritingMode.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[e.getAnchorJustification(n)];const o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(const e of o)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=i>=0&&e!==i?0:r.crossTileID)}markUsedOrientation(t,n,r){const a=n===e.WritingMode.horizontal||n===e.WritingMode.horizontalOnly?n:0,i=n===e.WritingMode.vertical?n:0,o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const e of o)t.text.placedSymbolArray.get(e).placedOrientation=a;r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.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 r=t?t.symbolFadeChange(e):1,a=t?t.opacities:{},i=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],i=a[e];i?(this.opacities[e]=new Oe(i,r,t.text,t.icon),n=n||t.text!==i.text.placed||t.icon!==i.icon.placed):(this.opacities[e]=new Oe(null,r,t.text,t.icon,t.skipFade),n=n||t.text||t.icon)}for(const e in a){const t=a[e];if(!this.opacities[e]){const a=new Oe(t,r,!1,!1);a.isHidden()||(this.opacities[e]=a,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 r of t){const t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,n,r.collisionBoxArray)}}updateBucketOpacities(t,n,r){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 a=t.layers[0].layout,i=new Oe(null,0,!1,!1,!0),o=a.get("text-allow-overlap"),s=a.get("icon-allow-overlap"),l=a.get("text-variable-anchor"),c="map"===a.get("text-rotation-alignment"),u="map"===a.get("text-pitch-alignment"),d="none"!==a.get("icon-text-fit"),p=new Oe(null,0,o&&(s||!t.hasIconData()||a.get("icon-optional")),s&&(o||!t.hasTextData()||a.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);const m=(e,t,n)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(n)};for(let r=0;r<t.symbolInstances.length;r++){const a=t.symbolInstances.get(r),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:s,crossTileID:b}=a;let h=this.opacities[b];n[b]?h=i:h||(h=p,this.opacities[b]=h),n[b]=!0;const f=a.numIconVertices>0,g=this.placedOrientations[a.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();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach(e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=n||_?1:0)}),a.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=n||y?1:0);const r=this.variableOffsets[a.crossTileID];r&&this.markUsedJustification(t,r.anchor,a,g);const i=this.placedOrientations[a.crossTileID];i&&(this.markUsedJustification(t,"left",a,i),this.markUsedOrientation(t,i,a))}if(f){const e=Pe(h.icon),n=!(d&&a.verticalPlacedIconSymbolIndex&&_);a.placedIconSymbolIndex>=0&&(m(t.icon,a.numIconVertices,n?e:Be),t.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=h.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,a.numVerticalIconVertices,n?Be:e),t.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=h.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const n=t.collisionArrays[r];if(n){let r=new e.pointGeometry(0,0);if(n.textBox||n.verticalTextBox){let e=!0;if(l){const t=this.variableOffsets[b];t?(r=Ne(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),c&&r._rotate(u?this.transform.angle:-this.transform.angle)):e=!1}n.textBox&&je(t.textCollisionBox.collisionVertexArray,h.text.placed,!e||_,r.x,r.y),n.verticalTextBox&&je(t.textCollisionBox.collisionVertexArray,h.text.placed,!e||y,r.x,r.y)}const a=Boolean(!y&&n.verticalIconBox);n.iconBox&&je(t.iconCollisionBox.collisionVertexArray,h.icon.placed,a,d?r.x:0,d?r.y:0),n.verticalIconBox&&je(t.iconCollisionBox.collisionVertexArray,h.icon.placed,!a,d?r.x:0,d?r.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,r,a){e.emplaceBack(t?1:0,n?1:0,r||0,a||0),e.emplaceBack(t?1:0,n?1:0,r||0,a||0),e.emplaceBack(t?1:0,n?1:0,r||0,a||0),e.emplaceBack(t?1:0,n?1:0,r||0,a||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,r,a){const i=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(i,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,a())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++,a())return!0;return!1}}class $e{constructor(e,t,n,r,a,i,o,s){this.placement=new Ee(e,t,i,o,s),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(t,n,r){const a=e.exported.now(),i=()=>{const t=e.exported.now()-a;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const e=n[t[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if("symbol"===e.type&&(!e.minzoom||e.minzoom<=a)&&(!e.maxzoom||e.maxzoom>a)){if(this._inProgressLayer||(this._inProgressLayer=new Ie(e)),this._inProgressLayer.continuePlacement(r[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 Ye{constructor(e,t,n){this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let n=0;n<t.length;n++){const r=t.get(n),a=r.key;this.indexedSymbolInstances[a]||(this.indexedSymbolInstances[a]=[]),this.indexedSymbolInstances[a].push({crossTileID:r.crossTileID,coord:this.getScaledCoordinates(r,e)})}}getScaledCoordinates(t,n){const r=Fe/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*e.EXTENT+t.anchorX)*r),y:Math.floor((n.canonical.y*e.EXTENT+t.anchorY)*r)}}findMatches(e,t,n){const r=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let a=0;a<e.length;a++){const i=e.get(a);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)<=r&&Math.abs(e.coord.y-s.y)<=r&&!n[e.crossTileID]){n[e.crossTileID]=!0,i.crossTileID=e.crossTileID;break}}}}class Xe{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],r={};for(const e in n){const a=n[e];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),r[a.tileID.key]=a}this.indexes[e]=r}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 r=this.usedCrossTileIDs[e.overscaledZ];for(const n in this.indexes){const a=this.indexes[n];if(Number(n)>e.overscaledZ)for(const n in a){const i=a[n];i.tileID.isChildOf(e)&&i.findMatches(t.symbolInstances,e,r)}else{const i=a[e.scaledTo(Number(n)).key];i&&i.findMatches(t.symbolInstances,e,r)}}for(let e=0;e<t.symbolInstances.length;e++){const a=t.symbolInstances.get(e);a.crossTileID||(a.crossTileID=n.generate(),r[a.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ye(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const n in t.indexedSymbolInstances)for(const r of t.indexedSymbolInstances[n])delete this.usedCrossTileIDs[e][r.crossTileID]}removeStaleBuckets(e){let t=!1;for(const n in this.indexes){const r=this.indexes[n];for(const a in r)e[r[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,r[a]),delete r[a],t=!0)}return t}}class Ve{constructor(){this.layerIndexes={},this.crossTileIDs=new Xe,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let r=this.layerIndexes[e.id];void 0===r&&(r=this.layerIndexes[e.id]=new He);let a=!1;const i={};r.handleWrapJump(n);for(const n of t){const t=n.getBucket(e);t&&e.id===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(n.tileID,t,this.crossTileIDs)&&(a=!0),i[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(i)&&(a=!0),a}pruneUnusedLayers(e){const t={};e.forEach(e=>{t[e]=!0});for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var Ue=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 r of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(r.key),this._tiles[r.key]||(r.posMatrix=new Float64Array(16),e.ortho(r.posMatrix,0,e.EXTENT,0,e.EXTENT,0,1),this._tiles[r.key]=new T(r,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 r of this._renderableTilesKeys){const a=this._tiles[r].tileID;if(a.canonical.equals(t.canonical)){const a=t.clone();a.posMatrix=new Float64Array(16),e.ortho(a.posMatrix,0,e.EXTENT,0,e.EXTENT,0,1),n[r]=a}else if(a.canonical.isChildOf(t.canonical)){const i=t.clone();i.posMatrix=new Float64Array(16);const o=a.canonical.z-t.canonical.z,s=a.canonical.x-(a.canonical.x>>o<<o),l=a.canonical.y-(a.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[r]=i}else if(t.canonical.isChildOf(a.canonical)){const i=t.clone();i.posMatrix=new Float64Array(16);const o=t.canonical.z-a.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[r]=i}}return n}getSourceTile(e,t){const n=this.sourceCache._source;let r=e.overscaledZ-this.deltaZoom;if(r>n.maxzoom&&(r=n.maxzoom),r<n.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(r).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!a||!a.dem)&&t)for(;r>=n.minzoom&&(!a||!a.dem);)a=this.sourceCache.getTileByID(e.scaledTo(r--).key);return a}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,r,a=e.EXTENT){if(!(n>=0&&n<a&&r>=0&&r<a))return this.elevationOffset;let i=0;const o=this.getTerrainData(t);if(o.tile&&o.tile.dem){const t=e.transformMat4$1([],[n/a*e.EXTENT,r/a*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 r=this.sourceCache._tiles[n];(r.tileID.equals(t)||r.tileID.isChildOf(t))&&(e===this.sourceCache.sourceCache.id&&(r.timeLoaded=Date.now()),this._rerender[e]=this._rerender[e]||{},this._rerender[e][r.tileID.key]=!0)}}needsRerender(e,t){return this._rerender[e]&&this._rerender[e][t.key]}clearRerenderCache(){this._rerender={}}getElevation(t,n,r,a=e.EXTENT){return(this.getDEMElevation(t,n,r,a)+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 r=n&&n+n.tileID.key+t.key;if(r&&!this._demMatrixCache[r]){const r=this.sourceCache.sourceCache._source.maxzoom;let a=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=r?a=t.canonical.z-r:e.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const i=t.canonical.x-(t.canonical.x>>a<<a),o=t.canonical.y-(t.canonical.y>>a<<a),s=e.fromScaling(new Float64Array(16),[1/(e.EXTENT<<a),1/(e.EXTENT<<a),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:r?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,r=t.height/devicePixelRatio;return!this._fbo||this._fbo.width===n&&this._fbo.height===r||(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:r,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:r,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,r,!0),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,r))),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 r=0;r<this._coordsTextureSize;r++,t+=4)n[t+0]=255&r,n[t+1]=255&e,n[t+2]=r>>8<<4|e>>8,n[t+3]=0;const r=new e.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new l(t,r,t.gl.RGBA,{premultiply:!1});return a.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(t){const n=new Uint8Array(4),r=this.style.map.painter,a=r.context,i=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(t.x,r.height/devicePixelRatio-t.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,n),a.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,r=new e.TriangleIndexArray,a=this.meshSize,i=e.EXTENT/a,o=a*a;for(let e=0;e<=a;e++)for(let t=0;t<=a;t++)n.emplaceBack(t*i,e*i);for(let e=0;e<o;e+=a+1)for(let t=0;t<a;t++)r.emplaceBack(t+e,a+t+e+1,a+t+e+2),r.emplaceBack(t+e,a+t+e+2,t+e+1);return this._mesh={indexBuffer:t.createIndexBuffer(r),vertexBuffer:t.createVertexBuffer(n,Ue.members),segments:e.SegmentVector.simpleSegment(0,0,n.length,r.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(U,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Qe=e.pick(U,["setCenter","setZoom","setBearing","setPitch"]),et=function(){const t={},n=e.spec.$version;for(const r in e.spec.$root){const a=e.spec.$root[r];if(a.required){let e=null;e="version"===r?n:"array"===a.type?[]:{},null!=e&&(t[r]=e)}}return t}();class tt extends e.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new y(X(),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 Ve,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 r=this;this._rtlTextPluginCallback=tt.registerForPluginStateChange(t=>{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},(t,n)=>{if(e.triggerPluginCompletionEvent(t),n&&n.every(e=>e))for(const e in r.sourceCaches)r.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 r="boolean"!=typeof n.validate||n.validate,a=this.map._requestManager.transformRequest(t,e.ResourceType.Style);this._request=e.getJSON(a,(t,n)=>{this._request=null,t?this.fire(new e.ErrorEvent(t)):n&&this._load(n,r)})}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 r=V(this.stylesheet.layers);this._order=r.map(e=>e.id),this._layers={},this._serializedLayers={};for(let t of r)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,r,a){let i,o,s;const l=r>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)a(s);else if(i&&o){const t=e.exported.getImageData(o),n={};for(const r in i){const{width:a,height:o,x:s,y:l,sdf:c,pixelRatio:u,stretchX:d,stretchY:p,content:m}=i[r],b=new e.RGBAImage({width:a,height:o});e.RGBAImage.copy(t,b,{x:s,y:l},{x:0,y:0},{width:a,height:o}),n[r]={data:b,pixelRatio:u,sdf:c,stretchX:d,stretchY:p,content:m}}a(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 r=t.sourceLayer;if(!r)return;const a=n.getSource();("geojson"===a.type||a.vectorLayerIds&&-1===a.vectorLayerIds.indexOf(r))&&this.fire(new e.ErrorEvent(new Error(`Source layer "${r}" does not exist on source "${a.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 r={};for(const e in this.sourceCaches){const t=this.sourceCaches[e];r[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 r){const n=this.sourceCaches[t];r[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=V(t.layers);const n=function(e,t){if(!e)return[{command:U.setStyle,args:[t]}];let n=[];try{if(!a(e.version,t.version))return[{command:U.setStyle,args:[t]}];a(e.center,t.center)||n.push({command:U.setCenter,args:[t.center]}),a(e.zoom,t.zoom)||n.push({command:U.setZoom,args:[t.zoom]}),a(e.bearing,t.bearing)||n.push({command:U.setBearing,args:[t.bearing]}),a(e.pitch,t.pitch)||n.push({command:U.setPitch,args:[t.pitch]}),a(e.sprite,t.sprite)||n.push({command:U.setSprite,args:[t.sprite]}),a(e.glyphs,t.glyphs)||n.push({command:U.setGlyphs,args:[t.glyphs]}),a(e.transition,t.transition)||n.push({command:U.setTransition,args:[t.transition]}),a(e.light,t.light)||n.push({command:U.setLight,args:[t.light]});const r={},i=[];!function(e,t,n,r){let i;for(i in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||K(i,n,r));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?a(e[i],t[i])||("geojson"===e[i].type&&"geojson"===t[i].type&&Z(e,t,i)?n.push({command:U.setGeoJSONSourceData,args:[i,t[i].data]}):J(i,t,n,r)):G(i,t,n))}(e.sources,t.sources,i,r);const o=[];e.layers&&e.layers.forEach(e=>{r[e.source]?n.push({command:U.removeLayer,args:[e.id]}):o.push(e)}),n=n.concat(i),function(e,t,n){t=t||[];const r=(e=e||[]).map(ee),i=t.map(ee),o=e.reduce(te,{}),s=t.reduce(te,{}),l=r.slice(),c=Object.create(null);let u,d,p,m,b,h,f;for(u=0,d=0;u<r.length;u++)p=r[u],Object.prototype.hasOwnProperty.call(s,p)?d++:(n.push({command:U.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:U.removeLayer,args:[p]}),l.splice(l.lastIndexOf(p,l.length-d),1)):d++,h=l[l.length-u],n.push({command:U.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]&&!a(m,b))if(a(m.source,b.source)&&a(m["source-layer"],b["source-layer"])&&a(m.type,b.type)){for(f in Q(m.layout,b.layout,n,p,null,U.setLayoutProperty),Q(m.paint,b.paint,n,p,null,U.setPaintProperty),a(m.filter,b.filter)||n.push({command:U.setFilter,args:[p,b.filter]}),a(m.minzoom,b.minzoom)&&a(m.maxzoom,b.maxzoom)||n.push({command:U.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),U.setPaintProperty):a(m[f],b[f])||n.push({command:U.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),U.setPaintProperty):a(m[f],b[f])||n.push({command:U.setLayerProperty,args:[p,f,b[f]]}))}else n.push({command:U.removeLayer,args:[p]}),h=l[l.lastIndexOf(p)+1],n.push({command:U.addLayer,args:[b,h]})}(o,t.layers,n)}catch(e){console.warn("Unable to compute style diff:",e),n=[{command:U.setStyle,args:[t]}]}return n}(this.serialize(),t).filter(e=>!(e.command in Qe));if(0===n.length)return!1;const r=n.filter(e=>!(e.command in Ze));if(r.length>0)throw new Error(`Unimplemented: ${r.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,r={}){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,r))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const a=this.sourceCaches[t]=new D(t,n,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:a.serialize(),sourceId:t})),a.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,r={}){this._checkLoaded();const a=t.id;if(this.getLayer(a))return void this.fire(new e.ErrorEvent(new Error(`Layer "${a}" 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(a,t.source),t=e.clone$1(t),t=e.extend(t,{source:a})),this._validate(e.validateStyle.layer,"layers."+a,t,{arrayIndex:-1},r))return;i=e.createStyleLayer(t),this._validateLayer(i),i.setEventedParent(this,{layer:{id:a}}),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 "${a}" before non-existing layer "${n}".`)));else{if(this._order.splice(o,0,a),this._layerOrderChanged=!0,this._layers[a]=i,this._removedLayers[a]&&i.source&&"custom"!==i.type){const e=this._removedLayers[a];delete this._removedLayers[a],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 r=this._order.indexOf(t);this._order.splice(r,1);const a=n?this._order.indexOf(n):this._order.length;n&&-1===a?this.fire(new e.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(a,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 r=this._order.indexOf(t);this._order.splice(r,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,r){this._checkLoaded();const a=this.getLayer(t);a?a.minzoom===n&&a.maxzoom===r||(null!=n&&(a.minzoom=n),null!=r&&(a.maxzoom=r),this._updateLayer(a)):this.fire(new e.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,r={}){this._checkLoaded();const i=this.getLayer(t);if(i){if(!a(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,r)||(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,r,i={}){this._checkLoaded();const o=this.getLayer(t);o?a(o.getLayoutProperty(n),r)||(o.setLayoutProperty(n,r,i),this._updateLayer(o)):this.fire(new e.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const r=this.getLayer(t);if(r)return r.getLayoutProperty(n);this.fire(new e.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,r,i={}){this._checkLoaded();const o=this.getLayer(t);o?a(o.getPaintProperty(n),r)||(o.setPaintProperty(n,r,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 r=t.source,a=t.sourceLayer,i=this.sourceCaches[r];if(void 0===i)return void this.fire(new e.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));const o=i.getSource().type;"geojson"===o&&a?this.fire(new e.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||a?(void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),i.setFeatureState(a,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 r=t.source,a=this.sourceCaches[r];if(void 0===a)return void this.fire(new e.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));const i=a.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."))):a.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,r=t.sourceLayer,a=this.sourceCaches[n];if(void 0!==a)return"vector"!==a.getSource().type||r?(void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),a.getFeatureState(r,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={},r=[];for(let a=this._order.length-1;a>=0;a--){const i=this._order[a];if(t(i)){n[i]=a;for(const t of e){const e=t[i];if(e)for(const t of e)r.push(t)}}}r.sort((e,t)=>t.intersectionZ-e.intersectionZ);const a=[];for(let i=this._order.length-1;i>=0;i--){const o=this._order[i];if(t(o))for(let e=r.length-1;e>=0;e--){const t=r[e].feature;if(n[t.layer.id]<i)break;a.push(t),r.pop()}else for(const t of e){const e=t[o];if(e)for(const t of e)a.push(t.feature)}}return a}queryRenderedFeatures(t,n,r){n&&n.filter&&this._validate(e.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const a={};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.`))),[];a[n.source]=!0}}const i=[];n.availableImages=this._availableImages;for(const e in this.sourceCaches)n.layers&&!a[e]||i.push(L(this.sourceCaches[e],this._layers,this._serializedLayers,t,n,r));return this.placement&&i.push(function(e,t,n,r,a,i,o){const s={},l=i.queryRenderedSymbols(r),c=[];for(const e of Object.keys(l).map(Number))c.push(o[e]);c.sort(S);for(const n of c){const r=n.featureIndex.lookupSymbolFeatures(l[n.bucketInstanceId],t,n.bucketIndex,n.sourceLayerIndex,a.filter,a.layers,a.availableImages,e);for(const e in r){const t=s[e]=s[e]||[],a=r[e];a.sort((e,t)=>{const r=n.featureSortOrder;if(r){const n=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex});for(const e of a)t.push(e)}}for(const t in s)s[t].forEach(r=>{const a=r.feature,i=n[e[t].source].getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.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 r=this.sourceCaches[t];return r?function(e,t){const n=e.getRenderableIds().map(t=>e.getTileByID(t)),r=[],a={};for(let e=0;e<n.length;e++){const i=n[e],o=i.tileID.canonical.key;a[o]||(a[o]=!0,i.querySourceFeatures(r,t))}return r}(r,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 r=this.light.getLight();let i=!1;for(const e in t)if(!a(t[e],r[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,r,a,i={}){return(!i||!1!==i.validate)&&Je(this,t.call(e.validateStyle,e.extend({key:n,style:this.serialize(),value:r,styleSpec:e.spec},a)))}_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,r,a,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 r=this.crossTileSymbolIndex.addLayer(n,l[n.source],t.center.lng);o=o||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((i=i||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.exported.now(),t.zoom))&&(this.pauseablePlacement=new $e(t,this.terrain,this._order,i,n,r,a,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 r=this.sourceCaches[t.source];r&&r.setDependencies(t.tileID.key,t.type,t.icons)}getGlyphs(e,t,n){this.glyphManager.getGlyphs(t.stacks,n)}getResource(t,n,r){return e.makeRequest(n,r)}}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 rt={prelude:at("#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:at("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:at("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:at("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:at("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:at("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:at("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:at("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:at("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:at("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:at("#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:at("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:at("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:at("#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:at("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:at("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:at("#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:at("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:at("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:at("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:at("#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:at("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:at("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:at("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:at("#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:at("#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:at("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",nt),terrainDepth:at("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:at("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 at(e,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/attribute ([\w]+) ([\w]+)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),i=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=i?i.concat(a):a,s={};return{fragmentSource:e=e.replace(n,(e,t,n,r,a)=>(s[a]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nvarying ${n} ${r} ${a};\n#else\nuniform ${n} ${r} u_${a};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${a}\n ${n} ${r} ${a} = u_${a};\n#endif\n`)),vertexSource:t=t.replace(n,(e,t,n,r,a)=>{const i="float"===r?"vec2":"vec4",o=a.match(/color/)?"color":i;return s[a]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${n} ${i} a_${a};\nvarying ${n} ${r} ${a};\n#else\nuniform ${n} ${r} u_${a};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = a_${a};\n#else\n ${n} ${r} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = unpack_mix_${o}(a_${a}, u_${a}_t);\n#else\n ${n} ${r} ${a} = u_${a};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${n} ${i} a_${a};\n#else\nuniform ${n} ${r} u_${a};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${a}\n ${n} ${r} ${a} = a_${a};\n#else\n ${n} ${r} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${n} ${r} ${a} = unpack_mix_${o}(a_${a}, u_${a}_t);\n#else\n ${n} ${r} ${a} = u_${a};\n#endif\n`}),staticAttributes:r,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,r,a,i,o,s,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!c&&e<r.length;e++)this.boundPaintVertexBuffers[e]!==r[e]&&(c=!0);e.extVertexArrayObject&&this.vao&&this.boundProgram===t&&this.boundLayoutVertexBuffer===n&&!c&&this.boundIndexBuffer===a&&this.boundVertexOffset===i&&this.boundDynamicVertexBuffer===o&&this.boundDynamicVertexBuffer2===s&&this.boundDynamicVertexBuffer3===l?(e.bindVertexArrayOES.set(this.vao),o&&o.bind(),a&&a.dynamicDraw&&a.bind(),s&&s.bind(),l&&l.bind()):this.freshBind(t,n,r,a,i,o,s,l)}freshBind(e,t,n,r,a,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=r,this.boundVertexOffset=a,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,a);for(const t of n)t.bind(),t.setVertexAttribPointers(d,e,a);i&&(i.bind(),i.setVertexAttribPointers(d,e,a)),r&&r.bind(),o&&(o.bind(),o.setVertexAttribPointers(d,e,a)),s&&(s.bind(),s.setVertexAttribPointers(d,e,a)),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 r=e[n].split(" ");t.push(r.pop())}return t}class st{constructor(t,n,r,a,i,o,s){const l=t.gl;this.program=l.createProgram();const c=ot(r.staticAttributes),u=a?a.getBinderAttributes():[],d=c.concat(u),p=rt.prelude.staticUniforms?ot(rt.prelude.staticUniforms):[],m=r.staticUniforms?ot(r.staticUniforms):[],b=a?a.getBinderUniforms():[],h=p.concat(m).concat(b),f=[];for(const e of h)f.indexOf(e)<0&&f.push(e);const g=a?a.defines():[];o&&g.push("#define OVERDRAW_INSPECTOR;"),s&&g.push("#define TERRAIN3D;");const _=g.concat(rt.prelude.fragmentSource,r.fragmentSource).join("\n"),y=g.concat(rt.prelude.vertexSource,r.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=a?a.getUniforms(t,z):[]}draw(e,t,n,r,a,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(r),e.setColorMode(a),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 r=n.vaos||(n.vaos={});(r[l]||(r[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 r=1/ve(n,1,t.transform.tileZoom),a=Math.pow(2,n.tileID.overscaledZ),i=n.tileSize*Math.pow(2,t.transform.tileZoom)/a,o=i*(n.tileID.canonical.x+n.tileID.wrap*a),s=i*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[r,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,r,a)=>{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:+r,u_opacity:a}},ut=(t,n,r,a,i,o,s)=>e.extend(ct(t,n,r,a),lt(o,n,s),{u_height_factor:-Math.pow(2,i.overscaledZ)/s.tileSize/8}),dt=e=>({u_matrix:e}),pt=(t,n,r,a)=>e.extend(dt(t),lt(r,n,a)),mt=(e,t)=>({u_matrix:e,u_world:t}),bt=(t,n,r,a,i)=>e.extend(pt(t,n,r,a),{u_world:i}),ht=(e,t,n,r)=>{const a=e.transform;let i,o;if("map"===r.paint.get("circle-pitch-alignment")){const e=ve(n,1,a.zoom);i=!0,o=[e,e]}else i=!1,o=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(t.posMatrix,n,r.paint.get("circle-translate"),r.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 r=ve(n,1,t.zoom),a=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:r,u_extrude_scale:[t.pixelsToGLUnits[0]/(r*a),t.pixelsToGLUnits[1]/(r*a)],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,r)=>({u_matrix:e,u_extrude_scale:ve(t,1,n),u_intensity:r});function Mt(t,n){const r=Math.pow(2,n.canonical.z),a=n.canonical.y;return[new e.MercatorCoordinate(0,a/r).toLngLat().lat,new e.MercatorCoordinate(0,(a+1)/r).toLngLat().lat]}const vt=(e,t,n,r)=>{const a=e.transform;return{u_matrix:xt(e,t,n,r),u_ratio:1/ve(t,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},zt=(t,n,r,a,i)=>e.extend(vt(t,n,r,i),{u_image:0,u_image_height:a}),Ot=(e,t,n,r,a)=>{const i=e.transform,o=At(t,i);return{u_matrix:xt(e,t,n,a),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,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},kt=(t,n,r,a,i,o)=>{const s=t.lineAtlas,l=At(n,t.transform),c="round"===r.layout.get("line-cap"),u=s.getDash(a.from,c),d=s.getDash(a.to,c),p=u.width*i.fromScale,m=d.width*i.toScale;return e.extend(vt(t,n,r,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,r){return e.translatePosMatrix(r?r.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const wt=(e,t,n,r,a)=>{return{u_matrix:e,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(o=a.paint.get("raster-saturation"),o>0?1-1/(1.001-o):-o),u_contrast_factor:(i=a.paint.get("raster-contrast"),i>0?1/(1-i):1+i),u_spin_weights:Nt(a.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,r,a,i,o,s,l,c)=>{const u=a.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:u.cameraToCenterDistance,u_pitch:u.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:u.width/u.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_matrix:i,u_label_plane_matrix:o,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+r,u_texsize:c,u_texture:0}},Et=(t,n,r,a,i,o,s,l,c,u,d)=>{const p=i.transform;return e.extend(qt(t,n,r,a,i,o,s,l,c,u),{u_gamma_scale:a?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:i.pixelRatio,u_is_halo:+d})},jt=(t,n,r,a,i,o,s,l,c,u)=>e.extend(Et(t,n,r,a,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,r,a,i,o)=>e.extend(function(e,t,n,r){const a=n.imageManager.getPattern(e.from.toString()),i=n.imageManager.getPattern(e.to.toString()),{width:o,height:s}=n.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),c=r.tileSize*Math.pow(2,n.transform.tileZoom)/l,u=c*(r.tileID.canonical.x+r.tileID.wrap*l),d=c*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.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:a.displaySize,u_pattern_size_b:i.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/ve(r,1,n.transform.tileZoom),u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[65535&u,65535&d]}}(a,o,r,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 r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.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,r){this.length=t.length,this.attributes=n,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;const a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.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 r=t.attributes[this.attributes[n].name];void 0!==r&&e.enableVertexAttribArray(r)}}setVertexAttribPointers(e,t,n){for(let r=0;r<this.attributes.length;r++){const a=this.attributes[r],i=t.attributes[a.name];void 0!==i&&e.vertexAttribPointer(i,a.components,e[Ct[a.type]],!1,this.itemSize,a.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 Yt extends Dt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Xt 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 Vt 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 Ut 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 rn 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 an 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,r){this.context=e,this.width=t,this.height=n;const a=e.gl,i=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new _n(e,i),r&&(this.depthAttachment=new yn(e,i)),a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.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 Yt(this),this.stencilFunc=new Xt(this),this.stencilOp=new Ht(this),this.stencilTest=new Vt(this),this.depthRange=new Ut(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 rn(this),this.program=new an(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 r=this.gl,a=r.createRenderbuffer();return this.bindRenderbuffer.set(a),r.renderbufferStorage(r.RENDERBUFFER,e,t,n),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t,n){return new Mn(this,e,t,n)}clear({color:e,depth:t}){const n=this.gl;let r=0;e&&(r|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(r|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),n.clear(r)}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){a(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,r,a,i){this.test=e,this.ref=t,this.mask=n,this.fail=r,this.depthFail=a,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,r,a,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<a.length;b++){const h=a[b],f=n.getTile(h),g=f.getBucket(r);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(),r=_;e.mul(n,g.placementInvProjMatrix,t.transform.glCoordMatrix),e.mul(n,n,g.placementViewportMatrix),d.push({circleArray:M,circleOffset:m,transform:r,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),r.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,r=e.circleArray[n+0],a=e.circleArray[n+1],i=e.circleArray[n+2],o=e.circleArray[n+3];h.emplace(f++,r,a,i,o,0),h.emplace(f++,r,a,i,o,1),h.emplace(f++,r,a,i,o,2),h.emplace(f++,r,a,i,o,3)}(!xn||xn.length<2*p)&&(xn=function(t){const n=2*t,r=new e.QuadTriangleArray;r.resize(n),r._trim();for(let e=0;e<n;e++){const t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}(p));const g=l.createIndexBuffer(xn,!0),_=l.createVertexBuffer(h,e.collisionCircleLayout.members,!0);for(const n of d){const a={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,a,t.style.terrain&&t.style.terrain.getTerrainData(n.coord),r.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,r,a,i,o){const{horizontalAlign:s,verticalAlign:l}=e.getAnchorAlignment(t),c=-(s-.5)*n,u=-(l-.5)*r,d=e.evaluateVariableOffset(t,a);return new e.pointGeometry((c/i+d[0])*o,(u/i+d[1])*o)}function En(t,n,r,a,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:a[f.crossTileID];if(_){const a=new e.pointGeometry(f.anchorX,f.anchorY),p=se(a,r?s:o,d),b=le(i.cameraToCenterDistance,p.signedDistanceFromCamera);let g=e.evaluateSizeForFeature(t.textSizeData,c,f)*b/e.ONE_EM;r&&(g*=t.tilePixelRatio/l);const{width:y,height:M,anchor:v,textOffset:z,textBoxScale:O}=_,k=qn(v,y,M,z,O,g),A=r?se(a.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 r=n.get(t);if(r.hidden)ge(r.numGlyphs,b);else{const n=h[t];if(n)for(let t=0;t<r.numGlyphs;t++)e.addDynamicAttributes(b,n.shiftedAnchor,n.angle);else ge(r.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,r,a,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"!==r.layout.get("symbol-placement"),y=f&&!g&&!_,M=!r.layout.get("symbol-sort-key").isConstant();let v=!1;const z=t.depthModeForSublayer(0,On.ReadOnly),O=r.layout.get("text-variable-anchor"),k=[];for(const l of a){const a=n.getTile(l),c=a.getBucket(r);if(!c)continue;const d=i?c.text:c.icon;if(!d||!d.segments.get().length)continue;const p=d.programConfigurations.get(r.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=a.glyphAtlasTexture,j=b.LINEAR,q=a.glyphAtlasTexture.size,c.iconsInText){L=a.imageAtlasTexture.size,S=a.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!==r.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;E=a.imageAtlasTexture,j=m||t.options.rotating||t.options.zooming||e||A?b.LINEAR:b.NEAREST,q=a.imageAtlasTexture.size}const T=ve(a,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"!==r.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"===r.layout.get("text-rotation-alignment");ue(c,l.posMatrix,t,i,C,R,g,u,n,e)}const B=t.translatePosMatrix(l.posMatrix,a,o,s),I=_||i&&O||P?Nn:C,$=t.translatePosMatrix(R,a,o,s,!0),F=m&&0!==r.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1);let Y;Y=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 X={program:x,buffers:d,uniformValues:Y,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:X,terrainData:N})}else k.push({segments:d.segments,sortKey:0,state:X,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 a=n.uniformValues;n.hasHalo&&(a.u_is_halo=1,Ln(n.buffers,e.segments,r,t,n.program,z,d,p,a,e.terrainData)),a.u_is_halo=0}Ln(n.buffers,e.segments,r,t,n.program,z,d,p,n.uniformValues,e.terrainData)}}function Ln(e,t,n,r,a,i,o,s,l,c){const u=r.context;a.draw(u,u.gl.TRIANGLES,i,o,s,An.disabled,l,c,n.id,e.layoutVertexBuffer,e.indexBuffer,t,n.paint,r.transform.zoom,e.programConfigurations.get(n.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function Sn(e,t,n,r,a,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 r){const r=t.getTile(f);if(c&&!r.patternsLoaded())continue;const g=r.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),r.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),_.updatePaintBuffers(u));const v=l.constantOr(null);if(v&&r.imageAtlas){const e=r.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,r,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,r,t):mt(O,t)}else b=g.indexBuffer,h=g.segments,m=c?pt(O,e,u,r):dt(O);y.draw(e.context,d,a,e.stencilModeForClipping(f),i,An.disabled,m,M,n.id,g.layoutVertexBuffer,b,h,n.paint,e.transform.zoom,_)}}function Tn(e,t,n,r,a,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 r){const r=t.getTile(m),b=r.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),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),f.updatePaintBuffers(d));const _=c.constantOr(null);if(_&&r.imageAtlas){const e=r.imageAtlas,t=e.patternPositions[_.to.toString()],n=e.patternPositions[_.from.toString()];t&&n&&f.setConstantPatternPositions(t,n)}const y=e.translatePosMatrix(m.posMatrix,r,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,r):ct(y,e,M,p);g.draw(s,s.gl.TRIANGLES,a,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,r,a,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,a,i,o,An.disabled,((e,t,n,r)=>{const a=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:r?r.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:a,u_highlight:i,u_accent:o}})(e,n,r,d?t:null),d,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}function Rn(t,n,r,a,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,a,i,o,An.disabled,((t,n)=>{const r=n.stride,a=e.create();return e.ortho(a,0,e.EXTENT,-e.EXTENT,0,0,1),e.translate(a,a,[0,-e.EXTENT,0]),{u_matrix:a,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:n.getUnpackVector()}})(n.tileID,u),null,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),n.needsHillshadePrepare=!1}}function Dn(t,n,r,a,i,o){const s=a.paint.get("raster-fade-duration");if(!o&&s>0){const a=e.exported.now(),o=(a-t.timeAdded)/s,l=n?(a-n.timeAdded)/s:-1,c=r.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 Yn(e,t,n,r){Hn(e,0,t+n/2,e.transform.width,n,r)}function Xn(e,t,n,r){Hn(e,t-n/2,0,n,e.transform.height,r)}function Hn(e,t,n,r,a,i){const o=e.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,n*e.pixelRatio,r*e.pixelRatio,a*e.pixelRatio),o.clear({color:i}),s.disable(s.SCISSOR_TEST)}function Vn(t,n,r){const a=t.context,i=a.gl,o=r.posMatrix,s=t.useProgram("debug"),l=On.disabled,c=kn.disabled,u=t.colorModeForRenderPass(),d="$debug",p=t.style.terrain&&t.style.terrain.getTerrainData(r);a.activeTexture.set(i.TEXTURE0),t.emptyTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE);const m=n.getTileByID(r.key).latestRawTileData,b=Math.floor((m&&m.byteLength||0)/1024),h=n.getTile(r).tileSize,f=512/Math.min(h,512)*(r.overscaledZ/t.transform.zoom)*.5;let g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=" => "+r.overscaledZ),function(e,t){e.initDebugOverlayCanvas();const n=e.debugOverlayCanvas,r=e.context.gl,a=e.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,n.width,n.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(t,5,5),a.strokeText(t,5,5),e.debugOverlayTexture.update(n),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,`${g} ${b}kB`),s.draw(a,i.TRIANGLES,l,c,vn.alphaBlended,An.disabled,gt(o,e.Color.transparent,f),null,d,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),s.draw(a,i.LINE_STRIP,l,c,u,An.disabled,gt(o,e.Color.red),p,d,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function Un(e,t,n){const r=e.context,a=r.gl,i=e.colorModeForRenderPass(),o=new On(a.LEQUAL,On.ReadWrite,e.depthRangeFor3D),s=e.useProgram("terrain"),l=t.getTerrainMesh(),c=t.getTerrainData(n.tileID);r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height]),r.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const u=e.transform.calculatePosMatrix(n.tileID.toUnwrapped());s.draw(r,a.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,r){const a=e.context,i=n.tileSize*t.qualityFactor;n.textures[r]||(n.textures[r]=e.getTileTexture(i)||new l(a,{width:i,height:i,data:null},a.gl.RGBA),n.textures[r].bind(a.gl.LINEAR,a.gl.CLAMP_TO_EDGE),0===r&&t.sourceCache.renderHistory.unshift(n.tileID.key));const o=t.getRTTFramebuffer();o.colorAttachment.set(n.textures[r].texture),a.bindFramebuffer.set(o.framebuffer),a.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 r=e.sourceCaches[n].getVisibleCoordinates();for(const e of r){const r=t.sourceCache.getTerrainCoords(e);for(const e in r)this._coordsDescendingInv[n][e]||(this._coordsDescendingInv[n][e]=[]),this._coordsDescendingInv[n][e].push(r[e])}}for(const t of e._order){const n=e._layers[t],r=n.source;if(this._renderToTexture[n.type]&&!this._coordsDescendingInvStr[r]){this._coordsDescendingInvStr[r]={};for(const e in this._coordsDescendingInv[r])this._coordsDescendingInvStr[r][e]=this._coordsDescendingInv[r][e].map(e=>e.key).sort().join()}}return this._renderableTiles.forEach(e=>{for(const n in this._coordsDescendingInvStr){const r=this._coordsDescendingInvStr[n][e.tileID.key];r&&r!==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,r=this.painter,a=r.style._order,i=r.currentLayer,o=i+1===a.length;if(this._renderToTexture[n]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(a[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(r,r.style.terrain,t,o),this._rerender[t.tileID.key]){r.context.clear({color:e.Color.transparent});for(let e=0;e<s.length;e++){const n=r.style._layers[s[e]],a=n.source?this._coordsDescendingInv[n.source][t.tileID.key]:[t.tileID];r._renderTileClippingMasks(n,a),r.renderLayer(r,r.style.sourceCaches[n.source],n,a),n.source&&(t.textureCoords[n.source]=this._coordsDescendingInvStr[n.source][t.tileID.key])}}Un(r,r.style.terrain,t)}if("hillshade"===n){this._stacks.push([a[i]]);for(const n of this._renderableTiles){const a=this._coordsDescendingInv[t.source][n.tileID.key];Gn(r,r.style.terrain,n,this._stacks.length-1),r.context.clear({color:e.Color.transparent}),r._renderTileClippingMasks(t,a),r.renderLayer(r,r.style.sourceCaches[t.source],t,a),Un(r,r.style.terrain,n)}return!0}return this._renderToTexture[n]}return!1}}const Jn={symbol:function(t,n,r,a,i){if("translucent"!==t.renderPass)return;const o=kn.disabled,s=t.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(t,n,r,a,i,o,s){const l=n.transform,c="map"===i,u="map"===o;for(const i of t){const t=a.getTile(i),o=t.getBucket(r);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"!==r.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)}}}(a,t,r,n,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),i),0!==r.paint.get("icon-opacity").constantOr(1)&&Wn(t,n,r,a,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),o,s),0!==r.paint.get("text-opacity").constantOr(1)&&Wn(t,n,r,a,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),o,s),n.map.showCollisionBoxes&&(wn(t,n,r,a,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),wn(t,n,r,a,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))},circle:function(t,n,r,a){if("translucent"!==t.renderPass)return;const i=r.paint.get("circle-opacity"),o=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),l=!r.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<a.length;i++){const o=a[i],s=n.getTile(o),c=s.getBucket(r);if(!c)continue;const u=c.programConfigurations.get(r.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,r),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:a,layoutVertexBuffer:i,indexBuffer:o,uniformValues:s,terrainData:l}=e.state;a.draw(c,u.TRIANGLES,d,p,m,An.disabled,s,l,r.id,i,o,e.segments,r.paint,t.transform.zoom,n)}},heatmap:function(t,n,r,a){if(0!==r.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 r=e.gl;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let a=n.heatmapFbo;if(a)r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer);else{const i=r.createTexture();r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),a=n.heatmapFbo=e.createFramebuffer(t.width/4,t.height/4,!1),function(e,t,n,r){const a=e.gl;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,t.width/4,t.height/4,0,a.RGBA,e.extRenderToTextureHalfFloat?e.extTextureHalfFloat.HALF_FLOAT_OES:a.UNSIGNED_BYTE,null),r.colorAttachment.set(n)}(e,t,i,a)}}(i,t,r),i.clear({color:e.Color.transparent});for(let e=0;e<a.length;e++){const c=a[e];if(n.hasRenderableParent(c))continue;const u=n.getTile(c),d=u.getBucket(r);if(!d)continue;const p=d.programConfigurations.get(r.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,r.paint.get("heatmap-intensity")),null,r.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,r.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 r=t.context,a=r.gl,i=n.heatmapFbo;if(!i)return;r.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i.colorAttachment.get()),r.activeTexture.set(a.TEXTURE1);let o=n.colorRampTexture;o||(o=n.colorRampTexture=new l(r,n.colorRamp,a.RGBA)),o.bind(a.LINEAR,a.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(r,a.TRIANGLES,On.disabled,kn.disabled,t.colorModeForRenderPass(),An.disabled,((t,n,r,a)=>{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,r))},line:function(t,n,r,a){if("translucent"!==t.renderPass)return;const i=r.paint.get("line-opacity"),o=r.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=r.paint.get("line-dasharray"),d=r.paint.get("line-pattern"),p=d.constantOr(1),m=r.paint.get("line-gradient"),b=r.getCrossfadeParameters(),h=p?"linePattern":u?"lineSDF":m?"lineGradient":"line",f=t.context,g=f.gl;let _=!0;for(const i of a){const a=n.getTile(i);if(p&&!a.patternsLoaded())continue;const o=a.getBucket(r);if(!o)continue;const y=o.programConfigurations.get(r.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&&a.imageAtlas){const e=a.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,a,r,b,A):u?kt(t,a,r,u,b,A):m?zt(t,a,r,o.lineClipsArray.length,A):vt(t,a,r,A);if(p)f.activeTexture.set(g.TEXTURE0),a.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 a=o.gradients[r.id];let s=a.texture;if(r.gradientVersion!==a.version){let c=256;if(r.stepInterpolant){const r=n.getSource().maxzoom,a=i.canonical.z===r?Math.ceil(1<<t.transform.maxZoom-i.canonical.z):1;c=e.clamp(e.nextPowerOfTwo(o.maxLineLength/e.EXTENT*1024*a),256,f.maxTextureSize)}a.gradient=e.renderColorRamp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:c,image:a.gradient||void 0,clips:o.lineClipsArray}),a.texture?a.texture.update(a.gradient):a.texture=new l(f,a.gradient,g.RGBA),a.version=r.gradientVersion,s=a.texture}f.activeTexture.set(g.TEXTURE0),s.bind(r.stepInterpolant?g.NEAREST:g.LINEAR,g.CLAMP_TO_EDGE)}v.draw(f,g.TRIANGLES,s,t.stencilModeForClipping(i),c,An.disabled,x,O,r.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,r.paint,t.transform.zoom,y,o.layoutVertexBuffer2),_=!1}},fill:function(t,n,r,a){const i=r.paint.get("fill-color"),o=r.paint.get("fill-opacity");if(0===o.constantOr(1))return;const s=t.colorModeForRenderPass(),l=r.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,r,a,e,s,!1)}if("translucent"===t.renderPass&&r.paint.get("fill-antialias")){const e=t.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,On.ReadOnly);Sn(t,n,r,a,e,s,!0)}},"fill-extrusion":function(e,t,n,r){const a=n.paint.get("fill-extrusion-opacity");if(0!==a&&"translucent"===e.renderPass){const i=new On(e.context.gl.LEQUAL,On.ReadWrite,e.depthRangeFor3D);if(1!==a||n.paint.get("fill-extrusion-pattern").constantOr(1))Tn(e,t,n,r,i,kn.disabled,vn.disabled),Tn(e,t,n,r,i,e.stencilModeFor3D(),e.colorModeForRenderPass());else{const a=e.colorModeForRenderPass();Tn(e,t,n,r,i,kn.disabled,a)}}},hillshade:function(e,t,n,r){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;const a=e.context,i=e.depthModeForSublayer(0,On.ReadOnly),o=e.colorModeForRenderPass(),[s,l]="translucent"===e.renderPass?e.stencilConfigForOverlap(r):[{},r];for(const r of l){const a=t.getTile(r);void 0!==a.needsHillshadePrepare&&a.needsHillshadePrepare&&"offscreen"===e.renderPass?Rn(e,a,n,i,kn.disabled,o):"translucent"===e.renderPass&&Cn(e,r,a,n,i,s[r.overscaledZ],o)}a.viewport.set([0,0,e.width,e.height])},raster:function(e,t,n,r){if("translucent"!==e.renderPass)return;if(0===n.paint.get("raster-opacity"))return;if(!r.length)return;const a=e.context,i=a.gl,o=t.getSource(),s=e.useProgram("raster"),l=e.colorModeForRenderPass(),[c,u]=o instanceof N?[{},r]:e.stencilConfigForOverlap(r),d=u[u.length-1].overscaledZ,p=!e.options.moving;for(const r of u){const u=e.depthModeForSublayer(r.overscaledZ-d,1===n.paint.get("raster-opacity")?On.ReadWrite:On.ReadOnly,i.LESS),m=t.getTile(r);m.registerFadeDuration(n.paint.get("raster-fade-duration"));const b=t.findLoadedParent(r,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;a.activeTexture.set(i.TEXTURE0),m.texture.bind(_,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST),a.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(r),M=y?r:null,v=M?M.posMatrix:e.transform.calculatePosMatrix(r.toUnwrapped(),p),z=wt(v,g||[0,0],f||1,h,n);o instanceof N?s.draw(a,i.TRIANGLES,u,kn.disabled,l,An.disabled,z,y,n.id,o.boundsBuffer,e.quadTriangleIndexBuffer,o.boundsSegments):s.draw(a,i.TRIANGLES,u,c[r.overscaledZ],l,An.disabled,z,y,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}},background:function(e,t,n,r){const a=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===a.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=r||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=r?t.posMatrix:e.transform.calculatePosMatrix(t.toUnwrapped()),d=u?Lt(l,i,e,u,{tileID:t,tileSize:c},g):Wt(l,i,a),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 r=0;r<n.length;r++)Vn(e,t,n[r])},custom:function(e,t,n){const r=e.context,a=n.implementation;if("offscreen"===e.renderPass){const t=a.prerender;t&&(e.setCustomLayerDefaults(),r.setColorMode(e.colorModeForRenderPass()),t.call(a,r.gl,e.transform.customLayerMatrix()),r.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),r.setColorMode(e.colorModeForRenderPass()),r.setStencilMode(kn.disabled);const t="3d"===a.renderingMode?new On(e.context.gl.LEQUAL,On.ReadWrite,e.depthRangeFor3D):e.depthModeForSublayer(0,On.ReadOnly);r.setDepthMode(t),a.render(r.gl,e.transform.customLayerMatrix()),r.setDirty(),e.setBaseState(),r.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 Ve,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,Ue.members),this.tileExtentSegments=e.SegmentVector.simpleSegment(0,0,4,2);const r=new e.PosArray;r.emplaceBack(0,0),r.emplaceBack(e.EXTENT,0),r.emplaceBack(0,e.EXTENT),r.emplaceBack(e.EXTENT,e.EXTENT),this.debugBuffer=t.createVertexBuffer(r,Ue.members),this.debugSegments=e.SegmentVector.simpleSegment(0,0,4,5);const a=new e.RasterBoundsArray;a.emplaceBack(0,0,0,0),a.emplaceBack(e.EXTENT,0,e.EXTENT,0),a.emplaceBack(0,e.EXTENT,0,e.EXTENT),a.emplaceBack(e.EXTENT,e.EXTENT,e.EXTENT,e.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(a,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,Ue.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 r=e.create();e.ortho(r,0,this.width,this.height,0,0,1),e.scale(r,r,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,On.disabled,this.stencilClearMode,vn.disabled,An.disabled,_t(r),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,r=n.gl;this.nextStencilID+t.length>256&&this.clearStencil(),n.setColorMode(vn.disabled),n.setDepthMode(On.disabled);const a=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);a.draw(n,r.TRIANGLES,On.disabled,new kn({func:r.ALWAYS,mask:0},t,255,r.KEEP,r.KEEP,r.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),r=n[n.length-1].overscaledZ,a=n[0].overscaledZ-r+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();const e={};for(let n=0;n<a;n++)e[n+r]=new kn({func:t.GEQUAL,mask:255},n+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=a,[e,n]}return[{[r]: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 r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new On(n||this.context.gl.LEQUAL,t,[r,r])}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 r=this.style._order,a=this.style.sourceCaches,i=this.style.terrain&&new Kn(this);for(const e in a){const t=a[e];t.used&&t.prepare(this.context)}const o={},s={},l={};for(const e in a){const t=a[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<r.length;e++)if(this.style._layers[r[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 r=t.context,a=r.gl,i=vn.unblended,o=new On(a.LEQUAL,On.ReadWrite,[0,1]),s=n.getTerrainMesh(),l=n.sourceCache.getRenderableTiles(),c=t.useProgram("terrainDepth");r.bindFramebuffer.set(n.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.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(r,a.TRIANGLES,o,kn.disabled,i,An.backCCW,{u_matrix:u},l,"terrain",s.vertexBuffer,s.indexBuffer,s.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,this.style.terrain),function(t,n){const r=t.context,a=r.gl,i=vn.unblended,o=new On(a.LEQUAL,On.ReadWrite,[0,1]),s=n.getTerrainMesh(),l=n.getCoordsTexture(),c=n.sourceCache.getRenderableTiles(),u=t.useProgram("terrainCoords");r.bindFramebuffer.set(n.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:e.Color.transparent,depth:1}),n.coordsIndex=[];for(const e of c){const c=n.getTerrainData(e.tileID);r.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,l.texture);const d=t.transform.calculatePosMatrix(e.tileID.toUnwrapped());u.draw(r,a.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)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const e of r){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,a[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=r.length-1;this.currentLayer>=0;this.currentLayer--){const e=this.style._layers[r[this.currentLayer]],t=a[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<r.length;this.currentLayer++){const e=this.style._layers[r[this.currentLayer]],t=a[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;Yn(e,e.transform.height-(t.top||0),3,Pn),Yn(e,t.bottom||0,3,Bn),Xn(e,t.left||0,3,In),Xn(e,e.transform.width-(t.right||0),3,$n);const n=e.transform.centerPoint;!function(e,t,n,r){Hn(e,t-1,n-10,2,20,r),Hn(e,t-10,n-1,20,2,r)}(e,n.x,e.transform.height-n.y,Fn)}(this),this.context.setDefault()}renderLayer(e,t,n,r){n.isHidden(this.transform.zoom)||("background"===n.type||"custom"===n.type||(r||[]).length)&&(this.id=n.id,this.gpuTimingStart(n),Jn[n.type](e,t,n,r,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 r=e[n],a=this.context.extTimerQuery,i=a.getQueryObjectEXT(r.query,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(r.query),t[n]=i}return t}translatePosMatrix(t,n,r,a,i){if(!r[0]&&!r[1])return t;const o=i?"map"===a?this.transform.angle:0:"viewport"===a?-this.transform.angle:0;if(o){const e=Math.sin(o),t=Math.cos(o);r=[r[0]*t-r[1]*e,r[0]*e+r[1]*t]}const s=[i?r[0]:ve(n,r[0],this.transform.zoom),i?r[1]:ve(n,r[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,rt[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,r){const a=Math.pow(2,r),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(r=>{const i=1/(r=e.transformMat4([],r,t))[3]/n*a;return e.mul$1(r,r,[i,i,1/r[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]]),r=e.sub([],i[t[2]],i[t[1]]),a=e.normalize([],e.cross([],n,r)),o=-e.dot(a,i[t[1]]);return a.concat(o)});return new Qn(i,o)}}class er{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],r=e.clone$2(this.min),a=e.clone$2(this.max);for(let e=0;e<n.length;e++)r[e]=n[e]?this.min[e]:this.center[e],a[e]=n[e]?this.center[e]:this.max[e];return a[2]=this.max[2],new er(r,a)}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 r=!0;for(let a=0;a<t.planes.length;a++){const i=t.planes[a];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&&(r=!1)}if(r)return 2;for(let e=0;e<3;e++){let n=Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let a=0;a<t.points.length;a++){const i=t.points[a][e]-this.min[e];n=Math.min(n,i),r=Math.max(r,i)}if(r<0||n>this.max[e]-this.min[e])return 0}return 1}}class tr{constructor(e=0,t=0,n=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(n)||n<0||isNaN(r)||r<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=r}interpolate(t,n,r){return null!=n.top&&null!=t.top&&(this.top=e.number(t.top,n.top,r)),null!=n.bottom&&null!=t.bottom&&(this.bottom=e.number(t.bottom,n.bottom,r)),null!=n.left&&null!=t.left&&(this.left=e.number(t.left,n.left,r)),null!=n.right&&null!=t.right&&(this.right=e.number(t.right,n.right,r)),this}getCenter(t,n){const r=e.clamp((this.left+t-this.right)/2,0,t),a=e.clamp((this.top+n-this.bottom)/2,0,n);return new e.pointGeometry(r,a)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new tr(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class nr{constructor(t,n,r,a,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==r?0:r,this._maxPitch=null==a?60:a,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 tr,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const e=new nr(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 r;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(r=new e.ARRAY_TYPE(4),e.ARRAY_TYPE!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r),function(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=r*l+i*s,e[1]=a*l+o*s,e[2]=r*-s+i*l,e[3]=a*-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 r=this.pointCoordinate(new e.pointGeometry(0,0)),a=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(r.x,a.x,i.x,o.x)),l=Math.floor(Math.max(r.x,a.x,i.x,o.x)),c=1;for(let r=s-c;r<=l+c;r++)0!==r&&n.push(new e.UnwrappedTileID(r,t))}return n}coveringTiles(t){var n,r;let a=this.coveringZoomLevel(t);const i=a;if(void 0!==t.minzoom&&a<t.minzoom)return[];void 0!==t.maxzoom&&a>t.maxzoom&&(a=t.maxzoom);const o=this.pointCoordinate(this.getCameraPoint()),s=e.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,a),c=[l*o.x,l*o.y,0],u=[l*s.x,l*s.y,0],d=Qn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a);let p=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=a);const m=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,b=e=>({aabb:new er([e*l,0,0],[(e+1)*l,l,0]),zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),h=[],f=[],g=a,_=t.reparseOverscaled?i:a;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 a=h.pop(),i=a.x,o=a.y;let s=a.fullyVisible;if(!s){const e=a.aabb.intersects(d);if(0===e)continue;s=2===e}const l=t.terrain?c:u,b=a.aabb.distanceX(l),y=a.aabb.distanceY(l),M=Math.max(Math.abs(b),Math.abs(y)),v=m+(1<<g-a.zoom)-2;if(a.zoom===g||M>v&&a.zoom>=p){const t=g-a.zoom,n=c[0]-.5-(i<<t),r=c[1]-.5-(o<<t);f.push({tileID:new e.OverscaledTileID(a.zoom===g?_:a.zoom,a.wrap,a.zoom,i,o),distanceSq:e.sqrLen([u[0]-.5-i,u[1]-.5-o]),tileDistanceToCamera:Math.sqrt(n*n+r*r)})}else for(let l=0;l<4;l++){const c=(i<<1)+l%2,u=(o<<1)+(l>>1),d=a.zoom+1;let p=a.aabb.quadrant(l);if(t.terrain){const i=new e.OverscaledTileID(d,a.wrap,d,c,u),o=t.terrain.getMinMaxElevation(i),s=null!==(n=o.minElevation)&&void 0!==n?n:this.elevation,l=null!==(r=o.maxElevation)&&void 0!==r?r:this.elevation;p=new er([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:a.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 r=e.MercatorCoordinate.fromLngLat(t),a=(1<<this.tileZoom)*e.EXTENT,i=r.x*a,o=r.y*a,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),r=this.getElevation(n,t);if(!(this.elevation-r))return;const a=this.getCameraPosition(),i=e.MercatorCoordinate.fromLngLat(a.lngLat,a.altitude),o=e.MercatorCoordinate.fromLngLat(n,r),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=r,this._center=n,this.zoom=d}setLocationAtPoint(t,n){const r=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),i=this.locationCoordinate(t),o=new e.MercatorCoordinate(i.x-(r.x-a.x),i.y-(r.y-a.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 r=[t.x,t.y,0,1],a=[t.x,t.y,1,1];e.transformMat4(r,r,this.pixelMatrixInverse),e.transformMat4(a,a,this.pixelMatrixInverse);const i=r[3],o=a[3],s=r[1]/i,l=a[1]/o,c=r[2]/i,u=a[2]/o,d=c===u?0:(0-c)/(u-c);return new e.MercatorCoordinate(e.number(r[0]/i,a[0]/o,d)/this.worldSize,e.number(s,l,d)/this.worldSize)}coordinatePoint(t,n=0,r=this.pixelMatrix){const a=[t.x*this.worldSize,t.y*this.worldSize,n,1];return e.transformMat4(a,a,r),new e.pointGeometry(a[0]/a[3],a[1]/a[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 r=t.key,a=n?this._alignedPosMatrixCache:this._posMatrixCache;if(a[r])return a[r];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),a[r]=new Float32Array(l),a[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,r,a,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&&(a=i+t),e+t>o&&(a=o-t)}if(this.lngRange){const t=(s+l)/2,n=e.wrap(d.x,t-this.worldSize/2,t+this.worldSize/2),a=c.x/2;n-a<s&&(r=s+a),n+a>l&&(r=l-a)}void 0===r&&void 0===a||(this.center=this.unproject(new e.pointGeometry(void 0!==r?r:d.x,void 0!==a?a:d.y)).wrap()),this._unmodified=u,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,r=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=e.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let a=e.identity(new Float64Array(16));e.scale(a,a,[this.width/2,-this.height/2,1]),e.translate(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=e.identity(new Float64Array(16)),e.scale(a,a,[1,-1,1]),e.translate(a,a,[-1,-1,0]),e.scale(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a,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;a=new Float64Array(16),e.perspective(a,this._fov,this.width/this.height,b,m),a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height,e.scale(a,a,[1,-1,1]),e.translate(a,a,[0,0,-this.cameraToCenterDistance]),e.rotateX(a,a,this._pitch),e.rotateZ(a,a,this.angle),e.translate(a,a,[-n,-r,0]),this.mercatorMatrix=e.scale([],a,[this.worldSize,this.worldSize,this.worldSize]),e.scale(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=e.multiply(new Float64Array(16),this.labelPlaneMatrix,a),e.translate(a,a,[0,0,-this.elevation]),this.projMatrix=a,this.invProjMatrix=e.invert([],a),this.pixelMatrix3D=e.multiply(new Float64Array(16),this.labelPlaneMatrix,a);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=r-Math.round(r)+g*f+_*h,v=new Float64Array(a);if(e.translate(v,v,[y>.5?y-1:y,M>.5?M-1:M,0]),this.alignedProjMatrix=v,a=e.invert(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,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 r=n.x,a=n.y,i=n.x,o=n.y;for(const e of t)r=Math.min(r,e.x),a=Math.min(a,e.y),i=Math.max(i,e.x),o=Math.max(o,e.y);return[new e.pointGeometry(r,a),new e.pointGeometry(i,a),new e.pointGeometry(i,o),new e.pointGeometry(r,o),new e.pointGeometry(r,a)]}}}class rr{constructor(t){this._hashName=t&&encodeURIComponent(t),e.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(e,t){let n=!1,r=null;const a=()=>{r=null,n&&(e(),r=setTimeout(a,300),n=!1)};return()=>(n=!0,r||a(),r)}(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,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,r),i=Math.round(t.lng*a)/a,o=Math.round(t.lat*a)/a,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 r=n.split("=")[0];return r===e?(t=!0,`${r}=${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 ar={linearity:.3,easing:e.bezier(0,0,.3,1)},ir=e.extend({deceleration:2500,maxSpeed:1400},ar),or=e.extend({deceleration:20,maxSpeed:1400},ar),sr=e.extend({deceleration:1e3,maxSpeed:360},ar),lr=e.extend({deceleration:1e3,maxSpeed:90},ar);class cr{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 r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const i=dr(n.pan.mag(),r,e.extend({},ir,t||{}));a.offset=n.pan.mult(i.amount/n.pan.mag()),a.center=this._map.transform.center,ur(a,i)}if(n.zoom){const e=dr(n.zoom,r,or);a.zoom=this._map.transform.zoom+e.amount,ur(a,e)}if(n.bearing){const t=dr(n.bearing,r,sr);a.bearing=this._map.transform.bearing+e.clamp(t.amount,-179,179),ur(a,t)}if(n.pitch){const e=dr(n.pitch,r,lr);a.pitch=this._map.transform.pitch+e.amount,ur(a,e)}if(a.zoom||a.bearing){const e=void 0===n.pinchAround?n.around:n.pinchAround;a.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),e.extend(a,{noMoveStart:!0})}}function ur(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function dr(t,n,r){const{maxSpeed:a,linearity:i,deceleration:o}=r,s=e.clamp(t*i/(n/1e3),-a,a),l=Math.abs(s)/(o*i);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}class pr extends e.Event{constructor(t,n,r,a={}){const o=i.mousePos(n.getCanvasContainer(),r),s=n.unproject(o);super(t,e.extend({point:o,lngLat:s,originalEvent:r},a)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class mr extends e.Event{constructor(t,n,r){const a="touchend"===t?r.changedTouches:r.touches,o=i.touchPos(n.getCanvasContainer(),a),s=o.map(e=>n.unproject(e)),l=o.reduce((e,t,n,r)=>e.add(t.div(r.length)),new e.pointGeometry(0,0));super(t,{points:o,point:l,lngLats:s,lngLat:n.unproject(l),originalEvent:r}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class br extends e.Event{constructor(e,t,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class hr{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new br(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new pr(e.type,this._map,e))}mouseup(e){this._map.fire(new pr(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new pr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new pr(e.type,this._map,e))}mouseover(e){this._map.fire(new pr(e.type,this._map,e))}mouseout(e){this._map.fire(new pr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new mr(e.type,this._map,e))}touchmove(e){this._map.fire(new mr(e.type,this._map,e))}touchend(e){this._map.fire(new mr(e.type,this._map,e))}touchcancel(e){this._map.fire(new mr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fr{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new pr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new pr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new pr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gr{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 r=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 a=Math.min(r.x,n.x),o=Math.max(r.x,n.x),s=Math.min(r.y,n.y),l=Math.max(r.y,n.y);i.setTransform(this._box,`translate(${a}px,${s}px)`),this._box.style.width=o-a+"px",this._box.style.height=l-s+"px"}mouseupWindow(t,n){if(!this._active)return;if(0!==t.button)return;const r=this._startPos,a=n;if(this.reset(),i.suppressClick(),r.x!==a.x||r.y!==a.y)return this._map.fire(new e.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(r,a,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 _r(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 r=0;r<e.length;r++)n[e[r].identifier]=t[r];return n}class yr{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),r.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=_r(r,n)))}touchmove(e,t,n){if(this.aborted||!this.centroid)return;const r=_r(n,t);for(const e in this.touches){const t=this.touches[e],n=r[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 Mr{constructor(e){this.singleTap=new yr(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 r=this.singleTap.touchend(e,t,n);if(r){const t=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(r)<30;if(t&&n||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class vr{constructor(){this._zoomIn=new Mr({numTouches:1,numTaps:2}),this._zoomOut=new Mr({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 r=this._zoomIn.touchend(e,t,n),a=this._zoomOut.touchend(e,t,n);return 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})}):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})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const zr={0:1,2:2};class Or{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=zr[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 kr extends Or{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 Ar extends Or{_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 xr extends Or{_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 wr{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,r){r.length>0&&(this._active=!0);const a=_r(r,n),i=new e.pointGeometry(0,0),o=new e.pointGeometry(0,0);let s=0;for(const e in a){const t=a[e],n=this._touches[e];n&&(i._add(t),o._add(t.sub(n)),s++,a[e]=t)}if(this._touches=a,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 Nr{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[r,a]=this._firstTwoTouches,i=qr(n,t,r),o=qr(n,t,a);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[r,a]=this._firstTwoTouches,o=qr(n,t,r),s=qr(n,t,a);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 qr(e,t,n){for(let r=0;r<e.length;r++)if(e[r].identifier===n)return t[r]}function Er(e,t){return Math.log(e/t)/Math.LN2}class jr extends Nr{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(Er(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Er(this._distance,n),pinchAround:t}}}function Wr(e,t){return 180*e.angleWith(t)/Math.PI}class Lr extends Nr{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:Wr(this._vector,n),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,n=Wr(e,this._startVector);return Math.abs(n)<t}}function Sr(e){return Math.abs(e.y)>Math.abs(e.x)}class Tr extends Nr{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,Sr(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,n){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const r=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,a,n.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,n){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,a=t.mag()>=2;if(!r&&!a)return;if(!r||!a)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const i=e.y>0==t.y>0;return Sr(e)&&Sr(t)&&i}}const Cr={panStep:100,bearingStep:15,pitchStep:10};class Rr{constructor(){const e=Cr;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,r=0,a=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(),a=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),i=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),i=1);break;default:return}return this._rotationDisabled&&(n=0,r=0),{cameraAnimation:o=>{const s=o.getZoom();o.easeTo({duration:300,easeId:"keyboardHandler",easing:Dr,zoom:t?Math.round(s)+t*(e.shiftKey?2:1):s,bearing:o.getBearing()+n*this._bearingStep,pitch:o.getPitch()+r*this._pitchStep,offset:[-a*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 Dr(e){return e*(2-e)}const Pr=4.000244140625;class Br{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 r=e.exported.now(),a=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==n&&n%Pr==0?this._type="wheel":0!==n&&Math.abs(n)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(a*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)>Pr?this._wheelZoomRate:this._defaultZoomRate;let n=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==n&&(n=1/n);const r="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(r*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,r=this._startZoom,a=this._easing;let i,o=!1;if("wheel"===this._type&&r&&a){const t=Math.min((e.exported.now()-this._lastWheelEventTime)/200,1),s=a(t);i=e.number(r,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,r=(e.exported.now()-t.start)/t.duration,a=t.easing(r+.01)-t.easing(r),i=.27/Math.sqrt(a*a+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 Ir{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 $r{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 Fr{constructor(){this._tap=new Mr({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 r=t[0],a=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:a/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 Yr{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 Xr{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 Hr{constructor(e,t,n,r){this._el=e,this._touchZoom=t,this._touchRotate=n,this._tapDragZoom=r,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 Vr=e=>e.zoom||e.drag||e.pitch||e.rotate;class Ur extends e.Event{}function Gr(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Kr{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new cr(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),e.bindAll(["handleEvent","handleWindowEvent"],this);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"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 hr(t,e));const r=t.boxZoom=new gr(t,e);this._add("boxZoom",r);const a=new vr,i=new $r;t.doubleClickZoom=new Ir(i,a),this._add("tapZoom",a),this._add("clickZoom",i);const o=new Fr;this._add("tapDragZoom",o);const s=t.touchPitch=new Tr(t);this._add("touchPitch",s);const l=new Ar(e),c=new xr(e);t.dragRotate=new Xr(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new kr(e),d=new wr(e,t);t.dragPan=new Yr(n,u,d),this._add("mousePan",u),this._add("touchPan",d,["touchZoom","touchRotate"]);const p=new Lr,m=new jr;t.touchZoomRotate=new Hr(n,m,p,o),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]);const b=t.scrollZoom=new Br(t,this);this._add("scrollZoom",b,["mousePan"]);const h=t.keyboard=new Rr;this._add("keyboard",h),this._add("blockableMapEvent",new fr(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(Vr(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,n){for(const r in e)if(r!==n&&(!t||t.indexOf(r)<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,r={needsRenderFrame:!1},a={},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(r,a,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||Gr(r))&&(this._changes.push([r,a,u]),this._triggerRenderFrame()),(Object.keys(o).length||Gr(r))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:d}=r;d&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],d(this._map))}mergeHandlerResult(t,n,r,a,i){if(!r)return;e.extend(t,r);const o={handlerName:a,originalEvent:r.originalEvent||i};void 0!==r.zoomDelta&&(n.zoom=o),void 0!==r.panDelta&&(n.drag=o),void 0!==r.pitchDelta&&(n.pitch=o),void 0!==r.bearingDelta&&(n.rotate=o)}_applyChanges(){const t={},n={},r={};for(const[a,i,o]of this._changes)a.panDelta&&(t.panDelta=(t.panDelta||new e.pointGeometry(0,0))._add(a.panDelta)),a.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+a.pitchDelta),void 0!==a.around&&(t.around=a.around),void 0!==a.pinchAround&&(t.pinchAround=a.pinchAround),a.noInertia&&(t.noInertia=a.noInertia),e.extend(n,i),e.extend(r,o);this._updateMapTransform(t,n,r),this._changes=[]}_updateMapTransform(t,n,r){const a=this._map,i=a.transform,o=a.style&&a.style.terrain;if(!(Gr(t)||o&&this._drag))return this._fireEvents(n,r,!0);let{panDelta:s,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:d,pinchAround:p}=t;void 0!==p&&(d=p),a._stop(!0),d=d||a.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},a.fire(new e.Event("freezeElevation",{freeze:!0}))):this._drag&&r[this._drag.handlerName]?(a.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,r,!0)}_fireEvents(t,n,r){const a=Vr(this._eventsInProgress),i=Vr(t),o={};for(const e in t){const{originalEvent:n}=t[e];this._eventsInProgress[e]||(o[e+"start"]=n),this._eventsInProgress[e]=t[e]}!a&&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:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=n[t]||r,s[e+"end"]=l)}for(const e in s)this._fireEvent(e,s[e]);const c=Vr(this._eventsInProgress);if(r&&(a||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 Ur("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Jr={extend:(t,...n)=>e.extend(t,...n),run(e){e()},logToElement(e,t=!1,n="log"){const r=window.document.getElementById(n);r&&(t&&(r.innerHTML=""),r.innerHTML+="<br>"+e)}};class Zr 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,r){return t=e.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,e.extend({offset:t},n),r)}panTo(t,n,r){return this.easeTo(e.extend({center:t},n),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,n,r){return this.easeTo(e.extend({zoom:t},n),r)}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,r){return this.easeTo(e.extend({bearing:t},n),r)}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 r=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),r,n)}_cameraForBoxAndBearing(t,n,r,a){const i={top:0,bottom:0,right:0,left:0};if("number"==typeof(a=e.extend({padding:i,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding){const e=a.padding;a.padding={top:e,bottom:e,right:e,left:e}}a.padding=e.extend(i,a.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(-r*Math.PI/180),d=c.rotate(-r*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+a.padding.left+a.padding.right))/b.x,f=(o.height-(s.top+s.bottom+a.padding.top+a.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)),a.maxZoom),_=e.pointGeometry.convert(a.offset),y=new e.pointGeometry((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(r*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:r}}fitBounds(e,t,n){return this._fitInternal(this.cameraForBounds(e,t),t,n)}fitScreenCoordinates(t,n,r,a,i){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(e.pointGeometry.convert(t)),this.transform.pointLocation(e.pointGeometry.convert(n)),r,a),a,i)}_fitInternal(t,n,r){return t?(delete(n=e.extend(t,n)).padding,n.linear?this.easeTo(n,r):this.flyTo(n,r)):this}jumpTo(t,n){this.stop();const r=this.transform;let a=!1,i=!1,o=!1;return"zoom"in t&&r.zoom!==+t.zoom&&(a=!0,r.zoom=+t.zoom),void 0!==t.center&&(r.center=e.LngLat.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(i=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(o=!0,r.pitch=+t.pitch),null==t.padding||r.isPaddingEqual(t.padding)||(r.padding=t.padding),this.fire(new e.Event("movestart",n)).fire(new e.Event("move",n)),a&&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,r,a=0){const i=e.MercatorCoordinate.fromLngLat(t,n),o=e.MercatorCoordinate.fromLngLat(r,a),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 r=this.transform,a=this.getZoom(),i=this.getBearing(),o=this.getPitch(),s=this.getPadding(),l="zoom"in t?+t.zoom:a,c="bearing"in t?this._normalizeBearing(t.bearing,i):i,u="pitch"in t?+t.pitch:o,d="padding"in t?t.padding:r.padding,p=e.pointGeometry.convert(t.offset);let m=r.centerPoint.add(p);const b=r.pointLocation(m),h=e.LngLat.convert(t.center||b);this._normalizeCenter(h);const f=r.project(b),g=r.project(h).sub(f),_=r.zoomScale(l-a);let y,M;t.around&&(y=e.LngLat.convert(t.around),M=r.locationPoint(y));const v={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==a,this._rotating=this._rotating||i!==c,this._pitching=this._pitching||u!==o,this._padding=!r.isPaddingEqual(d),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,v),this._ease(t=>{if(this._zooming&&(r.zoom=e.number(a,l,t)),this._rotating&&(r.bearing=e.number(i,c,t)),this._pitching&&(r.pitch=e.number(o,u,t)),this._padding&&(r.interpolatePadding(s,d,t),m=r.centerPoint.add(p)),y)r.setLocationAtPoint(y,M);else{const e=r.zoomScale(r.zoom-a),n=l>a?Math.min(2,_):Math.max(.5,_),i=Math.pow(n,1-t),o=r.unproject(f.add(g.mult(t*i)).mult(e));r.setLocationAtPoint(r.renderWorldCopies?o.wrap():o,m)}this._fireMoveEvents(n)},e=>{this._afterEase(n,e)},t),this}_prepareEase(t,n,r={}){this._moving=!0,this.fire(new e.Event("freezeElevation",{freeze:!0})),n||r.moving||this.fire(new e.Event("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.Event("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.Event("rotatestart",t)),this._pitching&&!r.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 r=this._zooming,a=this._rotating,i=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new e.Event("zoomend",t)),a&&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 r=e.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(r,n)}this.stop(),t=e.extend({offset:[0,0],speed:1.2,curve:1.42,easing:e.ease},t);const r=this.transform,a=this.getZoom(),i=this.getBearing(),o=this.getPitch(),s=this.getPadding(),l="zoom"in t?e.clamp(+t.zoom,r.minZoom,r.maxZoom):a,c="bearing"in t?this._normalizeBearing(t.bearing,i):i,u="pitch"in t?+t.pitch:o,d="padding"in t?t.padding:r.padding,p=r.zoomScale(l-a),m=e.pointGeometry.convert(t.offset);let b=r.centerPoint.add(m);const h=r.pointLocation(b),f=e.LngLat.convert(t.center||h);this._normalizeCenter(f);const g=r.project(h),_=r.project(f).sub(g);let y=t.curve;const M=Math.max(r.width,r.height),v=M/p,z=_.mag();if("minZoom"in t){const n=e.clamp(Math.min(t.minZoom,a,l),r.minZoom,r.maxZoom),i=M/r.zoomScale(n-a);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=!r.isPaddingEqual(d),this._prepareEase(n,!1),this._ease(t=>{const p=t*E,h=1/N(p);r.zoom=1===t?l:a+r.scaleZoom(h),this._rotating&&(r.bearing=e.number(i,c,t)),this._pitching&&(r.pitch=e.number(o,u,t)),this._padding&&(r.interpolatePadding(s,d,t),b=r.centerPoint.add(m));const y=1===t?f:r.unproject(g.add(_.mult(q(p))).mult(h));r.setLocationAtPoint(r.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,r){!1===r.animate||0===r.duration?(t(1),n()):(this._easeStart=e.exported.now(),this._easeOptions=r,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 r=Math.abs(t-n);return Math.abs(t-360-n)<r&&(t-=360),Math.abs(t+360-n)<r&&(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 Qr{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 r=t[n];if(r.used||r.usedForTerrain){const t=r.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,n)=>{for(let r=n+1;r<e.length;r++)if(e[r].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 ea{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 ta{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 na={"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"},ra={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},aa={showCompass:!0,showZoom:!0,visualizePitch:!1};class ia{constructor(t,n,r=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Ar({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,r&&(this.mousePitch=new xr({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,r=this.mouseRotate.mousemoveWindow(e,t);if(r&&r.bearingDelta&&n.setBearing(n.getBearing()+r.bearingDelta),this.mousePitch){const r=this.mousePitch.mousemoveWindow(e,t);r&&r.pitchDelta&&n.setPitch(n.getPitch()+r.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 oa(t,n,r){if(t=new e.LngLat(t.lng,t.lat),n){const a=new e.LngLat(t.lng-360,t.lat),i=new e.LngLat(t.lng+360,t.lat),o=r.locationPoint(t).distSqr(n);r.locationPoint(a).distSqr(n)<o?t=a:r.locationPoint(i).distSqr(n)<o&&(t=i)}for(;Math.abs(t.lng-r.center.lng)>180;){const e=r.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=r.width&&e.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}const sa={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 la(e,t,n){const r=e.classList;for(const e in sa)r.remove(`maplibregl-${n}-anchor-${e}`,`mapboxgl-${n}-anchor-${e}`);r.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class ca 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"),r=41,a=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",r+"px"),n.setAttributeNS(null,"width",a+"px"),n.setAttributeNS(null,"viewBox",`0 0 ${a} ${r}`);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",r*this._scale+"px"),n.setAttributeNS(null,"width",a*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()}),la(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,r=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":[r,-1*(t-n+r)],"bottom-right":[-r,-1*(t-n+r)],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=oa(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,`${sa[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 ua={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let da,pa=0,ma=!1;const ba={maxWidth:100,unit:"metric"};function ha(e,t,n){const r=n&&n.maxWidth||100,a=e._container.clientHeight/2,i=e.unproject([0,a]),o=e.unproject([r,a]),s=i.distanceTo(o);if(n&&"imperial"===n.unit){const n=3.2808*s;n>5280?fa(t,r,n/5280,e._getUIString("ScaleControl.Miles")):fa(t,r,n,e._getUIString("ScaleControl.Feet"))}else n&&"nautical"===n.unit?fa(t,r,s/1852,e._getUIString("ScaleControl.NauticalMiles")):s>=1e3?fa(t,r,s/1e3,e._getUIString("ScaleControl.Kilometers")):fa(t,r,s,e._getUIString("ScaleControl.Meters"))}function fa(e,t,n,r){const a=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*(a/n)+"px",e.innerHTML=`${a}&nbsp;${r}`}const ga={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},_a=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ya(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 ya(new e.pointGeometry(0,0))}const Ma={supported:t,setRTLTextPlugin:e.setRTLTextPlugin,getRTLTextPluginStatus:e.getRTLTextPluginStatus,Map:class extends Zr{constructor(t){var n;if(e.PerformanceUtils.mark(e.PerformanceMarkers.create),null!=(t=e.extend({},ra,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 nr(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 ta,this._controls=[],this._mapId=e.uniqueId(),this._locale=e.extend({},na,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 Kr(this,t),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=t.hash&&new rr("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 Qr({customAttribution:t.customAttribution})),t.maplibreLogo&&this.addControl(new ea,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 r=t.onAdd(this);this._controls.push(t);const a=this._controlPositions[n];return-1!==n.indexOf("bottom")?a.insertBefore(r,a.firstChild):a.appendChild(r),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,r){return null==r&&this.style.terrain&&(r=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(e,t,n,r)}resize(t){const n=this._containerDimensions(),r=n[0],a=n[1];this._resizeCanvas(r,a,this.getPixelRatio()),this.transform.resize(r,a),this.painter.resize(r,a,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 r=!1;const a=a=>{const i=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];i.length?r||(r=!0,n.call(this,new pr(e,this,a.originalEvent,{features:i}))):r=!1};return{layer:t,listener:n,delegates:{mousemove:a,mouseout:()=>{r=!1}}}}if("mouseleave"===e||"mouseout"===e){let r=!1;const a=a=>{(this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[]).length?r=!0:r&&(r=!1,n.call(this,new pr(e,this,a.originalEvent)))},i=t=>{r&&(r=!1,n.call(this,new pr(e,this,t.originalEvent)))};return{layer:t,listener:n,delegates:{mousemove:a,mouseout:i}}}{const r=e=>{const r=this.getLayer(t)?this.queryRenderedFeatures(e.point,{layers:[t]}):[];r.length&&(e.features=r,n.call(this,e),delete e.features)};return{layer:t,listener:n,delegates:{[e]:r}}}}on(e,t,n){if(void 0===n)return super.on(e,t);const r=this._createDelegatedListener(e,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r);for(const e in r.delegates)this.on(e,r.delegates[e]);return this}once(e,t,n){if(void 0===n)return super.once(e,t);const r=this._createDelegatedListener(e,t,n);for(const e in r.delegates)this.once(e,r.delegates[e]);return this}off(e,t,n){return void 0===n?super.off(e,t):(this._delegatedListeners&&this._delegatedListeners[e]&&(r=>{const a=this._delegatedListeners[e];for(let e=0;e<a.length;e++){const r=a[e];if(r.layer===t&&r.listener===n){for(const e in r.delegates)this.off(e,r.delegates[e]);return a.splice(e,1),this}}})(),this)}queryRenderedFeatures(t,n){if(!this.style)return[];let r;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])r=[e.pointGeometry.convert(t)];else{const n=e.pointGeometry.convert(t[0]),a=e.pointGeometry.convert(t[1]);r=[n,new e.pointGeometry(a.x,n.y),a,new e.pointGeometry(n.x,a.y),n]}return this.style.queryRenderedFeatures(r,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 r=this._requestManager.transformRequest(t,e.ResourceType.Style);e.getJSON(r,(t,r)=>{t?this.fire(new e.ErrorEvent(t)):r&&this._updateDiff(r,n)})}else"object"==typeof t&&this._updateDiff(t,n)}_updateDiff(t,n){try{this.style.setState(t)&&this._update(!0)}catch(r){e.warnOnce(`Unable to perform style diff: ${r.message||r.error||r}. 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:r=1,sdf:a=!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:r,stretchX:i,stretchY:o,content:s,sdf:a,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:r,stretchX:i,stretchY:o,content:s,sdf:a,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t)}}}updateImage(t,n){const r=this.style.getImage(t);if(!r)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 a=n instanceof HTMLImageElement||e.isImageBitmap(n)?e.exported.getImageData(n):n,{width:i,height:o,data:s}=a;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!==r.data.width||o!==r.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));r.data.replace(s,l),this.style.updateImage(t,r)}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,r={}){return this.style.setPaintProperty(e,t,n,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,n,r={}){return this.style.setLayoutProperty(e,t,n,r),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 r=this._controlContainer=i.create("div","maplibregl-control-container mapboxgl-control-container",e),a=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(e=>{a[e]=i.create("div",`maplibregl-ctrl-${e} mapboxgl-ctrl-${e}`,r)}),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}),r=this._canvas.getContext("webgl",n)||this._canvas.getContext("experimental-webgl",n);r?(this.painter=new Zn(r,this.transform),e.exported$1.testSupport(r)):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,r=0;const a=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(n=a.createQueryEXT(),a.beginQueryEXT(a.TIME_ELAPSED_EXT,n),r=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 r=new e.EvaluationParameters(t,{now:n,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=r.crossFadingFactor();1===a&&a===this._crossFadingFactor||(i=!0,this._crossFadingFactor=a),this.style.update(r)}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()-r;a.endQueryEXT(a.TIME_ELAPSED_EXT,n),setTimeout(()=>{const r=a.getQueryObjectEXT(n,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(n),this.fire(new e.Event("gpu-timing-frame",{cpuTime:t,gpuTime:r}))},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({},aa,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 ia(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({},ua,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!==da?t(da):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then(e=>{da="denied"!==e.state,t(da)}):(da=!!window.navigator.geolocation,t(da)),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,pa=0,ma=!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),r=t.coords.accuracy,a=this._map.getBearing(),i=e.extend({bearing:a},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(r),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]),r=t.distanceTo(n),a=Math.ceil(2*this._accuracy/r);this._circleElement.style.width=a+"px",this._circleElement.style.height=a+"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&&ma)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 ca(this._dotElement),this._circleElement=i.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ca({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":pa--,ma=!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"),pa++,pa>1?(e={maximumAge:6e5,timeout:0},ma=!0):(e=this.options.positionOptions,ma=!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:Qr,LogoControl:ea,ScaleControl:class{constructor(t){this.options=e.extend({},ba,t),e.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ha(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,ha(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(ga),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 r;for(n.innerHTML=e;r=n.firstChild,r;)t.appendChild(r);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=oa(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 r=ya(this.options.offset);if(!n){const e=this._container.offsetWidth,a=this._container.offsetHeight;let i;i=t.y+r.bottom.y<a?["top"]:t.y>this._map.transform.height-a?["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 a=t.add(r[n]).round();i.setTransform(this._container,`${sa[n]} translate(${a.x}px,${a.y}px)`),la(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(_a);e&&e.focus()}_onClose(){this.remove()}},Marker:ca,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(){X().acquire(I)},clearPrewarmedResources:function(){const e=Y;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(I),Y=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 Jr.extend(Ma,{isSafari:e.isSafari,getPerformanceMetrics:e.PerformanceUtils.getPerformanceMetrics}),Ma})),n}()},,function(e,t,n){!function(t,n){var r=function(e,t,n){"use strict";var r,a;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 a=e.lazySizesConfig||e.lazysizesConfig||{},n)t in a||(a[t]=n[t])}(),!t||!t.getElementsByClassName)return{init:function(){},cfg:a,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 r=n?"addEventListener":"removeEventListener";n&&_(e,t),p.forEach((function(n){e[r](n,t)}))},y=function(e,n,a,i,o){var s=t.createEvent("Event");return a||(a={}),a.instance=r,s.initEvent(n,!i,!o),s.detail=a,e.dispatchEvent(s),s},M=function(t,n){var r;!o&&(r=e.picturefill||a.pf)?(n&&n.src&&!t.getAttribute("srcset")&&t.setAttribute("srcset",n.src),r({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<a.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,r,a=function(){t=null,e()},i=function(){var e=n.now()-r;e<99?l(i,99-e):(u||a)(a)};return function(){r=n.now(),t||(t=l(i,99))}},x=(X=/^img$/i,H=/^iframe$/i,V="onscroll"in e&&!/(gle|ing)bot/.test(navigator.userAgent),U=0,G=0,K=-1,J=function(e){G--,(!e||G<0||!e.target)&&(G=0)},Z=function(e){return null==Y&&(Y="hidden"==v(t.body,"visibility")),Y||!("hidden"==v(e.parentNode,"visibility")&&"hidden"==v(e,"visibility"))},Q=function(e,n){var r,a=e,o=Z(e);for(B-=n,F+=n,I-=n,$+=n;o&&(a=a.offsetParent)&&a!=t.body&&a!=i;)(o=(v(a,"opacity")||1)>0)&&"visible"!=v(a,"overflow")&&(r=a.getBoundingClientRect(),o=$>r.left&&I<r.right&&F>r.top-1&&B<r.bottom+1);return o},ee=function(){var e,n,o,s,l,c,u,d,p,m,b,h,f=r.elements;if((C=a.loadMode)&&G<8&&(e=f.length)){for(n=0,K++;n<e;n++)if(f[n]&&!f[n]._lazyRace)if(!V||r.prematureUnveil&&r.prematureUnveil(f[n]))se(f[n]);else if((d=f[n].getAttribute("data-expand"))&&(c=1*d)||(c=U),m||(m=!a.expand||a.expand<1?i.clientHeight>500&&i.clientWidth>500?500:370:a.expand,r._defEx=m,b=m*a.expFactor,h=a.hFac,Y=null,U<b&&G<1&&K>2&&C>2&&!t.hidden?(U=b,K=0):U=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)&&(a.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]||a.preloadAfterLoad)&&(L[0]||!d&&(F||$||I||B||"auto"!=f[n].getAttribute(a.sizesAttr)))&&(s=L[0]||f[n]);s&&!l&&se(s)}},te=function(e){var t,r=0,i=a.throttleDelay,o=a.ricTimeout,s=function(){t=!1,r=n.now(),e()},c=u&&o>49?function(){u(s,{timeout:o}),o!==a.ricTimeout&&(o=a.ricTimeout)}:k((function(){l(s)}),!0);return function(e){var a;(e=!0===e)&&(o=33),t||(t=!0,(a=i-(n.now()-r))<0&&(a=0),e||a<9?c():l(c,a))}}(ee),ne=function(e){var t=e.target;t._lazyCache?delete t._lazyCache:(J(e),f(t,a.loadedClass),g(t,a.loadingClass),_(t,ae),y(t,"lazyloaded"))},re=k(ne),ae=function(e){re({target:e.target})},ie=function(e){var t,n=e.getAttribute(a.srcsetAttr);(t=a.customMedia[e.getAttribute("data-media")||e.getAttribute("media")])&&e.setAttribute("media",t),n&&e.setAttribute("srcset",n)},oe=k((function(e,t,n,r,i){var o,s,c,u,p,m;(p=y(e,"lazybeforeunveil",t)).defaultPrevented||(r&&(n?f(e,a.autosizesClass):e.setAttribute("sizes",r)),s=e.getAttribute(a.srcsetAttr),o=e.getAttribute(a.srcAttr),i&&(u=(c=e.parentNode)&&d.test(c.nodeName||"")),m=t.firesLoad||"src"in e&&(s||o||u),p={target:e},f(e,a.loadingClass),m&&(clearTimeout(T),T=l(J,2500),_(e,ae,!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")||a.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,a.lazyClass),O((function(){var t=e.complete&&e.naturalWidth>1;m&&!t||(t&&f(e,a.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=X.test(e.nodeName),r=n&&(e.getAttribute(a.sizesAttr)||e.getAttribute("sizes")),i="auto"==r;(!i&&S||!n||!e.getAttribute("src")&&!e.srcset||e.complete||h(e,a.errorClass)||!h(e,a.lazyClass))&&(t=y(e,"lazyunveilread").detail,i&&w.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,G++,oe(e,t,i,r,n))}},le=A((function(){a.loadMode=3,te()})),ce=function(){3==a.loadMode&&(a.loadMode=2),le()},ue=function(){S||(n.now()-R<999?l(ue,999):(S=!0,a.loadMode=3,te(),s("scroll",ce,!0)))},{_:function(){R=n.now(),r.elements=t.getElementsByClassName(a.lazyClass),L=t.getElementsByClassName(a.lazyClass+" "+a.preloadClass),s("scroll",te,!0),s("resize",te,!0),s("pageshow",(function(e){if(e.persisted){var n=t.querySelectorAll("."+a.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)),r.elements.length?(ee(),O._lsFlush()):te()},checkElems:te,unveil:se,_aLSL:ce}),w=(E=k((function(e,t,n,r){var a,i,o;if(e._lazysizesWidth=r,r+="px",e.setAttribute("sizes",r),d.test(t.nodeName||""))for(i=0,o=(a=t.getElementsByTagName("source")).length;i<o;i++)a[i].setAttribute("sizes",r);n.detail.dataAttr||M(e,n.detail)})),j=function(e,t,n){var r,a=e.parentNode;a&&(n=z(e,a,n),(r=y(e,"lazybeforesizes",{width:n,dataAttr:!!t})).defaultPrevented||(n=r.detail.width)&&n!==e._lazysizesWidth&&E(e,a,r,n))},W=A((function(){var e,t=q.length;if(t)for(e=0;e<t;e++)j(q[e])})),{_:function(){q=t.getElementsByClassName(a.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,Y,X,H,V,U,G,K,J,Z,Q,ee,te,ne,re,ae,ie,oe,se,le,ce,ue;var de,pe,me,be,he,fe,ge;return l((function(){a.init&&N()})),r={cfg:a,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=r,e.exports&&(e.exports=r)}("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 r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),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,r=e.className,i=e.icon,m=e.id,b=e.value,h=d[n],f=p[n];return i&&(f=i),a.a.createElement(a.a.Fragment,null,b&&a.a.createElement("div",{className:o()(Object(s.b)("pb_stat_change_kit",h),Object(l.c)(e),r),id:m},a.a.createElement(c.a,{status:h},f&&a.a.createElement(a.a.Fragment,null,a.a.createElement(u.a,{fixed_width:!0,icon:f})," "),"".concat(b,"%"))))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(52),l=n(2),c=n(5),u=n(14),d=n(17),p=n(8),m=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=e.alignment,i=void 0===r?"left":r,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.value,A=new s.a({value:k}),x=A.toWeekday(),w=A.toMonth(),N=A.toDay(),q=A.toYear(),E=(new Date).getFullYear().toString(),j=Object(l.a)(n),W=Object(l.c)(f),L=o()(Object(l.b)("pb_date_kit",i),Object(c.c)(e),b);return a.a.createElement("div",Object.assign({},j,W,{className:L,id:g}),"md"==O||"lg"==O?a.a.createElement(m.a,{size:4,tag:"h4"},v&&a.a.createElement(u.a,{className:"pb_icon_kit_container",color:"light",tag:"span"},a.a.createElement(p.a,{fixedWidth:!0,icon:"calendar-alt"})),y&&a.a.createElement(a.a.Fragment,null,x,a.a.createElement(u.a,{color:"light",tag:"span",text:" • "})),a.a.createElement("span",null,w," ",N),E!=q&&a.a.createElement("span",null,", ".concat(q))):a.a.createElement(a.a.Fragment,null,v&&a.a.createElement(d.a,{className:"pb_icon_kit_container",tag:"span"},a.a.createElement(p.a,{fixedWidth:!0,icon:"calendar-alt",size:"sm"})),y&&a.a.createElement(a.a.Fragment,null,a.a.createElement(d.a,{tag:"div"},x),a.a.createElement(d.a,{color:"light",tag:"div",text:" • "})),a.a.createElement(d.a,{tag:"span"},w," ",N,E!=q&&a.a.createElement(a.a.Fragment,null,", ".concat(q)))))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(57),u={home:"H#",project:"P#",appointment:"A#",default:"#"};t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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),r);return a.a.createElement("span",Object.assign({},v,z,{className:O,id:b}),a.a.createElement("a",{href:M,rel:h?"noreferrer":f,target:h?"_blank":"_self"},a.a.createElement(c.a,{dark:d,text:u[y]+g,variant:"primary"})))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),u=n(15),d=function(e){var t=e.active,n=e.dark,r=e.steps;return a.a.createElement("div",{className:"pb_progress_pill".concat(r<=t?"_active":"_inactive").concat(n?" dark":""),key:r})};t.a=function(e){var t=e.active,n=void 0===t?0:t,r=e.aria,i=void 0===r?{hidden:"true"}:r,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 a.a.createElement("div",Object.assign({},z,O,{className:k,id:h}),_&&a.a.createElement("div",{className:"progress_pills_status"},a.a.createElement(u.a,{dark:v,size:4,tag:"h4",text:_}),a.a.createElement(c.a,{color:"light",dark:v,text:y})),a.a.createElement("div",{className:"progress_pills"},function(e,t,n){for(var r=[],a=1;a<=e;a++)r.push(d({steps:a,active:t,dark:n}));return r}(g,n,v)))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return B}));var r=n(0),a=n.n(r),i=n(26),o=n(11),s=n(14),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,r=Object(i.omitBy)(n,u);return a.a.createElement("div",{className:"maskContainer"},Object(i.isEmpty)(n)&&a.a.createElement("div",{className:"filters"},a.a.createElement(s.a,{color:"light",paddingLeft:"xs",size:4,tag:"span",text:"No Filter Selected"})),!Object(i.isEmpty)(n)&&a.a.createElement("div",{className:"filters"},a.a.createElement("div",{className:"left_gradient"}),Object(i.map)(r,(function(e,n){return a.a.createElement("div",{className:"filter",key:"filter-".concat(n)},!0===e?a.a.createElement(c.a,{dark:t,size:4,tag:"h4",text:n}):a.a.createElement("div",null,a.a.createElement(l.a,{dark:t,text:n}),a.a.createElement(c.a,{dark:t,size:4,tag:"h4",text:e})))})),a.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,r=e.className,i=e.children,o=e.dark;return a.a.createElement("div",{className:m()("pb_filter_kit ".concat(r),Object(b.c)(e))},n?a.a.createElement(h.a,{dark:o,padding:"none"},i):a.a.createElement(a.a.Fragment,null,i))},g=n(58),_=n(76);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 r,a,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=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}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,r=new Array(t);n<t;n++)r[n]=e[n];return r}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(r.useState)(!0),2),c=l[0],u=l[1],d=a.a.createElement(g.a,{dark:n,icon:"filter",id:"filter",onClick:function(){return u(!c)},variant:"secondary"});return a.a.createElement(_.a,{closeOnClick:"outside",minWidth:i,placement:s,reference:d,shouldClosePopover:u,show:!c},a.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,r=e.title;return a.a.createElement(a.a.Fragment,null,n&&r?a.a.createElement(a.a.Fragment,null,a.a.createElement(z.a,{align:"center",count:n,dark:t,title:"".concat(O(n),":")})):n?a.a.createElement(a.a.Fragment,null,a.a.createElement(l.a,{className:"filter-results",dark:t,size:"xs",text:"".concat(n," ").concat(O(n))})):a.a.createElement("div",null))},A=n(24),x=n(8),w=n(80),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 r,a,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=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}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,r=new Array(t);n<t;n++)r[n]=e[n];return r}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,r){var o=function(e,t){var n=Object(i.find)(e,{name:t});return{name:t,dir:n&&"asc"==n.dir?"desc":"asc"}}(t,r);return a.a.createElement(N.a,{key:"option-".concat(o.name,"-").concat(o.dir)},a.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(r.useState)(!0),2),c=l[0],u=l[1],d=a.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 r=e.dir,i=e.name;return a.a.createElement("span",{key:"current-sort-".concat(i,"-").concat(r)}," ".concat(n[i]),a.a.createElement(x.a,{dark:t,icon:j(r)}))})));return a.a.createElement(_.a,{className:"pb_filter_sort_menu",closeOnClick:"outside",padding:"none",placement:"bottom",reference:d,shouldClosePopover:u,show:!c},a.a.createElement(w.a,null,W(n,o,(function(e){u(!0),s([e])}))))},S=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n},T=function(e){var t=e.onSortChange,n=e.sortOptions,r=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 a.a.createElement(f,Object.assign({dark:u},b),a.a.createElement(o.a,{orientation:"row",paddingRight:"lg",vertical:"center"},c&&a.a.createElement(a.a.Fragment,null,a.a.createElement(v,{dark:u,minWidth:p,placement:m},c),a.a.createElement(d,{dark:u,filters:s})),a.a.createElement(k,{dark:u,results:l}),!Object(i.isEmpty)(n)&&a.a.createElement(L,{dark:u,onChange:t,options:n,value:r})))},C=n(54),R=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n},D=function(e){var t=e.onSortChange,n=e.sortOptions,r=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 a.a.createElement(f,Object.assign({dark:u},b),a.a.createElement(o.a,{orientation:"row",vertical:"center"},a.a.createElement(v,{dark:u,minWidth:p,placement:m},c),a.a.createElement(d,{dark:u,filters:i})),a.a.createElement(C.a,{dark:u}),a.a.createElement(o.a,{className:"filter-bottom",orientation:"row",spacing:"between",vertical:"center"},a.a.createElement(k,{dark:u,results:s,title:!0}),a.a.createElement(o.a,{orientation:"row",vertical:"center"},a.a.createElement(l.a,{dark:u,text:"sort by:"}),a.a.createElement(L,{dark:u,onChange:t,options:n,value:r}))))},P=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n},B=function(e){var t=e.double,n=void 0!==t&&t,r=P(e,["double"]);return a.a.createElement(a.a.Fragment,null,!0===n?a.a.createElement(D,Object.assign({},r)):a.a.createElement(T,Object.assign({},r)))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),u=n(8);t.a=function(e){var t=e.align,n=void 0===t?"left":t,r=e.aria,i=void 0===r?{}:r,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 a.a.createElement("div",Object.assign({},h,f,{className:g,id:b}),a.a.createElement(c.a,{color:"light"},a.a.createElement(u.a,{aria:{label:"loading icon"},fixedWidth:!0,icon:"spinner",pulse:!0})," Loading"))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(33),u=n(57);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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),r);return a.a.createElement("div",Object.assign({},_,y,{className:M,id:b}),h.slice(0,1).map((function(e,t){return a.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 a.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 a.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 r=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],a={_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 r=this,a=arguments;clearTimeout(n),n=setTimeout((function(){return e.apply(r,a)}),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 r=window.document.createElement(e);return t=t||"",n=n||"",r.className=t,void 0!==n&&(r.textContent=n),r}function m(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function b(e,t){var n=p("div","numInputWrapper"),r=p("input","numInput "+e),a=p("span","arrowUp"),i=p("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?r.type="number":(r.type="text",r.pattern="\\d*"),void 0!==t)for(var o in t)r.setAttribute(o,t[o]);return n.appendChild(r),n.appendChild(a),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 r=parseInt(t),a=new Date(e.getFullYear(),0,2+7*(r-1),0,0,0,0);return a.setDate(a.getDate()-a.getDay()+n.firstDayOfWeek),a},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?a:t,r=e.l10n,o=void 0===r?i:r,s=e.isMobile,l=void 0!==s&&s;return function(e,t,r){var a=r||o;return void 0===n.formatDate||l?t.split("").map((function(t,r,i){return M[t]&&"\\"!==i[r-1]?M[t](e,a,n):"\\"!==t?t:""})).join(""):n.formatDate(e,t,a)}},z=function(e){var t=e.config,n=void 0===t?a:t,r=e.l10n,o=void 0===r?i:r;return function(e,t,r,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||a).dateFormat,d=String(e).trim();if("today"===d)s=new Date,r=!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===r&&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,r=e.defaultSeconds;if(void 0!==e.minDate){var a=e.minDate.getHours(),i=e.minDate.getMinutes(),o=e.minDate.getSeconds();t<a&&(t=a),t===a&&n<i&&(n=i),t===a&&n===i&&r<o&&(r=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&&(r=e.maxDate.getSeconds())}return{hours:t,minutes:n,seconds:r}}n(356);var w=function(){return(w=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},N=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),a=0;for(t=0;t<n;t++)for(var i=arguments[t],o=0,s=i.length;o<s;o++,a++)r[a]=i[o];return r};function q(e,t){var n={config:w(w({},a),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()),r=x(n.config);t.setHours(r.hours,r.minutes,r.seconds,t.getMilliseconds()),n.selectedDates=[t],n.latestSelectedDateObj=t}void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var t="keydown"===e.type,r=h(e),a=r;void 0!==n.amPM&&r===n.amPM&&(n.amPM.textContent=n.l10n.amPM[l(n.amPM.textContent===n.l10n.amPM[0])]);var i=parseFloat(a.getAttribute("min")),o=parseFloat(a.getAttribute("max")),c=parseFloat(a.getAttribute("step")),u=parseInt(a.value,10),d=e.delta||(t?38===e.which?1:-1:0),p=u+c*d;if(void 0!==a.value&&2===a.value.length){var m=a===n.hourElement,b=a===n.minuteElement;p<i?(p=o+p+l(!m)+(l(m)&&l(!n.amPM)),b&&D(void 0,-1,n.hourElement)):p>o&&(p=a===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])]),a.value=s(p)}}(e);var a=n._input.value;q(),ze(),n._input.value!==a&&n._debouncedChange()}function q(){if(void 0!==n.hourElement&&void 0!==n.minuteElement){var e,t,r=(parseInt(n.hourElement.value.slice(-2),10)||0)%24,a=(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=r,t=n.amPM.textContent,r=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(r,a,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);r=p[0],a=p[1],i=p[2]}}else{if(s){var m=void 0!==n.config.maxTime?n.config.maxTime:n.config.maxDate;(r=Math.min(r,m.getHours()))===m.getHours()&&(a=Math.min(a,m.getMinutes())),a===m.getMinutes()&&(i=Math.min(i,m.getSeconds()))}if(o){var b=void 0!==n.config.minTime?n.config.minTime:n.config.minDate;(r=Math.max(r,b.getHours()))===b.getHours()&&a<b.getMinutes()&&(a=b.getMinutes()),a===b.getMinutes()&&(i=Math.max(i,b.getSeconds()))}}W(r,a,i)}}function E(e){var t=e||n.latestSelectedDateObj;t&&t instanceof Date&&W(t.getHours(),t.getMinutes(),t.getSeconds())}function W(e,t,r){void 0!==n.latestSelectedDateObj&&n.latestSelectedDateObj.setHours(e%24,t,r||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(r)))}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,r,a){return t instanceof Array?t.forEach((function(t){return S(e,t,r,a)})):e instanceof Array?e.forEach((function(e){return S(e,t,r,a)})):(e.addEventListener(t,r,a),void n._handlers.push({remove:function(){return e.removeEventListener(t,r,a)}}))}function T(){ge("onChange")}function C(e,t){var r=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),a=n.currentYear,i=n.currentMonth;try{void 0!==r&&(n.currentYear=r.getFullYear(),n.currentMonth=r.getMonth())}catch(e){e.message="Invalid date supplied: "+r,n.config.errorHandler(e)}t&&n.currentYear!==a&&(ge("onYearChange"),X()),!t||n.currentYear===a&&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 r=e&&h(e),a=n||r&&r.parentNode&&r.parentNode.firstChild,i=_e("increment");i.delta=t,a&&a.dispatchEvent(i)}function P(e,t,r,a){var i=ee(t,!0),o=p("span",e,t.getDate().toString());return o.dateObj=t,o.$i=a,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&&a%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&&ae(e)}function I(e){for(var t=e>0?0:n.config.showMonths-1,r=e>0?n.config.showMonths:-1,a=t;a!=r;a+=e)for(var i=n.daysContainer.children[a],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 r=i(),a=te(r||document.body),o=void 0!==e?e:a?r: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():a?function(e,t){for(var r=-1===e.className.indexOf("Month")?e.dateObj.getMonth():n.currentMonth,a=t>0?n.config.showMonths:-1,i=t>0?1:-1,o=r-n.currentMonth;o!=a;o+=i)for(var s=n.daysContainer.children[o],l=r-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 r=(new Date(e,t,1).getDay()-n.l10n.firstDayOfWeek+7)%7,a=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=a+1-r,d=0;u<=a;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-r&&(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 Y(){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 r=new Date(n.currentYear,n.currentMonth,1);r.setMonth(n.currentMonth+t),e.appendChild(F(r.getFullYear(),r.getMonth()))}n.daysContainer.appendChild(e),n.days=n.daysContainer.firstChild,"range"===n.config.mode&&1===n.selectedDates.length&&ae()}}function X(){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 r=p("option","flatpickr-monthDropdown-month");r.value=new Date(n.currentYear,t).getMonth().toString(),r.textContent=g(t,n.config.shorthandCurrentMonth,n.l10n),r.tabIndex=-1,n.currentMonth===t&&(r.selected=!0),n.monthsDropdownContainer.appendChild(r)}}}function H(){var e,t=p("div","flatpickr-month"),r=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),r=parseInt(t.value,10);n.changeMonth(r-n.currentMonth),ge("onMonthChange")})),X(),e=n.monthsDropdownContainer);var a=b("cur-year",{tabindex:"-1"}),i=a.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(a),r.appendChild(o),t.appendChild(r),{container:t,yearElement:i,monthElement:e}}function V(){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 U(){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 r=n.config.showMonths;r--;)n.weekdayContainer.children[r].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 r=t?e:e-n.currentMonth;r<0&&!0===n._hidePrevMonthArrow||r>0&&!0===n._hideNextMonthArrow||(n.currentMonth+=r,(n.currentMonth<0||n.currentMonth>11)&&(n.currentYear+=n.currentMonth>11?1:-1,n.currentMonth=(n.currentMonth+12)%12,ge("onYearChange"),X()),Y(),ge("onMonthChange"),Me())}function J(e){return n.calendarContainer.contains(e)}function Z(e){if(n.isOpen&&!n.config.inline){var t=h(e),r=J(t),a=!(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)))&&!r&&!J(e.relatedTarget),i=!n.config.ignoredFocusElements.some((function(e){return e.contains(t)}));a&&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,r=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)),r&&(n.redraw(),ge("onYearChange"),X())}}function ee(e,t){var r;void 0===t&&(t=!0);var a=n.parseDate(e,void 0,t);if(n.config.minDate&&a&&O(a,n.config.minDate,void 0!==t?t:!n.minDateHasTime)<0||n.config.maxDate&&a&&O(a,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===a)return!1;for(var i=!!n.config.enable,o=null!==(r=n.config.enable)&&void 0!==r?r:n.config.disable,s=0,l=void 0;s<o.length;s++){if("function"==typeof(l=o[s])&&l(a))return i;if(l instanceof Date&&void 0!==a&&l.getTime()===a.getTime())return i;if("string"==typeof l){var c=n.parseDate(l,void 0,!0);return c&&c.getTime()===a.getTime()?i:!i}if("object"==typeof l&&void 0!==a&&l.from&&l.to&&a.getTime()>=l.from.getTime()&&a.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,r=n._input.value.trimEnd()!==ve();!t||!r||e.relatedTarget&&J(e.relatedTarget)||n.setDate(n._input.value,!0,e.target===n.altInput?n.config.altFormat:n.config.dateFormat)}function re(t){var r=h(t),a=n.config.wrap?e.contains(r):r===n._input,o=n.config.allowInput,s=n.isOpen&&(!o||!a),l=n.config.inline&&a&&!o;if(13===t.keyCode&&a){if(o)return n.setDate(n._input.value,!0,r===n.altInput?n.config.altFormat:n.config.dateFormat),n.close(),r.blur();n.open()}else if(J(r)||s||l){var c=!!n.timeContainer&&n.timeContainer.contains(r);switch(t.keyCode){case 13:c?(t.preventDefault(),M(),de()):pe(t);break;case 27:t.preventDefault(),de();break;case 8:case 46:a&&!n.config.allowInput&&(t.preventDefault(),n.clear());break;case 37:case 39:if(c||a)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!==r.$i||r===n.input||r===n.altInput?t.ctrlKey?(t.stopPropagation(),Q(n.currentYear-p),$(I(1),0)):c||$(void 0,7*p):r===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(r);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(r)&&t.shiftKey&&(t.preventDefault(),n._input.focus())}}if(void 0!==n.amPM&&r===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()}(a||J(r))&&ge("onKeyDown",t)}function ae(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 r=e?e.dateObj.getTime():n.days.firstElementChild.dateObj.getTime(),a=n.parseDate(n.selectedDates[0],void 0,!0).getTime(),i=Math.min(r,n.selectedDates[0].getTime()),o=Math.max(r,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<a&&(!l||u>l)?l=u:u>a&&(!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(r<=n.selectedDates[0].getTime()?"startRange":"endRange"),a<r&&d===a?t.classList.add("startRange"):a>r&&d===a&&t.classList.add("endRange"),d>=l&&(0===c||d<=c)&&(o=a,u=r,(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 r=n.config["_"+e+"Date"]=n.parseDate(t,n.config.dateFormat),a=n.config["_"+("min"===e?"max":"min")+"Date"];void 0!==r&&(n["min"===e?"minDateHasTime":"maxDateHasTime"]=r.getHours()>0||r.getMinutes()>0||r.getSeconds()>0),n.selectedDates&&(n.selectedDates=n.selectedDates.filter((function(e){return ee(e)})),n.selectedDates.length||"min"!==e||E(r),ze()),n.daysContainer&&(ue(),void 0!==r?n.currentYearElement[e]=r.getFullYear().toString():n.currentYearElement.removeAttribute(e),n.currentYearElement.disabled=!!a&&void 0!==r&&a.getFullYear()===r.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,r=Array.prototype.reduce.call(n.calendarContainer.children,(function(e,t){return e+t.offsetHeight}),0),a=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<r&&l.top>r,p=window.pageYOffset+l.top+(u?-r-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-=(a-l.width)/2,b=!0):"right"===s&&(m-=a-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+a>window.document.body.offsetWidth,_=f+a>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:(r=document.createElement("style"),document.head.appendChild(r),r.sheet);var r}();if(void 0===y)return;var M=window.document.body.offsetWidth,v=Math.max(0,M/2-a/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||(X(),Me(),Y())}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 r=t,a=n.latestSelectedDateObj=new Date(r.dateObj.getTime()),i=(a.getMonth()<n.currentMonth||a.getMonth()>n.currentMonth+n.config.showMonths-1)&&"range"!==n.config.mode;if(n.selectedDateElem=r,"single"===n.config.mode)n.selectedDates=[a];else if("multiple"===n.config.mode){var o=ye(a);o?n.selectedDates.splice(parseInt(o),1):n.selectedDates.push(a)}else"range"===n.config.mode&&(2===n.selectedDates.length&&n.clear(!1,!1),n.latestSelectedDateObj=a,n.selectedDates.push(a),0!==O(a,n.selectedDates[0],!0)&&n.selectedDates.sort((function(e,t){return e.getTime()-t.getTime()})));if(q(),i){var s=n.currentYear!==a.getFullYear();n.currentYear=a.getFullYear(),n.currentMonth=a.getMonth(),s&&(ge("onYearChange"),X()),ge("onMonthChange")}if(Me(),Y(),ze(),i||"range"===n.config.mode||1!==n.config.showMonths?void 0!==n.selectedDateElem&&void 0===n.hourElement&&n.selectedDateElem&&n.selectedDateElem.focus():B(r),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 r=x(n.config),a=r.hours,i=r.minutes,o=r.seconds;W(a,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=ae,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 r=h(e);r&&r.blur()}return void 0!==n.mobileInput&&(n.mobileInput.focus(),n.mobileInput.click()),void ge("onOpen")}if(n._input.disabled||n.config.inline)return;var a=n.isOpen;n.isOpen=!0,a||(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 a in Object.assign(n.config,e),e)void 0!==me[a]&&me[a].forEach((function(e){return e()}));else n.config[e]=t,void 0!==me[e]?me[e].forEach((function(e){return e()})):r.indexOf(e)>-1&&(n.config[e]=u(t));n.redraw(),ze(!0)},n.setDate=function(e,t,r){void 0===t&&(t=!1);void 0===r&&(r=n.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return n.clear(t);be(e,r),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:[V,_,U],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 r=[];if(e instanceof Array)r=e.map((function(e){return n.parseDate(e,t)}));else if(e instanceof Date||"number"==typeof e)r=[n.parseDate(e,t)];else if("string"==typeof e)switch(n.config.mode){case"single":case"time":r=[n.parseDate(e,t)];break;case"multiple":r=e.split(n.config.conjunction).map((function(e){return n.parseDate(e,t)}));break;case"range":r=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?r:r.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 r=n.config[e];if(void 0!==r&&r.length>0)for(var a=0;r[a]&&a<r.length;a++)r[a](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 r=n.selectedDates[t];if(r instanceof Date&&0===O(r,e))return""+t}return!1}function Me(){n.config.noCalendar||n.isMobile||!n.monthNav||(n.yearElements.forEach((function(e,t){var r=new Date(n.currentYear,n.currentMonth,1);r.setMonth(n.currentMonth+t),n.config.showMonths>1||"static"===n.config.monthSelectorType?n.monthElements[t].textContent=g(r.getMonth(),n.config.shorthandCurrentMonth,n.l10n)+" ":n.monthsDropdownContainer.value=r.getMonth().toString(),e.value=r.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,r){return"range"!==n.config.mode||n.config.enableTime||r.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),r=n.prevMonthNav.contains(t),a=n.nextMonthNav.contains(t);r||a?K(r?-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||a.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||a.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]];r.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)r.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,V(),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}}(),r=t.weekWrapper,a=t.weekNumbers;n.innerContainer.appendChild(r),n.weekNumbers=a,n.weekWrapper=r}n.rContainer=p("div","flatpickr-rContainer"),n.rContainer.appendChild(U()),n.daysContainer||(n.daysContainer=p("div","flatpickr-days"),n.daysContainer.tabIndex=-1),Y(),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",":"),r=b("flatpickr-hour",{"aria-label":n.l10n.hourAriaLabel});n.hourElement=r.getElementsByTagName("input")[0];var a=b("flatpickr-minute",{"aria-label":n.l10n.minuteAriaLabel});n.minuteElement=a.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(r),n.timeContainer.appendChild(t),n.timeContainer.appendChild(a),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&&ae(h(e))}));S(n._input,"keydown",re),void 0!==n.calendarContainer&&S(n.calendarContainer,"keydown",re);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})),r=[],a=0;a<n.length;a++){var i=n[a];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||{}),r.push(i._flatpickr)}catch(e){console.error(e)}}return 1===r.length?r[0]:r}"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 a=!("undefined"==typeof window||!window.document||!window.document.createElement),i={canUseDOM:a,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:a&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:a&&!!window.screen};void 0===(r=function(){return i}.call(t,n,t,e))||(e.exports=r)}()},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(5);t.a=function(e){var t=e.size,n=void 0===t?"lg":t,r=e.widths,i=void 0===r?[1]:r,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 a.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,r){return a.a.createElement("div",{className:o()("pb_distribution_width",t[r]?"color_".concat(t[r]):""),key:r,style:{width:"".concat(100*e/n,"%")}})}))}(u,c))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(52),l=n(2),c=n(5),u=n(14),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,r=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),r),_=Object(l.c)(m),y=new s.a({value:b||new Date(h),zone:f});return a.a.createElement("div",Object.assign({className:g},_),a.a.createElement(u.a,{className:o()("pb_time_stacked","time-spacing"),color:"light",dark:i},a.a.createElement("time",null,y.toTimeWithMeridian(),a.a.createElement(d.a,{className:"pb_time_stacked",color:"light",dark:i,tag:"span",text:y.toTimezone()}))))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),u=n(8);t.a=function(e){var t=e.align,n=void 0===t?"left":t,r=e.aria,i=void 0===r?{}:r,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 a.a.createElement("div",Object.assign({},_,y,{className:M,id:f}),a.a.createElement(c.a,{color:"light",dark:p},a.a.createElement(u.a,{dark:p,fixedWidth:!0,icon:h}),g))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(105),u=n(17);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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),r);return a.a.createElement("div",Object.assign({},g,_,{className:y,id:p}),a.a.createElement(u.a,{className:"pb_label_pill_label",text:m}),a.a.createElement(c.a,{className:"pb_label_pill_pill",text:b,variant:f}))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(33),u=n(14),d=n(11),p=n(30),m=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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||r,j=E?"pb_message_kit_avatar":"pb_message_kit",W=o()(Object(s.b)(j),Object(l.c)(e),g);return a.a.createElement("div",Object.assign({},N,q,{className:W,id:M}),E&&a.a.createElement(c.a,{imageUrl:h,name:r,size:"xs",status:b}),a.a.createElement("div",{className:"content_wrapper"},a.a.createElement(d.a,{justify:"left"===w?"none":"between",orientation:"row"},v&&a.a.createElement(m.a,{className:"message_title",size:4,text:v}),a.a.createElement(p.a,{className:"pull-".concat(w," ").concat(k?"message_humanized_time":null),text:O,timestamp:"",timezone:A}),k&&a.a.createElement(p.a,{className:"pull-".concat(w," message_timestamp"),text:"",timestamp:k,timezone:A})),z&&a.a.createElement(u.a,{className:"pb_message_body",text:z}),f))}},function(e,t,n){"use strict";e.exports=n(391)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(a=r.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 r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?i:String(i)),r)}var a,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,r=l(e);if(t){var a=l(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.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 r(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,r=0;r<n;r++)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])}))}))}))}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n(59).a)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(a=r.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 r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?i:String(i)),r)}var a,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,r=l(e);if(t){var a=l(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.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 r(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)}}])&&a(t.prototype,n),s&&a(t,s),Object.defineProperty(t,"prototype",{writable:!1}),c}(n(59).a)},function(e,t,n){"use strict";var r=n(0),a=n.n(r);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:r,floating:a}=e;const c=r.x+r.width/2-a.width/2,u=r.y+r.height/2-a.height/2,d=l(t),p=o(d),m=r[p]/2-a[p]/2,b="x"===d;let h;switch(s(t)){case"top":h={x:c,y:r.y-a.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-a.width,y:u};break;default:h={x:r.x,y:r.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:r,y:a,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:r,y:a}: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:r=0}=e||{},{x:a,y:s,placement:c,rects:d,platform:p,elements:m}=t;if(null==n)return{};const b=u(r),f={x:a,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 r=i(e),a=l(e),s=o(a);let c="x"===a?r===(n?"end":"start")?"right":"left":"start"===r?"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:r,middlewareData:a,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(r),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,r){const a=i(e);let o=function(e,t,n){const r=["left","right"],a=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?a:r:t?r:a;case"left":case"right":return t?i:o;default:return[]}}(s(e),"start"===n,r);return a&&(o=o.map(e=>e+"-"+a),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=a.flip)?void 0:n.overflows)||[];if(d&&N.push(w[z]),m){const{main:e,cross:t}=y(r,o,k);N.push(w[e],w[t])}if(q=[...q,{placement:r,overflows:N}],!N.every(e=>e<=0)){var E,j;const e=((null==(E=a.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(r!==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:r}=t,a=await async function(e,t){const{placement:n,platform:r,elements:a}=e,o=await(null==r.isRTL?void 0:r.isRTL(a.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+a.x,y:r+a.y,data:a}}}};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:r,display:a}=x(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(a)}function T(e){return["table","td","th"].includes(N(e))}function C(e){const t=/firefox/i.test(E()),n=x(e),r=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!r&&"none"!==r||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),r=parseFloat(t.height);const a=j(e),i=a?e.offsetWidth:n,o=a?e.offsetHeight:r,s=I(n)!==i||I(r)!==o;return s&&(n=i,r=o),{width:n,height:r,fallback:s}}function F(e){return W(e)?e:e.contextElement}const Y={x:1,y:1};function X(e){const t=F(e);if(!j(t))return Y;const n=t.getBoundingClientRect(),{width:r,height:a,fallback:i}=$(t);let o=(i?I(n.width):n.width)/r,s=(i?I(n.height):n.height)/a;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}function H(e,t,n,r){var a,i;void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),s=F(e);let l=Y;t&&(r?W(r)&&(l=X(r)):l=X(e));const c=s?A(s):window,u=R()&&n;let p=(o.left+(u&&(null==(a=c.visualViewport)?void 0:a.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=r&&W(r)?A(r):r;let n=e.frameElement;for(;n&&r&&t!==e;){const e=X(n),t=n.getBoundingClientRect(),r=getComputedStyle(n);t.x+=(n.clientLeft+parseFloat(r.paddingLeft))*e.x,t.y+=(n.clientTop+parseFloat(r.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 V(e){return((w(e)?e.ownerDocument:e.document)||window.document).documentElement}function U(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function G(e){return H(V(e)).left+U(e).scrollLeft}function K(e){if("html"===N(e))return e;const t=e.assignedSlot||e.parentNode||L(e)&&e.host||V(e);return L(t)?t.host:t}function J(e,t){var n;void 0===t&&(t=[]);const r=function e(t){const n=K(t);return D(n)?n.ownerDocument.body:j(n)&&S(n)?n:e(n)}(e),a=r===(null==(n=e.ownerDocument)?void 0:n.body),i=A(r);return a?t.concat(i,i.visualViewport||[],S(r)?r:[]):t.concat(r,J(r))}function Z(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=A(e),r=V(e),a=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,s=0,l=0;if(a){i=a.width,o=a.height;const e=R();(!e||e&&"fixed"===t)&&(s=a.offsetLeft,l=a.offsetTop)}return{width:i,height:o,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=V(e),n=U(e),r=e.ownerDocument.body,a=B(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=B(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+G(e);const s=-n.scrollTop;return"rtl"===x(r).direction&&(o+=B(t.clientWidth,r.clientWidth)-a),{width:a,height:i,x:o,y:s}}(V(e));else if(W(t))r=function(e,t){const n=H(e,!0,"fixed"===t),r=n.top+e.clientTop,a=n.left+e.clientLeft,i=j(e)?X(e):{x:1,y:1};return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:a*i.x,y:r*i.y}}(t,n);else{const n={...t};if(R()){var a,i;const t=A(e);n.x-=(null==(a=t.visualViewport)?void 0:a.offsetLeft)||0,n.y-=(null==(i=t.visualViewport)?void 0:i.offsetTop)||0}r=n}return d(r)}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 r=Q(e,t);for(;r&&T(r)&&"static"===x(r).position;)r=Q(r,t);return r&&("html"===N(r)||"body"===N(r)&&"static"===x(r).position&&!C(r))?n:r||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 r=j(t),a=V(t),i=H(e,!0,"fixed"===n,t);let o={scrollLeft:0,scrollTop:0};const s={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==N(t)||S(a))&&(o=U(t)),j(t)){const e=H(t,!0);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else a&&(s.x=G(a));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:r,strategy:a}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=J(e).filter(e=>W(e)&&"body"!==N(e)),a=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)a=null;else{(i?!t&&!a:!t&&"static"===e.position&&!!a&&["absolute","fixed"].includes(a.position))?r=r.filter(e=>e!==o):a=e}o=K(o)}return t.set(e,r),r}(t,this._c):[].concat(n),r],o=i[0],s=i.reduce((e,n)=>{const r=Z(t,n,a);return e.top=B(r.top,e.top),e.right=P(r.right,e.right),e.bottom=P(r.bottom,e.bottom),e.left=B(r.left,e.left),e},Z(t,o,a));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:r}=e;const a=j(n),i=V(n);if(n===i)return t;let o={scrollLeft:0,scrollTop:0},s={x:1,y:1};const l={x:0,y:0};if((a||!a&&"fixed"!==r)&&(("body"!==N(n)||S(i))&&(o=U(n)),j(n))){const e=H(n);s=X(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:V,getScale:X,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e;const a=this.getOffsetParent||ee,i=this.getDimensions;return{reference:te(t,await a(n),r),floating:{x:0,y:0,...await i(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===x(e).direction};const re=(e,t,n)=>{const r=new Map,a={platform:ne,...n},i={...a.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:a="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:a}),{x:d,y:p}=c(u,r,l),m=r,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:r,placement:m,strategy:a,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:a}):M.rects),({x:d,y:p}=c(u,m,l))),n=-1)}return{x:d,y:p,placement:m,strategy:a,middlewareData:b}})(e,t,{...a,platform:i})};var ae=n(28);const ie=e=>{const{element:t,padding:n}=e;return{name:"arrow",options:e,fn(e){return r=t,Object.prototype.hasOwnProperty.call(r,"current")?null!=t.current?f({element:t.current,padding:n}).fn(e):{}:t?f({element:t,padding:n}).fn(e):{};var r}}};var oe="undefined"!=typeof document?r.useLayoutEffect:r.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,r,a;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;0!=r--;)if(!se(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!Object.prototype.hasOwnProperty.call(t,a[r]))return!1;for(r=n;0!=r--;){const n=a[r];if(("_owner"!==n||!e.$$typeof)&&!se(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function le(e){const t=r.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?r.useLayoutEffect:r.useEffect;let de=!1,pe=0;const me=()=>"floating-ui-"+pe++;const be=r["useId".toString()]||function(){const[e,t]=r.useState(()=>de?me():void 0);return ue(()=>{null==e&&t(me())},[]),r.useEffect(()=>{de||(de=!0)},[]),e};function he(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter(e=>e!==n))||[])}}}const fe=r.createContext(null),ge=r.createContext(null),_e=()=>{var e;return(null==(e=r.useContext(fe))?void 0:e.id)||null},ye=()=>r.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&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof ve(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var r;return!1}function Ae(e){const t=Object(r.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:a,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=r.useRef(),v=r.useRef(),z=r.useRef(),O=r.useRef(),k=r.useRef(!0),A=r.useRef(!1),x=r.useRef(()=>{}),w=r.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]);r.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]),r.useEffect(()=>{if(!u||!_.current||!n)return;function e(){w()&&a(!1)}const t=Me(l).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[l,n,a,u,_,i,w]);const N=r.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(()=>a(!1),t)):e&&(clearTimeout(v.current),a(!1))}),[y,a]),q=r.useCallback(()=>{x.current(),z.current=void 0},[]),E=r.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 r.useEffect(()=>{if(u&&ze(s)){const e=s;return n&&e.addEventListener("mouseleave",c),null==l||l.addEventListener("mouseleave",c),h&&e.addEventListener("mousemove",r,{once:!0}),e.addEventListener("mouseenter",r),e.addEventListener("mouseleave",o),()=>{n&&e.removeEventListener("mouseleave",c),null==l||l.removeEventListener("mouseleave",c),h&&e.removeEventListener("mousemove",r),e.removeEventListener("mouseenter",r),e.removeEventListener("mouseleave",o)}}function t(){return!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)}function r(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(()=>{a(!0)},t):a(!0)}function o(r){if(t())return;x.current();const a=Me(l);if(clearTimeout(O.current),_.current){n||clearTimeout(v.current),z.current=_.current({...e,tree:f,x:r.clientX,y:r.clientY,onClose(){E(),q(),N()}});const t=z.current;return a.addEventListener("mousemove",t),void(x.current=()=>{a.removeEventListener("mousemove",t)})}("touch"!==M.current||!ke(l,r.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,a,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,r;const e=s,n=null==f||null==(t=f.nodesRef.current.find(e=>e.id===g))||null==(r=t.context)?void 0:r.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]),r.useEffect(()=>()=>{q(),clearTimeout(v.current),clearTimeout(O.current),E()},[u,q,E]),r.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||a(!0)},b))}},floating:{onMouseEnter(){clearTimeout(v.current)},onMouseLeave(){o.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),N(!1)}}}},[o,u,b,n,a,N])};function Ne(e,t){let n=e.filter(e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)}),r=n;for(;r.length;)r=e.filter(e=>{var t;return null==(t=r)?void 0:t.some(t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)})}),n=n.concat(r);return n}function qe(e){return"composedPath"in e?e.composedPath()[0]:e.target}const Ee=r["useInsertionEffect".toString()]||(e=>e());function je(e){const t=r.useRef(()=>{0});return Ee(()=>{t.current=e}),r.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}function We(e){let t,{restMs:n=0,buffer:r=.5,blockPointerEvents:a=!1}=void 0===e?{}:e,i=!1,o=!1;const s=e=>{let{x:a,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==a||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=a>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&&a>=v.right-1||"right"===O&&a<=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 a=z.width>v.width,i=z.height>v.height;switch(O){case"top":return[[a?t+r/2:k?t+4*r:t-4*r,n+r+1],[a?t-r/2:k?t+4*r:t-4*r,n+r+1],...[[z.left,k||a?z.bottom-r:z.top],[z.right,k?a?z.bottom-r:z.top:z.bottom-r]]];case"bottom":return[[a?t+r/2:k?t+4*r:t-4*r,n-r],[a?t-r/2:k?t+4*r:t-4*r,n-r],...[[z.left,k||a?z.top+r:z.bottom],[z.right,k?a?z.top+r:z.bottom:z.top+r]]];case"left":{const e=[t+r+1,i?n+r/2:A?n+4*r:n-4*r],a=[t+r+1,i?n-r/2:A?n+4*r:n-4*r];return[...[[A||i?z.right-r:z.left,z.top],[A?i?z.right-r:z.left:z.right-r,z.bottom]],e,a]}case"right":return[[t-r,i?n+r/2:A?n+4*r:n-4*r],[t-r,i?n-r/2:A?n+4*r:n-4*r],...[[A||i?z.left+r:z.right,z.top],[A?i?z.left+r:z.right:z.left+r,z.bottom]]]}}([a,s]);return i?void 0:o&&!x?m():void(!function(e,t){const[n,r]=e;let a=!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>=r!=c>=r&&n<=(l-i)*(r-s)/(c-s)+i&&(a=!a)}return a}([b,h],N)?m():n&&!o&&(t=setTimeout(m,n)))}};return s.__options={blockPointerEvents:a},s}function Le(e){void 0===e&&(e={});const{open:t=!1,onOpenChange:n,nodeId:a}=e,i=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:i,whileElementsMounted:o,open:s}=e,[l,c]=r.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,d]=r.useState(a);se(u,a)||d(a);const p=r.useRef(null),m=r.useRef(null),b=r.useRef(l),h=le(o),f=le(i),[g,_]=r.useState(null),[y,M]=r.useState(null),v=r.useCallback(e=>{p.current!==e&&(p.current=e,_(e))},[]),z=r.useCallback(e=>{m.current!==e&&(m.current=e,M(e))},[]),O=r.useCallback(()=>{if(!p.current||!m.current)return;const e={placement:t,strategy:n,middleware:u};f.current&&(e.platform=f.current),re(p.current,m.current,e).then(e=>{const t={...e,isPositioned:!0};k.current&&!se(b.current,t)&&(b.current=t,ae.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=r.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=r.useMemo(()=>({reference:p,floating:m,setReference:v,setFloating:z}),[v,z]),x=r.useMemo(()=>({reference:g,floating:y}),[g,y]);return r.useMemo(()=>({...l,update:O,refs:A,elements:x,reference:v,floating:z}),[l,O,A,x,v,z])}(e),o=ye(),s=r.useRef(null),l=r.useRef({}),c=r.useState(()=>he())[0],u=be(),[d,p]=r.useState(null),m=r.useCallback(e=>{const t=ze(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;i.refs.setReference(t)},[i.refs]),b=r.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=r.useMemo(()=>({...i.refs,setReference:b,setPositionReference:m,domReference:s}),[i.refs,b,m]),f=r.useMemo(()=>({...i.elements,domReference:d}),[i.elements,d]),g=je(n),_=r.useMemo(()=>({...i,refs:h,elements:f,dataRef:l,nodeId:a,floatingId:u,events:c,open:t,onOpenChange:g}),[i,a,u,c,t,g,h,f]);return ue(()=>{const e=null==o?void 0:o.nodesRef.current.find(e=>e.id===a);e&&(e.context=_)}),r.useMemo(()=>({...i,context:_,refs:h,elements:f,reference:b,positionReference:m}),[i,h,f,_,b,m])}function Se(e,t,n){const r=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,a]=t;var i;0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof a&&(null==(i=r.get(n))||i.push(a),e[n]=function(){for(var e,t=arguments.length,a=new Array(t),i=0;i<t;i++)a[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map(e=>e(...a)).find(e=>void 0!==e)})):e[n]=a}),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 r=n.call(e,t||"default");if("object"!=typeof r)return r;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 r,a,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=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}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,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Fe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}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(r.useState)(!1),2),S=L[0],T=L[1],C=Object(r.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:r,placement:a}=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:r},m=await p(e,u),b=l(s(a)),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-r}}}})],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,Y=R.placement,X=R.reference,H=R.strategy,V=R.x,U=R.y,G=function(e){void 0===e&&(e=[]);const t=e,n=r.useCallback(t=>Se(t,e,"reference"),t),a=r.useCallback(t=>Se(t,e,"floating"),t),i=r.useCallback(t=>Se(t,e,"item"),e.map(e=>null==e?void 0:e.item));return r.useMemo(()=>({getReferenceProps:n,getFloatingProps:a,getItemProps:i}),[n,a,i])}([we(D,{delay:b,handleClose:y?We({blockPointerEvents:!1}):null})]).getFloatingProps,K={bottom:"top",left:"right",right:"left",top:"bottom"}[Y.split("-")[0]];return a.a.createElement(a.a.Fragment,null,a.a.createElement("div",Object.assign({className:"pb_tooltip_kit ".concat(W),ref:X,role:"tooltip_trigger",style:{display:"inline-flex"}},j,E),c),S&&a.a.createElement("div",Object.assign({},G({className:"tooltip_tooltip ".concat(Y," visible"),ref:P,role:"tooltip",style:{position:H,top:null!=U?U:0,left:null!=V?V:0,zIndex:null!=N?N:0}})),a.a.createElement(Pe.a,{align:"center",gap:"xs"},g&&a.a.createElement("i",{className:"pb_icon_kit far fa-".concat(g," fa-fw")}),w),a.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 r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5);function c(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(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){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var p=function e(t,n){var r,a=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}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}}}}(t);try{for(a.s();!(r=a.n()).done;){var i=r.value;if(i.id===n)return i;if(i.children){var o=e(i.children,n);if(o)return o}}}catch(e){a.e(e)}finally{a.f()}return null},m=function e(t,n,r,a){t&&(t.checked=!0,t.expanded=a,n.push(t),t.children&&t.children.map((function(t){e(t,n,r,a)})),r(c(n)))},b=function e(t,n,r,a){if(t){t.checked=!1,t.expanded=!1;var i=n.filter((function(e){return e.id!==t.id}));t.children&&t.children.map((function(t){e(t,n,r,a)})),r(c(i))}},h=function e(t,n){for(var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=0;a<n.length;a++){var i=n[a];if(i.id===t)return[].concat(c(r),[i.id]);if(i.children&&i.children.length>0){var o=e(t,i.children,[].concat(c(r),[i.id]));if(o)return o}}return null},f=n(207),g=n.n(f),_=(n(364),function(e){var t=e.id,n=e.treeData,r=e.onChange,i=e.treeMode;return a.a.createElement(g.a,{data:n,id:t,keepOpenOnSelect:!0,keepTreeOnSearch:!0,keepChildrenOnSearch:!0,onChange:r,texts:{placeholder:"Select..."},mode:i?"hierarchical":"multiSelect"})});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 r,a,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=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}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,r=new Array(t);n<t;n++)r[n]=e[n];return r}t.a=function(e){var t=e.aria,n=void 0===t?{}:t,i=e.className,c=e.data,u=void 0===c?{}:c,d=e.id,f=e.name,g=e.returnAllSelected,M=void 0!==g&&g,v=e.treeData,z=e.onSelect,O=void 0===z?function(){}:z,k=Object(s.a)(n),A=Object(s.c)(u),x=o()(Object(s.b)("pb_multi_level_select"),Object(l.c)(e),i),w=y(Object(r.useState)(v),2),N=w[0],q=w[1],E=y(Object(r.useState)([]),2),j=E[0],W=E[1],L=y(Object(r.useState)([]),2),S=L[0],T=L[1];Object(r.useEffect)((function(){if(M){var e=j.filter((function(e){return e.checked})).filter((function(e,t,n){return t===n.findIndex((function(t){return t.id===e.id}))}));T(e)}}),[j]),Object(r.useEffect)((function(){var e,t,n=document.getElementById("pb_data_wrapper_".concat(d));n&&n.setAttribute("data-tree",JSON.stringify(S)),e=S,(t=document.querySelector("input#"+d))&&(t.value=JSON.stringify(e)),M&&O(S)}),[S]);var C=Object(r.useMemo)((function(){return a.a.createElement(_,Object.assign({treeData:N,onChange:function(e,t){T(t),O(t)},id:d},e))}),[N]);return a.a.createElement("div",Object.assign({},k,A,{className:x,id:d}),a.a.createElement("input",{type:"hidden",id:d,name:f,value:""}),M?a.a.createElement(_,Object.assign({treeData:N,treeMode:M,id:d,onChange:function(e){var t=N.map((function(t){if(t.id===e._id)e.checked?m(t,j,W,!1):b(t,j,W,!1);else if(t.children){var n=p(t.children,e._id);if(n)if(e.checked){if(m(n,j,W,!1),e._parent)h(e._parent,N).forEach((function(e){p(N,e).expanded=!0}))}else if(b(n,j,W,!1),e._parent)h(e._parent,N).forEach((function(e){p(N,e).expanded=!0}))}return t}));q(t)}},e)):a.a.createElement(a.a.Fragment,null,C))}},function(e,t,n){"use strict";var r=n(186),a=n(202),i=n.n(a),o=n(203),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 r=document.createElement("input"),a="datePicker-".concat(t.element.id,"-").concat(e);r.className="datePicker-AMPM",r.id=a,r.name="datepicker-ampm",r.type="radio",r.value=e;var i=document.createElement("label"),o=document.createElement("div");return i.className="label-".concat(e.toLowerCase()),i.setAttribute("for",a),o.className="buffer",o.innerHTML=e,i.append(o),n.prepend(r),n.append(i),n},r=function(e){if(t.selectedDates.length){var n="pb_selectable_card_kit_checked_enabled",r=document.getElementById("datePicker-".concat(t.element.id,"-AM")),a=document.getElementById("datePicker-".concat(t.element.id,"-PM")),i=t.selectedDates[0].getHours()<12?"AM":"PM";e&&(r.checked=!1,a.checked=!1,a.checked="PM"===i,r.checked="AM"===i),"PM"===i?(a.parentElement.className=n,r.parentElement.className="pb_selectable_card_kit_enabled"):"AM"===i&&(r.parentElement.className=n,a.parentElement.className="pb_selectable_card_kit_enabled")}};return{onValueUpdate:function(){r(!0)},onOpen:function(){r(!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 a=document.createElement("div");a.className="pb_caption_kit_md",a.innerHTML=null==e?void 0:e.caption,t.timeContainer.prepend(a)}if(function(){t.amPM.style.display="none";var e=document.createElement("div");e.className="pb_form_group_kit";var r=n("AM");r.addEventListener("click",(function(){t.selectedDates[0].setHours(t.selectedDates[0].getHours()%12+0),t.setDate(t.selectedDates[0],!0)}));var a=n("PM");a.addEventListener("click",(function(){t.selectedDates[0].setHours(t.selectedDates[0].getHours()%12+12),t.setDate(t.selectedDates[0],!0)})),e.prepend(r),e.append(a);var i=document.createElement("div");i.className="meridiem",i.append(e),t.timeContainer.append(i)}(),r(!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,a,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(r.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(){X()}],plugins:(a=[],"month"===E||A.length>0?a.push(i()({shorthand:!0,dateFormat:"F Y",altFormat:"F Y"})):"week"===E&&a.push(s()()),h&&a.push(l({caption:T,showTimezone:j})),a),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 Y=document.querySelector("#year-".concat(k));Y.innerHTML=$,Y.value=B.currentYear,Y.addEventListener("input",(function(e){B.changeYear(Number(e.target.value))})),B.input.form&&B.input.form.addEventListener("reset",(function(){setTimeout((function(){Y.value=B.currentYear,B.monthsDropdownContainer.value=B.currentMonth,d&&(B.setDate(d),X())}),0)}));var X=function(){Y.value=B.currentYear};if(Y.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 r=n(0),a=n.n(r),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,r=new Array(t);n<t;n++)r[n]=e[n];return r}t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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",r]);return a.a.createElement("div",Object.assign({},f,g,{className:_,id:m}),!p&&a.a.createElement("div",{className:"pb_star_rating_number"},h),a.a.createElement("div",{className:"pb_star_rating_wrapper"},a.a.createElement("div",{className:"pb_star_rating_highlight"},c(Array(Math.floor(h))).map((function(e,t){return a.a.createElement(l.a,{fixedWidth:!1,icon:"star",key:t})})),h%1!=0&&a.a.createElement(l.a,{fixedWidth:!1,icon:"star-half"})),a.a.createElement("div",{className:"pb_star_rating_base"},a.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),a.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),a.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),a.a.createElement(l.a,{fixedWidth:!1,icon:"star"}),a.a.createElement(l.a,{fixedWidth:!1,icon:"star"}))))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=function(){return r.createElement("svg",{viewBox:"0 0 200 250",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg"},r.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"}),r.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"}),r.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"}),r.createElement("path",{d:"M99.3 101.1h99.3v24.3H99.3z",fill:"#FFF"}))},u=function(){return r.createElement("svg",{viewBox:"0 0 242.9 242.9",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg"},r.createElement("circle",{cx:121.5,cy:121.5,r:121.5}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"a",x1:42.483,x2:200.309,y1:35.645,y2:35.645},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.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)"}}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"b",x1:17.407,x2:44.897,y1:132.179,y2:132.179},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.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)"}}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"c",x1:52.914,x2:189.715,y1:212.573,y2:212.573},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.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)"}}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"d",x1:31.123,x2:207.766,y1:136.159,y2:136.159},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.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)"}}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"e",x1:30.453,x2:213.794,y1:63.629,y2:63.629},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.createElement("path",{d:"M30.5 60.6h183.3v6.1H30.5z",style:{fill:"url(#e)"}}),r.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"f",x1:196.676,x2:225.538,y1:132.923,y2:132.923},r.createElement("stop",{offset:0,style:{stopColor:"#e6b711"}}),r.createElement("stop",{offset:.128,style:{stopColor:"#eac23c"}}),r.createElement("stop",{offset:.278,style:{stopColor:"#ec6"}}),r.createElement("stop",{offset:.413,style:{stopColor:"#f1d485"}}),r.createElement("stop",{offset:.527,style:{stopColor:"#f2d998"}}),r.createElement("stop",{offset:.607,style:{stopColor:"#f3db9f"}}),r.createElement("stop",{offset:1,style:{stopColor:"#e6b711"}})),r.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,r=e.badge,i=void 0===r?"million-dollar":r,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?a.a.createElement(u,null):a.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 a.a.createElement("div",Object.assign({},_,y,{className:M,id:b}),a.a.createElement("div",{className:"pb_user_badge_wrapper"},g))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(52),u=n(14),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,r=e.dark,i=void 0!==r&&r,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 a.a.createElement(a.a.Fragment,null,n&&a.a.createElement(a.a.Fragment,null,a.a.createElement(u.a,{color:"light",key:Math.random(),tag:"span"},a.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 a.a.createElement("time",{dateTime:(n=e,new c.a({value:n}).toIso())},(t=new Date,M.getFullYear()==v.getFullYear()&&M.getFullYear()==t.getFullYear()?a.a.createElement(a.a.Fragment,null," ".concat(m(e,!1)," ")):a.a.createElement(a.a.Fragment,null," ".concat(m(e,!0)," "))));var t,n};return a.a.createElement("div",Object.assign({},A,{className:o()(k,Object(s.c)(e),z)}),a.a.createElement("div",{className:"pb_date_range_inline_wrapper"},"xs"==h&&a.a.createElement(a.a.Fragment,null,O(),a.a.createElement(d.a,{dark:i,tag:"span"},x(M)),a.a.createElement(d.a,{dark:i,tag:"span"},a.a.createElement(p.a,{className:"pb_date_range_inline_arrow",fixedWidth:!0,icon:"long-arrow-right"})),a.a.createElement(d.a,{dark:i,tag:"span"},x(v))),"sm"==h&&a.a.createElement(a.a.Fragment,null,O(),a.a.createElement(u.a,{dark:i,tag:"span"},x(M)),a.a.createElement(u.a,{color:"light",dark:i,tag:"span"},a.a.createElement(p.a,{className:"pb_date_range_inline_arrow",dark:i,fixedWidth:!0,icon:"long-arrow-right"})),a.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 r,a=n(146);var i=((r=a)&&r.__esModule?r:{default:r}).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 r=function(){};e.exports=r},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(14),u=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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),r);return a.a.createElement("div",Object.assign({},h,f,{className:g,id:m}),a.a.createElement(c.a,{className:"pb_person_first",tag:"span"},p),b&&a.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 r=n(98),a=n(132),i=n(133),o=n(135),s=n(136),l=[a.a,i.a,o.a,s.a],c=Object(r.a)({defaultModifiers:l})},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),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,r=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),r);return a.a.createElement("div",Object.assign({},_,y,{className:M,id:g}),a.a.createElement(c.a,{className:"pb_contact_kit",color:"light",tag:"span"},a.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,""),r=n.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/);return"extension"==t?n.match(/^\d{4}$/):r?[r[1]?"+1 ":"","(",r[2],") ",r[3],"-",r[4]].join(""):null}(b,m)," "),i&&a.a.createElement(u.a,{size:"xs",tag:"span",text:i})))}},function(e,t,n){"use strict";var r=n(43),a=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=a.h.reduce((function(e,n){return e[n]=function(e,t,n){var i=Object(r.a)(e),o=[a.f,a.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,[a.f,a.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 r={left:"right",right:"left",bottom:"top",top:"bottom"};function a(e){return e.replace(/left|right|bottom|top/g,(function(e){return r[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(71),u=n(12);t.a={name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._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?[a(z)]:function(e){if(Object(i.a)(e)===u.a)return[];var t=a(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,r=n.placement,a=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)(r),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:a,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=a(D));var P=a(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[r]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}}},function(e,t,n){"use strict";var r=n(12),a=n(43),i=n(99);var o=n(91),s=n(103),l=n(78),c=n(63),u=n(71),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(a.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?r.m:r.f,I="y"===E?r.c:r.k,$="y"===E?"height":"width",F=W[E],Y=F+x[B],X=F-x[I],H=O?-S[$]/2:0,V=N===r.l?L[$]:S[$],U=N===r.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:V-ee-Z-C.mainAxis,ne=q?-L[$]/2+H+ee+Q+C.mainAxis:U+ee+Q+C.mainAxis,re=t.elements.arrow&&Object(l.a)(t.elements.arrow),ae=re?"y"===E?re.clientTop||0:re.clientLeft||0:0,ie=null!=(P=null==R?void 0:R[E])?P:0,oe=F+te-ie-ae,se=F+ne-ie,le=Object(o.a)(O?Object(p.b)(Y,oe):Y,F,O?Object(p.a)(X,se):X);W[E]=le,D[E]=le-F}if(g){var ce,ue="x"===E?r.m:r.f,de="x"===E?r.c:r.k,pe=W[j],me="y"===j?"height":"width",be=pe+x[ue],he=pe-x[de],fe=-1!==[r.m,r.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 r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),u=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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),r);return a.a.createElement("div",Object.assign({},y,M,{className:O,id:f}),a.a.createElement(c.a,{color:m?"lighter":"light"},a.a.createElement("span",{className:"".concat(v?"pb_legend_indicator_circle_custom":"pb_legend_indicator_circle"),style:z}),g&&a.a.createElement(u.a,{dark:m,size:4,tag:"span",text:" ".concat(g," ")})," ".concat(_," ")))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(2),o=n(5),s=n(11),l=n(16),c=n(54),u=n(148),d=n(65);t.a=function(e){e.date&&Object(o.a)("Date Time Stacked",["date"]);var t=e.date,n=e.datetime,r=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 a.a.createElement(s.a,Object.assign({inline:!1,vertical:"stretch"},e),a.a.createElement(l.a,null,a.a.createElement(d.a,{align:"right",bold:!0,dark:r,date:t||n})),a.a.createElement(c.a,{className:"date-time-padding",orientation:"vertical"}),a.a.createElement(l.a,null,a.a.createElement(u.a,{className:b,dark:r,date:t||n,timeZone:m})))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(11),u=n(54);t.a=function(e){var t=e.children,n=e.padding,r=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:r,paddingBottom:d,paddingX:m});return a.a.createElement(a.a.Fragment,null,_&&a.a.createElement(u.a,null),a.a.createElement("div",{className:"dialog-pseudo-footer"}),a.a.createElement(c.a,{className:o()(y,M,b),spacing:f},t))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5);t.a=function(e){var t=e.children,n=e.padding,r=void 0===n?"sm":n,i=e.className,c=Object(s.b)("dialog_body"),u=Object(l.c)(e,{padding:r});return a.a.createElement("div",{className:o()(c,u,i)},t)}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(8),u=function(e){var t=e.onClose;return a.a.createElement("div",{className:"pb_dialog_close_icon",onClick:t},a.a.createElement(c.a,{fixedWidth:!0,icon:"times"}))},d=n(131),p=n(11),m=n(54);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(r.useContext)(d.a),w=Object(s.b)("dialog_header"),N=Object(l.c)(e,{padding:g});return a.a.createElement("div",{className:"dialog_sticky_header"},a.a.createElement(p.a,Object.assign({},k,A,{className:o()(w,N,c),spacing:y}),i,v&&a.a.createElement(u,{onClose:x.onClose})),O&&a.a.createElement(m.a,null))}},function(e,t,n){e.exports=function(){"use strict";var e,t,n;function r(r,a){if(e)if(t){var i="var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk);",o={};e(o),n=a(o),"undefined"!=typeof window&&(n.workerUrl=window.URL.createObjectURL(new Blob([i],{type:"text/javascript"})))}else t=a;else e=a}return r(0,(function(e){var t=n;function n(e,t,n,r){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*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}function r(e,n,r,a){const i=new t(e,n,r,a);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,r=0;r<8;r++){var a=this.sampleCurveX(n)-e;if(Math.abs(a)<t)return n;var i=this.sampleCurveDerivativeX(n);if(Math.abs(i)<1e-6)break;n-=a/i}var o=0,s=1;for(n=e,r=0;r<20&&(a=this.sampleCurveX(n),!(Math.abs(a-e)<t));r++)e>a?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};const a=r(.25,.1,.25,1);function i(e,t,n){return Math.min(n,Math.max(t,e))}function o(e,t,n){const r=n-t,a=((e-t)%r+r)%r+t;return a===t?n:a}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 r={};for(const a in e)r[a]=t.call(n||this,e[a],a,e);return r}function d(e,t,n){const r={};for(const a in e)t.call(n||this,e[a],a,e)&&(r[a]=e[a]);return r}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,r,a=0,i=e.length,o=i-1;a<i;o=a++)n=e[a],r=e[o],t+=(r.x-n.x)*(n.y+r.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,r,a)=>{const i=r||a;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"),r=n.getContext("2d");if(!r)throw new Error("failed to create canvas 2d context");return n.width=e.width,n.height=e.height,r.drawImage(e,0,0,e.width,e.height),r.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),r=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=r,this},_rotateAround:function(e,t){var n=Math.cos(e),r=Math.sin(e),a=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=a,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,r){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=r}}const $=g()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href;function F(e,t){const n=new AbortController,r=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:$(),signal:n.signal});let a=!1,i=!1;return"json"===e.type&&r.headers.set("Accept","application/json"),i||(Date.now(),fetch(r).then(n=>n.ok?((n,r,o)=>{("arrayBuffer"===e.type?n.arrayBuffer():"json"===e.type?n.json():n.text()).then(e=>{i||(a=!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(r=>t(new I(n.status,n.statusText,e.url,r)))).catch(e=>{20!==e.code&&t(new Error(e.message))})),{cancel:()=>{i=!0,a||n.abort()}}}const Y=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 r=n.response;if("json"===e.type)try{r=JSON.parse(n.response)}catch(e){return t(e)}t(null,r,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else{const r=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});t(new I(n.status,n.statusText,e.url,r))}},n.send(e.body),{cancel:()=>n.abort()}}(e,t)},X=function(e,t){return Y(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 V="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let U,G;U=[],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 U.push(n),n}G++;let n=!1;const r=()=>{if(!n)for(n=!0,G--;U.length&&G<w.MAX_PARALLEL_IMAGE_REQUESTS;){const e=U.shift(),{requestParameters:t,callback:n,cancelled:r}=e;r||(e.cancel=K(t,n).cancel)}},a=X(e,(e,n,a,i)=>{r(),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=V})},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 r=new Blob([new Uint8Array(e)],{type:"image/png"});n.src=e.byteLength?URL.createObjectURL(r):V}(e,t)}(n,(e,n)=>{null!=e?t(e):null!=n&&t(null,n,{cacheControl:a,expires:i})})});return{cancel:()=>{a.cancel(),r()}}};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 r=n[e].indexOf(t);-1!==r&&n[e].splice(r,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 r=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const t of r)Z(n,t,this._oneTimeListeners),t.call(this,e);const a=this._eventedParent;a&&(s(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),a.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 re{constructor(e,t,n,r){this.message=(e?e+": ":"")+n,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}}function ae(e){const t=e.value;return t?[new re(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 r=n.indexOf("("),a=n.indexOf(")");if(-1!==r&&a+1===n.length){var i=n.substr(0,r),o=n.substr(r+1,a-(r+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,r=1){this.r=e,this.g=t,this.b=n,this.a=r}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,r]=this.toArray();return`rgba(${Math.round(e)},${Math.round(t)},${Math.round(n)},${r})`}toArray(){const{r:e,g:t,b:n,a:r}=this;return 0===r?[0,0,0,0]:[255*e/r,255*t/r,255*n/r,r]}}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,r,a){this.text=e,this.image=t,this.scale=n,this.fontStack=r,this.textColor=a}}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,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,n,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,n,r]:[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 r=Ie(n);const a=t.expectedType;return"array"!==r.kind||0!==r.N||!a||"array"!==a.kind||"number"==typeof a.N&&0!==a.N||(r=a),new Fe(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Ye{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Xe={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,r=1;const a=e[0];if("array"===a){let a,i;if(e.length>2){const n=e[1];if("string"!=typeof n||!(n in Xe)||"object"===n)return t.error('The item type argument of "array" must be one of string, number, boolean',1);a=Xe[n],r++}else a=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],r++}n=ve(a,i)}else{if(!Xe[a])throw new Error("Types doesn't contain name = "+a);n=Xe[a]}const i=[];for(;r<e.length;r++){const n=t.parse(e[r],r,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 Ye(`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 Ve={"to-boolean":me,"to-color":be,"to-number":de,"to-string":pe};class Ue{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(!Ve[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 r=Ve[n],a=[];for(let n=1;n<e.length;n++){const r=t.parse(e[n],n,fe);if(!r)return null;a.push(r)}return new Ue(r,a)}evaluate(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){let t,n;for(const r of this.args){if(t=r.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 Ye(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 r=Re.parse(t);if(r)return r}throw new Ye(`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 r=Number(t);if(!isNaN(r))return r}throw new Ye(`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,r){this.name=e,this.type=t,this._evaluate=n,this.args=r}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],r=Je.definitions[n];if(!r)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const a=Array.isArray(r)?r[0]:r.type,i=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=i.filter(([t])=>!Array.isArray(t)||t.length===e.length-1);let s=null;for(const[r,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],a=Array.isArray(r)?r[t-1]:r.type,i=s.parse(n,1+o.length,a);if(!i){l=!0;break}o.push(i)}if(!l)if(Array.isArray(r)&&r.length!==o.length)s.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){const t=Array.isArray(r)?r[e]:r.type,n=o[e];s.concat(e+1).checkSubtype(t,n.type)}if(0===s.errors.length)return new Je(n,a,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(" | "),r=[];for(let n=1;n<e.length;n++){const a=t.parse(e[n],1+r.length);if(!a)return null;r.push(ze(a.type))}t.error(`Expected arguments of type ${n}, but found (${r.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 r=t.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,me);if(!r)return null;const a=t.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,me);if(!a)return null;let i=null;return n.locale&&(i=t.parse(n.locale,1,pe),!i)?null:new Ze(r,a,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,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,a=Math.pow(2,t.z);return[Math.round(n*a*Qe),Math.round(r*a*Qe)]}function rt(e,t,n){const r=e[0]-t[0],a=e[1]-t[1],i=e[0]-n[0],o=e[1]-n[1];return r*o-i*a==0&&r*i<=0&&a*o<=0}function at(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(rt(e,s[t],s[t+1]))return!1;(a=s[t])[1]>(r=e)[1]!=(i=s[t+1])[1]>r[1]&&r[0]<(i[0]-a[0])*(r[1]-a[1])/(i[1]-a[1])+a[0]&&(n=!n)}}var r,a,i;return n}function it(e,t){for(let n=0;n<t.length;n++)if(at(e,t[n]))return!0;return!1}function ot(e,t,n,r){const a=r[0]-n[0],i=r[1]-n[1],o=(e[0]-n[0])*i-a*(e[1]-n[1]),s=(t[0]-n[0])*i-a*(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=[(a=t)[0]-(r=e)[0],a[1]-r[1]])[1]-s[1]*l[0]&&ot(r,a,i,o)&&ot(i,o,r,a))return!0;var r,a,i,o,s,l;return!1}function lt(e,t){for(let n=0;n<e.length;++n)if(!at(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 r=[];for(let a=0;a<e.length;a++){const i=[];for(let r=0;r<e[a].length;r++){const o=nt(e[a][r],n);et(t,o),i.push(o)}r.push(i)}return r}function dt(e,t,n){const r=[];for(let a=0;a<e.length;a++){const i=ut(e[a],t,n);r.push(i)}return r}function pt(e,t,n,r){if(e[0]<n[0]||e[0]>n[2]){const t=.5*r;let a=e[0]-n[0]>t?-r:n[0]-e[0]>t?r:0;0===a&&(a=e[0]-n[2]>t?-r:n[2]-e[0]>t?r:0),e[0]+=a}et(t,e)}function mt(e,t,n,r){const a=Math.pow(2,r.z)*Qe,i=[r.x*Qe,r.y*Qe],o=[];for(const r of e)for(const e of r){const r=[e.x+i[0],e.y+i[1]];pt(r,t,n,a),o.push(r)}return o}function bt(e,t,n,r){const a=Math.pow(2,r.z)*Qe,i=[r.x*Qe,r.y*Qe],o=[];for(const n of e){const e=[];for(const r of n){const n=[r.x+i[0],r.y+i[1]];et(t,n),e.push(n)}o.push(e)}if(t[2]-t[0]<=a/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(const e of o)for(const r of e)pt(r,t,n,a)}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],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if("Polygon"===t.type){const i=ut(t.coordinates,r,a),o=mt(e.geometry(),n,r,a);if(!tt(n,r))return!1;for(const e of o)if(!at(e,i))return!1}if("MultiPolygon"===t.type){const i=dt(t.coordinates,r,a),o=mt(e.geometry(),n,r,a);if(!tt(n,r))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],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if("Polygon"===t.type){const i=ut(t.coordinates,r,a),o=bt(e.geometry(),n,r,a);if(!tt(n,r))return!1;for(const e of o)if(!lt(e,i))return!1}if("MultiPolygon"===t.type){const i=dt(t.coordinates,r,a),o=bt(e.geometry(),n,r,a);if(!tt(n,r))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,r=new ce,a=[]){this.registry=e,this.path=t,this.key=t.map(e=>`[${e}]`).join(""),this.scope=r,this.errors=a,this.expectedType=n}parse(e,t,n,r,a={}){return t?this.concat(t,n,r)._parse(e,a):this._parse(e,a)}_parse(e,t){function n(e,t,n){return"assert"===n?new He(t,[e]):"coerce"===n?new Ue(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 r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const a=this.registry[r];if(a){let r=a.parse(e,this);if(!r)return null;if(this.expectedType){const e=this.expectedType,a=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==a.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==a.kind&&"string"!==a.kind)if("padding"!==e.kind||"value"!==a.kind&&"number"!==a.kind&&"array"!==a.kind){if(this.checkSubtype(e,a))return null}else r=n(r,e,t.typeAnnotation||"coerce");else r=n(r,e,t.typeAnnotation||"coerce");else r=n(r,e,t.typeAnnotation||"assert")}if(!(r instanceof Fe)&&"resolvedImage"!==r.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 Ue||t instanceof He;let r=!0;return t.eachChild(t=>{r=n?r&&e(t):r&&t instanceof Fe}),!!r&&ft(t)&&_t(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(r)){const t=new Ke;try{r=new Fe(r.type,r.evaluate(t))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". 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 r="number"==typeof e?this.path.concat(e):this.path,a=n?this.scope.concat(n):this.scope;return new Mt(this.registry,r,t||null,a,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 r,a,i=0,o=n,s=0;for(;i<=o;)if(s=Math.floor((i+o)/2),r=e[s],a=e[s+1],r<=t){if(s===n||t<a)return s;i=s+1}else{if(!(r>t))throw new Ye("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 r=[];let a=null;t.expectedType&&"value"!==t.expectedType.kind&&(a=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(r.length&&r[r.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,a);if(!c)return null;a=a||c.type,r.push([i,c])}return new zt(a,n,r)}evaluate(e){const t=this.labels,n=this.outputs;if(1===t.length)return n[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);const a=t.length;return r>=t[a-1]?n[a-1].evaluate(e):n[vt(t,r)].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,r)=>Ot(e,t[r],n))},padding:function(e,t,n){const r=e.values,a=t.values;return new Re([Ot(r[0],a[0],n),Ot(r[1],a[1],n),Ot(r[2],a[2],n),Ot(r[3],a[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),r=jt(e.b),a=Nt((.4124564*t+.3575761*n+.1804375*r)/.95047),i=Nt((.2126729*t+.7151522*n+.072175*r)/1);return{l:116*i-16,a:500*(a-i),b:200*(i-Nt((.0193339*t+.119192*n+.9503041*r)/1.08883)),alpha:e.a}}function Lt(e){let t=(e.l+16)/116,n=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*qt(t),n=.95047*qt(n),r=1.08883*qt(r),new Le(Et(3.2404542*n-1.5371385*t-.4985314*r),Et(-.969266*n+1.8760108*t+.041556*r),Et(.0556434*n-.2040259*t+1.0572252*r),e.alpha)}function St(e,t,n){const r=t-e;return e+n*(r>180||r<-180?r-360*Math.round(r/360):r)}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:r}=Wt(e),a=Math.atan2(r,n)*wt;return{h:a<0?a+360:a,c:Math.sqrt(n*n+r*r),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,r,a){this.type=e,this.operator=t,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(const[e,t]of a)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,n,r,a){let i=0;if("exponential"===e.name)i=Pt(n,e.base,r,a);else if("linear"===e.name)i=Pt(n,1,r,a);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,r,a))}return i}static parse(e,t){let[n,r,a,...i]=e;if(!Array.isArray(r)||0===r.length)return t.error("Expected an interpolation type expression.",1);if("linear"===r[0])r={name:"linear"};else if("exponential"===r[0]){const e=r[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:e}}else{if("cubic-bezier"!==r[0])return t.error("Unknown interpolation type "+String(r[0]),1,0);{const e=r.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);r={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(a=t.parse(a,2,de),!a)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],r=i[e+1],a=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.',a);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.',a);const c=t.parse(r,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,r,a,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 r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);const a=t.length;if(r>=t[a-1])return n[a-1].evaluate(e);const i=vt(t,r),o=Dt.interpolationFactor(this.interpolation,r,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,r){const a=r-n,i=e-n;return 0===a?0:1===t?i/a:(Math.pow(t,i)-1)/(Math.pow(t,a)-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 r=t.expectedType;r&&"value"!==r.kind&&(n=r);const a=[];for(const r of e.slice(1)){const e=t.parse(r,1+a.length,n,void 0,{typeAnnotation:"omit"});if(!e)return null;n=n||e.type,a.push(e)}if(!n)throw new Error("No output type");const i=r&&a.some(e=>ke(r,e.type));return new Bt(i?fe:n,a)}evaluate(e){let t,n=null,r=0;for(const a of this.args)if(r++,n=a.evaluate(e),n&&n instanceof De&&!n.available&&(t||(t=n.name),n=null,r===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 r=1;r<e.length-1;r+=2){const a=e[r];if("string"!=typeof a)return t.error(`Expected string, but found ${typeof a} instead.`,r);if(/[^a-zA-Z0-9_]/.test(a))return t.error("Variable names must contain only alphanumeric characters or '_'.",r);const i=t.parse(e[r+1],r+1);if(!i)return null;n.push([a,i])}const r=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return r?new It(n,r):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),r=t.parse(e[2],2,ve(t.expectedType||fe));return n&&r?new $t(r.type.itemType,n,r):null}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new Ye(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new Ye(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new Ye(`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),r=t.parse(e[2],2,fe);return n&&r?Ae(n.type,[me,pe,de,ue,fe])?new Ft(n,r):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 Ye(`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 Ye(`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 Yt{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),r=t.parse(e[2],2,fe);if(!n||!r)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 a=t.parse(e[3],3,de);return a?new Yt(n,r,a):null}return new Yt(n,r)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!xe(t,["boolean","string","number","null"]))throw new Ye(`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 Ye(`Expected second argument to be of type array or string, but found ${ze(Ie(n))} instead.`);if(this.fromIndex){const r=this.fromIndex.evaluate(e);return n.indexOf(t,r)}return n.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Xt{constructor(e,t,n,r,a,i){this.inputType=e,this.type=t,this.input=n,this.cases=r,this.outputs=a,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,r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const a={},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!==a[String(e)])return c.error("Branch labels must be unique.");a[String(e)]=i.length}const u=t.parse(l,o,r);if(!u)return null;r=r||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,r);return s?"value"!==o.type.kind&&t.concat(1).checkSubtype(n,o.type)?null:new Xt(n,r,o,a,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 r=[];for(let a=1;a<e.length-1;a+=2){const i=t.parse(e[a],a,me);if(!i)return null;const o=t.parse(e[a+1],a+1,n);if(!o)return null;r.push([i,o]),n=n||o.type}const a=t.parse(e[e.length-1],e.length-1,n);if(!a)return null;if(!n)throw new Error("Can't infer output type");return new Ht(n,r,a)}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 Vt{constructor(e,t,n,r){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=r}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),r=t.parse(e[2],2,de);if(!n||!r)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 a=t.parse(e[3],3,de);return a?new Vt(n.type,n,r,a):null}return new Vt(n.type,n,r)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!xe(t,["string","array"]))throw new Ye(`Expected first argument to be of type array or string, but found ${ze(Ie(t))} instead.`);if(this.endIndex){const r=this.endIndex.evaluate(e);return t.slice(n,r)}return t.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Ut(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,r){return 0===r.compare(t,n)}function Kt(e,t,n){const r="=="!==e&&"!="!==e;return class a{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(!Ut(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(!Ut(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)}'.`);r&&("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 a(i,o,s)}evaluate(a){const i=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(r&&this.hasUntypedArgument){const t=Ie(i),n=Ie(o);if(t.kind!==n.kind||"string"!==t.kind&&"number"!==t.kind)throw new Ye(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=Ie(i),n=Ie(o);if("string"!==e.kind||"string"!==n.kind)return t(a,i,o)}return this.collator?n(a,i,o,this.collator.evaluate(a)):t(a,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,r){return!Gt(0,t,n,r)})),Qt=Kt("<",(function(e,t,n){return t<n}),(function(e,t,n,r){return r.compare(t,n)<0})),en=Kt(">",(function(e,t,n){return t>n}),(function(e,t,n,r){return r.compare(t,n)>0})),tn=Kt("<=",(function(e,t,n){return t<=n}),(function(e,t,n,r){return r.compare(t,n)<=0})),nn=Kt(">=",(function(e,t,n){return t>=n}),(function(e,t,n,r){return r.compare(t,n)>=0}));class rn{constructor(e,t,n,r,a){this.type=pe,this.number=e,this.locale=t,this.currency=n,this.minFractionDigits=r,this.maxFractionDigits=a}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 r=e[2];if("object"!=typeof r||Array.isArray(r))return t.error("NumberFormat options argument must be an object.");let a=null;if(r.locale&&(a=t.parse(r.locale,1,pe),!a))return null;let i=null;if(r.currency&&(i=t.parse(r.currency,1,pe),!i))return null;let o=null;if(r["min-fraction-digits"]&&(o=t.parse(r["min-fraction-digits"],1,de),!o))return null;let s=null;return r["max-fraction-digits"]&&(s=t.parse(r["max-fraction-digits"],1,de),!s)?null:new rn(n,a,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 an{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 r=[];let a=!1;for(let n=1;n<=e.length-1;++n){const i=e[n];if(a&&"object"==typeof i&&!Array.isArray(i)){a=!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=r[r.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'.");a=!0,r.push({content:i,scale:null,font:null,textColor:null})}}return new an(r)}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 Ye(`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:an,image:on,in:Ft,"index-of":Yt,interpolate:Dt,"interpolate-hcl":Dt,"interpolate-lab":Dt,length:sn,let:It,literal:Fe,match:Xt,number:He,"number-format":rn,object:He,slice:Vt,step:zt,string:He,"to-boolean":Ue,"to-color":Ue,"to-number":Ue,"to-string":Ue,var:yt,within:ht};function cn(e,[t,n,r,a]){t=t.evaluate(e),n=n.evaluate(e),r=r.evaluate(e);const i=a?a.evaluate(e):1,o=Pe(t,n,r,i);if(o)throw new Ye(o);return new Le(t/255*i,n/255*i,r/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,r,a){return vn(typeof n===a?r[n]:void 0,e.default,t.default)}function On(e,t,n){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 a=vt(e.stops.map(e=>e[0]),n);return e.stops[a][1]}function kn(e,t,n){const r=void 0!==e.base?e.base:1;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 i=vt(e.stops.map(e=>e[0]),n),o=function(e,t,n,r){const a=r-n,i=e-n;return 0===a?0:1===t?i/a:(Math.pow(t,i)-1)/(Math.pow(t,a)-1)}(n,r,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 Ye(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 r of t)n+=r.evaluate(e);return n}],"*":[de,pn(de),(e,t)=>{let n=1;for(const r of t)n*=r.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 r=e.properties()[t.value],a=n.value;return typeof r==typeof a&&r<a}],"filter-id-<":[me,[fe],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n<r}],"filter->":[me,[pe,fe],(e,[t,n])=>{const r=e.properties()[t.value],a=n.value;return typeof r==typeof a&&r>a}],"filter-id->":[me,[fe],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n>r}],"filter-<=":[me,[pe,fe],(e,[t,n])=>{const r=e.properties()[t.value],a=n.value;return typeof r==typeof a&&r<=a}],"filter-id-<=":[me,[fe],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n<=r}],"filter->=":[me,[pe,fe],(e,[t,n])=>{const r=e.properties()[t.value],a=n.value;return typeof r==typeof a&&r>=a}],"filter-id->=":[me,[fe],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n>=r}],"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,r){for(;n<=r;){const a=n+r>>1;if(t[a]===e)return!0;t[a]>e?r=a-1:n=a+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,r,a,i){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=i,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,r,a,i){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=a||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 Ye(`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),r=n.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?mn(new xn(r,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,r,a,i){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,a,i)}evaluate(e,t,n,r,a,i){return this._styleExpression.evaluate(e,t,n,r,a,i)}}class En{constructor(e,t,n,r){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent="camera"!==e&&!gt(t.expression),this.interpolationType=r}evaluateWithoutErrorHandling(e,t,n,r,a,i){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,a,i)}evaluate(e,t,n,r,a,i){return this._styleExpression.evaluate(e,t,n,r,a,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 r=n.value.expression,a=ft(r);if(!a&&!hn(t))return bn([new le("","data expressions not supported")]);const i=_t(r,["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 r of t.args)if(n=e(r),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 r=e(t);r instanceof le?n=r:!n&&r?n=new le("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&r&&n!==r&&(n=new le("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}(r);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(a?"camera":"composite",n.value,o.labels,o instanceof Dt?o.interpolation:void 0):new qn(a?"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 r="color"===n.type,a=t.stops&&"object"==typeof t.stops[0][0],i=a||!(a||void 0!==t.property),o=t.type||(gn(n)?"exponential":"interval");if(r||"padding"===n.type){const e=r?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(a){const r={},a=[];for(let e=0;e<t.stops.length;e++){const n=t.stops[e],i=n[0].zoom;void 0===r[i]&&(r[i]={zoom:i,type:t.type,property:t.property,default:t.default,stops:[]},a.push(i)),r[i].stops.push([n[0].value,n[1]])}const i=[];for(const t of a)i.push([r[t].zoom,e(r[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},r)=>kn({stops:i,base:t.base},n,e).evaluate(e,r)}}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,r){const a=r&&r.properties?r.properties[t.property]:void 0;return void 0===a?vn(t.default,n.default):s(t,n,a,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,r=e.valueSpec||{},a=e.objectElementValidators||{},i=e.style,o=e.styleSpec;let s=[];const l=_n(n);if("object"!==l)return[new re(t,n,`object expected, ${l} found`)];for(const e in n){const l=e.split(".")[0],c=r[l]||r["*"];let u;if(a[l])u=a[l];else if(r[l])u=or;else if(a["*"])u=a["*"];else{if(!r["*"]){s.push(new re(t,n[e],`unknown property "${e}"`));continue}u=or}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 r)a[e]||r[e].required&&void 0===r[e].default&&void 0===n[e]&&s.push(new re(t,n,`missing required property "${e}"`));return s}function Sn(e){const t=e.value,n=e.valueSpec,r=e.style,a=e.styleSpec,i=e.key,o=e.arrayElementValidator||or;if("array"!==_n(t))return[new re(i,t,`array expected, ${_n(t)} found`)];if(n.length&&t.length!==n.length)return[new re(i,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new re(i,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let s={type:n.value,values:n.values};a.$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:r,styleSpec:a,key:`${i}[${e}]`}));return l}function Tn(e){const t=e.key,n=e.value,r=e.valueSpec;let a=_n(n);return"number"===a&&n!=n&&(a="NaN"),"number"!==a?[new re(t,n,`number expected, ${a} found`)]:"minimum"in r&&n<r.minimum?[new re(t,n,`${n} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&n>r.maximum?[new re(t,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]}function Cn(e){const t=e.valueSpec,n=oe(e.value.type);let r,a,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 re(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const r=e.value;return t=t.concat(Sn({key:e.key,value:r,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:d})),"array"===_n(r)&&0===r.length&&t.push(new re(e.key,r,"array must have at least one stop")),t},default:function(e){return or({key:e.key,value:e.value,valueSpec:t,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===n&&s&&u.push(new re(e.key,e.value,'missing required property "property"')),"identity"===n||e.value.stops||u.push(new re(e.key,e.value,'missing required property "stops"')),"exponential"===n&&e.valueSpec.expression&&!gn(e.valueSpec)&&u.push(new re(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!hn(e.valueSpec)?u.push(new re(e.key,e.value,"property functions not supported")):s&&!fn(e.valueSpec)&&u.push(new re(e.key,e.value,"zoom functions not supported"))),"categorical"!==n&&!c||void 0!==e.value.property||u.push(new re(e.key,e.value,'"property" property is required')),u;function d(e){let n=[];const r=e.value,s=e.key;if("array"!==_n(r))return[new re(s,r,`array expected, ${_n(r)} found`)];if(2!==r.length)return[new re(s,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==_n(r[0]))return[new re(s,r,`object expected, ${_n(r[0])} found`)];if(void 0===r[0].zoom)return[new re(s,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new re(s,r,"object stop key must have value")];if(i&&i>oe(r[0].zoom))return[new re(s,r[0].zoom,"stop zoom values must appear in ascending order")];oe(r[0].zoom)!==i&&(i=oe(r[0].zoom),a=void 0,o={}),n=n.concat(Ln({key:s+"[0]",value:r[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Tn,value:p}}))}else n=n.concat(p({key:s+"[0]",value:r[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},r));return wn(se(r[1]))?n.concat([new re(s+"[1]",r[1],"expressions are not allowed in function stops.")]):n.concat(or({key:s+"[1]",value:r[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(r){if(s!==r)return[new re(e.key,c,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new re(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==n){let r=`number expected, ${s} found`;return hn(t)&&void 0===n&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new re(e.key,c,r)]}return"categorical"!==n||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===s&&void 0!==a&&l<a?[new re(e.key,c,"stop domain values must appear in ascending order")]:(a=l,"categorical"===n&&l in o?[new re(e.key,c,"stop domain values must be unique")]:(o[l]=!0,[])):[new re(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 re(`${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 re(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 re(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!gt(n))return[new re(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 re(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!ft(n))return[new re(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,r=e.valueSpec,a=[];return Array.isArray(r.values)?-1===r.values.indexOf(oe(n))&&a.push(new re(t,n,`expected one of [${r.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(r.values).indexOf(oe(n))&&a.push(new re(t,n,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(n)} found`)),a}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=Yn(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,r)=>t.value.evaluate(e,n,{},r),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 Yn(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?Xn(e[1],e[2],"=="):"!="===t?Un(Xn(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?Xn(e[1],e[2],t):"any"===t?(n=e.slice(1),["any"].concat(n.map(Yn))):"all"===t?["all"].concat(e.slice(1).map(Yn)):"none"===t?["all"].concat(e.slice(1).map(Yn).map(Un)):"in"===t?Hn(e[1],e.slice(2)):"!in"===t?Un(Hn(e[1],e.slice(2))):"has"===t?Vn(e[1]):"!has"===t?Un(Vn(e[1])):"within"!==t||e;var n}function Xn(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 Vn(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Un(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,r=t.key;if("array"!==_n(n))return[new re(r,n,`array expected, ${_n(n)} found`)];const a=t.styleSpec;let i,o=[];if(n.length<1)return[new re(r,n,"filter array must have at least 1 element")];switch(o=o.concat(Dn({key:r+"[0]",value:n[0],valueSpec:a.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 re(r,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":3!==n.length&&o.push(new re(r,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 re(r+"[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:`${r}[${e}]`,value:n[e],valueSpec:a.geometry_type,style:t.style,styleSpec:t.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&o.push(new re(`${r}[${e}]`,n[e],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let a=1;a<n.length;a++)o=o.concat(e({key:`${r}[${a}]`,value:n[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=_n(n[1]),2!==n.length?o.push(new re(r,n,`filter array for "${n[0]}" operator must have 2 elements`)):"string"!==i&&o.push(new re(r+"[1]",n[1],`string expected, ${i} found`));break;case"within":i=_n(n[1]),2!==n.length?o.push(new re(r,n,`filter array for "${n[0]}" operator must have 2 elements`)):"object"!==i&&o.push(new re(r+"[1]",n[1],`object expected, ${i} found`))}return o}(e)}function Kn(e,t){const n=e.key,r=e.style,a=e.styleSpec,i=e.value,o=e.objectKey,s=a[`${t}_${e.layerType}`];if(!s)return[];const l=o.match(/^(.*)-transition$/);if("paint"===t&&l&&s[l[1]]&&s[l[1]].transition)return or({key:n,value:i,valueSpec:a.transition,style:r,styleSpec:a});const c=e.valueSpec||s[o];if(!c)return[new re(n,i,`unknown property "${o}"`)];let u;if("string"===_n(i)&&hn(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(i)))return[new re(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&&r&&!r.glyphs&&d.push(new re(n,i,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&yn(se(i))&&"identity"===oe(i.type)&&d.push(new re(n,i,'"text-font" does not support identity functions'))),d.concat(or({key:e.key,value:i,valueSpec:c,style:r,styleSpec:a,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,r=e.key,a=e.style,i=e.styleSpec;n.type||n.ref||t.push(new re(r,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=a.layers[o];oe(e.id)===i&&t.push(new re(r,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 re(r,n[e],`"${e}" is prohibited for ref layers`))}),a.layers.forEach(t=>{oe(t.id)===s&&(e=t)}),e?e.ref?t.push(new re(r,n.ref,"ref cannot reference another ref layer")):o=oe(e.type):t.push(new re(r,n.ref,`ref layer "${s}" not found`))}else if("background"!==o)if(n.source){const e=a.sources&&a.sources[n.source],i=e&&oe(e.type);e?"vector"===i&&"raster"===o?t.push(new re(r,n.source,`layer "${n.id}" requires a raster source`)):"raster"===i&&"raster"!==o?t.push(new re(r,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==i||n["source-layer"]?"raster-dem"===i&&"hillshade"!==o?t.push(new re(r,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 re(r,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new re(r,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new re(r,n.source,`source "${n.source}" not found`))}else t.push(new re(r,n,'missing required property "source"'));return t=t.concat(Ln({key:r,value:n,valueSpec:i.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":()=>[],type:()=>or({key:r+".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 er(e){const t=e.value,n=e.key,r=_n(t);return"string"!==r?[new re(n,t,`string expected, ${r} found`)]:[]}const tr={promoteId:function({key:e,value:t}){if("string"===_n(t))return er({key:e,value:t});{const n=[];for(const r in t)n.push(...er({key:`${e}.${r}`,value:t[r]}));return n}}};function nr(e){const t=e.value,n=e.key,r=e.styleSpec,a=e.style;if(!t.type)return[new re(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:r["source_"+i.replace("-","_")],style:e.style,styleSpec:r,objectElementValidators:tr}),o;case"geojson":if(o=Ln({key:n,value:t,valueSpec:r.source_geojson,style:a,styleSpec:r,objectElementValidators:tr}),t.cluster)for(const e in t.clusterProperties){const[r,a]=t.clusterProperties[e],i="string"==typeof r?[r,["accumulated"],["get",e]]:r;o.push(...Rn({key:`${n}.${e}.map`,value:a,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:r.source_video,style:a,styleSpec:r});case"image":return Ln({key:n,value:t,valueSpec:r.source_image,style:a,styleSpec:r});case"canvas":return[new re(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:a,styleSpec:r})}}function rr(e){const t=e.value,n=e.styleSpec,r=n.light,a=e.style;let i=[];const o=_n(t);if(void 0===t)return i;if("object"!==o)return i=i.concat([new re("light",t,`object expected, ${o} found`)]),i;for(const e in t){const o=e.match(/^(.*)-transition$/);i=i.concat(o&&r[o[1]]&&r[o[1]].transition?or({key:e,value:t[e],valueSpec:n.transition,style:a,styleSpec:n}):r[e]?or({key:e,value:t[e],valueSpec:r[e],style:a,styleSpec:n}):[new re(e,t[e],`unknown property "${e}"`)])}return i}function ar(e){const t=e.value,n=e.styleSpec,r=n.terrain,a=e.style;let i=[];const o=_n(t);if(void 0===t)return i;if("object"!==o)return i=i.concat([new re("terrain",t,`object expected, ${o} found`)]),i;for(const e in t)i=i.concat(r[e]?or({key:e,value:t[e],valueSpec:r[e],style:a,styleSpec:n}):[new re(e,t[e],`unknown property "${e}"`)]);return i}const ir={"*":()=>[],array:Sn,boolean:function(e){const t=e.value,n=e.key,r=_n(t);return"boolean"!==r?[new re(n,t,`boolean expected, ${r} found`)]:[]},number:Tn,color:function(e){const t=e.key,n=e.value,r=_n(n);return"string"!==r?[new re(t,n,`color expected, ${r} found`)]:null===we(n)?[new re(t,n,`color expected, "${n}" found`)]:[]},constants:ae,enum:Dn,filter:Gn,function:Cn,layer:Qn,object:Ln,source:nr,light:rr,terrain:ar,string:er,formatted:function(e){return 0===er(e).length?[]:Rn(e)},resolvedImage:function(e){return 0===er(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 re(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];const e={type:"number"};let r=[];for(let a=0;a<n.length;a++)r=r.concat(or({key:`${t}[${a}]`,value:n[a],valueSpec:e}));return r}return Tn({key:t,value:n,valueSpec:{}})}};function or(e){const t=e.value,n=e.valueSpec,r=e.styleSpec;return n.expression&&yn(oe(t))?Cn(e):n.expression&&wn(se(t))?Rn(e):n.type&&ir[n.type]?ir[n.type](e):Ln(ie({},e,{valueSpec:n.type?r[n.type]:n}))}function sr(e){const t=e.value,n=e.key,r=er(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new re(n,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new re(n,t,'"glyphs" url must include a "{range}" token'))),r}function lr(e,t=ne){let n=[];return n=n.concat(or({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:sr,"*":()=>[]}})),e.constants&&(n=n.concat(ae({key:"constants",value:e.constants,style:e,styleSpec:t}))),cr(n)}function cr(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function ur(e){return function(...t){return cr(e.apply(this,t))}}lr.source=ur(nr),lr.light=ur(rr),lr.terrain=ur(ar),lr.layer=ur(Qn),lr.filter=ur(Gn),lr.paintProperty=ur(Jn),lr.layoutProperty=ur(Zn);const dr=lr,pr=dr.light,mr=dr.paintProperty,br=dr.layoutProperty;function hr(e,t){let n=!1;if(t&&t.length)for(const r of t)e.fire(new ee(new Error(r.message))),n=!0;return n}class fr{constructor(e,t,n){const r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const a=new Int32Array(this.arrayBuffer);e=a[0],this.d=(t=a[1])+2*(n=a[2]);for(let e=0;e<this.d*this.d;e++){const t=a[3+e],n=a[3+e+1];r.push(t===n?null:a.subarray(t,n))}const i=a[3+r.length+1];this.keys=a.subarray(a[3+r.length],i),this.bboxes=a.subarray(i),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let e=0;e<this.d*this.d;e++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;const a=n/t*e;this.min=-a,this.max=e+a}insert(e,t,n,r,a){this._forEachCell(t,n,r,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(a)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,n,r,a,i){this.cells[a].push(i)}query(e,t,n,r,a){const i=this.min,o=this.max;if(e<=i&&t<=i&&o<=n&&o<=r&&!a)return Array.prototype.slice.call(this.keys);{const i=[];return this._forEachCell(e,t,n,r,this._queryCell,i,{},a),i}}_queryCell(e,t,n,r,a,i,o,s){const l=this.cells[a];if(null!==l){const a=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]&&r>=c[l+1])?(o[d]=!0,i.push(a[d])):o[d]=!1}}}}_forEachCell(e,t,n,r,a,i,o,s){const l=this._convertToCellCoord(e),c=this._convertToCellCoord(t),u=this._convertToCellCoord(n),d=this._convertToCellCoord(r);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)))&&a.call(this,e,t,n,r,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 r=new Int32Array(t+n+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let a=t;for(let t=0;t<e.length;t++){const n=e[t];r[3+t]=a,r.set(n,a),a+=n.length}return r[3+e.length]=a,r.set(this.keys,a),a+=this.keys.length,r[3+e.length+1]=a,r.set(this.bboxes,a),a+=this.bboxes.length,r.buffer}static serialize(e,t){const n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new fr(e.buffer)}}const gr={};function _r(e,t,n={}){if(gr[e])throw new Error(e+" is already registered.");Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),gr[e]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}_r("Object",Object),_r("TransferableGridIndex",fr),_r("Color",Le),_r("Error",Error),_r("AJAXError",I),_r("ResolvedImage",De),_r("StylePropertyFunction",Wn),_r("StyleExpression",xn,{omit:["_evaluator"]}),_r("ZoomDependentExpression",En),_r("ZoomConstantExpression",qn),_r("CompoundExpression",Je,{omit:["_evaluate"]});for(const e in ln)ln[e]._classRegistryKey||_r("Expression_"+e,ln[e]);function yr(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function Mr(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(yr(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 r of e)n.push(Mr(r,t));return n}if("object"==typeof e){const n=e.constructor,r=n._classRegistryKey;if(!r)throw new Error("can't serialize object of unregistered class");if(!gr[r])throw new Error(r+" is not registered.");const a=n.serialize?n.serialize(e,t):{};if(n.serialize){if(t&&a===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(gr[r].omit.indexOf(n)>=0)continue;const i=e[n];a[n]=gr[r].shallow.indexOf(n)>=0?i:Mr(i,t)}e instanceof Error&&(a.message=e.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(a.$name=r),a}throw new Error("can't serialize object of type "+typeof e)}function vr(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||yr(e)||O(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(vr);if("object"==typeof e){const t=e.$name||"Object";if(!gr[t])throw new Error("can't deserialize unregistered class "+t);const{klass:n}=gr[t];if(!n)throw new Error("can't deserialize unregistered class "+t);if(n.deserialize)return n.deserialize(e);const r=Object.create(n.prototype);for(const n of Object.keys(e)){if("$name"===n)continue;const a=e[n];r[n]=gr[t].shallow.indexOf(n)>=0?a:vr(a)}return r}throw new Error("can't deserialize object of type "+typeof e)}class zr{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 Or={"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 kr(e){for(const t of e)if(wr(t.charCodeAt(0)))return!0;return!1}function Ar(e){for(const t of e)if(!xr(t.charCodeAt(0)))return!1;return!0}function xr(e){return!(Or.Arabic(e)||Or["Arabic Supplement"](e)||Or["Arabic Extended-A"](e)||Or["Arabic Presentation Forms-A"](e)||Or["Arabic Presentation Forms-B"](e))}function wr(e){return!(746!==e&&747!==e&&(e<4352||!(Or["Bopomofo Extended"](e)||Or.Bopomofo(e)||Or["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||Or["CJK Compatibility Ideographs"](e)||Or["CJK Compatibility"](e)||Or["CJK Radicals Supplement"](e)||Or["CJK Strokes"](e)||!(!Or["CJK Symbols and Punctuation"](e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||Or["CJK Unified Ideographs Extension A"](e)||Or["CJK Unified Ideographs"](e)||Or["Enclosed CJK Letters and Months"](e)||Or["Hangul Compatibility Jamo"](e)||Or["Hangul Jamo Extended-A"](e)||Or["Hangul Jamo Extended-B"](e)||Or["Hangul Jamo"](e)||Or["Hangul Syllables"](e)||Or.Hiragana(e)||Or["Ideographic Description Characters"](e)||Or.Kanbun(e)||Or["Kangxi Radicals"](e)||Or["Katakana Phonetic Extensions"](e)||Or.Katakana(e)&&12540!==e||!(!Or["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)||!(!Or["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||Or["Unified Canadian Aboriginal Syllabics"](e)||Or["Unified Canadian Aboriginal Syllabics Extended"](e)||Or["Vertical Forms"](e)||Or["Yijing Hexagram Symbols"](e)||Or["Yi Syllables"](e)||Or["Yi Radicals"](e))))}function Nr(e){return!(wr(e)||function(e){return!!(Or["Latin-1 Supplement"](e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||Or["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)||Or["Letterlike Symbols"](e)||Or["Number Forms"](e)||Or["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)||Or["Control Pictures"](e)&&9251!==e||Or["Optical Character Recognition"](e)||Or["Enclosed Alphanumerics"](e)||Or["Geometric Shapes"](e)||Or["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Or["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Or["CJK Symbols and Punctuation"](e)||Or.Katakana(e)||Or["Private Use Area"](e)||Or["CJK Compatibility Forms"](e)||Or["Small Form Variants"](e)||Or["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 qr(e){return e>=1424&&e<=2303||Or["Arabic Presentation Forms-A"](e)||Or["Arabic Presentation Forms-B"](e)}function Er(e,t){return!(!t&&qr(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||Or.Khmer(e))}function jr(e){for(const t of e)if(qr(t.charCodeAt(0)))return!0;return!1}const Wr="deferred",Lr="loading",Sr="loaded";let Tr=null,Cr="unavailable",Rr=null;const Dr=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(Cr="error"),Tr&&Tr(e)};function Pr(){Br.fire(new Q("pluginStateChange",{pluginStatus:Cr,pluginURL:Rr}))}const Br=new te,Ir=function(){return Cr},$r=function(){if(Cr!==Wr||!Rr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Cr=Lr,Pr(),Rr&&X({url:Rr},e=>{e?Dr(e):(Cr=Sr,Pr())})},Fr={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Cr===Sr||null!=Fr.applyArabicShaping,isLoading:()=>Cr===Lr,setState(e){if(!g())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Cr=e.pluginStatus,Rr=e.pluginURL},isParsed(){if(!g())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=Fr.applyArabicShaping&&null!=Fr.processBidirectionalText&&null!=Fr.processStyledBidirectionalText},getPluginURL(){if(!g())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Rr}};class Yr{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 zr,this.transition={})}isSupportedScript(e){return function(e,t){for(const n of e)if(!Er(n.charCodeAt(0),t))return!1;return!0}(e,Fr.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 Xr{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 Hr{constructor(e){this.property=e,this.value=new Xr(e,void 0)}transitioned(e,t){return new Ur(this.property,this.value,t,s({},e.transition,this.transition),e.now)}untransitioned(){return new Ur(this.property,this.value,null,{},0)}}class Vr{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 Hr(this._values[e].property)),this._values[e].value=new Xr(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 Hr(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 r=this.getTransition(t);void 0!==r&&(e[t+"-transition"]=r)}return e}transitioned(e,t){const n=new Gr(this._properties);for(const r of Object.keys(this._values))n._values[r]=this._values[r].transitioned(e,t._values[r]);return n}untransitioned(){const e=new Gr(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Ur{constructor(e,t,n,r,a){this.property=e,this.value=t,this.begin=a+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){const r=e.now||0,a=this.value.possiblyEvaluate(e,t,n),i=this.prior;if(i){if(r>this.end)return this.prior=null,a;if(this.value.isDataDriven())return this.prior=null,a;if(r<this.begin)return i.possiblyEvaluate(e,t,n);{const o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(i.possiblyEvaluate(e,t,n),a,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 a}}class Gr{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){const r=new Zr(this._properties);for(const a of Object.keys(this._values))r._values[a]=this._values[a].possiblyEvaluate(e,t,n);return r}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Kr{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 Xr(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 r=new Zr(this._properties);for(const a of Object.keys(this._values))r._values[a]=this._values[a].possiblyEvaluate(e,t,n);return r}}class Jr{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,r){return this.property.evaluate(this.value,this.parameters,e,t,n,r)}}class Zr{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Qr{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 r=kt[this.specification.type];return r?r(e,t,n):e}}class ea{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,r){return new Jr(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},n,r)}: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 Jr(this,{kind:"constant",value:void 0},e.parameters);const r=kt[this.specification.type];return r?new Jr(this,{kind:"constant",value:r(e.value.value,t.value.value,n)},e.parameters):e}evaluate(e,t,n,r,a,i){return"constant"===e.kind?e.value:e.evaluate(t,n,r,a,i)}}class ta extends ea{possiblyEvaluate(e,t,n,r){if(void 0===e.value)return new Jr(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){const a=e.expression.evaluate(t,null,{},n,r),i="resolvedImage"===e.property.specification.type&&"string"!=typeof a?a.name:a,o=this._calculate(i,i,i,t);return new Jr(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 Jr(this,{kind:"constant",value:n},t)}return new Jr(this,e.expression,t)}evaluate(e,t,n,r,a,i){if("source"===e.kind){const o=e.evaluate(t,n,r,a,i);return this._calculate(o,o,o,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,r),e.evaluate({zoom:Math.floor(t.zoom)},n,r),e.evaluate({zoom:Math.floor(t.zoom)+1},n,r),t):e.value}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class na{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){if(void 0!==e.value){if("constant"===e.expression.kind){const a=e.expression.evaluate(t,null,{},n,r);return this._calculate(a,a,a,t)}return this._calculate(e.expression.evaluate(new Yr(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Yr(Math.floor(t.zoom),t)),e.expression.evaluate(new Yr(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class ra{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){return!!e.expression.evaluate(t,null,{},n,r)}interpolate(){return!1}}class aa{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 r=this.defaultPropertyValues[t]=new Xr(n,void 0),a=this.defaultTransitionablePropertyValues[t]=new Hr(n);this.defaultTransitioningPropertyValues[t]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}_r("DataDrivenProperty",ea),_r("DataConstantProperty",Qr),_r("CrossFadedDataDrivenProperty",ta),_r("CrossFadedProperty",na),_r("ColorRampProperty",ra);const ia="-transition";class oa 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 Kr(t.layout)),t.paint)){this._transitionablePaint=new Vr(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 Zr(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(br,`layers.${this.id}.layout.${e}`,e,t,n)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}getPaintProperty(e){return e.endsWith(ia)?this._transitionablePaint.getTransition(e.slice(0,-ia.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(null!=t&&this._validate(mr,`layers.${this.id}.paint.${e}`,e,t,n))return!1;if(e.endsWith(ia))return this._transitionablePaint.setTransition(e.slice(0,-ia.length),t||void 0),!1;{const n=this._transitionablePaint._values[e],r="cross-faded-data-driven"===n.property.specification["property-type"],a=n.value.isDataDriven(),i=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);const o=this._transitionablePaint._values[e].value;return o.isDataDriven()||a||r||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,r,a={}){return(!a||!1!==a.validate)&&hr(this,e.call(dr,{key:t,layerType:this.type,objectKey:n,value:r,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 Jr&&hn(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}}const sa={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class la{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 ca{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 ua(e,t=1){let n=0,r=0;return{members:e.map(e=>{const a=sa[e.type].BYTES_PER_ELEMENT,i=n=da(n,Math.max(t,a)),o=e.components||1;return r=Math.max(r,a),n+=a*o,{name:e.name,type:e.type,components:o,offset:i}}),size:da(n,Math.max(r,t)),alignment:t}}function da(e,t){return Math.ceil(e/t)*t}class pa extends ca{_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 r=2*e;return this.int16[r+0]=t,this.int16[r+1]=n,e}}pa.prototype.bytesPerElement=4,_r("StructArrayLayout2i4",pa);class ma extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r)}emplace(e,t,n,r,a){const i=4*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=r,this.int16[i+3]=a,e}}ma.prototype.bytesPerElement=8,_r("StructArrayLayout4i8",ma);class ba extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,a,i)}emplace(e,t,n,r,a,i,o){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=a,this.int16[s+4]=i,this.int16[s+5]=o,e}}ba.prototype.bytesPerElement=12,_r("StructArrayLayout2i4i12",ba);class ha extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,a,i)}emplace(e,t,n,r,a,i,o){const s=4*e,l=8*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.uint8[l+4]=r,this.uint8[l+5]=a,this.uint8[l+6]=i,this.uint8[l+7]=o,e}}ha.prototype.bytesPerElement=8,_r("StructArrayLayout2i4ub8",ha);class fa extends ca{_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 r=2*e;return this.float32[r+0]=t,this.float32[r+1]=n,e}}fa.prototype.bytesPerElement=8,_r("StructArrayLayout2f8",fa);class ga extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a,i,o,s,l,c){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,n,r,a,i,o,s,l,c)}emplace(e,t,n,r,a,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]=r,this.uint16[d+3]=a,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}}ga.prototype.bytesPerElement=20,_r("StructArrayLayout10ui20",ga);class _a extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a,i,o,s,l,c,u,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,r,a,i,o,s,l,c,u,d)}emplace(e,t,n,r,a,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]=r,this.int16[m+3]=a,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}}_a.prototype.bytesPerElement=24,_r("StructArrayLayout4i4ui4i24",_a);class ya extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){const a=3*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=r,e}}ya.prototype.bytesPerElement=12,_r("StructArrayLayout3f12",ya);class Ma extends ca{_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}}Ma.prototype.bytesPerElement=4,_r("StructArrayLayout1ul4",Ma);class va extends ca{_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,r,a,i,o,s,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,r,a,i,o,s,l)}emplace(e,t,n,r,a,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]=r,this.int16[u+3]=a,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}}va.prototype.bytesPerElement=20,_r("StructArrayLayout6i1ul2ui20",va);class za extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,a,i)}emplace(e,t,n,r,a,i,o){const s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=a,this.int16[s+4]=i,this.int16[s+5]=o,e}}za.prototype.bytesPerElement=12,_r("StructArrayLayout2i2i2i12",za);class Oa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,a){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r,a)}emplace(e,t,n,r,a,i){const o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=r,this.int16[s+6]=a,this.int16[s+7]=i,e}}Oa.prototype.bytesPerElement=16,_r("StructArrayLayout2f1f2i16",Oa);class ka extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r)}emplace(e,t,n,r,a){const i=12*e,o=3*e;return this.uint8[i+0]=t,this.uint8[i+1]=n,this.float32[o+1]=r,this.float32[o+2]=a,e}}ka.prototype.bytesPerElement=12,_r("StructArrayLayout2ub2f12",ka);class Aa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){const a=3*e;return this.uint16[a+0]=t,this.uint16[a+1]=n,this.uint16[a+2]=r,e}}Aa.prototype.bytesPerElement=6,_r("StructArrayLayout3ui6",Aa);class xa extends ca{_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,r,a,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,r,a,i,o,s,l,c,u,d,p,m,b,h,f)}emplace(e,t,n,r,a,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]=r,this.uint16[_+3]=a,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}}xa.prototype.bytesPerElement=48,_r("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xa);class wa extends ca{_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,r,a,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,r,a,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,r,a,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]=r,this.int16[q+3]=a,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}}wa.prototype.bytesPerElement=68,_r("StructArrayLayout8i15ui1ul4f68",wa);class Na extends ca{_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}}Na.prototype.bytesPerElement=4,_r("StructArrayLayout1f4",Na);class qa extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){const a=3*e;return this.int16[a+0]=t,this.int16[a+1]=n,this.int16[a+2]=r,e}}qa.prototype.bytesPerElement=6,_r("StructArrayLayout3i6",qa);class Ea extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){const a=4*e;return this.uint32[2*e+0]=t,this.uint16[a+2]=n,this.uint16[a+3]=r,e}}Ea.prototype.bytesPerElement=8,_r("StructArrayLayout1ul2ui8",Ea);class ja extends ca{_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 r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=n,e}}ja.prototype.bytesPerElement=4,_r("StructArrayLayout2ui4",ja);class Wa extends ca{_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}}Wa.prototype.bytesPerElement=2,_r("StructArrayLayout1ui2",Wa);class La extends ca{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r)}emplace(e,t,n,r,a){const i=4*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,this.float32[i+3]=a,e}}La.prototype.bytesPerElement=16,_r("StructArrayLayout4f16",La);class Sa extends la{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)}}Sa.prototype.size=20;class Ta extends va{get(e){return new Sa(this,e)}}_r("CollisionBoxArray",Ta);class Ca extends la{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]}}Ca.prototype.size=48;class Ra extends xa{get(e){return new Ca(this,e)}}_r("PlacedSymbolArray",Ra);class Da extends la{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]}}Da.prototype.size=68;class Pa extends wa{get(e){return new Da(this,e)}}_r("SymbolInstanceArray",Pa);class Ba extends Na{getoffsetX(e){return this.float32[1*e+0]}}_r("GlyphOffsetArray",Ba);class Ia extends qa{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}_r("SymbolLineVertexArray",Ia);class $a extends la{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]}}$a.prototype.size=8;class Fa extends Ea{get(e){return new $a(this,e)}}_r("FeatureIndexArray",Fa);class Ya extends pa{}class Xa extends pa{}class Ha extends pa{}class Va extends ba{}class Ua extends ha{}class Ga extends fa{}class Ka extends ga{}class Ja extends _a{}class Za extends ya{}class Qa extends Ma{}class ei extends za{}class ti extends ka{}class ni extends Aa{}class ri extends ja{}const ai=ua([{name:"a_pos",components:2,type:"Int16"}],4),{members:ii}=ai;class oi{constructor(e=[]){this.segments=e}prepareSegment(e,t,n,r){let a=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}`),(!a||a.vertexLength+e>oi.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==r)&&(a={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==r&&(a.sortKey=r),this.segments.push(a)),a}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,r){return new oi([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:r,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,_r("SegmentVector",oi);const li=ua([{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,r,a,i,o,s,l,c;for(r=e.length-(n=3&e.length),a=t,o=3432918353,s=461845907,c=0;c<r;)l=255&e.charCodeAt(c)|(255&e.charCodeAt(++c))<<8|(255&e.charCodeAt(++c))<<16|(255&e.charCodeAt(++c))<<24,++c,a=27492+(65535&(i=5*(65535&(a=(a^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>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:a^=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 a^=e.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0};var di={exports:{}};di.exports=function(e,t){for(var n,r=e.length,a=t^r,i=0;r>=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),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++i;switch(r){case 3:a^=(255&e.charCodeAt(i+2))<<16;case 2:a^=(255&e.charCodeAt(i+1))<<8;case 1:a=1540483477*(65535&(a^=255&e.charCodeAt(i)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>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,r){this.ids.push(hi(e)),this.positions.push(t,n,r)}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,r=this.ids.length-1;for(;n<r;){const e=n+r>>1;this.ids[e]>=t?r=e:n=e+1}const a=[];for(;this.ids[n]===t;)a.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return a}static serialize(e,t){const n=new Float64Array(e.ids),r=new Uint32Array(e.positions);return function e(t,n,r,a){for(;r<a;){const i=t[r+a>>1];let o=r-1,s=a+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-r<a-s?(e(t,n,r,s),r=s+1):(e(t,n,s+1,a),a=s)}}(n,r,0,n.length-1),t&&t.push(n.buffer,r.buffer),{ids:n,positions:r}}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 r=e[t];e[t]=e[n],e[n]=r}_r("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,r){const a="u_pattern_to"===r?this.patternTo:"u_pattern_from"===r?this.patternFrom:"u_pixel_ratio_to"===r?this.pixelRatioTo:"u_pixel_ratio_from"===r?this.pixelRatioFrom:null;a&&e.set(a)}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,r){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 r}populatePaintArray(e,t,n,r,a){const i=this.paintVertexArray.length,o=this.expression.evaluate(new Yr(0),t,{},r,[],a);this.paintVertexArray.resize(e),this._setPaintValue(i,e,o)}updatePaintArray(e,t,n,r){const a=this.expression.evaluate({zoom:0},n,r);this._setPaintValue(e,t,a)}_setPaintValue(e,t,n){if("color"===this.type){const r=zi(n);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,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,r,a,i){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=n,this.useIntegerZoom=r,this.zoom=a,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,r,a){const i=this.expression.evaluate(new Yr(this.zoom),t,{},r,[],a),o=this.expression.evaluate(new Yr(this.zoom+1),t,{},r,[],a),s=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(s,e,i,o)}updatePaintArray(e,t,n,r){const a=this.expression.evaluate({zoom:this.zoom},n,r),i=this.expression.evaluate({zoom:this.zoom+1},n,r);this._setPaintValue(e,t,a,i)}_setPaintValue(e,t,n,r){if("color"===this.type){const a=zi(n),i=zi(r);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,a[0],a[1],i[0],i[1])}else{for(let a=e;a<t;a++)this.paintVertexArray.emplace(a,n,r);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){const n=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=i(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,n){return new _i(e,t)}}class wi{constructor(e,t,n,r,a,i){this.expression=e,this.type=t,this.useIntegerZoom=n,this.zoom=r,this.layerId=i,this.zoomInPaintVertexArray=new a,this.zoomOutPaintVertexArray=new a}populatePaintArray(e,t,n){const r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,t.patterns&&t.patterns[this.layerId],n)}updatePaintArray(e,t,n,r,a){this._setPaintValues(e,t,n.patterns&&n.patterns[this.layerId],a)}_setPaintValues(e,t,n,r){if(!r||!n)return;const{min:a,mid:i,max:o}=n,s=r[a],l=r[i],c=r[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 r=[];for(const a in e.paint._values){if(!n(a))continue;const i=e.paint.get(a);if(!(i instanceof Jr&&hn(i.property.specification)))continue;const o=Ei(a,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[a]=d?new ki(s.value,o):new Oi(s.value,o,l),r.push("/u_"+a);else if("source"===s.kind||d){const n=ji(a,l,"source");this.binders[a]=d?new wi(s,l,c,t,n,e.id):new Ai(s,o,l,n),r.push("/a_"+a)}else{const e=ji(a,l,"composite");this.binders[a]=new xi(s,o,l,c,t,e),r.push("/z_"+a)}}this.cacheKey=r.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof Ai||t instanceof xi?t.maxValue:0}populatePaintArrays(e,t,n,r,a){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,r,a)}}setConstantPatternPositions(e,t){for(const n in this.binders){const r=this.binders[n];r instanceof ki&&r.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,n,r,a){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=r.paint.get(n);l.expression=c.value,l.updatePaintArray(t.start,t.end,s,e[o],a),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 r in this.binders){const a=this.binders[r];if(a instanceof Oi||a instanceof ki||a instanceof xi)for(const i of a.uniformNames)if(t[i]){const o=a.getBinding(e,t[i],i);n.push({name:i,property:r,binding:o})}}return n}setUniforms(e,t,n,r){for(const{name:e,property:a,binding:i}of t)this.binders[a].setUniform(i,r,n.get(a),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 r of e)this.programConfigurations[r.id]=new Ni(r,t,n);this.needsUpload=!1,this._featureMap=new bi,this._bufferOffset=0}populatePaintArrays(e,t,n,r,a,i){for(const n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,r,a,i);void 0!==t.id&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,r){for(const a of n)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(e,this._featureMap,t,a,r)||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 r={color:{source:fa,composite:La},number:{source:Na,composite:fa}},a=function(e){return{"line-pattern":{source:Ka,composite:Ka},"fill-pattern":{source:Ka,composite:Ka},"fill-extrusion-pattern":{source:Ka,composite:Ka}}[e]}(e);return a&&a[n]||r[t][n]}_r("ConstantBinder",Oi),_r("CrossFadedConstantBinder",ki),_r("SourceExpressionBinder",Ai),_r("CrossFadedCompositeBinder",wi),_r("CompositeExpressionBinder",xi),_r("ProgramConfiguration",Ni,{omit:["_buffers"]}),_r("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 r=n[e];for(let e=0;e<r.length;e++){const n=r[e],a=Math.round(n.x*t),o=Math.round(n.y*t);n.x=i(a,Si,Li),n.y=i(o,Si,Li),(a<n.x||a>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,r,a){e.emplaceBack(2*t+(r+1)/2,2*n+(a+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 Xa,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 r=this.layers[0],a=[];let i=null,o=!1;"circle"===r.type&&(i=r.layout.get("circle-sort-key"),o=!i.isConstant());for(const{feature:t,id:r,index:s,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Ci(t,e);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),c,n))continue;const u=o?i.evaluate(c,{},n):void 0,d={id:r,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:e?c.geometry:Ti(t),patterns:{},sortKey:u};a.push(d)}o&&a.sort((e,t)=>e.sortKey-t.sortKey);for(const r of a){const{geometry:a,index:i,sourceLayerIndex:o}=r,s=e[i].feature;this.addFeature(r,a,i,n),t.featureIndex.insert(s,a,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,r){for(const n of t)for(const t of n){const n=t.x,r=t.y;if(n<0||n>=Wi||r<0||r>=Wi)continue;const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),i=a.vertexLength;Ri(this.layoutVertexArray,n,r,-1,-1),Ri(this.layoutVertexArray,n,r,1,-1),Ri(this.layoutVertexArray,n,r,1,1),Ri(this.layoutVertexArray,n,r,-1,1),this.indexArray.emplaceBack(i,i+1,i+2),this.indexArray.emplaceBack(i,i+3,i+2),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},r)}}function Pi(e,t){for(let n=0;n<e.length;n++)if(Ui(t,e[n]))return!0;for(let n=0;n<t.length;n++)if(Ui(e,t[n]))return!0;return!!Fi(e,t)}function Bi(e,t,n){return!!Ui(e,t)||!!Xi(t,e,n)}function Ii(e,t){if(1===e.length)return Vi(t,e[0]);for(let n=0;n<t.length;n++){const r=t[n];for(let t=0;t<r.length;t++)if(Ui(e,r[t]))return!0}for(let n=0;n<e.length;n++)if(Vi(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 r=0;r<t.length;r++)if(Xi(t[r],e,n))return!0}for(let r=0;r<e.length;r++)if(Xi(e[r],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 r=e[n],a=e[n+1];for(let e=0;e<t.length-1;e++)if(Yi(r,a,t[e],t[e+1]))return!0}return!1}function Yi(e,t,n,r){return h(e,n,r)!==h(t,n,r)&&h(e,t,n)!==h(e,t,r)}function Xi(e,t,n){const r=n*n;if(1===t.length)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++)if(Hi(e,t[n-1],t[n])<r)return!0;return!1}function Hi(e,t,n){const r=t.distSqr(n);if(0===r)return e.distSqr(t);const a=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/r;return e.distSqr(a<0?t:a>1?n:n.sub(t)._mult(a)._add(t))}function Vi(e,t){let n,r,a,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++)r=n[e],a=n[o],r.y>t.y!=a.y>t.y&&t.x<(a.x-r.x)*(t.y-r.y)/(a.y-r.y)+r.x&&(i=!i)}return i}function Ui(e,t){let n=!1;for(let r=0,a=e.length-1;r<e.length;a=r++){const i=e[r],o=e[a];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(n=!n)}return n}function Gi(e,t,n){const r=n[0],a=n[2];if(e.x<r.x&&t.x<r.x||e.x>a.x&&t.x>a.x||e.y<r.y&&t.y<r.y||e.y>a.y&&t.y>a.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 r=t.paint.get(e).value;return"constant"===r.kind?r.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,r,a){if(!t[0]&&!t[1])return e;const i=A.convert(t)._mult(a);"viewport"===n&&i._rotate(-r);const o=[];for(let t=0;t<e.length;t++)o.push(e[t].sub(i));return o}_r("CircleBucket",Di,{omit:["layers"]});const Qi=new aa({"circle-sort-key":new ea(ne.layout_circle["circle-sort-key"])});var eo={paint:new aa({"circle-radius":new ea(ne.paint_circle["circle-radius"]),"circle-color":new ea(ne.paint_circle["circle-color"]),"circle-blur":new ea(ne.paint_circle["circle-blur"]),"circle-opacity":new ea(ne.paint_circle["circle-opacity"]),"circle-translate":new Qr(ne.paint_circle["circle-translate"]),"circle-translate-anchor":new Qr(ne.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Qr(ne.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Qr(ne.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ea(ne.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ea(ne.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ea(ne.paint_circle["circle-stroke-opacity"])}),layout:Qi},to=1e-6,no="undefined"!=typeof Float32Array?Float32Array:Array;function ro(){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 ao(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 r=t[0],a=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*r+M*s+v*d+z*h,e[1]=y*a+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])*r+(M=n[5])*s+(v=n[6])*d+(z=n[7])*h,e[5]=y*a+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])*r+(M=n[9])*s+(v=n[10])*d+(z=n[11])*h,e[9]=y*a+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])*r+(M=n[13])*s+(v=n[14])*d+(z=n[15])*h,e[13]=y*a+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 r=new no(3);return r[0]=e,r[1]=t,r[2]=n,r}function uo(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3];return e[0]=n[0]*r+n[4]*a+n[8]*i+n[12]*o,e[1]=n[1]*r+n[5]*a+n[9]*i+n[13]*o,e[2]=n[2]*r+n[6]*a+n[10]*i+n[14]*o,e[3]=n[3]*r+n[7]*a+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(),ro(),function(){var e;e=new no(2),no!=Float32Array&&(e[0]=0,e[1]=0)}();class bo extends Di{}_r("HeatmapBucket",bo,{omit:["layers"]});var ho={paint:new aa({"heatmap-radius":new ea(ne.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ea(ne.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Qr(ne.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ra(ne.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Qr(ne.paint_heatmap["heatmap-opacity"])})};function fo(e,{width:t,height:n},r,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t*n*r)throw new RangeError(`mismatched image size. expected: ${a.length} but got: ${t*n*r}`)}else a=new Uint8Array(t*n*r);return e.width=t,e.height=n,e.data=a,e}function go(e,{width:t,height:n},r){if(t===e.width&&n===e.height)return;const a=fo({},{width:t,height:n},r);_o(e,a,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,n)},r),e.width=t,e.height=n,e.data=a.data}function _o(e,t,n,r,a,i){if(0===a.width||0===a.height)return t;if(a.width>e.width||a.height>e.height||n.x>e.width-a.width||n.y>e.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||r.x>t.width-a.width||r.y>t.height-a.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<a.height;l++){const c=((n.y+l)*e.width+n.x)*i,u=((r.y+l)*t.width+r.x)*i;for(let e=0;e<a.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,r,a){_o(e,t,n,r,a,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,r,a){_o(e,t,n,r,a,4)}}function vo(e){const t={},n=e.resolution||256,r=e.clips?e.clips.length:1,a=e.image||new Mo({width:n,height:r});if(Math.log(n)/Math.LN2%1!=0)throw new Error("width is not a power of 2 - "+n);const i=(n,r,i)=>{t[e.evaluationKey]=i;const o=e.expression.evaluate(t);a.data[n+r+0]=Math.floor(255*o.r/o.a),a.data[n+r+1]=Math.floor(255*o.g/o.a),a.data[n+r+2]=Math.floor(255*o.b/o.a),a.data[n+r+3]=Math.floor(255*o.a)};if(e.clips)for(let t=0,a=0;t<r;++t,a+=4*n)for(let r=0,o=0;r<n;r++,o+=4){const s=r/(n-1),{start:l,end:c}=e.clips[t];i(a,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 a}_r("AlphaImage",yo),_r("RGBAImage",Mo);var zo={paint:new aa({"hillshade-illumination-direction":new Qr(ne.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Qr(ne.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Qr(ne.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Qr(ne.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Qr(ne.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Qr(ne.paint_hillshade["hillshade-accent-color"])})};const Oo=ua([{name:"a_pos",components:2,type:"Int16"}],4),{members:ko}=Oo;var Ao={exports:{}};function xo(e,t,n){n=n||2;var r,a,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,r){var a,i,o,s=[];for(a=0,i=t.length;a<i;a++)(o=wo(e,t[a]*r,a<i-1?t[a+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(Do(o));for(s.sort(So),a=0;a<s.length;a++)n=To(s[a],n);return n}(e,t,p,n)),e.length>80*n){r=i=e[0],a=o=e[1];for(var b=n;b<d;b+=n)(s=e[b])<r&&(r=s),(l=e[b+1])<a&&(a=l),s>i&&(i=s),l>o&&(o=l);c=0!==(c=Math.max(i-r,o-a))?32767/c:0}return qo(p,m,n,r,a,c,0),m}function wo(e,t,n,r,a){var i,o;if(a===Jo(e,t,n,r)>0)for(i=t;i<n;i+=r)o=Uo(i,e[i],e[i+1],o);else for(i=n-r;i>=t;i-=r)o=Uo(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,r=e;do{if(n=!1,r.steiner||!$o(r,r.next)&&0!==Io(r.prev,r,r.next))r=r.next;else{if(Go(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function qo(e,t,n,r,a,i,o){if(e){!o&&i&&function(e,t,n,r){var a=e;do{0===a.z&&(a.z=Ro(a.x,a.y,t,n,r)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==e);a.prevZ.nextZ=null,a.prevZ=null,function(e){var t,n,r,a,i,o,s,l,c=1;do{for(n=e,e=null,i=null,o=0;n;){for(o++,r=n,s=0,t=0;t<c&&(s++,r=r.nextZ);t++);for(l=c;s>0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(a=n,n=n.nextZ,s--):(a=r,r=r.nextZ,l--),i?i.nextZ=a:e=a,a.prevZ=i,i=a;n=r}i.nextZ=null,c*=2}while(o>1)}(a)}(e,r,a,i);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,i?jo(e,r,a,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,r,a,i,2):2===o&&Lo(e,t,n,r,a,i):qo(No(e),t,n,r,a,i,1);break}}}function Eo(e){var t=e.prev,n=e,r=e.next;if(Io(t,n,r)>=0)return!1;for(var a=t.x,i=n.x,o=r.x,s=t.y,l=n.y,c=r.y,u=a<i?a<o?a:o:i<o?i:o,d=s<l?s<c?s:c:l<c?l:c,p=a>i?a>o?a:o:i>o?i:o,m=s>l?s>c?s:c:l>c?l:c,b=r.next;b!==t;){if(b.x>=u&&b.x<=p&&b.y>=d&&b.y<=m&&Po(a,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,r){var a=e.prev,i=e,o=e.next;if(Io(a,i,o)>=0)return!1;for(var s=a.x,l=i.x,c=o.x,u=a.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,r),_=Ro(h,f,t,n,r),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!==a&&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!==a&&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!==a&&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!==a&&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 r=e;do{var a=r.prev,i=r.next.next;!$o(a,i)&&Fo(a,r,r.next,i)&&Ho(a,i)&&Ho(i,a)&&(t.push(a.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),Go(r),Go(r.next),r=e=i),r=r.next}while(r!==e);return No(r)}function Lo(e,t,n,r,a,i){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Bo(o,s)){var l=Vo(o,s);return o=No(o,o.next),l=No(l,l.next),qo(o,t,n,r,a,i,0),void qo(l,t,n,r,a,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,r=t,a=e.x,i=e.y,o=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=a&&s>o&&(o=s,n=r.x<r.next.x?r:r.next,s===a))return n}r=r.next}while(r!==t);if(!n)return null;var l,c=n,u=n.x,d=n.y,p=1/0;r=n;do{a>=r.x&&r.x>=u&&a!==r.x&&Po(i<d?a:o,i,u,d,i<d?o:a,i,r.x,r.y)&&(l=Math.abs(i-r.y)/(a-r.x),Ho(r,e)&&(l<p||l===p&&(r.x>n.x||r.x===n.x&&Co(n,r)))&&(n=r,p=l)),r=r.next}while(r!==c);return n}(e,t);if(!n)return t;var r=Vo(n,e);return No(r,r.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,r,a){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*a|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,r,a,i,o,s){return(a-o)*(t-s)>=(e-o)*(i-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(i-s)>=(a-o)*(r-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,r=!1,a=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&a<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(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,r){var a=Xo(Io(e,t,n)),i=Xo(Io(e,t,r)),o=Xo(Io(n,r,e)),s=Xo(Io(n,r,t));return a!==i&&o!==s||!(0!==a||!Yo(e,n,t))||!(0!==i||!Yo(e,r,t))||!(0!==o||!Yo(n,e,r))||!(0!==s||!Yo(n,t,r))}function Yo(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 Xo(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 Vo(e,t){var n=new Ko(e.i,e.x,e.y),r=new Ko(t.i,t.x,t.y),a=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=a,a.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function Uo(e,t,n,r){var a=new Ko(e,t,n);return r?(a.next=r.next,a.prev=r,r.next.prev=a,r.next=a):(a.prev=a,a.next=a),a}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,r){for(var a=0,i=t,o=n-r;i<n;i+=r)a+=(e[o]-e[i])*(e[i+1]+e[o+1]),o=i;return a}function Zo(e,t,n,r,a){!function e(t,n,r,a,i){for(;a>r;){if(a-r>600){var o=a-r+1,s=n-r+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(r,Math.floor(n-s*c/o+u)),Math.min(a,Math.floor(n+(o-s)*c/o+u)),i)}var d=t[n],p=r,m=a;for(Qo(t,r,n),i(t[a],d)>0&&Qo(t,r,a);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[r],d)?Qo(t,r,m):Qo(t,++m,a),m<=n&&(r=m+1),n<=m&&(a=m-1)}}(e,t,n||0,r||e.length-1,a||es)}function Qo(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}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 r=[];let a,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?(a&&r.push(a),a=[e[t]]):a.push(e[t]))}if(a&&r.push(a),t>1)for(let e=0;e<r.length;e++)r[e].length<=t||(Zo(r[e],t,1,r[e].length-1,ns),r[e]=r[e].slice(0,t));return r}function ns(e,t){return t.area-e.area}function rs(e,t,n){const r=n.patternDependencies;let a=!1;for(const n of t){const t=n.paint.get(e+"-pattern");t.isConstant()||(a=!0);const i=t.constantOr(null);i&&(a=!0,r[i.to]=!0,r[i.from]=!0)}return a}function as(e,t,n,r,a){const i=a.patternDependencies;for(const o of t){const t=o.paint.get(e+"-pattern").value;if("constant"!==t.kind){let e=t.evaluate({zoom:r-1},n,{},a.availableImages),s=t.evaluate({zoom:r},n,{},a.availableImages),l=t.evaluate({zoom:r+1},n,{},a.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,r){var a=t&&t.length,i=Math.abs(Jo(e,0,a?t[0]*n:e.length,n));if(a)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<r.length;o+=3){var c=r[o]*n,u=r[o+1]*n,d=r[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},r=0,a=0;a<e.length;a++){for(var i=0;i<e[a].length;i++)for(var o=0;o<t;o++)n.vertices.push(e[a][i][o]);a>0&&n.holes.push(r+=e[a-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 Ha,this.indexArray=new ni,this.indexArray2=new ri,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=rs("fill",this.layers,t);const r=this.layers[0].layout.get("fill-sort-key"),a=!r.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 Yr(this.zoom),u,n))continue;const d=a?r.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)}a&&i.sort((e,t)=>e.sortKey-t.sortKey);for(const r of i){const{geometry:a,index:i,sourceLayerIndex:o}=r;if(this.hasPattern){const e=as("fill",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,a,i,n,{});t.featureIndex.insert(e[i].feature,a,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,r,a){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),r=n.vertexLength,a=[],i=[];for(const t of e){if(0===t.length)continue;t!==e[0]&&i.push(a.length/2);const n=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),r=n.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(r+t.length-1,r),a.push(t[0].x),a.push(t[0].y);for(let e=1;e<t.length;e++)this.layoutVertexArray.emplaceBack(t[e].x,t[e].y),this.indexArray2.emplaceBack(r+e-1,r+e),a.push(t[e].x),a.push(t[e].y);n.vertexLength+=t.length,n.primitiveLength+=t.length}const o=Ao.exports(a,i);for(let e=0;e<o.length;e+=3)this.indexArray.emplaceBack(r+o[e],r+o[e+1],r+o[e+2]);n.vertexLength+=t,n.primitiveLength+=o.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,a,r)}}_r("FillBucket",is,{omit:["layers","patternFeatures"]});const os=new aa({"fill-sort-key":new ea(ne.layout_fill["fill-sort-key"])});var ss={paint:new aa({"fill-antialias":new Qr(ne.paint_fill["fill-antialias"]),"fill-opacity":new ea(ne.paint_fill["fill-opacity"]),"fill-color":new ea(ne.paint_fill["fill-color"]),"fill-outline-color":new ea(ne.paint_fill["fill-outline-color"]),"fill-translate":new Qr(ne.paint_fill["fill-translate"]),"fill-translate-anchor":new Qr(ne.paint_fill["fill-translate-anchor"]),"fill-pattern":new ta(ne.paint_fill["fill-pattern"])}),layout:os};const ls=ua([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),cs=ua([{name:"a_centroid",components:2,type:"Int16"}],4),{members:us}=ls;var ds={},ps=A,ms=bs;function bs(e,t,n,r,a){this.properties={},this.extent=n,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=a,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 r=t._keys[e.readVarint()],a=t._values[e.readVarint()];t.properties[r]=a}}(n,t):3==e?t.type=n.readVarint():4==e&&(t._geometry=n.pos)}function fs(e){for(var t,n,r=0,a=0,i=e.length,o=i-1;a<i;o=a++)r+=((n=e[o]).x-(t=e[a]).x)*(t.y+n.y);return r}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,r=1,a=0,i=0,o=0,s=[];e.pos<n;){if(a<=0){var l=e.readVarint();r=7&l,a=l>>3}if(a--,1===r||2===r)i+=e.readSVarint(),o+=e.readSVarint(),1===r&&(t&&s.push(t),t=[]),t.push(new ps(i,o));else{if(7!==r)throw new Error("unknown command "+r);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,r=0,a=0,i=0,o=1/0,s=-1/0,l=1/0,c=-1/0;e.pos<t;){if(r<=0){var u=e.readVarint();n=7&u,r=u>>3}if(r--,1===n||2===n)(a+=e.readSVarint())<o&&(o=a),a>s&&(s=a),(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 r,a,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(r=0;r<l.length;r++)d[r]=l[r][0];u(l=d);break;case 2:for(r=0;r<l.length;r++)u(l[r]);break;case 3:for(l=function(e){var t=e.length;if(t<=1)return[e];for(var n,r,a=[],i=0;i<t;i++){var o=fs(e[i]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(n&&a.push(n),n=[e[i]]):n.push(e[i]))}return n&&a.push(n),a}(l),r=0;r<l.length;r++)for(a=0;a<l[r].length;a++)u(l[r][a])}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 r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}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 r=new vs(n,n.readVarint()+n.pos);r.length&&(t[r.name]=r)}}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,r,a,i,o,s){e.emplaceBack(t,n,2*Math.floor(r*ks)+o,a*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 Va,this.centroidVertexArray=new Ya,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=rs("fill-extrusion",this.layers,t);for(const{feature:r,id:a,index:i,sourceLayerIndex:o}of e){const e=this.layers[0]._featureFilter.needGeometry,s=Ci(r,e);if(!this.layers[0]._featureFilter.filter(new Yr(this.zoom),s,n))continue;const l={id:a,sourceLayerIndex:o,index:i,geometry:e?s.geometry:Ti(r),properties:r.properties,type:r.type,patterns:{}};this.hasPattern?this.features.push(as("fill-extrusion",this.layers,l,this.zoom,t)):this.addFeature(l,l.geometry,i,n,{}),t.featureIndex.insert(r,l.geometry,i,o,this.index,!0)}}addFeatures(e,t,n){for(const e of this.features){const{geometry:r}=e;this.addFeature(e,r,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,r,a){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 r=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 a=e[n];if(n>=1){const o=e[n-1];if(!ws(a,o)){r.vertexLength+4>oi.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const e=a.sub(o)._perp()._unit(),n=o.dist(a);t+n>32768&&(t=0),As(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,0,t),As(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,1,t),i.x+=2*a.x,i.y+=2*a.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=r.vertexLength;this.indexArray.emplaceBack(s,s+2,s+1),this.indexArray.emplaceBack(s+1,s+2,s+3),r.vertexLength+=4,r.primitiveLength+=2}}}}if(r.vertexLength+t>oi.MAX_VERTEX_ARRAY_LENGTH&&(r=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray)),"Polygon"!==Os[e.type])continue;const a=[],o=[],s=r.vertexLength;for(const e of n)if(0!==e.length){e!==n[0]&&o.push(a.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,a.push(n.x),a.push(n.y)}}const l=Ao.exports(a,o);for(let e=0;e<l.length;e+=3)this.indexArray.emplaceBack(s+l[e],s+l[e+2],s+l[e+1]);r.primitiveLength+=l.length/3,r.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,a,r)}}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)}_r("FillExtrusionBucket",xs,{omit:["layers","features"]});var qs={paint:new aa({"fill-extrusion-opacity":new Qr(ne["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ea(ne["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Qr(ne["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Qr(ne["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ta(ne["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ea(ne["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ea(ne["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Qr(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 r=t[n++];let a;for(;!a||r.equals(a);)if(a=t[n++],!a)return 1/0;for(;n<t.length;n++){const i=t[n],o=e[0],s=a.sub(r),l=i.sub(r),c=o.sub(r),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,_=r.z*(1-f-g)+a.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=ua([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Ls}=Ws,Ss=ua([{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 Ua,this.layoutVertexArray2=new Ga,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=rs("line",this.layers,t);const r=this.layers[0].layout.get("line-sort-key"),a=!r.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 Yr(this.zoom),c,n))continue;const u=a?r.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)}a&&i.sort((e,t)=>e.sortKey-t.sortKey);for(const r of i){const{geometry:a,index:i,sourceLayerIndex:o}=r;if(this.hasPattern){const e=as("line",this.layers,r,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(r,a,i,n,{});t.featureIndex.insert(e[i].feature,a,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,r,a){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,a,r)}addLine(e,t,n,r,a,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&&(a=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":r;if(O&&"round"===k&&(y<i?k="miter":y<=2&&(k="fakeround")),"miter"===k&&y>a&&(k="bevel"),"bevel"===k&&(y>2&&(k="flipbevel"),y<a&&(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 r=h.sub(b)._mult(n)._add(b)._unit()._mult(z?-1:1);this.addHalfVertex(d,r.x,r.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,r,a,i=!1){const o=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,i,!1,n,a),this.addHalfVertex(e,o,s,i,!0,-r,a),this.distance>Ds/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(e,t,n,r,a,i))}addHalfVertex({x:e,y:t},n,r,a,i,o,s){const l=.5*(this.lineClips?this.scaledDistance*(Ds-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(a?1:0),(t<<1)+(i?1:0),Math.round(63*n)+128,Math.round(63*r)+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()}}_r("LineBucket",Ps,{omit:["layers","patternFeatures"]});const Bs=new aa({"line-cap":new Qr(ne.layout_line["line-cap"]),"line-join":new ea(ne.layout_line["line-join"]),"line-miter-limit":new Qr(ne.layout_line["line-miter-limit"]),"line-round-limit":new Qr(ne.layout_line["line-round-limit"]),"line-sort-key":new ea(ne.layout_line["line-sort-key"])});var Is={paint:new aa({"line-opacity":new ea(ne.paint_line["line-opacity"]),"line-color":new ea(ne.paint_line["line-color"]),"line-translate":new Qr(ne.paint_line["line-translate"]),"line-translate-anchor":new Qr(ne.paint_line["line-translate-anchor"]),"line-width":new ea(ne.paint_line["line-width"]),"line-gap-width":new ea(ne.paint_line["line-gap-width"]),"line-offset":new ea(ne.paint_line["line-offset"]),"line-blur":new ea(ne.paint_line["line-blur"]),"line-dasharray":new na(ne.paint_line["line-dasharray"]),"line-pattern":new ta(ne.paint_line["line-pattern"]),"line-gradient":new ra(ne.paint_line["line-gradient"])}),layout:Bs};const $s=new class extends ea{possiblyEvaluate(e,t){return t=new Yr(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,r){return t=s({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,r)}}(Is.paint.properties["line-width"].specification);function Fs(e,t){return t>0?t+2*e:e}$s.useIntegerZoom=!0;const Ys=ua([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xs=ua([{name:"a_projected_pos",components:3,type:"Float32"}],4);ua([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Hs=ua([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ua([{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 Vs=ua([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Us=ua([{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 r=t.layout.get("text-transform").evaluate(n,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),Fr.applyArabicShaping&&(e=Fr.applyArabicShaping(e)),e}(e.text,t,n)}),e}ua([{name:"triangle",components:3,type:"Uint16"}]),ua([{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"}]),ua([{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"}]),ua([{type:"Float32",name:"offsetX"}]),ua([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Ks={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Js=el,Zs=function(e,t,n,r,a){var i,o,s=8*a-r-1,l=(1<<s)-1,c=l>>1,u=-7,d=n?a-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+=r;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,r),i-=c}return(m?-1:1)*o*Math.pow(2,i-r)},Qs=function(e,t,n,r,a,i){var o,s,l,c=8*i-a-1,u=(1<<c)-1,d=u>>1,p=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,m=r?0:i-1,b=r?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,a),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,a),o=0));a>=8;e[n+m]=255&s,m+=b,s/=256,a-=8);for(o=o<<a|s,c+=a;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,rl=1/nl,al="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 r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(r);for(var a=n.pos-1;a>=e;a--)n.buf[a+r]=n.buf[a]}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:r,width:a,height:i,left:o,top:s,advance:l}=n.readMessage(zl,{});t.push({id:e,bitmap:new yo({width:a+6,height:i+6},r),metrics:{width:a,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 r of e)t+=r.w*r.h,n=Math.max(n,r.w);e.sort((e,t)=>t.h-e.h);const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}];let a=0,i=0;for(const t of e)for(let e=r.length-1;e>=0;e--){const n=r[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),a=Math.max(a,t.x+t.w),t.w===n.w&&t.h===n.h){const t=r.pop();e<r.length&&(r[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):(r.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:a,h:i,fill:t/(a*i)||0}}el.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),a=r>>3,i=this.pos;this.type=7&r,e(a,t,this),this.pos===i&&this.skip(r)}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,r=this.buf;return t=127&(n=r[this.pos++]),n<128?t:(t|=(127&(n=r[this.pos++]))<<7,n<128?t:(t|=(127&(n=r[this.pos++]))<<14,n<128?t:(t|=(127&(n=r[this.pos++]))<<21,n<128?t:function(e,t,n){var r,a,i=n.buf;if(r=(112&(a=i[n.pos++]))>>4,a<128)return ol(e,r,t);if(r|=(127&(a=i[n.pos++]))<<3,a<128)return ol(e,r,t);if(r|=(127&(a=i[n.pos++]))<<10,a<128)return ol(e,r,t);if(r|=(127&(a=i[n.pos++]))<<17,a<128)return ol(e,r,t);if(r|=(127&(a=i[n.pos++]))<<24,a<128)return ol(e,r,t);if(r|=(1&(a=i[n.pos++]))<<31,a<128)return ol(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(n=r[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&&al?function(e,t,n){return al.decode(e.subarray(t,n))}(this.buf,t,e):function(e,t,n){for(var r="",a=t;a<n;){var i,o,s,l=e[a],c=null,u=l>239?4:l>223?3:l>191?2:1;if(a+u>n)break;1===u?l<128&&(c=l):2===u?128==(192&(i=e[a+1]))&&(c=(31&l)<<6|63&i)<=127&&(c=null):3===u?(o=e[a+2],128==(192&(i=e[a+1]))&&128==(192&o)&&((c=(15&l)<<12|(63&i)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(o=e[a+2],s=e[a+3],128==(192&(i=e[a+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,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),a+=u}return r}(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*rl),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*rl),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,r=r+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)))))}(r,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 r,a,i=0;i<t.length;i++){if((r=t.charCodeAt(i))>55295&&r<57344){if(!a){r>56319||i+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):a=r;continue}if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,a=r;continue}r=a-55296<<10|r-56320|65536,a=null}else a&&(e[n++]=239,e[n++]=191,e[n++]=189,a=null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|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 r=this.pos-n;r>=128&&sl(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},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:r,stretchY:a,content:i}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=a,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={},r={};this.haveRenderCallbacks=[];const a=[];this.addImages(e,n,a),this.addImages(t,r,a);const{w:i,h:o}=Ol(a),s=new Mo({width:i||1,height:o||1});for(const t in e){const r=e[t],a=n[t].paddedRect;Mo.copy(r.data,s,{x:0,y:0},{x:a.x+1,y:a.y+1},r.data)}for(const e in t){const n=t[e],a=r[e].paddedRect,i=a.x+1,o=a.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=r}addImages(e,t,n){for(const r in e){const a=e[r],i={x:0,y:0,w:a.data.width+2,h:a.data.height+2};n.push(i),t[r]=new kl(i,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}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[r,a]=e.tl;n.update(t.data,void 0,{x:r,y:a})}}_r("ImagePosition",kl),_r("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 r=0;r<e.sections.length;r++){const a=e.sections[r];a.image?n.addImageSection(a):n.addTextSection(a,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 r=e.charCodeAt(n+1)||null,a=e.charCodeAt(n-1)||null;t+=r&&Nr(r)&&!Ks[e[n+1]]||a&&Nr(a)&&!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,r,a,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}=Fr;if(y&&1===g.sections.length){_=[];const e=y(g.toString(),Tl(g,u,o,n,a,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,a,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=[],r=e.text;let a=0;for(const r of t)n.push(e.substring(a,r)),a=r;return a<r.length&&n.push(e.substring(a,r.length)),n}(g,Tl(g,u,o,n,a,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,r,a,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&&!wr(g)||d&&(ql[g]||(y=g,Or.Arabic(y)||Or["Arabic Supplement"](y)||Or["Arabic Extended-A"](y)||Or["Arabic Presentation Forms-A"](y)||Or["Arabic Presentation Forms-B"](y))));if(h.imageName){const e=a[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 r=x?n[0]*h.scale-24*i:n[1]*h.scale-24*i;r>0&&r>z&&(z=r)}else{const e=r[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,r,a,i,o,s,l){const c=(t-n)*a;let u=0;u=i!==o?-s*r- -17:(-r*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,r,a,_,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,r,a,i){if(t.imageName){const e=r[t.imageName];return e?e.displaySize[0]*t.scale*24/i+a:0}{const r=n[t.fontStack],i=r&&r[e];return i?i.metrics.advance*t.scale+a:0}}function Wl(e,t,n,r){const a=Math.pow(e-t,2);return r?e<t?a/2:2*a:a+Math.abs(n)*n}function Ll(e,t,n){let r=0;return 10===e&&(r-=1e4),n&&(r+=150),40!==e&&65288!==e||(r+=50),41!==t&&65289!==t||(r+=50),r}function Sl(e,t,n,r,a,i){let o=null,s=Wl(t,n,a,i);for(const e of r){const r=Wl(t-e.x,n,a,i)+e.badness;r<=s&&(o=e,s=r)}return{index:e,x:t,priorBreak:o,badness:s}}function Tl(e,t,n,r,a,i,o){if("point"!==i)return[];if(!e)return[];const s=[],l=function(e,t,n,r,a,i){let o=0;for(let n=0;n<e.length();n++){const s=e.getSection(n);o+=jl(e.getCharCode(n),s,r,a,t,i)}return o/Math.max(1,Math.ceil(o/n))}(e,t,n,r,a,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,r,a,t,o)),n<e.length()-1){const t=!((d=p)<11904||!(Or["Bopomofo Extended"](d)||Or.Bopomofo(d)||Or["CJK Compatibility Forms"](d)||Or["CJK Compatibility Ideographs"](d)||Or["CJK Compatibility"](d)||Or["CJK Radicals Supplement"](d)||Or["CJK Strokes"](d)||Or["CJK Symbols and Punctuation"](d)||Or["CJK Unified Ideographs Extension A"](d)||Or["CJK Unified Ideographs"](d)||Or["Enclosed CJK Letters and Months"](d)||Or["Halfwidth and Fullwidth Forms"](d)||Or.Hiragana(d)||Or["Ideographic Description Characters"](d)||Or["Kangxi Radicals"](d)||Or["Katakana Phonetic Extensions"](d)||Or.Katakana(d)||Or["Vertical Forms"](d)||Or["Yi Radicals"](d)||Or["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,r,a){if(!r&&!a)return;const i=e[n],o=(e[n].x+i.metrics.advance*i.scale)*r;for(let r=t;r<=n;r++)e[r].x-=o,e[r].y+=a}function Dl(e,t,n){const{horizontalAlign:r,verticalAlign:a}=Cl(n),i=t[0]-e.displaySize[0]*r,o=t[1]-e.displaySize[1]*a;return{image:e,top:o,bottom:o+e.displaySize[1],left:i,right:i+e.displaySize[0]}}function Pl(e,t,n,r,a,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=a[0]+l-r[3],d=a[0]+c+r[1]):(m=a[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=a[1]+b-r[0],p=a[1]+h+r[2]):(u=a[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 Yr(e+1))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:r}=n;let a=0;for(;a<t.length&&t[a]<=e;)a++;a=Math.max(0,a-1);let i=a;for(;i<t.length&&t[i]<e+1;)i++;i=Math.min(t.length-1,i);const o=t[a],s=t[i];return"composite"===n.kind?{kind:"composite",minZoom:o,maxZoom:s,interpolationType:r}:{kind:"camera",minZoom:o,maxZoom:s,minSize:n.evaluate(new Yr(o)),maxSize:n.evaluate(new Yr(s)),interpolationType:r}}}class $l extends A{constructor(e,t,n,r){super(e,t),this.angle=n,void 0!==r&&(this.segment=r)}clone(){return new $l(this.x,this.y,this.angle,this.segment)}}function Fl(e,t,n,r,a){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>r;)c-=l.shift().angleDelta;if(c>a)return!1;o++,s+=t.dist(n)}return!0}function Yl(e){let t=0;for(let n=0;n<e.length-1;n++)t+=e[n].dist(e[n+1]);return t}function Xl(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 Vl(e,t,n,r,a,i){const o=Xl(n,a,i),s=Hl(n,r)*i;let l=0;const c=Yl(e)/2;for(let n=0;n<e.length-1;n++){const r=e[n],a=e[n+1],i=r.dist(a);if(l+i>c){const u=(c-l)/i,d=Ot(r.x,a.x,u),p=Ot(r.y,a.y,u),m=new $l(d,p,a.angleTo(r),n);return m._round(),!o||Fl(e,m,s,o,t)?m:void 0}l+=i}}function Ul(e,t,n,r,a,i,o,s,l){const c=Xl(r,i,o),u=Hl(r,a),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,r,a,i,o,s,l,c){const u=o/2,d=Yl(t);let p=0,m=n-r,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+r<p+l;){m+=r;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(),a&&!Fl(t,n,o,a,i)||b.push(n)}}p+=l}return l||b.length||s||(b=e(t,p/2,r,a,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,r,a){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>=r&&c.x>=r||(o.x>=r?o=new A(r,o.y+(r-o.x)/(c.x-o.x)*(c.y-o.y))._round():c.x>=r&&(c=new A(r,o.y+(r-o.x)/(c.x-o.x)*(c.y-o.y))._round()),o.y>=a&&c.y>=a||(o.y>=a?o=new A(o.x+(a-o.y)/(c.y-o.y)*(c.x-o.x),a)._round():c.y>=a&&(c=new A(o.x+(a-o.y)/(c.y-o.y)*(c.x-o.x),a)._round()),l&&o.equals(l[l.length-1])||(l=[o],i.push(l)),l.push(c)))))}}return i}function Kl(e,t,n,r){const a=[],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&&r){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=(r,a,s,l)=>{const d=Ql(r.stretch-_,y,c,e.left),p=ec(r.fixed-z,O,r.stretch,b),m=Ql(a.stretch-M,v,u,e.top),f=ec(a.fixed-k,x,a.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=r.stretch+r.fixed,D=a.stretch+a.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(r&&(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 r=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)a.push(w(r,t[e],i,t[e+1]))}}else a.push(w({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));return a}function Jl(e,t,n){let r=0;for(const a of e)r+=Math.max(t,Math.min(n,a[1]))-Math.max(t,Math.min(n,a[0]));return r}function Zl(e,t,n){const r=[{fixed:-1,stretch:0}];for(const[t,n]of e){const e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(n-t)})}return r.push({fixed:t+1,stretch:n}),r}function Ql(e,t,n,r){return e/t*n+r}function ec(e,t,n,r){return e-t*n/r}_r("Anchor",$l);class tc{constructor(e,t,n,r,a,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 r=t-e;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}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),r=new A(p,u),a=c*Math.PI/180;e._rotate(a),t._rotate(a),n._rotate(a),r._rotate(a),d=Math.min(e.x,t.x,n.x,r.x),p=Math.max(e.x,t.x,n.x,r.x),l=Math.min(e.y,t.y,n.y,r.y),u=Math.max(e.y,t.y,n.y,r.y)}e.emplaceBack(t.x,t.y,d,l,p,u,n,r,a)}this.boxEndIndex=e.length}}class nc{constructor(e=[],t=rc){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,r=t[e];for(;e>0;){const a=e-1>>1,i=t[a];if(n(r,i)>=0)break;t[e]=i,e=a}t[e]=r}_down(e){const{data:t,compare:n}=this,r=this.length>>1,a=t[e];for(;e<r;){let r=1+(e<<1),i=t[r];const o=r+1;if(o<this.length&&n(t[o],i)<0&&(r=o,i=t[o]),n(i,a)>=0)break;t[e]=i,e=r}t[e]=a}}function rc(e,t){return e<t?-1:e>t?1:0}function ac(e,t=1,n=!1){let r=1/0,a=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<r)&&(r=t.x),(!e||t.y<a)&&(a=t.y),(!e||t.x>i)&&(i=t.x),(!e||t.y>o)&&(o=t.y)}const l=Math.min(i-r,o-a);let c=l/2;const u=new nc([],ic);if(0===l)return new A(r,a);for(let t=r;t<i;t+=l)for(let n=a;n<o;n+=l)u.push(new oc(t+c,n+c,c,e));let d=function(e){let t=0,n=0,r=0;const a=e[0];for(let e=0,i=a.length,o=i-1;e<i;o=e++){const i=a[e],s=a[o],l=i.x*s.y-s.x*i.y;n+=(i.x+s.x)*l,r+=(i.y+s.y)*l,t+=3*l}return new oc(n/t,r/t,0,e)}(e),p=u.length;for(;u.length;){const r=u.pop();(r.d>d.d||!d.d)&&(d=r,n&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,p)),r.max-d.d<=t||(c=r.h/2,u.push(new oc(r.p.x-c,r.p.y-c,c,e)),u.push(new oc(r.p.x+c,r.p.y-c,c,e)),u.push(new oc(r.p.x-c,r.p.y+c,c,e)),u.push(new oc(r.p.x+c,r.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,r){this.p=new A(e,t),this.h=n,this.d=function(e,t){let n=!1,r=1/0;for(let a=0;a<t.length;a++){const i=t[a];for(let t=0,a=i.length,o=a-1;t<a;o=t++){const a=i[t],s=i[o];a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(n=!n),r=Math.min(r,Hi(e,a,s))}}return(n?1:-1)*Math.sqrt(r)}(this.p,r),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 r=0,a=0;switch(t=Math.abs(t),n=Math.abs(n),e){case"top-right":case"top-left":case"top":a=n-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-n}switch(e){case"top-right":case"bottom-right":case"right":r=-t;break;case"top-left":case"bottom-left":case"left":r=t}return[r,a]}(e,t[0],t[1]):function(e,t){let n=0,r=0;t<0&&(t=0);const a=t/Math.sqrt(2);switch(e){case"top-right":case"top-left":r=a-7;break;case"bottom-right":case"bottom-left":r=7-a;break;case"bottom":r=7-t;break;case"top":r=t-7}switch(e){case"top-right":case"bottom-right":n=-a;break;case"top-left":case"bottom-left":n=a;break;case"left":n=t;break;case"right":n=-t}return[n,r]}(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,r,a,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(r.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,r=1){const a=e.get("icon-padding").evaluate(t,{},n),i=a&&a.values;return[i[0]*r,i[1]*r,i[2]*r,i[3]*r]}(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;a&&"none"!==q&&(t.allowVerticalPlacement&&r.vertical&&(E=Pl(a,r.vertical,q,m.get("icon-text-fit-padding"),h,g)),f&&(a=Pl(a,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,r,a,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,r);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&&a.vertical){const e=l.layout.get("text-rotate").evaluate(z,{},A)+90;E=new tc(c,n,u,d,p,a.vertical,m,h,f,e),s&&(j=new tc(c,n,u,d,p,s,_,y,f,e))}if(i){const r=l.layout.get("icon-rotate").evaluate(z,{}),a="none"!==l.layout.get("icon-text-fit"),o=Kl(i,r,k,a),m=s?Kl(s,r,k,a):void 0;q=new tc(c,n,u,d,p,i,_,y,!1,r),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(a.horizontal);for(const r of $){const i=a.horizontal[r];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,a.vertical?e.WritingMode.horizontal:e.WritingMode.horizontalOnly,s?$:[r],D,C,O,A),s)break}a.vertical&&(T+=pc(t,n,a.vertical,o,l,f,z,g,w,e.WritingMode.vertical,["vertical"],D,R,O,A));const F=N?N.boxStartIndex:t.collisionBoxArray.length,Y=N?N.boxEndIndex:t.collisionBoxArray.length,X=E?E.boxStartIndex:t.collisionBoxArray.length,H=E?E.boxEndIndex:t.collisionBoxArray.length,V=q?q.boxStartIndex:t.collisionBoxArray.length,U=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,Y,X,H,V,U,G,K,u,S,T,W,L,Q,0,m,B,I,J)}(t,p,l,r,a,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=Ul(e,v,k,r.vertical||f,a,24,y,t.overscaling,Wi);for(const r of n){const n=f;n&&bc(t,n.text,N,r)||j(e,r)}}else if("line-center"===w){for(const e of n.geometry)if(e.length>1){const t=Vl(e,k,r.vertical||f,a,24,y);t&&j(e,t)}}else if("Polygon"===n.type)for(const e of ts(n.geometry,0)){const t=ac(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,r,a,i,o,s,l,c,u,d,p,m,h){const f=function(e,t,n,r,a,i,o,s){const l=r.layout.get("text-rotate").evaluate(i,{})*Math.PI/180,c=[];for(const e of t.positionedLines)for(const r of e.positionedGlyphs){if(!r.rect)continue;const i=r.rect||{};let u=4,d=!0,p=1,m=0;const b=(a||s)&&r.vertical,h=r.metrics.advance*r.scale/2;if(s&&t.verticalizable){const t=24*(r.scale-1),n=(24-r.metrics.width*r.scale)/2;m=e.lineOffset/2-(r.imageName?-n:t)}if(r.imageName){const e=o[r.imageName];d=e.sdf,p=e.pixelRatio,u=1/p}const f=a?[r.x+h,r.y]:[0,0];let g=a?[0,0]:[r.x+h+n[0],r.y+n[1]-m],_=[0,0];b&&(_=g,g=[0,0]);const y=(r.metrics.left-u)*r.scale-h+g[0],M=(-r.metrics.top-u)*r.scale+g[1],v=y+i.w*r.scale/p,z=M+i.h*r.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,a=new A(22-n,-(r.imageName?n:0)),i=new A(..._);O._rotateAround(t,e)._add(a)._add(i),k._rotateAround(t,e)._add(a)._add(i),x._rotateAround(t,e)._add(a)._add(i),w._rotateAround(t,e)._add(a)._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:r.sectionIndex,isSDF:d,pixelOffsetTL:N,pixelOffsetBR:q,minFontScaleX:0,minFontScaleY:0})}return c}(0,n,s,a,i,o,r,e.allowVerticalPlacement),g=e.textSizeData;let _=null;"source"===g.kind?(_=[Bl*a.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,r){const a=e.compareText;if(t in a){const e=a[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<n)return!0}else a[t]=[];return a[t].push(r),!1}const hc=ds.VectorTileFeature.types,fc=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function gc(e,t,n,r,a,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*r),Math.round(32*a),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(jr(t.text))return!0;return!1}class Mc{constructor(e){this.layoutVertexArray=new Ja,this.indexArray=new ni,this.programConfigurations=e,this.segments=new oi,this.dynamicLayoutVertexArray=new Za,this.opacityVertexArray=new Qa,this.placedSymbolArray=new Ra}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,n,r){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ys.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Xs.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,fc,!0),this.opacityVertexBuffer.itemSize=1),(n||r)&&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())}}_r("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())}}_r("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=ao([]),this.placementViewportMatrix=ao([]);const n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Il(this.zoom,n["text-size"]),this.iconSizeData=Il(this.zoom,n["icon-size"]);const r=this.layers[0].layout,a=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.canOverlap="never"!==wc(r,"text-overlap","text-allow-overlap")||"never"!==wc(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&!a.isConstant(),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map(t=>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 Ba,this.lineVertexArray=new Ia,this.symbolInstances=new Pa}calculateGlyphDependencies(e,t,n,r,a){for(let i=0;i<e.length;i++)if(t[e.charCodeAt(i)]=!0,(n||r)&&a){const n=Ks[e.charAt(i)];n&&(t[n.charCodeAt(0)]=!0)}}populate(t,n,r){const a=this.layers[0],i=a.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 Yr(this.zoom);for(const{feature:n,id:s,index:l,sourceLayerIndex:f}of t){const t=a._featureFilter.needGeometry,g=Ci(n,t);if(!a._featureFilter.filter(h,g,r))continue;let _,y;if(t||(g.geometry=Ti(n)),c){const e=a.getValueAndResolveTokens("text-field",g,r,b),t=Ce.factory(e);yc(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Ir()||this.hasRTLText&&Fr.isParsed())&&(_=Gs(t,a,g))}if(u){const e=a.getValueAndResolveTokens("icon-image",g,r,b);y=e instanceof De?e:De.fromString(e)}if(!_&&!y)continue;const M=this.sortFeaturesByKey?d.evaluate(g,{},r):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,{},r).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 r=kr(_.toString()),a=e.fontStack||t,i=m[a]=m[a]||{};this.calculateGlyphDependencies(e.text,i,n,this.allowVerticalPlacement,r)}}}"line"===i.get("symbol-placement")&&(this.features=function(e){const t={},n={},r=[];let a=0;function i(t){r.push(e[t]),a++}function o(e,t,a){const i=n[e];return delete n[e],n[t]=i,r[i].geometry[0].pop(),r[i].geometry[0]=r[i].geometry[0].concat(a[0]),i}function s(e,n,a){const i=t[n];return delete t[n],t[e]=i,r[i].geometry[0].shift(),r[i].geometry[0]=a[0].concat(r[i].geometry[0]),i}function l(e,t,n){const r=n?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.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),a=o(m,b,r[e].geometry);delete t[m],delete n[b],n[l(p,r[a].geometry,!0)]=a,r[e].geometry=null}else m in n?o(m,b,d):b in t?s(m,b,d):(i(c),t[m]=a-1,n[b]=a-1)}return r.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]),r=e.dist(t[e.segment]);const a={};for(let r=e.segment+1;r<t.length;r++)a[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:n},r<t.length-1&&(n+=t[r+1].dist(t[r]));for(let n=e.segment||0;n>=0;n--)a[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:r},n>0&&(r+=t[n-1].dist(t[n]));for(let e=0;e<t.length;e++){const t=a[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,n,r,a,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:a,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,a.x,A+a.y,u.x,u.y,r,z,d.x,d.y,g,M),gc(b,l.x,l.y,i.x,A+i.y,u.x+u.w,u.y,r,z,f.x,d.y,g,M),gc(b,l.x,l.y,s.x,A+s.y,u.x,u.y+u.h,r,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,r,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,r?r[0]:0,r?r[1]:0,a[0],a[1],s,0,!1,0,d)}_addCollisionDebugVertex(e,t,n,r,a,i){return t.emplaceBack(0,0),e.emplaceBack(n.x,n.y,r,a,Math.round(i.x),Math.round(i.y))}addCollisionDebugVertices(e,t,n,r,a,i,o){const s=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=s.vertexLength,c=a.layoutVertexArray,u=a.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,r)),this._addCollisionDebugVertex(c,u,i,d,p,new A(e,r)),s.vertexLength+=4;const m=a.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,r){for(let a=e;a<t;a++){const e=this.collisionBoxArray.get(a);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,r?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new vc(ei,Vs.members,ri),this.iconCollisionBox=new vc(ei,Vs.members,ri);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,r,a,i,o,s,l){const c={};for(let r=t;r<n;r++){const t=e.get(r);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=r;t<a;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),r=n.vertexStartIndex+4*n.numGlyphs;for(let t=n.vertexStartIndex;t<r;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),r=[],a=[],i=[];for(let e=0;e<this.symbolInstances.length;++e){i.push(e);const o=this.symbolInstances.get(e);r.push(0|Math.round(t*o.anchorX+n*o.anchorY)),a.push(o.featureIndex)}return i.sort((e,t)=>r[e]-r[t]||a[t]-a[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)}}}_r("SymbolBucket",zc,{omit:["layers","collisionBoxArray","features","compareText"]}),zc.MAX_GLYPHS=65535,zc.addDynamicAttributes=_c;const Oc=new aa({"symbol-placement":new Qr(ne.layout_symbol["symbol-placement"]),"symbol-spacing":new Qr(ne.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Qr(ne.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ea(ne.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Qr(ne.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Qr(ne.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Qr(ne.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Qr(ne.layout_symbol["icon-ignore-placement"]),"icon-optional":new Qr(ne.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Qr(ne.layout_symbol["icon-rotation-alignment"]),"icon-size":new ea(ne.layout_symbol["icon-size"]),"icon-text-fit":new Qr(ne.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Qr(ne.layout_symbol["icon-text-fit-padding"]),"icon-image":new ea(ne.layout_symbol["icon-image"]),"icon-rotate":new ea(ne.layout_symbol["icon-rotate"]),"icon-padding":new ea(ne.layout_symbol["icon-padding"]),"icon-keep-upright":new Qr(ne.layout_symbol["icon-keep-upright"]),"icon-offset":new ea(ne.layout_symbol["icon-offset"]),"icon-anchor":new ea(ne.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Qr(ne.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Qr(ne.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Qr(ne.layout_symbol["text-rotation-alignment"]),"text-field":new ea(ne.layout_symbol["text-field"]),"text-font":new ea(ne.layout_symbol["text-font"]),"text-size":new ea(ne.layout_symbol["text-size"]),"text-max-width":new ea(ne.layout_symbol["text-max-width"]),"text-line-height":new Qr(ne.layout_symbol["text-line-height"]),"text-letter-spacing":new ea(ne.layout_symbol["text-letter-spacing"]),"text-justify":new ea(ne.layout_symbol["text-justify"]),"text-radial-offset":new ea(ne.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Qr(ne.layout_symbol["text-variable-anchor"]),"text-anchor":new ea(ne.layout_symbol["text-anchor"]),"text-max-angle":new Qr(ne.layout_symbol["text-max-angle"]),"text-writing-mode":new Qr(ne.layout_symbol["text-writing-mode"]),"text-rotate":new ea(ne.layout_symbol["text-rotate"]),"text-padding":new Qr(ne.layout_symbol["text-padding"]),"text-keep-upright":new Qr(ne.layout_symbol["text-keep-upright"]),"text-transform":new ea(ne.layout_symbol["text-transform"]),"text-offset":new ea(ne.layout_symbol["text-offset"]),"text-allow-overlap":new Qr(ne.layout_symbol["text-allow-overlap"]),"text-overlap":new Qr(ne.layout_symbol["text-overlap"]),"text-ignore-placement":new Qr(ne.layout_symbol["text-ignore-placement"]),"text-optional":new Qr(ne.layout_symbol["text-optional"])});var kc={paint:new aa({"icon-opacity":new ea(ne.paint_symbol["icon-opacity"]),"icon-color":new ea(ne.paint_symbol["icon-color"]),"icon-halo-color":new ea(ne.paint_symbol["icon-halo-color"]),"icon-halo-width":new ea(ne.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ea(ne.paint_symbol["icon-halo-blur"]),"icon-translate":new Qr(ne.paint_symbol["icon-translate"]),"icon-translate-anchor":new Qr(ne.paint_symbol["icon-translate-anchor"]),"text-opacity":new ea(ne.paint_symbol["text-opacity"]),"text-color":new ea(ne.paint_symbol["text-color"],{runtimeType:be,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new ea(ne.paint_symbol["text-halo-color"]),"text-halo-width":new ea(ne.paint_symbol["text-halo-width"]),"text-halo-blur":new ea(ne.paint_symbol["text-halo-blur"]),"text-translate":new Qr(ne.paint_symbol["text-translate"]),"text-translate-anchor":new Qr(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}}_r("FormatSectionOverride",Ac,{omit:["defaultValue"]});class xc extends oa{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,r){const a=this.layout.get(e).evaluate(t,{},n,r),i=this._unevaluatedLayout._values[e];return i.isDataDriven()||wn(i.value)||!a?a:function(e,t){return t.replace(/{([^{}]+)}/g,(t,n)=>n in e?String(e[n]):"")}(t.properties,a)}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),r=new xn(n,t.property.specification);let a=null;a="constant"===t.value.kind||"source"===t.value.kind?new qn("source",r):new En("composite",r,t.value.zoomStops),this.paint._values[e]=new Jr(t.property,a,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"),r=kc.paint.properties[t];let a=!1;const i=e=>{for(const t of e)if(r.overrides&&r.overrides.hasOverride(t))return void(a=!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=>{a||(t instanceof Fe&&Ie(t.value)===_e?i(t.value.sections):t instanceof an?i(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return a}}function wc(e,t,n){let r="never";const a=e.get(t);return a?r=a:e.get(n)&&(r="always"),r}var Nc={paint:new aa({"background-color":new Qr(ne.paint_background["background-color"]),"background-pattern":new na(ne.paint_background["background-pattern"]),"background-opacity":new Qr(ne.paint_background["background-opacity"])})},qc={paint:new aa({"raster-opacity":new Qr(ne.paint_raster["raster-opacity"]),"raster-hue-rotate":new Qr(ne.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Qr(ne.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Qr(ne.paint_raster["raster-brightness-max"]),"raster-saturation":new Qr(ne.paint_raster["raster-saturation"]),"raster-contrast":new Qr(ne.paint_raster["raster-contrast"]),"raster-resampling":new Qr(ne.paint_raster["raster-resampling"]),"raster-fade-duration":new Qr(ne.paint_raster["raster-fade-duration"])})};class Ec extends oa{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 oa{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,r,a,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 r)for(const t of e){const e=u?t:mo(t,s);let n=p;const r=uo([],[t.x,t.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?n*=r[3]/i.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(n*=i.cameraToCenterDistance/r[3]),Bi(d,e,n))return!0}return!1}},heatmap:class extends oa{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 oa{constructor(e){super(e,zo)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},fill:class extends oa{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,r,a,i,o){return Ii(Zi(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),i.angle,o),r)}isTileClipped(){return!0}},"fill-extrusion":class extends oa{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,r,a,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,r){const a=[];for(const n of e){const e=[n.x,n.y,0,1];uo(e,e,t),a.push(new A(e[0]/e[3],e[1]/e[3]))}return a}(l,s),p=function(e,t,n,r){const a=[],i=[],o=r[8]*t,s=r[9]*t,l=r[10]*t,c=r[11]*t,u=r[8]*n,d=r[9]*n,p=r[10]*n,m=r[11]*n;for(const t of e){const e=[],n=[];for(const a of t){const t=a.x,i=a.y,b=r[0]*t+r[4]*i+r[12],h=r[1]*t+r[5]*i+r[13],f=r[2]*t+r[6]*i+r[14],g=r[3]*t+r[7]*i+r[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)}a.push(e),i.push(n)}return[a,i]}(r,u,c,s);return function(e,t,n){let r=1/0;Ii(n,t)&&(r=js(n,t[0]));for(let a=0;a<t.length;a++){const i=t[a],o=e[a];for(let e=0;e<i.length-1;e++){const t=i[e],a=[t,i[e+1],o[e+1],o[e],t];Pi(n,a)&&(r=Math.min(r,js(n,a)))}}return r!==1/0&&r}(p[0],p[1],d)}},line:class extends oa{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)),r=Ki("line-offset",this,t);return n/2+Math.abs(r)+Ji(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,n,r,a,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&&(r=function(e,t){const n=[];for(let r=0;r<e.length;r++){const a=e[r],i=[];for(let e=0;e<a.length;e++){const n=a[e-1],r=a[e],o=a[e+1],s=0===e?new A(0,0):r.sub(n)._unit()._perp(),l=e===a.length-1?new A(0,0):o.sub(r)._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(r))}n.push(i)}return n}(r,c*o)),function(e,t,n){for(let r=0;r<t.length;r++){const a=t[r];if(e.length>=3)for(let t=0;t<a.length;t++)if(Ui(e,a[t]))return!0;if($i(e,a,n))return!0}return!1}(s,r,l)}isTileClipped(){return!0}},symbol:xc,background:class extends oa{constructor(e){super(e,Nc)}},raster:class extends oa{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,r=e.lat*t,a=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return Lc*Math.acos(Math.min(a,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 r,a;if(e instanceof Sc)r=e,a=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(r=e._sw,a=e._ne,!r||!a)return this}return t||n?(t.lng=Math.min(r.lng,t.lng),t.lat=Math.min(r.lat,t.lat),n.lng=Math.max(a.lng,n.lng),n.lat=Math.max(a.lat,n.lat)):(this._sw=new Sc(r.lng,r.lat),this._ne=new Sc(a.lng,a.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 r=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&r}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 r=2*Math.PI*6378137/256/Math.pow(2,n);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class Yc{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=Vc(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 r=(i=this.y,o=this.z,s=Fc(256*(a=this.x),256*(i=Math.pow(2,o)-i-1),o),l=Fc(256*(a+1),256*(i+1),o),s[0]+","+s[1]+","+l[0]+","+l[1]);var a,i,o,s,l;const c=function(e,t,n){let r,a="";for(let i=e;i>0;i--)r=1<<i-1,a+=(t&r?1:0)+(n&r?2:0);return a}(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,r)}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 Xc{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Vc(e,t.z,t.z,t.x,t.y)}}class Hc{constructor(e,t,n,r,a){if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Yc(n,+r,+a),this.key=Vc(t,e,n,r,a)}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?Vc(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Vc(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,r=2*this.canonical.y;return[new Hc(t,this.wrap,t,n,r),new Hc(t,this.wrap,t,n+1,r),new Hc(t,this.wrap,t,n,r+1),new Hc(t,this.wrap,t,n+1,r+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 Xc(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 Vc(e,t,n,r,a){(e*=2)<0&&(e=-1*e-1);const i=1<<n;return(i*i*e+i*a+r).toString(36)+n.toString(36)+t.toString(36)}_r("CanonicalTileID",Yc),_r("OverscaledTileID",Hc,{omit:["posMatrix"]});class Uc{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 r=this.dim=t.height-2;this.data=new Uint32Array(t.data.buffer),this.encoding=n||"mapbox";for(let e=0;e<r;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(r,e)]=this.data[this._idx(r-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,r)]=this.data[this._idx(e,r-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(r,-1)]=this.data[this._idx(r-1,0)],this.data[this._idx(-1,r)]=this.data[this._idx(0,r-1)],this.data[this._idx(r,r)]=this.data[this._idx(r-1,r-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let e=0;e<r;e++)for(let t=0;t<r;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),r=4*this._idx(e,t);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(n[r],n[r+1],n[r+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 r=t*this.dim,a=t*this.dim+this.dim,i=n*this.dim,o=n*this.dim+this.dim;switch(t){case-1:r=a-1;break;case 1:a=r+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=r;n<a;n++)this.data[this._idx(n,t)]=e.data[this._idx(n+s,t+l)]}}_r("DEMData",Uc);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,r,a){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=n,e._y=r,this.properties=e.properties,this.id=a}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 fr(Wi,16,0),this.grid3D=new fr(Wi,16,0),this.featureIndexArray=new Fa,this.promoteId=t}insert(e,t,n,r,a,i){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,r,a);const s=i?this.grid3D:this.grid;for(let e=0;e<t.length;e++){const n=t[e],r=[1/0,1/0,-1/0,-1/0];for(let e=0;e<n.length;e++){const t=n[e];r[0]=Math.min(r[0],t.x),r[1]=Math.min(r[1],t.y),r[2]=Math.max(r[2],t.x),r[3]=Math.max(r[3],t.y)}r[0]<Wi&&r[1]<Wi&&r[2]>=0&&r[3]>=0&&s.insert(o,r[0],r[1],r[2],r[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,r){this.loadVTLayers();const a=e.params||{},i=Wi/e.tileSize/e.scale,o=In(a.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,r,a)=>function(e,t,n,r,a){for(const i of e)if(t<=i.x&&n<=i.y&&r>=i.x&&a>=i.y)return!0;const i=[new A(t,n),new A(t,a),new A(r,a),new A(r,n)];if(e.length>2)for(const t of i)if(Ui(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,r+l,a+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,a.layers,a.availableImages,t,n,r,(t,n,r)=>(p||(p=Ti(t)),n.queryIntersectsFeature(s,t,r,p,this.z,e.transform,i,e.pixelPosMatrix)))}return m}loadMatchingFeature(e,t,n,r,a,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(r);if(a.needGeometry){const e=Ci(b,!0);if(!a.filter(new Yr(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!a.filter(new Yr(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 a=l[n];if(!a)continue;let m={};h&&u&&(m=u.getState(a.sourceLayer||"_geojsonTileLayer",h));const f=s({},c[n]);f.paint=Zc(f.paint,a.paint,b,m,o),f.layout=Zc(f.layout,a.layout,b,m,o);const g=!d||d(b,a,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:r,feature:_,intersectionZ:g})}}lookupSymbolFeatures(e,t,n,r,a,i,o,s){const l={};this.loadVTLayers();const c=In(a);for(const a of e)this.loadMatchingFeature(l,n,r,a,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,r,a){return u(e,(e,i)=>{const o=t instanceof Zr?t.get(i):null;return o&&o.evaluate?o.evaluate(n,r,a):o})}function Qc(e){let t=1/0,n=1/0,r=-1/0,a=-1/0;for(const i of e)t=Math.min(t,i.x),n=Math.min(n,i.y),r=Math.max(r,i.x),a=Math.max(a,i.y);return{minX:t,minY:n,maxX:r,maxY:a}}function eu(e,t){return t-e}var tu;_r("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,ru=[];const au=1e3/30,iu={mark(e){performance.mark(e)},frame(e){const t=e;null!=nu&&ru.push(t-nu),nu=t},clearMetrics(){nu=null,ru=[],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,r=ru.length,a=1/(ru.reduce((e,t)=>e+t,0)/r/1e3),i=ru.filter(e=>e>au).reduce((e,t)=>e+(t-au)/au,0);return{loadTime:t,fullLoadTime:n,fps:a,percentDroppedFrames:i/(r+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,r,a=!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:r,mustQueue:a,sourceMapId:this.mapId,data:Mr(t,o)},o),{cancel:()=>{n&&delete this.callbacks[i],this.target.postMessage({id:i,type:"<cancel>",targetMapId:r,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(vr(t.error)):n(null,vr(t.data)))}else{let n=!1;const r=z(this.globalScope)?void 0:[],a=t.hasCallback?(t,a)=>{n=!0,delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:t?Mr(t):null,data:Mr(a,r)},r)}:e=>{n=!0};let i=null;const o=vr(t.data);if(this.parent[t.type])i=this.parent[t.type](t.sourceMapId,o,a);else if(this.parent.getWorkerSource){const e=t.type.split(".");i=this.parent.getWorkerSource(t.sourceMapId,e[0],o.source)[e[1]](o,a)}else a(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=Yc,e.CollisionBoxArray=Ta,e.CollisionCircleLayoutArray=class extends Oa{},e.Color=Le,e.DEMData=Uc,e.DataConstantProperty=Qr,e.DictionaryCoder=Gc,e.EXTENT=Wi,e.ErrorEvent=ee,e.EvaluationParameters=Yr,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 Wa{},e.LngLat=Sc,e.LngLatBounds=Tc,e.MercatorCoordinate=$c,e.ONE_EM=24,e.OverscaledTileID=Hc,e.PerformanceUtils=iu,e.PosArray=Ya,e.Properties=aa,e.QuadTriangleArray=class extends Aa{},e.RGBAImage=Mo,e.RasterBoundsArray=class extends ma{},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=Vr,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=Xc,e.ValidationError=re,e.ZoomHistory=zr,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 r=e.length;const a=new Array(e.length);let i=null;e.forEach((e,o)=>{t(e,(e,t)=>{e&&(i=e),a[o]=t,0==--r&&n(i,a)})})},e.bezier=r,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=Us,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=ro,e.createExpression=Nn,e.createFilter=In,e.createLayout=ua,e.createStyleLayer=function(e){return"custom"===e.type?new Ec(e):new jc[e.type](e)},e.cross=function(e,t,n){var r=t[0],a=t[1],i=t[2],o=n[0],s=n[1],l=n[2];return e[0]=a*l-i*s,e[1]=i*o-r*l,e[2]=r*s-a*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=a,e.emitValidationErrors=hr,e.enforceCacheSizeLimit=function(e){W(),q&&q.then(t=>{t.keys().then(n=>{for(let r=0;r<n.length-e;r++)t.delete(n[r])})})},e.equals=function(e,t){var n=e[0],r=e[1],a=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(r-y)<=to*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-M)<=to*Math.max(1,Math.abs(a),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:r,upperSize:a}){return"source"===e.kind?r/Bl:"composite"===e.kind?Ot(r/Bl,a/Bl,n):t},e.evaluateSizeForZoom=function(e,t){let n=0,r=0;if("constant"===e.kind)r=e.layoutSize;else if("source"!==e.kind){const{interpolationType:a,minZoom:o,maxZoom:s}=e,l=a?i(Dt.interpolationFactor(a,t,o,s),0,1):0;"camera"===e.kind?r=Ot(e.minSize,e.maxSize,l):n=l}return{uSizeT:n,uSize:r}},e.evaluateVariableOffset=lc,e.evented=Br,e.exported=k,e.exported$1=S,e.extend=s,e.filterObject=d,e.fromRotation=function(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=-n,e[4]=r,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=X,e.getImage=K,e.getJSON=function(e,t){return Y(s(e,{type:"json"}),t)},e.getOverlapMode=wc,e.getRTLTextPluginStatus=Ir,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 r=window.document.createElement("source");H(e[t])||(n.crossOrigin="Anonymous"),r.src=e[t],n.appendChild(r)}return{cancel:()=>{}}},e.identity=ao,e.invert=function(e,t){var n=t[0],r=t[1],a=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-r*o,y=n*l-a*o,M=n*c-i*o,v=r*l-a*s,z=r*c-i*s,O=a*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]=(a*N-r*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-a*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]=(r*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-r*A+a*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 r in e)r in t||n.push(r);return n},e.lazyLoadRTLTextPlugin=function(){Fr.isLoading()||Fr.isLoaded()||"deferred"!==Ir()||$r()},e.makeRequest=Y,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],r=t[1],a=t[2],i=n*n+r*r+a*a;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,r,a,i,o){var s=1/(t-n),l=1/(r-a),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]=(a+r)*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,r=t.bucket.layers[0]._unevaluatedLayout._values,a={layoutIconSize:r["icon-size"].possiblyEvaluate(new Yr(t.bucket.zoom+1),t.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Yr(t.bucket.zoom+1),t.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Yr(18))};if("composite"===t.bucket.textSizeData.kind){const{minZoom:e,maxZoom:n}=t.bucket.textSizeData;a.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Yr(e),t.canonical),r["text-size"].possiblyEvaluate(new Yr(n),t.canonical)]}if("composite"===t.bucket.iconSizeData.kind){const{minZoom:e,maxZoom:n}=t.bucket.iconSizeData;a.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Yr(e),t.canonical),r["icon-size"].possiblyEvaluate(new Yr(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 r of t.bucket.features){const c=n.get("text-font").evaluate(r,{},t.canonical).join(","),u=l.evaluate(r,{},t.canonical),d=a.layoutTextSize.evaluate(r,{},t.canonical),p=a.layoutIconSize.evaluate(r,{},t.canonical),m={horizontal:{},vertical:void 0},h=r.text;let f,g=[0,0];if(h){const a=h.toString(),l=24*n.get("text-letter-spacing").evaluate(r,{},t.canonical),p=Ar(a)?l:0,b=n.get("text-anchor").evaluate(r,{},t.canonical),f=n.get("text-variable-anchor");if(!f){const e=n.get("text-radial-offset").evaluate(r,{},t.canonical);g=e?lc(b,[24*e,sc]):n.get("text-offset").evaluate(r,{},t.canonical).map(e=>24*e)}let _=o?"center":n.get("text-justify").evaluate(r,{},t.canonical);const y=n.get("symbol-placement"),M="point"===y?24*n.get("text-max-width").evaluate(r,{},t.canonical):0,v=()=>{t.bucket.allowVerticalPlacement&&kr(a)&&(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 r=!1;for(let a=0;a<n.length;a++){const o=n[a];if(!m.horizontal[o])if(r)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,r=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(),kr(a)&&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(r.icon&&r.icon.name){const e=t.imageMap[r.icon.name];e&&(f=Dl(t.imagePositions[r.icon.name],n.get("icon-offset").evaluate(r,{},t.canonical),n.get("icon-anchor").evaluate(r,{},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,r,m,f,t.imageMap,a,d,p,g,_,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.perspective=function(e,t,n,r,a){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!=a&&a!==1/0?(e[10]=(a+r)*(i=1/(r-a)),e[14]=2*a*r*i):(e[10]=-1,e[14]=-2*r),e},e.pick=function(e,t){const n={};for(let r=0;r<t.length;r++){const a=t[r];a in e&&(n[a]=e[a])}return n},e.plugin=Fr,e.pointGeometry=A,e.polygonIntersectsPolygon=Pi,e.potpack=Ol,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.register=_r,e.registerForPluginStateChange=function(e){return e({pluginStatus:Cr,pluginURL:Rr}),Br.on("pluginStateChange",e),e},e.renderColorRamp=vo,e.rotateX=function(e,t,n){var r=Math.sin(n),a=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*a+c*r,e[5]=o*a+u*r,e[6]=s*a+d*r,e[7]=l*a+p*r,e[8]=c*a-i*r,e[9]=u*a-o*r,e[10]=d*a-s*r,e[11]=p*a-l*r,e},e.rotateZ=function(e,t,n){var r=Math.sin(n),a=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*a+c*r,e[1]=o*a+u*r,e[2]=s*a+d*r,e[3]=l*a+p*r,e[4]=c*a-i*r,e[5]=u*a-o*r,e[6]=d*a-s*r,e[7]=p*a-l*r,e},e.scale=function(e,t,n){var r=n[0],a=n[1],i=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,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(Cr===Wr||Cr===Lr||Cr===Sr)throw new Error("setRTLTextPlugin cannot be called multiple times.");Rr=k.resolveURL(e),Cr=Wr,Tr=t,Pr(),n||$r()},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 r=t[0],a=t[1],i=t[2];return e[0]=r*n[0]+a*n[3]+i*n[6],e[1]=r*n[1]+a*n[4]+i*n[7],e[2]=r*n[2]+a*n[5]+i*n[8],e},e.transformMat4=uo,e.transformMat4$1=function(e,t,n){var r=t[0],a=t[1];return e[0]=n[0]*r+n[4]*a+n[12],e[1]=n[1]*r+n[5]*a+n[13],e},e.translate=function(e,t,n){var r,a,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]):(a=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]=r=t[0],e[1]=a,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]=r*h+s*f+d*g+t[12],e[13]=a*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=Dr,e.unicodeBlockLookup=Or,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=pr,e.validateStyle=dr,e.vectorTile=ds,e.warnOnce=b,e.wrap=o})),r(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 r of e)n+=t(r)+",";return n+"]"}const r=Object.keys(e).sort();let a="{";for(let n=0;n<r.length;n++)a+=`${JSON.stringify(r[n])}:${t(e[r[n]])},`;return a+"}"}function n(n){let r="";for(const a of e.refProperties)r+="/"+t(n[a]);return r}class r{constructor(e){this.keyCache={},e&&this.replace(e)}replace(e){this._layerConfigs={},this._layers={},this.update(e,[])}update(t,r){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 r)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const a=function(e,t){const r={};for(let a=0;a<e.length;a++){const i=t&&t[e[a].id]||n(e[a]);t&&(t[e[a].id]=i);let o=r[i];o||(o=r[i]=[]),o.push(e[a])}const a=[];for(const e in r)a.push(r[e]);return a}(Object.values(this._layerConfigs),this.keyCache);for(const e of a){const t=e.map(e=>this._layers[e.id]),n=t[0];if("none"===n.visibility)continue;const r=n.source||"";let a=this.familiesBySource[r];a||(a=this.familiesBySource[r]={});const i=n.sourceLayer||"_geojsonTileLayer";let o=a[i];o||(o=a[i]=[]),o.push(t)}}}class a{constructor(t){const n={},r=[];for(const e in t){const a=t[e],i=n[e]={};for(const e in a){const t=a[+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};r.push(n),i[e]={rect:n,metrics:t.metrics}}}const{w:a,h:i}=e.potpack(r),o=new e.AlphaImage({width:a||1,height:i||1});for(const r in t){const a=t[r];for(const t in a){const i=a[+t];if(!i||0===i.bitmap.width||0===i.bitmap.height)continue;const s=n[r][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",a);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,r,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:r},p=n.familiesBySource[this.source];for(const n in p){const a=t.layers[n];if(!a)continue;1===a.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<a.length;e++){const t=a.feature(e),r=c.getId(t,n);s.push({feature:t,id:r,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,r),(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 a(b),n=new e.ImageAtlas(h,f);for(const a in u){const i=u[a];i instanceof e.SymbolBucket?(o(i.layers,this.zoom,r),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,r),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,r){const a=new e.EvaluationParameters(n);for(const e of t)e.recalculate(a,r)}function s(t,n){const r=e.getArrayBuffer(t.request,(t,r,a,i)=>{t?n(t):r&&n(null,{vectorTile:new e.vectorTile.VectorTile(new e.pbf(r)),rawData:r,cacheControl:a,expires:i})});return()=>{r.cancel(),n()}}class l{constructor(e,t,n,r){this.actor=e,this.layerIndex=t,this.availableImages=n,this.loadVectorData=r||s,this.loading={},this.loaded={}}loadTile(t,n){const r=t.uid;this.loading||(this.loading={});const a=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request),o=this.loading[r]=new i(t);o.abort=this.loadVectorData(t,(t,i)=>{if(delete this.loading[r],t||!i)return o.status="done",this.loaded[r]=o,n(t);const s=i.rawData,l={};i.expires&&(l.expires=i.expires),i.cacheControl&&(l.cacheControl=i.cacheControl);const c={};if(a){const e=a.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)))}o.vectorTile=i.vectorTile,o.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor,(t,r)=>{if(t||!r)return n(t);n(null,e.extend({rawTileData:s.slice(0)},r,l,c))}),this.loaded=this.loaded||{},this.loaded[r]=o})}reloadTile(e,t){const n=this.loaded,r=e.uid,a=this;if(n&&n[r]){const i=n[r];i.showCollisionBoxes=e.showCollisionBoxes;const o=(e,n)=>{const r=i.reloadCallback;r&&(delete i.reloadCallback,i.parse(i.vectorTile,a.layerIndex,this.availableImages,a.actor,r)),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,r=e.uid;n&&n[r]&&n[r].abort&&(n[r].abort(),delete n[r]),t()}removeTile(e,t){const n=this.loaded,r=e.uid;n&&n[r]&&delete n[r],t()}}class c{constructor(){this.loaded={}}loadTile(t,n){const{uid:r,encoding:a,rawImageData:i}=t,o=e.isImageBitmap(i)?this.getImageData(i):i,s=new e.DEMData(r,o,a);this.loaded=this.loaded||{},this.loaded[r]=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,r=0,a=0,i=e.length,o=i-1;a<i;o=a++){var s=(e[a][0]-e[o][0])*(e[o][1]+e[a][1]),l=n+s;r+=Math.abs(n)>=Math.abs(s)?n-l+s:s-l+n,n=l}n+r>=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 r=[];for(const t of n)r.push(new e.pointGeometry(t[0],t[1]));t.push(r)}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],r=[],a=0;a<n.length;a++)r.push(new f(n[a][0],n[a][1]));this.geometry.push(r)}return this.geometry},M.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,n=-1/0,r=1/0,a=-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),r=Math.min(r,l.y),a=Math.max(a,l.y)}return[t,r,n,a]},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 r={keys:[],values:[],keycache:{},valuecache:{}};for(n=0;n<e.length;n++)r.feature=e.feature(n),t.writeMessage(2,A,r);var a=r.keys;for(n=0;n<a.length;n++)t.writeStringField(3,a[n]);var i=r.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,r=e.keys,a=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&&(r.push(s),i[s]=c=r.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&&(a.push(l),o[d]=p=a.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(),r=e.type,a=0,i=0,o=n.length,s=0;s<o;s++){var l=n[s],c=1;1===r&&(c=l.length),t.writeVarint(w(1,c));for(var u=3===r?l.length-1:l.length,d=0;d<u;d++){1===d&&1!==r&&t.writeVarint(w(2,u-1));var p=l[d].x-a,m=l[d].y-i;t.writeVarint(N(p)),t.writeVarint(N(m)),a+=p,i+=m}3===r&&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,r,a,i){if(a-r<=n)return;const o=r+a>>1;(function e(t,n,r,a,i,o){for(;i>a;){if(i-a>600){const s=i-a+1,l=r-a+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,r,Math.max(a,Math.floor(r-l*u/s+d)),Math.min(i,Math.floor(r+(s-l)*u/s+d)),o)}const s=n[2*r+o];let l=a,c=i;for(W(t,n,a,r),n[2*i+o]>s&&W(t,n,a,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*a+o]===s?W(t,n,a,c):(c++,W(t,n,c,i)),c<=r&&(a=c+1),r<=c&&(i=c-1)}})(e,t,o,r,a,i%2),j(e,t,n,r,o-1,i+1),j(e,t,n,o+1,a,i+1)}function W(e,t,n,r){L(e,n,r),L(t,2*n,2*r),L(t,2*n+1,2*r+1)}function L(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function S(e,t,n,r){const a=e-n,i=t-r;return a*a+i*i}h.exports=O,h.exports.fromVectorTileJs=O,h.exports.fromGeojsonVt=function(e,t){t=t||{};var n={};for(var r in e)n[r]=new z(e[r].features,t),n[r].name=r,n[r].version=t.version,n[r].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,r=64,a=Float64Array){this.nodeSize=r,this.points=e;const i=e.length<65536?Uint16Array:Uint32Array,o=this.ids=new i(e.length),s=this.coords=new a(2*e.length);for(let r=0;r<e.length;r++)o[r]=r,s[2*r]=t(e[r]),s[2*r+1]=n(e[r]);j(o,s,r,0,o.length-1,0)}range(e,t,n,r){return function(e,t,n,r,a,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<=a&&u>=r&&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<=a&&u>=r&&u<=i&&l.push(e[b]);const h=(d+1)%2;(0===d?n<=c:r<=u)&&(s.push(m),s.push(b-1),s.push(h)),(0===d?a>=c:i>=u)&&(s.push(b+1),s.push(p),s.push(h))}return l}(this.ids,this.coords,e,t,n,r,this.nodeSize)}within(e,t,n){return function(e,t,n,r,a,i){const o=[0,e.length-1,0],s=[],l=a*a;for(;o.length;){const c=o.pop(),u=o.pop(),d=o.pop();if(u-d<=i){for(let a=d;a<=u;a++)S(t[2*a],t[2*a+1],n,r)<=l&&s.push(e[a]);continue}const p=Math.floor((d+u)/2),m=t[2*p],b=t[2*p+1];S(m,b,n,r)<=l&&s.push(e[p]);const h=(c+1)%2;(0===c?n-a<=m:r-a<=b)&&(o.push(d),o.push(p-1),o.push(h)),(0===c?n+a>=m:r+a>=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:r,nodeSize:a}=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[r+1]=new R(o,K,J,a,Float32Array),t&&console.timeEnd(i);for(let e=r;e>=n;e--){const n=+Date.now();o=this._cluster(o,e),this.trees[e]=new R(o,K,J,a,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 r=Math.max(-90,Math.min(90,e[1]));let a=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,a=180;else if(n>a){const e=this.getClusters([n,r,180,i],t),o=this.getClusters([-180,r,a,i],t);return e.concat(o)}const o=this.trees[this._limitZoom(t)],s=o.range(H(n),V(i),H(a),V(r)),l=[];for(const e of s){const t=o.points[e];l.push(t.numPoints?Y(t):this.points[t.index])}return l}getChildren(e){const t=this._getOriginId(e),n=this._getOriginZoom(e),r="No cluster with the specified id.",a=this.trees[n];if(!a)throw new Error(r);const i=a.points[t];if(!i)throw new Error(r);const o=this.options.radius/(this.options.extent*Math.pow(2,n-1)),s=a.within(i.x,i.y,o),l=[];for(const t of s){const n=a.points[t];n.parentId===e&&l.push(n.numPoints?Y(n):this.points[n.index])}if(0===l.length)throw new Error(r);return l}getLeaves(e,t,n){const r=[];return this._appendLeaves(r,e,t=t||10,n=n||0,0),r}getTile(e,t,n){const r=this.trees[this._limitZoom(e)],a=Math.pow(2,e),{extent:i,radius:o}=this.options,s=o/i,l=(n-s)/a,c=(n+1+s)/a,u={features:[]};return this._addTileFeatures(r.range((t-s)/a,l,(t+1+s)/a,c),r.points,t,n,a,u),0===t&&this._addTileFeatures(r.range(1-s/a,l,1,c),r.points,a,n,a,u),t===a-1&&this._addTileFeatures(r.range(0,l,s/a,c),r.points,-1,n,a,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,r,a){const i=this.getChildren(t);for(const t of i){const i=t.properties;if(i&&i.cluster?a+i.point_count<=r?a+=i.point_count:a=this._appendLeaves(e,i.cluster_id,n,r,a):a<r?a++:e.push(t),e.length===n)break}return a}_addTileFeatures(e,t,n,r,a,i){for(const o of e){const e=t[o],s=e.numPoints;let l,c,u;if(s)l=X(e),c=e.x,u=e.y;else{const t=this.points[e.index];l=t.properties,c=H(t.geometry.coordinates[0]),u=V(t.geometry.coordinates[1])}const d={type:1,geometry:[[Math.round(this.options.extent*(c*a-n)),Math.round(this.options.extent*(u*a-r))]],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:r,extent:a,reduce:i,minPoints:o}=this.options,s=r/(a*Math.pow(2,t));for(let r=0;r<e.length;r++){const a=e[r];if(a.zoom<=t)continue;a.zoom=t;const l=this.trees[t+1],c=l.within(a.x,a.y,s),u=a.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=a.x*u,o=a.y*u,s=i&&u>1?this._map(a,!0):null;const p=(r<<5)+(t+1)+this.points.length;for(const n of c){const r=l.points[n];if(r.zoom<=t)continue;r.zoom=t;const c=r.numPoints||1;e+=r.x*c,o+=r.y*c,r.parentId=p,i&&(s||(s=this._map(a,!0)),i(s,this._map(r)))}a.parentId=p,n.push($(e/d,o/d,p,d,s))}else if(n.push(a),d>1)for(const e of c){const r=l.points[e];r.zoom<=t||(r.zoom=t,n.push(r))}}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,r=this.options.map(n);return t&&r===n?G({},r):r}}function $(e,t,n,r,a){return{x:P(e),y:P(t),zoom:1/0,id:n,parentId:-1,numPoints:r,properties:a}}function F(e,t){const[n,r]=e.geometry.coordinates;return{x:P(H(n)),y:P(V(r)),zoom:1/0,index:t,parentId:-1}}function Y(e){return{type:"Feature",id:e.id,properties:X(e),geometry:{type:"Point",coordinates:[(t=e.x,360*(t-.5)),U(e.y)]}};var t}function X(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 V(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 U(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,r,a,i){var o=a-n,s=i-r;if(0!==o||0!==s){var l=((e-n)*o+(t-r)*s)/(o*o+s*s);l>1?(n=a,r=i):l>0&&(n+=o*l,r+=s*l)}return(o=e-n)*o+(s=t-r)*s}function Q(e,t,n,r){var a={id:void 0===e?null:e,type:t,geometry:n,tags:r,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 r=0;r<t.length;r++)ee(e,t[r]);else if("MultiPolygon"===n)for(r=0;r<t.length;r++)for(var a=0;a<t[r].length;a++)ee(e,t[r][a])}(a),a}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,r){if(t.geometry){var a=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=r||0),"Point"===i)ne(a,s);else if("MultiPoint"===i)for(var c=0;c<a.length;c++)ne(a[c],s);else if("LineString"===i)re(a,s,o,!1);else if("MultiLineString"===i){if(n.lineMetrics){for(c=0;c<a.length;c++)re(a[c],s=[],o,!1),e.push(Q(l,"LineString",s,t.properties));return}ae(a,s,o,!1)}else if("Polygon"===i)ae(a,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,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(c=0;c<a.length;c++){var u=[];ae(a[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 re(e,t,n,r){for(var a,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+=r?(a*c-l*i)/2:Math.sqrt(Math.pow(l-a,2)+Math.pow(c-i,2))),a=l,i=c}var u=t.length-3;t[2]=1,function e(t,n,r,a){for(var i,o=a,s=r-n>>1,l=r-n,c=t[n],u=t[n+1],d=t[r],p=t[r+1],m=n+3;m<r;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>a&&(i-n>3&&e(t,n,i,a),t[i+2]=o,r-i>3&&e(t,i,r,a))}(t,0,u,n),t[u+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function ae(e,t,n,r){for(var a=0;a<e.length;a++){var i=[];re(e[a],i,n,r),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,r,a,i,o,s){if(r/=t,i>=(n/=t)&&o<r)return e;if(o<n||i>=r)return null;for(var l=[],c=0;c<e.length;c++){var u=e[c],d=u.geometry,p=u.type,m=0===a?u.minX:u.minY,b=0===a?u.maxX:u.maxY;if(m>=n&&b<r)l.push(u);else if(!(b<n||m>=r)){var h=[];if("Point"===p||"MultiPoint"===p)le(d,h,n,r,a);else if("LineString"===p)ce(d,h,n,r,a,!1,s.lineMetrics);else if("MultiLineString"===p)de(d,h,n,r,a,!1);else if("Polygon"===p)de(d,h,n,r,a,!0);else if("MultiPolygon"===p)for(var f=0;f<d.length;f++){var g=[];de(d[f],g,n,r,a,!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,r,a){for(var i=0;i<e.length;i+=3){var o=e[i+a];o>=n&&o<=r&&(t.push(e[i]),t.push(e[i+1]),t.push(e[i+2]))}}function ce(e,t,n,r,a,i,o){for(var s,l,c=ue(e),u=0===a?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===a?m:b,y=0===a?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)):_>r?y<r&&(l=u(c,m,b,f,g,r),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>r&&_<=r&&(l=u(c,m,b,f,g,r),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===a?m:b)>=n&&_<=r&&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,r,a,i){for(var o=0;o<e.length;o++)ce(e[o],t,n,r,a,i,!1)}function pe(e,t,n,r){e.push(t),e.push(n),e.push(r)}function me(e,t,n,r,a,i){var o=(i-t)/(r-t);return e.push(i),e.push(n+(a-n)*o),e.push(1),o}function be(e,t,n,r,a,i){var o=(i-n)/(a-n);return e.push(t+(r-t)*o),e.push(i),e.push(1),o}function he(e,t){for(var n=[],r=0;r<e.length;r++){var a,i=e[r],o=i.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)a=fe(i.geometry,t);else if("MultiLineString"===o||"Polygon"===o){a=[];for(var s=0;s<i.geometry.length;s++)a.push(fe(i.geometry[s],t))}else if("MultiPolygon"===o)for(a=[],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));a.push(l)}n.push(Q(i.id,o,a,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 r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}function ge(e,t){if(e.transformed)return e;var n,r,a,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(r=0;r<c.length;r+=2)l.geometry.push(_e(c[r],c[r+1],t,i,o,s));else for(r=0;r<c.length;r++){var d=[];for(a=0;a<c[r].length;a+=2)d.push(_e(c[r][a],c[r][a+1],t,i,o,s));l.geometry.push(d)}}return e.transformed=!0,e}function _e(e,t,n,r,a,i){return[Math.round(n*(e*r-a)),Math.round(n*(t*r-i))]}function ye(e,t,n,r,a){for(var i=t===a.maxZoom?0:a.tolerance/((1<<t)*a.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:r,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,a);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,r){var a=t.geometry,i=t.type,o=[];if("Point"===i||"MultiPoint"===i)for(var s=0;s<a.length;s+=3)o.push(a[s]),o.push(a[s+1]),e.numPoints++,e.numSimplified++;else if("LineString"===i)ve(o,a,e,n,!1,!1);else if("MultiLineString"===i||"Polygon"===i)for(s=0;s<a.length;s++)ve(o,a[s],e,n,"Polygon"===i,0===s);else if("MultiPolygon"===i)for(var l=0;l<a.length;l++){var c=a[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&&r.lineMetrics){for(var d in u={},t.tags)u[d]=t.tags[d];u.mapbox_clip_start=a.start/a.size,u.mapbox_clip_end=a.end/a.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,r,a,i){var o=r*r;if(r>0&&t.size<(a?o:r))n.numPoints+=t.length/3;else{for(var s=[],l=0;l<t.length;l+=3)(0===r||t[l+2]>o)&&(n.numSimplified++,s.push(t[l]),s.push(t[l+1])),n.numPoints++;a&&function(e,t){for(var n=0,r=0,a=e.length,i=a-2;r<a;i=r,r+=2)n+=(e[r]-e[i])*(e[r+1]+e[i+1]);if(n>0===t)for(r=0,a=e.length;r<a/2;r+=2){var o=e[r],s=e[r+1];e[r]=e[a-2-r],e[r+1]=e[a-1-r],e[a-2-r]=o,e[a-1-r]=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 r=function(e,t){var n=[];if("FeatureCollection"===e.type)for(var r=0;r<e.features.length;r++)te(n,e.features[r],t,r);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),(r=function(e,t){var n=t.buffer/t.extent,r=e,a=se(e,1,-1-n,n,0,-1,2,t),i=se(e,1,1-n,2+n,0,-1,2,t);return(a||i)&&(r=se(e,1,-n,1+n,0,-1,2,t)||[],a&&(r=he(a,1).concat(r)),i&&(r=r.concat(he(i,-1)))),r}(r,t)).length&&this.splitTile(r,0,0,0),n&&(r.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 r=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!r)return t(null,null);const a=new b(r.features);let i=h.exports(a);0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),t(null,{vectorTile:a,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,r,a,i,o){for(var s=[e,t,n,r],l=this.options,c=l.debug;s.length;){r=s.pop(),n=s.pop(),t=s.pop(),e=s.pop();var u=1<<t,d=Oe(t,n,r),p=this.tiles[d];if(!p&&(c>1&&console.time("creation"),p=this.tiles[d]=ye(e,t,n,r,l),this.tileCoords.push({z:t,x:n,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,n,r,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,a){if(t===l.maxZoom||t===a)continue;var b=1<<a-t;if(n!==Math.floor(i/b)||r!==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,r-v,r+O,1,p.minY,p.maxY,l),f=se(y,u,r+z,r+k,1,p.minY,p.maxY,l),y=null),M&&(g=se(M,u,r-v,r+O,1,p.minY,p.maxY,l),_=se(M,u,r+z,r+k,1,p.minY,p.maxY,l),M=null),c>1&&console.timeEnd("clipping"),s.push(h||[],t+1,2*n,2*r),s.push(f||[],t+1,2*n,2*r+1),s.push(g||[],t+1,2*n+1,2*r),s.push(_||[],t+1,2*n+1,2*r+1)}}},ze.prototype.getTile=function(e,t,n){var r=this.options,a=r.extent,i=r.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],a);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],a):null):null};class Ae extends l{constructor(e,t,n,r){super(e,t,n,ke),r&&(this.loadGeoJSON=r)}loadData(t,n){var r;null===(r=this._pendingRequest)||void 0===r||r.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const a=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.RequestPerformance(t.request);this._pendingCallback=n,this._pendingRequest=this.loadGeoJSON(t,(r,i)=>{if(delete this._pendingCallback,delete this._pendingRequest,r||!i)return n(r);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 r,a=t&&t.type;if("FeatureCollection"===a)for(r=0;r<t.features.length;r++)e(t.features[r],n);else if("GeometryCollection"===a)for(r=0;r<t.geometries.length;r++)e(t.geometries[r],n);else if("Feature"===a)e(t.geometry,n);else if("Polygon"===a)u(t.coordinates,n);else if("MultiPolygon"===a)for(r=0;r<t.coordinates.length;r++)u(t.coordinates[r],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 r=i.features.filter(e=>n.value.evaluate({zoom:0},e));i={type:"FeatureCollection",features:r}}this._geoJSONIndex=t.cluster?new I(function({superclusterOptions:t,clusterProperties:n}){if(!n||!t)return t;const r={},a={},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);r[t]=s.value,a[t]=l.value}return t.map=e=>{o.properties=e;const t={};for(const e of s)t[e]=r[e].evaluate(i,o);return t},t.reduce=(e,t)=>{o.properties=t;for(const t of s)i.accumulated=e[t],e[t]=a[t].evaluate(i,o)},t}(t)).load(i.features):function(e,t){return new ze(e,t)}(i,t.geojsonVtOptions)}catch(r){return n(r)}this.loaded={};const o={};if(a){const e=a.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 r=this.workerSources[e][n];for(const e in r)r[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 r=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==r.removeSource?r.removeSource(t,n):n()}loadWorkerSource(e,t,n){try{this.self.importScripts(t.url),n()}catch(e){n(e.toString())}}syncRTLPluginState(t,n,r){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();r(n?void 0:new Error("RTL Text Plugin failed to import scripts from "+t),n)}}catch(e){r(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 r),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 r={send:(t,n,r)=>{this.actor.send(t,n,r,e)}};this.workerSources[e][t][n]=new this.workerSourceTypes[t](r,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})),r(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"}),r=URL.createObjectURL(n);try{t=new Worker(r),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(r),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===r[t=e&&e.failIfMajorPerformanceCaveat]&&(r[t]=function(e){var t,r=function(e){var t=document.createElement("canvas"),r=Object.create(n.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=e,t.getContext("webgl",r)||t.getContext("experimental-webgl",r)}(e);if(!r)return!1;try{t=r.createShader(r.VERTEX_SHADER)}catch(e){return!1}return!(!t||r.isContextLost())&&(r.shaderSource(t,"void main() {}"),r.compileShader(t),!0===r.getShaderParameter(t,r.COMPILE_STATUS))}(t)),r[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 r={};function a(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(!a(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(!a(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 r=window.document.createElement(e);return void 0!==t&&(r.className=t),n&&n.appendChild(r),r}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,r={}){e.addEventListener(t,n,"passive"in r?r:r.capture)}static removeEventListener(e,t,n,r={}){e.removeEventListener(t,n,"passive"in r?r:r.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 r=t.getBoundingClientRect();return new e.pointGeometry(n.clientX-r.left-t.clientLeft,n.clientY-r.top-t.clientTop)}static touchPos(t,n){const r=t.getBoundingClientRect(),a=[];for(let i=0;i<n.length;i++)a.push(new e.pointGeometry(n[i].clientX-r.left-t.clientLeft,n[i].clientY-r.top-t.clientTop));return a}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 r=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 r.path+=`${t}${n}`,function(e){const t=e.params.length?"?"+e.params.join("&"):"";return`${e.protocol}://${e.authority}${e.path}${t}`}(r)}setTransformRequest(e){this._transformRequestFn=e}}const s=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class l{constructor(e,t,n,r){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(t,r)}update(t,n,r){const{width:a,height:i}=t,o=!(this.size&&this.size[0]===a&&this.size[1]===i||r),{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=[a,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,a,i,0,this.format,l.UNSIGNED_BYTE,t.data);else{const{x:n,y:o}=r||{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,a,i,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(e,t,n){const{context:r}=this,{gl:a}=r;a.bindTexture(a.TEXTURE_2D,this.texture),n!==a.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=a.LINEAR),e!==this.filter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,t),a.texParameteri(a.TEXTURE_2D,a.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 r=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),r=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),r=!1),this._validateContent(n.content,n)||(this.fire(new e.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let n=0;for(const r of e){if(r[0]<n||r[1]<r[0]||t<r[1])return!1;n=r[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 r={};for(const n of t){this.images[n]||this.fire(new e.Event("styleimagemissing",{id:n}));const t=this.images[n];t?r[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,r)}getPixelSize(){const{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(t){const n=this.patterns[t],r=this.getImage(t);if(!r)return null;if(n&&n.position.version===r.version)return n.position;if(n)n.position.version=r.version;else{const n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},a=new e.ImagePosition(n,r);this.patterns[t]={bin:n,position:a}}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:r}=e.potpack(t),a=this.atlasImage;a.resize({width:n||1,height:r||1});for(const t in this.patterns){const{bin:n}=this.patterns[t],r=n.x+1,i=n.y+1,o=this.images[t].data,s=o.width,l=o.height;e.RGBAImage.copy(o,a,{x:0,y:0},{x:r,y:i},{width:s,height:l}),e.RGBAImage.copy(o,a,{x:0,y:l-1},{x:r,y:i-1},{width:s,height:1}),e.RGBAImage.copy(o,a,{x:0,y:0},{x:r,y:i+l},{width:s,height:1}),e.RGBAImage.copy(o,a,{x:s-1,y:0},{x:r-1,y:i},{width:1,height:l}),e.RGBAImage.copy(o,a,{x:0,y:0},{x:r+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,r,a,i,o,s,l){for(let c=t;c<t+r;c++)m(e,n*i+c,i,a,o,s,l);for(let c=n;c<n+a;c++)m(e,c*i+t,1,r,o,s,l)}function m(e,t,n,r,a,i,o){i[0]=0,o[0]=-d,o[1]=d,a[0]=e[t];for(let s=1,l=0,c=0;s<r;s++){a[s]=e[t+s*n];const r=s*s;do{const e=i[l];c=(a[s]-a[e]+r-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<r;s++){for(;o[l+1]<s;)l++;const r=i[l],c=s-r;e[t+s*n]=a[r]+c*c}}class b{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}getGlyphs(t,n){const r=[];for(const e in t)for(const n of t[e])r.push({stack:e,id:n});e.asyncAll(r,({stack:e,id:t},n)=>{let r=this.entries[e];r||(r=this.entries[e]={glyphs:{},requests:{},ranges:{}});let a=r.glyphs[t];if(void 0!==a)return void n(null,{stack:e,id:t,glyph:a});if(a=this._tinySDF(r,e,t),a)return r.glyphs[t]=a,void n(null,{stack:e,id:t,glyph:a});const i=Math.floor(t/256);if(256*i>65535)return void n(new Error("glyphs > 65535 not supported"));if(r.ranges[i])return void n(null,{stack:e,id:t,glyph:a});let o=r.requests[i];o||(o=r.requests[i]=[],b.loadGlyphRange(e,i,this.url,this.requestManager,(e,t)=>{if(t){for(const e in t)this._doesCharSupportLocalGlyph(+e)||(r.glyphs[+e]=t[+e]);r.ranges[i]=!0}for(const n of o)n(e,t);delete r.requests[i]})),o.push((r,a)=>{r?n(r):a&&n(null,{stack:e,id:t,glyph:a[t]||null})})},(e,t)=>{if(e)n(e);else if(t){const e={};for(const{stack:n,id:r,glyph:a}of t)(e[n]||(e[n]={}))[r]=a&&{id:a.id,bitmap:a.bitmap.clone(),metrics:a.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,r){const a=this.localIdeographFontFamily;if(!a)return;if(!this._doesCharSupportLocalGlyph(r))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:a,fontWeight:e})}const o=i.draw(String.fromCharCode(r));return{id:r,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,r,a,i){const o=256*n,s=o+255,l=a.transformRequest(r.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 r of e.parseGlyphPbf(n))t[r.id]=r;i(null,t)}})},b.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:r=.25,fontFamily:a="sans-serif",fontWeight:i="normal",fontStyle:o="normal"}={}){this.buffer=t,this.cutoff=r,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 ${a}`,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:r,actualBoundingBoxLeft:a,actualBoundingBoxRight:i}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.min(this.size-this.buffer,Math.ceil(i-a)),l=Math.min(this.size-this.buffer,o+Math.ceil(r)),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 r=(e+g)*c+t+g;if(1===n)y[r]=0,_[r]=d;else{const e=.5-n;y[r]=e>0?e*e:0,_[r]=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,r){return{x:e.number(t.x,n.x,r),y:e.number(t.y,n.y,r),z:e.number(t.z,n.z,r)}}},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,r){return(!r||!1!==r.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 r=[];let a=e.length%2==1?-e[e.length-1]*n:0,i=e[0]*n,o=!0;r.push({left:a,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];a=s*n,s+=l,i=s*n,r.push({left:a,right:i,isDash:o,zeroLength:0===l})}return r}addRoundDash(e,t,n){const r=t/2;for(let t=-n;t<=n;t++){const a=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*(r+1);if(o.isDash){const e=r-Math.abs(p);d=Math.sqrt(u*u+e*e)}else d=r-Math.sqrt(u*u+p*p);this.data[a+s]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){const n=e[t],r=e[t+1];n.zeroLength?e.splice(t,1):r&&r.isDash===n.isDash&&(r.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 r=this.width*this.nextRow;let a=0,i=e[a];for(let t=0;t<this.width;t++){t/i.right>1&&(i=e[++a]);const n=Math.abs(t-i.left),o=Math.abs(t-i.right),s=Math.min(n,o);this.data[r+t]=Math.max(0,Math.min(255,(i.isDash?s:-s)+128))}}addDash(t,n){const r=n?7:0,a=2*r+1;if(this.nextRow+a>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,a=this.getDashRanges(t,this.width,e);n?this.addRoundDash(a,e,r):this.addRegularDash(a)}const o={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:i};return this.nextRow+=a,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 r=this.workerPool.acquire(this.id);for(let e=0;e<r.length;e++){const t=new y.Actor(r[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,r){e.asyncAll(this.actors,(e,r)=>{e.send(t,n,r)},r=r||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,r){const a=function(n,a){if(n)return r(n);if(a){const n=e.pick(e.extend(a,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);a.vector_layers&&(n.vectorLayers=a.vector_layers,n.vectorLayerIds=n.vectorLayers.map(e=>e.id)),r(null,n)}};return t.url?e.getJSON(n.transformRequest(t.url,e.ResourceType.Source),a):e.exported.frame(()=>a(null,t))}y.Actor=e.Actor;class v{constructor(t,n,r){this.bounds=e.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=r||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),r=Math.floor(e.mercatorXfromLng(this.bounds.getWest())*n),a=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>=r&&t.x<i&&t.y>=a&&t.y<o}}class z extends e.Evented{constructor(t,n,r,a){if(super(),this.id=t,this.dispatcher=r,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(a)}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 r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:this.map._requestManager.transformRequest(r,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(r,a){return delete t.request,t.aborted?n(null):r&&404!==r.status?n(r):(a&&a.resourceTiming&&(t.resourceTiming=a.resourceTiming),this.map._refreshExpiredTiles&&a&&t.setExpiryData(a),t.loadVectorData(a,this.map.painter),e.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}a.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state?"loading"===t.state?t.reloadCallback=n:t.request=t.actor.send("reloadTile",a,i.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",a,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,r,a){super(),this.id=t,this.dispatcher=r,this.setEventedParent(a),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 r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=e.getImage(this.map._requestManager.transformRequest(r,e.ResourceType.Tile),(r,a,i)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(r)t.state="errored",n(r);else if(a){this.map._refreshExpiredTiles&&t.setExpiryData(i);const r=this.map.painter.context,o=r.gl;t.texture=this.map.painter.getTileTexture(a.width),t.texture?t.texture.update(a,{useMipmap:!0}):(t.texture=new l(r,a,o.RGBA,{useMipmap:!0}),t.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),r.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.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,r,a){super(t,n,r,a),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 r=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function a(e,r){e&&(t.state="errored",n(e)),r&&(t.dem=r,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=e.getImage(this.map._requestManager.transformRequest(r,e.ResourceType.Tile),function(r,i){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(r)t.state="errored",n(r);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),r={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",r,a.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,r=Math.pow(2,n.z),a=(n.x-1+r)%r,i=0===n.x?t.wrap-1:t.wrap,o=(n.x+1+r)%r,s=n.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.OverscaledTileID(t.overscaledZ,i,n.z,a,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,a,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<r&&(l[new e.OverscaledTileID(t.overscaledZ,i,n.z,a,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,r,a){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=r.getActor(),this.setEventedParent(a),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,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:t,offset:n},r),this}_updateWorkerData(t){const n=e.extend({},this.workerOptions),r=this._data;"string"==typeof r?(n.request=this.map._requestManager.transformRequest(e.exported.resolveURL(r),e.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(r),this._pendingLoads++,this.fire(new e.Event("dataloading",{dataType:"source"})),this.actor.send(this.type+".loadData",n,(n,r)=>{if(this._pendingLoads--,this._removed||r&&r.abandoned)return void this.fire(new e.Event("dataabort",{dataType:"source",sourceDataType:t}));let a=null;if(r&&r.resourceTiming&&r.resourceTiming[this.id]&&(a=r.resourceTiming[this.id].slice(0)),n)return void this.fire(new e.ErrorEvent(n));const i={dataType:"source",sourceDataType:t};this._collectResourceTiming&&a&&a.length>0&&e.extend(i,{resourceTiming:a}),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 r={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.request=this.actor.send(n,r,(r,a)=>(delete e.request,e.unloadVectorData(),e.aborted?t(null):r?t(r):(e.loadVectorData(a,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,r){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(r),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),(r,a)=>{this._loaded=!0,r?this.fire(new e.ErrorEvent(r)):a&&(this.image=a,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,r=1/0,a=-1/0,i=-1/0;for(const e of t)n=Math.min(n,e.x),r=Math.min(r,e.y),a=Math.max(a,e.x),i=Math.max(i,e.y);const o=Math.max(a-n,i-r),s=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),l=Math.pow(2,s);return new e.CanonicalTileID(s,Math.floor((n+a)/2*l),Math.floor((r+i)/2*l))}(n),this.minzoom=this.maxzoom=this.tileID.z;const r=n.map(e=>this.tileID.getTilePoint(e)._round());return this._boundsArray=new e.RasterBoundsArray,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,e.EXTENT,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,e.EXTENT),this._boundsArray.emplaceBack(r[2].x,r[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,r){super(e,t,n,r),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,r,a){super(t,n,r,a),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,r=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,r.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 r=e.create();return e.translate(r,r,[1,1,0]),e.scale(r,r,[.5*t.width,.5*t.height,1]),e.multiply(r,r,t.calculatePosMatrix(n.toUnwrapped()))}function L(e,t,n,r,a,i){const o=function(e,t,n){if(e)for(const r of e){const e=t[r];if(e&&e.source===n&&"fill-extrusion"===e.type)return!0}else for(const e in t){const r=t[e];if(r.source===n&&"fill-extrusion"===r.type)return!0}return!1}(a&&a.layers,t,e.id),s=i.maxPitchScaleFactor(),l=e.tilesIn(r,s,o);l.sort(S);const c=[];for(const r of l)c.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,n,e._state,r.queryGeometry,r.cameraQueryGeometry,r.scale,a,i,s,W(e.transform,r.tileID))});const u=function(e){const t={},n={};for(const r of e){const e=r.queryResults,a=r.wrappedTileID,i=n[a]=n[a]||{};for(const n in e){const r=e[n],a=i[n]=i[n]||{},o=t[n]=t[n]||[];for(const e of r)a[e.featureIndex]||(a[e.featureIndex]=!0,o.push(e))}}return t}(c);for(const t in u)u[t].forEach(t=>{const n=t.feature,r=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=r});return u}function S(e,t){const n=e.tileID,r=t.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.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,r){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 r of e){const e=r.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(const t of e)n[t.id]=r}}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,!r)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,r,a,i,o,s,l,c){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:a,scale:i,tileSize:this.tileSize,pixelPosMatrix:c,transform:s,params:o,queryPadding:this.queryPadding*l},e,t,n):{}}querySourceFeatures(t,n){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const a=r.loadVTLayers(),i=n?n.sourceLayer:"",o=a._geojsonTileLayer||a[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 a=o.feature(n);if(s.needGeometry){const t=e.toEvaluationFeature(a,!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),a))continue;const p=r.getId(a,i),m=new e.GeoJSONFeature(a,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 r=this.expirationTime-n;r?this.expirationTime=e+Math.max(r,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 r in this.buckets){if(!t.style.hasLayer(r))continue;const a=this.buckets[r],i=a.layers[0].sourceLayer||"_geojsonTileLayer",o=n[i],s=e[i];if(!o||!s||0===Object.keys(s).length)continue;a.update(s,o,this.imageAtlas&&this.imageAtlas.patternPositions||{});const l=t&&t.style&&t.style.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(a)))}}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 r=e.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);const a={value:t,timeout:void 0};if(void 0!==n&&(a.timeout=setTimeout(()=>{this.remove(e,a)},n)),this.data[r].push(a),this.order.push(r),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,r=void 0===t?0:this.data[n].indexOf(t),a=this.data[n][r];return this.data[n].splice(r,1),a.timeout&&clearTimeout(a.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(a.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 r of this.data[n])e(r.value)||t.push(r);for(const e of t)this.remove(e.value.tileID,e)}}class R{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,r){const a=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][a]=this.stateChanges[t][a]||{},e.extend(this.stateChanges[t][a],r),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==a&&(this.deletedStates[t][e]=null)}else if(this.deletedStates[t]&&null===this.deletedStates[t][a]){this.deletedStates[t][a]={};for(const e in this.state[t][a])r[e]||(this.deletedStates[t][a][e]=null)}else for(const e in r)this.deletedStates[t]&&this.deletedStates[t][a]&&null===this.deletedStates[t][a][e]&&delete this.deletedStates[t][a][e]}removeFeatureState(e,t,n){if(null===this.deletedStates[e])return;const r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][n]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(n in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][n]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(t,n){const r=String(n),a=e.extend({},(this.state[t]||{})[r],(this.stateChanges[t]||{})[r]);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 a[t]}return a}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(t,n){const r={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const n={};for(const r in this.stateChanges[t])this.state[t][r]||(this.state[t][r]={}),e.extend(this.state[t][r],this.stateChanges[t][r]),n[r]=this.state[t][r];r[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]}r[t]=r[t]||{},e.extend(r[t],n)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(const e in t)t[e].setFeatureState(r,n)}}class D extends e.Evented{constructor(t,n,r){super(),this.id=t,this.dispatcher=r,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,r,a){const i=new j[n.type](t,n,r,a);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,r,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 r=t.tileID,a=n.tileID,i=new e.pointGeometry(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),o=new e.pointGeometry(a.canonical.x,a.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-a.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,r,a){if(a)return t.state="errored",void(404!==a.status?this._source.fire(new e.ErrorEvent(a,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=e.exported.now(),"expired"===r&&(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 r=0;r<t.length;r++){const a=t[r];if(e.neighboringTiles&&e.neighboringTiles[a]){const t=this.getTileByID(a);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 r=t.tileID.canonical.y-e.tileID.canonical.y,a=Math.pow(2,e.tileID.canonical.z),i=t.tileID.key;0===n&&0===r||Math.abs(r)>1||(Math.abs(n)>1&&(1===Math.abs(n+a)?n+=a:1===Math.abs(n-a)&&(n-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,n,r),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,r){for(const a in this._tiles){let i=this._tiles[a];if(r[a]||!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]){r[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),r=this._getLoadedTile(t);if(r)return r}}_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,r=Math.floor(t*n*5),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(a)}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 r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}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 r;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?r=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(t=>new e.OverscaledTileID(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)):(r=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&&(r=r.filter(e=>this._source.hasTile(e)))):r=[];const a=t.coveringZoomLevel(this._source),i=Math.max(a-D.maxOverzooming,this._source.minzoom),o=Math.max(a+D.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const e={};for(const t of r)if(t.canonical.z>this._source.minzoom){const n=t.scaledTo(t.canonical.z-1);e[n.key]=n;const r=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[r.key]=r}r=r.concat(Object.values(e))}const s=this._updateRetainedTiles(r,a);if(B(this._source.type)){const t={},l={},c=Object.keys(s);for(const n of c){const r=s[n],a=this._tiles[n];if(!a||a.fadeEndTime&&a.fadeEndTime<=e.exported.now())continue;const o=this.findLoadedParent(r,i);o&&(this._addTile(o.tileID),t[o.tileID.key]=o.tileID),l[n]=r}this._retainLoadedChildren(l,a,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 r)this._tiles[n.key].hasData()?e[n.key]=n:t[n.key]=n;for(const n in t){const r=t[n].children(this._source.maxzoom);this._tiles[r[0].key]&&this._tiles[r[1].key]&&this._tiles[r[2].key]&&this._tiles[r[3].key]&&(e[r[0].key]=s[r[0].key]=r[0],e[r[1].key]=s[r[1].key]=r[1],e[r[2].key]=s[r[2].key]=r[2],e[r[3].key]=s[r[3].key]=r[3],delete t[n])}for(const n in t){const r=this.findLoadedParent(t[n],this._source.minzoom);if(r){e[r.tileID.key]=s[r.tileID.key]=r.tileID;for(const t in e)e[t].isChildOf(r.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={},r={},a=Math.max(t-D.maxOverzooming,this._source.minzoom),i=Math.max(t+D.maxUnderzooming,this._source.minzoom),o={};for(const r of e){const e=this._addTile(r);n[r.key]=r,e.hasData()||t<this._source.maxzoom&&(o[r.key]=r)}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>=a;--t){const a=i.scaledTo(t);if(r[a.key])break;if(r[a.key]=!0,e=this.getTile(a),!e&&o&&(e=this._addTile(a)),e&&(n[a.key]=a,o=e.wasRequested(),e.hasData()))break}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const t=[];let n,r=this._tiles[e].tileID;for(;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){n=this._loadedParentTiles[r.key];break}t.push(r.key);const e=r.scaledTo(r.overscaledZ-1);if(n=this._getLoadedTile(e),n)break;r=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 r=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,r||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,r){const a=[],i=this.transform;if(!i)return a;const o=r?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 r=this._tiles[c[t]];if(r.holdingForFade())continue;const o=r.tileID,b=Math.pow(2,i.zoom-r.tileID.overscaledZ),h=n*r.queryPadding*e.EXTENT/r.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));a.push({tile:r,tileID:o,queryGeometry:e,cameraQueryGeometry:t,scale:b})}}return a}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 r=this._tiles[e];r&&r.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),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-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(Ma.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 Y;function X(){return Y||(Y=new $),Y}function H(t,n){const r={};for(const e in t)"ref"!==e&&(r[e]=t[e]);return e.refProperties.forEach(e=>{e in n&&(r[e]=n[e])}),r}function V(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 U={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:U.addSource,args:[e,t[e]]})}function K(e,t,n){t.push({command:U.removeSource,args:[e]}),n[e]=!0}function J(e,t,n,r){K(e,n,r),G(e,t,n)}function Z(e,t,n){let r;for(r in e[n])if(Object.prototype.hasOwnProperty.call(e[n],r)&&"data"!==r&&!a(e[n][r],t[n][r]))return!1;for(r in t[n])if(Object.prototype.hasOwnProperty.call(t[n],r)&&"data"!==r&&!a(e[n][r],t[n][r]))return!1;return!0}function Q(e,t,n,r,i,o){let s;for(s in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,s)&&(a(e[s],t[s])||n.push({command:o,args:[r,s,t[s],i]}));for(s in t)Object.prototype.hasOwnProperty.call(t,s)&&!Object.prototype.hasOwnProperty.call(e,s)&&(a(e[s],t[s])||n.push({command:o,args:[r,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,r=this._distances[n];const a=t*this.paddedLength+this.padding;for(;r<a&&n<this._distances.length;)r=this._distances[++n];const i=n-1,o=this._distances[i],s=r-o,l=s>0?(a-o)/s:0;return this.points[i].mult(1-l).add(this.points[n].mult(l))}}function re(e,t){let n=!0;return"always"===e||"never"!==e&&"never"!==t||(n=!1),n}class ae{constructor(e,t,n){const r=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),a.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,r,a){this._forEachCell(t,n,r,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(a)}insertCircle(e,t,n,r){this._forEachCell(t-r,n-r,t+r,n+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(r)}_insertBoxCell(e,t,n,r,a,i){this.boxCells[a].push(i)}_insertCircleCell(e,t,n,r,a,i){this.circleCells[a].push(i)}_query(e,t,n,r,a,i,o){if(n<0||e>this.width||r<0||t>this.height)return[];const s=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(a)return[{key:null,x1:e,y1:t,x2:n,y2:r}];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],r=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-r,y1:n-r,x2:t+r,y2:n+r})}}else this._forEachCell(e,t,n,r,this._queryCell,s,{hitTest:a,overlapMode:i,seenUids:{box:{},circle:{}}},o);return s}query(e,t,n,r){return this._query(e,t,n,r,!1,null)}hitTest(e,t,n,r,a,i){return this._query(e,t,n,r,!0,a,i).length>0}hitTestCircle(e,t,n,r,a){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:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},a),c.length>0}_queryCell(e,t,n,r,a,i,o,s){const{seenUids:l,hitTest:c,overlapMode:u}=o,d=this.boxCells[a];if(null!==d){const a=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<=a[d+2]&&t<=a[d+3]&&n>=a[d+0]&&r>=a[d+1]&&(!s||s(p))&&(!c||!re(u,p.overlapMode))&&(i.push({key:p,x1:a[d],y1:a[d+1],x2:a[d+2],y2:a[d+3]}),c))return!0}}const p=this.circleCells[a];if(null!==p){const a=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(a[d],a[d+1],a[d+2],e,t,n,r)&&(!s||s(p))&&(!c||!re(u,p.overlapMode))){const e=a[d],t=a[d+1],n=a[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,r,a,i,o,s){const{circle:l,seenUids:c,overlapMode:u}=o,d=this.boxCells[a];if(null!==d){const e=this.bboxes;for(const t of d)if(!c.box[t]){c.box[t]=!0;const n=4*t,r=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(r))&&!re(u,r.overlapMode))return i.push(!0),!0}}const p=this.circleCells[a];if(null!==p){const e=this.circles;for(const t of p)if(!c.circle[t]){c.circle[t]=!0;const n=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[n],e[n+1],e[n+2],l.x,l.y,l.radius)&&(!s||s(r))&&!re(u,r.overlapMode))return i.push(!0),!0}}}_forEachCell(e,t,n,r,a,i,o,s){const l=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(r);for(let p=l;p<=u;p++)for(let l=c;l<=d;l++)if(a.call(this,e,t,n,r,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,r,a,i){const o=r-e,s=a-t,l=n+i;return l*l>o*o+s*s}_circleAndRectCollide(e,t,n,r,a,i,o){const s=(i-r)/2,l=Math.abs(e-(r+s));if(l>s+n)return!1;const c=(o-a)/2,u=Math.abs(t-(a+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,r,a,i){const o=e.create();return n?(e.scale(o,o,[1/i,1/i,1]),r||e.rotateZ(o,o,a.angle)):e.multiply(o,a.labelPlaneMatrix,t),o}function oe(t,n,r,a,i){if(n){const n=e.clone(t);return e.scale(n,n,[i,i,1]),r||e.rotateZ(n,n,-a.angle),n}return a.glCoordMatrix}function se(t,n,r){let a;r?(a=[t.x,t.y,r(t.x,t.y),1],e.transformMat4(a,a,n)):(a=[t.x,t.y,0,1],_e(a,a,n));const i=a[3];return{point:new e.pointGeometry(a[0]/i,a[1]/i),signedDistanceFromCamera:i}}function le(e,t){return.5+e/t*.5}function ce(e,t){const n=e[0]/e[3],r=e[1]/e[3];return n>=-t[0]&&n<=t[0]&&r>=-t[1]&&r<=t[1]}function ue(t,n,r,a,i,o,s,l,c,u){const d=a?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(d,r.transform.zoom),m=[256/r.width*2+1,256/r.height*2+1],b=a?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;b.clear();const h=t.lineVertexArray,f=a?t.text.placedSymbolArray:t.icon.placedSymbolArray,g=r.transform.width/r.transform.height;let _=!1;for(let a=0;a<f.length;a++){const y=f.get(a);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(r.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)}a?t.text.dynamicLayoutVertexBuffer.updateData(b):t.icon.dynamicLayoutVertexBuffer.updateData(b)}function de(e,t,n,r,a,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,r,a,i,o,s.segment,b,h,l,c,u,d,p);if(!_)return null;const y=he(e*g,n,r,a,i,o,s.segment,b,h,l,c,u,d,p);return y?{first:_,last:y}:null}function pe(t,n,r,a){return t===e.WritingMode.horizontal&&Math.abs(r.y-n.y)>Math.abs(r.x-n.x)*a?{useVertical:!0}:(t===e.WritingMode.vertical?n.y<r.y:n.x>r.x)?{needsFlipping:!0}:null}function me(t,n,r,a,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,r,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(a&&!r){const e=pe(t.writingMode,v,z,b);if(e)return e}M=[u.first];for(let a=t.glyphStartIndex+1;a<e-1;a++)M.push(he(g*l.getoffsetX(a),_,y,r,d,p,t.segment,n,i,c,o,m,h,f));M.push(u.last)}else{if(a&&!r){const n=se(p,i,f).point,r=t.lineStartIndex+t.segment+1,a=new e.pointGeometry(c.getx(r),c.gety(r)),o=se(a,i,f),s=o.signedDistanceFromCamera>0?o.point:be(p,a,n,1,i,f),l=pe(t.writingMode,n,s,b);if(l)return l}const n=he(g*l.getoffsetX(t.glyphStartIndex),_,y,r,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,r,a,i){const o=se(e.add(e.sub(t)._unit()),a,i).point,s=n.sub(o);return n.add(s._mult(r/s.mag()))}function he(t,n,r,a,i,o,s,l,c,u,d,p,m,b){const h=a?t-n:t+n;let f=h>0?1:-1,g=0;a&&(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(r*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 r=t[0],a=t[1];return e[0]=n[0]*r+n[4]*a+n[12],e[1]=n[1]*r+n[5]*a+n[13],e[3]=n[3]*r+n[7]*a+n[15],e}const ye=100;class Me{constructor(e,t=new ae(e.width+200,e.height+200,25),n=new ae(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,r,a,i){const o=this.projectAndGetPerspectiveRatio(r,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,a)||o.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,c,u,d],offscreen:this.isOffscreen(l,c,u,d)}}placeCollisionCircles(t,n,r,a,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,a,n.lineOffsetX*y,n.lineOffsetY*y,!1,M,f,n,r,s,{},!1,b);let z=!1,O=!1,k=!0;if(v){const n=.5*p*_+m,r=new e.pointGeometry(-100,-100),a=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>=r.x&&n.x<=a.x&&t.y>=r.y&&n.y<=a.y?[u]:n.x<r.x||t.x>a.x||n.y<r.y||t.y>a.y?[]:e.clipLine([u],r.x,r.y,a.x,a.y)}for(const e of g){i.reset(e,.25*n);let r=0;r=i.length<=.5*n?1:Math.ceil(i.paddedLength/f)+1;for(let e=0;e<r;e++){const a=e/Math.max(r-1,1),o=i.lerp(a),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 r=1/0,a=1/0,i=-1/0,o=-1/0;for(const s of t){const t=new e.pointGeometry(s.x+ye,s.y+ye);r=Math.min(r,t.x),a=Math.min(a,t.y),i=Math.max(i,t.x),o=Math.max(o,t.y),n.push(t)}const s=this.grid.query(r,a,i,o).concat(this.ignoredGrid.query(r,a,i,o)),l={},c={};for(const t of s){const r=t.key;if(void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;const a=[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,a)&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===c[r.bucketInstanceId]&&(c[r.bucketInstanceId]=[]),c[r.bucketInstanceId].push(r.featureIndex))}return c}insertCollisionBox(e,t,n,r,a,i){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:a,collisionGroupID:i,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,r,a,i){const o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:a,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,r,a){let i;return a?(i=[n,r,a(n,r),1],e.transformMat4(i,i,t)):(i=[n,r,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,r){return n<ye||e>=this.screenRightBoundary||r<ye||t>this.screenBottomBoundary}isInsideGrid(e,t,n,r){return n>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){const t=e.identity([]);return e.translate(t,t,[-100,-100,0]),t}}function ve(t,n,r){return n*(e.EXTENT/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}class ze{constructor(e,t,n,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&n?1:0,this.placed=n}isHidden(){return 0===this.opacity&&!this.placed}}class Oe{constructor(e,t,n,r,a){this.text=new ze(e?e.text:null,t,n,a),this.icon=new ze(e?e.icon:null,t,r,a)}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,r,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=r,this.tileID=a}}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,r,a,i){const{horizontalAlign:o,verticalAlign:s}=e.getAnchorAlignment(t),l=-(o-.5)*n,c=-(s-.5)*r,u=e.evaluateVariableOffset(t,a);return new e.pointGeometry(l+u[0]*i,c+u[1]*i)}function qe(t,n,r,a,i,o){const{x1:s,x2:l,y1:c,y2:u,anchorPointX:d,anchorPointY:p}=t,m=new e.pointGeometry(n,r);return a&&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,r,a){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(r),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,r,a){const i=r.getBucket(n),o=r.latestFeatureIndex;if(!i||!o||n.id!==i.layerIds[0])return;const s=r.collisionBoxArray,l=i.layers[0].layout,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),u=r.tileSize/e.EXTENT,d=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),p="map"===l.get("text-pitch-alignment"),m="map"===l.get("text-rotation-alignment"),b=ve(r,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,r.tileID);const g={bucket:i,layout:l,posMatrix:d,textLabelPlaneMatrix:h,labelToScreenMatrix:f,scale:c,textPixelRatio:u,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:e.evaluateSizeForZoom(i.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(i.sourceID)};if(a)for(const e of i.sortKeyRanges){const{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:a}=e;t.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:a,parameters:g})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:i.symbolInstances.length,parameters:g})}attemptAnchorPlacement(e,t,n,r,a,i,o,s,l,c,u,d,p,m,b,h){const f=[d.textOffset0,d.textOffset1],g=Ne(e,n,r,f,a),_=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:r,anchor:e,textBoxScale:a,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,r){const{bucket:a,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||!a.hasIconData()||h),A=y&&(g||!a.hasTextData()||b);!a.collisionArrays&&d&&a.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[a.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 r=e.WritingMode.horizontal;if(a.allowVerticalPlacement&&!n&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,r=e,this.markUsedOrientation(a,r,t))}return r},r=(n,r)=>{if(a.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&d.verticalTextBox){for(const t of a.writingModes)if(t===e.WritingMode.vertical?(N=r(),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,r)=>{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,a,r,d,R);if(b&&(p=b.placedGlyphBoxes,p&&p.box&&p.box.length)){y=!0,w=b.shift;break}}return p};r(()=>l(D,d.iconBox,e.WritingMode.horizontal),()=>{const n=d.verticalTextBox;return a.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(a,e.anchor,t,u))}}else{const i=(e,n)=>{const r=this.collisionIndex.placeCollisionBox(e,f,c,o,m.predicate,R);return r&&r.box&&r.box.length&&(this.markUsedOrientation(a,n,t),this.placedOrientations[t.crossTileID]=n),r};r(()=>i(D,e.WritingMode.horizontal),()=>{const n=d.verticalTextBox;return a.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=a.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),c=e.evaluateSizeForFeature(a.textSizeData,p,n),u=i.get("text-padding");j=this.collisionIndex.placeCollisionCircles(f,n,a.lineVertexArray,a.glyphOffsetArray,c,o,s,l,r,v,m.predicate,t.collisionCircleDiameter,u,R),j.circles.length&&j.collisionDetected&&!r&&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"),a.bucketInstanceId,q&&q.box&&S?S:L,m.ID),O&&W&&this.collisionIndex.insertCollisionBox(W.box,_,i.get("icon-ignore-placement"),a.bucketInstanceId,T,m.ID),j&&(y&&this.collisionIndex.insertCollisionCircles(j.circles,f,i.get("text-ignore-placement"),a.bucketInstanceId,L,m.ID),r)){const e=a.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===a.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[t.crossTileID]=new ke(y||k,O||A,x||a.justReloaded),n[t.crossTileID]=!0};if(O){if(0!==t.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");const e=a.getSortedSymbolIndexes(this.transform.angle);for(let t=e.length-1;t>=0;--t){const n=e[t];x(a.symbolInstances.get(n),a.collisionArrays[n])}}else for(let e=t.symbolInstanceStart;e<t.symbolInstanceEnd;e++)x(a.symbolInstances.get(e),a.collisionArrays[e]);if(r&&a.bucketInstanceId in this.collisionCircleArrays){const t=this.collisionCircleArrays[a.bucketInstanceId];e.invert(t.invProjMatrix,o),t.viewportMatrix=this.collisionIndex.getViewportMatrix()}a.justReloaded=!1}markUsedJustification(t,n,r,a){let i;i=a===e.WritingMode.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[e.getAnchorJustification(n)];const o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(const e of o)e>=0&&(t.text.placedSymbolArray.get(e).crossTileID=i>=0&&e!==i?0:r.crossTileID)}markUsedOrientation(t,n,r){const a=n===e.WritingMode.horizontal||n===e.WritingMode.horizontalOnly?n:0,i=n===e.WritingMode.vertical?n:0,o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(const e of o)t.text.placedSymbolArray.get(e).placedOrientation=a;r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.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 r=t?t.symbolFadeChange(e):1,a=t?t.opacities:{},i=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(const e in this.placements){const t=this.placements[e],i=a[e];i?(this.opacities[e]=new Oe(i,r,t.text,t.icon),n=n||t.text!==i.text.placed||t.icon!==i.icon.placed):(this.opacities[e]=new Oe(null,r,t.text,t.icon,t.skipFade),n=n||t.text||t.icon)}for(const e in a){const t=a[e];if(!this.opacities[e]){const a=new Oe(t,r,!1,!1);a.isHidden()||(this.opacities[e]=a,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 r of t){const t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,n,r.collisionBoxArray)}}updateBucketOpacities(t,n,r){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 a=t.layers[0].layout,i=new Oe(null,0,!1,!1,!0),o=a.get("text-allow-overlap"),s=a.get("icon-allow-overlap"),l=a.get("text-variable-anchor"),c="map"===a.get("text-rotation-alignment"),u="map"===a.get("text-pitch-alignment"),d="none"!==a.get("icon-text-fit"),p=new Oe(null,0,o&&(s||!t.hasIconData()||a.get("icon-optional")),s&&(o||!t.hasTextData()||a.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);const m=(e,t,n)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(n)};for(let r=0;r<t.symbolInstances.length;r++){const a=t.symbolInstances.get(r),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:s,crossTileID:b}=a;let h=this.opacities[b];n[b]?h=i:h||(h=p,this.opacities[b]=h),n[b]=!0;const f=a.numIconVertices>0,g=this.placedOrientations[a.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();[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach(e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=n||_?1:0)}),a.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).hidden=n||y?1:0);const r=this.variableOffsets[a.crossTileID];r&&this.markUsedJustification(t,r.anchor,a,g);const i=this.placedOrientations[a.crossTileID];i&&(this.markUsedJustification(t,"left",a,i),this.markUsedOrientation(t,i,a))}if(f){const e=Pe(h.icon),n=!(d&&a.verticalPlacedIconSymbolIndex&&_);a.placedIconSymbolIndex>=0&&(m(t.icon,a.numIconVertices,n?e:Be),t.icon.placedSymbolArray.get(a.placedIconSymbolIndex).hidden=h.icon.isHidden()),a.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,a.numVerticalIconVertices,n?Be:e),t.icon.placedSymbolArray.get(a.verticalPlacedIconSymbolIndex).hidden=h.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const n=t.collisionArrays[r];if(n){let r=new e.pointGeometry(0,0);if(n.textBox||n.verticalTextBox){let e=!0;if(l){const t=this.variableOffsets[b];t?(r=Ne(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),c&&r._rotate(u?this.transform.angle:-this.transform.angle)):e=!1}n.textBox&&je(t.textCollisionBox.collisionVertexArray,h.text.placed,!e||_,r.x,r.y),n.verticalTextBox&&je(t.textCollisionBox.collisionVertexArray,h.text.placed,!e||y,r.x,r.y)}const a=Boolean(!y&&n.verticalIconBox);n.iconBox&&je(t.iconCollisionBox.collisionVertexArray,h.icon.placed,a,d?r.x:0,d?r.y:0),n.verticalIconBox&&je(t.iconCollisionBox.collisionVertexArray,h.icon.placed,!a,d?r.x:0,d?r.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,r,a){e.emplaceBack(t?1:0,n?1:0,r||0,a||0),e.emplaceBack(t?1:0,n?1:0,r||0,a||0),e.emplaceBack(t?1:0,n?1:0,r||0,a||0),e.emplaceBack(t?1:0,n?1:0,r||0,a||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,r,a){const i=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(i,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,a())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++,a())return!0;return!1}}class $e{constructor(e,t,n,r,a,i,o,s){this.placement=new Ee(e,t,i,o,s),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(t,n,r){const a=e.exported.now(),i=()=>{const t=e.exported.now()-a;return!this._forceFullPlacement&&t>2};for(;this._currentPlacementIndex>=0;){const e=n[t[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if("symbol"===e.type&&(!e.minzoom||e.minzoom<=a)&&(!e.maxzoom||e.maxzoom>a)){if(this._inProgressLayer||(this._inProgressLayer=new Ie(e)),this._inProgressLayer.continuePlacement(r[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 Ye{constructor(e,t,n){this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(let n=0;n<t.length;n++){const r=t.get(n),a=r.key;this.indexedSymbolInstances[a]||(this.indexedSymbolInstances[a]=[]),this.indexedSymbolInstances[a].push({crossTileID:r.crossTileID,coord:this.getScaledCoordinates(r,e)})}}getScaledCoordinates(t,n){const r=Fe/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*e.EXTENT+t.anchorX)*r),y:Math.floor((n.canonical.y*e.EXTENT+t.anchorY)*r)}}findMatches(e,t,n){const r=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let a=0;a<e.length;a++){const i=e.get(a);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)<=r&&Math.abs(e.coord.y-s.y)<=r&&!n[e.crossTileID]){n[e.crossTileID]=!0,i.crossTileID=e.crossTileID;break}}}}class Xe{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],r={};for(const e in n){const a=n[e];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),r[a.tileID.key]=a}this.indexes[e]=r}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 r=this.usedCrossTileIDs[e.overscaledZ];for(const n in this.indexes){const a=this.indexes[n];if(Number(n)>e.overscaledZ)for(const n in a){const i=a[n];i.tileID.isChildOf(e)&&i.findMatches(t.symbolInstances,e,r)}else{const i=a[e.scaledTo(Number(n)).key];i&&i.findMatches(t.symbolInstances,e,r)}}for(let e=0;e<t.symbolInstances.length;e++){const a=t.symbolInstances.get(e);a.crossTileID||(a.crossTileID=n.generate(),r[a.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ye(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(const n in t.indexedSymbolInstances)for(const r of t.indexedSymbolInstances[n])delete this.usedCrossTileIDs[e][r.crossTileID]}removeStaleBuckets(e){let t=!1;for(const n in this.indexes){const r=this.indexes[n];for(const a in r)e[r[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,r[a]),delete r[a],t=!0)}return t}}class Ve{constructor(){this.layerIndexes={},this.crossTileIDs=new Xe,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let r=this.layerIndexes[e.id];void 0===r&&(r=this.layerIndexes[e.id]=new He);let a=!1;const i={};r.handleWrapJump(n);for(const n of t){const t=n.getBucket(e);t&&e.id===t.layerIds[0]&&(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),r.addBucket(n.tileID,t,this.crossTileIDs)&&(a=!0),i[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(i)&&(a=!0),a}pruneUnusedLayers(e){const t={};e.forEach(e=>{t[e]=!0});for(const e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var Ue=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 r of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(r.key),this._tiles[r.key]||(r.posMatrix=new Float64Array(16),e.ortho(r.posMatrix,0,e.EXTENT,0,e.EXTENT,0,1),this._tiles[r.key]=new T(r,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 r of this._renderableTilesKeys){const a=this._tiles[r].tileID;if(a.canonical.equals(t.canonical)){const a=t.clone();a.posMatrix=new Float64Array(16),e.ortho(a.posMatrix,0,e.EXTENT,0,e.EXTENT,0,1),n[r]=a}else if(a.canonical.isChildOf(t.canonical)){const i=t.clone();i.posMatrix=new Float64Array(16);const o=a.canonical.z-t.canonical.z,s=a.canonical.x-(a.canonical.x>>o<<o),l=a.canonical.y-(a.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[r]=i}else if(t.canonical.isChildOf(a.canonical)){const i=t.clone();i.posMatrix=new Float64Array(16);const o=t.canonical.z-a.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[r]=i}}return n}getSourceTile(e,t){const n=this.sourceCache._source;let r=e.overscaledZ-this.deltaZoom;if(r>n.maxzoom&&(r=n.maxzoom),r<n.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(r).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!a||!a.dem)&&t)for(;r>=n.minzoom&&(!a||!a.dem);)a=this.sourceCache.getTileByID(e.scaledTo(r--).key);return a}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,r,a=e.EXTENT){if(!(n>=0&&n<a&&r>=0&&r<a))return this.elevationOffset;let i=0;const o=this.getTerrainData(t);if(o.tile&&o.tile.dem){const t=e.transformMat4$1([],[n/a*e.EXTENT,r/a*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 r=this.sourceCache._tiles[n];(r.tileID.equals(t)||r.tileID.isChildOf(t))&&(e===this.sourceCache.sourceCache.id&&(r.timeLoaded=Date.now()),this._rerender[e]=this._rerender[e]||{},this._rerender[e][r.tileID.key]=!0)}}needsRerender(e,t){return this._rerender[e]&&this._rerender[e][t.key]}clearRerenderCache(){this._rerender={}}getElevation(t,n,r,a=e.EXTENT){return(this.getDEMElevation(t,n,r,a)+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 r=n&&n+n.tileID.key+t.key;if(r&&!this._demMatrixCache[r]){const r=this.sourceCache.sourceCache._source.maxzoom;let a=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=r?a=t.canonical.z-r:e.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const i=t.canonical.x-(t.canonical.x>>a<<a),o=t.canonical.y-(t.canonical.y>>a<<a),s=e.fromScaling(new Float64Array(16),[1/(e.EXTENT<<a),1/(e.EXTENT<<a),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:r?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,r=t.height/devicePixelRatio;return!this._fbo||this._fbo.width===n&&this._fbo.height===r||(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:r,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:r,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,r,!0),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,r))),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 r=0;r<this._coordsTextureSize;r++,t+=4)n[t+0]=255&r,n[t+1]=255&e,n[t+2]=r>>8<<4|e>>8,n[t+3]=0;const r=new e.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),a=new l(t,r,t.gl.RGBA,{premultiply:!1});return a.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=a,a}pointCoordinate(t){const n=new Uint8Array(4),r=this.style.map.painter,a=r.context,i=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(t.x,r.height/devicePixelRatio-t.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,n),a.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,r=new e.TriangleIndexArray,a=this.meshSize,i=e.EXTENT/a,o=a*a;for(let e=0;e<=a;e++)for(let t=0;t<=a;t++)n.emplaceBack(t*i,e*i);for(let e=0;e<o;e+=a+1)for(let t=0;t<a;t++)r.emplaceBack(t+e,a+t+e+1,a+t+e+2),r.emplaceBack(t+e,a+t+e+2,t+e+1);return this._mesh={indexBuffer:t.createIndexBuffer(r),vertexBuffer:t.createVertexBuffer(n,Ue.members),segments:e.SegmentVector.simpleSegment(0,0,n.length,r.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(U,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Qe=e.pick(U,["setCenter","setZoom","setBearing","setPitch"]),et=function(){const t={},n=e.spec.$version;for(const r in e.spec.$root){const a=e.spec.$root[r];if(a.required){let e=null;e="version"===r?n:"array"===a.type?[]:{},null!=e&&(t[r]=e)}}return t}();class tt extends e.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new y(X(),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 Ve,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 r=this;this._rtlTextPluginCallback=tt.registerForPluginStateChange(t=>{r.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},(t,n)=>{if(e.triggerPluginCompletionEvent(t),n&&n.every(e=>e))for(const e in r.sourceCaches)r.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 r="boolean"!=typeof n.validate||n.validate,a=this.map._requestManager.transformRequest(t,e.ResourceType.Style);this._request=e.getJSON(a,(t,n)=>{this._request=null,t?this.fire(new e.ErrorEvent(t)):n&&this._load(n,r)})}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 r=V(this.stylesheet.layers);this._order=r.map(e=>e.id),this._layers={},this._serializedLayers={};for(let t of r)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,r,a){let i,o,s;const l=r>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)a(s);else if(i&&o){const t=e.exported.getImageData(o),n={};for(const r in i){const{width:a,height:o,x:s,y:l,sdf:c,pixelRatio:u,stretchX:d,stretchY:p,content:m}=i[r],b=new e.RGBAImage({width:a,height:o});e.RGBAImage.copy(t,b,{x:s,y:l},{x:0,y:0},{width:a,height:o}),n[r]={data:b,pixelRatio:u,sdf:c,stretchX:d,stretchY:p,content:m}}a(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 r=t.sourceLayer;if(!r)return;const a=n.getSource();("geojson"===a.type||a.vectorLayerIds&&-1===a.vectorLayerIds.indexOf(r))&&this.fire(new e.ErrorEvent(new Error(`Source layer "${r}" does not exist on source "${a.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 r={};for(const e in this.sourceCaches){const t=this.sourceCaches[e];r[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 r){const n=this.sourceCaches[t];r[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=V(t.layers);const n=function(e,t){if(!e)return[{command:U.setStyle,args:[t]}];let n=[];try{if(!a(e.version,t.version))return[{command:U.setStyle,args:[t]}];a(e.center,t.center)||n.push({command:U.setCenter,args:[t.center]}),a(e.zoom,t.zoom)||n.push({command:U.setZoom,args:[t.zoom]}),a(e.bearing,t.bearing)||n.push({command:U.setBearing,args:[t.bearing]}),a(e.pitch,t.pitch)||n.push({command:U.setPitch,args:[t.pitch]}),a(e.sprite,t.sprite)||n.push({command:U.setSprite,args:[t.sprite]}),a(e.glyphs,t.glyphs)||n.push({command:U.setGlyphs,args:[t.glyphs]}),a(e.transition,t.transition)||n.push({command:U.setTransition,args:[t.transition]}),a(e.light,t.light)||n.push({command:U.setLight,args:[t.light]});const r={},i=[];!function(e,t,n,r){let i;for(i in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||K(i,n,r));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?a(e[i],t[i])||("geojson"===e[i].type&&"geojson"===t[i].type&&Z(e,t,i)?n.push({command:U.setGeoJSONSourceData,args:[i,t[i].data]}):J(i,t,n,r)):G(i,t,n))}(e.sources,t.sources,i,r);const o=[];e.layers&&e.layers.forEach(e=>{r[e.source]?n.push({command:U.removeLayer,args:[e.id]}):o.push(e)}),n=n.concat(i),function(e,t,n){t=t||[];const r=(e=e||[]).map(ee),i=t.map(ee),o=e.reduce(te,{}),s=t.reduce(te,{}),l=r.slice(),c=Object.create(null);let u,d,p,m,b,h,f;for(u=0,d=0;u<r.length;u++)p=r[u],Object.prototype.hasOwnProperty.call(s,p)?d++:(n.push({command:U.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:U.removeLayer,args:[p]}),l.splice(l.lastIndexOf(p,l.length-d),1)):d++,h=l[l.length-u],n.push({command:U.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]&&!a(m,b))if(a(m.source,b.source)&&a(m["source-layer"],b["source-layer"])&&a(m.type,b.type)){for(f in Q(m.layout,b.layout,n,p,null,U.setLayoutProperty),Q(m.paint,b.paint,n,p,null,U.setPaintProperty),a(m.filter,b.filter)||n.push({command:U.setFilter,args:[p,b.filter]}),a(m.minzoom,b.minzoom)&&a(m.maxzoom,b.maxzoom)||n.push({command:U.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),U.setPaintProperty):a(m[f],b[f])||n.push({command:U.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),U.setPaintProperty):a(m[f],b[f])||n.push({command:U.setLayerProperty,args:[p,f,b[f]]}))}else n.push({command:U.removeLayer,args:[p]}),h=l[l.lastIndexOf(p)+1],n.push({command:U.addLayer,args:[b,h]})}(o,t.layers,n)}catch(e){console.warn("Unable to compute style diff:",e),n=[{command:U.setStyle,args:[t]}]}return n}(this.serialize(),t).filter(e=>!(e.command in Qe));if(0===n.length)return!1;const r=n.filter(e=>!(e.command in Ze));if(r.length>0)throw new Error(`Unimplemented: ${r.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,r={}){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,r))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const a=this.sourceCaches[t]=new D(t,n,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:a.serialize(),sourceId:t})),a.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,r={}){this._checkLoaded();const a=t.id;if(this.getLayer(a))return void this.fire(new e.ErrorEvent(new Error(`Layer "${a}" 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(a,t.source),t=e.clone$1(t),t=e.extend(t,{source:a})),this._validate(e.validateStyle.layer,"layers."+a,t,{arrayIndex:-1},r))return;i=e.createStyleLayer(t),this._validateLayer(i),i.setEventedParent(this,{layer:{id:a}}),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 "${a}" before non-existing layer "${n}".`)));else{if(this._order.splice(o,0,a),this._layerOrderChanged=!0,this._layers[a]=i,this._removedLayers[a]&&i.source&&"custom"!==i.type){const e=this._removedLayers[a];delete this._removedLayers[a],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 r=this._order.indexOf(t);this._order.splice(r,1);const a=n?this._order.indexOf(n):this._order.length;n&&-1===a?this.fire(new e.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(a,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 r=this._order.indexOf(t);this._order.splice(r,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,r){this._checkLoaded();const a=this.getLayer(t);a?a.minzoom===n&&a.maxzoom===r||(null!=n&&(a.minzoom=n),null!=r&&(a.maxzoom=r),this._updateLayer(a)):this.fire(new e.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,r={}){this._checkLoaded();const i=this.getLayer(t);if(i){if(!a(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,r)||(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,r,i={}){this._checkLoaded();const o=this.getLayer(t);o?a(o.getLayoutProperty(n),r)||(o.setLayoutProperty(n,r,i),this._updateLayer(o)):this.fire(new e.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const r=this.getLayer(t);if(r)return r.getLayoutProperty(n);this.fire(new e.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,r,i={}){this._checkLoaded();const o=this.getLayer(t);o?a(o.getPaintProperty(n),r)||(o.setPaintProperty(n,r,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 r=t.source,a=t.sourceLayer,i=this.sourceCaches[r];if(void 0===i)return void this.fire(new e.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));const o=i.getSource().type;"geojson"===o&&a?this.fire(new e.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==o||a?(void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),i.setFeatureState(a,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 r=t.source,a=this.sourceCaches[r];if(void 0===a)return void this.fire(new e.ErrorEvent(new Error(`The source '${r}' does not exist in the map's style.`)));const i=a.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."))):a.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,r=t.sourceLayer,a=this.sourceCaches[n];if(void 0!==a)return"vector"!==a.getSource().type||r?(void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),a.getFeatureState(r,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={},r=[];for(let a=this._order.length-1;a>=0;a--){const i=this._order[a];if(t(i)){n[i]=a;for(const t of e){const e=t[i];if(e)for(const t of e)r.push(t)}}}r.sort((e,t)=>t.intersectionZ-e.intersectionZ);const a=[];for(let i=this._order.length-1;i>=0;i--){const o=this._order[i];if(t(o))for(let e=r.length-1;e>=0;e--){const t=r[e].feature;if(n[t.layer.id]<i)break;a.push(t),r.pop()}else for(const t of e){const e=t[o];if(e)for(const t of e)a.push(t.feature)}}return a}queryRenderedFeatures(t,n,r){n&&n.filter&&this._validate(e.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const a={};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.`))),[];a[n.source]=!0}}const i=[];n.availableImages=this._availableImages;for(const e in this.sourceCaches)n.layers&&!a[e]||i.push(L(this.sourceCaches[e],this._layers,this._serializedLayers,t,n,r));return this.placement&&i.push(function(e,t,n,r,a,i,o){const s={},l=i.queryRenderedSymbols(r),c=[];for(const e of Object.keys(l).map(Number))c.push(o[e]);c.sort(S);for(const n of c){const r=n.featureIndex.lookupSymbolFeatures(l[n.bucketInstanceId],t,n.bucketIndex,n.sourceLayerIndex,a.filter,a.layers,a.availableImages,e);for(const e in r){const t=s[e]=s[e]||[],a=r[e];a.sort((e,t)=>{const r=n.featureSortOrder;if(r){const n=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex});for(const e of a)t.push(e)}}for(const t in s)s[t].forEach(r=>{const a=r.feature,i=n[e[t].source].getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.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 r=this.sourceCaches[t];return r?function(e,t){const n=e.getRenderableIds().map(t=>e.getTileByID(t)),r=[],a={};for(let e=0;e<n.length;e++){const i=n[e],o=i.tileID.canonical.key;a[o]||(a[o]=!0,i.querySourceFeatures(r,t))}return r}(r,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 r=this.light.getLight();let i=!1;for(const e in t)if(!a(t[e],r[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,r,a,i={}){return(!i||!1!==i.validate)&&Je(this,t.call(e.validateStyle,e.extend({key:n,style:this.serialize(),value:r,styleSpec:e.spec},a)))}_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,r,a,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 r=this.crossTileSymbolIndex.addLayer(n,l[n.source],t.center.lng);o=o||r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((i=i||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.exported.now(),t.zoom))&&(this.pauseablePlacement=new $e(t,this.terrain,this._order,i,n,r,a,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 r=this.sourceCaches[t.source];r&&r.setDependencies(t.tileID.key,t.type,t.icons)}getGlyphs(e,t,n){this.glyphManager.getGlyphs(t.stacks,n)}getResource(t,n,r){return e.makeRequest(n,r)}}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 rt={prelude:at("#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:at("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:at("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:at("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:at("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:at("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:at("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:at("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:at("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:at("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:at("#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:at("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:at("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:at("#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:at("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:at("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:at("#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:at("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:at("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:at("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:at("#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:at("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:at("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:at("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:at("#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:at("#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:at("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",nt),terrainDepth:at("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:at("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 at(e,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/attribute ([\w]+) ([\w]+)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),i=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=i?i.concat(a):a,s={};return{fragmentSource:e=e.replace(n,(e,t,n,r,a)=>(s[a]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nvarying ${n} ${r} ${a};\n#else\nuniform ${n} ${r} u_${a};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${a}\n ${n} ${r} ${a} = u_${a};\n#endif\n`)),vertexSource:t=t.replace(n,(e,t,n,r,a)=>{const i="float"===r?"vec2":"vec4",o=a.match(/color/)?"color":i;return s[a]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${n} ${i} a_${a};\nvarying ${n} ${r} ${a};\n#else\nuniform ${n} ${r} u_${a};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = a_${a};\n#else\n ${n} ${r} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${a} = unpack_mix_${o}(a_${a}, u_${a}_t);\n#else\n ${n} ${r} ${a} = u_${a};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${a}\nuniform lowp float u_${a}_t;\nattribute ${n} ${i} a_${a};\n#else\nuniform ${n} ${r} u_${a};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${a}\n ${n} ${r} ${a} = a_${a};\n#else\n ${n} ${r} ${a} = u_${a};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${a}\n ${n} ${r} ${a} = unpack_mix_${o}(a_${a}, u_${a}_t);\n#else\n ${n} ${r} ${a} = u_${a};\n#endif\n`}),staticAttributes:r,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,r,a,i,o,s,l){this.context=e;let c=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!c&&e<r.length;e++)this.boundPaintVertexBuffers[e]!==r[e]&&(c=!0);e.extVertexArrayObject&&this.vao&&this.boundProgram===t&&this.boundLayoutVertexBuffer===n&&!c&&this.boundIndexBuffer===a&&this.boundVertexOffset===i&&this.boundDynamicVertexBuffer===o&&this.boundDynamicVertexBuffer2===s&&this.boundDynamicVertexBuffer3===l?(e.bindVertexArrayOES.set(this.vao),o&&o.bind(),a&&a.dynamicDraw&&a.bind(),s&&s.bind(),l&&l.bind()):this.freshBind(t,n,r,a,i,o,s,l)}freshBind(e,t,n,r,a,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=r,this.boundVertexOffset=a,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,a);for(const t of n)t.bind(),t.setVertexAttribPointers(d,e,a);i&&(i.bind(),i.setVertexAttribPointers(d,e,a)),r&&r.bind(),o&&(o.bind(),o.setVertexAttribPointers(d,e,a)),s&&(s.bind(),s.setVertexAttribPointers(d,e,a)),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 r=e[n].split(" ");t.push(r.pop())}return t}class st{constructor(t,n,r,a,i,o,s){const l=t.gl;this.program=l.createProgram();const c=ot(r.staticAttributes),u=a?a.getBinderAttributes():[],d=c.concat(u),p=rt.prelude.staticUniforms?ot(rt.prelude.staticUniforms):[],m=r.staticUniforms?ot(r.staticUniforms):[],b=a?a.getBinderUniforms():[],h=p.concat(m).concat(b),f=[];for(const e of h)f.indexOf(e)<0&&f.push(e);const g=a?a.defines():[];o&&g.push("#define OVERDRAW_INSPECTOR;"),s&&g.push("#define TERRAIN3D;");const _=g.concat(rt.prelude.fragmentSource,r.fragmentSource).join("\n"),y=g.concat(rt.prelude.vertexSource,r.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=a?a.getUniforms(t,z):[]}draw(e,t,n,r,a,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(r),e.setColorMode(a),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 r=n.vaos||(n.vaos={});(r[l]||(r[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 r=1/ve(n,1,t.transform.tileZoom),a=Math.pow(2,n.tileID.overscaledZ),i=n.tileSize*Math.pow(2,t.transform.tileZoom)/a,o=i*(n.tileID.canonical.x+n.tileID.wrap*a),s=i*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[r,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,r,a)=>{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:+r,u_opacity:a}},ut=(t,n,r,a,i,o,s)=>e.extend(ct(t,n,r,a),lt(o,n,s),{u_height_factor:-Math.pow(2,i.overscaledZ)/s.tileSize/8}),dt=e=>({u_matrix:e}),pt=(t,n,r,a)=>e.extend(dt(t),lt(r,n,a)),mt=(e,t)=>({u_matrix:e,u_world:t}),bt=(t,n,r,a,i)=>e.extend(pt(t,n,r,a),{u_world:i}),ht=(e,t,n,r)=>{const a=e.transform;let i,o;if("map"===r.paint.get("circle-pitch-alignment")){const e=ve(n,1,a.zoom);i=!0,o=[e,e]}else i=!1,o=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(t.posMatrix,n,r.paint.get("circle-translate"),r.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 r=ve(n,1,t.zoom),a=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:r,u_extrude_scale:[t.pixelsToGLUnits[0]/(r*a),t.pixelsToGLUnits[1]/(r*a)],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,r)=>({u_matrix:e,u_extrude_scale:ve(t,1,n),u_intensity:r});function Mt(t,n){const r=Math.pow(2,n.canonical.z),a=n.canonical.y;return[new e.MercatorCoordinate(0,a/r).toLngLat().lat,new e.MercatorCoordinate(0,(a+1)/r).toLngLat().lat]}const vt=(e,t,n,r)=>{const a=e.transform;return{u_matrix:xt(e,t,n,r),u_ratio:1/ve(t,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},zt=(t,n,r,a,i)=>e.extend(vt(t,n,r,i),{u_image:0,u_image_height:a}),Ot=(e,t,n,r,a)=>{const i=e.transform,o=At(t,i);return{u_matrix:xt(e,t,n,a),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,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},kt=(t,n,r,a,i,o)=>{const s=t.lineAtlas,l=At(n,t.transform),c="round"===r.layout.get("line-cap"),u=s.getDash(a.from,c),d=s.getDash(a.to,c),p=u.width*i.fromScale,m=d.width*i.toScale;return e.extend(vt(t,n,r,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,r){return e.translatePosMatrix(r?r.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const wt=(e,t,n,r,a)=>{return{u_matrix:e,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(o=a.paint.get("raster-saturation"),o>0?1-1/(1.001-o):-o),u_contrast_factor:(i=a.paint.get("raster-contrast"),i>0?1/(1-i):1+i),u_spin_weights:Nt(a.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,r,a,i,o,s,l,c)=>{const u=a.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:u.cameraToCenterDistance,u_pitch:u.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:u.width/u.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_matrix:i,u_label_plane_matrix:o,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+r,u_texsize:c,u_texture:0}},Et=(t,n,r,a,i,o,s,l,c,u,d)=>{const p=i.transform;return e.extend(qt(t,n,r,a,i,o,s,l,c,u),{u_gamma_scale:a?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:i.pixelRatio,u_is_halo:+d})},jt=(t,n,r,a,i,o,s,l,c,u)=>e.extend(Et(t,n,r,a,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,r,a,i,o)=>e.extend(function(e,t,n,r){const a=n.imageManager.getPattern(e.from.toString()),i=n.imageManager.getPattern(e.to.toString()),{width:o,height:s}=n.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),c=r.tileSize*Math.pow(2,n.transform.tileZoom)/l,u=c*(r.tileID.canonical.x+r.tileID.wrap*l),d=c*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.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:a.displaySize,u_pattern_size_b:i.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/ve(r,1,n.transform.tileZoom),u_pixel_coord_upper:[u>>16,d>>16],u_pixel_coord_lower:[65535&u,65535&d]}}(a,o,r,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 r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.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,r){this.length=t.length,this.attributes=n,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;const a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.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 r=t.attributes[this.attributes[n].name];void 0!==r&&e.enableVertexAttribArray(r)}}setVertexAttribPointers(e,t,n){for(let r=0;r<this.attributes.length;r++){const a=this.attributes[r],i=t.attributes[a.name];void 0!==i&&e.vertexAttribPointer(i,a.components,e[Ct[a.type]],!1,this.itemSize,a.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 Yt extends Dt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Xt 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 Vt 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 Ut 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 rn 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 an 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,r){this.context=e,this.width=t,this.height=n;const a=e.gl,i=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new _n(e,i),r&&(this.depthAttachment=new yn(e,i)),a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.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 Yt(this),this.stencilFunc=new Xt(this),this.stencilOp=new Ht(this),this.stencilTest=new Vt(this),this.depthRange=new Ut(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 rn(this),this.program=new an(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 r=this.gl,a=r.createRenderbuffer();return this.bindRenderbuffer.set(a),r.renderbufferStorage(r.RENDERBUFFER,e,t,n),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t,n){return new Mn(this,e,t,n)}clear({color:e,depth:t}){const n=this.gl;let r=0;e&&(r|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(r|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),n.clear(r)}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){a(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,r,a,i){this.test=e,this.ref=t,this.mask=n,this.fail=r,this.depthFail=a,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,r,a,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<a.length;b++){const h=a[b],f=n.getTile(h),g=f.getBucket(r);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(),r=_;e.mul(n,g.placementInvProjMatrix,t.transform.glCoordMatrix),e.mul(n,n,g.placementViewportMatrix),d.push({circleArray:M,circleOffset:m,transform:r,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),r.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,r=e.circleArray[n+0],a=e.circleArray[n+1],i=e.circleArray[n+2],o=e.circleArray[n+3];h.emplace(f++,r,a,i,o,0),h.emplace(f++,r,a,i,o,1),h.emplace(f++,r,a,i,o,2),h.emplace(f++,r,a,i,o,3)}(!xn||xn.length<2*p)&&(xn=function(t){const n=2*t,r=new e.QuadTriangleArray;r.resize(n),r._trim();for(let e=0;e<n;e++){const t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}(p));const g=l.createIndexBuffer(xn,!0),_=l.createVertexBuffer(h,e.collisionCircleLayout.members,!0);for(const n of d){const a={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,a,t.style.terrain&&t.style.terrain.getTerrainData(n.coord),r.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,r,a,i,o){const{horizontalAlign:s,verticalAlign:l}=e.getAnchorAlignment(t),c=-(s-.5)*n,u=-(l-.5)*r,d=e.evaluateVariableOffset(t,a);return new e.pointGeometry((c/i+d[0])*o,(u/i+d[1])*o)}function En(t,n,r,a,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:a[f.crossTileID];if(_){const a=new e.pointGeometry(f.anchorX,f.anchorY),p=se(a,r?s:o,d),b=le(i.cameraToCenterDistance,p.signedDistanceFromCamera);let g=e.evaluateSizeForFeature(t.textSizeData,c,f)*b/e.ONE_EM;r&&(g*=t.tilePixelRatio/l);const{width:y,height:M,anchor:v,textOffset:z,textBoxScale:O}=_,k=qn(v,y,M,z,O,g),A=r?se(a.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 r=n.get(t);if(r.hidden)ge(r.numGlyphs,b);else{const n=h[t];if(n)for(let t=0;t<r.numGlyphs;t++)e.addDynamicAttributes(b,n.shiftedAnchor,n.angle);else ge(r.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,r,a,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"!==r.layout.get("symbol-placement"),y=f&&!g&&!_,M=!r.layout.get("symbol-sort-key").isConstant();let v=!1;const z=t.depthModeForSublayer(0,On.ReadOnly),O=r.layout.get("text-variable-anchor"),k=[];for(const l of a){const a=n.getTile(l),c=a.getBucket(r);if(!c)continue;const d=i?c.text:c.icon;if(!d||!d.segments.get().length)continue;const p=d.programConfigurations.get(r.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=a.glyphAtlasTexture,j=b.LINEAR,q=a.glyphAtlasTexture.size,c.iconsInText){L=a.imageAtlasTexture.size,S=a.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!==r.layout.get("icon-size").constantOr(0)||c.iconsNeedLinear;E=a.imageAtlasTexture,j=m||t.options.rotating||t.options.zooming||e||A?b.LINEAR:b.NEAREST,q=a.imageAtlasTexture.size}const T=ve(a,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"!==r.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"===r.layout.get("text-rotation-alignment");ue(c,l.posMatrix,t,i,C,R,g,u,n,e)}const B=t.translatePosMatrix(l.posMatrix,a,o,s),I=_||i&&O||P?Nn:C,$=t.translatePosMatrix(R,a,o,s,!0),F=m&&0!==r.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1);let Y;Y=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 X={program:x,buffers:d,uniformValues:Y,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:X,terrainData:N})}else k.push({segments:d.segments,sortKey:0,state:X,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 a=n.uniformValues;n.hasHalo&&(a.u_is_halo=1,Ln(n.buffers,e.segments,r,t,n.program,z,d,p,a,e.terrainData)),a.u_is_halo=0}Ln(n.buffers,e.segments,r,t,n.program,z,d,p,n.uniformValues,e.terrainData)}}function Ln(e,t,n,r,a,i,o,s,l,c){const u=r.context;a.draw(u,u.gl.TRIANGLES,i,o,s,An.disabled,l,c,n.id,e.layoutVertexBuffer,e.indexBuffer,t,n.paint,r.transform.zoom,e.programConfigurations.get(n.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function Sn(e,t,n,r,a,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 r){const r=t.getTile(f);if(c&&!r.patternsLoaded())continue;const g=r.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),r.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),_.updatePaintBuffers(u));const v=l.constantOr(null);if(v&&r.imageAtlas){const e=r.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,r,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,r,t):mt(O,t)}else b=g.indexBuffer,h=g.segments,m=c?pt(O,e,u,r):dt(O);y.draw(e.context,d,a,e.stencilModeForClipping(f),i,An.disabled,m,M,n.id,g.layoutVertexBuffer,b,h,n.paint,e.transform.zoom,_)}}function Tn(e,t,n,r,a,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 r){const r=t.getTile(m),b=r.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),r.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),f.updatePaintBuffers(d));const _=c.constantOr(null);if(_&&r.imageAtlas){const e=r.imageAtlas,t=e.patternPositions[_.to.toString()],n=e.patternPositions[_.from.toString()];t&&n&&f.setConstantPatternPositions(t,n)}const y=e.translatePosMatrix(m.posMatrix,r,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,r):ct(y,e,M,p);g.draw(s,s.gl.TRIANGLES,a,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,r,a,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,a,i,o,An.disabled,((e,t,n,r)=>{const a=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:r?r.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:a,u_highlight:i,u_accent:o}})(e,n,r,d?t:null),d,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}function Rn(t,n,r,a,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,a,i,o,An.disabled,((t,n)=>{const r=n.stride,a=e.create();return e.ortho(a,0,e.EXTENT,-e.EXTENT,0,0,1),e.translate(a,a,[0,-e.EXTENT,0]),{u_matrix:a,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:n.getUnpackVector()}})(n.tileID,u),null,r.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),n.needsHillshadePrepare=!1}}function Dn(t,n,r,a,i,o){const s=a.paint.get("raster-fade-duration");if(!o&&s>0){const a=e.exported.now(),o=(a-t.timeAdded)/s,l=n?(a-n.timeAdded)/s:-1,c=r.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 Yn(e,t,n,r){Hn(e,0,t+n/2,e.transform.width,n,r)}function Xn(e,t,n,r){Hn(e,t-n/2,0,n,e.transform.height,r)}function Hn(e,t,n,r,a,i){const o=e.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,n*e.pixelRatio,r*e.pixelRatio,a*e.pixelRatio),o.clear({color:i}),s.disable(s.SCISSOR_TEST)}function Vn(t,n,r){const a=t.context,i=a.gl,o=r.posMatrix,s=t.useProgram("debug"),l=On.disabled,c=kn.disabled,u=t.colorModeForRenderPass(),d="$debug",p=t.style.terrain&&t.style.terrain.getTerrainData(r);a.activeTexture.set(i.TEXTURE0),t.emptyTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE);const m=n.getTileByID(r.key).latestRawTileData,b=Math.floor((m&&m.byteLength||0)/1024),h=n.getTile(r).tileSize,f=512/Math.min(h,512)*(r.overscaledZ/t.transform.zoom)*.5;let g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=" => "+r.overscaledZ),function(e,t){e.initDebugOverlayCanvas();const n=e.debugOverlayCanvas,r=e.context.gl,a=e.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,n.width,n.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(t,5,5),a.strokeText(t,5,5),e.debugOverlayTexture.update(n),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(t,`${g} ${b}kB`),s.draw(a,i.TRIANGLES,l,c,vn.alphaBlended,An.disabled,gt(o,e.Color.transparent,f),null,d,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),s.draw(a,i.LINE_STRIP,l,c,u,An.disabled,gt(o,e.Color.red),p,d,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function Un(e,t,n){const r=e.context,a=r.gl,i=e.colorModeForRenderPass(),o=new On(a.LEQUAL,On.ReadWrite,e.depthRangeFor3D),s=e.useProgram("terrain"),l=t.getTerrainMesh(),c=t.getTerrainData(n.tileID);r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height]),r.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const u=e.transform.calculatePosMatrix(n.tileID.toUnwrapped());s.draw(r,a.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,r){const a=e.context,i=n.tileSize*t.qualityFactor;n.textures[r]||(n.textures[r]=e.getTileTexture(i)||new l(a,{width:i,height:i,data:null},a.gl.RGBA),n.textures[r].bind(a.gl.LINEAR,a.gl.CLAMP_TO_EDGE),0===r&&t.sourceCache.renderHistory.unshift(n.tileID.key));const o=t.getRTTFramebuffer();o.colorAttachment.set(n.textures[r].texture),a.bindFramebuffer.set(o.framebuffer),a.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 r=e.sourceCaches[n].getVisibleCoordinates();for(const e of r){const r=t.sourceCache.getTerrainCoords(e);for(const e in r)this._coordsDescendingInv[n][e]||(this._coordsDescendingInv[n][e]=[]),this._coordsDescendingInv[n][e].push(r[e])}}for(const t of e._order){const n=e._layers[t],r=n.source;if(this._renderToTexture[n.type]&&!this._coordsDescendingInvStr[r]){this._coordsDescendingInvStr[r]={};for(const e in this._coordsDescendingInv[r])this._coordsDescendingInvStr[r][e]=this._coordsDescendingInv[r][e].map(e=>e.key).sort().join()}}return this._renderableTiles.forEach(e=>{for(const n in this._coordsDescendingInvStr){const r=this._coordsDescendingInvStr[n][e.tileID.key];r&&r!==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,r=this.painter,a=r.style._order,i=r.currentLayer,o=i+1===a.length;if(this._renderToTexture[n]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(a[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(r,r.style.terrain,t,o),this._rerender[t.tileID.key]){r.context.clear({color:e.Color.transparent});for(let e=0;e<s.length;e++){const n=r.style._layers[s[e]],a=n.source?this._coordsDescendingInv[n.source][t.tileID.key]:[t.tileID];r._renderTileClippingMasks(n,a),r.renderLayer(r,r.style.sourceCaches[n.source],n,a),n.source&&(t.textureCoords[n.source]=this._coordsDescendingInvStr[n.source][t.tileID.key])}}Un(r,r.style.terrain,t)}if("hillshade"===n){this._stacks.push([a[i]]);for(const n of this._renderableTiles){const a=this._coordsDescendingInv[t.source][n.tileID.key];Gn(r,r.style.terrain,n,this._stacks.length-1),r.context.clear({color:e.Color.transparent}),r._renderTileClippingMasks(t,a),r.renderLayer(r,r.style.sourceCaches[t.source],t,a),Un(r,r.style.terrain,n)}return!0}return this._renderToTexture[n]}return!1}}const Jn={symbol:function(t,n,r,a,i){if("translucent"!==t.renderPass)return;const o=kn.disabled,s=t.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(t,n,r,a,i,o,s){const l=n.transform,c="map"===i,u="map"===o;for(const i of t){const t=a.getTile(i),o=t.getBucket(r);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"!==r.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)}}}(a,t,r,n,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),i),0!==r.paint.get("icon-opacity").constantOr(1)&&Wn(t,n,r,a,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),o,s),0!==r.paint.get("text-opacity").constantOr(1)&&Wn(t,n,r,a,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),o,s),n.map.showCollisionBoxes&&(wn(t,n,r,a,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),wn(t,n,r,a,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))},circle:function(t,n,r,a){if("translucent"!==t.renderPass)return;const i=r.paint.get("circle-opacity"),o=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),l=!r.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<a.length;i++){const o=a[i],s=n.getTile(o),c=s.getBucket(r);if(!c)continue;const u=c.programConfigurations.get(r.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,r),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:a,layoutVertexBuffer:i,indexBuffer:o,uniformValues:s,terrainData:l}=e.state;a.draw(c,u.TRIANGLES,d,p,m,An.disabled,s,l,r.id,i,o,e.segments,r.paint,t.transform.zoom,n)}},heatmap:function(t,n,r,a){if(0!==r.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 r=e.gl;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let a=n.heatmapFbo;if(a)r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer);else{const i=r.createTexture();r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),a=n.heatmapFbo=e.createFramebuffer(t.width/4,t.height/4,!1),function(e,t,n,r){const a=e.gl;a.texImage2D(a.TEXTURE_2D,0,a.RGBA,t.width/4,t.height/4,0,a.RGBA,e.extRenderToTextureHalfFloat?e.extTextureHalfFloat.HALF_FLOAT_OES:a.UNSIGNED_BYTE,null),r.colorAttachment.set(n)}(e,t,i,a)}}(i,t,r),i.clear({color:e.Color.transparent});for(let e=0;e<a.length;e++){const c=a[e];if(n.hasRenderableParent(c))continue;const u=n.getTile(c),d=u.getBucket(r);if(!d)continue;const p=d.programConfigurations.get(r.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,r.paint.get("heatmap-intensity")),null,r.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,r.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 r=t.context,a=r.gl,i=n.heatmapFbo;if(!i)return;r.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,i.colorAttachment.get()),r.activeTexture.set(a.TEXTURE1);let o=n.colorRampTexture;o||(o=n.colorRampTexture=new l(r,n.colorRamp,a.RGBA)),o.bind(a.LINEAR,a.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(r,a.TRIANGLES,On.disabled,kn.disabled,t.colorModeForRenderPass(),An.disabled,((t,n,r,a)=>{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,r))},line:function(t,n,r,a){if("translucent"!==t.renderPass)return;const i=r.paint.get("line-opacity"),o=r.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=r.paint.get("line-dasharray"),d=r.paint.get("line-pattern"),p=d.constantOr(1),m=r.paint.get("line-gradient"),b=r.getCrossfadeParameters(),h=p?"linePattern":u?"lineSDF":m?"lineGradient":"line",f=t.context,g=f.gl;let _=!0;for(const i of a){const a=n.getTile(i);if(p&&!a.patternsLoaded())continue;const o=a.getBucket(r);if(!o)continue;const y=o.programConfigurations.get(r.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&&a.imageAtlas){const e=a.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,a,r,b,A):u?kt(t,a,r,u,b,A):m?zt(t,a,r,o.lineClipsArray.length,A):vt(t,a,r,A);if(p)f.activeTexture.set(g.TEXTURE0),a.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 a=o.gradients[r.id];let s=a.texture;if(r.gradientVersion!==a.version){let c=256;if(r.stepInterpolant){const r=n.getSource().maxzoom,a=i.canonical.z===r?Math.ceil(1<<t.transform.maxZoom-i.canonical.z):1;c=e.clamp(e.nextPowerOfTwo(o.maxLineLength/e.EXTENT*1024*a),256,f.maxTextureSize)}a.gradient=e.renderColorRamp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:c,image:a.gradient||void 0,clips:o.lineClipsArray}),a.texture?a.texture.update(a.gradient):a.texture=new l(f,a.gradient,g.RGBA),a.version=r.gradientVersion,s=a.texture}f.activeTexture.set(g.TEXTURE0),s.bind(r.stepInterpolant?g.NEAREST:g.LINEAR,g.CLAMP_TO_EDGE)}v.draw(f,g.TRIANGLES,s,t.stencilModeForClipping(i),c,An.disabled,x,O,r.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,r.paint,t.transform.zoom,y,o.layoutVertexBuffer2),_=!1}},fill:function(t,n,r,a){const i=r.paint.get("fill-color"),o=r.paint.get("fill-opacity");if(0===o.constantOr(1))return;const s=t.colorModeForRenderPass(),l=r.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,r,a,e,s,!1)}if("translucent"===t.renderPass&&r.paint.get("fill-antialias")){const e=t.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,On.ReadOnly);Sn(t,n,r,a,e,s,!0)}},"fill-extrusion":function(e,t,n,r){const a=n.paint.get("fill-extrusion-opacity");if(0!==a&&"translucent"===e.renderPass){const i=new On(e.context.gl.LEQUAL,On.ReadWrite,e.depthRangeFor3D);if(1!==a||n.paint.get("fill-extrusion-pattern").constantOr(1))Tn(e,t,n,r,i,kn.disabled,vn.disabled),Tn(e,t,n,r,i,e.stencilModeFor3D(),e.colorModeForRenderPass());else{const a=e.colorModeForRenderPass();Tn(e,t,n,r,i,kn.disabled,a)}}},hillshade:function(e,t,n,r){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;const a=e.context,i=e.depthModeForSublayer(0,On.ReadOnly),o=e.colorModeForRenderPass(),[s,l]="translucent"===e.renderPass?e.stencilConfigForOverlap(r):[{},r];for(const r of l){const a=t.getTile(r);void 0!==a.needsHillshadePrepare&&a.needsHillshadePrepare&&"offscreen"===e.renderPass?Rn(e,a,n,i,kn.disabled,o):"translucent"===e.renderPass&&Cn(e,r,a,n,i,s[r.overscaledZ],o)}a.viewport.set([0,0,e.width,e.height])},raster:function(e,t,n,r){if("translucent"!==e.renderPass)return;if(0===n.paint.get("raster-opacity"))return;if(!r.length)return;const a=e.context,i=a.gl,o=t.getSource(),s=e.useProgram("raster"),l=e.colorModeForRenderPass(),[c,u]=o instanceof N?[{},r]:e.stencilConfigForOverlap(r),d=u[u.length-1].overscaledZ,p=!e.options.moving;for(const r of u){const u=e.depthModeForSublayer(r.overscaledZ-d,1===n.paint.get("raster-opacity")?On.ReadWrite:On.ReadOnly,i.LESS),m=t.getTile(r);m.registerFadeDuration(n.paint.get("raster-fade-duration"));const b=t.findLoadedParent(r,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;a.activeTexture.set(i.TEXTURE0),m.texture.bind(_,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST),a.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(r),M=y?r:null,v=M?M.posMatrix:e.transform.calculatePosMatrix(r.toUnwrapped(),p),z=wt(v,g||[0,0],f||1,h,n);o instanceof N?s.draw(a,i.TRIANGLES,u,kn.disabled,l,An.disabled,z,y,n.id,o.boundsBuffer,e.quadTriangleIndexBuffer,o.boundsSegments):s.draw(a,i.TRIANGLES,u,c[r.overscaledZ],l,An.disabled,z,y,n.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}},background:function(e,t,n,r){const a=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===a.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=r||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=r?t.posMatrix:e.transform.calculatePosMatrix(t.toUnwrapped()),d=u?Lt(l,i,e,u,{tileID:t,tileSize:c},g):Wt(l,i,a),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 r=0;r<n.length;r++)Vn(e,t,n[r])},custom:function(e,t,n){const r=e.context,a=n.implementation;if("offscreen"===e.renderPass){const t=a.prerender;t&&(e.setCustomLayerDefaults(),r.setColorMode(e.colorModeForRenderPass()),t.call(a,r.gl,e.transform.customLayerMatrix()),r.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),r.setColorMode(e.colorModeForRenderPass()),r.setStencilMode(kn.disabled);const t="3d"===a.renderingMode?new On(e.context.gl.LEQUAL,On.ReadWrite,e.depthRangeFor3D):e.depthModeForSublayer(0,On.ReadOnly);r.setDepthMode(t),a.render(r.gl,e.transform.customLayerMatrix()),r.setDirty(),e.setBaseState(),r.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 Ve,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,Ue.members),this.tileExtentSegments=e.SegmentVector.simpleSegment(0,0,4,2);const r=new e.PosArray;r.emplaceBack(0,0),r.emplaceBack(e.EXTENT,0),r.emplaceBack(0,e.EXTENT),r.emplaceBack(e.EXTENT,e.EXTENT),this.debugBuffer=t.createVertexBuffer(r,Ue.members),this.debugSegments=e.SegmentVector.simpleSegment(0,0,4,5);const a=new e.RasterBoundsArray;a.emplaceBack(0,0,0,0),a.emplaceBack(e.EXTENT,0,e.EXTENT,0),a.emplaceBack(0,e.EXTENT,0,e.EXTENT),a.emplaceBack(e.EXTENT,e.EXTENT,e.EXTENT,e.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(a,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,Ue.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 r=e.create();e.ortho(r,0,this.width,this.height,0,0,1),e.scale(r,r,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,On.disabled,this.stencilClearMode,vn.disabled,An.disabled,_t(r),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,r=n.gl;this.nextStencilID+t.length>256&&this.clearStencil(),n.setColorMode(vn.disabled),n.setDepthMode(On.disabled);const a=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);a.draw(n,r.TRIANGLES,On.disabled,new kn({func:r.ALWAYS,mask:0},t,255,r.KEEP,r.KEEP,r.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),r=n[n.length-1].overscaledZ,a=n[0].overscaledZ-r+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();const e={};for(let n=0;n<a;n++)e[n+r]=new kn({func:t.GEQUAL,mask:255},n+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=a,[e,n]}return[{[r]: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 r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new On(n||this.context.gl.LEQUAL,t,[r,r])}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 r=this.style._order,a=this.style.sourceCaches,i=this.style.terrain&&new Kn(this);for(const e in a){const t=a[e];t.used&&t.prepare(this.context)}const o={},s={},l={};for(const e in a){const t=a[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<r.length;e++)if(this.style._layers[r[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 r=t.context,a=r.gl,i=vn.unblended,o=new On(a.LEQUAL,On.ReadWrite,[0,1]),s=n.getTerrainMesh(),l=n.sourceCache.getRenderableTiles(),c=t.useProgram("terrainDepth");r.bindFramebuffer.set(n.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.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(r,a.TRIANGLES,o,kn.disabled,i,An.backCCW,{u_matrix:u},l,"terrain",s.vertexBuffer,s.indexBuffer,s.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,this.style.terrain),function(t,n){const r=t.context,a=r.gl,i=vn.unblended,o=new On(a.LEQUAL,On.ReadWrite,[0,1]),s=n.getTerrainMesh(),l=n.getCoordsTexture(),c=n.sourceCache.getRenderableTiles(),u=t.useProgram("terrainCoords");r.bindFramebuffer.set(n.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:e.Color.transparent,depth:1}),n.coordsIndex=[];for(const e of c){const c=n.getTerrainData(e.tileID);r.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,l.texture);const d=t.transform.calculatePosMatrix(e.tileID.toUnwrapped());u.draw(r,a.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)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const e of r){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,a[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=r.length-1;this.currentLayer>=0;this.currentLayer--){const e=this.style._layers[r[this.currentLayer]],t=a[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<r.length;this.currentLayer++){const e=this.style._layers[r[this.currentLayer]],t=a[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;Yn(e,e.transform.height-(t.top||0),3,Pn),Yn(e,t.bottom||0,3,Bn),Xn(e,t.left||0,3,In),Xn(e,e.transform.width-(t.right||0),3,$n);const n=e.transform.centerPoint;!function(e,t,n,r){Hn(e,t-1,n-10,2,20,r),Hn(e,t-10,n-1,20,2,r)}(e,n.x,e.transform.height-n.y,Fn)}(this),this.context.setDefault()}renderLayer(e,t,n,r){n.isHidden(this.transform.zoom)||("background"===n.type||"custom"===n.type||(r||[]).length)&&(this.id=n.id,this.gpuTimingStart(n),Jn[n.type](e,t,n,r,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 r=e[n],a=this.context.extTimerQuery,i=a.getQueryObjectEXT(r.query,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(r.query),t[n]=i}return t}translatePosMatrix(t,n,r,a,i){if(!r[0]&&!r[1])return t;const o=i?"map"===a?this.transform.angle:0:"viewport"===a?-this.transform.angle:0;if(o){const e=Math.sin(o),t=Math.cos(o);r=[r[0]*t-r[1]*e,r[0]*e+r[1]*t]}const s=[i?r[0]:ve(n,r[0],this.transform.zoom),i?r[1]:ve(n,r[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,rt[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,r){const a=Math.pow(2,r),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(r=>{const i=1/(r=e.transformMat4([],r,t))[3]/n*a;return e.mul$1(r,r,[i,i,1/r[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]]),r=e.sub([],i[t[2]],i[t[1]]),a=e.normalize([],e.cross([],n,r)),o=-e.dot(a,i[t[1]]);return a.concat(o)});return new Qn(i,o)}}class er{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],r=e.clone$2(this.min),a=e.clone$2(this.max);for(let e=0;e<n.length;e++)r[e]=n[e]?this.min[e]:this.center[e],a[e]=n[e]?this.center[e]:this.max[e];return a[2]=this.max[2],new er(r,a)}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 r=!0;for(let a=0;a<t.planes.length;a++){const i=t.planes[a];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&&(r=!1)}if(r)return 2;for(let e=0;e<3;e++){let n=Number.MAX_VALUE,r=-Number.MAX_VALUE;for(let a=0;a<t.points.length;a++){const i=t.points[a][e]-this.min[e];n=Math.min(n,i),r=Math.max(r,i)}if(r<0||n>this.max[e]-this.min[e])return 0}return 1}}class tr{constructor(e=0,t=0,n=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(n)||n<0||isNaN(r)||r<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=r}interpolate(t,n,r){return null!=n.top&&null!=t.top&&(this.top=e.number(t.top,n.top,r)),null!=n.bottom&&null!=t.bottom&&(this.bottom=e.number(t.bottom,n.bottom,r)),null!=n.left&&null!=t.left&&(this.left=e.number(t.left,n.left,r)),null!=n.right&&null!=t.right&&(this.right=e.number(t.right,n.right,r)),this}getCenter(t,n){const r=e.clamp((this.left+t-this.right)/2,0,t),a=e.clamp((this.top+n-this.bottom)/2,0,n);return new e.pointGeometry(r,a)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new tr(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class nr{constructor(t,n,r,a,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==r?0:r,this._maxPitch=null==a?60:a,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 tr,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const e=new nr(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 r;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(r=new e.ARRAY_TYPE(4),e.ARRAY_TYPE!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r),function(e,t,n){var r=t[0],a=t[1],i=t[2],o=t[3],s=Math.sin(n),l=Math.cos(n);e[0]=r*l+i*s,e[1]=a*l+o*s,e[2]=r*-s+i*l,e[3]=a*-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 r=this.pointCoordinate(new e.pointGeometry(0,0)),a=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(r.x,a.x,i.x,o.x)),l=Math.floor(Math.max(r.x,a.x,i.x,o.x)),c=1;for(let r=s-c;r<=l+c;r++)0!==r&&n.push(new e.UnwrappedTileID(r,t))}return n}coveringTiles(t){var n,r;let a=this.coveringZoomLevel(t);const i=a;if(void 0!==t.minzoom&&a<t.minzoom)return[];void 0!==t.maxzoom&&a>t.maxzoom&&(a=t.maxzoom);const o=this.pointCoordinate(this.getCameraPoint()),s=e.MercatorCoordinate.fromLngLat(this.center),l=Math.pow(2,a),c=[l*o.x,l*o.y,0],u=[l*s.x,l*s.y,0],d=Qn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a);let p=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=a);const m=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,b=e=>({aabb:new er([e*l,0,0],[(e+1)*l,l,0]),zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),h=[],f=[],g=a,_=t.reparseOverscaled?i:a;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 a=h.pop(),i=a.x,o=a.y;let s=a.fullyVisible;if(!s){const e=a.aabb.intersects(d);if(0===e)continue;s=2===e}const l=t.terrain?c:u,b=a.aabb.distanceX(l),y=a.aabb.distanceY(l),M=Math.max(Math.abs(b),Math.abs(y)),v=m+(1<<g-a.zoom)-2;if(a.zoom===g||M>v&&a.zoom>=p){const t=g-a.zoom,n=c[0]-.5-(i<<t),r=c[1]-.5-(o<<t);f.push({tileID:new e.OverscaledTileID(a.zoom===g?_:a.zoom,a.wrap,a.zoom,i,o),distanceSq:e.sqrLen([u[0]-.5-i,u[1]-.5-o]),tileDistanceToCamera:Math.sqrt(n*n+r*r)})}else for(let l=0;l<4;l++){const c=(i<<1)+l%2,u=(o<<1)+(l>>1),d=a.zoom+1;let p=a.aabb.quadrant(l);if(t.terrain){const i=new e.OverscaledTileID(d,a.wrap,d,c,u),o=t.terrain.getMinMaxElevation(i),s=null!==(n=o.minElevation)&&void 0!==n?n:this.elevation,l=null!==(r=o.maxElevation)&&void 0!==r?r:this.elevation;p=new er([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:a.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 r=e.MercatorCoordinate.fromLngLat(t),a=(1<<this.tileZoom)*e.EXTENT,i=r.x*a,o=r.y*a,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),r=this.getElevation(n,t);if(!(this.elevation-r))return;const a=this.getCameraPosition(),i=e.MercatorCoordinate.fromLngLat(a.lngLat,a.altitude),o=e.MercatorCoordinate.fromLngLat(n,r),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=r,this._center=n,this.zoom=d}setLocationAtPoint(t,n){const r=this.pointCoordinate(n),a=this.pointCoordinate(this.centerPoint),i=this.locationCoordinate(t),o=new e.MercatorCoordinate(i.x-(r.x-a.x),i.y-(r.y-a.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 r=[t.x,t.y,0,1],a=[t.x,t.y,1,1];e.transformMat4(r,r,this.pixelMatrixInverse),e.transformMat4(a,a,this.pixelMatrixInverse);const i=r[3],o=a[3],s=r[1]/i,l=a[1]/o,c=r[2]/i,u=a[2]/o,d=c===u?0:(0-c)/(u-c);return new e.MercatorCoordinate(e.number(r[0]/i,a[0]/o,d)/this.worldSize,e.number(s,l,d)/this.worldSize)}coordinatePoint(t,n=0,r=this.pixelMatrix){const a=[t.x*this.worldSize,t.y*this.worldSize,n,1];return e.transformMat4(a,a,r),new e.pointGeometry(a[0]/a[3],a[1]/a[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 r=t.key,a=n?this._alignedPosMatrixCache:this._posMatrixCache;if(a[r])return a[r];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),a[r]=new Float32Array(l),a[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,r,a,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&&(a=i+t),e+t>o&&(a=o-t)}if(this.lngRange){const t=(s+l)/2,n=e.wrap(d.x,t-this.worldSize/2,t+this.worldSize/2),a=c.x/2;n-a<s&&(r=s+a),n+a>l&&(r=l-a)}void 0===r&&void 0===a||(this.center=this.unproject(new e.pointGeometry(void 0!==r?r:d.x,void 0!==a?a:d.y)).wrap()),this._unmodified=u,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,r=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=e.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let a=e.identity(new Float64Array(16));e.scale(a,a,[this.width/2,-this.height/2,1]),e.translate(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=e.identity(new Float64Array(16)),e.scale(a,a,[1,-1,1]),e.translate(a,a,[-1,-1,0]),e.scale(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a,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;a=new Float64Array(16),e.perspective(a,this._fov,this.width/this.height,b,m),a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height,e.scale(a,a,[1,-1,1]),e.translate(a,a,[0,0,-this.cameraToCenterDistance]),e.rotateX(a,a,this._pitch),e.rotateZ(a,a,this.angle),e.translate(a,a,[-n,-r,0]),this.mercatorMatrix=e.scale([],a,[this.worldSize,this.worldSize,this.worldSize]),e.scale(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=e.multiply(new Float64Array(16),this.labelPlaneMatrix,a),e.translate(a,a,[0,0,-this.elevation]),this.projMatrix=a,this.invProjMatrix=e.invert([],a),this.pixelMatrix3D=e.multiply(new Float64Array(16),this.labelPlaneMatrix,a);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=r-Math.round(r)+g*f+_*h,v=new Float64Array(a);if(e.translate(v,v,[y>.5?y-1:y,M>.5?M-1:M,0]),this.alignedProjMatrix=v,a=e.invert(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,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 r=n.x,a=n.y,i=n.x,o=n.y;for(const e of t)r=Math.min(r,e.x),a=Math.min(a,e.y),i=Math.max(i,e.x),o=Math.max(o,e.y);return[new e.pointGeometry(r,a),new e.pointGeometry(i,a),new e.pointGeometry(i,o),new e.pointGeometry(r,o),new e.pointGeometry(r,a)]}}}class rr{constructor(t){this._hashName=t&&encodeURIComponent(t),e.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(e,t){let n=!1,r=null;const a=()=>{r=null,n&&(e(),r=setTimeout(a,300),n=!1)};return()=>(n=!0,r||a(),r)}(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,r=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,r),i=Math.round(t.lng*a)/a,o=Math.round(t.lat*a)/a,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 r=n.split("=")[0];return r===e?(t=!0,`${r}=${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 ar={linearity:.3,easing:e.bezier(0,0,.3,1)},ir=e.extend({deceleration:2500,maxSpeed:1400},ar),or=e.extend({deceleration:20,maxSpeed:1400},ar),sr=e.extend({deceleration:1e3,maxSpeed:360},ar),lr=e.extend({deceleration:1e3,maxSpeed:90},ar);class cr{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 r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,a={};if(n.pan.mag()){const i=dr(n.pan.mag(),r,e.extend({},ir,t||{}));a.offset=n.pan.mult(i.amount/n.pan.mag()),a.center=this._map.transform.center,ur(a,i)}if(n.zoom){const e=dr(n.zoom,r,or);a.zoom=this._map.transform.zoom+e.amount,ur(a,e)}if(n.bearing){const t=dr(n.bearing,r,sr);a.bearing=this._map.transform.bearing+e.clamp(t.amount,-179,179),ur(a,t)}if(n.pitch){const e=dr(n.pitch,r,lr);a.pitch=this._map.transform.pitch+e.amount,ur(a,e)}if(a.zoom||a.bearing){const e=void 0===n.pinchAround?n.around:n.pinchAround;a.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),e.extend(a,{noMoveStart:!0})}}function ur(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function dr(t,n,r){const{maxSpeed:a,linearity:i,deceleration:o}=r,s=e.clamp(t*i/(n/1e3),-a,a),l=Math.abs(s)/(o*i);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}class pr extends e.Event{constructor(t,n,r,a={}){const o=i.mousePos(n.getCanvasContainer(),r),s=n.unproject(o);super(t,e.extend({point:o,lngLat:s,originalEvent:r},a)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class mr extends e.Event{constructor(t,n,r){const a="touchend"===t?r.changedTouches:r.touches,o=i.touchPos(n.getCanvasContainer(),a),s=o.map(e=>n.unproject(e)),l=o.reduce((e,t,n,r)=>e.add(t.div(r.length)),new e.pointGeometry(0,0));super(t,{points:o,point:l,lngLats:s,lngLat:n.unproject(l),originalEvent:r}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class br extends e.Event{constructor(e,t,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class hr{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new br(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new pr(e.type,this._map,e))}mouseup(e){this._map.fire(new pr(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new pr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new pr(e.type,this._map,e))}mouseover(e){this._map.fire(new pr(e.type,this._map,e))}mouseout(e){this._map.fire(new pr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new mr(e.type,this._map,e))}touchmove(e){this._map.fire(new mr(e.type,this._map,e))}touchend(e){this._map.fire(new mr(e.type,this._map,e))}touchcancel(e){this._map.fire(new mr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class fr{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new pr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new pr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new pr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gr{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 r=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 a=Math.min(r.x,n.x),o=Math.max(r.x,n.x),s=Math.min(r.y,n.y),l=Math.max(r.y,n.y);i.setTransform(this._box,`translate(${a}px,${s}px)`),this._box.style.width=o-a+"px",this._box.style.height=l-s+"px"}mouseupWindow(t,n){if(!this._active)return;if(0!==t.button)return;const r=this._startPos,a=n;if(this.reset(),i.suppressClick(),r.x!==a.x||r.y!==a.y)return this._map.fire(new e.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:e=>e.fitScreenCoordinates(r,a,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 _r(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 r=0;r<e.length;r++)n[e[r].identifier]=t[r];return n}class yr{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),r.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=_r(r,n)))}touchmove(e,t,n){if(this.aborted||!this.centroid)return;const r=_r(n,t);for(const e in this.touches){const t=this.touches[e],n=r[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 Mr{constructor(e){this.singleTap=new yr(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 r=this.singleTap.touchend(e,t,n);if(r){const t=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(r)<30;if(t&&n||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class vr{constructor(){this._zoomIn=new Mr({numTouches:1,numTaps:2}),this._zoomOut=new Mr({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 r=this._zoomIn.touchend(e,t,n),a=this._zoomOut.touchend(e,t,n);return 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})}):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})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const zr={0:1,2:2};class Or{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=zr[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 kr extends Or{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 Ar extends Or{_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 xr extends Or{_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 wr{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,r){r.length>0&&(this._active=!0);const a=_r(r,n),i=new e.pointGeometry(0,0),o=new e.pointGeometry(0,0);let s=0;for(const e in a){const t=a[e],n=this._touches[e];n&&(i._add(t),o._add(t.sub(n)),s++,a[e]=t)}if(this._touches=a,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 Nr{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[r,a]=this._firstTwoTouches,i=qr(n,t,r),o=qr(n,t,a);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[r,a]=this._firstTwoTouches,o=qr(n,t,r),s=qr(n,t,a);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 qr(e,t,n){for(let r=0;r<e.length;r++)if(e[r].identifier===n)return t[r]}function Er(e,t){return Math.log(e/t)/Math.LN2}class jr extends Nr{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(Er(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Er(this._distance,n),pinchAround:t}}}function Wr(e,t){return 180*e.angleWith(t)/Math.PI}class Lr extends Nr{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:Wr(this._vector,n),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const t=25/(Math.PI*this._minDiameter)*360,n=Wr(e,this._startVector);return Math.abs(n)<t}}function Sr(e){return Math.abs(e.y)>Math.abs(e.x)}class Tr extends Nr{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,Sr(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,n){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const r=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,a,n.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,n){if(void 0!==this._valid)return this._valid;const r=e.mag()>=2,a=t.mag()>=2;if(!r&&!a)return;if(!r||!a)return void 0===this._firstMove&&(this._firstMove=n),n-this._firstMove<100&&void 0;const i=e.y>0==t.y>0;return Sr(e)&&Sr(t)&&i}}const Cr={panStep:100,bearingStep:15,pitchStep:10};class Rr{constructor(){const e=Cr;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,r=0,a=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(),a=-1);break;case 39:e.shiftKey?n=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),i=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),i=1);break;default:return}return this._rotationDisabled&&(n=0,r=0),{cameraAnimation:o=>{const s=o.getZoom();o.easeTo({duration:300,easeId:"keyboardHandler",easing:Dr,zoom:t?Math.round(s)+t*(e.shiftKey?2:1):s,bearing:o.getBearing()+n*this._bearingStep,pitch:o.getPitch()+r*this._pitchStep,offset:[-a*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 Dr(e){return e*(2-e)}const Pr=4.000244140625;class Br{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 r=e.exported.now(),a=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==n&&n%Pr==0?this._type="wheel":0!==n&&Math.abs(n)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(a*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)>Pr?this._wheelZoomRate:this._defaultZoomRate;let n=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==n&&(n=1/n);const r="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(r*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,r=this._startZoom,a=this._easing;let i,o=!1;if("wheel"===this._type&&r&&a){const t=Math.min((e.exported.now()-this._lastWheelEventTime)/200,1),s=a(t);i=e.number(r,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,r=(e.exported.now()-t.start)/t.duration,a=t.easing(r+.01)-t.easing(r),i=.27/Math.sqrt(a*a+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 Ir{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 $r{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 Fr{constructor(){this._tap=new Mr({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 r=t[0],a=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:a/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 Yr{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 Xr{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 Hr{constructor(e,t,n,r){this._el=e,this._touchZoom=t,this._touchRotate=n,this._tapDragZoom=r,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 Vr=e=>e.zoom||e.drag||e.pitch||e.rotate;class Ur extends e.Event{}function Gr(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}class Kr{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new cr(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),e.bindAll(["handleEvent","handleWindowEvent"],this);const r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"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 hr(t,e));const r=t.boxZoom=new gr(t,e);this._add("boxZoom",r);const a=new vr,i=new $r;t.doubleClickZoom=new Ir(i,a),this._add("tapZoom",a),this._add("clickZoom",i);const o=new Fr;this._add("tapDragZoom",o);const s=t.touchPitch=new Tr(t);this._add("touchPitch",s);const l=new Ar(e),c=new xr(e);t.dragRotate=new Xr(e,l,c),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);const u=new kr(e),d=new wr(e,t);t.dragPan=new Yr(n,u,d),this._add("mousePan",u),this._add("touchPan",d,["touchZoom","touchRotate"]);const p=new Lr,m=new jr;t.touchZoomRotate=new Hr(n,m,p,o),this._add("touchRotate",p,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]);const b=t.scrollZoom=new Br(t,this);this._add("scrollZoom",b,["mousePan"]);const h=t.keyboard=new Rr;this._add("keyboard",h),this._add("blockableMapEvent",new fr(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(Vr(this._eventsInProgress))||this.isZooming()}_blockedByActive(e,t,n){for(const r in e)if(r!==n&&(!t||t.indexOf(r)<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,r={needsRenderFrame:!1},a={},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(r,a,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||Gr(r))&&(this._changes.push([r,a,u]),this._triggerRenderFrame()),(Object.keys(o).length||Gr(r))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:d}=r;d&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],d(this._map))}mergeHandlerResult(t,n,r,a,i){if(!r)return;e.extend(t,r);const o={handlerName:a,originalEvent:r.originalEvent||i};void 0!==r.zoomDelta&&(n.zoom=o),void 0!==r.panDelta&&(n.drag=o),void 0!==r.pitchDelta&&(n.pitch=o),void 0!==r.bearingDelta&&(n.rotate=o)}_applyChanges(){const t={},n={},r={};for(const[a,i,o]of this._changes)a.panDelta&&(t.panDelta=(t.panDelta||new e.pointGeometry(0,0))._add(a.panDelta)),a.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+a.zoomDelta),a.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+a.bearingDelta),a.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+a.pitchDelta),void 0!==a.around&&(t.around=a.around),void 0!==a.pinchAround&&(t.pinchAround=a.pinchAround),a.noInertia&&(t.noInertia=a.noInertia),e.extend(n,i),e.extend(r,o);this._updateMapTransform(t,n,r),this._changes=[]}_updateMapTransform(t,n,r){const a=this._map,i=a.transform,o=a.style&&a.style.terrain;if(!(Gr(t)||o&&this._drag))return this._fireEvents(n,r,!0);let{panDelta:s,zoomDelta:l,bearingDelta:c,pitchDelta:u,around:d,pinchAround:p}=t;void 0!==p&&(d=p),a._stop(!0),d=d||a.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},a.fire(new e.Event("freezeElevation",{freeze:!0}))):this._drag&&r[this._drag.handlerName]?(a.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,r,!0)}_fireEvents(t,n,r){const a=Vr(this._eventsInProgress),i=Vr(t),o={};for(const e in t){const{originalEvent:n}=t[e];this._eventsInProgress[e]||(o[e+"start"]=n),this._eventsInProgress[e]=t[e]}!a&&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:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=n[t]||r,s[e+"end"]=l)}for(const e in s)this._fireEvent(e,s[e]);const c=Vr(this._eventsInProgress);if(r&&(a||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 Ur("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}const Jr={extend:(t,...n)=>e.extend(t,...n),run(e){e()},logToElement(e,t=!1,n="log"){const r=window.document.getElementById(n);r&&(t&&(r.innerHTML=""),r.innerHTML+="<br>"+e)}};class Zr 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,r){return t=e.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,e.extend({offset:t},n),r)}panTo(t,n,r){return this.easeTo(e.extend({center:t},n),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(t,n,r){return this.easeTo(e.extend({zoom:t},n),r)}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,r){return this.easeTo(e.extend({bearing:t},n),r)}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 r=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),r,n)}_cameraForBoxAndBearing(t,n,r,a){const i={top:0,bottom:0,right:0,left:0};if("number"==typeof(a=e.extend({padding:i,offset:[0,0],maxZoom:this.transform.maxZoom},a)).padding){const e=a.padding;a.padding={top:e,bottom:e,right:e,left:e}}a.padding=e.extend(i,a.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(-r*Math.PI/180),d=c.rotate(-r*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+a.padding.left+a.padding.right))/b.x,f=(o.height-(s.top+s.bottom+a.padding.top+a.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)),a.maxZoom),_=e.pointGeometry.convert(a.offset),y=new e.pointGeometry((a.padding.left-a.padding.right)/2,(a.padding.top-a.padding.bottom)/2).rotate(r*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:r}}fitBounds(e,t,n){return this._fitInternal(this.cameraForBounds(e,t),t,n)}fitScreenCoordinates(t,n,r,a,i){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(e.pointGeometry.convert(t)),this.transform.pointLocation(e.pointGeometry.convert(n)),r,a),a,i)}_fitInternal(t,n,r){return t?(delete(n=e.extend(t,n)).padding,n.linear?this.easeTo(n,r):this.flyTo(n,r)):this}jumpTo(t,n){this.stop();const r=this.transform;let a=!1,i=!1,o=!1;return"zoom"in t&&r.zoom!==+t.zoom&&(a=!0,r.zoom=+t.zoom),void 0!==t.center&&(r.center=e.LngLat.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(i=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(o=!0,r.pitch=+t.pitch),null==t.padding||r.isPaddingEqual(t.padding)||(r.padding=t.padding),this.fire(new e.Event("movestart",n)).fire(new e.Event("move",n)),a&&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,r,a=0){const i=e.MercatorCoordinate.fromLngLat(t,n),o=e.MercatorCoordinate.fromLngLat(r,a),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 r=this.transform,a=this.getZoom(),i=this.getBearing(),o=this.getPitch(),s=this.getPadding(),l="zoom"in t?+t.zoom:a,c="bearing"in t?this._normalizeBearing(t.bearing,i):i,u="pitch"in t?+t.pitch:o,d="padding"in t?t.padding:r.padding,p=e.pointGeometry.convert(t.offset);let m=r.centerPoint.add(p);const b=r.pointLocation(m),h=e.LngLat.convert(t.center||b);this._normalizeCenter(h);const f=r.project(b),g=r.project(h).sub(f),_=r.zoomScale(l-a);let y,M;t.around&&(y=e.LngLat.convert(t.around),M=r.locationPoint(y));const v={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||l!==a,this._rotating=this._rotating||i!==c,this._pitching=this._pitching||u!==o,this._padding=!r.isPaddingEqual(d),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,v),this._ease(t=>{if(this._zooming&&(r.zoom=e.number(a,l,t)),this._rotating&&(r.bearing=e.number(i,c,t)),this._pitching&&(r.pitch=e.number(o,u,t)),this._padding&&(r.interpolatePadding(s,d,t),m=r.centerPoint.add(p)),y)r.setLocationAtPoint(y,M);else{const e=r.zoomScale(r.zoom-a),n=l>a?Math.min(2,_):Math.max(.5,_),i=Math.pow(n,1-t),o=r.unproject(f.add(g.mult(t*i)).mult(e));r.setLocationAtPoint(r.renderWorldCopies?o.wrap():o,m)}this._fireMoveEvents(n)},e=>{this._afterEase(n,e)},t),this}_prepareEase(t,n,r={}){this._moving=!0,this.fire(new e.Event("freezeElevation",{freeze:!0})),n||r.moving||this.fire(new e.Event("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.Event("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.Event("rotatestart",t)),this._pitching&&!r.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 r=this._zooming,a=this._rotating,i=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new e.Event("zoomend",t)),a&&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 r=e.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(r,n)}this.stop(),t=e.extend({offset:[0,0],speed:1.2,curve:1.42,easing:e.ease},t);const r=this.transform,a=this.getZoom(),i=this.getBearing(),o=this.getPitch(),s=this.getPadding(),l="zoom"in t?e.clamp(+t.zoom,r.minZoom,r.maxZoom):a,c="bearing"in t?this._normalizeBearing(t.bearing,i):i,u="pitch"in t?+t.pitch:o,d="padding"in t?t.padding:r.padding,p=r.zoomScale(l-a),m=e.pointGeometry.convert(t.offset);let b=r.centerPoint.add(m);const h=r.pointLocation(b),f=e.LngLat.convert(t.center||h);this._normalizeCenter(f);const g=r.project(h),_=r.project(f).sub(g);let y=t.curve;const M=Math.max(r.width,r.height),v=M/p,z=_.mag();if("minZoom"in t){const n=e.clamp(Math.min(t.minZoom,a,l),r.minZoom,r.maxZoom),i=M/r.zoomScale(n-a);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=!r.isPaddingEqual(d),this._prepareEase(n,!1),this._ease(t=>{const p=t*E,h=1/N(p);r.zoom=1===t?l:a+r.scaleZoom(h),this._rotating&&(r.bearing=e.number(i,c,t)),this._pitching&&(r.pitch=e.number(o,u,t)),this._padding&&(r.interpolatePadding(s,d,t),b=r.centerPoint.add(m));const y=1===t?f:r.unproject(g.add(_.mult(q(p))).mult(h));r.setLocationAtPoint(r.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,r){!1===r.animate||0===r.duration?(t(1),n()):(this._easeStart=e.exported.now(),this._easeOptions=r,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 r=Math.abs(t-n);return Math.abs(t-360-n)<r&&(t-=360),Math.abs(t+360-n)<r&&(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 Qr{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 r=t[n];if(r.used||r.usedForTerrain){const t=r.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,n)=>{for(let r=n+1;r<e.length;r++)if(e[r].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 ea{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 ta{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 na={"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"},ra={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},aa={showCompass:!0,showZoom:!0,visualizePitch:!1};class ia{constructor(t,n,r=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Ar({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,r&&(this.mousePitch=new xr({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,r=this.mouseRotate.mousemoveWindow(e,t);if(r&&r.bearingDelta&&n.setBearing(n.getBearing()+r.bearingDelta),this.mousePitch){const r=this.mousePitch.mousemoveWindow(e,t);r&&r.pitchDelta&&n.setPitch(n.getPitch()+r.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 oa(t,n,r){if(t=new e.LngLat(t.lng,t.lat),n){const a=new e.LngLat(t.lng-360,t.lat),i=new e.LngLat(t.lng+360,t.lat),o=r.locationPoint(t).distSqr(n);r.locationPoint(a).distSqr(n)<o?t=a:r.locationPoint(i).distSqr(n)<o&&(t=i)}for(;Math.abs(t.lng-r.center.lng)>180;){const e=r.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=r.width&&e.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}const sa={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 la(e,t,n){const r=e.classList;for(const e in sa)r.remove(`maplibregl-${n}-anchor-${e}`,`mapboxgl-${n}-anchor-${e}`);r.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class ca 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"),r=41,a=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",r+"px"),n.setAttributeNS(null,"width",a+"px"),n.setAttributeNS(null,"viewBox",`0 0 ${a} ${r}`);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",r*this._scale+"px"),n.setAttributeNS(null,"width",a*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()}),la(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,r=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":[r,-1*(t-n+r)],"bottom-right":[-r,-1*(t-n+r)],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=oa(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,`${sa[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 ua={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let da,pa=0,ma=!1;const ba={maxWidth:100,unit:"metric"};function ha(e,t,n){const r=n&&n.maxWidth||100,a=e._container.clientHeight/2,i=e.unproject([0,a]),o=e.unproject([r,a]),s=i.distanceTo(o);if(n&&"imperial"===n.unit){const n=3.2808*s;n>5280?fa(t,r,n/5280,e._getUIString("ScaleControl.Miles")):fa(t,r,n,e._getUIString("ScaleControl.Feet"))}else n&&"nautical"===n.unit?fa(t,r,s/1852,e._getUIString("ScaleControl.NauticalMiles")):s>=1e3?fa(t,r,s/1e3,e._getUIString("ScaleControl.Kilometers")):fa(t,r,s,e._getUIString("ScaleControl.Meters"))}function fa(e,t,n,r){const a=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*(a/n)+"px",e.innerHTML=`${a}&nbsp;${r}`}const ga={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},_a=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ya(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 ya(new e.pointGeometry(0,0))}const Ma={supported:t,setRTLTextPlugin:e.setRTLTextPlugin,getRTLTextPluginStatus:e.getRTLTextPluginStatus,Map:class extends Zr{constructor(t){var n;if(e.PerformanceUtils.mark(e.PerformanceMarkers.create),null!=(t=e.extend({},ra,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 nr(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 ta,this._controls=[],this._mapId=e.uniqueId(),this._locale=e.extend({},na,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 Kr(this,t),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=t.hash&&new rr("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 Qr({customAttribution:t.customAttribution})),t.maplibreLogo&&this.addControl(new ea,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 r=t.onAdd(this);this._controls.push(t);const a=this._controlPositions[n];return-1!==n.indexOf("bottom")?a.insertBefore(r,a.firstChild):a.appendChild(r),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,r){return null==r&&this.style.terrain&&(r=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(e,t,n,r)}resize(t){const n=this._containerDimensions(),r=n[0],a=n[1];this._resizeCanvas(r,a,this.getPixelRatio()),this.transform.resize(r,a),this.painter.resize(r,a,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 r=!1;const a=a=>{const i=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];i.length?r||(r=!0,n.call(this,new pr(e,this,a.originalEvent,{features:i}))):r=!1};return{layer:t,listener:n,delegates:{mousemove:a,mouseout:()=>{r=!1}}}}if("mouseleave"===e||"mouseout"===e){let r=!1;const a=a=>{(this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[]).length?r=!0:r&&(r=!1,n.call(this,new pr(e,this,a.originalEvent)))},i=t=>{r&&(r=!1,n.call(this,new pr(e,this,t.originalEvent)))};return{layer:t,listener:n,delegates:{mousemove:a,mouseout:i}}}{const r=e=>{const r=this.getLayer(t)?this.queryRenderedFeatures(e.point,{layers:[t]}):[];r.length&&(e.features=r,n.call(this,e),delete e.features)};return{layer:t,listener:n,delegates:{[e]:r}}}}on(e,t,n){if(void 0===n)return super.on(e,t);const r=this._createDelegatedListener(e,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r);for(const e in r.delegates)this.on(e,r.delegates[e]);return this}once(e,t,n){if(void 0===n)return super.once(e,t);const r=this._createDelegatedListener(e,t,n);for(const e in r.delegates)this.once(e,r.delegates[e]);return this}off(e,t,n){return void 0===n?super.off(e,t):(this._delegatedListeners&&this._delegatedListeners[e]&&(r=>{const a=this._delegatedListeners[e];for(let e=0;e<a.length;e++){const r=a[e];if(r.layer===t&&r.listener===n){for(const e in r.delegates)this.off(e,r.delegates[e]);return a.splice(e,1),this}}})(),this)}queryRenderedFeatures(t,n){if(!this.style)return[];let r;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])r=[e.pointGeometry.convert(t)];else{const n=e.pointGeometry.convert(t[0]),a=e.pointGeometry.convert(t[1]);r=[n,new e.pointGeometry(a.x,n.y),a,new e.pointGeometry(n.x,a.y),n]}return this.style.queryRenderedFeatures(r,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 r=this._requestManager.transformRequest(t,e.ResourceType.Style);e.getJSON(r,(t,r)=>{t?this.fire(new e.ErrorEvent(t)):r&&this._updateDiff(r,n)})}else"object"==typeof t&&this._updateDiff(t,n)}_updateDiff(t,n){try{this.style.setState(t)&&this._update(!0)}catch(r){e.warnOnce(`Unable to perform style diff: ${r.message||r.error||r}. 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:r=1,sdf:a=!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:r,stretchX:i,stretchY:o,content:s,sdf:a,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:r,stretchX:i,stretchY:o,content:s,sdf:a,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t)}}}updateImage(t,n){const r=this.style.getImage(t);if(!r)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 a=n instanceof HTMLImageElement||e.isImageBitmap(n)?e.exported.getImageData(n):n,{width:i,height:o,data:s}=a;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!==r.data.width||o!==r.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));r.data.replace(s,l),this.style.updateImage(t,r)}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,r={}){return this.style.setPaintProperty(e,t,n,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,n,r={}){return this.style.setLayoutProperty(e,t,n,r),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 r=this._controlContainer=i.create("div","maplibregl-control-container mapboxgl-control-container",e),a=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(e=>{a[e]=i.create("div",`maplibregl-ctrl-${e} mapboxgl-ctrl-${e}`,r)}),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}),r=this._canvas.getContext("webgl",n)||this._canvas.getContext("experimental-webgl",n);r?(this.painter=new Zn(r,this.transform),e.exported$1.testSupport(r)):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,r=0;const a=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(n=a.createQueryEXT(),a.beginQueryEXT(a.TIME_ELAPSED_EXT,n),r=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 r=new e.EvaluationParameters(t,{now:n,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=r.crossFadingFactor();1===a&&a===this._crossFadingFactor||(i=!0,this._crossFadingFactor=a),this.style.update(r)}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()-r;a.endQueryEXT(a.TIME_ELAPSED_EXT,n),setTimeout(()=>{const r=a.getQueryObjectEXT(n,a.QUERY_RESULT_EXT)/1e6;a.deleteQueryEXT(n),this.fire(new e.Event("gpu-timing-frame",{cpuTime:t,gpuTime:r}))},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({},aa,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 ia(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({},ua,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!==da?t(da):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then(e=>{da="denied"!==e.state,t(da)}):(da=!!window.navigator.geolocation,t(da)),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,pa=0,ma=!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),r=t.coords.accuracy,a=this._map.getBearing(),i=e.extend({bearing:a},this.options.fitBoundsOptions);this._map.fitBounds(n.toBounds(r),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]),r=t.distanceTo(n),a=Math.ceil(2*this._accuracy/r);this._circleElement.style.width=a+"px",this._circleElement.style.height=a+"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&&ma)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 ca(this._dotElement),this._circleElement=i.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ca({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":pa--,ma=!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"),pa++,pa>1?(e={maximumAge:6e5,timeout:0},ma=!0):(e=this.options.positionOptions,ma=!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:Qr,LogoControl:ea,ScaleControl:class{constructor(t){this.options=e.extend({},ba,t),e.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){ha(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,ha(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(ga),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 r;for(n.innerHTML=e;r=n.firstChild,r;)t.appendChild(r);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=oa(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 r=ya(this.options.offset);if(!n){const e=this._container.offsetWidth,a=this._container.offsetHeight;let i;i=t.y+r.bottom.y<a?["top"]:t.y>this._map.transform.height-a?["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 a=t.add(r[n]).round();i.setTransform(this._container,`${sa[n]} translate(${a.x}px,${a.y}px)`),la(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const e=this._container.querySelector(_a);e&&e.focus()}_onClose(){this.remove()}},Marker:ca,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(){X().acquire(I)},clearPrewarmedResources:function(){const e=Y;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(I),Y=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 Jr.extend(Ma,{isSafari:e.isSafari,getPerformanceMetrics:e.PerformanceUtils.getPerformanceMetrics}),Ma})),n}()},,function(e,t,n){!function(t,n){var r=function(e,t,n){"use strict";var r,a;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 a=e.lazySizesConfig||e.lazysizesConfig||{},n)t in a||(a[t]=n[t])}(),!t||!t.getElementsByClassName)return{init:function(){},cfg:a,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 r=n?"addEventListener":"removeEventListener";n&&_(e,t),p.forEach((function(n){e[r](n,t)}))},y=function(e,n,a,i,o){var s=t.createEvent("Event");return a||(a={}),a.instance=r,s.initEvent(n,!i,!o),s.detail=a,e.dispatchEvent(s),s},M=function(t,n){var r;!o&&(r=e.picturefill||a.pf)?(n&&n.src&&!t.getAttribute("srcset")&&t.setAttribute("srcset",n.src),r({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<a.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,r,a=function(){t=null,e()},i=function(){var e=n.now()-r;e<99?l(i,99-e):(u||a)(a)};return function(){r=n.now(),t||(t=l(i,99))}},x=(X=/^img$/i,H=/^iframe$/i,V="onscroll"in e&&!/(gle|ing)bot/.test(navigator.userAgent),U=0,G=0,K=-1,J=function(e){G--,(!e||G<0||!e.target)&&(G=0)},Z=function(e){return null==Y&&(Y="hidden"==v(t.body,"visibility")),Y||!("hidden"==v(e.parentNode,"visibility")&&"hidden"==v(e,"visibility"))},Q=function(e,n){var r,a=e,o=Z(e);for(B-=n,F+=n,I-=n,$+=n;o&&(a=a.offsetParent)&&a!=t.body&&a!=i;)(o=(v(a,"opacity")||1)>0)&&"visible"!=v(a,"overflow")&&(r=a.getBoundingClientRect(),o=$>r.left&&I<r.right&&F>r.top-1&&B<r.bottom+1);return o},ee=function(){var e,n,o,s,l,c,u,d,p,m,b,h,f=r.elements;if((C=a.loadMode)&&G<8&&(e=f.length)){for(n=0,K++;n<e;n++)if(f[n]&&!f[n]._lazyRace)if(!V||r.prematureUnveil&&r.prematureUnveil(f[n]))se(f[n]);else if((d=f[n].getAttribute("data-expand"))&&(c=1*d)||(c=U),m||(m=!a.expand||a.expand<1?i.clientHeight>500&&i.clientWidth>500?500:370:a.expand,r._defEx=m,b=m*a.expFactor,h=a.hFac,Y=null,U<b&&G<1&&K>2&&C>2&&!t.hidden?(U=b,K=0):U=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)&&(a.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]||a.preloadAfterLoad)&&(L[0]||!d&&(F||$||I||B||"auto"!=f[n].getAttribute(a.sizesAttr)))&&(s=L[0]||f[n]);s&&!l&&se(s)}},te=function(e){var t,r=0,i=a.throttleDelay,o=a.ricTimeout,s=function(){t=!1,r=n.now(),e()},c=u&&o>49?function(){u(s,{timeout:o}),o!==a.ricTimeout&&(o=a.ricTimeout)}:k((function(){l(s)}),!0);return function(e){var a;(e=!0===e)&&(o=33),t||(t=!0,(a=i-(n.now()-r))<0&&(a=0),e||a<9?c():l(c,a))}}(ee),ne=function(e){var t=e.target;t._lazyCache?delete t._lazyCache:(J(e),f(t,a.loadedClass),g(t,a.loadingClass),_(t,ae),y(t,"lazyloaded"))},re=k(ne),ae=function(e){re({target:e.target})},ie=function(e){var t,n=e.getAttribute(a.srcsetAttr);(t=a.customMedia[e.getAttribute("data-media")||e.getAttribute("media")])&&e.setAttribute("media",t),n&&e.setAttribute("srcset",n)},oe=k((function(e,t,n,r,i){var o,s,c,u,p,m;(p=y(e,"lazybeforeunveil",t)).defaultPrevented||(r&&(n?f(e,a.autosizesClass):e.setAttribute("sizes",r)),s=e.getAttribute(a.srcsetAttr),o=e.getAttribute(a.srcAttr),i&&(u=(c=e.parentNode)&&d.test(c.nodeName||"")),m=t.firesLoad||"src"in e&&(s||o||u),p={target:e},f(e,a.loadingClass),m&&(clearTimeout(T),T=l(J,2500),_(e,ae,!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")||a.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,a.lazyClass),O((function(){var t=e.complete&&e.naturalWidth>1;m&&!t||(t&&f(e,a.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=X.test(e.nodeName),r=n&&(e.getAttribute(a.sizesAttr)||e.getAttribute("sizes")),i="auto"==r;(!i&&S||!n||!e.getAttribute("src")&&!e.srcset||e.complete||h(e,a.errorClass)||!h(e,a.lazyClass))&&(t=y(e,"lazyunveilread").detail,i&&w.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,G++,oe(e,t,i,r,n))}},le=A((function(){a.loadMode=3,te()})),ce=function(){3==a.loadMode&&(a.loadMode=2),le()},ue=function(){S||(n.now()-R<999?l(ue,999):(S=!0,a.loadMode=3,te(),s("scroll",ce,!0)))},{_:function(){R=n.now(),r.elements=t.getElementsByClassName(a.lazyClass),L=t.getElementsByClassName(a.lazyClass+" "+a.preloadClass),s("scroll",te,!0),s("resize",te,!0),s("pageshow",(function(e){if(e.persisted){var n=t.querySelectorAll("."+a.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)),r.elements.length?(ee(),O._lsFlush()):te()},checkElems:te,unveil:se,_aLSL:ce}),w=(E=k((function(e,t,n,r){var a,i,o;if(e._lazysizesWidth=r,r+="px",e.setAttribute("sizes",r),d.test(t.nodeName||""))for(i=0,o=(a=t.getElementsByTagName("source")).length;i<o;i++)a[i].setAttribute("sizes",r);n.detail.dataAttr||M(e,n.detail)})),j=function(e,t,n){var r,a=e.parentNode;a&&(n=z(e,a,n),(r=y(e,"lazybeforesizes",{width:n,dataAttr:!!t})).defaultPrevented||(n=r.detail.width)&&n!==e._lazysizesWidth&&E(e,a,r,n))},W=A((function(){var e,t=q.length;if(t)for(e=0;e<t;e++)j(q[e])})),{_:function(){q=t.getElementsByClassName(a.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,Y,X,H,V,U,G,K,J,Z,Q,ee,te,ne,re,ae,ie,oe,se,le,ce,ue;var de,pe,me,be,he,fe,ge;return l((function(){a.init&&N()})),r={cfg:a,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=r,e.exports&&(e.exports=r)}("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 r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),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,r=e.className,i=e.icon,m=e.id,b=e.value,h=d[n],f=p[n];return i&&(f=i),a.a.createElement(a.a.Fragment,null,b&&a.a.createElement("div",{className:o()(Object(s.b)("pb_stat_change_kit",h),Object(l.c)(e),r),id:m},a.a.createElement(c.a,{status:h},f&&a.a.createElement(a.a.Fragment,null,a.a.createElement(u.a,{fixed_width:!0,icon:f})," "),"".concat(b,"%"))))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(52),l=n(2),c=n(5),u=n(14),d=n(17),p=n(8),m=n(15);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=e.alignment,i=void 0===r?"left":r,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.value,A=new s.a({value:k}),x=A.toWeekday(),w=A.toMonth(),N=A.toDay(),q=A.toYear(),E=(new Date).getFullYear().toString(),j=Object(l.a)(n),W=Object(l.c)(f),L=o()(Object(l.b)("pb_date_kit",i),Object(c.c)(e),b);return a.a.createElement("div",Object.assign({},j,W,{className:L,id:g}),"md"==O||"lg"==O?a.a.createElement(m.a,{size:4,tag:"h4"},v&&a.a.createElement(u.a,{className:"pb_icon_kit_container",color:"light",tag:"span"},a.a.createElement(p.a,{fixedWidth:!0,icon:"calendar-alt"})),y&&a.a.createElement(a.a.Fragment,null,x,a.a.createElement(u.a,{color:"light",tag:"span",text:" • "})),a.a.createElement("span",null,w," ",N),E!=q&&a.a.createElement("span",null,", ".concat(q))):a.a.createElement(a.a.Fragment,null,v&&a.a.createElement(d.a,{className:"pb_icon_kit_container",tag:"span"},a.a.createElement(p.a,{fixedWidth:!0,icon:"calendar-alt",size:"sm"})),y&&a.a.createElement(a.a.Fragment,null,a.a.createElement(d.a,{tag:"div"},x),a.a.createElement(d.a,{color:"light",tag:"div",text:" • "})),a.a.createElement(d.a,{tag:"span"},w," ",N,E!=q&&a.a.createElement(a.a.Fragment,null,", ".concat(q)))))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(57),u={home:"H#",project:"P#",appointment:"A#",default:"#"};t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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),r);return a.a.createElement("span",Object.assign({},v,z,{className:O,id:b}),a.a.createElement("a",{href:M,rel:h?"noreferrer":f,target:h?"_blank":"_self"},a.a.createElement(c.a,{dark:d,text:u[y]+g,variant:"primary"})))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),u=n(15),d=function(e){var t=e.active,n=e.dark,r=e.steps;return a.a.createElement("div",{className:"pb_progress_pill".concat(r<=t?"_active":"_inactive").concat(n?" dark":""),key:r})};t.a=function(e){var t=e.active,n=void 0===t?0:t,r=e.aria,i=void 0===r?{hidden:"true"}:r,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 a.a.createElement("div",Object.assign({},z,O,{className:k,id:h}),_&&a.a.createElement("div",{className:"progress_pills_status"},a.a.createElement(u.a,{dark:v,size:4,tag:"h4",text:_}),a.a.createElement(c.a,{color:"light",dark:v,text:y})),a.a.createElement("div",{className:"progress_pills"},function(e,t,n){for(var r=[],a=1;a<=e;a++)r.push(d({steps:a,active:t,dark:n}));return r}(g,n,v)))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return B}));var r=n(0),a=n.n(r),i=n(26),o=n(11),s=n(14),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,r=Object(i.omitBy)(n,u);return a.a.createElement("div",{className:"maskContainer"},Object(i.isEmpty)(n)&&a.a.createElement("div",{className:"filters"},a.a.createElement(s.a,{color:"light",paddingLeft:"xs",size:4,tag:"span",text:"No Filter Selected"})),!Object(i.isEmpty)(n)&&a.a.createElement("div",{className:"filters"},a.a.createElement("div",{className:"left_gradient"}),Object(i.map)(r,(function(e,n){return a.a.createElement("div",{className:"filter",key:"filter-".concat(n)},!0===e?a.a.createElement(c.a,{dark:t,size:4,tag:"h4",text:n}):a.a.createElement("div",null,a.a.createElement(l.a,{dark:t,text:n}),a.a.createElement(c.a,{dark:t,size:4,tag:"h4",text:e})))})),a.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,r=e.className,i=e.children,o=e.dark;return a.a.createElement("div",{className:m()("pb_filter_kit ".concat(r),Object(b.c)(e))},n?a.a.createElement(h.a,{dark:o,padding:"none"},i):a.a.createElement(a.a.Fragment,null,i))},g=n(58),_=n(76);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 r,a,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=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}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,r=new Array(t);n<t;n++)r[n]=e[n];return r}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(r.useState)(!0),2),c=l[0],u=l[1],d=a.a.createElement(g.a,{dark:n,icon:"filter",id:"filter",onClick:function(){return u(!c)},variant:"secondary"});return a.a.createElement(_.a,{closeOnClick:"outside",minWidth:i,placement:s,reference:d,shouldClosePopover:u,show:!c},a.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,r=e.title;return a.a.createElement(a.a.Fragment,null,n&&r?a.a.createElement(a.a.Fragment,null,a.a.createElement(z.a,{align:"center",count:n,dark:t,title:"".concat(O(n),":")})):n?a.a.createElement(a.a.Fragment,null,a.a.createElement(l.a,{className:"filter-results",dark:t,size:"xs",text:"".concat(n," ").concat(O(n))})):a.a.createElement("div",null))},A=n(24),x=n(8),w=n(80),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 r,a,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=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}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,r=new Array(t);n<t;n++)r[n]=e[n];return r}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,r){var o=function(e,t){var n=Object(i.find)(e,{name:t});return{name:t,dir:n&&"asc"==n.dir?"desc":"asc"}}(t,r);return a.a.createElement(N.a,{key:"option-".concat(o.name,"-").concat(o.dir)},a.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(r.useState)(!0),2),c=l[0],u=l[1],d=a.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 r=e.dir,i=e.name;return a.a.createElement("span",{key:"current-sort-".concat(i,"-").concat(r)}," ".concat(n[i]),a.a.createElement(x.a,{dark:t,icon:j(r)}))})));return a.a.createElement(_.a,{className:"pb_filter_sort_menu",closeOnClick:"outside",padding:"none",placement:"bottom",reference:d,shouldClosePopover:u,show:!c},a.a.createElement(w.a,null,W(n,o,(function(e){u(!0),s([e])}))))},S=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n},T=function(e){var t=e.onSortChange,n=e.sortOptions,r=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 a.a.createElement(f,Object.assign({dark:u},b),a.a.createElement(o.a,{orientation:"row",paddingRight:"lg",vertical:"center"},c&&a.a.createElement(a.a.Fragment,null,a.a.createElement(v,{dark:u,minWidth:p,placement:m},c),a.a.createElement(d,{dark:u,filters:s})),a.a.createElement(k,{dark:u,results:l}),!Object(i.isEmpty)(n)&&a.a.createElement(L,{dark:u,onChange:t,options:n,value:r})))},C=n(54),R=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n},D=function(e){var t=e.onSortChange,n=e.sortOptions,r=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 a.a.createElement(f,Object.assign({dark:u},b),a.a.createElement(o.a,{orientation:"row",vertical:"center"},a.a.createElement(v,{dark:u,minWidth:p,placement:m},c),a.a.createElement(d,{dark:u,filters:i})),a.a.createElement(C.a,{dark:u}),a.a.createElement(o.a,{className:"filter-bottom",orientation:"row",spacing:"between",vertical:"center"},a.a.createElement(k,{dark:u,results:s,title:!0}),a.a.createElement(o.a,{orientation:"row",vertical:"center"},a.a.createElement(l.a,{dark:u,text:"sort by:"}),a.a.createElement(L,{dark:u,onChange:t,options:n,value:r}))))},P=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]])}return n},B=function(e){var t=e.double,n=void 0!==t&&t,r=P(e,["double"]);return a.a.createElement(a.a.Fragment,null,!0===n?a.a.createElement(D,Object.assign({},r)):a.a.createElement(T,Object.assign({},r)))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(2),l=n(5),c=n(14),u=n(8);t.a=function(e){var t=e.align,n=void 0===t?"left":t,r=e.aria,i=void 0===r?{}:r,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 a.a.createElement("div",Object.assign({},h,f,{className:g,id:b}),a.a.createElement(c.a,{color:"light"},a.a.createElement(u.a,{aria:{label:"loading icon"},fixedWidth:!0,icon:"spinner",pulse:!0})," Loading"))}},function(e,t,n){"use strict";var r=n(0),a=n.n(r),i=n(3),o=n.n(i),s=n(5),l=n(2),c=n(33),u=n(57);t.a=function(e){var t=e.aria,n=void 0===t?{}:t,r=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),r);return a.a.createElement("div",Object.assign({},_,y,{className:M,id:b}),h.slice(0,1).map((function(e,t){return a.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 a.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 a.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 r=["onChange","onClose","onDayCreate","onDestroy","onKeyDown","onMonthChange","onOpen","onParseConfig","onReady","onValueUpdate","onYearChange","onPreCalendarPosition"],a={_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 r=this,a=arguments;clearTimeout(n),n=setTimeout((function(){return e.apply(r,a)}),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 r=window.document.createElement(e);return t=t||"",n=n||"",r.className=t,void 0!==n&&(r.textContent=n),r}function m(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function b(e,t){var n=p("div","numInputWrapper"),r=p("input","numInput "+e),a=p("span","arrowUp"),i=p("span","arrowDown");if(-1===navigator.userAgent.indexOf("MSIE 9.0")?r.type="number":(r.type="text",r.pattern="\\d*"),void 0!==t)for(var o in t)r.setAttribute(o,t[o]);return n.appendChild(r),n.appendChild(a),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 r=parseInt(t),a=new Date(e.getFullYear(),0,2+7*(r-1),0,0,0,0);return a.setDate(a.getDate()-a.getDay()+n.firstDayOfWeek),a},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?a:t,r=e.l10n,o=void 0===r?i:r,s=e.isMobile,l=void 0!==s&&s;return function(e,t,r){var a=r||o;return void 0===n.formatDate||l?t.split("").map((function(t,r,i){return M[t]&&"\\"!==i[r-1]?M[t](e,a,n):"\\"!==t?t:""})).join(""):n.formatDate(e,t,a)}},z=function(e){var t=e.config,n=void 0===t?a:t,r=e.l10n,o=void 0===r?i:r;return function(e,t,r,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||a).dateFormat,d=String(e).trim();if("today"===d)s=new Date,r=!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===r&&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,r=e.defaultSeconds;if(void 0!==e.minDate){var a=e.minDate.getHours(),i=e.minDate.getMinutes(),o=e.minDate.getSeconds();t<a&&(t=a),t===a&&n<i&&(n=i),t===a&&n===i&&r<o&&(r=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&&(r=e.maxDate.getSeconds())}return{hours:t,minutes:n,seconds:r}}n(356);var w=function(){return(w=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},N=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),a=0;for(t=0;t<n;t++)for(var i=arguments[t],o=0,s=i.length;o<s;o++,a++)r[a]=i[o];return r};function q(e,t){var n={config:w(w({},a),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()),r=x(n.config);t.setHours(r.hours,r.minutes,r.seconds,t.getMilliseconds()),n.selectedDates=[t],n.latestSelectedDateObj=t}void 0!==e&&"blur"!==e.type&&function(e){e.preventDefault();var t="keydown"===e.type,r=h(e),a=r;void 0!==n.amPM&&r===n.amPM&&(n.amPM.textContent=n.l10n.amPM[l(n.amPM.textContent===n.l10n.amPM[0])]);var i=parseFloat(a.getAttribute("min")),o=parseFloat(a.getAttribute("max")),c=parseFloat(a.getAttribute("step")),u=parseInt(a.value,10),d=e.delta||(t?38===e.which?1:-1:0),p=u+c*d;if(void 0!==a.value&&2===a.value.length){var m=a===n.hourElement,b=a===n.minuteElement;p<i?(p=o+p+l(!m)+(l(m)&&l(!n.amPM)),b&&D(void 0,-1,n.hourElement)):p>o&&(p=a===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])]),a.value=s(p)}}(e);var a=n._input.value;q(),ze(),n._input.value!==a&&n._debouncedChange()}function q(){if(void 0!==n.hourElement&&void 0!==n.minuteElement){var e,t,r=(parseInt(n.hourElement.value.slice(-2),10)||0)%24,a=(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=r,t=n.amPM.textContent,r=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(r,a,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);r=p[0],a=p[1],i=p[2]}}else{if(s){var m=void 0!==n.config.maxTime?n.config.maxTime:n.config.maxDate;(r=Math.min(r,m.getHours()))===m.getHours()&&(a=Math.min(a,m.getMinutes())),a===m.getMinutes()&&(i=Math.min(i,m.getSeconds()))}if(o){var b=void 0!==n.config.minTime?n.config.minTime:n.config.minDate;(r=Math.max(r,b.getHours()))===b.getHours()&&a<b.getMinutes()&&(a=b.getMinutes()),a===b.getMinutes()&&(i=Math.max(i,b.getSeconds()))}}W(r,a,i)}}function E(e){var t=e||n.latestSelectedDateObj;t&&t instanceof Date&&W(t.getHours(),t.getMinutes(),t.getSeconds())}function W(e,t,r){void 0!==n.latestSelectedDateObj&&n.latestSelectedDateObj.setHours(e%24,t,r||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(r)))}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,r,a){return t instanceof Array?t.forEach((function(t){return S(e,t,r,a)})):e instanceof Array?e.forEach((function(e){return S(e,t,r,a)})):(e.addEventListener(t,r,a),void n._handlers.push({remove:function(){return e.removeEventListener(t,r,a)}}))}function T(){ge("onChange")}function C(e,t){var r=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),a=n.currentYear,i=n.currentMonth;try{void 0!==r&&(n.currentYear=r.getFullYear(),n.currentMonth=r.getMonth())}catch(e){e.message="Invalid date supplied: "+r,n.config.errorHandler(e)}t&&n.currentYear!==a&&(ge("onYearChange"),X()),!t||n.currentYear===a&&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 r=e&&h(e),a=n||r&&r.parentNode&&r.parentNode.firstChild,i=_e("increment");i.delta=t,a&&a.dispatchEvent(i)}function P(e,t,r,a){var i=ee(t,!0),o=p("span",e,t.getDate().toString());return o.dateObj=t,o.$i=a,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&&a%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&&ae(e)}function I(e){for(var t=e>0?0:n.config.showMonths-1,r=e>0?n.config.showMonths:-1,a=t;a!=r;a+=e)for(var i=n.daysContainer.children[a],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 r=i(),a=te(r||document.body),o=void 0!==e?e:a?r: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():a?function(e,t){for(var r=-1===e.className.indexOf("Month")?e.dateObj.getMonth():n.currentMonth,a=t>0?n.config.showMonths:-1,i=t>0?1:-1,o=r-n.currentMonth;o!=a;o+=i)for(var s=n.daysContainer.children[o],l=r-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 r=(new Date(e,t,1).getDay()-n.l10n.firstDayOfWeek+7)%7,a=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=a+1-r,d=0;u<=a;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-r&&(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 Y(){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 r=new Date(n.currentYear,n.currentMonth,1);r.setMonth(n.currentMonth+t),e.appendChild(F(r.getFullYear(),r.getMonth()))}n.daysContainer.appendChild(e),n.days=n.daysContainer.firstChild,"range"===n.config.mode&&1===n.selectedDates.length&&ae()}}function X(){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 r=p("option","flatpickr-monthDropdown-month");r.value=new Date(n.currentYear,t).getMonth().toString(),r.textContent=g(t,n.config.shorthandCurrentMonth,n.l10n),r.tabIndex=-1,n.currentMonth===t&&(r.selected=!0),n.monthsDropdownContainer.appendChild(r)}}}function H(){var e,t=p("div","flatpickr-month"),r=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),r=parseInt(t.value,10);n.changeMonth(r-n.currentMonth),ge("onMonthChange")})),X(),e=n.monthsDropdownContainer);var a=b("cur-year",{tabindex:"-1"}),i=a.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(a),r.appendChild(o),t.appendChild(r),{container:t,yearElement:i,monthElement:e}}function V(){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 U(){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 r=n.config.showMonths;r--;)n.weekdayContainer.children[r].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 r=t?e:e-n.currentMonth;r<0&&!0===n._hidePrevMonthArrow||r>0&&!0===n._hideNextMonthArrow||(n.currentMonth+=r,(n.currentMonth<0||n.currentMonth>11)&&(n.currentYear+=n.currentMonth>11?1:-1,n.currentMonth=(n.currentMonth+12)%12,ge("onYearChange"),X()),Y(),ge("onMonthChange"),Me())}function J(e){return n.calendarContainer.contains(e)}function Z(e){if(n.isOpen&&!n.config.inline){var t=h(e),r=J(t),a=!(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)))&&!r&&!J(e.relatedTarget),i=!n.config.ignoredFocusElements.some((function(e){return e.contains(t)}));a&&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,r=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)),r&&(n.redraw(),ge("onYearChange"),X())}}function ee(e,t){var r;void 0===t&&(t=!0);var a=n.parseDate(e,void 0,t);if(n.config.minDate&&a&&O(a,n.config.minDate,void 0!==t?t:!n.minDateHasTime)<0||n.config.maxDate&&a&&O(a,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===a)return!1;for(var i=!!n.config.enable,o=null!==(r=n.config.enable)&&void 0!==r?r:n.config.disable,s=0,l=void 0;s<o.length;s++){if("function"==typeof(l=o[s])&&l(a))return i;if(l instanceof Date&&void 0!==a&&l.getTime()===a.getTime())return i;if("string"==typeof l){var c=n.parseDate(l,void 0,!0);return c&&c.getTime()===a.getTime()?i:!i}if("object"==typeof l&&void 0!==a&&l.from&&l.to&&a.getTime()>=l.from.getTime()&&a.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,r=n._input.value.trimEnd()!==ve();!t||!r||e.relatedTarget&&J(e.relatedTarget)||n.setDate(n._input.value,!0,e.target===n.altInput?n.config.altFormat:n.config.dateFormat)}function re(t){var r=h(t),a=n.config.wrap?e.contains(r):r===n._input,o=n.config.allowInput,s=n.isOpen&&(!o||!a),l=n.config.inline&&a&&!o;if(13===t.keyCode&&a){if(o)return n.setDate(n._input.value,!0,r===n.altInput?n.config.altFormat:n.config.dateFormat),n.close(),r.blur();n.open()}else if(J(r)||s||l){var c=!!n.timeContainer&&n.timeContainer.contains(r);switch(t.keyCode){case 13:c?(t.preventDefault(),M(),de()):pe(t);break;case 27:t.preventDefault(),de();break;case 8:case 46:a&&!n.config.allowInput&&(t.preventDefault(),n.clear());break;case 37:case 39:if(c||a)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!==r.$i||r===n.input||r===n.altInput?t.ctrlKey?(t.stopPropagation(),Q(n.currentYear-p),$(I(1),0)):c||$(void 0,7*p):r===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(r);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(r)&&t.shiftKey&&(t.preventDefault(),n._input.focus())}}if(void 0!==n.amPM&&r===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()}(a||J(r))&&ge("onKeyDown",t)}function ae(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 r=e?e.dateObj.getTime():n.days.firstElementChild.dateObj.getTime(),a=n.parseDate(n.selectedDates[0],void 0,!0).getTime(),i=Math.min(r,n.selectedDates[0].getTime()),o=Math.max(r,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<a&&(!l||u>l)?l=u:u>a&&(!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(r<=n.selectedDates[0].getTime()?"startRange":"endRange"),a<r&&d===a?t.classList.add("startRange"):a>r&&d===a&&t.classList.add("endRange"),d>=l&&(0===c||d<=c)&&(o=a,u=r,(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 r=n.config["_"+e+"Date"]=n.parseDate(t,n.config.dateFormat),a=n.config["_"+("min"===e?"max":"min")+"Date"];void 0!==r&&(n["min"===e?"minDateHasTime":"maxDateHasTime"]=r.getHours()>0||r.getMinutes()>0||r.getSeconds()>0),n.selectedDates&&(n.selectedDates=n.selectedDates.filter((function(e){return ee(e)})),n.selectedDates.length||"min"!==e||E(r),ze()),n.daysContainer&&(ue(),void 0!==r?n.currentYearElement[e]=r.getFullYear().toString():n.currentYearElement.removeAttribute(e),n.currentYearElement.disabled=!!a&&void 0!==r&&a.getFullYear()===r.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,r=Array.prototype.reduce.call(n.calendarContainer.children,(function(e,t){return e+t.offsetHeight}),0),a=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<r&&l.top>r,p=window.pageYOffset+l.top+(u?-r-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-=(a-l.width)/2,b=!0):"right"===s&&(m-=a-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+a>window.document.body.offsetWidth,_=f+a>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:(r=document.createElement("style"),document.head.appendChild(r),r.sheet);var r}();if(void 0===y)return;var M=window.document.body.offsetWidth,v=Math.max(0,M/2-a/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||(X(),Me(),Y())}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 r=t,a=n.latestSelectedDateObj=new Date(r.dateObj.getTime()),i=(a.getMonth()<n.currentMonth||a.getMonth()>n.currentMonth+n.config.showMonths-1)&&"range"!==n.config.mode;if(n.selectedDateElem=r,"single"===n.config.mode)n.selectedDates=[a];else if("multiple"===n.config.mode){var o=ye(a);o?n.selectedDates.splice(parseInt(o),1):n.selectedDates.push(a)}else"range"===n.config.mode&&(2===n.selectedDates.length&&n.clear(!1,!1),n.latestSelectedDateObj=a,n.selectedDates.push(a),0!==O(a,n.selectedDates[0],!0)&&n.selectedDates.sort((function(e,t){return e.getTime()-t.getTime()})));if(q(),i){var s=n.currentYear!==a.getFullYear();n.currentYear=a.getFullYear(),n.currentMonth=a.getMonth(),s&&(ge("onYearChange"),X()),ge("onMonthChange")}if(Me(),Y(),ze(),i||"range"===n.config.mode||1!==n.config.showMonths?void 0!==n.selectedDateElem&&void 0===n.hourElement&&n.selectedDateElem&&n.selectedDateElem.focus():B(r),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 r=x(n.config),a=r.hours,i=r.minutes,o=r.seconds;W(a,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=ae,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 r=h(e);r&&r.blur()}return void 0!==n.mobileInput&&(n.mobileInput.focus(),n.mobileInput.click()),void ge("onOpen")}if(n._input.disabled||n.config.inline)return;var a=n.isOpen;n.isOpen=!0,a||(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 a in Object.assign(n.config,e),e)void 0!==me[a]&&me[a].forEach((function(e){return e()}));else n.config[e]=t,void 0!==me[e]?me[e].forEach((function(e){return e()})):r.indexOf(e)>-1&&(n.config[e]=u(t));n.redraw(),ze(!0)},n.setDate=function(e,t,r){void 0===t&&(t=!1);void 0===r&&(r=n.config.dateFormat);if(0!==e&&!e||e instanceof Array&&0===e.length)return n.clear(t);be(e,r),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:[V,_,U],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 r=[];if(e instanceof Array)r=e.map((function(e){return n.parseDate(e,t)}));else if(e instanceof Date||"number"==typeof e)r=[n.parseDate(e,t)];else if("string"==typeof e)switch(n.config.mode){case"single":case"time":r=[n.parseDate(e,t)];break;case"multiple":r=e.split(n.config.conjunction).map((function(e){return n.parseDate(e,t)}));break;case"range":r=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?r:r.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 r=n.config[e];if(void 0!==r&&r.length>0)for(var a=0;r[a]&&a<r.length;a++)r[a](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 r=n.selectedDates[t];if(r instanceof Date&&0===O(r,e))return""+t}return!1}function Me(){n.config.noCalendar||n.isMobile||!n.monthNav||(n.yearElements.forEach((function(e,t){var r=new Date(n.currentYear,n.currentMonth,1);r.setMonth(n.currentMonth+t),n.config.showMonths>1||"static"===n.config.monthSelectorType?n.monthElements[t].textContent=g(r.getMonth(),n.config.shorthandCurrentMonth,n.l10n)+" ":n.monthsDropdownContainer.value=r.getMonth().toString(),e.value=r.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,r){return"range"!==n.config.mode||n.config.enableTime||r.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),r=n.prevMonthNav.contains(t),a=n.nextMonthNav.contains(t);r||a?K(r?-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||a.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||a.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]];r.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)r.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,V(),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}}(),r=t.weekWrapper,a=t.weekNumbers;n.innerContainer.appendChild(r),n.weekNumbers=a,n.weekWrapper=r}n.rContainer=p("div","flatpickr-rContainer"),n.rContainer.appendChild(U()),n.daysContainer||(n.daysContainer=p("div","flatpickr-days"),n.daysContainer.tabIndex=-1),Y(),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",":"),r=b("flatpickr-hour",{"aria-label":n.l10n.hourAriaLabel});n.hourElement=r.getElementsByTagName("input")[0];var a=b("flatpickr-minute",{"aria-label":n.l10n.minuteAriaLabel});n.minuteElement=a.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(r),n.timeContainer.appendChild(t),n.timeContainer.appendChild(a),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&&ae(h(e))}));S(n._input,"keydown",re),void 0!==n.calendarContainer&&S(n.calendarContainer,"keydown",re);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})),r=[],a=0;a<n.length;a++){var i=n[a];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||{}),r.push(i._flatpickr)}catch(e){console.error(e)}}return 1===r.length?r[0]:r}"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
  *