From 26603b2bd52d78d140c04de9f2f815a293461eb4 Mon Sep 17 00:00:00 2001 From: Emilio Mariscal Date: Wed, 15 Jan 2025 14:06:59 -0300 Subject: [PATCH] Updates --- CNAME | 1 - .../{index-Cbv4SEbF.js => index-CB9klhbe.js} | 28 +++++++++---------- ...-Cbv4SEbF.js.map => index-CB9klhbe.js.map} | 2 +- index.html | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) delete mode 100644 CNAME rename assets/{index-Cbv4SEbF.js => index-CB9klhbe.js} (98%) rename assets/{index-Cbv4SEbF.js.map => index-CB9klhbe.js.map} (60%) diff --git a/CNAME b/CNAME deleted file mode 100644 index 49165e4..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -chatmap.hotosm.org \ No newline at end of file diff --git a/assets/index-Cbv4SEbF.js b/assets/index-CB9klhbe.js similarity index 98% rename from assets/index-Cbv4SEbF.js rename to assets/index-CB9klhbe.js index ec7ca93..b4ce4ab 100644 --- a/assets/index-Cbv4SEbF.js +++ b/assets/index-CB9klhbe.js @@ -14,7 +14,7 @@ var pD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $U=pD((jU,Bg) * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var AD=Ht,DD=Symbol.for("react.element"),zD=Symbol.for("react.fragment"),RD=Object.prototype.hasOwnProperty,LD=AD.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,OD={key:!0,ref:!0,__self:!0,__source:!0};function lE(e,t,i){var o,h={},f=null,g=null;i!==void 0&&(f=""+i),t.key!==void 0&&(f=""+t.key),t.ref!==void 0&&(g=t.ref);for(o in t)RD.call(t,o)&&!OD.hasOwnProperty(o)&&(h[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps,t)h[o]===void 0&&(h[o]=t[o]);return{$$typeof:DD,type:e,key:f,ref:g,props:h,_owner:LD.current}}Ay.Fragment=zD;Ay.jsx=lE;Ay.jsxs=lE;JT.exports=Ay;var Xe=JT.exports,$v={},uE={exports:{}},Bs={},cE={exports:{}},hE={};/** + */var AD=Ht,DD=Symbol.for("react.element"),zD=Symbol.for("react.fragment"),RD=Object.prototype.hasOwnProperty,LD=AD.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,OD={key:!0,ref:!0,__self:!0,__source:!0};function lE(e,t,i){var o,h={},f=null,g=null;i!==void 0&&(f=""+i),t.key!==void 0&&(f=""+t.key),t.ref!==void 0&&(g=t.ref);for(o in t)RD.call(t,o)&&!OD.hasOwnProperty(o)&&(h[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps,t)h[o]===void 0&&(h[o]=t[o]);return{$$typeof:DD,type:e,key:f,ref:g,props:h,_owner:LD.current}}Ay.Fragment=zD;Ay.jsx=lE;Ay.jsxs=lE;JT.exports=Ay;var Ke=JT.exports,$v={},uE={exports:{}},Bs={},cE={exports:{}},hE={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var pD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $U=pD((jU,Bg) * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(Be,Le){var Ke=Be.length;Be.push(Le);e:for(;0>>1,Ee=Be[xe];if(0>>1;xeh(rt,Ke))Jth(er,rt)?(Be[xe]=er,Be[Jt]=Ke,xe=Jt):(Be[xe]=rt,Be[nt]=Ke,xe=nt);else if(Jth(er,Ke))Be[xe]=er,Be[Jt]=Ke,xe=Jt;else break e}}return Le}function h(Be,Le){var Ke=Be.sortIndex-Le.sortIndex;return Ke!==0?Ke:Be.id-Le.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var g=Date,c=g.now();e.unstable_now=function(){return g.now()-c}}var T=[],P=[],R=1,A=null,M=3,N=!1,Y=!1,j=!1,te=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function q(Be){for(var Le=i(P);Le!==null;){if(Le.callback===null)o(P);else if(Le.startTime<=Be)o(P),Le.sortIndex=Le.expirationTime,t(T,Le);else break;Le=i(P)}}function ne(Be){if(j=!1,q(Be),!Y)if(i(T)!==null)Y=!0,vt(oe);else{var Le=i(P);Le!==null&&ye(ne,Le.startTime-Be)}}function oe(Be,Le){Y=!1,j&&(j=!1,O(Fe),Fe=-1),N=!0;var Ke=M;try{for(q(Le),A=i(T);A!==null&&(!(A.expirationTime>Le)||Be&&!it());){var xe=A.callback;if(typeof xe=="function"){A.callback=null,M=A.priorityLevel;var Ee=xe(A.expirationTime<=Le);Le=e.unstable_now(),typeof Ee=="function"?A.callback=Ee:A===i(T)&&o(T),q(Le)}else o(T);A=i(T)}if(A!==null)var mt=!0;else{var nt=i(P);nt!==null&&ye(ne,nt.startTime-Le),mt=!1}return mt}finally{A=null,M=Ke,N=!1}}var ke=!1,ge=null,Fe=-1,Oe=5,We=-1;function it(){return!(e.unstable_now()-WeBe||125xe?(Be.sortIndex=Ke,t(P,Be),i(T)===null&&Be===i(P)&&(j?(O(Fe),Fe=-1):j=!0,ye(ne,Ke-xe))):(Be.sortIndex=Ee,t(T,Be),Y||N||(Y=!0,vt(oe))),Be},e.unstable_shouldYield=it,e.unstable_wrapCallback=function(Be){var Le=M;return function(){var Ke=M;M=Le;try{return Be.apply(this,arguments)}finally{M=Ke}}}})(hE);cE.exports=hE;var FD=cE.exports;/** + */(function(e){function t(Be,Le){var Xe=Be.length;Be.push(Le);e:for(;0>>1,Ee=Be[xe];if(0>>1;xeh(rt,Xe))Jth(er,rt)?(Be[xe]=er,Be[Jt]=Xe,xe=Jt):(Be[xe]=rt,Be[nt]=Xe,xe=nt);else if(Jth(er,Xe))Be[xe]=er,Be[Jt]=Xe,xe=Jt;else break e}}return Le}function h(Be,Le){var Xe=Be.sortIndex-Le.sortIndex;return Xe!==0?Xe:Be.id-Le.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;e.unstable_now=function(){return f.now()}}else{var g=Date,c=g.now();e.unstable_now=function(){return g.now()-c}}var T=[],P=[],R=1,A=null,M=3,N=!1,Y=!1,j=!1,te=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,$=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function q(Be){for(var Le=i(P);Le!==null;){if(Le.callback===null)o(P);else if(Le.startTime<=Be)o(P),Le.sortIndex=Le.expirationTime,t(T,Le);else break;Le=i(P)}}function ne(Be){if(j=!1,q(Be),!Y)if(i(T)!==null)Y=!0,vt(oe);else{var Le=i(P);Le!==null&&ye(ne,Le.startTime-Be)}}function oe(Be,Le){Y=!1,j&&(j=!1,O(Fe),Fe=-1),N=!0;var Xe=M;try{for(q(Le),A=i(T);A!==null&&(!(A.expirationTime>Le)||Be&&!it());){var xe=A.callback;if(typeof xe=="function"){A.callback=null,M=A.priorityLevel;var Ee=xe(A.expirationTime<=Le);Le=e.unstable_now(),typeof Ee=="function"?A.callback=Ee:A===i(T)&&o(T),q(Le)}else o(T);A=i(T)}if(A!==null)var mt=!0;else{var nt=i(P);nt!==null&&ye(ne,nt.startTime-Le),mt=!1}return mt}finally{A=null,M=Xe,N=!1}}var ke=!1,ge=null,Fe=-1,Oe=5,We=-1;function it(){return!(e.unstable_now()-WeBe||125xe?(Be.sortIndex=Xe,t(P,Be),i(T)===null&&Be===i(P)&&(j?(O(Fe),Fe=-1):j=!0,ye(ne,Xe-xe))):(Be.sortIndex=Ee,t(T,Be),Y||N||(Y=!0,vt(oe))),Be},e.unstable_shouldYield=it,e.unstable_wrapCallback=function(Be){var Le=M;return function(){var Xe=M;M=Le;try{return Be.apply(this,arguments)}finally{M=Xe}}}})(hE);cE.exports=hE;var FD=cE.exports;/** * @license React * react-dom.production.min.js * @@ -38,7 +38,7 @@ var pD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var $U=pD((jU,Bg) `).replace(tR,"")}function jm(e,t,i){if(t=MS(t),MS(e)!==t&&i)throw Error(lt(425))}function Zg(){}var l1=null,u1=null;function c1(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var h1=typeof setTimeout=="function"?setTimeout:void 0,rR=typeof clearTimeout=="function"?clearTimeout:void 0,AS=typeof Promise=="function"?Promise:void 0,nR=typeof queueMicrotask=="function"?queueMicrotask:typeof AS<"u"?function(e){return AS.resolve(null).then(e).catch(iR)}:h1;function iR(e){setTimeout(function(){throw e})}function ov(e,t){var i=t,o=0;do{var h=i.nextSibling;if(e.removeChild(i),h&&h.nodeType===8)if(i=h.data,i==="/$"){if(o===0){e.removeChild(h),Vf(t);return}o--}else i!=="$"&&i!=="$?"&&i!=="$!"||o++;i=h}while(i);Vf(t)}function Ll(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function DS(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"){if(t===0)return e;t--}else i==="/$"&&t++}e=e.previousSibling}return null}var Nh=Math.random().toString(36).slice(2),Vo="__reactFiber$"+Nh,qf="__reactProps$"+Nh,Ia="__reactContainer$"+Nh,d1="__reactEvents$"+Nh,sR="__reactListeners$"+Nh,oR="__reactHandles$"+Nh;function Cu(e){var t=e[Vo];if(t)return t;for(var i=e.parentNode;i;){if(t=i[Ia]||i[Vo]){if(i=t.alternate,t.child!==null||i!==null&&i.child!==null)for(e=DS(e);e!==null;){if(i=e[Vo])return i;e=DS(e)}return t}e=i,i=e.parentNode}return null}function gp(e){return e=e[Vo]||e[Ia],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function rh(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(lt(33))}function Oy(e){return e[qf]||null}var f1=[],nh=-1;function Hl(e){return{current:e}}function cn(e){0>nh||(e.current=f1[nh],f1[nh]=null,nh--)}function en(e,t){nh++,f1[nh]=e.current,e.current=t}var jl={},Pi=Hl(jl),cs=Hl(!1),Uu=jl;function Sh(e,t){var i=e.type.contextTypes;if(!i)return jl;var o=e.stateNode;if(o&&o.__reactInternalMemoizedUnmaskedChildContext===t)return o.__reactInternalMemoizedMaskedChildContext;var h={},f;for(f in i)h[f]=t[f];return o&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=h),h}function hs(e){return e=e.childContextTypes,e!=null}function qg(){cn(cs),cn(Pi)}function zS(e,t,i){if(Pi.current!==jl)throw Error(lt(168));en(Pi,t),en(cs,i)}function oC(e,t,i){var o=e.stateNode;if(t=t.childContextTypes,typeof o.getChildContext!="function")return i;o=o.getChildContext();for(var h in o)if(!(h in t))throw Error(lt(108,HD(e)||"Unknown",h));return kn({},i,o)}function Yg(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||jl,Uu=Pi.current,en(Pi,e),en(cs,cs.current),!0}function RS(e,t,i){var o=e.stateNode;if(!o)throw Error(lt(169));i?(e=oC(e,t,Uu),o.__reactInternalMemoizedMergedChildContext=e,cn(cs),cn(Pi),en(Pi,e)):cn(cs),en(cs,i)}var va=null,Fy=!1,av=!1;function aC(e){va===null?va=[e]:va.push(e)}function aR(e){Fy=!0,aC(e)}function Wl(){if(!av&&va!==null){av=!0;var e=0,t=Ur;try{var i=va;for(Ur=1;e>=g,h-=g,xa=1<<32-vo(t)+h|i<Fe?(Oe=ge,ge=null):Oe=ge.sibling;var We=M(O,ge,q[Fe],ne);if(We===null){ge===null&&(ge=Oe);break}e&&ge&&We.alternate===null&&t(O,ge),$=f(We,$,Fe),ke===null?oe=We:ke.sibling=We,ke=We,ge=Oe}if(Fe===q.length)return i(O,ge),yn&&wu(O,Fe),oe;if(ge===null){for(;FeFe?(Oe=ge,ge=null):Oe=ge.sibling;var it=M(O,ge,We.value,ne);if(it===null){ge===null&&(ge=Oe);break}e&&ge&&it.alternate===null&&t(O,ge),$=f(it,$,Fe),ke===null?oe=it:ke.sibling=it,ke=it,ge=Oe}if(We.done)return i(O,ge),yn&&wu(O,Fe),oe;if(ge===null){for(;!We.done;Fe++,We=q.next())We=A(O,We.value,ne),We!==null&&($=f(We,$,Fe),ke===null?oe=We:ke.sibling=We,ke=We);return yn&&wu(O,Fe),oe}for(ge=o(O,ge);!We.done;Fe++,We=q.next())We=N(ge,O,Fe,We.value,ne),We!==null&&(e&&We.alternate!==null&&ge.delete(We.key===null?Fe:We.key),$=f(We,$,Fe),ke===null?oe=We:ke.sibling=We,ke=We);return e&&ge.forEach(function(ve){return t(O,ve)}),yn&&wu(O,Fe),oe}function te(O,$,q,ne){if(typeof q=="object"&&q!==null&&q.type===Jc&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case zm:e:{for(var oe=q.key,ke=$;ke!==null;){if(ke.key===oe){if(oe=q.type,oe===Jc){if(ke.tag===7){i(O,ke.sibling),$=h(ke,q.props.children),$.return=O,O=$;break e}}else if(ke.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===wl&&FS(oe)===ke.type){i(O,ke.sibling),$=h(ke,q.props),$.ref=lf(O,ke,q),$.return=O,O=$;break e}i(O,ke);break}else t(O,ke);ke=ke.sibling}q.type===Jc?($=Lu(q.props.children,O.mode,ne,q.key),$.return=O,O=$):(ne=_g(q.type,q.key,q.props,null,O.mode,ne),ne.ref=lf(O,$,q),ne.return=O,O=ne)}return g(O);case Kc:e:{for(ke=q.key;$!==null;){if($.key===ke)if($.tag===4&&$.stateNode.containerInfo===q.containerInfo&&$.stateNode.implementation===q.implementation){i(O,$.sibling),$=h($,q.children||[]),$.return=O,O=$;break e}else{i(O,$);break}else t(O,$);$=$.sibling}$=mv(q,O.mode,ne),$.return=O,O=$}return g(O);case wl:return ke=q._init,te(O,$,ke(q._payload),ne)}if(mf(q))return Y(O,$,q,ne);if(rf(q))return j(O,$,q,ne);Hm(O,q)}return typeof q=="string"&&q!==""||typeof q=="number"?(q=""+q,$!==null&&$.tag===6?(i(O,$.sibling),$=h($,q),$.return=O,O=$):(i(O,$),$=pv(q,O.mode,ne),$.return=O,O=$),g(O)):i(O,$)}return te}var Th=hC(!0),dC=hC(!1),Jg=Hl(null),Qg=null,oh=null,Vx=null;function Hx(){Vx=oh=Qg=null}function Wx(e){var t=Jg.current;cn(Jg),e._currentValue=t}function g1(e,t,i){for(;e!==null;){var o=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,o!==null&&(o.childLanes|=t)):o!==null&&(o.childLanes&t)!==t&&(o.childLanes|=t),e===i)break;e=e.return}}function gh(e,t){Qg=e,Vx=oh=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ls=!0),e.firstContext=null)}function eo(e){var t=e._currentValue;if(Vx!==e)if(e={context:e,memoizedValue:t,next:null},oh===null){if(Qg===null)throw Error(lt(308));oh=e,Qg.dependencies={lanes:0,firstContext:e}}else oh=oh.next=e;return t}var Iu=null;function Gx(e){Iu===null?Iu=[e]:Iu.push(e)}function fC(e,t,i,o){var h=t.interleaved;return h===null?(i.next=i,Gx(t)):(i.next=h.next,h.next=i),t.interleaved=i,Pa(e,o)}function Pa(e,t){e.lanes|=t;var i=e.alternate;for(i!==null&&(i.lanes|=t),i=e,e=e.return;e!==null;)e.childLanes|=t,i=e.alternate,i!==null&&(i.childLanes|=t),i=e,e=e.return;return i.tag===3?i.stateNode:null}var bl=!1;function Zx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pC(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ka(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ol(e,t,i){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,Pr&2){var h=o.pending;return h===null?t.next=t:(t.next=h.next,h.next=t),o.pending=t,Pa(e,i)}return h=o.interleaved,h===null?(t.next=t,Gx(o)):(t.next=h.next,h.next=t),o.interleaved=t,Pa(e,i)}function dg(e,t,i){if(t=t.updateQueue,t!==null&&(t=t.shared,(i&4194240)!==0)){var o=t.lanes;o&=e.pendingLanes,i|=o,t.lanes=i,Dx(e,i)}}function BS(e,t){var i=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,i===o)){var h=null,f=null;if(i=i.firstBaseUpdate,i!==null){do{var g={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};f===null?h=f=g:f=f.next=g,i=i.next}while(i!==null);f===null?h=f=t:f=f.next=t}else h=f=t;i={baseState:o.baseState,firstBaseUpdate:h,lastBaseUpdate:f,shared:o.shared,effects:o.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=t:e.next=t,i.lastBaseUpdate=t}function ey(e,t,i,o){var h=e.updateQueue;bl=!1;var f=h.firstBaseUpdate,g=h.lastBaseUpdate,c=h.shared.pending;if(c!==null){h.shared.pending=null;var T=c,P=T.next;T.next=null,g===null?f=P:g.next=P,g=T;var R=e.alternate;R!==null&&(R=R.updateQueue,c=R.lastBaseUpdate,c!==g&&(c===null?R.firstBaseUpdate=P:c.next=P,R.lastBaseUpdate=T))}if(f!==null){var A=h.baseState;g=0,R=P=T=null,c=f;do{var M=c.lane,N=c.eventTime;if((o&M)===M){R!==null&&(R=R.next={eventTime:N,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var Y=e,j=c;switch(M=t,N=i,j.tag){case 1:if(Y=j.payload,typeof Y=="function"){A=Y.call(N,A,M);break e}A=Y;break e;case 3:Y.flags=Y.flags&-65537|128;case 0:if(Y=j.payload,M=typeof Y=="function"?Y.call(N,A,M):Y,M==null)break e;A=kn({},A,M);break e;case 2:bl=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,M=h.effects,M===null?h.effects=[c]:M.push(c))}else N={eventTime:N,lane:M,tag:c.tag,payload:c.payload,callback:c.callback,next:null},R===null?(P=R=N,T=A):R=R.next=N,g|=M;if(c=c.next,c===null){if(c=h.shared.pending,c===null)break;M=c,c=M.next,M.next=null,h.lastBaseUpdate=M,h.shared.pending=null}}while(!0);if(R===null&&(T=A),h.baseState=T,h.firstBaseUpdate=P,h.lastBaseUpdate=R,t=h.shared.interleaved,t!==null){h=t;do g|=h.lane,h=h.next;while(h!==t)}else f===null&&(h.shared.lanes=0);Hu|=g,e.lanes=g,e.memoizedState=A}}function NS(e,t,i){if(e=t.effects,t.effects=null,e!==null)for(t=0;ti?i:4,e(!0);var o=uv.transition;uv.transition={};try{e(!1),t()}finally{Ur=i,uv.transition=o}}function AC(){return to().memoizedState}function hR(e,t,i){var o=Bl(e);if(i={lane:o,action:i,hasEagerState:!1,eagerState:null,next:null},DC(e))zC(t,i);else if(i=fC(e,t,i,o),i!==null){var h=Hi();xo(i,e,o,h),RC(i,t,o)}}function dR(e,t,i){var o=Bl(e),h={lane:o,action:i,hasEagerState:!1,eagerState:null,next:null};if(DC(e))zC(t,h);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var g=t.lastRenderedState,c=f(g,i);if(h.hasEagerState=!0,h.eagerState=c,So(c,g)){var T=t.interleaved;T===null?(h.next=h,Gx(t)):(h.next=T.next,T.next=h),t.interleaved=h;return}}catch{}finally{}i=fC(e,t,h,o),i!==null&&(h=Hi(),xo(i,e,o,h),RC(i,t,o))}}function DC(e){var t=e.alternate;return e===Sn||t!==null&&t===Sn}function zC(e,t){If=ry=!0;var i=e.pending;i===null?t.next=t:(t.next=i.next,i.next=t),e.pending=t}function RC(e,t,i){if(i&4194240){var o=t.lanes;o&=e.pendingLanes,i|=o,t.lanes=i,Dx(e,i)}}var ny={readContext:eo,useCallback:ki,useContext:ki,useEffect:ki,useImperativeHandle:ki,useInsertionEffect:ki,useLayoutEffect:ki,useMemo:ki,useReducer:ki,useRef:ki,useState:ki,useDebugValue:ki,useDeferredValue:ki,useTransition:ki,useMutableSource:ki,useSyncExternalStore:ki,useId:ki,unstable_isNewReconciler:!1},fR={readContext:eo,useCallback:function(e,t){return Uo().memoizedState=[e,t===void 0?null:t],e},useContext:eo,useEffect:US,useImperativeHandle:function(e,t,i){return i=i!=null?i.concat([e]):null,pg(4194308,4,EC.bind(null,t,e),i)},useLayoutEffect:function(e,t){return pg(4194308,4,e,t)},useInsertionEffect:function(e,t){return pg(4,2,e,t)},useMemo:function(e,t){var i=Uo();return t=t===void 0?null:t,e=e(),i.memoizedState=[e,t],e},useReducer:function(e,t,i){var o=Uo();return t=i!==void 0?i(t):t,o.memoizedState=o.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},o.queue=e,e=e.dispatch=hR.bind(null,Sn,e),[o.memoizedState,e]},useRef:function(e){var t=Uo();return e={current:e},t.memoizedState=e},useState:$S,useDebugValue:tw,useDeferredValue:function(e){return Uo().memoizedState=e},useTransition:function(){var e=$S(!1),t=e[0];return e=cR.bind(null,e[1]),Uo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,i){var o=Sn,h=Uo();if(yn){if(i===void 0)throw Error(lt(407));i=i()}else{if(i=t(),ti===null)throw Error(lt(349));Vu&30||_C(o,t,i)}h.memoizedState=i;var f={value:i,getSnapshot:t};return h.queue=f,US(xC.bind(null,o,f,e),[e]),o.flags|=2048,Qf(9,vC.bind(null,o,f,i,t),void 0,null),i},useId:function(){var e=Uo(),t=ti.identifierPrefix;if(yn){var i=wa,o=xa;i=(o&~(1<<32-vo(o)-1)).toString(32)+i,t=":"+t+"R"+i,i=Kf++,0<\/script>",e=e.removeChild(e.firstChild)):typeof o.is=="string"?e=g.createElement(i,{is:o.is}):(e=g.createElement(i),i==="select"&&(g=e,o.multiple?g.multiple=!0:o.size&&(g.size=o.size))):e=g.createElementNS(e,i),e[Vo]=t,e[qf]=o,HC(e,t,!1,!1),t.stateNode=e;e:{switch(g=Jv(i,o),i){case"dialog":sn("cancel",e),sn("close",e),h=o;break;case"iframe":case"object":case"embed":sn("load",e),h=o;break;case"video":case"audio":for(h=0;hIh&&(t.flags|=128,o=!0,uf(f,!1),t.lanes=4194304)}else{if(!o)if(e=ty(g),e!==null){if(t.flags|=128,o=!0,i=e.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),uf(f,!0),f.tail===null&&f.tailMode==="hidden"&&!g.alternate&&!yn)return Ti(t),null}else 2*An()-f.renderingStartTime>Ih&&i!==1073741824&&(t.flags|=128,o=!0,uf(f,!1),t.lanes=4194304);f.isBackwards?(g.sibling=t.child,t.child=g):(i=f.last,i!==null?i.sibling=g:t.child=g,f.last=g)}return f.tail!==null?(t=f.tail,f.rendering=t,f.tail=t.sibling,f.renderingStartTime=An(),t.sibling=null,i=bn.current,en(bn,o?i&1|2:i&1),t):(Ti(t),null);case 22:case 23:return aw(),o=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==o&&(t.flags|=8192),o&&t.mode&1?Ms&1073741824&&(Ti(t),t.subtreeFlags&6&&(t.flags|=8192)):Ti(t),null;case 24:return null;case 25:return null}throw Error(lt(156,t.tag))}function wR(e,t){switch(Ux(t),t.tag){case 1:return hs(t.type)&&qg(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Eh(),cn(cs),cn(Pi),Xx(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Yx(t),null;case 13:if(cn(bn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(lt(340));kh()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return cn(bn),null;case 4:return Eh(),null;case 10:return Wx(t.type._context),null;case 22:case 23:return aw(),null;case 24:return null;default:return null}}var Gm=!1,Ci=!1,bR=typeof WeakSet=="function"?WeakSet:Set,Lt=null;function ah(e,t){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(o){In(e,t,o)}else i.current=null}function T1(e,t,i){try{i()}catch(o){In(e,t,o)}}var JS=!1;function SR(e,t){if(l1=Hg,e=KE(),Nx(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var o=i.getSelection&&i.getSelection();if(o&&o.rangeCount!==0){i=o.anchorNode;var h=o.anchorOffset,f=o.focusNode;o=o.focusOffset;try{i.nodeType,f.nodeType}catch{i=null;break e}var g=0,c=-1,T=-1,P=0,R=0,A=e,M=null;t:for(;;){for(var N;A!==i||h!==0&&A.nodeType!==3||(c=g+h),A!==f||o!==0&&A.nodeType!==3||(T=g+o),A.nodeType===3&&(g+=A.nodeValue.length),(N=A.firstChild)!==null;)M=A,A=N;for(;;){if(A===e)break t;if(M===i&&++P===h&&(c=g),M===f&&++R===o&&(T=g),(N=A.nextSibling)!==null)break;A=M,M=A.parentNode}A=N}i=c===-1||T===-1?null:{start:c,end:T}}else i=null}i=i||{start:0,end:0}}else i=null;for(u1={focusedElem:e,selectionRange:i},Hg=!1,Lt=t;Lt!==null;)if(t=Lt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Lt=e;else for(;Lt!==null;){t=Lt;try{var Y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(Y!==null){var j=Y.memoizedProps,te=Y.memoizedState,O=t.stateNode,$=O.getSnapshotBeforeUpdate(t.elementType===t.type?j:po(t.type,j),te);O.__reactInternalSnapshotBeforeUpdate=$}break;case 3:var q=t.stateNode.containerInfo;q.nodeType===1?q.textContent="":q.nodeType===9&&q.documentElement&&q.removeChild(q.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(lt(163))}}catch(ne){In(t,t.return,ne)}if(e=t.sibling,e!==null){e.return=t.return,Lt=e;break}Lt=t.return}return Y=JS,JS=!1,Y}function Pf(e,t,i){var o=t.updateQueue;if(o=o!==null?o.lastEffect:null,o!==null){var h=o=o.next;do{if((h.tag&e)===e){var f=h.destroy;h.destroy=void 0,f!==void 0&&T1(t,i,f)}h=h.next}while(h!==o)}}function $y(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var i=t=t.next;do{if((i.tag&e)===e){var o=i.create;i.destroy=o()}i=i.next}while(i!==t)}}function E1(e){var t=e.ref;if(t!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof t=="function"?t(e):t.current=e}}function ZC(e){var t=e.alternate;t!==null&&(e.alternate=null,ZC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Vo],delete t[qf],delete t[d1],delete t[sR],delete t[oR])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function qC(e){return e.tag===5||e.tag===3||e.tag===4}function QS(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qC(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function C1(e,t,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?i.nodeType===8?i.parentNode.insertBefore(e,t):i.insertBefore(e,t):(i.nodeType===8?(t=i.parentNode,t.insertBefore(e,i)):(t=i,t.appendChild(e)),i=i._reactRootContainer,i!=null||t.onclick!==null||(t.onclick=Zg));else if(o!==4&&(e=e.child,e!==null))for(C1(e,t,i),e=e.sibling;e!==null;)C1(e,t,i),e=e.sibling}function I1(e,t,i){var o=e.tag;if(o===5||o===6)e=e.stateNode,t?i.insertBefore(e,t):i.appendChild(e);else if(o!==4&&(e=e.child,e!==null))for(I1(e,t,i),e=e.sibling;e!==null;)I1(e,t,i),e=e.sibling}var li=null,go=!1;function yl(e,t,i){for(i=i.child;i!==null;)YC(e,t,i),i=i.sibling}function YC(e,t,i){if(Wo&&typeof Wo.onCommitFiberUnmount=="function")try{Wo.onCommitFiberUnmount(Dy,i)}catch{}switch(i.tag){case 5:Ci||ah(i,t);case 6:var o=li,h=go;li=null,yl(e,t,i),li=o,go=h,li!==null&&(go?(e=li,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):li.removeChild(i.stateNode));break;case 18:li!==null&&(go?(e=li,i=i.stateNode,e.nodeType===8?ov(e.parentNode,i):e.nodeType===1&&ov(e,i),Vf(e)):ov(li,i.stateNode));break;case 4:o=li,h=go,li=i.stateNode.containerInfo,go=!0,yl(e,t,i),li=o,go=h;break;case 0:case 11:case 14:case 15:if(!Ci&&(o=i.updateQueue,o!==null&&(o=o.lastEffect,o!==null))){h=o=o.next;do{var f=h,g=f.destroy;f=f.tag,g!==void 0&&(f&2||f&4)&&T1(i,t,g),h=h.next}while(h!==o)}yl(e,t,i);break;case 1:if(!Ci&&(ah(i,t),o=i.stateNode,typeof o.componentWillUnmount=="function"))try{o.props=i.memoizedProps,o.state=i.memoizedState,o.componentWillUnmount()}catch(c){In(i,t,c)}yl(e,t,i);break;case 21:yl(e,t,i);break;case 22:i.mode&1?(Ci=(o=Ci)||i.memoizedState!==null,yl(e,t,i),Ci=o):yl(e,t,i);break;default:yl(e,t,i)}}function ek(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new bR),t.forEach(function(o){var h=DR.bind(null,e,o);i.has(o)||(i.add(o),o.then(h,h))})}}function fo(e,t){var i=t.deletions;if(i!==null)for(var o=0;oh&&(h=g),o&=~f}if(o=h,o=An()-o,o=(120>o?120:480>o?480:1080>o?1080:1920>o?1920:3e3>o?3e3:4320>o?4320:1960*TR(o/1960))-o,10e?16:e,El===null)var o=!1;else{if(e=El,El=null,oy=0,Pr&6)throw Error(lt(331));var h=Pr;for(Pr|=4,Lt=e.current;Lt!==null;){var f=Lt,g=f.child;if(Lt.flags&16){var c=f.deletions;if(c!==null){for(var T=0;TAn()-sw?Ru(e,0):iw|=i),ds(e,t)}function nI(e,t){t===0&&(e.mode&1?(t=Fm,Fm<<=1,!(Fm&130023424)&&(Fm=4194304)):t=1);var i=Hi();e=Pa(e,t),e!==null&&(pp(e,t,i),ds(e,i))}function AR(e){var t=e.memoizedState,i=0;t!==null&&(i=t.retryLane),nI(e,i)}function DR(e,t){var i=0;switch(e.tag){case 13:var o=e.stateNode,h=e.memoizedState;h!==null&&(i=h.retryLane);break;case 19:o=e.stateNode;break;default:throw Error(lt(314))}o!==null&&o.delete(t),nI(e,i)}var iI;iI=function(e,t,i){if(e!==null)if(e.memoizedProps!==t.pendingProps||cs.current)ls=!0;else{if(!(e.lanes&i)&&!(t.flags&128))return ls=!1,vR(e,t,i);ls=!!(e.flags&131072)}else ls=!1,yn&&t.flags&1048576&&lC(t,Kg,t.index);switch(t.lanes=0,t.tag){case 2:var o=t.type;mg(e,t),e=t.pendingProps;var h=Sh(t,Pi.current);gh(t,i),h=Jx(null,t,o,e,h,i);var f=Qx();return t.flags|=1,typeof h=="object"&&h!==null&&typeof h.render=="function"&&h.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,hs(o)?(f=!0,Yg(t)):f=!1,t.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,Zx(t),h.updater=Ny,t.stateNode=h,h._reactInternals=t,_1(t,o,e,i),t=w1(null,t,o,!0,f,i)):(t.tag=0,yn&&f&&$x(t),Ni(null,t,h,i),t=t.child),t;case 16:o=t.elementType;e:{switch(mg(e,t),e=t.pendingProps,h=o._init,o=h(o._payload),t.type=o,h=t.tag=RR(o),e=po(o,e),h){case 0:t=x1(null,t,o,e,i);break e;case 1:t=YS(null,t,o,e,i);break e;case 11:t=ZS(null,t,o,e,i);break e;case 14:t=qS(null,t,o,po(o.type,e),i);break e}throw Error(lt(306,o,""))}return t;case 0:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),x1(e,t,o,h,i);case 1:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),YS(e,t,o,h,i);case 3:e:{if(UC(t),e===null)throw Error(lt(387));o=t.pendingProps,f=t.memoizedState,h=f.element,pC(e,t),ey(t,o,null,i);var g=t.memoizedState;if(o=g.element,f.isDehydrated)if(f={element:o,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){h=Ch(Error(lt(423)),t),t=XS(e,t,o,i,h);break e}else if(o!==h){h=Ch(Error(lt(424)),t),t=XS(e,t,o,i,h);break e}else for(Ls=Ll(t.stateNode.containerInfo.firstChild),Os=t,yn=!0,yo=null,i=dC(t,null,o,i),t.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(kh(),o===h){t=Ma(e,t,i);break e}Ni(e,t,o,i)}t=t.child}return t;case 5:return mC(t),e===null&&m1(t),o=t.type,h=t.pendingProps,f=e!==null?e.memoizedProps:null,g=h.children,c1(o,h)?g=null:f!==null&&c1(o,f)&&(t.flags|=32),$C(e,t),Ni(e,t,g,i),t.child;case 6:return e===null&&m1(t),null;case 13:return jC(e,t,i);case 4:return qx(t,t.stateNode.containerInfo),o=t.pendingProps,e===null?t.child=Th(t,null,o,i):Ni(e,t,o,i),t.child;case 11:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),ZS(e,t,o,h,i);case 7:return Ni(e,t,t.pendingProps,i),t.child;case 8:return Ni(e,t,t.pendingProps.children,i),t.child;case 12:return Ni(e,t,t.pendingProps.children,i),t.child;case 10:e:{if(o=t.type._context,h=t.pendingProps,f=t.memoizedProps,g=h.value,en(Jg,o._currentValue),o._currentValue=g,f!==null)if(So(f.value,g)){if(f.children===h.children&&!cs.current){t=Ma(e,t,i);break e}}else for(f=t.child,f!==null&&(f.return=t);f!==null;){var c=f.dependencies;if(c!==null){g=f.child;for(var T=c.firstContext;T!==null;){if(T.context===o){if(f.tag===1){T=ka(-1,i&-i),T.tag=2;var P=f.updateQueue;if(P!==null){P=P.shared;var R=P.pending;R===null?T.next=T:(T.next=R.next,R.next=T),P.pending=T}}f.lanes|=i,T=f.alternate,T!==null&&(T.lanes|=i),g1(f.return,i,t),c.lanes|=i;break}T=T.next}}else if(f.tag===10)g=f.type===t.type?null:f.child;else if(f.tag===18){if(g=f.return,g===null)throw Error(lt(341));g.lanes|=i,c=g.alternate,c!==null&&(c.lanes|=i),g1(g,i,t),g=f.sibling}else g=f.child;if(g!==null)g.return=f;else for(g=f;g!==null;){if(g===t){g=null;break}if(f=g.sibling,f!==null){f.return=g.return,g=f;break}g=g.return}f=g}Ni(e,t,h.children,i),t=t.child}return t;case 9:return h=t.type,o=t.pendingProps.children,gh(t,i),h=eo(h),o=o(h),t.flags|=1,Ni(e,t,o,i),t.child;case 14:return o=t.type,h=po(o,t.pendingProps),h=po(o.type,h),qS(e,t,o,h,i);case 15:return BC(e,t,t.type,t.pendingProps,i);case 17:return o=t.type,h=t.pendingProps,h=t.elementType===o?h:po(o,h),mg(e,t),t.tag=1,hs(o)?(e=!0,Yg(t)):e=!1,gh(t,i),LC(t,o,h),_1(t,o,h,i),w1(null,t,o,!0,e,i);case 19:return VC(e,t,i);case 22:return NC(e,t,i)}throw Error(lt(156,t.tag))};function sI(e,t){return DE(e,t)}function zR(e,t,i,o){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Js(e,t,i,o){return new zR(e,t,i,o)}function uw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function RR(e){if(typeof e=="function")return uw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ix)return 11;if(e===Px)return 14}return 2}function Nl(e,t){var i=e.alternate;return i===null?(i=Js(e.tag,t,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=t,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,t=e.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function _g(e,t,i,o,h,f){var g=2;if(o=e,typeof e=="function")uw(e)&&(g=1);else if(typeof e=="string")g=5;else e:switch(e){case Jc:return Lu(i.children,h,f,t);case Cx:g=8,h|=8;break;case jv:return e=Js(12,i,t,h|2),e.elementType=jv,e.lanes=f,e;case Vv:return e=Js(13,i,t,h),e.elementType=Vv,e.lanes=f,e;case Hv:return e=Js(19,i,t,h),e.elementType=Hv,e.lanes=f,e;case mE:return jy(i,h,f,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case fE:g=10;break e;case pE:g=9;break e;case Ix:g=11;break e;case Px:g=14;break e;case wl:g=16,o=null;break e}throw Error(lt(130,e==null?e:typeof e,""))}return t=Js(g,i,t,h),t.elementType=e,t.type=o,t.lanes=f,t}function Lu(e,t,i,o){return e=Js(7,e,o,t),e.lanes=i,e}function jy(e,t,i,o){return e=Js(22,e,o,t),e.elementType=mE,e.lanes=i,e.stateNode={isHidden:!1},e}function pv(e,t,i){return e=Js(6,e,null,t),e.lanes=i,e}function mv(e,t,i){return t=Js(4,e.children!==null?e.children:[],e.key,t),t.lanes=i,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function LR(e,t,i,o,h){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Y0(0),this.expirationTimes=Y0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Y0(0),this.identifierPrefix=o,this.onRecoverableError=h,this.mutableSourceEagerHydrationData=null}function cw(e,t,i,o,h,f,g,c,T){return e=new LR(e,t,i,c,T),t===1?(t=1,f===!0&&(t|=8)):t=0,f=Js(3,null,null,t),e.current=f,f.stateNode=e,f.memoizedState={element:o,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Zx(f),e}function OR(e,t,i){var o=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uI)}catch(e){console.error(e)}}uI(),uE.exports=Bs;var cI=uE.exports,lk=cI;$v.createRoot=lk.createRoot,$v.hydrateRoot=lk.hydrateRoot;const UR="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='80'%20height='48'%20viewBox='0%200%2080%2048'%3e%3cg%20fill='%23D73F3F'%20fill-rule='evenodd'%3e%3cpath%20d='M37.02656,20.77496%20C37.02656,20.29096%2037.12976,19.85896%2037.33616,19.48616%20C37.54096,19.11176%2037.81296,18.80696%2038.15056,18.56376%20C38.48656,18.32136%2038.86496,18.13736%2039.28576,18.01336%20C39.70496,17.89016%2040.12736,17.82776%2040.55376,17.82776%20C40.97856,17.82776%2041.40256,17.89016%2041.82336,18.01336%20C42.24176,18.13736%2042.62016,18.32136%2042.95616,18.56376%20C43.29456,18.80696%2043.56576,19.11176%2043.77216,19.48616%20C43.97856,19.85896%2044.08096,20.29096%2044.08096,20.77496%20L44.08096,27.14696%20C44.08096,27.64136%2043.97856,28.07496%2043.77216,28.44216%20C43.56576,28.81096%2043.29456,29.11416%2042.95616,29.35736%20C42.62016,29.60136%2042.24176,29.78616%2041.82336,29.90856%20C41.40256,30.03176%2040.97856,30.09336%2040.55376,30.09336%20C40.12736,30.09336%2039.70496,30.03176%2039.28576,29.90856%20C38.86496,29.78616%2038.48656,29.60136%2038.15056,29.35736%20C37.81296,29.11416%2037.54096,28.81096%2037.33616,28.44216%20C37.12976,28.07496%2037.02656,27.64136%2037.02656,27.14696%20L37.02656,20.77496%20Z%20M39.05136,27.15016%20C39.05136,27.56536%2039.28256,27.87496%2039.56576,28.07176%20C39.84736,28.27016%2040.18096,28.37496%2040.56576,28.37496%20C40.94896,28.37496%2041.28416,28.27016%2041.56656,28.07176%20C41.84736,27.87496%2042.00816,27.56536%2042.00816,27.15016%20L42.00816,20.77816%20C42.00816,20.36136%2041.84736,20.05256%2041.56656,19.85576%20C41.28416,19.65816%2040.94896,19.52536%2040.56576,19.52536%20C40.18096,19.52536%2039.84736,19.65816%2039.56576,19.85576%20C39.28256,20.05256%2039.05136,20.36136%2039.05136,20.77816%20L39.05136,27.15016%20Z'/%3e%3cpolygon%20points='33.379%2017.815%2033.379%2022.99%2030.152%2022.99%2030.152%2017.815%2028.387%2017.815%2028.387%2030.1%2030.152%2030.1%2030.152%2024.923%2033.379%2024.923%2033.379%2030.1%2035.278%2030.1%2035.278%2017.815'/%3e%3cpolygon%20points='52.431%2017.815%2045.426%2017.815%2045.426%2019.622%2048.015%2019.622%2047.985%2030.1%2049.847%2030.1%2049.847%2019.622%2052.431%2019.622'/%3e%3cpath%20d='M65.42344,28.7668%20L79.67944,28.7668%20L71.15544,19.1684%20L62.66904,9.57%20L54.18104,0.000400000001%20L11.53944,0.000400000001%20L20.02584,9.57%20L5.73784,9.57%20L14.22584,19.1684%20L14.29144,19.2332%20L0.000239999999,19.2332%20L8.52184,28.8316%20L17.01304,38.43%20L25.50024,48.0004%20L68.14184,48.0004%20L59.65064,38.43%20L59.58824,38.3364%20L73.87864,38.3364%20L65.42344,28.7668%20Z%20M39.83944,39.9492%20C30.31864,39.9492%2022.60104,32.8084%2022.60104,24.0012%20C22.60104,15.1908%2030.31864,8.05%2039.83944,8.05%20C49.36104,8.05%2057.07944,15.1908%2057.07944,24.0012%20C57.07944,32.8084%2049.36104,39.9492%2039.83944,39.9492%20Z'/%3e%3c/g%3e%3c/svg%3e";var us=function(){return us=Object.assign||function(t){for(var i,o=1,h=arguments.length;o0?ei($h,--ro):0,Mh--,On===10&&(Mh=1,qy--),On}function wo(){return On=ro2||R1(On)>3?"":" "}function KR(e,t){for(;--t&&wo()&&!(On<48||On>102||On>57&&On<65||On>70&&On<97););return Xy(e,xg()+(t<6&&Ou()==32&&wo()==32))}function L1(e){for(;wo();)switch(On){case e:return ro;case 34:case 39:e!==34&&e!==39&&L1(On);break;case 40:e===41&&L1(e);break;case 92:wo();break}return ro}function JR(e,t){for(;wo()&&e+On!==57;)if(e+On===84&&Ou()===47)break;return"/*"+Xy(t,ro-1)+"*"+mw(e===47?e:wo())}function QR(e){for(;!R1(Ou());)wo();return Xy(e,ro)}function e5(e){return YR(wg("",null,null,null,[""],e=qR(e),0,[0],e))}function wg(e,t,i,o,h,f,g,c,T){for(var P=0,R=0,A=g,M=0,N=0,Y=0,j=1,te=1,O=1,$=0,q="",ne=h,oe=f,ke=o,ge=q;te;)switch(Y=$,$=wo()){case 40:if(Y!=108&&ei(ge,A-1)==58){vg(ge+=hr(gv($),"&","&\f"),"&\f",fI(P?c[P-1]:0))!=-1&&(O=-1);break}case 34:case 39:case 91:ge+=gv($);break;case 9:case 10:case 13:case 32:ge+=XR(Y);break;case 92:ge+=KR(xg()-1,7);continue;case 47:switch(Ou()){case 42:case 47:_f(t5(JR(wo(),xg()),t,i,T),T);break;default:ge+="/"}break;case 123*j:c[P++]=jo(ge)*O;case 125*j:case 59:case 0:switch($){case 0:case 125:te=0;case 59+R:O==-1&&(ge=hr(ge,/\f/g,"")),N>0&&jo(ge)-A&&_f(N>32?hk(ge+";",o,i,A-1,T):hk(hr(ge," ","")+";",o,i,A-2,T),T);break;case 59:ge+=";";default:if(_f(ke=ck(ge,t,i,P,R,h,c,q,ne=[],oe=[],A,f),f),$===123)if(R===0)wg(ge,t,ke,ke,ne,f,A,c,oe);else switch(M===99&&ei(ge,3)===110?100:M){case 100:case 108:case 109:case 115:wg(e,ke,ke,o&&_f(ck(e,ke,ke,0,0,h,c,q,h,ne=[],A,oe),oe),h,oe,A,c,o?ne:oe);break;default:wg(ge,ke,ke,ke,[""],oe,0,c,oe)}}P=R=N=0,j=O=1,q=ge="",A=g;break;case 58:A=1+jo(ge),N=Y;default:if(j<1){if($==123)--j;else if($==125&&j++==0&&ZR()==125)continue}switch(ge+=mw($),$*j){case 38:O=R>0?1:(ge+="\f",-1);break;case 44:c[P++]=(jo(ge)-1)*O,O=1;break;case 64:Ou()===45&&(ge+=gv(wo())),M=Ou(),R=A=jo(q=ge+=QR(xg())),$++;break;case 45:Y===45&&jo(ge)==2&&(j=0)}}return f}function ck(e,t,i,o,h,f,g,c,T,P,R,A){for(var M=h-1,N=h===0?f:[""],Y=mI(N),j=0,te=0,O=0;j0?N[$]+" "+q:hr(q,/&\f/g,N[$])))&&(T[O++]=ne);return Yy(e,t,i,h===0?Zy:c,T,P,R,A)}function t5(e,t,i,o){return Yy(e,t,i,hI,mw(GR()),Ph(e,2,-2),0,o)}function hk(e,t,i,o,h){return Yy(e,t,i,pw,Ph(e,0,o),Ph(e,o+1,-1),o,h)}function yI(e,t,i){switch(HR(e,t)){case 5103:return Br+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Br+e+e;case 4789:return Df+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Br+e+Df+e+on+e+e;case 5936:switch(ei(e,t+11)){case 114:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Br+e+on+hr(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return Br+e+on+e+e;case 6165:return Br+e+on+"flex-"+e+e;case 5187:return Br+e+hr(e,/(\w+).+(:[^]+)/,Br+"box-$1$2"+on+"flex-$1$2")+e;case 5443:return Br+e+on+"flex-item-"+hr(e,/flex-|-self/g,"")+(ya(e,/flex-|baseline/)?"":on+"grid-row-"+hr(e,/flex-|-self/g,""))+e;case 4675:return Br+e+on+"flex-line-pack"+hr(e,/align-content|flex-|-self/g,"")+e;case 5548:return Br+e+on+hr(e,"shrink","negative")+e;case 5292:return Br+e+on+hr(e,"basis","preferred-size")+e;case 6060:return Br+"box-"+hr(e,"-grow","")+Br+e+on+hr(e,"grow","positive")+e;case 4554:return Br+hr(e,/([^-])(transform)/g,"$1"+Br+"$2")+e;case 6187:return hr(hr(hr(e,/(zoom-|grab)/,Br+"$1"),/(image-set)/,Br+"$1"),e,"")+e;case 5495:case 3959:return hr(e,/(image-set\([^]*)/,Br+"$1$`$1");case 4968:return hr(hr(e,/(.+:)(flex-)?(.*)/,Br+"box-pack:$3"+on+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Br+e+e;case 4200:if(!ya(e,/flex-|baseline/))return on+"grid-column-align"+Ph(e,t)+e;break;case 2592:case 3360:return on+hr(e,"template-","")+e;case 4384:case 3616:return i&&i.some(function(o,h){return t=h,ya(o.props,/grid-\w+-end/)})?~vg(e+(i=i[t].value),"span",0)?e:on+hr(e,"-start","")+e+on+"grid-row-span:"+(~vg(i,"span",0)?ya(i,/\d+/):+ya(i,/\d+/)-+ya(e,/\d+/))+";":on+hr(e,"-start","")+e;case 4896:case 4128:return i&&i.some(function(o){return ya(o.props,/grid-\w+-start/)})?e:on+hr(hr(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return hr(e,/(.+)-inline(.+)/,Br+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(jo(e)-1-t>6)switch(ei(e,t+1)){case 109:if(ei(e,t+4)!==45)break;case 102:return hr(e,/(.+:)(.+)-([^]+)/,"$1"+Br+"$2-$3$1"+Df+(ei(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~vg(e,"stretch",0)?yI(hr(e,"stretch","fill-available"),t,i)+e:e}break;case 5152:case 5920:return hr(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(o,h,f,g,c,T,P){return on+h+":"+f+P+(g?on+h+"-span:"+(c?T:+T-+f)+P:"")+e});case 4949:if(ei(e,t+6)===121)return hr(e,":",":"+Br)+e;break;case 6444:switch(ei(e,ei(e,14)===45?18:11)){case 120:return hr(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Br+(ei(e,14)===45?"inline-":"")+"box$3$1"+Br+"$2$3$1"+on+"$2box$3")+e;case 100:return hr(e,":",":"+on)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return hr(e,"scroll-","scroll-snap-")+e}return e}function cy(e,t){for(var i="",o=0;o-1&&!e.return)switch(e.type){case pw:e.return=yI(e.value,e.length,i);return;case dI:return cy([_l(e,{value:hr(e.value,"@","@"+Br)})],o);case Zy:if(e.length)return WR(i=e.props,function(h){switch(ya(h,o=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Zc(_l(e,{props:[hr(h,/:(read-\w+)/,":"+Df+"$1")]})),Zc(_l(e,{props:[h]})),z1(e,{props:uk(i,o)});break;case"::placeholder":Zc(_l(e,{props:[hr(h,/:(plac\w+)/,":"+Br+"input-$1")]})),Zc(_l(e,{props:[hr(h,/:(plac\w+)/,":"+Df+"$1")]})),Zc(_l(e,{props:[hr(h,/:(plac\w+)/,on+"input-$1")]})),Zc(_l(e,{props:[h]})),z1(e,{props:uk(i,o)});break}return""})}}var o5={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Ps={},Ah=typeof process<"u"&&Ps!==void 0&&(Ps.REACT_APP_SC_ATTR||Ps.SC_ATTR)||"data-styled",_I="active",vI="data-styled-version",Ky="6.1.13",gw=`/*!sc*/ -`,hy=typeof window<"u"&&"HTMLElement"in window,a5=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Ps!==void 0&&Ps.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Ps.REACT_APP_SC_DISABLE_SPEEDY!==""?Ps.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Ps.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&Ps!==void 0&&Ps.SC_DISABLE_SPEEDY!==void 0&&Ps.SC_DISABLE_SPEEDY!==""&&Ps.SC_DISABLE_SPEEDY!=="false"&&Ps.SC_DISABLE_SPEEDY),Jy=Object.freeze([]),Dh=Object.freeze({});function l5(e,t,i){return i===void 0&&(i=Dh),e.theme!==i.theme&&e.theme||t||i.theme}var xI=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),u5=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,c5=/(^-|-$)/g;function dk(e){return e.replace(u5,"-").replace(c5,"")}var h5=/(a)(d)/gi,Ym=52,fk=function(e){return String.fromCharCode(e+(e>25?39:97))};function O1(e){var t,i="";for(t=Math.abs(e);t>Ym;t=t/Ym|0)i=fk(t%Ym)+i;return(fk(t%Ym)+i).replace(h5,"$1-$2")}var yv,wI=5381,uh=function(e,t){for(var i=t.length;i;)e=33*e^t.charCodeAt(--i);return e},bI=function(e){return uh(wI,e)};function d5(e){return O1(bI(e)>>>0)}function f5(e){return e.displayName||e.name||"Component"}function _v(e){return typeof e=="string"&&!0}var SI=typeof Symbol=="function"&&Symbol.for,kI=SI?Symbol.for("react.memo"):60115,p5=SI?Symbol.for("react.forward_ref"):60112,m5={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},g5={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},TI={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},y5=((yv={})[p5]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},yv[kI]=TI,yv);function pk(e){return("type"in(t=e)&&t.type.$$typeof)===kI?TI:"$$typeof"in e?y5[e.$$typeof]:m5;var t}var _5=Object.defineProperty,v5=Object.getOwnPropertyNames,mk=Object.getOwnPropertySymbols,x5=Object.getOwnPropertyDescriptor,w5=Object.getPrototypeOf,gk=Object.prototype;function EI(e,t,i){if(typeof t!="string"){if(gk){var o=w5(t);o&&o!==gk&&EI(e,o,i)}var h=v5(t);mk&&(h=h.concat(mk(t)));for(var f=pk(e),g=pk(t),c=0;c0?" Args: ".concat(t.join(", ")):""))}var b5=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var i=0,o=0;o=this.groupSizes.length){for(var o=this.groupSizes,h=o.length,f=h;t>=f;)if((f<<=1)<0)throw _p(16,"".concat(t));this.groupSizes=new Uint32Array(f),this.groupSizes.set(o),this.length=f;for(var g=h;g=this.length||this.groupSizes[t]===0)return i;for(var o=this.groupSizes[t],h=this.indexOfGroup(t),f=h+o,g=h;g=0){var o=document.createTextNode(i);return this.element.insertBefore(o,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t0&&(te+="".concat(O,","))}),T+="".concat(Y).concat(j,'{content:"').concat(te,'"}').concat(gw)},R=0;R0?".".concat(t):M},R=T.slice();R.push(function(M){M.type===Zy&&M.value.includes("&")&&(M.props[0]=M.props[0].replace(z5,i).replace(o,P))}),g.prefix&&R.push(s5),R.push(r5);var A=function(M,N,Y,j){N===void 0&&(N=""),Y===void 0&&(Y=""),j===void 0&&(j="&"),t=j,i=N,o=new RegExp("\\".concat(i,"\\b"),"g");var te=M.replace(R5,""),O=e5(Y||N?"".concat(Y," ").concat(N," { ").concat(te," }"):te);g.namespace&&(O=PI(O,g.namespace));var $=[];return cy(O,n5(R.concat(i5(function(q){return $.push(q)})))),$};return A.hash=T.length?T.reduce(function(M,N){return N.name||_p(15),uh(M,N.name)},wI).toString():"",A}var O5=new II,B1=L5(),MI=wh.createContext({shouldForwardProp:void 0,styleSheet:O5,stylis:B1});MI.Consumer;wh.createContext(void 0);function xk(){return Ht.useContext(MI)}var F5=function(){function e(t,i){var o=this;this.inject=function(h,f){f===void 0&&(f=B1);var g=o.name+f.hash;h.hasNameForId(o.id,g)||h.insertRules(o.id,g,f(o.rules,g,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=i,_w(this,function(){throw _p(12,String(o.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=B1),this.name+t.hash},e}(),B5=function(e){return e>="A"&&e<="Z"};function wk(e){for(var t="",i=0;i>>0);if(!i.hasNameForId(this.componentId,g)){var c=o(f,".".concat(g),void 0,this.componentId);i.insertRules(this.componentId,g,c)}h=Mu(h,g),this.staticRulesId=g}else{for(var T=uh(this.baseHash,o.hash),P="",R=0;R>>0);i.hasNameForId(this.componentId,N)||i.insertRules(this.componentId,N,o(P,".".concat(N),void 0,this.componentId)),h=Mu(h,N)}}return h},e}(),zI=wh.createContext(void 0);zI.Consumer;var vv={};function j5(e,t,i){var o=yw(e),h=e,f=!_v(e),g=t.attrs,c=g===void 0?Jy:g,T=t.componentId,P=T===void 0?function(ne,oe){var ke=typeof ne!="string"?"sc":dk(ne);vv[ke]=(vv[ke]||0)+1;var ge="".concat(ke,"-").concat(d5(Ky+ke+vv[ke]));return oe?"".concat(oe,"-").concat(ge):ge}(t.displayName,t.parentComponentId):T,R=t.displayName,A=R===void 0?function(ne){return _v(ne)?"styled.".concat(ne):"Styled(".concat(f5(ne),")")}(e):R,M=t.displayName&&t.componentId?"".concat(dk(t.displayName),"-").concat(t.componentId):t.componentId||P,N=o&&h.attrs?h.attrs.concat(c).filter(Boolean):c,Y=t.shouldForwardProp;if(o&&h.shouldForwardProp){var j=h.shouldForwardProp;if(t.shouldForwardProp){var te=t.shouldForwardProp;Y=function(ne,oe){return j(ne,oe)&&te(ne,oe)}}else Y=j}var O=new U5(i,M,o?h.componentStyle:void 0);function $(ne,oe){return function(ke,ge,Fe){var Oe=ke.attrs,We=ke.componentStyle,it=ke.defaultProps,ve=ke.foldedComponentIds,Ue=ke.styledComponentId,H=ke.target,Re=wh.useContext(zI),vt=xk(),ye=ke.shouldForwardProp||vt.shouldForwardProp,Be=l5(ge,Re,it)||Dh,Le=function(rt,Jt,er){for(var Vt,Yt=us(us({},Jt),{className:void 0,theme:er}),_r=0;_r?@[\\\]^`{|}~-]+/g,c5=/(^-|-$)/g;function dk(e){return e.replace(u5,"-").replace(c5,"")}var h5=/(a)(d)/gi,Ym=52,fk=function(e){return String.fromCharCode(e+(e>25?39:97))};function O1(e){var t,i="";for(t=Math.abs(e);t>Ym;t=t/Ym|0)i=fk(t%Ym)+i;return(fk(t%Ym)+i).replace(h5,"$1-$2")}var yv,wI=5381,uh=function(e,t){for(var i=t.length;i;)e=33*e^t.charCodeAt(--i);return e},bI=function(e){return uh(wI,e)};function d5(e){return O1(bI(e)>>>0)}function f5(e){return e.displayName||e.name||"Component"}function _v(e){return typeof e=="string"&&!0}var SI=typeof Symbol=="function"&&Symbol.for,kI=SI?Symbol.for("react.memo"):60115,p5=SI?Symbol.for("react.forward_ref"):60112,m5={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},g5={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},TI={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},y5=((yv={})[p5]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},yv[kI]=TI,yv);function pk(e){return("type"in(t=e)&&t.type.$$typeof)===kI?TI:"$$typeof"in e?y5[e.$$typeof]:m5;var t}var _5=Object.defineProperty,v5=Object.getOwnPropertyNames,mk=Object.getOwnPropertySymbols,x5=Object.getOwnPropertyDescriptor,w5=Object.getPrototypeOf,gk=Object.prototype;function EI(e,t,i){if(typeof t!="string"){if(gk){var o=w5(t);o&&o!==gk&&EI(e,o,i)}var h=v5(t);mk&&(h=h.concat(mk(t)));for(var f=pk(e),g=pk(t),c=0;c0?" Args: ".concat(t.join(", ")):""))}var b5=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var i=0,o=0;o=this.groupSizes.length){for(var o=this.groupSizes,h=o.length,f=h;t>=f;)if((f<<=1)<0)throw _p(16,"".concat(t));this.groupSizes=new Uint32Array(f),this.groupSizes.set(o),this.length=f;for(var g=h;g=this.length||this.groupSizes[t]===0)return i;for(var o=this.groupSizes[t],h=this.indexOfGroup(t),f=h+o,g=h;g=0){var o=document.createTextNode(i);return this.element.insertBefore(o,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t0&&(te+="".concat(O,","))}),T+="".concat(Y).concat(j,'{content:"').concat(te,'"}').concat(gw)},R=0;R0?".".concat(t):M},R=T.slice();R.push(function(M){M.type===Zy&&M.value.includes("&")&&(M.props[0]=M.props[0].replace(z5,i).replace(o,P))}),g.prefix&&R.push(s5),R.push(r5);var A=function(M,N,Y,j){N===void 0&&(N=""),Y===void 0&&(Y=""),j===void 0&&(j="&"),t=j,i=N,o=new RegExp("\\".concat(i,"\\b"),"g");var te=M.replace(R5,""),O=e5(Y||N?"".concat(Y," ").concat(N," { ").concat(te," }"):te);g.namespace&&(O=PI(O,g.namespace));var $=[];return cy(O,n5(R.concat(i5(function(q){return $.push(q)})))),$};return A.hash=T.length?T.reduce(function(M,N){return N.name||_p(15),uh(M,N.name)},wI).toString():"",A}var O5=new II,B1=L5(),MI=wh.createContext({shouldForwardProp:void 0,styleSheet:O5,stylis:B1});MI.Consumer;wh.createContext(void 0);function xk(){return Ht.useContext(MI)}var F5=function(){function e(t,i){var o=this;this.inject=function(h,f){f===void 0&&(f=B1);var g=o.name+f.hash;h.hasNameForId(o.id,g)||h.insertRules(o.id,g,f(o.rules,g,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=i,_w(this,function(){throw _p(12,String(o.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=B1),this.name+t.hash},e}(),B5=function(e){return e>="A"&&e<="Z"};function wk(e){for(var t="",i=0;i>>0);if(!i.hasNameForId(this.componentId,g)){var c=o(f,".".concat(g),void 0,this.componentId);i.insertRules(this.componentId,g,c)}h=Mu(h,g),this.staticRulesId=g}else{for(var T=uh(this.baseHash,o.hash),P="",R=0;R>>0);i.hasNameForId(this.componentId,N)||i.insertRules(this.componentId,N,o(P,".".concat(N),void 0,this.componentId)),h=Mu(h,N)}}return h},e}(),zI=wh.createContext(void 0);zI.Consumer;var vv={};function j5(e,t,i){var o=yw(e),h=e,f=!_v(e),g=t.attrs,c=g===void 0?Jy:g,T=t.componentId,P=T===void 0?function(ne,oe){var ke=typeof ne!="string"?"sc":dk(ne);vv[ke]=(vv[ke]||0)+1;var ge="".concat(ke,"-").concat(d5(Ky+ke+vv[ke]));return oe?"".concat(oe,"-").concat(ge):ge}(t.displayName,t.parentComponentId):T,R=t.displayName,A=R===void 0?function(ne){return _v(ne)?"styled.".concat(ne):"Styled(".concat(f5(ne),")")}(e):R,M=t.displayName&&t.componentId?"".concat(dk(t.displayName),"-").concat(t.componentId):t.componentId||P,N=o&&h.attrs?h.attrs.concat(c).filter(Boolean):c,Y=t.shouldForwardProp;if(o&&h.shouldForwardProp){var j=h.shouldForwardProp;if(t.shouldForwardProp){var te=t.shouldForwardProp;Y=function(ne,oe){return j(ne,oe)&&te(ne,oe)}}else Y=j}var O=new U5(i,M,o?h.componentStyle:void 0);function $(ne,oe){return function(ke,ge,Fe){var Oe=ke.attrs,We=ke.componentStyle,it=ke.defaultProps,ve=ke.foldedComponentIds,Ue=ke.styledComponentId,H=ke.target,Re=wh.useContext(zI),vt=xk(),ye=ke.shouldForwardProp||vt.shouldForwardProp,Be=l5(ge,Re,it)||Dh,Le=function(rt,Jt,er){for(var Vt,Yt=us(us({},Jt),{className:void 0,theme:er}),_r=0;_rc?(ye(!0),R&&R("File size is too big"),!1):!(T&&Pk(xe.size)0||Yt(!1)},[]),Xr=Ht.useCallback(function(je){je.preventDefault(),je.stopPropagation()},[]),V=Ht.useCallback(function(je){je.preventDefault(),je.stopPropagation(),Yt(!1),xv=0;var ie=je.dataTransfer.files;if(ie&&ie.length>0){var de=nt?ie:ie[0],se=rt(de);Jt&&se&&Jt(de)}},[rt]);return Ht.useEffect(function(){var je=Ee.current;return je.addEventListener("click",_r),je.addEventListener("dragenter",fr),je.addEventListener("dragleave",br),je.addEventListener("dragover",Xr),je.addEventListener("drop",V),function(){je.removeEventListener("click",_r),je.removeEventListener("dragenter",fr),je.removeEventListener("dragleave",br),je.removeEventListener("dragover",Xr),je.removeEventListener("drop",V)}},[_r,fr,br,Xr,V,Ee]),Vt}({labelRef:ge,inputRef:Fe,multiple:O,handleChanges:Le,onDrop:N});return Ht.useEffect(function(){q==null||q(Ke)},[Ke]),Ht.useEffect(function(){P?(it(!0),H(P)):(Fe.current&&(Fe.current.value=""),it(!1),H(null))},[P]),Xe.jsxs(H5,Bu({overRide:g,className:"".concat(f||""," ").concat(Y?"is-disabled":""),ref:ge,htmlFor:t,onClick:function(xe){xe.preventDefault(),xe.stopPropagation()},"aria-describedby":ke,role:"button","aria-label":oe},{children:[Xe.jsx("input",{onClick:function(xe){xe.stopPropagation(),Fe&&Fe.current&&(Fe.current.value="",Fe.current.click())},onChange:function(xe){var Ee=xe.target.files,mt=O?Ee:Ee[0],nt=Le(mt);M&&nt&&M(mt)},accept:q5(o),ref:Fe,type:"file",id:t,name:t,disabled:Y,multiple:O,required:$},void 0),Ke&&Xe.jsx(W5,Bu({style:ne},{children:Xe.jsx("span",{children:i||"Drop Here"},void 0)}),void 0),!g&&Xe.jsxs(Xe.Fragment,{children:[Xe.jsx(X5,{},void 0),Xe.jsxs(G5,Bu({error:vt},{children:[K5(Ue,We,vt,Y,j,te),Xe.jsx(Y5,{types:o,minSize:T,maxSize:c},void 0)]}),void 0)]},void 0),g]}),void 0)};function Km(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var OI={exports:{}};/*! +`])),"#666"),Pk=function(e){return e/1024/1024},q5=function(e){return e===void 0?"":e.map(function(t){return".".concat(t.toLowerCase())}).join(",")};function Y5(e){var t=e.types,i=e.minSize,o=e.maxSize;if(t){var h=t.toString(),f="";return o&&(f+="size >= ".concat(o,", ")),i&&(f+="size <= ".concat(i,", ")),Ke.jsx("span",Bu({title:"".concat(f,"types: ").concat(h),className:"file-types"},{children:h}),void 0)}return null}function X5(){return Ke.jsxs("svg",Bu({width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[Ke.jsx("path",{d:"M5.33317 6.66667H22.6665V16H25.3332V6.66667C25.3332 5.196 24.1372 4 22.6665 4H5.33317C3.8625 4 2.6665 5.196 2.6665 6.66667V22.6667C2.6665 24.1373 3.8625 25.3333 5.33317 25.3333H15.9998V22.6667H5.33317V6.66667Z",fill:"#0658C2"},void 0),Ke.jsx("path",{d:"M10.6665 14.6667L6.6665 20H21.3332L15.9998 12L11.9998 17.3333L10.6665 14.6667Z",fill:"#0658C2"},void 0),Ke.jsx("path",{d:"M25.3332 18.6667H22.6665V22.6667H18.6665V25.3333H22.6665V29.3333H25.3332V25.3333H29.3332V22.6667H25.3332V18.6667Z",fill:"#0658C2"},void 0)]}),void 0)}var xv=0,K5=function(e,t,i,o,h,f){return i?Ke.jsx("span",{children:"File type/size error, Hovered on types!"},void 0):Ke.jsx(Z5,{children:o?Ke.jsx("span",{children:"Upload disabled"},void 0):Ke.jsx(Ke.Fragment,e||t?{children:f?Ke.jsx(Ke.Fragment,{children:Ke.jsx("span",{children:f},void 0)},void 0):Ke.jsxs(Ke.Fragment,{children:[Ke.jsx("span",{children:"Uploaded Successfully!"},void 0)," Upload another?"]},void 0)}:{children:Ke.jsxs(Ke.Fragment,h?{children:[Ke.jsx("span",{children:h.split(" ")[0]},void 0)," ",h.substr(h.indexOf(" ")+1)]}:{children:[Ke.jsx("span",{children:"Upload"},void 0)," or drop a file right here"]},void 0)},void 0)},void 0)},J5=function(e){var t=e.name,i=e.hoverTitle,o=e.types,h=e.handleChange,f=e.classes,g=e.children,c=e.maxSize,T=e.minSize,P=e.fileOrFiles,R=e.onSizeError,A=e.onTypeError,M=e.onSelect,N=e.onDrop,Y=e.disabled,j=e.label,te=e.uploadedLabel,O=e.multiple,$=e.required,q=e.onDraggingStateChange,ne=e.dropMessageStyle,oe=e.ariaLabel,ke=e.ariaDescribedby,ge=Ht.useRef(null),Fe=Ht.useRef(null),Oe=Ht.useState(!1),We=Oe[0],it=Oe[1],ve=Ht.useState(null),Ue=ve[0],H=ve[1],Re=Ht.useState(!1),vt=Re[0],ye=Re[1],Be=function(xe){return o&&!function(Ee,mt){var nt=Ee.name.split(".").pop();return mt.map(function(rt){return rt.toLowerCase()}).includes(nt.toLowerCase())}(xe,o)?(ye(!0),A&&A("File type is not supported"),!1):c&&Pk(xe.size)>c?(ye(!0),R&&R("File size is too big"),!1):!(T&&Pk(xe.size)0||Yt(!1)},[]),Xr=Ht.useCallback(function(je){je.preventDefault(),je.stopPropagation()},[]),V=Ht.useCallback(function(je){je.preventDefault(),je.stopPropagation(),Yt(!1),xv=0;var ie=je.dataTransfer.files;if(ie&&ie.length>0){var de=nt?ie:ie[0],se=rt(de);Jt&&se&&Jt(de)}},[rt]);return Ht.useEffect(function(){var je=Ee.current;return je.addEventListener("click",_r),je.addEventListener("dragenter",fr),je.addEventListener("dragleave",br),je.addEventListener("dragover",Xr),je.addEventListener("drop",V),function(){je.removeEventListener("click",_r),je.removeEventListener("dragenter",fr),je.removeEventListener("dragleave",br),je.removeEventListener("dragover",Xr),je.removeEventListener("drop",V)}},[_r,fr,br,Xr,V,Ee]),Vt}({labelRef:ge,inputRef:Fe,multiple:O,handleChanges:Le,onDrop:N});return Ht.useEffect(function(){q==null||q(Xe)},[Xe]),Ht.useEffect(function(){P?(it(!0),H(P)):(Fe.current&&(Fe.current.value=""),it(!1),H(null))},[P]),Ke.jsxs(H5,Bu({overRide:g,className:"".concat(f||""," ").concat(Y?"is-disabled":""),ref:ge,htmlFor:t,onClick:function(xe){xe.preventDefault(),xe.stopPropagation()},"aria-describedby":ke,role:"button","aria-label":oe},{children:[Ke.jsx("input",{onClick:function(xe){xe.stopPropagation(),Fe&&Fe.current&&(Fe.current.value="",Fe.current.click())},onChange:function(xe){var Ee=xe.target.files,mt=O?Ee:Ee[0],nt=Le(mt);M&&nt&&M(mt)},accept:q5(o),ref:Fe,type:"file",id:t,name:t,disabled:Y,multiple:O,required:$},void 0),Xe&&Ke.jsx(W5,Bu({style:ne},{children:Ke.jsx("span",{children:i||"Drop Here"},void 0)}),void 0),!g&&Ke.jsxs(Ke.Fragment,{children:[Ke.jsx(X5,{},void 0),Ke.jsxs(G5,Bu({error:vt},{children:[K5(Ue,We,vt,Y,j,te),Ke.jsx(Y5,{types:o,minSize:T,maxSize:c},void 0)]}),void 0)]},void 0),g]}),void 0)};function Km(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var OI={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -207,8 +207,8 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(e,t){(function(i){e.exports=i()})(function(){return function i(o,h,f){function g(P,R){if(!h[P]){if(!o[P]){var A=typeof Km=="function"&&Km;if(!R&&A)return A(P,!0);if(c)return c(P,!0);var M=new Error("Cannot find module '"+P+"'");throw M.code="MODULE_NOT_FOUND",M}var N=h[P]={exports:{}};o[P][0].call(N.exports,function(Y){var j=o[P][1][Y];return g(j||Y)},N,N.exports,i,o,h,f)}return h[P].exports}for(var c=typeof Km=="function"&&Km,T=0;T>2,N=(3&P)<<4|R>>4,Y=1>6:64,j=2>4,R=(15&M)<<4|(N=c.indexOf(T.charAt(j++)))>>2,A=(3&N)<<6|(Y=c.indexOf(T.charAt(j++))),$[te++]=P,N!==64&&($[te++]=R),Y!==64&&($[te++]=A);return $}},{"./support":30,"./utils":32}],2:[function(i,o,h){var f=i("./external"),g=i("./stream/DataWorker"),c=i("./stream/Crc32Probe"),T=i("./stream/DataLengthProbe");function P(R,A,M,N,Y){this.compressedSize=R,this.uncompressedSize=A,this.crc32=M,this.compression=N,this.compressedContent=Y}P.prototype={getContentWorker:function(){var R=new g(f.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new T("data_length")),A=this;return R.on("end",function(){if(this.streamInfo.data_length!==A.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),R},getCompressedWorker:function(){return new g(f.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},P.createWorkerFrom=function(R,A,M){return R.pipe(new c).pipe(new T("uncompressedSize")).pipe(A.compressWorker(M)).pipe(new T("compressedSize")).withStreamInfo("compression",A)},o.exports=P},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(i,o,h){var f=i("./stream/GenericWorker");h.STORE={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},h.DEFLATE=i("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(i,o,h){var f=i("./utils"),g=function(){for(var c,T=[],P=0;P<256;P++){c=P;for(var R=0;R<8;R++)c=1&c?3988292384^c>>>1:c>>>1;T[P]=c}return T}();o.exports=function(c,T){return c!==void 0&&c.length?f.getTypeOf(c)!=="string"?function(P,R,A,M){var N=g,Y=M+A;P^=-1;for(var j=M;j>>8^N[255&(P^R[j])];return-1^P}(0|T,c,c.length,0):function(P,R,A,M){var N=g,Y=M+A;P^=-1;for(var j=M;j>>8^N[255&(P^R.charCodeAt(j))];return-1^P}(0|T,c,c.length,0):0}},{"./utils":32}],5:[function(i,o,h){h.base64=!1,h.binary=!1,h.dir=!1,h.createFolders=!0,h.date=null,h.compression=null,h.compressionOptions=null,h.comment=null,h.unixPermissions=null,h.dosPermissions=null},{}],6:[function(i,o,h){var f=null;f=typeof Promise<"u"?Promise:i("lie"),o.exports={Promise:f}},{lie:37}],7:[function(i,o,h){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",g=i("pako"),c=i("./utils"),T=i("./stream/GenericWorker"),P=f?"uint8array":"array";function R(A,M){T.call(this,"FlateWorker/"+A),this._pako=null,this._pakoAction=A,this._pakoOptions=M,this.meta={}}h.magic="\b\0",c.inherits(R,T),R.prototype.processChunk=function(A){this.meta=A.meta,this._pako===null&&this._createPako(),this._pako.push(c.transformTo(P,A.data),!1)},R.prototype.flush=function(){T.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},R.prototype.cleanUp=function(){T.prototype.cleanUp.call(this),this._pako=null},R.prototype._createPako=function(){this._pako=new g[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var A=this;this._pako.onData=function(M){A.push({data:M,meta:A.meta})}},h.compressWorker=function(A){return new R("Deflate",A)},h.uncompressWorker=function(){return new R("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(i,o,h){function f(N,Y){var j,te="";for(j=0;j>>=8;return te}function g(N,Y,j,te,O,$){var q,ne,oe=N.file,ke=N.compression,ge=$!==P.utf8encode,Fe=c.transformTo("string",$(oe.name)),Oe=c.transformTo("string",P.utf8encode(oe.name)),We=oe.comment,it=c.transformTo("string",$(We)),ve=c.transformTo("string",P.utf8encode(We)),Ue=Oe.length!==oe.name.length,H=ve.length!==We.length,Re="",vt="",ye="",Be=oe.dir,Le=oe.date,Ke={crc32:0,compressedSize:0,uncompressedSize:0};Y&&!j||(Ke.crc32=N.crc32,Ke.compressedSize=N.compressedSize,Ke.uncompressedSize=N.uncompressedSize);var xe=0;Y&&(xe|=8),ge||!Ue&&!H||(xe|=2048);var Ee=0,mt=0;Be&&(Ee|=16),O==="UNIX"?(mt=798,Ee|=function(rt,Jt){var er=rt;return rt||(er=Jt?16893:33204),(65535&er)<<16}(oe.unixPermissions,Be)):(mt=20,Ee|=function(rt){return 63&(rt||0)}(oe.dosPermissions)),q=Le.getUTCHours(),q<<=6,q|=Le.getUTCMinutes(),q<<=5,q|=Le.getUTCSeconds()/2,ne=Le.getUTCFullYear()-1980,ne<<=4,ne|=Le.getUTCMonth()+1,ne<<=5,ne|=Le.getUTCDate(),Ue&&(vt=f(1,1)+f(R(Fe),4)+Oe,Re+="up"+f(vt.length,2)+vt),H&&(ye=f(1,1)+f(R(it),4)+ve,Re+="uc"+f(ye.length,2)+ye);var nt="";return nt+=` -\0`,nt+=f(xe,2),nt+=ke.magic,nt+=f(q,2),nt+=f(ne,2),nt+=f(Ke.crc32,4),nt+=f(Ke.compressedSize,4),nt+=f(Ke.uncompressedSize,4),nt+=f(Fe.length,2),nt+=f(Re.length,2),{fileRecord:A.LOCAL_FILE_HEADER+nt+Fe+Re,dirRecord:A.CENTRAL_FILE_HEADER+f(mt,2)+nt+f(it.length,2)+"\0\0\0\0"+f(Ee,4)+f(te,4)+Fe+Re+it}}var c=i("../utils"),T=i("../stream/GenericWorker"),P=i("../utf8"),R=i("../crc32"),A=i("../signature");function M(N,Y,j,te){T.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=j,this.encodeFileName=te,this.streamFiles=N,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}c.inherits(M,T),M.prototype.push=function(N){var Y=N.meta.percent||0,j=this.entriesCount,te=this._sources.length;this.accumulate?this.contentBuffer.push(N):(this.bytesWritten+=N.data.length,T.prototype.push.call(this,{data:N.data,meta:{currentFile:this.currentFile,percent:j?(Y+100*(j-te-1))/j:100}}))},M.prototype.openedSource=function(N){this.currentSourceOffset=this.bytesWritten,this.currentFile=N.file.name;var Y=this.streamFiles&&!N.file.dir;if(Y){var j=g(N,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},M.prototype.closedSource=function(N){this.accumulate=!1;var Y=this.streamFiles&&!N.file.dir,j=g(N,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),Y)this.push({data:function(te){return A.DATA_DESCRIPTOR+f(te.crc32,4)+f(te.compressedSize,4)+f(te.uncompressedSize,4)}(N),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},M.prototype.flush=function(){for(var N=this.bytesWritten,Y=0;Y=this.index;T--)P=(P<<8)+this.byteAt(T);return this.index+=c,P},readString:function(c){return f.transformTo("string",this.readData(c))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var c=this.readInt(4);return new Date(Date.UTC(1980+(c>>25&127),(c>>21&15)-1,c>>16&31,c>>11&31,c>>5&63,(31&c)<<1))}},o.exports=g},{"../utils":32}],19:[function(i,o,h){var f=i("./Uint8ArrayReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.readData=function(c){this.checkOffset(c);var T=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(i,o,h){var f=i("./DataReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.byteAt=function(c){return this.data.charCodeAt(this.zero+c)},g.prototype.lastIndexOfSignature=function(c){return this.data.lastIndexOf(c)-this.zero},g.prototype.readAndCheckSignature=function(c){return c===this.readData(4)},g.prototype.readData=function(c){this.checkOffset(c);var T=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./DataReader":18}],21:[function(i,o,h){var f=i("./ArrayReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.readData=function(c){if(this.checkOffset(c),c===0)return new Uint8Array(0);var T=this.data.subarray(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./ArrayReader":17}],22:[function(i,o,h){var f=i("../utils"),g=i("../support"),c=i("./ArrayReader"),T=i("./StringReader"),P=i("./NodeBufferReader"),R=i("./Uint8ArrayReader");o.exports=function(A){var M=f.getTypeOf(A);return f.checkSupport(M),M!=="string"||g.uint8array?M==="nodebuffer"?new P(A):g.uint8array?new R(f.transformTo("uint8array",A)):new c(f.transformTo("array",A)):new T(A)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(i,o,h){h.LOCAL_FILE_HEADER="PK",h.CENTRAL_FILE_HEADER="PK",h.CENTRAL_DIRECTORY_END="PK",h.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",h.ZIP64_CENTRAL_DIRECTORY_END="PK",h.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(i,o,h){var f=i("./GenericWorker"),g=i("../utils");function c(T){f.call(this,"ConvertWorker to "+T),this.destType=T}g.inherits(c,f),c.prototype.processChunk=function(T){this.push({data:g.transformTo(this.destType,T.data),meta:T.meta})},o.exports=c},{"../utils":32,"./GenericWorker":28}],25:[function(i,o,h){var f=i("./GenericWorker"),g=i("../crc32");function c(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i("../utils").inherits(c,f),c.prototype.processChunk=function(T){this.streamInfo.crc32=g(T.data,this.streamInfo.crc32||0),this.push(T)},o.exports=c},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(i,o,h){var f=i("../utils"),g=i("./GenericWorker");function c(T){g.call(this,"DataLengthProbe for "+T),this.propName=T,this.withStreamInfo(T,0)}f.inherits(c,g),c.prototype.processChunk=function(T){if(T){var P=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=P+T.data.length}g.prototype.processChunk.call(this,T)},o.exports=c},{"../utils":32,"./GenericWorker":28}],27:[function(i,o,h){var f=i("../utils"),g=i("./GenericWorker");function c(T){g.call(this,"DataWorker");var P=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,T.then(function(R){P.dataIsReady=!0,P.data=R,P.max=R&&R.length||0,P.type=f.getTypeOf(R),P.isPaused||P._tickAndRepeat()},function(R){P.error(R)})}f.inherits(c,g),c.prototype.cleanUp=function(){g.prototype.cleanUp.call(this),this.data=null},c.prototype.resume=function(){return!!g.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},c.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},c.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var T=null,P=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":T=this.data.substring(this.index,P);break;case"uint8array":T=this.data.subarray(this.index,P);break;case"array":case"nodebuffer":T=this.data.slice(this.index,P)}return this.index=P,this.push({data:T,meta:{percent:this.max?this.index/this.max*100:0}})},o.exports=c},{"../utils":32,"./GenericWorker":28}],28:[function(i,o,h){function f(g){this.name=g||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}f.prototype={push:function(g){this.emit("data",g)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(g){this.emit("error",g)}return!0},error:function(g){return!this.isFinished&&(this.isPaused?this.generatedError=g:(this.isFinished=!0,this.emit("error",g),this.previous&&this.previous.error(g),this.cleanUp()),!0)},on:function(g,c){return this._listeners[g].push(c),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(g,c){if(this._listeners[g])for(var T=0;T "+g:g}},o.exports=f},{}],29:[function(i,o,h){var f=i("../utils"),g=i("./ConvertWorker"),c=i("./GenericWorker"),T=i("../base64"),P=i("../support"),R=i("../external"),A=null;if(P.nodestream)try{A=i("../nodejs/NodejsStreamOutputAdapter")}catch{}function M(Y,j){return new R.Promise(function(te,O){var $=[],q=Y._internalType,ne=Y._outputType,oe=Y._mimeType;Y.on("data",function(ke,ge){$.push(ke),j&&j(ge)}).on("error",function(ke){$=[],O(ke)}).on("end",function(){try{var ke=function(ge,Fe,Oe){switch(ge){case"blob":return f.newBlob(f.transformTo("arraybuffer",Fe),Oe);case"base64":return T.encode(Fe);default:return f.transformTo(ge,Fe)}}(ne,function(ge,Fe){var Oe,We=0,it=null,ve=0;for(Oe=0;Oe"u")h.blob=!1;else{var f=new ArrayBuffer(0);try{h.blob=new Blob([f],{type:"application/zip"}).size===0}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);g.append(f),h.blob=g.getBlob("application/zip").size===0}catch{h.blob=!1}}}try{h.nodestream=!!i("readable-stream").Readable}catch{h.nodestream=!1}},{"readable-stream":16}],31:[function(i,o,h){for(var f=i("./utils"),g=i("./support"),c=i("./nodejsUtils"),T=i("./stream/GenericWorker"),P=new Array(256),R=0;R<256;R++)P[R]=252<=R?6:248<=R?5:240<=R?4:224<=R?3:192<=R?2:1;P[254]=P[254]=1;function A(){T.call(this,"utf-8 decode"),this.leftOver=null}function M(){T.call(this,"utf-8 encode")}h.utf8encode=function(N){return g.nodebuffer?c.newBufferFrom(N,"utf-8"):function(Y){var j,te,O,$,q,ne=Y.length,oe=0;for($=0;$>>6:(te<65536?j[q++]=224|te>>>12:(j[q++]=240|te>>>18,j[q++]=128|te>>>12&63),j[q++]=128|te>>>6&63),j[q++]=128|63&te);return j}(N)},h.utf8decode=function(N){return g.nodebuffer?f.transformTo("nodebuffer",N).toString("utf-8"):function(Y){var j,te,O,$,q=Y.length,ne=new Array(2*q);for(j=te=0;j>10&1023,ne[te++]=56320|1023&O)}return ne.length!==te&&(ne.subarray?ne=ne.subarray(0,te):ne.length=te),f.applyFromCharCode(ne)}(N=f.transformTo(g.uint8array?"uint8array":"array",N))},f.inherits(A,T),A.prototype.processChunk=function(N){var Y=f.transformTo(g.uint8array?"uint8array":"array",N.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var j=Y;(Y=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),Y.set(j,this.leftOver.length)}else Y=this.leftOver.concat(Y);this.leftOver=null}var te=function($,q){var ne;for((q=q||$.length)>$.length&&(q=$.length),ne=q-1;0<=ne&&(192&$[ne])==128;)ne--;return ne<0||ne===0?q:ne+P[$[ne]]>q?ne:q}(Y),O=Y;te!==Y.length&&(g.uint8array?(O=Y.subarray(0,te),this.leftOver=Y.subarray(te,Y.length)):(O=Y.slice(0,te),this.leftOver=Y.slice(te,Y.length))),this.push({data:h.utf8decode(O),meta:N.meta})},A.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:h.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},h.Utf8DecodeWorker=A,f.inherits(M,T),M.prototype.processChunk=function(N){this.push({data:h.utf8encode(N.data),meta:N.meta})},h.Utf8EncodeWorker=M},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(i,o,h){var f=i("./support"),g=i("./base64"),c=i("./nodejsUtils"),T=i("./external");function P(j){return j}function R(j,te){for(var O=0;O>8;this.dir=!!(16&this.externalFileAttributes),N==0&&(this.dosPermissions=63&this.externalFileAttributes),N==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var N=f(this.extraFields[1].value);this.uncompressedSize===g.MAX_VALUE_32BITS&&(this.uncompressedSize=N.readInt(8)),this.compressedSize===g.MAX_VALUE_32BITS&&(this.compressedSize=N.readInt(8)),this.localHeaderOffset===g.MAX_VALUE_32BITS&&(this.localHeaderOffset=N.readInt(8)),this.diskNumberStart===g.MAX_VALUE_32BITS&&(this.diskNumberStart=N.readInt(4))}},readExtraFields:function(N){var Y,j,te,O=N.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});N.index+4>>6:(N<65536?M[te++]=224|N>>>12:(M[te++]=240|N>>>18,M[te++]=128|N>>>12&63),M[te++]=128|N>>>6&63),M[te++]=128|63&N);return M},h.buf2binstring=function(A){return R(A,A.length)},h.binstring2buf=function(A){for(var M=new f.Buf8(A.length),N=0,Y=M.length;N>10&1023,$[Y++]=56320|1023&j)}return R($,Y)},h.utf8border=function(A,M){var N;for((M=M||A.length)>A.length&&(M=A.length),N=M-1;0<=N&&(192&A[N])==128;)N--;return N<0||N===0?M:N+T[A[N]]>M?N:M}},{"./common":41}],43:[function(i,o,h){o.exports=function(f,g,c,T){for(var P=65535&f|0,R=f>>>16&65535|0,A=0;c!==0;){for(c-=A=2e3>>1:g>>>1;c[T]=g}return c}();o.exports=function(g,c,T,P){var R=f,A=P+T;g^=-1;for(var M=P;M>>8^R[255&(g^c[M])];return-1^g}},{}],46:[function(i,o,h){var f,g=i("../utils/common"),c=i("./trees"),T=i("./adler32"),P=i("./crc32"),R=i("./messages"),A=0,M=4,N=0,Y=-2,j=-1,te=4,O=2,$=8,q=9,ne=286,oe=30,ke=19,ge=2*ne+1,Fe=15,Oe=3,We=258,it=We+Oe+1,ve=42,Ue=113,H=1,Re=2,vt=3,ye=4;function Be(V,je){return V.msg=R[je],je}function Le(V){return(V<<1)-(4V.avail_out&&(ie=V.avail_out),ie!==0&&(g.arraySet(V.output,je.pending_buf,je.pending_out,ie,V.next_out),V.next_out+=ie,je.pending_out+=ie,V.total_out+=ie,V.avail_out-=ie,je.pending-=ie,je.pending===0&&(je.pending_out=0))}function Ee(V,je){c._tr_flush_block(V,0<=V.block_start?V.block_start:-1,V.strstart-V.block_start,je),V.block_start=V.strstart,xe(V.strm)}function mt(V,je){V.pending_buf[V.pending++]=je}function nt(V,je){V.pending_buf[V.pending++]=je>>>8&255,V.pending_buf[V.pending++]=255&je}function rt(V,je){var ie,de,se=V.max_chain_length,Te=V.strstart,Ge=V.prev_length,tt=V.nice_match,Ne=V.strstart>V.w_size-it?V.strstart-(V.w_size-it):0,ot=V.window,kt=V.w_mask,at=V.prev,Bt=V.strstart+We,Tr=ot[Te+Ge-1],Ze=ot[Te+Ge];V.prev_length>=V.good_match&&(se>>=2),tt>V.lookahead&&(tt=V.lookahead);do if(ot[(ie=je)+Ge]===Ze&&ot[ie+Ge-1]===Tr&&ot[ie]===ot[Te]&&ot[++ie]===ot[Te+1]){Te+=2,ie++;do;while(ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&TeNe&&--se!=0);return Ge<=V.lookahead?Ge:V.lookahead}function Jt(V){var je,ie,de,se,Te,Ge,tt,Ne,ot,kt,at=V.w_size;do{if(se=V.window_size-V.lookahead-V.strstart,V.strstart>=at+(at-it)){for(g.arraySet(V.window,V.window,at,at,0),V.match_start-=at,V.strstart-=at,V.block_start-=at,je=ie=V.hash_size;de=V.head[--je],V.head[je]=at<=de?de-at:0,--ie;);for(je=ie=at;de=V.prev[--je],V.prev[je]=at<=de?de-at:0,--ie;);se+=at}if(V.strm.avail_in===0)break;if(Ge=V.strm,tt=V.window,Ne=V.strstart+V.lookahead,ot=se,kt=void 0,kt=Ge.avail_in,ot=Oe)for(Te=V.strstart-V.insert,V.ins_h=V.window[Te],V.ins_h=(V.ins_h<=Oe&&(V.ins_h=(V.ins_h<=Oe)if(de=c._tr_tally(V,V.strstart-V.match_start,V.match_length-Oe),V.lookahead-=V.match_length,V.match_length<=V.max_lazy_match&&V.lookahead>=Oe){for(V.match_length--;V.strstart++,V.ins_h=(V.ins_h<=Oe&&(V.ins_h=(V.ins_h<=Oe&&V.match_length<=V.prev_length){for(se=V.strstart+V.lookahead-Oe,de=c._tr_tally(V,V.strstart-1-V.prev_match,V.prev_length-Oe),V.lookahead-=V.prev_length-1,V.prev_length-=2;++V.strstart<=se&&(V.ins_h=(V.ins_h<V.pending_buf_size-5&&(ie=V.pending_buf_size-5);;){if(V.lookahead<=1){if(Jt(V),V.lookahead===0&&je===A)return H;if(V.lookahead===0)break}V.strstart+=V.lookahead,V.lookahead=0;var de=V.block_start+ie;if((V.strstart===0||V.strstart>=de)&&(V.lookahead=V.strstart-de,V.strstart=de,Ee(V,!1),V.strm.avail_out===0)||V.strstart-V.block_start>=V.w_size-it&&(Ee(V,!1),V.strm.avail_out===0))return H}return V.insert=0,je===M?(Ee(V,!0),V.strm.avail_out===0?vt:ye):(V.strstart>V.block_start&&(Ee(V,!1),V.strm.avail_out),H)}),new Yt(4,4,8,4,er),new Yt(4,5,16,8,er),new Yt(4,6,32,32,er),new Yt(4,4,16,16,Vt),new Yt(8,16,32,32,Vt),new Yt(8,16,128,128,Vt),new Yt(8,32,128,256,Vt),new Yt(32,128,258,1024,Vt),new Yt(32,258,258,4096,Vt)],h.deflateInit=function(V,je){return Xr(V,je,$,15,8,0)},h.deflateInit2=Xr,h.deflateReset=br,h.deflateResetKeep=fr,h.deflateSetHeader=function(V,je){return V&&V.state?V.state.wrap!==2?Y:(V.state.gzhead=je,N):Y},h.deflate=function(V,je){var ie,de,se,Te;if(!V||!V.state||5>8&255),mt(de,de.gzhead.time>>16&255),mt(de,de.gzhead.time>>24&255),mt(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),mt(de,255&de.gzhead.os),de.gzhead.extra&&de.gzhead.extra.length&&(mt(de,255&de.gzhead.extra.length),mt(de,de.gzhead.extra.length>>8&255)),de.gzhead.hcrc&&(V.adler=P(V.adler,de.pending_buf,de.pending,0)),de.gzindex=0,de.status=69):(mt(de,0),mt(de,0),mt(de,0),mt(de,0),mt(de,0),mt(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),mt(de,3),de.status=Ue);else{var Ge=$+(de.w_bits-8<<4)<<8;Ge|=(2<=de.strategy||de.level<2?0:de.level<6?1:de.level===6?2:3)<<6,de.strstart!==0&&(Ge|=32),Ge+=31-Ge%31,de.status=Ue,nt(de,Ge),de.strstart!==0&&(nt(de,V.adler>>>16),nt(de,65535&V.adler)),V.adler=1}if(de.status===69)if(de.gzhead.extra){for(se=de.pending;de.gzindex<(65535&de.gzhead.extra.length)&&(de.pending!==de.pending_buf_size||(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending!==de.pending_buf_size));)mt(de,255&de.gzhead.extra[de.gzindex]),de.gzindex++;de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),de.gzindex===de.gzhead.extra.length&&(de.gzindex=0,de.status=73)}else de.status=73;if(de.status===73)if(de.gzhead.name){se=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending===de.pending_buf_size)){Te=1;break}Te=de.gzindexse&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),Te===0&&(de.gzindex=0,de.status=91)}else de.status=91;if(de.status===91)if(de.gzhead.comment){se=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending===de.pending_buf_size)){Te=1;break}Te=de.gzindexse&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),Te===0&&(de.status=103)}else de.status=103;if(de.status===103&&(de.gzhead.hcrc?(de.pending+2>de.pending_buf_size&&xe(V),de.pending+2<=de.pending_buf_size&&(mt(de,255&V.adler),mt(de,V.adler>>8&255),V.adler=0,de.status=Ue)):de.status=Ue),de.pending!==0){if(xe(V),V.avail_out===0)return de.last_flush=-1,N}else if(V.avail_in===0&&Le(je)<=Le(ie)&&je!==M)return Be(V,-5);if(de.status===666&&V.avail_in!==0)return Be(V,-5);if(V.avail_in!==0||de.lookahead!==0||je!==A&&de.status!==666){var tt=de.strategy===2?function(Ne,ot){for(var kt;;){if(Ne.lookahead===0&&(Jt(Ne),Ne.lookahead===0)){if(ot===A)return H;break}if(Ne.match_length=0,kt=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++,kt&&(Ee(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,ot===M?(Ee(Ne,!0),Ne.strm.avail_out===0?vt:ye):Ne.last_lit&&(Ee(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,je):de.strategy===3?function(Ne,ot){for(var kt,at,Bt,Tr,Ze=Ne.window;;){if(Ne.lookahead<=We){if(Jt(Ne),Ne.lookahead<=We&&ot===A)return H;if(Ne.lookahead===0)break}if(Ne.match_length=0,Ne.lookahead>=Oe&&0Ne.lookahead&&(Ne.match_length=Ne.lookahead)}if(Ne.match_length>=Oe?(kt=c._tr_tally(Ne,1,Ne.match_length-Oe),Ne.lookahead-=Ne.match_length,Ne.strstart+=Ne.match_length,Ne.match_length=0):(kt=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++),kt&&(Ee(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,ot===M?(Ee(Ne,!0),Ne.strm.avail_out===0?vt:ye):Ne.last_lit&&(Ee(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,je):f[de.level].func(de,je);if(tt!==vt&&tt!==ye||(de.status=666),tt===H||tt===vt)return V.avail_out===0&&(de.last_flush=-1),N;if(tt===Re&&(je===1?c._tr_align(de):je!==5&&(c._tr_stored_block(de,0,0,!1),je===3&&(Ke(de.head),de.lookahead===0&&(de.strstart=0,de.block_start=0,de.insert=0))),xe(V),V.avail_out===0))return de.last_flush=-1,N}return je!==M?N:de.wrap<=0?1:(de.wrap===2?(mt(de,255&V.adler),mt(de,V.adler>>8&255),mt(de,V.adler>>16&255),mt(de,V.adler>>24&255),mt(de,255&V.total_in),mt(de,V.total_in>>8&255),mt(de,V.total_in>>16&255),mt(de,V.total_in>>24&255)):(nt(de,V.adler>>>16),nt(de,65535&V.adler)),xe(V),0=ie.w_size&&(Te===0&&(Ke(ie.head),ie.strstart=0,ie.block_start=0,ie.insert=0),ot=new g.Buf8(ie.w_size),g.arraySet(ot,je,kt-ie.w_size,ie.w_size,0),je=ot,kt=ie.w_size),Ge=V.avail_in,tt=V.next_in,Ne=V.input,V.avail_in=kt,V.next_in=0,V.input=je,Jt(ie);ie.lookahead>=Oe;){for(de=ie.strstart,se=ie.lookahead-(Oe-1);ie.ins_h=(ie.ins_h<>>=Oe=Fe>>>24,q-=Oe,(Oe=Fe>>>16&255)===0)Re[R++]=65535&Fe;else{if(!(16&Oe)){if(!(64&Oe)){Fe=ne[(65535&Fe)+($&(1<>>=Oe,q-=Oe),q<15&&($+=H[T++]<>>=Oe=Fe>>>24,q-=Oe,!(16&(Oe=Fe>>>16&255))){if(!(64&Oe)){Fe=oe[(65535&Fe)+($&(1<>>=Oe,q-=Oe,(Oe=R-A)>3,$&=(1<<(q-=We<<3))-1,f.next_in=T,f.next_out=R,f.avail_in=T>>24&255)+(ve>>>8&65280)+((65280&ve)<<8)+((255&ve)<<24)}function $(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function q(ve){var Ue;return ve&&ve.state?(Ue=ve.state,ve.total_in=ve.total_out=Ue.total=0,ve.msg="",Ue.wrap&&(ve.adler=1&Ue.wrap),Ue.mode=Y,Ue.last=0,Ue.havedict=0,Ue.dmax=32768,Ue.head=null,Ue.hold=0,Ue.bits=0,Ue.lencode=Ue.lendyn=new f.Buf32(j),Ue.distcode=Ue.distdyn=new f.Buf32(te),Ue.sane=1,Ue.back=-1,M):N}function ne(ve){var Ue;return ve&&ve.state?((Ue=ve.state).wsize=0,Ue.whave=0,Ue.wnext=0,q(ve)):N}function oe(ve,Ue){var H,Re;return ve&&ve.state?(Re=ve.state,Ue<0?(H=0,Ue=-Ue):(H=1+(Ue>>4),Ue<48&&(Ue&=15)),Ue&&(Ue<8||15=ye.wsize?(f.arraySet(ye.window,Ue,H-ye.wsize,ye.wsize,0),ye.wnext=0,ye.whave=ye.wsize):(Re<(vt=ye.wsize-ye.wnext)&&(vt=Re),f.arraySet(ye.window,Ue,H-Re,vt,ye.wnext),(Re-=vt)?(f.arraySet(ye.window,Ue,H-Re,Re,0),ye.wnext=Re,ye.whave=ye.wsize):(ye.wnext+=vt,ye.wnext===ye.wsize&&(ye.wnext=0),ye.whave>>8&255,H.check=c(H.check,Te,2,0),Ee=xe=0,H.mode=2;break}if(H.flags=0,H.head&&(H.head.done=!1),!(1&H.wrap)||(((255&xe)<<8)+(xe>>8))%31){ve.msg="incorrect header check",H.mode=30;break}if((15&xe)!=8){ve.msg="unknown compression method",H.mode=30;break}if(Ee-=4,V=8+(15&(xe>>>=4)),H.wbits===0)H.wbits=V;else if(V>H.wbits){ve.msg="invalid window size",H.mode=30;break}H.dmax=1<>8&1),512&H.flags&&(Te[0]=255&xe,Te[1]=xe>>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0,H.mode=3;case 3:for(;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,Te[2]=xe>>>16&255,Te[3]=xe>>>24&255,H.check=c(H.check,Te,4,0)),Ee=xe=0,H.mode=4;case 4:for(;Ee<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>8),512&H.flags&&(Te[0]=255&xe,Te[1]=xe>>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0,H.mode=5;case 5:if(1024&H.flags){for(;Ee<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0}else H.head&&(H.head.extra=null);H.mode=6;case 6:if(1024&H.flags&&(Le<(rt=H.length)&&(rt=Le),rt&&(H.head&&(V=H.head.extra_len-H.length,H.head.extra||(H.head.extra=new Array(H.head.extra_len)),f.arraySet(H.head.extra,Re,ye,rt,V)),512&H.flags&&(H.check=c(H.check,Re,rt,ye)),Le-=rt,ye+=rt,H.length-=rt),H.length))break e;H.length=0,H.mode=7;case 7:if(2048&H.flags){if(Le===0)break e;for(rt=0;V=Re[ye+rt++],H.head&&V&&H.length<65536&&(H.head.name+=String.fromCharCode(V)),V&&rt>9&1,H.head.done=!0),ve.adler=H.check=0,H.mode=12;break;case 10:for(;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=7&Ee,Ee-=7&Ee,H.mode=27;break}for(;Ee<3;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=1)){case 0:H.mode=14;break;case 1:if(We(H),H.mode=20,Ue!==6)break;xe>>>=2,Ee-=2;break e;case 2:H.mode=17;break;case 3:ve.msg="invalid block type",H.mode=30}xe>>>=2,Ee-=2;break;case 14:for(xe>>>=7&Ee,Ee-=7&Ee;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>16^65535)){ve.msg="invalid stored block lengths",H.mode=30;break}if(H.length=65535&xe,Ee=xe=0,H.mode=15,Ue===6)break e;case 15:H.mode=16;case 16:if(rt=H.length){if(Le>>=5,Ee-=5,H.ndist=1+(31&xe),xe>>>=5,Ee-=5,H.ncode=4+(15&xe),xe>>>=4,Ee-=4,286>>=3,Ee-=3}for(;H.have<19;)H.lens[Ge[H.have++]]=0;if(H.lencode=H.lendyn,H.lenbits=7,ie={bits:H.lenbits},je=P(0,H.lens,0,19,H.lencode,0,H.work,ie),H.lenbits=ie.bits,je){ve.msg="invalid code lengths set",H.mode=30;break}H.have=0,H.mode=19;case 19:for(;H.have>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=Vt,Ee-=Vt,H.lens[H.have++]=_r;else{if(_r===16){for(de=Vt+2;Ee>>=Vt,Ee-=Vt,H.have===0){ve.msg="invalid bit length repeat",H.mode=30;break}V=H.lens[H.have-1],rt=3+(3&xe),xe>>>=2,Ee-=2}else if(_r===17){for(de=Vt+3;Ee>>=Vt)),xe>>>=3,Ee-=3}else{for(de=Vt+7;Ee>>=Vt)),xe>>>=7,Ee-=7}if(H.have+rt>H.nlen+H.ndist){ve.msg="invalid bit length repeat",H.mode=30;break}for(;rt--;)H.lens[H.have++]=V}}if(H.mode===30)break;if(H.lens[256]===0){ve.msg="invalid code -- missing end-of-block",H.mode=30;break}if(H.lenbits=9,ie={bits:H.lenbits},je=P(R,H.lens,0,H.nlen,H.lencode,0,H.work,ie),H.lenbits=ie.bits,je){ve.msg="invalid literal/lengths set",H.mode=30;break}if(H.distbits=6,H.distcode=H.distdyn,ie={bits:H.distbits},je=P(A,H.lens,H.nlen,H.ndist,H.distcode,0,H.work,ie),H.distbits=ie.bits,je){ve.msg="invalid distances set",H.mode=30;break}if(H.mode=20,Ue===6)break e;case 20:H.mode=21;case 21:if(6<=Le&&258<=Ke){ve.next_out=Be,ve.avail_out=Ke,ve.next_in=ye,ve.avail_in=Le,H.hold=xe,H.bits=Ee,T(ve,nt),Be=ve.next_out,vt=ve.output,Ke=ve.avail_out,ye=ve.next_in,Re=ve.input,Le=ve.avail_in,xe=H.hold,Ee=H.bits,H.mode===12&&(H.back=-1);break}for(H.back=0;Yt=(se=H.lencode[xe&(1<>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>fr)])>>>16&255,_r=65535&se,!(fr+(Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=fr,Ee-=fr,H.back+=fr}if(xe>>>=Vt,Ee-=Vt,H.back+=Vt,H.length=_r,Yt===0){H.mode=26;break}if(32&Yt){H.back=-1,H.mode=12;break}if(64&Yt){ve.msg="invalid literal/length code",H.mode=30;break}H.extra=15&Yt,H.mode=22;case 22:if(H.extra){for(de=H.extra;Ee>>=H.extra,Ee-=H.extra,H.back+=H.extra}H.was=H.length,H.mode=23;case 23:for(;Yt=(se=H.distcode[xe&(1<>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>fr)])>>>16&255,_r=65535&se,!(fr+(Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=fr,Ee-=fr,H.back+=fr}if(xe>>>=Vt,Ee-=Vt,H.back+=Vt,64&Yt){ve.msg="invalid distance code",H.mode=30;break}H.offset=_r,H.extra=15&Yt,H.mode=24;case 24:if(H.extra){for(de=H.extra;Ee>>=H.extra,Ee-=H.extra,H.back+=H.extra}if(H.offset>H.dmax){ve.msg="invalid distance too far back",H.mode=30;break}H.mode=25;case 25:if(Ke===0)break e;if(rt=nt-Ke,H.offset>rt){if((rt=H.offset-rt)>H.whave&&H.sane){ve.msg="invalid distance too far back",H.mode=30;break}Jt=rt>H.wnext?(rt-=H.wnext,H.wsize-rt):H.wnext-rt,rt>H.length&&(rt=H.length),er=H.window}else er=vt,Jt=Be-H.offset,rt=H.length;for(Kege?(Oe=Jt[er+te[Ue]],Ee[mt+te[Ue]]):(Oe=96,0),$=1<>Be)+(q-=$)]=Fe<<24|Oe<<16|We|0,q!==0;);for($=1<>=1;if($!==0?(xe&=$-1,xe+=$):xe=0,Ue++,--nt[ve]==0){if(ve===Re)break;ve=A[M+te[Ue]]}if(vt>>7)]}function mt(se,Te){se.pending_buf[se.pending++]=255&Te,se.pending_buf[se.pending++]=Te>>>8&255}function nt(se,Te,Ge){se.bi_valid>O-Ge?(se.bi_buf|=Te<>O-se.bi_valid,se.bi_valid+=Ge-O):(se.bi_buf|=Te<>>=1,Ge<<=1,0<--Te;);return Ge>>>1}function er(se,Te,Ge){var tt,Ne,ot=new Array(te+1),kt=0;for(tt=1;tt<=te;tt++)ot[tt]=kt=kt+Ge[tt-1]<<1;for(Ne=0;Ne<=Te;Ne++){var at=se[2*Ne+1];at!==0&&(se[2*Ne]=Jt(ot[at]++,at))}}function Vt(se){var Te;for(Te=0;Te>1;1<=Ge;Ge--)fr(se,ot,Ge);for(Ne=Bt;Ge=se.heap[1],se.heap[1]=se.heap[se.heap_len--],fr(se,ot,1),tt=se.heap[1],se.heap[--se.heap_max]=Ge,se.heap[--se.heap_max]=tt,ot[2*Ne]=ot[2*Ge]+ot[2*tt],se.depth[Ne]=(se.depth[Ge]>=se.depth[tt]?se.depth[Ge]:se.depth[tt])+1,ot[2*Ge+1]=ot[2*tt+1]=Ne,se.heap[1]=Ne++,fr(se,ot,1),2<=se.heap_len;);se.heap[--se.heap_max]=se.heap[1],function(Ze,tn){var _n,vn,pi,Qe,Kt,Ut,Kr=tn.dyn_tree,mi=tn.max_code,Xt=tn.stat_desc.static_tree,Yi=tn.stat_desc.has_stree,fs=tn.stat_desc.extra_bits,ps=tn.stat_desc.extra_base,Hn=tn.stat_desc.max_length,he=0;for(Qe=0;Qe<=te;Qe++)Ze.bl_count[Qe]=0;for(Kr[2*Ze.heap[Ze.heap_max]+1]=0,_n=Ze.heap_max+1;_n>=7;Ne>>=1)if(1&Tr&&at.dyn_ltree[2*Bt]!==0)return g;if(at.dyn_ltree[18]!==0||at.dyn_ltree[20]!==0||at.dyn_ltree[26]!==0)return c;for(Bt=32;Bt>>3,(ot=se.static_len+3+7>>>3)<=Ne&&(Ne=ot)):Ne=ot=Ge+5,Ge+4<=Ne&&Te!==-1?de(se,Te,Ge,tt):se.strategy===4||ot===Ne?(nt(se,2+(tt?1:0),3),br(se,it,ve)):(nt(se,4+(tt?1:0),3),function(at,Bt,Tr,Ze){var tn;for(nt(at,Bt-257,5),nt(at,Tr-1,5),nt(at,Ze-4,4),tn=0;tn>>8&255,se.pending_buf[se.d_buf+2*se.last_lit+1]=255&Te,se.pending_buf[se.l_buf+se.last_lit]=255&Ge,se.last_lit++,Te===0?se.dyn_ltree[2*Ge]++:(se.matches++,Te--,se.dyn_ltree[2*(H[Ge]+A+1)]++,se.dyn_dtree[2*Ee(Te)]++),se.last_lit===se.lit_bufsize-1},h._tr_align=function(se){nt(se,2,3),rt(se,q,it),function(Te){Te.bi_valid===16?(mt(Te,Te.bi_buf),Te.bi_buf=0,Te.bi_valid=0):8<=Te.bi_valid&&(Te.pending_buf[Te.pending++]=255&Te.bi_buf,Te.bi_buf>>=8,Te.bi_valid-=8)}(se)}},{"../utils/common":41}],53:[function(i,o,h){o.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(i,o,h){(function(f){(function(g,c){if(!g.setImmediate){var T,P,R,A,M=1,N={},Y=!1,j=g.document,te=Object.getPrototypeOf&&Object.getPrototypeOf(g);te=te&&te.setTimeout?te:g,T={}.toString.call(g.process)==="[object process]"?function(ne){process.nextTick(function(){$(ne)})}:function(){if(g.postMessage&&!g.importScripts){var ne=!0,oe=g.onmessage;return g.onmessage=function(){ne=!1},g.postMessage("","*"),g.onmessage=oe,ne}}()?(A="setImmediate$"+Math.random()+"$",g.addEventListener?g.addEventListener("message",q,!1):g.attachEvent("onmessage",q),function(ne){g.postMessage(A+ne,"*")}):g.MessageChannel?((R=new MessageChannel).port1.onmessage=function(ne){$(ne.data)},function(ne){R.port2.postMessage(ne)}):j&&"onreadystatechange"in j.createElement("script")?(P=j.documentElement,function(ne){var oe=j.createElement("script");oe.onreadystatechange=function(){$(ne),oe.onreadystatechange=null,P.removeChild(oe),oe=null},P.appendChild(oe)}):function(ne){setTimeout($,0,ne)},te.setImmediate=function(ne){typeof ne!="function"&&(ne=new Function(""+ne));for(var oe=new Array(arguments.length-1),ke=0;ke"u"?f===void 0?this:f:self)}).call(this,typeof ff<"u"?ff:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(OI);var Q5=OI.exports;const eL=dp(Q5);var $1=function(e,t){return $1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var h in o)Object.prototype.hasOwnProperty.call(o,h)&&(i[h]=o[h])},$1(e,t)};function no(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");$1(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}var Ft=function(){return Ft=Object.assign||function(t){for(var i,o=1,h=arguments.length;o"u"&&(f=e.call(this,o),t.set(h,f)),f}function BI(e,t,i){var o=Array.prototype.slice.call(arguments,3),h=i(o),f=t.get(h);return typeof f>"u"&&(f=e.apply(this,o),t.set(h,f)),f}function vw(e,t,i,o,h){return i.bind(t,e,o,h)}function rL(e,t){var i=e.length===1?FI:BI;return vw(e,this,i,t.cache.create(),t.serializer)}function nL(e,t){return vw(e,this,BI,t.cache.create(),t.serializer)}function iL(e,t){return vw(e,this,FI,t.cache.create(),t.serializer)}var sL=function(){return JSON.stringify(arguments)};function xw(){this.cache=Object.create(null)}xw.prototype.get=function(e){return this.cache[e]};xw.prototype.set=function(e,t){this.cache[e]=t};var oL={create:function(){return new xw}},Ui={variadic:nL,monadic:iL};function NI(e,t,i){if(i===void 0&&(i=Error),!e)throw new i(t)}$i(function(){for(var e,t=[],i=0;i0}),i=[],o=0,h=t;o1)throw new RangeError("integer-width stems only accept a single optional option");h.options[0].replace(pL,function(T,P,R,A,M,N){if(P)t.minimumIntegerDigits=R.length;else{if(A&&M)throw new Error("We currently do not support maximum integer digits");if(N)throw new Error("We currently do not support exact integer digits")}return""});continue}if(YI.test(h.stem)){t.minimumIntegerDigits=h.stem.length;continue}if(Ak.test(h.stem)){if(h.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");h.stem.replace(Ak,function(T,P,R,A,M,N){return R==="*"?t.minimumFractionDigits=P.length:A&&A[0]==="#"?t.maximumFractionDigits=A.length:M&&N?(t.minimumFractionDigits=M.length,t.maximumFractionDigits=M.length+N.length):(t.minimumFractionDigits=P.length,t.maximumFractionDigits=P.length),""});var f=h.options[0];f==="w"?t=Ft(Ft({},t),{trailingZeroDisplay:"stripIfInteger"}):f&&(t=Ft(Ft({},t),Dk(f)));continue}if(qI.test(h.stem)){t=Ft(Ft({},t),Dk(h.stem));continue}var g=XI(h.stem);g&&(t=Ft(Ft({},t),g));var c=mL(h.stem);c&&(t=Ft(Ft({},t),c))}return t}var Jm={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function yL(e,t){for(var i="",o=0;o>1),T="a",P=_L(t);for((P=="H"||P=="k")&&(c=0);c-- >0;)i+=T;for(;g-- >0;)i=P+i}else h==="J"?i+="H":i+=h}return i}function _L(e){var t=e.hourCycle;if(t===void 0&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var i=e.language,o;i!=="root"&&(o=e.maximize().region);var h=Jm[o||""]||Jm[i||""]||Jm["".concat(i,"-001")]||Jm["001"];return h[0]}var wv,vL=new RegExp("^".concat(ZI.source,"*")),xL=new RegExp("".concat(ZI.source,"*$"));function Cr(e,t){return{start:e,end:t}}var wL=!!String.prototype.startsWith&&"_a".startsWith("a",1),bL=!!String.fromCodePoint,SL=!!Object.fromEntries,kL=!!String.prototype.codePointAt,TL=!!String.prototype.trimStart,EL=!!String.prototype.trimEnd,CL=!!Number.isSafeInteger,IL=CL?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},j1=!0;try{var PL=JI("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");j1=((wv=PL.exec("a"))===null||wv===void 0?void 0:wv[0])==="a"}catch{j1=!1}var Rk=wL?function(t,i,o){return t.startsWith(i,o)}:function(t,i,o){return t.slice(o,o+i.length)===i},V1=bL?String.fromCodePoint:function(){for(var t=[],i=0;if;){if(g=t[f++],g>1114111)throw RangeError(g+" is not a valid code point");o+=g<65536?String.fromCharCode(g):String.fromCharCode(((g-=65536)>>10)+55296,g%1024+56320)}return o},Lk=SL?Object.fromEntries:function(t){for(var i={},o=0,h=t;o=o)){var h=t.charCodeAt(i),f;return h<55296||h>56319||i+1===o||(f=t.charCodeAt(i+1))<56320||f>57343?h:(h-55296<<10)+(f-56320)+65536}},ML=TL?function(t){return t.trimStart()}:function(t){return t.replace(vL,"")},AL=EL?function(t){return t.trimEnd()}:function(t){return t.replace(xL,"")};function JI(e,t){return new RegExp(e,t)}var H1;if(j1){var Ok=JI("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");H1=function(t,i){var o;Ok.lastIndex=i;var h=Ok.exec(t);return(o=h[1])!==null&&o!==void 0?o:""}}else H1=function(t,i){for(var o=[];;){var h=KI(t,i);if(h===void 0||QI(h)||LL(h))break;o.push(h),i+=h>=65536?2:1}return V1.apply(void 0,o)};var DL=function(){function e(t,i){i===void 0&&(i={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!i.ignoreTag,this.locale=i.locale,this.requiresOtherClause=!!i.requiresOtherClause,this.shouldParseSkeletons=!!i.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,i,o){for(var h=[];!this.isEOF();){var f=this.char();if(f===123){var g=this.parseArgument(t,o);if(g.err)return g;h.push(g.val)}else{if(f===125&&t>0)break;if(f===35&&(i==="plural"||i==="selectordinal")){var c=this.clonePosition();this.bump(),h.push({type:an.pound,location:Cr(c,this.clonePosition())})}else if(f===60&&!this.ignoreTag&&this.peek()===47){if(o)break;return this.error(kr.UNMATCHED_CLOSING_TAG,Cr(this.clonePosition(),this.clonePosition()))}else if(f===60&&!this.ignoreTag&&W1(this.peek()||0)){var g=this.parseTag(t,i);if(g.err)return g;h.push(g.val)}else{var g=this.parseLiteral(t,i);if(g.err)return g;h.push(g.val)}}}return{val:h,err:null}},e.prototype.parseTag=function(t,i){var o=this.clonePosition();this.bump();var h=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:an.literal,value:"<".concat(h,"/>"),location:Cr(o,this.clonePosition())},err:null};if(this.bumpIf(">")){var f=this.parseMessage(t+1,i,!0);if(f.err)return f;var g=f.val,c=this.clonePosition();if(this.bumpIf("")?{val:{type:an.tag,value:h,children:g,location:Cr(o,this.clonePosition())},err:null}:this.error(kr.INVALID_TAG,Cr(c,this.clonePosition())))}else return this.error(kr.UNCLOSED_TAG,Cr(o,this.clonePosition()))}else return this.error(kr.INVALID_TAG,Cr(o,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&RL(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,i){for(var o=this.clonePosition(),h="";;){var f=this.tryParseQuote(i);if(f){h+=f;continue}var g=this.tryParseUnquoted(t,i);if(g){h+=g;continue}var c=this.tryParseLeftAngleBracket();if(c){h+=c;continue}break}var T=Cr(o,this.clonePosition());return{val:{type:an.literal,value:h,location:T},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!zL(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var i=[this.char()];for(this.bump();!this.isEOF();){var o=this.char();if(o===39)if(this.peek()===39)i.push(39),this.bump();else{this.bump();break}else i.push(o);this.bump()}return V1.apply(void 0,i)},e.prototype.tryParseUnquoted=function(t,i){if(this.isEOF())return null;var o=this.char();return o===60||o===123||o===35&&(i==="plural"||i==="selectordinal")||o===125&&t>0?null:(this.bump(),V1(o))},e.prototype.parseArgument=function(t,i){var o=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(kr.EMPTY_ARGUMENT,Cr(o,this.clonePosition()));var h=this.parseIdentifierIfPossible().value;if(!h)return this.error(kr.MALFORMED_ARGUMENT,Cr(o,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:an.argument,value:h,location:Cr(o,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition())):this.parseArgumentOptions(t,i,h,o);default:return this.error(kr.MALFORMED_ARGUMENT,Cr(o,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),i=this.offset(),o=H1(this.message,i),h=i+o.length;this.bumpTo(h);var f=this.clonePosition(),g=Cr(t,f);return{value:o,location:g}},e.prototype.parseArgumentOptions=function(t,i,o,h){var f,g=this.clonePosition(),c=this.parseIdentifierIfPossible().value,T=this.clonePosition();switch(c){case"":return this.error(kr.EXPECT_ARGUMENT_TYPE,Cr(g,T));case"number":case"date":case"time":{this.bumpSpace();var P=null;if(this.bumpIf(",")){this.bumpSpace();var R=this.clonePosition(),A=this.parseSimpleArgStyleIfPossible();if(A.err)return A;var M=AL(A.val);if(M.length===0)return this.error(kr.EXPECT_ARGUMENT_STYLE,Cr(this.clonePosition(),this.clonePosition()));var N=Cr(R,this.clonePosition());P={style:M,styleLocation:N}}var Y=this.tryParseArgumentClose(h);if(Y.err)return Y;var j=Cr(h,this.clonePosition());if(P&&Rk(P==null?void 0:P.style,"::",0)){var te=ML(P.style.slice(2));if(c==="number"){var A=this.parseNumberSkeletonFromString(te,P.styleLocation);return A.err?A:{val:{type:an.number,value:o,location:j,style:A.val},err:null}}else{if(te.length===0)return this.error(kr.EXPECT_DATE_TIME_SKELETON,j);var O=te;this.locale&&(O=yL(te,this.locale));var M={type:Lh.dateTime,pattern:O,location:P.styleLocation,parsedOptions:this.shouldParseSkeletons?cL(O):{}},$=c==="date"?an.date:an.time;return{val:{type:$,value:o,location:j,style:M},err:null}}}return{val:{type:c==="number"?an.number:c==="date"?an.date:an.time,value:o,location:j,style:(f=P==null?void 0:P.style)!==null&&f!==void 0?f:null},err:null}}case"plural":case"selectordinal":case"select":{var q=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(kr.EXPECT_SELECT_ARGUMENT_OPTIONS,Cr(q,Ft({},q)));this.bumpSpace();var ne=this.parseIdentifierIfPossible(),oe=0;if(c!=="select"&&ne.value==="offset"){if(!this.bumpIf(":"))return this.error(kr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Cr(this.clonePosition(),this.clonePosition()));this.bumpSpace();var A=this.tryParseDecimalInteger(kr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,kr.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(A.err)return A;this.bumpSpace(),ne=this.parseIdentifierIfPossible(),oe=A.val}var ke=this.tryParsePluralOrSelectOptions(t,c,i,ne);if(ke.err)return ke;var Y=this.tryParseArgumentClose(h);if(Y.err)return Y;var ge=Cr(h,this.clonePosition());return c==="select"?{val:{type:an.select,value:o,options:Lk(ke.val),location:ge},err:null}:{val:{type:an.plural,value:o,options:Lk(ke.val),offset:oe,pluralType:c==="plural"?"cardinal":"ordinal",location:ge},err:null}}default:return this.error(kr.INVALID_ARGUMENT_TYPE,Cr(g,T))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,i=this.clonePosition();!this.isEOF();){var o=this.char();switch(o){case 39:{this.bump();var h=this.clonePosition();if(!this.bumpUntil("'"))return this.error(kr.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Cr(h,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(i.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(i.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,i){var o=[];try{o=dL(t)}catch{return this.error(kr.INVALID_NUMBER_SKELETON,i)}return{val:{type:Lh.number,tokens:o,location:i,parsedOptions:this.shouldParseSkeletons?gL(o):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,i,o,h){for(var f,g=!1,c=[],T=new Set,P=h.value,R=h.location;;){if(P.length===0){var A=this.clonePosition();if(i!=="select"&&this.bumpIf("=")){var M=this.tryParseDecimalInteger(kr.EXPECT_PLURAL_ARGUMENT_SELECTOR,kr.INVALID_PLURAL_ARGUMENT_SELECTOR);if(M.err)return M;R=Cr(A,this.clonePosition()),P=this.message.slice(A.offset,this.offset())}else break}if(T.has(P))return this.error(i==="select"?kr.DUPLICATE_SELECT_ARGUMENT_SELECTOR:kr.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,R);P==="other"&&(g=!0),this.bumpSpace();var N=this.clonePosition();if(!this.bumpIf("{"))return this.error(i==="select"?kr.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:kr.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,Cr(this.clonePosition(),this.clonePosition()));var Y=this.parseMessage(t+1,i,o);if(Y.err)return Y;var j=this.tryParseArgumentClose(N);if(j.err)return j;c.push([P,{value:Y.val,location:Cr(N,this.clonePosition())}]),T.add(P),this.bumpSpace(),f=this.parseIdentifierIfPossible(),P=f.value,R=f.location}return c.length===0?this.error(i==="select"?kr.EXPECT_SELECT_ARGUMENT_SELECTOR:kr.EXPECT_PLURAL_ARGUMENT_SELECTOR,Cr(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!g?this.error(kr.MISSING_OTHER_CLAUSE,Cr(this.clonePosition(),this.clonePosition())):{val:c,err:null}},e.prototype.tryParseDecimalInteger=function(t,i){var o=1,h=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(o=-1);for(var f=!1,g=0;!this.isEOF();){var c=this.char();if(c>=48&&c<=57)f=!0,g=g*10+(c-48),this.bump();else break}var T=Cr(h,this.clonePosition());return f?(g*=o,IL(g)?{val:g,err:null}:this.error(i,T)):this.error(t,T)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var i=KI(this.message,t);if(i===void 0)throw Error("Offset ".concat(t," is at invalid UTF-16 code unit boundary"));return i},e.prototype.error=function(t,i){return{val:null,err:{kind:t,message:this.message,location:i}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(Rk(this.message,t,this.offset())){for(var i=0;i=0?(this.bumpTo(o),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset ".concat(t," must be greater than or equal to the current offset ").concat(this.offset()));for(t=Math.min(t,this.message.length);;){var i=this.offset();if(i===t)break;if(i>t)throw Error("targetOffset ".concat(t," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&QI(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),i=this.offset(),o=this.message.charCodeAt(i+(t>=65536?2:1));return o??null},e}();function W1(e){return e>=97&&e<=122||e>=65&&e<=90}function zL(e){return W1(e)||e===47}function RL(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function QI(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function LL(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function G1(e){e.forEach(function(t){if(delete t.location,VI(t)||HI(t))for(var i in t.options)delete t.options[i].location,G1(t.options[i].value);else $I(t)&&GI(t.style)||(UI(t)||jI(t))&&U1(t.style)?delete t.style.location:WI(t)&&G1(t.children)})}function OL(e,t){t===void 0&&(t={}),t=Ft({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var i=new DL(e,t).parse();if(i.err){var o=SyntaxError(kr[i.err.kind]);throw o.location=i.err.location,o.originalMessage=i.err.message,o}return t!=null&&t.captureLocation||G1(i.val),i.val}var Zo;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(Zo||(Zo={}));var Gl=function(e){no(t,e);function t(i,o,h){var f=e.call(this,i)||this;return f.code=o,f.originalMessage=h,f}return t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),Fk=function(e){no(t,e);function t(i,o,h,f){return e.call(this,'Invalid values for "'.concat(i,'": "').concat(o,'". Options are "').concat(Object.keys(h).join('", "'),'"'),Zo.INVALID_VALUE,f)||this}return t}(Gl),FL=function(e){no(t,e);function t(i,o,h){return e.call(this,'Value for "'.concat(i,'" must be of type ').concat(o),Zo.INVALID_VALUE,h)||this}return t}(Gl),BL=function(e){no(t,e);function t(i,o){return e.call(this,'The intl string context variable "'.concat(i,'" was not provided to the string "').concat(o,'"'),Zo.MISSING_VALUE,o)||this}return t}(Gl),Bi;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(Bi||(Bi={}));function NL(e){return e.length<2?e:e.reduce(function(t,i){var o=t[t.length-1];return!o||o.type!==Bi.literal||i.type!==Bi.literal?t.push(i):o.value+=i.value,t},[])}function eP(e){return typeof e=="function"}function kg(e,t,i,o,h,f,g){if(e.length===1&&Mk(e[0]))return[{type:Bi.literal,value:e[0].value}];for(var c=[],T=0,P=e;T>2,N=(3&P)<<4|R>>4,Y=1>6:64,j=2>4,R=(15&M)<<4|(N=c.indexOf(T.charAt(j++)))>>2,A=(3&N)<<6|(Y=c.indexOf(T.charAt(j++))),$[te++]=P,N!==64&&($[te++]=R),Y!==64&&($[te++]=A);return $}},{"./support":30,"./utils":32}],2:[function(i,o,h){var f=i("./external"),g=i("./stream/DataWorker"),c=i("./stream/Crc32Probe"),T=i("./stream/DataLengthProbe");function P(R,A,M,N,Y){this.compressedSize=R,this.uncompressedSize=A,this.crc32=M,this.compression=N,this.compressedContent=Y}P.prototype={getContentWorker:function(){var R=new g(f.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new T("data_length")),A=this;return R.on("end",function(){if(this.streamInfo.data_length!==A.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),R},getCompressedWorker:function(){return new g(f.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},P.createWorkerFrom=function(R,A,M){return R.pipe(new c).pipe(new T("uncompressedSize")).pipe(A.compressWorker(M)).pipe(new T("compressedSize")).withStreamInfo("compression",A)},o.exports=P},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(i,o,h){var f=i("./stream/GenericWorker");h.STORE={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},h.DEFLATE=i("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(i,o,h){var f=i("./utils"),g=function(){for(var c,T=[],P=0;P<256;P++){c=P;for(var R=0;R<8;R++)c=1&c?3988292384^c>>>1:c>>>1;T[P]=c}return T}();o.exports=function(c,T){return c!==void 0&&c.length?f.getTypeOf(c)!=="string"?function(P,R,A,M){var N=g,Y=M+A;P^=-1;for(var j=M;j>>8^N[255&(P^R[j])];return-1^P}(0|T,c,c.length,0):function(P,R,A,M){var N=g,Y=M+A;P^=-1;for(var j=M;j>>8^N[255&(P^R.charCodeAt(j))];return-1^P}(0|T,c,c.length,0):0}},{"./utils":32}],5:[function(i,o,h){h.base64=!1,h.binary=!1,h.dir=!1,h.createFolders=!0,h.date=null,h.compression=null,h.compressionOptions=null,h.comment=null,h.unixPermissions=null,h.dosPermissions=null},{}],6:[function(i,o,h){var f=null;f=typeof Promise<"u"?Promise:i("lie"),o.exports={Promise:f}},{lie:37}],7:[function(i,o,h){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",g=i("pako"),c=i("./utils"),T=i("./stream/GenericWorker"),P=f?"uint8array":"array";function R(A,M){T.call(this,"FlateWorker/"+A),this._pako=null,this._pakoAction=A,this._pakoOptions=M,this.meta={}}h.magic="\b\0",c.inherits(R,T),R.prototype.processChunk=function(A){this.meta=A.meta,this._pako===null&&this._createPako(),this._pako.push(c.transformTo(P,A.data),!1)},R.prototype.flush=function(){T.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},R.prototype.cleanUp=function(){T.prototype.cleanUp.call(this),this._pako=null},R.prototype._createPako=function(){this._pako=new g[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var A=this;this._pako.onData=function(M){A.push({data:M,meta:A.meta})}},h.compressWorker=function(A){return new R("Deflate",A)},h.uncompressWorker=function(){return new R("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(i,o,h){function f(N,Y){var j,te="";for(j=0;j>>=8;return te}function g(N,Y,j,te,O,$){var q,ne,oe=N.file,ke=N.compression,ge=$!==P.utf8encode,Fe=c.transformTo("string",$(oe.name)),Oe=c.transformTo("string",P.utf8encode(oe.name)),We=oe.comment,it=c.transformTo("string",$(We)),ve=c.transformTo("string",P.utf8encode(We)),Ue=Oe.length!==oe.name.length,H=ve.length!==We.length,Re="",vt="",ye="",Be=oe.dir,Le=oe.date,Xe={crc32:0,compressedSize:0,uncompressedSize:0};Y&&!j||(Xe.crc32=N.crc32,Xe.compressedSize=N.compressedSize,Xe.uncompressedSize=N.uncompressedSize);var xe=0;Y&&(xe|=8),ge||!Ue&&!H||(xe|=2048);var Ee=0,mt=0;Be&&(Ee|=16),O==="UNIX"?(mt=798,Ee|=function(rt,Jt){var er=rt;return rt||(er=Jt?16893:33204),(65535&er)<<16}(oe.unixPermissions,Be)):(mt=20,Ee|=function(rt){return 63&(rt||0)}(oe.dosPermissions)),q=Le.getUTCHours(),q<<=6,q|=Le.getUTCMinutes(),q<<=5,q|=Le.getUTCSeconds()/2,ne=Le.getUTCFullYear()-1980,ne<<=4,ne|=Le.getUTCMonth()+1,ne<<=5,ne|=Le.getUTCDate(),Ue&&(vt=f(1,1)+f(R(Fe),4)+Oe,Re+="up"+f(vt.length,2)+vt),H&&(ye=f(1,1)+f(R(it),4)+ve,Re+="uc"+f(ye.length,2)+ye);var nt="";return nt+=` +\0`,nt+=f(xe,2),nt+=ke.magic,nt+=f(q,2),nt+=f(ne,2),nt+=f(Xe.crc32,4),nt+=f(Xe.compressedSize,4),nt+=f(Xe.uncompressedSize,4),nt+=f(Fe.length,2),nt+=f(Re.length,2),{fileRecord:A.LOCAL_FILE_HEADER+nt+Fe+Re,dirRecord:A.CENTRAL_FILE_HEADER+f(mt,2)+nt+f(it.length,2)+"\0\0\0\0"+f(Ee,4)+f(te,4)+Fe+Re+it}}var c=i("../utils"),T=i("../stream/GenericWorker"),P=i("../utf8"),R=i("../crc32"),A=i("../signature");function M(N,Y,j,te){T.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=j,this.encodeFileName=te,this.streamFiles=N,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}c.inherits(M,T),M.prototype.push=function(N){var Y=N.meta.percent||0,j=this.entriesCount,te=this._sources.length;this.accumulate?this.contentBuffer.push(N):(this.bytesWritten+=N.data.length,T.prototype.push.call(this,{data:N.data,meta:{currentFile:this.currentFile,percent:j?(Y+100*(j-te-1))/j:100}}))},M.prototype.openedSource=function(N){this.currentSourceOffset=this.bytesWritten,this.currentFile=N.file.name;var Y=this.streamFiles&&!N.file.dir;if(Y){var j=g(N,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:j.fileRecord,meta:{percent:0}})}else this.accumulate=!0},M.prototype.closedSource=function(N){this.accumulate=!1;var Y=this.streamFiles&&!N.file.dir,j=g(N,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(j.dirRecord),Y)this.push({data:function(te){return A.DATA_DESCRIPTOR+f(te.crc32,4)+f(te.compressedSize,4)+f(te.uncompressedSize,4)}(N),meta:{percent:100}});else for(this.push({data:j.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},M.prototype.flush=function(){for(var N=this.bytesWritten,Y=0;Y=this.index;T--)P=(P<<8)+this.byteAt(T);return this.index+=c,P},readString:function(c){return f.transformTo("string",this.readData(c))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var c=this.readInt(4);return new Date(Date.UTC(1980+(c>>25&127),(c>>21&15)-1,c>>16&31,c>>11&31,c>>5&63,(31&c)<<1))}},o.exports=g},{"../utils":32}],19:[function(i,o,h){var f=i("./Uint8ArrayReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.readData=function(c){this.checkOffset(c);var T=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(i,o,h){var f=i("./DataReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.byteAt=function(c){return this.data.charCodeAt(this.zero+c)},g.prototype.lastIndexOfSignature=function(c){return this.data.lastIndexOf(c)-this.zero},g.prototype.readAndCheckSignature=function(c){return c===this.readData(4)},g.prototype.readData=function(c){this.checkOffset(c);var T=this.data.slice(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./DataReader":18}],21:[function(i,o,h){var f=i("./ArrayReader");function g(c){f.call(this,c)}i("../utils").inherits(g,f),g.prototype.readData=function(c){if(this.checkOffset(c),c===0)return new Uint8Array(0);var T=this.data.subarray(this.zero+this.index,this.zero+this.index+c);return this.index+=c,T},o.exports=g},{"../utils":32,"./ArrayReader":17}],22:[function(i,o,h){var f=i("../utils"),g=i("../support"),c=i("./ArrayReader"),T=i("./StringReader"),P=i("./NodeBufferReader"),R=i("./Uint8ArrayReader");o.exports=function(A){var M=f.getTypeOf(A);return f.checkSupport(M),M!=="string"||g.uint8array?M==="nodebuffer"?new P(A):g.uint8array?new R(f.transformTo("uint8array",A)):new c(f.transformTo("array",A)):new T(A)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(i,o,h){h.LOCAL_FILE_HEADER="PK",h.CENTRAL_FILE_HEADER="PK",h.CENTRAL_DIRECTORY_END="PK",h.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",h.ZIP64_CENTRAL_DIRECTORY_END="PK",h.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(i,o,h){var f=i("./GenericWorker"),g=i("../utils");function c(T){f.call(this,"ConvertWorker to "+T),this.destType=T}g.inherits(c,f),c.prototype.processChunk=function(T){this.push({data:g.transformTo(this.destType,T.data),meta:T.meta})},o.exports=c},{"../utils":32,"./GenericWorker":28}],25:[function(i,o,h){var f=i("./GenericWorker"),g=i("../crc32");function c(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}i("../utils").inherits(c,f),c.prototype.processChunk=function(T){this.streamInfo.crc32=g(T.data,this.streamInfo.crc32||0),this.push(T)},o.exports=c},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(i,o,h){var f=i("../utils"),g=i("./GenericWorker");function c(T){g.call(this,"DataLengthProbe for "+T),this.propName=T,this.withStreamInfo(T,0)}f.inherits(c,g),c.prototype.processChunk=function(T){if(T){var P=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=P+T.data.length}g.prototype.processChunk.call(this,T)},o.exports=c},{"../utils":32,"./GenericWorker":28}],27:[function(i,o,h){var f=i("../utils"),g=i("./GenericWorker");function c(T){g.call(this,"DataWorker");var P=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,T.then(function(R){P.dataIsReady=!0,P.data=R,P.max=R&&R.length||0,P.type=f.getTypeOf(R),P.isPaused||P._tickAndRepeat()},function(R){P.error(R)})}f.inherits(c,g),c.prototype.cleanUp=function(){g.prototype.cleanUp.call(this),this.data=null},c.prototype.resume=function(){return!!g.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},c.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},c.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var T=null,P=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":T=this.data.substring(this.index,P);break;case"uint8array":T=this.data.subarray(this.index,P);break;case"array":case"nodebuffer":T=this.data.slice(this.index,P)}return this.index=P,this.push({data:T,meta:{percent:this.max?this.index/this.max*100:0}})},o.exports=c},{"../utils":32,"./GenericWorker":28}],28:[function(i,o,h){function f(g){this.name=g||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}f.prototype={push:function(g){this.emit("data",g)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(g){this.emit("error",g)}return!0},error:function(g){return!this.isFinished&&(this.isPaused?this.generatedError=g:(this.isFinished=!0,this.emit("error",g),this.previous&&this.previous.error(g),this.cleanUp()),!0)},on:function(g,c){return this._listeners[g].push(c),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(g,c){if(this._listeners[g])for(var T=0;T "+g:g}},o.exports=f},{}],29:[function(i,o,h){var f=i("../utils"),g=i("./ConvertWorker"),c=i("./GenericWorker"),T=i("../base64"),P=i("../support"),R=i("../external"),A=null;if(P.nodestream)try{A=i("../nodejs/NodejsStreamOutputAdapter")}catch{}function M(Y,j){return new R.Promise(function(te,O){var $=[],q=Y._internalType,ne=Y._outputType,oe=Y._mimeType;Y.on("data",function(ke,ge){$.push(ke),j&&j(ge)}).on("error",function(ke){$=[],O(ke)}).on("end",function(){try{var ke=function(ge,Fe,Oe){switch(ge){case"blob":return f.newBlob(f.transformTo("arraybuffer",Fe),Oe);case"base64":return T.encode(Fe);default:return f.transformTo(ge,Fe)}}(ne,function(ge,Fe){var Oe,We=0,it=null,ve=0;for(Oe=0;Oe"u")h.blob=!1;else{var f=new ArrayBuffer(0);try{h.blob=new Blob([f],{type:"application/zip"}).size===0}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);g.append(f),h.blob=g.getBlob("application/zip").size===0}catch{h.blob=!1}}}try{h.nodestream=!!i("readable-stream").Readable}catch{h.nodestream=!1}},{"readable-stream":16}],31:[function(i,o,h){for(var f=i("./utils"),g=i("./support"),c=i("./nodejsUtils"),T=i("./stream/GenericWorker"),P=new Array(256),R=0;R<256;R++)P[R]=252<=R?6:248<=R?5:240<=R?4:224<=R?3:192<=R?2:1;P[254]=P[254]=1;function A(){T.call(this,"utf-8 decode"),this.leftOver=null}function M(){T.call(this,"utf-8 encode")}h.utf8encode=function(N){return g.nodebuffer?c.newBufferFrom(N,"utf-8"):function(Y){var j,te,O,$,q,ne=Y.length,oe=0;for($=0;$>>6:(te<65536?j[q++]=224|te>>>12:(j[q++]=240|te>>>18,j[q++]=128|te>>>12&63),j[q++]=128|te>>>6&63),j[q++]=128|63&te);return j}(N)},h.utf8decode=function(N){return g.nodebuffer?f.transformTo("nodebuffer",N).toString("utf-8"):function(Y){var j,te,O,$,q=Y.length,ne=new Array(2*q);for(j=te=0;j>10&1023,ne[te++]=56320|1023&O)}return ne.length!==te&&(ne.subarray?ne=ne.subarray(0,te):ne.length=te),f.applyFromCharCode(ne)}(N=f.transformTo(g.uint8array?"uint8array":"array",N))},f.inherits(A,T),A.prototype.processChunk=function(N){var Y=f.transformTo(g.uint8array?"uint8array":"array",N.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var j=Y;(Y=new Uint8Array(j.length+this.leftOver.length)).set(this.leftOver,0),Y.set(j,this.leftOver.length)}else Y=this.leftOver.concat(Y);this.leftOver=null}var te=function($,q){var ne;for((q=q||$.length)>$.length&&(q=$.length),ne=q-1;0<=ne&&(192&$[ne])==128;)ne--;return ne<0||ne===0?q:ne+P[$[ne]]>q?ne:q}(Y),O=Y;te!==Y.length&&(g.uint8array?(O=Y.subarray(0,te),this.leftOver=Y.subarray(te,Y.length)):(O=Y.slice(0,te),this.leftOver=Y.slice(te,Y.length))),this.push({data:h.utf8decode(O),meta:N.meta})},A.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:h.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},h.Utf8DecodeWorker=A,f.inherits(M,T),M.prototype.processChunk=function(N){this.push({data:h.utf8encode(N.data),meta:N.meta})},h.Utf8EncodeWorker=M},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(i,o,h){var f=i("./support"),g=i("./base64"),c=i("./nodejsUtils"),T=i("./external");function P(j){return j}function R(j,te){for(var O=0;O>8;this.dir=!!(16&this.externalFileAttributes),N==0&&(this.dosPermissions=63&this.externalFileAttributes),N==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var N=f(this.extraFields[1].value);this.uncompressedSize===g.MAX_VALUE_32BITS&&(this.uncompressedSize=N.readInt(8)),this.compressedSize===g.MAX_VALUE_32BITS&&(this.compressedSize=N.readInt(8)),this.localHeaderOffset===g.MAX_VALUE_32BITS&&(this.localHeaderOffset=N.readInt(8)),this.diskNumberStart===g.MAX_VALUE_32BITS&&(this.diskNumberStart=N.readInt(4))}},readExtraFields:function(N){var Y,j,te,O=N.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});N.index+4>>6:(N<65536?M[te++]=224|N>>>12:(M[te++]=240|N>>>18,M[te++]=128|N>>>12&63),M[te++]=128|N>>>6&63),M[te++]=128|63&N);return M},h.buf2binstring=function(A){return R(A,A.length)},h.binstring2buf=function(A){for(var M=new f.Buf8(A.length),N=0,Y=M.length;N>10&1023,$[Y++]=56320|1023&j)}return R($,Y)},h.utf8border=function(A,M){var N;for((M=M||A.length)>A.length&&(M=A.length),N=M-1;0<=N&&(192&A[N])==128;)N--;return N<0||N===0?M:N+T[A[N]]>M?N:M}},{"./common":41}],43:[function(i,o,h){o.exports=function(f,g,c,T){for(var P=65535&f|0,R=f>>>16&65535|0,A=0;c!==0;){for(c-=A=2e3>>1:g>>>1;c[T]=g}return c}();o.exports=function(g,c,T,P){var R=f,A=P+T;g^=-1;for(var M=P;M>>8^R[255&(g^c[M])];return-1^g}},{}],46:[function(i,o,h){var f,g=i("../utils/common"),c=i("./trees"),T=i("./adler32"),P=i("./crc32"),R=i("./messages"),A=0,M=4,N=0,Y=-2,j=-1,te=4,O=2,$=8,q=9,ne=286,oe=30,ke=19,ge=2*ne+1,Fe=15,Oe=3,We=258,it=We+Oe+1,ve=42,Ue=113,H=1,Re=2,vt=3,ye=4;function Be(V,je){return V.msg=R[je],je}function Le(V){return(V<<1)-(4V.avail_out&&(ie=V.avail_out),ie!==0&&(g.arraySet(V.output,je.pending_buf,je.pending_out,ie,V.next_out),V.next_out+=ie,je.pending_out+=ie,V.total_out+=ie,V.avail_out-=ie,je.pending-=ie,je.pending===0&&(je.pending_out=0))}function Ee(V,je){c._tr_flush_block(V,0<=V.block_start?V.block_start:-1,V.strstart-V.block_start,je),V.block_start=V.strstart,xe(V.strm)}function mt(V,je){V.pending_buf[V.pending++]=je}function nt(V,je){V.pending_buf[V.pending++]=je>>>8&255,V.pending_buf[V.pending++]=255&je}function rt(V,je){var ie,de,se=V.max_chain_length,Te=V.strstart,Ge=V.prev_length,tt=V.nice_match,Ne=V.strstart>V.w_size-it?V.strstart-(V.w_size-it):0,ot=V.window,kt=V.w_mask,at=V.prev,Bt=V.strstart+We,Tr=ot[Te+Ge-1],Ze=ot[Te+Ge];V.prev_length>=V.good_match&&(se>>=2),tt>V.lookahead&&(tt=V.lookahead);do if(ot[(ie=je)+Ge]===Ze&&ot[ie+Ge-1]===Tr&&ot[ie]===ot[Te]&&ot[++ie]===ot[Te+1]){Te+=2,ie++;do;while(ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&ot[++Te]===ot[++ie]&&TeNe&&--se!=0);return Ge<=V.lookahead?Ge:V.lookahead}function Jt(V){var je,ie,de,se,Te,Ge,tt,Ne,ot,kt,at=V.w_size;do{if(se=V.window_size-V.lookahead-V.strstart,V.strstart>=at+(at-it)){for(g.arraySet(V.window,V.window,at,at,0),V.match_start-=at,V.strstart-=at,V.block_start-=at,je=ie=V.hash_size;de=V.head[--je],V.head[je]=at<=de?de-at:0,--ie;);for(je=ie=at;de=V.prev[--je],V.prev[je]=at<=de?de-at:0,--ie;);se+=at}if(V.strm.avail_in===0)break;if(Ge=V.strm,tt=V.window,Ne=V.strstart+V.lookahead,ot=se,kt=void 0,kt=Ge.avail_in,ot=Oe)for(Te=V.strstart-V.insert,V.ins_h=V.window[Te],V.ins_h=(V.ins_h<=Oe&&(V.ins_h=(V.ins_h<=Oe)if(de=c._tr_tally(V,V.strstart-V.match_start,V.match_length-Oe),V.lookahead-=V.match_length,V.match_length<=V.max_lazy_match&&V.lookahead>=Oe){for(V.match_length--;V.strstart++,V.ins_h=(V.ins_h<=Oe&&(V.ins_h=(V.ins_h<=Oe&&V.match_length<=V.prev_length){for(se=V.strstart+V.lookahead-Oe,de=c._tr_tally(V,V.strstart-1-V.prev_match,V.prev_length-Oe),V.lookahead-=V.prev_length-1,V.prev_length-=2;++V.strstart<=se&&(V.ins_h=(V.ins_h<V.pending_buf_size-5&&(ie=V.pending_buf_size-5);;){if(V.lookahead<=1){if(Jt(V),V.lookahead===0&&je===A)return H;if(V.lookahead===0)break}V.strstart+=V.lookahead,V.lookahead=0;var de=V.block_start+ie;if((V.strstart===0||V.strstart>=de)&&(V.lookahead=V.strstart-de,V.strstart=de,Ee(V,!1),V.strm.avail_out===0)||V.strstart-V.block_start>=V.w_size-it&&(Ee(V,!1),V.strm.avail_out===0))return H}return V.insert=0,je===M?(Ee(V,!0),V.strm.avail_out===0?vt:ye):(V.strstart>V.block_start&&(Ee(V,!1),V.strm.avail_out),H)}),new Yt(4,4,8,4,er),new Yt(4,5,16,8,er),new Yt(4,6,32,32,er),new Yt(4,4,16,16,Vt),new Yt(8,16,32,32,Vt),new Yt(8,16,128,128,Vt),new Yt(8,32,128,256,Vt),new Yt(32,128,258,1024,Vt),new Yt(32,258,258,4096,Vt)],h.deflateInit=function(V,je){return Xr(V,je,$,15,8,0)},h.deflateInit2=Xr,h.deflateReset=br,h.deflateResetKeep=fr,h.deflateSetHeader=function(V,je){return V&&V.state?V.state.wrap!==2?Y:(V.state.gzhead=je,N):Y},h.deflate=function(V,je){var ie,de,se,Te;if(!V||!V.state||5>8&255),mt(de,de.gzhead.time>>16&255),mt(de,de.gzhead.time>>24&255),mt(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),mt(de,255&de.gzhead.os),de.gzhead.extra&&de.gzhead.extra.length&&(mt(de,255&de.gzhead.extra.length),mt(de,de.gzhead.extra.length>>8&255)),de.gzhead.hcrc&&(V.adler=P(V.adler,de.pending_buf,de.pending,0)),de.gzindex=0,de.status=69):(mt(de,0),mt(de,0),mt(de,0),mt(de,0),mt(de,0),mt(de,de.level===9?2:2<=de.strategy||de.level<2?4:0),mt(de,3),de.status=Ue);else{var Ge=$+(de.w_bits-8<<4)<<8;Ge|=(2<=de.strategy||de.level<2?0:de.level<6?1:de.level===6?2:3)<<6,de.strstart!==0&&(Ge|=32),Ge+=31-Ge%31,de.status=Ue,nt(de,Ge),de.strstart!==0&&(nt(de,V.adler>>>16),nt(de,65535&V.adler)),V.adler=1}if(de.status===69)if(de.gzhead.extra){for(se=de.pending;de.gzindex<(65535&de.gzhead.extra.length)&&(de.pending!==de.pending_buf_size||(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending!==de.pending_buf_size));)mt(de,255&de.gzhead.extra[de.gzindex]),de.gzindex++;de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),de.gzindex===de.gzhead.extra.length&&(de.gzindex=0,de.status=73)}else de.status=73;if(de.status===73)if(de.gzhead.name){se=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending===de.pending_buf_size)){Te=1;break}Te=de.gzindexse&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),Te===0&&(de.gzindex=0,de.status=91)}else de.status=91;if(de.status===91)if(de.gzhead.comment){se=de.pending;do{if(de.pending===de.pending_buf_size&&(de.gzhead.hcrc&&de.pending>se&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),xe(V),se=de.pending,de.pending===de.pending_buf_size)){Te=1;break}Te=de.gzindexse&&(V.adler=P(V.adler,de.pending_buf,de.pending-se,se)),Te===0&&(de.status=103)}else de.status=103;if(de.status===103&&(de.gzhead.hcrc?(de.pending+2>de.pending_buf_size&&xe(V),de.pending+2<=de.pending_buf_size&&(mt(de,255&V.adler),mt(de,V.adler>>8&255),V.adler=0,de.status=Ue)):de.status=Ue),de.pending!==0){if(xe(V),V.avail_out===0)return de.last_flush=-1,N}else if(V.avail_in===0&&Le(je)<=Le(ie)&&je!==M)return Be(V,-5);if(de.status===666&&V.avail_in!==0)return Be(V,-5);if(V.avail_in!==0||de.lookahead!==0||je!==A&&de.status!==666){var tt=de.strategy===2?function(Ne,ot){for(var kt;;){if(Ne.lookahead===0&&(Jt(Ne),Ne.lookahead===0)){if(ot===A)return H;break}if(Ne.match_length=0,kt=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++,kt&&(Ee(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,ot===M?(Ee(Ne,!0),Ne.strm.avail_out===0?vt:ye):Ne.last_lit&&(Ee(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,je):de.strategy===3?function(Ne,ot){for(var kt,at,Bt,Tr,Ze=Ne.window;;){if(Ne.lookahead<=We){if(Jt(Ne),Ne.lookahead<=We&&ot===A)return H;if(Ne.lookahead===0)break}if(Ne.match_length=0,Ne.lookahead>=Oe&&0Ne.lookahead&&(Ne.match_length=Ne.lookahead)}if(Ne.match_length>=Oe?(kt=c._tr_tally(Ne,1,Ne.match_length-Oe),Ne.lookahead-=Ne.match_length,Ne.strstart+=Ne.match_length,Ne.match_length=0):(kt=c._tr_tally(Ne,0,Ne.window[Ne.strstart]),Ne.lookahead--,Ne.strstart++),kt&&(Ee(Ne,!1),Ne.strm.avail_out===0))return H}return Ne.insert=0,ot===M?(Ee(Ne,!0),Ne.strm.avail_out===0?vt:ye):Ne.last_lit&&(Ee(Ne,!1),Ne.strm.avail_out===0)?H:Re}(de,je):f[de.level].func(de,je);if(tt!==vt&&tt!==ye||(de.status=666),tt===H||tt===vt)return V.avail_out===0&&(de.last_flush=-1),N;if(tt===Re&&(je===1?c._tr_align(de):je!==5&&(c._tr_stored_block(de,0,0,!1),je===3&&(Xe(de.head),de.lookahead===0&&(de.strstart=0,de.block_start=0,de.insert=0))),xe(V),V.avail_out===0))return de.last_flush=-1,N}return je!==M?N:de.wrap<=0?1:(de.wrap===2?(mt(de,255&V.adler),mt(de,V.adler>>8&255),mt(de,V.adler>>16&255),mt(de,V.adler>>24&255),mt(de,255&V.total_in),mt(de,V.total_in>>8&255),mt(de,V.total_in>>16&255),mt(de,V.total_in>>24&255)):(nt(de,V.adler>>>16),nt(de,65535&V.adler)),xe(V),0=ie.w_size&&(Te===0&&(Xe(ie.head),ie.strstart=0,ie.block_start=0,ie.insert=0),ot=new g.Buf8(ie.w_size),g.arraySet(ot,je,kt-ie.w_size,ie.w_size,0),je=ot,kt=ie.w_size),Ge=V.avail_in,tt=V.next_in,Ne=V.input,V.avail_in=kt,V.next_in=0,V.input=je,Jt(ie);ie.lookahead>=Oe;){for(de=ie.strstart,se=ie.lookahead-(Oe-1);ie.ins_h=(ie.ins_h<>>=Oe=Fe>>>24,q-=Oe,(Oe=Fe>>>16&255)===0)Re[R++]=65535&Fe;else{if(!(16&Oe)){if(!(64&Oe)){Fe=ne[(65535&Fe)+($&(1<>>=Oe,q-=Oe),q<15&&($+=H[T++]<>>=Oe=Fe>>>24,q-=Oe,!(16&(Oe=Fe>>>16&255))){if(!(64&Oe)){Fe=oe[(65535&Fe)+($&(1<>>=Oe,q-=Oe,(Oe=R-A)>3,$&=(1<<(q-=We<<3))-1,f.next_in=T,f.next_out=R,f.avail_in=T>>24&255)+(ve>>>8&65280)+((65280&ve)<<8)+((255&ve)<<24)}function $(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function q(ve){var Ue;return ve&&ve.state?(Ue=ve.state,ve.total_in=ve.total_out=Ue.total=0,ve.msg="",Ue.wrap&&(ve.adler=1&Ue.wrap),Ue.mode=Y,Ue.last=0,Ue.havedict=0,Ue.dmax=32768,Ue.head=null,Ue.hold=0,Ue.bits=0,Ue.lencode=Ue.lendyn=new f.Buf32(j),Ue.distcode=Ue.distdyn=new f.Buf32(te),Ue.sane=1,Ue.back=-1,M):N}function ne(ve){var Ue;return ve&&ve.state?((Ue=ve.state).wsize=0,Ue.whave=0,Ue.wnext=0,q(ve)):N}function oe(ve,Ue){var H,Re;return ve&&ve.state?(Re=ve.state,Ue<0?(H=0,Ue=-Ue):(H=1+(Ue>>4),Ue<48&&(Ue&=15)),Ue&&(Ue<8||15=ye.wsize?(f.arraySet(ye.window,Ue,H-ye.wsize,ye.wsize,0),ye.wnext=0,ye.whave=ye.wsize):(Re<(vt=ye.wsize-ye.wnext)&&(vt=Re),f.arraySet(ye.window,Ue,H-Re,vt,ye.wnext),(Re-=vt)?(f.arraySet(ye.window,Ue,H-Re,Re,0),ye.wnext=Re,ye.whave=ye.wsize):(ye.wnext+=vt,ye.wnext===ye.wsize&&(ye.wnext=0),ye.whave>>8&255,H.check=c(H.check,Te,2,0),Ee=xe=0,H.mode=2;break}if(H.flags=0,H.head&&(H.head.done=!1),!(1&H.wrap)||(((255&xe)<<8)+(xe>>8))%31){ve.msg="incorrect header check",H.mode=30;break}if((15&xe)!=8){ve.msg="unknown compression method",H.mode=30;break}if(Ee-=4,V=8+(15&(xe>>>=4)),H.wbits===0)H.wbits=V;else if(V>H.wbits){ve.msg="invalid window size",H.mode=30;break}H.dmax=1<>8&1),512&H.flags&&(Te[0]=255&xe,Te[1]=xe>>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0,H.mode=3;case 3:for(;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,Te[2]=xe>>>16&255,Te[3]=xe>>>24&255,H.check=c(H.check,Te,4,0)),Ee=xe=0,H.mode=4;case 4:for(;Ee<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>8),512&H.flags&&(Te[0]=255&xe,Te[1]=xe>>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0,H.mode=5;case 5:if(1024&H.flags){for(;Ee<16;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>8&255,H.check=c(H.check,Te,2,0)),Ee=xe=0}else H.head&&(H.head.extra=null);H.mode=6;case 6:if(1024&H.flags&&(Le<(rt=H.length)&&(rt=Le),rt&&(H.head&&(V=H.head.extra_len-H.length,H.head.extra||(H.head.extra=new Array(H.head.extra_len)),f.arraySet(H.head.extra,Re,ye,rt,V)),512&H.flags&&(H.check=c(H.check,Re,rt,ye)),Le-=rt,ye+=rt,H.length-=rt),H.length))break e;H.length=0,H.mode=7;case 7:if(2048&H.flags){if(Le===0)break e;for(rt=0;V=Re[ye+rt++],H.head&&V&&H.length<65536&&(H.head.name+=String.fromCharCode(V)),V&&rt>9&1,H.head.done=!0),ve.adler=H.check=0,H.mode=12;break;case 10:for(;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=7&Ee,Ee-=7&Ee,H.mode=27;break}for(;Ee<3;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=1)){case 0:H.mode=14;break;case 1:if(We(H),H.mode=20,Ue!==6)break;xe>>>=2,Ee-=2;break e;case 2:H.mode=17;break;case 3:ve.msg="invalid block type",H.mode=30}xe>>>=2,Ee-=2;break;case 14:for(xe>>>=7&Ee,Ee-=7&Ee;Ee<32;){if(Le===0)break e;Le--,xe+=Re[ye++]<>>16^65535)){ve.msg="invalid stored block lengths",H.mode=30;break}if(H.length=65535&xe,Ee=xe=0,H.mode=15,Ue===6)break e;case 15:H.mode=16;case 16:if(rt=H.length){if(Le>>=5,Ee-=5,H.ndist=1+(31&xe),xe>>>=5,Ee-=5,H.ncode=4+(15&xe),xe>>>=4,Ee-=4,286>>=3,Ee-=3}for(;H.have<19;)H.lens[Ge[H.have++]]=0;if(H.lencode=H.lendyn,H.lenbits=7,ie={bits:H.lenbits},je=P(0,H.lens,0,19,H.lencode,0,H.work,ie),H.lenbits=ie.bits,je){ve.msg="invalid code lengths set",H.mode=30;break}H.have=0,H.mode=19;case 19:for(;H.have>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=Vt,Ee-=Vt,H.lens[H.have++]=_r;else{if(_r===16){for(de=Vt+2;Ee>>=Vt,Ee-=Vt,H.have===0){ve.msg="invalid bit length repeat",H.mode=30;break}V=H.lens[H.have-1],rt=3+(3&xe),xe>>>=2,Ee-=2}else if(_r===17){for(de=Vt+3;Ee>>=Vt)),xe>>>=3,Ee-=3}else{for(de=Vt+7;Ee>>=Vt)),xe>>>=7,Ee-=7}if(H.have+rt>H.nlen+H.ndist){ve.msg="invalid bit length repeat",H.mode=30;break}for(;rt--;)H.lens[H.have++]=V}}if(H.mode===30)break;if(H.lens[256]===0){ve.msg="invalid code -- missing end-of-block",H.mode=30;break}if(H.lenbits=9,ie={bits:H.lenbits},je=P(R,H.lens,0,H.nlen,H.lencode,0,H.work,ie),H.lenbits=ie.bits,je){ve.msg="invalid literal/lengths set",H.mode=30;break}if(H.distbits=6,H.distcode=H.distdyn,ie={bits:H.distbits},je=P(A,H.lens,H.nlen,H.ndist,H.distcode,0,H.work,ie),H.distbits=ie.bits,je){ve.msg="invalid distances set",H.mode=30;break}if(H.mode=20,Ue===6)break e;case 20:H.mode=21;case 21:if(6<=Le&&258<=Xe){ve.next_out=Be,ve.avail_out=Xe,ve.next_in=ye,ve.avail_in=Le,H.hold=xe,H.bits=Ee,T(ve,nt),Be=ve.next_out,vt=ve.output,Xe=ve.avail_out,ye=ve.next_in,Re=ve.input,Le=ve.avail_in,xe=H.hold,Ee=H.bits,H.mode===12&&(H.back=-1);break}for(H.back=0;Yt=(se=H.lencode[xe&(1<>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>fr)])>>>16&255,_r=65535&se,!(fr+(Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=fr,Ee-=fr,H.back+=fr}if(xe>>>=Vt,Ee-=Vt,H.back+=Vt,H.length=_r,Yt===0){H.mode=26;break}if(32&Yt){H.back=-1,H.mode=12;break}if(64&Yt){ve.msg="invalid literal/length code",H.mode=30;break}H.extra=15&Yt,H.mode=22;case 22:if(H.extra){for(de=H.extra;Ee>>=H.extra,Ee-=H.extra,H.back+=H.extra}H.was=H.length,H.mode=23;case 23:for(;Yt=(se=H.distcode[xe&(1<>>16&255,_r=65535&se,!((Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>fr)])>>>16&255,_r=65535&se,!(fr+(Vt=se>>>24)<=Ee);){if(Le===0)break e;Le--,xe+=Re[ye++]<>>=fr,Ee-=fr,H.back+=fr}if(xe>>>=Vt,Ee-=Vt,H.back+=Vt,64&Yt){ve.msg="invalid distance code",H.mode=30;break}H.offset=_r,H.extra=15&Yt,H.mode=24;case 24:if(H.extra){for(de=H.extra;Ee>>=H.extra,Ee-=H.extra,H.back+=H.extra}if(H.offset>H.dmax){ve.msg="invalid distance too far back",H.mode=30;break}H.mode=25;case 25:if(Xe===0)break e;if(rt=nt-Xe,H.offset>rt){if((rt=H.offset-rt)>H.whave&&H.sane){ve.msg="invalid distance too far back",H.mode=30;break}Jt=rt>H.wnext?(rt-=H.wnext,H.wsize-rt):H.wnext-rt,rt>H.length&&(rt=H.length),er=H.window}else er=vt,Jt=Be-H.offset,rt=H.length;for(Xege?(Oe=Jt[er+te[Ue]],Ee[mt+te[Ue]]):(Oe=96,0),$=1<>Be)+(q-=$)]=Fe<<24|Oe<<16|We|0,q!==0;);for($=1<>=1;if($!==0?(xe&=$-1,xe+=$):xe=0,Ue++,--nt[ve]==0){if(ve===Re)break;ve=A[M+te[Ue]]}if(vt>>7)]}function mt(se,Te){se.pending_buf[se.pending++]=255&Te,se.pending_buf[se.pending++]=Te>>>8&255}function nt(se,Te,Ge){se.bi_valid>O-Ge?(se.bi_buf|=Te<>O-se.bi_valid,se.bi_valid+=Ge-O):(se.bi_buf|=Te<>>=1,Ge<<=1,0<--Te;);return Ge>>>1}function er(se,Te,Ge){var tt,Ne,ot=new Array(te+1),kt=0;for(tt=1;tt<=te;tt++)ot[tt]=kt=kt+Ge[tt-1]<<1;for(Ne=0;Ne<=Te;Ne++){var at=se[2*Ne+1];at!==0&&(se[2*Ne]=Jt(ot[at]++,at))}}function Vt(se){var Te;for(Te=0;Te>1;1<=Ge;Ge--)fr(se,ot,Ge);for(Ne=Bt;Ge=se.heap[1],se.heap[1]=se.heap[se.heap_len--],fr(se,ot,1),tt=se.heap[1],se.heap[--se.heap_max]=Ge,se.heap[--se.heap_max]=tt,ot[2*Ne]=ot[2*Ge]+ot[2*tt],se.depth[Ne]=(se.depth[Ge]>=se.depth[tt]?se.depth[Ge]:se.depth[tt])+1,ot[2*Ge+1]=ot[2*tt+1]=Ne,se.heap[1]=Ne++,fr(se,ot,1),2<=se.heap_len;);se.heap[--se.heap_max]=se.heap[1],function(Ze,tn){var _n,vn,pi,Qe,Kt,Ut,Kr=tn.dyn_tree,mi=tn.max_code,Xt=tn.stat_desc.static_tree,Yi=tn.stat_desc.has_stree,fs=tn.stat_desc.extra_bits,ps=tn.stat_desc.extra_base,Hn=tn.stat_desc.max_length,he=0;for(Qe=0;Qe<=te;Qe++)Ze.bl_count[Qe]=0;for(Kr[2*Ze.heap[Ze.heap_max]+1]=0,_n=Ze.heap_max+1;_n>=7;Ne>>=1)if(1&Tr&&at.dyn_ltree[2*Bt]!==0)return g;if(at.dyn_ltree[18]!==0||at.dyn_ltree[20]!==0||at.dyn_ltree[26]!==0)return c;for(Bt=32;Bt>>3,(ot=se.static_len+3+7>>>3)<=Ne&&(Ne=ot)):Ne=ot=Ge+5,Ge+4<=Ne&&Te!==-1?de(se,Te,Ge,tt):se.strategy===4||ot===Ne?(nt(se,2+(tt?1:0),3),br(se,it,ve)):(nt(se,4+(tt?1:0),3),function(at,Bt,Tr,Ze){var tn;for(nt(at,Bt-257,5),nt(at,Tr-1,5),nt(at,Ze-4,4),tn=0;tn>>8&255,se.pending_buf[se.d_buf+2*se.last_lit+1]=255&Te,se.pending_buf[se.l_buf+se.last_lit]=255&Ge,se.last_lit++,Te===0?se.dyn_ltree[2*Ge]++:(se.matches++,Te--,se.dyn_ltree[2*(H[Ge]+A+1)]++,se.dyn_dtree[2*Ee(Te)]++),se.last_lit===se.lit_bufsize-1},h._tr_align=function(se){nt(se,2,3),rt(se,q,it),function(Te){Te.bi_valid===16?(mt(Te,Te.bi_buf),Te.bi_buf=0,Te.bi_valid=0):8<=Te.bi_valid&&(Te.pending_buf[Te.pending++]=255&Te.bi_buf,Te.bi_buf>>=8,Te.bi_valid-=8)}(se)}},{"../utils/common":41}],53:[function(i,o,h){o.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(i,o,h){(function(f){(function(g,c){if(!g.setImmediate){var T,P,R,A,M=1,N={},Y=!1,j=g.document,te=Object.getPrototypeOf&&Object.getPrototypeOf(g);te=te&&te.setTimeout?te:g,T={}.toString.call(g.process)==="[object process]"?function(ne){process.nextTick(function(){$(ne)})}:function(){if(g.postMessage&&!g.importScripts){var ne=!0,oe=g.onmessage;return g.onmessage=function(){ne=!1},g.postMessage("","*"),g.onmessage=oe,ne}}()?(A="setImmediate$"+Math.random()+"$",g.addEventListener?g.addEventListener("message",q,!1):g.attachEvent("onmessage",q),function(ne){g.postMessage(A+ne,"*")}):g.MessageChannel?((R=new MessageChannel).port1.onmessage=function(ne){$(ne.data)},function(ne){R.port2.postMessage(ne)}):j&&"onreadystatechange"in j.createElement("script")?(P=j.documentElement,function(ne){var oe=j.createElement("script");oe.onreadystatechange=function(){$(ne),oe.onreadystatechange=null,P.removeChild(oe),oe=null},P.appendChild(oe)}):function(ne){setTimeout($,0,ne)},te.setImmediate=function(ne){typeof ne!="function"&&(ne=new Function(""+ne));for(var oe=new Array(arguments.length-1),ke=0;ke"u"?f===void 0?this:f:self)}).call(this,typeof ff<"u"?ff:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(OI);var Q5=OI.exports;const eL=dp(Q5);var $1=function(e,t){return $1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,o){i.__proto__=o}||function(i,o){for(var h in o)Object.prototype.hasOwnProperty.call(o,h)&&(i[h]=o[h])},$1(e,t)};function no(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");$1(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}var Ft=function(){return Ft=Object.assign||function(t){for(var i,o=1,h=arguments.length;o"u"&&(f=e.call(this,o),t.set(h,f)),f}function BI(e,t,i){var o=Array.prototype.slice.call(arguments,3),h=i(o),f=t.get(h);return typeof f>"u"&&(f=e.apply(this,o),t.set(h,f)),f}function vw(e,t,i,o,h){return i.bind(t,e,o,h)}function rL(e,t){var i=e.length===1?FI:BI;return vw(e,this,i,t.cache.create(),t.serializer)}function nL(e,t){return vw(e,this,BI,t.cache.create(),t.serializer)}function iL(e,t){return vw(e,this,FI,t.cache.create(),t.serializer)}var sL=function(){return JSON.stringify(arguments)};function xw(){this.cache=Object.create(null)}xw.prototype.get=function(e){return this.cache[e]};xw.prototype.set=function(e,t){this.cache[e]=t};var oL={create:function(){return new xw}},Ui={variadic:nL,monadic:iL};function NI(e,t,i){if(i===void 0&&(i=Error),!e)throw new i(t)}$i(function(){for(var e,t=[],i=0;i0}),i=[],o=0,h=t;o1)throw new RangeError("integer-width stems only accept a single optional option");h.options[0].replace(pL,function(T,P,R,A,M,N){if(P)t.minimumIntegerDigits=R.length;else{if(A&&M)throw new Error("We currently do not support maximum integer digits");if(N)throw new Error("We currently do not support exact integer digits")}return""});continue}if(YI.test(h.stem)){t.minimumIntegerDigits=h.stem.length;continue}if(Ak.test(h.stem)){if(h.options.length>1)throw new RangeError("Fraction-precision stems only accept a single optional option");h.stem.replace(Ak,function(T,P,R,A,M,N){return R==="*"?t.minimumFractionDigits=P.length:A&&A[0]==="#"?t.maximumFractionDigits=A.length:M&&N?(t.minimumFractionDigits=M.length,t.maximumFractionDigits=M.length+N.length):(t.minimumFractionDigits=P.length,t.maximumFractionDigits=P.length),""});var f=h.options[0];f==="w"?t=Ft(Ft({},t),{trailingZeroDisplay:"stripIfInteger"}):f&&(t=Ft(Ft({},t),Dk(f)));continue}if(qI.test(h.stem)){t=Ft(Ft({},t),Dk(h.stem));continue}var g=XI(h.stem);g&&(t=Ft(Ft({},t),g));var c=mL(h.stem);c&&(t=Ft(Ft({},t),c))}return t}var Jm={"001":["H","h"],419:["h","H","hB","hb"],AC:["H","h","hb","hB"],AD:["H","hB"],AE:["h","hB","hb","H"],AF:["H","hb","hB","h"],AG:["h","hb","H","hB"],AI:["H","h","hb","hB"],AL:["h","H","hB"],AM:["H","hB"],AO:["H","hB"],AR:["h","H","hB","hb"],AS:["h","H"],AT:["H","hB"],AU:["h","hb","H","hB"],AW:["H","hB"],AX:["H"],AZ:["H","hB","h"],BA:["H","hB","h"],BB:["h","hb","H","hB"],BD:["h","hB","H"],BE:["H","hB"],BF:["H","hB"],BG:["H","hB","h"],BH:["h","hB","hb","H"],BI:["H","h"],BJ:["H","hB"],BL:["H","hB"],BM:["h","hb","H","hB"],BN:["hb","hB","h","H"],BO:["h","H","hB","hb"],BQ:["H"],BR:["H","hB"],BS:["h","hb","H","hB"],BT:["h","H"],BW:["H","h","hb","hB"],BY:["H","h"],BZ:["H","h","hb","hB"],CA:["h","hb","H","hB"],CC:["H","h","hb","hB"],CD:["hB","H"],CF:["H","h","hB"],CG:["H","hB"],CH:["H","hB","h"],CI:["H","hB"],CK:["H","h","hb","hB"],CL:["h","H","hB","hb"],CM:["H","h","hB"],CN:["H","hB","hb","h"],CO:["h","H","hB","hb"],CP:["H"],CR:["h","H","hB","hb"],CU:["h","H","hB","hb"],CV:["H","hB"],CW:["H","hB"],CX:["H","h","hb","hB"],CY:["h","H","hb","hB"],CZ:["H"],DE:["H","hB"],DG:["H","h","hb","hB"],DJ:["h","H"],DK:["H"],DM:["h","hb","H","hB"],DO:["h","H","hB","hb"],DZ:["h","hB","hb","H"],EA:["H","h","hB","hb"],EC:["h","H","hB","hb"],EE:["H","hB"],EG:["h","hB","hb","H"],EH:["h","hB","hb","H"],ER:["h","H"],ES:["H","hB","h","hb"],ET:["hB","hb","h","H"],FI:["H"],FJ:["h","hb","H","hB"],FK:["H","h","hb","hB"],FM:["h","hb","H","hB"],FO:["H","h"],FR:["H","hB"],GA:["H","hB"],GB:["H","h","hb","hB"],GD:["h","hb","H","hB"],GE:["H","hB","h"],GF:["H","hB"],GG:["H","h","hb","hB"],GH:["h","H"],GI:["H","h","hb","hB"],GL:["H","h"],GM:["h","hb","H","hB"],GN:["H","hB"],GP:["H","hB"],GQ:["H","hB","h","hb"],GR:["h","H","hb","hB"],GT:["h","H","hB","hb"],GU:["h","hb","H","hB"],GW:["H","hB"],GY:["h","hb","H","hB"],HK:["h","hB","hb","H"],HN:["h","H","hB","hb"],HR:["H","hB"],HU:["H","h"],IC:["H","h","hB","hb"],ID:["H"],IE:["H","h","hb","hB"],IL:["H","hB"],IM:["H","h","hb","hB"],IN:["h","H"],IO:["H","h","hb","hB"],IQ:["h","hB","hb","H"],IR:["hB","H"],IS:["H"],IT:["H","hB"],JE:["H","h","hb","hB"],JM:["h","hb","H","hB"],JO:["h","hB","hb","H"],JP:["H","K","h"],KE:["hB","hb","H","h"],KG:["H","h","hB","hb"],KH:["hB","h","H","hb"],KI:["h","hb","H","hB"],KM:["H","h","hB","hb"],KN:["h","hb","H","hB"],KP:["h","H","hB","hb"],KR:["h","H","hB","hb"],KW:["h","hB","hb","H"],KY:["h","hb","H","hB"],KZ:["H","hB"],LA:["H","hb","hB","h"],LB:["h","hB","hb","H"],LC:["h","hb","H","hB"],LI:["H","hB","h"],LK:["H","h","hB","hb"],LR:["h","hb","H","hB"],LS:["h","H"],LT:["H","h","hb","hB"],LU:["H","h","hB"],LV:["H","hB","hb","h"],LY:["h","hB","hb","H"],MA:["H","h","hB","hb"],MC:["H","hB"],MD:["H","hB"],ME:["H","hB","h"],MF:["H","hB"],MG:["H","h"],MH:["h","hb","H","hB"],MK:["H","h","hb","hB"],ML:["H"],MM:["hB","hb","H","h"],MN:["H","h","hb","hB"],MO:["h","hB","hb","H"],MP:["h","hb","H","hB"],MQ:["H","hB"],MR:["h","hB","hb","H"],MS:["H","h","hb","hB"],MT:["H","h"],MU:["H","h"],MV:["H","h"],MW:["h","hb","H","hB"],MX:["h","H","hB","hb"],MY:["hb","hB","h","H"],MZ:["H","hB"],NA:["h","H","hB","hb"],NC:["H","hB"],NE:["H"],NF:["H","h","hb","hB"],NG:["H","h","hb","hB"],NI:["h","H","hB","hb"],NL:["H","hB"],NO:["H","h"],NP:["H","h","hB"],NR:["H","h","hb","hB"],NU:["H","h","hb","hB"],NZ:["h","hb","H","hB"],OM:["h","hB","hb","H"],PA:["h","H","hB","hb"],PE:["h","H","hB","hb"],PF:["H","h","hB"],PG:["h","H"],PH:["h","hB","hb","H"],PK:["h","hB","H"],PL:["H","h"],PM:["H","hB"],PN:["H","h","hb","hB"],PR:["h","H","hB","hb"],PS:["h","hB","hb","H"],PT:["H","hB"],PW:["h","H"],PY:["h","H","hB","hb"],QA:["h","hB","hb","H"],RE:["H","hB"],RO:["H","hB"],RS:["H","hB","h"],RU:["H"],RW:["H","h"],SA:["h","hB","hb","H"],SB:["h","hb","H","hB"],SC:["H","h","hB"],SD:["h","hB","hb","H"],SE:["H"],SG:["h","hb","H","hB"],SH:["H","h","hb","hB"],SI:["H","hB"],SJ:["H"],SK:["H"],SL:["h","hb","H","hB"],SM:["H","h","hB"],SN:["H","h","hB"],SO:["h","H"],SR:["H","hB"],SS:["h","hb","H","hB"],ST:["H","hB"],SV:["h","H","hB","hb"],SX:["H","h","hb","hB"],SY:["h","hB","hb","H"],SZ:["h","hb","H","hB"],TA:["H","h","hb","hB"],TC:["h","hb","H","hB"],TD:["h","H","hB"],TF:["H","h","hB"],TG:["H","hB"],TH:["H","h"],TJ:["H","h"],TL:["H","hB","hb","h"],TM:["H","h"],TN:["h","hB","hb","H"],TO:["h","H"],TR:["H","hB"],TT:["h","hb","H","hB"],TW:["hB","hb","h","H"],TZ:["hB","hb","H","h"],UA:["H","hB","h"],UG:["hB","hb","H","h"],UM:["h","hb","H","hB"],US:["h","hb","H","hB"],UY:["h","H","hB","hb"],UZ:["H","hB","h"],VA:["H","h","hB"],VC:["h","hb","H","hB"],VE:["h","H","hB","hb"],VG:["h","hb","H","hB"],VI:["h","hb","H","hB"],VN:["H","h"],VU:["h","H"],WF:["H","hB"],WS:["h","H"],XK:["H","hB","h"],YE:["h","hB","hb","H"],YT:["H","hB"],ZA:["H","h","hb","hB"],ZM:["h","hb","H","hB"],ZW:["H","h"],"af-ZA":["H","h","hB","hb"],"ar-001":["h","hB","hb","H"],"ca-ES":["H","h","hB"],"en-001":["h","hb","H","hB"],"en-HK":["h","hb","H","hB"],"en-IL":["H","h","hb","hB"],"en-MY":["h","hb","H","hB"],"es-BR":["H","h","hB","hb"],"es-ES":["H","h","hB","hb"],"es-GQ":["H","h","hB","hb"],"fr-CA":["H","h","hB"],"gl-ES":["H","h","hB"],"gu-IN":["hB","hb","h","H"],"hi-IN":["hB","h","H"],"it-CH":["H","h","hB"],"it-IT":["H","h","hB"],"kn-IN":["hB","h","H"],"ml-IN":["hB","h","H"],"mr-IN":["hB","hb","h","H"],"pa-IN":["hB","hb","h","H"],"ta-IN":["hB","h","hb","H"],"te-IN":["hB","h","H"],"zu-ZA":["H","hB","hb","h"]};function yL(e,t){for(var i="",o=0;o>1),T="a",P=_L(t);for((P=="H"||P=="k")&&(c=0);c-- >0;)i+=T;for(;g-- >0;)i=P+i}else h==="J"?i+="H":i+=h}return i}function _L(e){var t=e.hourCycle;if(t===void 0&&e.hourCycles&&e.hourCycles.length&&(t=e.hourCycles[0]),t)switch(t){case"h24":return"k";case"h23":return"H";case"h12":return"h";case"h11":return"K";default:throw new Error("Invalid hourCycle")}var i=e.language,o;i!=="root"&&(o=e.maximize().region);var h=Jm[o||""]||Jm[i||""]||Jm["".concat(i,"-001")]||Jm["001"];return h[0]}var wv,vL=new RegExp("^".concat(ZI.source,"*")),xL=new RegExp("".concat(ZI.source,"*$"));function Cr(e,t){return{start:e,end:t}}var wL=!!String.prototype.startsWith&&"_a".startsWith("a",1),bL=!!String.fromCodePoint,SL=!!Object.fromEntries,kL=!!String.prototype.codePointAt,TL=!!String.prototype.trimStart,EL=!!String.prototype.trimEnd,CL=!!Number.isSafeInteger,IL=CL?Number.isSafeInteger:function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e&&Math.abs(e)<=9007199254740991},j1=!0;try{var PL=JI("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");j1=((wv=PL.exec("a"))===null||wv===void 0?void 0:wv[0])==="a"}catch{j1=!1}var Rk=wL?function(t,i,o){return t.startsWith(i,o)}:function(t,i,o){return t.slice(o,o+i.length)===i},V1=bL?String.fromCodePoint:function(){for(var t=[],i=0;if;){if(g=t[f++],g>1114111)throw RangeError(g+" is not a valid code point");o+=g<65536?String.fromCharCode(g):String.fromCharCode(((g-=65536)>>10)+55296,g%1024+56320)}return o},Lk=SL?Object.fromEntries:function(t){for(var i={},o=0,h=t;o=o)){var h=t.charCodeAt(i),f;return h<55296||h>56319||i+1===o||(f=t.charCodeAt(i+1))<56320||f>57343?h:(h-55296<<10)+(f-56320)+65536}},ML=TL?function(t){return t.trimStart()}:function(t){return t.replace(vL,"")},AL=EL?function(t){return t.trimEnd()}:function(t){return t.replace(xL,"")};function JI(e,t){return new RegExp(e,t)}var H1;if(j1){var Ok=JI("([^\\p{White_Space}\\p{Pattern_Syntax}]*)","yu");H1=function(t,i){var o;Ok.lastIndex=i;var h=Ok.exec(t);return(o=h[1])!==null&&o!==void 0?o:""}}else H1=function(t,i){for(var o=[];;){var h=KI(t,i);if(h===void 0||QI(h)||LL(h))break;o.push(h),i+=h>=65536?2:1}return V1.apply(void 0,o)};var DL=function(){function e(t,i){i===void 0&&(i={}),this.message=t,this.position={offset:0,line:1,column:1},this.ignoreTag=!!i.ignoreTag,this.locale=i.locale,this.requiresOtherClause=!!i.requiresOtherClause,this.shouldParseSkeletons=!!i.shouldParseSkeletons}return e.prototype.parse=function(){if(this.offset()!==0)throw Error("parser can only be used once");return this.parseMessage(0,"",!1)},e.prototype.parseMessage=function(t,i,o){for(var h=[];!this.isEOF();){var f=this.char();if(f===123){var g=this.parseArgument(t,o);if(g.err)return g;h.push(g.val)}else{if(f===125&&t>0)break;if(f===35&&(i==="plural"||i==="selectordinal")){var c=this.clonePosition();this.bump(),h.push({type:an.pound,location:Cr(c,this.clonePosition())})}else if(f===60&&!this.ignoreTag&&this.peek()===47){if(o)break;return this.error(kr.UNMATCHED_CLOSING_TAG,Cr(this.clonePosition(),this.clonePosition()))}else if(f===60&&!this.ignoreTag&&W1(this.peek()||0)){var g=this.parseTag(t,i);if(g.err)return g;h.push(g.val)}else{var g=this.parseLiteral(t,i);if(g.err)return g;h.push(g.val)}}}return{val:h,err:null}},e.prototype.parseTag=function(t,i){var o=this.clonePosition();this.bump();var h=this.parseTagName();if(this.bumpSpace(),this.bumpIf("/>"))return{val:{type:an.literal,value:"<".concat(h,"/>"),location:Cr(o,this.clonePosition())},err:null};if(this.bumpIf(">")){var f=this.parseMessage(t+1,i,!0);if(f.err)return f;var g=f.val,c=this.clonePosition();if(this.bumpIf("")?{val:{type:an.tag,value:h,children:g,location:Cr(o,this.clonePosition())},err:null}:this.error(kr.INVALID_TAG,Cr(c,this.clonePosition())))}else return this.error(kr.UNCLOSED_TAG,Cr(o,this.clonePosition()))}else return this.error(kr.INVALID_TAG,Cr(o,this.clonePosition()))},e.prototype.parseTagName=function(){var t=this.offset();for(this.bump();!this.isEOF()&&RL(this.char());)this.bump();return this.message.slice(t,this.offset())},e.prototype.parseLiteral=function(t,i){for(var o=this.clonePosition(),h="";;){var f=this.tryParseQuote(i);if(f){h+=f;continue}var g=this.tryParseUnquoted(t,i);if(g){h+=g;continue}var c=this.tryParseLeftAngleBracket();if(c){h+=c;continue}break}var T=Cr(o,this.clonePosition());return{val:{type:an.literal,value:h,location:T},err:null}},e.prototype.tryParseLeftAngleBracket=function(){return!this.isEOF()&&this.char()===60&&(this.ignoreTag||!zL(this.peek()||0))?(this.bump(),"<"):null},e.prototype.tryParseQuote=function(t){if(this.isEOF()||this.char()!==39)return null;switch(this.peek()){case 39:return this.bump(),this.bump(),"'";case 123:case 60:case 62:case 125:break;case 35:if(t==="plural"||t==="selectordinal")break;return null;default:return null}this.bump();var i=[this.char()];for(this.bump();!this.isEOF();){var o=this.char();if(o===39)if(this.peek()===39)i.push(39),this.bump();else{this.bump();break}else i.push(o);this.bump()}return V1.apply(void 0,i)},e.prototype.tryParseUnquoted=function(t,i){if(this.isEOF())return null;var o=this.char();return o===60||o===123||o===35&&(i==="plural"||i==="selectordinal")||o===125&&t>0?null:(this.bump(),V1(o))},e.prototype.parseArgument=function(t,i){var o=this.clonePosition();if(this.bump(),this.bumpSpace(),this.isEOF())return this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition()));if(this.char()===125)return this.bump(),this.error(kr.EMPTY_ARGUMENT,Cr(o,this.clonePosition()));var h=this.parseIdentifierIfPossible().value;if(!h)return this.error(kr.MALFORMED_ARGUMENT,Cr(o,this.clonePosition()));if(this.bumpSpace(),this.isEOF())return this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition()));switch(this.char()){case 125:return this.bump(),{val:{type:an.argument,value:h,location:Cr(o,this.clonePosition())},err:null};case 44:return this.bump(),this.bumpSpace(),this.isEOF()?this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(o,this.clonePosition())):this.parseArgumentOptions(t,i,h,o);default:return this.error(kr.MALFORMED_ARGUMENT,Cr(o,this.clonePosition()))}},e.prototype.parseIdentifierIfPossible=function(){var t=this.clonePosition(),i=this.offset(),o=H1(this.message,i),h=i+o.length;this.bumpTo(h);var f=this.clonePosition(),g=Cr(t,f);return{value:o,location:g}},e.prototype.parseArgumentOptions=function(t,i,o,h){var f,g=this.clonePosition(),c=this.parseIdentifierIfPossible().value,T=this.clonePosition();switch(c){case"":return this.error(kr.EXPECT_ARGUMENT_TYPE,Cr(g,T));case"number":case"date":case"time":{this.bumpSpace();var P=null;if(this.bumpIf(",")){this.bumpSpace();var R=this.clonePosition(),A=this.parseSimpleArgStyleIfPossible();if(A.err)return A;var M=AL(A.val);if(M.length===0)return this.error(kr.EXPECT_ARGUMENT_STYLE,Cr(this.clonePosition(),this.clonePosition()));var N=Cr(R,this.clonePosition());P={style:M,styleLocation:N}}var Y=this.tryParseArgumentClose(h);if(Y.err)return Y;var j=Cr(h,this.clonePosition());if(P&&Rk(P==null?void 0:P.style,"::",0)){var te=ML(P.style.slice(2));if(c==="number"){var A=this.parseNumberSkeletonFromString(te,P.styleLocation);return A.err?A:{val:{type:an.number,value:o,location:j,style:A.val},err:null}}else{if(te.length===0)return this.error(kr.EXPECT_DATE_TIME_SKELETON,j);var O=te;this.locale&&(O=yL(te,this.locale));var M={type:Lh.dateTime,pattern:O,location:P.styleLocation,parsedOptions:this.shouldParseSkeletons?cL(O):{}},$=c==="date"?an.date:an.time;return{val:{type:$,value:o,location:j,style:M},err:null}}}return{val:{type:c==="number"?an.number:c==="date"?an.date:an.time,value:o,location:j,style:(f=P==null?void 0:P.style)!==null&&f!==void 0?f:null},err:null}}case"plural":case"selectordinal":case"select":{var q=this.clonePosition();if(this.bumpSpace(),!this.bumpIf(","))return this.error(kr.EXPECT_SELECT_ARGUMENT_OPTIONS,Cr(q,Ft({},q)));this.bumpSpace();var ne=this.parseIdentifierIfPossible(),oe=0;if(c!=="select"&&ne.value==="offset"){if(!this.bumpIf(":"))return this.error(kr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,Cr(this.clonePosition(),this.clonePosition()));this.bumpSpace();var A=this.tryParseDecimalInteger(kr.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE,kr.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);if(A.err)return A;this.bumpSpace(),ne=this.parseIdentifierIfPossible(),oe=A.val}var ke=this.tryParsePluralOrSelectOptions(t,c,i,ne);if(ke.err)return ke;var Y=this.tryParseArgumentClose(h);if(Y.err)return Y;var ge=Cr(h,this.clonePosition());return c==="select"?{val:{type:an.select,value:o,options:Lk(ke.val),location:ge},err:null}:{val:{type:an.plural,value:o,options:Lk(ke.val),offset:oe,pluralType:c==="plural"?"cardinal":"ordinal",location:ge},err:null}}default:return this.error(kr.INVALID_ARGUMENT_TYPE,Cr(g,T))}},e.prototype.tryParseArgumentClose=function(t){return this.isEOF()||this.char()!==125?this.error(kr.EXPECT_ARGUMENT_CLOSING_BRACE,Cr(t,this.clonePosition())):(this.bump(),{val:!0,err:null})},e.prototype.parseSimpleArgStyleIfPossible=function(){for(var t=0,i=this.clonePosition();!this.isEOF();){var o=this.char();switch(o){case 39:{this.bump();var h=this.clonePosition();if(!this.bumpUntil("'"))return this.error(kr.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE,Cr(h,this.clonePosition()));this.bump();break}case 123:{t+=1,this.bump();break}case 125:{if(t>0)t-=1;else return{val:this.message.slice(i.offset,this.offset()),err:null};break}default:this.bump();break}}return{val:this.message.slice(i.offset,this.offset()),err:null}},e.prototype.parseNumberSkeletonFromString=function(t,i){var o=[];try{o=dL(t)}catch{return this.error(kr.INVALID_NUMBER_SKELETON,i)}return{val:{type:Lh.number,tokens:o,location:i,parsedOptions:this.shouldParseSkeletons?gL(o):{}},err:null}},e.prototype.tryParsePluralOrSelectOptions=function(t,i,o,h){for(var f,g=!1,c=[],T=new Set,P=h.value,R=h.location;;){if(P.length===0){var A=this.clonePosition();if(i!=="select"&&this.bumpIf("=")){var M=this.tryParseDecimalInteger(kr.EXPECT_PLURAL_ARGUMENT_SELECTOR,kr.INVALID_PLURAL_ARGUMENT_SELECTOR);if(M.err)return M;R=Cr(A,this.clonePosition()),P=this.message.slice(A.offset,this.offset())}else break}if(T.has(P))return this.error(i==="select"?kr.DUPLICATE_SELECT_ARGUMENT_SELECTOR:kr.DUPLICATE_PLURAL_ARGUMENT_SELECTOR,R);P==="other"&&(g=!0),this.bumpSpace();var N=this.clonePosition();if(!this.bumpIf("{"))return this.error(i==="select"?kr.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT:kr.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT,Cr(this.clonePosition(),this.clonePosition()));var Y=this.parseMessage(t+1,i,o);if(Y.err)return Y;var j=this.tryParseArgumentClose(N);if(j.err)return j;c.push([P,{value:Y.val,location:Cr(N,this.clonePosition())}]),T.add(P),this.bumpSpace(),f=this.parseIdentifierIfPossible(),P=f.value,R=f.location}return c.length===0?this.error(i==="select"?kr.EXPECT_SELECT_ARGUMENT_SELECTOR:kr.EXPECT_PLURAL_ARGUMENT_SELECTOR,Cr(this.clonePosition(),this.clonePosition())):this.requiresOtherClause&&!g?this.error(kr.MISSING_OTHER_CLAUSE,Cr(this.clonePosition(),this.clonePosition())):{val:c,err:null}},e.prototype.tryParseDecimalInteger=function(t,i){var o=1,h=this.clonePosition();this.bumpIf("+")||this.bumpIf("-")&&(o=-1);for(var f=!1,g=0;!this.isEOF();){var c=this.char();if(c>=48&&c<=57)f=!0,g=g*10+(c-48),this.bump();else break}var T=Cr(h,this.clonePosition());return f?(g*=o,IL(g)?{val:g,err:null}:this.error(i,T)):this.error(t,T)},e.prototype.offset=function(){return this.position.offset},e.prototype.isEOF=function(){return this.offset()===this.message.length},e.prototype.clonePosition=function(){return{offset:this.position.offset,line:this.position.line,column:this.position.column}},e.prototype.char=function(){var t=this.position.offset;if(t>=this.message.length)throw Error("out of bound");var i=KI(this.message,t);if(i===void 0)throw Error("Offset ".concat(t," is at invalid UTF-16 code unit boundary"));return i},e.prototype.error=function(t,i){return{val:null,err:{kind:t,message:this.message,location:i}}},e.prototype.bump=function(){if(!this.isEOF()){var t=this.char();t===10?(this.position.line+=1,this.position.column=1,this.position.offset+=1):(this.position.column+=1,this.position.offset+=t<65536?1:2)}},e.prototype.bumpIf=function(t){if(Rk(this.message,t,this.offset())){for(var i=0;i=0?(this.bumpTo(o),!0):(this.bumpTo(this.message.length),!1)},e.prototype.bumpTo=function(t){if(this.offset()>t)throw Error("targetOffset ".concat(t," must be greater than or equal to the current offset ").concat(this.offset()));for(t=Math.min(t,this.message.length);;){var i=this.offset();if(i===t)break;if(i>t)throw Error("targetOffset ".concat(t," is at invalid UTF-16 code unit boundary"));if(this.bump(),this.isEOF())break}},e.prototype.bumpSpace=function(){for(;!this.isEOF()&&QI(this.char());)this.bump()},e.prototype.peek=function(){if(this.isEOF())return null;var t=this.char(),i=this.offset(),o=this.message.charCodeAt(i+(t>=65536?2:1));return o??null},e}();function W1(e){return e>=97&&e<=122||e>=65&&e<=90}function zL(e){return W1(e)||e===47}function RL(e){return e===45||e===46||e>=48&&e<=57||e===95||e>=97&&e<=122||e>=65&&e<=90||e==183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function QI(e){return e>=9&&e<=13||e===32||e===133||e>=8206&&e<=8207||e===8232||e===8233}function LL(e){return e>=33&&e<=35||e===36||e>=37&&e<=39||e===40||e===41||e===42||e===43||e===44||e===45||e>=46&&e<=47||e>=58&&e<=59||e>=60&&e<=62||e>=63&&e<=64||e===91||e===92||e===93||e===94||e===96||e===123||e===124||e===125||e===126||e===161||e>=162&&e<=165||e===166||e===167||e===169||e===171||e===172||e===174||e===176||e===177||e===182||e===187||e===191||e===215||e===247||e>=8208&&e<=8213||e>=8214&&e<=8215||e===8216||e===8217||e===8218||e>=8219&&e<=8220||e===8221||e===8222||e===8223||e>=8224&&e<=8231||e>=8240&&e<=8248||e===8249||e===8250||e>=8251&&e<=8254||e>=8257&&e<=8259||e===8260||e===8261||e===8262||e>=8263&&e<=8273||e===8274||e===8275||e>=8277&&e<=8286||e>=8592&&e<=8596||e>=8597&&e<=8601||e>=8602&&e<=8603||e>=8604&&e<=8607||e===8608||e>=8609&&e<=8610||e===8611||e>=8612&&e<=8613||e===8614||e>=8615&&e<=8621||e===8622||e>=8623&&e<=8653||e>=8654&&e<=8655||e>=8656&&e<=8657||e===8658||e===8659||e===8660||e>=8661&&e<=8691||e>=8692&&e<=8959||e>=8960&&e<=8967||e===8968||e===8969||e===8970||e===8971||e>=8972&&e<=8991||e>=8992&&e<=8993||e>=8994&&e<=9e3||e===9001||e===9002||e>=9003&&e<=9083||e===9084||e>=9085&&e<=9114||e>=9115&&e<=9139||e>=9140&&e<=9179||e>=9180&&e<=9185||e>=9186&&e<=9254||e>=9255&&e<=9279||e>=9280&&e<=9290||e>=9291&&e<=9311||e>=9472&&e<=9654||e===9655||e>=9656&&e<=9664||e===9665||e>=9666&&e<=9719||e>=9720&&e<=9727||e>=9728&&e<=9838||e===9839||e>=9840&&e<=10087||e===10088||e===10089||e===10090||e===10091||e===10092||e===10093||e===10094||e===10095||e===10096||e===10097||e===10098||e===10099||e===10100||e===10101||e>=10132&&e<=10175||e>=10176&&e<=10180||e===10181||e===10182||e>=10183&&e<=10213||e===10214||e===10215||e===10216||e===10217||e===10218||e===10219||e===10220||e===10221||e===10222||e===10223||e>=10224&&e<=10239||e>=10240&&e<=10495||e>=10496&&e<=10626||e===10627||e===10628||e===10629||e===10630||e===10631||e===10632||e===10633||e===10634||e===10635||e===10636||e===10637||e===10638||e===10639||e===10640||e===10641||e===10642||e===10643||e===10644||e===10645||e===10646||e===10647||e===10648||e>=10649&&e<=10711||e===10712||e===10713||e===10714||e===10715||e>=10716&&e<=10747||e===10748||e===10749||e>=10750&&e<=11007||e>=11008&&e<=11055||e>=11056&&e<=11076||e>=11077&&e<=11078||e>=11079&&e<=11084||e>=11085&&e<=11123||e>=11124&&e<=11125||e>=11126&&e<=11157||e===11158||e>=11159&&e<=11263||e>=11776&&e<=11777||e===11778||e===11779||e===11780||e===11781||e>=11782&&e<=11784||e===11785||e===11786||e===11787||e===11788||e===11789||e>=11790&&e<=11798||e===11799||e>=11800&&e<=11801||e===11802||e===11803||e===11804||e===11805||e>=11806&&e<=11807||e===11808||e===11809||e===11810||e===11811||e===11812||e===11813||e===11814||e===11815||e===11816||e===11817||e>=11818&&e<=11822||e===11823||e>=11824&&e<=11833||e>=11834&&e<=11835||e>=11836&&e<=11839||e===11840||e===11841||e===11842||e>=11843&&e<=11855||e>=11856&&e<=11857||e===11858||e>=11859&&e<=11903||e>=12289&&e<=12291||e===12296||e===12297||e===12298||e===12299||e===12300||e===12301||e===12302||e===12303||e===12304||e===12305||e>=12306&&e<=12307||e===12308||e===12309||e===12310||e===12311||e===12312||e===12313||e===12314||e===12315||e===12316||e===12317||e>=12318&&e<=12319||e===12320||e===12336||e===64830||e===64831||e>=65093&&e<=65094}function G1(e){e.forEach(function(t){if(delete t.location,VI(t)||HI(t))for(var i in t.options)delete t.options[i].location,G1(t.options[i].value);else $I(t)&&GI(t.style)||(UI(t)||jI(t))&&U1(t.style)?delete t.style.location:WI(t)&&G1(t.children)})}function OL(e,t){t===void 0&&(t={}),t=Ft({shouldParseSkeletons:!0,requiresOtherClause:!0},t);var i=new DL(e,t).parse();if(i.err){var o=SyntaxError(kr[i.err.kind]);throw o.location=i.err.location,o.originalMessage=i.err.message,o}return t!=null&&t.captureLocation||G1(i.val),i.val}var Zo;(function(e){e.MISSING_VALUE="MISSING_VALUE",e.INVALID_VALUE="INVALID_VALUE",e.MISSING_INTL_API="MISSING_INTL_API"})(Zo||(Zo={}));var Gl=function(e){no(t,e);function t(i,o,h){var f=e.call(this,i)||this;return f.code=o,f.originalMessage=h,f}return t.prototype.toString=function(){return"[formatjs Error: ".concat(this.code,"] ").concat(this.message)},t}(Error),Fk=function(e){no(t,e);function t(i,o,h,f){return e.call(this,'Invalid values for "'.concat(i,'": "').concat(o,'". Options are "').concat(Object.keys(h).join('", "'),'"'),Zo.INVALID_VALUE,f)||this}return t}(Gl),FL=function(e){no(t,e);function t(i,o,h){return e.call(this,'Value for "'.concat(i,'" must be of type ').concat(o),Zo.INVALID_VALUE,h)||this}return t}(Gl),BL=function(e){no(t,e);function t(i,o){return e.call(this,'The intl string context variable "'.concat(i,'" was not provided to the string "').concat(o,'"'),Zo.MISSING_VALUE,o)||this}return t}(Gl),Bi;(function(e){e[e.literal=0]="literal",e[e.object=1]="object"})(Bi||(Bi={}));function NL(e){return e.length<2?e:e.reduce(function(t,i){var o=t[t.length-1];return!o||o.type!==Bi.literal||i.type!==Bi.literal?t.push(i):o.value+=i.value,t},[])}function eP(e){return typeof e=="function"}function kg(e,t,i,o,h,f,g){if(e.length===1&&Mk(e[0]))return[{type:Bi.literal,value:e[0].value}];for(var c=[],T=0,P=e;T"u")){var i=Intl.NumberFormat.supportedLocalesOf(t);return i.length>0?new Intl.Locale(i[0]):new Intl.Locale(typeof t=="string"?t:t[0])}},e.__parse=OL,e.formats={number:{integer:{maximumFractionDigits:0},currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}},e}(),Gu;(function(e){e.FORMAT_ERROR="FORMAT_ERROR",e.UNSUPPORTED_FORMATTER="UNSUPPORTED_FORMATTER",e.INVALID_CONFIG="INVALID_CONFIG",e.MISSING_DATA="MISSING_DATA",e.MISSING_TRANSLATION="MISSING_TRANSLATION"})(Gu||(Gu={}));var wp=function(e){no(t,e);function t(i,o,h){var f=this,g=h?h instanceof Error?h:new Error(String(h)):void 0;return f=e.call(this,"[@formatjs/intl Error ".concat(i,"] ").concat(o,` `).concat(g?` @@ -236,11 +236,11 @@ For more details see https://formatjs.io/docs/getting-started/message-distributi * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ri=typeof Symbol=="function"&&Symbol.for,bw=ri?Symbol.for("react.element"):60103,Sw=ri?Symbol.for("react.portal"):60106,e_=ri?Symbol.for("react.fragment"):60107,t_=ri?Symbol.for("react.strict_mode"):60108,r_=ri?Symbol.for("react.profiler"):60114,n_=ri?Symbol.for("react.provider"):60109,i_=ri?Symbol.for("react.context"):60110,kw=ri?Symbol.for("react.async_mode"):60111,s_=ri?Symbol.for("react.concurrent_mode"):60111,o_=ri?Symbol.for("react.forward_ref"):60112,a_=ri?Symbol.for("react.suspense"):60113,y4=ri?Symbol.for("react.suspense_list"):60120,l_=ri?Symbol.for("react.memo"):60115,u_=ri?Symbol.for("react.lazy"):60116,_4=ri?Symbol.for("react.block"):60121,v4=ri?Symbol.for("react.fundamental"):60117,x4=ri?Symbol.for("react.responder"):60118,w4=ri?Symbol.for("react.scope"):60119;function $s(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case bw:switch(e=e.type,e){case kw:case s_:case e_:case r_:case t_:case a_:return e;default:switch(e=e&&e.$$typeof,e){case i_:case o_:case u_:case l_:case n_:return e;default:return t}}case Sw:return t}}}function cP(e){return $s(e)===s_}jr.AsyncMode=kw;jr.ConcurrentMode=s_;jr.ContextConsumer=i_;jr.ContextProvider=n_;jr.Element=bw;jr.ForwardRef=o_;jr.Fragment=e_;jr.Lazy=u_;jr.Memo=l_;jr.Portal=Sw;jr.Profiler=r_;jr.StrictMode=t_;jr.Suspense=a_;jr.isAsyncMode=function(e){return cP(e)||$s(e)===kw};jr.isConcurrentMode=cP;jr.isContextConsumer=function(e){return $s(e)===i_};jr.isContextProvider=function(e){return $s(e)===n_};jr.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===bw};jr.isForwardRef=function(e){return $s(e)===o_};jr.isFragment=function(e){return $s(e)===e_};jr.isLazy=function(e){return $s(e)===u_};jr.isMemo=function(e){return $s(e)===l_};jr.isPortal=function(e){return $s(e)===Sw};jr.isProfiler=function(e){return $s(e)===r_};jr.isStrictMode=function(e){return $s(e)===t_};jr.isSuspense=function(e){return $s(e)===a_};jr.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===e_||e===s_||e===r_||e===t_||e===a_||e===y4||typeof e=="object"&&e!==null&&(e.$$typeof===u_||e.$$typeof===l_||e.$$typeof===n_||e.$$typeof===i_||e.$$typeof===o_||e.$$typeof===v4||e.$$typeof===x4||e.$$typeof===w4||e.$$typeof===_4)};jr.typeOf=$s;uP.exports=jr;var b4=uP.exports,hP=b4,S4={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},k4={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},dP={};dP[hP.ForwardRef]=S4;dP[hP.Memo]=k4;var Tw=typeof window<"u"&&!window.__REACT_INTL_BYPASS_GLOBAL_CONTEXT__?window.__REACT_INTL_CONTEXT__||(window.__REACT_INTL_CONTEXT__=Ht.createContext(null)):Ht.createContext(null);Tw.Consumer;var T4=Tw.Provider,E4=T4,C4=Tw;function c_(){var e=Ht.useContext(C4);return aP(e),e}var Y1;(function(e){e.formatDate="FormattedDate",e.formatTime="FormattedTime",e.formatNumber="FormattedNumber",e.formatList="FormattedList",e.formatDisplayName="FormattedDisplayName"})(Y1||(Y1={}));var X1;(function(e){e.formatDate="FormattedDateParts",e.formatTime="FormattedTimeParts",e.formatNumber="FormattedNumberParts",e.formatList="FormattedListParts"})(X1||(X1={}));function fP(e){var t=function(i){var o=c_(),h=i.value,f=i.children,g=Rh(i,["value","children"]),c=typeof h=="string"?new Date(h||0):h,T=e==="formatDate"?o.formatDateToParts(c,g):o.formatTimeToParts(c,g);return f(T)};return t.displayName=X1[e],t}function bp(e){var t=function(i){var o=c_(),h=i.value,f=i.children,g=Rh(i,["value","children"]),c=o[e](h,g);if(typeof f=="function")return f(c);var T=o.textComponent||Ht.Fragment;return Ht.createElement(T,null,c)};return t.displayName=Y1[e],t}function pP(e){return e&&Object.keys(e).reduce(function(t,i){var o=e[i];return t[i]=eP(o)?g4(o):o,t},{})}var jk=function(e,t,i,o){for(var h=[],f=4;f{if(e.substring(0,8)==="__MACOSX")return;const t=e.toLowerCase();if(t.endsWith(".txt")||t.endsWith(".json"))return"chat";if(t.endsWith(".zip"))return"zip";if(t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".mp4"))return"media"},A4=({onFilesLoad:e,onDataFileLoad:t,onError:i})=>{const[o,h]=Ht.useState(),[f,g]=Ht.useState(),c=c_(),T=R=>{g(R.length);for(let M=0;M({...te,[N.name]:j.target.result}))},A.onerror=function(j){i(N.name)}}else Y==="zip"&&new eL().loadAsync(N).then(function(j){Object.keys(j.files).forEach(te=>{const O=Hk(te);O==="chat"?j.files[te].async("string").then(function($){h(q=>({...q,[N.name]:$}))}):O==="media"&&j.files[te].async("arraybuffer").then(function($){const q=new Uint8Array($),ne=new Blob([q.buffer]);t(te,ne)})})})}};Ht.useEffect(()=>{o&&Object.keys(o).length===f&&e(o)},[o,e]);const P=o&&Object.keys(o).length!==f;return Xe.jsxs(Xe.Fragment,{children:[P?Xe.jsxs("p",{style:{textAlign:"center"},children:[c.formatMessage({id:"app.loading",defaultMessage:"Loading"})," ..."]}):"",Xe.jsx("div",{style:P?{display:"none"}:null,children:Xe.jsx(J5,{classes:"fileUploadDropArea",handleChange:T,multiple:!0,name:"file",types:M4,label:c.formatMessage({id:"app.uploadLabel",defaultMessage:"Upload or drag a file right here"})})})]})};var gP={exports:{}};/** + */var ri=typeof Symbol=="function"&&Symbol.for,bw=ri?Symbol.for("react.element"):60103,Sw=ri?Symbol.for("react.portal"):60106,e_=ri?Symbol.for("react.fragment"):60107,t_=ri?Symbol.for("react.strict_mode"):60108,r_=ri?Symbol.for("react.profiler"):60114,n_=ri?Symbol.for("react.provider"):60109,i_=ri?Symbol.for("react.context"):60110,kw=ri?Symbol.for("react.async_mode"):60111,s_=ri?Symbol.for("react.concurrent_mode"):60111,o_=ri?Symbol.for("react.forward_ref"):60112,a_=ri?Symbol.for("react.suspense"):60113,y4=ri?Symbol.for("react.suspense_list"):60120,l_=ri?Symbol.for("react.memo"):60115,u_=ri?Symbol.for("react.lazy"):60116,_4=ri?Symbol.for("react.block"):60121,v4=ri?Symbol.for("react.fundamental"):60117,x4=ri?Symbol.for("react.responder"):60118,w4=ri?Symbol.for("react.scope"):60119;function $s(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case bw:switch(e=e.type,e){case kw:case s_:case e_:case r_:case t_:case a_:return e;default:switch(e=e&&e.$$typeof,e){case i_:case o_:case u_:case l_:case n_:return e;default:return t}}case Sw:return t}}}function cP(e){return $s(e)===s_}jr.AsyncMode=kw;jr.ConcurrentMode=s_;jr.ContextConsumer=i_;jr.ContextProvider=n_;jr.Element=bw;jr.ForwardRef=o_;jr.Fragment=e_;jr.Lazy=u_;jr.Memo=l_;jr.Portal=Sw;jr.Profiler=r_;jr.StrictMode=t_;jr.Suspense=a_;jr.isAsyncMode=function(e){return cP(e)||$s(e)===kw};jr.isConcurrentMode=cP;jr.isContextConsumer=function(e){return $s(e)===i_};jr.isContextProvider=function(e){return $s(e)===n_};jr.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===bw};jr.isForwardRef=function(e){return $s(e)===o_};jr.isFragment=function(e){return $s(e)===e_};jr.isLazy=function(e){return $s(e)===u_};jr.isMemo=function(e){return $s(e)===l_};jr.isPortal=function(e){return $s(e)===Sw};jr.isProfiler=function(e){return $s(e)===r_};jr.isStrictMode=function(e){return $s(e)===t_};jr.isSuspense=function(e){return $s(e)===a_};jr.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===e_||e===s_||e===r_||e===t_||e===a_||e===y4||typeof e=="object"&&e!==null&&(e.$$typeof===u_||e.$$typeof===l_||e.$$typeof===n_||e.$$typeof===i_||e.$$typeof===o_||e.$$typeof===v4||e.$$typeof===x4||e.$$typeof===w4||e.$$typeof===_4)};jr.typeOf=$s;uP.exports=jr;var b4=uP.exports,hP=b4,S4={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},k4={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},dP={};dP[hP.ForwardRef]=S4;dP[hP.Memo]=k4;var Tw=typeof window<"u"&&!window.__REACT_INTL_BYPASS_GLOBAL_CONTEXT__?window.__REACT_INTL_CONTEXT__||(window.__REACT_INTL_CONTEXT__=Ht.createContext(null)):Ht.createContext(null);Tw.Consumer;var T4=Tw.Provider,E4=T4,C4=Tw;function c_(){var e=Ht.useContext(C4);return aP(e),e}var Y1;(function(e){e.formatDate="FormattedDate",e.formatTime="FormattedTime",e.formatNumber="FormattedNumber",e.formatList="FormattedList",e.formatDisplayName="FormattedDisplayName"})(Y1||(Y1={}));var X1;(function(e){e.formatDate="FormattedDateParts",e.formatTime="FormattedTimeParts",e.formatNumber="FormattedNumberParts",e.formatList="FormattedListParts"})(X1||(X1={}));function fP(e){var t=function(i){var o=c_(),h=i.value,f=i.children,g=Rh(i,["value","children"]),c=typeof h=="string"?new Date(h||0):h,T=e==="formatDate"?o.formatDateToParts(c,g):o.formatTimeToParts(c,g);return f(T)};return t.displayName=X1[e],t}function bp(e){var t=function(i){var o=c_(),h=i.value,f=i.children,g=Rh(i,["value","children"]),c=o[e](h,g);if(typeof f=="function")return f(c);var T=o.textComponent||Ht.Fragment;return Ht.createElement(T,null,c)};return t.displayName=Y1[e],t}function pP(e){return e&&Object.keys(e).reduce(function(t,i){var o=e[i];return t[i]=eP(o)?g4(o):o,t},{})}var jk=function(e,t,i,o){for(var h=[],f=4;f{if(e.substring(0,8)==="__MACOSX")return;const t=e.toLowerCase();if(t.endsWith(".txt")||t.endsWith(".json"))return"chat";if(t.endsWith(".zip"))return"zip";if(t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".mp4"))return"media"},A4=({onFilesLoad:e,onDataFileLoad:t,onError:i})=>{const[o,h]=Ht.useState(),[f,g]=Ht.useState(),c=c_(),T=R=>{g(R.length);for(let M=0;M({...te,[N.name]:j.target.result}))},A.onerror=function(j){i(N.name)}}else Y==="zip"&&new eL().loadAsync(N).then(function(j){Object.keys(j.files).forEach(te=>{const O=Hk(te);O==="chat"?j.files[te].async("string").then(function($){h(q=>({...q,[N.name]:$}))}):O==="media"&&j.files[te].async("arraybuffer").then(function($){const q=new Uint8Array($),ne=new Blob([q.buffer]);t(te,ne)})})})}};Ht.useEffect(()=>{o&&Object.keys(o).length===f&&e(o)},[o,e]);const P=o&&Object.keys(o).length!==f;return Ke.jsxs(Ke.Fragment,{children:[P?Ke.jsxs("p",{style:{textAlign:"center"},children:[c.formatMessage({id:"app.loading",defaultMessage:"Loading"})," ..."]}):"",Ke.jsx("div",{style:P?{display:"none"}:null,children:Ke.jsx(J5,{classes:"fileUploadDropArea",handleChange:T,multiple:!0,name:"file",types:M4,label:c.formatMessage({id:"app.uploadLabel",defaultMessage:"Upload or drag a file right here"})})})]})};var gP={exports:{}};/** * MapLibre GL JS * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt - */(function(e,t){(function(i,o){e.exports=o()})(ff,function(){var i={},o={};function h(g,c,T){if(o[g]=T,g==="index"){var P="var sharedModule = {}; ("+o.shared+")(sharedModule); ("+o.worker+")(sharedModule);",R={};return o.shared(R),o.index(i,R),typeof window<"u"&&i.setWorkerUrl(window.URL.createObjectURL(new Blob([P],{type:"text/javascript"}))),i}}h("shared",["exports"],function(g){function c(s,n,a,d){return new(a||(a=Promise))(function(y,x){function w(I){try{k(d.next(I))}catch(D){x(D)}}function b(I){try{k(d.throw(I))}catch(D){x(D)}}function k(I){var D;I.done?y(I.value):(D=I.value,D instanceof a?D:new a(function(L){L(D)})).then(w,b)}k((d=d.apply(s,n||[])).next())})}function T(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}typeof SuppressedError=="function"&&SuppressedError;var P=R;function R(s,n){this.x=s,this.y=n}R.prototype={clone:function(){return new R(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,n){return this.clone()._rotateAround(s,n)},matMult:function(s){return this.clone()._matMult(s)},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(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var n=s.x-this.x,a=s.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,n){return Math.atan2(this.x*n-this.y*s,this.x*s+this.y*n)},_matMult:function(s){var n=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=n,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var n=Math.cos(s),a=Math.sin(s),d=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=d,this},_rotateAround:function(s,n){var a=Math.cos(s),d=Math.sin(s),y=n.y+d*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-d*(this.y-n.y),this.y=y,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},R.convert=function(s){return s instanceof R?s:Array.isArray(s)?new R(s[0],s[1]):s};var A=T(P),M=N;function N(s,n,a,d){this.cx=3*s,this.bx=3*(a-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(d-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=n,this.p2x=a,this.p2y=d}N.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,n){if(n===void 0&&(n=1e-6),s<0)return 0;if(s>1)return 1;for(var a=s,d=0;d<8;d++){var y=this.sampleCurveX(a)-s;if(Math.abs(y)y?w=a:b=a,a=.5*(b-w)+w;return a},solve:function(s,n){return this.sampleCurveY(this.solveCurveX(s,n))}};var Y=T(M);let j,te;function O(){return j==null&&(j=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),j}function $(){if(te==null&&(te=!1,O())){const n=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(n){for(let d=0;d<5*5;d++){const y=4*d;n.fillStyle=`rgb(${y},${y+1},${y+2})`,n.fillRect(d%5,Math.floor(d/5),1,1)}const a=n.getImageData(0,0,5,5).data;for(let d=0;d<5*5*4;d++)if(d%4!=3&&a[d]!==d){te=!0;break}}}return te||!1}function q(s,n,a,d){const y=new Y(s,n,a,d);return x=>y.solve(x)}const ne=q(.25,.1,.25,1);function oe(s,n,a){return Math.min(a,Math.max(n,s))}function ke(s,n,a){const d=a-n,y=((s-n)%d+d)%d+n;return y===n?a:y}function ge(s,...n){for(const a of n)for(const d in a)s[d]=a[d];return s}let Fe=1;function Oe(s,n,a){const d={};for(const y in s)d[y]=n.call(this,s[y],y,s);return d}function We(s,n,a){const d={};for(const y in s)n.call(this,s[y],y,s)&&(d[y]=s[y]);return d}function it(s){return Array.isArray(s)?s.map(it):typeof s=="object"&&s?Oe(s,it):s}const ve={};function Ue(s){ve[s]||(typeof console<"u"&&console.warn(s),ve[s]=!0)}function H(s,n,a){return(a.y-s.y)*(n.x-s.x)>(n.y-s.y)*(a.x-s.x)}function Re(s){return typeof WorkerGlobalScope<"u"&&s!==void 0&&s instanceof WorkerGlobalScope}let vt=null;function ye(s){return typeof ImageBitmap<"u"&&s instanceof ImageBitmap}const Be="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Le(s,n,a,d,y){return c(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const x=new VideoFrame(s,{timestamp:0});try{const w=x==null?void 0:x.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const b=w.startsWith("BGR"),k=new Uint8ClampedArray(d*y*4);if(yield x.copyTo(k,function(I,D,L,U,Z){const K=4*Math.max(-D,0),J=(Math.max(0,L)-L)*U*4+K,le=4*U,fe=Math.max(0,D),De=Math.max(0,L);return{rect:{x:fe,y:De,width:Math.min(I.width,D+U)-fe,height:Math.min(I.height,L+Z)-De},layout:[{offset:J,stride:le}]}}(s,n,a,d,y)),b)for(let I=0;IRe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Yt=function(s,n){if(/:\/\//.test(s.url)&&!/^https?:|^file:/.test(s.url)){const d=rt(s.url);if(d)return d(s,n);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,targetMapId:Jt},n)}if(!(/^file:/.test(a=s.url)||/^file:/.test(Vt())&&!/^\w+:/.test(a))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(d,y){return c(this,void 0,void 0,function*(){const x=new Request(d.url,{method:d.method||"GET",body:d.body,credentials:d.credentials,headers:d.headers,cache:d.cache,referrer:Vt(),signal:y.signal});d.type!=="json"||x.headers.has("Accept")||x.headers.set("Accept","application/json");const w=yield fetch(x);if(!w.ok){const I=yield w.blob();throw new er(w.status,w.statusText,d.url,I)}let b;b=d.type==="arrayBuffer"||d.type==="image"?w.arrayBuffer():d.type==="json"?w.json():w.text();const k=yield b;if(y.signal.aborted)throw mt();return{data:k,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires")}})}(s,n);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,mustQueue:!0,targetMapId:Jt},n)}var a;return function(d,y){return new Promise((x,w)=>{var b;const k=new XMLHttpRequest;k.open(d.method||"GET",d.url,!0),d.type!=="arrayBuffer"&&d.type!=="image"||(k.responseType="arraybuffer");for(const I in d.headers)k.setRequestHeader(I,d.headers[I]);d.type==="json"&&(k.responseType="text",!((b=d.headers)===null||b===void 0)&&b.Accept||k.setRequestHeader("Accept","application/json")),k.withCredentials=d.credentials==="include",k.onerror=()=>{w(new Error(k.statusText))},k.onload=()=>{if(!y.signal.aborted)if((k.status>=200&&k.status<300||k.status===0)&&k.response!==null){let I=k.response;if(d.type==="json")try{I=JSON.parse(k.response)}catch(D){return void w(D)}x({data:I,cacheControl:k.getResponseHeader("Cache-Control"),expires:k.getResponseHeader("Expires")})}else{const I=new Blob([k.response],{type:k.getResponseHeader("Content-Type")});w(new er(k.status,k.statusText,d.url,I))}},y.signal.addEventListener("abort",()=>{k.abort(),w(mt())}),k.send(d.body)})}(s,n)};function _r(s){if(!s||s.indexOf("://")<=0||s.indexOf("data:image/")===0||s.indexOf("blob:")===0)return!0;const n=new URL(s),a=window.location;return n.protocol===a.protocol&&n.host===a.host}function fr(s,n,a){a[s]&&a[s].indexOf(n)!==-1||(a[s]=a[s]||[],a[s].push(n))}function br(s,n,a){if(a&&a[s]){const d=a[s].indexOf(n);d!==-1&&a[s].splice(d,1)}}class Xr{constructor(n,a={}){ge(this,a),this.type=n}}class V extends Xr{constructor(n,a={}){super("error",ge({error:n},a))}}class je{on(n,a){return this._listeners=this._listeners||{},fr(n,a,this._listeners),this}off(n,a){return br(n,a,this._listeners),br(n,a,this._oneTimeListeners),this}once(n,a){return a?(this._oneTimeListeners=this._oneTimeListeners||{},fr(n,a,this._oneTimeListeners),this):new Promise(d=>this.once(n,d))}fire(n,a){typeof n=="string"&&(n=new Xr(n,a||{}));const d=n.type;if(this.listens(d)){n.target=this;const y=this._listeners&&this._listeners[d]?this._listeners[d].slice():[];for(const b of y)b.call(this,n);const x=this._oneTimeListeners&&this._oneTimeListeners[d]?this._oneTimeListeners[d].slice():[];for(const b of x)br(d,b,this._oneTimeListeners),b.call(this,n);const w=this._eventedParent;w&&(ge(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(n))}else n instanceof V&&console.error(n.error);return this}listens(n){return this._listeners&&this._listeners[n]&&this._listeners[n].length>0||this._oneTimeListeners&&this._oneTimeListeners[n]&&this._oneTimeListeners[n].length>0||this._eventedParent&&this._eventedParent.listens(n)}setEventedParent(n,a){return this._eventedParent=n,this._eventedParentData=a,this}}var ie={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const de=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function se(s,n){const a={};for(const d in s)d!=="ref"&&(a[d]=s[d]);return de.forEach(d=>{d in n&&(a[d]=n[d])}),a}function Te(s,n){if(Array.isArray(s)){if(!Array.isArray(n)||s.length!==n.length)return!1;for(let a=0;a`:s.itemType.kind==="value"?"array":`array<${n}>`}return s.kind}const ee=[pi,Qe,Kt,Ut,Kr,fs,mi,G(Xt),ps,Hn,he];function ue(s,n){if(n.kind==="error")return null;if(s.kind==="array"){if(n.kind==="array"&&(n.N===0&&n.itemType.kind==="value"||!ue(s.itemType,n.itemType))&&(typeof s.N!="number"||s.N===n.N))return null}else{if(s.kind===n.kind)return null;if(s.kind==="value"){for(const a of ee)if(!ue(a,n))return null}}return`Expected ${W(s)} but found ${W(n)} instead.`}function Se(s,n){return n.some(a=>a.kind===s.kind)}function Ie(s,n){return n.some(a=>a==="null"?s===null:a==="array"?Array.isArray(s):a==="object"?s&&!Array.isArray(s)&&typeof s=="object":a===typeof s)}function Ae(s,n){return s.kind==="array"&&n.kind==="array"?s.itemType.kind===n.itemType.kind&&typeof s.N=="number":s.kind===n.kind}const _e=.96422,He=.82521,Je=4/29,$e=6/29,ut=3*$e*$e,Rt=$e*$e*$e,Ot=Math.PI/180,mr=180/Math.PI;function Qt(s){return(s%=360)<0&&(s+=360),s}function gr([s,n,a,d]){let y,x;const w=Tn((.2225045*(s=or(s))+.7168786*(n=or(n))+.0606169*(a=or(a)))/1);s===n&&n===a?y=x=w:(y=Tn((.4360747*s+.3850649*n+.1430804*a)/_e),x=Tn((.0139322*s+.0971045*n+.7141733*a)/He));const b=116*w-16;return[b<0?0:b,500*(y-w),200*(w-x),d]}function or(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function Tn(s){return s>Rt?Math.pow(s,1/3):s/ut+Je}function rn([s,n,a,d]){let y=(s+16)/116,x=isNaN(n)?y:y+n/500,w=isNaN(a)?y:y-a/200;return y=1*Mr(y),x=_e*Mr(x),w=He*Mr(w),[rr(3.1338561*x-1.6168667*y-.4906146*w),rr(-.9787684*x+1.9161415*y+.033454*w),rr(.0719453*x-.2289914*y+1.4052427*w),d]}function rr(s){return(s=s<=.00304?12.92*s:1.055*Math.pow(s,1/2.4)-.055)<0?0:s>1?1:s}function Mr(s){return s>$e?s*s*s:ut*(s-Je)}function Yr(s){return parseInt(s.padEnd(2,s),16)/255}function Dn(s,n){return Bn(n?s/100:s,0,1)}function Bn(s,n,a){return Math.min(Math.max(n,s),a)}function ni(s){return!s.some(Number.isNaN)}const Fa={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Ar{constructor(n,a,d,y=1,x=!0){this.r=n,this.g=a,this.b=d,this.a=y,x||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[n,a,d,y]))}static parse(n){if(n instanceof Ar)return n;if(typeof n!="string")return;const a=function(d){if((d=d.toLowerCase().trim())==="transparent")return[0,0,0,0];const y=Fa[d];if(y){const[w,b,k]=y;return[w/255,b/255,k/255,1]}if(d.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(d)){const w=d.length<6?1:2;let b=1;return[Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+w)||"ff")]}if(d.startsWith("rgb")){const w=d.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[b,k,I,D,L,U,Z,K,J,le,fe,De]=w,be=[D||" ",Z||" ",le].join("");if(be===" "||be===" /"||be===",,"||be===",,,"){const Me=[I,U,J].join(""),Ve=Me==="%%%"?100:Me===""?255:0;if(Ve){const et=[Bn(+k/Ve,0,1),Bn(+L/Ve,0,1),Bn(+K/Ve,0,1),fe?Dn(+fe,De):1];if(ni(et))return et}}return}}const x=d.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[w,b,k,I,D,L,U,Z,K]=x,J=[k||" ",D||" ",U].join("");if(J===" "||J===" /"||J===",,"||J===",,,"){const le=[+b,Bn(+I,0,100),Bn(+L,0,100),Z?Dn(+Z,K):1];if(ni(le))return function([fe,De,be,Me]){function Ve(et){const xt=(et+fe/30)%12,Nt=De*Math.min(be,1-be);return be-Nt*Math.max(-1,Math.min(xt-3,9-xt,1))}return fe=Qt(fe),De/=100,be/=100,[Ve(0),Ve(8),Ve(4),Me]}(le)}}}(n);return a?new Ar(...a,!1):void 0}get rgb(){const{r:n,g:a,b:d,a:y}=this,x=y||1/0;return this.overwriteGetter("rgb",[n/x,a/x,d/x,y])}get hcl(){return this.overwriteGetter("hcl",function(n){const[a,d,y,x]=gr(n),w=Math.sqrt(d*d+y*y);return[Math.round(1e4*w)?Qt(Math.atan2(y,d)*mr):NaN,w,a,x]}(this.rgb))}get lab(){return this.overwriteGetter("lab",gr(this.rgb))}overwriteGetter(n,a){return Object.defineProperty(this,n,{value:a}),a}toString(){const[n,a,d,y]=this.rgb;return`rgba(${[n,a,d].map(x=>Math.round(255*x)).join(",")},${y})`}}Ar.black=new Ar(0,0,0,1),Ar.white=new Ar(1,1,1,1),Ar.transparent=new Ar(0,0,0,0),Ar.red=new Ar(1,0,0,1);class qh{constructor(n,a,d){this.sensitivity=n?a?"variant":"case":a?"accent":"base",this.locale=d,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(n,a){return this.collator.compare(n,a)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Yh{constructor(n,a,d,y,x){this.text=n,this.image=a,this.scale=d,this.fontStack=y,this.textColor=x}}class Mi{constructor(n){this.sections=n}static fromString(n){return new Mi([new Yh(n,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(n=>n.text.length!==0||n.image&&n.image.name.length!==0)}static factory(n){return n instanceof Mi?n:Mi.fromString(n)}toString(){return this.sections.length===0?"":this.sections.map(n=>n.text).join("")}}class Ai{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof Ai)return n;if(typeof n=="number")return new Ai([n,n,n,n]);if(Array.isArray(n)&&!(n.length<1||n.length>4)){for(const a of n)if(typeof a!="number")return;switch(n.length){case 1:n=[n[0],n[0],n[0],n[0]];break;case 2:n=[n[0],n[1],n[0],n[1]];break;case 3:n=[n[0],n[1],n[2],n[1]]}return new Ai(n)}}toString(){return JSON.stringify(this.values)}}const P_=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Xi{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof Xi)return n;if(Array.isArray(n)&&!(n.length<1)&&n.length%2==0){for(let a=0;a=0&&s<=255&&typeof n=="number"&&n>=0&&n<=255&&typeof a=="number"&&a>=0&&a<=255?d===void 0||typeof d=="number"&&d>=0&&d<=1?null:`Invalid rgba value [${[s,n,a,d].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof d=="number"?[s,n,a,d]:[s,n,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ko(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof Ar||s instanceof qh||s instanceof Mi||s instanceof Ai||s instanceof Xi||s instanceof Di)return!0;if(Array.isArray(s)){for(const n of s)if(!Ko(n))return!1;return!0}if(typeof s=="object"){for(const n in s)if(!Ko(s[n]))return!1;return!0}return!1}function En(s){if(s===null)return pi;if(typeof s=="string")return Kt;if(typeof s=="boolean")return Ut;if(typeof s=="number")return Qe;if(s instanceof Ar)return Kr;if(s instanceof qh)return Yi;if(s instanceof Mi)return fs;if(s instanceof Ai)return ps;if(s instanceof Xi)return he;if(s instanceof Di)return Hn;if(Array.isArray(s)){const n=s.length;let a;for(const d of s){const y=En(d);if(a){if(a===y)continue;a=Xt;break}a=y}return G(a||Xt,n)}return mi}function Zl(s){const n=typeof s;return s===null?"":n==="string"||n==="number"||n==="boolean"?String(s):s instanceof Ar||s instanceof Mi||s instanceof Ai||s instanceof Xi||s instanceof Di?s.toString():JSON.stringify(s)}class ms{constructor(n,a){this.type=n,this.value=a}static parse(n,a){if(n.length!==2)return a.error(`'literal' expression requires exactly one argument, but found ${n.length-1} instead.`);if(!Ko(n[1]))return a.error("invalid value");const d=n[1];let y=En(d);const x=a.expectedType;return y.kind!=="array"||y.N!==0||!x||x.kind!=="array"||typeof x.N=="number"&&x.N!==0||(y=x),new ms(y,d)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class xn{constructor(n){this.name="ExpressionEvaluationError",this.message=n}toJSON(){return this.message}}const Ju={string:Kt,number:Qe,boolean:Ut,object:mi};class gs{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");let d,y=1;const x=n[0];if(x==="array"){let b,k;if(n.length>2){const I=n[1];if(typeof I!="string"||!(I in Ju)||I==="object")return a.error('The item type argument of "array" must be one of string, number, boolean',1);b=Ju[I],y++}else b=Xt;if(n.length>3){if(n[2]!==null&&(typeof n[2]!="number"||n[2]<0||n[2]!==Math.floor(n[2])))return a.error('The length argument to "array" must be a positive integer literal',2);k=n[2],y++}d=G(b,k)}else{if(!Ju[x])throw new Error(`Types doesn't contain name = ${x}`);d=Ju[x]}const w=[];for(;yn.outputDefined())}}const Xh={"to-boolean":Ut,"to-color":Kr,"to-number":Qe,"to-string":Kt};class ys{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const d=n[0];if(!Xh[d])throw new Error(`Can't parse ${d} as it is not part of the known types`);if((d==="to-boolean"||d==="to-string")&&n.length!==2)return a.error("Expected one argument.");const y=Xh[d],x=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(a)}: expected an array containing either three or four numeric values.`:Ba(a[0],a[1],a[2],a[3]),!d))return new Ar(a[0]/255,a[1]/255,a[2]/255,a[3])}throw new xn(d||`Could not parse color from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"padding":{let a;for(const d of this.args){a=d.evaluate(n);const y=Ai.parse(a);if(y)return y}throw new xn(`Could not parse padding from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"variableAnchorOffsetCollection":{let a;for(const d of this.args){a=d.evaluate(n);const y=Xi.parse(a);if(y)return y}throw new xn(`Could not parse variableAnchorOffsetCollection from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"number":{let a=null;for(const d of this.args){if(a=d.evaluate(n),a===null)return 0;const y=Number(a);if(!isNaN(y))return y}throw new xn(`Could not convert ${JSON.stringify(a)} to number.`)}case"formatted":return Mi.fromString(Zl(this.args[0].evaluate(n)));case"resolvedImage":return Di.fromString(Zl(this.args[0].evaluate(n)));default:return Zl(this.args[0].evaluate(n))}}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}const M_=["Unknown","Point","LineString","Polygon"];class Qu{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?M_[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(n){let a=this._parseColorCache[n];return a||(a=this._parseColorCache[n]=Ar.parse(n)),a}}class Jo{constructor(n,a,d=[],y,x=new vn,w=[]){this.registry=n,this.path=d,this.key=d.map(b=>`[${b}]`).join(""),this.scope=x,this.errors=w,this.expectedType=y,this._isConstant=a}parse(n,a,d,y,x={}){return a?this.concat(a,d,y)._parse(n,x):this._parse(n,x)}_parse(n,a){function d(y,x,w){return w==="assert"?new gs(x,[y]):w==="coerce"?new ys(x,[y]):y}if(n!==null&&typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"||(n=["literal",n]),Array.isArray(n)){if(n.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const y=n[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const x=this.registry[y];if(x){let w=x.parse(n,this);if(!w)return null;if(this.expectedType){const b=this.expectedType,k=w.type;if(b.kind!=="string"&&b.kind!=="number"&&b.kind!=="boolean"&&b.kind!=="object"&&b.kind!=="array"||k.kind!=="value")if(b.kind!=="color"&&b.kind!=="formatted"&&b.kind!=="resolvedImage"||k.kind!=="value"&&k.kind!=="string")if(b.kind!=="padding"||k.kind!=="value"&&k.kind!=="number"&&k.kind!=="array")if(b.kind!=="variableAnchorOffsetCollection"||k.kind!=="value"&&k.kind!=="array"){if(this.checkSubtype(b,k))return null}else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"assert")}if(!(w instanceof ms)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const b=new Qu;try{w=new ms(w.type,w.evaluate(b))}catch(k){return this.error(k.message),null}}return w}return this.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(n===void 0?"'undefined' value invalid. Use null instead.":typeof n=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof n} instead.`)}concat(n,a,d){const y=typeof n=="number"?this.path.concat(n):this.path,x=d?this.scope.concat(d):this.scope;return new Jo(this.registry,this._isConstant,y,a||null,x,this.errors)}error(n,...a){const d=`${this.key}${a.map(y=>`[${y}]`).join("")}`;this.errors.push(new _n(d,n))}checkSubtype(n,a){const d=ue(n,a);return d&&this.error(d),d}}class Po{constructor(n,a){this.type=a.type,this.bindings=[].concat(n),this.result=a}evaluate(n){return this.result.evaluate(n)}eachChild(n){for(const a of this.bindings)n(a[1]);n(this.result)}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found ${n.length-1} instead.`);const d=[];for(let x=1;x=d.length)throw new xn(`Array index out of bounds: ${a} > ${d.length-1}.`);if(a!==Math.floor(a))throw new xn(`Array index must be an integer, but found ${a} instead.`);return d[a]}eachChild(n){n(this.index),n(this.input)}outputDefined(){return!1}}class Jh{constructor(n,a){this.type=Ut,this.needle=n,this.haystack=a}static parse(n,a){if(n.length!==3)return a.error(`Expected 2 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Xt);return d&&y?Se(d.type,[Ut,Kt,Qe,pi,Xt])?new Jh(d,y):a.error(`Expected first argument to be of type boolean, string, number or null, but found ${W(d.type)} instead`):null}evaluate(n){const a=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(!d)return!1;if(!Ie(a,["boolean","string","number","null"]))throw new xn(`Expected first argument to be of type boolean, string, number or null, but found ${W(En(a))} instead.`);if(!Ie(d,["string","array"]))throw new xn(`Expected second argument to be of type array or string, but found ${W(En(d))} instead.`);return d.indexOf(a)>=0}eachChild(n){n(this.needle),n(this.haystack)}outputDefined(){return!0}}class Na{constructor(n,a,d){this.type=Qe,this.needle=n,this.haystack=a,this.fromIndex=d}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Xt);if(!d||!y)return null;if(!Se(d.type,[Ut,Kt,Qe,pi,Xt]))return a.error(`Expected first argument to be of type boolean, string, number or null, but found ${W(d.type)} instead`);if(n.length===4){const x=a.parse(n[3],3,Qe);return x?new Na(d,y,x):null}return new Na(d,y)}evaluate(n){const a=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(!Ie(a,["boolean","string","number","null"]))throw new xn(`Expected first argument to be of type boolean, string, number or null, but found ${W(En(a))} instead.`);let y;if(this.fromIndex&&(y=this.fromIndex.evaluate(n)),Ie(d,["string"])){const x=d.indexOf(a,y);return x===-1?-1:[...d.slice(0,x)].length}if(Ie(d,["array"]))return d.indexOf(a,y);throw new xn(`Expected second argument to be of type array or string, but found ${W(En(d))} instead.`)}eachChild(n){n(this.needle),n(this.haystack),this.fromIndex&&n(this.fromIndex)}outputDefined(){return!1}}class Qh{constructor(n,a,d,y,x,w){this.inputType=n,this.type=a,this.input=d,this.cases=y,this.outputs=x,this.otherwise=w}static parse(n,a){if(n.length<5)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if(n.length%2!=1)return a.error("Expected an even number of arguments.");let d,y;a.expectedType&&a.expectedType.kind!=="value"&&(y=a.expectedType);const x={},w=[];for(let I=2;INumber.MAX_SAFE_INTEGER)return U.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof K=="number"&&Math.floor(K)!==K)return U.error("Numeric branch labels must be integer values.");if(d){if(U.checkSubtype(d,En(K)))return null}else d=En(K);if(x[String(K)]!==void 0)return U.error("Branch labels must be unique.");x[String(K)]=w.length}const Z=a.parse(L,I,y);if(!Z)return null;y=y||Z.type,w.push(Z)}const b=a.parse(n[1],1,Xt);if(!b)return null;const k=a.parse(n[n.length-1],n.length-1,y);return k?b.type.kind!=="value"&&a.concat(1).checkSubtype(d,b.type)?null:new Qh(d,y,b,x,w,k):null}evaluate(n){const a=this.input.evaluate(n);return(En(a)===this.inputType&&this.outputs[this.cases[a]]||this.otherwise).evaluate(n)}eachChild(n){n(this.input),this.outputs.forEach(n),n(this.otherwise)}outputDefined(){return this.outputs.every(n=>n.outputDefined())&&this.otherwise.outputDefined()}}class ec{constructor(n,a,d){this.type=n,this.branches=a,this.otherwise=d}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found only ${n.length-1}.`);if(n.length%2!=0)return a.error("Expected an odd number of arguments.");let d;a.expectedType&&a.expectedType.kind!=="value"&&(d=a.expectedType);const y=[];for(let w=1;wa.outputDefined())&&this.otherwise.outputDefined()}}class ql{constructor(n,a,d,y){this.type=n,this.input=a,this.beginIndex=d,this.endIndex=y}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Qe);if(!d||!y)return null;if(!Se(d.type,[G(Xt),Kt,Xt]))return a.error(`Expected first argument to be of type array or string, but found ${W(d.type)} instead`);if(n.length===4){const x=a.parse(n[3],3,Qe);return x?new ql(d.type,d,y,x):null}return new ql(d.type,d,y)}evaluate(n){const a=this.input.evaluate(n),d=this.beginIndex.evaluate(n);let y;if(this.endIndex&&(y=this.endIndex.evaluate(n)),Ie(a,["string"]))return[...a].slice(d,y).join("");if(Ie(a,["array"]))return a.slice(d,y);throw new xn(`Expected first argument to be of type array or string, but found ${W(En(a))} instead.`)}eachChild(n){n(this.input),n(this.beginIndex),this.endIndex&&n(this.endIndex)}outputDefined(){return!1}}function tc(s,n){const a=s.length-1;let d,y,x=0,w=a,b=0;for(;x<=w;)if(b=Math.floor((x+w)/2),d=s[b],y=s[b+1],d<=n){if(b===a||nn))throw new xn("Input is not a number.");w=b-1}return 0}class $a{constructor(n,a,d){this.type=n,this.input=a,this.labels=[],this.outputs=[];for(const[y,x]of d)this.labels.push(y),this.outputs.push(x)}static parse(n,a){if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");const d=a.parse(n[1],1,Qe);if(!d)return null;const y=[];let x=null;a.expectedType&&a.expectedType.kind!=="value"&&(x=a.expectedType);for(let w=1;w=b)return a.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',I);const L=a.parse(k,D,x);if(!L)return null;x=x||L.type,y.push([b,L])}return new $a(x,d,y)}evaluate(n){const a=this.labels,d=this.outputs;if(a.length===1)return d[0].evaluate(n);const y=this.input.evaluate(n);if(y<=a[0])return d[0].evaluate(n);const x=a.length;return y>=a[x-1]?d[x-1].evaluate(n):d[tc(a,y)].evaluate(n)}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function Mp(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var A_=Ap;function Ap(s,n,a,d){this.cx=3*s,this.bx=3*(a-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(d-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=n,this.p2x=a,this.p2y=d}Ap.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,n){if(n===void 0&&(n=1e-6),s<0)return 0;if(s>1)return 1;for(var a=s,d=0;d<8;d++){var y=this.sampleCurveX(a)-s;if(Math.abs(y)y?w=a:b=a,a=.5*(b-w)+w;return a},solve:function(s,n){return this.sampleCurveY(this.solveCurveX(s,n))}};var D_=Mp(A_);function Qo(s,n,a){return s+a*(n-s)}function Yl(s,n,a){return s.map((d,y)=>Qo(d,n[y],a))}const gi={number:Qo,color:function(s,n,a,d="rgb"){switch(d){case"rgb":{const[y,x,w,b]=Yl(s.rgb,n.rgb,a);return new Ar(y,x,w,b,!1)}case"hcl":{const[y,x,w,b]=s.hcl,[k,I,D,L]=n.hcl;let U,Z;if(isNaN(y)||isNaN(k))isNaN(y)?isNaN(k)?U=NaN:(U=k,w!==1&&w!==0||(Z=I)):(U=y,D!==1&&D!==0||(Z=x));else{let De=k-y;k>y&&De>180?De-=360:k180&&(De+=360),U=y+a*De}const[K,J,le,fe]=function([De,be,Me,Ve]){return De=isNaN(De)?0:De*Ot,rn([Me,Math.cos(De)*be,Math.sin(De)*be,Ve])}([U,Z??Qo(x,I,a),Qo(w,D,a),Qo(b,L,a)]);return new Ar(K,J,le,fe,!1)}case"lab":{const[y,x,w,b]=rn(Yl(s.lab,n.lab,a));return new Ar(y,x,w,b,!1)}}},array:Yl,padding:function(s,n,a){return new Ai(Yl(s.values,n.values,a))},variableAnchorOffsetCollection:function(s,n,a){const d=s.values,y=n.values;if(d.length!==y.length)throw new xn(`Cannot interpolate values of different length. from: ${s.toString()}, to: ${n.toString()}`);const x=[];for(let w=0;wtypeof D!="number"||D<0||D>1))return a.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);y={name:"cubic-bezier",controlPoints:I}}}if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");if(x=a.parse(x,2,Qe),!x)return null;const b=[];let k=null;d==="interpolate-hcl"||d==="interpolate-lab"?k=Kr:a.expectedType&&a.expectedType.kind!=="value"&&(k=a.expectedType);for(let I=0;I=D)return a.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',U);const K=a.parse(L,Z,k);if(!K)return null;k=k||K.type,b.push([D,K])}return Ae(k,Qe)||Ae(k,Kr)||Ae(k,ps)||Ae(k,he)||Ae(k,G(Qe))?new yi(k,d,y,x,b):a.error(`Type ${W(k)} is not interpolatable.`)}evaluate(n){const a=this.labels,d=this.outputs;if(a.length===1)return d[0].evaluate(n);const y=this.input.evaluate(n);if(y<=a[0])return d[0].evaluate(n);const x=a.length;if(y>=a[x-1])return d[x-1].evaluate(n);const w=tc(a,y),b=yi.interpolationFactor(this.interpolation,y,a[w],a[w+1]),k=d[w].evaluate(n),I=d[w+1].evaluate(n);switch(this.operator){case"interpolate":return gi[this.type.kind](k,I,b);case"interpolate-hcl":return gi.color(k,I,b,"hcl");case"interpolate-lab":return gi.color(k,I,b,"lab")}}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function rc(s,n,a,d){const y=d-a,x=s-a;return y===0?0:n===1?x/y:(Math.pow(n,x)-1)/(Math.pow(n,y)-1)}class nc{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expectected at least one argument.");let d=null;const y=a.expectedType;y&&y.kind!=="value"&&(d=y);const x=[];for(const b of n.slice(1)){const k=a.parse(b,1+x.length,d,void 0,{typeAnnotation:"omit"});if(!k)return null;d=d||k.type,x.push(k)}if(!d)throw new Error("No output type");const w=y&&x.some(b=>ue(y,b.type));return new nc(w?Xt:d,x)}evaluate(n){let a,d=null,y=0;for(const x of this.args)if(y++,d=x.evaluate(n),d&&d instanceof Di&&!d.available&&(a||(a=d.name),d=null,y===this.args.length&&(d=a)),d!==null)break;return d}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}function ic(s,n){return s==="=="||s==="!="?n.kind==="boolean"||n.kind==="string"||n.kind==="number"||n.kind==="null"||n.kind==="value":n.kind==="string"||n.kind==="number"||n.kind==="value"}function Dp(s,n,a,d){return d.compare(n,a)===0}function Ua(s,n,a){const d=s!=="=="&&s!=="!=";return class yP{constructor(x,w,b){this.type=Ut,this.lhs=x,this.rhs=w,this.collator=b,this.hasUntypedArgument=x.type.kind==="value"||w.type.kind==="value"}static parse(x,w){if(x.length!==3&&x.length!==4)return w.error("Expected two or three arguments.");const b=x[0];let k=w.parse(x[1],1,Xt);if(!k)return null;if(!ic(b,k.type))return w.concat(1).error(`"${b}" comparisons are not supported for type '${W(k.type)}'.`);let I=w.parse(x[2],2,Xt);if(!I)return null;if(!ic(b,I.type))return w.concat(2).error(`"${b}" comparisons are not supported for type '${W(I.type)}'.`);if(k.type.kind!==I.type.kind&&k.type.kind!=="value"&&I.type.kind!=="value")return w.error(`Cannot compare types '${W(k.type)}' and '${W(I.type)}'.`);d&&(k.type.kind==="value"&&I.type.kind!=="value"?k=new gs(I.type,[k]):k.type.kind!=="value"&&I.type.kind==="value"&&(I=new gs(k.type,[I])));let D=null;if(x.length===4){if(k.type.kind!=="string"&&I.type.kind!=="string"&&k.type.kind!=="value"&&I.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(D=w.parse(x[3],3,Yi),!D)return null}return new yP(k,I,D)}evaluate(x){const w=this.lhs.evaluate(x),b=this.rhs.evaluate(x);if(d&&this.hasUntypedArgument){const k=En(w),I=En(b);if(k.kind!==I.kind||k.kind!=="string"&&k.kind!=="number")throw new xn(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${k.kind}, ${I.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){const k=En(w),I=En(b);if(k.kind!=="string"||I.kind!=="string")return n(x,w,b)}return this.collator?a(x,w,b,this.collator.evaluate(x)):n(x,w,b)}eachChild(x){x(this.lhs),x(this.rhs),this.collator&&x(this.collator)}outputDefined(){return!0}}}const z_=Ua("==",function(s,n,a){return n===a},Dp),zp=Ua("!=",function(s,n,a){return n!==a},function(s,n,a,d){return!Dp(0,n,a,d)}),Rp=Ua("<",function(s,n,a){return n",function(s,n,a){return n>a},function(s,n,a,d){return d.compare(n,a)>0}),L_=Ua("<=",function(s,n,a){return n<=a},function(s,n,a,d){return d.compare(n,a)<=0}),Lp=Ua(">=",function(s,n,a){return n>=a},function(s,n,a,d){return d.compare(n,a)>=0});class Xl{constructor(n,a,d){this.type=Yi,this.locale=d,this.caseSensitive=n,this.diacriticSensitive=a}static parse(n,a){if(n.length!==2)return a.error("Expected one argument.");const d=n[1];if(typeof d!="object"||Array.isArray(d))return a.error("Collator options argument must be an object.");const y=a.parse(d["case-sensitive"]!==void 0&&d["case-sensitive"],1,Ut);if(!y)return null;const x=a.parse(d["diacritic-sensitive"]!==void 0&&d["diacritic-sensitive"],1,Ut);if(!x)return null;let w=null;return d.locale&&(w=a.parse(d.locale,1,Kt),!w)?null:new Xl(y,x,w)}evaluate(n){return new qh(this.caseSensitive.evaluate(n),this.diacriticSensitive.evaluate(n),this.locale?this.locale.evaluate(n):null)}eachChild(n){n(this.caseSensitive),n(this.diacriticSensitive),this.locale&&n(this.locale)}outputDefined(){return!1}}class ed{constructor(n,a,d,y,x){this.type=Kt,this.number=n,this.locale=a,this.currency=d,this.minFractionDigits=y,this.maxFractionDigits=x}static parse(n,a){if(n.length!==3)return a.error("Expected two arguments.");const d=a.parse(n[1],1,Qe);if(!d)return null;const y=n[2];if(typeof y!="object"||Array.isArray(y))return a.error("NumberFormat options argument must be an object.");let x=null;if(y.locale&&(x=a.parse(y.locale,1,Kt),!x))return null;let w=null;if(y.currency&&(w=a.parse(y.currency,1,Kt),!w))return null;let b=null;if(y["min-fraction-digits"]&&(b=a.parse(y["min-fraction-digits"],1,Qe),!b))return null;let k=null;return y["max-fraction-digits"]&&(k=a.parse(y["max-fraction-digits"],1,Qe),!k)?null:new ed(d,x,w,b,k)}evaluate(n){return new Intl.NumberFormat(this.locale?this.locale.evaluate(n):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(n):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(n):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(n):void 0}).format(this.number.evaluate(n))}eachChild(n){n(this.number),this.locale&&n(this.locale),this.currency&&n(this.currency),this.minFractionDigits&&n(this.minFractionDigits),this.maxFractionDigits&&n(this.maxFractionDigits)}outputDefined(){return!1}}class sc{constructor(n){this.type=fs,this.sections=n}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const d=n[1];if(!Array.isArray(d)&&typeof d=="object")return a.error("First argument must be an image or text section.");const y=[];let x=!1;for(let w=1;w<=n.length-1;++w){const b=n[w];if(x&&typeof b=="object"&&!Array.isArray(b)){x=!1;let k=null;if(b["font-scale"]&&(k=a.parse(b["font-scale"],1,Qe),!k))return null;let I=null;if(b["text-font"]&&(I=a.parse(b["text-font"],1,G(Kt)),!I))return null;let D=null;if(b["text-color"]&&(D=a.parse(b["text-color"],1,Kr),!D))return null;const L=y[y.length-1];L.scale=k,L.font=I,L.textColor=D}else{const k=a.parse(n[w],1,Xt);if(!k)return null;const I=k.type.kind;if(I!=="string"&&I!=="value"&&I!=="null"&&I!=="resolvedImage")return a.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");x=!0,y.push({content:k,scale:null,font:null,textColor:null})}}return new sc(y)}evaluate(n){return new Mi(this.sections.map(a=>{const d=a.content.evaluate(n);return En(d)===Hn?new Yh("",d,null,null,null):new Yh(Zl(d),null,a.scale?a.scale.evaluate(n):null,a.font?a.font.evaluate(n).join(","):null,a.textColor?a.textColor.evaluate(n):null)}))}eachChild(n){for(const a of this.sections)n(a.content),a.scale&&n(a.scale),a.font&&n(a.font),a.textColor&&n(a.textColor)}outputDefined(){return!1}}class td{constructor(n){this.type=Hn,this.input=n}static parse(n,a){if(n.length!==2)return a.error("Expected two arguments.");const d=a.parse(n[1],1,Kt);return d?new td(d):a.error("No image name provided.")}evaluate(n){const a=this.input.evaluate(n),d=Di.fromString(a);return d&&n.availableImages&&(d.available=n.availableImages.indexOf(a)>-1),d}eachChild(n){n(this.input)}outputDefined(){return!1}}class rd{constructor(n){this.type=Qe,this.input=n}static parse(n,a){if(n.length!==2)return a.error(`Expected 1 argument, but found ${n.length-1} instead.`);const d=a.parse(n[1],1);return d?d.type.kind!=="array"&&d.type.kind!=="string"&&d.type.kind!=="value"?a.error(`Expected argument of type string or array, but found ${W(d.type)} instead.`):new rd(d):null}evaluate(n){const a=this.input.evaluate(n);if(typeof a=="string")return[...a].length;if(Array.isArray(a))return a.length;throw new xn(`Expected value to be of type string or array, but found ${W(En(a))} instead.`)}eachChild(n){n(this.input)}outputDefined(){return!1}}const js=8192;function O_(s,n){const a=(180+s[0])/360,d=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,y=Math.pow(2,n.z);return[Math.round(a*y*js),Math.round(d*y*js)]}function nd(s,n){const a=Math.pow(2,n.z);return[(y=(s[0]/js+n.x)/a,360*y-180),(d=(s[1]/js+n.y)/a,360/Math.PI*Math.atan(Math.exp((180-360*d)*Math.PI/180))-90)];var d,y}function ea(s,n){s[0]=Math.min(s[0],n[0]),s[1]=Math.min(s[1],n[1]),s[2]=Math.max(s[2],n[0]),s[3]=Math.max(s[3],n[1])}function Mo(s,n){return!(s[0]<=n[0]||s[2]>=n[2]||s[1]<=n[1]||s[3]>=n[3])}function Er(s,n,a){const d=s[0]-n[0],y=s[1]-n[1],x=s[0]-a[0],w=s[1]-a[1];return d*w-x*y==0&&d*x<=0&&y*w<=0}function oc(s,n,a,d){return(y=[d[0]-a[0],d[1]-a[1]])[0]*(x=[n[0]-s[0],n[1]-s[1]])[1]-y[1]*x[0]!=0&&!(!Fp(s,n,a,d)||!Fp(a,d,s,n));var y,x}function F_(s,n,a){for(const d of a)for(let y=0;y(y=s)[1]!=(w=b[k+1])[1]>y[1]&&y[0]<(w[0]-x[0])*(y[1]-x[1])/(w[1]-x[1])+x[0]&&(d=!d)}var y,x,w;return d}function B_(s,n){for(const a of n)if(ja(s,a))return!0;return!1}function Op(s,n){for(const a of s)if(!ja(a,n))return!1;for(let a=0;a0&&b<0||w<0&&b>0}function id(s,n,a){const d=[];for(let y=0;ya[2]){const y=.5*d;let x=s[0]-a[0]>y?-d:a[0]-s[0]>y?d:0;x===0&&(x=s[0]-a[2]>y?-d:a[2]-s[0]>y?d:0),s[0]+=x}ea(n,s)}function $p(s,n,a,d){const y=Math.pow(2,d.z)*js,x=[d.x*js,d.y*js],w=[];for(const b of s)for(const k of b){const I=[k.x+x[0],k.y+x[1]];Np(I,n,a,y),w.push(I)}return w}function Up(s,n,a,d){const y=Math.pow(2,d.z)*js,x=[d.x*js,d.y*js],w=[];for(const k of s){const I=[];for(const D of k){const L=[D.x+x[0],D.y+x[1]];ea(n,L),I.push(L)}w.push(I)}if(n[2]-n[0]<=y/2){(b=n)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(const k of w)for(const I of k)Np(I,n,a,y)}var b;return w}class ta{constructor(n,a){this.type=Ut,this.geojson=n,this.geometries=a}static parse(n,a){if(n.length!==2)return a.error(`'within' expression requires exactly one argument, but found ${n.length-1} instead.`);if(Ko(n[1])){const d=n[1];if(d.type==="FeatureCollection"){const y=[];for(const x of d.features){const{type:w,coordinates:b}=x.geometry;w==="Polygon"&&y.push(b),w==="MultiPolygon"&&y.push(...b)}if(y.length)return new ta(d,{type:"MultiPolygon",coordinates:y})}else if(d.type==="Feature"){const y=d.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new ta(d,d.geometry)}else if(d.type==="Polygon"||d.type==="MultiPolygon")return new ta(d,d)}return a.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(a,d){const y=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=a.canonicalID();if(d.type==="Polygon"){const b=id(d.coordinates,x,w),k=$p(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!ja(I,b))return!1}if(d.type==="MultiPolygon"){const b=Bp(d.coordinates,x,w),k=$p(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!B_(I,b))return!1}return!0}(n,this.geometries);if(n.geometryType()==="LineString")return function(a,d){const y=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=a.canonicalID();if(d.type==="Polygon"){const b=id(d.coordinates,x,w),k=Up(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!Op(I,b))return!1}if(d.type==="MultiPolygon"){const b=Bp(d.coordinates,x,w),k=Up(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!N_(I,b))return!1}return!0}(n,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let jp=class{constructor(s=[],n=(a,d)=>ad?1:0){if(this.data=s,this.length=this.data.length,this.compare=n,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;const s=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),s}peek(){return this.data[0]}_up(s){const{data:n,compare:a}=this,d=n[s];for(;s>0;){const y=s-1>>1,x=n[y];if(a(d,x)>=0)break;n[s]=x,s=y}n[s]=d}_down(s){const{data:n,compare:a}=this,d=this.length>>1,y=n[s];for(;s=0)break;n[s]=n[x],s=x}n[s]=y}};function $_(s,n,a,d,y){Vp(s,n,a,d||s.length-1,y||U_)}function Vp(s,n,a,d,y){for(;d>a;){if(d-a>600){var x=d-a+1,w=n-a+1,b=Math.log(x),k=.5*Math.exp(2*b/3),I=.5*Math.sqrt(b*k*(x-k)/x)*(w-x/2<0?-1:1);Vp(s,n,Math.max(a,Math.floor(n-w*k/x+I)),Math.min(d,Math.floor(n+(x-w)*k/x+I)),y)}var D=s[n],L=a,U=d;for(Kl(s,a,n),y(s[d],D)>0&&Kl(s,a,d);L0;)U--}y(s[a],D)===0?Kl(s,a,U):Kl(s,++U,d),U<=n&&(a=U+1),n<=U&&(d=U-1)}}function Kl(s,n,a){var d=s[n];s[n]=s[a],s[a]=d}function U_(s,n){return sn?1:0}function ac(s,n){if(s.length<=1)return[s];const a=[];let d,y;for(const x of s){const w=V_(x);w!==0&&(x.area=Math.abs(w),y===void 0&&(y=w<0),y===w<0?(d&&a.push(d),d=[x]):d.push(x))}if(d&&a.push(d),n>1)for(let x=0;x1?(I=n[k+1][0],D=n[k+1][1]):Z>0&&(I+=L/this.kx*Z,D+=U/this.ky*Z)),L=this.wrap(a[0]-I)*this.kx,U=(a[1]-D)*this.ky;const K=L*L+U*U;K180;)n-=360;return n}}function Zp(s,n){return n[0]-s[0]}function lc(s){return s[1]-s[0]+1}function ao(s,n){return s[1]>=s[0]&&s[1]s[1])return[null,null];const a=lc(s);if(n){if(a===2)return[s,null];const y=Math.floor(a/2);return[[s[0],s[0]+y],[s[0]+y,s[1]]]}if(a===1)return[s,null];const d=Math.floor(a/2)-1;return[[s[0],s[0]+d],[s[0]+d+1,s[1]]]}function ad(s,n){if(!ao(n,s.length))return[1/0,1/0,-1/0,-1/0];const a=[1/0,1/0,-1/0,-1/0];for(let d=n[0];d<=n[1];++d)ea(a,s[d]);return a}function ld(s){const n=[1/0,1/0,-1/0,-1/0];for(const a of s)for(const d of a)ea(n,d);return n}function uc(s){return s[0]!==-1/0&&s[1]!==-1/0&&s[2]!==1/0&&s[3]!==1/0}function ud(s,n,a){if(!uc(s)||!uc(n))return NaN;let d=0,y=0;return s[2]n[2]&&(d=s[0]-n[2]),s[1]>n[3]&&(y=s[1]-n[3]),s[3]=d)return d;if(Mo(y,x)){if(cc(s,n))return 0}else if(cc(n,s))return 0;let w=1/0;for(const b of s)for(let k=0,I=b.length,D=I-1;k0;){const k=w.pop();if(k[0]>=x)continue;const I=k[1],D=n?50:100;if(lc(I)<=D){if(!ao(I,s.length))return NaN;if(n){const L=ir(s,I,a,d);if(isNaN(L)||L===0)return L;x=Math.min(x,L)}else for(let L=I[0];L<=I[1];++L){const U=W_(s[L],a,d);if(x=Math.min(x,U),x===0)return 0}}else{const L=od(I,n);Rr(w,x,d,s,b,L[0]),Rr(w,x,d,s,b,L[1])}}return x}function Ql(s,n,a,d,y,x=1/0){let w=Math.min(x,y.distance(s[0],a[0]));if(w===0)return w;const b=new jp([[0,[0,s.length-1],[0,a.length-1]]],Zp);for(;b.length>0;){const k=b.pop();if(k[0]>=w)continue;const I=k[1],D=k[2],L=n?50:100,U=d?50:100;if(lc(I)<=L&&lc(D)<=U){if(!ao(I,s.length)&&ao(D,a.length))return NaN;let Z;if(n&&d)Z=H_(s,I,a,D,y),w=Math.min(w,Z);else if(n&&!d){const K=s.slice(I[0],I[1]+1);for(let J=D[0];J<=D[1];++J)if(Z=ra(a[J],K,y),w=Math.min(w,Z),w===0)return w}else if(!n&&d){const K=a.slice(D[0],D[1]+1);for(let J=I[0];J<=I[1];++J)if(Z=ra(s[J],K,y),w=Math.min(w,Z),w===0)return w}else Z=fn(s,I,a,D,y),w=Math.min(w,Z)}else{const Z=od(I,n),K=od(D,d);na(b,w,y,s,a,Z[0],K[0]),na(b,w,y,s,a,Z[0],K[1]),na(b,w,y,s,a,Z[1],K[0]),na(b,w,y,s,a,Z[1],K[1])}}return w}function hd(s){return s.type==="MultiPolygon"?s.coordinates.map(n=>({type:"Polygon",coordinates:n})):s.type==="MultiLineString"?s.coordinates.map(n=>({type:"LineString",coordinates:n})):s.type==="MultiPoint"?s.coordinates.map(n=>({type:"Point",coordinates:n})):[s]}class ia{constructor(n,a){this.type=Qe,this.geojson=n,this.geometries=a}static parse(n,a){if(n.length!==2)return a.error(`'distance' expression requires exactly one argument, but found ${n.length-1} instead.`);if(Ko(n[1])){const d=n[1];if(d.type==="FeatureCollection")return new ia(d,d.features.map(y=>hd(y.geometry)).flat());if(d.type==="Feature")return new ia(d,hd(d.geometry));if("type"in d&&"coordinates"in d)return new ia(d,hd(d))}return a.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(a,d){const y=a.geometry(),x=y.flat().map(k=>nd([k.x,k.y],a.canonical));if(y.length===0)return NaN;const w=new sd(x[0][1]);let b=1/0;for(const k of d){switch(k.type){case"Point":b=Math.min(b,Ql(x,!1,[k.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,Ql(x,!1,k.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,Jl(x,!1,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries);if(n.geometryType()==="LineString")return function(a,d){const y=a.geometry(),x=y.flat().map(k=>nd([k.x,k.y],a.canonical));if(y.length===0)return NaN;const w=new sd(x[0][1]);let b=1/0;for(const k of d){switch(k.type){case"Point":b=Math.min(b,Ql(x,!0,[k.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,Ql(x,!0,k.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,Jl(x,!0,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries);if(n.geometryType()==="Polygon")return function(a,d){const y=a.geometry();if(y.length===0||y[0].length===0)return NaN;const x=ac(y,0).map(k=>k.map(I=>I.map(D=>nd([D.x,D.y],a.canonical)))),w=new sd(x[0][0][0][1]);let b=1/0;for(const k of d)for(const I of x){switch(k.type){case"Point":b=Math.min(b,Jl([k.coordinates],!1,I,w,b));break;case"LineString":b=Math.min(b,Jl(k.coordinates,!0,I,w,b));break;case"Polygon":b=Math.min(b,Nr(I,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Va={"==":z_,"!=":zp,">":R_,"<":Rp,">=":Lp,"<=":L_,array:gs,at:Kh,boolean:gs,case:ec,coalesce:nc,collator:Xl,format:sc,image:td,in:Jh,"index-of":Na,interpolate:yi,"interpolate-hcl":yi,"interpolate-lab":yi,length:rd,let:Po,literal:ms,match:Qh,number:gs,"number-format":ed,object:gs,slice:ql,step:$a,string:gs,"to-boolean":ys,"to-color":ys,"to-number":ys,"to-string":ys,var:Sr,within:ta,distance:ia};class Ki{constructor(n,a,d,y){this.name=n,this.type=a,this._evaluate=d,this.args=y}evaluate(n){return this._evaluate(n,this.args)}eachChild(n){this.args.forEach(n)}outputDefined(){return!1}static parse(n,a){const d=n[0],y=Ki.definitions[d];if(!y)return a.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0);const x=Array.isArray(y)?y[0]:y.type,w=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,b=w.filter(([I])=>!Array.isArray(I)||I.length===n.length-1);let k=null;for(const[I,D]of b){k=new Jo(a.registry,eu,a.path,null,a.scope);const L=[];let U=!1;for(let Z=1;Z{return U=L,Array.isArray(U)?`(${U.map(W).join(", ")})`:`(${W(U.type)}...)`;var U}).join(" | "),D=[];for(let L=1;L{a=n?a&&eu(d):a&&d instanceof ms}),!!a&&tu(s)&&ru(s,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function tu(s){if(s instanceof Ki&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof ta||s instanceof ia)return!1;let n=!0;return s.eachChild(a=>{n&&!tu(a)&&(n=!1)}),n}function Ha(s){if(s instanceof Ki&&s.name==="feature-state")return!1;let n=!0;return s.eachChild(a=>{n&&!Ha(a)&&(n=!1)}),n}function ru(s,n){if(s instanceof Ki&&n.indexOf(s.name)>=0)return!1;let a=!0;return s.eachChild(d=>{a&&!ru(d,n)&&(a=!1)}),a}function hc(s){return{result:"success",value:s}}function Wa(s){return{result:"error",value:s}}function Ga(s){return s["property-type"]==="data-driven"||s["property-type"]==="cross-faded-data-driven"}function qp(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function md(s){return!!s.expression&&s.expression.interpolated}function vr(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function dc(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function G_(s){return s}function Yp(s,n){const a=n.type==="color",d=s.stops&&typeof s.stops[0][0]=="object",y=d||!(d||s.property!==void 0),x=s.type||(md(n)?"exponential":"interval");if(a||n.type==="padding"){const D=a?Ar.parse:Ai.parse;(s=tn({},s)).stops&&(s.stops=s.stops.map(L=>[L[0],D(L[1])])),s.default=D(s.default?s.default:n.default)}if(s.colorSpace&&(w=s.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${s.colorSpace}"`);var w;let b,k,I;if(x==="exponential")b=Kp;else if(x==="interval")b=fc;else if(x==="categorical"){b=Xp,k=Object.create(null);for(const D of s.stops)k[D[0]]=D[1];I=typeof s.stops[0][0]}else{if(x!=="identity")throw new Error(`Unknown function type "${x}"`);b=Jp}if(d){const D={},L=[];for(let K=0;KK[0]),evaluate:({zoom:K},J)=>Kp({stops:U,base:s.base},n,K).evaluate(K,J)}}if(y){const D=x==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:yi.interpolationFactor.bind(void 0,D),zoomStops:s.stops.map(L=>L[0]),evaluate:({zoom:L})=>b(s,n,L,k,I)}}return{kind:"source",evaluate(D,L){const U=L&&L.properties?L.properties[s.property]:void 0;return U===void 0?Za(s.default,n.default):b(s,n,U,k,I)}}}function Za(s,n,a){return s!==void 0?s:n!==void 0?n:a!==void 0?a:void 0}function Xp(s,n,a,d,y){return Za(typeof a===y?d[a]:void 0,s.default,n.default)}function fc(s,n,a){if(vr(a)!=="number")return Za(s.default,n.default);const d=s.stops.length;if(d===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[d-1][0])return s.stops[d-1][1];const y=tc(s.stops.map(x=>x[0]),a);return s.stops[y][1]}function Kp(s,n,a){const d=s.base!==void 0?s.base:1;if(vr(a)!=="number")return Za(s.default,n.default);const y=s.stops.length;if(y===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[y-1][0])return s.stops[y-1][1];const x=tc(s.stops.map(D=>D[0]),a),w=function(D,L,U,Z){const K=Z-U,J=D-U;return K===0?0:L===1?J/K:(Math.pow(L,J)-1)/(Math.pow(L,K)-1)}(a,d,s.stops[x][0],s.stops[x+1][0]),b=s.stops[x][1],k=s.stops[x+1][1],I=gi[n.type]||G_;return typeof b.evaluate=="function"?{evaluate(...D){const L=b.evaluate.apply(void 0,D),U=k.evaluate.apply(void 0,D);if(L!==void 0&&U!==void 0)return I(L,U,w,s.colorSpace)}}:I(b,k,w,s.colorSpace)}function Jp(s,n,a){switch(n.type){case"color":a=Ar.parse(a);break;case"formatted":a=Mi.fromString(a.toString());break;case"resolvedImage":a=Di.fromString(a.toString());break;case"padding":a=Ai.parse(a);break;default:vr(a)===n.type||n.type==="enum"&&n.values[a]||(a=void 0)}return Za(a,s.default,n.default)}Ki.register(Va,{error:[{kind:"error"},[Kt],(s,[n])=>{throw new xn(n.evaluate(s))}],typeof:[Kt,[Xt],(s,[n])=>W(En(n.evaluate(s)))],"to-rgba":[G(Qe,4),[Kr],(s,[n])=>{const[a,d,y,x]=n.evaluate(s).rgb;return[255*a,255*d,255*y,x]}],rgb:[Kr,[Qe,Qe,Qe],dd],rgba:[Kr,[Qe,Qe,Qe,Qe],dd],has:{type:Ut,overloads:[[[Kt],(s,[n])=>fd(n.evaluate(s),s.properties())],[[Kt,mi],(s,[n,a])=>fd(n.evaluate(s),a.evaluate(s))]]},get:{type:Xt,overloads:[[[Kt],(s,[n])=>pd(n.evaluate(s),s.properties())],[[Kt,mi],(s,[n,a])=>pd(n.evaluate(s),a.evaluate(s))]]},"feature-state":[Xt,[Kt],(s,[n])=>pd(n.evaluate(s),s.featureState||{})],properties:[mi,[],s=>s.properties()],"geometry-type":[Kt,[],s=>s.geometryType()],id:[Xt,[],s=>s.id()],zoom:[Qe,[],s=>s.globals.zoom],"heatmap-density":[Qe,[],s=>s.globals.heatmapDensity||0],"line-progress":[Qe,[],s=>s.globals.lineProgress||0],accumulated:[Xt,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[Qe,sa(Qe),(s,n)=>{let a=0;for(const d of n)a+=d.evaluate(s);return a}],"*":[Qe,sa(Qe),(s,n)=>{let a=1;for(const d of n)a*=d.evaluate(s);return a}],"-":{type:Qe,overloads:[[[Qe,Qe],(s,[n,a])=>n.evaluate(s)-a.evaluate(s)],[[Qe],(s,[n])=>-n.evaluate(s)]]},"/":[Qe,[Qe,Qe],(s,[n,a])=>n.evaluate(s)/a.evaluate(s)],"%":[Qe,[Qe,Qe],(s,[n,a])=>n.evaluate(s)%a.evaluate(s)],ln2:[Qe,[],()=>Math.LN2],pi:[Qe,[],()=>Math.PI],e:[Qe,[],()=>Math.E],"^":[Qe,[Qe,Qe],(s,[n,a])=>Math.pow(n.evaluate(s),a.evaluate(s))],sqrt:[Qe,[Qe],(s,[n])=>Math.sqrt(n.evaluate(s))],log10:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))/Math.LN10],ln:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))],log2:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))/Math.LN2],sin:[Qe,[Qe],(s,[n])=>Math.sin(n.evaluate(s))],cos:[Qe,[Qe],(s,[n])=>Math.cos(n.evaluate(s))],tan:[Qe,[Qe],(s,[n])=>Math.tan(n.evaluate(s))],asin:[Qe,[Qe],(s,[n])=>Math.asin(n.evaluate(s))],acos:[Qe,[Qe],(s,[n])=>Math.acos(n.evaluate(s))],atan:[Qe,[Qe],(s,[n])=>Math.atan(n.evaluate(s))],min:[Qe,sa(Qe),(s,n)=>Math.min(...n.map(a=>a.evaluate(s)))],max:[Qe,sa(Qe),(s,n)=>Math.max(...n.map(a=>a.evaluate(s)))],abs:[Qe,[Qe],(s,[n])=>Math.abs(n.evaluate(s))],round:[Qe,[Qe],(s,[n])=>{const a=n.evaluate(s);return a<0?-Math.round(-a):Math.round(a)}],floor:[Qe,[Qe],(s,[n])=>Math.floor(n.evaluate(s))],ceil:[Qe,[Qe],(s,[n])=>Math.ceil(n.evaluate(s))],"filter-==":[Ut,[Kt,Xt],(s,[n,a])=>s.properties()[n.value]===a.value],"filter-id-==":[Ut,[Xt],(s,[n])=>s.id()===n.value],"filter-type-==":[Ut,[Kt],(s,[n])=>s.geometryType()===n.value],"filter-<":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d{const a=s.id(),d=n.value;return typeof a==typeof d&&a":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d>y}],"filter-id->":[Ut,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a>d}],"filter-<=":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d<=y}],"filter-id-<=":[Ut,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a<=d}],"filter->=":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d>=y}],"filter-id->=":[Ut,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a>=d}],"filter-has":[Ut,[Xt],(s,[n])=>n.value in s.properties()],"filter-has-id":[Ut,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[Ut,[G(Kt)],(s,[n])=>n.value.indexOf(s.geometryType())>=0],"filter-id-in":[Ut,[G(Xt)],(s,[n])=>n.value.indexOf(s.id())>=0],"filter-in-small":[Ut,[Kt,G(Xt)],(s,[n,a])=>a.value.indexOf(s.properties()[n.value])>=0],"filter-in-large":[Ut,[Kt,G(Xt)],(s,[n,a])=>function(d,y,x,w){for(;x<=w;){const b=x+w>>1;if(y[b]===d)return!0;y[b]>d?w=b-1:x=b+1}return!1}(s.properties()[n.value],a.value,0,a.value.length-1)],all:{type:Ut,overloads:[[[Ut,Ut],(s,[n,a])=>n.evaluate(s)&&a.evaluate(s)],[sa(Ut),(s,n)=>{for(const a of n)if(!a.evaluate(s))return!1;return!0}]]},any:{type:Ut,overloads:[[[Ut,Ut],(s,[n,a])=>n.evaluate(s)||a.evaluate(s)],[sa(Ut),(s,n)=>{for(const a of n)if(a.evaluate(s))return!0;return!1}]]},"!":[Ut,[Ut],(s,[n])=>!n.evaluate(s)],"is-supported-script":[Ut,[Kt],(s,[n])=>{const a=s.globals&&s.globals.isSupportedScript;return!a||a(n.evaluate(s))}],upcase:[Kt,[Kt],(s,[n])=>n.evaluate(s).toUpperCase()],downcase:[Kt,[Kt],(s,[n])=>n.evaluate(s).toLowerCase()],concat:[Kt,sa(Xt),(s,n)=>n.map(a=>Zl(a.evaluate(s))).join("")],"resolved-locale":[Kt,[Yi],(s,[n])=>n.evaluate(s).resolvedLocale()]});class pc{constructor(n,a){var d;this.expression=n,this._warningHistory={},this._evaluator=new Qu,this._defaultValue=a?(d=a).type==="color"&&dc(d.default)?new Ar(0,0,0,0):d.type==="color"?Ar.parse(d.default)||null:d.type==="padding"?Ai.parse(d.default)||null:d.type==="variableAnchorOffsetCollection"?Xi.parse(d.default)||null:d.default===void 0?null:d.default:null,this._enumValues=a&&a.type==="enum"?a.values:null}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._evaluator.globals=n,this._evaluator.feature=a,this._evaluator.featureState=d,this._evaluator.canonical=y,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(n,a,d,y,x,w){this._evaluator.globals=n,this._evaluator.feature=a||null,this._evaluator.featureState=d||null,this._evaluator.canonical=y,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w||null;try{const b=this.expression.evaluate(this._evaluator);if(b==null||typeof b=="number"&&b!=b)return this._defaultValue;if(this._enumValues&&!(b in this._enumValues))throw new xn(`Expected value to be one of ${Object.keys(this._enumValues).map(k=>JSON.stringify(k)).join(", ")}, but found ${JSON.stringify(b)} instead.`);return b}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(b.message)),this._defaultValue}}}function mc(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in Va}function qa(s,n){const a=new Jo(Va,eu,[],n?function(y){const x={color:Kr,string:Kt,number:Qe,enum:Kt,boolean:Ut,formatted:fs,padding:ps,resolvedImage:Hn,variableAnchorOffsetCollection:he};return y.type==="array"?G(x[y.value]||Xt,y.length):x[y.type]}(n):void 0),d=a.parse(s,void 0,void 0,void 0,n&&n.type==="string"?{typeAnnotation:"coerce"}:void 0);return d?hc(new pc(d,n)):Wa(a.errors)}class Ya{constructor(n,a){this.kind=n,this._styleExpression=a,this.isStateDependent=n!=="constant"&&!Ha(a.expression)}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._styleExpression.evaluateWithoutErrorHandling(n,a,d,y,x,w)}evaluate(n,a,d,y,x,w){return this._styleExpression.evaluate(n,a,d,y,x,w)}}class Xa{constructor(n,a,d,y){this.kind=n,this.zoomStops=d,this._styleExpression=a,this.isStateDependent=n!=="camera"&&!Ha(a.expression),this.interpolationType=y}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._styleExpression.evaluateWithoutErrorHandling(n,a,d,y,x,w)}evaluate(n,a,d,y,x,w){return this._styleExpression.evaluate(n,a,d,y,x,w)}interpolationFactor(n,a,d){return this.interpolationType?yi.interpolationFactor(this.interpolationType,n,a,d):0}}function gd(s,n){const a=qa(s,n);if(a.result==="error")return a;const d=a.value.expression,y=tu(d);if(!y&&!Ga(n))return Wa([new _n("","data expressions not supported")]);const x=ru(d,["zoom"]);if(!x&&!qp(n))return Wa([new _n("","zoom expressions not supported")]);const w=nu(d);return w||x?w instanceof _n?Wa([w]):w instanceof yi&&!md(n)?Wa([new _n("",'"interpolate" expressions cannot be used with this property')]):hc(w?new Xa(y?"camera":"composite",a.value,w.labels,w instanceof yi?w.interpolation:void 0):new Ya(y?"constant":"source",a.value)):Wa([new _n("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ka{constructor(n,a){this._parameters=n,this._specification=a,tn(this,Yp(this._parameters,this._specification))}static deserialize(n){return new Ka(n._parameters,n._specification)}static serialize(n){return{_parameters:n._parameters,_specification:n._specification}}}function nu(s){let n=null;if(s instanceof Po)n=nu(s.result);else if(s instanceof nc){for(const a of s.args)if(n=nu(a),n)break}else(s instanceof $a||s instanceof yi)&&s.input instanceof Ki&&s.input.name==="zoom"&&(n=s);return n instanceof _n||s.eachChild(a=>{const d=nu(a);d instanceof _n?n=d:!n&&d?n=new _n("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&d&&n!==d&&(n=new _n("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}function gc(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const n of s.slice(1))if(!gc(n)&&typeof n!="boolean")return!1;return!0;default:return!0}}const yc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yd(s){if(s==null)return{filter:()=>!0,needGeometry:!1};gc(s)||(s=_c(s));const n=qa(s,yc);if(n.result==="error")throw new Error(n.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,d,y)=>n.value.evaluate(a,d,{},y),needGeometry:Qp(s)}}function Z_(s,n){return sn?1:0}function Qp(s){if(!Array.isArray(s))return!1;if(s[0]==="within"||s[0]==="distance")return!0;for(let n=1;n"||n==="<="||n===">="?_d(s[1],s[2],n):n==="any"?(a=s.slice(1),["any"].concat(a.map(_c))):n==="all"?["all"].concat(s.slice(1).map(_c)):n==="none"?["all"].concat(s.slice(1).map(_c).map(Wn)):n==="in"?iu(s[1],s.slice(2)):n==="!in"?Wn(iu(s[1],s.slice(2))):n==="has"?su(s[1]):n!=="!has"||Wn(su(s[1]));var a}function _d(s,n,a){switch(s){case"$type":return[`filter-type-${a}`,n];case"$id":return[`filter-id-${a}`,n];default:return[`filter-${a}`,s,n]}}function iu(s,n){if(n.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",n]];case"$id":return["filter-id-in",["literal",n]];default:return n.length>200&&!n.some(a=>typeof a!=typeof n[0])?["filter-in-large",s,["literal",n.sort(Z_)]]:["filter-in-small",s,["literal",n]]}}function su(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function Wn(s){return["!",s]}function oa(s){const n=typeof s;if(n==="number"||n==="boolean"||n==="string"||s==null)return JSON.stringify(s);if(Array.isArray(s)){let y="[";for(const x of s)y+=`${oa(x)},`;return`${y}]`}const a=Object.keys(s).sort();let d="{";for(let y=0;yd.maximum?[new Ze(n,a,`${a} is greater than the maximum value ${d.maximum}`)]:[]}function vc(s){const n=s.valueSpec,a=pn(s.value.type);let d,y,x,w={};const b=a!=="categorical"&&s.value.property===void 0,k=!b,I=vr(s.value.stops)==="array"&&vr(s.value.stops[0])==="array"&&vr(s.value.stops[0][0])==="object",D=zi({key:s.key,value:s.value,valueSpec:s.styleSpec.function,validateSpec:s.validateSpec,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(Z){if(a==="identity")return[new Ze(Z.key,Z.value,'identity function may not have a "stops" property')];let K=[];const J=Z.value;return K=K.concat(ou({key:Z.key,value:J,valueSpec:Z.valueSpec,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,arrayElementValidator:L})),vr(J)==="array"&&J.length===0&&K.push(new Ze(Z.key,J,"array must have at least one stop")),K},default:function(Z){return Z.validateSpec({key:Z.key,value:Z.value,valueSpec:n,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec})}}});return a==="identity"&&b&&D.push(new Ze(s.key,s.value,'missing required property "property"')),a==="identity"||s.value.stops||D.push(new Ze(s.key,s.value,'missing required property "stops"')),a==="exponential"&&s.valueSpec.expression&&!md(s.valueSpec)&&D.push(new Ze(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(k&&!Ga(s.valueSpec)?D.push(new Ze(s.key,s.value,"property functions not supported")):b&&!qp(s.valueSpec)&&D.push(new Ze(s.key,s.value,"zoom functions not supported"))),a!=="categorical"&&!I||s.value.property!==void 0||D.push(new Ze(s.key,s.value,'"property" property is required')),D;function L(Z){let K=[];const J=Z.value,le=Z.key;if(vr(J)!=="array")return[new Ze(le,J,`array expected, ${vr(J)} found`)];if(J.length!==2)return[new Ze(le,J,`array length 2 expected, length ${J.length} found`)];if(I){if(vr(J[0])!=="object")return[new Ze(le,J,`object expected, ${vr(J[0])} found`)];if(J[0].zoom===void 0)return[new Ze(le,J,"object stop key must have zoom")];if(J[0].value===void 0)return[new Ze(le,J,"object stop key must have value")];if(x&&x>pn(J[0].zoom))return[new Ze(le,J[0].zoom,"stop zoom values must appear in ascending order")];pn(J[0].zoom)!==x&&(x=pn(J[0].zoom),y=void 0,w={}),K=K.concat(zi({key:`${le}[0]`,value:J[0],valueSpec:{zoom:{}},validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,objectElementValidators:{zoom:vd,value:U}}))}else K=K.concat(U({key:`${le}[0]`,value:J[0],valueSpec:{},validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec},J));return mc(_s(J[1]))?K.concat([new Ze(`${le}[1]`,J[1],"expressions are not allowed in function stops.")]):K.concat(Z.validateSpec({key:`${le}[1]`,value:J[1],valueSpec:n,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec}))}function U(Z,K){const J=vr(Z.value),le=pn(Z.value),fe=Z.value!==null?Z.value:K;if(d){if(J!==d)return[new Ze(Z.key,fe,`${J} stop domain type must match previous stop domain type ${d}`)]}else d=J;if(J!=="number"&&J!=="string"&&J!=="boolean")return[new Ze(Z.key,fe,"stop domain value must be a number, string, or boolean")];if(J!=="number"&&a!=="categorical"){let De=`number expected, ${J} found`;return Ga(n)&&a===void 0&&(De+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ze(Z.key,fe,De)]}return a!=="categorical"||J!=="number"||isFinite(le)&&Math.floor(le)===le?a!=="categorical"&&J==="number"&&y!==void 0&&lenew Ze(`${s.key}${d.key}`,s.value,d.message));const a=n.value.expression||n.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!a.outputDefined())return[new Ze(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!Ha(a))return[new Ze(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter"&&!Ha(a))return[new Ze(s.key,s.value,'"feature-state" data expressions are not supported with filters.')];if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!ru(a,["zoom","feature-state"]))return[new Ze(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!tu(a))return[new Ze(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function lo(s){const n=s.key,a=s.value,d=s.valueSpec,y=[];return Array.isArray(d.values)?d.values.indexOf(pn(a))===-1&&y.push(new Ze(n,a,`expected one of [${d.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(d.values).indexOf(pn(a))===-1&&y.push(new Ze(n,a,`expected one of [${Object.keys(d.values).join(", ")}], ${JSON.stringify(a)} found`)),y}function xd(s){return gc(_s(s.value))?Ja(tn({},s,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xc(s)}function xc(s){const n=s.value,a=s.key;if(vr(n)!=="array")return[new Ze(a,n,`array expected, ${vr(n)} found`)];const d=s.styleSpec;let y,x=[];if(n.length<1)return[new Ze(a,n,"filter array must have at least 1 element")];switch(x=x.concat(lo({key:`${a}[0]`,value:n[0],valueSpec:d.filter_operator,style:s.style,styleSpec:s.styleSpec})),pn(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&pn(n[1])==="$type"&&x.push(new Ze(a,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":n.length!==3&&x.push(new Ze(a,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(y=vr(n[1]),y!=="string"&&x.push(new Ze(`${a}[1]`,n[1],`string expected, ${y} found`)));for(let w=2;w{I in a&&n.push(new Ze(d,a[I],`"${I}" is prohibited for ref layers`))}),y.layers.forEach(I=>{pn(I.id)===b&&(k=I)}),k?k.ref?n.push(new Ze(d,a.ref,"ref cannot reference another ref layer")):w=pn(k.type):n.push(new Ze(d,a.ref,`ref layer "${b}" not found`))}else if(w!=="background")if(a.source){const k=y.sources&&y.sources[a.source],I=k&&pn(k.type);k?I==="vector"&&w==="raster"?n.push(new Ze(d,a.source,`layer "${a.id}" requires a raster source`)):I!=="raster-dem"&&w==="hillshade"?n.push(new Ze(d,a.source,`layer "${a.id}" requires a raster-dem source`)):I==="raster"&&w!=="raster"?n.push(new Ze(d,a.source,`layer "${a.id}" requires a vector source`)):I!=="vector"||a["source-layer"]?I==="raster-dem"&&w!=="hillshade"?n.push(new Ze(d,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!a.paint||!a.paint["line-gradient"]||I==="geojson"&&k.lineMetrics||n.push(new Ze(d,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new Ze(d,a,`layer "${a.id}" must specify a "source-layer"`)):n.push(new Ze(d,a.source,`source "${a.source}" not found`))}else n.push(new Ze(d,a,'missing required property "source"'));return n=n.concat(zi({key:d,value:a,valueSpec:x.layer,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,objectElementValidators:{"*":()=>[],type:()=>s.validateSpec({key:`${d}.type`,value:a.type,valueSpec:x.layer.type,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,object:a,objectKey:"type"}),filter:xd,layout:k=>zi({layer:a,key:k.key,value:k.value,style:k.style,styleSpec:k.styleSpec,validateSpec:k.validateSpec,objectElementValidators:{"*":I=>bd(tn({layerType:w},I))}}),paint:k=>zi({layer:a,key:k.key,value:k.value,style:k.style,styleSpec:k.styleSpec,validateSpec:k.validateSpec,objectElementValidators:{"*":I=>wc(tn({layerType:w},I))}})}})),n}function aa(s){const n=s.value,a=s.key,d=vr(n);return d!=="string"?[new Ze(a,n,`string expected, ${d} found`)]:[]}const bc={promoteId:function({key:s,value:n}){if(vr(n)==="string")return aa({key:s,value:n});{const a=[];for(const d in n)a.push(...aa({key:`${s}.${d}`,value:n[d]}));return a}}};function au(s){const n=s.value,a=s.key,d=s.styleSpec,y=s.style,x=s.validateSpec;if(!n.type)return[new Ze(a,n,'"type" is required')];const w=pn(n.type);let b;switch(w){case"vector":case"raster":return b=zi({key:a,value:n,valueSpec:d[`source_${w.replace("-","_")}`],style:s.style,styleSpec:d,objectElementValidators:bc,validateSpec:x}),b;case"raster-dem":return b=function(k){var I;const D=(I=k.sourceName)!==null&&I!==void 0?I:"",L=k.value,U=k.styleSpec,Z=U.source_raster_dem,K=k.style;let J=[];const le=vr(L);if(L===void 0)return J;if(le!=="object")return J.push(new Ze("source_raster_dem",L,`object expected, ${le} found`)),J;const fe=pn(L.encoding)==="custom",De=["redFactor","greenFactor","blueFactor","baseShift"],be=k.value.encoding?`"${k.value.encoding}"`:"Default";for(const Me in L)!fe&&De.includes(Me)?J.push(new Ze(Me,L[Me],`In "${D}": "${Me}" is only valid when "encoding" is set to "custom". ${be} encoding found`)):Z[Me]?J=J.concat(k.validateSpec({key:Me,value:L[Me],valueSpec:Z[Me],validateSpec:k.validateSpec,style:K,styleSpec:U})):J.push(new Ze(Me,L[Me],`unknown property "${Me}"`));return J}({sourceName:a,value:n,style:s.style,styleSpec:d,validateSpec:x}),b;case"geojson":if(b=zi({key:a,value:n,valueSpec:d.source_geojson,style:y,styleSpec:d,validateSpec:x,objectElementValidators:bc}),n.cluster)for(const k in n.clusterProperties){const[I,D]=n.clusterProperties[k],L=typeof I=="string"?[I,["accumulated"],["get",k]]:I;b.push(...Ja({key:`${a}.${k}.map`,value:D,validateSpec:x,expressionContext:"cluster-map"})),b.push(...Ja({key:`${a}.${k}.reduce`,value:L,validateSpec:x,expressionContext:"cluster-reduce"}))}return b;case"video":return zi({key:a,value:n,valueSpec:d.source_video,style:y,validateSpec:x,styleSpec:d});case"image":return zi({key:a,value:n,valueSpec:d.source_image,style:y,validateSpec:x,styleSpec:d});case"canvas":return[new Ze(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return lo({key:`${a}.type`,value:n.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:x,styleSpec:d})}}function kd(s){const n=s.value,a=s.styleSpec,d=a.light,y=s.style;let x=[];const w=vr(n);if(n===void 0)return x;if(w!=="object")return x=x.concat([new Ze("light",n,`object expected, ${w} found`)]),x;for(const b in n){const k=b.match(/^(.*)-transition$/);x=x.concat(k&&d[k[1]]&&d[k[1]].transition?s.validateSpec({key:b,value:n[b],valueSpec:a.transition,validateSpec:s.validateSpec,style:y,styleSpec:a}):d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],validateSpec:s.validateSpec,style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)])}return x}function Td(s){const n=s.value,a=s.styleSpec,d=a.sky,y=s.style,x=vr(n);if(n===void 0)return[];if(x!=="object")return[new Ze("sky",n,`object expected, ${x} found`)];let w=[];for(const b in n)w=w.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)]);return w}function Ed(s){const n=s.value,a=s.styleSpec,d=a.terrain,y=s.style;let x=[];const w=vr(n);if(n===void 0)return x;if(w!=="object")return x=x.concat([new Ze("terrain",n,`object expected, ${w} found`)]),x;for(const b in n)x=x.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],validateSpec:s.validateSpec,style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)]);return x}function Cd(s){let n=[];const a=s.value,d=s.key;if(Array.isArray(a)){const y=[],x=[];for(const w in a)a[w].id&&y.includes(a[w].id)&&n.push(new Ze(d,a,`all the sprites' ids must be unique, but ${a[w].id} is duplicated`)),y.push(a[w].id),a[w].url&&x.includes(a[w].url)&&n.push(new Ze(d,a,`all the sprites' URLs must be unique, but ${a[w].url} is duplicated`)),x.push(a[w].url),n=n.concat(zi({key:`${d}[${w}]`,value:a[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:s.validateSpec}));return n}return aa({key:d,value:a})}const Sc={"*":()=>[],array:ou,boolean:function(s){const n=s.value,a=s.key,d=vr(n);return d!=="boolean"?[new Ze(a,n,`boolean expected, ${d} found`)]:[]},number:vd,color:function(s){const n=s.key,a=s.value,d=vr(a);return d!=="string"?[new Ze(n,a,`color expected, ${d} found`)]:Ar.parse(String(a))?[]:[new Ze(n,a,`color expected, "${a}" found`)]},constants:tm,enum:lo,filter:xd,function:vc,layer:Sd,object:zi,source:au,light:kd,sky:Td,terrain:Ed,projection:function(s){const n=s.value,a=s.styleSpec,d=a.projection,y=s.style,x=vr(n);if(n===void 0)return[];if(x!=="object")return[new Ze("projection",n,`object expected, ${x} found`)];let w=[];for(const b in n)w=w.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)]);return w},string:aa,formatted:function(s){return aa(s).length===0?[]:Ja(s)},resolvedImage:function(s){return aa(s).length===0?[]:Ja(s)},padding:function(s){const n=s.key,a=s.value;if(vr(a)==="array"){if(a.length<1||a.length>4)return[new Ze(n,a,`padding requires 1 to 4 values; ${a.length} values found`)];const d={type:"number"};let y=[];for(let x=0;x[]}})),s.constants&&(a=a.concat(tm({key:"constants",value:s.constants,style:s,styleSpec:n,validateSpec:Qa}))),Id(a)}function Vs(s){return function(n){return s({...n,validateSpec:Qa})}}function Id(s){return[].concat(s).sort((n,a)=>n.line-a.line)}function vs(s){return function(...n){return Id(s.apply(this,n))}}Ji.source=vs(Vs(au)),Ji.sprite=vs(Vs(Cd)),Ji.glyphs=vs(Vs(rm)),Ji.light=vs(Vs(kd)),Ji.sky=vs(Vs(Td)),Ji.terrain=vs(Vs(Ed)),Ji.layer=vs(Vs(Sd)),Ji.filter=vs(Vs(xd)),Ji.paintProperty=vs(Vs(wc)),Ji.layoutProperty=vs(Vs(bd));const la=Ji,q_=la.light,Y_=la.sky,nm=la.paintProperty,im=la.layoutProperty;function Pd(s,n){let a=!1;if(n&&n.length)for(const d of n)s.fire(new V(new Error(d.message))),a=!0;return a}class el{constructor(n,a,d){const y=this.cells=[];if(n instanceof ArrayBuffer){this.arrayBuffer=n;const w=new Int32Array(this.arrayBuffer);n=w[0],this.d=(a=w[1])+2*(d=w[2]);for(let k=0;k=L[K+0]&&y>=L[K+1])?(b[Z]=!0,w.push(D[Z])):b[Z]=!1}}}}_forEachCell(n,a,d,y,x,w,b,k){const I=this._convertToCellCoord(n),D=this._convertToCellCoord(a),L=this._convertToCellCoord(d),U=this._convertToCellCoord(y);for(let Z=I;Z<=L;Z++)for(let K=D;K<=U;K++){const J=this.d*K+Z;if((!k||k(this._convertFromCellCoord(Z),this._convertFromCellCoord(K),this._convertFromCellCoord(Z+1),this._convertFromCellCoord(K+1)))&&x.call(this,n,a,d,y,J,w,b,k))return}}_convertFromCellCoord(n){return(n-this.padding)/this.scale}_convertToCellCoord(n){return Math.max(0,Math.min(this.d-1,Math.floor(n*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const n=this.cells,a=3+this.cells.length+1+1;let d=0;for(let w=0;w=0)continue;const w=s[x];y[x]=Qi[a].shallow.indexOf(x)>=0?w:tl(w,n)}s instanceof Error&&(y.message=s.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return a!=="Object"&&(y.$name=a),y}function rl(s){if(sm(s))return s;if(Array.isArray(s))return s.map(rl);if(typeof s!="object")throw new Error("can't deserialize object of type "+typeof s);const n=Md(s)||"Object";if(!Qi[n])throw new Error(`can't deserialize unregistered class ${n}`);const{klass:a}=Qi[n];if(!a)throw new Error(`can't deserialize unregistered class ${n}`);if(a.deserialize)return a.deserialize(s);const d=Object.create(a.prototype);for(const y of Object.keys(s)){if(y==="$name")continue;const x=s[y];d[y]=Qi[n].shallow.indexOf(y)>=0?x:rl(x)}return d}class Ad{constructor(){this.first=!0}update(n,a){const d=Math.floor(n);return this.first?(this.first=!1,this.lastIntegerZoom=d,this.lastIntegerZoomTime=0,this.lastZoom=n,this.lastFloorZoom=d,!0):(this.lastFloorZoom>d?(this.lastIntegerZoom=d+1,this.lastIntegerZoomTime=a):this.lastFloorZooms>=128&&s<=255,"Hangul Jamo":s=>s>=4352&&s<=4607,Khmer:s=>s>=6016&&s<=6143,"General Punctuation":s=>s>=8192&&s<=8303,"Letterlike Symbols":s=>s>=8448&&s<=8527,"Number Forms":s=>s>=8528&&s<=8591,"Miscellaneous Technical":s=>s>=8960&&s<=9215,"Control Pictures":s=>s>=9216&&s<=9279,"Optical Character Recognition":s=>s>=9280&&s<=9311,"Enclosed Alphanumerics":s=>s>=9312&&s<=9471,"Geometric Shapes":s=>s>=9632&&s<=9727,"Miscellaneous Symbols":s=>s>=9728&&s<=9983,"Miscellaneous Symbols and Arrows":s=>s>=11008&&s<=11263,"Ideographic Description Characters":s=>s>=12272&&s<=12287,"CJK Symbols and Punctuation":s=>s>=12288&&s<=12351,Katakana:s=>s>=12448&&s<=12543,Kanbun:s=>s>=12688&&s<=12703,"CJK Strokes":s=>s>=12736&&s<=12783,"Enclosed CJK Letters and Months":s=>s>=12800&&s<=13055,"CJK Compatibility":s=>s>=13056&&s<=13311,"Yijing Hexagram Symbols":s=>s>=19904&&s<=19967,"Private Use Area":s=>s>=57344&&s<=63743,"Vertical Forms":s=>s>=65040&&s<=65055,"CJK Compatibility Forms":s=>s>=65072&&s<=65103,"Small Form Variants":s=>s>=65104&&s<=65135,"Halfwidth and Fullwidth Forms":s=>s>=65280&&s<=65519};function Dd(s){for(const n of s)if(Rd(n.charCodeAt(0)))return!0;return!1}function X_(s){for(const n of s)if(!nl(n.charCodeAt(0)))return!1;return!0}function zd(s){const n=s.map(a=>{try{return new RegExp(`\\p{sc=${a}}`,"u").source}catch{return null}}).filter(a=>a);return new RegExp(n.join("|"),"u")}const K_=zd(["Arab","Dupl","Mong","Ougr","Syrc"]);function nl(s){return!K_.test(String.fromCodePoint(s))}const om=zd(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Rd(s){return!(s!==746&&s!==747&&(s<4352||!(ur["CJK Compatibility Forms"](s)&&!(s>=65097&&s<=65103)||ur["CJK Compatibility"](s)||ur["CJK Strokes"](s)||!(!ur["CJK Symbols and Punctuation"](s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||ur["Enclosed CJK Letters and Months"](s)||ur["Ideographic Description Characters"](s)||ur.Kanbun(s)||ur.Katakana(s)&&s!==12540||!(!ur["Halfwidth and Fullwidth Forms"](s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!ur["Small Form Variants"](s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||ur["Vertical Forms"](s)||ur["Yijing Hexagram Symbols"](s)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(s))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(s))||om.test(String.fromCodePoint(s)))))}function am(s){return!(Rd(s)||function(n){return!!(ur["Latin-1 Supplement"](n)&&(n===167||n===169||n===174||n===177||n===188||n===189||n===190||n===215||n===247)||ur["General Punctuation"](n)&&(n===8214||n===8224||n===8225||n===8240||n===8241||n===8251||n===8252||n===8258||n===8263||n===8264||n===8265||n===8273)||ur["Letterlike Symbols"](n)||ur["Number Forms"](n)||ur["Miscellaneous Technical"](n)&&(n>=8960&&n<=8967||n>=8972&&n<=8991||n>=8996&&n<=9e3||n===9003||n>=9085&&n<=9114||n>=9150&&n<=9165||n===9167||n>=9169&&n<=9179||n>=9186&&n<=9215)||ur["Control Pictures"](n)&&n!==9251||ur["Optical Character Recognition"](n)||ur["Enclosed Alphanumerics"](n)||ur["Geometric Shapes"](n)||ur["Miscellaneous Symbols"](n)&&!(n>=9754&&n<=9759)||ur["Miscellaneous Symbols and Arrows"](n)&&(n>=11026&&n<=11055||n>=11088&&n<=11097||n>=11192&&n<=11243)||ur["CJK Symbols and Punctuation"](n)||ur.Katakana(n)||ur["Private Use Area"](n)||ur["CJK Compatibility Forms"](n)||ur["Small Form Variants"](n)||ur["Halfwidth and Fullwidth Forms"](n)||n===8734||n===8756||n===8757||n>=9984&&n<=10087||n>=10102&&n<=10131||n===65532||n===65533)}(s))}const J_=zd(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Ld(s){return J_.test(String.fromCodePoint(s))}function Q_(s,n){return!(!n&&Ld(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||ur.Khmer(s))}function e0(s){for(const n of s)if(Ld(n.charCodeAt(0)))return!0;return!1}const Ri=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(s){this.pluginStatus=s.pluginStatus,this.pluginURL=s.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(s){this.applyArabicShaping=s.applyArabicShaping,this.processBidirectionalText=s.processBidirectionalText,this.processStyledBidirectionalText=s.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Vr{constructor(n,a){this.zoom=n,a?(this.now=a.now,this.fadeDuration=a.fadeDuration,this.zoomHistory=a.zoomHistory,this.transition=a.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ad,this.transition={})}isSupportedScript(n){return function(a,d){for(const y of a)if(!Q_(y.charCodeAt(0),d))return!1;return!0}(n,Ri.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const n=this.zoom,a=n-Math.floor(n),d=this.crossFadingFactor();return n>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:a+(1-a)*d}:{fromScale:.5,toScale:1,t:1-(1-d)*a}}}class il{constructor(n,a){this.property=n,this.value=a,this.expression=function(d,y){if(dc(d))return new Ka(d,y);if(mc(d)){const x=gd(d,y);if(x.result==="error")throw new Error(x.value.map(w=>`${w.key}: ${w.message}`).join(", "));return x.value}{let x=d;return y.type==="color"&&typeof d=="string"?x=Ar.parse(d):y.type!=="padding"||typeof d!="number"&&!Array.isArray(d)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(d)&&(x=Xi.parse(d)):x=Ai.parse(d),{kind:"constant",evaluate:()=>x}}}(a===void 0?n.specification.default:a,n.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(n,a,d){return this.property.possiblyEvaluate(this,n,a,d)}}class Tc{constructor(n){this.property=n,this.value=new il(n,void 0)}transitioned(n,a){return new lm(this.property,this.value,a,ge({},n.transition,this.transition),n.now)}untransitioned(){return new lm(this.property,this.value,null,{},0)}}class Ec{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitionablePropertyValues)}getValue(n){return it(this._values[n].value.value)}setValue(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new Tc(this._values[n].property)),this._values[n].value=new il(this._values[n].property,a===null?void 0:it(a))}getTransition(n){return it(this._values[n].transition)}setTransition(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new Tc(this._values[n].property)),this._values[n].transition=it(a)||void 0}serialize(){const n={};for(const a of Object.keys(this._values)){const d=this.getValue(a);d!==void 0&&(n[a]=d);const y=this.getTransition(a);y!==void 0&&(n[`${a}-transition`]=y)}return n}transitioned(n,a){const d=new lu(this._properties);for(const y of Object.keys(this._values))d._values[y]=this._values[y].transitioned(n,a._values[y]);return d}untransitioned(){const n=new lu(this._properties);for(const a of Object.keys(this._values))n._values[a]=this._values[a].untransitioned();return n}}class lm{constructor(n,a,d,y,x){this.property=n,this.value=a,this.begin=x+y.delay||0,this.end=this.begin+y.duration||0,n.specification.transition&&(y.delay||y.duration)&&(this.prior=d)}possiblyEvaluate(n,a,d){const y=n.now||0,x=this.value.possiblyEvaluate(n,a,d),w=this.prior;if(w){if(y>this.end)return this.prior=null,x;if(this.value.isDataDriven())return this.prior=null,x;if(y=1)return 1;const I=k*k,D=I*k;return 4*(k<.5?D:3*(k-I)+D-.75)}(b))}}return x}}class lu{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitioningPropertyValues)}possiblyEvaluate(n,a,d){const y=new cu(this._properties);for(const x of Object.keys(this._values))y._values[x]=this._values[x].possiblyEvaluate(n,a,d);return y}hasTransition(){for(const n of Object.keys(this._values))if(this._values[n].prior)return!0;return!1}}class uu{constructor(n){this._properties=n,this._values=Object.create(n.defaultPropertyValues)}hasValue(n){return this._values[n].value!==void 0}getValue(n){return it(this._values[n].value)}setValue(n,a){this._values[n]=new il(this._values[n].property,a===null?void 0:it(a))}serialize(){const n={};for(const a of Object.keys(this._values)){const d=this.getValue(a);d!==void 0&&(n[a]=d)}return n}possiblyEvaluate(n,a,d){const y=new cu(this._properties);for(const x of Object.keys(this._values))y._values[x]=this._values[x].possiblyEvaluate(n,a,d);return y}}class Hs{constructor(n,a,d){this.property=n,this.value=a,this.parameters=d}isConstant(){return this.value.kind==="constant"}constantOr(n){return this.value.kind==="constant"?this.value.value:n}evaluate(n,a,d,y){return this.property.evaluate(this.value,this.parameters,n,a,d,y)}}class cu{constructor(n){this._properties=n,this._values=Object.create(n.defaultPossiblyEvaluatedValues)}get(n){return this._values[n]}}class It{constructor(n){this.specification=n}possiblyEvaluate(n,a){if(n.isDataDriven())throw new Error("Value should not be data driven");return n.expression.evaluate(a)}interpolate(n,a,d){const y=gi[this.specification.type];return y?y(n,a,d):n}}class jt{constructor(n,a){this.specification=n,this.overrides=a}possiblyEvaluate(n,a,d,y){return new Hs(this,n.expression.kind==="constant"||n.expression.kind==="camera"?{kind:"constant",value:n.expression.evaluate(a,null,{},d,y)}:n.expression,a)}interpolate(n,a,d){if(n.value.kind!=="constant"||a.value.kind!=="constant")return n;if(n.value.value===void 0||a.value.value===void 0)return new Hs(this,{kind:"constant",value:void 0},n.parameters);const y=gi[this.specification.type];if(y){const x=y(n.value.value,a.value.value,d);return new Hs(this,{kind:"constant",value:x},n.parameters)}return n}evaluate(n,a,d,y,x,w){return n.kind==="constant"?n.value:n.evaluate(a,d,y,x,w)}}class Cc extends jt{possiblyEvaluate(n,a,d,y){if(n.value===void 0)return new Hs(this,{kind:"constant",value:void 0},a);if(n.expression.kind==="constant"){const x=n.expression.evaluate(a,null,{},d,y),w=n.property.specification.type==="resolvedImage"&&typeof x!="string"?x.name:x,b=this._calculate(w,w,w,a);return new Hs(this,{kind:"constant",value:b},a)}if(n.expression.kind==="camera"){const x=this._calculate(n.expression.evaluate({zoom:a.zoom-1}),n.expression.evaluate({zoom:a.zoom}),n.expression.evaluate({zoom:a.zoom+1}),a);return new Hs(this,{kind:"constant",value:x},a)}return new Hs(this,n.expression,a)}evaluate(n,a,d,y,x,w){if(n.kind==="source"){const b=n.evaluate(a,d,y,x,w);return this._calculate(b,b,b,a)}return n.kind==="composite"?this._calculate(n.evaluate({zoom:Math.floor(a.zoom)-1},d,y),n.evaluate({zoom:Math.floor(a.zoom)},d,y),n.evaluate({zoom:Math.floor(a.zoom)+1},d,y),a):n.value}_calculate(n,a,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:d,to:a}}interpolate(n){return n}}class Ic{constructor(n){this.specification=n}possiblyEvaluate(n,a,d,y){if(n.value!==void 0){if(n.expression.kind==="constant"){const x=n.expression.evaluate(a,null,{},d,y);return this._calculate(x,x,x,a)}return this._calculate(n.expression.evaluate(new Vr(Math.floor(a.zoom-1),a)),n.expression.evaluate(new Vr(Math.floor(a.zoom),a)),n.expression.evaluate(new Vr(Math.floor(a.zoom+1),a)),a)}}_calculate(n,a,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:d,to:a}}interpolate(n){return n}}class Od{constructor(n){this.specification=n}possiblyEvaluate(n,a,d,y){return!!n.expression.evaluate(a,null,{},d,y)}interpolate(){return!1}}class v{constructor(n){this.properties=n,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const a in n){const d=n[a];d.specification.overridable&&this.overridableProperties.push(a);const y=this.defaultPropertyValues[a]=new il(d,void 0),x=this.defaultTransitionablePropertyValues[a]=new Tc(d);this.defaultTransitioningPropertyValues[a]=x.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=y.possiblyEvaluate({})}}}St("DataDrivenProperty",jt),St("DataConstantProperty",It),St("CrossFadedDataDrivenProperty",Cc),St("CrossFadedProperty",Ic),St("ColorRampProperty",Od);const r="-transition";class u extends je{constructor(n,a){if(super(),this.id=n.id,this.type=n.type,this._featureFilter={filter:()=>!0,needGeometry:!1},n.type!=="custom"&&(this.metadata=n.metadata,this.minzoom=n.minzoom,this.maxzoom=n.maxzoom,n.type!=="background"&&(this.source=n.source,this.sourceLayer=n["source-layer"],this.filter=n.filter),a.layout&&(this._unevaluatedLayout=new uu(a.layout)),a.paint)){this._transitionablePaint=new Ec(a.paint);for(const d in n.paint)this.setPaintProperty(d,n.paint[d],{validate:!1});for(const d in n.layout)this.setLayoutProperty(d,n.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new cu(a.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(n){return n==="visibility"?this.visibility:this._unevaluatedLayout.getValue(n)}setLayoutProperty(n,a,d={}){a!=null&&this._validate(im,`layers.${this.id}.layout.${n}`,n,a,d)||(n!=="visibility"?this._unevaluatedLayout.setValue(n,a):this.visibility=a)}getPaintProperty(n){return n.endsWith(r)?this._transitionablePaint.getTransition(n.slice(0,-11)):this._transitionablePaint.getValue(n)}setPaintProperty(n,a,d={}){if(a!=null&&this._validate(nm,`layers.${this.id}.paint.${n}`,n,a,d))return!1;if(n.endsWith(r))return this._transitionablePaint.setTransition(n.slice(0,-11),a||void 0),!1;{const y=this._transitionablePaint._values[n],x=y.property.specification["property-type"]==="cross-faded-data-driven",w=y.value.isDataDriven(),b=y.value;this._transitionablePaint.setValue(n,a),this._handleSpecialPaintPropertyUpdate(n);const k=this._transitionablePaint._values[n].value;return k.isDataDriven()||w||x||this._handleOverridablePaintPropertyUpdate(n,b,k)}}_handleSpecialPaintPropertyUpdate(n){}_handleOverridablePaintPropertyUpdate(n,a,d){return!1}isHidden(n){return!!(this.minzoom&&n=this.maxzoom)||this.visibility==="none"}updateTransitions(n){this._transitioningPaint=this._transitionablePaint.transitioned(n,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(n,a){n.getCrossfadeParameters&&(this._crossfadeParameters=n.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(n,void 0,a)),this.paint=this._transitioningPaint.possiblyEvaluate(n,void 0,a)}serialize(){const n={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&&(n.layout=n.layout||{},n.layout.visibility=this.visibility),We(n,(a,d)=>!(a===void 0||d==="layout"&&!Object.keys(a).length||d==="paint"&&!Object.keys(a).length))}_validate(n,a,d,y,x={}){return(!x||x.validate!==!1)&&Pd(this,n.call(la,{key:a,layerType:this.type,objectKey:d,value:y,styleSpec:ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const n in this.paint._values){const a=this.paint.get(n);if(a instanceof Hs&&Ga(a.property.specification)&&(a.value.kind==="source"||a.value.kind==="composite")&&a.value.isStateDependent)return!0}return!1}}const p={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class m{constructor(n,a){this._structArray=n,this._pos1=a*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class _{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(n,a){return n._trim(),a&&(n.isTransferred=!0,a.push(n.arrayBuffer)),{length:n.length,arrayBuffer:n.arrayBuffer}}static deserialize(n){const a=Object.create(this.prototype);return a.arrayBuffer=n.arrayBuffer,a.length=n.length,a.capacity=n.arrayBuffer.byteLength/a.bytesPerElement,a._refreshViews(),a}_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(n){this.reserve(n),this.length=n}reserve(n){if(n>this.capacity){this.capacity=Math.max(n,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const a=this.uint8;this._refreshViews(),a&&this.uint8.set(a)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function S(s,n=1){let a=0,d=0;return{members:s.map(y=>{const x=p[y.type].BYTES_PER_ELEMENT,w=a=E(a,Math.max(n,x)),b=y.components||1;return d=Math.max(d,x),a+=x*b,{name:y.name,type:y.type,components:b,offset:w}}),size:E(a,Math.max(d,n)),alignment:n}}function E(s,n){return Math.ceil(s/n)*n}class C extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.int16[y+0]=a,this.int16[y+1]=d,n}}C.prototype.bytesPerElement=4,St("StructArrayLayout2i4",C);class z extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.int16[x+0]=a,this.int16[x+1]=d,this.int16[x+2]=y,n}}z.prototype.bytesPerElement=6,St("StructArrayLayout3i6",z);class F extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y){const x=this.length;return this.resize(x+1),this.emplace(x,n,a,d,y)}emplace(n,a,d,y,x){const w=4*n;return this.int16[w+0]=a,this.int16[w+1]=d,this.int16[w+2]=y,this.int16[w+3]=x,n}}F.prototype.bytesPerElement=8,St("StructArrayLayout4i8",F);class B extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=6*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.int16[k+2]=y,this.int16[k+3]=x,this.int16[k+4]=w,this.int16[k+5]=b,n}}B.prototype.bytesPerElement=12,St("StructArrayLayout2i4i12",B);class X extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=4*n,I=8*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.uint8[I+4]=y,this.uint8[I+5]=x,this.uint8[I+6]=w,this.uint8[I+7]=b,n}}X.prototype.bytesPerElement=8,St("StructArrayLayout2i4ub8",X);class Q extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.float32[y+0]=a,this.float32[y+1]=d,n}}Q.prototype.bytesPerElement=8,St("StructArrayLayout2f8",Q);class re extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w,b,k,I,D){const L=this.length;return this.resize(L+1),this.emplace(L,n,a,d,y,x,w,b,k,I,D)}emplace(n,a,d,y,x,w,b,k,I,D,L){const U=10*n;return this.uint16[U+0]=a,this.uint16[U+1]=d,this.uint16[U+2]=y,this.uint16[U+3]=x,this.uint16[U+4]=w,this.uint16[U+5]=b,this.uint16[U+6]=k,this.uint16[U+7]=I,this.uint16[U+8]=D,this.uint16[U+9]=L,n}}re.prototype.bytesPerElement=20,St("StructArrayLayout10ui20",re);class ce extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w,b,k,I,D,L,U){const Z=this.length;return this.resize(Z+1),this.emplace(Z,n,a,d,y,x,w,b,k,I,D,L,U)}emplace(n,a,d,y,x,w,b,k,I,D,L,U,Z){const K=12*n;return this.int16[K+0]=a,this.int16[K+1]=d,this.int16[K+2]=y,this.int16[K+3]=x,this.uint16[K+4]=w,this.uint16[K+5]=b,this.uint16[K+6]=k,this.uint16[K+7]=I,this.int16[K+8]=D,this.int16[K+9]=L,this.int16[K+10]=U,this.int16[K+11]=Z,n}}ce.prototype.bytesPerElement=24,St("StructArrayLayout4i4ui4i24",ce);class pe extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.float32[x+0]=a,this.float32[x+1]=d,this.float32[x+2]=y,n}}pe.prototype.bytesPerElement=12,St("StructArrayLayout3f12",pe);class me extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint32[1*n+0]=a,n}}me.prototype.bytesPerElement=4,St("StructArrayLayout1ul4",me);class we extends _{_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(n,a,d,y,x,w,b,k,I){const D=this.length;return this.resize(D+1),this.emplace(D,n,a,d,y,x,w,b,k,I)}emplace(n,a,d,y,x,w,b,k,I,D){const L=10*n,U=5*n;return this.int16[L+0]=a,this.int16[L+1]=d,this.int16[L+2]=y,this.int16[L+3]=x,this.int16[L+4]=w,this.int16[L+5]=b,this.uint32[U+3]=k,this.uint16[L+8]=I,this.uint16[L+9]=D,n}}we.prototype.bytesPerElement=20,St("StructArrayLayout6i1ul2ui20",we);class ae extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=6*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.int16[k+2]=y,this.int16[k+3]=x,this.int16[k+4]=w,this.int16[k+5]=b,n}}ae.prototype.bytesPerElement=12,St("StructArrayLayout2i2i2i12",ae);class Ce extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x){const w=this.length;return this.resize(w+1),this.emplace(w,n,a,d,y,x)}emplace(n,a,d,y,x,w){const b=4*n,k=8*n;return this.float32[b+0]=a,this.float32[b+1]=d,this.float32[b+2]=y,this.int16[k+6]=x,this.int16[k+7]=w,n}}Ce.prototype.bytesPerElement=16,St("StructArrayLayout2f1f2i16",Ce);class Pe extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=16*n,I=4*n,D=8*n;return this.uint8[k+0]=a,this.uint8[k+1]=d,this.float32[I+1]=y,this.float32[I+2]=x,this.int16[D+6]=w,this.int16[D+7]=b,n}}Pe.prototype.bytesPerElement=16,St("StructArrayLayout2ub2f2i16",Pe);class ze extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.uint16[x+0]=a,this.uint16[x+1]=d,this.uint16[x+2]=y,n}}ze.prototype.bytesPerElement=6,St("StructArrayLayout3ui6",ze);class Ye extends _{_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(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe){const De=this.length;return this.resize(De+1),this.emplace(De,n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe)}emplace(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De){const be=24*n,Me=12*n,Ve=48*n;return this.int16[be+0]=a,this.int16[be+1]=d,this.uint16[be+2]=y,this.uint16[be+3]=x,this.uint32[Me+2]=w,this.uint32[Me+3]=b,this.uint32[Me+4]=k,this.uint16[be+10]=I,this.uint16[be+11]=D,this.uint16[be+12]=L,this.float32[Me+7]=U,this.float32[Me+8]=Z,this.uint8[Ve+36]=K,this.uint8[Ve+37]=J,this.uint8[Ve+38]=le,this.uint32[Me+10]=fe,this.int16[be+22]=De,n}}Ye.prototype.bytesPerElement=48,St("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ye);class st extends _{_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(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt){const bt=this.length;return this.resize(bt+1),this.emplace(bt,n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt)}emplace(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt,bt){const qe=32*n,Dt=16*n;return this.int16[qe+0]=a,this.int16[qe+1]=d,this.int16[qe+2]=y,this.int16[qe+3]=x,this.int16[qe+4]=w,this.int16[qe+5]=b,this.int16[qe+6]=k,this.int16[qe+7]=I,this.uint16[qe+8]=D,this.uint16[qe+9]=L,this.uint16[qe+10]=U,this.uint16[qe+11]=Z,this.uint16[qe+12]=K,this.uint16[qe+13]=J,this.uint16[qe+14]=le,this.uint16[qe+15]=fe,this.uint16[qe+16]=De,this.uint16[qe+17]=be,this.uint16[qe+18]=Me,this.uint16[qe+19]=Ve,this.uint16[qe+20]=et,this.uint16[qe+21]=xt,this.uint16[qe+22]=Nt,this.uint32[Dt+12]=yt,this.float32[Dt+13]=pt,this.float32[Dt+14]=At,this.uint16[qe+30]=Tt,this.uint16[qe+31]=bt,n}}st.prototype.bytesPerElement=64,St("StructArrayLayout8i15ui1ul2f2ui64",st);class gt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.float32[1*n+0]=a,n}}gt.prototype.bytesPerElement=4,St("StructArrayLayout1f4",gt);class wt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.uint16[6*n+0]=a,this.float32[x+1]=d,this.float32[x+2]=y,n}}wt.prototype.bytesPerElement=12,St("StructArrayLayout1ui2f12",wt);class dt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=4*n;return this.uint32[2*n+0]=a,this.uint16[x+2]=d,this.uint16[x+3]=y,n}}dt.prototype.bytesPerElement=8,St("StructArrayLayout1ul2ui8",dt);class ct extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.uint16[y+0]=a,this.uint16[y+1]=d,n}}ct.prototype.bytesPerElement=4,St("StructArrayLayout2ui4",ct);class Pt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint16[1*n+0]=a,n}}Pt.prototype.bytesPerElement=2,St("StructArrayLayout1ui2",Pt);class qt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d,y){const x=this.length;return this.resize(x+1),this.emplace(x,n,a,d,y)}emplace(n,a,d,y,x){const w=4*n;return this.float32[w+0]=a,this.float32[w+1]=d,this.float32[w+2]=y,this.float32[w+3]=x,n}}qt.prototype.bytesPerElement=16,St("StructArrayLayout4f16",qt);class ft extends m{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)}}ft.prototype.size=20;class _t extends we{get(n){return new ft(this,n)}}St("CollisionBoxArray",_t);class Gt extends m{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(n){this._structArray.uint8[this._pos1+37]=n}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(n){this._structArray.uint8[this._pos1+38]=n}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(n){this._structArray.uint32[this._pos4+10]=n}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Gt.prototype.size=48;class Hr extends Ye{get(n){return new Gt(this,n)}}St("PlacedSymbolArray",Hr);class tr extends m{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(n){this._structArray.uint32[this._pos4+12]=n}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}tr.prototype.size=64;class ar extends st{get(n){return new tr(this,n)}}St("SymbolInstanceArray",ar);class Wr extends gt{getoffsetX(n){return this.float32[1*n+0]}}St("GlyphOffsetArray",Wr);class Gn extends z{getx(n){return this.int16[3*n+0]}gety(n){return this.int16[3*n+1]}gettileUnitDistanceFromAnchor(n){return this.int16[3*n+2]}}St("SymbolLineVertexArray",Gn);class xs extends m{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}xs.prototype.size=12;class Gr extends wt{get(n){return new xs(this,n)}}St("TextAnchorOffsetArray",Gr);class _i extends m{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]}}_i.prototype.size=8;class ii extends dt{get(n){return new _i(this,n)}}St("FeatureIndexArray",ii);class Zn extends C{}class si extends C{}class Ws extends C{}class sl extends B{}class Pc extends X{}class ol extends Q{}class es extends re{}class Mc extends ce{}class Fd extends pe{}class ts extends me{}class rs extends ae{}class Ao extends Pe{}class ws extends ze{}class Nn extends ct{}const qn=S([{name:"a_pos",components:2,type:"Int16"}],4),{members:Li}=qn;class cr{constructor(n=[]){this.segments=n}prepareSegment(n,a,d,y){let x=this.segments[this.segments.length-1];return n>cr.MAX_VERTEX_ARRAY_LENGTH&&Ue(`Max vertices per segment is ${cr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${n}`),(!x||x.vertexLength+n>cr.MAX_VERTEX_ARRAY_LENGTH||x.sortKey!==y)&&(x={vertexOffset:a.length,primitiveOffset:d.length,vertexLength:0,primitiveLength:0},y!==void 0&&(x.sortKey=y),this.segments.push(x)),x}get(){return this.segments}destroy(){for(const n of this.segments)for(const a in n.vaos)n.vaos[a].destroy()}static simpleSegment(n,a,d,y){return new cr([{vertexOffset:n,primitiveOffset:a,vertexLength:d,primitiveLength:y,vaos:{},sortKey:0}])}}function ua(s,n){return 256*(s=oe(Math.floor(s),0,255))+oe(Math.floor(n),0,255)}cr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,St("SegmentVector",cr);const al=S([{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 ll={exports:{}},um={exports:{}};um.exports=function(s,n){var a,d,y,x,w,b,k,I;for(d=s.length-(a=3&s.length),y=n,w=3432918353,b=461845907,I=0;I>>16)*w&65535)<<16)&4294967295)<<15|k>>>17))*b+(((k>>>16)*b&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(x>>>16)&65535)<<16);switch(k=0,a){case 3:k^=(255&s.charCodeAt(I+2))<<16;case 2:k^=(255&s.charCodeAt(I+1))<<8;case 1:y^=k=(65535&(k=(k=(65535&(k^=255&s.charCodeAt(I)))*w+(((k>>>16)*w&65535)<<16)&4294967295)<<15|k>>>17))*b+(((k>>>16)*b&65535)<<16)&4294967295}return y^=s.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var t0=um.exports,cm={exports:{}};cm.exports=function(s,n){for(var a,d=s.length,y=n^d,x=0;d>=4;)a=1540483477*(65535&(a=255&s.charCodeAt(x)|(255&s.charCodeAt(++x))<<8|(255&s.charCodeAt(++x))<<16|(255&s.charCodeAt(++x))<<24))+((1540483477*(a>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),d-=4,++x;switch(d){case 3:y^=(255&s.charCodeAt(x+2))<<16;case 2:y^=(255&s.charCodeAt(x+1))<<8;case 1:y=1540483477*(65535&(y^=255&s.charCodeAt(x)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var Do=t0,hm=cm.exports;ll.exports=Do,ll.exports.murmur3=Do,ll.exports.murmur2=hm;var Ac=T(ll.exports);class hu{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(n,a,d,y){this.ids.push(Dc(n)),this.positions.push(a,d,y)}getPositions(n){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const a=Dc(n);let d=0,y=this.ids.length-1;for(;d>1;this.ids[w]>=a?y=w:d=w+1}const x=[];for(;this.ids[d]===a;)x.push({index:this.positions[3*d],start:this.positions[3*d+1],end:this.positions[3*d+2]}),d++;return x}static serialize(n,a){const d=new Float64Array(n.ids),y=new Uint32Array(n.positions);return zc(d,y,0,d.length-1),a&&a.push(d.buffer,y.buffer),{ids:d,positions:y}}static deserialize(n){const a=new hu;return a.ids=n.ids,a.positions=n.positions,a.indexed=!0,a}}function Dc(s){const n=+s;return!isNaN(n)&&n<=Number.MAX_SAFE_INTEGER?n:Ac(String(s))}function zc(s,n,a,d){for(;a>1];let x=a-1,w=d+1;for(;;){do x++;while(s[x]y);if(x>=w)break;ul(s,x,w),ul(n,3*x,3*w),ul(n,3*x+1,3*w+1),ul(n,3*x+2,3*w+2)}w-a`u_${y}`),this.type=d}setUniform(n,a,d){n.set(d.constantOr(this.value))}getBinding(n,a,d){return this.type==="color"?new _b(n,a):new dm(n,a)}}class Rc{constructor(n,a){this.uniformNames=a.map(d=>`u_${d}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(n,a){this.pixelRatioFrom=a.pixelRatio,this.pixelRatioTo=n.pixelRatio,this.patternFrom=a.tlbr,this.patternTo=n.tlbr}setUniform(n,a,d,y){const x=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;x&&n.set(x)}getBinding(n,a,d){return d.substr(0,9)==="u_pattern"?new yb(n,a):new dm(n,a)}}class ca{constructor(n,a,d,y){this.expression=n,this.type=d,this.maxValue=0,this.paintVertexAttributes=a.map(x=>({name:`a_${x}`,type:"Float32",components:d==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(n,a,d,y,x){const w=this.paintVertexArray.length,b=this.expression.evaluate(new Vr(0),a,{},y,[],x);this.paintVertexArray.resize(n),this._setPaintValue(w,n,b)}updatePaintArray(n,a,d,y){const x=this.expression.evaluate({zoom:0},d,y);this._setPaintValue(n,a,x)}_setPaintValue(n,a,d){if(this.type==="color"){const y=r0(d);for(let x=n;x`u_${b}_t`),this.type=d,this.useIntegerZoom=y,this.zoom=x,this.maxValue=0,this.paintVertexAttributes=a.map(b=>({name:`a_${b}`,type:"Float32",components:d==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(n,a,d,y,x){const w=this.expression.evaluate(new Vr(this.zoom),a,{},y,[],x),b=this.expression.evaluate(new Vr(this.zoom+1),a,{},y,[],x),k=this.paintVertexArray.length;this.paintVertexArray.resize(n),this._setPaintValue(k,n,w,b)}updatePaintArray(n,a,d,y){const x=this.expression.evaluate({zoom:this.zoom},d,y),w=this.expression.evaluate({zoom:this.zoom+1},d,y);this._setPaintValue(n,a,x,w)}_setPaintValue(n,a,d,y){if(this.type==="color"){const x=r0(d),w=r0(y);for(let b=n;b`#define HAS_UNIFORM_${y}`))}return n}getBinderAttributes(){const n=[];for(const a in this.binders){const d=this.binders[a];if(d instanceof ca||d instanceof uo)for(let y=0;y!0){this.programConfigurations={};for(const y of n)this.programConfigurations[y.id]=new vb(y,a,d);this.needsUpload=!1,this._featureMap=new hu,this._bufferOffset=0}populatePaintArrays(n,a,d,y,x,w){for(const b in this.programConfigurations)this.programConfigurations[b].populatePaintArrays(n,a,y,x,w);a.id!==void 0&&this._featureMap.add(a.id,d,this._bufferOffset,n),this._bufferOffset=n,this.needsUpload=!0}updatePaintArrays(n,a,d,y){for(const x of d)this.needsUpload=this.programConfigurations[x.id].updatePaintArrays(n,this._featureMap,a,x,y)||this.needsUpload}get(n){return this.programConfigurations[n]}upload(n){if(this.needsUpload){for(const a in this.programConfigurations)this.programConfigurations[a].upload(n);this.needsUpload=!1}}destroy(){for(const n in this.programConfigurations)this.programConfigurations[n].destroy()}}function SA(s,n){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"]}[s]||[s.replace(`${n}-`,"").replace(/-/g,"_")]}function xb(s,n,a){const d={color:{source:Q,composite:qt},number:{source:gt,composite:Q}},y=function(x){return{"line-pattern":{source:es,composite:es},"fill-pattern":{source:es,composite:es},"fill-extrusion-pattern":{source:es,composite:es}}[x]}(s);return y&&y[a]||d[n][a]}St("ConstantBinder",Bd),St("CrossFadedConstantBinder",Rc),St("SourceExpressionBinder",ca),St("CrossFadedCompositeBinder",cl),St("CompositeExpressionBinder",uo),St("ProgramConfiguration",vb,{omit:["_buffers"]}),St("ProgramConfigurationSet",fu);const Cn=8192,n0=Math.pow(2,14)-1,wb=-n0-1;function pu(s){const n=Cn/s.extent,a=s.loadGeometry();for(let d=0;dw.x+1||kw.y+1)&&Ue("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return a}function mu(s,n){return{type:s.type,id:s.id,properties:s.properties,geometry:n?pu(s):[]}}function fm(s,n,a,d,y){s.emplaceBack(2*n+(d+1)/2,2*a+(y+1)/2)}class i0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new si,this.indexArray=new ws,this.segments=new cr,this.programConfigurations=new fu(n.layers,n.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){const y=this.layers[0],x=[];let w=null,b=!1;y.type==="circle"&&(w=y.layout.get("circle-sort-key"),b=!w.isConstant());for(const{feature:k,id:I,index:D,sourceLayerIndex:L}of n){const U=this.layers[0]._featureFilter.needGeometry,Z=mu(k,U);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),Z,d))continue;const K=b?w.evaluate(Z,{},d):void 0,J={id:I,properties:k.properties,type:k.type,sourceLayerIndex:L,index:D,geometry:U?Z.geometry:pu(k),patterns:{},sortKey:K};x.push(J)}b&&x.sort((k,I)=>k.sortKey-I.sortKey);for(const k of x){const{geometry:I,index:D,sourceLayerIndex:L}=k,U=n[D].feature;this.addFeature(k,I,D,d),a.featureIndex.insert(U,I,D,L,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Li),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(n,a,d,y){for(const x of a)for(const w of x){const b=w.x,k=w.y;if(b<0||b>=Cn||k<0||k>=Cn)continue;const I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,n.sortKey),D=I.vertexLength;fm(this.layoutVertexArray,b,k,-1,-1),fm(this.layoutVertexArray,b,k,1,-1),fm(this.layoutVertexArray,b,k,1,1),fm(this.layoutVertexArray,b,k,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),I.vertexLength+=4,I.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,{},y)}}function bb(s,n){for(let a=0;a1){if(s0(s,n))return!0;for(let d=0;d1?a:a.sub(n)._mult(y)._add(n))}function Tb(s,n){let a,d,y,x=!1;for(let w=0;wn.y!=y.y>n.y&&n.x<(y.x-d.x)*(n.y-d.y)/(y.y-d.y)+d.x&&(x=!x)}return x}function Lc(s,n){let a=!1;for(let d=0,y=s.length-1;dn.y!=w.y>n.y&&n.x<(w.x-x.x)*(n.y-x.y)/(w.y-x.y)+x.x&&(a=!a)}return a}function CA(s,n,a){const d=a[0],y=a[2];if(s.xy.x&&n.x>y.x||s.yy.y&&n.y>y.y)return!1;const x=H(s,n,a[0]);return x!==H(s,n,a[1])||x!==H(s,n,a[2])||x!==H(s,n,a[3])}function Nd(s,n,a){const d=n.paint.get(s).value;return d.kind==="constant"?d.value:a.programConfigurations.get(n.id).getMaxValue(s)}function pm(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function mm(s,n,a,d,y){if(!n[0]&&!n[1])return s;const x=A.convert(n)._mult(y);a==="viewport"&&x._rotate(-d);const w=[];for(let b=0;bPb(le,J))}(I,k),Z=L?D*b:D;for(const K of y)for(const J of K){const le=L?J:Pb(J,k);let fe=Z;const De=gm([],[J.x,J.y,0,1],k);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?fe*=De[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(fe*=w.cameraToCenterDistance/De[3]),kA(U,le,fe))return!0}return!1}}function Pb(s,n){const a=gm([],[s.x,s.y,0,1],n);return new A(a[0]/a[3],a[1]/a[3])}class Mb extends i0{}let Ab;St("HeatmapBucket",Mb,{omit:["layers"]});var AA={get paint(){return Ab=Ab||new v({"heatmap-radius":new jt(ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new jt(ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new It(ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Od(ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new It(ie.paint_heatmap["heatmap-opacity"])})}};function l0(s,{width:n,height:a},d,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==n*a*d)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${n*a*d}`)}else y=new Uint8Array(n*a*d);return s.width=n,s.height=a,s.data=y,s}function Db(s,{width:n,height:a},d){if(n===s.width&&a===s.height)return;const y=l0({},{width:n,height:a},d);u0(s,y,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,n),height:Math.min(s.height,a)},d),s.width=n,s.height=a,s.data=y.data}function u0(s,n,a,d,y,x){if(y.width===0||y.height===0)return n;if(y.width>s.width||y.height>s.height||a.x>s.width-y.width||a.y>s.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>n.width||y.height>n.height||d.x>n.width-y.width||d.y>n.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const w=s.data,b=n.data;if(w===b)throw new Error("srcData equals dstData, so image is already copied");for(let k=0;k{n[s.evaluationKey]=k;const I=s.expression.evaluate(n);y.data[w+b+0]=Math.floor(255*I.r/I.a),y.data[w+b+1]=Math.floor(255*I.g/I.a),y.data[w+b+2]=Math.floor(255*I.b/I.a),y.data[w+b+3]=Math.floor(255*I.a)};if(s.clips)for(let w=0,b=0;w80*a){b=1/0,k=1/0;let D=-1/0,L=-1/0;for(let U=a;UD&&(D=Z),K>L&&(L=K)}I=Math.max(D-b,L-k),I=I!==0?32767/I:0}return jd(x,w,a,b,k,I,0),w}function Ob(s,n,a,d,y){let x;if(y===function(w,b,k,I){let D=0;for(let L=b,U=k-I;L0)for(let w=n;w=n;w-=d)x=Nb(w/d|0,s[w],s[w+1],x);return x&&ym(x,x.next)&&(Hd(x),x=x.next),x}function gu(s,n){if(!s)return s;n||(n=s);let a,d=s;do if(a=!1,d.steiner||!ym(d,d.next)&&wn(d.prev,d,d.next)!==0)d=d.next;else{if(Hd(d),d=n=d.prev,d===d.next)break;a=!0}while(a||d!==n);return n}function jd(s,n,a,d,y,x,w){if(!s)return;!w&&x&&function(k,I,D,L){let U=k;do U.z===0&&(U.z=h0(U.x,U.y,I,D,L)),U.prevZ=U.prev,U.nextZ=U.next,U=U.next;while(U!==k);U.prevZ.nextZ=null,U.prevZ=null,function(Z){let K,J=1;do{let le,fe=Z;Z=null;let De=null;for(K=0;fe;){K++;let be=fe,Me=0;for(let et=0;et0||Ve>0&&be;)Me!==0&&(Ve===0||!be||fe.z<=be.z)?(le=fe,fe=fe.nextZ,Me--):(le=be,be=be.nextZ,Ve--),De?De.nextZ=le:Z=le,le.prevZ=De,De=le;fe=be}De.nextZ=null,J*=2}while(K>1)}(U)}(s,d,y,x);let b=s;for(;s.prev!==s.next;){const k=s.prev,I=s.next;if(x?BA(s,d,y,x):FA(s))n.push(k.i,s.i,I.i),Hd(s),s=I.next,b=I.next;else if((s=I)===b){w?w===1?jd(s=NA(gu(s),n),n,a,d,y,x,2):w===2&&$A(s,n,a,d,y,x):jd(gu(s),n,a,d,y,x,1);break}}}function FA(s){const n=s.prev,a=s,d=s.next;if(wn(n,a,d)>=0)return!1;const y=n.x,x=a.x,w=d.x,b=n.y,k=a.y,I=d.y,D=yx?y>w?y:w:x>w?x:w,Z=b>k?b>I?b:I:k>I?k:I;let K=d.next;for(;K!==n;){if(K.x>=D&&K.x<=U&&K.y>=L&&K.y<=Z&&Fc(y,b,x,k,w,I,K.x,K.y)&&wn(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function BA(s,n,a,d){const y=s.prev,x=s,w=s.next;if(wn(y,x,w)>=0)return!1;const b=y.x,k=x.x,I=w.x,D=y.y,L=x.y,U=w.y,Z=bk?b>I?b:I:k>I?k:I,le=D>L?D>U?D:U:L>U?L:U,fe=h0(Z,K,n,a,d),De=h0(J,le,n,a,d);let be=s.prevZ,Me=s.nextZ;for(;be&&be.z>=fe&&Me&&Me.z<=De;){if(be.x>=Z&&be.x<=J&&be.y>=K&&be.y<=le&&be!==y&&be!==w&&Fc(b,D,k,L,I,U,be.x,be.y)&&wn(be.prev,be,be.next)>=0||(be=be.prevZ,Me.x>=Z&&Me.x<=J&&Me.y>=K&&Me.y<=le&&Me!==y&&Me!==w&&Fc(b,D,k,L,I,U,Me.x,Me.y)&&wn(Me.prev,Me,Me.next)>=0))return!1;Me=Me.nextZ}for(;be&&be.z>=fe;){if(be.x>=Z&&be.x<=J&&be.y>=K&&be.y<=le&&be!==y&&be!==w&&Fc(b,D,k,L,I,U,be.x,be.y)&&wn(be.prev,be,be.next)>=0)return!1;be=be.prevZ}for(;Me&&Me.z<=De;){if(Me.x>=Z&&Me.x<=J&&Me.y>=K&&Me.y<=le&&Me!==y&&Me!==w&&Fc(b,D,k,L,I,U,Me.x,Me.y)&&wn(Me.prev,Me,Me.next)>=0)return!1;Me=Me.nextZ}return!0}function NA(s,n){let a=s;do{const d=a.prev,y=a.next.next;!ym(d,y)&&Fb(d,a,a.next,y)&&Vd(d,y)&&Vd(y,d)&&(n.push(d.i,a.i,y.i),Hd(a),Hd(a.next),a=s=y),a=a.next}while(a!==s);return gu(a)}function $A(s,n,a,d,y,x){let w=s;do{let b=w.next.next;for(;b!==w.prev;){if(w.i!==b.i&&WA(w,b)){let k=Bb(w,b);return w=gu(w,w.next),k=gu(k,k.next),jd(w,n,a,d,y,x,0),void jd(k,n,a,d,y,x,0)}b=b.next}w=w.next}while(w!==s)}function UA(s,n){return s.x-n.x}function jA(s,n){const a=function(y,x){let w=x;const b=y.x,k=y.y;let I,D=-1/0;do{if(k<=w.y&&k>=w.next.y&&w.next.y!==w.y){const J=w.x+(k-w.y)*(w.next.x-w.x)/(w.next.y-w.y);if(J<=b&&J>D&&(D=J,I=w.x=w.x&&w.x>=U&&b!==w.x&&Fc(kI.x||w.x===I.x&&VA(I,w)))&&(I=w,K=J)}w=w.next}while(w!==L);return I}(s,n);if(!a)return n;const d=Bb(a,s);return gu(d,d.next),gu(a,a.next)}function VA(s,n){return wn(s.prev,s,n.prev)<0&&wn(n.next,s,s.next)<0}function h0(s,n,a,d,y){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-a)*y|0)|s<<8))|s<<4))|s<<2))|s<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-d)*y|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function HA(s){let n=s,a=s;do(n.x=(s-w)*(x-b)&&(s-w)*(d-b)>=(a-w)*(n-b)&&(a-w)*(x-b)>=(y-w)*(d-b)}function WA(s,n){return s.next.i!==n.i&&s.prev.i!==n.i&&!function(a,d){let y=a;do{if(y.i!==a.i&&y.next.i!==a.i&&y.i!==d.i&&y.next.i!==d.i&&Fb(y,y.next,a,d))return!0;y=y.next}while(y!==a);return!1}(s,n)&&(Vd(s,n)&&Vd(n,s)&&function(a,d){let y=a,x=!1;const w=(a.x+d.x)/2,b=(a.y+d.y)/2;do y.y>b!=y.next.y>b&&y.next.y!==y.y&&w<(y.next.x-y.x)*(b-y.y)/(y.next.y-y.y)+y.x&&(x=!x),y=y.next;while(y!==a);return x}(s,n)&&(wn(s.prev,s,n.prev)||wn(s,n.prev,n))||ym(s,n)&&wn(s.prev,s,s.next)>0&&wn(n.prev,n,n.next)>0)}function wn(s,n,a){return(n.y-s.y)*(a.x-n.x)-(n.x-s.x)*(a.y-n.y)}function ym(s,n){return s.x===n.x&&s.y===n.y}function Fb(s,n,a,d){const y=vm(wn(s,n,a)),x=vm(wn(s,n,d)),w=vm(wn(a,d,s)),b=vm(wn(a,d,n));return y!==x&&w!==b||!(y!==0||!_m(s,a,n))||!(x!==0||!_m(s,d,n))||!(w!==0||!_m(a,s,d))||!(b!==0||!_m(a,n,d))}function _m(s,n,a){return n.x<=Math.max(s.x,a.x)&&n.x>=Math.min(s.x,a.x)&&n.y<=Math.max(s.y,a.y)&&n.y>=Math.min(s.y,a.y)}function vm(s){return s>0?1:s<0?-1:0}function Vd(s,n){return wn(s.prev,s,s.next)<0?wn(s,n,s.next)>=0&&wn(s,s.prev,n)>=0:wn(s,n,s.prev)<0||wn(s,s.next,n)<0}function Bb(s,n){const a=d0(s.i,s.x,s.y),d=d0(n.i,n.x,n.y),y=s.next,x=n.prev;return s.next=n,n.prev=s,a.next=y,y.prev=a,d.next=a,a.prev=d,x.next=d,d.prev=x,d}function Nb(s,n,a,d){const y=d0(s,n,a);return d?(y.next=d.next,y.prev=d,d.next.prev=y,d.next=y):(y.prev=y,y.next=y),y}function Hd(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function d0(s,n,a){return{i:s,x:n,y:a,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function f0(s,n,a){const d=a.patternDependencies;let y=!1;for(const x of n){const w=x.paint.get(`${s}-pattern`);w.isConstant()||(y=!0);const b=w.constantOr(null);b&&(y=!0,d[b.to]=!0,d[b.from]=!0)}return y}function p0(s,n,a,d,y){const x=y.patternDependencies;for(const w of n){const b=w.paint.get(`${s}-pattern`).value;if(b.kind!=="constant"){let k=b.evaluate({zoom:d-1},a,{},y.availableImages),I=b.evaluate({zoom:d},a,{},y.availableImages),D=b.evaluate({zoom:d+1},a,{},y.availableImages);k=k&&k.name?k.name:k,I=I&&I.name?I.name:I,D=D&&D.name?D.name:D,x[k]=!0,x[I]=!0,x[D]=!0,a.patterns[w.id]={min:k,mid:I,max:D}}}return a}class m0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ws,this.indexArray=new ws,this.indexArray2=new Nn,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.segments2=new cr,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.hasPattern=f0("fill",this.layers,a);const y=this.layers[0].layout.get("fill-sort-key"),x=!y.isConstant(),w=[];for(const{feature:b,id:k,index:I,sourceLayerIndex:D}of n){const L=this.layers[0]._featureFilter.needGeometry,U=mu(b,L);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),U,d))continue;const Z=x?y.evaluate(U,{},d,a.availableImages):void 0,K={id:k,properties:b.properties,type:b.type,sourceLayerIndex:D,index:I,geometry:L?U.geometry:pu(b),patterns:{},sortKey:Z};w.push(K)}x&&w.sort((b,k)=>b.sortKey-k.sortKey);for(const b of w){const{geometry:k,index:I,sourceLayerIndex:D}=b;if(this.hasPattern){const L=p0("fill",this.layers,b,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(b,k,I,d,{});a.featureIndex.insert(n[I].feature,k,I,D,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}addFeatures(n,a,d){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,a,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,OA),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.indexBuffer2=n.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(n),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(n,a,d,y,x){for(const w of ac(a,500)){let b=0;for(const Z of w)b+=Z.length;const k=this.segments.prepareSegment(b,this.layoutVertexArray,this.indexArray),I=k.vertexLength,D=[],L=[];for(const Z of w){if(Z.length===0)continue;Z!==w[0]&&L.push(D.length/2);const K=this.segments2.prepareSegment(Z.length,this.layoutVertexArray,this.indexArray2),J=K.vertexLength;this.layoutVertexArray.emplaceBack(Z[0].x,Z[0].y),this.indexArray2.emplaceBack(J+Z.length-1,J),D.push(Z[0].x),D.push(Z[0].y);for(let le=1;le>3}if(y--,d===1||d===2)x+=s.readSVarint(),w+=s.readSVarint(),d===1&&(n&&b.push(n),n=[]),n.push(new KA(x,w));else{if(d!==7)throw new Error("unknown command "+d);n&&n.push(n[0].clone())}}return n&&b.push(n),b},Bc.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var n=s.readVarint()+s.pos,a=1,d=0,y=0,x=0,w=1/0,b=-1/0,k=1/0,I=-1/0;s.pos>3}if(d--,a===1||a===2)(y+=s.readSVarint())b&&(b=y),(x+=s.readSVarint())I&&(I=x);else if(a!==7)throw new Error("unknown command "+a)}return[w,k,b,I]},Bc.prototype.toGeoJSON=function(s,n,a){var d,y,x=this.extent*Math.pow(2,a),w=this.extent*s,b=this.extent*n,k=this.loadGeometry(),I=Bc.types[this.type];function D(Z){for(var K=0;K>3;y=w===1?d.readString():w===2?d.readFloat():w===3?d.readDouble():w===4?d.readVarint64():w===5?d.readVarint():w===6?d.readSVarint():w===7?d.readBoolean():null}return y}(a))}Hb.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var n=this._pbf.readVarint()+this._pbf.pos;return new e3(this._pbf,n,this.extent,this._keys,this._values)};var r3=Vb;function n3(s,n,a){if(s===3){var d=new r3(a,a.readVarint()+a.pos);d.length&&(n[d.name]=d)}}hl.VectorTile=function(s,n){this.layers=s.readFields(n3,{},n)},hl.VectorTileFeature=jb,hl.VectorTileLayer=Vb;const i3=hl.VectorTileFeature.types,g0=Math.pow(2,13);function Wd(s,n,a,d,y,x,w,b){s.emplaceBack(n,a,2*Math.floor(d*g0)+w,y*g0*2,x*g0*2,Math.round(b))}class y0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new sl,this.centroidVertexArray=new Zn,this.indexArray=new ws,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.features=[],this.hasPattern=f0("fill-extrusion",this.layers,a);for(const{feature:y,id:x,index:w,sourceLayerIndex:b}of n){const k=this.layers[0]._featureFilter.needGeometry,I=mu(y,k);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),I,d))continue;const D={id:x,sourceLayerIndex:b,index:w,geometry:k?I.geometry:pu(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(p0("fill-extrusion",this.layers,D,this.zoom,a)):this.addFeature(D,D.geometry,w,d,{}),a.featureIndex.insert(y,D.geometry,w,b,this.index,!0)}}addFeatures(n,a,d){for(const y of this.features){const{geometry:x}=y;this.addFeature(y,x,y.index,a,d)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,XA),this.centroidVertexBuffer=n.createVertexBuffer(this.centroidVertexArray,YA.members,!0),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(n,a,d,y,x){for(const w of ac(a,500)){const b={x:0,y:0,vertexCount:0};let k=0;for(const K of w)k+=K.length;let I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const K of w){if(K.length===0||o3(K))continue;let J=0;for(let le=0;le=1){const De=K[le-1];if(!s3(fe,De)){I.vertexLength+4>cr.MAX_VERTEX_ARRAY_LENGTH&&(I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const be=fe.sub(De)._perp()._unit(),Me=De.dist(fe);J+Me>32768&&(J=0),Wd(this.layoutVertexArray,fe.x,fe.y,be.x,be.y,0,0,J),Wd(this.layoutVertexArray,fe.x,fe.y,be.x,be.y,0,1,J),b.x+=2*fe.x,b.y+=2*fe.y,b.vertexCount+=2,J+=Me,Wd(this.layoutVertexArray,De.x,De.y,be.x,be.y,0,0,J),Wd(this.layoutVertexArray,De.x,De.y,be.x,be.y,0,1,J),b.x+=2*De.x,b.y+=2*De.y,b.vertexCount+=2;const Ve=I.vertexLength;this.indexArray.emplaceBack(Ve,Ve+2,Ve+1),this.indexArray.emplaceBack(Ve+1,Ve+2,Ve+3),I.vertexLength+=4,I.primitiveLength+=2}}}}if(I.vertexLength+k>cr.MAX_VERTEX_ARRAY_LENGTH&&(I=this.segments.prepareSegment(k,this.layoutVertexArray,this.indexArray)),i3[n.type]!=="Polygon")continue;const D=[],L=[],U=I.vertexLength;for(const K of w)if(K.length!==0){K!==w[0]&&L.push(D.length/2);for(let J=0;JCn)||s.y===n.y&&(s.y<0||s.y>Cn)}function o3(s){return s.every(n=>n.x<0)||s.every(n=>n.x>Cn)||s.every(n=>n.y<0)||s.every(n=>n.y>Cn)}let Wb;St("FillExtrusionBucket",y0,{omit:["layers","features"]});var a3={get paint(){return Wb=Wb||new v({"fill-extrusion-opacity":new It(ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new jt(ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new It(ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new It(ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Cc(ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new jt(ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new jt(ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new It(ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class l3 extends u{constructor(n){super(n,a3)}createBucket(n){return new y0(n)}queryRadius(){return pm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(n,a,d,y,x,w,b,k){const I=mm(n,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,b),D=this.paint.get("fill-extrusion-height").evaluate(a,d),L=this.paint.get("fill-extrusion-base").evaluate(a,d),U=function(K,J,le,fe){const De=[];for(const be of K){const Me=[be.x,be.y,0,1];gm(Me,Me,J),De.push(new A(Me[0]/Me[3],Me[1]/Me[3]))}return De}(I,k),Z=function(K,J,le,fe){const De=[],be=[],Me=fe[8]*J,Ve=fe[9]*J,et=fe[10]*J,xt=fe[11]*J,Nt=fe[8]*le,yt=fe[9]*le,pt=fe[10]*le,At=fe[11]*le;for(const Tt of K){const bt=[],qe=[];for(const Dt of Tt){const Mt=Dt.x,Zt=Dt.y,Fr=fe[0]*Mt+fe[4]*Zt+fe[12],Or=fe[1]*Mt+fe[5]*Zt+fe[13],zn=fe[2]*Mt+fe[6]*Zt+fe[14],Gs=fe[3]*Mt+fe[7]*Zt+fe[15],Xn=zn+et,Rn=Gs+xt,xi=Fr+Nt,wi=Or+yt,bi=zn+pt,mn=Gs+At,Ln=new A((Fr+Me)/Rn,(Or+Ve)/Rn);Ln.z=Xn/Rn,bt.push(Ln);const oi=new A(xi/mn,wi/mn);oi.z=bi/mn,qe.push(oi)}De.push(bt),be.push(qe)}return[De,be]}(y,L,D,k);return function(K,J,le){let fe=1/0;Sb(le,J)&&(fe=Gb(le,J[0]));for(let De=0;Dea.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new Pc,this.layoutVertexArray2=new ol,this.indexArray=new ws,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.hasPattern=f0("line",this.layers,a);const y=this.layers[0].layout.get("line-sort-key"),x=!y.isConstant(),w=[];for(const{feature:b,id:k,index:I,sourceLayerIndex:D}of n){const L=this.layers[0]._featureFilter.needGeometry,U=mu(b,L);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),U,d))continue;const Z=x?y.evaluate(U,{},d):void 0,K={id:k,properties:b.properties,type:b.type,sourceLayerIndex:D,index:I,geometry:L?U.geometry:pu(b),patterns:{},sortKey:Z};w.push(K)}x&&w.sort((b,k)=>b.sortKey-k.sortKey);for(const b of w){const{geometry:k,index:I,sourceLayerIndex:D}=b;if(this.hasPattern){const L=p0("line",this.layers,b,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(b,k,I,d,{});a.featureIndex.insert(n[I].feature,k,I,D,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}addFeatures(n,a,d){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,a,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=n.createVertexBuffer(this.layoutVertexArray2,d3)),this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,c3),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(n){if(n.properties&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_end"))return{start:+n.properties.mapbox_clip_start,end:+n.properties.mapbox_clip_end}}addFeature(n,a,d,y,x){const w=this.layers[0].layout,b=w.get("line-join").evaluate(n,{}),k=w.get("line-cap"),I=w.get("line-miter-limit"),D=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(n);for(const L of a)this.addLine(L,n,b,k,I,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,x,y)}addLine(n,a,d,y,x,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let fe=0;fe=2&&n[k-1].equals(n[k-2]);)k--;let I=0;for(;I0;if(xt&&fe>I){const At=U.dist(Z);if(At>2*D){const Tt=U.sub(U.sub(Z)._mult(D/At)._round());this.updateDistance(Z,Tt),this.addCurrentVertex(Tt,J,0,0,L),Z=Tt}}const yt=Z&&K;let pt=yt?d:b?"butt":y;if(yt&&pt==="round"&&(Vex&&(pt="bevel"),pt==="bevel"&&(Ve>2&&(pt="flipbevel"),Ve100)De=le.mult(-1);else{const At=Ve*J.add(le).mag()/J.sub(le).mag();De._perp()._mult(At*(Nt?-1:1))}this.addCurrentVertex(U,De,0,0,L),this.addCurrentVertex(U,De.mult(-1),0,0,L)}else if(pt==="bevel"||pt==="fakeround"){const At=-Math.sqrt(Ve*Ve-1),Tt=Nt?At:0,bt=Nt?0:At;if(Z&&this.addCurrentVertex(U,J,Tt,bt,L),pt==="fakeround"){const qe=Math.round(180*et/Math.PI/20);for(let Dt=1;Dt2*D){const Tt=U.add(K.sub(U)._mult(D/At)._round());this.updateDistance(U,Tt),this.addCurrentVertex(Tt,le,0,0,L),U=Tt}}}}addCurrentVertex(n,a,d,y,x,w=!1){const b=a.y*y-a.x,k=-a.y-a.x*y;this.addHalfVertex(n,a.x+a.y*d,a.y-a.x*d,w,!1,d,x),this.addHalfVertex(n,b,k,w,!0,-y,x),this.distance>Zb/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(n,a,d,y,x,w))}addHalfVertex({x:n,y:a},d,y,x,w,b,k){const I=.5*(this.lineClips?this.scaledDistance*(Zb-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((n<<1)+(x?1:0),(a<<1)+(w?1:0),Math.round(63*d)+128,Math.round(63*y)+128,1+(b===0?0:b<0?-1:1)|(63&I)<<2,I>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=k.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),k.primitiveLength++),w?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(n,a){this.distance+=n.dist(a),this.updateScaledDistance()}}let qb,Yb;St("LineBucket",_0,{omit:["layers","patternFeatures"]});var Xb={get paint(){return Yb=Yb||new v({"line-opacity":new jt(ie.paint_line["line-opacity"]),"line-color":new jt(ie.paint_line["line-color"]),"line-translate":new It(ie.paint_line["line-translate"]),"line-translate-anchor":new It(ie.paint_line["line-translate-anchor"]),"line-width":new jt(ie.paint_line["line-width"]),"line-gap-width":new jt(ie.paint_line["line-gap-width"]),"line-offset":new jt(ie.paint_line["line-offset"]),"line-blur":new jt(ie.paint_line["line-blur"]),"line-dasharray":new Ic(ie.paint_line["line-dasharray"]),"line-pattern":new Cc(ie.paint_line["line-pattern"]),"line-gradient":new Od(ie.paint_line["line-gradient"])})},get layout(){return qb=qb||new v({"line-cap":new It(ie.layout_line["line-cap"]),"line-join":new jt(ie.layout_line["line-join"]),"line-miter-limit":new It(ie.layout_line["line-miter-limit"]),"line-round-limit":new It(ie.layout_line["line-round-limit"]),"line-sort-key":new jt(ie.layout_line["line-sort-key"])})}};class m3 extends jt{possiblyEvaluate(n,a){return a=new Vr(Math.floor(a.zoom),{now:a.now,fadeDuration:a.fadeDuration,zoomHistory:a.zoomHistory,transition:a.transition}),super.possiblyEvaluate(n,a)}evaluate(n,a,d,y){return a=ge({},a,{zoom:Math.floor(a.zoom)}),super.evaluate(n,a,d,y)}}let xm;class g3 extends u{constructor(n){super(n,Xb),this.gradientVersion=0,xm||(xm=new m3(Xb.paint.properties["line-width"].specification),xm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(n){if(n==="line-gradient"){const a=this.gradientExpression();this.stepInterpolant=!!function(d){return d._styleExpression!==void 0}(a)&&a._styleExpression.expression instanceof $a,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(n,a){super.recalculate(n,a),this.paint._values["line-floorwidth"]=xm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,n)}createBucket(n){return new _0(n)}queryRadius(n){const a=n,d=Kb(Nd("line-width",this,a),Nd("line-gap-width",this,a)),y=Nd("line-offset",this,a);return d/2+Math.abs(y)+pm(this.paint.get("line-translate"))}queryIntersectsFeature(n,a,d,y,x,w,b){const k=mm(n,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,b),I=b/2*Kb(this.paint.get("line-width").evaluate(a,d),this.paint.get("line-gap-width").evaluate(a,d)),D=this.paint.get("line-offset").evaluate(a,d);return D&&(y=function(L,U){const Z=[];for(let K=0;K=3){for(let le=0;le0?n+2*s:s}const y3=S([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),_3=S([{name:"a_projected_pos",components:3,type:"Float32"}],4);S([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const v3=S([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);S([{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 Jb=S([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),x3=S([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function w3(s,n,a){return s.sections.forEach(d=>{d.text=function(y,x,w){const b=x.layout.get("text-transform").evaluate(w,{});return b==="uppercase"?y=y.toLocaleUpperCase():b==="lowercase"&&(y=y.toLocaleLowerCase()),Ri.applyArabicShaping&&(y=Ri.applyArabicShaping(y)),y}(d.text,n,a)}),s}S([{name:"triangle",components:3,type:"Uint16"}]),S([{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"}]),S([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),S([{type:"Float32",name:"offsetX"}]),S([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),S([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Zd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Pn=24,Qb=Lr,e2=function(s,n,a,d,y){var x,w,b=8*y-d-1,k=(1<>1,D=-7,L=y-1,U=-1,Z=s[n+L];for(L+=U,x=Z&(1<<-D)-1,Z>>=-D,D+=b;D>0;x=256*x+s[n+L],L+=U,D-=8);for(w=x&(1<<-D)-1,x>>=-D,D+=d;D>0;w=256*w+s[n+L],L+=U,D-=8);if(x===0)x=1-I;else{if(x===k)return w?NaN:1/0*(Z?-1:1);w+=Math.pow(2,d),x-=I}return(Z?-1:1)*w*Math.pow(2,x-d)},t2=function(s,n,a,d,y,x){var w,b,k,I=8*x-y-1,D=(1<>1,U=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,Z=0,K=1,J=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(b=isNaN(n)?1:0,w=D):(w=Math.floor(Math.log(n)/Math.LN2),n*(k=Math.pow(2,-w))<1&&(w--,k*=2),(n+=w+L>=1?U/k:U*Math.pow(2,1-L))*k>=2&&(w++,k/=2),w+L>=D?(b=0,w=D):w+L>=1?(b=(n*k-1)*Math.pow(2,y),w+=L):(b=n*Math.pow(2,L-1)*Math.pow(2,y),w=0));y>=8;s[a+Z]=255&b,Z+=K,b/=256,y-=8);for(w=w<0;s[a+Z]=255&w,Z+=K,w/=256,I-=8);s[a+Z-K]|=128*J};function Lr(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}Lr.Varint=0,Lr.Fixed64=1,Lr.Bytes=2,Lr.Fixed32=5;var v0=4294967296,r2=1/v0,n2=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ha(s){return s.type===Lr.Bytes?s.readVarint()+s.pos:s.pos+1}function Nc(s,n,a){return a?4294967296*n+(s>>>0):4294967296*(n>>>0)+(s>>>0)}function i2(s,n,a){var d=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));a.realloc(d);for(var y=a.pos-1;y>=s;y--)a.buf[y+d]=a.buf[y]}function b3(s,n){for(var a=0;a>>8,s[a+2]=n>>>16,s[a+3]=n>>>24}function s2(s,n){return(s[n]|s[n+1]<<8|s[n+2]<<16)+(s[n+3]<<24)}Lr.prototype={destroy:function(){this.buf=null},readFields:function(s,n,a){for(a=a||this.length;this.pos>3,x=this.pos;this.type=7&d,s(y,n,this),this.pos===x&&this.skip(d)}return n},readMessage:function(s,n){return this.readFields(s,n,this.readVarint()+this.pos)},readFixed32:function(){var s=wm(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=s2(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=wm(this.buf,this.pos)+wm(this.buf,this.pos+4)*v0;return this.pos+=8,s},readSFixed64:function(){var s=wm(this.buf,this.pos)+s2(this.buf,this.pos+4)*v0;return this.pos+=8,s},readFloat:function(){var s=e2(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=e2(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var n,a,d=this.buf;return n=127&(a=d[this.pos++]),a<128?n:(n|=(127&(a=d[this.pos++]))<<7,a<128?n:(n|=(127&(a=d[this.pos++]))<<14,a<128?n:(n|=(127&(a=d[this.pos++]))<<21,a<128?n:function(y,x,w){var b,k,I=w.buf;if(b=(112&(k=I[w.pos++]))>>4,k<128||(b|=(127&(k=I[w.pos++]))<<3,k<128)||(b|=(127&(k=I[w.pos++]))<<10,k<128)||(b|=(127&(k=I[w.pos++]))<<17,k<128)||(b|=(127&(k=I[w.pos++]))<<24,k<128)||(b|=(1&(k=I[w.pos++]))<<31,k<128))return Nc(y,b,x);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(a=d[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var s=this.readVarint()+this.pos,n=this.pos;return this.pos=s,s-n>=12&&n2?function(a,d,y){return n2.decode(a.subarray(d,y))}(this.buf,n,s):function(a,d,y){for(var x="",w=d;w239?4:D>223?3:D>191?2:1;if(w+U>y)break;U===1?D<128&&(L=D):U===2?(192&(b=a[w+1]))==128&&(L=(31&D)<<6|63&b)<=127&&(L=null):U===3?(k=a[w+2],(192&(b=a[w+1]))==128&&(192&k)==128&&((L=(15&D)<<12|(63&b)<<6|63&k)<=2047||L>=55296&&L<=57343)&&(L=null)):U===4&&(k=a[w+2],I=a[w+3],(192&(b=a[w+1]))==128&&(192&k)==128&&(192&I)==128&&((L=(15&D)<<18|(63&b)<<12|(63&k)<<6|63&I)<=65535||L>=1114112)&&(L=null)),L===null?(L=65533,U=1):L>65535&&(L-=65536,x+=String.fromCharCode(L>>>10&1023|55296),L=56320|1023&L),x+=String.fromCharCode(L),w+=U}return x}(this.buf,n,s)},readBytes:function(){var s=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,s);return this.pos=s,n},readPackedVarint:function(s,n){if(this.type!==Lr.Bytes)return s.push(this.readVarint(n));var a=ha(this);for(s=s||[];this.pos127;);else if(n===Lr.Bytes)this.pos=this.readVarint()+this.pos;else if(n===Lr.Fixed32)this.pos+=4;else{if(n!==Lr.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(s,n){this.writeVarint(s<<3|n)},realloc:function(s){for(var n=this.length||16;n268435455||s<0?function(n,a){var d,y;if(n>=0?(d=n%4294967296|0,y=n/4294967296|0):(y=~(-n/4294967296),4294967295^(d=~(-n%4294967296))?d=d+1|0:(d=0,y=y+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");a.realloc(10),function(x,w,b){b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,b.buf[b.pos]=127&(x>>>=7)}(d,0,a),function(x,w){var b=(7&x)<<4;w.buf[w.pos++]|=b|((x>>>=3)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x)))))}(y,a)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(!!s)},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var n=this.pos;this.pos=function(d,y,x){for(var w,b,k=0;k55295&&w<57344){if(!b){w>56319||k+1===y.length?(d[x++]=239,d[x++]=191,d[x++]=189):b=w;continue}if(w<56320){d[x++]=239,d[x++]=191,d[x++]=189,b=w;continue}w=b-55296<<10|w-56320|65536,b=null}else b&&(d[x++]=239,d[x++]=191,d[x++]=189,b=null);w<128?d[x++]=w:(w<2048?d[x++]=w>>6|192:(w<65536?d[x++]=w>>12|224:(d[x++]=w>>18|240,d[x++]=w>>12&63|128),d[x++]=w>>6&63|128),d[x++]=63&w|128)}return x}(this.buf,s,this.pos);var a=this.pos-n;a>=128&&i2(n,a,this),this.pos=n-1,this.writeVarint(a),this.pos+=a},writeFloat:function(s){this.realloc(4),t2(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),t2(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var n=s.length;this.writeVarint(n),this.realloc(n);for(var a=0;a=128&&i2(a,d,this),this.pos=a-1,this.writeVarint(d),this.pos+=d},writeMessage:function(s,n,a){this.writeTag(s,Lr.Bytes),this.writeRawMessage(n,a)},writePackedVarint:function(s,n){n.length&&this.writeMessage(s,b3,n)},writePackedSVarint:function(s,n){n.length&&this.writeMessage(s,S3,n)},writePackedBoolean:function(s,n){n.length&&this.writeMessage(s,E3,n)},writePackedFloat:function(s,n){n.length&&this.writeMessage(s,k3,n)},writePackedDouble:function(s,n){n.length&&this.writeMessage(s,T3,n)},writePackedFixed32:function(s,n){n.length&&this.writeMessage(s,C3,n)},writePackedSFixed32:function(s,n){n.length&&this.writeMessage(s,I3,n)},writePackedFixed64:function(s,n){n.length&&this.writeMessage(s,P3,n)},writePackedSFixed64:function(s,n){n.length&&this.writeMessage(s,M3,n)},writeBytesField:function(s,n){this.writeTag(s,Lr.Bytes),this.writeBytes(n)},writeFixed32Field:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeSFixed64(n)},writeVarintField:function(s,n){this.writeTag(s,Lr.Varint),this.writeVarint(n)},writeSVarintField:function(s,n){this.writeTag(s,Lr.Varint),this.writeSVarint(n)},writeStringField:function(s,n){this.writeTag(s,Lr.Bytes),this.writeString(n)},writeFloatField:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeFloat(n)},writeDoubleField:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeDouble(n)},writeBooleanField:function(s,n){this.writeVarintField(s,!!n)}};var x0=T(Qb);const w0=3;function A3(s,n,a){s===1&&a.readMessage(D3,n)}function D3(s,n,a){if(s===3){const{id:d,bitmap:y,width:x,height:w,left:b,top:k,advance:I}=a.readMessage(z3,{});n.push({id:d,bitmap:new Ud({width:x+2*w0,height:w+2*w0},y),metrics:{width:x,height:w,left:b,top:k,advance:I}})}}function z3(s,n,a){s===1?n.id=a.readVarint():s===2?n.bitmap=a.readBytes():s===3?n.width=a.readVarint():s===4?n.height=a.readVarint():s===5?n.left=a.readSVarint():s===6?n.top=a.readSVarint():s===7&&(n.advance=a.readVarint())}const o2=w0;function a2(s){let n=0,a=0;for(const w of s)n+=w.w*w.h,a=Math.max(a,w.w);s.sort((w,b)=>b.h-w.h);const d=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(n/.95)),a),h:1/0}];let y=0,x=0;for(const w of s)for(let b=d.length-1;b>=0;b--){const k=d[b];if(!(w.w>k.w||w.h>k.h)){if(w.x=k.x,w.y=k.y,x=Math.max(x,w.y+w.h),y=Math.max(y,w.x+w.w),w.w===k.w&&w.h===k.h){const I=d.pop();b=0&&d>=n&&Sm[this.text.charCodeAt(d)];d--)a--;this.text=this.text.substring(n,a),this.sectionIndex=this.sectionIndex.slice(n,a)}substring(n,a){const d=new Uc;return d.text=this.text.substring(n,a),d.sectionIndex=this.sectionIndex.slice(n,a),d.sections=this.sections,d}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((n,a)=>Math.max(n,this.sections[a].scale),0)}addTextSection(n,a){this.text+=n.text,this.sections.push(Yd.forText(n.scale,n.fontStack||a));const d=this.sections.length-1;for(let y=0;y=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function bm(s,n,a,d,y,x,w,b,k,I,D,L,U,Z,K){const J=Uc.fromFeature(s,y);let le;L===g.ah.vertical&&J.verticalizePunctuation();const{processBidirectionalText:fe,processStyledBidirectionalText:De}=Ri;if(fe&&J.sections.length===1){le=[];const Ve=fe(J.toString(),S0(J,I,x,n,d,Z));for(const et of Ve){const xt=new Uc;xt.text=et,xt.sections=J.sections;for(let Nt=0;Nt0&&da>Jn&&(Jn=da)}else{const Ts=xt[xr.fontStack],$n=Ts&&Ts[Zr];if($n&&$n.rect)Wc=$n.rect,nn=$n.metrics;else{const da=et[xr.fontStack],tf=da&&da[Zr];if(!tf)continue;nn=tf.metrics}ns=(Ln-xr.scale)*Pn}Zs?(Ve.verticalizable=!0,Si.push({glyph:Zr,imageName:Ro,x:Zt,y:Fr+ns,vertical:Zs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:$r,metrics:nn,rect:Wc}),Zt+=Lo*xr.scale+qe):(Si.push({glyph:Zr,imageName:Ro,x:Zt,y:Fr+ns,vertical:Zs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:$r,metrics:nn,rect:Wc}),Zt+=nn.advance*xr.scale+qe)}Si.length!==0&&(Or=Math.max(Zt-qe,Or),F3(Si,0,Si.length-1,Gs,Jn)),Zt=0;const ks=pt*Ln+Jn;Kn.lineOffset=Math.max(Jn,oi),Fr+=ks,zn=Math.max(ks,zn),++Xn}var Rn;const xi=Fr-qd,{horizontalAlign:wi,verticalAlign:bi}=k0(At);(function(mn,Ln,oi,Kn,Si,Jn,ks,Fi,xr){const $r=(Ln-oi)*Si;let Zr=0;Zr=Jn!==ks?-Fi*Kn-qd:(-Kn*xr+.5)*ks;for(const ns of mn)for(const nn of ns.positionedGlyphs)nn.x+=$r,nn.y+=Zr})(Ve.positionedLines,Gs,wi,bi,Or,zn,pt,xi,yt.length),Ve.top+=-bi*xi,Ve.bottom=Ve.top+xi,Ve.left+=-wi*Or,Ve.right=Ve.left+Or}(Me,n,a,d,le,w,b,k,L,I,U,K),!function(Ve){for(const et of Ve)if(et.positionedGlyphs.length!==0)return!1;return!0}(be)&&Me}const Sm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},R3={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},L3={40:!0};function u2(s,n,a,d,y,x){if(n.imageName){const w=d[n.imageName];return w?w.displaySize[0]*n.scale*Pn/x+y:0}{const w=a[n.fontStack],b=w&&w[s];return b?b.metrics.advance*n.scale+y:0}}function c2(s,n,a,d){const y=Math.pow(s-n,2);return d?s=0;let I=0;for(let L=0;LI){const D=Math.ceil(x/I);y*=D/w,w=D}return{x1:d,y1:y,x2:d+x,y2:y+w}}function p2(s,n,a,d,y,x){const w=s.image;let b;if(w.content){const le=w.content,fe=w.pixelRatio||1;b=[le[0]/fe,le[1]/fe,w.displaySize[0]-le[2]/fe,w.displaySize[1]-le[3]/fe]}const k=n.left*x,I=n.right*x;let D,L,U,Z;a==="width"||a==="both"?(Z=y[0]+k-d[3],L=y[0]+I+d[1]):(Z=y[0]+(k+I-w.displaySize[0])/2,L=Z+w.displaySize[0]);const K=n.top*x,J=n.bottom*x;return a==="height"||a==="both"?(D=y[1]+K-d[0],U=y[1]+J+d[2]):(D=y[1]+(K+J-w.displaySize[1])/2,U=D+w.displaySize[1]),{image:w,top:D,right:L,bottom:U,left:Z,collisionPadding:b}}const Xd=255,zo=128,fl=Xd*zo;function m2(s,n){const{expression:a}=n;if(a.kind==="constant")return{kind:"constant",layoutSize:a.evaluate(new Vr(s+1))};if(a.kind==="source")return{kind:"source"};{const{zoomStops:d,interpolationType:y}=a;let x=0;for(;xw.id),this.index=n.index,this.pixelRatio=n.pixelRatio,this.sourceLayerIndex=n.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=a0([]),this.placementViewportMatrix=a0([]);const a=this.layers[0]._unevaluatedLayout._values;this.textSizeData=m2(this.zoom,a["text-size"]),this.iconSizeData=m2(this.zoom,a["icon-size"]);const d=this.layers[0].layout,y=d.get("symbol-sort-key"),x=d.get("symbol-z-order");this.canOverlap=T0(d,"text-overlap","text-allow-overlap")!=="never"||T0(d,"icon-overlap","icon-allow-overlap")!=="never"||d.get("text-ignore-placement")||d.get("icon-ignore-placement"),this.sortFeaturesByKey=x!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(x==="viewport-y"||x==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,d.get("symbol-placement")==="point"&&(this.writingModes=d.get("text-writing-mode").map(w=>g.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=n.sourceID}createArrays(){this.text=new C0(new fu(this.layers,this.zoom,n=>/^text/.test(n))),this.icon=new C0(new fu(this.layers,this.zoom,n=>/^icon/.test(n))),this.glyphOffsetArray=new Wr,this.lineVertexArray=new Gn,this.symbolInstances=new ar,this.textAnchorOffsets=new Gr}calculateGlyphDependencies(n,a,d,y,x){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),D=k.value.kind!=="constant"||!!k.value.value||Object.keys(k.parameters).length>0,L=x.get("symbol-sort-key");if(this.features=[],!I&&!D)return;const U=a.iconDependencies,Z=a.glyphDependencies,K=a.availableImages,J=new Vr(this.zoom);for(const{feature:le,id:fe,index:De,sourceLayerIndex:be}of n){const Me=y._featureFilter.needGeometry,Ve=mu(le,Me);if(!y._featureFilter.filter(J,Ve,d))continue;let et,xt;if(Me||(Ve.geometry=pu(le)),I){const yt=y.getValueAndResolveTokens("text-field",Ve,d,K),pt=Mi.factory(yt),At=this.hasRTLText=this.hasRTLText||U3(pt);(!At||Ri.getRTLTextPluginStatus()==="unavailable"||At&&Ri.isParsed())&&(et=w3(pt,y,Ve))}if(D){const yt=y.getValueAndResolveTokens("icon-image",Ve,d,K);xt=yt instanceof Di?yt:Di.fromString(yt)}if(!et&&!xt)continue;const Nt=this.sortFeaturesByKey?L.evaluate(Ve,{},d):void 0;if(this.features.push({id:fe,text:et,icon:xt,index:De,sourceLayerIndex:be,geometry:Ve.geometry,properties:le.properties,type:N3[le.type],sortKey:Nt}),xt&&(U[xt.name]=!0),et){const yt=w.evaluate(Ve,{},d).join(","),pt=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(g.ah.vertical)>=0;for(const At of et.sections)if(At.image)U[At.image.name]=!0;else{const Tt=Dd(et.toString()),bt=At.fontStack||yt,qe=Z[bt]=Z[bt]||{};this.calculateGlyphDependencies(At.text,qe,pt,this.allowVerticalPlacement,Tt)}}}x.get("symbol-placement")==="line"&&(this.features=function(le){const fe={},De={},be=[];let Me=0;function Ve(yt){be.push(le[yt]),Me++}function et(yt,pt,At){const Tt=De[yt];return delete De[yt],De[pt]=Tt,be[Tt].geometry[0].pop(),be[Tt].geometry[0]=be[Tt].geometry[0].concat(At[0]),Tt}function xt(yt,pt,At){const Tt=fe[pt];return delete fe[pt],fe[yt]=Tt,be[Tt].geometry[0].shift(),be[Tt].geometry[0]=At[0].concat(be[Tt].geometry[0]),Tt}function Nt(yt,pt,At){const Tt=At?pt[0][pt[0].length-1]:pt[0][0];return`${yt}:${Tt.x}:${Tt.y}`}for(let yt=0;ytyt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((le,fe)=>le.sortKey-fe.sortKey)}update(n,a,d){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(n,a,this.layers,d),this.icon.programConfigurations.updatePaintArrays(n,a,this.layers,d))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(n),this.iconCollisionBox.upload(n)),this.text.upload(n,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(n,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(n,a){const d=this.lineVertexArray.length;if(n.segment!==void 0){let y=n.dist(a[n.segment+1]),x=n.dist(a[n.segment]);const w={};for(let b=n.segment+1;b=0;b--)w[b]={x:a[b].x,y:a[b].y,tileUnitDistanceFromAnchor:x},b>0&&(x+=a[b-1].dist(a[b]));for(let b=0;b0}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(n,a){const d=n.placedSymbolArray.get(a),y=d.vertexStartIndex+4*d.numGlyphs;for(let x=d.vertexStartIndex;xy[b]-y[k]||x[k]-x[b]),w}addToSortKeyRanges(n,a){const d=this.sortKeyRanges[this.sortKeyRanges.length-1];d&&d.sortKey===a?d.symbolInstanceEnd=n+1:this.sortKeyRanges.push({sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:n+1})}sortFeatures(n){if(this.sortFeaturesByY&&this.sortedAngle!==n&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(n),this.sortedAngle=n,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const a of this.symbolInstanceIndexes){const d=this.symbolInstances.get(a);this.featureSortOrder.push(d.featureIndex),[d.rightJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.leftJustifiedTextSymbolIndex].forEach((y,x,w)=>{y>=0&&w.indexOf(y)===x&&this.addIndicesForPlacedSymbol(this.text,y)}),d.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,d.verticalPlacedTextSymbolIndex),d.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.placedIconSymbolIndex),d.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let g2,y2;St("SymbolBucket",jc,{omit:["layers","collisionBoxArray","features","compareText"]}),jc.MAX_GLYPHS=65535,jc.addDynamicAttributes=E0;var P0={get paint(){return y2=y2||new v({"icon-opacity":new jt(ie.paint_symbol["icon-opacity"]),"icon-color":new jt(ie.paint_symbol["icon-color"]),"icon-halo-color":new jt(ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new jt(ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new jt(ie.paint_symbol["icon-halo-blur"]),"icon-translate":new It(ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new It(ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new jt(ie.paint_symbol["text-opacity"]),"text-color":new jt(ie.paint_symbol["text-color"],{runtimeType:Kr,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new jt(ie.paint_symbol["text-halo-color"]),"text-halo-width":new jt(ie.paint_symbol["text-halo-width"]),"text-halo-blur":new jt(ie.paint_symbol["text-halo-blur"]),"text-translate":new It(ie.paint_symbol["text-translate"]),"text-translate-anchor":new It(ie.paint_symbol["text-translate-anchor"])})},get layout(){return g2=g2||new v({"symbol-placement":new It(ie.layout_symbol["symbol-placement"]),"symbol-spacing":new It(ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new It(ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new jt(ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new It(ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new It(ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new It(ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new It(ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new It(ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new It(ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new jt(ie.layout_symbol["icon-size"]),"icon-text-fit":new It(ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new It(ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new jt(ie.layout_symbol["icon-image"]),"icon-rotate":new jt(ie.layout_symbol["icon-rotate"]),"icon-padding":new jt(ie.layout_symbol["icon-padding"]),"icon-keep-upright":new It(ie.layout_symbol["icon-keep-upright"]),"icon-offset":new jt(ie.layout_symbol["icon-offset"]),"icon-anchor":new jt(ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new It(ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new It(ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new It(ie.layout_symbol["text-rotation-alignment"]),"text-field":new jt(ie.layout_symbol["text-field"]),"text-font":new jt(ie.layout_symbol["text-font"]),"text-size":new jt(ie.layout_symbol["text-size"]),"text-max-width":new jt(ie.layout_symbol["text-max-width"]),"text-line-height":new It(ie.layout_symbol["text-line-height"]),"text-letter-spacing":new jt(ie.layout_symbol["text-letter-spacing"]),"text-justify":new jt(ie.layout_symbol["text-justify"]),"text-radial-offset":new jt(ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new It(ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new jt(ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new jt(ie.layout_symbol["text-anchor"]),"text-max-angle":new It(ie.layout_symbol["text-max-angle"]),"text-writing-mode":new It(ie.layout_symbol["text-writing-mode"]),"text-rotate":new jt(ie.layout_symbol["text-rotate"]),"text-padding":new It(ie.layout_symbol["text-padding"]),"text-keep-upright":new It(ie.layout_symbol["text-keep-upright"]),"text-transform":new jt(ie.layout_symbol["text-transform"]),"text-offset":new jt(ie.layout_symbol["text-offset"]),"text-allow-overlap":new It(ie.layout_symbol["text-allow-overlap"]),"text-overlap":new It(ie.layout_symbol["text-overlap"]),"text-ignore-placement":new It(ie.layout_symbol["text-ignore-placement"]),"text-optional":new It(ie.layout_symbol["text-optional"])})}};class _2{constructor(n){if(n.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=n.property.overrides?n.property.overrides.runtimeType:pi,this.defaultValue=n}evaluate(n){if(n.formattedSection){const a=this.defaultValue.property.overrides;if(a&&a.hasOverride(n.formattedSection))return a.getOverride(n.formattedSection)}return n.feature&&n.featureState?this.defaultValue.evaluate(n.feature,n.featureState):this.defaultValue.property.specification.default}eachChild(n){this.defaultValue.isConstant()||n(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}St("FormatSectionOverride",_2,{omit:["defaultValue"]});class Tm extends u{constructor(n){super(n,P0)}recalculate(n,a){if(super.recalculate(n,a),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const d=this.layout.get("text-writing-mode");if(d){const y=[];for(const x of d)y.indexOf(x)<0&&y.push(x);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(n,a,d,y){const x=this.layout.get(n).evaluate(a,{},d,y),w=this._unevaluatedLayout._values[n];return w.isDataDriven()||mc(w.value)||!x?x:function(b,k){return k.replace(/{([^{}]+)}/g,(I,D)=>b&&D in b?String(b[D]):"")}(a.properties,x)}createBucket(n){return new jc(n)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const n of P0.paint.overridableProperties){if(!Tm.hasPaintOverride(this.layout,n))continue;const a=this.paint.get(n),d=new _2(a),y=new pc(d,a.property.specification);let x=null;x=a.value.kind==="constant"||a.value.kind==="source"?new Ya("source",y):new Xa("composite",y,a.value.zoomStops),this.paint._values[n]=new Hs(a.property,x,a.parameters)}}_handleOverridablePaintPropertyUpdate(n,a,d){return!(!this.layout||a.isDataDriven()||d.isDataDriven())&&Tm.hasPaintOverride(this.layout,n)}static hasPaintOverride(n,a){const d=n.get("text-field"),y=P0.paint.properties[a];let x=!1;const w=b=>{for(const k of b)if(y.overrides&&y.overrides.hasOverride(k))return void(x=!0)};if(d.value.kind==="constant"&&d.value.value instanceof Mi)w(d.value.value.sections);else if(d.value.kind==="source"){const b=I=>{x||(I instanceof ms&&En(I.value)===fs?w(I.value.sections):I instanceof sc?w(I.sections):I.eachChild(b))},k=d.value;k._styleExpression&&b(k._styleExpression.expression)}return x}}let v2;var j3={get paint(){return v2=v2||new v({"background-color":new It(ie.paint_background["background-color"]),"background-pattern":new Ic(ie.paint_background["background-pattern"]),"background-opacity":new It(ie.paint_background["background-opacity"])})}};class V3 extends u{constructor(n){super(n,j3)}}let x2;var H3={get paint(){return x2=x2||new v({"raster-opacity":new It(ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new It(ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new It(ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new It(ie.paint_raster["raster-brightness-max"]),"raster-saturation":new It(ie.paint_raster["raster-saturation"]),"raster-contrast":new It(ie.paint_raster["raster-contrast"]),"raster-resampling":new It(ie.paint_raster["raster-resampling"]),"raster-fade-duration":new It(ie.paint_raster["raster-fade-duration"])})}};class W3 extends u{constructor(n){super(n,H3)}}class G3 extends u{constructor(n){super(n,{}),this.onAdd=a=>{this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)},this.onRemove=a=>{this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)},this.implementation=n}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Z3{constructor(n){this._methodToThrottle=n,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const M0=63710088e-1;class pl{constructor(n,a){if(isNaN(n)||isNaN(a))throw new Error(`Invalid LngLat object: (${n}, ${a})`);if(this.lng=+n,this.lat=+a,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new pl(ke(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(n){const a=Math.PI/180,d=this.lat*a,y=n.lat*a,x=Math.sin(d)*Math.sin(y)+Math.cos(d)*Math.cos(y)*Math.cos((n.lng-this.lng)*a);return M0*Math.acos(Math.min(x,1))}static convert(n){if(n instanceof pl)return n;if(Array.isArray(n)&&(n.length===2||n.length===3))return new pl(Number(n[0]),Number(n[1]));if(!Array.isArray(n)&&typeof n=="object"&&n!==null)return new pl(Number("lng"in n?n.lng:n.lon),Number(n.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const w2=2*Math.PI*M0;function b2(s){return w2*Math.cos(s*Math.PI/180)}function S2(s){return(180+s)/360}function k2(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function T2(s,n){return s/b2(n)}function A0(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}class Kd{constructor(n,a,d=0){this.x=+n,this.y=+a,this.z=+d}static fromLngLat(n,a=0){const d=pl.convert(n);return new Kd(S2(d.lng),k2(d.lat),T2(a,d.lat))}toLngLat(){return new pl(360*this.x-180,A0(this.y))}toAltitude(){return this.z*b2(A0(this.y))}meterInMercatorCoordinateUnits(){return 1/w2*(n=A0(this.y),1/Math.cos(n*Math.PI/180));var n}}function E2(s,n,a){var d=2*Math.PI*6378137/256/Math.pow(2,a);return[s*d-2*Math.PI*6378137/2,n*d-2*Math.PI*6378137/2]}class D0{constructor(n,a,d){if(!function(y,x,w){return!(y<0||y>25||w<0||w>=Math.pow(2,y)||x<0||x>=Math.pow(2,y))}(n,a,d))throw new Error(`x=${a}, y=${d}, z=${n} outside of bounds. 0<=x<${Math.pow(2,n)}, 0<=y<${Math.pow(2,n)} 0<=z<=25 `);this.z=n,this.x=a,this.y=d,this.key=Jd(0,n,n,a,d)}equals(n){return this.z===n.z&&this.x===n.x&&this.y===n.y}url(n,a,d){const y=(w=this.y,b=this.z,k=E2(256*(x=this.x),256*(w=Math.pow(2,b)-w-1),b),I=E2(256*(x+1),256*(w+1),b),k[0]+","+k[1]+","+I[0]+","+I[1]);var x,w,b,k,I;const D=function(L,U,Z){let K,J="";for(let le=L;le>0;le--)K=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,y)}isChildOf(n){const a=this.z-n.z;return a>0&&n.x===this.x>>a&&n.y===this.y>>a}getTilePoint(n){const a=Math.pow(2,this.z);return new A((n.x*a-this.x)*Cn,(n.y*a-this.y)*Cn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class C2{constructor(n,a){this.wrap=n,this.canonical=a,this.key=Jd(n,a.z,a.z,a.x,a.y)}}class Ss{constructor(n,a,d,y,x){if(n= z; overscaledZ = ${n}; z = ${d}`);this.overscaledZ=n,this.wrap=a,this.canonical=new D0(d,+y,+x),this.key=Jd(a,n,d,y,x)}clone(){return new Ss(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(n){return this.overscaledZ===n.overscaledZ&&this.wrap===n.wrap&&this.canonical.equals(n.canonical)}scaledTo(n){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-n;return n>this.canonical.z?new Ss(n,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ss(n,this.wrap,n,this.canonical.x>>a,this.canonical.y>>a)}calculateScaledKey(n,a){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const d=this.canonical.z-n;return n>this.canonical.z?Jd(this.wrap*+a,n,this.canonical.z,this.canonical.x,this.canonical.y):Jd(this.wrap*+a,n,n,this.canonical.x>>d,this.canonical.y>>d)}isChildOf(n){if(n.wrap!==this.wrap)return!1;const a=this.canonical.z-n.canonical.z;return n.overscaledZ===0||n.overscaledZ>a&&n.canonical.y===this.canonical.y>>a}children(n){if(this.overscaledZ>=n)return[new Ss(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const a=this.canonical.z+1,d=2*this.canonical.x,y=2*this.canonical.y;return[new Ss(a,this.wrap,a,d,y),new Ss(a,this.wrap,a,d+1,y),new Ss(a,this.wrap,a,d,y+1),new Ss(a,this.wrap,a,d+1,y+1)]}isLessThan(n){return this.wrapn.wrap)&&(this.overscaledZn.overscaledZ)&&(this.canonical.xn.canonical.x)&&this.canonical.ythis.max&&(this.max=L),L=this.dim+1||a<-1||a>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(a+1)*this.stride+(n+1)}unpack(n,a,d){return n*this.redFactor+a*this.greenFactor+d*this.blueFactor-this.baseShift}getPixels(){return new bs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(n,a,d){if(this.dim!==n.dim)throw new Error("dem dimension mismatch");let y=a*this.dim,x=a*this.dim+this.dim,w=d*this.dim,b=d*this.dim+this.dim;switch(a){case-1:y=x-1;break;case 1:x=y+1}switch(d){case-1:w=b-1;break;case 1:b=w+1}const k=-a*this.dim,I=-d*this.dim;for(let D=w;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${n} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[n]}}class M2{constructor(n,a,d,y,x){this.type="Feature",this._vectorTileFeature=n,n._z=a,n._x=d,n._y=y,this.properties=n.properties,this.id=x}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(n){this._geometry=n}toJSON(){const n={geometry:this.geometry};for(const a in this)a!=="_geometry"&&a!=="_vectorTileFeature"&&(n[a]=this[a]);return n}}class A2{constructor(n,a){this.tileID=n,this.x=n.canonical.x,this.y=n.canonical.y,this.z=n.canonical.z,this.grid=new el(Cn,16,0),this.grid3D=new el(Cn,16,0),this.featureIndexArray=new ii,this.promoteId=a}insert(n,a,d,y,x,w){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(d,y,x);const k=w?this.grid3D:this.grid;for(let I=0;I=0&&L[3]>=0&&k.insert(b,L[0],L[1],L[2],L[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new hl.VectorTile(new x0(this.rawTileData)).layers,this.sourceLayerCoder=new P2(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(n,a,d,y){this.loadVTLayers();const x=n.params||{},w=Cn/n.tileSize/n.scale,b=yd(x.filter),k=n.queryGeometry,I=n.queryPadding*w,D=z2(k),L=this.grid.query(D.minX-I,D.minY-I,D.maxX+I,D.maxY+I),U=z2(n.cameraQueryGeometry),Z=this.grid3D.query(U.minX-I,U.minY-I,U.maxX+I,U.maxY+I,(le,fe,De,be)=>function(Me,Ve,et,xt,Nt){for(const pt of Me)if(Ve<=pt.x&&et<=pt.y&&xt>=pt.x&&Nt>=pt.y)return!0;const yt=[new A(Ve,et),new A(Ve,Nt),new A(xt,Nt),new A(xt,et)];if(Me.length>2){for(const pt of yt)if(Lc(Me,pt))return!0}for(let pt=0;pt(be||(be=pu(Me)),Ve.queryIntersectsFeature(k,Me,et,be,this.z,n.transform,w,n.pixelPosMatrix)))}return K}loadMatchingFeature(n,a,d,y,x,w,b,k,I,D,L){const U=this.bucketLayerIDs[a];if(w&&!function(le,fe){for(let De=0;De=0)return!0;return!1}(w,U))return;const Z=this.sourceLayerCoder.decode(d),K=this.vtLayers[Z].feature(y);if(x.needGeometry){const le=mu(K,!0);if(!x.filter(new Vr(this.tileID.overscaledZ),le,this.tileID.canonical))return}else if(!x.filter(new Vr(this.tileID.overscaledZ),K))return;const J=this.getId(K,Z);for(let le=0;le{const b=n instanceof cu?n.get(w):null;return b&&b.evaluate?b.evaluate(a,d,y):b})}function z2(s){let n=1/0,a=1/0,d=-1/0,y=-1/0;for(const x of s)n=Math.min(n,x.x),a=Math.min(a,x.y),d=Math.max(d,x.x),y=Math.max(y,x.y);return{minX:n,minY:a,maxX:d,maxY:y}}function q3(s,n){return n-s}function R2(s,n,a,d,y){const x=[];for(let w=0;w=d&&L.x>=d||(D.x>=d?D=new A(d,D.y+(d-D.x)/(L.x-D.x)*(L.y-D.y))._round():L.x>=d&&(L=new A(d,D.y+(d-D.x)/(L.x-D.x)*(L.y-D.y))._round()),D.y>=y&&L.y>=y||(D.y>=y?D=new A(D.x+(y-D.y)/(L.y-D.y)*(L.x-D.x),y)._round():L.y>=y&&(L=new A(D.x+(y-D.y)/(L.y-D.y)*(L.x-D.x),y)._round()),k&&D.equals(k[k.length-1])||(k=[D],x.push(k)),k.push(L)))))}}return x}St("FeatureIndex",A2,{omit:["rawTileData","sourceLayerCoder"]});class ml extends A{constructor(n,a,d,y){super(n,a),this.angle=d,y!==void 0&&(this.segment=y)}clone(){return new ml(this.x,this.y,this.angle,this.segment)}}function L2(s,n,a,d,y){if(n.segment===void 0||a===0)return!0;let x=n,w=n.segment+1,b=0;for(;b>-a/2;){if(w--,w<0)return!1;b-=s[w].dist(x),x=s[w]}b+=s[w].dist(s[w+1]),w++;const k=[];let I=0;for(;bd;)I-=k.shift().angleDelta;if(I>y)return!1;w++,b+=D.dist(L)}return!0}function O2(s){let n=0;for(let a=0;aI){const K=(I-k)/Z,J=gi.number(L.x,U.x,K),le=gi.number(L.y,U.y,K),fe=new ml(J,le,U.angleTo(L),D);return fe._round(),!w||L2(s,fe,b,w,n)?fe:void 0}k+=Z}}function X3(s,n,a,d,y,x,w,b,k){const I=F2(d,x,w),D=B2(d,y),L=D*w,U=s[0].x===0||s[0].x===k||s[0].y===0||s[0].y===k;return n-L=0&&Me=0&&Ve=0&&U+I<=D){const et=new ml(Me,Ve,De,K);et._round(),d&&!L2(s,et,x,d,y)||Z.push(et)}}L+=fe}return b||Z.length||w||(Z=N2(s,L/2,a,d,y,x,w,!0,k)),Z}St("Anchor",ml);const Vc=Oi;function $2(s,n,a,d){const y=[],x=s.image,w=x.pixelRatio,b=x.paddedRect.w-2*Vc,k=x.paddedRect.h-2*Vc;let I={x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};const D=x.stretchX||[[0,b]],L=x.stretchY||[[0,k]],U=(qe,Dt)=>qe+Dt[1]-Dt[0],Z=D.reduce(U,0),K=L.reduce(U,0),J=b-Z,le=k-K;let fe=0,De=Z,be=0,Me=K,Ve=0,et=J,xt=0,Nt=le;if(x.content&&d){const qe=x.content,Dt=qe[2]-qe[0],Mt=qe[3]-qe[1];(x.textFitWidth||x.textFitHeight)&&(I=f2(s)),fe=Em(D,0,qe[0]),be=Em(L,0,qe[1]),De=Em(D,qe[0],qe[2]),Me=Em(L,qe[1],qe[3]),Ve=qe[0]-fe,xt=qe[1]-be,et=Dt-De,Nt=Mt-Me}const yt=I.x1,pt=I.y1,At=I.x2-yt,Tt=I.y2-pt,bt=(qe,Dt,Mt,Zt)=>{const Fr=Cm(qe.stretch-fe,De,At,yt),Or=Im(qe.fixed-Ve,et,qe.stretch,Z),zn=Cm(Dt.stretch-be,Me,Tt,pt),Gs=Im(Dt.fixed-xt,Nt,Dt.stretch,K),Xn=Cm(Mt.stretch-fe,De,At,yt),Rn=Im(Mt.fixed-Ve,et,Mt.stretch,Z),xi=Cm(Zt.stretch-be,Me,Tt,pt),wi=Im(Zt.fixed-xt,Nt,Zt.stretch,K),bi=new A(Fr,zn),mn=new A(Xn,zn),Ln=new A(Xn,xi),oi=new A(Fr,xi),Kn=new A(Or/w,Gs/w),Si=new A(Rn/w,wi/w),Jn=n*Math.PI/180;if(Jn){const xr=Math.sin(Jn),$r=Math.cos(Jn),Zr=[$r,-xr,xr,$r];bi._matMult(Zr),mn._matMult(Zr),oi._matMult(Zr),Ln._matMult(Zr)}const ks=qe.stretch+qe.fixed,Fi=Dt.stretch+Dt.fixed;return{tl:bi,tr:mn,bl:oi,br:Ln,tex:{x:x.paddedRect.x+Vc+ks,y:x.paddedRect.y+Vc+Fi,w:Mt.stretch+Mt.fixed-ks,h:Zt.stretch+Zt.fixed-Fi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Kn,pixelOffsetBR:Si,minFontScaleX:et/w/At,minFontScaleY:Nt/w/Tt,isSDF:a}};if(d&&(x.stretchX||x.stretchY)){const qe=U2(D,J,Z),Dt=U2(L,le,K);for(let Mt=0;Mt0&&(J=Math.max(10,J),this.circleDiameter=J)}else{const U=!((L=w.image)===null||L===void 0)&&L.content&&(w.image.textFitWidth||w.image.textFitHeight)?f2(w):{x1:w.left,y1:w.top,x2:w.right,y2:w.bottom};U.y1=U.y1*b-k[0],U.y2=U.y2*b+k[2],U.x1=U.x1*b-k[3],U.x2=U.x2*b+k[1];const Z=w.collisionPadding;if(Z&&(U.x1-=Z[0]*b,U.y1-=Z[1]*b,U.x2+=Z[2]*b,U.y2+=Z[3]*b),D){const K=new A(U.x1,U.y1),J=new A(U.x2,U.y1),le=new A(U.x1,U.y2),fe=new A(U.x2,U.y2),De=D*Math.PI/180;K._rotate(De),J._rotate(De),le._rotate(De),fe._rotate(De),U.x1=Math.min(K.x,J.x,le.x,fe.x),U.x2=Math.max(K.x,J.x,le.x,fe.x),U.y1=Math.min(K.y,J.y,le.y,fe.y),U.y2=Math.max(K.y,J.y,le.y,fe.y)}n.emplaceBack(a.x,a.y,U.x1,U.y1,U.x2,U.y2,d,y,x)}this.boxEndIndex=n.length}}class K3{constructor(n=[],a=(d,y)=>dy?1:0){if(this.data=n,this.length=this.data.length,this.compare=a,this.length>0)for(let d=(this.length>>1)-1;d>=0;d--)this._down(d)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],a=this.data.pop();return--this.length>0&&(this.data[0]=a,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:a,compare:d}=this,y=a[n];for(;n>0;){const x=n-1>>1,w=a[x];if(d(y,w)>=0)break;a[n]=w,n=x}a[n]=y}_down(n){const{data:a,compare:d}=this,y=this.length>>1,x=a[n];for(;n=0)break;a[n]=a[w],n=w}a[n]=x}}function J3(s,n=1,a=!1){let d=1/0,y=1/0,x=-1/0,w=-1/0;const b=s[0];for(let Z=0;Zx)&&(x=K.x),(!Z||K.y>w)&&(w=K.y)}const k=Math.min(x-d,w-y);let I=k/2;const D=new K3([],Q3);if(k===0)return new A(d,y);for(let Z=d;ZL.d||!L.d)&&(L=Z,a&&console.log("found best %d after %d probes",Math.round(1e4*Z.d)/1e4,U)),Z.max-L.d<=n||(I=Z.h/2,D.push(new Hc(Z.p.x-I,Z.p.y-I,I,s)),D.push(new Hc(Z.p.x+I,Z.p.y-I,I,s)),D.push(new Hc(Z.p.x-I,Z.p.y+I,I,s)),D.push(new Hc(Z.p.x+I,Z.p.y+I,I,s)),U+=4)}return a&&(console.log(`num probes: ${U}`),console.log(`best distance: ${L.d}`)),L.p}function Q3(s,n){return n.max-s.max}function Hc(s,n,a,d){this.p=new A(s,n),this.h=a,this.d=function(y,x){let w=!1,b=1/0;for(let k=0;ky.y!=K.y>y.y&&y.x<(K.x-Z.x)*(y.y-Z.y)/(K.y-Z.y)+Z.x&&(w=!w),b=Math.min(b,kb(y,Z,K))}}return(w?1:-1)*Math.sqrt(b)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}var Yn;g.aq=void 0,(Yn=g.aq||(g.aq={}))[Yn.center=1]="center",Yn[Yn.left=2]="left",Yn[Yn.right=3]="right",Yn[Yn.top=4]="top",Yn[Yn.bottom=5]="bottom",Yn[Yn["top-left"]=6]="top-left",Yn[Yn["top-right"]=7]="top-right",Yn[Yn["bottom-left"]=8]="bottom-left",Yn[Yn["bottom-right"]=9]="bottom-right";const gl=7,z0=Number.POSITIVE_INFINITY;function j2(s,n){return n[1]!==z0?function(a,d,y){let x=0,w=0;switch(d=Math.abs(d),y=Math.abs(y),a){case"top-right":case"top-left":case"top":w=y-gl;break;case"bottom-right":case"bottom-left":case"bottom":w=-y+gl}switch(a){case"top-right":case"bottom-right":case"right":x=-d;break;case"top-left":case"bottom-left":case"left":x=d}return[x,w]}(s,n[0],n[1]):function(a,d){let y=0,x=0;d<0&&(d=0);const w=d/Math.SQRT2;switch(a){case"top-right":case"top-left":x=w-gl;break;case"bottom-right":case"bottom-left":x=-w+gl;break;case"bottom":x=-d+gl;break;case"top":x=d-gl}switch(a){case"top-right":case"bottom-right":y=-w;break;case"top-left":case"bottom-left":y=w;break;case"left":y=d;break;case"right":y=-d}return[y,x]}(s,n[0])}function V2(s,n,a){var d;const y=s.layout,x=(d=y.get("text-variable-anchor-offset"))===null||d===void 0?void 0:d.evaluate(n,{},a);if(x){const b=x.values,k=[];for(let I=0;IU*Pn);D.startsWith("top")?L[1]-=gl:D.startsWith("bottom")&&(L[1]+=gl),k[I+1]=L}return new Xi(k)}const w=y.get("text-variable-anchor");if(w){let b;b=s._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(n,{},a)*Pn,z0]:y.get("text-offset").evaluate(n,{},a).map(I=>I*Pn);const k=[];for(const I of w)k.push(I,j2(I,b));return new Xi(k)}return null}function R0(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function eD(s,n,a,d,y,x,w,b,k,I,D){let L=x.textMaxSize.evaluate(n,{});L===void 0&&(L=w);const U=s.layers[0].layout,Z=U.get("icon-offset").evaluate(n,{},D),K=W2(a.horizontal),J=w/24,le=s.tilePixelRatio*J,fe=s.tilePixelRatio*L/24,De=s.tilePixelRatio*b,be=s.tilePixelRatio*U.get("symbol-spacing"),Me=U.get("text-padding")*s.tilePixelRatio,Ve=function(qe,Dt,Mt,Zt=1){const Fr=qe.get("icon-padding").evaluate(Dt,{},Mt),Or=Fr&&Fr.values;return[Or[0]*Zt,Or[1]*Zt,Or[2]*Zt,Or[3]*Zt]}(U,n,D,s.tilePixelRatio),et=U.get("text-max-angle")/180*Math.PI,xt=U.get("text-rotation-alignment")!=="viewport"&&U.get("symbol-placement")!=="point",Nt=U.get("icon-rotation-alignment")==="map"&&U.get("symbol-placement")!=="point",yt=U.get("symbol-placement"),pt=be/2,At=U.get("icon-text-fit");let Tt;d&&At!=="none"&&(s.allowVerticalPlacement&&a.vertical&&(Tt=p2(d,a.vertical,At,U.get("icon-text-fit-padding"),Z,J)),K&&(d=p2(d,K,At,U.get("icon-text-fit-padding"),Z,J)));const bt=(qe,Dt)=>{Dt.x<0||Dt.x>=Cn||Dt.y<0||Dt.y>=Cn||function(Mt,Zt,Fr,Or,zn,Gs,Xn,Rn,xi,wi,bi,mn,Ln,oi,Kn,Si,Jn,ks,Fi,xr,$r,Zr,ns,nn,Wc){const Ro=Mt.addToLineVertexArray(Zt,Fr);let Lo,Zs,Ts,$n,da=0,tf=0,Y2=0,X2=0,j0=-1,V0=-1;const fa={};let K2=Ac("");if(Mt.allowVerticalPlacement&&Or.vertical){const ai=Rn.layout.get("text-rotate").evaluate($r,{},nn)+90;Ts=new Pm(xi,Zt,wi,bi,mn,Or.vertical,Ln,oi,Kn,ai),Xn&&($n=new Pm(xi,Zt,wi,bi,mn,Xn,Jn,ks,Kn,ai))}if(zn){const ai=Rn.layout.get("icon-rotate").evaluate($r,{}),Es=Rn.layout.get("icon-text-fit")!=="none",yu=$2(zn,ai,ns,Es),ho=Xn?$2(Xn,ai,ns,Es):void 0;Zs=new Pm(xi,Zt,wi,bi,mn,zn,Jn,ks,!1,ai),da=4*yu.length;const _u=Mt.iconSizeData;let Oo=null;_u.kind==="source"?(Oo=[zo*Rn.layout.get("icon-size").evaluate($r,{})],Oo[0]>fl&&Ue(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)):_u.kind==="composite"&&(Oo=[zo*Zr.compositeIconSizes[0].evaluate($r,{},nn),zo*Zr.compositeIconSizes[1].evaluate($r,{},nn)],(Oo[0]>fl||Oo[1]>fl)&&Ue(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)),Mt.addSymbols(Mt.icon,yu,Oo,xr,Fi,$r,g.ah.none,Zt,Ro.lineStartIndex,Ro.lineLength,-1,nn),j0=Mt.icon.placedSymbolArray.length-1,ho&&(tf=4*ho.length,Mt.addSymbols(Mt.icon,ho,Oo,xr,Fi,$r,g.ah.vertical,Zt,Ro.lineStartIndex,Ro.lineLength,-1,nn),V0=Mt.icon.placedSymbolArray.length-1)}const J2=Object.keys(Or.horizontal);for(const ai of J2){const Es=Or.horizontal[ai];if(!Lo){K2=Ac(Es.text);const ho=Rn.layout.get("text-rotate").evaluate($r,{},nn);Lo=new Pm(xi,Zt,wi,bi,mn,Es,Ln,oi,Kn,ho)}const yu=Es.positionedLines.length===1;if(Y2+=H2(Mt,Zt,Es,Gs,Rn,Kn,$r,Si,Ro,Or.vertical?g.ah.horizontal:g.ah.horizontalOnly,yu?J2:[ai],fa,j0,Zr,nn),yu)break}Or.vertical&&(X2+=H2(Mt,Zt,Or.vertical,Gs,Rn,Kn,$r,Si,Ro,g.ah.vertical,["vertical"],fa,V0,Zr,nn));const nD=Lo?Lo.boxStartIndex:Mt.collisionBoxArray.length,iD=Lo?Lo.boxEndIndex:Mt.collisionBoxArray.length,sD=Ts?Ts.boxStartIndex:Mt.collisionBoxArray.length,oD=Ts?Ts.boxEndIndex:Mt.collisionBoxArray.length,aD=Zs?Zs.boxStartIndex:Mt.collisionBoxArray.length,lD=Zs?Zs.boxEndIndex:Mt.collisionBoxArray.length,uD=$n?$n.boxStartIndex:Mt.collisionBoxArray.length,cD=$n?$n.boxEndIndex:Mt.collisionBoxArray.length;let co=-1;const Am=(ai,Es)=>ai&&ai.circleDiameter?Math.max(ai.circleDiameter,Es):Es;co=Am(Lo,co),co=Am(Ts,co),co=Am(Zs,co),co=Am($n,co);const Q2=co>-1?1:0;Q2&&(co*=Wc/Pn),Mt.glyphOffsetArray.length>=jc.MAX_GLYPHS&&Ue("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),$r.sortKey!==void 0&&Mt.addToSortKeyRanges(Mt.symbolInstances.length,$r.sortKey);const hD=V2(Rn,$r,nn),[dD,fD]=function(ai,Es){const yu=ai.length,ho=Es==null?void 0:Es.values;if((ho==null?void 0:ho.length)>0)for(let _u=0;_u=0?fa.right:-1,fa.center>=0?fa.center:-1,fa.left>=0?fa.left:-1,fa.vertical||-1,j0,V0,K2,nD,iD,sD,oD,aD,lD,uD,cD,wi,Y2,X2,da,tf,Q2,0,Ln,co,dD,fD)}(s,Dt,qe,a,d,y,Tt,s.layers[0],s.collisionBoxArray,n.index,n.sourceLayerIndex,s.index,le,[Me,Me,Me,Me],xt,k,De,Ve,Nt,Z,n,x,I,D,w)};if(yt==="line")for(const qe of R2(n.geometry,0,0,Cn,Cn)){const Dt=X3(qe,be,et,a.vertical||K,d,24,fe,s.overscaling,Cn);for(const Mt of Dt)K&&tD(s,K.text,pt,Mt)||bt(qe,Mt)}else if(yt==="line-center"){for(const qe of n.geometry)if(qe.length>1){const Dt=Y3(qe,et,a.vertical||K,d,24,fe);Dt&&bt(qe,Dt)}}else if(n.type==="Polygon")for(const qe of ac(n.geometry,0)){const Dt=J3(qe,16);bt(qe[0],new ml(Dt.x,Dt.y,0))}else if(n.type==="LineString")for(const qe of n.geometry)bt(qe,new ml(qe[0].x,qe[0].y,0));else if(n.type==="Point")for(const qe of n.geometry)for(const Dt of qe)bt([Dt],new ml(Dt.x,Dt.y,0))}function H2(s,n,a,d,y,x,w,b,k,I,D,L,U,Z,K){const J=function(De,be,Me,Ve,et,xt,Nt,yt){const pt=Ve.layout.get("text-rotate").evaluate(xt,{})*Math.PI/180,At=[];for(const Tt of be.positionedLines)for(const bt of Tt.positionedGlyphs){if(!bt.rect)continue;const qe=bt.rect||{};let Dt=o2+1,Mt=!0,Zt=1,Fr=0;const Or=(et||yt)&&bt.vertical,zn=bt.metrics.advance*bt.scale/2;if(yt&&be.verticalizable&&(Fr=Tt.lineOffset/2-(bt.imageName?-(Pn-bt.metrics.width*bt.scale)/2:(bt.scale-1)*Pn)),bt.imageName){const xr=Nt[bt.imageName];Mt=xr.sdf,Zt=xr.pixelRatio,Dt=Oi/Zt}const Gs=et?[bt.x+zn,bt.y]:[0,0];let Xn=et?[0,0]:[bt.x+zn+Me[0],bt.y+Me[1]-Fr],Rn=[0,0];Or&&(Rn=Xn,Xn=[0,0]);const xi=bt.metrics.isDoubleResolution?2:1,wi=(bt.metrics.left-Dt)*bt.scale-zn+Xn[0],bi=(-bt.metrics.top-Dt)*bt.scale+Xn[1],mn=wi+qe.w/xi*bt.scale/Zt,Ln=bi+qe.h/xi*bt.scale/Zt,oi=new A(wi,bi),Kn=new A(mn,bi),Si=new A(wi,Ln),Jn=new A(mn,Ln);if(Or){const xr=new A(-zn,zn-qd),$r=-Math.PI/2,Zr=Pn/2-zn,ns=new A(5-qd-Zr,-(bt.imageName?Zr:0)),nn=new A(...Rn);oi._rotateAround($r,xr)._add(ns)._add(nn),Kn._rotateAround($r,xr)._add(ns)._add(nn),Si._rotateAround($r,xr)._add(ns)._add(nn),Jn._rotateAround($r,xr)._add(ns)._add(nn)}if(pt){const xr=Math.sin(pt),$r=Math.cos(pt),Zr=[$r,-xr,xr,$r];oi._matMult(Zr),Kn._matMult(Zr),Si._matMult(Zr),Jn._matMult(Zr)}const ks=new A(0,0),Fi=new A(0,0);At.push({tl:oi,tr:Kn,bl:Si,br:Jn,tex:qe,writingMode:be.writingMode,glyphOffset:Gs,sectionIndex:bt.sectionIndex,isSDF:Mt,pixelOffsetTL:ks,pixelOffsetBR:Fi,minFontScaleX:0,minFontScaleY:0})}return At}(0,a,b,y,x,w,d,s.allowVerticalPlacement),le=s.textSizeData;let fe=null;le.kind==="source"?(fe=[zo*y.layout.get("text-size").evaluate(w,{})],fe[0]>fl&&Ue(`${s.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)):le.kind==="composite"&&(fe=[zo*Z.compositeTextSizes[0].evaluate(w,{},K),zo*Z.compositeTextSizes[1].evaluate(w,{},K)],(fe[0]>fl||fe[1]>fl)&&Ue(`${s.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)),s.addSymbols(s.text,J,fe,b,x,w,I,n,k.lineStartIndex,k.lineLength,U,K);for(const De of D)L[De]=s.text.placedSymbolArray.length-1;return 4*J.length}function W2(s){for(const n in s)return s[n];return null}function tD(s,n,a,d){const y=s.compareText;if(n in y){const x=y[n];for(let w=x.length-1;w>=0;w--)if(d.dist(x[w])>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const x=G2[15&d];if(!x)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(n,2,1),[b]=new Uint32Array(n,4,1);return new L0(b,w,x,n)}constructor(n,a=64,d=Float64Array,y){if(isNaN(n)||n<0)throw new Error(`Unpexpected numItems value: ${n}.`);this.numItems=+n,this.nodeSize=Math.min(Math.max(+a,2),65535),this.ArrayType=d,this.IndexArrayType=n<65536?Uint16Array:Uint32Array;const x=G2.indexOf(this.ArrayType),w=2*n*this.ArrayType.BYTES_PER_ELEMENT,b=n*this.IndexArrayType.BYTES_PER_ELEMENT,k=(8-b%8)%8;if(x<0)throw new Error(`Unexpected typed array class: ${d}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+k,2*n),this._pos=2*n,this._finished=!0):(this.data=new ArrayBuffer(8+w+b+k),this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+k,2*n),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+x]),new Uint16Array(this.data,2,1)[0]=a,new Uint32Array(this.data,4,1)[0]=n)}add(n,a){const d=this._pos>>1;return this.ids[d]=d,this.coords[this._pos++]=n,this.coords[this._pos++]=a,d}finish(){const n=this._pos>>1;if(n!==this.numItems)throw new Error(`Added ${n} items when expected ${this.numItems}.`);return O0(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(n,a,d,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:x,coords:w,nodeSize:b}=this,k=[0,x.length-1,0],I=[];for(;k.length;){const D=k.pop()||0,L=k.pop()||0,U=k.pop()||0;if(L-U<=b){for(let le=U;le<=L;le++){const fe=w[2*le],De=w[2*le+1];fe>=n&&fe<=d&&De>=a&&De<=y&&I.push(x[le])}continue}const Z=U+L>>1,K=w[2*Z],J=w[2*Z+1];K>=n&&K<=d&&J>=a&&J<=y&&I.push(x[Z]),(D===0?n<=K:a<=J)&&(k.push(U),k.push(Z-1),k.push(1-D)),(D===0?d>=K:y>=J)&&(k.push(Z+1),k.push(L),k.push(1-D))}return I}within(n,a,d){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:x,nodeSize:w}=this,b=[0,y.length-1,0],k=[],I=d*d;for(;b.length;){const D=b.pop()||0,L=b.pop()||0,U=b.pop()||0;if(L-U<=w){for(let le=U;le<=L;le++)q2(x[2*le],x[2*le+1],n,a)<=I&&k.push(y[le]);continue}const Z=U+L>>1,K=x[2*Z],J=x[2*Z+1];q2(K,J,n,a)<=I&&k.push(y[Z]),(D===0?n-d<=K:a-d<=J)&&(b.push(U),b.push(Z-1),b.push(1-D)),(D===0?n+d>=K:a+d>=J)&&(b.push(Z+1),b.push(L),b.push(1-D))}return k}}function O0(s,n,a,d,y,x){if(y-d<=a)return;const w=d+y>>1;Z2(s,n,w,d,y,x),O0(s,n,a,d,w-1,1-x),O0(s,n,a,w+1,y,1-x)}function Z2(s,n,a,d,y,x){for(;y>d;){if(y-d>600){const I=y-d+1,D=a-d+1,L=Math.log(I),U=.5*Math.exp(2*L/3),Z=.5*Math.sqrt(L*U*(I-U)/I)*(D-I/2<0?-1:1);Z2(s,n,a,Math.max(d,Math.floor(a-D*U/I+Z)),Math.min(y,Math.floor(a+(I-D)*U/I+Z)),x)}const w=n[2*a+x];let b=d,k=y;for(Qd(s,n,d,a),n[2*y+x]>w&&Qd(s,n,d,y);bw;)k--}n[2*d+x]===w?Qd(s,n,d,k):(k++,Qd(s,n,k,y)),k<=a&&(d=k+1),a<=k&&(y=k-1)}}function Qd(s,n,a,d){F0(s,a,d),F0(n,2*a,2*d),F0(n,2*a+1,2*d+1)}function F0(s,n,a){const d=s[n];s[n]=s[a],s[a]=d}function q2(s,n,a,d){const y=s-a,x=n-d;return y*y+x*x}var B0;g.bg=void 0,(B0=g.bg||(g.bg={})).create="create",B0.load="load",B0.fullLoad="fullLoad";let Mm=null,ef=[];const N0=1e3/60,$0="loadTime",U0="fullLoadTime",rD={mark(s){performance.mark(s)},frame(s){const n=s;Mm!=null&&ef.push(n-Mm),Mm=n},clearMetrics(){Mm=null,ef=[],performance.clearMeasures($0),performance.clearMeasures(U0);for(const s in g.bg)performance.clearMarks(g.bg[s])},getPerformanceMetrics(){performance.measure($0,g.bg.create,g.bg.load),performance.measure(U0,g.bg.create,g.bg.fullLoad);const s=performance.getEntriesByName($0)[0].duration,n=performance.getEntriesByName(U0)[0].duration,a=ef.length,d=1/(ef.reduce((x,w)=>x+w,0)/a/1e3),y=ef.filter(x=>x>N0).reduce((x,w)=>x+(w-N0)/N0,0);return{loadTime:s,fullLoadTime:n,fps:d,percentDroppedFrames:y/(a+y)*100,totalFrames:a}}};g.$=class extends F{},g.A=Oc,g.B=Y_,g.C=function(s){if(vt==null){const n=s.navigator?s.navigator.userAgent:null;vt=!!s.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return vt},g.D=It,g.E=je,g.F=class{constructor(s,n){this.target=s,this.mapId=n,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Z3(()=>this.process()),this.subscription=function(a,d,y,x){return a.addEventListener(d,y,!1),{unsubscribe:()=>{a.removeEventListener(d,y,!1)}}}(this.target,"message",a=>this.receive(a)),this.globalScope=Re(self)?s:window}registerMessageHandler(s,n){this.messageHandlers[s]=n}sendAsync(s,n){return new Promise((a,d)=>{const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:a,reject:d},n&&n.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];const b={id:y,type:"",origin:location.origin,targetMapId:s.targetMapId,sourceMapId:this.mapId};this.target.postMessage(b)},{once:!0});const x=[],w=Object.assign(Object.assign({},s),{id:y,sourceMapId:this.mapId,origin:location.origin,data:tl(s.data,x)});this.target.postMessage(w,{transfer:x})})}receive(s){const n=s.data,a=n.id;if(!(n.origin!=="file://"&&location.origin!=="file://"&&n.origin!=="resource://android"&&location.origin!=="resource://android"&&n.origin!==location.origin||n.targetMapId&&this.mapId!==n.targetMapId)){if(n.type===""){delete this.tasks[a];const d=this.abortControllers[a];return delete this.abortControllers[a],void(d&&d.abort())}if(Re(self)||n.mustQueue)return this.tasks[a]=n,this.taskQueue.push(a),void this.invoker.trigger();this.processTask(a,n)}}process(){if(this.taskQueue.length===0)return;const s=this.taskQueue.shift(),n=this.tasks[s];delete this.tasks[s],this.taskQueue.length>0&&this.invoker.trigger(),n&&this.processTask(s,n)}processTask(s,n){return c(this,void 0,void 0,function*(){if(n.type===""){const y=this.resolveRejects[s];return delete this.resolveRejects[s],y?void(n.error?y.reject(rl(n.error)):y.resolve(rl(n.data))):void 0}if(!this.messageHandlers[n.type])return void this.completeTask(s,new Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const a=rl(n.data),d=new AbortController;this.abortControllers[s]=d;try{const y=yield this.messageHandlers[n.type](n.sourceMapId,a,d);this.completeTask(s,null,y)}catch(y){this.completeTask(s,y)}})}completeTask(s,n,a){const d=[];delete this.abortControllers[s];const y={id:s,type:"",sourceMapId:this.mapId,origin:location.origin,error:n?tl(n):null,data:tl(a,d)};this.target.postMessage(y,{transfer:d})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},g.G=Jt,g.H=function(){var s=new Oc(16);return Oc!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},g.I=b0,g.J=function(s,n,a){var d,y,x,w,b,k,I,D,L,U,Z,K,J=a[0],le=a[1],fe=a[2];return n===s?(s[12]=n[0]*J+n[4]*le+n[8]*fe+n[12],s[13]=n[1]*J+n[5]*le+n[9]*fe+n[13],s[14]=n[2]*J+n[6]*le+n[10]*fe+n[14],s[15]=n[3]*J+n[7]*le+n[11]*fe+n[15]):(y=n[1],x=n[2],w=n[3],b=n[4],k=n[5],I=n[6],D=n[7],L=n[8],U=n[9],Z=n[10],K=n[11],s[0]=d=n[0],s[1]=y,s[2]=x,s[3]=w,s[4]=b,s[5]=k,s[6]=I,s[7]=D,s[8]=L,s[9]=U,s[10]=Z,s[11]=K,s[12]=d*J+b*le+L*fe+n[12],s[13]=y*J+k*le+U*fe+n[13],s[14]=x*J+I*le+Z*fe+n[14],s[15]=w*J+D*le+K*fe+n[15]),s},g.K=function(s,n,a){var d=a[0],y=a[1],x=a[2];return s[0]=n[0]*d,s[1]=n[1]*d,s[2]=n[2]*d,s[3]=n[3]*d,s[4]=n[4]*y,s[5]=n[5]*y,s[6]=n[6]*y,s[7]=n[7]*y,s[8]=n[8]*x,s[9]=n[9]*x,s[10]=n[10]*x,s[11]=n[11]*x,s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15],s},g.L=Ib,g.M=function(s,n){const a={};for(let d=0;d{const n=window.document.createElement("video");return n.muted=!0,new Promise(a=>{n.onloadstart=()=>{a(n)};for(const d of s){const y=window.document.createElement("source");_r(d)||(n.crossOrigin="Anonymous"),y.src=d,n.appendChild(y)}})},g.a4=function(){return Fe++},g.a5=_t,g.a6=jc,g.a7=yd,g.a8=mu,g.a9=M2,g.aA=function(s){if(s.type==="custom")return new G3(s);switch(s.type){case"background":return new V3(s);case"circle":return new MA(s);case"fill":return new ZA(s);case"fill-extrusion":return new l3(s);case"heatmap":return new DA(s);case"hillshade":return new RA(s);case"line":return new g3(s);case"raster":return new W3(s);case"symbol":return new Tm(s)}},g.aB=it,g.aC=function(s,n){if(!s)return[{command:"setStyle",args:[n]}];let a=[];try{if(!Te(s.version,n.version))return[{command:"setStyle",args:[n]}];Te(s.center,n.center)||a.push({command:"setCenter",args:[n.center]}),Te(s.zoom,n.zoom)||a.push({command:"setZoom",args:[n.zoom]}),Te(s.bearing,n.bearing)||a.push({command:"setBearing",args:[n.bearing]}),Te(s.pitch,n.pitch)||a.push({command:"setPitch",args:[n.pitch]}),Te(s.sprite,n.sprite)||a.push({command:"setSprite",args:[n.sprite]}),Te(s.glyphs,n.glyphs)||a.push({command:"setGlyphs",args:[n.glyphs]}),Te(s.transition,n.transition)||a.push({command:"setTransition",args:[n.transition]}),Te(s.light,n.light)||a.push({command:"setLight",args:[n.light]}),Te(s.terrain,n.terrain)||a.push({command:"setTerrain",args:[n.terrain]}),Te(s.sky,n.sky)||a.push({command:"setSky",args:[n.sky]}),Te(s.projection,n.projection)||a.push({command:"setProjection",args:[n.projection]});const d={},y=[];(function(w,b,k,I){let D;for(D in b=b||{},w=w||{})Object.prototype.hasOwnProperty.call(w,D)&&(Object.prototype.hasOwnProperty.call(b,D)||Ne(D,k,I));for(D in b)Object.prototype.hasOwnProperty.call(b,D)&&(Object.prototype.hasOwnProperty.call(w,D)?Te(w[D],b[D])||(w[D].type==="geojson"&&b[D].type==="geojson"&&kt(w,b,D)?Ge(k,{command:"setGeoJSONSourceData",args:[D,b[D].data]}):ot(D,b,k,I)):tt(D,b,k))})(s.sources,n.sources,y,d);const x=[];s.layers&&s.layers.forEach(w=>{"source"in w&&d[w.source]?a.push({command:"removeLayer",args:[w.id]}):x.push(w)}),a=a.concat(y),function(w,b,k){b=b||[];const I=(w=w||[]).map(Bt),D=b.map(Bt),L=w.reduce(Tr,{}),U=b.reduce(Tr,{}),Z=I.slice(),K=Object.create(null);let J,le,fe,De,be;for(let Me=0,Ve=0;Me@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(a,d,y,x)=>{const w=y||x;return n[d]=!w||w.toLowerCase(),""}),n["max-age"]){const a=parseInt(n["max-age"],10);isNaN(a)?delete n["max-age"]:n["max-age"]=a}return n},g.ab=function(s,n){const a=[];for(const d in s)d in n||a.push(d);return a},g.ac=oe,g.ad=function(s,n,a){var d=Math.sin(a),y=Math.cos(a),x=n[0],w=n[1],b=n[2],k=n[3],I=n[4],D=n[5],L=n[6],U=n[7];return n!==s&&(s[8]=n[8],s[9]=n[9],s[10]=n[10],s[11]=n[11],s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15]),s[0]=x*y+I*d,s[1]=w*y+D*d,s[2]=b*y+L*d,s[3]=k*y+U*d,s[4]=I*y-x*d,s[5]=D*y-w*d,s[6]=L*y-b*d,s[7]=U*y-k*d,s},g.ae=function(s){var n=new Oc(16);return n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=s[3],n[4]=s[4],n[5]=s[5],n[6]=s[6],n[7]=s[7],n[8]=s[8],n[9]=s[9],n[10]=s[10],n[11]=s[11],n[12]=s[12],n[13]=s[13],n[14]=s[14],n[15]=s[15],n},g.af=gm,g.ag=function(s,n){let a=0,d=0;if(s.kind==="constant")d=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:y,minZoom:x,maxZoom:w}=s,b=y?oe(yi.interpolationFactor(y,n,x,w),0,1):0;s.kind==="camera"?d=gi.number(s.minSize,s.maxSize,b):a=b}return{uSizeT:a,uSize:d}},g.ai=function(s,{uSize:n,uSizeT:a},{lowerSize:d,upperSize:y}){return s.kind==="source"?d/zo:s.kind==="composite"?gi.number(d/zo,y/zo,a):n},g.aj=E0,g.ak=function(s,n,a,d){const y=n.y-s.y,x=n.x-s.x,w=d.y-a.y,b=d.x-a.x,k=w*x-b*y;if(k===0)return null;const I=(b*(s.y-a.y)-w*(s.x-a.x))/k;return new A(s.x+I*x,s.y+I*y)},g.al=R2,g.am=bb,g.an=a0,g.ao=function(s){let n=1/0,a=1/0,d=-1/0,y=-1/0;for(const x of s)n=Math.min(n,x.x),a=Math.min(a,x.y),d=Math.max(d,x.x),y=Math.max(y,x.y);return[n,a,d,y]},g.ap=Pn,g.ar=T0,g.as=function(s,n){var a=n[0],d=n[1],y=n[2],x=n[3],w=n[4],b=n[5],k=n[6],I=n[7],D=n[8],L=n[9],U=n[10],Z=n[11],K=n[12],J=n[13],le=n[14],fe=n[15],De=a*b-d*w,be=a*k-y*w,Me=a*I-x*w,Ve=d*k-y*b,et=d*I-x*b,xt=y*I-x*k,Nt=D*J-L*K,yt=D*le-U*K,pt=D*fe-Z*K,At=L*le-U*J,Tt=L*fe-Z*J,bt=U*fe-Z*le,qe=De*bt-be*Tt+Me*At+Ve*pt-et*yt+xt*Nt;return qe?(s[0]=(b*bt-k*Tt+I*At)*(qe=1/qe),s[1]=(y*Tt-d*bt-x*At)*qe,s[2]=(J*xt-le*et+fe*Ve)*qe,s[3]=(U*et-L*xt-Z*Ve)*qe,s[4]=(k*pt-w*bt-I*yt)*qe,s[5]=(a*bt-y*pt+x*yt)*qe,s[6]=(le*Me-K*xt-fe*be)*qe,s[7]=(D*xt-U*Me+Z*be)*qe,s[8]=(w*Tt-b*pt+I*Nt)*qe,s[9]=(d*pt-a*Tt-x*Nt)*qe,s[10]=(K*et-J*Me+fe*De)*qe,s[11]=(L*Me-D*et-Z*De)*qe,s[12]=(b*yt-w*At-k*Nt)*qe,s[13]=(a*At-d*yt+y*Nt)*qe,s[14]=(J*be-K*Ve-le*De)*qe,s[15]=(D*Ve-L*be+U*De)*qe,s):null},g.at=R0,g.au=k0,g.av=L0,g.aw=function(){const s={},n=ie.$version;for(const a in ie.$root){const d=ie.$root[a];if(d.required){let y=null;y=a==="version"?n:d.type==="array"?[]:{},y!=null&&(s[a]=y)}}return s},g.ax=Ad,g.ay=Vt,g.az=function(s){s=s.slice();const n=Object.create(null);for(let a=0;a25||d<0||d>=1||a<0||a>=1)},g.bc=function(s,n){return s[0]=n[0],s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n[1],s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=n[2],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s},g.bd=class extends z{},g.be=M0,g.bf=rD,g.bh=er,g.bi=function(s,n){nt.REGISTERED_PROTOCOLS[s]=n},g.bj=function(s){delete nt.REGISTERED_PROTOCOLS[s]},g.bk=function(s,n){const a={};for(let y=0;ybt*Pn)}let yt=w?"center":a.get("text-justify").evaluate(I,{},s.canonical);const pt=a.get("symbol-placement")==="point"?a.get("text-max-width").evaluate(I,{},s.canonical)*Pn:1/0,At=()=>{s.bucket.allowVerticalPlacement&&Dd(Me)&&(K.vertical=bm(J,s.glyphMap,s.glyphPositions,s.imagePositions,D,pt,x,xt,"left",et,fe,g.ah.vertical,!0,U,L))};if(!w&&Nt){const Tt=new Set;if(yt==="auto")for(let qe=0;qec(void 0,void 0,void 0,function*(){if(s.byteLength===0)return createImageBitmap(new ImageData(1,1));const n=new Blob([new Uint8Array(s)],{type:"image/png"});try{return createImageBitmap(n)}catch(a){throw new Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),g.e=ge,g.f=s=>new Promise((n,a)=>{const d=new Image;d.onload=()=>{n(d),URL.revokeObjectURL(d.src),d.onload=null,window.requestAnimationFrame(()=>{d.src=Be})},d.onerror=()=>a(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 y=new Blob([new Uint8Array(s)],{type:"image/png"});d.src=s.byteLength?URL.createObjectURL(y):Be}),g.g=rt,g.h=(s,n)=>Yt(ge(s,{type:"json"}),n),g.i=Re,g.j=V,g.k=Xr,g.l=(s,n)=>Yt(ge(s,{type:"arrayBuffer"}),n),g.m=Yt,g.n=function(s){return new x0(s).readFields(A3,[])},g.o=Ud,g.p=a2,g.q=v,g.r=q_,g.s=_r,g.t=Pd,g.u=la,g.v=ie,g.w=Ue,g.x=function([s,n,a]){return n+=90,n*=Math.PI/180,a*=Math.PI/180,{x:s*Math.cos(n)*Math.sin(a),y:s*Math.sin(n)*Math.sin(a),z:s*Math.cos(a)}},g.y=gi,g.z=Vr}),h("worker",["./shared"],function(g){class c{constructor(G){this.keyCache={},G&&this.replace(G)}replace(G){this._layerConfigs={},this._layers={},this.update(G,[])}update(G,W){for(const ue of G){this._layerConfigs[ue.id]=ue;const Se=this._layers[ue.id]=g.aA(ue);Se._featureFilter=g.a7(Se.filter),this.keyCache[ue.id]&&delete this.keyCache[ue.id]}for(const ue of W)delete this.keyCache[ue],delete this._layerConfigs[ue],delete this._layers[ue];this.familiesBySource={};const ee=g.bk(Object.values(this._layerConfigs),this.keyCache);for(const ue of ee){const Se=ue.map($e=>this._layers[$e.id]),Ie=Se[0];if(Ie.visibility==="none")continue;const Ae=Ie.source||"";let _e=this.familiesBySource[Ae];_e||(_e=this.familiesBySource[Ae]={});const He=Ie.sourceLayer||"_geojsonTileLayer";let Je=_e[He];Je||(Je=_e[He]=[]),Je.push(Se)}}}class T{constructor(G){const W={},ee=[];for(const Ae in G){const _e=G[Ae],He=W[Ae]={};for(const Je in _e){const $e=_e[+Je];if(!$e||$e.bitmap.width===0||$e.bitmap.height===0)continue;const ut={x:0,y:0,w:$e.bitmap.width+2,h:$e.bitmap.height+2};ee.push(ut),He[Je]={rect:ut,metrics:$e.metrics}}}const{w:ue,h:Se}=g.p(ee),Ie=new g.o({width:ue||1,height:Se||1});for(const Ae in G){const _e=G[Ae];for(const He in _e){const Je=_e[+He];if(!Je||Je.bitmap.width===0||Je.bitmap.height===0)continue;const $e=W[Ae][He].rect;g.o.copy(Je.bitmap,Ie,{x:0,y:0},{x:$e.x+1,y:$e.y+1},Je.bitmap)}}this.image=Ie,this.positions=W}}g.bl("GlyphAtlas",T);class P{constructor(G){this.tileID=new g.S(G.tileID.overscaledZ,G.tileID.wrap,G.tileID.canonical.z,G.tileID.canonical.x,G.tileID.canonical.y),this.uid=G.uid,this.zoom=G.zoom,this.pixelRatio=G.pixelRatio,this.tileSize=G.tileSize,this.source=G.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=G.showCollisionBoxes,this.collectResourceTiming=!!G.collectResourceTiming,this.returnDependencies=!!G.returnDependencies,this.promoteId=G.promoteId,this.inFlightDependencies=[]}parse(G,W,ee,ue){return g._(this,void 0,void 0,function*(){this.status="parsing",this.data=G,this.collisionBoxArray=new g.a5;const Se=new g.bm(Object.keys(G.layers).sort()),Ie=new g.bn(this.tileID,this.promoteId);Ie.bucketLayerIDs=[];const Ae={},_e={featureIndex:Ie,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ee},He=W.familiesBySource[this.source];for(const rr in He){const Mr=G.layers[rr];if(!Mr)continue;Mr.version===1&&g.w(`Vector tile source "${this.source}" layer "${rr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Yr=Se.encode(rr),Dn=[];for(let Bn=0;Bn=ni.maxzoom||ni.visibility!=="none"&&(R(Bn,this.zoom,ee),(Ae[ni.id]=ni.createBucket({index:Ie.bucketLayerIDs.length,layers:Bn,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Yr,sourceID:this.source})).populate(Dn,_e,this.tileID.canonical),Ie.bucketLayerIDs.push(Bn.map(Fa=>Fa.id)))}}const Je=g.aF(_e.glyphDependencies,rr=>Object.keys(rr).map(Number));this.inFlightDependencies.forEach(rr=>rr==null?void 0:rr.abort()),this.inFlightDependencies=[];let $e=Promise.resolve({});if(Object.keys(Je).length){const rr=new AbortController;this.inFlightDependencies.push(rr),$e=ue.sendAsync({type:"GG",data:{stacks:Je,source:this.source,tileID:this.tileID,type:"glyphs"}},rr)}const ut=Object.keys(_e.iconDependencies);let Rt=Promise.resolve({});if(ut.length){const rr=new AbortController;this.inFlightDependencies.push(rr),Rt=ue.sendAsync({type:"GI",data:{icons:ut,source:this.source,tileID:this.tileID,type:"icons"}},rr)}const Ot=Object.keys(_e.patternDependencies);let mr=Promise.resolve({});if(Ot.length){const rr=new AbortController;this.inFlightDependencies.push(rr),mr=ue.sendAsync({type:"GI",data:{icons:Ot,source:this.source,tileID:this.tileID,type:"patterns"}},rr)}const[Qt,gr,or]=yield Promise.all([$e,Rt,mr]),Tn=new T(Qt),rn=new g.bo(gr,or);for(const rr in Ae){const Mr=Ae[rr];Mr instanceof g.a6?(R(Mr.layers,this.zoom,ee),g.bp({bucket:Mr,glyphMap:Qt,glyphPositions:Tn.positions,imageMap:gr,imagePositions:rn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Mr.hasPattern&&(Mr instanceof g.bq||Mr instanceof g.br||Mr instanceof g.bs)&&(R(Mr.layers,this.zoom,ee),Mr.addFeatures(_e,this.tileID.canonical,rn.patternPositions))}return this.status="done",{buckets:Object.values(Ae).filter(rr=>!rr.isEmpty()),featureIndex:Ie,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Tn.image,imageAtlas:rn,glyphMap:this.returnDependencies?Qt:null,iconMap:this.returnDependencies?gr:null,glyphPositions:this.returnDependencies?Tn.positions:null}})}}function R(he,G,W){const ee=new g.z(G);for(const ue of he)ue.recalculate(ee,W)}class A{constructor(G,W,ee){this.actor=G,this.layerIndex=W,this.availableImages=ee,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(G,W){return g._(this,void 0,void 0,function*(){const ee=yield g.l(G.request,W);try{return{vectorTile:new g.bt.VectorTile(new g.bu(ee.data)),rawData:ee.data,cacheControl:ee.cacheControl,expires:ee.expires}}catch(ue){const Se=new Uint8Array(ee.data);let Ie=`Unable to parse the tile at ${G.request.url}, `;throw Ie+=Se[0]===31&&Se[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ue.message}`,new Error(Ie)}})}loadTile(G){return g._(this,void 0,void 0,function*(){const W=G.uid,ee=!!(G&&G.request&&G.request.collectResourceTiming)&&new g.bv(G.request),ue=new P(G);this.loading[W]=ue;const Se=new AbortController;ue.abort=Se;try{const Ie=yield this.loadVectorTile(G,Se);if(delete this.loading[W],!Ie)return null;const Ae=Ie.rawData,_e={};Ie.expires&&(_e.expires=Ie.expires),Ie.cacheControl&&(_e.cacheControl=Ie.cacheControl);const He={};if(ee){const $e=ee.finish();$e&&(He.resourceTiming=JSON.parse(JSON.stringify($e)))}ue.vectorTile=Ie.vectorTile;const Je=ue.parse(Ie.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[W]=ue,this.fetching[W]={rawTileData:Ae,cacheControl:_e,resourceTiming:He};try{const $e=yield Je;return g.e({rawTileData:Ae.slice(0)},$e,_e,He)}finally{delete this.fetching[W]}}catch(Ie){throw delete this.loading[W],ue.status="done",this.loaded[W]=ue,Ie}})}reloadTile(G){return g._(this,void 0,void 0,function*(){const W=G.uid;if(!this.loaded||!this.loaded[W])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const ee=this.loaded[W];if(ee.showCollisionBoxes=G.showCollisionBoxes,ee.status==="parsing"){const ue=yield ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor);let Se;if(this.fetching[W]){const{rawTileData:Ie,cacheControl:Ae,resourceTiming:_e}=this.fetching[W];delete this.fetching[W],Se=g.e({rawTileData:Ie.slice(0)},ue,Ae,_e)}else Se=ue;return Se}if(ee.status==="done"&&ee.vectorTile)return ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(G){return g._(this,void 0,void 0,function*(){const W=this.loading,ee=G.uid;W&&W[ee]&&W[ee].abort&&(W[ee].abort.abort(),delete W[ee])})}removeTile(G){return g._(this,void 0,void 0,function*(){this.loaded&&this.loaded[G.uid]&&delete this.loaded[G.uid]})}}class M{constructor(){this.loaded={}}loadTile(G){return g._(this,void 0,void 0,function*(){const{uid:W,encoding:ee,rawImageData:ue,redFactor:Se,greenFactor:Ie,blueFactor:Ae,baseShift:_e}=G,He=ue.width+2,Je=ue.height+2,$e=g.b(ue)?new g.R({width:He,height:Je},yield g.bw(ue,-1,-1,He,Je)):ue,ut=new g.bx(W,$e,ee,Se,Ie,Ae,_e);return this.loaded=this.loaded||{},this.loaded[W]=ut,ut})}removeTile(G){const W=this.loaded,ee=G.uid;W&&W[ee]&&delete W[ee]}}function N(he,G){if(he.length!==0){Y(he[0],G);for(var W=1;W=Math.abs(Ae)?W-_e+Ae:Ae-_e+W,W=_e}W+ee>=0!=!!G&&he.reverse()}var j=g.by(function he(G,W){var ee,ue=G&&G.type;if(ue==="FeatureCollection")for(ee=0;ee>31}function Re(he,G){for(var W=he.loadGeometry(),ee=he.type,ue=0,Se=0,Ie=W.length,Ae=0;Aehe},Le=Math.fround||(Ke=new Float32Array(1),he=>(Ke[0]=+he,Ke[0]));var Ke;const xe=3,Ee=5,mt=6;class nt{constructor(G){this.options=Object.assign(Object.create(Be),G),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(G){const{log:W,minZoom:ee,maxZoom:ue}=this.options;W&&console.time("total time");const Se=`prepare ${G.length} points`;W&&console.time(Se),this.points=G;const Ie=[];for(let _e=0;_e=ee;_e--){const He=+Date.now();Ae=this.trees[_e]=this._createTree(this._cluster(Ae,_e)),W&&console.log("z%d: %d clusters in %dms",_e,Ae.numItems,+Date.now()-He)}return W&&console.timeEnd("total time"),this}getClusters(G,W){let ee=((G[0]+180)%360+360)%360-180;const ue=Math.max(-90,Math.min(90,G[1]));let Se=G[2]===180?180:((G[2]+180)%360+360)%360-180;const Ie=Math.max(-90,Math.min(90,G[3]));if(G[2]-G[0]>=360)ee=-180,Se=180;else if(ee>Se){const $e=this.getClusters([ee,ue,180,Ie],W),ut=this.getClusters([-180,ue,Se,Ie],W);return $e.concat(ut)}const Ae=this.trees[this._limitZoom(W)],_e=Ae.range(er(ee),Vt(Ie),er(Se),Vt(ue)),He=Ae.data,Je=[];for(const $e of _e){const ut=this.stride*$e;Je.push(He[ut+Ee]>1?rt(He,ut,this.clusterProps):this.points[He[ut+xe]])}return Je}getChildren(G){const W=this._getOriginId(G),ee=this._getOriginZoom(G),ue="No cluster with the specified id.",Se=this.trees[ee];if(!Se)throw new Error(ue);const Ie=Se.data;if(W*this.stride>=Ie.length)throw new Error(ue);const Ae=this.options.radius/(this.options.extent*Math.pow(2,ee-1)),_e=Se.within(Ie[W*this.stride],Ie[W*this.stride+1],Ae),He=[];for(const Je of _e){const $e=Je*this.stride;Ie[$e+4]===G&&He.push(Ie[$e+Ee]>1?rt(Ie,$e,this.clusterProps):this.points[Ie[$e+xe]])}if(He.length===0)throw new Error(ue);return He}getLeaves(G,W,ee){const ue=[];return this._appendLeaves(ue,G,W=W||10,ee=ee||0,0),ue}getTile(G,W,ee){const ue=this.trees[this._limitZoom(G)],Se=Math.pow(2,G),{extent:Ie,radius:Ae}=this.options,_e=Ae/Ie,He=(ee-_e)/Se,Je=(ee+1+_e)/Se,$e={features:[]};return this._addTileFeatures(ue.range((W-_e)/Se,He,(W+1+_e)/Se,Je),ue.data,W,ee,Se,$e),W===0&&this._addTileFeatures(ue.range(1-_e/Se,He,1,Je),ue.data,Se,ee,Se,$e),W===Se-1&&this._addTileFeatures(ue.range(0,He,_e/Se,Je),ue.data,-1,ee,Se,$e),$e.features.length?$e:null}getClusterExpansionZoom(G){let W=this._getOriginZoom(G)-1;for(;W<=this.options.maxZoom;){const ee=this.getChildren(G);if(W++,ee.length!==1)break;G=ee[0].properties.cluster_id}return W}_appendLeaves(G,W,ee,ue,Se){const Ie=this.getChildren(W);for(const Ae of Ie){const _e=Ae.properties;if(_e&&_e.cluster?Se+_e.point_count<=ue?Se+=_e.point_count:Se=this._appendLeaves(G,_e.cluster_id,ee,ue,Se):Se1;let Je,$e,ut;if(He)Je=Jt(W,_e,this.clusterProps),$e=W[_e],ut=W[_e+1];else{const mr=this.points[W[_e+xe]];Je=mr.properties;const[Qt,gr]=mr.geometry.coordinates;$e=er(Qt),ut=Vt(gr)}const Rt={type:1,geometry:[[Math.round(this.options.extent*($e*Se-ee)),Math.round(this.options.extent*(ut*Se-ue))]],tags:Je};let Ot;Ot=He||this.options.generateId?W[_e+xe]:this.points[W[_e+xe]].id,Ot!==void 0&&(Rt.id=Ot),Ie.features.push(Rt)}}_limitZoom(G){return Math.max(this.options.minZoom,Math.min(Math.floor(+G),this.options.maxZoom+1))}_cluster(G,W){const{radius:ee,extent:ue,reduce:Se,minPoints:Ie}=this.options,Ae=ee/(ue*Math.pow(2,W)),_e=G.data,He=[],Je=this.stride;for(let $e=0;$e<_e.length;$e+=Je){if(_e[$e+2]<=W)continue;_e[$e+2]=W;const ut=_e[$e],Rt=_e[$e+1],Ot=G.within(_e[$e],_e[$e+1],Ae),mr=_e[$e+Ee];let Qt=mr;for(const gr of Ot){const or=gr*Je;_e[or+2]>W&&(Qt+=_e[or+Ee])}if(Qt>mr&&Qt>=Ie){let gr,or=ut*mr,Tn=Rt*mr,rn=-1;const rr=(($e/Je|0)<<5)+(W+1)+this.points.length;for(const Mr of Ot){const Yr=Mr*Je;if(_e[Yr+2]<=W)continue;_e[Yr+2]=W;const Dn=_e[Yr+Ee];or+=_e[Yr]*Dn,Tn+=_e[Yr+1]*Dn,_e[Yr+4]=rr,Se&&(gr||(gr=this._map(_e,$e,!0),rn=this.clusterProps.length,this.clusterProps.push(gr)),Se(gr,this._map(_e,Yr)))}_e[$e+4]=rr,He.push(or/Qt,Tn/Qt,1/0,rr,-1,Qt),Se&&He.push(rn)}else{for(let gr=0;gr1)for(const gr of Ot){const or=gr*Je;if(!(_e[or+2]<=W)){_e[or+2]=W;for(let Tn=0;Tn>5}_getOriginZoom(G){return(G-this.points.length)%32}_map(G,W,ee){if(G[W+Ee]>1){const Ie=this.clusterProps[G[W+mt]];return ee?Object.assign({},Ie):Ie}const ue=this.points[G[W+xe]].properties,Se=this.options.map(ue);return ee&&Se===ue?Object.assign({},Se):Se}}function rt(he,G,W){return{type:"Feature",id:he[G+xe],properties:Jt(he,G,W),geometry:{type:"Point",coordinates:[(ee=he[G],360*(ee-.5)),Yt(he[G+1])]}};var ee}function Jt(he,G,W){const ee=he[G+Ee],ue=ee>=1e4?`${Math.round(ee/1e3)}k`:ee>=1e3?Math.round(ee/100)/10+"k":ee,Se=he[G+mt],Ie=Se===-1?{}:Object.assign({},W[Se]);return Object.assign(Ie,{cluster:!0,cluster_id:he[G+xe],point_count:ee,point_count_abbreviated:ue})}function er(he){return he/360+.5}function Vt(he){const G=Math.sin(he*Math.PI/180),W=.5-.25*Math.log((1+G)/(1-G))/Math.PI;return W<0?0:W>1?1:W}function Yt(he){const G=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(G))/Math.PI-90}function _r(he,G,W,ee){let ue=ee;const Se=G+(W-G>>1);let Ie,Ae=W-G;const _e=he[G],He=he[G+1],Je=he[W],$e=he[W+1];for(let ut=G+3;utue)Ie=ut,ue=Rt;else if(Rt===ue){const Ot=Math.abs(ut-Se);Otee&&(Ie-G>3&&_r(he,G,Ie,ee),he[Ie+2]=ue,W-Ie>3&&_r(he,Ie,W,ee))}function fr(he,G,W,ee,ue,Se){let Ie=ue-W,Ae=Se-ee;if(Ie!==0||Ae!==0){const _e=((he-W)*Ie+(G-ee)*Ae)/(Ie*Ie+Ae*Ae);_e>1?(W=ue,ee=Se):_e>0&&(W+=Ie*_e,ee+=Ae*_e)}return Ie=he-W,Ae=G-ee,Ie*Ie+Ae*Ae}function br(he,G,W,ee){const ue={id:he??null,type:G,geometry:W,tags:ee,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(G==="Point"||G==="MultiPoint"||G==="LineString")Xr(ue,W);else if(G==="Polygon")Xr(ue,W[0]);else if(G==="MultiLineString")for(const Se of W)Xr(ue,Se);else if(G==="MultiPolygon")for(const Se of W)Xr(ue,Se[0]);return ue}function Xr(he,G){for(let W=0;W0&&(Ie+=ee?(ue*Je-He*Se)/2:Math.sqrt(Math.pow(He-ue,2)+Math.pow(Je-Se,2))),ue=He,Se=Je}const Ae=G.length-3;G[2]=1,_r(G,0,Ae,W),G[Ae+2]=1,G.size=Math.abs(Ie),G.start=0,G.end=G.size}function de(he,G,W,ee){for(let ue=0;ue1?1:W}function Ge(he,G,W,ee,ue,Se,Ie,Ae){if(ee/=G,Se>=(W/=G)&&Ie=ee)return null;const _e=[];for(const He of he){const Je=He.geometry;let $e=He.type;const ut=ue===0?He.minX:He.minY,Rt=ue===0?He.maxX:He.maxY;if(ut>=W&&Rt=ee)continue;let Ot=[];if($e==="Point"||$e==="MultiPoint")tt(Je,Ot,W,ee,ue);else if($e==="LineString")Ne(Je,Ot,W,ee,ue,!1,Ae.lineMetrics);else if($e==="MultiLineString")kt(Je,Ot,W,ee,ue,!1);else if($e==="Polygon")kt(Je,Ot,W,ee,ue,!0);else if($e==="MultiPolygon")for(const mr of Je){const Qt=[];kt(mr,Qt,W,ee,ue,!0),Qt.length&&Ot.push(Qt)}if(Ot.length){if(Ae.lineMetrics&&$e==="LineString"){for(const mr of Ot)_e.push(br(He.id,$e,mr,He.tags));continue}$e!=="LineString"&&$e!=="MultiLineString"||(Ot.length===1?($e="LineString",Ot=Ot[0]):$e="MultiLineString"),$e!=="Point"&&$e!=="MultiPoint"||($e=Ot.length===3?"Point":"MultiPoint"),_e.push(br(He.id,$e,Ot,He.tags))}}return _e.length?_e:null}function tt(he,G,W,ee,ue){for(let Se=0;Se=W&&Ie<=ee&&at(G,he[Se],he[Se+1],he[Se+2])}}function Ne(he,G,W,ee,ue,Se,Ie){let Ae=ot(he);const _e=ue===0?Bt:Tr;let He,Je,$e=he.start;for(let Qt=0;QtW&&(Je=_e(Ae,gr,or,rn,rr,W),Ie&&(Ae.start=$e+He*Je)):Mr>ee?Yr=W&&(Je=_e(Ae,gr,or,rn,rr,W),Dn=!0),Yr>ee&&Mr<=ee&&(Je=_e(Ae,gr,or,rn,rr,ee),Dn=!0),!Se&&Dn&&(Ie&&(Ae.end=$e+He*Je),G.push(Ae),Ae=ot(he)),Ie&&($e+=He)}let ut=he.length-3;const Rt=he[ut],Ot=he[ut+1],mr=ue===0?Rt:Ot;mr>=W&&mr<=ee&&at(Ae,Rt,Ot,he[ut+2]),ut=Ae.length-3,Se&&ut>=3&&(Ae[ut]!==Ae[0]||Ae[ut+1]!==Ae[1])&&at(Ae,Ae[0],Ae[1],Ae[2]),Ae.length&&G.push(Ae)}function ot(he){const G=[];return G.size=he.size,G.start=he.start,G.end=he.end,G}function kt(he,G,W,ee,ue,Se){for(const Ie of he)Ne(Ie,G,W,ee,ue,Se,!1)}function at(he,G,W,ee){he.push(G,W,ee)}function Bt(he,G,W,ee,ue,Se){const Ie=(Se-G)/(ee-G);return at(he,Se,W+(ue-W)*Ie,1),Ie}function Tr(he,G,W,ee,ue,Se){const Ie=(Se-W)/(ue-W);return at(he,G+(ee-G)*Ie,Se,1),Ie}function Ze(he,G){const W=[];for(let ee=0;ee0&&G.size<(ue?Ie:ee))return void(W.numPoints+=G.length/3);const Ae=[];for(let _e=0;_eIe)&&(W.numSimplified++,Ae.push(G[_e],G[_e+1])),W.numPoints++;ue&&function(_e,He){let Je=0;for(let $e=0,ut=_e.length,Rt=ut-2;$e0===He)for(let $e=0,ut=_e.length;$e24)throw new Error("maxZoom should be in the 0-24 range");if(W.promoteId&&W.generateId)throw new Error("promoteId and generateId cannot be used together.");let ue=function(Se,Ie){const Ae=[];if(Se.type==="FeatureCollection")for(let _e=0;_e1&&console.time("creation"),Rt=this.tiles[ut]=pi(G,W,ee,ue,He),this.tileCoords.push({z:W,x:ee,y:ue}),Je)){Je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",W,ee,ue,Rt.numFeatures,Rt.numPoints,Rt.numSimplified),console.timeEnd("creation"));const Dn=`z${W}`;this.stats[Dn]=(this.stats[Dn]||0)+1,this.total++}if(Rt.source=G,Se==null){if(W===He.indexMaxZoom||Rt.numPoints<=He.indexMaxPoints)continue}else{if(W===He.maxZoom||W===Se)continue;if(Se!=null){const Dn=Se-W;if(ee!==Ie>>Dn||ue!==Ae>>Dn)continue}}if(Rt.source=null,G.length===0)continue;Je>1&&console.time("clipping");const Ot=.5*He.buffer/He.extent,mr=.5-Ot,Qt=.5+Ot,gr=1+Ot;let or=null,Tn=null,rn=null,rr=null,Mr=Ge(G,$e,ee-Ot,ee+Qt,0,Rt.minX,Rt.maxX,He),Yr=Ge(G,$e,ee+mr,ee+gr,0,Rt.minX,Rt.maxX,He);G=null,Mr&&(or=Ge(Mr,$e,ue-Ot,ue+Qt,1,Rt.minY,Rt.maxY,He),Tn=Ge(Mr,$e,ue+mr,ue+gr,1,Rt.minY,Rt.maxY,He),Mr=null),Yr&&(rn=Ge(Yr,$e,ue-Ot,ue+Qt,1,Rt.minY,Rt.maxY,He),rr=Ge(Yr,$e,ue+mr,ue+gr,1,Rt.minY,Rt.maxY,He),Yr=null),Je>1&&console.timeEnd("clipping"),_e.push(or||[],W+1,2*ee,2*ue),_e.push(Tn||[],W+1,2*ee,2*ue+1),_e.push(rn||[],W+1,2*ee+1,2*ue),_e.push(rr||[],W+1,2*ee+1,2*ue+1)}}getTile(G,W,ee){G=+G,W=+W,ee=+ee;const ue=this.options,{extent:Se,debug:Ie}=ue;if(G<0||G>24)return null;const Ae=1<1&&console.log("drilling down to z%d-%d-%d",G,W,ee);let He,Je=G,$e=W,ut=ee;for(;!He&&Je>0;)Je--,$e>>=1,ut>>=1,He=this.tiles[mi(Je,$e,ut)];return He&&He.source?(Ie>1&&(console.log("found parent tile z%d-%d-%d",Je,$e,ut),console.time("drilling down")),this.splitTile(He.source,Je,$e,ut,G,W,ee),Ie>1&&console.timeEnd("drilling down"),this.tiles[_e]?_n(this.tiles[_e],Se):null):null}}function mi(he,G,W){return 32*((1<{$e.properties=Rt;const Ot={};for(const mr of ut)Ot[mr]=_e[mr].evaluate(Je,$e);return Ot},Ie.reduce=(Rt,Ot)=>{$e.properties=Ot;for(const mr of ut)Je.accumulated=Rt[mr],Rt[mr]=He[mr].evaluate(Je,$e)},Ie}(G)).load((yield this._pendingData).features):(ue=yield this._pendingData,new Kr(ue,G.geojsonVtOptions)),this.loaded={};const Se={};if(ee){const Ie=ee.finish();Ie&&(Se.resourceTiming={},Se.resourceTiming[G.source]=JSON.parse(JSON.stringify(Ie)))}return Se}catch(Se){if(delete this._pendingRequest,g.bB(Se))return{abandoned:!0};throw Se}var ue})}getData(){return g._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(G){const W=this.loaded;return W&&W[G.uid]?super.reloadTile(G):this.loadTile(G)}loadAndProcessGeoJSON(G,W){return g._(this,void 0,void 0,function*(){let ee=yield this.loadGeoJSON(G,W);if(delete this._pendingRequest,typeof ee!="object")throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`);if(j(ee,!0),G.filter){const ue=g.bC(G.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ue.result==="error")throw new Error(ue.value.map(Ie=>`${Ie.key}: ${Ie.message}`).join(", "));ee={type:"FeatureCollection",features:ee.features.filter(Ie=>ue.value.evaluate({zoom:0},Ie))}}return ee})}loadGeoJSON(G,W){return g._(this,void 0,void 0,function*(){const{promoteId:ee}=G;if(G.request){const ue=yield g.h(G.request,W);return this._dataUpdateable=Yi(ue.data,ee)?fs(ue.data,ee):void 0,ue.data}if(typeof G.data=="string")try{const ue=JSON.parse(G.data);return this._dataUpdateable=Yi(ue,ee)?fs(ue,ee):void 0,ue}catch{throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`)}if(!G.dataDiff)throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${G.source}`);return function(ue,Se,Ie){var Ae,_e,He,Je;if(Se.removeAll&&ue.clear(),Se.remove)for(const $e of Se.remove)ue.delete($e);if(Se.add)for(const $e of Se.add){const ut=Xt($e,Ie);ut!=null&&ue.set(ut,$e)}if(Se.update)for(const $e of Se.update){let ut=ue.get($e.id);if(ut==null)continue;const Rt=!$e.removeAllProperties&&(((Ae=$e.removeProperties)===null||Ae===void 0?void 0:Ae.length)>0||((_e=$e.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0);if(($e.newGeometry||$e.removeAllProperties||Rt)&&(ut=Object.assign({},ut),ue.set($e.id,ut),Rt&&(ut.properties=Object.assign({},ut.properties))),$e.newGeometry&&(ut.geometry=$e.newGeometry),$e.removeAllProperties)ut.properties={};else if(((He=$e.removeProperties)===null||He===void 0?void 0:He.length)>0)for(const Ot of $e.removeProperties)Object.prototype.hasOwnProperty.call(ut.properties,Ot)&&delete ut.properties[Ot];if(((Je=$e.addOrUpdateProperties)===null||Je===void 0?void 0:Je.length)>0)for(const{key:Ot,value:mr}of $e.addOrUpdateProperties)ut.properties[Ot]=mr}}(this._dataUpdateable,G.dataDiff,ee),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(G){return g._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(G){return this._geoJSONIndex.getClusterExpansionZoom(G.clusterId)}getClusterChildren(G){return this._geoJSONIndex.getChildren(G.clusterId)}getClusterLeaves(G){return this._geoJSONIndex.getLeaves(G.clusterId,G.limit,G.offset)}}class Hn{constructor(G){this.self=G,this.actor=new g.F(G),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(W,ee)=>{if(this.externalWorkerSourceTypes[W])throw new Error(`Worker source with name "${W}" already registered.`);this.externalWorkerSourceTypes[W]=ee},this.self.addProtocol=g.bi,this.self.removeProtocol=g.bj,this.self.registerRTLTextPlugin=W=>{if(g.bD.isParsed())throw new Error("RTL text plugin already registered.");g.bD.setMethods(W)},this.actor.registerMessageHandler("LDT",(W,ee)=>this._getDEMWorkerSource(W,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RDT",(W,ee)=>g._(this,void 0,void 0,function*(){this._getDEMWorkerSource(W,ee.source).removeTile(ee)})),this.actor.registerMessageHandler("GCEZ",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterExpansionZoom(ee)})),this.actor.registerMessageHandler("GCC",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterChildren(ee)})),this.actor.registerMessageHandler("GCL",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterLeaves(ee)})),this.actor.registerMessageHandler("LD",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).loadData(ee)),this.actor.registerMessageHandler("GD",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).getData()),this.actor.registerMessageHandler("LT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).reloadTile(ee)),this.actor.registerMessageHandler("AT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).abortTile(ee)),this.actor.registerMessageHandler("RMT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).removeTile(ee)),this.actor.registerMessageHandler("RS",(W,ee)=>g._(this,void 0,void 0,function*(){if(!this.workerSources[W]||!this.workerSources[W][ee.type]||!this.workerSources[W][ee.type][ee.source])return;const ue=this.workerSources[W][ee.type][ee.source];delete this.workerSources[W][ee.type][ee.source],ue.removeSource!==void 0&&ue.removeSource(ee)})),this.actor.registerMessageHandler("RM",W=>g._(this,void 0,void 0,function*(){delete this.layerIndexes[W],delete this.availableImages[W],delete this.workerSources[W],delete this.demWorkerSources[W]})),this.actor.registerMessageHandler("SR",(W,ee)=>g._(this,void 0,void 0,function*(){this.referrer=ee})),this.actor.registerMessageHandler("SRPS",(W,ee)=>this._syncRTLPluginState(W,ee)),this.actor.registerMessageHandler("IS",(W,ee)=>g._(this,void 0,void 0,function*(){this.self.importScripts(ee)})),this.actor.registerMessageHandler("SI",(W,ee)=>this._setImages(W,ee)),this.actor.registerMessageHandler("UL",(W,ee)=>g._(this,void 0,void 0,function*(){this._getLayerIndex(W).update(ee.layers,ee.removedIds)})),this.actor.registerMessageHandler("SL",(W,ee)=>g._(this,void 0,void 0,function*(){this._getLayerIndex(W).replace(ee)}))}_setImages(G,W){return g._(this,void 0,void 0,function*(){this.availableImages[G]=W;for(const ee in this.workerSources[G]){const ue=this.workerSources[G][ee];for(const Se in ue)ue[Se].availableImages=W}})}_syncRTLPluginState(G,W){return g._(this,void 0,void 0,function*(){if(g.bD.isParsed())return g.bD.getState();if(W.pluginStatus!=="loading")return g.bD.setState(W),W;const ee=W.pluginURL;if(this.self.importScripts(ee),g.bD.isParsed()){const ue={pluginStatus:"loaded",pluginURL:ee};return g.bD.setState(ue),ue}throw g.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${ee}`)})}_getAvailableImages(G){let W=this.availableImages[G];return W||(W=[]),W}_getLayerIndex(G){let W=this.layerIndexes[G];return W||(W=this.layerIndexes[G]=new c),W}_getWorkerSource(G,W,ee){if(this.workerSources[G]||(this.workerSources[G]={}),this.workerSources[G][W]||(this.workerSources[G][W]={}),!this.workerSources[G][W][ee]){const ue={sendAsync:(Se,Ie)=>(Se.targetMapId=G,this.actor.sendAsync(Se,Ie))};switch(W){case"vector":this.workerSources[G][W][ee]=new A(ue,this._getLayerIndex(G),this._getAvailableImages(G));break;case"geojson":this.workerSources[G][W][ee]=new ps(ue,this._getLayerIndex(G),this._getAvailableImages(G));break;default:this.workerSources[G][W][ee]=new this.externalWorkerSourceTypes[W](ue,this._getLayerIndex(G),this._getAvailableImages(G))}}return this.workerSources[G][W][ee]}_getDEMWorkerSource(G,W){return this.demWorkerSources[G]||(this.demWorkerSources[G]={}),this.demWorkerSources[G][W]||(this.demWorkerSources[G][W]=new M),this.demWorkerSources[G][W]}}return g.i(self)&&(self.worker=new Hn(self)),Hn}),h("index",["exports","./shared"],function(g,c){var T="4.7.1";let P,R;const A={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:v=>new Promise((r,u)=>{const p=requestAnimationFrame(r);v.signal.addEventListener("abort",()=>{cancelAnimationFrame(p),u(c.c())})}),getImageData(v,r=0){return this.getImageCanvasContext(v).getImageData(-r,-r,v.width+2*r,v.height+2*r)},getImageCanvasContext(v){const r=window.document.createElement("canvas"),u=r.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("failed to create canvas 2d context");return r.width=v.width,r.height=v.height,u.drawImage(v,0,0,v.width,v.height),u},resolveURL:v=>(P||(P=document.createElement("a")),P.href=v,P.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(R==null&&(R=matchMedia("(prefers-reduced-motion: reduce)")),R.matches)}};class M{static testProp(r){if(!M.docStyle)return r[0];for(let u=0;u{window.removeEventListener("click",M.suppressClickInternal,!0)},0)}static getScale(r){const u=r.getBoundingClientRect();return{x:u.width/r.offsetWidth||1,y:u.height/r.offsetHeight||1,boundingClientRect:u}}static getPoint(r,u,p){const m=u.boundingClientRect;return new c.P((p.clientX-m.left)/u.x-r.clientLeft,(p.clientY-m.top)/u.y-r.clientTop)}static mousePos(r,u){const p=M.getScale(r);return M.getPoint(r,p,u)}static touchPos(r,u){const p=[],m=M.getScale(r);for(let _=0;_{Y&&$(Y),Y=null,O=!0},j.onerror=()=>{te=!0,Y=null},j.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(v){let r,u,p,m;v.resetRequestQueue=()=>{r=[],u=0,p=0,m={}},v.addThrottleControl=C=>{const z=p++;return m[z]=C,z},v.removeThrottleControl=C=>{delete m[C],S()},v.getImage=(C,z,F=!0)=>new Promise((B,X)=>{N.supported&&(C.headers||(C.headers={}),C.headers.accept="image/webp,*/*"),c.e(C,{type:"image"}),r.push({abortController:z,requestParameters:C,supportImageRefresh:F,state:"queued",onError:Q=>{X(Q)},onSuccess:Q=>{B(Q)}}),S()});const _=C=>c._(this,void 0,void 0,function*(){C.state="running";const{requestParameters:z,supportImageRefresh:F,onError:B,onSuccess:X,abortController:Q}=C,re=F===!1&&!c.i(self)&&!c.g(z.url)&&(!z.headers||Object.keys(z.headers).reduce((me,we)=>me&&we==="accept",!0));u++;const ce=re?E(z,Q):c.m(z,Q);try{const me=yield ce;delete C.abortController,C.state="completed",me.data instanceof HTMLImageElement||c.b(me.data)?X(me):me.data&&X({data:yield(pe=me.data,typeof createImageBitmap=="function"?c.d(pe):c.f(pe)),cacheControl:me.cacheControl,expires:me.expires})}catch(me){delete C.abortController,B(me)}finally{u--,S()}var pe}),S=()=>{const C=(()=>{for(const z of Object.keys(m))if(m[z]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let z=u;z0;z++){const F=r.shift();F.abortController.signal.aborted?z--:_(F)}},E=(C,z)=>new Promise((F,B)=>{const X=new Image,Q=C.url,re=C.credentials;re&&re==="include"?X.crossOrigin="use-credentials":(re&&re==="same-origin"||!c.s(Q))&&(X.crossOrigin="anonymous"),z.signal.addEventListener("abort",()=>{X.src="",B(c.c())}),X.fetchPriority="high",X.onload=()=>{X.onerror=X.onload=null,F({data:X})},X.onerror=()=>{X.onerror=X.onload=null,z.signal.aborted||B(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."))},X.src=Q})}(q||(q={})),q.resetRequestQueue();class ne{constructor(r){this._transformRequestFn=r}transformRequest(r,u){return this._transformRequestFn&&this._transformRequestFn(r,u)||{url:r}}setTransformRequest(r){this._transformRequestFn=r}}function oe(v){var r=new c.A(3);return r[0]=v[0],r[1]=v[1],r[2]=v[2],r}var ke,ge=function(v,r,u){return v[0]=r[0]-u[0],v[1]=r[1]-u[1],v[2]=r[2]-u[2],v};ke=new c.A(3),c.A!=Float32Array&&(ke[0]=0,ke[1]=0,ke[2]=0);var Fe=function(v){var r=v[0],u=v[1];return r*r+u*u};function Oe(v){const r=[];if(typeof v=="string")r.push({id:"default",url:v});else if(v&&v.length>0){const u=[];for(const{id:p,url:m}of v){const _=`${p}${m}`;u.indexOf(_)===-1&&(u.push(_),r.push({id:p,url:m}))}}return r}function We(v,r,u){const p=v.split("?");return p[0]+=`${r}${u}`,p.join("?")}(function(){var v=new c.A(2);c.A!=Float32Array&&(v[0]=0,v[1]=0)})();class it{constructor(r,u,p,m){this.context=r,this.format=p,this.texture=r.gl.createTexture(),this.update(u,m)}update(r,u,p){const{width:m,height:_}=r,S=!(this.size&&this.size[0]===m&&this.size[1]===_||p),{context:E}=this,{gl:C}=E;if(this.useMipmap=!!(u&&u.useMipmap),C.bindTexture(C.TEXTURE_2D,this.texture),E.pixelStoreUnpackFlipY.set(!1),E.pixelStoreUnpack.set(1),E.pixelStoreUnpackPremultiplyAlpha.set(this.format===C.RGBA&&(!u||u.premultiply!==!1)),S)this.size=[m,_],r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||c.b(r)?C.texImage2D(C.TEXTURE_2D,0,this.format,this.format,C.UNSIGNED_BYTE,r):C.texImage2D(C.TEXTURE_2D,0,this.format,m,_,0,this.format,C.UNSIGNED_BYTE,r.data);else{const{x:z,y:F}=p||{x:0,y:0};r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||c.b(r)?C.texSubImage2D(C.TEXTURE_2D,0,z,F,C.RGBA,C.UNSIGNED_BYTE,r):C.texSubImage2D(C.TEXTURE_2D,0,z,F,m,_,C.RGBA,C.UNSIGNED_BYTE,r.data)}this.useMipmap&&this.isSizePowerOfTwo()&&C.generateMipmap(C.TEXTURE_2D)}bind(r,u,p){const{context:m}=this,{gl:_}=m;_.bindTexture(_.TEXTURE_2D,this.texture),p!==_.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(p=_.LINEAR),r!==this.filter&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,r),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,p||r),this.filter=r),u!==this.wrap&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,u),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,u),this.wrap=u)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}}function ve(v){const{userImage:r}=v;return!!(r&&r.render&&r.render())&&(v.data.replace(new Uint8Array(r.data.buffer)),!0)}class Ue extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(r){if(this.loaded!==r&&(this.loaded=r,r)){for(const{ids:u,promiseResolve:p}of this.requestors)p(this._getImagesForIds(u));this.requestors=[]}}getImage(r){const u=this.images[r];if(u&&!u.data&&u.spriteData){const p=u.spriteData;u.data=new c.R({width:p.width,height:p.height},p.context.getImageData(p.x,p.y,p.width,p.height).data),u.spriteData=null}return u}addImage(r,u){if(this.images[r])throw new Error(`Image id ${r} already exist, use updateImage instead`);this._validate(r,u)&&(this.images[r]=u)}_validate(r,u){let p=!0;const m=u.data||u.spriteData;return this._validateStretch(u.stretchX,m&&m.width)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchX" value`))),p=!1),this._validateStretch(u.stretchY,m&&m.height)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchY" value`))),p=!1),this._validateContent(u.content,u)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "content" value`))),p=!1),p}_validateStretch(r,u){if(!r)return!0;let p=0;for(const m of r){if(m[0]{let m=!0;if(!this.isLoaded())for(const _ of r)this.images[_]||(m=!1);this.isLoaded()||m?u(this._getImagesForIds(r)):this.requestors.push({ids:r,promiseResolve:u})})}_getImagesForIds(r){const u={};for(const p of r){let m=this.getImage(p);m||(this.fire(new c.k("styleimagemissing",{id:p})),m=this.getImage(p)),m?u[p]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,textFitWidth:m.textFitWidth,textFitHeight:m.textFitHeight,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:c.w(`Image "${p}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return u}getPixelSize(){const{width:r,height:u}=this.atlasImage;return{width:r,height:u}}getPattern(r){const u=this.patterns[r],p=this.getImage(r);if(!p)return null;if(u&&u.position.version===p.version)return u.position;if(u)u.position.version=p.version;else{const m={w:p.data.width+2,h:p.data.height+2,x:0,y:0},_=new c.I(m,p);this.patterns[r]={bin:m,position:_}}return this._updatePatternAtlas(),this.patterns[r].position}bind(r){const u=r.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new it(r,this.atlasImage,u.RGBA),this.atlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(){const r=[];for(const _ in this.patterns)r.push(this.patterns[_].bin);const{w:u,h:p}=c.p(r),m=this.atlasImage;m.resize({width:u||1,height:p||1});for(const _ in this.patterns){const{bin:S}=this.patterns[_],E=S.x+1,C=S.y+1,z=this.getImage(_).data,F=z.width,B=z.height;c.R.copy(z,m,{x:0,y:0},{x:E,y:C},{width:F,height:B}),c.R.copy(z,m,{x:0,y:B-1},{x:E,y:C-1},{width:F,height:1}),c.R.copy(z,m,{x:0,y:0},{x:E,y:C+B},{width:F,height:1}),c.R.copy(z,m,{x:F-1,y:0},{x:E-1,y:C},{width:1,height:B}),c.R.copy(z,m,{x:0,y:0},{x:E+F,y:C},{width:1,height:B})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(r){for(const u of r){if(this.callbackDispatchedThisFrame[u])continue;this.callbackDispatchedThisFrame[u]=!0;const p=this.getImage(u);p||c.w(`Image with ID: "${u}" was not found`),ve(p)&&this.updateImage(u,p)}}}const H=1e20;function Re(v,r,u,p,m,_,S,E,C){for(let z=r;z-1);C++,_[C]=E,S[C]=z,S[C+1]=H}for(let E=0,C=0;E65535)throw new Error("glyphs > 65535 not supported");if(p.ranges[_])return{stack:r,id:u,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!p.requests[_]){const E=ye.loadGlyphRange(r,_,this.url,this.requestManager);p.requests[_]=E}const S=yield p.requests[_];for(const E in S)this._doesCharSupportLocalGlyph(+E)||(p.glyphs[+E]=S[+E]);return p.ranges[_]=!0,{stack:r,id:u,glyph:S[u]||null}})}_doesCharSupportLocalGlyph(r){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(r))}_tinySDF(r,u,p){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(p))return;let _=r.tinySDF;if(!_){let E="400";/bold/i.test(u)?E="900":/medium/i.test(u)?E="500":/light/i.test(u)&&(E="200"),_=r.tinySDF=new ye.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:E})}const S=_.draw(String.fromCharCode(p));return{id:p,bitmap:new c.o({width:S.width||60,height:S.height||60},S.data),metrics:{width:S.glyphWidth/2||24,height:S.glyphHeight/2||24,left:S.glyphLeft/2+.5||0,top:S.glyphTop/2-27.5||-8,advance:S.glyphAdvance/2||24,isDoubleResolution:!0}}}}ye.loadGlyphRange=function(v,r,u,p){return c._(this,void 0,void 0,function*(){const m=256*r,_=m+255,S=p.transformRequest(u.replace("{fontstack}",v).replace("{range}",`${m}-${_}`),"Glyphs"),E=yield c.l(S,new AbortController);if(!E||!E.data)throw new Error(`Could not load glyph range. range: ${r}, ${m}-${_}`);const C={};for(const z of c.n(E.data))C[z.id]=z;return C})},ye.TinySDF=class{constructor({fontSize:v=24,buffer:r=3,radius:u=8,cutoff:p=.25,fontFamily:m="sans-serif",fontWeight:_="normal",fontStyle:S="normal"}={}){this.buffer=r,this.cutoff=p,this.radius=u;const E=this.size=v+4*r,C=this._createCanvas(E),z=this.ctx=C.getContext("2d",{willReadFrequently:!0});z.font=`${S} ${_} ${v}px ${m}`,z.textBaseline="alphabetic",z.textAlign="left",z.fillStyle="black",this.gridOuter=new Float64Array(E*E),this.gridInner=new Float64Array(E*E),this.f=new Float64Array(E),this.z=new Float64Array(E+1),this.v=new Uint16Array(E)}_createCanvas(v){const r=document.createElement("canvas");return r.width=r.height=v,r}draw(v){const{width:r,actualBoundingBoxAscent:u,actualBoundingBoxDescent:p,actualBoundingBoxLeft:m,actualBoundingBoxRight:_}=this.ctx.measureText(v),S=Math.ceil(u),E=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(_-m))),C=Math.min(this.size-this.buffer,S+Math.ceil(p)),z=E+2*this.buffer,F=C+2*this.buffer,B=Math.max(z*F,0),X=new Uint8ClampedArray(B),Q={data:X,width:z,height:F,glyphWidth:E,glyphHeight:C,glyphTop:S,glyphLeft:0,glyphAdvance:r};if(E===0||C===0)return Q;const{ctx:re,buffer:ce,gridInner:pe,gridOuter:me}=this;re.clearRect(ce,ce,E,C),re.fillText(v,ce,ce+S);const we=re.getImageData(ce,ce,E,C);me.fill(H,0,B),pe.fill(0,0,B);for(let ae=0;ae0?Ye*Ye:0,pe[ze]=Ye<0?Ye*Ye:0}}Re(me,0,0,z,F,z,this.f,this.v,this.z),Re(pe,ce,ce,E,C,z,this.f,this.v,this.z);for(let ae=0;ae1&&(C=r[++E]);const F=Math.abs(z-C.left),B=Math.abs(z-C.right),X=Math.min(F,B);let Q;const re=_/p*(m+1);if(C.isDash){const ce=m-Math.abs(re);Q=Math.sqrt(X*X+ce*ce)}else Q=m-Math.sqrt(X*X+re*re);this.data[S+z]=Math.max(0,Math.min(255,Q+128))}}}addRegularDash(r){for(let E=r.length-1;E>=0;--E){const C=r[E],z=r[E+1];C.zeroLength?r.splice(E,1):z&&z.isDash===C.isDash&&(z.left=C.left,r.splice(E,1))}const u=r[0],p=r[r.length-1];u.isDash===p.isDash&&(u.left=p.left-this.width,p.right=u.right+this.width);const m=this.width*this.nextRow;let _=0,S=r[_];for(let E=0;E1&&(S=r[++_]);const C=Math.abs(E-S.left),z=Math.abs(E-S.right),F=Math.min(C,z);this.data[m+E]=Math.max(0,Math.min(255,(S.isDash?F:-F)+128))}}addDash(r,u){const p=u?7:0,m=2*p+1;if(this.nextRow+m>this.height)return c.w("LineAtlas out of space"),null;let _=0;for(let E=0;E{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[nt]}numActive(){return Object.keys(this.active).length}}const Jt=Math.floor(A.hardwareConcurrency/2);let er,Vt;function Yt(){return er||(er=new rt),er}rt.workerCount=c.C(globalThis)?Math.max(Math.min(Jt,3),1):1;class _r{constructor(r,u){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=u;const p=this.workerPool.acquire(u);for(let m=0;m{u.remove()}),this.actors=[],r&&this.workerPool.release(this.id)}registerMessageHandler(r,u){for(const p of this.actors)p.registerMessageHandler(r,u)}}function fr(){return Vt||(Vt=new _r(Yt(),c.G),Vt.registerMessageHandler("GR",(v,r,u)=>c.m(r,u))),Vt}function br(v,r){const u=c.H();return c.J(u,u,[1,1,0]),c.K(u,u,[.5*v.width,.5*v.height,1]),c.L(u,u,v.calculatePosMatrix(r.toUnwrapped()))}function Xr(v,r,u,p,m,_){const S=function(B,X,Q){if(B)for(const re of B){const ce=X[re];if(ce&&ce.source===Q&&ce.type==="fill-extrusion")return!0}else for(const re in X){const ce=X[re];if(ce.source===Q&&ce.type==="fill-extrusion")return!0}return!1}(m&&m.layers,r,v.id),E=_.maxPitchScaleFactor(),C=v.tilesIn(p,E,S);C.sort(V);const z=[];for(const B of C)z.push({wrappedTileID:B.tileID.wrapped().key,queryResults:B.tile.queryRenderedFeatures(r,u,v._state,B.queryGeometry,B.cameraQueryGeometry,B.scale,m,_,E,br(v.transform,B.tileID))});const F=function(B){const X={},Q={};for(const re of B){const ce=re.queryResults,pe=re.wrappedTileID,me=Q[pe]=Q[pe]||{};for(const we in ce){const ae=ce[we],Ce=me[we]=me[we]||{},Pe=X[we]=X[we]||[];for(const ze of ae)Ce[ze.featureIndex]||(Ce[ze.featureIndex]=!0,Pe.push(ze))}}return X}(z);for(const B in F)F[B].forEach(X=>{const Q=X.feature,re=v.getFeatureState(Q.layer["source-layer"],Q.id);Q.source=Q.layer.source,Q.layer["source-layer"]&&(Q.sourceLayer=Q.layer["source-layer"]),Q.state=re});return F}function V(v,r){const u=v.tileID,p=r.tileID;return u.overscaledZ-p.overscaledZ||u.canonical.y-p.canonical.y||u.wrap-p.wrap||u.canonical.x-p.canonical.x}function je(v,r,u){return c._(this,void 0,void 0,function*(){let p=v;if(v.url?p=(yield c.h(r.transformRequest(v.url,"Source"),u)).data:yield A.frameAsync(u),!p)return null;const m=c.M(c.e(p,v),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(m.vectorLayerIds=p.vector_layers.map(_=>_.id)),m})}class ie{constructor(r,u){r&&(u?this.setSouthWest(r).setNorthEast(u):Array.isArray(r)&&(r.length===4?this.setSouthWest([r[0],r[1]]).setNorthEast([r[2],r[3]]):this.setSouthWest(r[0]).setNorthEast(r[1])))}setNorthEast(r){return this._ne=r instanceof c.N?new c.N(r.lng,r.lat):c.N.convert(r),this}setSouthWest(r){return this._sw=r instanceof c.N?new c.N(r.lng,r.lat):c.N.convert(r),this}extend(r){const u=this._sw,p=this._ne;let m,_;if(r instanceof c.N)m=r,_=r;else{if(!(r instanceof ie))return Array.isArray(r)?r.length===4||r.every(Array.isArray)?this.extend(ie.convert(r)):this.extend(c.N.convert(r)):r&&("lng"in r||"lon"in r)&&"lat"in r?this.extend(c.N.convert(r)):this;if(m=r._sw,_=r._ne,!m||!_)return this}return u||p?(u.lng=Math.min(m.lng,u.lng),u.lat=Math.min(m.lat,u.lat),p.lng=Math.max(_.lng,p.lng),p.lat=Math.max(_.lat,p.lat)):(this._sw=new c.N(m.lng,m.lat),this._ne=new c.N(_.lng,_.lat)),this}getCenter(){return new c.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new c.N(this.getWest(),this.getNorth())}getSouthEast(){return new c.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(r){const{lng:u,lat:p}=c.N.convert(r);let m=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=p&&p<=this._ne.lat&&m}static convert(r){return r instanceof ie?r:r&&new ie(r)}static fromLngLat(r,u=0){const p=360*u/40075017,m=p/Math.cos(Math.PI/180*r.lat);return new ie(new c.N(r.lng-m,r.lat-p),new c.N(r.lng+m,r.lat+p))}adjustAntiMeridian(){const r=new c.N(this._sw.lng,this._sw.lat),u=new c.N(this._ne.lng,this._ne.lat);return new ie(r,r.lng>u.lng?new c.N(u.lng+360,u.lat):u)}}class de{constructor(r,u,p){this.bounds=ie.convert(this.validateBounds(r)),this.minzoom=u||0,this.maxzoom=p||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}contains(r){const u=Math.pow(2,r.z),p=Math.floor(c.O(this.bounds.getWest())*u),m=Math.floor(c.Q(this.bounds.getNorth())*u),_=Math.ceil(c.O(this.bounds.getEast())*u),S=Math.ceil(c.Q(this.bounds.getSouth())*u);return r.x>=p&&r.x<_&&r.y>=m&&r.y{this._options.tiles=r}),this}setUrl(r){return this.setSourceProperty(()=>{this.url=r,this._options.url=r}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p={request:this.map._requestManager.transformRequest(u,"Tile"),uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};p.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(r.actor&&r.state!=="expired"){if(r.state==="loading")return new Promise((_,S)=>{r.reloadPromise={resolve:_,reject:S}})}else r.actor=this.dispatcher.getActor(),m="LT";r.abortController=new AbortController;try{const _=yield r.actor.sendAsync({type:m,data:p},r.abortController);if(delete r.abortController,r.aborted)return;this._afterTileLoadWorkerResponse(r,_)}catch(_){if(delete r.abortController,r.aborted)return;if(_&&_.status!==404)throw _;this._afterTileLoadWorkerResponse(r,null)}})}_afterTileLoadWorkerResponse(r,u){if(u&&u.resourceTiming&&(r.resourceTiming=u.resourceTiming),u&&this.map._refreshExpiredTiles&&r.setExpiryData(u),r.loadVectorData(u,this.map.painter),r.reloadPromise){const p=r.reloadPromise;r.reloadPromise=null,this.loadTile(r).then(p.resolve).catch(p.reject)}}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.actor&&(yield r.actor.sendAsync({type:"AT",data:{uid:r.uid,type:this.type,source:this.id}}))})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.unloadVectorData(),r.actor&&(yield r.actor.sendAsync({type:"RMT",data:{uid:r.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Te extends c.E{constructor(r,u,p,m){super(),this.id=r,this.dispatcher=p,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},u),c.e(this,c.M(u,["url","scheme","tileSize"]))}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const r=yield je(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(c.e(this,r),r.bounds&&(this.tileBounds=new de(r.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(r){this._tileJSONRequest=null,this.fire(new c.j(r))}})}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(r){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),r(),this.load()}setTiles(r){return this.setSourceProperty(()=>{this._options.tiles=r}),this}setUrl(r){return this.setSourceProperty(()=>{this.url=r,this._options.url=r}),this}serialize(){return c.e({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);r.abortController=new AbortController;try{const p=yield q.getImage(this.map._requestManager.transformRequest(u,"Tile"),r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(p&&p.data){this.map._refreshExpiredTiles&&p.cacheControl&&p.expires&&r.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});const m=this.map.painter.context,_=m.gl,S=p.data;r.texture=this.map.painter.getTileTexture(S.width),r.texture?r.texture.update(S,{useMipmap:!0}):(r.texture=new it(m,S,_.RGBA,{useMipmap:!0}),r.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST)),r.state="loaded"}}catch(p){if(delete r.abortController,r.aborted)r.state="unloaded";else if(p)throw r.state="errored",p}})}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController)})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.texture&&this.map.painter.saveTileTexture(r.texture)})}hasTransition(){return!1}}class Ge extends Te{constructor(r,u,p,m){super(r,u,p,m),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},u),this.encoding=u.encoding||"mapbox",this.redFactor=u.redFactor,this.greenFactor=u.greenFactor,this.blueFactor=u.blueFactor,this.baseShift=u.baseShift}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p=this.map._requestManager.transformRequest(u,"Tile");r.neighboringTiles=this._getNeighboringTiles(r.tileID),r.abortController=new AbortController;try{const m=yield q.getImage(p,r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(m&&m.data){const _=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&r.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const S=c.b(_)&&c.U()?_:yield this.readImageNow(_),E={type:this.type,uid:r.uid,source:this.id,rawImageData:S,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!r.actor||r.state==="expired"){r.actor=this.dispatcher.getActor();const C=yield r.actor.sendAsync({type:"LDT",data:E});r.dem=C,r.needsHillshadePrepare=!0,r.needsTerrainPrepare=!0,r.state="loaded"}}}catch(m){if(delete r.abortController,r.aborted)r.state="unloaded";else if(m)throw r.state="errored",m}})}readImageNow(r){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.V()){const u=r.width+2,p=r.height+2;try{return new c.R({width:u,height:p},yield c.W(r,-1,-1,u,p))}catch{}}return A.getImageData(r,1)})}_getNeighboringTiles(r){const u=r.canonical,p=Math.pow(2,u.z),m=(u.x-1+p)%p,_=u.x===0?r.wrap-1:r.wrap,S=(u.x+1+p)%p,E=u.x+1===p?r.wrap+1:r.wrap,C={};return C[new c.S(r.overscaledZ,_,u.z,m,u.y).key]={backfilled:!1},C[new c.S(r.overscaledZ,E,u.z,S,u.y).key]={backfilled:!1},u.y>0&&(C[new c.S(r.overscaledZ,_,u.z,m,u.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,r.wrap,u.z,u.x,u.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,E,u.z,S,u.y-1).key]={backfilled:!1}),u.y+10&&c.e(_,{resourceTiming:m}),this.fire(new c.k("data",Object.assign(Object.assign({},_),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},_),{sourceDataType:"content"})))}catch(p){if(this._pendingLoads--,this._removed)return void this.fire(new c.k("dataabort",{dataType:"source"}));this.fire(new c.j(p))}})}loaded(){return this._pendingLoads===0}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.actor?"RT":"LT";r.actor=this.actor;const p={type:this.type,uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};r.abortController=new AbortController;const m=yield this.actor.sendAsync({type:u,data:p},r.abortController);delete r.abortController,r.unloadVectorData(),r.aborted||r.loadVectorData(m,this.map.painter,u==="RT")})}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.aborted=!0})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:r.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ne=c.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ot extends c.E{constructor(r,u,p,m){super(),this.id=r,this.dispatcher=p,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=u}load(r){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const u=yield q.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,u&&u.data&&(this.image=u.data,r&&(this.coordinates=r),this._finishLoading())}catch(u){this._request=null,this._loaded=!0,this.fire(new c.j(u))}})}loaded(){return this._loaded}updateImage(r){return r.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=r.url,this.load(r.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(r){this.map=r,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(r){this.coordinates=r;const u=r.map(c.Z.fromLngLat);this.tileID=function(m){let _=1/0,S=1/0,E=-1/0,C=-1/0;for(const X of m)_=Math.min(_,X.x),S=Math.min(S,X.y),E=Math.max(E,X.x),C=Math.max(C,X.y);const z=Math.max(E-_,C-S),F=Math.max(0,Math.floor(-Math.log(z)/Math.LN2)),B=Math.pow(2,F);return new c.a1(F,Math.floor((_+E)/2*B),Math.floor((S+C)/2*B))}(u),this.minzoom=this.maxzoom=this.tileID.z;const p=u.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new c.$,this._boundsArray.emplaceBack(p[0].x,p[0].y,0,0),this._boundsArray.emplaceBack(p[1].x,p[1].y,c.X,0),this._boundsArray.emplaceBack(p[3].x,p[3].y,0,c.X),this._boundsArray.emplaceBack(p[2].x,p[2].y,c.X,c.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const r=this.map.painter.context,u=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new it(r,this.image,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const _=this.tiles[m];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,p=!0)}p&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(r){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(r.tileID.canonical)?(this.tiles[String(r.tileID.wrap)]=r,r.buckets={}):r.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class kt extends ot{constructor(r,u,p,m){super(r,u,p,m),this.roundZoom=!0,this.type="video",this.options=u}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const r=this.options;this.urls=[];for(const u of r.urls)this.urls.push(this.map._requestManager.transformRequest(u,"Source").url);try{const u=yield c.a3(this.urls);if(this._loaded=!0,!u)return;this.video=u,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(u){this.fire(new c.j(u))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(r){if(this.video){const u=this.video.seekable;ru.end(0)?this.fire(new c.j(new c.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${u.start(0)} and ${u.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(r){this.map||(this.map=r,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const r=this.map.painter.context,u=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.texSubImage2D(u.TEXTURE_2D,0,0,0,u.RGBA,u.UNSIGNED_BYTE,this.video)):(this.texture=new it(r,this.video,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const _=this.tiles[m];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,p=!0)}p&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class at extends ot{constructor(r,u,p,m){super(r,u,p,m),u.coordinates?Array.isArray(u.coordinates)&&u.coordinates.length===4&&!u.coordinates.some(_=>!Array.isArray(_)||_.length!==2||_.some(S=>typeof S!="number"))||this.fire(new c.j(new c.a2(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.a2(`sources.${r}`,null,'missing required property "coordinates"'))),u.animate&&typeof u.animate!="boolean"&&this.fire(new c.j(new c.a2(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),u.canvas?typeof u.canvas=="string"||u.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.a2(`sources.${r}`,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 c.j(new c.a2(`sources.${r}`,null,'missing required property "canvas"'))),this.options=u,this.animate=u.animate===void 0||u.animate}load(){return c._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new c.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(r){this.map=r,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const u=this.map.painter.context,p=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new it(u,this.canvas,p.RGBA,{premultiply:!0});let m=!1;for(const _ in this.tiles){const S=this.tiles[_];S.state!=="loaded"&&(S.state="loaded",S.texture=this.texture,m=!0)}m&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const r of[this.canvas.width,this.canvas.height])if(isNaN(r)||r<=0)return!0;return!1}}const Bt={},Tr=v=>{switch(v){case"geojson":return tt;case"image":return ot;case"raster":return Te;case"raster-dem":return Ge;case"vector":return se;case"video":return kt;case"canvas":return at}return Bt[v]},Ze="RTLPluginLoaded";class tn extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=fr()}_syncState(r){return this.status=r,this.dispatcher.broadcast("SRPS",{pluginStatus:r,pluginURL:this.url}).catch(u=>{throw this.status="error",u})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(r){return c._(this,arguments,void 0,function*(u,p=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=A.resolveURL(u),!this.url)throw new Error(`requested url ${u} is invalid`);if(this.status==="unavailable"){if(!p)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.k(Ze))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let _n=null;function vn(){return _n||(_n=new tn),_n}class pi{constructor(r,u){this.timeAdded=0,this.fadeEndTime=0,this.tileID=r,this.uid=c.a4(),this.uses=0,this.tileSize=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(r){const u=r+this.timeAdded;u_.getLayer(z)).filter(Boolean);if(C.length!==0){E.layers=C,E.stateDependentLayerIds&&(E.stateDependentLayers=E.stateDependentLayerIds.map(z=>C.filter(F=>F.id===z)[0]));for(const z of C)S[z.id]=E}}return S}(r.buckets,u.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const _=this.buckets[m];if(_ instanceof c.a6){if(this.hasSymbolBuckets=!0,!p)break;_.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const _=this.buckets[m];if(_ instanceof c.a6&&_.hasRTLText){this.hasRTLText=!0,vn().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const _=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(m).queryRadius(_))}r.imageAtlas&&(this.imageAtlas=r.imageAtlas),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage)}else this.collisionBoxArray=new c.a5}unloadVectorData(){for(const r in this.buckets)this.buckets[r].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(r){return this.buckets[r.id]}upload(r){for(const p in this.buckets){const m=this.buckets[p];m.uploadPending()&&m.upload(r)}const u=r.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new it(r,this.imageAtlas.image,u.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new it(r,this.glyphAtlasImage,u.ALPHA),this.glyphAtlasImage=null)}prepare(r){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture)}queryRenderedFeatures(r,u,p,m,_,S,E,C,z,F){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:_,scale:S,tileSize:this.tileSize,pixelPosMatrix:F,transform:C,params:E,queryPadding:this.queryPadding*z},r,u,p):{}}querySourceFeatures(r,u){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const m=p.loadVTLayers(),_=u&&u.sourceLayer?u.sourceLayer:"",S=m._geojsonTileLayer||m[_];if(!S)return;const E=c.a7(u&&u.filter),{z:C,x:z,y:F}=this.tileID.canonical,B={z:C,x:z,y:F};for(let X=0;Xp)m=!1;else if(u)if(this.expirationTime{this.remove(r,_)},p)),this.data[m].push(_),this.order.push(m),this.order.length>this.max){const S=this._getAndRemoveByKey(this.order[0]);S&&this.onRemove(S)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const u=this.data[r].shift();return u.timeout&&clearTimeout(u.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),u.value}getByKey(r){const u=this.data[r];return u?u[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,u){if(!this.has(r))return this;const p=r.wrapped().key,m=u===void 0?0:this.data[p].indexOf(u),_=this.data[p][m];return this.data[p].splice(m,1),_.timeout&&clearTimeout(_.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(_.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}filter(r){const u=[];for(const p in this.data)for(const m of this.data[p])r(m.value)||u.push(m);for(const p of u)this.remove(p.value.tileID,p)}}class Kt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(r,u,p){const m=String(u);if(this.stateChanges[r]=this.stateChanges[r]||{},this.stateChanges[r][m]=this.stateChanges[r][m]||{},c.e(this.stateChanges[r][m],p),this.deletedStates[r]===null){this.deletedStates[r]={};for(const _ in this.state[r])_!==m&&(this.deletedStates[r][_]=null)}else if(this.deletedStates[r]&&this.deletedStates[r][m]===null){this.deletedStates[r][m]={};for(const _ in this.state[r][m])p[_]||(this.deletedStates[r][m][_]=null)}else for(const _ in p)this.deletedStates[r]&&this.deletedStates[r][m]&&this.deletedStates[r][m][_]===null&&delete this.deletedStates[r][m][_]}removeFeatureState(r,u,p){if(this.deletedStates[r]===null)return;const m=String(u);if(this.deletedStates[r]=this.deletedStates[r]||{},p&&u!==void 0)this.deletedStates[r][m]!==null&&(this.deletedStates[r][m]=this.deletedStates[r][m]||{},this.deletedStates[r][m][p]=null);else if(u!==void 0)if(this.stateChanges[r]&&this.stateChanges[r][m])for(p in this.deletedStates[r][m]={},this.stateChanges[r][m])this.deletedStates[r][m][p]=null;else this.deletedStates[r][m]=null;else this.deletedStates[r]=null}getState(r,u){const p=String(u),m=c.e({},(this.state[r]||{})[p],(this.stateChanges[r]||{})[p]);if(this.deletedStates[r]===null)return{};if(this.deletedStates[r]){const _=this.deletedStates[r][u];if(_===null)return{};for(const S in _)delete m[S]}return m}initializeTileState(r,u){r.setFeatureState(this.state,u)}coalesceChanges(r,u){const p={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const _={};for(const S in this.stateChanges[m])this.state[m][S]||(this.state[m][S]={}),c.e(this.state[m][S],this.stateChanges[m][S]),_[S]=this.state[m][S];p[m]=_}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const _={};if(this.deletedStates[m]===null)for(const S in this.state[m])_[S]={},this.state[m][S]={};else for(const S in this.deletedStates[m]){if(this.deletedStates[m][S]===null)this.state[m][S]={};else for(const E of Object.keys(this.deletedStates[m][S]))delete this.state[m][S][E];_[S]=this.state[m][S]}p[m]=p[m]||{},c.e(p[m],_)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const m in r)r[m].setFeatureState(p,u)}}class Ut extends c.E{constructor(r,u,p){super(),this.id=r,this.dispatcher=p,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,_,S,E)=>{const C=new(Tr(_.type))(m,_,S,E);if(C.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${C.id}`);return C})(r,u,p,this),this._tiles={},this._cache=new Qe(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Kt,this._didEmitContent=!1,this._updated=!1}onAdd(r){this.map=r,this._maxTileCacheSize=r?r._maxTileCacheSize:null,this._maxTileCacheZoomLevels=r?r._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(r)}onRemove(r){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(r)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const r in this._tiles){const u=this._tiles[r];if(u.state!=="loaded"&&u.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(r,u,p){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(r),this._tileLoaded(r,u,p)}catch(m){r.state="errored",m.status!==404?this._source.fire(new c.j(m,{tile:r})):this.update(this.transform,this.terrain)}})}_unloadTile(r){this._source.unloadTile&&this._source.unloadTile(r)}_abortTile(r){this._source.abortTile&&this._source.abortTile(r),this._source.fire(new c.k("dataabort",{tile:r,coord:r.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(r){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const u in this._tiles){const p=this._tiles[u];p.upload(r),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(r=>r.tileID).sort(Kr).map(r=>r.key)}getRenderableIds(r){const u=[];for(const p in this._tiles)this._isIdRenderable(p,r)&&u.push(this._tiles[p]);return r?u.sort((p,m)=>{const _=p.tileID,S=m.tileID,E=new c.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle),C=new c.P(S.canonical.x,S.canonical.y)._rotate(this.transform.angle);return _.overscaledZ-S.overscaledZ||C.y-E.y||C.x-E.x}).map(p=>p.tileID.key):u.map(p=>p.tileID).sort(Kr).map(p=>p.key)}hasRenderableParent(r){const u=this.findLoadedParent(r,0);return!!u&&this._isIdRenderable(u.tileID.key)}_isIdRenderable(r,u){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(u||!this._tiles[r].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const r in this._tiles)this._tiles[r].state!=="errored"&&this._reloadTile(r,"reloading")}}_reloadTile(r,u){return c._(this,void 0,void 0,function*(){const p=this._tiles[r];p&&(p.state!=="loading"&&(p.state=u),yield this._loadTile(p,r,u))})}_tileLoaded(r,u,p){r.timeAdded=A.now(),p==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(u,r),this.getSource().type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null),r.aborted||this._source.fire(new c.k("data",{dataType:"source",tile:r,coord:r.tileID}))}_backfillDEM(r){const u=this.getRenderableIds();for(let m=0;m1||(Math.abs(S)>1&&(Math.abs(S+C)===1?S+=C:Math.abs(S-C)===1&&(S-=C)),_.dem&&m.dem&&(m.dem.backfillBorder(_.dem,S,E),m.neighboringTiles&&m.neighboringTiles[z]&&(m.neighboringTiles[z].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,u,p,m){for(const _ in this._tiles){let S=this._tiles[_];if(m[_]||!S.hasData()||S.tileID.overscaledZ<=u||S.tileID.overscaledZ>p)continue;let E=S.tileID;for(;S&&S.tileID.overscaledZ>u+1;){const z=S.tileID.scaledTo(S.tileID.overscaledZ-1);S=this._tiles[z.key],S&&S.hasData()&&(E=z)}let C=E;for(;C.overscaledZ>u;)if(C=C.scaledTo(C.overscaledZ-1),r[C.key]){m[E.key]=E;break}}}findLoadedParent(r,u){if(r.key in this._loadedParentTiles){const p=this._loadedParentTiles[r.key];return p&&p.tileID.overscaledZ>=u?p:null}for(let p=r.overscaledZ-1;p>=u;p--){const m=r.scaledTo(p),_=this._getLoadedTile(m);if(_)return _}}findLoadedSibling(r){return this._getLoadedTile(r)}_getLoadedTile(r){const u=this._tiles[r.key];return u&&u.hasData()?u:this._cache.getByKey(r.wrapped().key)}updateCacheSize(r){const u=Math.ceil(r.width/this._source.tileSize)+1,p=Math.ceil(r.height/this._source.tileSize)+1,m=Math.floor(u*p*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),_=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(_)}handleWrapJump(r){const u=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,u){const p={};for(const m in this._tiles){const _=this._tiles[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+u),p[_.tileID.key]=_}this._tiles=p;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}_updateCoveredAndRetainedTiles(r,u,p,m,_,S){const E={},C={},z=Object.keys(r),F=A.now();for(const B of z){const X=r[B],Q=this._tiles[B];if(!Q||Q.fadeEndTime!==0&&Q.fadeEndTime<=F)continue;const re=this.findLoadedParent(X,u),ce=this.findLoadedSibling(X),pe=re||ce||null;pe&&(this._addTile(pe.tileID),E[pe.tileID.key]=pe.tileID),C[B]=X}this._retainLoadedChildren(C,m,p,r);for(const B in E)r[B]||(this._coveredTiles[B]=!0,r[B]=E[B]);if(S){const B={},X={};for(const Q of _)this._tiles[Q.key].hasData()?B[Q.key]=Q:X[Q.key]=Q;for(const Q in X){const re=X[Q].children(this._source.maxzoom);this._tiles[re[0].key]&&this._tiles[re[1].key]&&this._tiles[re[2].key]&&this._tiles[re[3].key]&&(B[re[0].key]=r[re[0].key]=re[0],B[re[1].key]=r[re[1].key]=re[1],B[re[2].key]=r[re[2].key]=re[2],B[re[3].key]=r[re[3].key]=re[3],delete X[Q])}for(const Q in X){const re=X[Q],ce=this.findLoadedParent(re,this._source.minzoom),pe=this.findLoadedSibling(re),me=ce||pe||null;if(me){B[me.tileID.key]=r[me.tileID.key]=me.tileID;for(const we in B)B[we].isChildOf(me.tileID)&&delete B[we]}}for(const Q in this._tiles)B[Q]||(this._coveredTiles[Q]=!0)}}update(r,u){if(!this._sourceLoaded||this._paused)return;let p;this.transform=r,this.terrain=u,this.updateCacheSize(r),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(F=>new c.S(F.canonical.z,F.wrap,F.canonical.z,F.canonical.x,F.canonical.y)):(p=r.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:u}),this._source.hasTile&&(p=p.filter(F=>this._source.hasTile(F)))):p=[];const m=r.coveringZoomLevel(this._source),_=Math.max(m-Ut.maxOverzooming,this._source.minzoom),S=Math.max(m+Ut.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const F={};for(const B of p)if(B.canonical.z>this._source.minzoom){const X=B.scaledTo(B.canonical.z-1);F[X.key]=X;const Q=B.scaledTo(Math.max(this._source.minzoom,Math.min(B.canonical.z,5)));F[Q.key]=Q}p=p.concat(Object.values(F))}const E=p.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,E&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const C=this._updateRetainedTiles(p,m);mi(this._source.type)&&this._updateCoveredAndRetainedTiles(C,_,S,m,p,u);for(const F in C)this._tiles[F].clearFadeHold();const z=c.ab(this._tiles,C);for(const F of z){const B=this._tiles[F];B.hasSymbolBuckets&&!B.holdingForFade()?B.setHoldDuration(this.map._fadeDuration):B.hasSymbolBuckets&&!B.symbolFadeFinished()||this._removeTile(F)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(r)}_updateRetainedTiles(r,u){var p;const m={},_={},S=Math.max(u-Ut.maxOverzooming,this._source.minzoom),E=Math.max(u+Ut.maxUnderzooming,this._source.minzoom),C={};for(const z of r){const F=this._addTile(z);m[z.key]=z,F.hasData()||uthis._source.maxzoom){const X=z.children(this._source.maxzoom)[0],Q=this.getTile(X);if(Q&&Q.hasData()){m[X.key]=X;continue}}else{const X=z.children(this._source.maxzoom);if(m[X[0].key]&&m[X[1].key]&&m[X[2].key]&&m[X[3].key])continue}let B=F.wasRequested();for(let X=z.overscaledZ-1;X>=S;--X){const Q=z.scaledTo(X);if(_[Q.key])break;if(_[Q.key]=!0,F=this.getTile(Q),!F&&B&&(F=this._addTile(Q)),F){const re=F.hasData();if((re||!(!((p=this.map)===null||p===void 0)&&p.cancelPendingTileRequestsWhileZooming)||B)&&(m[Q.key]=Q),B=F.wasRequested(),re)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const u=[];let p,m=this._tiles[r].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){p=this._loadedParentTiles[m.key];break}u.push(m.key);const _=m.scaledTo(m.overscaledZ-1);if(p=this._getLoadedTile(_),p)break;m=_}for(const _ of u)this._loadedParentTiles[_]=p}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const r in this._tiles){const u=this._tiles[r].tileID,p=this._getLoadedTile(u);this._loadedSiblingTiles[u.key]=p}}_addTile(r){let u=this._tiles[r.key];if(u)return u;u=this._cache.getAndRemove(r),u&&(this._setTileReloadTimer(r.key,u),u.tileID=r,this._state.initializeTileState(u,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,u)));const p=u;return u||(u=new pi(r,this._source.tileSize*r.overscaleFactor()),this._loadTile(u,r.key,u.state)),u.uses++,this._tiles[r.key]=u,p||this._source.fire(new c.k("dataloading",{tile:u,coord:u.tileID,dataType:"source"})),u}_setTileReloadTimer(r,u){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const p=u.getExpiryTimeout();p&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},p))}_removeTile(r){const u=this._tiles[r];u&&(u.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),u.uses>0||(u.hasData()&&u.state!=="reloading"?this._cache.add(u.tileID,u,u.getExpiryTimeout()):(u.aborted=!0,this._abortTile(u),this._unloadTile(u))))}_dataHandler(r){const u=r.sourceDataType;r.dataType==="source"&&u==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&r.dataType==="source"&&u==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(r);this._cache.reset()}tilesIn(r,u,p){const m=[],_=this.transform;if(!_)return m;const S=p?_.getCameraQueryGeometry(r):r,E=r.map(re=>_.pointCoordinate(re,this.terrain)),C=S.map(re=>_.pointCoordinate(re,this.terrain)),z=this.getIds();let F=1/0,B=1/0,X=-1/0,Q=-1/0;for(const re of C)F=Math.min(F,re.x),B=Math.min(B,re.y),X=Math.max(X,re.x),Q=Math.max(Q,re.y);for(let re=0;re=0&&ae[1].y+we>=0){const Ce=E.map(ze=>pe.getTilePoint(ze)),Pe=C.map(ze=>pe.getTilePoint(ze));m.push({tile:ce,tileID:pe,queryGeometry:Ce,cameraQueryGeometry:Pe,scale:me})}}return m}getVisibleCoordinates(r){const u=this.getRenderableIds(r).map(p=>this._tiles[p].tileID);for(const p of u)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return u}hasTransition(){if(this._source.hasTransition())return!0;if(mi(this._source.type)){const r=A.now();for(const u in this._tiles)if(this._tiles[u].fadeEndTime>=r)return!0}return!1}setFeatureState(r,u,p){this._state.updateState(r=r||"_geojsonTileLayer",u,p)}removeFeatureState(r,u,p){this._state.removeFeatureState(r=r||"_geojsonTileLayer",u,p)}getFeatureState(r,u){return this._state.getState(r=r||"_geojsonTileLayer",u)}setDependencies(r,u,p){const m=this._tiles[r];m&&m.setDependencies(u,p)}reloadTilesForDependencies(r,u){for(const p in this._tiles)this._tiles[p].hasDependency(r,u)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(r,u))}}function Kr(v,r){const u=Math.abs(2*v.wrap)-+(v.wrap<0),p=Math.abs(2*r.wrap)-+(r.wrap<0);return v.overscaledZ-r.overscaledZ||p-u||r.canonical.y-v.canonical.y||r.canonical.x-v.canonical.x}function mi(v){return v==="raster"||v==="image"||v==="video"}Ut.maxOverzooming=10,Ut.maxUnderzooming=3;class Xt{constructor(r,u){this.reset(r,u)}reset(r,u){this.points=r||[],this._distances=[0];for(let p=1;p0?(m-S)/E:0;return this.points[_].mult(1-C).add(this.points[u].mult(C))}}function Yi(v,r){let u=!0;return v==="always"||v!=="never"&&r!=="never"||(u=!1),u}class fs{constructor(r,u,p){const m=this.boxCells=[],_=this.circleCells=[];this.xCellCount=Math.ceil(r/p),this.yCellCount=Math.ceil(u/p);for(let S=0;Sthis.width||m<0||u>this.height)return[];const C=[];if(r<=0&&u<=0&&this.width<=p&&this.height<=m){if(_)return[{key:null,x1:r,y1:u,x2:p,y2:m}];for(let z=0;z0}hitTestCircle(r,u,p,m,_){const S=r-p,E=r+p,C=u-p,z=u+p;if(E<0||S>this.width||z<0||C>this.height)return!1;const F=[];return this._forEachCell(S,C,E,z,this._queryCellCircle,F,{hitTest:!0,overlapMode:m,circle:{x:r,y:u,radius:p},seenUids:{box:{},circle:{}}},_),F.length>0}_queryCell(r,u,p,m,_,S,E,C){const{seenUids:z,hitTest:F,overlapMode:B}=E,X=this.boxCells[_];if(X!==null){const re=this.bboxes;for(const ce of X)if(!z.box[ce]){z.box[ce]=!0;const pe=4*ce,me=this.boxKeys[ce];if(r<=re[pe+2]&&u<=re[pe+3]&&p>=re[pe+0]&&m>=re[pe+1]&&(!C||C(me))&&(!F||!Yi(B,me.overlapMode))&&(S.push({key:me,x1:re[pe],y1:re[pe+1],x2:re[pe+2],y2:re[pe+3]}),F))return!0}}const Q=this.circleCells[_];if(Q!==null){const re=this.circles;for(const ce of Q)if(!z.circle[ce]){z.circle[ce]=!0;const pe=3*ce,me=this.circleKeys[ce];if(this._circleAndRectCollide(re[pe],re[pe+1],re[pe+2],r,u,p,m)&&(!C||C(me))&&(!F||!Yi(B,me.overlapMode))){const we=re[pe],ae=re[pe+1],Ce=re[pe+2];if(S.push({key:me,x1:we-Ce,y1:ae-Ce,x2:we+Ce,y2:ae+Ce}),F)return!0}}}return!1}_queryCellCircle(r,u,p,m,_,S,E,C){const{circle:z,seenUids:F,overlapMode:B}=E,X=this.boxCells[_];if(X!==null){const re=this.bboxes;for(const ce of X)if(!F.box[ce]){F.box[ce]=!0;const pe=4*ce,me=this.boxKeys[ce];if(this._circleAndRectCollide(z.x,z.y,z.radius,re[pe+0],re[pe+1],re[pe+2],re[pe+3])&&(!C||C(me))&&!Yi(B,me.overlapMode))return S.push(!0),!0}}const Q=this.circleCells[_];if(Q!==null){const re=this.circles;for(const ce of Q)if(!F.circle[ce]){F.circle[ce]=!0;const pe=3*ce,me=this.circleKeys[ce];if(this._circlesCollide(re[pe],re[pe+1],re[pe+2],z.x,z.y,z.radius)&&(!C||C(me))&&!Yi(B,me.overlapMode))return S.push(!0),!0}}}_forEachCell(r,u,p,m,_,S,E,C){const z=this._convertToXCellCoord(r),F=this._convertToYCellCoord(u),B=this._convertToXCellCoord(p),X=this._convertToYCellCoord(m);for(let Q=z;Q<=B;Q++)for(let re=F;re<=X;re++)if(_.call(this,r,u,p,m,this.xCellCount*re+Q,S,E,C))return}_convertToXCellCoord(r){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(r*this.xScale)))}_convertToYCellCoord(r){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(r*this.yScale)))}_circlesCollide(r,u,p,m,_,S){const E=m-r,C=_-u,z=p+S;return z*z>E*E+C*C}_circleAndRectCollide(r,u,p,m,_,S,E){const C=(S-m)/2,z=Math.abs(r-(m+C));if(z>C+p)return!1;const F=(E-_)/2,B=Math.abs(u-(_+F));if(B>F+p)return!1;if(z<=C||B<=F)return!0;const X=z-C,Q=B-F;return X*X+Q*Q<=p*p}}function ps(v,r,u,p,m){const _=c.H();return r?(c.K(_,_,[1/m,1/m,1]),u||c.ad(_,_,p.angle)):c.L(_,p.labelPlaneMatrix,v),_}function Hn(v,r,u,p,m){if(r){const _=c.ae(v);return c.K(_,_,[m,m,1]),u||c.ad(_,_,-p.angle),_}return p.glCoordMatrix}function he(v,r,u,p){let m;p?(m=[v,r,p(v,r),1],c.af(m,m,u)):(m=[v,r,0,1],mr(m,m,u));const _=m[3];return{point:new c.P(m[0]/_,m[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}function G(v,r){return .5+v/r*.5}function W(v,r){return v.x>=-r[0]&&v.x<=r[0]&&v.y>=-r[1]&&v.y<=r[1]}function ee(v,r,u,p,m,_,S,E,C,z,F,B,X,Q,re){const ce=p?v.textSizeData:v.iconSizeData,pe=c.ag(ce,u.transform.zoom),me=[256/u.width*2+1,256/u.height*2+1],we=p?v.text.dynamicLayoutVertexArray:v.icon.dynamicLayoutVertexArray;we.clear();const ae=v.lineVertexArray,Ce=p?v.text.placedSymbolArray:v.icon.placedSymbolArray,Pe=u.transform.width/u.transform.height;let ze=!1;for(let Ye=0;YeMath.abs(u.x-r.x)*p?{useVertical:!0}:(v===c.ah.vertical?r.yu.x)?{needsFlipping:!0}:null}function Ie(v,r,u,p,m,_,S,E,C,z,F){const B=u/24,X=r.lineOffsetX*B,Q=r.lineOffsetY*B;let re;if(r.numGlyphs>1){const ce=r.glyphStartIndex+r.numGlyphs,pe=r.lineStartIndex,me=r.lineStartIndex+r.lineLength,we=ue(B,E,X,Q,p,r,F,v);if(!we)return{notEnoughRoom:!0};const ae=he(we.first.point.x,we.first.point.y,S,v.getElevation).point,Ce=he(we.last.point.x,we.last.point.y,S,v.getElevation).point;if(m&&!p){const Pe=Se(r.writingMode,ae,Ce,z);if(Pe)return Pe}re=[we.first];for(let Pe=r.glyphStartIndex+1;Pe0?ae.point:function(ze,Ye,st,gt,wt,dt){return Ae(ze,Ye,st,1,wt,dt)}(v.tileAnchorPoint,we,pe,0,_,v),Pe=Se(r.writingMode,pe,Ce,z);if(Pe)return Pe}const ce=ut(B*E.getoffsetX(r.glyphStartIndex),X,Q,p,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,v,F);if(!ce||v.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};re=[ce]}for(const ce of re)c.aj(C,ce.point,ce.angle);return{}}function Ae(v,r,u,p,m,_){const S=v.add(v.sub(r)._unit()),E=m!==void 0?he(S.x,S.y,m,_.getElevation).point:He(S.x,S.y,_).point,C=u.sub(E);return u.add(C._mult(p/C.mag()))}function _e(v,r,u){const p=r.projectionCache;if(p.projections[v])return p.projections[v];const m=new c.P(r.lineVertexArray.getx(v),r.lineVertexArray.gety(v)),_=He(m.x,m.y,r);if(_.signedDistanceFromCamera>0)return p.projections[v]=_.point,p.anyProjectionOccluded=p.anyProjectionOccluded||_.isOccluded,_.point;const S=v-u.direction;return function(E,C,z,F,B){return Ae(E,C,z,F,void 0,B)}(u.distanceFromAnchor===0?r.tileAnchorPoint:new c.P(r.lineVertexArray.getx(S),r.lineVertexArray.gety(S)),m,u.previousVertex,u.absOffsetX-u.distanceFromAnchor+1,r)}function He(v,r,u){const p=v+u.translation[0],m=r+u.translation[1];let _;return!u.pitchWithMap&&u.projection.useSpecialProjectionForSymbols?(_=u.projection.projectTileCoordinates(p,m,u.unwrappedTileID,u.getElevation),_.point.x=(.5*_.point.x+.5)*u.width,_.point.y=(.5*-_.point.y+.5)*u.height):(_=he(p,m,u.labelPlaneMatrix,u.getElevation),_.isOccluded=!1),_}function Je(v,r,u){return v._unit()._perp()._mult(r*u)}function $e(v,r,u,p,m,_,S,E,C){if(E.projectionCache.offsets[v])return E.projectionCache.offsets[v];const z=u.add(r);if(v+C.direction=m)return E.projectionCache.offsets[v]=z,z;const F=_e(v+C.direction,E,C),B=Je(F.sub(u),S,C.direction),X=u.add(B),Q=F.add(B);return E.projectionCache.offsets[v]=c.ak(_,z,X,Q)||z,E.projectionCache.offsets[v]}function ut(v,r,u,p,m,_,S,E,C){const z=p?v-r:v+r;let F=z>0?1:-1,B=0;p&&(F*=-1,B=Math.PI),F<0&&(B+=Math.PI);let X,Q=F>0?_+m:_+m+1;E.projectionCache.cachedAnchorPoint?X=E.projectionCache.cachedAnchorPoint:(X=He(E.tileAnchorPoint.x,E.tileAnchorPoint.y,E).point,E.projectionCache.cachedAnchorPoint=X);let re,ce,pe=X,me=X,we=0,ae=0;const Ce=Math.abs(z),Pe=[];let ze;for(;we+ae<=Ce;){if(Q+=F,Q<_||Q>=S)return null;we+=ae,me=pe,ce=re;const gt={absOffsetX:Ce,direction:F,distanceFromAnchor:we,previousVertex:me};if(pe=_e(Q,E,gt),u===0)Pe.push(me),ze=pe.sub(me);else{let wt;const dt=pe.sub(me);wt=dt.mag()===0?Je(_e(Q+F,E,gt).sub(pe),u,F):Je(dt,u,F),ce||(ce=me.add(wt)),re=$e(Q,wt,pe,_,S,ce,u,E,gt),Pe.push(ce),ze=re.sub(ce)}ae=ze.mag()}const Ye=ze._mult((Ce-we)/ae)._add(ce||me),st=B+Math.atan2(pe.y-me.y,pe.x-me.x);return Pe.push(Ye),{point:Ye,angle:C?st:0,path:Pe}}const Rt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ot(v,r){for(let u=0;u=1;tr--)_t.push(qt.path[tr]);for(let tr=1;trar.signedDistanceFromCamera<=0)?[]:tr.map(ar=>ar.point)}let Hr=[];if(_t.length>0){const tr=_t[0].clone(),ar=_t[0].clone();for(let Wr=1;Wr<_t.length;Wr++)tr.x=Math.min(tr.x,_t[Wr].x),tr.y=Math.min(tr.y,_t[Wr].y),ar.x=Math.max(ar.x,_t[Wr].x),ar.y=Math.max(ar.y,_t[Wr].y);Hr=tr.x>=dt.x&&ar.x<=ct.x&&tr.y>=dt.y&&ar.y<=ct.y?[_t]:ar.xct.x||ar.yct.y?[]:c.al([_t],dt.x,dt.y,ct.x,ct.y)}for(const tr of Hr){Pt.reset(tr,.25*wt);let ar=0;ar=Pt.length<=.5*wt?1:Math.ceil(Pt.paddedLength/Gt)+1;for(let Wr=0;Wrhe(m.x,m.y,p,u.getElevation))}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const u=[];let p=1/0,m=1/0,_=-1/0,S=-1/0;for(const F of r){const B=new c.P(F.x+Qt,F.y+Qt);p=Math.min(p,B.x),m=Math.min(m,B.y),_=Math.max(_,B.x),S=Math.max(S,B.y),u.push(B)}const E=this.grid.query(p,m,_,S).concat(this.ignoredGrid.query(p,m,_,S)),C={},z={};for(const F of E){const B=F.key;if(C[B.bucketInstanceId]===void 0&&(C[B.bucketInstanceId]={}),C[B.bucketInstanceId][B.featureIndex])continue;const X=[new c.P(F.x1,F.y1),new c.P(F.x2,F.y1),new c.P(F.x2,F.y2),new c.P(F.x1,F.y2)];c.am(u,X)&&(C[B.bucketInstanceId][B.featureIndex]=!0,z[B.bucketInstanceId]===void 0&&(z[B.bucketInstanceId]=[]),z[B.bucketInstanceId].push(B.featureIndex))}return z}insertCollisionBox(r,u,p,m,_,S){(p?this.ignoredGrid:this.grid).insert({bucketInstanceId:m,featureIndex:_,collisionGroupID:S,overlapMode:u},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,u,p,m,_,S){const E=p?this.ignoredGrid:this.grid,C={bucketInstanceId:m,featureIndex:_,collisionGroupID:S,overlapMode:u};for(let z=0;z=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(r,u,p,m){return p>=0&&r=0&&uthis.projectAndGetPerspectiveRatio(p,wt.x,wt.y,m,z));st=gt.some(wt=>!wt.isOccluded),Ye=gt.map(wt=>wt.point)}else st=!0;return{box:c.ao(Ye),allPointsOccluded:!st}}}function or(v,r,u){return r*(c.X/(v.tileSize*Math.pow(2,u-v.tileID.overscaledZ)))}class Tn{constructor(r,u,p,m){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?u:-u))):m&&p?1:0,this.placed=p}isHidden(){return this.opacity===0&&!this.placed}}class rn{constructor(r,u,p,m,_){this.text=new Tn(r?r.text:null,u,p,_),this.icon=new Tn(r?r.icon:null,u,m,_)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class rr{constructor(r,u,p){this.text=r,this.icon=u,this.skipFade=p}}class Mr{constructor(){this.invProjMatrix=c.H(),this.viewportMatrix=c.H(),this.circles=[]}}class Yr{constructor(r,u,p,m,_){this.bucketInstanceId=r,this.featureIndex=u,this.sourceLayerIndex=p,this.bucketIndex=m,this.tileID=_}}class Dn{constructor(r){this.crossSourceCollisions=r,this.maxGroupID=0,this.collisionGroups={}}get(r){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[r]){const u=++this.maxGroupID;this.collisionGroups[r]={ID:u,predicate:p=>p.collisionGroupID===u}}return this.collisionGroups[r]}}function Bn(v,r,u,p,m){const{horizontalAlign:_,verticalAlign:S}=c.au(v);return new c.P(-(_-.5)*r+p[0]*m,-(S-.5)*u+p[1]*m)}class ni{constructor(r,u,p,m,_,S){this.transform=r.clone(),this.terrain=p,this.collisionIndex=new gr(this.transform,u),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Dn(_),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=S,S&&(S.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(r){const u=this.terrain;return u?(p,m)=>u.getElevation(r,p,m):null}getBucketParts(r,u,p,m){const _=p.getBucket(u),S=p.latestFeatureIndex;if(!_||!S||u.id!==_.layerIds[0])return;const E=p.collisionBoxArray,C=_.layers[0].layout,z=_.layers[0].paint,F=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),B=p.tileSize/c.X,X=p.tileID.toUnwrapped(),Q=this.transform.calculatePosMatrix(X),re=C.get("text-pitch-alignment")==="map",ce=C.get("text-rotation-alignment")==="map",pe=or(p,1,this.transform.zoom),me=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("text-translate"),z.get("text-translate-anchor")),we=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("icon-translate"),z.get("icon-translate-anchor")),ae=ps(Q,re,ce,this.transform,pe);let Ce=null;if(re){const ze=Hn(Q,re,ce,this.transform,pe);Ce=c.L([],this.transform.labelPlaneMatrix,ze)}this.retainedQueryData[_.bucketInstanceId]=new Yr(_.bucketInstanceId,S,_.sourceLayerIndex,_.index,p.tileID);const Pe={bucket:_,layout:C,translationText:me,translationIcon:we,posMatrix:Q,unwrappedTileID:X,textLabelPlaneMatrix:ae,labelToScreenMatrix:Ce,scale:F,textPixelRatio:B,holdingForFade:p.holdingForFade(),collisionBoxArray:E,partiallyEvaluatedTextSize:c.ag(_.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(_.sourceID)};if(m)for(const ze of _.sortKeyRanges){const{sortKey:Ye,symbolInstanceStart:st,symbolInstanceEnd:gt}=ze;r.push({sortKey:Ye,symbolInstanceStart:st,symbolInstanceEnd:gt,parameters:Pe})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:_.symbolInstances.length,parameters:Pe})}attemptAnchorPlacement(r,u,p,m,_,S,E,C,z,F,B,X,Q,re,ce,pe,me,we,ae){const Ce=c.aq[r.textAnchor],Pe=[r.textOffset0,r.textOffset1],ze=Bn(Ce,p,m,Pe,_),Ye=this.collisionIndex.placeCollisionBox(u,X,C,z,F,E,S,pe,B.predicate,ae,ze);if((!we||this.collisionIndex.placeCollisionBox(we,X,C,z,F,E,S,me,B.predicate,ae,ze).placeable)&&Ye.placeable){let st;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID].text&&(st=this.prevPlacement.variableOffsets[Q.crossTileID].anchor),Q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Q.crossTileID]={textOffset:Pe,width:p,height:m,anchor:Ce,textBoxScale:_,prevAnchor:st},this.markUsedJustification(re,Ce,Q,ce),re.allowVerticalPlacement&&(this.markUsedOrientation(re,ce,Q),this.placedOrientations[Q.crossTileID]=ce),{shift:ze,placedGlyphBoxes:Ye}}}placeLayerBucketPart(r,u,p){const{bucket:m,layout:_,translationText:S,translationIcon:E,posMatrix:C,unwrappedTileID:z,textLabelPlaneMatrix:F,labelToScreenMatrix:B,textPixelRatio:X,holdingForFade:Q,collisionBoxArray:re,partiallyEvaluatedTextSize:ce,collisionGroup:pe}=r.parameters,me=_.get("text-optional"),we=_.get("icon-optional"),ae=c.ar(_,"text-overlap","text-allow-overlap"),Ce=ae==="always",Pe=c.ar(_,"icon-overlap","icon-allow-overlap"),ze=Pe==="always",Ye=_.get("text-rotation-alignment")==="map",st=_.get("text-pitch-alignment")==="map",gt=_.get("icon-text-fit")!=="none",wt=_.get("symbol-z-order")==="viewport-y",dt=Ce&&(ze||!m.hasIconData()||we),ct=ze&&(Ce||!m.hasTextData()||me);!m.collisionArrays&&re&&m.deserializeCollisionBoxes(re);const Pt=this._getTerrainElevationFunc(this.retainedQueryData[m.bucketInstanceId].tileID),qt=(ft,_t,Gt)=>{var Hr,tr;if(u[ft.crossTileID])return;if(Q)return void(this.placements[ft.crossTileID]=new rr(!1,!1,!1));let ar=!1,Wr=!1,Gn=!0,xs=null,Gr={box:null,placeable:!1,offscreen:null},_i={box:null,placeable:!1,offscreen:null},ii=null,Zn=null,si=null,Ws=0,sl=0,Pc=0;_t.textFeatureIndex?Ws=_t.textFeatureIndex:ft.useRuntimeCollisionCircles&&(Ws=ft.featureIndex),_t.verticalTextFeatureIndex&&(sl=_t.verticalTextFeatureIndex);const ol=_t.textBox;if(ol){const ts=Nn=>{let qn=c.ah.horizontal;if(m.allowVerticalPlacement&&!Nn&&this.prevPlacement){const Li=this.prevPlacement.placedOrientations[ft.crossTileID];Li&&(this.placedOrientations[ft.crossTileID]=Li,qn=Li,this.markUsedOrientation(m,qn,ft))}return qn},rs=(Nn,qn)=>{if(m.allowVerticalPlacement&&ft.numVerticalGlyphVertices>0&&_t.verticalTextBox){for(const Li of m.writingModes)if(Li===c.ah.vertical?(Gr=qn(),_i=Gr):Gr=Nn(),Gr&&Gr.placeable)break}else Gr=Nn()},Ao=ft.textAnchorOffsetStartIndex,ws=ft.textAnchorOffsetEndIndex;if(ws===Ao){const Nn=(qn,Li)=>{const cr=this.collisionIndex.placeCollisionBox(qn,ae,X,C,z,st,Ye,S,pe.predicate,Pt);return cr&&cr.placeable&&(this.markUsedOrientation(m,Li,ft),this.placedOrientations[ft.crossTileID]=Li),cr};rs(()=>Nn(ol,c.ah.horizontal),()=>{const qn=_t.verticalTextBox;return m.allowVerticalPlacement&&ft.numVerticalGlyphVertices>0&&qn?Nn(qn,c.ah.vertical):{box:null,offscreen:null}}),ts(Gr&&Gr.placeable)}else{let Nn=c.aq[(tr=(Hr=this.prevPlacement)===null||Hr===void 0?void 0:Hr.variableOffsets[ft.crossTileID])===null||tr===void 0?void 0:tr.anchor];const qn=(cr,ua,al)=>{const ll=cr.x2-cr.x1,um=cr.y2-cr.y1,t0=ft.textBoxScale,cm=gt&&Pe==="never"?ua:null;let Do=null,hm=ae==="never"?1:2,Ac="never";Nn&&hm++;for(let hu=0;huqn(ol,_t.iconBox,c.ah.horizontal),()=>{const cr=_t.verticalTextBox;return m.allowVerticalPlacement&&(!Gr||!Gr.placeable)&&ft.numVerticalGlyphVertices>0&&cr?qn(cr,_t.verticalIconBox,c.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Gr&&(ar=Gr.placeable,Gn=Gr.offscreen);const Li=ts(Gr&&Gr.placeable);if(!ar&&this.prevPlacement){const cr=this.prevPlacement.variableOffsets[ft.crossTileID];cr&&(this.variableOffsets[ft.crossTileID]=cr,this.markUsedJustification(m,cr.anchor,ft,Li))}}}if(ii=Gr,ar=ii&&ii.placeable,Gn=ii&&ii.offscreen,ft.useRuntimeCollisionCircles){const ts=m.text.placedSymbolArray.get(ft.centerJustifiedTextSymbolIndex),rs=c.ai(m.textSizeData,ce,ts),Ao=_.get("text-padding");Zn=this.collisionIndex.placeCollisionCircles(ae,ts,m.lineVertexArray,m.glyphOffsetArray,rs,C,z,F,B,p,st,pe.predicate,ft.collisionCircleDiameter,Ao,S,Pt),Zn.circles.length&&Zn.collisionDetected&&!p&&c.w("Collisions detected, but collision boxes are not shown"),ar=Ce||Zn.circles.length>0&&!Zn.collisionDetected,Gn=Gn&&Zn.offscreen}if(_t.iconFeatureIndex&&(Pc=_t.iconFeatureIndex),_t.iconBox){const ts=rs=>this.collisionIndex.placeCollisionBox(rs,Pe,X,C,z,st,Ye,E,pe.predicate,Pt,gt&&xs?xs:void 0);_i&&_i.placeable&&_t.verticalIconBox?(si=ts(_t.verticalIconBox),Wr=si.placeable):(si=ts(_t.iconBox),Wr=si.placeable),Gn=Gn&&si.offscreen}const es=me||ft.numHorizontalGlyphVertices===0&&ft.numVerticalGlyphVertices===0,Mc=we||ft.numIconVertices===0;es||Mc?Mc?es||(Wr=Wr&&ar):ar=Wr&&ar:Wr=ar=Wr&&ar;const Fd=Wr&&si.placeable;if(ar&&ii.placeable&&this.collisionIndex.insertCollisionBox(ii.box,ae,_.get("text-ignore-placement"),m.bucketInstanceId,_i&&_i.placeable&&sl?sl:Ws,pe.ID),Fd&&this.collisionIndex.insertCollisionBox(si.box,Pe,_.get("icon-ignore-placement"),m.bucketInstanceId,Pc,pe.ID),Zn&&ar&&this.collisionIndex.insertCollisionCircles(Zn.circles,ae,_.get("text-ignore-placement"),m.bucketInstanceId,Ws,pe.ID),p&&this.storeCollisionData(m.bucketInstanceId,Gt,_t,ii,si,Zn),ft.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(m.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ft.crossTileID]=new rr(ar||dt,Wr||ct,Gn||m.justReloaded),u[ft.crossTileID]=!0};if(wt){if(r.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ft=m.getSortedSymbolIndexes(this.transform.angle);for(let _t=ft.length-1;_t>=0;--_t){const Gt=ft[_t];qt(m.symbolInstances.get(Gt),m.collisionArrays[Gt],Gt)}}else for(let ft=r.symbolInstanceStart;ft=0&&(r.text.placedSymbolArray.get(E).crossTileID=_>=0&&E!==_?0:p.crossTileID)}markUsedOrientation(r,u,p){const m=u===c.ah.horizontal||u===c.ah.horizontalOnly?u:0,_=u===c.ah.vertical?u:0,S=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const E of S)r.text.placedSymbolArray.get(E).placedOrientation=m;p.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=_)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const u=this.prevPlacement;let p=!1;this.prevZoomAdjustment=u?u.zoomAdjustment(this.transform.zoom):0;const m=u?u.symbolFadeChange(r):1,_=u?u.opacities:{},S=u?u.variableOffsets:{},E=u?u.placedOrientations:{};for(const C in this.placements){const z=this.placements[C],F=_[C];F?(this.opacities[C]=new rn(F,m,z.text,z.icon),p=p||z.text!==F.text.placed||z.icon!==F.icon.placed):(this.opacities[C]=new rn(null,m,z.text,z.icon,z.skipFade),p=p||z.text||z.icon)}for(const C in _){const z=_[C];if(!this.opacities[C]){const F=new rn(z,m,!1,!1);F.isHidden()||(this.opacities[C]=F,p=p||z.text.placed||z.icon.placed)}}for(const C in S)this.variableOffsets[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.variableOffsets[C]=S[C]);for(const C in E)this.placedOrientations[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.placedOrientations[C]=E[C]);if(u&&u.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");p?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=u?u.lastPlacementChangeTime:r)}updateLayerOpacities(r,u){const p={};for(const m of u){const _=m.getBucket(r);_&&m.latestFeatureIndex&&r.id===_.layerIds[0]&&this.updateBucketOpacities(_,m.tileID,p,m.collisionBoxArray)}}updateBucketOpacities(r,u,p,m){r.hasTextData()&&(r.text.opacityVertexArray.clear(),r.text.hasVisibleVertices=!1),r.hasIconData()&&(r.icon.opacityVertexArray.clear(),r.icon.hasVisibleVertices=!1),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const _=r.layers[0],S=_.layout,E=new rn(null,0,!1,!1,!0),C=S.get("text-allow-overlap"),z=S.get("icon-allow-overlap"),F=_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"),B=S.get("text-rotation-alignment")==="map",X=S.get("text-pitch-alignment")==="map",Q=S.get("icon-text-fit")!=="none",re=new rn(null,0,C&&(z||!r.hasIconData()||S.get("icon-optional")),z&&(C||!r.hasTextData()||S.get("text-optional")),!0);!r.collisionArrays&&m&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(m);const ce=(me,we,ae)=>{for(let Ce=0;Ce0,st=this.placedOrientations[we.crossTileID],gt=st===c.ah.vertical,wt=st===c.ah.horizontal||st===c.ah.horizontalOnly;if(ae>0||Ce>0){const ct=Di(ze.text);ce(r.text,ae,gt?Ba:ct),ce(r.text,Ce,wt?Ba:ct);const Pt=ze.text.isHidden();[we.rightJustifiedTextSymbolIndex,we.centerJustifiedTextSymbolIndex,we.leftJustifiedTextSymbolIndex].forEach(_t=>{_t>=0&&(r.text.placedSymbolArray.get(_t).hidden=Pt||gt?1:0)}),we.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(we.verticalPlacedTextSymbolIndex).hidden=Pt||wt?1:0);const qt=this.variableOffsets[we.crossTileID];qt&&this.markUsedJustification(r,qt.anchor,we,st);const ft=this.placedOrientations[we.crossTileID];ft&&(this.markUsedJustification(r,"left",we,ft),this.markUsedOrientation(r,ft,we))}if(Ye){const ct=Di(ze.icon),Pt=!(Q&&we.verticalPlacedIconSymbolIndex&>);we.placedIconSymbolIndex>=0&&(ce(r.icon,we.numIconVertices,Pt?ct:Ba),r.icon.placedSymbolArray.get(we.placedIconSymbolIndex).hidden=ze.icon.isHidden()),we.verticalPlacedIconSymbolIndex>=0&&(ce(r.icon,we.numVerticalIconVertices,Pt?Ba:ct),r.icon.placedSymbolArray.get(we.verticalPlacedIconSymbolIndex).hidden=ze.icon.isHidden())}const dt=pe&&pe.has(me)?pe.get(me):{text:null,icon:null};if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const ct=r.collisionArrays[me];if(ct){let Pt=new c.P(0,0);if(ct.textBox||ct.verticalTextBox){let qt=!0;if(F){const ft=this.variableOffsets[Pe];ft?(Pt=Bn(ft.anchor,ft.width,ft.height,ft.textOffset,ft.textBoxScale),B&&Pt._rotate(X?this.transform.angle:-this.transform.angle)):qt=!1}if(ct.textBox||ct.verticalTextBox){let ft;ct.textBox&&(ft=gt),ct.verticalTextBox&&(ft=wt),Fa(r.textCollisionBox.collisionVertexArray,ze.text.placed,!qt||ft,dt.text,Pt.x,Pt.y)}}if(ct.iconBox||ct.verticalIconBox){const qt=!!(!wt&&ct.verticalIconBox);let ft;ct.iconBox&&(ft=qt),ct.verticalIconBox&&(ft=!qt),Fa(r.iconCollisionBox.collisionVertexArray,ze.icon.placed,ft,dt.icon,Q?Pt.x:0,Q?Pt.y:0)}}}}if(r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.text.opacityVertexArray.length!==r.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${r.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${r.text.layoutVertexArray.length}) / 4`);if(r.icon.opacityVertexArray.length!==r.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${r.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${r.icon.layoutVertexArray.length}) / 4`);if(r.bucketInstanceId in this.collisionCircleArrays){const me=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=me.invProjMatrix,r.placementViewportMatrix=me.viewportMatrix,r.collisionCircleArray=me.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return this.stale||r-this.lastPlacementChangeTimer}setStale(){this.stale=!0}}function Fa(v,r,u,p,m,_){p&&p.length!==0||(p=[0,0,0,0]);const S=p[0]-Qt,E=p[1]-Qt,C=p[2]-Qt,z=p[3]-Qt;v.emplaceBack(r?1:0,u?1:0,m||0,_||0,S,E),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,C,E),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,C,z),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,S,z)}const Ar=Math.pow(2,25),qh=Math.pow(2,24),Yh=Math.pow(2,17),Mi=Math.pow(2,16),Ai=Math.pow(2,9),P_=Math.pow(2,8),Xi=Math.pow(2,1);function Di(v){if(v.opacity===0&&!v.placed)return 0;if(v.opacity===1&&v.placed)return 4294967295;const r=v.placed?1:0,u=Math.floor(127*v.opacity);return u*Ar+r*qh+u*Yh+r*Mi+u*Ai+r*P_+u*Xi+r}const Ba=0;function Ko(){return{isOccluded:(v,r,u)=>!1,getPitchedTextCorrection:(v,r,u)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(v,r,u,p){throw new Error("Not implemented.")},translatePosition:(v,r,u,p)=>function(m,_,S,E,C=!1){if(!S[0]&&!S[1])return[0,0];const z=C?E==="map"?m.angle:0:E==="viewport"?-m.angle:0;if(z){const F=Math.sin(z),B=Math.cos(z);S=[S[0]*B-S[1]*F,S[0]*F+S[1]*B]}return[C?S[0]:or(_,S[0],m.zoom),C?S[1]:or(_,S[1],m.zoom)]}(v,r,u,p),getCircleRadiusCorrection:v=>1}}class En{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&!r.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(r,u,p,m,_){const S=this._bucketParts;for(;this._currentTileIndexE.sortKey-C.sortKey));this._currentPartIndex!this._forceFullPlacement&&A.now()-m>2;for(;this._currentPlacementIndex>=0;){const S=u[r[this._currentPlacementIndex]],E=this.placement.collisionIndex.transform.zoom;if(S.type==="symbol"&&(!S.minzoom||S.minzoom<=E)&&(!S.maxzoom||S.maxzoom>E)){if(this._inProgressLayer||(this._inProgressLayer=new En(S)),this._inProgressLayer.continuePlacement(p[S.source],this.placement,this._showCollisionBoxes,S,_))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(r){return this.placement.commit(r),this.placement}}const ms=512/c.X/2;class xn{constructor(r,u,p){this.tileID=r,this.bucketInstanceId=p,this._symbolsByKey={};const m=new Map;for(let _=0;_({x:Math.floor(C.anchorX*ms),y:Math.floor(C.anchorY*ms)})),crossTileIDs:S.map(C=>C.crossTileID)};if(E.positions.length>128){const C=new c.av(E.positions.length,16,Uint16Array);for(const{x:z,y:F}of E.positions)C.add(z,F);C.finish(),delete E.positions,E.index=C}this._symbolsByKey[_]=E}}getScaledCoordinates(r,u){const{x:p,y:m,z:_}=this.tileID.canonical,{x:S,y:E,z:C}=u.canonical,z=ms/Math.pow(2,C-_),F=(E*c.X+r.anchorY)*z,B=m*c.X*ms;return{x:Math.floor((S*c.X+r.anchorX)*z-p*c.X*ms),y:Math.floor(F-B)}}findMatches(r,u,p){const m=this.tileID.canonical.zr)}}class Ju{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class gs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const u=Math.round((r-this.lng)/360);if(u!==0)for(const p in this.indexes){const m=this.indexes[p],_={};for(const S in m){const E=m[S];E.tileID=E.tileID.unwrapTo(E.tileID.wrap+u),_[E.tileID.key]=E}this.indexes[p]=_}this.lng=r}addBucket(r,u,p){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===u.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let _=0;_r.overscaledZ)for(const E in S){const C=S[E];C.tileID.isChildOf(r)&&C.findMatches(u.symbolInstances,r,m)}else{const E=S[r.scaledTo(Number(_)).key];E&&E.findMatches(u.symbolInstances,r,m)}}for(let _=0;_{u[p]=!0});for(const p in this.layerIndexes)u[p]||delete this.layerIndexes[p]}}const ys=(v,r)=>c.t(v,r&&r.filter(u=>u.identifier!=="source.canvas")),M_=c.aw();class Qu extends c.E{constructor(r,u={}){super(),this._rtlPluginLoaded=()=>{for(const p in this.sourceCaches){const m=this.sourceCaches[p].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[p].reload()}},this.map=r,this.dispatcher=new _r(Yt(),r._getMapId()),this.dispatcher.registerMessageHandler("GG",(p,m)=>this.getGlyphs(p,m)),this.dispatcher.registerMessageHandler("GI",(p,m)=>this.getImages(p,m)),this.imageManager=new Ue,this.imageManager.setEventedParent(this),this.glyphManager=new ye(r._requestManager,u.localIdeographFontFamily),this.lineAtlas=new mt(256,512),this.crossTileSymbolIndex=new Xh,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.ay()),vn().on(Ze,this._rtlPluginLoaded),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.sourceCaches[p.sourceId];if(!m)return;const _=m.getSource();if(_&&_.vectorLayerIds)for(const S in this._layers){const E=this._layers[S];E.source===_.id&&this._validateLayer(E)}})}loadURL(r,u={},p){this.fire(new c.k("dataloading",{dataType:"style"})),u.validate=typeof u.validate!="boolean"||u.validate;const m=this.map._requestManager.transformRequest(r,"Style");this._loadStyleRequest=new AbortController;const _=this._loadStyleRequest;c.h(m,this._loadStyleRequest).then(S=>{this._loadStyleRequest=null,this._load(S.data,u,p)}).catch(S=>{this._loadStyleRequest=null,S&&!_.signal.aborted&&this.fire(new c.j(S))})}loadJSON(r,u={},p){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,A.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,u.validate=u.validate!==!1,this._load(r,u,p)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(M_,{validate:!1})}_load(r,u,p){var m;const _=u.transformStyle?u.transformStyle(p,r):r;if(!u.validate||!ys(this,c.u(_))){this._loaded=!0,this.stylesheet=_;for(const S in _.sources)this.addSource(S,_.sources[S],{validate:!1});_.sprite?this._loadSprite(_.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(_.glyphs),this._createLayers(),this.light=new Ke(this.stylesheet.light),this.sky=new Ee(this.stylesheet.sky),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const r=c.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",r),this._order=r.map(u=>u.id),this._layers={},this._serializedLayers=null;for(const u of r){const p=c.aA(u);p.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=p}}_loadSprite(r,u=!1,p=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(_,S,E,C){return c._(this,void 0,void 0,function*(){const z=Oe(_),F=E>1?"@2x":"",B={},X={};for(const{id:Q,url:re}of z){const ce=S.transformRequest(We(re,F,".json"),"SpriteJSON");B[Q]=c.h(ce,C);const pe=S.transformRequest(We(re,F,".png"),"SpriteImage");X[Q]=q.getImage(pe,C)}return yield Promise.all([...Object.values(B),...Object.values(X)]),function(Q,re){return c._(this,void 0,void 0,function*(){const ce={};for(const pe in Q){ce[pe]={};const me=A.getImageCanvasContext((yield re[pe]).data),we=(yield Q[pe]).data;for(const ae in we){const{width:Ce,height:Pe,x:ze,y:Ye,sdf:st,pixelRatio:gt,stretchX:wt,stretchY:dt,content:ct,textFitWidth:Pt,textFitHeight:qt}=we[ae];ce[pe][ae]={data:null,pixelRatio:gt,sdf:st,stretchX:wt,stretchY:dt,content:ct,textFitWidth:Pt,textFitHeight:qt,spriteData:{width:Ce,height:Pe,x:ze,y:Ye,context:me}}}}return ce})}(B,X)})}(r,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(_=>{if(this._spriteRequest=null,_)for(const S in _){this._spritesImagesIds[S]=[];const E=this._spritesImagesIds[S]?this._spritesImagesIds[S].filter(C=>!(C in _)):[];for(const C of E)this.imageManager.removeImage(C),this._changedImages[C]=!0;for(const C in _[S]){const z=S==="default"?C:`${S}:${C}`;this._spritesImagesIds[S].push(z),z in this.imageManager.images?this.imageManager.updateImage(z,_[S][C],!1):this.imageManager.addImage(z,_[S][C]),u&&(this._changedImages[z]=!0)}}}).catch(_=>{this._spriteRequest=null,m=_,this.fire(new c.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),u&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),p&&p(m)})}_unloadSprite(){for(const r of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(r),this._changedImages[r]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(r){const u=this.sourceCaches[r.source];if(!u)return;const p=r.sourceLayer;if(!p)return;const m=u.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(p)===-1)&&this.fire(new c.j(new Error(`Source layer "${p}" does not exist on source "${m.id}" as specified by style layer "${r.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const r in this.sourceCaches)if(!this.sourceCaches[r].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(r,u=!1){const p=this._serializedAllLayers();if(!r||r.length===0)return Object.values(u?c.aB(p):p);const m=[];for(const _ of r)if(p[_]){const S=u?c.aB(p[_]):p[_];m.push(S)}return m}_serializedAllLayers(){let r=this._serializedLayers;if(r)return r;r=this._serializedLayers={};const u=Object.keys(this._layers);for(const p of u){const m=this._layers[p];m.type!=="custom"&&(r[p]=m.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const r in this.sourceCaches)if(this.sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(r){if(!this._loaded)return;const u=this._changed;if(u){const m=Object.keys(this._updatedLayers),_=Object.keys(this._removedLayers);(m.length||_.length)&&this._updateWorkerLayers(m,_);for(const S in this._updatedSources){const E=this._updatedSources[S];if(E==="reload")this._reloadSource(S);else{if(E!=="clear")throw new Error(`Invalid action ${E}`);this._clearSource(S)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const S in this._updatedPaintProps)this._layers[S].updateTransitions(r);this.light.updateTransitions(r),this.sky.updateTransitions(r),this._resetUpdates()}const p={};for(const m in this.sourceCaches){const _=this.sourceCaches[m];p[m]=_.used,_.used=!1}for(const m of this._order){const _=this._layers[m];_.recalculate(r,this._availableImages),!_.isHidden(r.zoom)&&_.source&&(this.sourceCaches[_.source].used=!0)}for(const m in p){const _=this.sourceCaches[m];!!p[m]!=!!_.used&&_.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(r),this.sky.recalculate(r),this.z=r.zoom,u&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=Object.keys(this._changedImages);if(r.length){for(const u in this.sourceCaches)this.sourceCaches[u].reloadTilesForDependencies(["icons","patterns"],r);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const r in this.sourceCaches)this.sourceCaches[r].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(r,u){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(r,!1),removedIds:u})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(r,u={}){var p;this._checkLoaded();const m=this.serialize();if(r=u.transformStyle?u.transformStyle(m,r):r,((p=u.validate)===null||p===void 0||p)&&ys(this,c.u(r)))return!1;(r=c.aB(r)).layers=c.az(r.layers);const _=c.aC(m,r),S=this._getOperationsToPerform(_);if(S.unimplemented.length>0)throw new Error(`Unimplemented: ${S.unimplemented.join(", ")}.`);if(S.operations.length===0)return!1;for(const E of S.operations)E();return this.stylesheet=r,this._serializedLayers=null,!0}_getOperationsToPerform(r){const u=[],p=[];for(const m of r)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":u.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":u.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":u.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":u.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":u.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":u.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":u.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":u.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":u.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":u.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":u.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":u.push(()=>this.setSprite.apply(this,m.args));break;case"setSky":u.push(()=>this.setSky.apply(this,m.args));break;case"setTerrain":u.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":u.push(()=>{});break;default:p.push(m.command)}return{operations:u,unimplemented:p}}addImage(r,u){if(this.getImage(r))return this.fire(new c.j(new Error(`An image named "${r}" already exists.`)));this.imageManager.addImage(r,u),this._afterImageUpdated(r)}updateImage(r,u){this.imageManager.updateImage(r,u)}getImage(r){return this.imageManager.getImage(r)}removeImage(r){if(!this.getImage(r))return this.fire(new c.j(new Error(`An image named "${r}" does not exist.`)));this.imageManager.removeImage(r),this._afterImageUpdated(r)}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(r,u,p={}){if(this._checkLoaded(),this.sourceCaches[r]!==void 0)throw new Error(`Source "${r}" already exists.`);if(!u.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(u).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(u.type)>=0&&this._validate(c.u.source,`sources.${r}`,u,null,p))return;this.map&&this.map._collectResourceTiming&&(u.collectResourceTiming=!0);const m=this.sourceCaches[r]=new Ut(r,u,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:r})),m.onAdd(this.map),this._changed=!0}removeSource(r){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===r)return this.fire(new c.j(new Error(`Source "${r}" cannot be removed while layer "${p}" is using it.`)));const u=this.sourceCaches[r];delete this.sourceCaches[r],delete this._updatedSources[r],u.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:r})),u.setEventedParent(null),u.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(r,u){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error(`There is no source with this ID=${r}`);const p=this.sourceCaches[r].getSource();if(p.type!=="geojson")throw new Error(`geojsonSource.type is ${p.type}, which is !== 'geojson`);p.setData(u),this._changed=!0}getSource(r){return this.sourceCaches[r]&&this.sourceCaches[r].getSource()}addLayer(r,u,p={}){this._checkLoaded();const m=r.id;if(this.getLayer(m))return void this.fire(new c.j(new Error(`Layer "${m}" already exists on this map.`)));let _;if(r.type==="custom"){if(ys(this,c.aD(r)))return;_=c.aA(r)}else{if("source"in r&&typeof r.source=="object"&&(this.addSource(m,r.source),r=c.aB(r),r=c.e(r,{source:m})),this._validate(c.u.layer,`layers.${m}`,r,{arrayIndex:-1},p))return;_=c.aA(r),this._validateLayer(_),_.setEventedParent(this,{layer:{id:m}})}const S=u?this._order.indexOf(u):this._order.length;if(u&&S===-1)this.fire(new c.j(new Error(`Cannot add layer "${m}" before non-existing layer "${u}".`)));else{if(this._order.splice(S,0,m),this._layerOrderChanged=!0,this._layers[m]=_,this._removedLayers[m]&&_.source&&_.type!=="custom"){const E=this._removedLayers[m];delete this._removedLayers[m],E.type!==_.type?this._updatedSources[_.source]="clear":(this._updatedSources[_.source]="reload",this.sourceCaches[_.source].pause())}this._updateLayer(_),_.onAdd&&_.onAdd(this.map)}}moveLayer(r,u){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new c.j(new Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===u)return;const p=this._order.indexOf(r);this._order.splice(p,1);const m=u?this._order.indexOf(u):this._order.length;u&&m===-1?this.fire(new c.j(new Error(`Cannot move layer "${r}" before non-existing layer "${u}".`))):(this._order.splice(m,0,r),this._layerOrderChanged=!0)}removeLayer(r){this._checkLoaded();const u=this._layers[r];if(!u)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${r}".`)));u.setEventedParent(null);const p=this._order.indexOf(r);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=u,delete this._layers[r],this._serializedLayers&&delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],u.onRemove&&u.onRemove(this.map)}getLayer(r){return this._layers[r]}getLayersOrder(){return[...this._order]}hasLayer(r){return r in this._layers}setLayerZoomRange(r,u,p){this._checkLoaded();const m=this.getLayer(r);m?m.minzoom===u&&m.maxzoom===p||(u!=null&&(m.minzoom=u),p!=null&&(m.maxzoom=p),this._updateLayer(m)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${r}".`)))}setFilter(r,u,p={}){this._checkLoaded();const m=this.getLayer(r);if(m){if(!c.aE(m.filter,u))return u==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(c.u.filter,`layers.${m.id}.filter`,u,null,p)||(m.filter=c.aB(u),this._updateLayer(m)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${r}".`)))}getFilter(r){return c.aB(this.getLayer(r).filter)}setLayoutProperty(r,u,p,m={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getLayoutProperty(u),p)||(_.setLayoutProperty(u,p,m),this._updateLayer(_)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${r}".`)))}getLayoutProperty(r,u){const p=this.getLayer(r);if(p)return p.getLayoutProperty(u);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${r}".`)))}setPaintProperty(r,u,p,m={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getPaintProperty(u),p)||(_.setPaintProperty(u,p,m)&&this._updateLayer(_),this._changed=!0,this._updatedPaintProps[r]=!0,this._serializedLayers=null):this.fire(new c.j(new Error(`Cannot style non-existing layer "${r}".`)))}getPaintProperty(r,u){return this.getLayer(r).getPaintProperty(u)}setFeatureState(r,u){this._checkLoaded();const p=r.source,m=r.sourceLayer,_=this.sourceCaches[p];if(_===void 0)return void this.fire(new c.j(new Error(`The source '${p}' does not exist in the map's style.`)));const S=_.getSource().type;S==="geojson"&&m?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):S!=="vector"||m?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),_.setFeatureState(m,r.id,u)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(r,u){this._checkLoaded();const p=r.source,m=this.sourceCaches[p];if(m===void 0)return void this.fire(new c.j(new Error(`The source '${p}' does not exist in the map's style.`)));const _=m.getSource().type,S=_==="vector"?r.sourceLayer:void 0;_!=="vector"||S?u&&typeof r.id!="string"&&typeof r.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(S,r.id,u):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(r){this._checkLoaded();const u=r.source,p=r.sourceLayer,m=this.sourceCaches[u];if(m!==void 0)return m.getSource().type!=="vector"||p?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(p,r.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${u}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const r=c.aF(this.sourceCaches,_=>_.serialize()),u=this._serializeByIds(this._order,!0),p=this.map.getTerrain()||void 0,m=this.stylesheet;return c.aG({version:m.version,name:m.name,metadata:m.metadata,light:m.light,sky:m.sky,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:r,layers:u,terrain:p},_=>_!==void 0)}_updateLayer(r){this._updatedLayers[r.id]=!0,r.source&&!this._updatedSources[r.source]&&this.sourceCaches[r.source].getSource().type!=="raster"&&(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(r){const u=S=>this._layers[S].type==="fill-extrusion",p={},m=[];for(let S=this._order.length-1;S>=0;S--){const E=this._order[S];if(u(E)){p[E]=S;for(const C of r){const z=C[E];if(z)for(const F of z)m.push(F)}}}m.sort((S,E)=>E.intersectionZ-S.intersectionZ);const _=[];for(let S=this._order.length-1;S>=0;S--){const E=this._order[S];if(u(E))for(let C=m.length-1;C>=0;C--){const z=m[C].feature;if(p[z.layer.id]{const st=me.featureSortOrder;if(st){const gt=st.indexOf(ze.featureIndex);return st.indexOf(Ye.featureIndex)-gt}return Ye.featureIndex-ze.featureIndex});for(const ze of Pe)Ce.push(ze)}}for(const me in re)re[me].forEach(we=>{const ae=we.feature,Ce=z[E[me].source].getFeatureState(ae.layer["source-layer"],ae.id);ae.source=ae.layer.source,ae.layer["source-layer"]&&(ae.sourceLayer=ae.layer["source-layer"]),ae.state=Ce});return re}(this._layers,S,this.sourceCaches,r,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(_)}querySourceFeatures(r,u){u&&u.filter&&this._validate(c.u.filter,"querySourceFeatures.filter",u.filter,null,u);const p=this.sourceCaches[r];return p?function(m,_){const S=m.getRenderableIds().map(z=>m.getTileByID(z)),E=[],C={};for(let z=0;zX.getTileByID(Q)).sort((Q,re)=>re.tileID.overscaledZ-Q.tileID.overscaledZ||(Q.tileID.isLessThan(re.tileID)?-1:1))}const B=this.crossTileSymbolIndex.addLayer(F,C[F.source],r.center.lng);S=S||B}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((_=_||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(A.now(),r.zoom))&&(this.pauseablePlacement=new Zl(r,this.map.terrain,this._order,_,u,p,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,C),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(A.now()),E=!0),S&&this.pauseablePlacement.placement.setStale()),E||S)for(const z of this._order){const F=this._layers[z];F.type==="symbol"&&this.placement.updateLayerOpacities(F,C[F.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(A.now())}_releaseSymbolFadeTiles(){for(const r in this.sourceCaches)this.sourceCaches[r].releaseSymbolFadeTiles()}getImages(r,u){return c._(this,void 0,void 0,function*(){const p=yield this.imageManager.getImages(u.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[u.source];return m&&m.setDependencies(u.tileID.key,u.type,u.icons),p})}getGlyphs(r,u){return c._(this,void 0,void 0,function*(){const p=yield this.glyphManager.getGlyphs(u.stacks),m=this.sourceCaches[u.source];return m&&m.setDependencies(u.tileID.key,u.type,[""]),p})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(r,u={}){this._checkLoaded(),r&&this._validate(c.u.glyphs,"glyphs",r,null,u)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=r,this.glyphManager.entries={},this.glyphManager.setURL(r))}addSprite(r,u,p={},m){this._checkLoaded();const _=[{id:r,url:u}],S=[...Oe(this.stylesheet.sprite),..._];this._validate(c.u.sprite,"sprite",S,null,p)||(this.stylesheet.sprite=S,this._loadSprite(_,!0,m))}removeSprite(r){this._checkLoaded();const u=Oe(this.stylesheet.sprite);if(u.find(p=>p.id===r)){if(this._spritesImagesIds[r])for(const p of this._spritesImagesIds[r])this.imageManager.removeImage(p),this._changedImages[p]=!0;u.splice(u.findIndex(p=>p.id===r),1),this.stylesheet.sprite=u.length>0?u:void 0,delete this._spritesImagesIds[r],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${r}" doesn't exists on this map.`)))}getSprite(){return Oe(this.stylesheet.sprite)}setSprite(r,u={},p){this._checkLoaded(),r&&this._validate(c.u.sprite,"sprite",r,null,u)||(this.stylesheet.sprite=r,r?this._loadSprite(r,!0,p):(this._unloadSprite(),p&&p(null)))}}var Jo=c.Y([{name:"a_pos",type:"Int16",components:2}]);const Po={prelude:Sr(`#ifdef GL_ES + */(function(e,t){(function(i,o){e.exports=o()})(ff,function(){var i={},o={};function h(g,c,T){if(o[g]=T,g==="index"){var P="var sharedModule = {}; ("+o.shared+")(sharedModule); ("+o.worker+")(sharedModule);",R={};return o.shared(R),o.index(i,R),typeof window<"u"&&i.setWorkerUrl(window.URL.createObjectURL(new Blob([P],{type:"text/javascript"}))),i}}h("shared",["exports"],function(g){function c(s,n,a,d){return new(a||(a=Promise))(function(y,x){function w(I){try{k(d.next(I))}catch(D){x(D)}}function b(I){try{k(d.throw(I))}catch(D){x(D)}}function k(I){var D;I.done?y(I.value):(D=I.value,D instanceof a?D:new a(function(L){L(D)})).then(w,b)}k((d=d.apply(s,n||[])).next())})}function T(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}typeof SuppressedError=="function"&&SuppressedError;var P=R;function R(s,n){this.x=s,this.y=n}R.prototype={clone:function(){return new R(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,n){return this.clone()._rotateAround(s,n)},matMult:function(s){return this.clone()._matMult(s)},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(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var n=s.x-this.x,a=s.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,n){return Math.atan2(this.x*n-this.y*s,this.x*s+this.y*n)},_matMult:function(s){var n=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=n,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var n=Math.cos(s),a=Math.sin(s),d=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=d,this},_rotateAround:function(s,n){var a=Math.cos(s),d=Math.sin(s),y=n.y+d*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-d*(this.y-n.y),this.y=y,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},R.convert=function(s){return s instanceof R?s:Array.isArray(s)?new R(s[0],s[1]):s};var A=T(P),M=N;function N(s,n,a,d){this.cx=3*s,this.bx=3*(a-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(d-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=n,this.p2x=a,this.p2y=d}N.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,n){if(n===void 0&&(n=1e-6),s<0)return 0;if(s>1)return 1;for(var a=s,d=0;d<8;d++){var y=this.sampleCurveX(a)-s;if(Math.abs(y)y?w=a:b=a,a=.5*(b-w)+w;return a},solve:function(s,n){return this.sampleCurveY(this.solveCurveX(s,n))}};var Y=T(M);let j,te;function O(){return j==null&&(j=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),j}function $(){if(te==null&&(te=!1,O())){const n=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(n){for(let d=0;d<5*5;d++){const y=4*d;n.fillStyle=`rgb(${y},${y+1},${y+2})`,n.fillRect(d%5,Math.floor(d/5),1,1)}const a=n.getImageData(0,0,5,5).data;for(let d=0;d<5*5*4;d++)if(d%4!=3&&a[d]!==d){te=!0;break}}}return te||!1}function q(s,n,a,d){const y=new Y(s,n,a,d);return x=>y.solve(x)}const ne=q(.25,.1,.25,1);function oe(s,n,a){return Math.min(a,Math.max(n,s))}function ke(s,n,a){const d=a-n,y=((s-n)%d+d)%d+n;return y===n?a:y}function ge(s,...n){for(const a of n)for(const d in a)s[d]=a[d];return s}let Fe=1;function Oe(s,n,a){const d={};for(const y in s)d[y]=n.call(this,s[y],y,s);return d}function We(s,n,a){const d={};for(const y in s)n.call(this,s[y],y,s)&&(d[y]=s[y]);return d}function it(s){return Array.isArray(s)?s.map(it):typeof s=="object"&&s?Oe(s,it):s}const ve={};function Ue(s){ve[s]||(typeof console<"u"&&console.warn(s),ve[s]=!0)}function H(s,n,a){return(a.y-s.y)*(n.x-s.x)>(n.y-s.y)*(a.x-s.x)}function Re(s){return typeof WorkerGlobalScope<"u"&&s!==void 0&&s instanceof WorkerGlobalScope}let vt=null;function ye(s){return typeof ImageBitmap<"u"&&s instanceof ImageBitmap}const Be="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Le(s,n,a,d,y){return c(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const x=new VideoFrame(s,{timestamp:0});try{const w=x==null?void 0:x.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const b=w.startsWith("BGR"),k=new Uint8ClampedArray(d*y*4);if(yield x.copyTo(k,function(I,D,L,U,Z){const K=4*Math.max(-D,0),J=(Math.max(0,L)-L)*U*4+K,le=4*U,fe=Math.max(0,D),De=Math.max(0,L);return{rect:{x:fe,y:De,width:Math.min(I.width,D+U)-fe,height:Math.min(I.height,L+Z)-De},layout:[{offset:J,stride:le}]}}(s,n,a,d,y)),b)for(let I=0;IRe(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Yt=function(s,n){if(/:\/\//.test(s.url)&&!/^https?:|^file:/.test(s.url)){const d=rt(s.url);if(d)return d(s,n);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,targetMapId:Jt},n)}if(!(/^file:/.test(a=s.url)||/^file:/.test(Vt())&&!/^\w+:/.test(a))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(d,y){return c(this,void 0,void 0,function*(){const x=new Request(d.url,{method:d.method||"GET",body:d.body,credentials:d.credentials,headers:d.headers,cache:d.cache,referrer:Vt(),signal:y.signal});d.type!=="json"||x.headers.has("Accept")||x.headers.set("Accept","application/json");const w=yield fetch(x);if(!w.ok){const I=yield w.blob();throw new er(w.status,w.statusText,d.url,I)}let b;b=d.type==="arrayBuffer"||d.type==="image"?w.arrayBuffer():d.type==="json"?w.json():w.text();const k=yield b;if(y.signal.aborted)throw mt();return{data:k,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires")}})}(s,n);if(Re(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:s,mustQueue:!0,targetMapId:Jt},n)}var a;return function(d,y){return new Promise((x,w)=>{var b;const k=new XMLHttpRequest;k.open(d.method||"GET",d.url,!0),d.type!=="arrayBuffer"&&d.type!=="image"||(k.responseType="arraybuffer");for(const I in d.headers)k.setRequestHeader(I,d.headers[I]);d.type==="json"&&(k.responseType="text",!((b=d.headers)===null||b===void 0)&&b.Accept||k.setRequestHeader("Accept","application/json")),k.withCredentials=d.credentials==="include",k.onerror=()=>{w(new Error(k.statusText))},k.onload=()=>{if(!y.signal.aborted)if((k.status>=200&&k.status<300||k.status===0)&&k.response!==null){let I=k.response;if(d.type==="json")try{I=JSON.parse(k.response)}catch(D){return void w(D)}x({data:I,cacheControl:k.getResponseHeader("Cache-Control"),expires:k.getResponseHeader("Expires")})}else{const I=new Blob([k.response],{type:k.getResponseHeader("Content-Type")});w(new er(k.status,k.statusText,d.url,I))}},y.signal.addEventListener("abort",()=>{k.abort(),w(mt())}),k.send(d.body)})}(s,n)};function _r(s){if(!s||s.indexOf("://")<=0||s.indexOf("data:image/")===0||s.indexOf("blob:")===0)return!0;const n=new URL(s),a=window.location;return n.protocol===a.protocol&&n.host===a.host}function fr(s,n,a){a[s]&&a[s].indexOf(n)!==-1||(a[s]=a[s]||[],a[s].push(n))}function br(s,n,a){if(a&&a[s]){const d=a[s].indexOf(n);d!==-1&&a[s].splice(d,1)}}class Xr{constructor(n,a={}){ge(this,a),this.type=n}}class V extends Xr{constructor(n,a={}){super("error",ge({error:n},a))}}class je{on(n,a){return this._listeners=this._listeners||{},fr(n,a,this._listeners),this}off(n,a){return br(n,a,this._listeners),br(n,a,this._oneTimeListeners),this}once(n,a){return a?(this._oneTimeListeners=this._oneTimeListeners||{},fr(n,a,this._oneTimeListeners),this):new Promise(d=>this.once(n,d))}fire(n,a){typeof n=="string"&&(n=new Xr(n,a||{}));const d=n.type;if(this.listens(d)){n.target=this;const y=this._listeners&&this._listeners[d]?this._listeners[d].slice():[];for(const b of y)b.call(this,n);const x=this._oneTimeListeners&&this._oneTimeListeners[d]?this._oneTimeListeners[d].slice():[];for(const b of x)br(d,b,this._oneTimeListeners),b.call(this,n);const w=this._eventedParent;w&&(ge(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(n))}else n instanceof V&&console.error(n.error);return this}listens(n){return this._listeners&&this._listeners[n]&&this._listeners[n].length>0||this._oneTimeListeners&&this._oneTimeListeners[n]&&this._oneTimeListeners[n].length>0||this._eventedParent&&this._eventedParent.listens(n)}setEventedParent(n,a){return this._eventedParent=n,this._eventedParentData=a,this}}var ie={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const de=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function se(s,n){const a={};for(const d in s)d!=="ref"&&(a[d]=s[d]);return de.forEach(d=>{d in n&&(a[d]=n[d])}),a}function Te(s,n){if(Array.isArray(s)){if(!Array.isArray(n)||s.length!==n.length)return!1;for(let a=0;a`:s.itemType.kind==="value"?"array":`array<${n}>`}return s.kind}const ee=[pi,Qe,Kt,Ut,Kr,fs,mi,G(Xt),ps,Hn,he];function ue(s,n){if(n.kind==="error")return null;if(s.kind==="array"){if(n.kind==="array"&&(n.N===0&&n.itemType.kind==="value"||!ue(s.itemType,n.itemType))&&(typeof s.N!="number"||s.N===n.N))return null}else{if(s.kind===n.kind)return null;if(s.kind==="value"){for(const a of ee)if(!ue(a,n))return null}}return`Expected ${W(s)} but found ${W(n)} instead.`}function Se(s,n){return n.some(a=>a.kind===s.kind)}function Ie(s,n){return n.some(a=>a==="null"?s===null:a==="array"?Array.isArray(s):a==="object"?s&&!Array.isArray(s)&&typeof s=="object":a===typeof s)}function Ae(s,n){return s.kind==="array"&&n.kind==="array"?s.itemType.kind===n.itemType.kind&&typeof s.N=="number":s.kind===n.kind}const _e=.96422,He=.82521,Je=4/29,$e=6/29,ut=3*$e*$e,Rt=$e*$e*$e,Ot=Math.PI/180,mr=180/Math.PI;function Qt(s){return(s%=360)<0&&(s+=360),s}function gr([s,n,a,d]){let y,x;const w=Tn((.2225045*(s=or(s))+.7168786*(n=or(n))+.0606169*(a=or(a)))/1);s===n&&n===a?y=x=w:(y=Tn((.4360747*s+.3850649*n+.1430804*a)/_e),x=Tn((.0139322*s+.0971045*n+.7141733*a)/He));const b=116*w-16;return[b<0?0:b,500*(y-w),200*(w-x),d]}function or(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function Tn(s){return s>Rt?Math.pow(s,1/3):s/ut+Je}function rn([s,n,a,d]){let y=(s+16)/116,x=isNaN(n)?y:y+n/500,w=isNaN(a)?y:y-a/200;return y=1*Mr(y),x=_e*Mr(x),w=He*Mr(w),[rr(3.1338561*x-1.6168667*y-.4906146*w),rr(-.9787684*x+1.9161415*y+.033454*w),rr(.0719453*x-.2289914*y+1.4052427*w),d]}function rr(s){return(s=s<=.00304?12.92*s:1.055*Math.pow(s,1/2.4)-.055)<0?0:s>1?1:s}function Mr(s){return s>$e?s*s*s:ut*(s-Je)}function Yr(s){return parseInt(s.padEnd(2,s),16)/255}function Dn(s,n){return Bn(n?s/100:s,0,1)}function Bn(s,n,a){return Math.min(Math.max(n,s),a)}function ni(s){return!s.some(Number.isNaN)}const Fa={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Ar{constructor(n,a,d,y=1,x=!0){this.r=n,this.g=a,this.b=d,this.a=y,x||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[n,a,d,y]))}static parse(n){if(n instanceof Ar)return n;if(typeof n!="string")return;const a=function(d){if((d=d.toLowerCase().trim())==="transparent")return[0,0,0,0];const y=Fa[d];if(y){const[w,b,k]=y;return[w/255,b/255,k/255,1]}if(d.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(d)){const w=d.length<6?1:2;let b=1;return[Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+=w)),Yr(d.slice(b,b+w)||"ff")]}if(d.startsWith("rgb")){const w=d.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[b,k,I,D,L,U,Z,K,J,le,fe,De]=w,be=[D||" ",Z||" ",le].join("");if(be===" "||be===" /"||be===",,"||be===",,,"){const Me=[I,U,J].join(""),Ve=Me==="%%%"?100:Me===""?255:0;if(Ve){const et=[Bn(+k/Ve,0,1),Bn(+L/Ve,0,1),Bn(+K/Ve,0,1),fe?Dn(+fe,De):1];if(ni(et))return et}}return}}const x=d.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[w,b,k,I,D,L,U,Z,K]=x,J=[k||" ",D||" ",U].join("");if(J===" "||J===" /"||J===",,"||J===",,,"){const le=[+b,Bn(+I,0,100),Bn(+L,0,100),Z?Dn(+Z,K):1];if(ni(le))return function([fe,De,be,Me]){function Ve(et){const xt=(et+fe/30)%12,Nt=De*Math.min(be,1-be);return be-Nt*Math.max(-1,Math.min(xt-3,9-xt,1))}return fe=Qt(fe),De/=100,be/=100,[Ve(0),Ve(8),Ve(4),Me]}(le)}}}(n);return a?new Ar(...a,!1):void 0}get rgb(){const{r:n,g:a,b:d,a:y}=this,x=y||1/0;return this.overwriteGetter("rgb",[n/x,a/x,d/x,y])}get hcl(){return this.overwriteGetter("hcl",function(n){const[a,d,y,x]=gr(n),w=Math.sqrt(d*d+y*y);return[Math.round(1e4*w)?Qt(Math.atan2(y,d)*mr):NaN,w,a,x]}(this.rgb))}get lab(){return this.overwriteGetter("lab",gr(this.rgb))}overwriteGetter(n,a){return Object.defineProperty(this,n,{value:a}),a}toString(){const[n,a,d,y]=this.rgb;return`rgba(${[n,a,d].map(x=>Math.round(255*x)).join(",")},${y})`}}Ar.black=new Ar(0,0,0,1),Ar.white=new Ar(1,1,1,1),Ar.transparent=new Ar(0,0,0,0),Ar.red=new Ar(1,0,0,1);class qh{constructor(n,a,d){this.sensitivity=n?a?"variant":"case":a?"accent":"base",this.locale=d,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(n,a){return this.collator.compare(n,a)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Yh{constructor(n,a,d,y,x){this.text=n,this.image=a,this.scale=d,this.fontStack=y,this.textColor=x}}class Mi{constructor(n){this.sections=n}static fromString(n){return new Mi([new Yh(n,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(n=>n.text.length!==0||n.image&&n.image.name.length!==0)}static factory(n){return n instanceof Mi?n:Mi.fromString(n)}toString(){return this.sections.length===0?"":this.sections.map(n=>n.text).join("")}}class Ai{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof Ai)return n;if(typeof n=="number")return new Ai([n,n,n,n]);if(Array.isArray(n)&&!(n.length<1||n.length>4)){for(const a of n)if(typeof a!="number")return;switch(n.length){case 1:n=[n[0],n[0],n[0],n[0]];break;case 2:n=[n[0],n[1],n[0],n[1]];break;case 3:n=[n[0],n[1],n[2],n[1]]}return new Ai(n)}}toString(){return JSON.stringify(this.values)}}const P_=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Xi{constructor(n){this.values=n.slice()}static parse(n){if(n instanceof Xi)return n;if(Array.isArray(n)&&!(n.length<1)&&n.length%2==0){for(let a=0;a=0&&s<=255&&typeof n=="number"&&n>=0&&n<=255&&typeof a=="number"&&a>=0&&a<=255?d===void 0||typeof d=="number"&&d>=0&&d<=1?null:`Invalid rgba value [${[s,n,a,d].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof d=="number"?[s,n,a,d]:[s,n,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ko(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof Ar||s instanceof qh||s instanceof Mi||s instanceof Ai||s instanceof Xi||s instanceof Di)return!0;if(Array.isArray(s)){for(const n of s)if(!Ko(n))return!1;return!0}if(typeof s=="object"){for(const n in s)if(!Ko(s[n]))return!1;return!0}return!1}function En(s){if(s===null)return pi;if(typeof s=="string")return Kt;if(typeof s=="boolean")return Ut;if(typeof s=="number")return Qe;if(s instanceof Ar)return Kr;if(s instanceof qh)return Yi;if(s instanceof Mi)return fs;if(s instanceof Ai)return ps;if(s instanceof Xi)return he;if(s instanceof Di)return Hn;if(Array.isArray(s)){const n=s.length;let a;for(const d of s){const y=En(d);if(a){if(a===y)continue;a=Xt;break}a=y}return G(a||Xt,n)}return mi}function Zl(s){const n=typeof s;return s===null?"":n==="string"||n==="number"||n==="boolean"?String(s):s instanceof Ar||s instanceof Mi||s instanceof Ai||s instanceof Xi||s instanceof Di?s.toString():JSON.stringify(s)}class ms{constructor(n,a){this.type=n,this.value=a}static parse(n,a){if(n.length!==2)return a.error(`'literal' expression requires exactly one argument, but found ${n.length-1} instead.`);if(!Ko(n[1]))return a.error("invalid value");const d=n[1];let y=En(d);const x=a.expectedType;return y.kind!=="array"||y.N!==0||!x||x.kind!=="array"||typeof x.N=="number"&&x.N!==0||(y=x),new ms(y,d)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class xn{constructor(n){this.name="ExpressionEvaluationError",this.message=n}toJSON(){return this.message}}const Ju={string:Kt,number:Qe,boolean:Ut,object:mi};class gs{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");let d,y=1;const x=n[0];if(x==="array"){let b,k;if(n.length>2){const I=n[1];if(typeof I!="string"||!(I in Ju)||I==="object")return a.error('The item type argument of "array" must be one of string, number, boolean',1);b=Ju[I],y++}else b=Xt;if(n.length>3){if(n[2]!==null&&(typeof n[2]!="number"||n[2]<0||n[2]!==Math.floor(n[2])))return a.error('The length argument to "array" must be a positive integer literal',2);k=n[2],y++}d=G(b,k)}else{if(!Ju[x])throw new Error(`Types doesn't contain name = ${x}`);d=Ju[x]}const w=[];for(;yn.outputDefined())}}const Xh={"to-boolean":Ut,"to-color":Kr,"to-number":Qe,"to-string":Kt};class ys{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const d=n[0];if(!Xh[d])throw new Error(`Can't parse ${d} as it is not part of the known types`);if((d==="to-boolean"||d==="to-string")&&n.length!==2)return a.error("Expected one argument.");const y=Xh[d],x=[];for(let w=1;w4?`Invalid rbga value ${JSON.stringify(a)}: expected an array containing either three or four numeric values.`:Ba(a[0],a[1],a[2],a[3]),!d))return new Ar(a[0]/255,a[1]/255,a[2]/255,a[3])}throw new xn(d||`Could not parse color from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"padding":{let a;for(const d of this.args){a=d.evaluate(n);const y=Ai.parse(a);if(y)return y}throw new xn(`Could not parse padding from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"variableAnchorOffsetCollection":{let a;for(const d of this.args){a=d.evaluate(n);const y=Xi.parse(a);if(y)return y}throw new xn(`Could not parse variableAnchorOffsetCollection from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"number":{let a=null;for(const d of this.args){if(a=d.evaluate(n),a===null)return 0;const y=Number(a);if(!isNaN(y))return y}throw new xn(`Could not convert ${JSON.stringify(a)} to number.`)}case"formatted":return Mi.fromString(Zl(this.args[0].evaluate(n)));case"resolvedImage":return Di.fromString(Zl(this.args[0].evaluate(n)));default:return Zl(this.args[0].evaluate(n))}}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}const M_=["Unknown","Point","LineString","Polygon"];class Qu{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?M_[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(n){let a=this._parseColorCache[n];return a||(a=this._parseColorCache[n]=Ar.parse(n)),a}}class Jo{constructor(n,a,d=[],y,x=new vn,w=[]){this.registry=n,this.path=d,this.key=d.map(b=>`[${b}]`).join(""),this.scope=x,this.errors=w,this.expectedType=y,this._isConstant=a}parse(n,a,d,y,x={}){return a?this.concat(a,d,y)._parse(n,x):this._parse(n,x)}_parse(n,a){function d(y,x,w){return w==="assert"?new gs(x,[y]):w==="coerce"?new ys(x,[y]):y}if(n!==null&&typeof n!="string"&&typeof n!="boolean"&&typeof n!="number"||(n=["literal",n]),Array.isArray(n)){if(n.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const y=n[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const x=this.registry[y];if(x){let w=x.parse(n,this);if(!w)return null;if(this.expectedType){const b=this.expectedType,k=w.type;if(b.kind!=="string"&&b.kind!=="number"&&b.kind!=="boolean"&&b.kind!=="object"&&b.kind!=="array"||k.kind!=="value")if(b.kind!=="color"&&b.kind!=="formatted"&&b.kind!=="resolvedImage"||k.kind!=="value"&&k.kind!=="string")if(b.kind!=="padding"||k.kind!=="value"&&k.kind!=="number"&&k.kind!=="array")if(b.kind!=="variableAnchorOffsetCollection"||k.kind!=="value"&&k.kind!=="array"){if(this.checkSubtype(b,k))return null}else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"coerce");else w=d(w,b,a.typeAnnotation||"assert")}if(!(w instanceof ms)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const b=new Qu;try{w=new ms(w.type,w.evaluate(b))}catch(k){return this.error(k.message),null}}return w}return this.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(n===void 0?"'undefined' value invalid. Use null instead.":typeof n=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof n} instead.`)}concat(n,a,d){const y=typeof n=="number"?this.path.concat(n):this.path,x=d?this.scope.concat(d):this.scope;return new Jo(this.registry,this._isConstant,y,a||null,x,this.errors)}error(n,...a){const d=`${this.key}${a.map(y=>`[${y}]`).join("")}`;this.errors.push(new _n(d,n))}checkSubtype(n,a){const d=ue(n,a);return d&&this.error(d),d}}class Po{constructor(n,a){this.type=a.type,this.bindings=[].concat(n),this.result=a}evaluate(n){return this.result.evaluate(n)}eachChild(n){for(const a of this.bindings)n(a[1]);n(this.result)}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found ${n.length-1} instead.`);const d=[];for(let x=1;x=d.length)throw new xn(`Array index out of bounds: ${a} > ${d.length-1}.`);if(a!==Math.floor(a))throw new xn(`Array index must be an integer, but found ${a} instead.`);return d[a]}eachChild(n){n(this.index),n(this.input)}outputDefined(){return!1}}class Jh{constructor(n,a){this.type=Ut,this.needle=n,this.haystack=a}static parse(n,a){if(n.length!==3)return a.error(`Expected 2 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Xt);return d&&y?Se(d.type,[Ut,Kt,Qe,pi,Xt])?new Jh(d,y):a.error(`Expected first argument to be of type boolean, string, number or null, but found ${W(d.type)} instead`):null}evaluate(n){const a=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(!d)return!1;if(!Ie(a,["boolean","string","number","null"]))throw new xn(`Expected first argument to be of type boolean, string, number or null, but found ${W(En(a))} instead.`);if(!Ie(d,["string","array"]))throw new xn(`Expected second argument to be of type array or string, but found ${W(En(d))} instead.`);return d.indexOf(a)>=0}eachChild(n){n(this.needle),n(this.haystack)}outputDefined(){return!0}}class Na{constructor(n,a,d){this.type=Qe,this.needle=n,this.haystack=a,this.fromIndex=d}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Xt);if(!d||!y)return null;if(!Se(d.type,[Ut,Kt,Qe,pi,Xt]))return a.error(`Expected first argument to be of type boolean, string, number or null, but found ${W(d.type)} instead`);if(n.length===4){const x=a.parse(n[3],3,Qe);return x?new Na(d,y,x):null}return new Na(d,y)}evaluate(n){const a=this.needle.evaluate(n),d=this.haystack.evaluate(n);if(!Ie(a,["boolean","string","number","null"]))throw new xn(`Expected first argument to be of type boolean, string, number or null, but found ${W(En(a))} instead.`);let y;if(this.fromIndex&&(y=this.fromIndex.evaluate(n)),Ie(d,["string"])){const x=d.indexOf(a,y);return x===-1?-1:[...d.slice(0,x)].length}if(Ie(d,["array"]))return d.indexOf(a,y);throw new xn(`Expected second argument to be of type array or string, but found ${W(En(d))} instead.`)}eachChild(n){n(this.needle),n(this.haystack),this.fromIndex&&n(this.fromIndex)}outputDefined(){return!1}}class Qh{constructor(n,a,d,y,x,w){this.inputType=n,this.type=a,this.input=d,this.cases=y,this.outputs=x,this.otherwise=w}static parse(n,a){if(n.length<5)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if(n.length%2!=1)return a.error("Expected an even number of arguments.");let d,y;a.expectedType&&a.expectedType.kind!=="value"&&(y=a.expectedType);const x={},w=[];for(let I=2;INumber.MAX_SAFE_INTEGER)return U.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof K=="number"&&Math.floor(K)!==K)return U.error("Numeric branch labels must be integer values.");if(d){if(U.checkSubtype(d,En(K)))return null}else d=En(K);if(x[String(K)]!==void 0)return U.error("Branch labels must be unique.");x[String(K)]=w.length}const Z=a.parse(L,I,y);if(!Z)return null;y=y||Z.type,w.push(Z)}const b=a.parse(n[1],1,Xt);if(!b)return null;const k=a.parse(n[n.length-1],n.length-1,y);return k?b.type.kind!=="value"&&a.concat(1).checkSubtype(d,b.type)?null:new Qh(d,y,b,x,w,k):null}evaluate(n){const a=this.input.evaluate(n);return(En(a)===this.inputType&&this.outputs[this.cases[a]]||this.otherwise).evaluate(n)}eachChild(n){n(this.input),this.outputs.forEach(n),n(this.otherwise)}outputDefined(){return this.outputs.every(n=>n.outputDefined())&&this.otherwise.outputDefined()}}class ec{constructor(n,a,d){this.type=n,this.branches=a,this.otherwise=d}static parse(n,a){if(n.length<4)return a.error(`Expected at least 3 arguments, but found only ${n.length-1}.`);if(n.length%2!=0)return a.error("Expected an odd number of arguments.");let d;a.expectedType&&a.expectedType.kind!=="value"&&(d=a.expectedType);const y=[];for(let w=1;wa.outputDefined())&&this.otherwise.outputDefined()}}class ql{constructor(n,a,d,y){this.type=n,this.input=a,this.beginIndex=d,this.endIndex=y}static parse(n,a){if(n.length<=2||n.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${n.length-1} instead.`);const d=a.parse(n[1],1,Xt),y=a.parse(n[2],2,Qe);if(!d||!y)return null;if(!Se(d.type,[G(Xt),Kt,Xt]))return a.error(`Expected first argument to be of type array or string, but found ${W(d.type)} instead`);if(n.length===4){const x=a.parse(n[3],3,Qe);return x?new ql(d.type,d,y,x):null}return new ql(d.type,d,y)}evaluate(n){const a=this.input.evaluate(n),d=this.beginIndex.evaluate(n);let y;if(this.endIndex&&(y=this.endIndex.evaluate(n)),Ie(a,["string"]))return[...a].slice(d,y).join("");if(Ie(a,["array"]))return a.slice(d,y);throw new xn(`Expected first argument to be of type array or string, but found ${W(En(a))} instead.`)}eachChild(n){n(this.input),n(this.beginIndex),this.endIndex&&n(this.endIndex)}outputDefined(){return!1}}function tc(s,n){const a=s.length-1;let d,y,x=0,w=a,b=0;for(;x<=w;)if(b=Math.floor((x+w)/2),d=s[b],y=s[b+1],d<=n){if(b===a||nn))throw new xn("Input is not a number.");w=b-1}return 0}class $a{constructor(n,a,d){this.type=n,this.input=a,this.labels=[],this.outputs=[];for(const[y,x]of d)this.labels.push(y),this.outputs.push(x)}static parse(n,a){if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");const d=a.parse(n[1],1,Qe);if(!d)return null;const y=[];let x=null;a.expectedType&&a.expectedType.kind!=="value"&&(x=a.expectedType);for(let w=1;w=b)return a.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',I);const L=a.parse(k,D,x);if(!L)return null;x=x||L.type,y.push([b,L])}return new $a(x,d,y)}evaluate(n){const a=this.labels,d=this.outputs;if(a.length===1)return d[0].evaluate(n);const y=this.input.evaluate(n);if(y<=a[0])return d[0].evaluate(n);const x=a.length;return y>=a[x-1]?d[x-1].evaluate(n):d[tc(a,y)].evaluate(n)}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function Mp(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var A_=Ap;function Ap(s,n,a,d){this.cx=3*s,this.bx=3*(a-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(d-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=n,this.p2x=a,this.p2y=d}Ap.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,n){if(n===void 0&&(n=1e-6),s<0)return 0;if(s>1)return 1;for(var a=s,d=0;d<8;d++){var y=this.sampleCurveX(a)-s;if(Math.abs(y)y?w=a:b=a,a=.5*(b-w)+w;return a},solve:function(s,n){return this.sampleCurveY(this.solveCurveX(s,n))}};var D_=Mp(A_);function Qo(s,n,a){return s+a*(n-s)}function Yl(s,n,a){return s.map((d,y)=>Qo(d,n[y],a))}const gi={number:Qo,color:function(s,n,a,d="rgb"){switch(d){case"rgb":{const[y,x,w,b]=Yl(s.rgb,n.rgb,a);return new Ar(y,x,w,b,!1)}case"hcl":{const[y,x,w,b]=s.hcl,[k,I,D,L]=n.hcl;let U,Z;if(isNaN(y)||isNaN(k))isNaN(y)?isNaN(k)?U=NaN:(U=k,w!==1&&w!==0||(Z=I)):(U=y,D!==1&&D!==0||(Z=x));else{let De=k-y;k>y&&De>180?De-=360:k180&&(De+=360),U=y+a*De}const[K,J,le,fe]=function([De,be,Me,Ve]){return De=isNaN(De)?0:De*Ot,rn([Me,Math.cos(De)*be,Math.sin(De)*be,Ve])}([U,Z??Qo(x,I,a),Qo(w,D,a),Qo(b,L,a)]);return new Ar(K,J,le,fe,!1)}case"lab":{const[y,x,w,b]=rn(Yl(s.lab,n.lab,a));return new Ar(y,x,w,b,!1)}}},array:Yl,padding:function(s,n,a){return new Ai(Yl(s.values,n.values,a))},variableAnchorOffsetCollection:function(s,n,a){const d=s.values,y=n.values;if(d.length!==y.length)throw new xn(`Cannot interpolate values of different length. from: ${s.toString()}, to: ${n.toString()}`);const x=[];for(let w=0;wtypeof D!="number"||D<0||D>1))return a.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);y={name:"cubic-bezier",controlPoints:I}}}if(n.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${n.length-1}.`);if((n.length-1)%2!=0)return a.error("Expected an even number of arguments.");if(x=a.parse(x,2,Qe),!x)return null;const b=[];let k=null;d==="interpolate-hcl"||d==="interpolate-lab"?k=Kr:a.expectedType&&a.expectedType.kind!=="value"&&(k=a.expectedType);for(let I=0;I=D)return a.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',U);const K=a.parse(L,Z,k);if(!K)return null;k=k||K.type,b.push([D,K])}return Ae(k,Qe)||Ae(k,Kr)||Ae(k,ps)||Ae(k,he)||Ae(k,G(Qe))?new yi(k,d,y,x,b):a.error(`Type ${W(k)} is not interpolatable.`)}evaluate(n){const a=this.labels,d=this.outputs;if(a.length===1)return d[0].evaluate(n);const y=this.input.evaluate(n);if(y<=a[0])return d[0].evaluate(n);const x=a.length;if(y>=a[x-1])return d[x-1].evaluate(n);const w=tc(a,y),b=yi.interpolationFactor(this.interpolation,y,a[w],a[w+1]),k=d[w].evaluate(n),I=d[w+1].evaluate(n);switch(this.operator){case"interpolate":return gi[this.type.kind](k,I,b);case"interpolate-hcl":return gi.color(k,I,b,"hcl");case"interpolate-lab":return gi.color(k,I,b,"lab")}}eachChild(n){n(this.input);for(const a of this.outputs)n(a)}outputDefined(){return this.outputs.every(n=>n.outputDefined())}}function rc(s,n,a,d){const y=d-a,x=s-a;return y===0?0:n===1?x/y:(Math.pow(n,x)-1)/(Math.pow(n,y)-1)}class nc{constructor(n,a){this.type=n,this.args=a}static parse(n,a){if(n.length<2)return a.error("Expectected at least one argument.");let d=null;const y=a.expectedType;y&&y.kind!=="value"&&(d=y);const x=[];for(const b of n.slice(1)){const k=a.parse(b,1+x.length,d,void 0,{typeAnnotation:"omit"});if(!k)return null;d=d||k.type,x.push(k)}if(!d)throw new Error("No output type");const w=y&&x.some(b=>ue(y,b.type));return new nc(w?Xt:d,x)}evaluate(n){let a,d=null,y=0;for(const x of this.args)if(y++,d=x.evaluate(n),d&&d instanceof Di&&!d.available&&(a||(a=d.name),d=null,y===this.args.length&&(d=a)),d!==null)break;return d}eachChild(n){this.args.forEach(n)}outputDefined(){return this.args.every(n=>n.outputDefined())}}function ic(s,n){return s==="=="||s==="!="?n.kind==="boolean"||n.kind==="string"||n.kind==="number"||n.kind==="null"||n.kind==="value":n.kind==="string"||n.kind==="number"||n.kind==="value"}function Dp(s,n,a,d){return d.compare(n,a)===0}function Ua(s,n,a){const d=s!=="=="&&s!=="!=";return class yP{constructor(x,w,b){this.type=Ut,this.lhs=x,this.rhs=w,this.collator=b,this.hasUntypedArgument=x.type.kind==="value"||w.type.kind==="value"}static parse(x,w){if(x.length!==3&&x.length!==4)return w.error("Expected two or three arguments.");const b=x[0];let k=w.parse(x[1],1,Xt);if(!k)return null;if(!ic(b,k.type))return w.concat(1).error(`"${b}" comparisons are not supported for type '${W(k.type)}'.`);let I=w.parse(x[2],2,Xt);if(!I)return null;if(!ic(b,I.type))return w.concat(2).error(`"${b}" comparisons are not supported for type '${W(I.type)}'.`);if(k.type.kind!==I.type.kind&&k.type.kind!=="value"&&I.type.kind!=="value")return w.error(`Cannot compare types '${W(k.type)}' and '${W(I.type)}'.`);d&&(k.type.kind==="value"&&I.type.kind!=="value"?k=new gs(I.type,[k]):k.type.kind!=="value"&&I.type.kind==="value"&&(I=new gs(k.type,[I])));let D=null;if(x.length===4){if(k.type.kind!=="string"&&I.type.kind!=="string"&&k.type.kind!=="value"&&I.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(D=w.parse(x[3],3,Yi),!D)return null}return new yP(k,I,D)}evaluate(x){const w=this.lhs.evaluate(x),b=this.rhs.evaluate(x);if(d&&this.hasUntypedArgument){const k=En(w),I=En(b);if(k.kind!==I.kind||k.kind!=="string"&&k.kind!=="number")throw new xn(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${k.kind}, ${I.kind}) instead.`)}if(this.collator&&!d&&this.hasUntypedArgument){const k=En(w),I=En(b);if(k.kind!=="string"||I.kind!=="string")return n(x,w,b)}return this.collator?a(x,w,b,this.collator.evaluate(x)):n(x,w,b)}eachChild(x){x(this.lhs),x(this.rhs),this.collator&&x(this.collator)}outputDefined(){return!0}}}const z_=Ua("==",function(s,n,a){return n===a},Dp),zp=Ua("!=",function(s,n,a){return n!==a},function(s,n,a,d){return!Dp(0,n,a,d)}),Rp=Ua("<",function(s,n,a){return n",function(s,n,a){return n>a},function(s,n,a,d){return d.compare(n,a)>0}),L_=Ua("<=",function(s,n,a){return n<=a},function(s,n,a,d){return d.compare(n,a)<=0}),Lp=Ua(">=",function(s,n,a){return n>=a},function(s,n,a,d){return d.compare(n,a)>=0});class Xl{constructor(n,a,d){this.type=Yi,this.locale=d,this.caseSensitive=n,this.diacriticSensitive=a}static parse(n,a){if(n.length!==2)return a.error("Expected one argument.");const d=n[1];if(typeof d!="object"||Array.isArray(d))return a.error("Collator options argument must be an object.");const y=a.parse(d["case-sensitive"]!==void 0&&d["case-sensitive"],1,Ut);if(!y)return null;const x=a.parse(d["diacritic-sensitive"]!==void 0&&d["diacritic-sensitive"],1,Ut);if(!x)return null;let w=null;return d.locale&&(w=a.parse(d.locale,1,Kt),!w)?null:new Xl(y,x,w)}evaluate(n){return new qh(this.caseSensitive.evaluate(n),this.diacriticSensitive.evaluate(n),this.locale?this.locale.evaluate(n):null)}eachChild(n){n(this.caseSensitive),n(this.diacriticSensitive),this.locale&&n(this.locale)}outputDefined(){return!1}}class ed{constructor(n,a,d,y,x){this.type=Kt,this.number=n,this.locale=a,this.currency=d,this.minFractionDigits=y,this.maxFractionDigits=x}static parse(n,a){if(n.length!==3)return a.error("Expected two arguments.");const d=a.parse(n[1],1,Qe);if(!d)return null;const y=n[2];if(typeof y!="object"||Array.isArray(y))return a.error("NumberFormat options argument must be an object.");let x=null;if(y.locale&&(x=a.parse(y.locale,1,Kt),!x))return null;let w=null;if(y.currency&&(w=a.parse(y.currency,1,Kt),!w))return null;let b=null;if(y["min-fraction-digits"]&&(b=a.parse(y["min-fraction-digits"],1,Qe),!b))return null;let k=null;return y["max-fraction-digits"]&&(k=a.parse(y["max-fraction-digits"],1,Qe),!k)?null:new ed(d,x,w,b,k)}evaluate(n){return new Intl.NumberFormat(this.locale?this.locale.evaluate(n):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(n):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(n):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(n):void 0}).format(this.number.evaluate(n))}eachChild(n){n(this.number),this.locale&&n(this.locale),this.currency&&n(this.currency),this.minFractionDigits&&n(this.minFractionDigits),this.maxFractionDigits&&n(this.maxFractionDigits)}outputDefined(){return!1}}class sc{constructor(n){this.type=fs,this.sections=n}static parse(n,a){if(n.length<2)return a.error("Expected at least one argument.");const d=n[1];if(!Array.isArray(d)&&typeof d=="object")return a.error("First argument must be an image or text section.");const y=[];let x=!1;for(let w=1;w<=n.length-1;++w){const b=n[w];if(x&&typeof b=="object"&&!Array.isArray(b)){x=!1;let k=null;if(b["font-scale"]&&(k=a.parse(b["font-scale"],1,Qe),!k))return null;let I=null;if(b["text-font"]&&(I=a.parse(b["text-font"],1,G(Kt)),!I))return null;let D=null;if(b["text-color"]&&(D=a.parse(b["text-color"],1,Kr),!D))return null;const L=y[y.length-1];L.scale=k,L.font=I,L.textColor=D}else{const k=a.parse(n[w],1,Xt);if(!k)return null;const I=k.type.kind;if(I!=="string"&&I!=="value"&&I!=="null"&&I!=="resolvedImage")return a.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");x=!0,y.push({content:k,scale:null,font:null,textColor:null})}}return new sc(y)}evaluate(n){return new Mi(this.sections.map(a=>{const d=a.content.evaluate(n);return En(d)===Hn?new Yh("",d,null,null,null):new Yh(Zl(d),null,a.scale?a.scale.evaluate(n):null,a.font?a.font.evaluate(n).join(","):null,a.textColor?a.textColor.evaluate(n):null)}))}eachChild(n){for(const a of this.sections)n(a.content),a.scale&&n(a.scale),a.font&&n(a.font),a.textColor&&n(a.textColor)}outputDefined(){return!1}}class td{constructor(n){this.type=Hn,this.input=n}static parse(n,a){if(n.length!==2)return a.error("Expected two arguments.");const d=a.parse(n[1],1,Kt);return d?new td(d):a.error("No image name provided.")}evaluate(n){const a=this.input.evaluate(n),d=Di.fromString(a);return d&&n.availableImages&&(d.available=n.availableImages.indexOf(a)>-1),d}eachChild(n){n(this.input)}outputDefined(){return!1}}class rd{constructor(n){this.type=Qe,this.input=n}static parse(n,a){if(n.length!==2)return a.error(`Expected 1 argument, but found ${n.length-1} instead.`);const d=a.parse(n[1],1);return d?d.type.kind!=="array"&&d.type.kind!=="string"&&d.type.kind!=="value"?a.error(`Expected argument of type string or array, but found ${W(d.type)} instead.`):new rd(d):null}evaluate(n){const a=this.input.evaluate(n);if(typeof a=="string")return[...a].length;if(Array.isArray(a))return a.length;throw new xn(`Expected value to be of type string or array, but found ${W(En(a))} instead.`)}eachChild(n){n(this.input)}outputDefined(){return!1}}const js=8192;function O_(s,n){const a=(180+s[0])/360,d=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,y=Math.pow(2,n.z);return[Math.round(a*y*js),Math.round(d*y*js)]}function nd(s,n){const a=Math.pow(2,n.z);return[(y=(s[0]/js+n.x)/a,360*y-180),(d=(s[1]/js+n.y)/a,360/Math.PI*Math.atan(Math.exp((180-360*d)*Math.PI/180))-90)];var d,y}function ea(s,n){s[0]=Math.min(s[0],n[0]),s[1]=Math.min(s[1],n[1]),s[2]=Math.max(s[2],n[0]),s[3]=Math.max(s[3],n[1])}function Mo(s,n){return!(s[0]<=n[0]||s[2]>=n[2]||s[1]<=n[1]||s[3]>=n[3])}function Er(s,n,a){const d=s[0]-n[0],y=s[1]-n[1],x=s[0]-a[0],w=s[1]-a[1];return d*w-x*y==0&&d*x<=0&&y*w<=0}function oc(s,n,a,d){return(y=[d[0]-a[0],d[1]-a[1]])[0]*(x=[n[0]-s[0],n[1]-s[1]])[1]-y[1]*x[0]!=0&&!(!Fp(s,n,a,d)||!Fp(a,d,s,n));var y,x}function F_(s,n,a){for(const d of a)for(let y=0;y(y=s)[1]!=(w=b[k+1])[1]>y[1]&&y[0]<(w[0]-x[0])*(y[1]-x[1])/(w[1]-x[1])+x[0]&&(d=!d)}var y,x,w;return d}function B_(s,n){for(const a of n)if(ja(s,a))return!0;return!1}function Op(s,n){for(const a of s)if(!ja(a,n))return!1;for(let a=0;a0&&b<0||w<0&&b>0}function id(s,n,a){const d=[];for(let y=0;ya[2]){const y=.5*d;let x=s[0]-a[0]>y?-d:a[0]-s[0]>y?d:0;x===0&&(x=s[0]-a[2]>y?-d:a[2]-s[0]>y?d:0),s[0]+=x}ea(n,s)}function $p(s,n,a,d){const y=Math.pow(2,d.z)*js,x=[d.x*js,d.y*js],w=[];for(const b of s)for(const k of b){const I=[k.x+x[0],k.y+x[1]];Np(I,n,a,y),w.push(I)}return w}function Up(s,n,a,d){const y=Math.pow(2,d.z)*js,x=[d.x*js,d.y*js],w=[];for(const k of s){const I=[];for(const D of k){const L=[D.x+x[0],D.y+x[1]];ea(n,L),I.push(L)}w.push(I)}if(n[2]-n[0]<=y/2){(b=n)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(const k of w)for(const I of k)Np(I,n,a,y)}var b;return w}class ta{constructor(n,a){this.type=Ut,this.geojson=n,this.geometries=a}static parse(n,a){if(n.length!==2)return a.error(`'within' expression requires exactly one argument, but found ${n.length-1} instead.`);if(Ko(n[1])){const d=n[1];if(d.type==="FeatureCollection"){const y=[];for(const x of d.features){const{type:w,coordinates:b}=x.geometry;w==="Polygon"&&y.push(b),w==="MultiPolygon"&&y.push(...b)}if(y.length)return new ta(d,{type:"MultiPolygon",coordinates:y})}else if(d.type==="Feature"){const y=d.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new ta(d,d.geometry)}else if(d.type==="Polygon"||d.type==="MultiPolygon")return new ta(d,d)}return a.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(a,d){const y=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=a.canonicalID();if(d.type==="Polygon"){const b=id(d.coordinates,x,w),k=$p(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!ja(I,b))return!1}if(d.type==="MultiPolygon"){const b=Bp(d.coordinates,x,w),k=$p(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!B_(I,b))return!1}return!0}(n,this.geometries);if(n.geometryType()==="LineString")return function(a,d){const y=[1/0,1/0,-1/0,-1/0],x=[1/0,1/0,-1/0,-1/0],w=a.canonicalID();if(d.type==="Polygon"){const b=id(d.coordinates,x,w),k=Up(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!Op(I,b))return!1}if(d.type==="MultiPolygon"){const b=Bp(d.coordinates,x,w),k=Up(a.geometry(),y,x,w);if(!Mo(y,x))return!1;for(const I of k)if(!N_(I,b))return!1}return!0}(n,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let jp=class{constructor(s=[],n=(a,d)=>ad?1:0){if(this.data=s,this.length=this.data.length,this.compare=n,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;const s=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),s}peek(){return this.data[0]}_up(s){const{data:n,compare:a}=this,d=n[s];for(;s>0;){const y=s-1>>1,x=n[y];if(a(d,x)>=0)break;n[s]=x,s=y}n[s]=d}_down(s){const{data:n,compare:a}=this,d=this.length>>1,y=n[s];for(;s=0)break;n[s]=n[x],s=x}n[s]=y}};function $_(s,n,a,d,y){Vp(s,n,a,d||s.length-1,y||U_)}function Vp(s,n,a,d,y){for(;d>a;){if(d-a>600){var x=d-a+1,w=n-a+1,b=Math.log(x),k=.5*Math.exp(2*b/3),I=.5*Math.sqrt(b*k*(x-k)/x)*(w-x/2<0?-1:1);Vp(s,n,Math.max(a,Math.floor(n-w*k/x+I)),Math.min(d,Math.floor(n+(x-w)*k/x+I)),y)}var D=s[n],L=a,U=d;for(Kl(s,a,n),y(s[d],D)>0&&Kl(s,a,d);L0;)U--}y(s[a],D)===0?Kl(s,a,U):Kl(s,++U,d),U<=n&&(a=U+1),n<=U&&(d=U-1)}}function Kl(s,n,a){var d=s[n];s[n]=s[a],s[a]=d}function U_(s,n){return sn?1:0}function ac(s,n){if(s.length<=1)return[s];const a=[];let d,y;for(const x of s){const w=V_(x);w!==0&&(x.area=Math.abs(w),y===void 0&&(y=w<0),y===w<0?(d&&a.push(d),d=[x]):d.push(x))}if(d&&a.push(d),n>1)for(let x=0;x1?(I=n[k+1][0],D=n[k+1][1]):Z>0&&(I+=L/this.kx*Z,D+=U/this.ky*Z)),L=this.wrap(a[0]-I)*this.kx,U=(a[1]-D)*this.ky;const K=L*L+U*U;K180;)n-=360;return n}}function Zp(s,n){return n[0]-s[0]}function lc(s){return s[1]-s[0]+1}function ao(s,n){return s[1]>=s[0]&&s[1]s[1])return[null,null];const a=lc(s);if(n){if(a===2)return[s,null];const y=Math.floor(a/2);return[[s[0],s[0]+y],[s[0]+y,s[1]]]}if(a===1)return[s,null];const d=Math.floor(a/2)-1;return[[s[0],s[0]+d],[s[0]+d+1,s[1]]]}function ad(s,n){if(!ao(n,s.length))return[1/0,1/0,-1/0,-1/0];const a=[1/0,1/0,-1/0,-1/0];for(let d=n[0];d<=n[1];++d)ea(a,s[d]);return a}function ld(s){const n=[1/0,1/0,-1/0,-1/0];for(const a of s)for(const d of a)ea(n,d);return n}function uc(s){return s[0]!==-1/0&&s[1]!==-1/0&&s[2]!==1/0&&s[3]!==1/0}function ud(s,n,a){if(!uc(s)||!uc(n))return NaN;let d=0,y=0;return s[2]n[2]&&(d=s[0]-n[2]),s[1]>n[3]&&(y=s[1]-n[3]),s[3]=d)return d;if(Mo(y,x)){if(cc(s,n))return 0}else if(cc(n,s))return 0;let w=1/0;for(const b of s)for(let k=0,I=b.length,D=I-1;k0;){const k=w.pop();if(k[0]>=x)continue;const I=k[1],D=n?50:100;if(lc(I)<=D){if(!ao(I,s.length))return NaN;if(n){const L=ir(s,I,a,d);if(isNaN(L)||L===0)return L;x=Math.min(x,L)}else for(let L=I[0];L<=I[1];++L){const U=W_(s[L],a,d);if(x=Math.min(x,U),x===0)return 0}}else{const L=od(I,n);Rr(w,x,d,s,b,L[0]),Rr(w,x,d,s,b,L[1])}}return x}function Ql(s,n,a,d,y,x=1/0){let w=Math.min(x,y.distance(s[0],a[0]));if(w===0)return w;const b=new jp([[0,[0,s.length-1],[0,a.length-1]]],Zp);for(;b.length>0;){const k=b.pop();if(k[0]>=w)continue;const I=k[1],D=k[2],L=n?50:100,U=d?50:100;if(lc(I)<=L&&lc(D)<=U){if(!ao(I,s.length)&&ao(D,a.length))return NaN;let Z;if(n&&d)Z=H_(s,I,a,D,y),w=Math.min(w,Z);else if(n&&!d){const K=s.slice(I[0],I[1]+1);for(let J=D[0];J<=D[1];++J)if(Z=ra(a[J],K,y),w=Math.min(w,Z),w===0)return w}else if(!n&&d){const K=a.slice(D[0],D[1]+1);for(let J=I[0];J<=I[1];++J)if(Z=ra(s[J],K,y),w=Math.min(w,Z),w===0)return w}else Z=fn(s,I,a,D,y),w=Math.min(w,Z)}else{const Z=od(I,n),K=od(D,d);na(b,w,y,s,a,Z[0],K[0]),na(b,w,y,s,a,Z[0],K[1]),na(b,w,y,s,a,Z[1],K[0]),na(b,w,y,s,a,Z[1],K[1])}}return w}function hd(s){return s.type==="MultiPolygon"?s.coordinates.map(n=>({type:"Polygon",coordinates:n})):s.type==="MultiLineString"?s.coordinates.map(n=>({type:"LineString",coordinates:n})):s.type==="MultiPoint"?s.coordinates.map(n=>({type:"Point",coordinates:n})):[s]}class ia{constructor(n,a){this.type=Qe,this.geojson=n,this.geometries=a}static parse(n,a){if(n.length!==2)return a.error(`'distance' expression requires exactly one argument, but found ${n.length-1} instead.`);if(Ko(n[1])){const d=n[1];if(d.type==="FeatureCollection")return new ia(d,d.features.map(y=>hd(y.geometry)).flat());if(d.type==="Feature")return new ia(d,hd(d.geometry));if("type"in d&&"coordinates"in d)return new ia(d,hd(d))}return a.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(n){if(n.geometry()!=null&&n.canonicalID()!=null){if(n.geometryType()==="Point")return function(a,d){const y=a.geometry(),x=y.flat().map(k=>nd([k.x,k.y],a.canonical));if(y.length===0)return NaN;const w=new sd(x[0][1]);let b=1/0;for(const k of d){switch(k.type){case"Point":b=Math.min(b,Ql(x,!1,[k.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,Ql(x,!1,k.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,Jl(x,!1,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries);if(n.geometryType()==="LineString")return function(a,d){const y=a.geometry(),x=y.flat().map(k=>nd([k.x,k.y],a.canonical));if(y.length===0)return NaN;const w=new sd(x[0][1]);let b=1/0;for(const k of d){switch(k.type){case"Point":b=Math.min(b,Ql(x,!0,[k.coordinates],!1,w,b));break;case"LineString":b=Math.min(b,Ql(x,!0,k.coordinates,!0,w,b));break;case"Polygon":b=Math.min(b,Jl(x,!0,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries);if(n.geometryType()==="Polygon")return function(a,d){const y=a.geometry();if(y.length===0||y[0].length===0)return NaN;const x=ac(y,0).map(k=>k.map(I=>I.map(D=>nd([D.x,D.y],a.canonical)))),w=new sd(x[0][0][0][1]);let b=1/0;for(const k of d)for(const I of x){switch(k.type){case"Point":b=Math.min(b,Jl([k.coordinates],!1,I,w,b));break;case"LineString":b=Math.min(b,Jl(k.coordinates,!0,I,w,b));break;case"Polygon":b=Math.min(b,Nr(I,k.coordinates,w,b))}if(b===0)return b}return b}(n,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Va={"==":z_,"!=":zp,">":R_,"<":Rp,">=":Lp,"<=":L_,array:gs,at:Kh,boolean:gs,case:ec,coalesce:nc,collator:Xl,format:sc,image:td,in:Jh,"index-of":Na,interpolate:yi,"interpolate-hcl":yi,"interpolate-lab":yi,length:rd,let:Po,literal:ms,match:Qh,number:gs,"number-format":ed,object:gs,slice:ql,step:$a,string:gs,"to-boolean":ys,"to-color":ys,"to-number":ys,"to-string":ys,var:Sr,within:ta,distance:ia};class Ki{constructor(n,a,d,y){this.name=n,this.type=a,this._evaluate=d,this.args=y}evaluate(n){return this._evaluate(n,this.args)}eachChild(n){this.args.forEach(n)}outputDefined(){return!1}static parse(n,a){const d=n[0],y=Ki.definitions[d];if(!y)return a.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0);const x=Array.isArray(y)?y[0]:y.type,w=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,b=w.filter(([I])=>!Array.isArray(I)||I.length===n.length-1);let k=null;for(const[I,D]of b){k=new Jo(a.registry,eu,a.path,null,a.scope);const L=[];let U=!1;for(let Z=1;Z{return U=L,Array.isArray(U)?`(${U.map(W).join(", ")})`:`(${W(U.type)}...)`;var U}).join(" | "),D=[];for(let L=1;L{a=n?a&&eu(d):a&&d instanceof ms}),!!a&&tu(s)&&ru(s,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function tu(s){if(s instanceof Ki&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof ta||s instanceof ia)return!1;let n=!0;return s.eachChild(a=>{n&&!tu(a)&&(n=!1)}),n}function Ha(s){if(s instanceof Ki&&s.name==="feature-state")return!1;let n=!0;return s.eachChild(a=>{n&&!Ha(a)&&(n=!1)}),n}function ru(s,n){if(s instanceof Ki&&n.indexOf(s.name)>=0)return!1;let a=!0;return s.eachChild(d=>{a&&!ru(d,n)&&(a=!1)}),a}function hc(s){return{result:"success",value:s}}function Wa(s){return{result:"error",value:s}}function Ga(s){return s["property-type"]==="data-driven"||s["property-type"]==="cross-faded-data-driven"}function qp(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function md(s){return!!s.expression&&s.expression.interpolated}function vr(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function dc(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function G_(s){return s}function Yp(s,n){const a=n.type==="color",d=s.stops&&typeof s.stops[0][0]=="object",y=d||!(d||s.property!==void 0),x=s.type||(md(n)?"exponential":"interval");if(a||n.type==="padding"){const D=a?Ar.parse:Ai.parse;(s=tn({},s)).stops&&(s.stops=s.stops.map(L=>[L[0],D(L[1])])),s.default=D(s.default?s.default:n.default)}if(s.colorSpace&&(w=s.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${s.colorSpace}"`);var w;let b,k,I;if(x==="exponential")b=Kp;else if(x==="interval")b=fc;else if(x==="categorical"){b=Xp,k=Object.create(null);for(const D of s.stops)k[D[0]]=D[1];I=typeof s.stops[0][0]}else{if(x!=="identity")throw new Error(`Unknown function type "${x}"`);b=Jp}if(d){const D={},L=[];for(let K=0;KK[0]),evaluate:({zoom:K},J)=>Kp({stops:U,base:s.base},n,K).evaluate(K,J)}}if(y){const D=x==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:D,interpolationFactor:yi.interpolationFactor.bind(void 0,D),zoomStops:s.stops.map(L=>L[0]),evaluate:({zoom:L})=>b(s,n,L,k,I)}}return{kind:"source",evaluate(D,L){const U=L&&L.properties?L.properties[s.property]:void 0;return U===void 0?Za(s.default,n.default):b(s,n,U,k,I)}}}function Za(s,n,a){return s!==void 0?s:n!==void 0?n:a!==void 0?a:void 0}function Xp(s,n,a,d,y){return Za(typeof a===y?d[a]:void 0,s.default,n.default)}function fc(s,n,a){if(vr(a)!=="number")return Za(s.default,n.default);const d=s.stops.length;if(d===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[d-1][0])return s.stops[d-1][1];const y=tc(s.stops.map(x=>x[0]),a);return s.stops[y][1]}function Kp(s,n,a){const d=s.base!==void 0?s.base:1;if(vr(a)!=="number")return Za(s.default,n.default);const y=s.stops.length;if(y===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[y-1][0])return s.stops[y-1][1];const x=tc(s.stops.map(D=>D[0]),a),w=function(D,L,U,Z){const K=Z-U,J=D-U;return K===0?0:L===1?J/K:(Math.pow(L,J)-1)/(Math.pow(L,K)-1)}(a,d,s.stops[x][0],s.stops[x+1][0]),b=s.stops[x][1],k=s.stops[x+1][1],I=gi[n.type]||G_;return typeof b.evaluate=="function"?{evaluate(...D){const L=b.evaluate.apply(void 0,D),U=k.evaluate.apply(void 0,D);if(L!==void 0&&U!==void 0)return I(L,U,w,s.colorSpace)}}:I(b,k,w,s.colorSpace)}function Jp(s,n,a){switch(n.type){case"color":a=Ar.parse(a);break;case"formatted":a=Mi.fromString(a.toString());break;case"resolvedImage":a=Di.fromString(a.toString());break;case"padding":a=Ai.parse(a);break;default:vr(a)===n.type||n.type==="enum"&&n.values[a]||(a=void 0)}return Za(a,s.default,n.default)}Ki.register(Va,{error:[{kind:"error"},[Kt],(s,[n])=>{throw new xn(n.evaluate(s))}],typeof:[Kt,[Xt],(s,[n])=>W(En(n.evaluate(s)))],"to-rgba":[G(Qe,4),[Kr],(s,[n])=>{const[a,d,y,x]=n.evaluate(s).rgb;return[255*a,255*d,255*y,x]}],rgb:[Kr,[Qe,Qe,Qe],dd],rgba:[Kr,[Qe,Qe,Qe,Qe],dd],has:{type:Ut,overloads:[[[Kt],(s,[n])=>fd(n.evaluate(s),s.properties())],[[Kt,mi],(s,[n,a])=>fd(n.evaluate(s),a.evaluate(s))]]},get:{type:Xt,overloads:[[[Kt],(s,[n])=>pd(n.evaluate(s),s.properties())],[[Kt,mi],(s,[n,a])=>pd(n.evaluate(s),a.evaluate(s))]]},"feature-state":[Xt,[Kt],(s,[n])=>pd(n.evaluate(s),s.featureState||{})],properties:[mi,[],s=>s.properties()],"geometry-type":[Kt,[],s=>s.geometryType()],id:[Xt,[],s=>s.id()],zoom:[Qe,[],s=>s.globals.zoom],"heatmap-density":[Qe,[],s=>s.globals.heatmapDensity||0],"line-progress":[Qe,[],s=>s.globals.lineProgress||0],accumulated:[Xt,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[Qe,sa(Qe),(s,n)=>{let a=0;for(const d of n)a+=d.evaluate(s);return a}],"*":[Qe,sa(Qe),(s,n)=>{let a=1;for(const d of n)a*=d.evaluate(s);return a}],"-":{type:Qe,overloads:[[[Qe,Qe],(s,[n,a])=>n.evaluate(s)-a.evaluate(s)],[[Qe],(s,[n])=>-n.evaluate(s)]]},"/":[Qe,[Qe,Qe],(s,[n,a])=>n.evaluate(s)/a.evaluate(s)],"%":[Qe,[Qe,Qe],(s,[n,a])=>n.evaluate(s)%a.evaluate(s)],ln2:[Qe,[],()=>Math.LN2],pi:[Qe,[],()=>Math.PI],e:[Qe,[],()=>Math.E],"^":[Qe,[Qe,Qe],(s,[n,a])=>Math.pow(n.evaluate(s),a.evaluate(s))],sqrt:[Qe,[Qe],(s,[n])=>Math.sqrt(n.evaluate(s))],log10:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))/Math.LN10],ln:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))],log2:[Qe,[Qe],(s,[n])=>Math.log(n.evaluate(s))/Math.LN2],sin:[Qe,[Qe],(s,[n])=>Math.sin(n.evaluate(s))],cos:[Qe,[Qe],(s,[n])=>Math.cos(n.evaluate(s))],tan:[Qe,[Qe],(s,[n])=>Math.tan(n.evaluate(s))],asin:[Qe,[Qe],(s,[n])=>Math.asin(n.evaluate(s))],acos:[Qe,[Qe],(s,[n])=>Math.acos(n.evaluate(s))],atan:[Qe,[Qe],(s,[n])=>Math.atan(n.evaluate(s))],min:[Qe,sa(Qe),(s,n)=>Math.min(...n.map(a=>a.evaluate(s)))],max:[Qe,sa(Qe),(s,n)=>Math.max(...n.map(a=>a.evaluate(s)))],abs:[Qe,[Qe],(s,[n])=>Math.abs(n.evaluate(s))],round:[Qe,[Qe],(s,[n])=>{const a=n.evaluate(s);return a<0?-Math.round(-a):Math.round(a)}],floor:[Qe,[Qe],(s,[n])=>Math.floor(n.evaluate(s))],ceil:[Qe,[Qe],(s,[n])=>Math.ceil(n.evaluate(s))],"filter-==":[Ut,[Kt,Xt],(s,[n,a])=>s.properties()[n.value]===a.value],"filter-id-==":[Ut,[Xt],(s,[n])=>s.id()===n.value],"filter-type-==":[Ut,[Kt],(s,[n])=>s.geometryType()===n.value],"filter-<":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d{const a=s.id(),d=n.value;return typeof a==typeof d&&a":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d>y}],"filter-id->":[Ut,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a>d}],"filter-<=":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d<=y}],"filter-id-<=":[Ut,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a<=d}],"filter->=":[Ut,[Kt,Xt],(s,[n,a])=>{const d=s.properties()[n.value],y=a.value;return typeof d==typeof y&&d>=y}],"filter-id->=":[Ut,[Xt],(s,[n])=>{const a=s.id(),d=n.value;return typeof a==typeof d&&a>=d}],"filter-has":[Ut,[Xt],(s,[n])=>n.value in s.properties()],"filter-has-id":[Ut,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[Ut,[G(Kt)],(s,[n])=>n.value.indexOf(s.geometryType())>=0],"filter-id-in":[Ut,[G(Xt)],(s,[n])=>n.value.indexOf(s.id())>=0],"filter-in-small":[Ut,[Kt,G(Xt)],(s,[n,a])=>a.value.indexOf(s.properties()[n.value])>=0],"filter-in-large":[Ut,[Kt,G(Xt)],(s,[n,a])=>function(d,y,x,w){for(;x<=w;){const b=x+w>>1;if(y[b]===d)return!0;y[b]>d?w=b-1:x=b+1}return!1}(s.properties()[n.value],a.value,0,a.value.length-1)],all:{type:Ut,overloads:[[[Ut,Ut],(s,[n,a])=>n.evaluate(s)&&a.evaluate(s)],[sa(Ut),(s,n)=>{for(const a of n)if(!a.evaluate(s))return!1;return!0}]]},any:{type:Ut,overloads:[[[Ut,Ut],(s,[n,a])=>n.evaluate(s)||a.evaluate(s)],[sa(Ut),(s,n)=>{for(const a of n)if(a.evaluate(s))return!0;return!1}]]},"!":[Ut,[Ut],(s,[n])=>!n.evaluate(s)],"is-supported-script":[Ut,[Kt],(s,[n])=>{const a=s.globals&&s.globals.isSupportedScript;return!a||a(n.evaluate(s))}],upcase:[Kt,[Kt],(s,[n])=>n.evaluate(s).toUpperCase()],downcase:[Kt,[Kt],(s,[n])=>n.evaluate(s).toLowerCase()],concat:[Kt,sa(Xt),(s,n)=>n.map(a=>Zl(a.evaluate(s))).join("")],"resolved-locale":[Kt,[Yi],(s,[n])=>n.evaluate(s).resolvedLocale()]});class pc{constructor(n,a){var d;this.expression=n,this._warningHistory={},this._evaluator=new Qu,this._defaultValue=a?(d=a).type==="color"&&dc(d.default)?new Ar(0,0,0,0):d.type==="color"?Ar.parse(d.default)||null:d.type==="padding"?Ai.parse(d.default)||null:d.type==="variableAnchorOffsetCollection"?Xi.parse(d.default)||null:d.default===void 0?null:d.default:null,this._enumValues=a&&a.type==="enum"?a.values:null}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._evaluator.globals=n,this._evaluator.feature=a,this._evaluator.featureState=d,this._evaluator.canonical=y,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(n,a,d,y,x,w){this._evaluator.globals=n,this._evaluator.feature=a||null,this._evaluator.featureState=d||null,this._evaluator.canonical=y,this._evaluator.availableImages=x||null,this._evaluator.formattedSection=w||null;try{const b=this.expression.evaluate(this._evaluator);if(b==null||typeof b=="number"&&b!=b)return this._defaultValue;if(this._enumValues&&!(b in this._enumValues))throw new xn(`Expected value to be one of ${Object.keys(this._enumValues).map(k=>JSON.stringify(k)).join(", ")}, but found ${JSON.stringify(b)} instead.`);return b}catch(b){return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(b.message)),this._defaultValue}}}function mc(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in Va}function qa(s,n){const a=new Jo(Va,eu,[],n?function(y){const x={color:Kr,string:Kt,number:Qe,enum:Kt,boolean:Ut,formatted:fs,padding:ps,resolvedImage:Hn,variableAnchorOffsetCollection:he};return y.type==="array"?G(x[y.value]||Xt,y.length):x[y.type]}(n):void 0),d=a.parse(s,void 0,void 0,void 0,n&&n.type==="string"?{typeAnnotation:"coerce"}:void 0);return d?hc(new pc(d,n)):Wa(a.errors)}class Ya{constructor(n,a){this.kind=n,this._styleExpression=a,this.isStateDependent=n!=="constant"&&!Ha(a.expression)}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._styleExpression.evaluateWithoutErrorHandling(n,a,d,y,x,w)}evaluate(n,a,d,y,x,w){return this._styleExpression.evaluate(n,a,d,y,x,w)}}class Xa{constructor(n,a,d,y){this.kind=n,this.zoomStops=d,this._styleExpression=a,this.isStateDependent=n!=="camera"&&!Ha(a.expression),this.interpolationType=y}evaluateWithoutErrorHandling(n,a,d,y,x,w){return this._styleExpression.evaluateWithoutErrorHandling(n,a,d,y,x,w)}evaluate(n,a,d,y,x,w){return this._styleExpression.evaluate(n,a,d,y,x,w)}interpolationFactor(n,a,d){return this.interpolationType?yi.interpolationFactor(this.interpolationType,n,a,d):0}}function gd(s,n){const a=qa(s,n);if(a.result==="error")return a;const d=a.value.expression,y=tu(d);if(!y&&!Ga(n))return Wa([new _n("","data expressions not supported")]);const x=ru(d,["zoom"]);if(!x&&!qp(n))return Wa([new _n("","zoom expressions not supported")]);const w=nu(d);return w||x?w instanceof _n?Wa([w]):w instanceof yi&&!md(n)?Wa([new _n("",'"interpolate" expressions cannot be used with this property')]):hc(w?new Xa(y?"camera":"composite",a.value,w.labels,w instanceof yi?w.interpolation:void 0):new Ya(y?"constant":"source",a.value)):Wa([new _n("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ka{constructor(n,a){this._parameters=n,this._specification=a,tn(this,Yp(this._parameters,this._specification))}static deserialize(n){return new Ka(n._parameters,n._specification)}static serialize(n){return{_parameters:n._parameters,_specification:n._specification}}}function nu(s){let n=null;if(s instanceof Po)n=nu(s.result);else if(s instanceof nc){for(const a of s.args)if(n=nu(a),n)break}else(s instanceof $a||s instanceof yi)&&s.input instanceof Ki&&s.input.name==="zoom"&&(n=s);return n instanceof _n||s.eachChild(a=>{const d=nu(a);d instanceof _n?n=d:!n&&d?n=new _n("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&d&&n!==d&&(n=new _n("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n}function gc(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const n of s.slice(1))if(!gc(n)&&typeof n!="boolean")return!1;return!0;default:return!0}}const yc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yd(s){if(s==null)return{filter:()=>!0,needGeometry:!1};gc(s)||(s=_c(s));const n=qa(s,yc);if(n.result==="error")throw new Error(n.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,d,y)=>n.value.evaluate(a,d,{},y),needGeometry:Qp(s)}}function Z_(s,n){return sn?1:0}function Qp(s){if(!Array.isArray(s))return!1;if(s[0]==="within"||s[0]==="distance")return!0;for(let n=1;n"||n==="<="||n===">="?_d(s[1],s[2],n):n==="any"?(a=s.slice(1),["any"].concat(a.map(_c))):n==="all"?["all"].concat(s.slice(1).map(_c)):n==="none"?["all"].concat(s.slice(1).map(_c).map(Wn)):n==="in"?iu(s[1],s.slice(2)):n==="!in"?Wn(iu(s[1],s.slice(2))):n==="has"?su(s[1]):n!=="!has"||Wn(su(s[1]));var a}function _d(s,n,a){switch(s){case"$type":return[`filter-type-${a}`,n];case"$id":return[`filter-id-${a}`,n];default:return[`filter-${a}`,s,n]}}function iu(s,n){if(n.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",n]];case"$id":return["filter-id-in",["literal",n]];default:return n.length>200&&!n.some(a=>typeof a!=typeof n[0])?["filter-in-large",s,["literal",n.sort(Z_)]]:["filter-in-small",s,["literal",n]]}}function su(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function Wn(s){return["!",s]}function oa(s){const n=typeof s;if(n==="number"||n==="boolean"||n==="string"||s==null)return JSON.stringify(s);if(Array.isArray(s)){let y="[";for(const x of s)y+=`${oa(x)},`;return`${y}]`}const a=Object.keys(s).sort();let d="{";for(let y=0;yd.maximum?[new Ze(n,a,`${a} is greater than the maximum value ${d.maximum}`)]:[]}function vc(s){const n=s.valueSpec,a=pn(s.value.type);let d,y,x,w={};const b=a!=="categorical"&&s.value.property===void 0,k=!b,I=vr(s.value.stops)==="array"&&vr(s.value.stops[0])==="array"&&vr(s.value.stops[0][0])==="object",D=zi({key:s.key,value:s.value,valueSpec:s.styleSpec.function,validateSpec:s.validateSpec,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(Z){if(a==="identity")return[new Ze(Z.key,Z.value,'identity function may not have a "stops" property')];let K=[];const J=Z.value;return K=K.concat(ou({key:Z.key,value:J,valueSpec:Z.valueSpec,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,arrayElementValidator:L})),vr(J)==="array"&&J.length===0&&K.push(new Ze(Z.key,J,"array must have at least one stop")),K},default:function(Z){return Z.validateSpec({key:Z.key,value:Z.value,valueSpec:n,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec})}}});return a==="identity"&&b&&D.push(new Ze(s.key,s.value,'missing required property "property"')),a==="identity"||s.value.stops||D.push(new Ze(s.key,s.value,'missing required property "stops"')),a==="exponential"&&s.valueSpec.expression&&!md(s.valueSpec)&&D.push(new Ze(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(k&&!Ga(s.valueSpec)?D.push(new Ze(s.key,s.value,"property functions not supported")):b&&!qp(s.valueSpec)&&D.push(new Ze(s.key,s.value,"zoom functions not supported"))),a!=="categorical"&&!I||s.value.property!==void 0||D.push(new Ze(s.key,s.value,'"property" property is required')),D;function L(Z){let K=[];const J=Z.value,le=Z.key;if(vr(J)!=="array")return[new Ze(le,J,`array expected, ${vr(J)} found`)];if(J.length!==2)return[new Ze(le,J,`array length 2 expected, length ${J.length} found`)];if(I){if(vr(J[0])!=="object")return[new Ze(le,J,`object expected, ${vr(J[0])} found`)];if(J[0].zoom===void 0)return[new Ze(le,J,"object stop key must have zoom")];if(J[0].value===void 0)return[new Ze(le,J,"object stop key must have value")];if(x&&x>pn(J[0].zoom))return[new Ze(le,J[0].zoom,"stop zoom values must appear in ascending order")];pn(J[0].zoom)!==x&&(x=pn(J[0].zoom),y=void 0,w={}),K=K.concat(zi({key:`${le}[0]`,value:J[0],valueSpec:{zoom:{}},validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,objectElementValidators:{zoom:vd,value:U}}))}else K=K.concat(U({key:`${le}[0]`,value:J[0],valueSpec:{},validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec},J));return mc(_s(J[1]))?K.concat([new Ze(`${le}[1]`,J[1],"expressions are not allowed in function stops.")]):K.concat(Z.validateSpec({key:`${le}[1]`,value:J[1],valueSpec:n,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec}))}function U(Z,K){const J=vr(Z.value),le=pn(Z.value),fe=Z.value!==null?Z.value:K;if(d){if(J!==d)return[new Ze(Z.key,fe,`${J} stop domain type must match previous stop domain type ${d}`)]}else d=J;if(J!=="number"&&J!=="string"&&J!=="boolean")return[new Ze(Z.key,fe,"stop domain value must be a number, string, or boolean")];if(J!=="number"&&a!=="categorical"){let De=`number expected, ${J} found`;return Ga(n)&&a===void 0&&(De+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ze(Z.key,fe,De)]}return a!=="categorical"||J!=="number"||isFinite(le)&&Math.floor(le)===le?a!=="categorical"&&J==="number"&&y!==void 0&&lenew Ze(`${s.key}${d.key}`,s.value,d.message));const a=n.value.expression||n.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!a.outputDefined())return[new Ze(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!Ha(a))return[new Ze(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter"&&!Ha(a))return[new Ze(s.key,s.value,'"feature-state" data expressions are not supported with filters.')];if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!ru(a,["zoom","feature-state"]))return[new Ze(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!tu(a))return[new Ze(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function lo(s){const n=s.key,a=s.value,d=s.valueSpec,y=[];return Array.isArray(d.values)?d.values.indexOf(pn(a))===-1&&y.push(new Ze(n,a,`expected one of [${d.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(d.values).indexOf(pn(a))===-1&&y.push(new Ze(n,a,`expected one of [${Object.keys(d.values).join(", ")}], ${JSON.stringify(a)} found`)),y}function xd(s){return gc(_s(s.value))?Ja(tn({},s,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xc(s)}function xc(s){const n=s.value,a=s.key;if(vr(n)!=="array")return[new Ze(a,n,`array expected, ${vr(n)} found`)];const d=s.styleSpec;let y,x=[];if(n.length<1)return[new Ze(a,n,"filter array must have at least 1 element")];switch(x=x.concat(lo({key:`${a}[0]`,value:n[0],valueSpec:d.filter_operator,style:s.style,styleSpec:s.styleSpec})),pn(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&pn(n[1])==="$type"&&x.push(new Ze(a,n,`"$type" cannot be use with operator "${n[0]}"`));case"==":case"!=":n.length!==3&&x.push(new Ze(a,n,`filter array for operator "${n[0]}" must have 3 elements`));case"in":case"!in":n.length>=2&&(y=vr(n[1]),y!=="string"&&x.push(new Ze(`${a}[1]`,n[1],`string expected, ${y} found`)));for(let w=2;w{I in a&&n.push(new Ze(d,a[I],`"${I}" is prohibited for ref layers`))}),y.layers.forEach(I=>{pn(I.id)===b&&(k=I)}),k?k.ref?n.push(new Ze(d,a.ref,"ref cannot reference another ref layer")):w=pn(k.type):n.push(new Ze(d,a.ref,`ref layer "${b}" not found`))}else if(w!=="background")if(a.source){const k=y.sources&&y.sources[a.source],I=k&&pn(k.type);k?I==="vector"&&w==="raster"?n.push(new Ze(d,a.source,`layer "${a.id}" requires a raster source`)):I!=="raster-dem"&&w==="hillshade"?n.push(new Ze(d,a.source,`layer "${a.id}" requires a raster-dem source`)):I==="raster"&&w!=="raster"?n.push(new Ze(d,a.source,`layer "${a.id}" requires a vector source`)):I!=="vector"||a["source-layer"]?I==="raster-dem"&&w!=="hillshade"?n.push(new Ze(d,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!a.paint||!a.paint["line-gradient"]||I==="geojson"&&k.lineMetrics||n.push(new Ze(d,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):n.push(new Ze(d,a,`layer "${a.id}" must specify a "source-layer"`)):n.push(new Ze(d,a.source,`source "${a.source}" not found`))}else n.push(new Ze(d,a,'missing required property "source"'));return n=n.concat(zi({key:d,value:a,valueSpec:x.layer,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,objectElementValidators:{"*":()=>[],type:()=>s.validateSpec({key:`${d}.type`,value:a.type,valueSpec:x.layer.type,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,object:a,objectKey:"type"}),filter:xd,layout:k=>zi({layer:a,key:k.key,value:k.value,style:k.style,styleSpec:k.styleSpec,validateSpec:k.validateSpec,objectElementValidators:{"*":I=>bd(tn({layerType:w},I))}}),paint:k=>zi({layer:a,key:k.key,value:k.value,style:k.style,styleSpec:k.styleSpec,validateSpec:k.validateSpec,objectElementValidators:{"*":I=>wc(tn({layerType:w},I))}})}})),n}function aa(s){const n=s.value,a=s.key,d=vr(n);return d!=="string"?[new Ze(a,n,`string expected, ${d} found`)]:[]}const bc={promoteId:function({key:s,value:n}){if(vr(n)==="string")return aa({key:s,value:n});{const a=[];for(const d in n)a.push(...aa({key:`${s}.${d}`,value:n[d]}));return a}}};function au(s){const n=s.value,a=s.key,d=s.styleSpec,y=s.style,x=s.validateSpec;if(!n.type)return[new Ze(a,n,'"type" is required')];const w=pn(n.type);let b;switch(w){case"vector":case"raster":return b=zi({key:a,value:n,valueSpec:d[`source_${w.replace("-","_")}`],style:s.style,styleSpec:d,objectElementValidators:bc,validateSpec:x}),b;case"raster-dem":return b=function(k){var I;const D=(I=k.sourceName)!==null&&I!==void 0?I:"",L=k.value,U=k.styleSpec,Z=U.source_raster_dem,K=k.style;let J=[];const le=vr(L);if(L===void 0)return J;if(le!=="object")return J.push(new Ze("source_raster_dem",L,`object expected, ${le} found`)),J;const fe=pn(L.encoding)==="custom",De=["redFactor","greenFactor","blueFactor","baseShift"],be=k.value.encoding?`"${k.value.encoding}"`:"Default";for(const Me in L)!fe&&De.includes(Me)?J.push(new Ze(Me,L[Me],`In "${D}": "${Me}" is only valid when "encoding" is set to "custom". ${be} encoding found`)):Z[Me]?J=J.concat(k.validateSpec({key:Me,value:L[Me],valueSpec:Z[Me],validateSpec:k.validateSpec,style:K,styleSpec:U})):J.push(new Ze(Me,L[Me],`unknown property "${Me}"`));return J}({sourceName:a,value:n,style:s.style,styleSpec:d,validateSpec:x}),b;case"geojson":if(b=zi({key:a,value:n,valueSpec:d.source_geojson,style:y,styleSpec:d,validateSpec:x,objectElementValidators:bc}),n.cluster)for(const k in n.clusterProperties){const[I,D]=n.clusterProperties[k],L=typeof I=="string"?[I,["accumulated"],["get",k]]:I;b.push(...Ja({key:`${a}.${k}.map`,value:D,validateSpec:x,expressionContext:"cluster-map"})),b.push(...Ja({key:`${a}.${k}.reduce`,value:L,validateSpec:x,expressionContext:"cluster-reduce"}))}return b;case"video":return zi({key:a,value:n,valueSpec:d.source_video,style:y,validateSpec:x,styleSpec:d});case"image":return zi({key:a,value:n,valueSpec:d.source_image,style:y,validateSpec:x,styleSpec:d});case"canvas":return[new Ze(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return lo({key:`${a}.type`,value:n.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:x,styleSpec:d})}}function kd(s){const n=s.value,a=s.styleSpec,d=a.light,y=s.style;let x=[];const w=vr(n);if(n===void 0)return x;if(w!=="object")return x=x.concat([new Ze("light",n,`object expected, ${w} found`)]),x;for(const b in n){const k=b.match(/^(.*)-transition$/);x=x.concat(k&&d[k[1]]&&d[k[1]].transition?s.validateSpec({key:b,value:n[b],valueSpec:a.transition,validateSpec:s.validateSpec,style:y,styleSpec:a}):d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],validateSpec:s.validateSpec,style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)])}return x}function Td(s){const n=s.value,a=s.styleSpec,d=a.sky,y=s.style,x=vr(n);if(n===void 0)return[];if(x!=="object")return[new Ze("sky",n,`object expected, ${x} found`)];let w=[];for(const b in n)w=w.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)]);return w}function Ed(s){const n=s.value,a=s.styleSpec,d=a.terrain,y=s.style;let x=[];const w=vr(n);if(n===void 0)return x;if(w!=="object")return x=x.concat([new Ze("terrain",n,`object expected, ${w} found`)]),x;for(const b in n)x=x.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],validateSpec:s.validateSpec,style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)]);return x}function Cd(s){let n=[];const a=s.value,d=s.key;if(Array.isArray(a)){const y=[],x=[];for(const w in a)a[w].id&&y.includes(a[w].id)&&n.push(new Ze(d,a,`all the sprites' ids must be unique, but ${a[w].id} is duplicated`)),y.push(a[w].id),a[w].url&&x.includes(a[w].url)&&n.push(new Ze(d,a,`all the sprites' URLs must be unique, but ${a[w].url} is duplicated`)),x.push(a[w].url),n=n.concat(zi({key:`${d}[${w}]`,value:a[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:s.validateSpec}));return n}return aa({key:d,value:a})}const Sc={"*":()=>[],array:ou,boolean:function(s){const n=s.value,a=s.key,d=vr(n);return d!=="boolean"?[new Ze(a,n,`boolean expected, ${d} found`)]:[]},number:vd,color:function(s){const n=s.key,a=s.value,d=vr(a);return d!=="string"?[new Ze(n,a,`color expected, ${d} found`)]:Ar.parse(String(a))?[]:[new Ze(n,a,`color expected, "${a}" found`)]},constants:tm,enum:lo,filter:xd,function:vc,layer:Sd,object:zi,source:au,light:kd,sky:Td,terrain:Ed,projection:function(s){const n=s.value,a=s.styleSpec,d=a.projection,y=s.style,x=vr(n);if(n===void 0)return[];if(x!=="object")return[new Ze("projection",n,`object expected, ${x} found`)];let w=[];for(const b in n)w=w.concat(d[b]?s.validateSpec({key:b,value:n[b],valueSpec:d[b],style:y,styleSpec:a}):[new Ze(b,n[b],`unknown property "${b}"`)]);return w},string:aa,formatted:function(s){return aa(s).length===0?[]:Ja(s)},resolvedImage:function(s){return aa(s).length===0?[]:Ja(s)},padding:function(s){const n=s.key,a=s.value;if(vr(a)==="array"){if(a.length<1||a.length>4)return[new Ze(n,a,`padding requires 1 to 4 values; ${a.length} values found`)];const d={type:"number"};let y=[];for(let x=0;x[]}})),s.constants&&(a=a.concat(tm({key:"constants",value:s.constants,style:s,styleSpec:n,validateSpec:Qa}))),Id(a)}function Vs(s){return function(n){return s({...n,validateSpec:Qa})}}function Id(s){return[].concat(s).sort((n,a)=>n.line-a.line)}function vs(s){return function(...n){return Id(s.apply(this,n))}}Ji.source=vs(Vs(au)),Ji.sprite=vs(Vs(Cd)),Ji.glyphs=vs(Vs(rm)),Ji.light=vs(Vs(kd)),Ji.sky=vs(Vs(Td)),Ji.terrain=vs(Vs(Ed)),Ji.layer=vs(Vs(Sd)),Ji.filter=vs(Vs(xd)),Ji.paintProperty=vs(Vs(wc)),Ji.layoutProperty=vs(Vs(bd));const la=Ji,q_=la.light,Y_=la.sky,nm=la.paintProperty,im=la.layoutProperty;function Pd(s,n){let a=!1;if(n&&n.length)for(const d of n)s.fire(new V(new Error(d.message))),a=!0;return a}class el{constructor(n,a,d){const y=this.cells=[];if(n instanceof ArrayBuffer){this.arrayBuffer=n;const w=new Int32Array(this.arrayBuffer);n=w[0],this.d=(a=w[1])+2*(d=w[2]);for(let k=0;k=L[K+0]&&y>=L[K+1])?(b[Z]=!0,w.push(D[Z])):b[Z]=!1}}}}_forEachCell(n,a,d,y,x,w,b,k){const I=this._convertToCellCoord(n),D=this._convertToCellCoord(a),L=this._convertToCellCoord(d),U=this._convertToCellCoord(y);for(let Z=I;Z<=L;Z++)for(let K=D;K<=U;K++){const J=this.d*K+Z;if((!k||k(this._convertFromCellCoord(Z),this._convertFromCellCoord(K),this._convertFromCellCoord(Z+1),this._convertFromCellCoord(K+1)))&&x.call(this,n,a,d,y,J,w,b,k))return}}_convertFromCellCoord(n){return(n-this.padding)/this.scale}_convertToCellCoord(n){return Math.max(0,Math.min(this.d-1,Math.floor(n*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const n=this.cells,a=3+this.cells.length+1+1;let d=0;for(let w=0;w=0)continue;const w=s[x];y[x]=Qi[a].shallow.indexOf(x)>=0?w:tl(w,n)}s instanceof Error&&(y.message=s.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return a!=="Object"&&(y.$name=a),y}function rl(s){if(sm(s))return s;if(Array.isArray(s))return s.map(rl);if(typeof s!="object")throw new Error("can't deserialize object of type "+typeof s);const n=Md(s)||"Object";if(!Qi[n])throw new Error(`can't deserialize unregistered class ${n}`);const{klass:a}=Qi[n];if(!a)throw new Error(`can't deserialize unregistered class ${n}`);if(a.deserialize)return a.deserialize(s);const d=Object.create(a.prototype);for(const y of Object.keys(s)){if(y==="$name")continue;const x=s[y];d[y]=Qi[n].shallow.indexOf(y)>=0?x:rl(x)}return d}class Ad{constructor(){this.first=!0}update(n,a){const d=Math.floor(n);return this.first?(this.first=!1,this.lastIntegerZoom=d,this.lastIntegerZoomTime=0,this.lastZoom=n,this.lastFloorZoom=d,!0):(this.lastFloorZoom>d?(this.lastIntegerZoom=d+1,this.lastIntegerZoomTime=a):this.lastFloorZooms>=128&&s<=255,"Hangul Jamo":s=>s>=4352&&s<=4607,Khmer:s=>s>=6016&&s<=6143,"General Punctuation":s=>s>=8192&&s<=8303,"Letterlike Symbols":s=>s>=8448&&s<=8527,"Number Forms":s=>s>=8528&&s<=8591,"Miscellaneous Technical":s=>s>=8960&&s<=9215,"Control Pictures":s=>s>=9216&&s<=9279,"Optical Character Recognition":s=>s>=9280&&s<=9311,"Enclosed Alphanumerics":s=>s>=9312&&s<=9471,"Geometric Shapes":s=>s>=9632&&s<=9727,"Miscellaneous Symbols":s=>s>=9728&&s<=9983,"Miscellaneous Symbols and Arrows":s=>s>=11008&&s<=11263,"Ideographic Description Characters":s=>s>=12272&&s<=12287,"CJK Symbols and Punctuation":s=>s>=12288&&s<=12351,Katakana:s=>s>=12448&&s<=12543,Kanbun:s=>s>=12688&&s<=12703,"CJK Strokes":s=>s>=12736&&s<=12783,"Enclosed CJK Letters and Months":s=>s>=12800&&s<=13055,"CJK Compatibility":s=>s>=13056&&s<=13311,"Yijing Hexagram Symbols":s=>s>=19904&&s<=19967,"Private Use Area":s=>s>=57344&&s<=63743,"Vertical Forms":s=>s>=65040&&s<=65055,"CJK Compatibility Forms":s=>s>=65072&&s<=65103,"Small Form Variants":s=>s>=65104&&s<=65135,"Halfwidth and Fullwidth Forms":s=>s>=65280&&s<=65519};function Dd(s){for(const n of s)if(Rd(n.charCodeAt(0)))return!0;return!1}function X_(s){for(const n of s)if(!nl(n.charCodeAt(0)))return!1;return!0}function zd(s){const n=s.map(a=>{try{return new RegExp(`\\p{sc=${a}}`,"u").source}catch{return null}}).filter(a=>a);return new RegExp(n.join("|"),"u")}const K_=zd(["Arab","Dupl","Mong","Ougr","Syrc"]);function nl(s){return!K_.test(String.fromCodePoint(s))}const om=zd(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Rd(s){return!(s!==746&&s!==747&&(s<4352||!(ur["CJK Compatibility Forms"](s)&&!(s>=65097&&s<=65103)||ur["CJK Compatibility"](s)||ur["CJK Strokes"](s)||!(!ur["CJK Symbols and Punctuation"](s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||ur["Enclosed CJK Letters and Months"](s)||ur["Ideographic Description Characters"](s)||ur.Kanbun(s)||ur.Katakana(s)&&s!==12540||!(!ur["Halfwidth and Fullwidth Forms"](s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!ur["Small Form Variants"](s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||ur["Vertical Forms"](s)||ur["Yijing Hexagram Symbols"](s)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(s))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(s))||om.test(String.fromCodePoint(s)))))}function am(s){return!(Rd(s)||function(n){return!!(ur["Latin-1 Supplement"](n)&&(n===167||n===169||n===174||n===177||n===188||n===189||n===190||n===215||n===247)||ur["General Punctuation"](n)&&(n===8214||n===8224||n===8225||n===8240||n===8241||n===8251||n===8252||n===8258||n===8263||n===8264||n===8265||n===8273)||ur["Letterlike Symbols"](n)||ur["Number Forms"](n)||ur["Miscellaneous Technical"](n)&&(n>=8960&&n<=8967||n>=8972&&n<=8991||n>=8996&&n<=9e3||n===9003||n>=9085&&n<=9114||n>=9150&&n<=9165||n===9167||n>=9169&&n<=9179||n>=9186&&n<=9215)||ur["Control Pictures"](n)&&n!==9251||ur["Optical Character Recognition"](n)||ur["Enclosed Alphanumerics"](n)||ur["Geometric Shapes"](n)||ur["Miscellaneous Symbols"](n)&&!(n>=9754&&n<=9759)||ur["Miscellaneous Symbols and Arrows"](n)&&(n>=11026&&n<=11055||n>=11088&&n<=11097||n>=11192&&n<=11243)||ur["CJK Symbols and Punctuation"](n)||ur.Katakana(n)||ur["Private Use Area"](n)||ur["CJK Compatibility Forms"](n)||ur["Small Form Variants"](n)||ur["Halfwidth and Fullwidth Forms"](n)||n===8734||n===8756||n===8757||n>=9984&&n<=10087||n>=10102&&n<=10131||n===65532||n===65533)}(s))}const J_=zd(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Ld(s){return J_.test(String.fromCodePoint(s))}function Q_(s,n){return!(!n&&Ld(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||ur.Khmer(s))}function e0(s){for(const n of s)if(Ld(n.charCodeAt(0)))return!0;return!1}const Ri=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(s){this.pluginStatus=s.pluginStatus,this.pluginURL=s.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(s){this.applyArabicShaping=s.applyArabicShaping,this.processBidirectionalText=s.processBidirectionalText,this.processStyledBidirectionalText=s.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Vr{constructor(n,a){this.zoom=n,a?(this.now=a.now,this.fadeDuration=a.fadeDuration,this.zoomHistory=a.zoomHistory,this.transition=a.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ad,this.transition={})}isSupportedScript(n){return function(a,d){for(const y of a)if(!Q_(y.charCodeAt(0),d))return!1;return!0}(n,Ri.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const n=this.zoom,a=n-Math.floor(n),d=this.crossFadingFactor();return n>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:a+(1-a)*d}:{fromScale:.5,toScale:1,t:1-(1-d)*a}}}class il{constructor(n,a){this.property=n,this.value=a,this.expression=function(d,y){if(dc(d))return new Ka(d,y);if(mc(d)){const x=gd(d,y);if(x.result==="error")throw new Error(x.value.map(w=>`${w.key}: ${w.message}`).join(", "));return x.value}{let x=d;return y.type==="color"&&typeof d=="string"?x=Ar.parse(d):y.type!=="padding"||typeof d!="number"&&!Array.isArray(d)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(d)&&(x=Xi.parse(d)):x=Ai.parse(d),{kind:"constant",evaluate:()=>x}}}(a===void 0?n.specification.default:a,n.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(n,a,d){return this.property.possiblyEvaluate(this,n,a,d)}}class Tc{constructor(n){this.property=n,this.value=new il(n,void 0)}transitioned(n,a){return new lm(this.property,this.value,a,ge({},n.transition,this.transition),n.now)}untransitioned(){return new lm(this.property,this.value,null,{},0)}}class Ec{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitionablePropertyValues)}getValue(n){return it(this._values[n].value.value)}setValue(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new Tc(this._values[n].property)),this._values[n].value=new il(this._values[n].property,a===null?void 0:it(a))}getTransition(n){return it(this._values[n].transition)}setTransition(n,a){Object.prototype.hasOwnProperty.call(this._values,n)||(this._values[n]=new Tc(this._values[n].property)),this._values[n].transition=it(a)||void 0}serialize(){const n={};for(const a of Object.keys(this._values)){const d=this.getValue(a);d!==void 0&&(n[a]=d);const y=this.getTransition(a);y!==void 0&&(n[`${a}-transition`]=y)}return n}transitioned(n,a){const d=new lu(this._properties);for(const y of Object.keys(this._values))d._values[y]=this._values[y].transitioned(n,a._values[y]);return d}untransitioned(){const n=new lu(this._properties);for(const a of Object.keys(this._values))n._values[a]=this._values[a].untransitioned();return n}}class lm{constructor(n,a,d,y,x){this.property=n,this.value=a,this.begin=x+y.delay||0,this.end=this.begin+y.duration||0,n.specification.transition&&(y.delay||y.duration)&&(this.prior=d)}possiblyEvaluate(n,a,d){const y=n.now||0,x=this.value.possiblyEvaluate(n,a,d),w=this.prior;if(w){if(y>this.end)return this.prior=null,x;if(this.value.isDataDriven())return this.prior=null,x;if(y=1)return 1;const I=k*k,D=I*k;return 4*(k<.5?D:3*(k-I)+D-.75)}(b))}}return x}}class lu{constructor(n){this._properties=n,this._values=Object.create(n.defaultTransitioningPropertyValues)}possiblyEvaluate(n,a,d){const y=new cu(this._properties);for(const x of Object.keys(this._values))y._values[x]=this._values[x].possiblyEvaluate(n,a,d);return y}hasTransition(){for(const n of Object.keys(this._values))if(this._values[n].prior)return!0;return!1}}class uu{constructor(n){this._properties=n,this._values=Object.create(n.defaultPropertyValues)}hasValue(n){return this._values[n].value!==void 0}getValue(n){return it(this._values[n].value)}setValue(n,a){this._values[n]=new il(this._values[n].property,a===null?void 0:it(a))}serialize(){const n={};for(const a of Object.keys(this._values)){const d=this.getValue(a);d!==void 0&&(n[a]=d)}return n}possiblyEvaluate(n,a,d){const y=new cu(this._properties);for(const x of Object.keys(this._values))y._values[x]=this._values[x].possiblyEvaluate(n,a,d);return y}}class Hs{constructor(n,a,d){this.property=n,this.value=a,this.parameters=d}isConstant(){return this.value.kind==="constant"}constantOr(n){return this.value.kind==="constant"?this.value.value:n}evaluate(n,a,d,y){return this.property.evaluate(this.value,this.parameters,n,a,d,y)}}class cu{constructor(n){this._properties=n,this._values=Object.create(n.defaultPossiblyEvaluatedValues)}get(n){return this._values[n]}}class It{constructor(n){this.specification=n}possiblyEvaluate(n,a){if(n.isDataDriven())throw new Error("Value should not be data driven");return n.expression.evaluate(a)}interpolate(n,a,d){const y=gi[this.specification.type];return y?y(n,a,d):n}}class jt{constructor(n,a){this.specification=n,this.overrides=a}possiblyEvaluate(n,a,d,y){return new Hs(this,n.expression.kind==="constant"||n.expression.kind==="camera"?{kind:"constant",value:n.expression.evaluate(a,null,{},d,y)}:n.expression,a)}interpolate(n,a,d){if(n.value.kind!=="constant"||a.value.kind!=="constant")return n;if(n.value.value===void 0||a.value.value===void 0)return new Hs(this,{kind:"constant",value:void 0},n.parameters);const y=gi[this.specification.type];if(y){const x=y(n.value.value,a.value.value,d);return new Hs(this,{kind:"constant",value:x},n.parameters)}return n}evaluate(n,a,d,y,x,w){return n.kind==="constant"?n.value:n.evaluate(a,d,y,x,w)}}class Cc extends jt{possiblyEvaluate(n,a,d,y){if(n.value===void 0)return new Hs(this,{kind:"constant",value:void 0},a);if(n.expression.kind==="constant"){const x=n.expression.evaluate(a,null,{},d,y),w=n.property.specification.type==="resolvedImage"&&typeof x!="string"?x.name:x,b=this._calculate(w,w,w,a);return new Hs(this,{kind:"constant",value:b},a)}if(n.expression.kind==="camera"){const x=this._calculate(n.expression.evaluate({zoom:a.zoom-1}),n.expression.evaluate({zoom:a.zoom}),n.expression.evaluate({zoom:a.zoom+1}),a);return new Hs(this,{kind:"constant",value:x},a)}return new Hs(this,n.expression,a)}evaluate(n,a,d,y,x,w){if(n.kind==="source"){const b=n.evaluate(a,d,y,x,w);return this._calculate(b,b,b,a)}return n.kind==="composite"?this._calculate(n.evaluate({zoom:Math.floor(a.zoom)-1},d,y),n.evaluate({zoom:Math.floor(a.zoom)},d,y),n.evaluate({zoom:Math.floor(a.zoom)+1},d,y),a):n.value}_calculate(n,a,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:d,to:a}}interpolate(n){return n}}class Ic{constructor(n){this.specification=n}possiblyEvaluate(n,a,d,y){if(n.value!==void 0){if(n.expression.kind==="constant"){const x=n.expression.evaluate(a,null,{},d,y);return this._calculate(x,x,x,a)}return this._calculate(n.expression.evaluate(new Vr(Math.floor(a.zoom-1),a)),n.expression.evaluate(new Vr(Math.floor(a.zoom),a)),n.expression.evaluate(new Vr(Math.floor(a.zoom+1),a)),a)}}_calculate(n,a,d,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:n,to:a}:{from:d,to:a}}interpolate(n){return n}}class Od{constructor(n){this.specification=n}possiblyEvaluate(n,a,d,y){return!!n.expression.evaluate(a,null,{},d,y)}interpolate(){return!1}}class v{constructor(n){this.properties=n,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const a in n){const d=n[a];d.specification.overridable&&this.overridableProperties.push(a);const y=this.defaultPropertyValues[a]=new il(d,void 0),x=this.defaultTransitionablePropertyValues[a]=new Tc(d);this.defaultTransitioningPropertyValues[a]=x.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=y.possiblyEvaluate({})}}}St("DataDrivenProperty",jt),St("DataConstantProperty",It),St("CrossFadedDataDrivenProperty",Cc),St("CrossFadedProperty",Ic),St("ColorRampProperty",Od);const r="-transition";class u extends je{constructor(n,a){if(super(),this.id=n.id,this.type=n.type,this._featureFilter={filter:()=>!0,needGeometry:!1},n.type!=="custom"&&(this.metadata=n.metadata,this.minzoom=n.minzoom,this.maxzoom=n.maxzoom,n.type!=="background"&&(this.source=n.source,this.sourceLayer=n["source-layer"],this.filter=n.filter),a.layout&&(this._unevaluatedLayout=new uu(a.layout)),a.paint)){this._transitionablePaint=new Ec(a.paint);for(const d in n.paint)this.setPaintProperty(d,n.paint[d],{validate:!1});for(const d in n.layout)this.setLayoutProperty(d,n.layout[d],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new cu(a.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(n){return n==="visibility"?this.visibility:this._unevaluatedLayout.getValue(n)}setLayoutProperty(n,a,d={}){a!=null&&this._validate(im,`layers.${this.id}.layout.${n}`,n,a,d)||(n!=="visibility"?this._unevaluatedLayout.setValue(n,a):this.visibility=a)}getPaintProperty(n){return n.endsWith(r)?this._transitionablePaint.getTransition(n.slice(0,-11)):this._transitionablePaint.getValue(n)}setPaintProperty(n,a,d={}){if(a!=null&&this._validate(nm,`layers.${this.id}.paint.${n}`,n,a,d))return!1;if(n.endsWith(r))return this._transitionablePaint.setTransition(n.slice(0,-11),a||void 0),!1;{const y=this._transitionablePaint._values[n],x=y.property.specification["property-type"]==="cross-faded-data-driven",w=y.value.isDataDriven(),b=y.value;this._transitionablePaint.setValue(n,a),this._handleSpecialPaintPropertyUpdate(n);const k=this._transitionablePaint._values[n].value;return k.isDataDriven()||w||x||this._handleOverridablePaintPropertyUpdate(n,b,k)}}_handleSpecialPaintPropertyUpdate(n){}_handleOverridablePaintPropertyUpdate(n,a,d){return!1}isHidden(n){return!!(this.minzoom&&n=this.maxzoom)||this.visibility==="none"}updateTransitions(n){this._transitioningPaint=this._transitionablePaint.transitioned(n,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(n,a){n.getCrossfadeParameters&&(this._crossfadeParameters=n.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(n,void 0,a)),this.paint=this._transitioningPaint.possiblyEvaluate(n,void 0,a)}serialize(){const n={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&&(n.layout=n.layout||{},n.layout.visibility=this.visibility),We(n,(a,d)=>!(a===void 0||d==="layout"&&!Object.keys(a).length||d==="paint"&&!Object.keys(a).length))}_validate(n,a,d,y,x={}){return(!x||x.validate!==!1)&&Pd(this,n.call(la,{key:a,layerType:this.type,objectKey:d,value:y,styleSpec:ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const n in this.paint._values){const a=this.paint.get(n);if(a instanceof Hs&&Ga(a.property.specification)&&(a.value.kind==="source"||a.value.kind==="composite")&&a.value.isStateDependent)return!0}return!1}}const p={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class m{constructor(n,a){this._structArray=n,this._pos1=a*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class _{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(n,a){return n._trim(),a&&(n.isTransferred=!0,a.push(n.arrayBuffer)),{length:n.length,arrayBuffer:n.arrayBuffer}}static deserialize(n){const a=Object.create(this.prototype);return a.arrayBuffer=n.arrayBuffer,a.length=n.length,a.capacity=n.arrayBuffer.byteLength/a.bytesPerElement,a._refreshViews(),a}_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(n){this.reserve(n),this.length=n}reserve(n){if(n>this.capacity){this.capacity=Math.max(n,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const a=this.uint8;this._refreshViews(),a&&this.uint8.set(a)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function S(s,n=1){let a=0,d=0;return{members:s.map(y=>{const x=p[y.type].BYTES_PER_ELEMENT,w=a=E(a,Math.max(n,x)),b=y.components||1;return d=Math.max(d,x),a+=x*b,{name:y.name,type:y.type,components:b,offset:w}}),size:E(a,Math.max(d,n)),alignment:n}}function E(s,n){return Math.ceil(s/n)*n}class C extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.int16[y+0]=a,this.int16[y+1]=d,n}}C.prototype.bytesPerElement=4,St("StructArrayLayout2i4",C);class z extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.int16[x+0]=a,this.int16[x+1]=d,this.int16[x+2]=y,n}}z.prototype.bytesPerElement=6,St("StructArrayLayout3i6",z);class F extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y){const x=this.length;return this.resize(x+1),this.emplace(x,n,a,d,y)}emplace(n,a,d,y,x){const w=4*n;return this.int16[w+0]=a,this.int16[w+1]=d,this.int16[w+2]=y,this.int16[w+3]=x,n}}F.prototype.bytesPerElement=8,St("StructArrayLayout4i8",F);class B extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=6*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.int16[k+2]=y,this.int16[k+3]=x,this.int16[k+4]=w,this.int16[k+5]=b,n}}B.prototype.bytesPerElement=12,St("StructArrayLayout2i4i12",B);class X extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=4*n,I=8*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.uint8[I+4]=y,this.uint8[I+5]=x,this.uint8[I+6]=w,this.uint8[I+7]=b,n}}X.prototype.bytesPerElement=8,St("StructArrayLayout2i4ub8",X);class Q extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.float32[y+0]=a,this.float32[y+1]=d,n}}Q.prototype.bytesPerElement=8,St("StructArrayLayout2f8",Q);class re extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w,b,k,I,D){const L=this.length;return this.resize(L+1),this.emplace(L,n,a,d,y,x,w,b,k,I,D)}emplace(n,a,d,y,x,w,b,k,I,D,L){const U=10*n;return this.uint16[U+0]=a,this.uint16[U+1]=d,this.uint16[U+2]=y,this.uint16[U+3]=x,this.uint16[U+4]=w,this.uint16[U+5]=b,this.uint16[U+6]=k,this.uint16[U+7]=I,this.uint16[U+8]=D,this.uint16[U+9]=L,n}}re.prototype.bytesPerElement=20,St("StructArrayLayout10ui20",re);class ce extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w,b,k,I,D,L,U){const Z=this.length;return this.resize(Z+1),this.emplace(Z,n,a,d,y,x,w,b,k,I,D,L,U)}emplace(n,a,d,y,x,w,b,k,I,D,L,U,Z){const K=12*n;return this.int16[K+0]=a,this.int16[K+1]=d,this.int16[K+2]=y,this.int16[K+3]=x,this.uint16[K+4]=w,this.uint16[K+5]=b,this.uint16[K+6]=k,this.uint16[K+7]=I,this.int16[K+8]=D,this.int16[K+9]=L,this.int16[K+10]=U,this.int16[K+11]=Z,n}}ce.prototype.bytesPerElement=24,St("StructArrayLayout4i4ui4i24",ce);class pe extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.float32[x+0]=a,this.float32[x+1]=d,this.float32[x+2]=y,n}}pe.prototype.bytesPerElement=12,St("StructArrayLayout3f12",pe);class me extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint32[1*n+0]=a,n}}me.prototype.bytesPerElement=4,St("StructArrayLayout1ul4",me);class we extends _{_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(n,a,d,y,x,w,b,k,I){const D=this.length;return this.resize(D+1),this.emplace(D,n,a,d,y,x,w,b,k,I)}emplace(n,a,d,y,x,w,b,k,I,D){const L=10*n,U=5*n;return this.int16[L+0]=a,this.int16[L+1]=d,this.int16[L+2]=y,this.int16[L+3]=x,this.int16[L+4]=w,this.int16[L+5]=b,this.uint32[U+3]=k,this.uint16[L+8]=I,this.uint16[L+9]=D,n}}we.prototype.bytesPerElement=20,St("StructArrayLayout6i1ul2ui20",we);class ae extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=6*n;return this.int16[k+0]=a,this.int16[k+1]=d,this.int16[k+2]=y,this.int16[k+3]=x,this.int16[k+4]=w,this.int16[k+5]=b,n}}ae.prototype.bytesPerElement=12,St("StructArrayLayout2i2i2i12",ae);class Ce extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x){const w=this.length;return this.resize(w+1),this.emplace(w,n,a,d,y,x)}emplace(n,a,d,y,x,w){const b=4*n,k=8*n;return this.float32[b+0]=a,this.float32[b+1]=d,this.float32[b+2]=y,this.int16[k+6]=x,this.int16[k+7]=w,n}}Ce.prototype.bytesPerElement=16,St("StructArrayLayout2f1f2i16",Ce);class Pe extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(n,a,d,y,x,w){const b=this.length;return this.resize(b+1),this.emplace(b,n,a,d,y,x,w)}emplace(n,a,d,y,x,w,b){const k=16*n,I=4*n,D=8*n;return this.uint8[k+0]=a,this.uint8[k+1]=d,this.float32[I+1]=y,this.float32[I+2]=x,this.int16[D+6]=w,this.int16[D+7]=b,n}}Pe.prototype.bytesPerElement=16,St("StructArrayLayout2ub2f2i16",Pe);class ze extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.uint16[x+0]=a,this.uint16[x+1]=d,this.uint16[x+2]=y,n}}ze.prototype.bytesPerElement=6,St("StructArrayLayout3ui6",ze);class Ye extends _{_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(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe){const De=this.length;return this.resize(De+1),this.emplace(De,n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe)}emplace(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De){const be=24*n,Me=12*n,Ve=48*n;return this.int16[be+0]=a,this.int16[be+1]=d,this.uint16[be+2]=y,this.uint16[be+3]=x,this.uint32[Me+2]=w,this.uint32[Me+3]=b,this.uint32[Me+4]=k,this.uint16[be+10]=I,this.uint16[be+11]=D,this.uint16[be+12]=L,this.float32[Me+7]=U,this.float32[Me+8]=Z,this.uint8[Ve+36]=K,this.uint8[Ve+37]=J,this.uint8[Ve+38]=le,this.uint32[Me+10]=fe,this.int16[be+22]=De,n}}Ye.prototype.bytesPerElement=48,St("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ye);class st extends _{_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(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt){const bt=this.length;return this.resize(bt+1),this.emplace(bt,n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt)}emplace(n,a,d,y,x,w,b,k,I,D,L,U,Z,K,J,le,fe,De,be,Me,Ve,et,xt,Nt,yt,pt,At,Tt,bt){const qe=32*n,Dt=16*n;return this.int16[qe+0]=a,this.int16[qe+1]=d,this.int16[qe+2]=y,this.int16[qe+3]=x,this.int16[qe+4]=w,this.int16[qe+5]=b,this.int16[qe+6]=k,this.int16[qe+7]=I,this.uint16[qe+8]=D,this.uint16[qe+9]=L,this.uint16[qe+10]=U,this.uint16[qe+11]=Z,this.uint16[qe+12]=K,this.uint16[qe+13]=J,this.uint16[qe+14]=le,this.uint16[qe+15]=fe,this.uint16[qe+16]=De,this.uint16[qe+17]=be,this.uint16[qe+18]=Me,this.uint16[qe+19]=Ve,this.uint16[qe+20]=et,this.uint16[qe+21]=xt,this.uint16[qe+22]=Nt,this.uint32[Dt+12]=yt,this.float32[Dt+13]=pt,this.float32[Dt+14]=At,this.uint16[qe+30]=Tt,this.uint16[qe+31]=bt,n}}st.prototype.bytesPerElement=64,St("StructArrayLayout8i15ui1ul2f2ui64",st);class gt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.float32[1*n+0]=a,n}}gt.prototype.bytesPerElement=4,St("StructArrayLayout1f4",gt);class wt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=3*n;return this.uint16[6*n+0]=a,this.float32[x+1]=d,this.float32[x+2]=y,n}}wt.prototype.bytesPerElement=12,St("StructArrayLayout1ui2f12",wt);class dt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a,d){const y=this.length;return this.resize(y+1),this.emplace(y,n,a,d)}emplace(n,a,d,y){const x=4*n;return this.uint32[2*n+0]=a,this.uint16[x+2]=d,this.uint16[x+3]=y,n}}dt.prototype.bytesPerElement=8,St("StructArrayLayout1ul2ui8",dt);class ct extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n,a){const d=this.length;return this.resize(d+1),this.emplace(d,n,a)}emplace(n,a,d){const y=2*n;return this.uint16[y+0]=a,this.uint16[y+1]=d,n}}ct.prototype.bytesPerElement=4,St("StructArrayLayout2ui4",ct);class Pt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(n){const a=this.length;return this.resize(a+1),this.emplace(a,n)}emplace(n,a){return this.uint16[1*n+0]=a,n}}Pt.prototype.bytesPerElement=2,St("StructArrayLayout1ui2",Pt);class qt extends _{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(n,a,d,y){const x=this.length;return this.resize(x+1),this.emplace(x,n,a,d,y)}emplace(n,a,d,y,x){const w=4*n;return this.float32[w+0]=a,this.float32[w+1]=d,this.float32[w+2]=y,this.float32[w+3]=x,n}}qt.prototype.bytesPerElement=16,St("StructArrayLayout4f16",qt);class ft extends m{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)}}ft.prototype.size=20;class _t extends we{get(n){return new ft(this,n)}}St("CollisionBoxArray",_t);class Gt extends m{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(n){this._structArray.uint8[this._pos1+37]=n}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(n){this._structArray.uint8[this._pos1+38]=n}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(n){this._structArray.uint32[this._pos4+10]=n}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Gt.prototype.size=48;class Hr extends Ye{get(n){return new Gt(this,n)}}St("PlacedSymbolArray",Hr);class tr extends m{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(n){this._structArray.uint32[this._pos4+12]=n}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}tr.prototype.size=64;class ar extends st{get(n){return new tr(this,n)}}St("SymbolInstanceArray",ar);class Wr extends gt{getoffsetX(n){return this.float32[1*n+0]}}St("GlyphOffsetArray",Wr);class Gn extends z{getx(n){return this.int16[3*n+0]}gety(n){return this.int16[3*n+1]}gettileUnitDistanceFromAnchor(n){return this.int16[3*n+2]}}St("SymbolLineVertexArray",Gn);class xs extends m{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}xs.prototype.size=12;class Gr extends wt{get(n){return new xs(this,n)}}St("TextAnchorOffsetArray",Gr);class _i extends m{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]}}_i.prototype.size=8;class ii extends dt{get(n){return new _i(this,n)}}St("FeatureIndexArray",ii);class Zn extends C{}class si extends C{}class Ws extends C{}class sl extends B{}class Pc extends X{}class ol extends Q{}class es extends re{}class Mc extends ce{}class Fd extends pe{}class ts extends me{}class rs extends ae{}class Ao extends Pe{}class ws extends ze{}class Nn extends ct{}const qn=S([{name:"a_pos",components:2,type:"Int16"}],4),{members:Li}=qn;class cr{constructor(n=[]){this.segments=n}prepareSegment(n,a,d,y){let x=this.segments[this.segments.length-1];return n>cr.MAX_VERTEX_ARRAY_LENGTH&&Ue(`Max vertices per segment is ${cr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${n}`),(!x||x.vertexLength+n>cr.MAX_VERTEX_ARRAY_LENGTH||x.sortKey!==y)&&(x={vertexOffset:a.length,primitiveOffset:d.length,vertexLength:0,primitiveLength:0},y!==void 0&&(x.sortKey=y),this.segments.push(x)),x}get(){return this.segments}destroy(){for(const n of this.segments)for(const a in n.vaos)n.vaos[a].destroy()}static simpleSegment(n,a,d,y){return new cr([{vertexOffset:n,primitiveOffset:a,vertexLength:d,primitiveLength:y,vaos:{},sortKey:0}])}}function ua(s,n){return 256*(s=oe(Math.floor(s),0,255))+oe(Math.floor(n),0,255)}cr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,St("SegmentVector",cr);const al=S([{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 ll={exports:{}},um={exports:{}};um.exports=function(s,n){var a,d,y,x,w,b,k,I;for(d=s.length-(a=3&s.length),y=n,w=3432918353,b=461845907,I=0;I>>16)*w&65535)<<16)&4294967295)<<15|k>>>17))*b+(((k>>>16)*b&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(x>>>16)&65535)<<16);switch(k=0,a){case 3:k^=(255&s.charCodeAt(I+2))<<16;case 2:k^=(255&s.charCodeAt(I+1))<<8;case 1:y^=k=(65535&(k=(k=(65535&(k^=255&s.charCodeAt(I)))*w+(((k>>>16)*w&65535)<<16)&4294967295)<<15|k>>>17))*b+(((k>>>16)*b&65535)<<16)&4294967295}return y^=s.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var t0=um.exports,cm={exports:{}};cm.exports=function(s,n){for(var a,d=s.length,y=n^d,x=0;d>=4;)a=1540483477*(65535&(a=255&s.charCodeAt(x)|(255&s.charCodeAt(++x))<<8|(255&s.charCodeAt(++x))<<16|(255&s.charCodeAt(++x))<<24))+((1540483477*(a>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),d-=4,++x;switch(d){case 3:y^=(255&s.charCodeAt(x+2))<<16;case 2:y^=(255&s.charCodeAt(x+1))<<8;case 1:y=1540483477*(65535&(y^=255&s.charCodeAt(x)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var Do=t0,hm=cm.exports;ll.exports=Do,ll.exports.murmur3=Do,ll.exports.murmur2=hm;var Ac=T(ll.exports);class hu{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(n,a,d,y){this.ids.push(Dc(n)),this.positions.push(a,d,y)}getPositions(n){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const a=Dc(n);let d=0,y=this.ids.length-1;for(;d>1;this.ids[w]>=a?y=w:d=w+1}const x=[];for(;this.ids[d]===a;)x.push({index:this.positions[3*d],start:this.positions[3*d+1],end:this.positions[3*d+2]}),d++;return x}static serialize(n,a){const d=new Float64Array(n.ids),y=new Uint32Array(n.positions);return zc(d,y,0,d.length-1),a&&a.push(d.buffer,y.buffer),{ids:d,positions:y}}static deserialize(n){const a=new hu;return a.ids=n.ids,a.positions=n.positions,a.indexed=!0,a}}function Dc(s){const n=+s;return!isNaN(n)&&n<=Number.MAX_SAFE_INTEGER?n:Ac(String(s))}function zc(s,n,a,d){for(;a>1];let x=a-1,w=d+1;for(;;){do x++;while(s[x]y);if(x>=w)break;ul(s,x,w),ul(n,3*x,3*w),ul(n,3*x+1,3*w+1),ul(n,3*x+2,3*w+2)}w-a`u_${y}`),this.type=d}setUniform(n,a,d){n.set(d.constantOr(this.value))}getBinding(n,a,d){return this.type==="color"?new _b(n,a):new dm(n,a)}}class Rc{constructor(n,a){this.uniformNames=a.map(d=>`u_${d}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(n,a){this.pixelRatioFrom=a.pixelRatio,this.pixelRatioTo=n.pixelRatio,this.patternFrom=a.tlbr,this.patternTo=n.tlbr}setUniform(n,a,d,y){const x=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;x&&n.set(x)}getBinding(n,a,d){return d.substr(0,9)==="u_pattern"?new yb(n,a):new dm(n,a)}}class ca{constructor(n,a,d,y){this.expression=n,this.type=d,this.maxValue=0,this.paintVertexAttributes=a.map(x=>({name:`a_${x}`,type:"Float32",components:d==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(n,a,d,y,x){const w=this.paintVertexArray.length,b=this.expression.evaluate(new Vr(0),a,{},y,[],x);this.paintVertexArray.resize(n),this._setPaintValue(w,n,b)}updatePaintArray(n,a,d,y){const x=this.expression.evaluate({zoom:0},d,y);this._setPaintValue(n,a,x)}_setPaintValue(n,a,d){if(this.type==="color"){const y=r0(d);for(let x=n;x`u_${b}_t`),this.type=d,this.useIntegerZoom=y,this.zoom=x,this.maxValue=0,this.paintVertexAttributes=a.map(b=>({name:`a_${b}`,type:"Float32",components:d==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(n,a,d,y,x){const w=this.expression.evaluate(new Vr(this.zoom),a,{},y,[],x),b=this.expression.evaluate(new Vr(this.zoom+1),a,{},y,[],x),k=this.paintVertexArray.length;this.paintVertexArray.resize(n),this._setPaintValue(k,n,w,b)}updatePaintArray(n,a,d,y){const x=this.expression.evaluate({zoom:this.zoom},d,y),w=this.expression.evaluate({zoom:this.zoom+1},d,y);this._setPaintValue(n,a,x,w)}_setPaintValue(n,a,d,y){if(this.type==="color"){const x=r0(d),w=r0(y);for(let b=n;b`#define HAS_UNIFORM_${y}`))}return n}getBinderAttributes(){const n=[];for(const a in this.binders){const d=this.binders[a];if(d instanceof ca||d instanceof uo)for(let y=0;y!0){this.programConfigurations={};for(const y of n)this.programConfigurations[y.id]=new vb(y,a,d);this.needsUpload=!1,this._featureMap=new hu,this._bufferOffset=0}populatePaintArrays(n,a,d,y,x,w){for(const b in this.programConfigurations)this.programConfigurations[b].populatePaintArrays(n,a,y,x,w);a.id!==void 0&&this._featureMap.add(a.id,d,this._bufferOffset,n),this._bufferOffset=n,this.needsUpload=!0}updatePaintArrays(n,a,d,y){for(const x of d)this.needsUpload=this.programConfigurations[x.id].updatePaintArrays(n,this._featureMap,a,x,y)||this.needsUpload}get(n){return this.programConfigurations[n]}upload(n){if(this.needsUpload){for(const a in this.programConfigurations)this.programConfigurations[a].upload(n);this.needsUpload=!1}}destroy(){for(const n in this.programConfigurations)this.programConfigurations[n].destroy()}}function SA(s,n){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"]}[s]||[s.replace(`${n}-`,"").replace(/-/g,"_")]}function xb(s,n,a){const d={color:{source:Q,composite:qt},number:{source:gt,composite:Q}},y=function(x){return{"line-pattern":{source:es,composite:es},"fill-pattern":{source:es,composite:es},"fill-extrusion-pattern":{source:es,composite:es}}[x]}(s);return y&&y[a]||d[n][a]}St("ConstantBinder",Bd),St("CrossFadedConstantBinder",Rc),St("SourceExpressionBinder",ca),St("CrossFadedCompositeBinder",cl),St("CompositeExpressionBinder",uo),St("ProgramConfiguration",vb,{omit:["_buffers"]}),St("ProgramConfigurationSet",fu);const Cn=8192,n0=Math.pow(2,14)-1,wb=-n0-1;function pu(s){const n=Cn/s.extent,a=s.loadGeometry();for(let d=0;dw.x+1||kw.y+1)&&Ue("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return a}function mu(s,n){return{type:s.type,id:s.id,properties:s.properties,geometry:n?pu(s):[]}}function fm(s,n,a,d,y){s.emplaceBack(2*n+(d+1)/2,2*a+(y+1)/2)}class i0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new si,this.indexArray=new ws,this.segments=new cr,this.programConfigurations=new fu(n.layers,n.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){const y=this.layers[0],x=[];let w=null,b=!1;y.type==="circle"&&(w=y.layout.get("circle-sort-key"),b=!w.isConstant());for(const{feature:k,id:I,index:D,sourceLayerIndex:L}of n){const U=this.layers[0]._featureFilter.needGeometry,Z=mu(k,U);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),Z,d))continue;const K=b?w.evaluate(Z,{},d):void 0,J={id:I,properties:k.properties,type:k.type,sourceLayerIndex:L,index:D,geometry:U?Z.geometry:pu(k),patterns:{},sortKey:K};x.push(J)}b&&x.sort((k,I)=>k.sortKey-I.sortKey);for(const k of x){const{geometry:I,index:D,sourceLayerIndex:L}=k,U=n[D].feature;this.addFeature(k,I,D,d),a.featureIndex.insert(U,I,D,L,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,Li),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(n,a,d,y){for(const x of a)for(const w of x){const b=w.x,k=w.y;if(b<0||b>=Cn||k<0||k>=Cn)continue;const I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,n.sortKey),D=I.vertexLength;fm(this.layoutVertexArray,b,k,-1,-1),fm(this.layoutVertexArray,b,k,1,-1),fm(this.layoutVertexArray,b,k,1,1),fm(this.layoutVertexArray,b,k,-1,1),this.indexArray.emplaceBack(D,D+1,D+2),this.indexArray.emplaceBack(D,D+3,D+2),I.vertexLength+=4,I.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,{},y)}}function bb(s,n){for(let a=0;a1){if(s0(s,n))return!0;for(let d=0;d1?a:a.sub(n)._mult(y)._add(n))}function Tb(s,n){let a,d,y,x=!1;for(let w=0;wn.y!=y.y>n.y&&n.x<(y.x-d.x)*(n.y-d.y)/(y.y-d.y)+d.x&&(x=!x)}return x}function Lc(s,n){let a=!1;for(let d=0,y=s.length-1;dn.y!=w.y>n.y&&n.x<(w.x-x.x)*(n.y-x.y)/(w.y-x.y)+x.x&&(a=!a)}return a}function CA(s,n,a){const d=a[0],y=a[2];if(s.xy.x&&n.x>y.x||s.yy.y&&n.y>y.y)return!1;const x=H(s,n,a[0]);return x!==H(s,n,a[1])||x!==H(s,n,a[2])||x!==H(s,n,a[3])}function Nd(s,n,a){const d=n.paint.get(s).value;return d.kind==="constant"?d.value:a.programConfigurations.get(n.id).getMaxValue(s)}function pm(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function mm(s,n,a,d,y){if(!n[0]&&!n[1])return s;const x=A.convert(n)._mult(y);a==="viewport"&&x._rotate(-d);const w=[];for(let b=0;bPb(le,J))}(I,k),Z=L?D*b:D;for(const K of y)for(const J of K){const le=L?J:Pb(J,k);let fe=Z;const De=gm([],[J.x,J.y,0,1],k);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?fe*=De[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(fe*=w.cameraToCenterDistance/De[3]),kA(U,le,fe))return!0}return!1}}function Pb(s,n){const a=gm([],[s.x,s.y,0,1],n);return new A(a[0]/a[3],a[1]/a[3])}class Mb extends i0{}let Ab;St("HeatmapBucket",Mb,{omit:["layers"]});var AA={get paint(){return Ab=Ab||new v({"heatmap-radius":new jt(ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new jt(ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new It(ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Od(ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new It(ie.paint_heatmap["heatmap-opacity"])})}};function l0(s,{width:n,height:a},d,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==n*a*d)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${n*a*d}`)}else y=new Uint8Array(n*a*d);return s.width=n,s.height=a,s.data=y,s}function Db(s,{width:n,height:a},d){if(n===s.width&&a===s.height)return;const y=l0({},{width:n,height:a},d);u0(s,y,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,n),height:Math.min(s.height,a)},d),s.width=n,s.height=a,s.data=y.data}function u0(s,n,a,d,y,x){if(y.width===0||y.height===0)return n;if(y.width>s.width||y.height>s.height||a.x>s.width-y.width||a.y>s.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>n.width||y.height>n.height||d.x>n.width-y.width||d.y>n.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const w=s.data,b=n.data;if(w===b)throw new Error("srcData equals dstData, so image is already copied");for(let k=0;k{n[s.evaluationKey]=k;const I=s.expression.evaluate(n);y.data[w+b+0]=Math.floor(255*I.r/I.a),y.data[w+b+1]=Math.floor(255*I.g/I.a),y.data[w+b+2]=Math.floor(255*I.b/I.a),y.data[w+b+3]=Math.floor(255*I.a)};if(s.clips)for(let w=0,b=0;w80*a){b=1/0,k=1/0;let D=-1/0,L=-1/0;for(let U=a;UD&&(D=Z),K>L&&(L=K)}I=Math.max(D-b,L-k),I=I!==0?32767/I:0}return jd(x,w,a,b,k,I,0),w}function Ob(s,n,a,d,y){let x;if(y===function(w,b,k,I){let D=0;for(let L=b,U=k-I;L0)for(let w=n;w=n;w-=d)x=Nb(w/d|0,s[w],s[w+1],x);return x&&ym(x,x.next)&&(Hd(x),x=x.next),x}function gu(s,n){if(!s)return s;n||(n=s);let a,d=s;do if(a=!1,d.steiner||!ym(d,d.next)&&wn(d.prev,d,d.next)!==0)d=d.next;else{if(Hd(d),d=n=d.prev,d===d.next)break;a=!0}while(a||d!==n);return n}function jd(s,n,a,d,y,x,w){if(!s)return;!w&&x&&function(k,I,D,L){let U=k;do U.z===0&&(U.z=h0(U.x,U.y,I,D,L)),U.prevZ=U.prev,U.nextZ=U.next,U=U.next;while(U!==k);U.prevZ.nextZ=null,U.prevZ=null,function(Z){let K,J=1;do{let le,fe=Z;Z=null;let De=null;for(K=0;fe;){K++;let be=fe,Me=0;for(let et=0;et0||Ve>0&&be;)Me!==0&&(Ve===0||!be||fe.z<=be.z)?(le=fe,fe=fe.nextZ,Me--):(le=be,be=be.nextZ,Ve--),De?De.nextZ=le:Z=le,le.prevZ=De,De=le;fe=be}De.nextZ=null,J*=2}while(K>1)}(U)}(s,d,y,x);let b=s;for(;s.prev!==s.next;){const k=s.prev,I=s.next;if(x?BA(s,d,y,x):FA(s))n.push(k.i,s.i,I.i),Hd(s),s=I.next,b=I.next;else if((s=I)===b){w?w===1?jd(s=NA(gu(s),n),n,a,d,y,x,2):w===2&&$A(s,n,a,d,y,x):jd(gu(s),n,a,d,y,x,1);break}}}function FA(s){const n=s.prev,a=s,d=s.next;if(wn(n,a,d)>=0)return!1;const y=n.x,x=a.x,w=d.x,b=n.y,k=a.y,I=d.y,D=yx?y>w?y:w:x>w?x:w,Z=b>k?b>I?b:I:k>I?k:I;let K=d.next;for(;K!==n;){if(K.x>=D&&K.x<=U&&K.y>=L&&K.y<=Z&&Fc(y,b,x,k,w,I,K.x,K.y)&&wn(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function BA(s,n,a,d){const y=s.prev,x=s,w=s.next;if(wn(y,x,w)>=0)return!1;const b=y.x,k=x.x,I=w.x,D=y.y,L=x.y,U=w.y,Z=bk?b>I?b:I:k>I?k:I,le=D>L?D>U?D:U:L>U?L:U,fe=h0(Z,K,n,a,d),De=h0(J,le,n,a,d);let be=s.prevZ,Me=s.nextZ;for(;be&&be.z>=fe&&Me&&Me.z<=De;){if(be.x>=Z&&be.x<=J&&be.y>=K&&be.y<=le&&be!==y&&be!==w&&Fc(b,D,k,L,I,U,be.x,be.y)&&wn(be.prev,be,be.next)>=0||(be=be.prevZ,Me.x>=Z&&Me.x<=J&&Me.y>=K&&Me.y<=le&&Me!==y&&Me!==w&&Fc(b,D,k,L,I,U,Me.x,Me.y)&&wn(Me.prev,Me,Me.next)>=0))return!1;Me=Me.nextZ}for(;be&&be.z>=fe;){if(be.x>=Z&&be.x<=J&&be.y>=K&&be.y<=le&&be!==y&&be!==w&&Fc(b,D,k,L,I,U,be.x,be.y)&&wn(be.prev,be,be.next)>=0)return!1;be=be.prevZ}for(;Me&&Me.z<=De;){if(Me.x>=Z&&Me.x<=J&&Me.y>=K&&Me.y<=le&&Me!==y&&Me!==w&&Fc(b,D,k,L,I,U,Me.x,Me.y)&&wn(Me.prev,Me,Me.next)>=0)return!1;Me=Me.nextZ}return!0}function NA(s,n){let a=s;do{const d=a.prev,y=a.next.next;!ym(d,y)&&Fb(d,a,a.next,y)&&Vd(d,y)&&Vd(y,d)&&(n.push(d.i,a.i,y.i),Hd(a),Hd(a.next),a=s=y),a=a.next}while(a!==s);return gu(a)}function $A(s,n,a,d,y,x){let w=s;do{let b=w.next.next;for(;b!==w.prev;){if(w.i!==b.i&&WA(w,b)){let k=Bb(w,b);return w=gu(w,w.next),k=gu(k,k.next),jd(w,n,a,d,y,x,0),void jd(k,n,a,d,y,x,0)}b=b.next}w=w.next}while(w!==s)}function UA(s,n){return s.x-n.x}function jA(s,n){const a=function(y,x){let w=x;const b=y.x,k=y.y;let I,D=-1/0;do{if(k<=w.y&&k>=w.next.y&&w.next.y!==w.y){const J=w.x+(k-w.y)*(w.next.x-w.x)/(w.next.y-w.y);if(J<=b&&J>D&&(D=J,I=w.x=w.x&&w.x>=U&&b!==w.x&&Fc(kI.x||w.x===I.x&&VA(I,w)))&&(I=w,K=J)}w=w.next}while(w!==L);return I}(s,n);if(!a)return n;const d=Bb(a,s);return gu(d,d.next),gu(a,a.next)}function VA(s,n){return wn(s.prev,s,n.prev)<0&&wn(n.next,s,s.next)<0}function h0(s,n,a,d,y){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-a)*y|0)|s<<8))|s<<4))|s<<2))|s<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-d)*y|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function HA(s){let n=s,a=s;do(n.x=(s-w)*(x-b)&&(s-w)*(d-b)>=(a-w)*(n-b)&&(a-w)*(x-b)>=(y-w)*(d-b)}function WA(s,n){return s.next.i!==n.i&&s.prev.i!==n.i&&!function(a,d){let y=a;do{if(y.i!==a.i&&y.next.i!==a.i&&y.i!==d.i&&y.next.i!==d.i&&Fb(y,y.next,a,d))return!0;y=y.next}while(y!==a);return!1}(s,n)&&(Vd(s,n)&&Vd(n,s)&&function(a,d){let y=a,x=!1;const w=(a.x+d.x)/2,b=(a.y+d.y)/2;do y.y>b!=y.next.y>b&&y.next.y!==y.y&&w<(y.next.x-y.x)*(b-y.y)/(y.next.y-y.y)+y.x&&(x=!x),y=y.next;while(y!==a);return x}(s,n)&&(wn(s.prev,s,n.prev)||wn(s,n.prev,n))||ym(s,n)&&wn(s.prev,s,s.next)>0&&wn(n.prev,n,n.next)>0)}function wn(s,n,a){return(n.y-s.y)*(a.x-n.x)-(n.x-s.x)*(a.y-n.y)}function ym(s,n){return s.x===n.x&&s.y===n.y}function Fb(s,n,a,d){const y=vm(wn(s,n,a)),x=vm(wn(s,n,d)),w=vm(wn(a,d,s)),b=vm(wn(a,d,n));return y!==x&&w!==b||!(y!==0||!_m(s,a,n))||!(x!==0||!_m(s,d,n))||!(w!==0||!_m(a,s,d))||!(b!==0||!_m(a,n,d))}function _m(s,n,a){return n.x<=Math.max(s.x,a.x)&&n.x>=Math.min(s.x,a.x)&&n.y<=Math.max(s.y,a.y)&&n.y>=Math.min(s.y,a.y)}function vm(s){return s>0?1:s<0?-1:0}function Vd(s,n){return wn(s.prev,s,s.next)<0?wn(s,n,s.next)>=0&&wn(s,s.prev,n)>=0:wn(s,n,s.prev)<0||wn(s,s.next,n)<0}function Bb(s,n){const a=d0(s.i,s.x,s.y),d=d0(n.i,n.x,n.y),y=s.next,x=n.prev;return s.next=n,n.prev=s,a.next=y,y.prev=a,d.next=a,a.prev=d,x.next=d,d.prev=x,d}function Nb(s,n,a,d){const y=d0(s,n,a);return d?(y.next=d.next,y.prev=d,d.next.prev=y,d.next=y):(y.prev=y,y.next=y),y}function Hd(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function d0(s,n,a){return{i:s,x:n,y:a,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function f0(s,n,a){const d=a.patternDependencies;let y=!1;for(const x of n){const w=x.paint.get(`${s}-pattern`);w.isConstant()||(y=!0);const b=w.constantOr(null);b&&(y=!0,d[b.to]=!0,d[b.from]=!0)}return y}function p0(s,n,a,d,y){const x=y.patternDependencies;for(const w of n){const b=w.paint.get(`${s}-pattern`).value;if(b.kind!=="constant"){let k=b.evaluate({zoom:d-1},a,{},y.availableImages),I=b.evaluate({zoom:d},a,{},y.availableImages),D=b.evaluate({zoom:d+1},a,{},y.availableImages);k=k&&k.name?k.name:k,I=I&&I.name?I.name:I,D=D&&D.name?D.name:D,x[k]=!0,x[I]=!0,x[D]=!0,a.patterns[w.id]={min:k,mid:I,max:D}}}return a}class m0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ws,this.indexArray=new ws,this.indexArray2=new Nn,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.segments2=new cr,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.hasPattern=f0("fill",this.layers,a);const y=this.layers[0].layout.get("fill-sort-key"),x=!y.isConstant(),w=[];for(const{feature:b,id:k,index:I,sourceLayerIndex:D}of n){const L=this.layers[0]._featureFilter.needGeometry,U=mu(b,L);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),U,d))continue;const Z=x?y.evaluate(U,{},d,a.availableImages):void 0,K={id:k,properties:b.properties,type:b.type,sourceLayerIndex:D,index:I,geometry:L?U.geometry:pu(b),patterns:{},sortKey:Z};w.push(K)}x&&w.sort((b,k)=>b.sortKey-k.sortKey);for(const b of w){const{geometry:k,index:I,sourceLayerIndex:D}=b;if(this.hasPattern){const L=p0("fill",this.layers,b,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(b,k,I,d,{});a.featureIndex.insert(n[I].feature,k,I,D,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}addFeatures(n,a,d){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,a,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,OA),this.indexBuffer=n.createIndexBuffer(this.indexArray),this.indexBuffer2=n.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(n),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(n,a,d,y,x){for(const w of ac(a,500)){let b=0;for(const Z of w)b+=Z.length;const k=this.segments.prepareSegment(b,this.layoutVertexArray,this.indexArray),I=k.vertexLength,D=[],L=[];for(const Z of w){if(Z.length===0)continue;Z!==w[0]&&L.push(D.length/2);const K=this.segments2.prepareSegment(Z.length,this.layoutVertexArray,this.indexArray2),J=K.vertexLength;this.layoutVertexArray.emplaceBack(Z[0].x,Z[0].y),this.indexArray2.emplaceBack(J+Z.length-1,J),D.push(Z[0].x),D.push(Z[0].y);for(let le=1;le>3}if(y--,d===1||d===2)x+=s.readSVarint(),w+=s.readSVarint(),d===1&&(n&&b.push(n),n=[]),n.push(new KA(x,w));else{if(d!==7)throw new Error("unknown command "+d);n&&n.push(n[0].clone())}}return n&&b.push(n),b},Bc.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var n=s.readVarint()+s.pos,a=1,d=0,y=0,x=0,w=1/0,b=-1/0,k=1/0,I=-1/0;s.pos>3}if(d--,a===1||a===2)(y+=s.readSVarint())b&&(b=y),(x+=s.readSVarint())I&&(I=x);else if(a!==7)throw new Error("unknown command "+a)}return[w,k,b,I]},Bc.prototype.toGeoJSON=function(s,n,a){var d,y,x=this.extent*Math.pow(2,a),w=this.extent*s,b=this.extent*n,k=this.loadGeometry(),I=Bc.types[this.type];function D(Z){for(var K=0;K>3;y=w===1?d.readString():w===2?d.readFloat():w===3?d.readDouble():w===4?d.readVarint64():w===5?d.readVarint():w===6?d.readSVarint():w===7?d.readBoolean():null}return y}(a))}Hb.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var n=this._pbf.readVarint()+this._pbf.pos;return new e3(this._pbf,n,this.extent,this._keys,this._values)};var r3=Vb;function n3(s,n,a){if(s===3){var d=new r3(a,a.readVarint()+a.pos);d.length&&(n[d.name]=d)}}hl.VectorTile=function(s,n){this.layers=s.readFields(n3,{},n)},hl.VectorTileFeature=jb,hl.VectorTileLayer=Vb;const i3=hl.VectorTileFeature.types,g0=Math.pow(2,13);function Wd(s,n,a,d,y,x,w,b){s.emplaceBack(n,a,2*Math.floor(d*g0)+w,y*g0*2,x*g0*2,Math.round(b))}class y0{constructor(n){this.zoom=n.zoom,this.overscaling=n.overscaling,this.layers=n.layers,this.layerIds=this.layers.map(a=>a.id),this.index=n.index,this.hasPattern=!1,this.layoutVertexArray=new sl,this.centroidVertexArray=new Zn,this.indexArray=new ws,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.features=[],this.hasPattern=f0("fill-extrusion",this.layers,a);for(const{feature:y,id:x,index:w,sourceLayerIndex:b}of n){const k=this.layers[0]._featureFilter.needGeometry,I=mu(y,k);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),I,d))continue;const D={id:x,sourceLayerIndex:b,index:w,geometry:k?I.geometry:pu(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(p0("fill-extrusion",this.layers,D,this.zoom,a)):this.addFeature(D,D.geometry,w,d,{}),a.featureIndex.insert(y,D.geometry,w,b,this.index,!0)}}addFeatures(n,a,d){for(const y of this.features){const{geometry:x}=y;this.addFeature(y,x,y.index,a,d)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,XA),this.centroidVertexBuffer=n.createVertexBuffer(this.centroidVertexArray,YA.members,!0),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(n,a,d,y,x){for(const w of ac(a,500)){const b={x:0,y:0,vertexCount:0};let k=0;for(const K of w)k+=K.length;let I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const K of w){if(K.length===0||o3(K))continue;let J=0;for(let le=0;le=1){const De=K[le-1];if(!s3(fe,De)){I.vertexLength+4>cr.MAX_VERTEX_ARRAY_LENGTH&&(I=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const be=fe.sub(De)._perp()._unit(),Me=De.dist(fe);J+Me>32768&&(J=0),Wd(this.layoutVertexArray,fe.x,fe.y,be.x,be.y,0,0,J),Wd(this.layoutVertexArray,fe.x,fe.y,be.x,be.y,0,1,J),b.x+=2*fe.x,b.y+=2*fe.y,b.vertexCount+=2,J+=Me,Wd(this.layoutVertexArray,De.x,De.y,be.x,be.y,0,0,J),Wd(this.layoutVertexArray,De.x,De.y,be.x,be.y,0,1,J),b.x+=2*De.x,b.y+=2*De.y,b.vertexCount+=2;const Ve=I.vertexLength;this.indexArray.emplaceBack(Ve,Ve+2,Ve+1),this.indexArray.emplaceBack(Ve+1,Ve+2,Ve+3),I.vertexLength+=4,I.primitiveLength+=2}}}}if(I.vertexLength+k>cr.MAX_VERTEX_ARRAY_LENGTH&&(I=this.segments.prepareSegment(k,this.layoutVertexArray,this.indexArray)),i3[n.type]!=="Polygon")continue;const D=[],L=[],U=I.vertexLength;for(const K of w)if(K.length!==0){K!==w[0]&&L.push(D.length/2);for(let J=0;JCn)||s.y===n.y&&(s.y<0||s.y>Cn)}function o3(s){return s.every(n=>n.x<0)||s.every(n=>n.x>Cn)||s.every(n=>n.y<0)||s.every(n=>n.y>Cn)}let Wb;St("FillExtrusionBucket",y0,{omit:["layers","features"]});var a3={get paint(){return Wb=Wb||new v({"fill-extrusion-opacity":new It(ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new jt(ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new It(ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new It(ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Cc(ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new jt(ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new jt(ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new It(ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class l3 extends u{constructor(n){super(n,a3)}createBucket(n){return new y0(n)}queryRadius(){return pm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(n,a,d,y,x,w,b,k){const I=mm(n,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,b),D=this.paint.get("fill-extrusion-height").evaluate(a,d),L=this.paint.get("fill-extrusion-base").evaluate(a,d),U=function(K,J,le,fe){const De=[];for(const be of K){const Me=[be.x,be.y,0,1];gm(Me,Me,J),De.push(new A(Me[0]/Me[3],Me[1]/Me[3]))}return De}(I,k),Z=function(K,J,le,fe){const De=[],be=[],Me=fe[8]*J,Ve=fe[9]*J,et=fe[10]*J,xt=fe[11]*J,Nt=fe[8]*le,yt=fe[9]*le,pt=fe[10]*le,At=fe[11]*le;for(const Tt of K){const bt=[],qe=[];for(const Dt of Tt){const Mt=Dt.x,Zt=Dt.y,Fr=fe[0]*Mt+fe[4]*Zt+fe[12],Or=fe[1]*Mt+fe[5]*Zt+fe[13],zn=fe[2]*Mt+fe[6]*Zt+fe[14],Gs=fe[3]*Mt+fe[7]*Zt+fe[15],Xn=zn+et,Rn=Gs+xt,xi=Fr+Nt,wi=Or+yt,bi=zn+pt,mn=Gs+At,Ln=new A((Fr+Me)/Rn,(Or+Ve)/Rn);Ln.z=Xn/Rn,bt.push(Ln);const oi=new A(xi/mn,wi/mn);oi.z=bi/mn,qe.push(oi)}De.push(bt),be.push(qe)}return[De,be]}(y,L,D,k);return function(K,J,le){let fe=1/0;Sb(le,J)&&(fe=Gb(le,J[0]));for(let De=0;Dea.id),this.index=n.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new Pc,this.layoutVertexArray2=new ol,this.indexArray=new ws,this.programConfigurations=new fu(n.layers,n.zoom),this.segments=new cr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(n,a,d){this.hasPattern=f0("line",this.layers,a);const y=this.layers[0].layout.get("line-sort-key"),x=!y.isConstant(),w=[];for(const{feature:b,id:k,index:I,sourceLayerIndex:D}of n){const L=this.layers[0]._featureFilter.needGeometry,U=mu(b,L);if(!this.layers[0]._featureFilter.filter(new Vr(this.zoom),U,d))continue;const Z=x?y.evaluate(U,{},d):void 0,K={id:k,properties:b.properties,type:b.type,sourceLayerIndex:D,index:I,geometry:L?U.geometry:pu(b),patterns:{},sortKey:Z};w.push(K)}x&&w.sort((b,k)=>b.sortKey-k.sortKey);for(const b of w){const{geometry:k,index:I,sourceLayerIndex:D}=b;if(this.hasPattern){const L=p0("line",this.layers,b,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(b,k,I,d,{});a.featureIndex.insert(n[I].feature,k,I,D,this.index)}}update(n,a,d){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(n,a,this.stateDependentLayers,d)}addFeatures(n,a,d){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,a,d)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(n){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=n.createVertexBuffer(this.layoutVertexArray2,d3)),this.layoutVertexBuffer=n.createVertexBuffer(this.layoutVertexArray,c3),this.indexBuffer=n.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(n),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(n){if(n.properties&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(n.properties,"mapbox_clip_end"))return{start:+n.properties.mapbox_clip_start,end:+n.properties.mapbox_clip_end}}addFeature(n,a,d,y,x){const w=this.layers[0].layout,b=w.get("line-join").evaluate(n,{}),k=w.get("line-cap"),I=w.get("line-miter-limit"),D=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(n);for(const L of a)this.addLine(L,n,b,k,I,D);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,n,d,x,y)}addLine(n,a,d,y,x,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let fe=0;fe=2&&n[k-1].equals(n[k-2]);)k--;let I=0;for(;I0;if(xt&&fe>I){const At=U.dist(Z);if(At>2*D){const Tt=U.sub(U.sub(Z)._mult(D/At)._round());this.updateDistance(Z,Tt),this.addCurrentVertex(Tt,J,0,0,L),Z=Tt}}const yt=Z&&K;let pt=yt?d:b?"butt":y;if(yt&&pt==="round"&&(Vex&&(pt="bevel"),pt==="bevel"&&(Ve>2&&(pt="flipbevel"),Ve100)De=le.mult(-1);else{const At=Ve*J.add(le).mag()/J.sub(le).mag();De._perp()._mult(At*(Nt?-1:1))}this.addCurrentVertex(U,De,0,0,L),this.addCurrentVertex(U,De.mult(-1),0,0,L)}else if(pt==="bevel"||pt==="fakeround"){const At=-Math.sqrt(Ve*Ve-1),Tt=Nt?At:0,bt=Nt?0:At;if(Z&&this.addCurrentVertex(U,J,Tt,bt,L),pt==="fakeround"){const qe=Math.round(180*et/Math.PI/20);for(let Dt=1;Dt2*D){const Tt=U.add(K.sub(U)._mult(D/At)._round());this.updateDistance(U,Tt),this.addCurrentVertex(Tt,le,0,0,L),U=Tt}}}}addCurrentVertex(n,a,d,y,x,w=!1){const b=a.y*y-a.x,k=-a.y-a.x*y;this.addHalfVertex(n,a.x+a.y*d,a.y-a.x*d,w,!1,d,x),this.addHalfVertex(n,b,k,w,!0,-y,x),this.distance>Zb/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(n,a,d,y,x,w))}addHalfVertex({x:n,y:a},d,y,x,w,b,k){const I=.5*(this.lineClips?this.scaledDistance*(Zb-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((n<<1)+(x?1:0),(a<<1)+(w?1:0),Math.round(63*d)+128,Math.round(63*y)+128,1+(b===0?0:b<0?-1:1)|(63&I)<<2,I>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const D=k.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,D),k.primitiveLength++),w?this.e2=D:this.e1=D}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(n,a){this.distance+=n.dist(a),this.updateScaledDistance()}}let qb,Yb;St("LineBucket",_0,{omit:["layers","patternFeatures"]});var Xb={get paint(){return Yb=Yb||new v({"line-opacity":new jt(ie.paint_line["line-opacity"]),"line-color":new jt(ie.paint_line["line-color"]),"line-translate":new It(ie.paint_line["line-translate"]),"line-translate-anchor":new It(ie.paint_line["line-translate-anchor"]),"line-width":new jt(ie.paint_line["line-width"]),"line-gap-width":new jt(ie.paint_line["line-gap-width"]),"line-offset":new jt(ie.paint_line["line-offset"]),"line-blur":new jt(ie.paint_line["line-blur"]),"line-dasharray":new Ic(ie.paint_line["line-dasharray"]),"line-pattern":new Cc(ie.paint_line["line-pattern"]),"line-gradient":new Od(ie.paint_line["line-gradient"])})},get layout(){return qb=qb||new v({"line-cap":new It(ie.layout_line["line-cap"]),"line-join":new jt(ie.layout_line["line-join"]),"line-miter-limit":new It(ie.layout_line["line-miter-limit"]),"line-round-limit":new It(ie.layout_line["line-round-limit"]),"line-sort-key":new jt(ie.layout_line["line-sort-key"])})}};class m3 extends jt{possiblyEvaluate(n,a){return a=new Vr(Math.floor(a.zoom),{now:a.now,fadeDuration:a.fadeDuration,zoomHistory:a.zoomHistory,transition:a.transition}),super.possiblyEvaluate(n,a)}evaluate(n,a,d,y){return a=ge({},a,{zoom:Math.floor(a.zoom)}),super.evaluate(n,a,d,y)}}let xm;class g3 extends u{constructor(n){super(n,Xb),this.gradientVersion=0,xm||(xm=new m3(Xb.paint.properties["line-width"].specification),xm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(n){if(n==="line-gradient"){const a=this.gradientExpression();this.stepInterpolant=!!function(d){return d._styleExpression!==void 0}(a)&&a._styleExpression.expression instanceof $a,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(n,a){super.recalculate(n,a),this.paint._values["line-floorwidth"]=xm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,n)}createBucket(n){return new _0(n)}queryRadius(n){const a=n,d=Kb(Nd("line-width",this,a),Nd("line-gap-width",this,a)),y=Nd("line-offset",this,a);return d/2+Math.abs(y)+pm(this.paint.get("line-translate"))}queryIntersectsFeature(n,a,d,y,x,w,b){const k=mm(n,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,b),I=b/2*Kb(this.paint.get("line-width").evaluate(a,d),this.paint.get("line-gap-width").evaluate(a,d)),D=this.paint.get("line-offset").evaluate(a,d);return D&&(y=function(L,U){const Z=[];for(let K=0;K=3){for(let le=0;le0?n+2*s:s}const y3=S([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),_3=S([{name:"a_projected_pos",components:3,type:"Float32"}],4);S([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const v3=S([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);S([{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 Jb=S([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),x3=S([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function w3(s,n,a){return s.sections.forEach(d=>{d.text=function(y,x,w){const b=x.layout.get("text-transform").evaluate(w,{});return b==="uppercase"?y=y.toLocaleUpperCase():b==="lowercase"&&(y=y.toLocaleLowerCase()),Ri.applyArabicShaping&&(y=Ri.applyArabicShaping(y)),y}(d.text,n,a)}),s}S([{name:"triangle",components:3,type:"Uint16"}]),S([{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"}]),S([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),S([{type:"Float32",name:"offsetX"}]),S([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),S([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Zd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Pn=24,Qb=Lr,e2=function(s,n,a,d,y){var x,w,b=8*y-d-1,k=(1<>1,D=-7,L=y-1,U=-1,Z=s[n+L];for(L+=U,x=Z&(1<<-D)-1,Z>>=-D,D+=b;D>0;x=256*x+s[n+L],L+=U,D-=8);for(w=x&(1<<-D)-1,x>>=-D,D+=d;D>0;w=256*w+s[n+L],L+=U,D-=8);if(x===0)x=1-I;else{if(x===k)return w?NaN:1/0*(Z?-1:1);w+=Math.pow(2,d),x-=I}return(Z?-1:1)*w*Math.pow(2,x-d)},t2=function(s,n,a,d,y,x){var w,b,k,I=8*x-y-1,D=(1<>1,U=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,Z=0,K=1,J=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(b=isNaN(n)?1:0,w=D):(w=Math.floor(Math.log(n)/Math.LN2),n*(k=Math.pow(2,-w))<1&&(w--,k*=2),(n+=w+L>=1?U/k:U*Math.pow(2,1-L))*k>=2&&(w++,k/=2),w+L>=D?(b=0,w=D):w+L>=1?(b=(n*k-1)*Math.pow(2,y),w+=L):(b=n*Math.pow(2,L-1)*Math.pow(2,y),w=0));y>=8;s[a+Z]=255&b,Z+=K,b/=256,y-=8);for(w=w<0;s[a+Z]=255&w,Z+=K,w/=256,I-=8);s[a+Z-K]|=128*J};function Lr(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}Lr.Varint=0,Lr.Fixed64=1,Lr.Bytes=2,Lr.Fixed32=5;var v0=4294967296,r2=1/v0,n2=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ha(s){return s.type===Lr.Bytes?s.readVarint()+s.pos:s.pos+1}function Nc(s,n,a){return a?4294967296*n+(s>>>0):4294967296*(n>>>0)+(s>>>0)}function i2(s,n,a){var d=n<=16383?1:n<=2097151?2:n<=268435455?3:Math.floor(Math.log(n)/(7*Math.LN2));a.realloc(d);for(var y=a.pos-1;y>=s;y--)a.buf[y+d]=a.buf[y]}function b3(s,n){for(var a=0;a>>8,s[a+2]=n>>>16,s[a+3]=n>>>24}function s2(s,n){return(s[n]|s[n+1]<<8|s[n+2]<<16)+(s[n+3]<<24)}Lr.prototype={destroy:function(){this.buf=null},readFields:function(s,n,a){for(a=a||this.length;this.pos>3,x=this.pos;this.type=7&d,s(y,n,this),this.pos===x&&this.skip(d)}return n},readMessage:function(s,n){return this.readFields(s,n,this.readVarint()+this.pos)},readFixed32:function(){var s=wm(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=s2(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=wm(this.buf,this.pos)+wm(this.buf,this.pos+4)*v0;return this.pos+=8,s},readSFixed64:function(){var s=wm(this.buf,this.pos)+s2(this.buf,this.pos+4)*v0;return this.pos+=8,s},readFloat:function(){var s=e2(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=e2(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var n,a,d=this.buf;return n=127&(a=d[this.pos++]),a<128?n:(n|=(127&(a=d[this.pos++]))<<7,a<128?n:(n|=(127&(a=d[this.pos++]))<<14,a<128?n:(n|=(127&(a=d[this.pos++]))<<21,a<128?n:function(y,x,w){var b,k,I=w.buf;if(b=(112&(k=I[w.pos++]))>>4,k<128||(b|=(127&(k=I[w.pos++]))<<3,k<128)||(b|=(127&(k=I[w.pos++]))<<10,k<128)||(b|=(127&(k=I[w.pos++]))<<17,k<128)||(b|=(127&(k=I[w.pos++]))<<24,k<128)||(b|=(1&(k=I[w.pos++]))<<31,k<128))return Nc(y,b,x);throw new Error("Expected varint not more than 10 bytes")}(n|=(15&(a=d[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var s=this.readVarint()+this.pos,n=this.pos;return this.pos=s,s-n>=12&&n2?function(a,d,y){return n2.decode(a.subarray(d,y))}(this.buf,n,s):function(a,d,y){for(var x="",w=d;w239?4:D>223?3:D>191?2:1;if(w+U>y)break;U===1?D<128&&(L=D):U===2?(192&(b=a[w+1]))==128&&(L=(31&D)<<6|63&b)<=127&&(L=null):U===3?(k=a[w+2],(192&(b=a[w+1]))==128&&(192&k)==128&&((L=(15&D)<<12|(63&b)<<6|63&k)<=2047||L>=55296&&L<=57343)&&(L=null)):U===4&&(k=a[w+2],I=a[w+3],(192&(b=a[w+1]))==128&&(192&k)==128&&(192&I)==128&&((L=(15&D)<<18|(63&b)<<12|(63&k)<<6|63&I)<=65535||L>=1114112)&&(L=null)),L===null?(L=65533,U=1):L>65535&&(L-=65536,x+=String.fromCharCode(L>>>10&1023|55296),L=56320|1023&L),x+=String.fromCharCode(L),w+=U}return x}(this.buf,n,s)},readBytes:function(){var s=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,s);return this.pos=s,n},readPackedVarint:function(s,n){if(this.type!==Lr.Bytes)return s.push(this.readVarint(n));var a=ha(this);for(s=s||[];this.pos127;);else if(n===Lr.Bytes)this.pos=this.readVarint()+this.pos;else if(n===Lr.Fixed32)this.pos+=4;else{if(n!==Lr.Fixed64)throw new Error("Unimplemented type: "+n);this.pos+=8}},writeTag:function(s,n){this.writeVarint(s<<3|n)},realloc:function(s){for(var n=this.length||16;n268435455||s<0?function(n,a){var d,y;if(n>=0?(d=n%4294967296|0,y=n/4294967296|0):(y=~(-n/4294967296),4294967295^(d=~(-n%4294967296))?d=d+1|0:(d=0,y=y+1|0)),n>=18446744073709552e3||n<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");a.realloc(10),function(x,w,b){b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,x>>>=7,b.buf[b.pos++]=127&x|128,b.buf[b.pos]=127&(x>>>=7)}(d,0,a),function(x,w){var b=(7&x)<<4;w.buf[w.pos++]|=b|((x>>>=3)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x|((x>>>=7)?128:0),x&&(w.buf[w.pos++]=127&x)))))}(y,a)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(!!s)},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var n=this.pos;this.pos=function(d,y,x){for(var w,b,k=0;k55295&&w<57344){if(!b){w>56319||k+1===y.length?(d[x++]=239,d[x++]=191,d[x++]=189):b=w;continue}if(w<56320){d[x++]=239,d[x++]=191,d[x++]=189,b=w;continue}w=b-55296<<10|w-56320|65536,b=null}else b&&(d[x++]=239,d[x++]=191,d[x++]=189,b=null);w<128?d[x++]=w:(w<2048?d[x++]=w>>6|192:(w<65536?d[x++]=w>>12|224:(d[x++]=w>>18|240,d[x++]=w>>12&63|128),d[x++]=w>>6&63|128),d[x++]=63&w|128)}return x}(this.buf,s,this.pos);var a=this.pos-n;a>=128&&i2(n,a,this),this.pos=n-1,this.writeVarint(a),this.pos+=a},writeFloat:function(s){this.realloc(4),t2(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),t2(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var n=s.length;this.writeVarint(n),this.realloc(n);for(var a=0;a=128&&i2(a,d,this),this.pos=a-1,this.writeVarint(d),this.pos+=d},writeMessage:function(s,n,a){this.writeTag(s,Lr.Bytes),this.writeRawMessage(n,a)},writePackedVarint:function(s,n){n.length&&this.writeMessage(s,b3,n)},writePackedSVarint:function(s,n){n.length&&this.writeMessage(s,S3,n)},writePackedBoolean:function(s,n){n.length&&this.writeMessage(s,E3,n)},writePackedFloat:function(s,n){n.length&&this.writeMessage(s,k3,n)},writePackedDouble:function(s,n){n.length&&this.writeMessage(s,T3,n)},writePackedFixed32:function(s,n){n.length&&this.writeMessage(s,C3,n)},writePackedSFixed32:function(s,n){n.length&&this.writeMessage(s,I3,n)},writePackedFixed64:function(s,n){n.length&&this.writeMessage(s,P3,n)},writePackedSFixed64:function(s,n){n.length&&this.writeMessage(s,M3,n)},writeBytesField:function(s,n){this.writeTag(s,Lr.Bytes),this.writeBytes(n)},writeFixed32Field:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeFixed32(n)},writeSFixed32Field:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeSFixed32(n)},writeFixed64Field:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeFixed64(n)},writeSFixed64Field:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeSFixed64(n)},writeVarintField:function(s,n){this.writeTag(s,Lr.Varint),this.writeVarint(n)},writeSVarintField:function(s,n){this.writeTag(s,Lr.Varint),this.writeSVarint(n)},writeStringField:function(s,n){this.writeTag(s,Lr.Bytes),this.writeString(n)},writeFloatField:function(s,n){this.writeTag(s,Lr.Fixed32),this.writeFloat(n)},writeDoubleField:function(s,n){this.writeTag(s,Lr.Fixed64),this.writeDouble(n)},writeBooleanField:function(s,n){this.writeVarintField(s,!!n)}};var x0=T(Qb);const w0=3;function A3(s,n,a){s===1&&a.readMessage(D3,n)}function D3(s,n,a){if(s===3){const{id:d,bitmap:y,width:x,height:w,left:b,top:k,advance:I}=a.readMessage(z3,{});n.push({id:d,bitmap:new Ud({width:x+2*w0,height:w+2*w0},y),metrics:{width:x,height:w,left:b,top:k,advance:I}})}}function z3(s,n,a){s===1?n.id=a.readVarint():s===2?n.bitmap=a.readBytes():s===3?n.width=a.readVarint():s===4?n.height=a.readVarint():s===5?n.left=a.readSVarint():s===6?n.top=a.readSVarint():s===7&&(n.advance=a.readVarint())}const o2=w0;function a2(s){let n=0,a=0;for(const w of s)n+=w.w*w.h,a=Math.max(a,w.w);s.sort((w,b)=>b.h-w.h);const d=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(n/.95)),a),h:1/0}];let y=0,x=0;for(const w of s)for(let b=d.length-1;b>=0;b--){const k=d[b];if(!(w.w>k.w||w.h>k.h)){if(w.x=k.x,w.y=k.y,x=Math.max(x,w.y+w.h),y=Math.max(y,w.x+w.w),w.w===k.w&&w.h===k.h){const I=d.pop();b=0&&d>=n&&Sm[this.text.charCodeAt(d)];d--)a--;this.text=this.text.substring(n,a),this.sectionIndex=this.sectionIndex.slice(n,a)}substring(n,a){const d=new Uc;return d.text=this.text.substring(n,a),d.sectionIndex=this.sectionIndex.slice(n,a),d.sections=this.sections,d}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((n,a)=>Math.max(n,this.sections[a].scale),0)}addTextSection(n,a){this.text+=n.text,this.sections.push(Yd.forText(n.scale,n.fontStack||a));const d=this.sections.length-1;for(let y=0;y=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function bm(s,n,a,d,y,x,w,b,k,I,D,L,U,Z,K){const J=Uc.fromFeature(s,y);let le;L===g.ah.vertical&&J.verticalizePunctuation();const{processBidirectionalText:fe,processStyledBidirectionalText:De}=Ri;if(fe&&J.sections.length===1){le=[];const Ve=fe(J.toString(),S0(J,I,x,n,d,Z));for(const et of Ve){const xt=new Uc;xt.text=et,xt.sections=J.sections;for(let Nt=0;Nt0&&da>Jn&&(Jn=da)}else{const Ts=xt[xr.fontStack],$n=Ts&&Ts[Zr];if($n&&$n.rect)Wc=$n.rect,nn=$n.metrics;else{const da=et[xr.fontStack],tf=da&&da[Zr];if(!tf)continue;nn=tf.metrics}ns=(Ln-xr.scale)*Pn}Zs?(Ve.verticalizable=!0,Si.push({glyph:Zr,imageName:Ro,x:Zt,y:Fr+ns,vertical:Zs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:$r,metrics:nn,rect:Wc}),Zt+=Lo*xr.scale+qe):(Si.push({glyph:Zr,imageName:Ro,x:Zt,y:Fr+ns,vertical:Zs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:$r,metrics:nn,rect:Wc}),Zt+=nn.advance*xr.scale+qe)}Si.length!==0&&(Or=Math.max(Zt-qe,Or),F3(Si,0,Si.length-1,Gs,Jn)),Zt=0;const ks=pt*Ln+Jn;Kn.lineOffset=Math.max(Jn,oi),Fr+=ks,zn=Math.max(ks,zn),++Xn}var Rn;const xi=Fr-qd,{horizontalAlign:wi,verticalAlign:bi}=k0(At);(function(mn,Ln,oi,Kn,Si,Jn,ks,Fi,xr){const $r=(Ln-oi)*Si;let Zr=0;Zr=Jn!==ks?-Fi*Kn-qd:(-Kn*xr+.5)*ks;for(const ns of mn)for(const nn of ns.positionedGlyphs)nn.x+=$r,nn.y+=Zr})(Ve.positionedLines,Gs,wi,bi,Or,zn,pt,xi,yt.length),Ve.top+=-bi*xi,Ve.bottom=Ve.top+xi,Ve.left+=-wi*Or,Ve.right=Ve.left+Or}(Me,n,a,d,le,w,b,k,L,I,U,K),!function(Ve){for(const et of Ve)if(et.positionedGlyphs.length!==0)return!1;return!0}(be)&&Me}const Sm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},R3={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},L3={40:!0};function u2(s,n,a,d,y,x){if(n.imageName){const w=d[n.imageName];return w?w.displaySize[0]*n.scale*Pn/x+y:0}{const w=a[n.fontStack],b=w&&w[s];return b?b.metrics.advance*n.scale+y:0}}function c2(s,n,a,d){const y=Math.pow(s-n,2);return d?s=0;let I=0;for(let L=0;LI){const D=Math.ceil(x/I);y*=D/w,w=D}return{x1:d,y1:y,x2:d+x,y2:y+w}}function p2(s,n,a,d,y,x){const w=s.image;let b;if(w.content){const le=w.content,fe=w.pixelRatio||1;b=[le[0]/fe,le[1]/fe,w.displaySize[0]-le[2]/fe,w.displaySize[1]-le[3]/fe]}const k=n.left*x,I=n.right*x;let D,L,U,Z;a==="width"||a==="both"?(Z=y[0]+k-d[3],L=y[0]+I+d[1]):(Z=y[0]+(k+I-w.displaySize[0])/2,L=Z+w.displaySize[0]);const K=n.top*x,J=n.bottom*x;return a==="height"||a==="both"?(D=y[1]+K-d[0],U=y[1]+J+d[2]):(D=y[1]+(K+J-w.displaySize[1])/2,U=D+w.displaySize[1]),{image:w,top:D,right:L,bottom:U,left:Z,collisionPadding:b}}const Xd=255,zo=128,fl=Xd*zo;function m2(s,n){const{expression:a}=n;if(a.kind==="constant")return{kind:"constant",layoutSize:a.evaluate(new Vr(s+1))};if(a.kind==="source")return{kind:"source"};{const{zoomStops:d,interpolationType:y}=a;let x=0;for(;xw.id),this.index=n.index,this.pixelRatio=n.pixelRatio,this.sourceLayerIndex=n.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=a0([]),this.placementViewportMatrix=a0([]);const a=this.layers[0]._unevaluatedLayout._values;this.textSizeData=m2(this.zoom,a["text-size"]),this.iconSizeData=m2(this.zoom,a["icon-size"]);const d=this.layers[0].layout,y=d.get("symbol-sort-key"),x=d.get("symbol-z-order");this.canOverlap=T0(d,"text-overlap","text-allow-overlap")!=="never"||T0(d,"icon-overlap","icon-allow-overlap")!=="never"||d.get("text-ignore-placement")||d.get("icon-ignore-placement"),this.sortFeaturesByKey=x!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(x==="viewport-y"||x==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,d.get("symbol-placement")==="point"&&(this.writingModes=d.get("text-writing-mode").map(w=>g.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=n.sourceID}createArrays(){this.text=new C0(new fu(this.layers,this.zoom,n=>/^text/.test(n))),this.icon=new C0(new fu(this.layers,this.zoom,n=>/^icon/.test(n))),this.glyphOffsetArray=new Wr,this.lineVertexArray=new Gn,this.symbolInstances=new ar,this.textAnchorOffsets=new Gr}calculateGlyphDependencies(n,a,d,y,x){for(let w=0;w0)&&(w.value.kind!=="constant"||w.value.value.length>0),D=k.value.kind!=="constant"||!!k.value.value||Object.keys(k.parameters).length>0,L=x.get("symbol-sort-key");if(this.features=[],!I&&!D)return;const U=a.iconDependencies,Z=a.glyphDependencies,K=a.availableImages,J=new Vr(this.zoom);for(const{feature:le,id:fe,index:De,sourceLayerIndex:be}of n){const Me=y._featureFilter.needGeometry,Ve=mu(le,Me);if(!y._featureFilter.filter(J,Ve,d))continue;let et,xt;if(Me||(Ve.geometry=pu(le)),I){const yt=y.getValueAndResolveTokens("text-field",Ve,d,K),pt=Mi.factory(yt),At=this.hasRTLText=this.hasRTLText||U3(pt);(!At||Ri.getRTLTextPluginStatus()==="unavailable"||At&&Ri.isParsed())&&(et=w3(pt,y,Ve))}if(D){const yt=y.getValueAndResolveTokens("icon-image",Ve,d,K);xt=yt instanceof Di?yt:Di.fromString(yt)}if(!et&&!xt)continue;const Nt=this.sortFeaturesByKey?L.evaluate(Ve,{},d):void 0;if(this.features.push({id:fe,text:et,icon:xt,index:De,sourceLayerIndex:be,geometry:Ve.geometry,properties:le.properties,type:N3[le.type],sortKey:Nt}),xt&&(U[xt.name]=!0),et){const yt=w.evaluate(Ve,{},d).join(","),pt=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(g.ah.vertical)>=0;for(const At of et.sections)if(At.image)U[At.image.name]=!0;else{const Tt=Dd(et.toString()),bt=At.fontStack||yt,qe=Z[bt]=Z[bt]||{};this.calculateGlyphDependencies(At.text,qe,pt,this.allowVerticalPlacement,Tt)}}}x.get("symbol-placement")==="line"&&(this.features=function(le){const fe={},De={},be=[];let Me=0;function Ve(yt){be.push(le[yt]),Me++}function et(yt,pt,At){const Tt=De[yt];return delete De[yt],De[pt]=Tt,be[Tt].geometry[0].pop(),be[Tt].geometry[0]=be[Tt].geometry[0].concat(At[0]),Tt}function xt(yt,pt,At){const Tt=fe[pt];return delete fe[pt],fe[yt]=Tt,be[Tt].geometry[0].shift(),be[Tt].geometry[0]=At[0].concat(be[Tt].geometry[0]),Tt}function Nt(yt,pt,At){const Tt=At?pt[0][pt[0].length-1]:pt[0][0];return`${yt}:${Tt.x}:${Tt.y}`}for(let yt=0;ytyt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((le,fe)=>le.sortKey-fe.sortKey)}update(n,a,d){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(n,a,this.layers,d),this.icon.programConfigurations.updatePaintArrays(n,a,this.layers,d))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(n){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(n),this.iconCollisionBox.upload(n)),this.text.upload(n,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(n,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(n,a){const d=this.lineVertexArray.length;if(n.segment!==void 0){let y=n.dist(a[n.segment+1]),x=n.dist(a[n.segment]);const w={};for(let b=n.segment+1;b=0;b--)w[b]={x:a[b].x,y:a[b].y,tileUnitDistanceFromAnchor:x},b>0&&(x+=a[b-1].dist(a[b]));for(let b=0;b0}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(n,a){const d=n.placedSymbolArray.get(a),y=d.vertexStartIndex+4*d.numGlyphs;for(let x=d.vertexStartIndex;xy[b]-y[k]||x[k]-x[b]),w}addToSortKeyRanges(n,a){const d=this.sortKeyRanges[this.sortKeyRanges.length-1];d&&d.sortKey===a?d.symbolInstanceEnd=n+1:this.sortKeyRanges.push({sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:n+1})}sortFeatures(n){if(this.sortFeaturesByY&&this.sortedAngle!==n&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(n),this.sortedAngle=n,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const a of this.symbolInstanceIndexes){const d=this.symbolInstances.get(a);this.featureSortOrder.push(d.featureIndex),[d.rightJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.leftJustifiedTextSymbolIndex].forEach((y,x,w)=>{y>=0&&w.indexOf(y)===x&&this.addIndicesForPlacedSymbol(this.text,y)}),d.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,d.verticalPlacedTextSymbolIndex),d.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.placedIconSymbolIndex),d.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,d.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let g2,y2;St("SymbolBucket",jc,{omit:["layers","collisionBoxArray","features","compareText"]}),jc.MAX_GLYPHS=65535,jc.addDynamicAttributes=E0;var P0={get paint(){return y2=y2||new v({"icon-opacity":new jt(ie.paint_symbol["icon-opacity"]),"icon-color":new jt(ie.paint_symbol["icon-color"]),"icon-halo-color":new jt(ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new jt(ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new jt(ie.paint_symbol["icon-halo-blur"]),"icon-translate":new It(ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new It(ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new jt(ie.paint_symbol["text-opacity"]),"text-color":new jt(ie.paint_symbol["text-color"],{runtimeType:Kr,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new jt(ie.paint_symbol["text-halo-color"]),"text-halo-width":new jt(ie.paint_symbol["text-halo-width"]),"text-halo-blur":new jt(ie.paint_symbol["text-halo-blur"]),"text-translate":new It(ie.paint_symbol["text-translate"]),"text-translate-anchor":new It(ie.paint_symbol["text-translate-anchor"])})},get layout(){return g2=g2||new v({"symbol-placement":new It(ie.layout_symbol["symbol-placement"]),"symbol-spacing":new It(ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new It(ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new jt(ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new It(ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new It(ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new It(ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new It(ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new It(ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new It(ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new jt(ie.layout_symbol["icon-size"]),"icon-text-fit":new It(ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new It(ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new jt(ie.layout_symbol["icon-image"]),"icon-rotate":new jt(ie.layout_symbol["icon-rotate"]),"icon-padding":new jt(ie.layout_symbol["icon-padding"]),"icon-keep-upright":new It(ie.layout_symbol["icon-keep-upright"]),"icon-offset":new jt(ie.layout_symbol["icon-offset"]),"icon-anchor":new jt(ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new It(ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new It(ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new It(ie.layout_symbol["text-rotation-alignment"]),"text-field":new jt(ie.layout_symbol["text-field"]),"text-font":new jt(ie.layout_symbol["text-font"]),"text-size":new jt(ie.layout_symbol["text-size"]),"text-max-width":new jt(ie.layout_symbol["text-max-width"]),"text-line-height":new It(ie.layout_symbol["text-line-height"]),"text-letter-spacing":new jt(ie.layout_symbol["text-letter-spacing"]),"text-justify":new jt(ie.layout_symbol["text-justify"]),"text-radial-offset":new jt(ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new It(ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new jt(ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new jt(ie.layout_symbol["text-anchor"]),"text-max-angle":new It(ie.layout_symbol["text-max-angle"]),"text-writing-mode":new It(ie.layout_symbol["text-writing-mode"]),"text-rotate":new jt(ie.layout_symbol["text-rotate"]),"text-padding":new It(ie.layout_symbol["text-padding"]),"text-keep-upright":new It(ie.layout_symbol["text-keep-upright"]),"text-transform":new jt(ie.layout_symbol["text-transform"]),"text-offset":new jt(ie.layout_symbol["text-offset"]),"text-allow-overlap":new It(ie.layout_symbol["text-allow-overlap"]),"text-overlap":new It(ie.layout_symbol["text-overlap"]),"text-ignore-placement":new It(ie.layout_symbol["text-ignore-placement"]),"text-optional":new It(ie.layout_symbol["text-optional"])})}};class _2{constructor(n){if(n.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=n.property.overrides?n.property.overrides.runtimeType:pi,this.defaultValue=n}evaluate(n){if(n.formattedSection){const a=this.defaultValue.property.overrides;if(a&&a.hasOverride(n.formattedSection))return a.getOverride(n.formattedSection)}return n.feature&&n.featureState?this.defaultValue.evaluate(n.feature,n.featureState):this.defaultValue.property.specification.default}eachChild(n){this.defaultValue.isConstant()||n(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}St("FormatSectionOverride",_2,{omit:["defaultValue"]});class Tm extends u{constructor(n){super(n,P0)}recalculate(n,a){if(super.recalculate(n,a),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const d=this.layout.get("text-writing-mode");if(d){const y=[];for(const x of d)y.indexOf(x)<0&&y.push(x);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(n,a,d,y){const x=this.layout.get(n).evaluate(a,{},d,y),w=this._unevaluatedLayout._values[n];return w.isDataDriven()||mc(w.value)||!x?x:function(b,k){return k.replace(/{([^{}]+)}/g,(I,D)=>b&&D in b?String(b[D]):"")}(a.properties,x)}createBucket(n){return new jc(n)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const n of P0.paint.overridableProperties){if(!Tm.hasPaintOverride(this.layout,n))continue;const a=this.paint.get(n),d=new _2(a),y=new pc(d,a.property.specification);let x=null;x=a.value.kind==="constant"||a.value.kind==="source"?new Ya("source",y):new Xa("composite",y,a.value.zoomStops),this.paint._values[n]=new Hs(a.property,x,a.parameters)}}_handleOverridablePaintPropertyUpdate(n,a,d){return!(!this.layout||a.isDataDriven()||d.isDataDriven())&&Tm.hasPaintOverride(this.layout,n)}static hasPaintOverride(n,a){const d=n.get("text-field"),y=P0.paint.properties[a];let x=!1;const w=b=>{for(const k of b)if(y.overrides&&y.overrides.hasOverride(k))return void(x=!0)};if(d.value.kind==="constant"&&d.value.value instanceof Mi)w(d.value.value.sections);else if(d.value.kind==="source"){const b=I=>{x||(I instanceof ms&&En(I.value)===fs?w(I.value.sections):I instanceof sc?w(I.sections):I.eachChild(b))},k=d.value;k._styleExpression&&b(k._styleExpression.expression)}return x}}let v2;var j3={get paint(){return v2=v2||new v({"background-color":new It(ie.paint_background["background-color"]),"background-pattern":new Ic(ie.paint_background["background-pattern"]),"background-opacity":new It(ie.paint_background["background-opacity"])})}};class V3 extends u{constructor(n){super(n,j3)}}let x2;var H3={get paint(){return x2=x2||new v({"raster-opacity":new It(ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new It(ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new It(ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new It(ie.paint_raster["raster-brightness-max"]),"raster-saturation":new It(ie.paint_raster["raster-saturation"]),"raster-contrast":new It(ie.paint_raster["raster-contrast"]),"raster-resampling":new It(ie.paint_raster["raster-resampling"]),"raster-fade-duration":new It(ie.paint_raster["raster-fade-duration"])})}};class W3 extends u{constructor(n){super(n,H3)}}class G3 extends u{constructor(n){super(n,{}),this.onAdd=a=>{this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)},this.onRemove=a=>{this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)},this.implementation=n}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class Z3{constructor(n){this._methodToThrottle=n,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const M0=63710088e-1;class pl{constructor(n,a){if(isNaN(n)||isNaN(a))throw new Error(`Invalid LngLat object: (${n}, ${a})`);if(this.lng=+n,this.lat=+a,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new pl(ke(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(n){const a=Math.PI/180,d=this.lat*a,y=n.lat*a,x=Math.sin(d)*Math.sin(y)+Math.cos(d)*Math.cos(y)*Math.cos((n.lng-this.lng)*a);return M0*Math.acos(Math.min(x,1))}static convert(n){if(n instanceof pl)return n;if(Array.isArray(n)&&(n.length===2||n.length===3))return new pl(Number(n[0]),Number(n[1]));if(!Array.isArray(n)&&typeof n=="object"&&n!==null)return new pl(Number("lng"in n?n.lng:n.lon),Number(n.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const w2=2*Math.PI*M0;function b2(s){return w2*Math.cos(s*Math.PI/180)}function S2(s){return(180+s)/360}function k2(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function T2(s,n){return s/b2(n)}function A0(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}class Kd{constructor(n,a,d=0){this.x=+n,this.y=+a,this.z=+d}static fromLngLat(n,a=0){const d=pl.convert(n);return new Kd(S2(d.lng),k2(d.lat),T2(a,d.lat))}toLngLat(){return new pl(360*this.x-180,A0(this.y))}toAltitude(){return this.z*b2(A0(this.y))}meterInMercatorCoordinateUnits(){return 1/w2*(n=A0(this.y),1/Math.cos(n*Math.PI/180));var n}}function E2(s,n,a){var d=2*Math.PI*6378137/256/Math.pow(2,a);return[s*d-2*Math.PI*6378137/2,n*d-2*Math.PI*6378137/2]}class D0{constructor(n,a,d){if(!function(y,x,w){return!(y<0||y>25||w<0||w>=Math.pow(2,y)||x<0||x>=Math.pow(2,y))}(n,a,d))throw new Error(`x=${a}, y=${d}, z=${n} outside of bounds. 0<=x<${Math.pow(2,n)}, 0<=y<${Math.pow(2,n)} 0<=z<=25 `);this.z=n,this.x=a,this.y=d,this.key=Jd(0,n,n,a,d)}equals(n){return this.z===n.z&&this.x===n.x&&this.y===n.y}url(n,a,d){const y=(w=this.y,b=this.z,k=E2(256*(x=this.x),256*(w=Math.pow(2,b)-w-1),b),I=E2(256*(x+1),256*(w+1),b),k[0]+","+k[1]+","+I[0]+","+I[1]);var x,w,b,k,I;const D=function(L,U,Z){let K,J="";for(let le=L;le>0;le--)K=1<1?"@2x":"").replace(/{quadkey}/g,D).replace(/{bbox-epsg-3857}/g,y)}isChildOf(n){const a=this.z-n.z;return a>0&&n.x===this.x>>a&&n.y===this.y>>a}getTilePoint(n){const a=Math.pow(2,this.z);return new A((n.x*a-this.x)*Cn,(n.y*a-this.y)*Cn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class C2{constructor(n,a){this.wrap=n,this.canonical=a,this.key=Jd(n,a.z,a.z,a.x,a.y)}}class Ss{constructor(n,a,d,y,x){if(n= z; overscaledZ = ${n}; z = ${d}`);this.overscaledZ=n,this.wrap=a,this.canonical=new D0(d,+y,+x),this.key=Jd(a,n,d,y,x)}clone(){return new Ss(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(n){return this.overscaledZ===n.overscaledZ&&this.wrap===n.wrap&&this.canonical.equals(n.canonical)}scaledTo(n){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-n;return n>this.canonical.z?new Ss(n,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ss(n,this.wrap,n,this.canonical.x>>a,this.canonical.y>>a)}calculateScaledKey(n,a){if(n>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${n}; overscaledZ = ${this.overscaledZ}`);const d=this.canonical.z-n;return n>this.canonical.z?Jd(this.wrap*+a,n,this.canonical.z,this.canonical.x,this.canonical.y):Jd(this.wrap*+a,n,n,this.canonical.x>>d,this.canonical.y>>d)}isChildOf(n){if(n.wrap!==this.wrap)return!1;const a=this.canonical.z-n.canonical.z;return n.overscaledZ===0||n.overscaledZ>a&&n.canonical.y===this.canonical.y>>a}children(n){if(this.overscaledZ>=n)return[new Ss(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const a=this.canonical.z+1,d=2*this.canonical.x,y=2*this.canonical.y;return[new Ss(a,this.wrap,a,d,y),new Ss(a,this.wrap,a,d+1,y),new Ss(a,this.wrap,a,d,y+1),new Ss(a,this.wrap,a,d+1,y+1)]}isLessThan(n){return this.wrapn.wrap)&&(this.overscaledZn.overscaledZ)&&(this.canonical.xn.canonical.x)&&this.canonical.ythis.max&&(this.max=L),L=this.dim+1||a<-1||a>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(a+1)*this.stride+(n+1)}unpack(n,a,d){return n*this.redFactor+a*this.greenFactor+d*this.blueFactor-this.baseShift}getPixels(){return new bs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(n,a,d){if(this.dim!==n.dim)throw new Error("dem dimension mismatch");let y=a*this.dim,x=a*this.dim+this.dim,w=d*this.dim,b=d*this.dim+this.dim;switch(a){case-1:y=x-1;break;case 1:x=y+1}switch(d){case-1:w=b-1;break;case 1:b=w+1}const k=-a*this.dim,I=-d*this.dim;for(let D=w;D=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${n} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[n]}}class M2{constructor(n,a,d,y,x){this.type="Feature",this._vectorTileFeature=n,n._z=a,n._x=d,n._y=y,this.properties=n.properties,this.id=x}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(n){this._geometry=n}toJSON(){const n={geometry:this.geometry};for(const a in this)a!=="_geometry"&&a!=="_vectorTileFeature"&&(n[a]=this[a]);return n}}class A2{constructor(n,a){this.tileID=n,this.x=n.canonical.x,this.y=n.canonical.y,this.z=n.canonical.z,this.grid=new el(Cn,16,0),this.grid3D=new el(Cn,16,0),this.featureIndexArray=new ii,this.promoteId=a}insert(n,a,d,y,x,w){const b=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(d,y,x);const k=w?this.grid3D:this.grid;for(let I=0;I=0&&L[3]>=0&&k.insert(b,L[0],L[1],L[2],L[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new hl.VectorTile(new x0(this.rawTileData)).layers,this.sourceLayerCoder=new P2(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(n,a,d,y){this.loadVTLayers();const x=n.params||{},w=Cn/n.tileSize/n.scale,b=yd(x.filter),k=n.queryGeometry,I=n.queryPadding*w,D=z2(k),L=this.grid.query(D.minX-I,D.minY-I,D.maxX+I,D.maxY+I),U=z2(n.cameraQueryGeometry),Z=this.grid3D.query(U.minX-I,U.minY-I,U.maxX+I,U.maxY+I,(le,fe,De,be)=>function(Me,Ve,et,xt,Nt){for(const pt of Me)if(Ve<=pt.x&&et<=pt.y&&xt>=pt.x&&Nt>=pt.y)return!0;const yt=[new A(Ve,et),new A(Ve,Nt),new A(xt,Nt),new A(xt,et)];if(Me.length>2){for(const pt of yt)if(Lc(Me,pt))return!0}for(let pt=0;pt(be||(be=pu(Me)),Ve.queryIntersectsFeature(k,Me,et,be,this.z,n.transform,w,n.pixelPosMatrix)))}return K}loadMatchingFeature(n,a,d,y,x,w,b,k,I,D,L){const U=this.bucketLayerIDs[a];if(w&&!function(le,fe){for(let De=0;De=0)return!0;return!1}(w,U))return;const Z=this.sourceLayerCoder.decode(d),K=this.vtLayers[Z].feature(y);if(x.needGeometry){const le=mu(K,!0);if(!x.filter(new Vr(this.tileID.overscaledZ),le,this.tileID.canonical))return}else if(!x.filter(new Vr(this.tileID.overscaledZ),K))return;const J=this.getId(K,Z);for(let le=0;le{const b=n instanceof cu?n.get(w):null;return b&&b.evaluate?b.evaluate(a,d,y):b})}function z2(s){let n=1/0,a=1/0,d=-1/0,y=-1/0;for(const x of s)n=Math.min(n,x.x),a=Math.min(a,x.y),d=Math.max(d,x.x),y=Math.max(y,x.y);return{minX:n,minY:a,maxX:d,maxY:y}}function q3(s,n){return n-s}function R2(s,n,a,d,y){const x=[];for(let w=0;w=d&&L.x>=d||(D.x>=d?D=new A(d,D.y+(d-D.x)/(L.x-D.x)*(L.y-D.y))._round():L.x>=d&&(L=new A(d,D.y+(d-D.x)/(L.x-D.x)*(L.y-D.y))._round()),D.y>=y&&L.y>=y||(D.y>=y?D=new A(D.x+(y-D.y)/(L.y-D.y)*(L.x-D.x),y)._round():L.y>=y&&(L=new A(D.x+(y-D.y)/(L.y-D.y)*(L.x-D.x),y)._round()),k&&D.equals(k[k.length-1])||(k=[D],x.push(k)),k.push(L)))))}}return x}St("FeatureIndex",A2,{omit:["rawTileData","sourceLayerCoder"]});class ml extends A{constructor(n,a,d,y){super(n,a),this.angle=d,y!==void 0&&(this.segment=y)}clone(){return new ml(this.x,this.y,this.angle,this.segment)}}function L2(s,n,a,d,y){if(n.segment===void 0||a===0)return!0;let x=n,w=n.segment+1,b=0;for(;b>-a/2;){if(w--,w<0)return!1;b-=s[w].dist(x),x=s[w]}b+=s[w].dist(s[w+1]),w++;const k=[];let I=0;for(;bd;)I-=k.shift().angleDelta;if(I>y)return!1;w++,b+=D.dist(L)}return!0}function O2(s){let n=0;for(let a=0;aI){const K=(I-k)/Z,J=gi.number(L.x,U.x,K),le=gi.number(L.y,U.y,K),fe=new ml(J,le,U.angleTo(L),D);return fe._round(),!w||L2(s,fe,b,w,n)?fe:void 0}k+=Z}}function X3(s,n,a,d,y,x,w,b,k){const I=F2(d,x,w),D=B2(d,y),L=D*w,U=s[0].x===0||s[0].x===k||s[0].y===0||s[0].y===k;return n-L=0&&Me=0&&Ve=0&&U+I<=D){const et=new ml(Me,Ve,De,K);et._round(),d&&!L2(s,et,x,d,y)||Z.push(et)}}L+=fe}return b||Z.length||w||(Z=N2(s,L/2,a,d,y,x,w,!0,k)),Z}St("Anchor",ml);const Vc=Oi;function $2(s,n,a,d){const y=[],x=s.image,w=x.pixelRatio,b=x.paddedRect.w-2*Vc,k=x.paddedRect.h-2*Vc;let I={x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};const D=x.stretchX||[[0,b]],L=x.stretchY||[[0,k]],U=(qe,Dt)=>qe+Dt[1]-Dt[0],Z=D.reduce(U,0),K=L.reduce(U,0),J=b-Z,le=k-K;let fe=0,De=Z,be=0,Me=K,Ve=0,et=J,xt=0,Nt=le;if(x.content&&d){const qe=x.content,Dt=qe[2]-qe[0],Mt=qe[3]-qe[1];(x.textFitWidth||x.textFitHeight)&&(I=f2(s)),fe=Em(D,0,qe[0]),be=Em(L,0,qe[1]),De=Em(D,qe[0],qe[2]),Me=Em(L,qe[1],qe[3]),Ve=qe[0]-fe,xt=qe[1]-be,et=Dt-De,Nt=Mt-Me}const yt=I.x1,pt=I.y1,At=I.x2-yt,Tt=I.y2-pt,bt=(qe,Dt,Mt,Zt)=>{const Fr=Cm(qe.stretch-fe,De,At,yt),Or=Im(qe.fixed-Ve,et,qe.stretch,Z),zn=Cm(Dt.stretch-be,Me,Tt,pt),Gs=Im(Dt.fixed-xt,Nt,Dt.stretch,K),Xn=Cm(Mt.stretch-fe,De,At,yt),Rn=Im(Mt.fixed-Ve,et,Mt.stretch,Z),xi=Cm(Zt.stretch-be,Me,Tt,pt),wi=Im(Zt.fixed-xt,Nt,Zt.stretch,K),bi=new A(Fr,zn),mn=new A(Xn,zn),Ln=new A(Xn,xi),oi=new A(Fr,xi),Kn=new A(Or/w,Gs/w),Si=new A(Rn/w,wi/w),Jn=n*Math.PI/180;if(Jn){const xr=Math.sin(Jn),$r=Math.cos(Jn),Zr=[$r,-xr,xr,$r];bi._matMult(Zr),mn._matMult(Zr),oi._matMult(Zr),Ln._matMult(Zr)}const ks=qe.stretch+qe.fixed,Fi=Dt.stretch+Dt.fixed;return{tl:bi,tr:mn,bl:oi,br:Ln,tex:{x:x.paddedRect.x+Vc+ks,y:x.paddedRect.y+Vc+Fi,w:Mt.stretch+Mt.fixed-ks,h:Zt.stretch+Zt.fixed-Fi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Kn,pixelOffsetBR:Si,minFontScaleX:et/w/At,minFontScaleY:Nt/w/Tt,isSDF:a}};if(d&&(x.stretchX||x.stretchY)){const qe=U2(D,J,Z),Dt=U2(L,le,K);for(let Mt=0;Mt0&&(J=Math.max(10,J),this.circleDiameter=J)}else{const U=!((L=w.image)===null||L===void 0)&&L.content&&(w.image.textFitWidth||w.image.textFitHeight)?f2(w):{x1:w.left,y1:w.top,x2:w.right,y2:w.bottom};U.y1=U.y1*b-k[0],U.y2=U.y2*b+k[2],U.x1=U.x1*b-k[3],U.x2=U.x2*b+k[1];const Z=w.collisionPadding;if(Z&&(U.x1-=Z[0]*b,U.y1-=Z[1]*b,U.x2+=Z[2]*b,U.y2+=Z[3]*b),D){const K=new A(U.x1,U.y1),J=new A(U.x2,U.y1),le=new A(U.x1,U.y2),fe=new A(U.x2,U.y2),De=D*Math.PI/180;K._rotate(De),J._rotate(De),le._rotate(De),fe._rotate(De),U.x1=Math.min(K.x,J.x,le.x,fe.x),U.x2=Math.max(K.x,J.x,le.x,fe.x),U.y1=Math.min(K.y,J.y,le.y,fe.y),U.y2=Math.max(K.y,J.y,le.y,fe.y)}n.emplaceBack(a.x,a.y,U.x1,U.y1,U.x2,U.y2,d,y,x)}this.boxEndIndex=n.length}}class K3{constructor(n=[],a=(d,y)=>dy?1:0){if(this.data=n,this.length=this.data.length,this.compare=a,this.length>0)for(let d=(this.length>>1)-1;d>=0;d--)this._down(d)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],a=this.data.pop();return--this.length>0&&(this.data[0]=a,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:a,compare:d}=this,y=a[n];for(;n>0;){const x=n-1>>1,w=a[x];if(d(y,w)>=0)break;a[n]=w,n=x}a[n]=y}_down(n){const{data:a,compare:d}=this,y=this.length>>1,x=a[n];for(;n=0)break;a[n]=a[w],n=w}a[n]=x}}function J3(s,n=1,a=!1){let d=1/0,y=1/0,x=-1/0,w=-1/0;const b=s[0];for(let Z=0;Zx)&&(x=K.x),(!Z||K.y>w)&&(w=K.y)}const k=Math.min(x-d,w-y);let I=k/2;const D=new K3([],Q3);if(k===0)return new A(d,y);for(let Z=d;ZL.d||!L.d)&&(L=Z,a&&console.log("found best %d after %d probes",Math.round(1e4*Z.d)/1e4,U)),Z.max-L.d<=n||(I=Z.h/2,D.push(new Hc(Z.p.x-I,Z.p.y-I,I,s)),D.push(new Hc(Z.p.x+I,Z.p.y-I,I,s)),D.push(new Hc(Z.p.x-I,Z.p.y+I,I,s)),D.push(new Hc(Z.p.x+I,Z.p.y+I,I,s)),U+=4)}return a&&(console.log(`num probes: ${U}`),console.log(`best distance: ${L.d}`)),L.p}function Q3(s,n){return n.max-s.max}function Hc(s,n,a,d){this.p=new A(s,n),this.h=a,this.d=function(y,x){let w=!1,b=1/0;for(let k=0;ky.y!=K.y>y.y&&y.x<(K.x-Z.x)*(y.y-Z.y)/(K.y-Z.y)+Z.x&&(w=!w),b=Math.min(b,kb(y,Z,K))}}return(w?1:-1)*Math.sqrt(b)}(this.p,d),this.max=this.d+this.h*Math.SQRT2}var Yn;g.aq=void 0,(Yn=g.aq||(g.aq={}))[Yn.center=1]="center",Yn[Yn.left=2]="left",Yn[Yn.right=3]="right",Yn[Yn.top=4]="top",Yn[Yn.bottom=5]="bottom",Yn[Yn["top-left"]=6]="top-left",Yn[Yn["top-right"]=7]="top-right",Yn[Yn["bottom-left"]=8]="bottom-left",Yn[Yn["bottom-right"]=9]="bottom-right";const gl=7,z0=Number.POSITIVE_INFINITY;function j2(s,n){return n[1]!==z0?function(a,d,y){let x=0,w=0;switch(d=Math.abs(d),y=Math.abs(y),a){case"top-right":case"top-left":case"top":w=y-gl;break;case"bottom-right":case"bottom-left":case"bottom":w=-y+gl}switch(a){case"top-right":case"bottom-right":case"right":x=-d;break;case"top-left":case"bottom-left":case"left":x=d}return[x,w]}(s,n[0],n[1]):function(a,d){let y=0,x=0;d<0&&(d=0);const w=d/Math.SQRT2;switch(a){case"top-right":case"top-left":x=w-gl;break;case"bottom-right":case"bottom-left":x=-w+gl;break;case"bottom":x=-d+gl;break;case"top":x=d-gl}switch(a){case"top-right":case"bottom-right":y=-w;break;case"top-left":case"bottom-left":y=w;break;case"left":y=d;break;case"right":y=-d}return[y,x]}(s,n[0])}function V2(s,n,a){var d;const y=s.layout,x=(d=y.get("text-variable-anchor-offset"))===null||d===void 0?void 0:d.evaluate(n,{},a);if(x){const b=x.values,k=[];for(let I=0;IU*Pn);D.startsWith("top")?L[1]-=gl:D.startsWith("bottom")&&(L[1]+=gl),k[I+1]=L}return new Xi(k)}const w=y.get("text-variable-anchor");if(w){let b;b=s._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(n,{},a)*Pn,z0]:y.get("text-offset").evaluate(n,{},a).map(I=>I*Pn);const k=[];for(const I of w)k.push(I,j2(I,b));return new Xi(k)}return null}function R0(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function eD(s,n,a,d,y,x,w,b,k,I,D){let L=x.textMaxSize.evaluate(n,{});L===void 0&&(L=w);const U=s.layers[0].layout,Z=U.get("icon-offset").evaluate(n,{},D),K=W2(a.horizontal),J=w/24,le=s.tilePixelRatio*J,fe=s.tilePixelRatio*L/24,De=s.tilePixelRatio*b,be=s.tilePixelRatio*U.get("symbol-spacing"),Me=U.get("text-padding")*s.tilePixelRatio,Ve=function(qe,Dt,Mt,Zt=1){const Fr=qe.get("icon-padding").evaluate(Dt,{},Mt),Or=Fr&&Fr.values;return[Or[0]*Zt,Or[1]*Zt,Or[2]*Zt,Or[3]*Zt]}(U,n,D,s.tilePixelRatio),et=U.get("text-max-angle")/180*Math.PI,xt=U.get("text-rotation-alignment")!=="viewport"&&U.get("symbol-placement")!=="point",Nt=U.get("icon-rotation-alignment")==="map"&&U.get("symbol-placement")!=="point",yt=U.get("symbol-placement"),pt=be/2,At=U.get("icon-text-fit");let Tt;d&&At!=="none"&&(s.allowVerticalPlacement&&a.vertical&&(Tt=p2(d,a.vertical,At,U.get("icon-text-fit-padding"),Z,J)),K&&(d=p2(d,K,At,U.get("icon-text-fit-padding"),Z,J)));const bt=(qe,Dt)=>{Dt.x<0||Dt.x>=Cn||Dt.y<0||Dt.y>=Cn||function(Mt,Zt,Fr,Or,zn,Gs,Xn,Rn,xi,wi,bi,mn,Ln,oi,Kn,Si,Jn,ks,Fi,xr,$r,Zr,ns,nn,Wc){const Ro=Mt.addToLineVertexArray(Zt,Fr);let Lo,Zs,Ts,$n,da=0,tf=0,Y2=0,X2=0,j0=-1,V0=-1;const fa={};let K2=Ac("");if(Mt.allowVerticalPlacement&&Or.vertical){const ai=Rn.layout.get("text-rotate").evaluate($r,{},nn)+90;Ts=new Pm(xi,Zt,wi,bi,mn,Or.vertical,Ln,oi,Kn,ai),Xn&&($n=new Pm(xi,Zt,wi,bi,mn,Xn,Jn,ks,Kn,ai))}if(zn){const ai=Rn.layout.get("icon-rotate").evaluate($r,{}),Es=Rn.layout.get("icon-text-fit")!=="none",yu=$2(zn,ai,ns,Es),ho=Xn?$2(Xn,ai,ns,Es):void 0;Zs=new Pm(xi,Zt,wi,bi,mn,zn,Jn,ks,!1,ai),da=4*yu.length;const _u=Mt.iconSizeData;let Oo=null;_u.kind==="source"?(Oo=[zo*Rn.layout.get("icon-size").evaluate($r,{})],Oo[0]>fl&&Ue(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)):_u.kind==="composite"&&(Oo=[zo*Zr.compositeIconSizes[0].evaluate($r,{},nn),zo*Zr.compositeIconSizes[1].evaluate($r,{},nn)],(Oo[0]>fl||Oo[1]>fl)&&Ue(`${Mt.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)),Mt.addSymbols(Mt.icon,yu,Oo,xr,Fi,$r,g.ah.none,Zt,Ro.lineStartIndex,Ro.lineLength,-1,nn),j0=Mt.icon.placedSymbolArray.length-1,ho&&(tf=4*ho.length,Mt.addSymbols(Mt.icon,ho,Oo,xr,Fi,$r,g.ah.vertical,Zt,Ro.lineStartIndex,Ro.lineLength,-1,nn),V0=Mt.icon.placedSymbolArray.length-1)}const J2=Object.keys(Or.horizontal);for(const ai of J2){const Es=Or.horizontal[ai];if(!Lo){K2=Ac(Es.text);const ho=Rn.layout.get("text-rotate").evaluate($r,{},nn);Lo=new Pm(xi,Zt,wi,bi,mn,Es,Ln,oi,Kn,ho)}const yu=Es.positionedLines.length===1;if(Y2+=H2(Mt,Zt,Es,Gs,Rn,Kn,$r,Si,Ro,Or.vertical?g.ah.horizontal:g.ah.horizontalOnly,yu?J2:[ai],fa,j0,Zr,nn),yu)break}Or.vertical&&(X2+=H2(Mt,Zt,Or.vertical,Gs,Rn,Kn,$r,Si,Ro,g.ah.vertical,["vertical"],fa,V0,Zr,nn));const nD=Lo?Lo.boxStartIndex:Mt.collisionBoxArray.length,iD=Lo?Lo.boxEndIndex:Mt.collisionBoxArray.length,sD=Ts?Ts.boxStartIndex:Mt.collisionBoxArray.length,oD=Ts?Ts.boxEndIndex:Mt.collisionBoxArray.length,aD=Zs?Zs.boxStartIndex:Mt.collisionBoxArray.length,lD=Zs?Zs.boxEndIndex:Mt.collisionBoxArray.length,uD=$n?$n.boxStartIndex:Mt.collisionBoxArray.length,cD=$n?$n.boxEndIndex:Mt.collisionBoxArray.length;let co=-1;const Am=(ai,Es)=>ai&&ai.circleDiameter?Math.max(ai.circleDiameter,Es):Es;co=Am(Lo,co),co=Am(Ts,co),co=Am(Zs,co),co=Am($n,co);const Q2=co>-1?1:0;Q2&&(co*=Wc/Pn),Mt.glyphOffsetArray.length>=jc.MAX_GLYPHS&&Ue("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),$r.sortKey!==void 0&&Mt.addToSortKeyRanges(Mt.symbolInstances.length,$r.sortKey);const hD=V2(Rn,$r,nn),[dD,fD]=function(ai,Es){const yu=ai.length,ho=Es==null?void 0:Es.values;if((ho==null?void 0:ho.length)>0)for(let _u=0;_u=0?fa.right:-1,fa.center>=0?fa.center:-1,fa.left>=0?fa.left:-1,fa.vertical||-1,j0,V0,K2,nD,iD,sD,oD,aD,lD,uD,cD,wi,Y2,X2,da,tf,Q2,0,Ln,co,dD,fD)}(s,Dt,qe,a,d,y,Tt,s.layers[0],s.collisionBoxArray,n.index,n.sourceLayerIndex,s.index,le,[Me,Me,Me,Me],xt,k,De,Ve,Nt,Z,n,x,I,D,w)};if(yt==="line")for(const qe of R2(n.geometry,0,0,Cn,Cn)){const Dt=X3(qe,be,et,a.vertical||K,d,24,fe,s.overscaling,Cn);for(const Mt of Dt)K&&tD(s,K.text,pt,Mt)||bt(qe,Mt)}else if(yt==="line-center"){for(const qe of n.geometry)if(qe.length>1){const Dt=Y3(qe,et,a.vertical||K,d,24,fe);Dt&&bt(qe,Dt)}}else if(n.type==="Polygon")for(const qe of ac(n.geometry,0)){const Dt=J3(qe,16);bt(qe[0],new ml(Dt.x,Dt.y,0))}else if(n.type==="LineString")for(const qe of n.geometry)bt(qe,new ml(qe[0].x,qe[0].y,0));else if(n.type==="Point")for(const qe of n.geometry)for(const Dt of qe)bt([Dt],new ml(Dt.x,Dt.y,0))}function H2(s,n,a,d,y,x,w,b,k,I,D,L,U,Z,K){const J=function(De,be,Me,Ve,et,xt,Nt,yt){const pt=Ve.layout.get("text-rotate").evaluate(xt,{})*Math.PI/180,At=[];for(const Tt of be.positionedLines)for(const bt of Tt.positionedGlyphs){if(!bt.rect)continue;const qe=bt.rect||{};let Dt=o2+1,Mt=!0,Zt=1,Fr=0;const Or=(et||yt)&&bt.vertical,zn=bt.metrics.advance*bt.scale/2;if(yt&&be.verticalizable&&(Fr=Tt.lineOffset/2-(bt.imageName?-(Pn-bt.metrics.width*bt.scale)/2:(bt.scale-1)*Pn)),bt.imageName){const xr=Nt[bt.imageName];Mt=xr.sdf,Zt=xr.pixelRatio,Dt=Oi/Zt}const Gs=et?[bt.x+zn,bt.y]:[0,0];let Xn=et?[0,0]:[bt.x+zn+Me[0],bt.y+Me[1]-Fr],Rn=[0,0];Or&&(Rn=Xn,Xn=[0,0]);const xi=bt.metrics.isDoubleResolution?2:1,wi=(bt.metrics.left-Dt)*bt.scale-zn+Xn[0],bi=(-bt.metrics.top-Dt)*bt.scale+Xn[1],mn=wi+qe.w/xi*bt.scale/Zt,Ln=bi+qe.h/xi*bt.scale/Zt,oi=new A(wi,bi),Kn=new A(mn,bi),Si=new A(wi,Ln),Jn=new A(mn,Ln);if(Or){const xr=new A(-zn,zn-qd),$r=-Math.PI/2,Zr=Pn/2-zn,ns=new A(5-qd-Zr,-(bt.imageName?Zr:0)),nn=new A(...Rn);oi._rotateAround($r,xr)._add(ns)._add(nn),Kn._rotateAround($r,xr)._add(ns)._add(nn),Si._rotateAround($r,xr)._add(ns)._add(nn),Jn._rotateAround($r,xr)._add(ns)._add(nn)}if(pt){const xr=Math.sin(pt),$r=Math.cos(pt),Zr=[$r,-xr,xr,$r];oi._matMult(Zr),Kn._matMult(Zr),Si._matMult(Zr),Jn._matMult(Zr)}const ks=new A(0,0),Fi=new A(0,0);At.push({tl:oi,tr:Kn,bl:Si,br:Jn,tex:qe,writingMode:be.writingMode,glyphOffset:Gs,sectionIndex:bt.sectionIndex,isSDF:Mt,pixelOffsetTL:ks,pixelOffsetBR:Fi,minFontScaleX:0,minFontScaleY:0})}return At}(0,a,b,y,x,w,d,s.allowVerticalPlacement),le=s.textSizeData;let fe=null;le.kind==="source"?(fe=[zo*y.layout.get("text-size").evaluate(w,{})],fe[0]>fl&&Ue(`${s.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)):le.kind==="composite"&&(fe=[zo*Z.compositeTextSizes[0].evaluate(w,{},K),zo*Z.compositeTextSizes[1].evaluate(w,{},K)],(fe[0]>fl||fe[1]>fl)&&Ue(`${s.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)),s.addSymbols(s.text,J,fe,b,x,w,I,n,k.lineStartIndex,k.lineLength,U,K);for(const De of D)L[De]=s.text.placedSymbolArray.length-1;return 4*J.length}function W2(s){for(const n in s)return s[n];return null}function tD(s,n,a,d){const y=s.compareText;if(n in y){const x=y[n];for(let w=x.length-1;w>=0;w--)if(d.dist(x[w])>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const x=G2[15&d];if(!x)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(n,2,1),[b]=new Uint32Array(n,4,1);return new L0(b,w,x,n)}constructor(n,a=64,d=Float64Array,y){if(isNaN(n)||n<0)throw new Error(`Unpexpected numItems value: ${n}.`);this.numItems=+n,this.nodeSize=Math.min(Math.max(+a,2),65535),this.ArrayType=d,this.IndexArrayType=n<65536?Uint16Array:Uint32Array;const x=G2.indexOf(this.ArrayType),w=2*n*this.ArrayType.BYTES_PER_ELEMENT,b=n*this.IndexArrayType.BYTES_PER_ELEMENT,k=(8-b%8)%8;if(x<0)throw new Error(`Unexpected typed array class: ${d}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+k,2*n),this._pos=2*n,this._finished=!0):(this.data=new ArrayBuffer(8+w+b+k),this.ids=new this.IndexArrayType(this.data,8,n),this.coords=new this.ArrayType(this.data,8+b+k,2*n),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+x]),new Uint16Array(this.data,2,1)[0]=a,new Uint32Array(this.data,4,1)[0]=n)}add(n,a){const d=this._pos>>1;return this.ids[d]=d,this.coords[this._pos++]=n,this.coords[this._pos++]=a,d}finish(){const n=this._pos>>1;if(n!==this.numItems)throw new Error(`Added ${n} items when expected ${this.numItems}.`);return O0(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(n,a,d,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:x,coords:w,nodeSize:b}=this,k=[0,x.length-1,0],I=[];for(;k.length;){const D=k.pop()||0,L=k.pop()||0,U=k.pop()||0;if(L-U<=b){for(let le=U;le<=L;le++){const fe=w[2*le],De=w[2*le+1];fe>=n&&fe<=d&&De>=a&&De<=y&&I.push(x[le])}continue}const Z=U+L>>1,K=w[2*Z],J=w[2*Z+1];K>=n&&K<=d&&J>=a&&J<=y&&I.push(x[Z]),(D===0?n<=K:a<=J)&&(k.push(U),k.push(Z-1),k.push(1-D)),(D===0?d>=K:y>=J)&&(k.push(Z+1),k.push(L),k.push(1-D))}return I}within(n,a,d){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:x,nodeSize:w}=this,b=[0,y.length-1,0],k=[],I=d*d;for(;b.length;){const D=b.pop()||0,L=b.pop()||0,U=b.pop()||0;if(L-U<=w){for(let le=U;le<=L;le++)q2(x[2*le],x[2*le+1],n,a)<=I&&k.push(y[le]);continue}const Z=U+L>>1,K=x[2*Z],J=x[2*Z+1];q2(K,J,n,a)<=I&&k.push(y[Z]),(D===0?n-d<=K:a-d<=J)&&(b.push(U),b.push(Z-1),b.push(1-D)),(D===0?n+d>=K:a+d>=J)&&(b.push(Z+1),b.push(L),b.push(1-D))}return k}}function O0(s,n,a,d,y,x){if(y-d<=a)return;const w=d+y>>1;Z2(s,n,w,d,y,x),O0(s,n,a,d,w-1,1-x),O0(s,n,a,w+1,y,1-x)}function Z2(s,n,a,d,y,x){for(;y>d;){if(y-d>600){const I=y-d+1,D=a-d+1,L=Math.log(I),U=.5*Math.exp(2*L/3),Z=.5*Math.sqrt(L*U*(I-U)/I)*(D-I/2<0?-1:1);Z2(s,n,a,Math.max(d,Math.floor(a-D*U/I+Z)),Math.min(y,Math.floor(a+(I-D)*U/I+Z)),x)}const w=n[2*a+x];let b=d,k=y;for(Qd(s,n,d,a),n[2*y+x]>w&&Qd(s,n,d,y);bw;)k--}n[2*d+x]===w?Qd(s,n,d,k):(k++,Qd(s,n,k,y)),k<=a&&(d=k+1),a<=k&&(y=k-1)}}function Qd(s,n,a,d){F0(s,a,d),F0(n,2*a,2*d),F0(n,2*a+1,2*d+1)}function F0(s,n,a){const d=s[n];s[n]=s[a],s[a]=d}function q2(s,n,a,d){const y=s-a,x=n-d;return y*y+x*x}var B0;g.bg=void 0,(B0=g.bg||(g.bg={})).create="create",B0.load="load",B0.fullLoad="fullLoad";let Mm=null,ef=[];const N0=1e3/60,$0="loadTime",U0="fullLoadTime",rD={mark(s){performance.mark(s)},frame(s){const n=s;Mm!=null&&ef.push(n-Mm),Mm=n},clearMetrics(){Mm=null,ef=[],performance.clearMeasures($0),performance.clearMeasures(U0);for(const s in g.bg)performance.clearMarks(g.bg[s])},getPerformanceMetrics(){performance.measure($0,g.bg.create,g.bg.load),performance.measure(U0,g.bg.create,g.bg.fullLoad);const s=performance.getEntriesByName($0)[0].duration,n=performance.getEntriesByName(U0)[0].duration,a=ef.length,d=1/(ef.reduce((x,w)=>x+w,0)/a/1e3),y=ef.filter(x=>x>N0).reduce((x,w)=>x+(w-N0)/N0,0);return{loadTime:s,fullLoadTime:n,fps:d,percentDroppedFrames:y/(a+y)*100,totalFrames:a}}};g.$=class extends F{},g.A=Oc,g.B=Y_,g.C=function(s){if(vt==null){const n=s.navigator?s.navigator.userAgent:null;vt=!!s.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return vt},g.D=It,g.E=je,g.F=class{constructor(s,n){this.target=s,this.mapId=n,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Z3(()=>this.process()),this.subscription=function(a,d,y,x){return a.addEventListener(d,y,!1),{unsubscribe:()=>{a.removeEventListener(d,y,!1)}}}(this.target,"message",a=>this.receive(a)),this.globalScope=Re(self)?s:window}registerMessageHandler(s,n){this.messageHandlers[s]=n}sendAsync(s,n){return new Promise((a,d)=>{const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:a,reject:d},n&&n.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];const b={id:y,type:"",origin:location.origin,targetMapId:s.targetMapId,sourceMapId:this.mapId};this.target.postMessage(b)},{once:!0});const x=[],w=Object.assign(Object.assign({},s),{id:y,sourceMapId:this.mapId,origin:location.origin,data:tl(s.data,x)});this.target.postMessage(w,{transfer:x})})}receive(s){const n=s.data,a=n.id;if(!(n.origin!=="file://"&&location.origin!=="file://"&&n.origin!=="resource://android"&&location.origin!=="resource://android"&&n.origin!==location.origin||n.targetMapId&&this.mapId!==n.targetMapId)){if(n.type===""){delete this.tasks[a];const d=this.abortControllers[a];return delete this.abortControllers[a],void(d&&d.abort())}if(Re(self)||n.mustQueue)return this.tasks[a]=n,this.taskQueue.push(a),void this.invoker.trigger();this.processTask(a,n)}}process(){if(this.taskQueue.length===0)return;const s=this.taskQueue.shift(),n=this.tasks[s];delete this.tasks[s],this.taskQueue.length>0&&this.invoker.trigger(),n&&this.processTask(s,n)}processTask(s,n){return c(this,void 0,void 0,function*(){if(n.type===""){const y=this.resolveRejects[s];return delete this.resolveRejects[s],y?void(n.error?y.reject(rl(n.error)):y.resolve(rl(n.data))):void 0}if(!this.messageHandlers[n.type])return void this.completeTask(s,new Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const a=rl(n.data),d=new AbortController;this.abortControllers[s]=d;try{const y=yield this.messageHandlers[n.type](n.sourceMapId,a,d);this.completeTask(s,null,y)}catch(y){this.completeTask(s,y)}})}completeTask(s,n,a){const d=[];delete this.abortControllers[s];const y={id:s,type:"",sourceMapId:this.mapId,origin:location.origin,error:n?tl(n):null,data:tl(a,d)};this.target.postMessage(y,{transfer:d})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},g.G=Jt,g.H=function(){var s=new Oc(16);return Oc!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},g.I=b0,g.J=function(s,n,a){var d,y,x,w,b,k,I,D,L,U,Z,K,J=a[0],le=a[1],fe=a[2];return n===s?(s[12]=n[0]*J+n[4]*le+n[8]*fe+n[12],s[13]=n[1]*J+n[5]*le+n[9]*fe+n[13],s[14]=n[2]*J+n[6]*le+n[10]*fe+n[14],s[15]=n[3]*J+n[7]*le+n[11]*fe+n[15]):(y=n[1],x=n[2],w=n[3],b=n[4],k=n[5],I=n[6],D=n[7],L=n[8],U=n[9],Z=n[10],K=n[11],s[0]=d=n[0],s[1]=y,s[2]=x,s[3]=w,s[4]=b,s[5]=k,s[6]=I,s[7]=D,s[8]=L,s[9]=U,s[10]=Z,s[11]=K,s[12]=d*J+b*le+L*fe+n[12],s[13]=y*J+k*le+U*fe+n[13],s[14]=x*J+I*le+Z*fe+n[14],s[15]=w*J+D*le+K*fe+n[15]),s},g.K=function(s,n,a){var d=a[0],y=a[1],x=a[2];return s[0]=n[0]*d,s[1]=n[1]*d,s[2]=n[2]*d,s[3]=n[3]*d,s[4]=n[4]*y,s[5]=n[5]*y,s[6]=n[6]*y,s[7]=n[7]*y,s[8]=n[8]*x,s[9]=n[9]*x,s[10]=n[10]*x,s[11]=n[11]*x,s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15],s},g.L=Ib,g.M=function(s,n){const a={};for(let d=0;d{const n=window.document.createElement("video");return n.muted=!0,new Promise(a=>{n.onloadstart=()=>{a(n)};for(const d of s){const y=window.document.createElement("source");_r(d)||(n.crossOrigin="Anonymous"),y.src=d,n.appendChild(y)}})},g.a4=function(){return Fe++},g.a5=_t,g.a6=jc,g.a7=yd,g.a8=mu,g.a9=M2,g.aA=function(s){if(s.type==="custom")return new G3(s);switch(s.type){case"background":return new V3(s);case"circle":return new MA(s);case"fill":return new ZA(s);case"fill-extrusion":return new l3(s);case"heatmap":return new DA(s);case"hillshade":return new RA(s);case"line":return new g3(s);case"raster":return new W3(s);case"symbol":return new Tm(s)}},g.aB=it,g.aC=function(s,n){if(!s)return[{command:"setStyle",args:[n]}];let a=[];try{if(!Te(s.version,n.version))return[{command:"setStyle",args:[n]}];Te(s.center,n.center)||a.push({command:"setCenter",args:[n.center]}),Te(s.zoom,n.zoom)||a.push({command:"setZoom",args:[n.zoom]}),Te(s.bearing,n.bearing)||a.push({command:"setBearing",args:[n.bearing]}),Te(s.pitch,n.pitch)||a.push({command:"setPitch",args:[n.pitch]}),Te(s.sprite,n.sprite)||a.push({command:"setSprite",args:[n.sprite]}),Te(s.glyphs,n.glyphs)||a.push({command:"setGlyphs",args:[n.glyphs]}),Te(s.transition,n.transition)||a.push({command:"setTransition",args:[n.transition]}),Te(s.light,n.light)||a.push({command:"setLight",args:[n.light]}),Te(s.terrain,n.terrain)||a.push({command:"setTerrain",args:[n.terrain]}),Te(s.sky,n.sky)||a.push({command:"setSky",args:[n.sky]}),Te(s.projection,n.projection)||a.push({command:"setProjection",args:[n.projection]});const d={},y=[];(function(w,b,k,I){let D;for(D in b=b||{},w=w||{})Object.prototype.hasOwnProperty.call(w,D)&&(Object.prototype.hasOwnProperty.call(b,D)||Ne(D,k,I));for(D in b)Object.prototype.hasOwnProperty.call(b,D)&&(Object.prototype.hasOwnProperty.call(w,D)?Te(w[D],b[D])||(w[D].type==="geojson"&&b[D].type==="geojson"&&kt(w,b,D)?Ge(k,{command:"setGeoJSONSourceData",args:[D,b[D].data]}):ot(D,b,k,I)):tt(D,b,k))})(s.sources,n.sources,y,d);const x=[];s.layers&&s.layers.forEach(w=>{"source"in w&&d[w.source]?a.push({command:"removeLayer",args:[w.id]}):x.push(w)}),a=a.concat(y),function(w,b,k){b=b||[];const I=(w=w||[]).map(Bt),D=b.map(Bt),L=w.reduce(Tr,{}),U=b.reduce(Tr,{}),Z=I.slice(),K=Object.create(null);let J,le,fe,De,be;for(let Me=0,Ve=0;Me@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(a,d,y,x)=>{const w=y||x;return n[d]=!w||w.toLowerCase(),""}),n["max-age"]){const a=parseInt(n["max-age"],10);isNaN(a)?delete n["max-age"]:n["max-age"]=a}return n},g.ab=function(s,n){const a=[];for(const d in s)d in n||a.push(d);return a},g.ac=oe,g.ad=function(s,n,a){var d=Math.sin(a),y=Math.cos(a),x=n[0],w=n[1],b=n[2],k=n[3],I=n[4],D=n[5],L=n[6],U=n[7];return n!==s&&(s[8]=n[8],s[9]=n[9],s[10]=n[10],s[11]=n[11],s[12]=n[12],s[13]=n[13],s[14]=n[14],s[15]=n[15]),s[0]=x*y+I*d,s[1]=w*y+D*d,s[2]=b*y+L*d,s[3]=k*y+U*d,s[4]=I*y-x*d,s[5]=D*y-w*d,s[6]=L*y-b*d,s[7]=U*y-k*d,s},g.ae=function(s){var n=new Oc(16);return n[0]=s[0],n[1]=s[1],n[2]=s[2],n[3]=s[3],n[4]=s[4],n[5]=s[5],n[6]=s[6],n[7]=s[7],n[8]=s[8],n[9]=s[9],n[10]=s[10],n[11]=s[11],n[12]=s[12],n[13]=s[13],n[14]=s[14],n[15]=s[15],n},g.af=gm,g.ag=function(s,n){let a=0,d=0;if(s.kind==="constant")d=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:y,minZoom:x,maxZoom:w}=s,b=y?oe(yi.interpolationFactor(y,n,x,w),0,1):0;s.kind==="camera"?d=gi.number(s.minSize,s.maxSize,b):a=b}return{uSizeT:a,uSize:d}},g.ai=function(s,{uSize:n,uSizeT:a},{lowerSize:d,upperSize:y}){return s.kind==="source"?d/zo:s.kind==="composite"?gi.number(d/zo,y/zo,a):n},g.aj=E0,g.ak=function(s,n,a,d){const y=n.y-s.y,x=n.x-s.x,w=d.y-a.y,b=d.x-a.x,k=w*x-b*y;if(k===0)return null;const I=(b*(s.y-a.y)-w*(s.x-a.x))/k;return new A(s.x+I*x,s.y+I*y)},g.al=R2,g.am=bb,g.an=a0,g.ao=function(s){let n=1/0,a=1/0,d=-1/0,y=-1/0;for(const x of s)n=Math.min(n,x.x),a=Math.min(a,x.y),d=Math.max(d,x.x),y=Math.max(y,x.y);return[n,a,d,y]},g.ap=Pn,g.ar=T0,g.as=function(s,n){var a=n[0],d=n[1],y=n[2],x=n[3],w=n[4],b=n[5],k=n[6],I=n[7],D=n[8],L=n[9],U=n[10],Z=n[11],K=n[12],J=n[13],le=n[14],fe=n[15],De=a*b-d*w,be=a*k-y*w,Me=a*I-x*w,Ve=d*k-y*b,et=d*I-x*b,xt=y*I-x*k,Nt=D*J-L*K,yt=D*le-U*K,pt=D*fe-Z*K,At=L*le-U*J,Tt=L*fe-Z*J,bt=U*fe-Z*le,qe=De*bt-be*Tt+Me*At+Ve*pt-et*yt+xt*Nt;return qe?(s[0]=(b*bt-k*Tt+I*At)*(qe=1/qe),s[1]=(y*Tt-d*bt-x*At)*qe,s[2]=(J*xt-le*et+fe*Ve)*qe,s[3]=(U*et-L*xt-Z*Ve)*qe,s[4]=(k*pt-w*bt-I*yt)*qe,s[5]=(a*bt-y*pt+x*yt)*qe,s[6]=(le*Me-K*xt-fe*be)*qe,s[7]=(D*xt-U*Me+Z*be)*qe,s[8]=(w*Tt-b*pt+I*Nt)*qe,s[9]=(d*pt-a*Tt-x*Nt)*qe,s[10]=(K*et-J*Me+fe*De)*qe,s[11]=(L*Me-D*et-Z*De)*qe,s[12]=(b*yt-w*At-k*Nt)*qe,s[13]=(a*At-d*yt+y*Nt)*qe,s[14]=(J*be-K*Ve-le*De)*qe,s[15]=(D*Ve-L*be+U*De)*qe,s):null},g.at=R0,g.au=k0,g.av=L0,g.aw=function(){const s={},n=ie.$version;for(const a in ie.$root){const d=ie.$root[a];if(d.required){let y=null;y=a==="version"?n:d.type==="array"?[]:{},y!=null&&(s[a]=y)}}return s},g.ax=Ad,g.ay=Vt,g.az=function(s){s=s.slice();const n=Object.create(null);for(let a=0;a25||d<0||d>=1||a<0||a>=1)},g.bc=function(s,n){return s[0]=n[0],s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n[1],s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=n[2],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s},g.bd=class extends z{},g.be=M0,g.bf=rD,g.bh=er,g.bi=function(s,n){nt.REGISTERED_PROTOCOLS[s]=n},g.bj=function(s){delete nt.REGISTERED_PROTOCOLS[s]},g.bk=function(s,n){const a={};for(let y=0;ybt*Pn)}let yt=w?"center":a.get("text-justify").evaluate(I,{},s.canonical);const pt=a.get("symbol-placement")==="point"?a.get("text-max-width").evaluate(I,{},s.canonical)*Pn:1/0,At=()=>{s.bucket.allowVerticalPlacement&&Dd(Me)&&(K.vertical=bm(J,s.glyphMap,s.glyphPositions,s.imagePositions,D,pt,x,xt,"left",et,fe,g.ah.vertical,!0,U,L))};if(!w&&Nt){const Tt=new Set;if(yt==="auto")for(let qe=0;qec(void 0,void 0,void 0,function*(){if(s.byteLength===0)return createImageBitmap(new ImageData(1,1));const n=new Blob([new Uint8Array(s)],{type:"image/png"});try{return createImageBitmap(n)}catch(a){throw new Error(`Could not load image because of ${a.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),g.e=ge,g.f=s=>new Promise((n,a)=>{const d=new Image;d.onload=()=>{n(d),URL.revokeObjectURL(d.src),d.onload=null,window.requestAnimationFrame(()=>{d.src=Be})},d.onerror=()=>a(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 y=new Blob([new Uint8Array(s)],{type:"image/png"});d.src=s.byteLength?URL.createObjectURL(y):Be}),g.g=rt,g.h=(s,n)=>Yt(ge(s,{type:"json"}),n),g.i=Re,g.j=V,g.k=Xr,g.l=(s,n)=>Yt(ge(s,{type:"arrayBuffer"}),n),g.m=Yt,g.n=function(s){return new x0(s).readFields(A3,[])},g.o=Ud,g.p=a2,g.q=v,g.r=q_,g.s=_r,g.t=Pd,g.u=la,g.v=ie,g.w=Ue,g.x=function([s,n,a]){return n+=90,n*=Math.PI/180,a*=Math.PI/180,{x:s*Math.cos(n)*Math.sin(a),y:s*Math.sin(n)*Math.sin(a),z:s*Math.cos(a)}},g.y=gi,g.z=Vr}),h("worker",["./shared"],function(g){class c{constructor(G){this.keyCache={},G&&this.replace(G)}replace(G){this._layerConfigs={},this._layers={},this.update(G,[])}update(G,W){for(const ue of G){this._layerConfigs[ue.id]=ue;const Se=this._layers[ue.id]=g.aA(ue);Se._featureFilter=g.a7(Se.filter),this.keyCache[ue.id]&&delete this.keyCache[ue.id]}for(const ue of W)delete this.keyCache[ue],delete this._layerConfigs[ue],delete this._layers[ue];this.familiesBySource={};const ee=g.bk(Object.values(this._layerConfigs),this.keyCache);for(const ue of ee){const Se=ue.map($e=>this._layers[$e.id]),Ie=Se[0];if(Ie.visibility==="none")continue;const Ae=Ie.source||"";let _e=this.familiesBySource[Ae];_e||(_e=this.familiesBySource[Ae]={});const He=Ie.sourceLayer||"_geojsonTileLayer";let Je=_e[He];Je||(Je=_e[He]=[]),Je.push(Se)}}}class T{constructor(G){const W={},ee=[];for(const Ae in G){const _e=G[Ae],He=W[Ae]={};for(const Je in _e){const $e=_e[+Je];if(!$e||$e.bitmap.width===0||$e.bitmap.height===0)continue;const ut={x:0,y:0,w:$e.bitmap.width+2,h:$e.bitmap.height+2};ee.push(ut),He[Je]={rect:ut,metrics:$e.metrics}}}const{w:ue,h:Se}=g.p(ee),Ie=new g.o({width:ue||1,height:Se||1});for(const Ae in G){const _e=G[Ae];for(const He in _e){const Je=_e[+He];if(!Je||Je.bitmap.width===0||Je.bitmap.height===0)continue;const $e=W[Ae][He].rect;g.o.copy(Je.bitmap,Ie,{x:0,y:0},{x:$e.x+1,y:$e.y+1},Je.bitmap)}}this.image=Ie,this.positions=W}}g.bl("GlyphAtlas",T);class P{constructor(G){this.tileID=new g.S(G.tileID.overscaledZ,G.tileID.wrap,G.tileID.canonical.z,G.tileID.canonical.x,G.tileID.canonical.y),this.uid=G.uid,this.zoom=G.zoom,this.pixelRatio=G.pixelRatio,this.tileSize=G.tileSize,this.source=G.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=G.showCollisionBoxes,this.collectResourceTiming=!!G.collectResourceTiming,this.returnDependencies=!!G.returnDependencies,this.promoteId=G.promoteId,this.inFlightDependencies=[]}parse(G,W,ee,ue){return g._(this,void 0,void 0,function*(){this.status="parsing",this.data=G,this.collisionBoxArray=new g.a5;const Se=new g.bm(Object.keys(G.layers).sort()),Ie=new g.bn(this.tileID,this.promoteId);Ie.bucketLayerIDs=[];const Ae={},_e={featureIndex:Ie,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ee},He=W.familiesBySource[this.source];for(const rr in He){const Mr=G.layers[rr];if(!Mr)continue;Mr.version===1&&g.w(`Vector tile source "${this.source}" layer "${rr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Yr=Se.encode(rr),Dn=[];for(let Bn=0;Bn=ni.maxzoom||ni.visibility!=="none"&&(R(Bn,this.zoom,ee),(Ae[ni.id]=ni.createBucket({index:Ie.bucketLayerIDs.length,layers:Bn,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Yr,sourceID:this.source})).populate(Dn,_e,this.tileID.canonical),Ie.bucketLayerIDs.push(Bn.map(Fa=>Fa.id)))}}const Je=g.aF(_e.glyphDependencies,rr=>Object.keys(rr).map(Number));this.inFlightDependencies.forEach(rr=>rr==null?void 0:rr.abort()),this.inFlightDependencies=[];let $e=Promise.resolve({});if(Object.keys(Je).length){const rr=new AbortController;this.inFlightDependencies.push(rr),$e=ue.sendAsync({type:"GG",data:{stacks:Je,source:this.source,tileID:this.tileID,type:"glyphs"}},rr)}const ut=Object.keys(_e.iconDependencies);let Rt=Promise.resolve({});if(ut.length){const rr=new AbortController;this.inFlightDependencies.push(rr),Rt=ue.sendAsync({type:"GI",data:{icons:ut,source:this.source,tileID:this.tileID,type:"icons"}},rr)}const Ot=Object.keys(_e.patternDependencies);let mr=Promise.resolve({});if(Ot.length){const rr=new AbortController;this.inFlightDependencies.push(rr),mr=ue.sendAsync({type:"GI",data:{icons:Ot,source:this.source,tileID:this.tileID,type:"patterns"}},rr)}const[Qt,gr,or]=yield Promise.all([$e,Rt,mr]),Tn=new T(Qt),rn=new g.bo(gr,or);for(const rr in Ae){const Mr=Ae[rr];Mr instanceof g.a6?(R(Mr.layers,this.zoom,ee),g.bp({bucket:Mr,glyphMap:Qt,glyphPositions:Tn.positions,imageMap:gr,imagePositions:rn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Mr.hasPattern&&(Mr instanceof g.bq||Mr instanceof g.br||Mr instanceof g.bs)&&(R(Mr.layers,this.zoom,ee),Mr.addFeatures(_e,this.tileID.canonical,rn.patternPositions))}return this.status="done",{buckets:Object.values(Ae).filter(rr=>!rr.isEmpty()),featureIndex:Ie,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Tn.image,imageAtlas:rn,glyphMap:this.returnDependencies?Qt:null,iconMap:this.returnDependencies?gr:null,glyphPositions:this.returnDependencies?Tn.positions:null}})}}function R(he,G,W){const ee=new g.z(G);for(const ue of he)ue.recalculate(ee,W)}class A{constructor(G,W,ee){this.actor=G,this.layerIndex=W,this.availableImages=ee,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(G,W){return g._(this,void 0,void 0,function*(){const ee=yield g.l(G.request,W);try{return{vectorTile:new g.bt.VectorTile(new g.bu(ee.data)),rawData:ee.data,cacheControl:ee.cacheControl,expires:ee.expires}}catch(ue){const Se=new Uint8Array(ee.data);let Ie=`Unable to parse the tile at ${G.request.url}, `;throw Ie+=Se[0]===31&&Se[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ue.message}`,new Error(Ie)}})}loadTile(G){return g._(this,void 0,void 0,function*(){const W=G.uid,ee=!!(G&&G.request&&G.request.collectResourceTiming)&&new g.bv(G.request),ue=new P(G);this.loading[W]=ue;const Se=new AbortController;ue.abort=Se;try{const Ie=yield this.loadVectorTile(G,Se);if(delete this.loading[W],!Ie)return null;const Ae=Ie.rawData,_e={};Ie.expires&&(_e.expires=Ie.expires),Ie.cacheControl&&(_e.cacheControl=Ie.cacheControl);const He={};if(ee){const $e=ee.finish();$e&&(He.resourceTiming=JSON.parse(JSON.stringify($e)))}ue.vectorTile=Ie.vectorTile;const Je=ue.parse(Ie.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[W]=ue,this.fetching[W]={rawTileData:Ae,cacheControl:_e,resourceTiming:He};try{const $e=yield Je;return g.e({rawTileData:Ae.slice(0)},$e,_e,He)}finally{delete this.fetching[W]}}catch(Ie){throw delete this.loading[W],ue.status="done",this.loaded[W]=ue,Ie}})}reloadTile(G){return g._(this,void 0,void 0,function*(){const W=G.uid;if(!this.loaded||!this.loaded[W])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const ee=this.loaded[W];if(ee.showCollisionBoxes=G.showCollisionBoxes,ee.status==="parsing"){const ue=yield ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor);let Se;if(this.fetching[W]){const{rawTileData:Ie,cacheControl:Ae,resourceTiming:_e}=this.fetching[W];delete this.fetching[W],Se=g.e({rawTileData:Ie.slice(0)},ue,Ae,_e)}else Se=ue;return Se}if(ee.status==="done"&&ee.vectorTile)return ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(G){return g._(this,void 0,void 0,function*(){const W=this.loading,ee=G.uid;W&&W[ee]&&W[ee].abort&&(W[ee].abort.abort(),delete W[ee])})}removeTile(G){return g._(this,void 0,void 0,function*(){this.loaded&&this.loaded[G.uid]&&delete this.loaded[G.uid]})}}class M{constructor(){this.loaded={}}loadTile(G){return g._(this,void 0,void 0,function*(){const{uid:W,encoding:ee,rawImageData:ue,redFactor:Se,greenFactor:Ie,blueFactor:Ae,baseShift:_e}=G,He=ue.width+2,Je=ue.height+2,$e=g.b(ue)?new g.R({width:He,height:Je},yield g.bw(ue,-1,-1,He,Je)):ue,ut=new g.bx(W,$e,ee,Se,Ie,Ae,_e);return this.loaded=this.loaded||{},this.loaded[W]=ut,ut})}removeTile(G){const W=this.loaded,ee=G.uid;W&&W[ee]&&delete W[ee]}}function N(he,G){if(he.length!==0){Y(he[0],G);for(var W=1;W=Math.abs(Ae)?W-_e+Ae:Ae-_e+W,W=_e}W+ee>=0!=!!G&&he.reverse()}var j=g.by(function he(G,W){var ee,ue=G&&G.type;if(ue==="FeatureCollection")for(ee=0;ee>31}function Re(he,G){for(var W=he.loadGeometry(),ee=he.type,ue=0,Se=0,Ie=W.length,Ae=0;Aehe},Le=Math.fround||(Xe=new Float32Array(1),he=>(Xe[0]=+he,Xe[0]));var Xe;const xe=3,Ee=5,mt=6;class nt{constructor(G){this.options=Object.assign(Object.create(Be),G),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(G){const{log:W,minZoom:ee,maxZoom:ue}=this.options;W&&console.time("total time");const Se=`prepare ${G.length} points`;W&&console.time(Se),this.points=G;const Ie=[];for(let _e=0;_e=ee;_e--){const He=+Date.now();Ae=this.trees[_e]=this._createTree(this._cluster(Ae,_e)),W&&console.log("z%d: %d clusters in %dms",_e,Ae.numItems,+Date.now()-He)}return W&&console.timeEnd("total time"),this}getClusters(G,W){let ee=((G[0]+180)%360+360)%360-180;const ue=Math.max(-90,Math.min(90,G[1]));let Se=G[2]===180?180:((G[2]+180)%360+360)%360-180;const Ie=Math.max(-90,Math.min(90,G[3]));if(G[2]-G[0]>=360)ee=-180,Se=180;else if(ee>Se){const $e=this.getClusters([ee,ue,180,Ie],W),ut=this.getClusters([-180,ue,Se,Ie],W);return $e.concat(ut)}const Ae=this.trees[this._limitZoom(W)],_e=Ae.range(er(ee),Vt(Ie),er(Se),Vt(ue)),He=Ae.data,Je=[];for(const $e of _e){const ut=this.stride*$e;Je.push(He[ut+Ee]>1?rt(He,ut,this.clusterProps):this.points[He[ut+xe]])}return Je}getChildren(G){const W=this._getOriginId(G),ee=this._getOriginZoom(G),ue="No cluster with the specified id.",Se=this.trees[ee];if(!Se)throw new Error(ue);const Ie=Se.data;if(W*this.stride>=Ie.length)throw new Error(ue);const Ae=this.options.radius/(this.options.extent*Math.pow(2,ee-1)),_e=Se.within(Ie[W*this.stride],Ie[W*this.stride+1],Ae),He=[];for(const Je of _e){const $e=Je*this.stride;Ie[$e+4]===G&&He.push(Ie[$e+Ee]>1?rt(Ie,$e,this.clusterProps):this.points[Ie[$e+xe]])}if(He.length===0)throw new Error(ue);return He}getLeaves(G,W,ee){const ue=[];return this._appendLeaves(ue,G,W=W||10,ee=ee||0,0),ue}getTile(G,W,ee){const ue=this.trees[this._limitZoom(G)],Se=Math.pow(2,G),{extent:Ie,radius:Ae}=this.options,_e=Ae/Ie,He=(ee-_e)/Se,Je=(ee+1+_e)/Se,$e={features:[]};return this._addTileFeatures(ue.range((W-_e)/Se,He,(W+1+_e)/Se,Je),ue.data,W,ee,Se,$e),W===0&&this._addTileFeatures(ue.range(1-_e/Se,He,1,Je),ue.data,Se,ee,Se,$e),W===Se-1&&this._addTileFeatures(ue.range(0,He,_e/Se,Je),ue.data,-1,ee,Se,$e),$e.features.length?$e:null}getClusterExpansionZoom(G){let W=this._getOriginZoom(G)-1;for(;W<=this.options.maxZoom;){const ee=this.getChildren(G);if(W++,ee.length!==1)break;G=ee[0].properties.cluster_id}return W}_appendLeaves(G,W,ee,ue,Se){const Ie=this.getChildren(W);for(const Ae of Ie){const _e=Ae.properties;if(_e&&_e.cluster?Se+_e.point_count<=ue?Se+=_e.point_count:Se=this._appendLeaves(G,_e.cluster_id,ee,ue,Se):Se1;let Je,$e,ut;if(He)Je=Jt(W,_e,this.clusterProps),$e=W[_e],ut=W[_e+1];else{const mr=this.points[W[_e+xe]];Je=mr.properties;const[Qt,gr]=mr.geometry.coordinates;$e=er(Qt),ut=Vt(gr)}const Rt={type:1,geometry:[[Math.round(this.options.extent*($e*Se-ee)),Math.round(this.options.extent*(ut*Se-ue))]],tags:Je};let Ot;Ot=He||this.options.generateId?W[_e+xe]:this.points[W[_e+xe]].id,Ot!==void 0&&(Rt.id=Ot),Ie.features.push(Rt)}}_limitZoom(G){return Math.max(this.options.minZoom,Math.min(Math.floor(+G),this.options.maxZoom+1))}_cluster(G,W){const{radius:ee,extent:ue,reduce:Se,minPoints:Ie}=this.options,Ae=ee/(ue*Math.pow(2,W)),_e=G.data,He=[],Je=this.stride;for(let $e=0;$e<_e.length;$e+=Je){if(_e[$e+2]<=W)continue;_e[$e+2]=W;const ut=_e[$e],Rt=_e[$e+1],Ot=G.within(_e[$e],_e[$e+1],Ae),mr=_e[$e+Ee];let Qt=mr;for(const gr of Ot){const or=gr*Je;_e[or+2]>W&&(Qt+=_e[or+Ee])}if(Qt>mr&&Qt>=Ie){let gr,or=ut*mr,Tn=Rt*mr,rn=-1;const rr=(($e/Je|0)<<5)+(W+1)+this.points.length;for(const Mr of Ot){const Yr=Mr*Je;if(_e[Yr+2]<=W)continue;_e[Yr+2]=W;const Dn=_e[Yr+Ee];or+=_e[Yr]*Dn,Tn+=_e[Yr+1]*Dn,_e[Yr+4]=rr,Se&&(gr||(gr=this._map(_e,$e,!0),rn=this.clusterProps.length,this.clusterProps.push(gr)),Se(gr,this._map(_e,Yr)))}_e[$e+4]=rr,He.push(or/Qt,Tn/Qt,1/0,rr,-1,Qt),Se&&He.push(rn)}else{for(let gr=0;gr1)for(const gr of Ot){const or=gr*Je;if(!(_e[or+2]<=W)){_e[or+2]=W;for(let Tn=0;Tn>5}_getOriginZoom(G){return(G-this.points.length)%32}_map(G,W,ee){if(G[W+Ee]>1){const Ie=this.clusterProps[G[W+mt]];return ee?Object.assign({},Ie):Ie}const ue=this.points[G[W+xe]].properties,Se=this.options.map(ue);return ee&&Se===ue?Object.assign({},Se):Se}}function rt(he,G,W){return{type:"Feature",id:he[G+xe],properties:Jt(he,G,W),geometry:{type:"Point",coordinates:[(ee=he[G],360*(ee-.5)),Yt(he[G+1])]}};var ee}function Jt(he,G,W){const ee=he[G+Ee],ue=ee>=1e4?`${Math.round(ee/1e3)}k`:ee>=1e3?Math.round(ee/100)/10+"k":ee,Se=he[G+mt],Ie=Se===-1?{}:Object.assign({},W[Se]);return Object.assign(Ie,{cluster:!0,cluster_id:he[G+xe],point_count:ee,point_count_abbreviated:ue})}function er(he){return he/360+.5}function Vt(he){const G=Math.sin(he*Math.PI/180),W=.5-.25*Math.log((1+G)/(1-G))/Math.PI;return W<0?0:W>1?1:W}function Yt(he){const G=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(G))/Math.PI-90}function _r(he,G,W,ee){let ue=ee;const Se=G+(W-G>>1);let Ie,Ae=W-G;const _e=he[G],He=he[G+1],Je=he[W],$e=he[W+1];for(let ut=G+3;utue)Ie=ut,ue=Rt;else if(Rt===ue){const Ot=Math.abs(ut-Se);Otee&&(Ie-G>3&&_r(he,G,Ie,ee),he[Ie+2]=ue,W-Ie>3&&_r(he,Ie,W,ee))}function fr(he,G,W,ee,ue,Se){let Ie=ue-W,Ae=Se-ee;if(Ie!==0||Ae!==0){const _e=((he-W)*Ie+(G-ee)*Ae)/(Ie*Ie+Ae*Ae);_e>1?(W=ue,ee=Se):_e>0&&(W+=Ie*_e,ee+=Ae*_e)}return Ie=he-W,Ae=G-ee,Ie*Ie+Ae*Ae}function br(he,G,W,ee){const ue={id:he??null,type:G,geometry:W,tags:ee,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(G==="Point"||G==="MultiPoint"||G==="LineString")Xr(ue,W);else if(G==="Polygon")Xr(ue,W[0]);else if(G==="MultiLineString")for(const Se of W)Xr(ue,Se);else if(G==="MultiPolygon")for(const Se of W)Xr(ue,Se[0]);return ue}function Xr(he,G){for(let W=0;W0&&(Ie+=ee?(ue*Je-He*Se)/2:Math.sqrt(Math.pow(He-ue,2)+Math.pow(Je-Se,2))),ue=He,Se=Je}const Ae=G.length-3;G[2]=1,_r(G,0,Ae,W),G[Ae+2]=1,G.size=Math.abs(Ie),G.start=0,G.end=G.size}function de(he,G,W,ee){for(let ue=0;ue1?1:W}function Ge(he,G,W,ee,ue,Se,Ie,Ae){if(ee/=G,Se>=(W/=G)&&Ie=ee)return null;const _e=[];for(const He of he){const Je=He.geometry;let $e=He.type;const ut=ue===0?He.minX:He.minY,Rt=ue===0?He.maxX:He.maxY;if(ut>=W&&Rt=ee)continue;let Ot=[];if($e==="Point"||$e==="MultiPoint")tt(Je,Ot,W,ee,ue);else if($e==="LineString")Ne(Je,Ot,W,ee,ue,!1,Ae.lineMetrics);else if($e==="MultiLineString")kt(Je,Ot,W,ee,ue,!1);else if($e==="Polygon")kt(Je,Ot,W,ee,ue,!0);else if($e==="MultiPolygon")for(const mr of Je){const Qt=[];kt(mr,Qt,W,ee,ue,!0),Qt.length&&Ot.push(Qt)}if(Ot.length){if(Ae.lineMetrics&&$e==="LineString"){for(const mr of Ot)_e.push(br(He.id,$e,mr,He.tags));continue}$e!=="LineString"&&$e!=="MultiLineString"||(Ot.length===1?($e="LineString",Ot=Ot[0]):$e="MultiLineString"),$e!=="Point"&&$e!=="MultiPoint"||($e=Ot.length===3?"Point":"MultiPoint"),_e.push(br(He.id,$e,Ot,He.tags))}}return _e.length?_e:null}function tt(he,G,W,ee,ue){for(let Se=0;Se=W&&Ie<=ee&&at(G,he[Se],he[Se+1],he[Se+2])}}function Ne(he,G,W,ee,ue,Se,Ie){let Ae=ot(he);const _e=ue===0?Bt:Tr;let He,Je,$e=he.start;for(let Qt=0;QtW&&(Je=_e(Ae,gr,or,rn,rr,W),Ie&&(Ae.start=$e+He*Je)):Mr>ee?Yr=W&&(Je=_e(Ae,gr,or,rn,rr,W),Dn=!0),Yr>ee&&Mr<=ee&&(Je=_e(Ae,gr,or,rn,rr,ee),Dn=!0),!Se&&Dn&&(Ie&&(Ae.end=$e+He*Je),G.push(Ae),Ae=ot(he)),Ie&&($e+=He)}let ut=he.length-3;const Rt=he[ut],Ot=he[ut+1],mr=ue===0?Rt:Ot;mr>=W&&mr<=ee&&at(Ae,Rt,Ot,he[ut+2]),ut=Ae.length-3,Se&&ut>=3&&(Ae[ut]!==Ae[0]||Ae[ut+1]!==Ae[1])&&at(Ae,Ae[0],Ae[1],Ae[2]),Ae.length&&G.push(Ae)}function ot(he){const G=[];return G.size=he.size,G.start=he.start,G.end=he.end,G}function kt(he,G,W,ee,ue,Se){for(const Ie of he)Ne(Ie,G,W,ee,ue,Se,!1)}function at(he,G,W,ee){he.push(G,W,ee)}function Bt(he,G,W,ee,ue,Se){const Ie=(Se-G)/(ee-G);return at(he,Se,W+(ue-W)*Ie,1),Ie}function Tr(he,G,W,ee,ue,Se){const Ie=(Se-W)/(ue-W);return at(he,G+(ee-G)*Ie,Se,1),Ie}function Ze(he,G){const W=[];for(let ee=0;ee0&&G.size<(ue?Ie:ee))return void(W.numPoints+=G.length/3);const Ae=[];for(let _e=0;_eIe)&&(W.numSimplified++,Ae.push(G[_e],G[_e+1])),W.numPoints++;ue&&function(_e,He){let Je=0;for(let $e=0,ut=_e.length,Rt=ut-2;$e0===He)for(let $e=0,ut=_e.length;$e24)throw new Error("maxZoom should be in the 0-24 range");if(W.promoteId&&W.generateId)throw new Error("promoteId and generateId cannot be used together.");let ue=function(Se,Ie){const Ae=[];if(Se.type==="FeatureCollection")for(let _e=0;_e1&&console.time("creation"),Rt=this.tiles[ut]=pi(G,W,ee,ue,He),this.tileCoords.push({z:W,x:ee,y:ue}),Je)){Je>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",W,ee,ue,Rt.numFeatures,Rt.numPoints,Rt.numSimplified),console.timeEnd("creation"));const Dn=`z${W}`;this.stats[Dn]=(this.stats[Dn]||0)+1,this.total++}if(Rt.source=G,Se==null){if(W===He.indexMaxZoom||Rt.numPoints<=He.indexMaxPoints)continue}else{if(W===He.maxZoom||W===Se)continue;if(Se!=null){const Dn=Se-W;if(ee!==Ie>>Dn||ue!==Ae>>Dn)continue}}if(Rt.source=null,G.length===0)continue;Je>1&&console.time("clipping");const Ot=.5*He.buffer/He.extent,mr=.5-Ot,Qt=.5+Ot,gr=1+Ot;let or=null,Tn=null,rn=null,rr=null,Mr=Ge(G,$e,ee-Ot,ee+Qt,0,Rt.minX,Rt.maxX,He),Yr=Ge(G,$e,ee+mr,ee+gr,0,Rt.minX,Rt.maxX,He);G=null,Mr&&(or=Ge(Mr,$e,ue-Ot,ue+Qt,1,Rt.minY,Rt.maxY,He),Tn=Ge(Mr,$e,ue+mr,ue+gr,1,Rt.minY,Rt.maxY,He),Mr=null),Yr&&(rn=Ge(Yr,$e,ue-Ot,ue+Qt,1,Rt.minY,Rt.maxY,He),rr=Ge(Yr,$e,ue+mr,ue+gr,1,Rt.minY,Rt.maxY,He),Yr=null),Je>1&&console.timeEnd("clipping"),_e.push(or||[],W+1,2*ee,2*ue),_e.push(Tn||[],W+1,2*ee,2*ue+1),_e.push(rn||[],W+1,2*ee+1,2*ue),_e.push(rr||[],W+1,2*ee+1,2*ue+1)}}getTile(G,W,ee){G=+G,W=+W,ee=+ee;const ue=this.options,{extent:Se,debug:Ie}=ue;if(G<0||G>24)return null;const Ae=1<1&&console.log("drilling down to z%d-%d-%d",G,W,ee);let He,Je=G,$e=W,ut=ee;for(;!He&&Je>0;)Je--,$e>>=1,ut>>=1,He=this.tiles[mi(Je,$e,ut)];return He&&He.source?(Ie>1&&(console.log("found parent tile z%d-%d-%d",Je,$e,ut),console.time("drilling down")),this.splitTile(He.source,Je,$e,ut,G,W,ee),Ie>1&&console.timeEnd("drilling down"),this.tiles[_e]?_n(this.tiles[_e],Se):null):null}}function mi(he,G,W){return 32*((1<{$e.properties=Rt;const Ot={};for(const mr of ut)Ot[mr]=_e[mr].evaluate(Je,$e);return Ot},Ie.reduce=(Rt,Ot)=>{$e.properties=Ot;for(const mr of ut)Je.accumulated=Rt[mr],Rt[mr]=He[mr].evaluate(Je,$e)},Ie}(G)).load((yield this._pendingData).features):(ue=yield this._pendingData,new Kr(ue,G.geojsonVtOptions)),this.loaded={};const Se={};if(ee){const Ie=ee.finish();Ie&&(Se.resourceTiming={},Se.resourceTiming[G.source]=JSON.parse(JSON.stringify(Ie)))}return Se}catch(Se){if(delete this._pendingRequest,g.bB(Se))return{abandoned:!0};throw Se}var ue})}getData(){return g._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(G){const W=this.loaded;return W&&W[G.uid]?super.reloadTile(G):this.loadTile(G)}loadAndProcessGeoJSON(G,W){return g._(this,void 0,void 0,function*(){let ee=yield this.loadGeoJSON(G,W);if(delete this._pendingRequest,typeof ee!="object")throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`);if(j(ee,!0),G.filter){const ue=g.bC(G.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ue.result==="error")throw new Error(ue.value.map(Ie=>`${Ie.key}: ${Ie.message}`).join(", "));ee={type:"FeatureCollection",features:ee.features.filter(Ie=>ue.value.evaluate({zoom:0},Ie))}}return ee})}loadGeoJSON(G,W){return g._(this,void 0,void 0,function*(){const{promoteId:ee}=G;if(G.request){const ue=yield g.h(G.request,W);return this._dataUpdateable=Yi(ue.data,ee)?fs(ue.data,ee):void 0,ue.data}if(typeof G.data=="string")try{const ue=JSON.parse(G.data);return this._dataUpdateable=Yi(ue,ee)?fs(ue,ee):void 0,ue}catch{throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`)}if(!G.dataDiff)throw new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${G.source}`);return function(ue,Se,Ie){var Ae,_e,He,Je;if(Se.removeAll&&ue.clear(),Se.remove)for(const $e of Se.remove)ue.delete($e);if(Se.add)for(const $e of Se.add){const ut=Xt($e,Ie);ut!=null&&ue.set(ut,$e)}if(Se.update)for(const $e of Se.update){let ut=ue.get($e.id);if(ut==null)continue;const Rt=!$e.removeAllProperties&&(((Ae=$e.removeProperties)===null||Ae===void 0?void 0:Ae.length)>0||((_e=$e.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0);if(($e.newGeometry||$e.removeAllProperties||Rt)&&(ut=Object.assign({},ut),ue.set($e.id,ut),Rt&&(ut.properties=Object.assign({},ut.properties))),$e.newGeometry&&(ut.geometry=$e.newGeometry),$e.removeAllProperties)ut.properties={};else if(((He=$e.removeProperties)===null||He===void 0?void 0:He.length)>0)for(const Ot of $e.removeProperties)Object.prototype.hasOwnProperty.call(ut.properties,Ot)&&delete ut.properties[Ot];if(((Je=$e.addOrUpdateProperties)===null||Je===void 0?void 0:Je.length)>0)for(const{key:Ot,value:mr}of $e.addOrUpdateProperties)ut.properties[Ot]=mr}}(this._dataUpdateable,G.dataDiff,ee),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(G){return g._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(G){return this._geoJSONIndex.getClusterExpansionZoom(G.clusterId)}getClusterChildren(G){return this._geoJSONIndex.getChildren(G.clusterId)}getClusterLeaves(G){return this._geoJSONIndex.getLeaves(G.clusterId,G.limit,G.offset)}}class Hn{constructor(G){this.self=G,this.actor=new g.F(G),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(W,ee)=>{if(this.externalWorkerSourceTypes[W])throw new Error(`Worker source with name "${W}" already registered.`);this.externalWorkerSourceTypes[W]=ee},this.self.addProtocol=g.bi,this.self.removeProtocol=g.bj,this.self.registerRTLTextPlugin=W=>{if(g.bD.isParsed())throw new Error("RTL text plugin already registered.");g.bD.setMethods(W)},this.actor.registerMessageHandler("LDT",(W,ee)=>this._getDEMWorkerSource(W,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RDT",(W,ee)=>g._(this,void 0,void 0,function*(){this._getDEMWorkerSource(W,ee.source).removeTile(ee)})),this.actor.registerMessageHandler("GCEZ",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterExpansionZoom(ee)})),this.actor.registerMessageHandler("GCC",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterChildren(ee)})),this.actor.registerMessageHandler("GCL",(W,ee)=>g._(this,void 0,void 0,function*(){return this._getWorkerSource(W,ee.type,ee.source).getClusterLeaves(ee)})),this.actor.registerMessageHandler("LD",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).loadData(ee)),this.actor.registerMessageHandler("GD",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).getData()),this.actor.registerMessageHandler("LT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).loadTile(ee)),this.actor.registerMessageHandler("RT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).reloadTile(ee)),this.actor.registerMessageHandler("AT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).abortTile(ee)),this.actor.registerMessageHandler("RMT",(W,ee)=>this._getWorkerSource(W,ee.type,ee.source).removeTile(ee)),this.actor.registerMessageHandler("RS",(W,ee)=>g._(this,void 0,void 0,function*(){if(!this.workerSources[W]||!this.workerSources[W][ee.type]||!this.workerSources[W][ee.type][ee.source])return;const ue=this.workerSources[W][ee.type][ee.source];delete this.workerSources[W][ee.type][ee.source],ue.removeSource!==void 0&&ue.removeSource(ee)})),this.actor.registerMessageHandler("RM",W=>g._(this,void 0,void 0,function*(){delete this.layerIndexes[W],delete this.availableImages[W],delete this.workerSources[W],delete this.demWorkerSources[W]})),this.actor.registerMessageHandler("SR",(W,ee)=>g._(this,void 0,void 0,function*(){this.referrer=ee})),this.actor.registerMessageHandler("SRPS",(W,ee)=>this._syncRTLPluginState(W,ee)),this.actor.registerMessageHandler("IS",(W,ee)=>g._(this,void 0,void 0,function*(){this.self.importScripts(ee)})),this.actor.registerMessageHandler("SI",(W,ee)=>this._setImages(W,ee)),this.actor.registerMessageHandler("UL",(W,ee)=>g._(this,void 0,void 0,function*(){this._getLayerIndex(W).update(ee.layers,ee.removedIds)})),this.actor.registerMessageHandler("SL",(W,ee)=>g._(this,void 0,void 0,function*(){this._getLayerIndex(W).replace(ee)}))}_setImages(G,W){return g._(this,void 0,void 0,function*(){this.availableImages[G]=W;for(const ee in this.workerSources[G]){const ue=this.workerSources[G][ee];for(const Se in ue)ue[Se].availableImages=W}})}_syncRTLPluginState(G,W){return g._(this,void 0,void 0,function*(){if(g.bD.isParsed())return g.bD.getState();if(W.pluginStatus!=="loading")return g.bD.setState(W),W;const ee=W.pluginURL;if(this.self.importScripts(ee),g.bD.isParsed()){const ue={pluginStatus:"loaded",pluginURL:ee};return g.bD.setState(ue),ue}throw g.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${ee}`)})}_getAvailableImages(G){let W=this.availableImages[G];return W||(W=[]),W}_getLayerIndex(G){let W=this.layerIndexes[G];return W||(W=this.layerIndexes[G]=new c),W}_getWorkerSource(G,W,ee){if(this.workerSources[G]||(this.workerSources[G]={}),this.workerSources[G][W]||(this.workerSources[G][W]={}),!this.workerSources[G][W][ee]){const ue={sendAsync:(Se,Ie)=>(Se.targetMapId=G,this.actor.sendAsync(Se,Ie))};switch(W){case"vector":this.workerSources[G][W][ee]=new A(ue,this._getLayerIndex(G),this._getAvailableImages(G));break;case"geojson":this.workerSources[G][W][ee]=new ps(ue,this._getLayerIndex(G),this._getAvailableImages(G));break;default:this.workerSources[G][W][ee]=new this.externalWorkerSourceTypes[W](ue,this._getLayerIndex(G),this._getAvailableImages(G))}}return this.workerSources[G][W][ee]}_getDEMWorkerSource(G,W){return this.demWorkerSources[G]||(this.demWorkerSources[G]={}),this.demWorkerSources[G][W]||(this.demWorkerSources[G][W]=new M),this.demWorkerSources[G][W]}}return g.i(self)&&(self.worker=new Hn(self)),Hn}),h("index",["exports","./shared"],function(g,c){var T="4.7.1";let P,R;const A={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:v=>new Promise((r,u)=>{const p=requestAnimationFrame(r);v.signal.addEventListener("abort",()=>{cancelAnimationFrame(p),u(c.c())})}),getImageData(v,r=0){return this.getImageCanvasContext(v).getImageData(-r,-r,v.width+2*r,v.height+2*r)},getImageCanvasContext(v){const r=window.document.createElement("canvas"),u=r.getContext("2d",{willReadFrequently:!0});if(!u)throw new Error("failed to create canvas 2d context");return r.width=v.width,r.height=v.height,u.drawImage(v,0,0,v.width,v.height),u},resolveURL:v=>(P||(P=document.createElement("a")),P.href=v,P.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(R==null&&(R=matchMedia("(prefers-reduced-motion: reduce)")),R.matches)}};class M{static testProp(r){if(!M.docStyle)return r[0];for(let u=0;u{window.removeEventListener("click",M.suppressClickInternal,!0)},0)}static getScale(r){const u=r.getBoundingClientRect();return{x:u.width/r.offsetWidth||1,y:u.height/r.offsetHeight||1,boundingClientRect:u}}static getPoint(r,u,p){const m=u.boundingClientRect;return new c.P((p.clientX-m.left)/u.x-r.clientLeft,(p.clientY-m.top)/u.y-r.clientTop)}static mousePos(r,u){const p=M.getScale(r);return M.getPoint(r,p,u)}static touchPos(r,u){const p=[],m=M.getScale(r);for(let _=0;_{Y&&$(Y),Y=null,O=!0},j.onerror=()=>{te=!0,Y=null},j.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(v){let r,u,p,m;v.resetRequestQueue=()=>{r=[],u=0,p=0,m={}},v.addThrottleControl=C=>{const z=p++;return m[z]=C,z},v.removeThrottleControl=C=>{delete m[C],S()},v.getImage=(C,z,F=!0)=>new Promise((B,X)=>{N.supported&&(C.headers||(C.headers={}),C.headers.accept="image/webp,*/*"),c.e(C,{type:"image"}),r.push({abortController:z,requestParameters:C,supportImageRefresh:F,state:"queued",onError:Q=>{X(Q)},onSuccess:Q=>{B(Q)}}),S()});const _=C=>c._(this,void 0,void 0,function*(){C.state="running";const{requestParameters:z,supportImageRefresh:F,onError:B,onSuccess:X,abortController:Q}=C,re=F===!1&&!c.i(self)&&!c.g(z.url)&&(!z.headers||Object.keys(z.headers).reduce((me,we)=>me&&we==="accept",!0));u++;const ce=re?E(z,Q):c.m(z,Q);try{const me=yield ce;delete C.abortController,C.state="completed",me.data instanceof HTMLImageElement||c.b(me.data)?X(me):me.data&&X({data:yield(pe=me.data,typeof createImageBitmap=="function"?c.d(pe):c.f(pe)),cacheControl:me.cacheControl,expires:me.expires})}catch(me){delete C.abortController,B(me)}finally{u--,S()}var pe}),S=()=>{const C=(()=>{for(const z of Object.keys(m))if(m[z]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let z=u;z0;z++){const F=r.shift();F.abortController.signal.aborted?z--:_(F)}},E=(C,z)=>new Promise((F,B)=>{const X=new Image,Q=C.url,re=C.credentials;re&&re==="include"?X.crossOrigin="use-credentials":(re&&re==="same-origin"||!c.s(Q))&&(X.crossOrigin="anonymous"),z.signal.addEventListener("abort",()=>{X.src="",B(c.c())}),X.fetchPriority="high",X.onload=()=>{X.onerror=X.onload=null,F({data:X})},X.onerror=()=>{X.onerror=X.onload=null,z.signal.aborted||B(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."))},X.src=Q})}(q||(q={})),q.resetRequestQueue();class ne{constructor(r){this._transformRequestFn=r}transformRequest(r,u){return this._transformRequestFn&&this._transformRequestFn(r,u)||{url:r}}setTransformRequest(r){this._transformRequestFn=r}}function oe(v){var r=new c.A(3);return r[0]=v[0],r[1]=v[1],r[2]=v[2],r}var ke,ge=function(v,r,u){return v[0]=r[0]-u[0],v[1]=r[1]-u[1],v[2]=r[2]-u[2],v};ke=new c.A(3),c.A!=Float32Array&&(ke[0]=0,ke[1]=0,ke[2]=0);var Fe=function(v){var r=v[0],u=v[1];return r*r+u*u};function Oe(v){const r=[];if(typeof v=="string")r.push({id:"default",url:v});else if(v&&v.length>0){const u=[];for(const{id:p,url:m}of v){const _=`${p}${m}`;u.indexOf(_)===-1&&(u.push(_),r.push({id:p,url:m}))}}return r}function We(v,r,u){const p=v.split("?");return p[0]+=`${r}${u}`,p.join("?")}(function(){var v=new c.A(2);c.A!=Float32Array&&(v[0]=0,v[1]=0)})();class it{constructor(r,u,p,m){this.context=r,this.format=p,this.texture=r.gl.createTexture(),this.update(u,m)}update(r,u,p){const{width:m,height:_}=r,S=!(this.size&&this.size[0]===m&&this.size[1]===_||p),{context:E}=this,{gl:C}=E;if(this.useMipmap=!!(u&&u.useMipmap),C.bindTexture(C.TEXTURE_2D,this.texture),E.pixelStoreUnpackFlipY.set(!1),E.pixelStoreUnpack.set(1),E.pixelStoreUnpackPremultiplyAlpha.set(this.format===C.RGBA&&(!u||u.premultiply!==!1)),S)this.size=[m,_],r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||c.b(r)?C.texImage2D(C.TEXTURE_2D,0,this.format,this.format,C.UNSIGNED_BYTE,r):C.texImage2D(C.TEXTURE_2D,0,this.format,m,_,0,this.format,C.UNSIGNED_BYTE,r.data);else{const{x:z,y:F}=p||{x:0,y:0};r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||c.b(r)?C.texSubImage2D(C.TEXTURE_2D,0,z,F,C.RGBA,C.UNSIGNED_BYTE,r):C.texSubImage2D(C.TEXTURE_2D,0,z,F,m,_,C.RGBA,C.UNSIGNED_BYTE,r.data)}this.useMipmap&&this.isSizePowerOfTwo()&&C.generateMipmap(C.TEXTURE_2D)}bind(r,u,p){const{context:m}=this,{gl:_}=m;_.bindTexture(_.TEXTURE_2D,this.texture),p!==_.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(p=_.LINEAR),r!==this.filter&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MAG_FILTER,r),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,p||r),this.filter=r),u!==this.wrap&&(_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,u),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,u),this.wrap=u)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}}function ve(v){const{userImage:r}=v;return!!(r&&r.render&&r.render())&&(v.data.replace(new Uint8Array(r.data.buffer)),!0)}class Ue extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(r){if(this.loaded!==r&&(this.loaded=r,r)){for(const{ids:u,promiseResolve:p}of this.requestors)p(this._getImagesForIds(u));this.requestors=[]}}getImage(r){const u=this.images[r];if(u&&!u.data&&u.spriteData){const p=u.spriteData;u.data=new c.R({width:p.width,height:p.height},p.context.getImageData(p.x,p.y,p.width,p.height).data),u.spriteData=null}return u}addImage(r,u){if(this.images[r])throw new Error(`Image id ${r} already exist, use updateImage instead`);this._validate(r,u)&&(this.images[r]=u)}_validate(r,u){let p=!0;const m=u.data||u.spriteData;return this._validateStretch(u.stretchX,m&&m.width)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchX" value`))),p=!1),this._validateStretch(u.stretchY,m&&m.height)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "stretchY" value`))),p=!1),this._validateContent(u.content,u)||(this.fire(new c.j(new Error(`Image "${r}" has invalid "content" value`))),p=!1),p}_validateStretch(r,u){if(!r)return!0;let p=0;for(const m of r){if(m[0]{let m=!0;if(!this.isLoaded())for(const _ of r)this.images[_]||(m=!1);this.isLoaded()||m?u(this._getImagesForIds(r)):this.requestors.push({ids:r,promiseResolve:u})})}_getImagesForIds(r){const u={};for(const p of r){let m=this.getImage(p);m||(this.fire(new c.k("styleimagemissing",{id:p})),m=this.getImage(p)),m?u[p]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,textFitWidth:m.textFitWidth,textFitHeight:m.textFitHeight,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:c.w(`Image "${p}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return u}getPixelSize(){const{width:r,height:u}=this.atlasImage;return{width:r,height:u}}getPattern(r){const u=this.patterns[r],p=this.getImage(r);if(!p)return null;if(u&&u.position.version===p.version)return u.position;if(u)u.position.version=p.version;else{const m={w:p.data.width+2,h:p.data.height+2,x:0,y:0},_=new c.I(m,p);this.patterns[r]={bin:m,position:_}}return this._updatePatternAtlas(),this.patterns[r].position}bind(r){const u=r.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new it(r,this.atlasImage,u.RGBA),this.atlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(){const r=[];for(const _ in this.patterns)r.push(this.patterns[_].bin);const{w:u,h:p}=c.p(r),m=this.atlasImage;m.resize({width:u||1,height:p||1});for(const _ in this.patterns){const{bin:S}=this.patterns[_],E=S.x+1,C=S.y+1,z=this.getImage(_).data,F=z.width,B=z.height;c.R.copy(z,m,{x:0,y:0},{x:E,y:C},{width:F,height:B}),c.R.copy(z,m,{x:0,y:B-1},{x:E,y:C-1},{width:F,height:1}),c.R.copy(z,m,{x:0,y:0},{x:E,y:C+B},{width:F,height:1}),c.R.copy(z,m,{x:F-1,y:0},{x:E-1,y:C},{width:1,height:B}),c.R.copy(z,m,{x:0,y:0},{x:E+F,y:C},{width:1,height:B})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(r){for(const u of r){if(this.callbackDispatchedThisFrame[u])continue;this.callbackDispatchedThisFrame[u]=!0;const p=this.getImage(u);p||c.w(`Image with ID: "${u}" was not found`),ve(p)&&this.updateImage(u,p)}}}const H=1e20;function Re(v,r,u,p,m,_,S,E,C){for(let z=r;z-1);C++,_[C]=E,S[C]=z,S[C+1]=H}for(let E=0,C=0;E65535)throw new Error("glyphs > 65535 not supported");if(p.ranges[_])return{stack:r,id:u,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!p.requests[_]){const E=ye.loadGlyphRange(r,_,this.url,this.requestManager);p.requests[_]=E}const S=yield p.requests[_];for(const E in S)this._doesCharSupportLocalGlyph(+E)||(p.glyphs[+E]=S[+E]);return p.ranges[_]=!0,{stack:r,id:u,glyph:S[u]||null}})}_doesCharSupportLocalGlyph(r){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(r))}_tinySDF(r,u,p){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(p))return;let _=r.tinySDF;if(!_){let E="400";/bold/i.test(u)?E="900":/medium/i.test(u)?E="500":/light/i.test(u)&&(E="200"),_=r.tinySDF=new ye.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:E})}const S=_.draw(String.fromCharCode(p));return{id:p,bitmap:new c.o({width:S.width||60,height:S.height||60},S.data),metrics:{width:S.glyphWidth/2||24,height:S.glyphHeight/2||24,left:S.glyphLeft/2+.5||0,top:S.glyphTop/2-27.5||-8,advance:S.glyphAdvance/2||24,isDoubleResolution:!0}}}}ye.loadGlyphRange=function(v,r,u,p){return c._(this,void 0,void 0,function*(){const m=256*r,_=m+255,S=p.transformRequest(u.replace("{fontstack}",v).replace("{range}",`${m}-${_}`),"Glyphs"),E=yield c.l(S,new AbortController);if(!E||!E.data)throw new Error(`Could not load glyph range. range: ${r}, ${m}-${_}`);const C={};for(const z of c.n(E.data))C[z.id]=z;return C})},ye.TinySDF=class{constructor({fontSize:v=24,buffer:r=3,radius:u=8,cutoff:p=.25,fontFamily:m="sans-serif",fontWeight:_="normal",fontStyle:S="normal"}={}){this.buffer=r,this.cutoff=p,this.radius=u;const E=this.size=v+4*r,C=this._createCanvas(E),z=this.ctx=C.getContext("2d",{willReadFrequently:!0});z.font=`${S} ${_} ${v}px ${m}`,z.textBaseline="alphabetic",z.textAlign="left",z.fillStyle="black",this.gridOuter=new Float64Array(E*E),this.gridInner=new Float64Array(E*E),this.f=new Float64Array(E),this.z=new Float64Array(E+1),this.v=new Uint16Array(E)}_createCanvas(v){const r=document.createElement("canvas");return r.width=r.height=v,r}draw(v){const{width:r,actualBoundingBoxAscent:u,actualBoundingBoxDescent:p,actualBoundingBoxLeft:m,actualBoundingBoxRight:_}=this.ctx.measureText(v),S=Math.ceil(u),E=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(_-m))),C=Math.min(this.size-this.buffer,S+Math.ceil(p)),z=E+2*this.buffer,F=C+2*this.buffer,B=Math.max(z*F,0),X=new Uint8ClampedArray(B),Q={data:X,width:z,height:F,glyphWidth:E,glyphHeight:C,glyphTop:S,glyphLeft:0,glyphAdvance:r};if(E===0||C===0)return Q;const{ctx:re,buffer:ce,gridInner:pe,gridOuter:me}=this;re.clearRect(ce,ce,E,C),re.fillText(v,ce,ce+S);const we=re.getImageData(ce,ce,E,C);me.fill(H,0,B),pe.fill(0,0,B);for(let ae=0;ae0?Ye*Ye:0,pe[ze]=Ye<0?Ye*Ye:0}}Re(me,0,0,z,F,z,this.f,this.v,this.z),Re(pe,ce,ce,E,C,z,this.f,this.v,this.z);for(let ae=0;ae1&&(C=r[++E]);const F=Math.abs(z-C.left),B=Math.abs(z-C.right),X=Math.min(F,B);let Q;const re=_/p*(m+1);if(C.isDash){const ce=m-Math.abs(re);Q=Math.sqrt(X*X+ce*ce)}else Q=m-Math.sqrt(X*X+re*re);this.data[S+z]=Math.max(0,Math.min(255,Q+128))}}}addRegularDash(r){for(let E=r.length-1;E>=0;--E){const C=r[E],z=r[E+1];C.zeroLength?r.splice(E,1):z&&z.isDash===C.isDash&&(z.left=C.left,r.splice(E,1))}const u=r[0],p=r[r.length-1];u.isDash===p.isDash&&(u.left=p.left-this.width,p.right=u.right+this.width);const m=this.width*this.nextRow;let _=0,S=r[_];for(let E=0;E1&&(S=r[++_]);const C=Math.abs(E-S.left),z=Math.abs(E-S.right),F=Math.min(C,z);this.data[m+E]=Math.max(0,Math.min(255,(S.isDash?F:-F)+128))}}addDash(r,u){const p=u?7:0,m=2*p+1;if(this.nextRow+m>this.height)return c.w("LineAtlas out of space"),null;let _=0;for(let E=0;E{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[nt]}numActive(){return Object.keys(this.active).length}}const Jt=Math.floor(A.hardwareConcurrency/2);let er,Vt;function Yt(){return er||(er=new rt),er}rt.workerCount=c.C(globalThis)?Math.max(Math.min(Jt,3),1):1;class _r{constructor(r,u){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=u;const p=this.workerPool.acquire(u);for(let m=0;m{u.remove()}),this.actors=[],r&&this.workerPool.release(this.id)}registerMessageHandler(r,u){for(const p of this.actors)p.registerMessageHandler(r,u)}}function fr(){return Vt||(Vt=new _r(Yt(),c.G),Vt.registerMessageHandler("GR",(v,r,u)=>c.m(r,u))),Vt}function br(v,r){const u=c.H();return c.J(u,u,[1,1,0]),c.K(u,u,[.5*v.width,.5*v.height,1]),c.L(u,u,v.calculatePosMatrix(r.toUnwrapped()))}function Xr(v,r,u,p,m,_){const S=function(B,X,Q){if(B)for(const re of B){const ce=X[re];if(ce&&ce.source===Q&&ce.type==="fill-extrusion")return!0}else for(const re in X){const ce=X[re];if(ce.source===Q&&ce.type==="fill-extrusion")return!0}return!1}(m&&m.layers,r,v.id),E=_.maxPitchScaleFactor(),C=v.tilesIn(p,E,S);C.sort(V);const z=[];for(const B of C)z.push({wrappedTileID:B.tileID.wrapped().key,queryResults:B.tile.queryRenderedFeatures(r,u,v._state,B.queryGeometry,B.cameraQueryGeometry,B.scale,m,_,E,br(v.transform,B.tileID))});const F=function(B){const X={},Q={};for(const re of B){const ce=re.queryResults,pe=re.wrappedTileID,me=Q[pe]=Q[pe]||{};for(const we in ce){const ae=ce[we],Ce=me[we]=me[we]||{},Pe=X[we]=X[we]||[];for(const ze of ae)Ce[ze.featureIndex]||(Ce[ze.featureIndex]=!0,Pe.push(ze))}}return X}(z);for(const B in F)F[B].forEach(X=>{const Q=X.feature,re=v.getFeatureState(Q.layer["source-layer"],Q.id);Q.source=Q.layer.source,Q.layer["source-layer"]&&(Q.sourceLayer=Q.layer["source-layer"]),Q.state=re});return F}function V(v,r){const u=v.tileID,p=r.tileID;return u.overscaledZ-p.overscaledZ||u.canonical.y-p.canonical.y||u.wrap-p.wrap||u.canonical.x-p.canonical.x}function je(v,r,u){return c._(this,void 0,void 0,function*(){let p=v;if(v.url?p=(yield c.h(r.transformRequest(v.url,"Source"),u)).data:yield A.frameAsync(u),!p)return null;const m=c.M(c.e(p,v),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in p&&p.vector_layers&&(m.vectorLayerIds=p.vector_layers.map(_=>_.id)),m})}class ie{constructor(r,u){r&&(u?this.setSouthWest(r).setNorthEast(u):Array.isArray(r)&&(r.length===4?this.setSouthWest([r[0],r[1]]).setNorthEast([r[2],r[3]]):this.setSouthWest(r[0]).setNorthEast(r[1])))}setNorthEast(r){return this._ne=r instanceof c.N?new c.N(r.lng,r.lat):c.N.convert(r),this}setSouthWest(r){return this._sw=r instanceof c.N?new c.N(r.lng,r.lat):c.N.convert(r),this}extend(r){const u=this._sw,p=this._ne;let m,_;if(r instanceof c.N)m=r,_=r;else{if(!(r instanceof ie))return Array.isArray(r)?r.length===4||r.every(Array.isArray)?this.extend(ie.convert(r)):this.extend(c.N.convert(r)):r&&("lng"in r||"lon"in r)&&"lat"in r?this.extend(c.N.convert(r)):this;if(m=r._sw,_=r._ne,!m||!_)return this}return u||p?(u.lng=Math.min(m.lng,u.lng),u.lat=Math.min(m.lat,u.lat),p.lng=Math.max(_.lng,p.lng),p.lat=Math.max(_.lat,p.lat)):(this._sw=new c.N(m.lng,m.lat),this._ne=new c.N(_.lng,_.lat)),this}getCenter(){return new c.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new c.N(this.getWest(),this.getNorth())}getSouthEast(){return new c.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(r){const{lng:u,lat:p}=c.N.convert(r);let m=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=p&&p<=this._ne.lat&&m}static convert(r){return r instanceof ie?r:r&&new ie(r)}static fromLngLat(r,u=0){const p=360*u/40075017,m=p/Math.cos(Math.PI/180*r.lat);return new ie(new c.N(r.lng-m,r.lat-p),new c.N(r.lng+m,r.lat+p))}adjustAntiMeridian(){const r=new c.N(this._sw.lng,this._sw.lat),u=new c.N(this._ne.lng,this._ne.lat);return new ie(r,r.lng>u.lng?new c.N(u.lng+360,u.lat):u)}}class de{constructor(r,u,p){this.bounds=ie.convert(this.validateBounds(r)),this.minzoom=u||0,this.maxzoom=p||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}contains(r){const u=Math.pow(2,r.z),p=Math.floor(c.O(this.bounds.getWest())*u),m=Math.floor(c.Q(this.bounds.getNorth())*u),_=Math.ceil(c.O(this.bounds.getEast())*u),S=Math.ceil(c.Q(this.bounds.getSouth())*u);return r.x>=p&&r.x<_&&r.y>=m&&r.y{this._options.tiles=r}),this}setUrl(r){return this.setSourceProperty(()=>{this.url=r,this._options.url=r}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p={request:this.map._requestManager.transformRequest(u,"Tile"),uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};p.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(r.actor&&r.state!=="expired"){if(r.state==="loading")return new Promise((_,S)=>{r.reloadPromise={resolve:_,reject:S}})}else r.actor=this.dispatcher.getActor(),m="LT";r.abortController=new AbortController;try{const _=yield r.actor.sendAsync({type:m,data:p},r.abortController);if(delete r.abortController,r.aborted)return;this._afterTileLoadWorkerResponse(r,_)}catch(_){if(delete r.abortController,r.aborted)return;if(_&&_.status!==404)throw _;this._afterTileLoadWorkerResponse(r,null)}})}_afterTileLoadWorkerResponse(r,u){if(u&&u.resourceTiming&&(r.resourceTiming=u.resourceTiming),u&&this.map._refreshExpiredTiles&&r.setExpiryData(u),r.loadVectorData(u,this.map.painter),r.reloadPromise){const p=r.reloadPromise;r.reloadPromise=null,this.loadTile(r).then(p.resolve).catch(p.reject)}}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.actor&&(yield r.actor.sendAsync({type:"AT",data:{uid:r.uid,type:this.type,source:this.id}}))})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.unloadVectorData(),r.actor&&(yield r.actor.sendAsync({type:"RMT",data:{uid:r.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Te extends c.E{constructor(r,u,p,m){super(),this.id=r,this.dispatcher=p,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},u),c.e(this,c.M(u,["url","scheme","tileSize"]))}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const r=yield je(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(c.e(this,r),r.bounds&&(this.tileBounds=new de(r.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))}catch(r){this._tileJSONRequest=null,this.fire(new c.j(r))}})}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(r){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),r(),this.load()}setTiles(r){return this.setSourceProperty(()=>{this._options.tiles=r}),this}setUrl(r){return this.setSourceProperty(()=>{this.url=r,this._options.url=r}),this}serialize(){return c.e({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);r.abortController=new AbortController;try{const p=yield q.getImage(this.map._requestManager.transformRequest(u,"Tile"),r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(p&&p.data){this.map._refreshExpiredTiles&&p.cacheControl&&p.expires&&r.setExpiryData({cacheControl:p.cacheControl,expires:p.expires});const m=this.map.painter.context,_=m.gl,S=p.data;r.texture=this.map.painter.getTileTexture(S.width),r.texture?r.texture.update(S,{useMipmap:!0}):(r.texture=new it(m,S,_.RGBA,{useMipmap:!0}),r.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST)),r.state="loaded"}}catch(p){if(delete r.abortController,r.aborted)r.state="unloaded";else if(p)throw r.state="errored",p}})}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController)})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.texture&&this.map.painter.saveTileTexture(r.texture)})}hasTransition(){return!1}}class Ge extends Te{constructor(r,u,p,m){super(r,u,p,m),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},u),this.encoding=u.encoding||"mapbox",this.redFactor=u.redFactor,this.greenFactor=u.greenFactor,this.blueFactor=u.blueFactor,this.baseShift=u.baseShift}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),p=this.map._requestManager.transformRequest(u,"Tile");r.neighboringTiles=this._getNeighboringTiles(r.tileID),r.abortController=new AbortController;try{const m=yield q.getImage(p,r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(m&&m.data){const _=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&r.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const S=c.b(_)&&c.U()?_:yield this.readImageNow(_),E={type:this.type,uid:r.uid,source:this.id,rawImageData:S,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!r.actor||r.state==="expired"){r.actor=this.dispatcher.getActor();const C=yield r.actor.sendAsync({type:"LDT",data:E});r.dem=C,r.needsHillshadePrepare=!0,r.needsTerrainPrepare=!0,r.state="loaded"}}}catch(m){if(delete r.abortController,r.aborted)r.state="unloaded";else if(m)throw r.state="errored",m}})}readImageNow(r){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.V()){const u=r.width+2,p=r.height+2;try{return new c.R({width:u,height:p},yield c.W(r,-1,-1,u,p))}catch{}}return A.getImageData(r,1)})}_getNeighboringTiles(r){const u=r.canonical,p=Math.pow(2,u.z),m=(u.x-1+p)%p,_=u.x===0?r.wrap-1:r.wrap,S=(u.x+1+p)%p,E=u.x+1===p?r.wrap+1:r.wrap,C={};return C[new c.S(r.overscaledZ,_,u.z,m,u.y).key]={backfilled:!1},C[new c.S(r.overscaledZ,E,u.z,S,u.y).key]={backfilled:!1},u.y>0&&(C[new c.S(r.overscaledZ,_,u.z,m,u.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,r.wrap,u.z,u.x,u.y-1).key]={backfilled:!1},C[new c.S(r.overscaledZ,E,u.z,S,u.y-1).key]={backfilled:!1}),u.y+10&&c.e(_,{resourceTiming:m}),this.fire(new c.k("data",Object.assign(Object.assign({},_),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},_),{sourceDataType:"content"})))}catch(p){if(this._pendingLoads--,this._removed)return void this.fire(new c.k("dataabort",{dataType:"source"}));this.fire(new c.j(p))}})}loaded(){return this._pendingLoads===0}loadTile(r){return c._(this,void 0,void 0,function*(){const u=r.actor?"RT":"LT";r.actor=this.actor;const p={type:this.type,uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};r.abortController=new AbortController;const m=yield this.actor.sendAsync({type:u,data:p},r.abortController);delete r.abortController,r.unloadVectorData(),r.aborted||r.loadVectorData(m,this.map.painter,u==="RT")})}abortTile(r){return c._(this,void 0,void 0,function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.aborted=!0})}unloadTile(r){return c._(this,void 0,void 0,function*(){r.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:r.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var Ne=c.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ot extends c.E{constructor(r,u,p,m){super(),this.id=r,this.dispatcher=p,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=u}load(r){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const u=yield q.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,u&&u.data&&(this.image=u.data,r&&(this.coordinates=r),this._finishLoading())}catch(u){this._request=null,this._loaded=!0,this.fire(new c.j(u))}})}loaded(){return this._loaded}updateImage(r){return r.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=r.url,this.load(r.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(r){this.map=r,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(r){this.coordinates=r;const u=r.map(c.Z.fromLngLat);this.tileID=function(m){let _=1/0,S=1/0,E=-1/0,C=-1/0;for(const X of m)_=Math.min(_,X.x),S=Math.min(S,X.y),E=Math.max(E,X.x),C=Math.max(C,X.y);const z=Math.max(E-_,C-S),F=Math.max(0,Math.floor(-Math.log(z)/Math.LN2)),B=Math.pow(2,F);return new c.a1(F,Math.floor((_+E)/2*B),Math.floor((S+C)/2*B))}(u),this.minzoom=this.maxzoom=this.tileID.z;const p=u.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new c.$,this._boundsArray.emplaceBack(p[0].x,p[0].y,0,0),this._boundsArray.emplaceBack(p[1].x,p[1].y,c.X,0),this._boundsArray.emplaceBack(p[3].x,p[3].y,0,c.X),this._boundsArray.emplaceBack(p[2].x,p[2].y,c.X,c.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const r=this.map.painter.context,u=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new it(r,this.image,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const _=this.tiles[m];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,p=!0)}p&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(r){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(r.tileID.canonical)?(this.tiles[String(r.tileID.wrap)]=r,r.buckets={}):r.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class kt extends ot{constructor(r,u,p,m){super(r,u,p,m),this.roundZoom=!0,this.type="video",this.options=u}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1;const r=this.options;this.urls=[];for(const u of r.urls)this.urls.push(this.map._requestManager.transformRequest(u,"Source").url);try{const u=yield c.a3(this.urls);if(this._loaded=!0,!u)return;this.video=u,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(u){this.fire(new c.j(u))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(r){if(this.video){const u=this.video.seekable;ru.end(0)?this.fire(new c.j(new c.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${u.start(0)} and ${u.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(r){this.map||(this.map=r,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const r=this.map.painter.context,u=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.texSubImage2D(u.TEXTURE_2D,0,0,0,u.RGBA,u.UNSIGNED_BYTE,this.video)):(this.texture=new it(r,this.video,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));let p=!1;for(const m in this.tiles){const _=this.tiles[m];_.state!=="loaded"&&(_.state="loaded",_.texture=this.texture,p=!0)}p&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class at extends ot{constructor(r,u,p,m){super(r,u,p,m),u.coordinates?Array.isArray(u.coordinates)&&u.coordinates.length===4&&!u.coordinates.some(_=>!Array.isArray(_)||_.length!==2||_.some(S=>typeof S!="number"))||this.fire(new c.j(new c.a2(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.a2(`sources.${r}`,null,'missing required property "coordinates"'))),u.animate&&typeof u.animate!="boolean"&&this.fire(new c.j(new c.a2(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),u.canvas?typeof u.canvas=="string"||u.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.a2(`sources.${r}`,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 c.j(new c.a2(`sources.${r}`,null,'missing required property "canvas"'))),this.options=u,this.animate=u.animate===void 0||u.animate}load(){return c._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new c.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(r){this.map=r,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const u=this.map.painter.context,p=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,Ne.members)),this.boundsSegments||(this.boundsSegments=c.a0.simpleSegment(0,0,4,2)),this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new it(u,this.canvas,p.RGBA,{premultiply:!0});let m=!1;for(const _ in this.tiles){const S=this.tiles[_];S.state!=="loaded"&&(S.state="loaded",S.texture=this.texture,m=!0)}m&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const r of[this.canvas.width,this.canvas.height])if(isNaN(r)||r<=0)return!0;return!1}}const Bt={},Tr=v=>{switch(v){case"geojson":return tt;case"image":return ot;case"raster":return Te;case"raster-dem":return Ge;case"vector":return se;case"video":return kt;case"canvas":return at}return Bt[v]},Ze="RTLPluginLoaded";class tn extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=fr()}_syncState(r){return this.status=r,this.dispatcher.broadcast("SRPS",{pluginStatus:r,pluginURL:this.url}).catch(u=>{throw this.status="error",u})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(r){return c._(this,arguments,void 0,function*(u,p=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=A.resolveURL(u),!this.url)throw new Error(`requested url ${u} is invalid`);if(this.status==="unavailable"){if(!p)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.k(Ze))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let _n=null;function vn(){return _n||(_n=new tn),_n}class pi{constructor(r,u){this.timeAdded=0,this.fadeEndTime=0,this.tileID=r,this.uid=c.a4(),this.uses=0,this.tileSize=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(r){const u=r+this.timeAdded;u_.getLayer(z)).filter(Boolean);if(C.length!==0){E.layers=C,E.stateDependentLayerIds&&(E.stateDependentLayers=E.stateDependentLayerIds.map(z=>C.filter(F=>F.id===z)[0]));for(const z of C)S[z.id]=E}}return S}(r.buckets,u.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const _=this.buckets[m];if(_ instanceof c.a6){if(this.hasSymbolBuckets=!0,!p)break;_.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const _=this.buckets[m];if(_ instanceof c.a6&&_.hasRTLText){this.hasRTLText=!0,vn().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const _=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(m).queryRadius(_))}r.imageAtlas&&(this.imageAtlas=r.imageAtlas),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage)}else this.collisionBoxArray=new c.a5}unloadVectorData(){for(const r in this.buckets)this.buckets[r].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(r){return this.buckets[r.id]}upload(r){for(const p in this.buckets){const m=this.buckets[p];m.uploadPending()&&m.upload(r)}const u=r.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new it(r,this.imageAtlas.image,u.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new it(r,this.glyphAtlasImage,u.ALPHA),this.glyphAtlasImage=null)}prepare(r){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture)}queryRenderedFeatures(r,u,p,m,_,S,E,C,z,F){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:_,scale:S,tileSize:this.tileSize,pixelPosMatrix:F,transform:C,params:E,queryPadding:this.queryPadding*z},r,u,p):{}}querySourceFeatures(r,u){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const m=p.loadVTLayers(),_=u&&u.sourceLayer?u.sourceLayer:"",S=m._geojsonTileLayer||m[_];if(!S)return;const E=c.a7(u&&u.filter),{z:C,x:z,y:F}=this.tileID.canonical,B={z:C,x:z,y:F};for(let X=0;Xp)m=!1;else if(u)if(this.expirationTime{this.remove(r,_)},p)),this.data[m].push(_),this.order.push(m),this.order.length>this.max){const S=this._getAndRemoveByKey(this.order[0]);S&&this.onRemove(S)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const u=this.data[r].shift();return u.timeout&&clearTimeout(u.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),u.value}getByKey(r){const u=this.data[r];return u?u[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,u){if(!this.has(r))return this;const p=r.wrapped().key,m=u===void 0?0:this.data[p].indexOf(u),_=this.data[p][m];return this.data[p].splice(m,1),_.timeout&&clearTimeout(_.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(_.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}filter(r){const u=[];for(const p in this.data)for(const m of this.data[p])r(m.value)||u.push(m);for(const p of u)this.remove(p.value.tileID,p)}}class Kt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(r,u,p){const m=String(u);if(this.stateChanges[r]=this.stateChanges[r]||{},this.stateChanges[r][m]=this.stateChanges[r][m]||{},c.e(this.stateChanges[r][m],p),this.deletedStates[r]===null){this.deletedStates[r]={};for(const _ in this.state[r])_!==m&&(this.deletedStates[r][_]=null)}else if(this.deletedStates[r]&&this.deletedStates[r][m]===null){this.deletedStates[r][m]={};for(const _ in this.state[r][m])p[_]||(this.deletedStates[r][m][_]=null)}else for(const _ in p)this.deletedStates[r]&&this.deletedStates[r][m]&&this.deletedStates[r][m][_]===null&&delete this.deletedStates[r][m][_]}removeFeatureState(r,u,p){if(this.deletedStates[r]===null)return;const m=String(u);if(this.deletedStates[r]=this.deletedStates[r]||{},p&&u!==void 0)this.deletedStates[r][m]!==null&&(this.deletedStates[r][m]=this.deletedStates[r][m]||{},this.deletedStates[r][m][p]=null);else if(u!==void 0)if(this.stateChanges[r]&&this.stateChanges[r][m])for(p in this.deletedStates[r][m]={},this.stateChanges[r][m])this.deletedStates[r][m][p]=null;else this.deletedStates[r][m]=null;else this.deletedStates[r]=null}getState(r,u){const p=String(u),m=c.e({},(this.state[r]||{})[p],(this.stateChanges[r]||{})[p]);if(this.deletedStates[r]===null)return{};if(this.deletedStates[r]){const _=this.deletedStates[r][u];if(_===null)return{};for(const S in _)delete m[S]}return m}initializeTileState(r,u){r.setFeatureState(this.state,u)}coalesceChanges(r,u){const p={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const _={};for(const S in this.stateChanges[m])this.state[m][S]||(this.state[m][S]={}),c.e(this.state[m][S],this.stateChanges[m][S]),_[S]=this.state[m][S];p[m]=_}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const _={};if(this.deletedStates[m]===null)for(const S in this.state[m])_[S]={},this.state[m][S]={};else for(const S in this.deletedStates[m]){if(this.deletedStates[m][S]===null)this.state[m][S]={};else for(const E of Object.keys(this.deletedStates[m][S]))delete this.state[m][S][E];_[S]=this.state[m][S]}p[m]=p[m]||{},c.e(p[m],_)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const m in r)r[m].setFeatureState(p,u)}}class Ut extends c.E{constructor(r,u,p){super(),this.id=r,this.dispatcher=p,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,_,S,E)=>{const C=new(Tr(_.type))(m,_,S,E);if(C.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${C.id}`);return C})(r,u,p,this),this._tiles={},this._cache=new Qe(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Kt,this._didEmitContent=!1,this._updated=!1}onAdd(r){this.map=r,this._maxTileCacheSize=r?r._maxTileCacheSize:null,this._maxTileCacheZoomLevels=r?r._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(r)}onRemove(r){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(r)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const r in this._tiles){const u=this._tiles[r];if(u.state!=="loaded"&&u.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(r,u,p){return c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(r),this._tileLoaded(r,u,p)}catch(m){r.state="errored",m.status!==404?this._source.fire(new c.j(m,{tile:r})):this.update(this.transform,this.terrain)}})}_unloadTile(r){this._source.unloadTile&&this._source.unloadTile(r)}_abortTile(r){this._source.abortTile&&this._source.abortTile(r),this._source.fire(new c.k("dataabort",{tile:r,coord:r.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(r){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const u in this._tiles){const p=this._tiles[u];p.upload(r),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(r=>r.tileID).sort(Kr).map(r=>r.key)}getRenderableIds(r){const u=[];for(const p in this._tiles)this._isIdRenderable(p,r)&&u.push(this._tiles[p]);return r?u.sort((p,m)=>{const _=p.tileID,S=m.tileID,E=new c.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle),C=new c.P(S.canonical.x,S.canonical.y)._rotate(this.transform.angle);return _.overscaledZ-S.overscaledZ||C.y-E.y||C.x-E.x}).map(p=>p.tileID.key):u.map(p=>p.tileID).sort(Kr).map(p=>p.key)}hasRenderableParent(r){const u=this.findLoadedParent(r,0);return!!u&&this._isIdRenderable(u.tileID.key)}_isIdRenderable(r,u){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(u||!this._tiles[r].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const r in this._tiles)this._tiles[r].state!=="errored"&&this._reloadTile(r,"reloading")}}_reloadTile(r,u){return c._(this,void 0,void 0,function*(){const p=this._tiles[r];p&&(p.state!=="loading"&&(p.state=u),yield this._loadTile(p,r,u))})}_tileLoaded(r,u,p){r.timeAdded=A.now(),p==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(u,r),this.getSource().type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null),r.aborted||this._source.fire(new c.k("data",{dataType:"source",tile:r,coord:r.tileID}))}_backfillDEM(r){const u=this.getRenderableIds();for(let m=0;m1||(Math.abs(S)>1&&(Math.abs(S+C)===1?S+=C:Math.abs(S-C)===1&&(S-=C)),_.dem&&m.dem&&(m.dem.backfillBorder(_.dem,S,E),m.neighboringTiles&&m.neighboringTiles[z]&&(m.neighboringTiles[z].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,u,p,m){for(const _ in this._tiles){let S=this._tiles[_];if(m[_]||!S.hasData()||S.tileID.overscaledZ<=u||S.tileID.overscaledZ>p)continue;let E=S.tileID;for(;S&&S.tileID.overscaledZ>u+1;){const z=S.tileID.scaledTo(S.tileID.overscaledZ-1);S=this._tiles[z.key],S&&S.hasData()&&(E=z)}let C=E;for(;C.overscaledZ>u;)if(C=C.scaledTo(C.overscaledZ-1),r[C.key]){m[E.key]=E;break}}}findLoadedParent(r,u){if(r.key in this._loadedParentTiles){const p=this._loadedParentTiles[r.key];return p&&p.tileID.overscaledZ>=u?p:null}for(let p=r.overscaledZ-1;p>=u;p--){const m=r.scaledTo(p),_=this._getLoadedTile(m);if(_)return _}}findLoadedSibling(r){return this._getLoadedTile(r)}_getLoadedTile(r){const u=this._tiles[r.key];return u&&u.hasData()?u:this._cache.getByKey(r.wrapped().key)}updateCacheSize(r){const u=Math.ceil(r.width/this._source.tileSize)+1,p=Math.ceil(r.height/this._source.tileSize)+1,m=Math.floor(u*p*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),_=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(_)}handleWrapJump(r){const u=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,u){const p={};for(const m in this._tiles){const _=this._tiles[m];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+u),p[_.tileID.key]=_}this._tiles=p;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}_updateCoveredAndRetainedTiles(r,u,p,m,_,S){const E={},C={},z=Object.keys(r),F=A.now();for(const B of z){const X=r[B],Q=this._tiles[B];if(!Q||Q.fadeEndTime!==0&&Q.fadeEndTime<=F)continue;const re=this.findLoadedParent(X,u),ce=this.findLoadedSibling(X),pe=re||ce||null;pe&&(this._addTile(pe.tileID),E[pe.tileID.key]=pe.tileID),C[B]=X}this._retainLoadedChildren(C,m,p,r);for(const B in E)r[B]||(this._coveredTiles[B]=!0,r[B]=E[B]);if(S){const B={},X={};for(const Q of _)this._tiles[Q.key].hasData()?B[Q.key]=Q:X[Q.key]=Q;for(const Q in X){const re=X[Q].children(this._source.maxzoom);this._tiles[re[0].key]&&this._tiles[re[1].key]&&this._tiles[re[2].key]&&this._tiles[re[3].key]&&(B[re[0].key]=r[re[0].key]=re[0],B[re[1].key]=r[re[1].key]=re[1],B[re[2].key]=r[re[2].key]=re[2],B[re[3].key]=r[re[3].key]=re[3],delete X[Q])}for(const Q in X){const re=X[Q],ce=this.findLoadedParent(re,this._source.minzoom),pe=this.findLoadedSibling(re),me=ce||pe||null;if(me){B[me.tileID.key]=r[me.tileID.key]=me.tileID;for(const we in B)B[we].isChildOf(me.tileID)&&delete B[we]}}for(const Q in this._tiles)B[Q]||(this._coveredTiles[Q]=!0)}}update(r,u){if(!this._sourceLoaded||this._paused)return;let p;this.transform=r,this.terrain=u,this.updateCacheSize(r),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(F=>new c.S(F.canonical.z,F.wrap,F.canonical.z,F.canonical.x,F.canonical.y)):(p=r.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:u}),this._source.hasTile&&(p=p.filter(F=>this._source.hasTile(F)))):p=[];const m=r.coveringZoomLevel(this._source),_=Math.max(m-Ut.maxOverzooming,this._source.minzoom),S=Math.max(m+Ut.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const F={};for(const B of p)if(B.canonical.z>this._source.minzoom){const X=B.scaledTo(B.canonical.z-1);F[X.key]=X;const Q=B.scaledTo(Math.max(this._source.minzoom,Math.min(B.canonical.z,5)));F[Q.key]=Q}p=p.concat(Object.values(F))}const E=p.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,E&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const C=this._updateRetainedTiles(p,m);mi(this._source.type)&&this._updateCoveredAndRetainedTiles(C,_,S,m,p,u);for(const F in C)this._tiles[F].clearFadeHold();const z=c.ab(this._tiles,C);for(const F of z){const B=this._tiles[F];B.hasSymbolBuckets&&!B.holdingForFade()?B.setHoldDuration(this.map._fadeDuration):B.hasSymbolBuckets&&!B.symbolFadeFinished()||this._removeTile(F)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(r)}_updateRetainedTiles(r,u){var p;const m={},_={},S=Math.max(u-Ut.maxOverzooming,this._source.minzoom),E=Math.max(u+Ut.maxUnderzooming,this._source.minzoom),C={};for(const z of r){const F=this._addTile(z);m[z.key]=z,F.hasData()||uthis._source.maxzoom){const X=z.children(this._source.maxzoom)[0],Q=this.getTile(X);if(Q&&Q.hasData()){m[X.key]=X;continue}}else{const X=z.children(this._source.maxzoom);if(m[X[0].key]&&m[X[1].key]&&m[X[2].key]&&m[X[3].key])continue}let B=F.wasRequested();for(let X=z.overscaledZ-1;X>=S;--X){const Q=z.scaledTo(X);if(_[Q.key])break;if(_[Q.key]=!0,F=this.getTile(Q),!F&&B&&(F=this._addTile(Q)),F){const re=F.hasData();if((re||!(!((p=this.map)===null||p===void 0)&&p.cancelPendingTileRequestsWhileZooming)||B)&&(m[Q.key]=Q),B=F.wasRequested(),re)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const u=[];let p,m=this._tiles[r].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){p=this._loadedParentTiles[m.key];break}u.push(m.key);const _=m.scaledTo(m.overscaledZ-1);if(p=this._getLoadedTile(_),p)break;m=_}for(const _ of u)this._loadedParentTiles[_]=p}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const r in this._tiles){const u=this._tiles[r].tileID,p=this._getLoadedTile(u);this._loadedSiblingTiles[u.key]=p}}_addTile(r){let u=this._tiles[r.key];if(u)return u;u=this._cache.getAndRemove(r),u&&(this._setTileReloadTimer(r.key,u),u.tileID=r,this._state.initializeTileState(u,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,u)));const p=u;return u||(u=new pi(r,this._source.tileSize*r.overscaleFactor()),this._loadTile(u,r.key,u.state)),u.uses++,this._tiles[r.key]=u,p||this._source.fire(new c.k("dataloading",{tile:u,coord:u.tileID,dataType:"source"})),u}_setTileReloadTimer(r,u){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const p=u.getExpiryTimeout();p&&(this._timers[r]=setTimeout(()=>{this._reloadTile(r,"expired"),delete this._timers[r]},p))}_removeTile(r){const u=this._tiles[r];u&&(u.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),u.uses>0||(u.hasData()&&u.state!=="reloading"?this._cache.add(u.tileID,u,u.getExpiryTimeout()):(u.aborted=!0,this._abortTile(u),this._unloadTile(u))))}_dataHandler(r){const u=r.sourceDataType;r.dataType==="source"&&u==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&r.dataType==="source"&&u==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(r);this._cache.reset()}tilesIn(r,u,p){const m=[],_=this.transform;if(!_)return m;const S=p?_.getCameraQueryGeometry(r):r,E=r.map(re=>_.pointCoordinate(re,this.terrain)),C=S.map(re=>_.pointCoordinate(re,this.terrain)),z=this.getIds();let F=1/0,B=1/0,X=-1/0,Q=-1/0;for(const re of C)F=Math.min(F,re.x),B=Math.min(B,re.y),X=Math.max(X,re.x),Q=Math.max(Q,re.y);for(let re=0;re=0&&ae[1].y+we>=0){const Ce=E.map(ze=>pe.getTilePoint(ze)),Pe=C.map(ze=>pe.getTilePoint(ze));m.push({tile:ce,tileID:pe,queryGeometry:Ce,cameraQueryGeometry:Pe,scale:me})}}return m}getVisibleCoordinates(r){const u=this.getRenderableIds(r).map(p=>this._tiles[p].tileID);for(const p of u)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return u}hasTransition(){if(this._source.hasTransition())return!0;if(mi(this._source.type)){const r=A.now();for(const u in this._tiles)if(this._tiles[u].fadeEndTime>=r)return!0}return!1}setFeatureState(r,u,p){this._state.updateState(r=r||"_geojsonTileLayer",u,p)}removeFeatureState(r,u,p){this._state.removeFeatureState(r=r||"_geojsonTileLayer",u,p)}getFeatureState(r,u){return this._state.getState(r=r||"_geojsonTileLayer",u)}setDependencies(r,u,p){const m=this._tiles[r];m&&m.setDependencies(u,p)}reloadTilesForDependencies(r,u){for(const p in this._tiles)this._tiles[p].hasDependency(r,u)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(r,u))}}function Kr(v,r){const u=Math.abs(2*v.wrap)-+(v.wrap<0),p=Math.abs(2*r.wrap)-+(r.wrap<0);return v.overscaledZ-r.overscaledZ||p-u||r.canonical.y-v.canonical.y||r.canonical.x-v.canonical.x}function mi(v){return v==="raster"||v==="image"||v==="video"}Ut.maxOverzooming=10,Ut.maxUnderzooming=3;class Xt{constructor(r,u){this.reset(r,u)}reset(r,u){this.points=r||[],this._distances=[0];for(let p=1;p0?(m-S)/E:0;return this.points[_].mult(1-C).add(this.points[u].mult(C))}}function Yi(v,r){let u=!0;return v==="always"||v!=="never"&&r!=="never"||(u=!1),u}class fs{constructor(r,u,p){const m=this.boxCells=[],_=this.circleCells=[];this.xCellCount=Math.ceil(r/p),this.yCellCount=Math.ceil(u/p);for(let S=0;Sthis.width||m<0||u>this.height)return[];const C=[];if(r<=0&&u<=0&&this.width<=p&&this.height<=m){if(_)return[{key:null,x1:r,y1:u,x2:p,y2:m}];for(let z=0;z0}hitTestCircle(r,u,p,m,_){const S=r-p,E=r+p,C=u-p,z=u+p;if(E<0||S>this.width||z<0||C>this.height)return!1;const F=[];return this._forEachCell(S,C,E,z,this._queryCellCircle,F,{hitTest:!0,overlapMode:m,circle:{x:r,y:u,radius:p},seenUids:{box:{},circle:{}}},_),F.length>0}_queryCell(r,u,p,m,_,S,E,C){const{seenUids:z,hitTest:F,overlapMode:B}=E,X=this.boxCells[_];if(X!==null){const re=this.bboxes;for(const ce of X)if(!z.box[ce]){z.box[ce]=!0;const pe=4*ce,me=this.boxKeys[ce];if(r<=re[pe+2]&&u<=re[pe+3]&&p>=re[pe+0]&&m>=re[pe+1]&&(!C||C(me))&&(!F||!Yi(B,me.overlapMode))&&(S.push({key:me,x1:re[pe],y1:re[pe+1],x2:re[pe+2],y2:re[pe+3]}),F))return!0}}const Q=this.circleCells[_];if(Q!==null){const re=this.circles;for(const ce of Q)if(!z.circle[ce]){z.circle[ce]=!0;const pe=3*ce,me=this.circleKeys[ce];if(this._circleAndRectCollide(re[pe],re[pe+1],re[pe+2],r,u,p,m)&&(!C||C(me))&&(!F||!Yi(B,me.overlapMode))){const we=re[pe],ae=re[pe+1],Ce=re[pe+2];if(S.push({key:me,x1:we-Ce,y1:ae-Ce,x2:we+Ce,y2:ae+Ce}),F)return!0}}}return!1}_queryCellCircle(r,u,p,m,_,S,E,C){const{circle:z,seenUids:F,overlapMode:B}=E,X=this.boxCells[_];if(X!==null){const re=this.bboxes;for(const ce of X)if(!F.box[ce]){F.box[ce]=!0;const pe=4*ce,me=this.boxKeys[ce];if(this._circleAndRectCollide(z.x,z.y,z.radius,re[pe+0],re[pe+1],re[pe+2],re[pe+3])&&(!C||C(me))&&!Yi(B,me.overlapMode))return S.push(!0),!0}}const Q=this.circleCells[_];if(Q!==null){const re=this.circles;for(const ce of Q)if(!F.circle[ce]){F.circle[ce]=!0;const pe=3*ce,me=this.circleKeys[ce];if(this._circlesCollide(re[pe],re[pe+1],re[pe+2],z.x,z.y,z.radius)&&(!C||C(me))&&!Yi(B,me.overlapMode))return S.push(!0),!0}}}_forEachCell(r,u,p,m,_,S,E,C){const z=this._convertToXCellCoord(r),F=this._convertToYCellCoord(u),B=this._convertToXCellCoord(p),X=this._convertToYCellCoord(m);for(let Q=z;Q<=B;Q++)for(let re=F;re<=X;re++)if(_.call(this,r,u,p,m,this.xCellCount*re+Q,S,E,C))return}_convertToXCellCoord(r){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(r*this.xScale)))}_convertToYCellCoord(r){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(r*this.yScale)))}_circlesCollide(r,u,p,m,_,S){const E=m-r,C=_-u,z=p+S;return z*z>E*E+C*C}_circleAndRectCollide(r,u,p,m,_,S,E){const C=(S-m)/2,z=Math.abs(r-(m+C));if(z>C+p)return!1;const F=(E-_)/2,B=Math.abs(u-(_+F));if(B>F+p)return!1;if(z<=C||B<=F)return!0;const X=z-C,Q=B-F;return X*X+Q*Q<=p*p}}function ps(v,r,u,p,m){const _=c.H();return r?(c.K(_,_,[1/m,1/m,1]),u||c.ad(_,_,p.angle)):c.L(_,p.labelPlaneMatrix,v),_}function Hn(v,r,u,p,m){if(r){const _=c.ae(v);return c.K(_,_,[m,m,1]),u||c.ad(_,_,-p.angle),_}return p.glCoordMatrix}function he(v,r,u,p){let m;p?(m=[v,r,p(v,r),1],c.af(m,m,u)):(m=[v,r,0,1],mr(m,m,u));const _=m[3];return{point:new c.P(m[0]/_,m[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}function G(v,r){return .5+v/r*.5}function W(v,r){return v.x>=-r[0]&&v.x<=r[0]&&v.y>=-r[1]&&v.y<=r[1]}function ee(v,r,u,p,m,_,S,E,C,z,F,B,X,Q,re){const ce=p?v.textSizeData:v.iconSizeData,pe=c.ag(ce,u.transform.zoom),me=[256/u.width*2+1,256/u.height*2+1],we=p?v.text.dynamicLayoutVertexArray:v.icon.dynamicLayoutVertexArray;we.clear();const ae=v.lineVertexArray,Ce=p?v.text.placedSymbolArray:v.icon.placedSymbolArray,Pe=u.transform.width/u.transform.height;let ze=!1;for(let Ye=0;YeMath.abs(u.x-r.x)*p?{useVertical:!0}:(v===c.ah.vertical?r.yu.x)?{needsFlipping:!0}:null}function Ie(v,r,u,p,m,_,S,E,C,z,F){const B=u/24,X=r.lineOffsetX*B,Q=r.lineOffsetY*B;let re;if(r.numGlyphs>1){const ce=r.glyphStartIndex+r.numGlyphs,pe=r.lineStartIndex,me=r.lineStartIndex+r.lineLength,we=ue(B,E,X,Q,p,r,F,v);if(!we)return{notEnoughRoom:!0};const ae=he(we.first.point.x,we.first.point.y,S,v.getElevation).point,Ce=he(we.last.point.x,we.last.point.y,S,v.getElevation).point;if(m&&!p){const Pe=Se(r.writingMode,ae,Ce,z);if(Pe)return Pe}re=[we.first];for(let Pe=r.glyphStartIndex+1;Pe0?ae.point:function(ze,Ye,st,gt,wt,dt){return Ae(ze,Ye,st,1,wt,dt)}(v.tileAnchorPoint,we,pe,0,_,v),Pe=Se(r.writingMode,pe,Ce,z);if(Pe)return Pe}const ce=ut(B*E.getoffsetX(r.glyphStartIndex),X,Q,p,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,v,F);if(!ce||v.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};re=[ce]}for(const ce of re)c.aj(C,ce.point,ce.angle);return{}}function Ae(v,r,u,p,m,_){const S=v.add(v.sub(r)._unit()),E=m!==void 0?he(S.x,S.y,m,_.getElevation).point:He(S.x,S.y,_).point,C=u.sub(E);return u.add(C._mult(p/C.mag()))}function _e(v,r,u){const p=r.projectionCache;if(p.projections[v])return p.projections[v];const m=new c.P(r.lineVertexArray.getx(v),r.lineVertexArray.gety(v)),_=He(m.x,m.y,r);if(_.signedDistanceFromCamera>0)return p.projections[v]=_.point,p.anyProjectionOccluded=p.anyProjectionOccluded||_.isOccluded,_.point;const S=v-u.direction;return function(E,C,z,F,B){return Ae(E,C,z,F,void 0,B)}(u.distanceFromAnchor===0?r.tileAnchorPoint:new c.P(r.lineVertexArray.getx(S),r.lineVertexArray.gety(S)),m,u.previousVertex,u.absOffsetX-u.distanceFromAnchor+1,r)}function He(v,r,u){const p=v+u.translation[0],m=r+u.translation[1];let _;return!u.pitchWithMap&&u.projection.useSpecialProjectionForSymbols?(_=u.projection.projectTileCoordinates(p,m,u.unwrappedTileID,u.getElevation),_.point.x=(.5*_.point.x+.5)*u.width,_.point.y=(.5*-_.point.y+.5)*u.height):(_=he(p,m,u.labelPlaneMatrix,u.getElevation),_.isOccluded=!1),_}function Je(v,r,u){return v._unit()._perp()._mult(r*u)}function $e(v,r,u,p,m,_,S,E,C){if(E.projectionCache.offsets[v])return E.projectionCache.offsets[v];const z=u.add(r);if(v+C.direction=m)return E.projectionCache.offsets[v]=z,z;const F=_e(v+C.direction,E,C),B=Je(F.sub(u),S,C.direction),X=u.add(B),Q=F.add(B);return E.projectionCache.offsets[v]=c.ak(_,z,X,Q)||z,E.projectionCache.offsets[v]}function ut(v,r,u,p,m,_,S,E,C){const z=p?v-r:v+r;let F=z>0?1:-1,B=0;p&&(F*=-1,B=Math.PI),F<0&&(B+=Math.PI);let X,Q=F>0?_+m:_+m+1;E.projectionCache.cachedAnchorPoint?X=E.projectionCache.cachedAnchorPoint:(X=He(E.tileAnchorPoint.x,E.tileAnchorPoint.y,E).point,E.projectionCache.cachedAnchorPoint=X);let re,ce,pe=X,me=X,we=0,ae=0;const Ce=Math.abs(z),Pe=[];let ze;for(;we+ae<=Ce;){if(Q+=F,Q<_||Q>=S)return null;we+=ae,me=pe,ce=re;const gt={absOffsetX:Ce,direction:F,distanceFromAnchor:we,previousVertex:me};if(pe=_e(Q,E,gt),u===0)Pe.push(me),ze=pe.sub(me);else{let wt;const dt=pe.sub(me);wt=dt.mag()===0?Je(_e(Q+F,E,gt).sub(pe),u,F):Je(dt,u,F),ce||(ce=me.add(wt)),re=$e(Q,wt,pe,_,S,ce,u,E,gt),Pe.push(ce),ze=re.sub(ce)}ae=ze.mag()}const Ye=ze._mult((Ce-we)/ae)._add(ce||me),st=B+Math.atan2(pe.y-me.y,pe.x-me.x);return Pe.push(Ye),{point:Ye,angle:C?st:0,path:Pe}}const Rt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ot(v,r){for(let u=0;u=1;tr--)_t.push(qt.path[tr]);for(let tr=1;trar.signedDistanceFromCamera<=0)?[]:tr.map(ar=>ar.point)}let Hr=[];if(_t.length>0){const tr=_t[0].clone(),ar=_t[0].clone();for(let Wr=1;Wr<_t.length;Wr++)tr.x=Math.min(tr.x,_t[Wr].x),tr.y=Math.min(tr.y,_t[Wr].y),ar.x=Math.max(ar.x,_t[Wr].x),ar.y=Math.max(ar.y,_t[Wr].y);Hr=tr.x>=dt.x&&ar.x<=ct.x&&tr.y>=dt.y&&ar.y<=ct.y?[_t]:ar.xct.x||ar.yct.y?[]:c.al([_t],dt.x,dt.y,ct.x,ct.y)}for(const tr of Hr){Pt.reset(tr,.25*wt);let ar=0;ar=Pt.length<=.5*wt?1:Math.ceil(Pt.paddedLength/Gt)+1;for(let Wr=0;Wrhe(m.x,m.y,p,u.getElevation))}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const u=[];let p=1/0,m=1/0,_=-1/0,S=-1/0;for(const F of r){const B=new c.P(F.x+Qt,F.y+Qt);p=Math.min(p,B.x),m=Math.min(m,B.y),_=Math.max(_,B.x),S=Math.max(S,B.y),u.push(B)}const E=this.grid.query(p,m,_,S).concat(this.ignoredGrid.query(p,m,_,S)),C={},z={};for(const F of E){const B=F.key;if(C[B.bucketInstanceId]===void 0&&(C[B.bucketInstanceId]={}),C[B.bucketInstanceId][B.featureIndex])continue;const X=[new c.P(F.x1,F.y1),new c.P(F.x2,F.y1),new c.P(F.x2,F.y2),new c.P(F.x1,F.y2)];c.am(u,X)&&(C[B.bucketInstanceId][B.featureIndex]=!0,z[B.bucketInstanceId]===void 0&&(z[B.bucketInstanceId]=[]),z[B.bucketInstanceId].push(B.featureIndex))}return z}insertCollisionBox(r,u,p,m,_,S){(p?this.ignoredGrid:this.grid).insert({bucketInstanceId:m,featureIndex:_,collisionGroupID:S,overlapMode:u},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,u,p,m,_,S){const E=p?this.ignoredGrid:this.grid,C={bucketInstanceId:m,featureIndex:_,collisionGroupID:S,overlapMode:u};for(let z=0;z=this.screenRightBoundary||mthis.screenBottomBoundary}isInsideGrid(r,u,p,m){return p>=0&&r=0&&uthis.projectAndGetPerspectiveRatio(p,wt.x,wt.y,m,z));st=gt.some(wt=>!wt.isOccluded),Ye=gt.map(wt=>wt.point)}else st=!0;return{box:c.ao(Ye),allPointsOccluded:!st}}}function or(v,r,u){return r*(c.X/(v.tileSize*Math.pow(2,u-v.tileID.overscaledZ)))}class Tn{constructor(r,u,p,m){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?u:-u))):m&&p?1:0,this.placed=p}isHidden(){return this.opacity===0&&!this.placed}}class rn{constructor(r,u,p,m,_){this.text=new Tn(r?r.text:null,u,p,_),this.icon=new Tn(r?r.icon:null,u,m,_)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class rr{constructor(r,u,p){this.text=r,this.icon=u,this.skipFade=p}}class Mr{constructor(){this.invProjMatrix=c.H(),this.viewportMatrix=c.H(),this.circles=[]}}class Yr{constructor(r,u,p,m,_){this.bucketInstanceId=r,this.featureIndex=u,this.sourceLayerIndex=p,this.bucketIndex=m,this.tileID=_}}class Dn{constructor(r){this.crossSourceCollisions=r,this.maxGroupID=0,this.collisionGroups={}}get(r){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[r]){const u=++this.maxGroupID;this.collisionGroups[r]={ID:u,predicate:p=>p.collisionGroupID===u}}return this.collisionGroups[r]}}function Bn(v,r,u,p,m){const{horizontalAlign:_,verticalAlign:S}=c.au(v);return new c.P(-(_-.5)*r+p[0]*m,-(S-.5)*u+p[1]*m)}class ni{constructor(r,u,p,m,_,S){this.transform=r.clone(),this.terrain=p,this.collisionIndex=new gr(this.transform,u),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Dn(_),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=S,S&&(S.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(r){const u=this.terrain;return u?(p,m)=>u.getElevation(r,p,m):null}getBucketParts(r,u,p,m){const _=p.getBucket(u),S=p.latestFeatureIndex;if(!_||!S||u.id!==_.layerIds[0])return;const E=p.collisionBoxArray,C=_.layers[0].layout,z=_.layers[0].paint,F=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),B=p.tileSize/c.X,X=p.tileID.toUnwrapped(),Q=this.transform.calculatePosMatrix(X),re=C.get("text-pitch-alignment")==="map",ce=C.get("text-rotation-alignment")==="map",pe=or(p,1,this.transform.zoom),me=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("text-translate"),z.get("text-translate-anchor")),we=this.collisionIndex.mapProjection.translatePosition(this.transform,p,z.get("icon-translate"),z.get("icon-translate-anchor")),ae=ps(Q,re,ce,this.transform,pe);let Ce=null;if(re){const ze=Hn(Q,re,ce,this.transform,pe);Ce=c.L([],this.transform.labelPlaneMatrix,ze)}this.retainedQueryData[_.bucketInstanceId]=new Yr(_.bucketInstanceId,S,_.sourceLayerIndex,_.index,p.tileID);const Pe={bucket:_,layout:C,translationText:me,translationIcon:we,posMatrix:Q,unwrappedTileID:X,textLabelPlaneMatrix:ae,labelToScreenMatrix:Ce,scale:F,textPixelRatio:B,holdingForFade:p.holdingForFade(),collisionBoxArray:E,partiallyEvaluatedTextSize:c.ag(_.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(_.sourceID)};if(m)for(const ze of _.sortKeyRanges){const{sortKey:Ye,symbolInstanceStart:st,symbolInstanceEnd:gt}=ze;r.push({sortKey:Ye,symbolInstanceStart:st,symbolInstanceEnd:gt,parameters:Pe})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:_.symbolInstances.length,parameters:Pe})}attemptAnchorPlacement(r,u,p,m,_,S,E,C,z,F,B,X,Q,re,ce,pe,me,we,ae){const Ce=c.aq[r.textAnchor],Pe=[r.textOffset0,r.textOffset1],ze=Bn(Ce,p,m,Pe,_),Ye=this.collisionIndex.placeCollisionBox(u,X,C,z,F,E,S,pe,B.predicate,ae,ze);if((!we||this.collisionIndex.placeCollisionBox(we,X,C,z,F,E,S,me,B.predicate,ae,ze).placeable)&&Ye.placeable){let st;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID].text&&(st=this.prevPlacement.variableOffsets[Q.crossTileID].anchor),Q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Q.crossTileID]={textOffset:Pe,width:p,height:m,anchor:Ce,textBoxScale:_,prevAnchor:st},this.markUsedJustification(re,Ce,Q,ce),re.allowVerticalPlacement&&(this.markUsedOrientation(re,ce,Q),this.placedOrientations[Q.crossTileID]=ce),{shift:ze,placedGlyphBoxes:Ye}}}placeLayerBucketPart(r,u,p){const{bucket:m,layout:_,translationText:S,translationIcon:E,posMatrix:C,unwrappedTileID:z,textLabelPlaneMatrix:F,labelToScreenMatrix:B,textPixelRatio:X,holdingForFade:Q,collisionBoxArray:re,partiallyEvaluatedTextSize:ce,collisionGroup:pe}=r.parameters,me=_.get("text-optional"),we=_.get("icon-optional"),ae=c.ar(_,"text-overlap","text-allow-overlap"),Ce=ae==="always",Pe=c.ar(_,"icon-overlap","icon-allow-overlap"),ze=Pe==="always",Ye=_.get("text-rotation-alignment")==="map",st=_.get("text-pitch-alignment")==="map",gt=_.get("icon-text-fit")!=="none",wt=_.get("symbol-z-order")==="viewport-y",dt=Ce&&(ze||!m.hasIconData()||we),ct=ze&&(Ce||!m.hasTextData()||me);!m.collisionArrays&&re&&m.deserializeCollisionBoxes(re);const Pt=this._getTerrainElevationFunc(this.retainedQueryData[m.bucketInstanceId].tileID),qt=(ft,_t,Gt)=>{var Hr,tr;if(u[ft.crossTileID])return;if(Q)return void(this.placements[ft.crossTileID]=new rr(!1,!1,!1));let ar=!1,Wr=!1,Gn=!0,xs=null,Gr={box:null,placeable:!1,offscreen:null},_i={box:null,placeable:!1,offscreen:null},ii=null,Zn=null,si=null,Ws=0,sl=0,Pc=0;_t.textFeatureIndex?Ws=_t.textFeatureIndex:ft.useRuntimeCollisionCircles&&(Ws=ft.featureIndex),_t.verticalTextFeatureIndex&&(sl=_t.verticalTextFeatureIndex);const ol=_t.textBox;if(ol){const ts=Nn=>{let qn=c.ah.horizontal;if(m.allowVerticalPlacement&&!Nn&&this.prevPlacement){const Li=this.prevPlacement.placedOrientations[ft.crossTileID];Li&&(this.placedOrientations[ft.crossTileID]=Li,qn=Li,this.markUsedOrientation(m,qn,ft))}return qn},rs=(Nn,qn)=>{if(m.allowVerticalPlacement&&ft.numVerticalGlyphVertices>0&&_t.verticalTextBox){for(const Li of m.writingModes)if(Li===c.ah.vertical?(Gr=qn(),_i=Gr):Gr=Nn(),Gr&&Gr.placeable)break}else Gr=Nn()},Ao=ft.textAnchorOffsetStartIndex,ws=ft.textAnchorOffsetEndIndex;if(ws===Ao){const Nn=(qn,Li)=>{const cr=this.collisionIndex.placeCollisionBox(qn,ae,X,C,z,st,Ye,S,pe.predicate,Pt);return cr&&cr.placeable&&(this.markUsedOrientation(m,Li,ft),this.placedOrientations[ft.crossTileID]=Li),cr};rs(()=>Nn(ol,c.ah.horizontal),()=>{const qn=_t.verticalTextBox;return m.allowVerticalPlacement&&ft.numVerticalGlyphVertices>0&&qn?Nn(qn,c.ah.vertical):{box:null,offscreen:null}}),ts(Gr&&Gr.placeable)}else{let Nn=c.aq[(tr=(Hr=this.prevPlacement)===null||Hr===void 0?void 0:Hr.variableOffsets[ft.crossTileID])===null||tr===void 0?void 0:tr.anchor];const qn=(cr,ua,al)=>{const ll=cr.x2-cr.x1,um=cr.y2-cr.y1,t0=ft.textBoxScale,cm=gt&&Pe==="never"?ua:null;let Do=null,hm=ae==="never"?1:2,Ac="never";Nn&&hm++;for(let hu=0;huqn(ol,_t.iconBox,c.ah.horizontal),()=>{const cr=_t.verticalTextBox;return m.allowVerticalPlacement&&(!Gr||!Gr.placeable)&&ft.numVerticalGlyphVertices>0&&cr?qn(cr,_t.verticalIconBox,c.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Gr&&(ar=Gr.placeable,Gn=Gr.offscreen);const Li=ts(Gr&&Gr.placeable);if(!ar&&this.prevPlacement){const cr=this.prevPlacement.variableOffsets[ft.crossTileID];cr&&(this.variableOffsets[ft.crossTileID]=cr,this.markUsedJustification(m,cr.anchor,ft,Li))}}}if(ii=Gr,ar=ii&&ii.placeable,Gn=ii&&ii.offscreen,ft.useRuntimeCollisionCircles){const ts=m.text.placedSymbolArray.get(ft.centerJustifiedTextSymbolIndex),rs=c.ai(m.textSizeData,ce,ts),Ao=_.get("text-padding");Zn=this.collisionIndex.placeCollisionCircles(ae,ts,m.lineVertexArray,m.glyphOffsetArray,rs,C,z,F,B,p,st,pe.predicate,ft.collisionCircleDiameter,Ao,S,Pt),Zn.circles.length&&Zn.collisionDetected&&!p&&c.w("Collisions detected, but collision boxes are not shown"),ar=Ce||Zn.circles.length>0&&!Zn.collisionDetected,Gn=Gn&&Zn.offscreen}if(_t.iconFeatureIndex&&(Pc=_t.iconFeatureIndex),_t.iconBox){const ts=rs=>this.collisionIndex.placeCollisionBox(rs,Pe,X,C,z,st,Ye,E,pe.predicate,Pt,gt&&xs?xs:void 0);_i&&_i.placeable&&_t.verticalIconBox?(si=ts(_t.verticalIconBox),Wr=si.placeable):(si=ts(_t.iconBox),Wr=si.placeable),Gn=Gn&&si.offscreen}const es=me||ft.numHorizontalGlyphVertices===0&&ft.numVerticalGlyphVertices===0,Mc=we||ft.numIconVertices===0;es||Mc?Mc?es||(Wr=Wr&&ar):ar=Wr&&ar:Wr=ar=Wr&&ar;const Fd=Wr&&si.placeable;if(ar&&ii.placeable&&this.collisionIndex.insertCollisionBox(ii.box,ae,_.get("text-ignore-placement"),m.bucketInstanceId,_i&&_i.placeable&&sl?sl:Ws,pe.ID),Fd&&this.collisionIndex.insertCollisionBox(si.box,Pe,_.get("icon-ignore-placement"),m.bucketInstanceId,Pc,pe.ID),Zn&&ar&&this.collisionIndex.insertCollisionCircles(Zn.circles,ae,_.get("text-ignore-placement"),m.bucketInstanceId,Ws,pe.ID),p&&this.storeCollisionData(m.bucketInstanceId,Gt,_t,ii,si,Zn),ft.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(m.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[ft.crossTileID]=new rr(ar||dt,Wr||ct,Gn||m.justReloaded),u[ft.crossTileID]=!0};if(wt){if(r.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const ft=m.getSortedSymbolIndexes(this.transform.angle);for(let _t=ft.length-1;_t>=0;--_t){const Gt=ft[_t];qt(m.symbolInstances.get(Gt),m.collisionArrays[Gt],Gt)}}else for(let ft=r.symbolInstanceStart;ft=0&&(r.text.placedSymbolArray.get(E).crossTileID=_>=0&&E!==_?0:p.crossTileID)}markUsedOrientation(r,u,p){const m=u===c.ah.horizontal||u===c.ah.horizontalOnly?u:0,_=u===c.ah.vertical?u:0,S=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const E of S)r.text.placedSymbolArray.get(E).placedOrientation=m;p.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=_)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const u=this.prevPlacement;let p=!1;this.prevZoomAdjustment=u?u.zoomAdjustment(this.transform.zoom):0;const m=u?u.symbolFadeChange(r):1,_=u?u.opacities:{},S=u?u.variableOffsets:{},E=u?u.placedOrientations:{};for(const C in this.placements){const z=this.placements[C],F=_[C];F?(this.opacities[C]=new rn(F,m,z.text,z.icon),p=p||z.text!==F.text.placed||z.icon!==F.icon.placed):(this.opacities[C]=new rn(null,m,z.text,z.icon,z.skipFade),p=p||z.text||z.icon)}for(const C in _){const z=_[C];if(!this.opacities[C]){const F=new rn(z,m,!1,!1);F.isHidden()||(this.opacities[C]=F,p=p||z.text.placed||z.icon.placed)}}for(const C in S)this.variableOffsets[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.variableOffsets[C]=S[C]);for(const C in E)this.placedOrientations[C]||!this.opacities[C]||this.opacities[C].isHidden()||(this.placedOrientations[C]=E[C]);if(u&&u.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");p?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=u?u.lastPlacementChangeTime:r)}updateLayerOpacities(r,u){const p={};for(const m of u){const _=m.getBucket(r);_&&m.latestFeatureIndex&&r.id===_.layerIds[0]&&this.updateBucketOpacities(_,m.tileID,p,m.collisionBoxArray)}}updateBucketOpacities(r,u,p,m){r.hasTextData()&&(r.text.opacityVertexArray.clear(),r.text.hasVisibleVertices=!1),r.hasIconData()&&(r.icon.opacityVertexArray.clear(),r.icon.hasVisibleVertices=!1),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const _=r.layers[0],S=_.layout,E=new rn(null,0,!1,!1,!0),C=S.get("text-allow-overlap"),z=S.get("icon-allow-overlap"),F=_._unevaluatedLayout.hasValue("text-variable-anchor")||_._unevaluatedLayout.hasValue("text-variable-anchor-offset"),B=S.get("text-rotation-alignment")==="map",X=S.get("text-pitch-alignment")==="map",Q=S.get("icon-text-fit")!=="none",re=new rn(null,0,C&&(z||!r.hasIconData()||S.get("icon-optional")),z&&(C||!r.hasTextData()||S.get("text-optional")),!0);!r.collisionArrays&&m&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(m);const ce=(me,we,ae)=>{for(let Ce=0;Ce0,st=this.placedOrientations[we.crossTileID],gt=st===c.ah.vertical,wt=st===c.ah.horizontal||st===c.ah.horizontalOnly;if(ae>0||Ce>0){const ct=Di(ze.text);ce(r.text,ae,gt?Ba:ct),ce(r.text,Ce,wt?Ba:ct);const Pt=ze.text.isHidden();[we.rightJustifiedTextSymbolIndex,we.centerJustifiedTextSymbolIndex,we.leftJustifiedTextSymbolIndex].forEach(_t=>{_t>=0&&(r.text.placedSymbolArray.get(_t).hidden=Pt||gt?1:0)}),we.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(we.verticalPlacedTextSymbolIndex).hidden=Pt||wt?1:0);const qt=this.variableOffsets[we.crossTileID];qt&&this.markUsedJustification(r,qt.anchor,we,st);const ft=this.placedOrientations[we.crossTileID];ft&&(this.markUsedJustification(r,"left",we,ft),this.markUsedOrientation(r,ft,we))}if(Ye){const ct=Di(ze.icon),Pt=!(Q&&we.verticalPlacedIconSymbolIndex&>);we.placedIconSymbolIndex>=0&&(ce(r.icon,we.numIconVertices,Pt?ct:Ba),r.icon.placedSymbolArray.get(we.placedIconSymbolIndex).hidden=ze.icon.isHidden()),we.verticalPlacedIconSymbolIndex>=0&&(ce(r.icon,we.numVerticalIconVertices,Pt?Ba:ct),r.icon.placedSymbolArray.get(we.verticalPlacedIconSymbolIndex).hidden=ze.icon.isHidden())}const dt=pe&&pe.has(me)?pe.get(me):{text:null,icon:null};if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const ct=r.collisionArrays[me];if(ct){let Pt=new c.P(0,0);if(ct.textBox||ct.verticalTextBox){let qt=!0;if(F){const ft=this.variableOffsets[Pe];ft?(Pt=Bn(ft.anchor,ft.width,ft.height,ft.textOffset,ft.textBoxScale),B&&Pt._rotate(X?this.transform.angle:-this.transform.angle)):qt=!1}if(ct.textBox||ct.verticalTextBox){let ft;ct.textBox&&(ft=gt),ct.verticalTextBox&&(ft=wt),Fa(r.textCollisionBox.collisionVertexArray,ze.text.placed,!qt||ft,dt.text,Pt.x,Pt.y)}}if(ct.iconBox||ct.verticalIconBox){const qt=!!(!wt&&ct.verticalIconBox);let ft;ct.iconBox&&(ft=qt),ct.verticalIconBox&&(ft=!qt),Fa(r.iconCollisionBox.collisionVertexArray,ze.icon.placed,ft,dt.icon,Q?Pt.x:0,Q?Pt.y:0)}}}}if(r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.text.opacityVertexArray.length!==r.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${r.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${r.text.layoutVertexArray.length}) / 4`);if(r.icon.opacityVertexArray.length!==r.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${r.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${r.icon.layoutVertexArray.length}) / 4`);if(r.bucketInstanceId in this.collisionCircleArrays){const me=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=me.invProjMatrix,r.placementViewportMatrix=me.viewportMatrix,r.collisionCircleArray=me.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return this.stale||r-this.lastPlacementChangeTimer}setStale(){this.stale=!0}}function Fa(v,r,u,p,m,_){p&&p.length!==0||(p=[0,0,0,0]);const S=p[0]-Qt,E=p[1]-Qt,C=p[2]-Qt,z=p[3]-Qt;v.emplaceBack(r?1:0,u?1:0,m||0,_||0,S,E),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,C,E),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,C,z),v.emplaceBack(r?1:0,u?1:0,m||0,_||0,S,z)}const Ar=Math.pow(2,25),qh=Math.pow(2,24),Yh=Math.pow(2,17),Mi=Math.pow(2,16),Ai=Math.pow(2,9),P_=Math.pow(2,8),Xi=Math.pow(2,1);function Di(v){if(v.opacity===0&&!v.placed)return 0;if(v.opacity===1&&v.placed)return 4294967295;const r=v.placed?1:0,u=Math.floor(127*v.opacity);return u*Ar+r*qh+u*Yh+r*Mi+u*Ai+r*P_+u*Xi+r}const Ba=0;function Ko(){return{isOccluded:(v,r,u)=>!1,getPitchedTextCorrection:(v,r,u)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(v,r,u,p){throw new Error("Not implemented.")},translatePosition:(v,r,u,p)=>function(m,_,S,E,C=!1){if(!S[0]&&!S[1])return[0,0];const z=C?E==="map"?m.angle:0:E==="viewport"?-m.angle:0;if(z){const F=Math.sin(z),B=Math.cos(z);S=[S[0]*B-S[1]*F,S[0]*F+S[1]*B]}return[C?S[0]:or(_,S[0],m.zoom),C?S[1]:or(_,S[1],m.zoom)]}(v,r,u,p),getCircleRadiusCorrection:v=>1}}class En{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&!r.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(r,u,p,m,_){const S=this._bucketParts;for(;this._currentTileIndexE.sortKey-C.sortKey));this._currentPartIndex!this._forceFullPlacement&&A.now()-m>2;for(;this._currentPlacementIndex>=0;){const S=u[r[this._currentPlacementIndex]],E=this.placement.collisionIndex.transform.zoom;if(S.type==="symbol"&&(!S.minzoom||S.minzoom<=E)&&(!S.maxzoom||S.maxzoom>E)){if(this._inProgressLayer||(this._inProgressLayer=new En(S)),this._inProgressLayer.continuePlacement(p[S.source],this.placement,this._showCollisionBoxes,S,_))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(r){return this.placement.commit(r),this.placement}}const ms=512/c.X/2;class xn{constructor(r,u,p){this.tileID=r,this.bucketInstanceId=p,this._symbolsByKey={};const m=new Map;for(let _=0;_({x:Math.floor(C.anchorX*ms),y:Math.floor(C.anchorY*ms)})),crossTileIDs:S.map(C=>C.crossTileID)};if(E.positions.length>128){const C=new c.av(E.positions.length,16,Uint16Array);for(const{x:z,y:F}of E.positions)C.add(z,F);C.finish(),delete E.positions,E.index=C}this._symbolsByKey[_]=E}}getScaledCoordinates(r,u){const{x:p,y:m,z:_}=this.tileID.canonical,{x:S,y:E,z:C}=u.canonical,z=ms/Math.pow(2,C-_),F=(E*c.X+r.anchorY)*z,B=m*c.X*ms;return{x:Math.floor((S*c.X+r.anchorX)*z-p*c.X*ms),y:Math.floor(F-B)}}findMatches(r,u,p){const m=this.tileID.canonical.zr)}}class Ju{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class gs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const u=Math.round((r-this.lng)/360);if(u!==0)for(const p in this.indexes){const m=this.indexes[p],_={};for(const S in m){const E=m[S];E.tileID=E.tileID.unwrapTo(E.tileID.wrap+u),_[E.tileID.key]=E}this.indexes[p]=_}this.lng=r}addBucket(r,u,p){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===u.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let _=0;_r.overscaledZ)for(const E in S){const C=S[E];C.tileID.isChildOf(r)&&C.findMatches(u.symbolInstances,r,m)}else{const E=S[r.scaledTo(Number(_)).key];E&&E.findMatches(u.symbolInstances,r,m)}}for(let _=0;_{u[p]=!0});for(const p in this.layerIndexes)u[p]||delete this.layerIndexes[p]}}const ys=(v,r)=>c.t(v,r&&r.filter(u=>u.identifier!=="source.canvas")),M_=c.aw();class Qu extends c.E{constructor(r,u={}){super(),this._rtlPluginLoaded=()=>{for(const p in this.sourceCaches){const m=this.sourceCaches[p].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[p].reload()}},this.map=r,this.dispatcher=new _r(Yt(),r._getMapId()),this.dispatcher.registerMessageHandler("GG",(p,m)=>this.getGlyphs(p,m)),this.dispatcher.registerMessageHandler("GI",(p,m)=>this.getImages(p,m)),this.imageManager=new Ue,this.imageManager.setEventedParent(this),this.glyphManager=new ye(r._requestManager,u.localIdeographFontFamily),this.lineAtlas=new mt(256,512),this.crossTileSymbolIndex=new Xh,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.ay()),vn().on(Ze,this._rtlPluginLoaded),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.sourceCaches[p.sourceId];if(!m)return;const _=m.getSource();if(_&&_.vectorLayerIds)for(const S in this._layers){const E=this._layers[S];E.source===_.id&&this._validateLayer(E)}})}loadURL(r,u={},p){this.fire(new c.k("dataloading",{dataType:"style"})),u.validate=typeof u.validate!="boolean"||u.validate;const m=this.map._requestManager.transformRequest(r,"Style");this._loadStyleRequest=new AbortController;const _=this._loadStyleRequest;c.h(m,this._loadStyleRequest).then(S=>{this._loadStyleRequest=null,this._load(S.data,u,p)}).catch(S=>{this._loadStyleRequest=null,S&&!_.signal.aborted&&this.fire(new c.j(S))})}loadJSON(r,u={},p){this.fire(new c.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,A.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,u.validate=u.validate!==!1,this._load(r,u,p)}).catch(()=>{})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(M_,{validate:!1})}_load(r,u,p){var m;const _=u.transformStyle?u.transformStyle(p,r):r;if(!u.validate||!ys(this,c.u(_))){this._loaded=!0,this.stylesheet=_;for(const S in _.sources)this.addSource(S,_.sources[S],{validate:!1});_.sprite?this._loadSprite(_.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(_.glyphs),this._createLayers(),this.light=new Xe(this.stylesheet.light),this.sky=new Ee(this.stylesheet.sky),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const r=c.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",r),this._order=r.map(u=>u.id),this._layers={},this._serializedLayers=null;for(const u of r){const p=c.aA(u);p.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=p}}_loadSprite(r,u=!1,p=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(_,S,E,C){return c._(this,void 0,void 0,function*(){const z=Oe(_),F=E>1?"@2x":"",B={},X={};for(const{id:Q,url:re}of z){const ce=S.transformRequest(We(re,F,".json"),"SpriteJSON");B[Q]=c.h(ce,C);const pe=S.transformRequest(We(re,F,".png"),"SpriteImage");X[Q]=q.getImage(pe,C)}return yield Promise.all([...Object.values(B),...Object.values(X)]),function(Q,re){return c._(this,void 0,void 0,function*(){const ce={};for(const pe in Q){ce[pe]={};const me=A.getImageCanvasContext((yield re[pe]).data),we=(yield Q[pe]).data;for(const ae in we){const{width:Ce,height:Pe,x:ze,y:Ye,sdf:st,pixelRatio:gt,stretchX:wt,stretchY:dt,content:ct,textFitWidth:Pt,textFitHeight:qt}=we[ae];ce[pe][ae]={data:null,pixelRatio:gt,sdf:st,stretchX:wt,stretchY:dt,content:ct,textFitWidth:Pt,textFitHeight:qt,spriteData:{width:Ce,height:Pe,x:ze,y:Ye,context:me}}}}return ce})}(B,X)})}(r,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(_=>{if(this._spriteRequest=null,_)for(const S in _){this._spritesImagesIds[S]=[];const E=this._spritesImagesIds[S]?this._spritesImagesIds[S].filter(C=>!(C in _)):[];for(const C of E)this.imageManager.removeImage(C),this._changedImages[C]=!0;for(const C in _[S]){const z=S==="default"?C:`${S}:${C}`;this._spritesImagesIds[S].push(z),z in this.imageManager.images?this.imageManager.updateImage(z,_[S][C],!1):this.imageManager.addImage(z,_[S][C]),u&&(this._changedImages[z]=!0)}}}).catch(_=>{this._spriteRequest=null,m=_,this.fire(new c.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),u&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),p&&p(m)})}_unloadSprite(){for(const r of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(r),this._changedImages[r]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(r){const u=this.sourceCaches[r.source];if(!u)return;const p=r.sourceLayer;if(!p)return;const m=u.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(p)===-1)&&this.fire(new c.j(new Error(`Source layer "${p}" does not exist on source "${m.id}" as specified by style layer "${r.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const r in this.sourceCaches)if(!this.sourceCaches[r].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(r,u=!1){const p=this._serializedAllLayers();if(!r||r.length===0)return Object.values(u?c.aB(p):p);const m=[];for(const _ of r)if(p[_]){const S=u?c.aB(p[_]):p[_];m.push(S)}return m}_serializedAllLayers(){let r=this._serializedLayers;if(r)return r;r=this._serializedLayers={};const u=Object.keys(this._layers);for(const p of u){const m=this._layers[p];m.type!=="custom"&&(r[p]=m.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const r in this.sourceCaches)if(this.sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(r){if(!this._loaded)return;const u=this._changed;if(u){const m=Object.keys(this._updatedLayers),_=Object.keys(this._removedLayers);(m.length||_.length)&&this._updateWorkerLayers(m,_);for(const S in this._updatedSources){const E=this._updatedSources[S];if(E==="reload")this._reloadSource(S);else{if(E!=="clear")throw new Error(`Invalid action ${E}`);this._clearSource(S)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const S in this._updatedPaintProps)this._layers[S].updateTransitions(r);this.light.updateTransitions(r),this.sky.updateTransitions(r),this._resetUpdates()}const p={};for(const m in this.sourceCaches){const _=this.sourceCaches[m];p[m]=_.used,_.used=!1}for(const m of this._order){const _=this._layers[m];_.recalculate(r,this._availableImages),!_.isHidden(r.zoom)&&_.source&&(this.sourceCaches[_.source].used=!0)}for(const m in p){const _=this.sourceCaches[m];!!p[m]!=!!_.used&&_.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(r),this.sky.recalculate(r),this.z=r.zoom,u&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=Object.keys(this._changedImages);if(r.length){for(const u in this.sourceCaches)this.sourceCaches[u].reloadTilesForDependencies(["icons","patterns"],r);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const r in this.sourceCaches)this.sourceCaches[r].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(r,u){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(r,!1),removedIds:u})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(r,u={}){var p;this._checkLoaded();const m=this.serialize();if(r=u.transformStyle?u.transformStyle(m,r):r,((p=u.validate)===null||p===void 0||p)&&ys(this,c.u(r)))return!1;(r=c.aB(r)).layers=c.az(r.layers);const _=c.aC(m,r),S=this._getOperationsToPerform(_);if(S.unimplemented.length>0)throw new Error(`Unimplemented: ${S.unimplemented.join(", ")}.`);if(S.operations.length===0)return!1;for(const E of S.operations)E();return this.stylesheet=r,this._serializedLayers=null,!0}_getOperationsToPerform(r){const u=[],p=[];for(const m of r)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":u.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":u.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":u.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":u.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":u.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":u.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":u.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":u.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":u.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":u.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":u.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":u.push(()=>this.setSprite.apply(this,m.args));break;case"setSky":u.push(()=>this.setSky.apply(this,m.args));break;case"setTerrain":u.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":u.push(()=>{});break;default:p.push(m.command)}return{operations:u,unimplemented:p}}addImage(r,u){if(this.getImage(r))return this.fire(new c.j(new Error(`An image named "${r}" already exists.`)));this.imageManager.addImage(r,u),this._afterImageUpdated(r)}updateImage(r,u){this.imageManager.updateImage(r,u)}getImage(r){return this.imageManager.getImage(r)}removeImage(r){if(!this.getImage(r))return this.fire(new c.j(new Error(`An image named "${r}" does not exist.`)));this.imageManager.removeImage(r),this._afterImageUpdated(r)}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(r,u,p={}){if(this._checkLoaded(),this.sourceCaches[r]!==void 0)throw new Error(`Source "${r}" already exists.`);if(!u.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(u).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(u.type)>=0&&this._validate(c.u.source,`sources.${r}`,u,null,p))return;this.map&&this.map._collectResourceTiming&&(u.collectResourceTiming=!0);const m=this.sourceCaches[r]=new Ut(r,u,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:r})),m.onAdd(this.map),this._changed=!0}removeSource(r){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===r)return this.fire(new c.j(new Error(`Source "${r}" cannot be removed while layer "${p}" is using it.`)));const u=this.sourceCaches[r];delete this.sourceCaches[r],delete this._updatedSources[r],u.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:r})),u.setEventedParent(null),u.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(r,u){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error(`There is no source with this ID=${r}`);const p=this.sourceCaches[r].getSource();if(p.type!=="geojson")throw new Error(`geojsonSource.type is ${p.type}, which is !== 'geojson`);p.setData(u),this._changed=!0}getSource(r){return this.sourceCaches[r]&&this.sourceCaches[r].getSource()}addLayer(r,u,p={}){this._checkLoaded();const m=r.id;if(this.getLayer(m))return void this.fire(new c.j(new Error(`Layer "${m}" already exists on this map.`)));let _;if(r.type==="custom"){if(ys(this,c.aD(r)))return;_=c.aA(r)}else{if("source"in r&&typeof r.source=="object"&&(this.addSource(m,r.source),r=c.aB(r),r=c.e(r,{source:m})),this._validate(c.u.layer,`layers.${m}`,r,{arrayIndex:-1},p))return;_=c.aA(r),this._validateLayer(_),_.setEventedParent(this,{layer:{id:m}})}const S=u?this._order.indexOf(u):this._order.length;if(u&&S===-1)this.fire(new c.j(new Error(`Cannot add layer "${m}" before non-existing layer "${u}".`)));else{if(this._order.splice(S,0,m),this._layerOrderChanged=!0,this._layers[m]=_,this._removedLayers[m]&&_.source&&_.type!=="custom"){const E=this._removedLayers[m];delete this._removedLayers[m],E.type!==_.type?this._updatedSources[_.source]="clear":(this._updatedSources[_.source]="reload",this.sourceCaches[_.source].pause())}this._updateLayer(_),_.onAdd&&_.onAdd(this.map)}}moveLayer(r,u){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new c.j(new Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===u)return;const p=this._order.indexOf(r);this._order.splice(p,1);const m=u?this._order.indexOf(u):this._order.length;u&&m===-1?this.fire(new c.j(new Error(`Cannot move layer "${r}" before non-existing layer "${u}".`))):(this._order.splice(m,0,r),this._layerOrderChanged=!0)}removeLayer(r){this._checkLoaded();const u=this._layers[r];if(!u)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${r}".`)));u.setEventedParent(null);const p=this._order.indexOf(r);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=u,delete this._layers[r],this._serializedLayers&&delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],u.onRemove&&u.onRemove(this.map)}getLayer(r){return this._layers[r]}getLayersOrder(){return[...this._order]}hasLayer(r){return r in this._layers}setLayerZoomRange(r,u,p){this._checkLoaded();const m=this.getLayer(r);m?m.minzoom===u&&m.maxzoom===p||(u!=null&&(m.minzoom=u),p!=null&&(m.maxzoom=p),this._updateLayer(m)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${r}".`)))}setFilter(r,u,p={}){this._checkLoaded();const m=this.getLayer(r);if(m){if(!c.aE(m.filter,u))return u==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(c.u.filter,`layers.${m.id}.filter`,u,null,p)||(m.filter=c.aB(u),this._updateLayer(m)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${r}".`)))}getFilter(r){return c.aB(this.getLayer(r).filter)}setLayoutProperty(r,u,p,m={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getLayoutProperty(u),p)||(_.setLayoutProperty(u,p,m),this._updateLayer(_)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${r}".`)))}getLayoutProperty(r,u){const p=this.getLayer(r);if(p)return p.getLayoutProperty(u);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${r}".`)))}setPaintProperty(r,u,p,m={}){this._checkLoaded();const _=this.getLayer(r);_?c.aE(_.getPaintProperty(u),p)||(_.setPaintProperty(u,p,m)&&this._updateLayer(_),this._changed=!0,this._updatedPaintProps[r]=!0,this._serializedLayers=null):this.fire(new c.j(new Error(`Cannot style non-existing layer "${r}".`)))}getPaintProperty(r,u){return this.getLayer(r).getPaintProperty(u)}setFeatureState(r,u){this._checkLoaded();const p=r.source,m=r.sourceLayer,_=this.sourceCaches[p];if(_===void 0)return void this.fire(new c.j(new Error(`The source '${p}' does not exist in the map's style.`)));const S=_.getSource().type;S==="geojson"&&m?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):S!=="vector"||m?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),_.setFeatureState(m,r.id,u)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(r,u){this._checkLoaded();const p=r.source,m=this.sourceCaches[p];if(m===void 0)return void this.fire(new c.j(new Error(`The source '${p}' does not exist in the map's style.`)));const _=m.getSource().type,S=_==="vector"?r.sourceLayer:void 0;_!=="vector"||S?u&&typeof r.id!="string"&&typeof r.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(S,r.id,u):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(r){this._checkLoaded();const u=r.source,p=r.sourceLayer,m=this.sourceCaches[u];if(m!==void 0)return m.getSource().type!=="vector"||p?(r.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(p,r.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${u}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const r=c.aF(this.sourceCaches,_=>_.serialize()),u=this._serializeByIds(this._order,!0),p=this.map.getTerrain()||void 0,m=this.stylesheet;return c.aG({version:m.version,name:m.name,metadata:m.metadata,light:m.light,sky:m.sky,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:r,layers:u,terrain:p},_=>_!==void 0)}_updateLayer(r){this._updatedLayers[r.id]=!0,r.source&&!this._updatedSources[r.source]&&this.sourceCaches[r.source].getSource().type!=="raster"&&(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(r){const u=S=>this._layers[S].type==="fill-extrusion",p={},m=[];for(let S=this._order.length-1;S>=0;S--){const E=this._order[S];if(u(E)){p[E]=S;for(const C of r){const z=C[E];if(z)for(const F of z)m.push(F)}}}m.sort((S,E)=>E.intersectionZ-S.intersectionZ);const _=[];for(let S=this._order.length-1;S>=0;S--){const E=this._order[S];if(u(E))for(let C=m.length-1;C>=0;C--){const z=m[C].feature;if(p[z.layer.id]{const st=me.featureSortOrder;if(st){const gt=st.indexOf(ze.featureIndex);return st.indexOf(Ye.featureIndex)-gt}return Ye.featureIndex-ze.featureIndex});for(const ze of Pe)Ce.push(ze)}}for(const me in re)re[me].forEach(we=>{const ae=we.feature,Ce=z[E[me].source].getFeatureState(ae.layer["source-layer"],ae.id);ae.source=ae.layer.source,ae.layer["source-layer"]&&(ae.sourceLayer=ae.layer["source-layer"]),ae.state=Ce});return re}(this._layers,S,this.sourceCaches,r,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(_)}querySourceFeatures(r,u){u&&u.filter&&this._validate(c.u.filter,"querySourceFeatures.filter",u.filter,null,u);const p=this.sourceCaches[r];return p?function(m,_){const S=m.getRenderableIds().map(z=>m.getTileByID(z)),E=[],C={};for(let z=0;zX.getTileByID(Q)).sort((Q,re)=>re.tileID.overscaledZ-Q.tileID.overscaledZ||(Q.tileID.isLessThan(re.tileID)?-1:1))}const B=this.crossTileSymbolIndex.addLayer(F,C[F.source],r.center.lng);S=S||B}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((_=_||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(A.now(),r.zoom))&&(this.pauseablePlacement=new Zl(r,this.map.terrain,this._order,_,u,p,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,C),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(A.now()),E=!0),S&&this.pauseablePlacement.placement.setStale()),E||S)for(const z of this._order){const F=this._layers[z];F.type==="symbol"&&this.placement.updateLayerOpacities(F,C[F.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(A.now())}_releaseSymbolFadeTiles(){for(const r in this.sourceCaches)this.sourceCaches[r].releaseSymbolFadeTiles()}getImages(r,u){return c._(this,void 0,void 0,function*(){const p=yield this.imageManager.getImages(u.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[u.source];return m&&m.setDependencies(u.tileID.key,u.type,u.icons),p})}getGlyphs(r,u){return c._(this,void 0,void 0,function*(){const p=yield this.glyphManager.getGlyphs(u.stacks),m=this.sourceCaches[u.source];return m&&m.setDependencies(u.tileID.key,u.type,[""]),p})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(r,u={}){this._checkLoaded(),r&&this._validate(c.u.glyphs,"glyphs",r,null,u)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=r,this.glyphManager.entries={},this.glyphManager.setURL(r))}addSprite(r,u,p={},m){this._checkLoaded();const _=[{id:r,url:u}],S=[...Oe(this.stylesheet.sprite),..._];this._validate(c.u.sprite,"sprite",S,null,p)||(this.stylesheet.sprite=S,this._loadSprite(_,!0,m))}removeSprite(r){this._checkLoaded();const u=Oe(this.stylesheet.sprite);if(u.find(p=>p.id===r)){if(this._spritesImagesIds[r])for(const p of this._spritesImagesIds[r])this.imageManager.removeImage(p),this._changedImages[p]=!0;u.splice(u.findIndex(p=>p.id===r),1),this.stylesheet.sprite=u.length>0?u:void 0,delete this._spritesImagesIds[r],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${r}" doesn't exists on this map.`)))}getSprite(){return Oe(this.stylesheet.sprite)}setSprite(r,u={},p){this._checkLoaded(),r&&this._validate(c.u.sprite,"sprite",r,null,u)||(this.stylesheet.sprite=r,r?this._loadSprite(r,!0,p):(this._unloadSprite(),p&&p(null)))}}var Jo=c.Y([{name:"a_pos",type:"Int16",components:2}]);const Po={prelude:Sr(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -841,7 +841,7 @@ uniform ${F} ${B} u_${X}; `),IO=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,xT=new Map;function $o(e){var t=xT.get(e);if(t===void 0){if(!IO.test(e))throw Error(dr(65,e));t=Et("<"+e),xT.set(e,t)}return t}var PO=Et("");function MO(e,t,i,o,h){switch(t){case"select":e.push($o("select"));var f=null,g=null;for(R in i)if(os.call(i,R)){var c=i[R];if(c!=null)switch(R){case"children":f=c;break;case"dangerouslySetInnerHTML":g=c;break;case"defaultValue":case"value":break;default:Is(e,o,R,c)}}return e.push(xl),Ag(e,g,f),f;case"option":g=h.selectedValue,e.push($o("option"));var T=c=null,P=null,R=null;for(f in i)if(os.call(i,f)){var A=i[f];if(A!=null)switch(f){case"children":c=A;break;case"selected":P=A;break;case"dangerouslySetInnerHTML":R=A;break;case"value":T=A;default:Is(e,o,f,A)}}if(g!=null)if(i=T!==null?""+T:CO(c),rx(g)){for(o=0;o"),zO=Et(''),LO=Et(""),OO=Et(''),BO=Et(""),NO=Et(""),$O=Et("");function wT(e,t,i){if($t(e,OO),i===null)throw Error(dr(395));return $t(e,i),un(e,FO)}var HO=Et('"),ZO=Et('"),XO=Et('"),QO=Et(''),t6=Et(""),r6=Et(''),i6=Et(""),s6=Et(''),a6=Et(""),l6=Et(''),c6=Et("");function h6(e,t,i,o){switch(i.insertionMode){case 0:case 1:return $t(e,HO),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,WO);case 2:return $t(e,ZO),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,qO);case 3:return $t(e,XO),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,KO);case 4:return $t(e,QO),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,e6);case 5:return $t(e,r6),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,n6);case 6:return $t(e,s6),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,o6);case 7:return $t(e,l6),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,u6);default:throw Error(dr(397))}}function d6(e,t){switch(t.insertionMode){case 0:case 1:return un(e,GO);case 2:return un(e,YO);case 3:return un(e,JO);case 4:return un(e,t6);case 5:return un(e,i6);case 6:return un(e,a6);case 7:return un(e,c6);default:throw Error(dr(397))}}var f6=Et('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'),p6=Et('$RS("'),m6=Et('","'),g6=Et('")<\/script>'),y6=Et('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'),_6=Et('$RC("'),v6=Et('","'),x6=Et('")<\/script>'),w6=Et('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'),b6=Et('$RX("'),S6=Et('"'),k6=Et(")<\/script>"),Av=Et(","),T6=/[<\u2028\u2029]/g;function Dv(e){return JSON.stringify(e).replace(T6,function(t){switch(t){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}var Rf=Object.assign,E6=Symbol.for("react.element"),qP=Symbol.for("react.portal"),YP=Symbol.for("react.fragment"),XP=Symbol.for("react.strict_mode"),KP=Symbol.for("react.profiler"),JP=Symbol.for("react.provider"),QP=Symbol.for("react.context"),eM=Symbol.for("react.forward_ref"),tM=Symbol.for("react.suspense"),rM=Symbol.for("react.suspense_list"),nM=Symbol.for("react.memo"),Bw=Symbol.for("react.lazy"),C6=Symbol.for("react.scope"),I6=Symbol.for("react.debug_trace_mode"),P6=Symbol.for("react.legacy_hidden"),M6=Symbol.for("react.default_value"),bT=Symbol.iterator;function nx(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case YP:return"Fragment";case qP:return"Portal";case KP:return"Profiler";case XP:return"StrictMode";case tM:return"Suspense";case rM:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case QP:return(e.displayName||"Context")+".Consumer";case JP:return(e._context.displayName||"Context")+".Provider";case eM:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case nM:return t=e.displayName||null,t!==null?t:nx(e.type)||"Memo";case Bw:t=e._payload,e=e._init;try{return nx(e(t))}catch{}}return null}var iM={};function ST(e,t){if(e=e.contextTypes,!e)return iM;var i={},o;for(o in e)i[o]=t[o];return i}var Du=null;function p_(e,t){if(e!==t){e.context._currentValue=e.parentValue,e=e.parent;var i=t.parent;if(e===null){if(i!==null)throw Error(dr(401))}else{if(i===null)throw Error(dr(401));p_(e,i)}t.context._currentValue=t.value}}function sM(e){e.context._currentValue=e.parentValue,e=e.parent,e!==null&&sM(e)}function oM(e){var t=e.parent;t!==null&&oM(t),e.context._currentValue=e.value}function aM(e,t){if(e.context._currentValue=e.parentValue,e=e.parent,e===null)throw Error(dr(402));e.depth===t.depth?p_(e,t):aM(e,t)}function lM(e,t){var i=t.parent;if(i===null)throw Error(dr(402));e.depth===i.depth?p_(e,i):lM(e,i),t.context._currentValue=t.value}function _y(e){var t=Du;t!==e&&(t===null?oM(e):e===null?sM(t):t.depth===e.depth?p_(t,e):t.depth>e.depth?aM(t,e):lM(t,e),Du=e)}var kT={isMounted:function(){return!1},enqueueSetState:function(e,t){e=e._reactInternals,e.queue!==null&&e.queue.push(t)},enqueueReplaceState:function(e,t){e=e._reactInternals,e.replace=!0,e.queue=[t]},enqueueForceUpdate:function(){}};function TT(e,t,i,o){var h=e.state!==void 0?e.state:null;e.updater=kT,e.props=i,e.state=h;var f={queue:[],replace:!1};e._reactInternals=f;var g=t.contextType;if(e.context=typeof g=="object"&&g!==null?g._currentValue:o,g=t.getDerivedStateFromProps,typeof g=="function"&&(g=g(i,h),h=g==null?h:Rf({},h,g),e.state=h),typeof t.getDerivedStateFromProps!="function"&&typeof e.getSnapshotBeforeUpdate!="function"&&(typeof e.UNSAFE_componentWillMount=="function"||typeof e.componentWillMount=="function"))if(t=e.state,typeof e.componentWillMount=="function"&&e.componentWillMount(),typeof e.UNSAFE_componentWillMount=="function"&&e.UNSAFE_componentWillMount(),t!==e.state&&kT.enqueueReplaceState(e,e.state,null),f.queue!==null&&0>=g,h-=g,{id:1<<32-Dg(t)+h|i<>>=0,e===0?32:31-(D6(e)/z6|0)|0}function L6(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var O6=typeof Object.is=="function"?Object.is:L6,Da=null,Nw=null,zg=null,Qr=null,wf=!1,vy=!1,ip=0,Il=null,m_=0;function Eu(){if(Da===null)throw Error(dr(321));return Da}function ET(){if(0e.progressiveChunkSize)o.rootSegmentID=e.nextSegmentId++,e.completedBoundaries.push(o),wT(t,e.responseState,o.id),ng(e,t,i);else{if(un(t,LO),i=o.completedSegments,i.length!==1)throw Error(dr(391));g_(e,t,i[0])}return un(t,NO)}function RT(e,t,i){return h6(t,e.responseState,i.formatContext,i.id),g_(e,t,i),d6(t,i.formatContext)}function LT(e,t,i){for(var o=i.completedSegments,h=0;h{g.current||(g.current=new _P.Popup({closeOnClick:!1,closeOnMove:o,closeButton:h,className:"popup"})),g.current.setLngLat([t,e]).setHTML(j6(i))},[e,t,i,f,o,h,g]),null}var Sp={};function mM(e,t,i){var o,h,f,g,c,T,P,R,A=0,M,N=e.type==="FeatureCollection",Y=e.type==="Feature",j=N?e.features.length:1;for(o=0;oi[0]&&(t[0]=i[0]),t[1]>i[1]&&(t[1]=i[1]),t[2]{if(e.file&&t&&e.file in t){if(e.file.endsWith("jpg")||e.file.endsWith("jpeg"))return Xe.jsx("img",{className:"popupImage",alt:"Message attached file",src:URL.createObjectURL(t[e.file])});if(e.file.endsWith("mp4"))return Xe.jsx("video",{controls:!0,autoplay:!0,loop:!0,className:"popupImage",alt:"Message attached file",src:URL.createObjectURL(t[e.file])})}return e.message};function X6({data:e,dataFiles:t}){const i=Ht.useRef(null),o=Ht.useRef(null),[h,f]=Ht.useState(null),g=Ht.useRef(null),c=T=>{const P=new Date(T.time);return String(P.getHours()).padStart(2,"0")+":"+String(P.getMinutes()).padStart(2,"0")};return Ht.useEffect(()=>{o.current||(o.current=new _P.Map({container:i.current,center:[0,0],zoom:17,style:z4}),o.current.on("load",()=>{o.current.setCenter(e.features[0].geometry.coordinates),o.current.addSource("locations",{data:e,type:"geojson"});const T=q6(e);o.current.fitBounds(T,{padding:50}),o.current.on("mouseenter","pois",()=>{o.current.getCanvas().style.cursor="pointer"}),o.current.on("mouseleave","pois",()=>{o.current.getCanvas().style.cursor="inherit"}),o.current.addLayer({id:"pois",type:"circle",source:"locations",layout:{},paint:{"circle-color":"#D63F40","circle-radius":10}}),o.current.on("click","pois",P=>{f(P.features[0])})}))},[e,g]),Ht.useEffect(()=>{!o.current||!h||(f(h),g.current.addTo(o.current))},[h]),Xe.jsxs("div",{className:"map-wrap",children:[Xe.jsx("div",{ref:i,className:"map"}),o.current&&h&&Xe.jsx(V6,{longitude:h.geometry.coordinates[0],latitude:h.geometry.coordinates[1],popupRef:g,closeOnMove:!1,closeButton:!0,children:Xe.jsxs("div",{className:"activePopupFeatureContent",children:[Xe.jsxs("p",{children:[Xe.jsx("span",{className:"msgUsername",children:h.properties.username}),Xe.jsx("span",{className:"msgDatetime",children:c(h.properties)})]}),Xe.jsx("p",{children:Y6(h.properties,t)})]})})]})}function K6({data:e,filename:t}){const i=o=>"data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(o));return Xe.jsx("a",{className:"primaryButton",href:i(e),download:`${t}.geojson`,children:Xe.jsx(ln,{id:"app.download",defaultMessage:"Download"})})}function J6({onOptionClick:e}){return Xe.jsx(Xe.Fragment,{children:Xe.jsx("div",{className:"appNav",children:Xe.jsx("button",{className:"textButton",onClick:()=>e("options"),children:Xe.jsx(ln,{id:"app.options",defaultMessage:"Options"})})})})}var ax={exports:{}},Zu={},yM={exports:{}},Q6="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",eF=Q6,tF=eF;function _M(){}function vM(){}vM.resetWarningCache=_M;var rF=function(){function e(o,h,f,g,c,T){if(T!==tF){var P=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw P.name="Invariant Violation",P}}e.isRequired=e;function t(){return e}var i={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:vM,resetWarningCache:_M};return i.PropTypes=i,i};yM.exports=rF();var xM=yM.exports,lx={exports:{}},Eo={},ux={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=R;/*! +`&&e.push(Mv),f;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":e.push($o(t));for(var N in i)if(os.call(i,N)&&(f=i[N],f!=null))switch(N){case"children":case"dangerouslySetInnerHTML":throw Error(dr(399,t));default:Is(e,o,N,f)}return e.push(vT),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return Pv(e,i,t,o);case"html":return h.insertionMode===0&&e.push(PO),Pv(e,i,t,o);default:if(t.indexOf("-")===-1&&typeof i.is!="string")return Pv(e,i,t,o);e.push($o(t)),g=f=null;for(P in i)if(os.call(i,P)&&(c=i[P],c!=null))switch(P){case"children":f=c;break;case"dangerouslySetInnerHTML":g=c;break;case"style":ZP(e,o,c);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:GP(P)&&typeof c!="function"&&typeof c!="symbol"&&e.push(vl,pr(P),Yc,pr(ui(c)),Tu)}return e.push(xl),Ag(e,g,f),f}}var AO=Et(""),zO=Et(''),LO=Et(""),OO=Et(''),BO=Et(""),NO=Et(""),$O=Et("");function wT(e,t,i){if($t(e,OO),i===null)throw Error(dr(395));return $t(e,i),un(e,FO)}var HO=Et('"),ZO=Et('"),XO=Et('"),QO=Et(''),t6=Et(""),r6=Et(''),i6=Et(""),s6=Et(''),a6=Et(""),l6=Et(''),c6=Et("");function h6(e,t,i,o){switch(i.insertionMode){case 0:case 1:return $t(e,HO),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,WO);case 2:return $t(e,ZO),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,qO);case 3:return $t(e,XO),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,KO);case 4:return $t(e,QO),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,e6);case 5:return $t(e,r6),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,n6);case 6:return $t(e,s6),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,o6);case 7:return $t(e,l6),$t(e,t.segmentPrefix),$t(e,pr(o.toString(16))),un(e,u6);default:throw Error(dr(397))}}function d6(e,t){switch(t.insertionMode){case 0:case 1:return un(e,GO);case 2:return un(e,YO);case 3:return un(e,JO);case 4:return un(e,t6);case 5:return un(e,i6);case 6:return un(e,a6);case 7:return un(e,c6);default:throw Error(dr(397))}}var f6=Et('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'),p6=Et('$RS("'),m6=Et('","'),g6=Et('")<\/script>'),y6=Et('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'),_6=Et('$RC("'),v6=Et('","'),x6=Et('")<\/script>'),w6=Et('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'),b6=Et('$RX("'),S6=Et('"'),k6=Et(")<\/script>"),Av=Et(","),T6=/[<\u2028\u2029]/g;function Dv(e){return JSON.stringify(e).replace(T6,function(t){switch(t){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}var Rf=Object.assign,E6=Symbol.for("react.element"),qP=Symbol.for("react.portal"),YP=Symbol.for("react.fragment"),XP=Symbol.for("react.strict_mode"),KP=Symbol.for("react.profiler"),JP=Symbol.for("react.provider"),QP=Symbol.for("react.context"),eM=Symbol.for("react.forward_ref"),tM=Symbol.for("react.suspense"),rM=Symbol.for("react.suspense_list"),nM=Symbol.for("react.memo"),Bw=Symbol.for("react.lazy"),C6=Symbol.for("react.scope"),I6=Symbol.for("react.debug_trace_mode"),P6=Symbol.for("react.legacy_hidden"),M6=Symbol.for("react.default_value"),bT=Symbol.iterator;function nx(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case YP:return"Fragment";case qP:return"Portal";case KP:return"Profiler";case XP:return"StrictMode";case tM:return"Suspense";case rM:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case QP:return(e.displayName||"Context")+".Consumer";case JP:return(e._context.displayName||"Context")+".Provider";case eM:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case nM:return t=e.displayName||null,t!==null?t:nx(e.type)||"Memo";case Bw:t=e._payload,e=e._init;try{return nx(e(t))}catch{}}return null}var iM={};function ST(e,t){if(e=e.contextTypes,!e)return iM;var i={},o;for(o in e)i[o]=t[o];return i}var Du=null;function p_(e,t){if(e!==t){e.context._currentValue=e.parentValue,e=e.parent;var i=t.parent;if(e===null){if(i!==null)throw Error(dr(401))}else{if(i===null)throw Error(dr(401));p_(e,i)}t.context._currentValue=t.value}}function sM(e){e.context._currentValue=e.parentValue,e=e.parent,e!==null&&sM(e)}function oM(e){var t=e.parent;t!==null&&oM(t),e.context._currentValue=e.value}function aM(e,t){if(e.context._currentValue=e.parentValue,e=e.parent,e===null)throw Error(dr(402));e.depth===t.depth?p_(e,t):aM(e,t)}function lM(e,t){var i=t.parent;if(i===null)throw Error(dr(402));e.depth===i.depth?p_(e,i):lM(e,i),t.context._currentValue=t.value}function _y(e){var t=Du;t!==e&&(t===null?oM(e):e===null?sM(t):t.depth===e.depth?p_(t,e):t.depth>e.depth?aM(t,e):lM(t,e),Du=e)}var kT={isMounted:function(){return!1},enqueueSetState:function(e,t){e=e._reactInternals,e.queue!==null&&e.queue.push(t)},enqueueReplaceState:function(e,t){e=e._reactInternals,e.replace=!0,e.queue=[t]},enqueueForceUpdate:function(){}};function TT(e,t,i,o){var h=e.state!==void 0?e.state:null;e.updater=kT,e.props=i,e.state=h;var f={queue:[],replace:!1};e._reactInternals=f;var g=t.contextType;if(e.context=typeof g=="object"&&g!==null?g._currentValue:o,g=t.getDerivedStateFromProps,typeof g=="function"&&(g=g(i,h),h=g==null?h:Rf({},h,g),e.state=h),typeof t.getDerivedStateFromProps!="function"&&typeof e.getSnapshotBeforeUpdate!="function"&&(typeof e.UNSAFE_componentWillMount=="function"||typeof e.componentWillMount=="function"))if(t=e.state,typeof e.componentWillMount=="function"&&e.componentWillMount(),typeof e.UNSAFE_componentWillMount=="function"&&e.UNSAFE_componentWillMount(),t!==e.state&&kT.enqueueReplaceState(e,e.state,null),f.queue!==null&&0>=g,h-=g,{id:1<<32-Dg(t)+h|i<>>=0,e===0?32:31-(D6(e)/z6|0)|0}function L6(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var O6=typeof Object.is=="function"?Object.is:L6,Da=null,Nw=null,zg=null,Qr=null,wf=!1,vy=!1,ip=0,Il=null,m_=0;function Eu(){if(Da===null)throw Error(dr(321));return Da}function ET(){if(0e.progressiveChunkSize)o.rootSegmentID=e.nextSegmentId++,e.completedBoundaries.push(o),wT(t,e.responseState,o.id),ng(e,t,i);else{if(un(t,LO),i=o.completedSegments,i.length!==1)throw Error(dr(391));g_(e,t,i[0])}return un(t,NO)}function RT(e,t,i){return h6(t,e.responseState,i.formatContext,i.id),g_(e,t,i),d6(t,i.formatContext)}function LT(e,t,i){for(var o=i.completedSegments,h=0;h{g.current||(g.current=new _P.Popup({closeOnClick:!1,closeOnMove:o,closeButton:h,className:"popup"})),g.current.setLngLat([t,e]).setHTML(j6(i))},[e,t,i,f,o,h,g]),null}var Sp={};function mM(e,t,i){var o,h,f,g,c,T,P,R,A=0,M,N=e.type==="FeatureCollection",Y=e.type==="Feature",j=N?e.features.length:1;for(o=0;oi[0]&&(t[0]=i[0]),t[1]>i[1]&&(t[1]=i[1]),t[2]{if(e.file&&t&&e.file in t){if(e.file.endsWith("jpg")||e.file.endsWith("jpeg"))return Ke.jsx("img",{className:"popupImage",alt:"Message attached file",src:URL.createObjectURL(t[e.file])});if(e.file.endsWith("mp4"))return Ke.jsx("video",{controls:!0,autoplay:!0,loop:!0,className:"popupImage",alt:"Message attached file",src:URL.createObjectURL(t[e.file])})}return e.message};function X6({data:e,dataFiles:t}){const i=Ht.useRef(null),o=Ht.useRef(null),[h,f]=Ht.useState(null),g=Ht.useRef(null),c=T=>{const P=new Date(T.time);return String(P.getHours()).padStart(2,"0")+":"+String(P.getMinutes()).padStart(2,"0")};return Ht.useEffect(()=>{o.current||(o.current=new _P.Map({container:i.current,center:[0,0],zoom:17,style:z4}),o.current.on("load",()=>{o.current.setCenter(e.features[0].geometry.coordinates),o.current.addSource("locations",{data:e,type:"geojson"});const T=q6(e);o.current.fitBounds(T,{padding:50}),o.current.on("mouseenter","pois",()=>{o.current.getCanvas().style.cursor="pointer"}),o.current.on("mouseleave","pois",()=>{o.current.getCanvas().style.cursor="inherit"}),o.current.addLayer({id:"pois",type:"circle",source:"locations",layout:{},paint:{"circle-color":"#D63F40","circle-radius":10}}),o.current.on("click","pois",P=>{f(P.features[0])})}))},[e,g]),Ht.useEffect(()=>{!o.current||!h||(f(h),g.current.addTo(o.current))},[h]),Ke.jsxs("div",{className:"map-wrap",children:[Ke.jsx("div",{ref:i,className:"map"}),o.current&&h&&Ke.jsx(V6,{longitude:h.geometry.coordinates[0],latitude:h.geometry.coordinates[1],popupRef:g,closeOnMove:!1,closeButton:!0,children:Ke.jsxs("div",{className:"activePopupFeatureContent",children:[Ke.jsxs("p",{children:[Ke.jsx("span",{className:"msgUsername",children:h.properties.username}),Ke.jsx("span",{className:"msgDatetime",children:c(h.properties)})]}),Ke.jsx("p",{children:Y6(h.properties,t)})]})})]})}function K6({data:e,filename:t}){const i=o=>"data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(o));return Ke.jsx("a",{className:"primaryButton",href:i(e),download:`${t}.geojson`,children:Ke.jsx(ln,{id:"app.download",defaultMessage:"Download"})})}function J6({onOptionClick:e}){return Ke.jsx(Ke.Fragment,{children:Ke.jsx("div",{className:"appNav",children:Ke.jsx("button",{className:"textButton",onClick:()=>e("options"),children:Ke.jsx(ln,{id:"app.options",defaultMessage:"Options"})})})})}var ax={exports:{}},Zu={},yM={exports:{}},Q6="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",eF=Q6,tF=eF;function _M(){}function vM(){}vM.resetWarningCache=_M;var rF=function(){function e(o,h,f,g,c,T){if(T!==tF){var P=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw P.name="Invariant Violation",P}}e.isRequired=e;function t(){return e}var i={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:vM,resetWarningCache:_M};return i.PropTypes=i,i};yM.exports=rF();var xM=yM.exports,lx={exports:{}},Eo={},ux={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=R;/*! * Adapted from jQuery UI core * * http://jqueryui.com @@ -855,7 +855,7 @@ uniform ${F} ${B} u_${X}; Copyright (c) 2015 Jed Watson. Based on code that is Copyright 2013-2015, Facebook, Inc. All rights reserved. -*/(function(e){(function(){var t=!!(typeof window<"u"&&window.document&&window.document.createElement),i={canUseDOM:t,canUseWorkers:typeof Worker<"u",canUseEventListeners:t&&!!(window.addEventListener||window.attachEvent),canUseViewport:t&&!!window.screen};e.exports?e.exports=i:window.ExecutionEnvironment=i})()})(bM);var gF=bM.exports;Object.defineProperty(bo,"__esModule",{value:!0});bo.canUseDOM=bo.SafeNodeList=bo.SafeHTMLCollection=void 0;var yF=gF,_F=vF(yF);function vF(e){return e&&e.__esModule?e:{default:e}}var y_=_F.default,xF=y_.canUseDOM?window.HTMLElement:{};bo.SafeHTMLCollection=y_.canUseDOM?window.HTMLCollection:{};bo.SafeNodeList=y_.canUseDOM?window.NodeList:{};bo.canUseDOM=y_.canUseDOM;bo.default=xF;Object.defineProperty(Co,"__esModule",{value:!0});Co.resetState=TF;Co.log=EF;Co.assertNodeList=SM;Co.setElement=CF;Co.validateElement=Hw;Co.hide=IF;Co.show=PF;Co.documentNotReadyOrSSRTesting=MF;var wF=mF,bF=kF(wF),SF=bo;function kF(e){return e&&e.__esModule?e:{default:e}}var qs=null;function TF(){qs&&(qs.removeAttribute?qs.removeAttribute("aria-hidden"):qs.length!=null?qs.forEach(function(e){return e.removeAttribute("aria-hidden")}):document.querySelectorAll(qs).forEach(function(e){return e.removeAttribute("aria-hidden")})),qs=null}function EF(){}function SM(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function CF(e){var t=e;if(typeof t=="string"&&SF.canUseDOM){var i=document.querySelectorAll(t);SM(i,t),t=i}return qs=t||qs,qs}function Hw(e){var t=e||qs;return t?Array.isArray(t)||t instanceof HTMLCollection||t instanceof NodeList?t:[t]:((0,bF.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),[])}function IF(e){var t=!0,i=!1,o=void 0;try{for(var h=Hw(e)[Symbol.iterator](),f;!(t=(f=h.next()).done);t=!0){var g=f.value;g.setAttribute("aria-hidden","true")}}catch(c){i=!0,o=c}finally{try{!t&&h.return&&h.return()}finally{if(i)throw o}}}function PF(e){var t=!0,i=!1,o=void 0;try{for(var h=Hw(e)[Symbol.iterator](),f;!(t=(f=h.next()).done);t=!0){var g=f.value;g.removeAttribute("aria-hidden")}}catch(c){i=!0,o=c}finally{try{!t&&h.return&&h.return()}finally{if(i)throw o}}}function MF(){qs=null}var Vh={};Object.defineProperty(Vh,"__esModule",{value:!0});Vh.resetState=AF;Vh.log=DF;var Lf={},Of={};function FT(e,t){e.classList.remove(t)}function AF(){var e=document.getElementsByTagName("html")[0];for(var t in Lf)FT(e,Lf[t]);var i=document.body;for(var o in Of)FT(i,Of[o]);Lf={},Of={}}function DF(){}var zF=function(t,i){return t[i]||(t[i]=0),t[i]+=1,i},RF=function(t,i){return t[i]&&(t[i]-=1),i},LF=function(t,i,o){o.forEach(function(h){zF(i,h),t.add(h)})},OF=function(t,i,o){o.forEach(function(h){RF(i,h),i[h]===0&&t.remove(h)})};Vh.add=function(t,i){return LF(t.classList,t.nodeName.toLowerCase()=="html"?Lf:Of,i.split(" "))};Vh.remove=function(t,i){return OF(t.classList,t.nodeName.toLowerCase()=="html"?Lf:Of,i.split(" "))};var Hh={};Object.defineProperty(Hh,"__esModule",{value:!0});Hh.log=BF;Hh.resetState=NF;function FF(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var kM=function e(){var t=this;FF(this,e),this.register=function(i){t.openInstances.indexOf(i)===-1&&(t.openInstances.push(i),t.emit("register"))},this.deregister=function(i){var o=t.openInstances.indexOf(i);o!==-1&&(t.openInstances.splice(o,1),t.emit("deregister"))},this.subscribe=function(i){t.subscribers.push(i)},this.emit=function(i){t.subscribers.forEach(function(o){return o(i,t.openInstances.slice())})},this.openInstances=[],this.subscribers=[]},Sy=new kM;function BF(){console.log("portalOpenInstances ----------"),console.log(Sy.openInstances.length),Sy.openInstances.forEach(function(e){return console.log(e)}),console.log("end portalOpenInstances ----------")}function NF(){Sy=new kM}Hh.default=Sy;var Ww={};Object.defineProperty(Ww,"__esModule",{value:!0});Ww.resetState=VF;Ww.log=HF;var $F=Hh,UF=jF($F);function jF(e){return e&&e.__esModule?e:{default:e}}var Ei=void 0,mo=void 0,Nu=[];function VF(){for(var e=[Ei,mo],t=0;t0?(document.body.firstChild!==Ei&&document.body.insertBefore(Ei,document.body.firstChild),document.body.lastChild!==mo&&document.body.appendChild(mo)):(Ei.parentElement&&Ei.parentElement.removeChild(Ei),mo.parentElement&&mo.parentElement.removeChild(mo))}UF.default.subscribe(WF);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(H){for(var Re=1;Re0&&(ve-=1,ve===0&&N.show(Le)),ye.props.shouldFocusAfterRender&&(ye.props.shouldReturnFocusAfterClose?(P.returnFocus(ye.props.preventScroll),P.teardownScopedFocus()):P.popWithoutFocus()),ye.props.onAfterClose&&ye.props.onAfterClose(),q.default.deregister(ye)},ye.open=function(){ye.beforeOpen(),ye.state.afterOpen&&ye.state.beforeClose?(clearTimeout(ye.closeTimer),ye.setState({beforeClose:!1})):(ye.props.shouldFocusAfterRender&&(P.setupScopedFocus(ye.node),P.markForFocusLater()),ye.setState({isOpen:!0},function(){ye.openAnimationFrame=requestAnimationFrame(function(){ye.setState({afterOpen:!0}),ye.props.isOpen&&ye.props.onAfterOpen&&ye.props.onAfterOpen({overlayEl:ye.overlay,contentEl:ye.content})})}))},ye.close=function(){ye.props.closeTimeoutMS>0?ye.closeWithTimeout():ye.closeWithoutTimeout()},ye.focusContent=function(){return ye.content&&!ye.contentHasFocus()&&ye.content.focus({preventScroll:!0})},ye.closeWithTimeout=function(){var Be=Date.now()+ye.props.closeTimeoutMS;ye.setState({beforeClose:!0,closesAt:Be},function(){ye.closeTimer=setTimeout(ye.closeWithoutTimeout,ye.state.closesAt-Date.now())})},ye.closeWithoutTimeout=function(){ye.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},ye.afterClose)},ye.handleKeyDown=function(Be){We(Be)&&(0,A.default)(ye.content,Be),ye.props.shouldCloseOnEsc&&it(Be)&&(Be.stopPropagation(),ye.requestClose(Be))},ye.handleOverlayOnClick=function(Be){ye.shouldClose===null&&(ye.shouldClose=!0),ye.shouldClose&&ye.props.shouldCloseOnOverlayClick&&(ye.ownerHandlesClose()?ye.requestClose(Be):ye.focusContent()),ye.shouldClose=null},ye.handleContentOnMouseUp=function(){ye.shouldClose=!1},ye.handleOverlayOnMouseDown=function(Be){!ye.props.shouldCloseOnOverlayClick&&Be.target==ye.overlay&&Be.preventDefault()},ye.handleContentOnClick=function(){ye.shouldClose=!1},ye.handleContentOnMouseDown=function(){ye.shouldClose=!1},ye.requestClose=function(Be){return ye.ownerHandlesClose()&&ye.props.onRequestClose(Be)},ye.ownerHandlesClose=function(){return ye.props.onRequestClose},ye.shouldBeClosed=function(){return!ye.state.isOpen&&!ye.state.beforeClose},ye.contentHasFocus=function(){return document.activeElement===ye.content||ye.content.contains(document.activeElement)},ye.buildClassName=function(Be,Le){var Ke=(typeof Le>"u"?"undefined":o(Le))==="object"?Le:{base:Oe[Be],afterOpen:Oe[Be]+"--after-open",beforeClose:Oe[Be]+"--before-close"},xe=Ke.base;return ye.state.afterOpen&&(xe=xe+" "+Ke.afterOpen),ye.state.beforeClose&&(xe=xe+" "+Ke.beforeClose),typeof Le=="string"&&Le?xe+" "+Le:xe},ye.attributesFromObject=function(Be,Le){return Object.keys(Le).reduce(function(Ke,xe){return Ke[Be+"-"+xe]=Le[xe],Ke},{})},ye.state={afterOpen:!1,beforeClose:!1},ye.shouldClose=null,ye.moveFromContentToOverlay=null,ye}return h(Re,[{key:"componentDidMount",value:function(){this.props.isOpen&&this.open()}},{key:"componentDidUpdate",value:function(ye,Be){this.props.isOpen&&!ye.isOpen?this.open():!this.props.isOpen&&ye.isOpen&&this.close(),this.props.shouldFocusAfterRender&&this.state.isOpen&&!Be.isOpen&&this.focusContent()}},{key:"componentWillUnmount",value:function(){this.state.isOpen&&this.afterClose(),clearTimeout(this.closeTimer),cancelAnimationFrame(this.openAnimationFrame)}},{key:"beforeOpen",value:function(){var ye=this.props,Be=ye.appElement,Le=ye.ariaHideApp,Ke=ye.htmlOpenClassName,xe=ye.bodyOpenClassName,Ee=ye.parentSelector,mt=Ee&&Ee().ownerDocument||document;xe&&j.add(mt.body,xe),Ke&&j.add(mt.getElementsByTagName("html")[0],Ke),Le&&(ve+=1,N.hide(Be)),q.default.register(this)}},{key:"render",value:function(){var ye=this.props,Be=ye.id,Le=ye.className,Ke=ye.overlayClassName,xe=ye.defaultStyles,Ee=ye.children,mt=Le?{}:xe.content,nt=Ke?{}:xe.overlay;if(this.shouldBeClosed())return null;var rt={ref:this.setOverlayRef,className:this.buildClassName("overlay",Ke),style:i({},nt,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown},Jt=i({id:Be,ref:this.setContentRef,style:i({},mt,this.props.style.content),className:this.buildClassName("content",Le),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.attributesFromObject("aria",i({modal:!0},this.props.aria)),this.attributesFromObject("data",this.props.data||{}),{"data-testid":this.props.testId}),er=this.props.contentElement(Jt,Ee);return this.props.overlayElement(rt,er)}}]),Re}(f.Component);Ue.defaultProps={style:{overlay:{},content:{}},defaultStyles:{}},Ue.propTypes={isOpen:c.default.bool.isRequired,defaultStyles:c.default.shape({content:c.default.object,overlay:c.default.object}),style:c.default.shape({content:c.default.object,overlay:c.default.object}),className:c.default.oneOfType([c.default.string,c.default.object]),overlayClassName:c.default.oneOfType([c.default.string,c.default.object]),parentSelector:c.default.func,bodyOpenClassName:c.default.string,htmlOpenClassName:c.default.string,ariaHideApp:c.default.bool,appElement:c.default.oneOfType([c.default.instanceOf(O.default),c.default.instanceOf(te.SafeHTMLCollection),c.default.instanceOf(te.SafeNodeList),c.default.arrayOf(c.default.instanceOf(O.default))]),onAfterOpen:c.default.func,onAfterClose:c.default.func,onRequestClose:c.default.func,closeTimeoutMS:c.default.number,shouldFocusAfterRender:c.default.bool,shouldCloseOnOverlayClick:c.default.bool,shouldReturnFocusAfterClose:c.default.bool,preventScroll:c.default.bool,role:c.default.string,contentLabel:c.default.string,aria:c.default.object,data:c.default.object,children:c.default.node,shouldCloseOnEsc:c.default.bool,overlayRef:c.default.func,contentRef:c.default.func,id:c.default.string,overlayElement:c.default.func,contentElement:c.default.func,testId:c.default.string},t.default=Ue,e.exports=t.default})(lx,lx.exports);var GF=lx.exports;function TM(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);e!=null&&this.setState(e)}function EM(e){function t(i){var o=this.constructor.getDerivedStateFromProps(e,i);return o??null}this.setState(t.bind(this))}function CM(e,t){try{var i=this.props,o=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(i,o)}finally{this.props=i,this.state=o}}TM.__suppressDeprecationWarning=!0;EM.__suppressDeprecationWarning=!0;CM.__suppressDeprecationWarning=!0;function ZF(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if(typeof e.getDerivedStateFromProps!="function"&&typeof t.getSnapshotBeforeUpdate!="function")return e;var i=null,o=null,h=null;if(typeof t.componentWillMount=="function"?i="componentWillMount":typeof t.UNSAFE_componentWillMount=="function"&&(i="UNSAFE_componentWillMount"),typeof t.componentWillReceiveProps=="function"?o="componentWillReceiveProps":typeof t.UNSAFE_componentWillReceiveProps=="function"&&(o="UNSAFE_componentWillReceiveProps"),typeof t.componentWillUpdate=="function"?h="componentWillUpdate":typeof t.UNSAFE_componentWillUpdate=="function"&&(h="UNSAFE_componentWillUpdate"),i!==null||o!==null||h!==null){var f=e.displayName||e.name,g=typeof e.getDerivedStateFromProps=="function"?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error(`Unsafe legacy lifecycles will not be called for components using new component APIs. +*/(function(e){(function(){var t=!!(typeof window<"u"&&window.document&&window.document.createElement),i={canUseDOM:t,canUseWorkers:typeof Worker<"u",canUseEventListeners:t&&!!(window.addEventListener||window.attachEvent),canUseViewport:t&&!!window.screen};e.exports?e.exports=i:window.ExecutionEnvironment=i})()})(bM);var gF=bM.exports;Object.defineProperty(bo,"__esModule",{value:!0});bo.canUseDOM=bo.SafeNodeList=bo.SafeHTMLCollection=void 0;var yF=gF,_F=vF(yF);function vF(e){return e&&e.__esModule?e:{default:e}}var y_=_F.default,xF=y_.canUseDOM?window.HTMLElement:{};bo.SafeHTMLCollection=y_.canUseDOM?window.HTMLCollection:{};bo.SafeNodeList=y_.canUseDOM?window.NodeList:{};bo.canUseDOM=y_.canUseDOM;bo.default=xF;Object.defineProperty(Co,"__esModule",{value:!0});Co.resetState=TF;Co.log=EF;Co.assertNodeList=SM;Co.setElement=CF;Co.validateElement=Hw;Co.hide=IF;Co.show=PF;Co.documentNotReadyOrSSRTesting=MF;var wF=mF,bF=kF(wF),SF=bo;function kF(e){return e&&e.__esModule?e:{default:e}}var qs=null;function TF(){qs&&(qs.removeAttribute?qs.removeAttribute("aria-hidden"):qs.length!=null?qs.forEach(function(e){return e.removeAttribute("aria-hidden")}):document.querySelectorAll(qs).forEach(function(e){return e.removeAttribute("aria-hidden")})),qs=null}function EF(){}function SM(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function CF(e){var t=e;if(typeof t=="string"&&SF.canUseDOM){var i=document.querySelectorAll(t);SM(i,t),t=i}return qs=t||qs,qs}function Hw(e){var t=e||qs;return t?Array.isArray(t)||t instanceof HTMLCollection||t instanceof NodeList?t:[t]:((0,bF.default)(!1,["react-modal: App element is not defined.","Please use `Modal.setAppElement(el)` or set `appElement={el}`.","This is needed so screen readers don't see main content","when modal is opened. It is not recommended, but you can opt-out","by setting `ariaHideApp={false}`."].join(" ")),[])}function IF(e){var t=!0,i=!1,o=void 0;try{for(var h=Hw(e)[Symbol.iterator](),f;!(t=(f=h.next()).done);t=!0){var g=f.value;g.setAttribute("aria-hidden","true")}}catch(c){i=!0,o=c}finally{try{!t&&h.return&&h.return()}finally{if(i)throw o}}}function PF(e){var t=!0,i=!1,o=void 0;try{for(var h=Hw(e)[Symbol.iterator](),f;!(t=(f=h.next()).done);t=!0){var g=f.value;g.removeAttribute("aria-hidden")}}catch(c){i=!0,o=c}finally{try{!t&&h.return&&h.return()}finally{if(i)throw o}}}function MF(){qs=null}var Vh={};Object.defineProperty(Vh,"__esModule",{value:!0});Vh.resetState=AF;Vh.log=DF;var Lf={},Of={};function FT(e,t){e.classList.remove(t)}function AF(){var e=document.getElementsByTagName("html")[0];for(var t in Lf)FT(e,Lf[t]);var i=document.body;for(var o in Of)FT(i,Of[o]);Lf={},Of={}}function DF(){}var zF=function(t,i){return t[i]||(t[i]=0),t[i]+=1,i},RF=function(t,i){return t[i]&&(t[i]-=1),i},LF=function(t,i,o){o.forEach(function(h){zF(i,h),t.add(h)})},OF=function(t,i,o){o.forEach(function(h){RF(i,h),i[h]===0&&t.remove(h)})};Vh.add=function(t,i){return LF(t.classList,t.nodeName.toLowerCase()=="html"?Lf:Of,i.split(" "))};Vh.remove=function(t,i){return OF(t.classList,t.nodeName.toLowerCase()=="html"?Lf:Of,i.split(" "))};var Hh={};Object.defineProperty(Hh,"__esModule",{value:!0});Hh.log=BF;Hh.resetState=NF;function FF(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var kM=function e(){var t=this;FF(this,e),this.register=function(i){t.openInstances.indexOf(i)===-1&&(t.openInstances.push(i),t.emit("register"))},this.deregister=function(i){var o=t.openInstances.indexOf(i);o!==-1&&(t.openInstances.splice(o,1),t.emit("deregister"))},this.subscribe=function(i){t.subscribers.push(i)},this.emit=function(i){t.subscribers.forEach(function(o){return o(i,t.openInstances.slice())})},this.openInstances=[],this.subscribers=[]},Sy=new kM;function BF(){console.log("portalOpenInstances ----------"),console.log(Sy.openInstances.length),Sy.openInstances.forEach(function(e){return console.log(e)}),console.log("end portalOpenInstances ----------")}function NF(){Sy=new kM}Hh.default=Sy;var Ww={};Object.defineProperty(Ww,"__esModule",{value:!0});Ww.resetState=VF;Ww.log=HF;var $F=Hh,UF=jF($F);function jF(e){return e&&e.__esModule?e:{default:e}}var Ei=void 0,mo=void 0,Nu=[];function VF(){for(var e=[Ei,mo],t=0;t0?(document.body.firstChild!==Ei&&document.body.insertBefore(Ei,document.body.firstChild),document.body.lastChild!==mo&&document.body.appendChild(mo)):(Ei.parentElement&&Ei.parentElement.removeChild(Ei),mo.parentElement&&mo.parentElement.removeChild(mo))}UF.default.subscribe(WF);(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(H){for(var Re=1;Re0&&(ve-=1,ve===0&&N.show(Le)),ye.props.shouldFocusAfterRender&&(ye.props.shouldReturnFocusAfterClose?(P.returnFocus(ye.props.preventScroll),P.teardownScopedFocus()):P.popWithoutFocus()),ye.props.onAfterClose&&ye.props.onAfterClose(),q.default.deregister(ye)},ye.open=function(){ye.beforeOpen(),ye.state.afterOpen&&ye.state.beforeClose?(clearTimeout(ye.closeTimer),ye.setState({beforeClose:!1})):(ye.props.shouldFocusAfterRender&&(P.setupScopedFocus(ye.node),P.markForFocusLater()),ye.setState({isOpen:!0},function(){ye.openAnimationFrame=requestAnimationFrame(function(){ye.setState({afterOpen:!0}),ye.props.isOpen&&ye.props.onAfterOpen&&ye.props.onAfterOpen({overlayEl:ye.overlay,contentEl:ye.content})})}))},ye.close=function(){ye.props.closeTimeoutMS>0?ye.closeWithTimeout():ye.closeWithoutTimeout()},ye.focusContent=function(){return ye.content&&!ye.contentHasFocus()&&ye.content.focus({preventScroll:!0})},ye.closeWithTimeout=function(){var Be=Date.now()+ye.props.closeTimeoutMS;ye.setState({beforeClose:!0,closesAt:Be},function(){ye.closeTimer=setTimeout(ye.closeWithoutTimeout,ye.state.closesAt-Date.now())})},ye.closeWithoutTimeout=function(){ye.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},ye.afterClose)},ye.handleKeyDown=function(Be){We(Be)&&(0,A.default)(ye.content,Be),ye.props.shouldCloseOnEsc&&it(Be)&&(Be.stopPropagation(),ye.requestClose(Be))},ye.handleOverlayOnClick=function(Be){ye.shouldClose===null&&(ye.shouldClose=!0),ye.shouldClose&&ye.props.shouldCloseOnOverlayClick&&(ye.ownerHandlesClose()?ye.requestClose(Be):ye.focusContent()),ye.shouldClose=null},ye.handleContentOnMouseUp=function(){ye.shouldClose=!1},ye.handleOverlayOnMouseDown=function(Be){!ye.props.shouldCloseOnOverlayClick&&Be.target==ye.overlay&&Be.preventDefault()},ye.handleContentOnClick=function(){ye.shouldClose=!1},ye.handleContentOnMouseDown=function(){ye.shouldClose=!1},ye.requestClose=function(Be){return ye.ownerHandlesClose()&&ye.props.onRequestClose(Be)},ye.ownerHandlesClose=function(){return ye.props.onRequestClose},ye.shouldBeClosed=function(){return!ye.state.isOpen&&!ye.state.beforeClose},ye.contentHasFocus=function(){return document.activeElement===ye.content||ye.content.contains(document.activeElement)},ye.buildClassName=function(Be,Le){var Xe=(typeof Le>"u"?"undefined":o(Le))==="object"?Le:{base:Oe[Be],afterOpen:Oe[Be]+"--after-open",beforeClose:Oe[Be]+"--before-close"},xe=Xe.base;return ye.state.afterOpen&&(xe=xe+" "+Xe.afterOpen),ye.state.beforeClose&&(xe=xe+" "+Xe.beforeClose),typeof Le=="string"&&Le?xe+" "+Le:xe},ye.attributesFromObject=function(Be,Le){return Object.keys(Le).reduce(function(Xe,xe){return Xe[Be+"-"+xe]=Le[xe],Xe},{})},ye.state={afterOpen:!1,beforeClose:!1},ye.shouldClose=null,ye.moveFromContentToOverlay=null,ye}return h(Re,[{key:"componentDidMount",value:function(){this.props.isOpen&&this.open()}},{key:"componentDidUpdate",value:function(ye,Be){this.props.isOpen&&!ye.isOpen?this.open():!this.props.isOpen&&ye.isOpen&&this.close(),this.props.shouldFocusAfterRender&&this.state.isOpen&&!Be.isOpen&&this.focusContent()}},{key:"componentWillUnmount",value:function(){this.state.isOpen&&this.afterClose(),clearTimeout(this.closeTimer),cancelAnimationFrame(this.openAnimationFrame)}},{key:"beforeOpen",value:function(){var ye=this.props,Be=ye.appElement,Le=ye.ariaHideApp,Xe=ye.htmlOpenClassName,xe=ye.bodyOpenClassName,Ee=ye.parentSelector,mt=Ee&&Ee().ownerDocument||document;xe&&j.add(mt.body,xe),Xe&&j.add(mt.getElementsByTagName("html")[0],Xe),Le&&(ve+=1,N.hide(Be)),q.default.register(this)}},{key:"render",value:function(){var ye=this.props,Be=ye.id,Le=ye.className,Xe=ye.overlayClassName,xe=ye.defaultStyles,Ee=ye.children,mt=Le?{}:xe.content,nt=Xe?{}:xe.overlay;if(this.shouldBeClosed())return null;var rt={ref:this.setOverlayRef,className:this.buildClassName("overlay",Xe),style:i({},nt,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown},Jt=i({id:Be,ref:this.setContentRef,style:i({},mt,this.props.style.content),className:this.buildClassName("content",Le),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.attributesFromObject("aria",i({modal:!0},this.props.aria)),this.attributesFromObject("data",this.props.data||{}),{"data-testid":this.props.testId}),er=this.props.contentElement(Jt,Ee);return this.props.overlayElement(rt,er)}}]),Re}(f.Component);Ue.defaultProps={style:{overlay:{},content:{}},defaultStyles:{}},Ue.propTypes={isOpen:c.default.bool.isRequired,defaultStyles:c.default.shape({content:c.default.object,overlay:c.default.object}),style:c.default.shape({content:c.default.object,overlay:c.default.object}),className:c.default.oneOfType([c.default.string,c.default.object]),overlayClassName:c.default.oneOfType([c.default.string,c.default.object]),parentSelector:c.default.func,bodyOpenClassName:c.default.string,htmlOpenClassName:c.default.string,ariaHideApp:c.default.bool,appElement:c.default.oneOfType([c.default.instanceOf(O.default),c.default.instanceOf(te.SafeHTMLCollection),c.default.instanceOf(te.SafeNodeList),c.default.arrayOf(c.default.instanceOf(O.default))]),onAfterOpen:c.default.func,onAfterClose:c.default.func,onRequestClose:c.default.func,closeTimeoutMS:c.default.number,shouldFocusAfterRender:c.default.bool,shouldCloseOnOverlayClick:c.default.bool,shouldReturnFocusAfterClose:c.default.bool,preventScroll:c.default.bool,role:c.default.string,contentLabel:c.default.string,aria:c.default.object,data:c.default.object,children:c.default.node,shouldCloseOnEsc:c.default.bool,overlayRef:c.default.func,contentRef:c.default.func,id:c.default.string,overlayElement:c.default.func,contentElement:c.default.func,testId:c.default.string},t.default=Ue,e.exports=t.default})(lx,lx.exports);var GF=lx.exports;function TM(){var e=this.constructor.getDerivedStateFromProps(this.props,this.state);e!=null&&this.setState(e)}function EM(e){function t(i){var o=this.constructor.getDerivedStateFromProps(e,i);return o??null}this.setState(t.bind(this))}function CM(e,t){try{var i=this.props,o=this.state;this.props=e,this.state=t,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(i,o)}finally{this.props=i,this.state=o}}TM.__suppressDeprecationWarning=!0;EM.__suppressDeprecationWarning=!0;CM.__suppressDeprecationWarning=!0;function ZF(e){var t=e.prototype;if(!t||!t.isReactComponent)throw new Error("Can only polyfill class components");if(typeof e.getDerivedStateFromProps!="function"&&typeof t.getSnapshotBeforeUpdate!="function")return e;var i=null,o=null,h=null;if(typeof t.componentWillMount=="function"?i="componentWillMount":typeof t.UNSAFE_componentWillMount=="function"&&(i="UNSAFE_componentWillMount"),typeof t.componentWillReceiveProps=="function"?o="componentWillReceiveProps":typeof t.UNSAFE_componentWillReceiveProps=="function"&&(o="UNSAFE_componentWillReceiveProps"),typeof t.componentWillUpdate=="function"?h="componentWillUpdate":typeof t.UNSAFE_componentWillUpdate=="function"&&(h="UNSAFE_componentWillUpdate"),i!==null||o!==null||h!==null){var f=e.displayName||e.name,g=typeof e.getDerivedStateFromProps=="function"?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error(`Unsafe legacy lifecycles will not be called for components using new component APIs. `+f+" uses "+g+" but also contains the following legacy lifecycles:"+(i!==null?` `+i:"")+(o!==null?` @@ -863,7 +863,7 @@ uniform ${F} ${B} u_${X}; `+h:"")+` The above lifecycles should be removed. Learn more about this warning here: -https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(t.componentWillMount=TM,t.componentWillReceiveProps=EM),typeof t.getSnapshotBeforeUpdate=="function"){if(typeof t.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=CM;var c=t.componentDidUpdate;t.componentDidUpdate=function(P,R,A){var M=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:A;c.call(this,P,R,M)}}return e}const qF=Object.freeze(Object.defineProperty({__proto__:null,polyfill:ZF},Symbol.toStringTag,{value:"Module"})),YF=mD(qF);Object.defineProperty(Zu,"__esModule",{value:!0});Zu.bodyOpenClassName=Zu.portalClassName=void 0;var NT=Object.assign||function(e){for(var t=1;th(f),className:["cardOption",o?"cardOptionSelected":""].join(" "),children:[Xe.jsx("img",{className:"cardOptionImage",src:e,alt:t}),Xe.jsx("h3",{children:t}),i]})}function cB({settings:e,onChange:t}){const i=o=>{t({...e,msgPosition:o})};return Xe.jsx("div",{className:"",children:Xe.jsxs("div",{className:"cardOptions",children:[Xe.jsxs(Rv,{selected:e.msgPosition==="closest",img:"img/config-closest.png",name:"closest",title:Xe.jsx(ln,{id:"app.config.closestMsg",defaultMessage:"closest"}),onClick:i,children:[Xe.jsx(ln,{id:"app.config.msgPositionTextStart",defaultMessage:"It will search for locations and the"})," ",Xe.jsxs("strong",{children:[" ",Xe.jsx(ln,{id:"app.config.closestMsg",defaultMessage:"closest"})," "]})," ",Xe.jsx(ln,{id:"app.config.msgPositionTextEnd",defaultMessage:"message from the same user."})]}),Xe.jsxs(Rv,{selected:e.msgPosition==="after",img:"img/config-after.png",name:"after",title:Xe.jsx(ln,{id:"app.config.closestNextMsg",defaultMessage:"next"}),onClick:i,children:[Xe.jsx(ln,{id:"app.config.msgPositionTextStart",defaultMessage:"It will search for locations and the"})," ",Xe.jsx("strong",{children:Xe.jsx(ln,{id:"app.config.closestNextMsg",defaultMessage:"next"})})," ",Xe.jsx(ln,{id:"app.config.msgPositionTextEnd",defaultMessage:"message from the same user."})]}),Xe.jsxs(Rv,{selected:e.msgPosition==="before",img:"img/config-before.png",name:"before",title:Xe.jsx(ln,{id:"app.config.closestPreviousMsg",defaultMessage:"previous"}),onClick:i,children:[Xe.jsx(ln,{id:"app.config.msgPositionTextStart",defaultMessage:"It will search for locations and the"})," ",Xe.jsx("strong",{children:Xe.jsx(ln,{id:"app.config.previousNextMsg",defaultMessage:"next"})})," ",Xe.jsx(ln,{id:"app.config.msgPositionTextEnd",defaultMessage:"message from the same user."})]})]})})}function hB(e){const[t,i]=Ht.useState(e);return[t,f=>{i(f)},()=>{i(e)}]}function dB(e){return e.substring(e.lastIndexOf("/")+1,e.length)}function fB(){const[e,t]=Ht.useState(),[i,o]=Ht.useState();return[c=>{o(c)},(c,T)=>{t(P=>({...P,[dB(c)]:T}))},()=>{o(null),t()},e,i]}const Gw=(e,t)=>{let i=t-1,o=t+1,h,f,g=e[t];for(;(e[i]||e[o])&&!(f&&h);){if(e[i]&&e[i].username===g.username&&!h){const c=Math.abs(e[t].time-e[i].time);h={index:i,delta:c}}if(e[o]&&e[o].username===g.username&&!f){const c=Math.abs(e[t].time-e[o].time);f={index:o,delta:c}}i--,o++}if(h&&f){if(h.delta===f.delta)return{...e[h.index],message:e[h.index].message+". "+e[f.index].message};if(h.deltaf.delta)return e[f.index]}else{if(h)return e[h.index];if(f)return e[f.index]}return g},Zw=(e,t)=>MM(e,t,1),qw=(e,t)=>MM(e,t,-1),MM=(e,t,i)=>{let o=t+i,h,f=e[t];for(;e[o]&&!h;){if(e[o]&&e[o].username===f.username&&!h){const g=Math.abs(e[t].time-e[o].time);h={index:o,delta:g}}o+=i}return h?e[h.index]:f},pB=/[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/,dx={IOS:/\[(.*)\] (.*): (.*)/,ANDROID:/(.*) - (.*): (.*)/},mB=e=>{const t=e.match(dx.IOS),i=e.match(dx.ANDROID);return t?"IOS":i?"ANDROID":"UNKNOWN"},gB=e=>{const t=e.message.toLowerCase();let i=t.indexOf(".jpg");if(i<0&&(i=t.indexOf(".mp4")),i>0)return e.message.substring(0,i+4)},yB=e=>{const t=e.match(pB);return t?t[0].split(",").map(i=>parseFloat(i)):null},_B=(e,t)=>{const i=e.match(dx[t]);if(i){let o=i[2];const h=o.indexOf(":");h>-1&&(o=o.substring(0,h));let f={time:vB(i[1]),username:o,message:i[3]};return f.file=gB(f),f.file&&(f.message=""),f}},vB=e=>{let t=e.replace("a. m.","AM").replace("p. m.","PM");t=t.replace("a.m.","AM").replace("p.m.","PM");let i=t.split(" ");const o=new Date;let h=[[o.getFullYear(),o.getMonth()+1,o.getDate()].join("/"),i[1]].join(" ");return new Date(h)},xB=(e,t)=>{let i=0;const o={};return e.forEach(h=>{h=h.replaceAll(/[\u200E\u200F\u202A-\u202E\u200B]/g,"");const f=_B(h,t);f&&(o[i]=f,i++)}),o};function wB({text:e,msgPosition:t}){if(!e)return;const i=e.split(` +https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof e.getDerivedStateFromProps=="function"&&(t.componentWillMount=TM,t.componentWillReceiveProps=EM),typeof t.getSnapshotBeforeUpdate=="function"){if(typeof t.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");t.componentWillUpdate=CM;var c=t.componentDidUpdate;t.componentDidUpdate=function(P,R,A){var M=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:A;c.call(this,P,R,M)}}return e}const qF=Object.freeze(Object.defineProperty({__proto__:null,polyfill:ZF},Symbol.toStringTag,{value:"Module"})),YF=mD(qF);Object.defineProperty(Zu,"__esModule",{value:!0});Zu.bodyOpenClassName=Zu.portalClassName=void 0;var NT=Object.assign||function(e){for(var t=1;th(f),className:["cardOption",o?"cardOptionSelected":""].join(" "),children:[Ke.jsx("img",{className:"cardOptionImage",src:e,alt:t}),Ke.jsx("h3",{children:t}),i]})}function cB({settings:e,onChange:t}){const i=o=>{t({...e,msgPosition:o})};return Ke.jsx("div",{className:"",children:Ke.jsxs("div",{className:"cardOptions",children:[Ke.jsxs(Rv,{selected:e.msgPosition==="closest",img:"img/config-closest.png",name:"closest",title:Ke.jsx(ln,{id:"app.config.closestMsg",defaultMessage:"closest"}),onClick:i,children:[Ke.jsx(ln,{id:"app.config.msgPositionTextStart",defaultMessage:"It will search for locations and the"})," ",Ke.jsxs("strong",{children:[" ",Ke.jsx(ln,{id:"app.config.closestMsg",defaultMessage:"closest"})," "]})," ",Ke.jsx(ln,{id:"app.config.msgPositionTextEnd",defaultMessage:"message from the same user."})]}),Ke.jsxs(Rv,{selected:e.msgPosition==="after",img:"img/config-after.png",name:"after",title:Ke.jsx(ln,{id:"app.config.closestNextMsg",defaultMessage:"next"}),onClick:i,children:[Ke.jsx(ln,{id:"app.config.msgPositionTextStart",defaultMessage:"It will search for locations and the"})," ",Ke.jsx("strong",{children:Ke.jsx(ln,{id:"app.config.closestNextMsg",defaultMessage:"next"})})," ",Ke.jsx(ln,{id:"app.config.msgPositionTextEnd",defaultMessage:"message from the same user."})]}),Ke.jsxs(Rv,{selected:e.msgPosition==="before",img:"img/config-before.png",name:"before",title:Ke.jsx(ln,{id:"app.config.closestPreviousMsg",defaultMessage:"previous"}),onClick:i,children:[Ke.jsx(ln,{id:"app.config.msgPositionTextStart",defaultMessage:"It will search for locations and the"})," ",Ke.jsx("strong",{children:Ke.jsx(ln,{id:"app.config.previousNextMsg",defaultMessage:"next"})})," ",Ke.jsx(ln,{id:"app.config.msgPositionTextEnd",defaultMessage:"message from the same user."})]})]})})}function hB(e){const[t,i]=Ht.useState(e);return[t,f=>{i(f)},()=>{i(e)}]}function dB(e){return e.substring(e.lastIndexOf("/")+1,e.length)}function fB(){const[e,t]=Ht.useState(),[i,o]=Ht.useState();return[c=>{o(c)},(c,T)=>{t(P=>({...P,[dB(c)]:T}))},()=>{o(null),t()},e,i]}const Gw=(e,t)=>{let i=t-1,o=t+1,h,f,g=e[t];for(;(e[i]||e[o])&&!(f&&h);){if(e[i]&&e[i].username===g.username&&!h){const c=Math.abs(e[t].time-e[i].time);h={index:i,delta:c}}if(e[o]&&e[o].username===g.username&&!f){const c=Math.abs(e[t].time-e[o].time);f={index:o,delta:c}}i--,o++}if(h&&f){if(h.delta===f.delta)return{...e[h.index],message:e[h.index].message+". "+e[f.index].message};if(h.deltaf.delta)return e[f.index]}else{if(h)return e[h.index];if(f)return e[f.index]}return g},Zw=(e,t)=>MM(e,t,1),qw=(e,t)=>MM(e,t,-1),MM=(e,t,i)=>{let o=t+i,h,f=e[t];for(;e[o]&&!h;){if(e[o]&&e[o].username===f.username&&!h){const g=Math.abs(e[t].time-e[o].time);h={index:o,delta:g}}o+=i}return h?e[h.index]:f},pB=/[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/,dx={IOS:/\[(.*)\] (.*): (.*)/,ANDROID:/(.*) - (.*): (.*)/},mB=e=>{const t=e.match(dx.IOS),i=e.match(dx.ANDROID);return t?"IOS":i?"ANDROID":"UNKNOWN"},gB=e=>{const t=e.message.toLowerCase();let i=t.indexOf(".jpg");if(i<0&&(i=t.indexOf(".mp4")),i>0)return e.message.substring(0,i+4)},yB=e=>{const t=e.match(pB);return t?t[0].split(",").map(i=>parseFloat(i)):null},_B=(e,t)=>{const i=e.match(dx[t]);if(i){let o=i[2];const h=o.indexOf(":");h>-1&&(o=o.substring(0,h));let f={time:vB(i[1]),username:o,message:i[3]};return f.file=gB(f),f.file&&(f.message=""),f}},vB=e=>{let t=e.replace("a. m.","AM").replace("p. m.","PM");t=t.replace("a.m.","AM").replace("p.m.","PM");let i=t.split(" ");const o=new Date;let h=[[o.getFullYear(),o.getMonth()+1,o.getDate()].join("/"),i[1]].join(" ");return new Date(h)},xB=(e,t)=>{let i=0;const o={};return e.forEach(h=>{h=h.replaceAll(/[\u200E\u200F\u202A-\u202E\u200B]/g,"");const f=_B(h,t);f&&(o[i]=f,i++)}),o};function wB({text:e,msgPosition:t}){if(!e)return;const i=e.split(` `),o={type:"FeatureCollection",features:[]};let h={},f;for(let T=0;T{if(T.message){const R=yB(T.message);if(R){h={type:"Feature",properties:{},geometry:{type:"Point",coordinates:[parseFloat(R[1]),parseFloat(R[0])]}};let A;switch(t){case"before":A=qw(g,P);break;case"after":A=Zw(g,P);break;default:A=Gw(g,P);break}h.properties={...A},o.features.push(h)}}}),o}function WT(e){return e.substring(e.lastIndexOf("/")+1,e.length)}const bB=e=>{let t="",i={time:SB(e.date),username:e.from};return Array.isArray(e.text)?e.text.forEach(o=>{o.type==="link"&&(t=o.text)}):e.text!==""&&(t=e.text),i.message=t,e.location_information&&(i.location=[e.location_information.latitude,e.location_information.longitude]),e.photo&&(i.file=WT(e.photo)),e.file&&e.mime_type==="video/mp4"&&(i.file=WT(e.file)),i},SB=e=>new Date(e),kB=e=>{let t=0;const i={};return e.forEach(o=>{const h=bB(o);h&&(i[t]=h,t++)}),i};function TB({text:e,msgPosition:t}){if(!e)return;const i=JSON.parse(e),o={type:"FeatureCollection",features:[]},h=kB(i.messages);return Object.values(h).forEach((g,c)=>{if(g.location){let T={type:"Feature",properties:{},geometry:{type:"Point",coordinates:[g.location[1],g.location[0]]}},P;switch(t){case"before":P=qw(h,c);break;case"after":P=Zw(h,c);break;default:P=Gw(h,c);break}T.properties={...P},o.features.push(T)}}),o}//! moment.js //! version : 2.30.1 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors @@ -874,5 +874,5 @@ var AM;function Ct(){return AM.apply(null,arguments)}function EB(e){AM=e}functio Arguments: `+Array.prototype.slice.call(o).join("")+` `+new Error().stack),i=!1}return t.apply(this,arguments)},t)}var ZT={};function RM(e,t){Ct.deprecationHandler!=null&&Ct.deprecationHandler(e,t),ZT[e]||(zM(t),ZT[e]=!0)}Ct.suppressDeprecationWarnings=!1;Ct.deprecationHandler=null;function Xo(e){return typeof Function<"u"&&e instanceof Function||Object.prototype.toString.call(e)==="[object Function]"}function IB(e){var t,i;for(i in e)Dr(e,i)&&(t=e[i],Xo(t)?this[i]=t:this["_"+i]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function px(e,t){var i=Ml({},e),o;for(o in t)Dr(t,o)&&($u(e[o])&&$u(t[o])?(i[o]={},Ml(i[o],e[o]),Ml(i[o],t[o])):t[o]!=null?i[o]=t[o]:delete i[o]);for(o in e)Dr(e,o)&&!Dr(t,o)&&$u(e[o])&&(i[o]=Ml({},i[o]));return i}function Jw(e){e!=null&&this.set(e)}var mx;Object.keys?mx=Object.keys:mx=function(e){var t,i=[];for(t in e)Dr(e,t)&&i.push(t);return i};var PB={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function MB(e,t,i){var o=this._calendar[e]||this._calendar.sameElse;return Xo(o)?o.call(t,i):o}function qo(e,t,i){var o=""+Math.abs(e),h=t-o.length,f=e>=0;return(f?i?"+":"":"-")+Math.pow(10,Math.max(0,h)).toString().substr(1)+o}var Qw=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,sg=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Ov={},_h={};function Wt(e,t,i,o){var h=o;typeof o=="string"&&(h=function(){return this[o]()}),e&&(_h[e]=h),t&&(_h[t[0]]=function(){return qo(h.apply(this,arguments),t[1],t[2])}),i&&(_h[i]=function(){return this.localeData().ordinal(h.apply(this,arguments),e)})}function AB(e){return e.match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function DB(e){var t=e.match(Qw),i,o;for(i=0,o=t.length;i=0&&sg.test(e);)e=e.replace(sg,o),sg.lastIndex=0,i-=1;return e}var zB={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function RB(e){var t=this._longDateFormat[e],i=this._longDateFormat[e.toUpperCase()];return t||!i?t:(this._longDateFormat[e]=i.match(Qw).map(function(o){return o==="MMMM"||o==="MM"||o==="DD"||o==="dddd"?o.slice(1):o}).join(""),this._longDateFormat[e])}var LB="Invalid date";function OB(){return this._invalidDate}var FB="%d",BB=/\d{1,2}/;function NB(e){return this._ordinal.replace("%d",e)}var $B={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function UB(e,t,i,o){var h=this._relativeTime[i];return Xo(h)?h(e,t,i,o):h.replace(/%d/i,e)}function jB(e,t){var i=this._relativeTime[e>0?"future":"past"];return Xo(i)?i(t):i.replace(/%s/i,t)}var qT={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function oo(e){return typeof e=="string"?qT[e]||qT[e.toLowerCase()]:void 0}function eb(e){var t={},i,o;for(o in e)Dr(e,o)&&(i=oo(o),i&&(t[i]=e[o]));return t}var VB={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function HB(e){var t=[],i;for(i in e)Dr(e,i)&&t.push({unit:i,priority:VB[i]});return t.sort(function(o,h){return o.priority-h.priority}),t}var OM=/\d/,Us=/\d\d/,FM=/\d{3}/,tb=/\d{4}/,v_=/[+-]?\d{6}/,dn=/\d\d?/,BM=/\d\d\d\d?/,NM=/\d\d\d\d\d\d?/,x_=/\d{1,3}/,rb=/\d{1,4}/,w_=/[+-]?\d{1,6}/,Wh=/\d+/,b_=/[+-]?\d+/,WB=/Z|[+-]\d\d:?\d\d/gi,S_=/Z|[+-]\d\d(?::?\d\d)?/gi,GB=/[+-]?\d+(\.\d{1,3})?/,Ip=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Gh=/^[1-9]\d?/,nb=/^([1-9]\d|\d)/,Ey;Ey={};function zt(e,t,i){Ey[e]=Xo(t)?t:function(o,h){return o&&i?i:t}}function ZB(e,t){return Dr(Ey,e)?Ey[e](t._strict,t._locale):new RegExp(qB(e))}function qB(e){return Ta(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,i,o,h,f){return i||o||h||f}))}function Ta(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Ks(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function wr(e){var t=+e,i=0;return t!==0&&isFinite(t)&&(i=Ks(t)),i}var gx={};function qr(e,t){var i,o=t,h;for(typeof e=="string"&&(e=[e]),za(t)&&(o=function(f,g){g[t]=wr(f)}),h=e.length,i=0;i68?1900:2e3)};var $M=Zh("FullYear",!0);function JB(){return k_(this.year())}function Zh(e,t){return function(i){return i!=null?(UM(this,e,i),Ct.updateOffset(this,t),this):lp(this,e)}}function lp(e,t){if(!e.isValid())return NaN;var i=e._d,o=e._isUTC;switch(t){case"Milliseconds":return o?i.getUTCMilliseconds():i.getMilliseconds();case"Seconds":return o?i.getUTCSeconds():i.getSeconds();case"Minutes":return o?i.getUTCMinutes():i.getMinutes();case"Hours":return o?i.getUTCHours():i.getHours();case"Date":return o?i.getUTCDate():i.getDate();case"Day":return o?i.getUTCDay():i.getDay();case"Month":return o?i.getUTCMonth():i.getMonth();case"FullYear":return o?i.getUTCFullYear():i.getFullYear();default:return NaN}}function UM(e,t,i){var o,h,f,g,c;if(!(!e.isValid()||isNaN(i))){switch(o=e._d,h=e._isUTC,t){case"Milliseconds":return void(h?o.setUTCMilliseconds(i):o.setMilliseconds(i));case"Seconds":return void(h?o.setUTCSeconds(i):o.setSeconds(i));case"Minutes":return void(h?o.setUTCMinutes(i):o.setMinutes(i));case"Hours":return void(h?o.setUTCHours(i):o.setHours(i));case"Date":return void(h?o.setUTCDate(i):o.setDate(i));case"FullYear":break;default:return}f=i,g=e.month(),c=e.date(),c=c===29&&g===1&&!k_(f)?28:c,h?o.setUTCFullYear(f,g,c):o.setFullYear(f,g,c)}}function QB(e){return e=oo(e),Xo(this[e])?this[e]():this}function eN(e,t){if(typeof e=="object"){e=eb(e);var i=HB(e),o,h=i.length;for(o=0;o=0?(c=new Date(e+400,t,i,o,h,f,g),isFinite(c.getFullYear())&&c.setFullYear(e)):c=new Date(e,t,i,o,h,f,g),c}function up(e){var t,i;return e<100&&e>=0?(i=Array.prototype.slice.call(arguments),i[0]=e+400,t=new Date(Date.UTC.apply(null,i)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Cy(e,t,i){var o=7+t-i,h=(7+up(e,0,o).getUTCDay()-t)%7;return-h+o-1}function ZM(e,t,i,o,h){var f=(7+i-o)%7,g=Cy(e,o,h),c=1+7*(t-1)+f+g,T,P;return c<=0?(T=e-1,P=Ff(T)+c):c>Ff(e)?(T=e+1,P=c-Ff(e)):(T=e,P=c),{year:T,dayOfYear:P}}function cp(e,t,i){var o=Cy(e.year(),t,i),h=Math.floor((e.dayOfYear()-o-1)/7)+1,f,g;return h<1?(g=e.year()-1,f=h+Ea(g,t,i)):h>Ea(e.year(),t,i)?(f=h-Ea(e.year(),t,i),g=e.year()+1):(g=e.year(),f=h),{week:f,year:g}}function Ea(e,t,i){var o=Cy(e,t,i),h=Cy(e+1,t,i);return(Ff(e)-o+h)/7}Wt("w",["ww",2],"wo","week");Wt("W",["WW",2],"Wo","isoWeek");zt("w",dn,Gh);zt("ww",dn,Us);zt("W",dn,Gh);zt("WW",dn,Us);Pp(["w","ww","W","WW"],function(e,t,i,o){t[o.substr(0,1)]=wr(e)});function fN(e){return cp(e,this._week.dow,this._week.doy).week}var pN={dow:0,doy:6};function mN(){return this._week.dow}function gN(){return this._week.doy}function yN(e){var t=this.localeData().week(this);return e==null?t:this.add((e-t)*7,"d")}function _N(e){var t=cp(this,1,4).week;return e==null?t:this.add((e-t)*7,"d")}Wt("d",0,"do","day");Wt("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)});Wt("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)});Wt("dddd",0,0,function(e){return this.localeData().weekdays(this,e)});Wt("e",0,0,"weekday");Wt("E",0,0,"isoWeekday");zt("d",dn);zt("e",dn);zt("E",dn);zt("dd",function(e,t){return t.weekdaysMinRegex(e)});zt("ddd",function(e,t){return t.weekdaysShortRegex(e)});zt("dddd",function(e,t){return t.weekdaysRegex(e)});Pp(["dd","ddd","dddd"],function(e,t,i,o){var h=i._locale.weekdaysParse(e,o,i._strict);h!=null?t.d=h:lr(i).invalidWeekday=e});Pp(["d","e","E"],function(e,t,i,o){t[o]=wr(e)});function vN(e,t){return typeof e!="string"?e:isNaN(e)?(e=t.weekdaysParse(e),typeof e=="number"?e:null):parseInt(e,10)}function xN(e,t){return typeof e=="string"?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}function sb(e,t){return e.slice(t,7).concat(e.slice(0,t))}var wN="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),qM="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),bN="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),SN=Ip,kN=Ip,TN=Ip;function EN(e,t){var i=ko(this._weekdays)?this._weekdays:this._weekdays[e&&e!==!0&&this._weekdays.isFormat.test(t)?"format":"standalone"];return e===!0?sb(i,this._week.dow):e?i[e.day()]:i}function CN(e){return e===!0?sb(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort}function IN(e){return e===!0?sb(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin}function PN(e,t,i){var o,h,f,g=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],o=0;o<7;++o)f=Yo([2e3,1]).day(o),this._minWeekdaysParse[o]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[o]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[o]=this.weekdays(f,"").toLocaleLowerCase();return i?t==="dddd"?(h=Mn.call(this._weekdaysParse,g),h!==-1?h:null):t==="ddd"?(h=Mn.call(this._shortWeekdaysParse,g),h!==-1?h:null):(h=Mn.call(this._minWeekdaysParse,g),h!==-1?h:null):t==="dddd"?(h=Mn.call(this._weekdaysParse,g),h!==-1||(h=Mn.call(this._shortWeekdaysParse,g),h!==-1)?h:(h=Mn.call(this._minWeekdaysParse,g),h!==-1?h:null)):t==="ddd"?(h=Mn.call(this._shortWeekdaysParse,g),h!==-1||(h=Mn.call(this._weekdaysParse,g),h!==-1)?h:(h=Mn.call(this._minWeekdaysParse,g),h!==-1?h:null)):(h=Mn.call(this._minWeekdaysParse,g),h!==-1||(h=Mn.call(this._weekdaysParse,g),h!==-1)?h:(h=Mn.call(this._shortWeekdaysParse,g),h!==-1?h:null))}function MN(e,t,i){var o,h,f;if(this._weekdaysParseExact)return PN.call(this,e,t,i);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),o=0;o<7;o++){if(h=Yo([2e3,1]).day(o),i&&!this._fullWeekdaysParse[o]&&(this._fullWeekdaysParse[o]=new RegExp("^"+this.weekdays(h,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[o]=new RegExp("^"+this.weekdaysShort(h,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[o]=new RegExp("^"+this.weekdaysMin(h,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[o]||(f="^"+this.weekdays(h,"")+"|^"+this.weekdaysShort(h,"")+"|^"+this.weekdaysMin(h,""),this._weekdaysParse[o]=new RegExp(f.replace(".",""),"i")),i&&t==="dddd"&&this._fullWeekdaysParse[o].test(e))return o;if(i&&t==="ddd"&&this._shortWeekdaysParse[o].test(e))return o;if(i&&t==="dd"&&this._minWeekdaysParse[o].test(e))return o;if(!i&&this._weekdaysParse[o].test(e))return o}}function AN(e){if(!this.isValid())return e!=null?this:NaN;var t=lp(this,"Day");return e!=null?(e=vN(e,this.localeData()),this.add(e-t,"d")):t}function DN(e){if(!this.isValid())return e!=null?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return e==null?t:this.add(e-t,"d")}function zN(e){if(!this.isValid())return e!=null?this:NaN;if(e!=null){var t=xN(e,this.localeData());return this.day(this.day()%7?t:t-7)}else return this.day()||7}function RN(e){return this._weekdaysParseExact?(Dr(this,"_weekdaysRegex")||ob.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(Dr(this,"_weekdaysRegex")||(this._weekdaysRegex=SN),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)}function LN(e){return this._weekdaysParseExact?(Dr(this,"_weekdaysRegex")||ob.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(Dr(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=kN),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function ON(e){return this._weekdaysParseExact?(Dr(this,"_weekdaysRegex")||ob.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(Dr(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=TN),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function ob(){function e(R,A){return A.length-R.length}var t=[],i=[],o=[],h=[],f,g,c,T,P;for(f=0;f<7;f++)g=Yo([2e3,1]).day(f),c=Ta(this.weekdaysMin(g,"")),T=Ta(this.weekdaysShort(g,"")),P=Ta(this.weekdays(g,"")),t.push(c),i.push(T),o.push(P),h.push(c),h.push(T),h.push(P);t.sort(e),i.sort(e),o.sort(e),h.sort(e),this._weekdaysRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+t.join("|")+")","i")}function ab(){return this.hours()%12||12}function FN(){return this.hours()||24}Wt("H",["HH",2],0,"hour");Wt("h",["hh",2],0,ab);Wt("k",["kk",2],0,FN);Wt("hmm",0,0,function(){return""+ab.apply(this)+qo(this.minutes(),2)});Wt("hmmss",0,0,function(){return""+ab.apply(this)+qo(this.minutes(),2)+qo(this.seconds(),2)});Wt("Hmm",0,0,function(){return""+this.hours()+qo(this.minutes(),2)});Wt("Hmmss",0,0,function(){return""+this.hours()+qo(this.minutes(),2)+qo(this.seconds(),2)});function YM(e,t){Wt(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}YM("a",!0);YM("A",!1);function XM(e,t){return t._meridiemParse}zt("a",XM);zt("A",XM);zt("H",dn,nb);zt("h",dn,Gh);zt("k",dn,Gh);zt("HH",dn,Us);zt("hh",dn,Us);zt("kk",dn,Us);zt("hmm",BM);zt("hmmss",NM);zt("Hmm",BM);zt("Hmmss",NM);qr(["H","HH"],Vn);qr(["k","kk"],function(e,t,i){var o=wr(e);t[Vn]=o===24?0:o});qr(["a","A"],function(e,t,i){i._isPm=i._locale.isPM(e),i._meridiem=e});qr(["h","hh"],function(e,t,i){t[Vn]=wr(e),lr(i).bigHour=!0});qr("hmm",function(e,t,i){var o=e.length-2;t[Vn]=wr(e.substr(0,o)),t[_o]=wr(e.substr(o)),lr(i).bigHour=!0});qr("hmmss",function(e,t,i){var o=e.length-4,h=e.length-2;t[Vn]=wr(e.substr(0,o)),t[_o]=wr(e.substr(o,2)),t[Sa]=wr(e.substr(h)),lr(i).bigHour=!0});qr("Hmm",function(e,t,i){var o=e.length-2;t[Vn]=wr(e.substr(0,o)),t[_o]=wr(e.substr(o))});qr("Hmmss",function(e,t,i){var o=e.length-4,h=e.length-2;t[Vn]=wr(e.substr(0,o)),t[_o]=wr(e.substr(o,2)),t[Sa]=wr(e.substr(h))});function BN(e){return(e+"").toLowerCase().charAt(0)==="p"}var NN=/[ap]\.?m?\.?/i,$N=Zh("Hours",!0);function UN(e,t,i){return e>11?i?"pm":"PM":i?"am":"AM"}var KM={calendar:PB,longDateFormat:zB,invalidDate:LB,ordinal:FB,dayOfMonthOrdinalParse:BB,relativeTime:$B,months:rN,monthsShort:jM,week:pN,weekdays:wN,weekdaysMin:bN,weekdaysShort:qM,meridiemParse:NN},gn={},hf={},hp;function jN(e,t){var i,o=Math.min(e.length,t.length);for(i=0;i0;){if(h=T_(f.slice(0,i).join("-")),h)return h;if(o&&o.length>=i&&jN(f,o)>=i-1)break;i--}t++}return hp}function HN(e){return!!(e&&e.match("^[^/\\\\]*$"))}function T_(e){var t=null,i;if(gn[e]===void 0&&typeof Bg<"u"&&Bg&&Bg.exports&&HN(e))try{t=hp._abbr,i=require,i("./locale/"+e),$l(t)}catch{gn[e]=null}return gn[e]}function $l(e,t){var i;return e&&(is(t)?i=La(e):i=lb(e,t),i?hp=i:typeof console<"u"&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),hp._abbr}function lb(e,t){if(t!==null){var i,o=KM;if(t.abbr=e,gn[e]!=null)RM("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),o=gn[e]._config;else if(t.parentLocale!=null)if(gn[t.parentLocale]!=null)o=gn[t.parentLocale]._config;else if(i=T_(t.parentLocale),i!=null)o=i._config;else return hf[t.parentLocale]||(hf[t.parentLocale]=[]),hf[t.parentLocale].push({name:e,config:t}),null;return gn[e]=new Jw(px(o,t)),hf[e]&&hf[e].forEach(function(h){lb(h.name,h.config)}),$l(e),gn[e]}else return delete gn[e],null}function WN(e,t){if(t!=null){var i,o,h=KM;gn[e]!=null&&gn[e].parentLocale!=null?gn[e].set(px(gn[e]._config,t)):(o=T_(e),o!=null&&(h=o._config),t=px(h,t),o==null&&(t.abbr=e),i=new Jw(t),i.parentLocale=gn[e],gn[e]=i),$l(e)}else gn[e]!=null&&(gn[e].parentLocale!=null?(gn[e]=gn[e].parentLocale,e===$l()&&$l(e)):gn[e]!=null&&delete gn[e]);return gn[e]}function La(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return hp;if(!ko(e)){if(t=T_(e),t)return t;e=[e]}return VN(e)}function GN(){return mx(gn)}function ub(e){var t,i=e._a;return i&&lr(e).overflow===-2&&(t=i[ba]<0||i[ba]>11?ba:i[Ho]<1||i[Ho]>ib(i[Ii],i[ba])?Ho:i[Vn]<0||i[Vn]>24||i[Vn]===24&&(i[_o]!==0||i[Sa]!==0||i[zu]!==0)?Vn:i[_o]<0||i[_o]>59?_o:i[Sa]<0||i[Sa]>59?Sa:i[zu]<0||i[zu]>999?zu:-1,lr(e)._overflowDayOfYear&&(tHo)&&(t=Ho),lr(e)._overflowWeeks&&t===-1&&(t=XB),lr(e)._overflowWeekday&&t===-1&&(t=KB),lr(e).overflow=t),e}var ZN=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,qN=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,YN=/Z|[+-]\d\d(?::?\d\d)?/,og=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Fv=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],XN=/^\/?Date\((-?\d+)/i,KN=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,JN={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function JM(e){var t,i,o=e._i,h=ZN.exec(o)||qN.exec(o),f,g,c,T,P=og.length,R=Fv.length;if(h){for(lr(e).iso=!0,t=0,i=P;tFf(g)||e._dayOfYear===0)&&(lr(e)._overflowDayOfYear=!0),i=up(g,0,e._dayOfYear),e._a[ba]=i.getUTCMonth(),e._a[Ho]=i.getUTCDate()),t=0;t<3&&e._a[t]==null;++t)e._a[t]=o[t]=h[t];for(;t<7;t++)e._a[t]=o[t]=e._a[t]==null?t===2?1:0:e._a[t];e._a[Vn]===24&&e._a[_o]===0&&e._a[Sa]===0&&e._a[zu]===0&&(e._nextDay=!0,e._a[Vn]=0),e._d=(e._useUTC?up:dN).apply(null,o),f=e._useUTC?e._d.getUTCDay():e._d.getDay(),e._tzm!=null&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Vn]=24),e._w&&typeof e._w.d<"u"&&e._w.d!==f&&(lr(e).weekdayMismatch=!0)}}function o8(e){var t,i,o,h,f,g,c,T,P;t=e._w,t.GG!=null||t.W!=null||t.E!=null?(f=1,g=4,i=Xc(t.GG,e._a[Ii],cp(hn(),1,4).year),o=Xc(t.W,1),h=Xc(t.E,1),(h<1||h>7)&&(T=!0)):(f=e._locale._week.dow,g=e._locale._week.doy,P=cp(hn(),f,g),i=Xc(t.gg,e._a[Ii],P.year),o=Xc(t.w,P.week),t.d!=null?(h=t.d,(h<0||h>6)&&(T=!0)):t.e!=null?(h=t.e+f,(t.e<0||t.e>6)&&(T=!0)):h=f),o<1||o>Ea(i,f,g)?lr(e)._overflowWeeks=!0:T!=null?lr(e)._overflowWeekday=!0:(c=ZM(i,o,h,f,g),e._a[Ii]=c.year,e._dayOfYear=c.dayOfYear)}Ct.ISO_8601=function(){};Ct.RFC_2822=function(){};function hb(e){if(e._f===Ct.ISO_8601){JM(e);return}if(e._f===Ct.RFC_2822){QM(e);return}e._a=[],lr(e).empty=!0;var t=""+e._i,i,o,h,f,g,c=t.length,T=0,P,R;for(h=LM(e._f,e._locale).match(Qw)||[],R=h.length,i=0;i0&&lr(e).unusedInput.push(g),t=t.slice(t.indexOf(o)+o.length),T+=o.length),_h[f]?(o?lr(e).empty=!1:lr(e).unusedTokens.push(f),YB(f,o,e)):e._strict&&!o&&lr(e).unusedTokens.push(f);lr(e).charsLeftOver=c-T,t.length>0&&lr(e).unusedInput.push(t),e._a[Vn]<=12&&lr(e).bigHour===!0&&e._a[Vn]>0&&(lr(e).bigHour=void 0),lr(e).parsedDateParts=e._a.slice(0),lr(e).meridiem=e._meridiem,e._a[Vn]=a8(e._locale,e._a[Vn],e._meridiem),P=lr(e).era,P!==null&&(e._a[Ii]=e._locale.erasConvertYear(P,e._a[Ii])),cb(e),ub(e)}function a8(e,t,i){var o;return i==null?t:e.meridiemHour!=null?e.meridiemHour(t,i):(e.isPM!=null&&(o=e.isPM(i),o&&t<12&&(t+=12),!o&&t===12&&(t=0)),t)}function l8(e){var t,i,o,h,f,g,c=!1,T=e._f.length;if(T===0){lr(e).invalidFormat=!0,e._d=new Date(NaN);return}for(h=0;hthis?this:e:__()});function rA(e,t){var i,o;if(t.length===1&&ko(t[0])&&(t=t[0]),!t.length)return hn();for(i=t[0],o=1;othis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function P8(){if(!is(this._isDSTShifted))return this._isDSTShifted;var e={},t;return Kw(e,this),e=eA(e),e._a?(t=e._isUTC?Yo(e._a):hn(e._a),this._isDSTShifted=this.isValid()&&x8(e._a,t.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function M8(){return this.isValid()?!this._isUTC:!1}function A8(){return this.isValid()?this._isUTC:!1}function iA(){return this.isValid()?this._isUTC&&this._offset===0:!1}var D8=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,z8=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Io(e,t){var i=e,o=null,h,f,g;return Og(e)?i={ms:e._milliseconds,d:e._days,M:e._months}:za(e)||!isNaN(+e)?(i={},t?i[t]=+e:i.milliseconds=+e):(o=D8.exec(e))?(h=o[1]==="-"?-1:1,i={y:0,d:wr(o[Ho])*h,h:wr(o[Vn])*h,m:wr(o[_o])*h,s:wr(o[Sa])*h,ms:wr(yx(o[zu]*1e3))*h}):(o=z8.exec(e))?(h=o[1]==="-"?-1:1,i={y:xu(o[2],h),M:xu(o[3],h),w:xu(o[4],h),d:xu(o[5],h),h:xu(o[6],h),m:xu(o[7],h),s:xu(o[8],h)}):i==null?i={}:typeof i=="object"&&("from"in i||"to"in i)&&(g=R8(hn(i.from),hn(i.to)),i={},i.ms=g.milliseconds,i.M=g.months),f=new E_(i),Og(e)&&Dr(e,"_locale")&&(f._locale=e._locale),Og(e)&&Dr(e,"_isValid")&&(f._isValid=e._isValid),f}Io.fn=E_.prototype;Io.invalid=v8;function xu(e,t){var i=e&&parseFloat(e.replace(",","."));return(isNaN(i)?0:i)*t}function XT(e,t){var i={};return i.months=t.month()-e.month()+(t.year()-e.year())*12,e.clone().add(i.months,"M").isAfter(t)&&--i.months,i.milliseconds=+t-+e.clone().add(i.months,"M"),i}function R8(e,t){var i;return e.isValid()&&t.isValid()?(t=fb(t,e),e.isBefore(t)?i=XT(e,t):(i=XT(t,e),i.milliseconds=-i.milliseconds,i.months=-i.months),i):{milliseconds:0,months:0}}function sA(e,t){return function(i,o){var h,f;return o!==null&&!isNaN(+o)&&(RM(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),f=i,i=o,o=f),h=Io(i,o),oA(this,h,e),this}}function oA(e,t,i,o){var h=t._milliseconds,f=yx(t._days),g=yx(t._months);e.isValid()&&(o=o??!0,g&&HM(e,lp(e,"Month")+g*i),f&&UM(e,"Date",lp(e,"Date")+f*i),h&&e._d.setTime(e._d.valueOf()+h*i),o&&Ct.updateOffset(e,f||g))}var L8=sA(1,"add"),O8=sA(-1,"subtract");function aA(e){return typeof e=="string"||e instanceof String}function F8(e){return To(e)||Ep(e)||aA(e)||za(e)||N8(e)||B8(e)||e===null||e===void 0}function B8(e){var t=$u(e)&&!Yw(e),i=!1,o=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],h,f,g=o.length;for(h=0;hi.valueOf():i.valueOf()9999?Lg(i,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Xo(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Lg(i,"Z")):Lg(i,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function Q8(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="",i,o,h,f;return this.isLocal()||(e=this.utcOffset()===0?"moment.utc":"moment.parseZone",t="Z"),i="["+e+'("]',o=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",h="-MM-DD[T]HH:mm:ss.SSS",f=t+'[")]',this.format(i+o+h+f)}function e$(e){e||(e=this.isUtc()?Ct.defaultFormatUtc:Ct.defaultFormat);var t=Lg(this,e);return this.localeData().postformat(t)}function t$(e,t){return this.isValid()&&(To(e)&&e.isValid()||hn(e).isValid())?Io({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function r$(e){return this.from(hn(),e)}function n$(e,t){return this.isValid()&&(To(e)&&e.isValid()||hn(e).isValid())?Io({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()}function i$(e){return this.to(hn(),e)}function lA(e){var t;return e===void 0?this._locale._abbr:(t=La(e),t!=null&&(this._locale=t),this)}var uA=so("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return e===void 0?this.localeData():this.locale(e)});function cA(){return this._locale}var Iy=1e3,vh=60*Iy,Py=60*vh,hA=(365*400+97)*24*Py;function xh(e,t){return(e%t+t)%t}function dA(e,t,i){return e<100&&e>=0?new Date(e+400,t,i)-hA:new Date(e,t,i).valueOf()}function fA(e,t,i){return e<100&&e>=0?Date.UTC(e+400,t,i)-hA:Date.UTC(e,t,i)}function s$(e){var t,i;if(e=oo(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(i=this._isUTC?fA:dA,e){case"year":t=i(this.year(),0,1);break;case"quarter":t=i(this.year(),this.month()-this.month()%3,1);break;case"month":t=i(this.year(),this.month(),1);break;case"week":t=i(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=i(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=i(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=xh(t+(this._isUTC?0:this.utcOffset()*vh),Py);break;case"minute":t=this._d.valueOf(),t-=xh(t,vh);break;case"second":t=this._d.valueOf(),t-=xh(t,Iy);break}return this._d.setTime(t),Ct.updateOffset(this,!0),this}function o$(e){var t,i;if(e=oo(e),e===void 0||e==="millisecond"||!this.isValid())return this;switch(i=this._isUTC?fA:dA,e){case"year":t=i(this.year()+1,0,1)-1;break;case"quarter":t=i(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=i(this.year(),this.month()+1,1)-1;break;case"week":t=i(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=i(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=i(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=Py-xh(t+(this._isUTC?0:this.utcOffset()*vh),Py)-1;break;case"minute":t=this._d.valueOf(),t+=vh-xh(t,vh)-1;break;case"second":t=this._d.valueOf(),t+=Iy-xh(t,Iy)-1;break}return this._d.setTime(t),Ct.updateOffset(this,!0),this}function a$(){return this._d.valueOf()-(this._offset||0)*6e4}function l$(){return Math.floor(this.valueOf()/1e3)}function u$(){return new Date(this.valueOf())}function c$(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]}function h$(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}}function d$(){return this.isValid()?this.toISOString():null}function f$(){return Xw(this)}function p$(){return Ml({},lr(this))}function m$(){return lr(this).overflow}function g$(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}Wt("N",0,0,"eraAbbr");Wt("NN",0,0,"eraAbbr");Wt("NNN",0,0,"eraAbbr");Wt("NNNN",0,0,"eraName");Wt("NNNNN",0,0,"eraNarrow");Wt("y",["y",1],"yo","eraYear");Wt("y",["yy",2],0,"eraYear");Wt("y",["yyy",3],0,"eraYear");Wt("y",["yyyy",4],0,"eraYear");zt("N",pb);zt("NN",pb);zt("NNN",pb);zt("NNNN",C$);zt("NNNNN",I$);qr(["N","NN","NNN","NNNN","NNNNN"],function(e,t,i,o){var h=i._locale.erasParse(e,o,i._strict);h?lr(i).era=h:lr(i).invalidEra=e});zt("y",Wh);zt("yy",Wh);zt("yyy",Wh);zt("yyyy",Wh);zt("yo",P$);qr(["y","yy","yyy","yyyy"],Ii);qr(["yo"],function(e,t,i,o){var h;i._locale._eraYearOrdinalRegex&&(h=e.match(i._locale._eraYearOrdinalRegex)),i._locale.eraYearOrdinalParse?t[Ii]=i._locale.eraYearOrdinalParse(e,h):t[Ii]=parseInt(e,10)});function y$(e,t){var i,o,h,f=this._eras||La("en")._eras;for(i=0,o=f.length;i=0)return f[o]}function v$(e,t){var i=e.since<=e.until?1:-1;return t===void 0?Ct(e.since).year():Ct(e.since).year()+(t-e.offset)*i}function x$(){var e,t,i,o=this.localeData().eras();for(e=0,t=o.length;ef&&(t=f),O$.call(this,e,t,i,o,h))}function O$(e,t,i,o,h){var f=ZM(e,t,i,o,h),g=up(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}Wt("Q",0,"Qo","quarter");zt("Q",OM);qr("Q",function(e,t){t[ba]=(wr(e)-1)*3});function F$(e){return e==null?Math.ceil((this.month()+1)/3):this.month((e-1)*3+this.month()%3)}Wt("D",["DD",2],"Do","date");zt("D",dn,Gh);zt("DD",dn,Us);zt("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient});qr(["D","DD"],Ho);qr("Do",function(e,t){t[Ho]=wr(e.match(dn)[0])});var mA=Zh("Date",!0);Wt("DDD",["DDDD",3],"DDDo","dayOfYear");zt("DDD",x_);zt("DDDD",FM);qr(["DDD","DDDD"],function(e,t,i){i._dayOfYear=wr(e)});function B$(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return e==null?t:this.add(e-t,"d")}Wt("m",["mm",2],0,"minute");zt("m",dn,nb);zt("mm",dn,Us);qr(["m","mm"],_o);var N$=Zh("Minutes",!1);Wt("s",["ss",2],0,"second");zt("s",dn,nb);zt("ss",dn,Us);qr(["s","ss"],Sa);var $$=Zh("Seconds",!1);Wt("S",0,0,function(){return~~(this.millisecond()/100)});Wt(0,["SS",2],0,function(){return~~(this.millisecond()/10)});Wt(0,["SSS",3],0,"millisecond");Wt(0,["SSSS",4],0,function(){return this.millisecond()*10});Wt(0,["SSSSS",5],0,function(){return this.millisecond()*100});Wt(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3});Wt(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4});Wt(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5});Wt(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6});zt("S",x_,OM);zt("SS",x_,Us);zt("SSS",x_,FM);var Al,gA;for(Al="SSSS";Al.length<=9;Al+="S")zt(Al,Wh);function U$(e,t){t[zu]=wr(("0."+e)*1e3)}for(Al="S";Al.length<=9;Al+="S")qr(Al,U$);gA=Zh("Milliseconds",!1);Wt("z",0,0,"zoneAbbr");Wt("zz",0,0,"zoneName");function j$(){return this._isUTC?"UTC":""}function V$(){return this._isUTC?"Coordinated Universal Time":""}var ht=Cp.prototype;ht.add=L8;ht.calendar=j8;ht.clone=V8;ht.diff=X8;ht.endOf=o$;ht.format=e$;ht.from=t$;ht.fromNow=r$;ht.to=n$;ht.toNow=i$;ht.get=QB;ht.invalidAt=m$;ht.isAfter=H8;ht.isBefore=W8;ht.isBetween=G8;ht.isSame=Z8;ht.isSameOrAfter=q8;ht.isSameOrBefore=Y8;ht.isValid=f$;ht.lang=uA;ht.locale=lA;ht.localeData=cA;ht.max=f8;ht.min=d8;ht.parsingFlags=p$;ht.set=eN;ht.startOf=s$;ht.subtract=O8;ht.toArray=c$;ht.toObject=h$;ht.toDate=u$;ht.toISOString=J8;ht.inspect=Q8;typeof Symbol<"u"&&Symbol.for!=null&&(ht[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"});ht.toJSON=d$;ht.toString=K8;ht.unix=l$;ht.valueOf=a$;ht.creationData=g$;ht.eraName=x$;ht.eraNarrow=w$;ht.eraAbbr=b$;ht.eraYear=S$;ht.year=$M;ht.isLeapYear=JB;ht.weekYear=M$;ht.isoWeekYear=A$;ht.quarter=ht.quarters=F$;ht.month=WM;ht.daysInMonth=uN;ht.week=ht.weeks=yN;ht.isoWeek=ht.isoWeeks=_N;ht.weeksInYear=R$;ht.weeksInWeekYear=L$;ht.isoWeeksInYear=D$;ht.isoWeeksInISOWeekYear=z$;ht.date=mA;ht.day=ht.days=AN;ht.weekday=DN;ht.isoWeekday=zN;ht.dayOfYear=B$;ht.hour=ht.hours=$N;ht.minute=ht.minutes=N$;ht.second=ht.seconds=$$;ht.millisecond=ht.milliseconds=gA;ht.utcOffset=b8;ht.utc=k8;ht.local=T8;ht.parseZone=E8;ht.hasAlignedHourOffset=C8;ht.isDST=I8;ht.isLocal=M8;ht.isUtcOffset=A8;ht.isUtc=iA;ht.isUTC=iA;ht.zoneAbbr=j$;ht.zoneName=V$;ht.dates=so("dates accessor is deprecated. Use date instead.",mA);ht.months=so("months accessor is deprecated. Use month instead",WM);ht.years=so("years accessor is deprecated. Use year instead",$M);ht.zone=so("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",S8);ht.isDSTShifted=so("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",P8);function H$(e){return hn(e*1e3)}function W$(){return hn.apply(null,arguments).parseZone()}function yA(e){return e}var zr=Jw.prototype;zr.calendar=MB;zr.longDateFormat=RB;zr.invalidDate=OB;zr.ordinal=NB;zr.preparse=yA;zr.postformat=yA;zr.relativeTime=UB;zr.pastFuture=jB;zr.set=IB;zr.eras=y$;zr.erasParse=_$;zr.erasConvertYear=v$;zr.erasAbbrRegex=T$;zr.erasNameRegex=k$;zr.erasNarrowRegex=E$;zr.months=sN;zr.monthsShort=oN;zr.monthsParse=lN;zr.monthsRegex=hN;zr.monthsShortRegex=cN;zr.week=fN;zr.firstDayOfYear=gN;zr.firstDayOfWeek=mN;zr.weekdays=EN;zr.weekdaysMin=IN;zr.weekdaysShort=CN;zr.weekdaysParse=MN;zr.weekdaysRegex=RN;zr.weekdaysShortRegex=LN;zr.weekdaysMinRegex=ON;zr.isPM=BN;zr.meridiem=UN;function My(e,t,i,o){var h=La(),f=Yo().set(o,t);return h[i](f,e)}function _A(e,t,i){if(za(e)&&(t=e,e=void 0),e=e||"",t!=null)return My(e,t,i,"month");var o,h=[];for(o=0;o<12;o++)h[o]=My(e,o,i,"month");return h}function gb(e,t,i,o){typeof e=="boolean"?(za(t)&&(i=t,t=void 0),t=t||""):(t=e,i=t,e=!1,za(t)&&(i=t,t=void 0),t=t||"");var h=La(),f=e?h._week.dow:0,g,c=[];if(i!=null)return My(t,(i+f)%7,o,"day");for(g=0;g<7;g++)c[g]=My(t,(g+f)%7,o,"day");return c}function G$(e,t){return _A(e,t,"months")}function Z$(e,t){return _A(e,t,"monthsShort")}function q$(e,t,i){return gb(e,t,i,"weekdays")}function Y$(e,t,i){return gb(e,t,i,"weekdaysShort")}function X$(e,t,i){return gb(e,t,i,"weekdaysMin")}$l("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10,i=wr(e%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return e+i}});Ct.lang=so("moment.lang is deprecated. Use moment.locale instead.",$l);Ct.langData=so("moment.langData is deprecated. Use moment.localeData instead.",La);var ma=Math.abs;function K$(){var e=this._data;return this._milliseconds=ma(this._milliseconds),this._days=ma(this._days),this._months=ma(this._months),e.milliseconds=ma(e.milliseconds),e.seconds=ma(e.seconds),e.minutes=ma(e.minutes),e.hours=ma(e.hours),e.months=ma(e.months),e.years=ma(e.years),this}function vA(e,t,i,o){var h=Io(t,i);return e._milliseconds+=o*h._milliseconds,e._days+=o*h._days,e._months+=o*h._months,e._bubble()}function J$(e,t){return vA(this,e,t,1)}function Q$(e,t){return vA(this,e,t,-1)}function KT(e){return e<0?Math.floor(e):Math.ceil(e)}function eU(){var e=this._milliseconds,t=this._days,i=this._months,o=this._data,h,f,g,c,T;return e>=0&&t>=0&&i>=0||e<=0&&t<=0&&i<=0||(e+=KT(vx(i)+t)*864e5,t=0,i=0),o.milliseconds=e%1e3,h=Ks(e/1e3),o.seconds=h%60,f=Ks(h/60),o.minutes=f%60,g=Ks(f/60),o.hours=g%24,t+=Ks(g/24),T=Ks(xA(t)),i+=T,t-=KT(vx(T)),c=Ks(i/12),i%=12,o.days=t,o.months=i,o.years=c,this}function xA(e){return e*4800/146097}function vx(e){return e*146097/4800}function tU(e){if(!this.isValid())return NaN;var t,i,o=this._milliseconds;if(e=oo(e),e==="month"||e==="quarter"||e==="year")switch(t=this._days+o/864e5,i=this._months+xA(t),e){case"month":return i;case"quarter":return i/3;case"year":return i/12}else switch(t=this._days+Math.round(vx(this._months)),e){case"week":return t/7+o/6048e5;case"day":return t+o/864e5;case"hour":return t*24+o/36e5;case"minute":return t*1440+o/6e4;case"second":return t*86400+o/1e3;case"millisecond":return Math.floor(t*864e5)+o;default:throw new Error("Unknown unit "+e)}}function Oa(e){return function(){return this.as(e)}}var wA=Oa("ms"),rU=Oa("s"),nU=Oa("m"),iU=Oa("h"),sU=Oa("d"),oU=Oa("w"),aU=Oa("M"),lU=Oa("Q"),uU=Oa("y"),cU=wA;function hU(){return Io(this)}function dU(e){return e=oo(e),this.isValid()?this[e+"s"]():NaN}function Ku(e){return function(){return this.isValid()?this._data[e]:NaN}}var fU=Ku("milliseconds"),pU=Ku("seconds"),mU=Ku("minutes"),gU=Ku("hours"),yU=Ku("days"),_U=Ku("months"),vU=Ku("years");function xU(){return Ks(this.days()/7)}var _a=Math.round,hh={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function wU(e,t,i,o,h){return h.relativeTime(t||1,!!i,e,o)}function bU(e,t,i,o){var h=Io(e).abs(),f=_a(h.as("s")),g=_a(h.as("m")),c=_a(h.as("h")),T=_a(h.as("d")),P=_a(h.as("M")),R=_a(h.as("w")),A=_a(h.as("y")),M=f<=i.ss&&["s",f]||f0,M[4]=o,wU.apply(null,M)}function SU(e){return e===void 0?_a:typeof e=="function"?(_a=e,!0):!1}function kU(e,t){return hh[e]===void 0?!1:t===void 0?hh[e]:(hh[e]=t,e==="s"&&(hh.ss=t-1),!0)}function TU(e,t){if(!this.isValid())return this.localeData().invalidDate();var i=!1,o=hh,h,f;return typeof e=="object"&&(t=e,e=!1),typeof e=="boolean"&&(i=e),typeof t=="object"&&(o=Object.assign({},hh,t),t.s!=null&&t.ss==null&&(o.ss=t.s-1)),h=this.localeData(),f=bU(this,!i,o,h),i&&(f=h.pastFuture(+this,f)),h.postformat(f)}var Bv=Math.abs;function qc(e){return(e>0)-(e<0)||+e}function I_(){if(!this.isValid())return this.localeData().invalidDate();var e=Bv(this._milliseconds)/1e3,t=Bv(this._days),i=Bv(this._months),o,h,f,g,c=this.asSeconds(),T,P,R,A;return c?(o=Ks(e/60),h=Ks(o/60),e%=60,o%=60,f=Ks(i/12),i%=12,g=e?e.toFixed(3).replace(/\.?0+$/,""):"",T=c<0?"-":"",P=qc(this._months)!==qc(c)?"-":"",R=qc(this._days)!==qc(c)?"-":"",A=qc(this._milliseconds)!==qc(c)?"-":"",T+"P"+(f?P+f+"Y":"")+(i?P+i+"M":"")+(t?R+t+"D":"")+(h||o||e?"T":"")+(h?A+h+"H":"")+(o?A+o+"M":"")+(e?A+g+"S":"")):"P0D"}var Ir=E_.prototype;Ir.isValid=_8;Ir.abs=K$;Ir.add=J$;Ir.subtract=Q$;Ir.as=tU;Ir.asMilliseconds=wA;Ir.asSeconds=rU;Ir.asMinutes=nU;Ir.asHours=iU;Ir.asDays=sU;Ir.asWeeks=oU;Ir.asMonths=aU;Ir.asQuarters=lU;Ir.asYears=uU;Ir.valueOf=cU;Ir._bubble=eU;Ir.clone=hU;Ir.get=dU;Ir.milliseconds=fU;Ir.seconds=pU;Ir.minutes=mU;Ir.hours=gU;Ir.days=yU;Ir.weeks=xU;Ir.months=_U;Ir.years=vU;Ir.humanize=TU;Ir.toISOString=I_;Ir.toString=I_;Ir.toJSON=I_;Ir.locale=lA;Ir.localeData=cA;Ir.toIsoString=so("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",I_);Ir.lang=uA;Wt("X",0,0,"unix");Wt("x",0,0,"valueOf");zt("x",b_);zt("X",GB);qr("X",function(e,t,i){i._d=new Date(parseFloat(e)*1e3)});qr("x",function(e,t,i){i._d=new Date(wr(e))});//! moment.js Ct.version="2.30.1";EB(hn);Ct.fn=ht;Ct.min=p8;Ct.max=m8;Ct.now=g8;Ct.utc=Yo;Ct.unix=H$;Ct.months=G$;Ct.isDate=Ep;Ct.locale=$l;Ct.invalid=__;Ct.duration=Io;Ct.isMoment=To;Ct.weekdays=q$;Ct.parseZone=W$;Ct.localeData=La;Ct.isDuration=Og;Ct.monthsShort=Z$;Ct.weekdaysMin=X$;Ct.defineLocale=lb;Ct.updateLocale=WN;Ct.locales=GN;Ct.weekdaysShort=Y$;Ct.normalizeUnits=oo;Ct.relativeTimeRounding=SU;Ct.relativeTimeThreshold=kU;Ct.calendarFormat=U8;Ct.prototype=ht;Ct.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const EU=/[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?)%2C\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/,CU=e=>{const t=e.match(EU);return t?t[0].split("%2C").map(i=>parseFloat(i)):null},IU=(e,t)=>{const i=CU(e);if(i)t._location=[parseFloat(i[1]),parseFloat(i[0])],t.file=null;else if(e.indexOf("From: ")===0)t.username=e.replace("From: ","");else if(e.indexOf("Sent: ")===0)t.timeString=e.replace("Sent: ",""),t.time=PU(t.timeString);else if(e.indexOf("Attachment: ")===0&&e.indexOf(".jpeg")>-1)t.file=e.substring(12,e.indexOf(".jpeg")+5);else if(e.indexOf("Attachment: ")===0&&e.indexOf(".jpg")>-1)t.file=e.substring(12,e.indexOf(".jpg")+4);else if(e.indexOf("Attachment: ")===0&&e.indexOf("jpeg")>-1&&e.indexOf("no filename")>-1){const o=Ct.parseZone(t.timeString).format("YYYY-MM-DD-HH-mm-ss");t.file=`attachment-${o}.jpg`}else!t.file&&!t.message&&e.indexOf("Type: ")===-1&&e.indexOf("Received: ")===-1&&e.indexOf("Conversation: ")===-1&&(t.message=e)},PU=e=>new Date(e),MU=e=>{const t={};let i={},o=!1,h,f=0;for(const[g,c]of e.entries()){IU(c,i);let T=c.indexOf("From: ")===0;o&&(T?(t[f]=i,h=i.username,i={},f++):g===e.length-1&&i&&(i.username=h,t[f]=i)),T&&!o&&(o=!0)}return t};function AU({text:e,msgPosition:t}){if(!e)return;const i=e.split(` -`),o={type:"FeatureCollection",features:[]};let h={};const f=MU(i);return Object.values(f).forEach((c,T)=>{if(c._location){h={type:"Feature",properties:{},geometry:{type:"Point",coordinates:c._location}};let P;switch(t){case"before":P=qw(f,T);break;case"after":P=Zw(f,T);break;default:P=Gw(f,T);break}h.properties={...P},o.features.push(h)}}),o}function DU(e){for(let t in e){const i=e[t];return i?i[0]==="{"?TB:i.indexOf("group-v2-change")>-1?AU:wB:void 0}}function zU({files:e,msgPosition:t}){const[i,o]=Ht.useState({type:"FeatureCollection",features:[]});return Ht.useEffect(()=>{if(!e)return;let f=[];const g=DU(e);for(let c in e){const T=g({text:e[c],msgPosition:t});f=f.concat(T.features)}o(c=>({type:"FeatureCollection",features:[...c.features,...f]}))},[e]),[i,()=>{o({type:"FeatureCollection",features:[]})}]}function RU(){const[e,t]=Ht.useState(null),[i,o]=hB({msgPosition:"closest"}),[h,f,g,c,T]=fB(),[P,R]=zU({files:T,msgPosition:i.msgPosition}),A=()=>{g(),R()},M=()=>{t(null)};Ht.useEffect(()=>{t(null)},[i.msgPosition]);let N;i.msgPosition==="before"?N=Xe.jsx(ln,{id:"app.config.closestPreviousMsg",defaultMessage:"previous"}):i.msgPosition==="after"?N=Xe.jsx(ln,{id:"app.config.closestNextMsg",defaultMessage:"next"}):N=Xe.jsx(ln,{id:"app.config.closestMsg",defaultMessage:"closest"});const Y=T&&P&&P.features.length>0,j=T&&P&&P.features.length===0;return Xe.jsxs("div",{className:"app",children:[Xe.jsxs("header",{className:"header",children:[Xe.jsxs("div",{className:"top",children:[Xe.jsx(J6,{onOptionClick:te=>{te==="options"&&t(Xe.jsx(cB,{settings:i,onChange:o}))}}),Xe.jsx(uB,{isOpen:e!==null,onClose:M,content:e})]}),Xe.jsxs("h1",{className:Y?"titleSmall":"",children:[Xe.jsx("img",{src:UR,className:"logo",alt:"logo"})," ",Xe.jsx("strong",{children:"Chat"}),"Map"]}),Y?Xe.jsxs("div",{className:"fileOtions",children:[Xe.jsx(K6,{data:P,filename:"chat-locations"}),Xe.jsx("button",{onClick:A,className:"secondaryButton",children:Xe.jsx(ln,{id:"app.uploadNewFile",defaultMessage:"Upload new file"})})]}):Xe.jsxs(Xe.Fragment,{children:[Xe.jsx("p",{className:"subtitle",children:Xe.jsx(ln,{id:"app.subtitle",defaultMessage:"Export a chat from the app and visualize the locations shared in the conversation"})}),Xe.jsx("p",{className:"supportedApps",children:Xe.jsx(ln,{id:"app.supportedApps",defaultMessage:"Now it works with WhatsApp, Telegram or Signal!"})})]})]}),!T&&Xe.jsxs(Xe.Fragment,{children:[Xe.jsx("div",{className:"fileUpload",children:Xe.jsx(A4,{onDataFileLoad:f,onFilesLoad:h})}),Xe.jsxs("p",{className:"configDesc",children:[Xe.jsx(ln,{id:"app.config.msgPositionTextStart",defaultMessage:"It will search for locations and the"})," ",Xe.jsx("strong",{children:N})," ",Xe.jsx(ln,{id:"app.config.msgPositionTextEnd",defaultMessage:"message from the same user."})]}),Xe.jsxs("div",{className:"infoLinks",children:[Xe.jsxs("div",{className:"copy",children:[Xe.jsx("a",{className:"github",href:"https://github.com/hotosm/chatmap"}),Xe.jsx("span",{children:"Free and Open Source Software"})]}),Xe.jsx("a",{href:"https://www.hotosm.org/privacy",children:"We collect zero data. https://www.hotosm.org/privacy"})]})]}),Y&&Xe.jsx("div",{className:"data",children:Xe.jsx("div",{className:"map",children:Xe.jsx(X6,{data:P,dataFiles:c})})}),j&&Xe.jsxs(Xe.Fragment,{children:[Xe.jsx("h2",{children:Xe.jsx(ln,{id:"app.nolocations",defaultMessage:"No locations found in this file"})}),Xe.jsx("button",{onClick:A,className:"secondaryButton",children:Xe.jsx(ln,{id:"app.uploadNewFile",defaultMessage:"Upload new file"})})]})]})}const LU={"app.subtitle":"Export a chat from the app and visualize the locations shared in the conversation","app.config.msgPositionTextStart":"It will search for locations and the","app.config.msgPositionTextEnd":"message from the same user.","app.config.closestPreviousMsg":"previous","app.config.closestNextMsg":"next","app.config.closestMsg":"closest","app.uploadNewFile":"Upload new file","app.download":"Download","app.options":"Options","app.uploadLabel":"Upload or drag a file right here","app.nolocations":"No locations found in this file","app.supportedApps":"Now it works with WhatsApp, Telegram or Signal!"},OU={"app.subtitle":"Exporta un chat desde la aplicación y visualiza las ubicaciones compartidas en la conversación","app.config.msgPositionTextStart":"Buscará localizaciones y el","app.config.msgPositionTextEnd":"mensaje del mismo usuario.","app.config.closestPreviousMsg":"anterior","app.config.closestNextMsg":"siguiente","app.config.closestMsg":"más cercano","app.uploadNewFile":"Subir un nuevo archivo","app.download":"Descargar","app.options":"Opciones","app.uploadLabel":"Sube o arrastra un archivo aquí mismo","app.nolocations":"No se han encontrado ubicaciones en este archivo","app.loading":"Cargando","app.supportedApps":"Ahora funciona con WhatsApp, Telegram o Signal!"},FU={"app.subtitle":"Exportar uma chat da aplicação e visualizar localizações partilhadas na conversa","app.config.msgPositionTextStart":"Procurará locais e o","app.config.msgPositionTextEnd":"mensagem do mesmo utilizador.","app.config.closestPreviousMsg":"anterior","app.config.closestNextMsg":"seguinte","app.config.closestMsg":"mais próximo","app.uploadNewFile":"Carregar um novo ficheiro","app.download":"Descarregar","app.options":"Opções","app.uploadLabel":"Carregue ou arraste um ficheiro aqui mesmo","app.nolocations":"Não foram encontrados locais neste arquivo.","app.loading":"Carregando","app.supportedApps":"Agora funciona com WhatsApp, Telegram e Signal!"},Nv={en:LU,es:OU,pt:FU},BU=()=>{const e=navigator.language.slice(0,2);return e in Nv?Nv[e]:Nv.en},NU=$v.createRoot(document.getElementById("root"));NU.render(Xe.jsx(wh.StrictMode,{children:Xe.jsx(I4,{locale:navigator.language,messages:BU(),children:Xe.jsx(RU,{})})}))});export default $U(); -//# sourceMappingURL=index-Cbv4SEbF.js.map +`),o={type:"FeatureCollection",features:[]};let h={};const f=MU(i);return Object.values(f).forEach((c,T)=>{if(c._location){h={type:"Feature",properties:{},geometry:{type:"Point",coordinates:c._location}};let P;switch(t){case"before":P=qw(f,T);break;case"after":P=Zw(f,T);break;default:P=Gw(f,T);break}h.properties={...P},o.features.push(h)}}),o}function DU(e){for(let t in e){const i=e[t];return i?i[0]==="{"?TB:i.indexOf("group-v2-change")>-1?AU:wB:void 0}}function zU({files:e,msgPosition:t}){const[i,o]=Ht.useState({type:"FeatureCollection",features:[]});return Ht.useEffect(()=>{if(!e)return;let f=[];const g=DU(e);for(let c in e){const T=g({text:e[c],msgPosition:t});f=f.concat(T.features)}o(c=>({type:"FeatureCollection",features:[...c.features,...f]}))},[e]),[i,()=>{o({type:"FeatureCollection",features:[]})}]}function RU(){const[e,t]=Ht.useState(null),[i,o]=hB({msgPosition:"closest"}),[h,f,g,c,T]=fB(),[P,R]=zU({files:T,msgPosition:i.msgPosition}),A=()=>{g(),R()},M=()=>{t(null)};Ht.useEffect(()=>{t(null)},[i.msgPosition]);let N;i.msgPosition==="before"?N=Ke.jsx(ln,{id:"app.config.closestPreviousMsg",defaultMessage:"previous"}):i.msgPosition==="after"?N=Ke.jsx(ln,{id:"app.config.closestNextMsg",defaultMessage:"next"}):N=Ke.jsx(ln,{id:"app.config.closestMsg",defaultMessage:"closest"});const Y=T&&P&&P.features.length>0,j=T&&P&&P.features.length===0;return Ke.jsxs("div",{className:"app",children:[Ke.jsxs("header",{className:"header",children:[Ke.jsxs("div",{className:"top",children:[Ke.jsx(J6,{onOptionClick:te=>{te==="options"&&t(Ke.jsx(cB,{settings:i,onChange:o}))}}),Ke.jsx(uB,{isOpen:e!==null,onClose:M,content:e})]}),Ke.jsxs("h1",{className:Y?"titleSmall":"",children:[Ke.jsx("img",{src:UR,className:"logo",alt:"logo"})," ChatMap"]}),Y?Ke.jsxs("div",{className:"fileOtions",children:[Ke.jsx(K6,{data:P,filename:"chat-locations"}),Ke.jsx("button",{onClick:A,className:"secondaryButton",children:Ke.jsx(ln,{id:"app.uploadNewFile",defaultMessage:"Upload new file"})})]}):Ke.jsxs(Ke.Fragment,{children:[Ke.jsx("p",{className:"subtitle",children:Ke.jsx(ln,{id:"app.subtitle",defaultMessage:"Export a chat from the app and visualize the locations shared in the conversation"})}),Ke.jsx("p",{className:"supportedApps",children:Ke.jsx(ln,{id:"app.supportedApps",defaultMessage:"Now it works with WhatsApp, Telegram or Signal!"})})]})]}),!T&&Ke.jsxs(Ke.Fragment,{children:[Ke.jsx("div",{className:"fileUpload",children:Ke.jsx(A4,{onDataFileLoad:f,onFilesLoad:h})}),Ke.jsxs("p",{className:"configDesc",children:[Ke.jsx(ln,{id:"app.config.msgPositionTextStart",defaultMessage:"It will search for locations and the"})," ",Ke.jsx("strong",{children:N})," ",Ke.jsx(ln,{id:"app.config.msgPositionTextEnd",defaultMessage:"message from the same user."})]}),Ke.jsxs("div",{className:"infoLinks",children:[Ke.jsxs("div",{className:"copy",children:[Ke.jsx("a",{className:"github",href:"https://github.com/hotosm/chatmap"}),Ke.jsx("span",{children:"Free and Open Source Software"})]}),Ke.jsx("a",{href:"https://www.hotosm.org/privacy",children:"We collect zero data. https://www.hotosm.org/privacy"})]})]}),Y&&Ke.jsx("div",{className:"data",children:Ke.jsx("div",{className:"map",children:Ke.jsx(X6,{data:P,dataFiles:c})})}),j&&Ke.jsxs(Ke.Fragment,{children:[Ke.jsx("h2",{children:Ke.jsx(ln,{id:"app.nolocations",defaultMessage:"No locations found in this file"})}),Ke.jsx("button",{onClick:A,className:"secondaryButton",children:Ke.jsx(ln,{id:"app.uploadNewFile",defaultMessage:"Upload new file"})})]})]})}const LU={"app.subtitle":"Export a chat from the app and visualize the locations shared in the conversation","app.config.msgPositionTextStart":"It will search for locations and the","app.config.msgPositionTextEnd":"message from the same user.","app.config.closestPreviousMsg":"previous","app.config.closestNextMsg":"next","app.config.closestMsg":"closest","app.uploadNewFile":"Upload new file","app.download":"Download","app.options":"Options","app.uploadLabel":"Upload or drag a file right here","app.nolocations":"No locations found in this file","app.supportedApps":"Now it works with WhatsApp, Telegram or Signal!"},OU={"app.subtitle":"Exporta un chat desde la aplicación y visualiza las ubicaciones compartidas en la conversación","app.config.msgPositionTextStart":"Buscará localizaciones y el","app.config.msgPositionTextEnd":"mensaje del mismo usuario.","app.config.closestPreviousMsg":"anterior","app.config.closestNextMsg":"siguiente","app.config.closestMsg":"más cercano","app.uploadNewFile":"Subir un nuevo archivo","app.download":"Descargar","app.options":"Opciones","app.uploadLabel":"Sube o arrastra un archivo aquí mismo","app.nolocations":"No se han encontrado ubicaciones en este archivo","app.loading":"Cargando","app.supportedApps":"Ahora funciona con WhatsApp, Telegram o Signal!"},FU={"app.subtitle":"Exportar uma chat da aplicação e visualizar localizações partilhadas na conversa","app.config.msgPositionTextStart":"Procurará locais e o","app.config.msgPositionTextEnd":"mensagem do mesmo utilizador.","app.config.closestPreviousMsg":"anterior","app.config.closestNextMsg":"seguinte","app.config.closestMsg":"mais próximo","app.uploadNewFile":"Carregar um novo ficheiro","app.download":"Descarregar","app.options":"Opções","app.uploadLabel":"Carregue ou arraste um ficheiro aqui mesmo","app.nolocations":"Não foram encontrados locais neste arquivo.","app.loading":"Carregando","app.supportedApps":"Agora funciona com WhatsApp, Telegram e Signal!"},Nv={en:LU,es:OU,pt:FU},BU=()=>{const e=navigator.language.slice(0,2);return e in Nv?Nv[e]:Nv.en},NU=$v.createRoot(document.getElementById("root"));NU.render(Ke.jsx(wh.StrictMode,{children:Ke.jsx(I4,{locale:navigator.language,messages:BU(),children:Ke.jsx(RU,{})})}))});export default $U(); +//# sourceMappingURL=index-CB9klhbe.js.map diff --git a/assets/index-Cbv4SEbF.js.map b/assets/index-CB9klhbe.js.map similarity index 60% rename from assets/index-Cbv4SEbF.js.map rename to assets/index-CB9klhbe.js.map index 5ad627e..c784153 100644 --- a/assets/index-Cbv4SEbF.js.map +++ b/assets/index-CB9klhbe.js.map @@ -1 +1 @@ -{"version":3,"file":"index-Cbv4SEbF.js","sources":["../../node_modules/react/cjs/react.production.min.js","../../node_modules/react/index.js","../../node_modules/react/cjs/react-jsx-runtime.production.min.js","../../node_modules/react/jsx-runtime.js","../../node_modules/scheduler/cjs/scheduler.production.min.js","../../node_modules/scheduler/index.js","../../node_modules/react-dom/cjs/react-dom.production.min.js","../../node_modules/react-dom/index.js","../../node_modules/react-dom/client.js","../../src/hot-logo.svg","../../node_modules/styled-components/node_modules/tslib/tslib.es6.mjs","../../node_modules/stylis/src/Enum.js","../../node_modules/stylis/src/Utility.js","../../node_modules/stylis/src/Tokenizer.js","../../node_modules/stylis/src/Parser.js","../../node_modules/stylis/src/Prefixer.js","../../node_modules/stylis/src/Serializer.js","../../node_modules/stylis/src/Middleware.js","../../node_modules/@emotion/unitless/dist/emotion-unitless.esm.js","../../node_modules/styled-components/dist/styled-components.browser.esm.js","../../node_modules/react-drag-drop-files/dist/react-drag-drop-files.esm.js","../../node_modules/jszip/dist/jszip.min.js","../../node_modules/tslib/tslib.es6.mjs","../../node_modules/@formatjs/fast-memoize/lib/index.js","../../node_modules/@formatjs/ecma402-abstract/lib/utils.js","../../node_modules/@formatjs/icu-messageformat-parser/lib/error.js","../../node_modules/@formatjs/icu-messageformat-parser/lib/types.js","../../node_modules/@formatjs/icu-messageformat-parser/lib/regex.generated.js","../../node_modules/@formatjs/icu-skeleton-parser/lib/date-time.js","../../node_modules/@formatjs/icu-skeleton-parser/lib/regex.generated.js","../../node_modules/@formatjs/icu-skeleton-parser/lib/number.js","../../node_modules/@formatjs/icu-messageformat-parser/lib/time-data.generated.js","../../node_modules/@formatjs/icu-messageformat-parser/lib/date-time-pattern-generator.js","../../node_modules/@formatjs/icu-messageformat-parser/lib/parser.js","../../node_modules/@formatjs/icu-messageformat-parser/lib/index.js","../../node_modules/intl-messageformat/lib/src/error.js","../../node_modules/intl-messageformat/lib/src/formatters.js","../../node_modules/intl-messageformat/lib/src/core.js","../../node_modules/@formatjs/intl/lib/src/error.js","../../node_modules/@formatjs/intl/lib/src/utils.js","../../node_modules/@formatjs/intl/lib/src/message.js","../../node_modules/@formatjs/intl/lib/src/dateTime.js","../../node_modules/@formatjs/intl/lib/src/displayName.js","../../node_modules/@formatjs/intl/lib/src/list.js","../../node_modules/@formatjs/intl/lib/src/plural.js","../../node_modules/@formatjs/intl/lib/src/relativeTime.js","../../node_modules/@formatjs/intl/lib/src/number.js","../../node_modules/@formatjs/intl/lib/src/create-intl.js","../../node_modules/react-intl/lib/src/utils.js","../../node_modules/react-is/cjs/react-is.production.min.js","../../node_modules/react-is/index.js","../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../../node_modules/react-intl/lib/src/components/injectIntl.js","../../node_modules/react-intl/lib/src/components/useIntl.js","../../node_modules/react-intl/lib/src/components/createFormattedComponent.js","../../node_modules/react-intl/lib/src/components/createIntl.js","../../node_modules/react-intl/lib/src/components/provider.js","../../node_modules/react-intl/lib/src/components/message.js","../../node_modules/react-intl/lib/index.js","../../src/components/FileUpload/index.jsx","../../node_modules/maplibre-gl/dist/maplibre-gl.js","../../src/components/Map/source.js","../../node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.min.js","../../node_modules/react-dom/cjs/react-dom-server.browser.production.min.js","../../node_modules/react-dom/server.browser.js","../../src/components/Map/popup.jsx","../../node_modules/turf-meta/index.js","../../node_modules/turf-extent/index.js","../../src/components/Map/index.jsx","../../src/components/DownloadButton/index.jsx","../../src/components/NavBar/index.jsx","../../node_modules/prop-types/lib/ReactPropTypesSecret.js","../../node_modules/prop-types/factoryWithThrowingShims.js","../../node_modules/prop-types/index.js","../../node_modules/react-modal/lib/helpers/tabbable.js","../../node_modules/react-modal/lib/helpers/focusManager.js","../../node_modules/react-modal/lib/helpers/scopeTab.js","../../node_modules/warning/warning.js","../../node_modules/exenv/index.js","../../node_modules/react-modal/lib/helpers/safeHTMLElement.js","../../node_modules/react-modal/lib/helpers/ariaAppHider.js","../../node_modules/react-modal/lib/helpers/classList.js","../../node_modules/react-modal/lib/helpers/portalOpenInstances.js","../../node_modules/react-modal/lib/helpers/bodyTrap.js","../../node_modules/react-modal/lib/components/ModalPortal.js","../../node_modules/react-lifecycles-compat/react-lifecycles-compat.es.js","../../node_modules/react-modal/lib/components/Modal.js","../../node_modules/react-modal/lib/index.js","../../src/components/NavModal/index.jsx","../../src/components/Settings/CardOption.jsx","../../src/components/Settings/index.jsx","../../src/hooks/useSettings.js","../../src/hooks/useFileManager.js","../../src/parsers/chatmap.js","../../src/parsers/whatsapp.js","../../src/parsers/telegram.js","../../node_modules/moment/dist/moment.js","../../src/parsers/signal.js","../../src/parsers/detectApp.js","../../src/hooks/useContentMerger.js","../../src/App.jsx","../../src/main.jsx"],"sourcesContent":["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n","/**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),ca=require(\"scheduler\");function p(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function v(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var z={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){z[a]=new v(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];z[b]=new v(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){z[a]=new v(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){z[a]=new v(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){z[a]=new v(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){z[a]=new v(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){z[a]=new v(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){z[a]=new v(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){z[a]=new v(a,5,!1,a.toLowerCase(),null,!1,!1)});var ra=/[\\-:]([a-z])/g;function sa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(ra,\nsa);z[b]=new v(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!1,!1)});\nz.xlinkHref=new v(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction ta(a,b,c,d){var e=z.hasOwnProperty(b)?z[b]:null;if(null!==e?0!==e.type:d||!(2h||e[g]!==f[h]){var k=\"\\n\"+e[g].replace(\" at new \",\" at \");a.displayName&&k.includes(\"\")&&(k=k.replace(\"\",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{Na=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Ma(a):\"\"}\nfunction Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma(\"Lazy\");case 13:return Ma(\"Suspense\");case 19:return Ma(\"SuspenseList\");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return\"\"}}\nfunction Qa(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ya:return\"Fragment\";case wa:return\"Portal\";case Aa:return\"Profiler\";case za:return\"StrictMode\";case Ea:return\"Suspense\";case Fa:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case Ca:return(a.displayName||\"Context\")+\".Consumer\";case Ba:return(a._context.displayName||\"Context\")+\".Provider\";case Da:var b=a.render;a=a.displayName;a||(a=b.displayName||\nb.name||\"\",a=\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");return a;case Ga:return b=a.displayName||null,null!==b?b:Qa(a.type)||\"Memo\";case Ha:b=a._payload;a=a._init;try{return Qa(a(b))}catch(c){}}return null}\nfunction Ra(a){var b=a.type;switch(a.tag){case 24:return\"Cache\";case 9:return(b.displayName||\"Context\")+\".Consumer\";case 10:return(b._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return a=b.render,a=a.displayName||a.name||\"\",b.displayName||(\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return b;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return Qa(b);case 8:return b===za?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";\ncase 12:return\"Profiler\";case 21:return\"Scope\";case 13:return\"Suspense\";case 19:return\"SuspenseList\";case 25:return\"TracingMarker\";case 1:case 0:case 17:case 2:case 14:case 15:if(\"function\"===typeof b)return b.displayName||b.name||null;if(\"string\"===typeof b)return b}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"string\":case \"undefined\":return a;case \"object\":return a;default:return\"\"}}\nfunction Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return A({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function ab(a,b){b=b.checked;null!=b&&ta(a,\"checked\",b,!1)}\nfunction bb(a,b){ab(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?cb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&cb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction db(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction cb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}var eb=Array.isArray;\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e\"+b.valueOf().toString()+\"\";for(b=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction ob(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,\nzoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(pb).forEach(function(a){qb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pb[b]=pb[a]})});function rb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||pb.hasOwnProperty(a)&&pb[a]?(\"\"+b).trim():b+\"px\"}\nfunction sb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=rb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction ub(a,b){if(b){if(tb[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(p(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(p(60));if(\"object\"!==typeof b.dangerouslySetInnerHTML||!(\"__html\"in b.dangerouslySetInnerHTML))throw Error(p(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(p(62));}}\nfunction vb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return!1;default:return!0}}var wb=null;function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(p(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;a>>=0;return 0===a?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304;\nfunction tc(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;\ndefault:return a}}function uc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=tc(h):(f&=g,0!==f&&(d=tc(f)))}else g=c&~e,0!==g?d=tc(g):0!==f&&(d=tc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);return b}\nfunction Ac(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-oc(b);a[b]=c}function Bc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Je(c)}}function Le(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Le(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Me(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Ne(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nfunction Oe(a){var b=Me(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&c&&c.ownerDocument&&Le(c.ownerDocument.documentElement,c)){if(null!==d&&Ne(c))if(b=d.start,a=d.end,void 0===a&&(a=b),\"selectionStart\"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(a=(b=c.ownerDocument||document)&&b.defaultView||window,a.getSelection){a=a.getSelection();var e=c.textContent.length,f=Math.min(d.start,e);d=void 0===d.end?f:Math.min(d.end,e);!a.extend&&f>d&&(e=d,d=f,f=e);e=Ke(c,f);var g=Ke(c,\nd);e&&g&&(1!==a.rangeCount||a.anchorNode!==e.node||a.anchorOffset!==e.offset||a.focusNode!==g.node||a.focusOffset!==g.offset)&&(b=b.createRange(),b.setStart(e.node,e.offset),a.removeAllRanges(),f>d?(a.addRange(b),a.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),a.addRange(b)))}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});\"function\"===typeof c.focus&&c.focus();for(c=0;c=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Ne(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Ie(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(a,b){Tf++;Sf[Tf]=a.current;a.current=b}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,b){var c=a.type.contextTypes;if(!c)return Vf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}\nfunction Zf(a){a=a.childContextTypes;return null!==a&&void 0!==a}function $f(){E(Wf);E(H)}function ag(a,b,c){if(H.current!==Vf)throw Error(p(168));G(H,b);G(Wf,c)}function bg(a,b,c){var d=a.stateNode;b=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(p(108,Ra(a)||\"Unknown\",e));return A({},c,d)}\nfunction cg(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf;Xf=H.current;G(H,a);G(Wf,Wf.current);return!0}function dg(a,b,c){var d=a.stateNode;if(!d)throw Error(p(169));c?(a=bg(a,b,Xf),d.__reactInternalMemoizedMergedChildContext=a,E(Wf),E(H),G(H,a)):E(Wf);G(Wf,c)}var eg=null,fg=!1,gg=!1;function hg(a){null===eg?eg=[a]:eg.push(a)}function ig(a){fg=!0;hg(a)}\nfunction jg(){if(!gg&&null!==eg){gg=!0;var a=0,b=C;try{var c=eg;for(C=1;a>=g;e-=g;rg=1<<32-oc(b)+e|c<w?(x=u,u=null):x=u.sibling;var n=r(e,u,h[w],k);if(null===n){null===u&&(u=x);break}a&&u&&null===n.alternate&&b(e,u);g=f(n,g,w);null===m?l=n:m.sibling=n;m=n;u=x}if(w===h.length)return c(e,u),I&&tg(e,w),l;if(null===u){for(;ww?(x=m,m=null):x=m.sibling;var t=r(e,m,n.value,k);if(null===t){null===m&&(m=x);break}a&&m&&null===t.alternate&&b(e,m);g=f(t,g,w);null===u?l=t:u.sibling=t;u=t;m=x}if(n.done)return c(e,\nm),I&&tg(e,w),l;if(null===m){for(;!n.done;w++,n=h.next())n=q(e,n.value,k),null!==n&&(g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);I&&tg(e,w);return l}for(m=d(e,m);!n.done;w++,n=h.next())n=y(m,e,w,n.value,k),null!==n&&(a&&null!==n.alternate&&m.delete(null===n.key?w:n.key),g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);a&&m.forEach(function(a){return b(e,a)});I&&tg(e,w);return l}function J(a,d,f,h){\"object\"===typeof f&&null!==f&&f.type===ya&&null===f.key&&(f=f.props.children);if(\"object\"===typeof f&&null!==f){switch(f.$$typeof){case va:a:{for(var k=\nf.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ya){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||\"object\"===typeof k&&null!==k&&k.$$typeof===Ha&&Ng(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=Lg(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling}f.type===ya?(d=Tg(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=Rg(f.type,f.key,f.props,null,a.mode,h),h.ref=Lg(a,d,f),h.return=a,a=h)}return g(a);case wa:a:{for(l=f.key;null!==\nd;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=Sg(f,a.mode,h);d.return=a;a=d}return g(a);case Ha:return l=f._init,J(a,d,l(f._payload),h)}if(eb(f))return n(a,d,f,h);if(Ka(f))return t(a,d,f,h);Mg(a,f)}return\"string\"===typeof f&&\"\"!==f||\"number\"===typeof f?(f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):\n(c(a,d),d=Qg(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return J}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null}function ah(a){var b=Wg.current;E(Wg);a._currentValue=b}function bh(a,b,c){for(;null!==a;){var d=a.alternate;(a.childLanes&b)!==b?(a.childLanes|=b,null!==d&&(d.childLanes|=b)):null!==d&&(d.childLanes&b)!==b&&(d.childLanes|=b);if(a===c)break;a=a.return}}\nfunction ch(a,b){Xg=a;Zg=Yg=null;a=a.dependencies;null!==a&&null!==a.firstContext&&(0!==(a.lanes&b)&&(dh=!0),a.firstContext=null)}function eh(a){var b=a._currentValue;if(Zg!==a)if(a={context:a,memoizedValue:b,next:null},null===Yg){if(null===Xg)throw Error(p(308));Yg=a;Xg.dependencies={lanes:0,firstContext:a}}else Yg=Yg.next=a;return b}var fh=null;function gh(a){null===fh?fh=[a]:fh.push(a)}\nfunction hh(a,b,c,d){var e=b.interleaved;null===e?(c.next=c,gh(b)):(c.next=e.next,e.next=c);b.interleaved=c;return ih(a,d)}function ih(a,b){a.lanes|=b;var c=a.alternate;null!==c&&(c.lanes|=b);c=a;for(a=a.return;null!==a;)a.childLanes|=b,c=a.alternate,null!==c&&(c.childLanes|=b),c=a,a=a.return;return 3===c.tag?c.stateNode:null}var jh=!1;function kh(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}\nfunction lh(a,b){a=a.updateQueue;b.updateQueue===a&&(b.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function mh(a,b){return{eventTime:a,lane:b,tag:0,payload:null,callback:null,next:null}}\nfunction nh(a,b,c){var d=a.updateQueue;if(null===d)return null;d=d.shared;if(0!==(K&2)){var e=d.pending;null===e?b.next=b:(b.next=e.next,e.next=b);d.pending=b;return ih(a,c)}e=d.interleaved;null===e?(b.next=b,gh(d)):(b.next=e.next,e.next=b);d.interleaved=b;return ih(a,c)}function oh(a,b,c){b=b.updateQueue;if(null!==b&&(b=b.shared,0!==(c&4194240))){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nfunction ph(a,b){var c=a.updateQueue,d=a.alternate;if(null!==d&&(d=d.updateQueue,c===d)){var e=null,f=null;c=c.firstBaseUpdate;if(null!==c){do{var g={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};null===f?e=f=g:f=f.next=g;c=c.next}while(null!==c);null===f?e=f=b:f=f.next=b}else e=f=b;c={baseState:d.baseState,firstBaseUpdate:e,lastBaseUpdate:f,shared:d.shared,effects:d.effects};a.updateQueue=c;return}a=c.lastBaseUpdate;null===a?c.firstBaseUpdate=b:a.next=\nb;c.lastBaseUpdate=b}\nfunction qh(a,b,c,d){var e=a.updateQueue;jh=!1;var f=e.firstBaseUpdate,g=e.lastBaseUpdate,h=e.shared.pending;if(null!==h){e.shared.pending=null;var k=h,l=k.next;k.next=null;null===g?f=l:g.next=l;g=k;var m=a.alternate;null!==m&&(m=m.updateQueue,h=m.lastBaseUpdate,h!==g&&(null===h?m.firstBaseUpdate=l:h.next=l,m.lastBaseUpdate=k))}if(null!==f){var q=e.baseState;g=0;m=l=k=null;h=f;do{var r=h.lane,y=h.eventTime;if((d&r)===r){null!==m&&(m=m.next={eventTime:y,lane:0,tag:h.tag,payload:h.payload,callback:h.callback,\nnext:null});a:{var n=a,t=h;r=b;y=c;switch(t.tag){case 1:n=t.payload;if(\"function\"===typeof n){q=n.call(y,q,r);break a}q=n;break a;case 3:n.flags=n.flags&-65537|128;case 0:n=t.payload;r=\"function\"===typeof n?n.call(y,q,r):n;if(null===r||void 0===r)break a;q=A({},q,r);break a;case 2:jh=!0}}null!==h.callback&&0!==h.lane&&(a.flags|=64,r=e.effects,null===r?e.effects=[h]:r.push(h))}else y={eventTime:y,lane:r,tag:h.tag,payload:h.payload,callback:h.callback,next:null},null===m?(l=m=y,k=q):m=m.next=y,g|=r;\nh=h.next;if(null===h)if(h=e.shared.pending,null===h)break;else r=h,h=r.next,r.next=null,e.lastBaseUpdate=r,e.shared.pending=null}while(1);null===m&&(k=q);e.baseState=k;e.firstBaseUpdate=l;e.lastBaseUpdate=m;b=e.shared.interleaved;if(null!==b){e=b;do g|=e.lane,e=e.next;while(e!==b)}else null===f&&(e.shared.lanes=0);rh|=g;a.lanes=g;a.memoizedState=q}}\nfunction sh(a,b,c){a=b.effects;b.effects=null;if(null!==a)for(b=0;bc?c:4;a(!0);var d=Gh.transition;Gh.transition={};try{a(!1),b()}finally{C=c,Gh.transition=d}}function wi(){return Uh().memoizedState}\nfunction xi(a,b,c){var d=yi(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(zi(a))Ai(b,c);else if(c=hh(a,b,c,d),null!==c){var e=R();gi(c,a,d,e);Bi(c,b,d)}}\nfunction ii(a,b,c){var d=yi(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(zi(a))Ai(b,e);else{var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(He(h,g)){var k=b.interleaved;null===k?(e.next=e,gh(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(l){}finally{}c=hh(a,b,e,d);null!==c&&(e=R(),gi(c,a,d,e),Bi(c,b,d))}}\nfunction zi(a){var b=a.alternate;return a===M||null!==b&&b===M}function Ai(a,b){Jh=Ih=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}function Bi(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nvar Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(a,b){Th().memoizedState=[a,void 0===b?null:b];return a},useContext:eh,useEffect:mi,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ki(4194308,\n4,pi.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ki(4194308,4,a,b)},useInsertionEffect:function(a,b){return ki(4,2,a,b)},useMemo:function(a,b){var c=Th();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=Th();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=xi.bind(null,M,a);return[d.memoizedState,a]},useRef:function(a){var b=\nTh();a={current:a};return b.memoizedState=a},useState:hi,useDebugValue:ri,useDeferredValue:function(a){return Th().memoizedState=a},useTransition:function(){var a=hi(!1),b=a[0];a=vi.bind(null,a[1]);Th().memoizedState=a;return[b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=M,e=Th();if(I){if(void 0===c)throw Error(p(407));c=c()}else{c=b();if(null===Q)throw Error(p(349));0!==(Hh&30)||di(d,b,c)}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;mi(ai.bind(null,d,\nf,a),[a]);d.flags|=2048;bi(9,ci.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=Th(),b=Q.identifierPrefix;if(I){var c=sg;var d=rg;c=(d&~(1<<32-oc(d)-1)).toString(32)+c;b=\":\"+b+\"R\"+c;c=Kh++;0\\x3c/script>\",a=a.removeChild(a.firstChild)):\n\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[Of]=b;a[Pf]=d;zj(a,b,!1,!1);b.stateNode=a;a:{g=vb(c,d);switch(c){case \"dialog\":D(\"cancel\",a);D(\"close\",a);e=d;break;case \"iframe\":case \"object\":case \"embed\":D(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eGj&&(b.flags|=128,d=!0,Dj(f,!1),b.lanes=4194304)}else{if(!d)if(a=Ch(g),null!==a){if(b.flags|=128,d=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Dj(f,!0),null===f.tail&&\"hidden\"===f.tailMode&&!g.alternate&&!I)return S(b),null}else 2*B()-f.renderingStartTime>Gj&&1073741824!==c&&(b.flags|=128,d=!0,Dj(f,!1),b.lanes=4194304);f.isBackwards?(g.sibling=b.child,b.child=g):(c=f.last,null!==c?c.sibling=g:b.child=g,f.last=g)}if(null!==f.tail)return b=f.tail,f.rendering=\nb,f.tail=b.sibling,f.renderingStartTime=B(),b.sibling=null,c=L.current,G(L,d?c&1|2:c&1),b;S(b);return null;case 22:case 23:return Hj(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(fj&1073741824)&&(S(b),b.subtreeFlags&6&&(b.flags|=8192)):S(b),null;case 24:return null;case 25:return null}throw Error(p(156,b.tag));}\nfunction Ij(a,b){wg(b);switch(b.tag){case 1:return Zf(b.type)&&$f(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return zh(),E(Wf),E(H),Eh(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return Bh(b),null;case 13:E(L);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(p(340));Ig()}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(b.type._context),null;case 22:case 23:return Hj(),\nnull;case 24:return null;default:return null}}var Jj=!1,U=!1,Kj=\"function\"===typeof WeakSet?WeakSet:Set,V=null;function Lj(a,b){var c=a.ref;if(null!==c)if(\"function\"===typeof c)try{c(null)}catch(d){W(a,b,d)}else c.current=null}function Mj(a,b,c){try{c()}catch(d){W(a,b,d)}}var Nj=!1;\nfunction Oj(a,b){Cf=dd;a=Me();if(Ne(a)){if(\"selectionStart\"in a)var c={start:a.selectionStart,end:a.selectionEnd};else a:{c=(c=a.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&0!==d.rangeCount){c=d.anchorNode;var e=d.anchorOffset,f=d.focusNode;d=d.focusOffset;try{c.nodeType,f.nodeType}catch(F){c=null;break a}var g=0,h=-1,k=-1,l=0,m=0,q=a,r=null;b:for(;;){for(var y;;){q!==c||0!==e&&3!==q.nodeType||(h=g+e);q!==f||0!==d&&3!==q.nodeType||(k=g+d);3===q.nodeType&&(g+=\nq.nodeValue.length);if(null===(y=q.firstChild))break;r=q;q=y}for(;;){if(q===a)break b;r===c&&++l===e&&(h=g);r===f&&++m===d&&(k=g);if(null!==(y=q.nextSibling))break;q=r;r=q.parentNode}q=y}c=-1===h||-1===k?null:{start:h,end:k}}else c=null}c=c||{start:0,end:0}}else c=null;Df={focusedElem:a,selectionRange:c};dd=!1;for(V=b;null!==V;)if(b=V,a=b.child,0!==(b.subtreeFlags&1028)&&null!==a)a.return=b,V=a;else for(;null!==V;){b=V;try{var n=b.alternate;if(0!==(b.flags&1024))switch(b.tag){case 0:case 11:case 15:break;\ncase 1:if(null!==n){var t=n.memoizedProps,J=n.memoizedState,x=b.stateNode,w=x.getSnapshotBeforeUpdate(b.elementType===b.type?t:Ci(b.type,t),J);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var u=b.stateNode.containerInfo;1===u.nodeType?u.textContent=\"\":9===u.nodeType&&u.documentElement&&u.removeChild(u.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163));}}catch(F){W(b,b.return,F)}a=b.sibling;if(null!==a){a.return=b.return;V=a;break}V=b.return}n=Nj;Nj=!1;return n}\nfunction Pj(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Mj(b,c,f)}e=e.next}while(e!==d)}}function Qj(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d()}c=c.next}while(c!==b)}}function Rj(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c}\"function\"===typeof b?b(a):b.current=a}}\nfunction Sj(a){var b=a.alternate;null!==b&&(a.alternate=null,Sj(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&(delete b[Of],delete b[Pf],delete b[of],delete b[Qf],delete b[Rf]));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null}function Tj(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction Uj(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Tj(a.return))return null;a=a.return}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}\nfunction Vj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=Bf));else if(4!==d&&(a=a.child,null!==a))for(Vj(a,b,c),a=a.sibling;null!==a;)Vj(a,b,c),a=a.sibling}\nfunction Wj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(Wj(a,b,c),a=a.sibling;null!==a;)Wj(a,b,c),a=a.sibling}var X=null,Xj=!1;function Yj(a,b,c){for(c=c.child;null!==c;)Zj(a,b,c),c=c.sibling}\nfunction Zj(a,b,c){if(lc&&\"function\"===typeof lc.onCommitFiberUnmount)try{lc.onCommitFiberUnmount(kc,c)}catch(h){}switch(c.tag){case 5:U||Lj(c,b);case 6:var d=X,e=Xj;X=null;Yj(a,b,c);X=d;Xj=e;null!==X&&(Xj?(a=X,c=c.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):X.removeChild(c.stateNode));break;case 18:null!==X&&(Xj?(a=X,c=c.stateNode,8===a.nodeType?Kf(a.parentNode,c):1===a.nodeType&&Kf(a,c),bd(a)):Kf(X,c.stateNode));break;case 4:d=X;e=Xj;X=c.stateNode.containerInfo;Xj=!0;\nYj(a,b,c);X=d;Xj=e;break;case 0:case 11:case 14:case 15:if(!U&&(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?Mj(c,b,g):0!==(f&4)&&Mj(c,b,g));e=e.next}while(e!==d)}Yj(a,b,c);break;case 1:if(!U&&(Lj(c,b),d=c.stateNode,\"function\"===typeof d.componentWillUnmount))try{d.props=c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount()}catch(h){W(c,b,h)}Yj(a,b,c);break;case 21:Yj(a,b,c);break;case 22:c.mode&1?(U=(d=U)||null!==\nc.memoizedState,Yj(a,b,c),U=d):Yj(a,b,c);break;default:Yj(a,b,c)}}function ak(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Kj);b.forEach(function(b){var d=bk.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}\nfunction ck(a,b){var c=b.deletions;if(null!==c)for(var d=0;de&&(e=g);d&=~f}d=e;d=B()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*lk(d/1960))-d;if(10a?16:a;if(null===wk)var d=!1;else{a=wk;wk=null;xk=0;if(0!==(K&6))throw Error(p(331));var e=K;K|=4;for(V=a.current;null!==V;){var f=V,g=f.child;if(0!==(V.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kB()-fk?Kk(a,0):rk|=c);Dk(a,b)}function Yk(a,b){0===b&&(0===(a.mode&1)?b=1:(b=sc,sc<<=1,0===(sc&130023424)&&(sc=4194304)));var c=R();a=ih(a,b);null!==a&&(Ac(a,b,c),Dk(a,c))}function uj(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Yk(a,c)}\nfunction bk(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(p(314));}null!==d&&d.delete(b);Yk(a,c)}var Vk;\nVk=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||Wf.current)dh=!0;else{if(0===(a.lanes&c)&&0===(b.flags&128))return dh=!1,yj(a,b,c);dh=0!==(a.flags&131072)?!0:!1}else dh=!1,I&&0!==(b.flags&1048576)&&ug(b,ng,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;ij(a,b);a=b.pendingProps;var e=Yf(b,H.current);ch(b,c);e=Nh(null,b,d,a,e,c);var f=Sh();b.flags|=1;\"object\"===typeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof?(b.tag=1,b.memoizedState=null,b.updateQueue=\nnull,Zf(d)?(f=!0,cg(b)):f=!1,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,kh(b),e.updater=Ei,b.stateNode=e,e._reactInternals=b,Ii(b,d,a,c),b=jj(null,b,d,!0,f,c)):(b.tag=0,I&&f&&vg(b),Xi(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{ij(a,b);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=Zk(d);a=Ci(d,a);switch(e){case 0:b=cj(null,b,d,a,c);break a;case 1:b=hj(null,b,d,a,c);break a;case 11:b=Yi(null,b,d,a,c);break a;case 14:b=$i(null,b,d,Ci(d.type,a),c);break a}throw Error(p(306,\nd,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),cj(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),hj(a,b,d,e,c);case 3:a:{kj(b);if(null===a)throw Error(p(387));d=b.pendingProps;f=b.memoizedState;e=f.element;lh(a,b);qh(b,d,null,c);var g=b.memoizedState;d=g.element;if(f.isDehydrated)if(f={element:d,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},b.updateQueue.baseState=\nf,b.memoizedState=f,b.flags&256){e=Ji(Error(p(423)),b);b=lj(a,b,d,c,e);break a}else if(d!==e){e=Ji(Error(p(424)),b);b=lj(a,b,d,c,e);break a}else for(yg=Lf(b.stateNode.containerInfo.firstChild),xg=b,I=!0,zg=null,c=Vg(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{Ig();if(d===e){b=Zi(a,b,c);break a}Xi(a,b,d,c)}b=b.child}return b;case 5:return Ah(b),null===a&&Eg(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Ef(d,e)?g=null:null!==f&&Ef(d,f)&&(b.flags|=32),\ngj(a,b),Xi(a,b,g,c),b.child;case 6:return null===a&&Eg(b),null;case 13:return oj(a,b,c);case 4:return yh(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Ug(b,null,d,c):Xi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),Yi(a,b,d,e,c);case 7:return Xi(a,b,b.pendingProps,c),b.child;case 8:return Xi(a,b,b.pendingProps.children,c),b.child;case 12:return Xi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;f=b.memoizedProps;\ng=e.value;G(Wg,d._currentValue);d._currentValue=g;if(null!==f)if(He(f.value,g)){if(f.children===e.children&&!Wf.current){b=Zi(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=mh(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=c);bh(f.return,\nc,b);h.lanes|=c;break}k=k.next}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(p(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);bh(g,c,b);g=f.sibling}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return}f=g}Xi(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,d=b.pendingProps.children,ch(b,c),e=eh(e),d=d(e),b.flags|=1,Xi(a,b,d,c),\nb.child;case 14:return d=b.type,e=Ci(d,b.pendingProps),e=Ci(d.type,e),$i(a,b,d,e,c);case 15:return bj(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Ci(d,e),ij(a,b),b.tag=1,Zf(d)?(a=!0,cg(b)):a=!1,ch(b,c),Gi(b,d,e),Ii(b,d,e,c),jj(null,b,d,!0,a,c);case 19:return xj(a,b,c);case 22:return dj(a,b,c)}throw Error(p(156,b.tag));};function Fk(a,b){return ac(a,b)}\nfunction $k(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null}function Bg(a,b,c,d){return new $k(a,b,c,d)}function aj(a){a=a.prototype;return!(!a||!a.isReactComponent)}\nfunction Zk(a){if(\"function\"===typeof a)return aj(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Da)return 11;if(a===Ga)return 14}return 2}\nfunction Pg(a,b){var c=a.alternate;null===c?(c=Bg(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};\nc.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}\nfunction Rg(a,b,c,d,e,f){var g=2;d=a;if(\"function\"===typeof a)aj(a)&&(g=1);else if(\"string\"===typeof a)g=5;else a:switch(a){case ya:return Tg(c.children,e,f,b);case za:g=8;e|=8;break;case Aa:return a=Bg(12,c,b,e|2),a.elementType=Aa,a.lanes=f,a;case Ea:return a=Bg(13,c,b,e),a.elementType=Ea,a.lanes=f,a;case Fa:return a=Bg(19,c,b,e),a.elementType=Fa,a.lanes=f,a;case Ia:return pj(c,e,f,b);default:if(\"object\"===typeof a&&null!==a)switch(a.$$typeof){case Ba:g=10;break a;case Ca:g=9;break a;case Da:g=11;\nbreak a;case Ga:g=14;break a;case Ha:g=16;d=null;break a}throw Error(p(130,null==a?a:typeof a,\"\"));}b=Bg(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Tg(a,b,c,d){a=Bg(7,a,d,b);a.lanes=c;return a}function pj(a,b,c,d){a=Bg(22,a,d,b);a.elementType=Ia;a.lanes=c;a.stateNode={isHidden:!1};return a}function Qg(a,b,c){a=Bg(6,a,null,b);a.lanes=c;return a}\nfunction Sg(a,b,c){b=Bg(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}\nfunction al(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=zc(0);this.expirationTimes=zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=zc(0);this.identifierPrefix=d;this.onRecoverableError=e;this.mutableSourceEagerHydrationData=\nnull}function bl(a,b,c,d,e,f,g,h,k){a=new al(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=Bg(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null};kh(f);return a}function cl(a,b,c){var d=3= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n function next() {\n while (env.stack.length) {\n var rec = env.stack.pop();\n try {\n var result = rec.dispose && rec.dispose.call(rec.value);\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n catch (e) {\n fail(e);\n }\n }\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n};\n","export var MS = '-ms-'\nexport var MOZ = '-moz-'\nexport var WEBKIT = '-webkit-'\n\nexport var COMMENT = 'comm'\nexport var RULESET = 'rule'\nexport var DECLARATION = 'decl'\n\nexport var PAGE = '@page'\nexport var MEDIA = '@media'\nexport var IMPORT = '@import'\nexport var CHARSET = '@charset'\nexport var VIEWPORT = '@viewport'\nexport var SUPPORTS = '@supports'\nexport var DOCUMENT = '@document'\nexport var NAMESPACE = '@namespace'\nexport var KEYFRAMES = '@keyframes'\nexport var FONT_FACE = '@font-face'\nexport var COUNTER_STYLE = '@counter-style'\nexport var FONT_FEATURE_VALUES = '@font-feature-values'\nexport var LAYER = '@layer'\nexport var SCOPE = '@scope'\n","/**\n * @param {number}\n * @return {number}\n */\nexport var abs = Math.abs\n\n/**\n * @param {number}\n * @return {string}\n */\nexport var from = String.fromCharCode\n\n/**\n * @param {object}\n * @return {object}\n */\nexport var assign = Object.assign\n\n/**\n * @param {string} value\n * @param {number} length\n * @return {number}\n */\nexport function hash (value, length) {\n\treturn charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0\n}\n\n/**\n * @param {string} value\n * @return {string}\n */\nexport function trim (value) {\n\treturn value.trim()\n}\n\n/**\n * @param {string} value\n * @param {RegExp} pattern\n * @return {string?}\n */\nexport function match (value, pattern) {\n\treturn (value = pattern.exec(value)) ? value[0] : value\n}\n\n/**\n * @param {string} value\n * @param {(string|RegExp)} pattern\n * @param {string} replacement\n * @return {string}\n */\nexport function replace (value, pattern, replacement) {\n\treturn value.replace(pattern, replacement)\n}\n\n/**\n * @param {string} value\n * @param {string} search\n * @param {number} position\n * @return {number}\n */\nexport function indexof (value, search, position) {\n\treturn value.indexOf(search, position)\n}\n\n/**\n * @param {string} value\n * @param {number} index\n * @return {number}\n */\nexport function charat (value, index) {\n\treturn value.charCodeAt(index) | 0\n}\n\n/**\n * @param {string} value\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function substr (value, begin, end) {\n\treturn value.slice(begin, end)\n}\n\n/**\n * @param {string} value\n * @return {number}\n */\nexport function strlen (value) {\n\treturn value.length\n}\n\n/**\n * @param {any[]} value\n * @return {number}\n */\nexport function sizeof (value) {\n\treturn value.length\n}\n\n/**\n * @param {any} value\n * @param {any[]} array\n * @return {any}\n */\nexport function append (value, array) {\n\treturn array.push(value), value\n}\n\n/**\n * @param {string[]} array\n * @param {function} callback\n * @return {string}\n */\nexport function combine (array, callback) {\n\treturn array.map(callback).join('')\n}\n\n/**\n * @param {string[]} array\n * @param {RegExp} pattern\n * @return {string[]}\n */\nexport function filter (array, pattern) {\n\treturn array.filter(function (value) { return !match(value, pattern) })\n}\n","import {from, trim, charat, strlen, substr, append, assign} from './Utility.js'\n\nexport var line = 1\nexport var column = 1\nexport var length = 0\nexport var position = 0\nexport var character = 0\nexport var characters = ''\n\n/**\n * @param {string} value\n * @param {object | null} root\n * @param {object | null} parent\n * @param {string} type\n * @param {string[] | string} props\n * @param {object[] | string} children\n * @param {object[]} siblings\n * @param {number} length\n */\nexport function node (value, root, parent, type, props, children, length, siblings) {\n\treturn {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: '', siblings: siblings}\n}\n\n/**\n * @param {object} root\n * @param {object} props\n * @return {object}\n */\nexport function copy (root, props) {\n\treturn assign(node('', null, null, '', null, null, 0, root.siblings), root, {length: -root.length}, props)\n}\n\n/**\n * @param {object} root\n */\nexport function lift (root) {\n\twhile (root.root)\n\t\troot = copy(root.root, {children: [root]})\n\n\tappend(root, root.siblings)\n}\n\n/**\n * @return {number}\n */\nexport function char () {\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function prev () {\n\tcharacter = position > 0 ? charat(characters, --position) : 0\n\n\tif (column--, character === 10)\n\t\tcolumn = 1, line--\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function next () {\n\tcharacter = position < length ? charat(characters, position++) : 0\n\n\tif (column++, character === 10)\n\t\tcolumn = 1, line++\n\n\treturn character\n}\n\n/**\n * @return {number}\n */\nexport function peek () {\n\treturn charat(characters, position)\n}\n\n/**\n * @return {number}\n */\nexport function caret () {\n\treturn position\n}\n\n/**\n * @param {number} begin\n * @param {number} end\n * @return {string}\n */\nexport function slice (begin, end) {\n\treturn substr(characters, begin, end)\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function token (type) {\n\tswitch (type) {\n\t\t// \\0 \\t \\n \\r \\s whitespace token\n\t\tcase 0: case 9: case 10: case 13: case 32:\n\t\t\treturn 5\n\t\t// ! + , / > @ ~ isolate token\n\t\tcase 33: case 43: case 44: case 47: case 62: case 64: case 126:\n\t\t// ; { } breakpoint token\n\t\tcase 59: case 123: case 125:\n\t\t\treturn 4\n\t\t// : accompanied token\n\t\tcase 58:\n\t\t\treturn 3\n\t\t// \" ' ( [ opening delimit token\n\t\tcase 34: case 39: case 40: case 91:\n\t\t\treturn 2\n\t\t// ) ] closing delimit token\n\t\tcase 41: case 93:\n\t\t\treturn 1\n\t}\n\n\treturn 0\n}\n\n/**\n * @param {string} value\n * @return {any[]}\n */\nexport function alloc (value) {\n\treturn line = column = 1, length = strlen(characters = value), position = 0, []\n}\n\n/**\n * @param {any} value\n * @return {any}\n */\nexport function dealloc (value) {\n\treturn characters = '', value\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function delimit (type) {\n\treturn trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))\n}\n\n/**\n * @param {string} value\n * @return {string[]}\n */\nexport function tokenize (value) {\n\treturn dealloc(tokenizer(alloc(value)))\n}\n\n/**\n * @param {number} type\n * @return {string}\n */\nexport function whitespace (type) {\n\twhile (character = peek())\n\t\tif (character < 33)\n\t\t\tnext()\n\t\telse\n\t\t\tbreak\n\n\treturn token(type) > 2 || token(character) > 3 ? '' : ' '\n}\n\n/**\n * @param {string[]} children\n * @return {string[]}\n */\nexport function tokenizer (children) {\n\twhile (next())\n\t\tswitch (token(character)) {\n\t\t\tcase 0: append(identifier(position - 1), children)\n\t\t\t\tbreak\n\t\t\tcase 2: append(delimit(character), children)\n\t\t\t\tbreak\n\t\t\tdefault: append(from(character), children)\n\t\t}\n\n\treturn children\n}\n\n/**\n * @param {number} index\n * @param {number} count\n * @return {string}\n */\nexport function escaping (index, count) {\n\twhile (--count && next())\n\t\t// not 0-9 A-F a-f\n\t\tif (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))\n\t\t\tbreak\n\n\treturn slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))\n}\n\n/**\n * @param {number} type\n * @return {number}\n */\nexport function delimiter (type) {\n\twhile (next())\n\t\tswitch (character) {\n\t\t\t// ] ) \" '\n\t\t\tcase type:\n\t\t\t\treturn position\n\t\t\t// \" '\n\t\t\tcase 34: case 39:\n\t\t\t\tif (type !== 34 && type !== 39)\n\t\t\t\t\tdelimiter(character)\n\t\t\t\tbreak\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (type === 41)\n\t\t\t\t\tdelimiter(type)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tnext()\n\t\t\t\tbreak\n\t\t}\n\n\treturn position\n}\n\n/**\n * @param {number} type\n * @param {number} index\n * @return {number}\n */\nexport function commenter (type, index) {\n\twhile (next())\n\t\t// //\n\t\tif (type + character === 47 + 10)\n\t\t\tbreak\n\t\t// /*\n\t\telse if (type + character === 42 + 42 && peek() === 47)\n\t\t\tbreak\n\n\treturn '/*' + slice(index, position - 1) + '*' + from(type === 47 ? type : next())\n}\n\n/**\n * @param {number} index\n * @return {string}\n */\nexport function identifier (index) {\n\twhile (!token(peek()))\n\t\tnext()\n\n\treturn slice(index, position)\n}\n","import {COMMENT, RULESET, DECLARATION} from './Enum.js'\nimport {abs, charat, trim, from, sizeof, strlen, substr, append, replace, indexof} from './Utility.js'\nimport {node, char, prev, next, peek, caret, alloc, dealloc, delimit, whitespace, escaping, identifier, commenter} from './Tokenizer.js'\n\n/**\n * @param {string} value\n * @return {object[]}\n */\nexport function compile (value) {\n\treturn dealloc(parse('', null, null, null, [''], value = alloc(value), 0, [0], value))\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {string[]} rule\n * @param {string[]} rules\n * @param {string[]} rulesets\n * @param {number[]} pseudo\n * @param {number[]} points\n * @param {string[]} declarations\n * @return {object}\n */\nexport function parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {\n\tvar index = 0\n\tvar offset = 0\n\tvar length = pseudo\n\tvar atrule = 0\n\tvar property = 0\n\tvar previous = 0\n\tvar variable = 1\n\tvar scanning = 1\n\tvar ampersand = 1\n\tvar character = 0\n\tvar type = ''\n\tvar props = rules\n\tvar children = rulesets\n\tvar reference = rule\n\tvar characters = type\n\n\twhile (scanning)\n\t\tswitch (previous = character, character = next()) {\n\t\t\t// (\n\t\t\tcase 40:\n\t\t\t\tif (previous != 108 && charat(characters, length - 1) == 58) {\n\t\t\t\t\tif (indexof(characters += replace(delimit(character), '&', '&\\f'), '&\\f', abs(index ? points[index - 1] : 0)) != -1)\n\t\t\t\t\t\tampersand = -1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t// \" ' [\n\t\t\tcase 34: case 39: case 91:\n\t\t\t\tcharacters += delimit(character)\n\t\t\t\tbreak\n\t\t\t// \\t \\n \\r \\s\n\t\t\tcase 9: case 10: case 13: case 32:\n\t\t\t\tcharacters += whitespace(previous)\n\t\t\t\tbreak\n\t\t\t// \\\n\t\t\tcase 92:\n\t\t\t\tcharacters += escaping(caret() - 1, 7)\n\t\t\t\tcontinue\n\t\t\t// /\n\t\t\tcase 47:\n\t\t\t\tswitch (peek()) {\n\t\t\t\t\tcase 42: case 47:\n\t\t\t\t\t\tappend(comment(commenter(next(), caret()), root, parent, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcharacters += '/'\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t// {\n\t\t\tcase 123 * variable:\n\t\t\t\tpoints[index++] = strlen(characters) * ampersand\n\t\t\t// } ; \\0\n\t\t\tcase 125 * variable: case 59: case 0:\n\t\t\t\tswitch (character) {\n\t\t\t\t\t// \\0 }\n\t\t\t\t\tcase 0: case 125: scanning = 0\n\t\t\t\t\t// ;\n\t\t\t\t\tcase 59 + offset: if (ampersand == -1) characters = replace(characters, /\\f/g, '')\n\t\t\t\t\t\tif (property > 0 && (strlen(characters) - length))\n\t\t\t\t\t\t\tappend(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @ ;\n\t\t\t\t\tcase 59: characters += ';'\n\t\t\t\t\t// { rule/at-rule\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tappend(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length, rulesets), rulesets)\n\n\t\t\t\t\t\tif (character === 123)\n\t\t\t\t\t\t\tif (offset === 0)\n\t\t\t\t\t\t\t\tparse(characters, root, reference, reference, props, rulesets, length, points, children)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tswitch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {\n\t\t\t\t\t\t\t\t\t// d l m s\n\t\t\t\t\t\t\t\t\tcase 100: case 108: case 109: case 115:\n\t\t\t\t\t\t\t\t\t\tparse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length, children), children), rules, children, length, points, rule ? props : children)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\tparse(characters, reference, reference, reference, [''], children, 0, points, children)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tindex = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo\n\t\t\t\tbreak\n\t\t\t// :\n\t\t\tcase 58:\n\t\t\t\tlength = 1 + strlen(characters), property = previous\n\t\t\tdefault:\n\t\t\t\tif (variable < 1)\n\t\t\t\t\tif (character == 123)\n\t\t\t\t\t\t--variable\n\t\t\t\t\telse if (character == 125 && variable++ == 0 && prev() == 125)\n\t\t\t\t\t\tcontinue\n\n\t\t\t\tswitch (characters += from(character), character * variable) {\n\t\t\t\t\t// &\n\t\t\t\t\tcase 38:\n\t\t\t\t\t\tampersand = offset > 0 ? 1 : (characters += '\\f', -1)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// ,\n\t\t\t\t\tcase 44:\n\t\t\t\t\t\tpoints[index++] = (strlen(characters) - 1) * ampersand, ampersand = 1\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// @\n\t\t\t\t\tcase 64:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (peek() === 45)\n\t\t\t\t\t\t\tcharacters += delimit(next())\n\n\t\t\t\t\t\tatrule = peek(), offset = length = strlen(type = characters += identifier(caret())), character++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t// -\n\t\t\t\t\tcase 45:\n\t\t\t\t\t\tif (previous === 45 && strlen(characters) == 2)\n\t\t\t\t\t\t\tvariable = 0\n\t\t\t\t}\n\t\t}\n\n\treturn rulesets\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} index\n * @param {number} offset\n * @param {string[]} rules\n * @param {number[]} points\n * @param {string} type\n * @param {string[]} props\n * @param {string[]} children\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length, siblings) {\n\tvar post = offset - 1\n\tvar rule = offset === 0 ? rules : ['']\n\tvar size = sizeof(rule)\n\n\tfor (var i = 0, j = 0, k = 0; i < index; ++i)\n\t\tfor (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)\n\t\t\tif (z = trim(j > 0 ? rule[x] + ' ' + y : replace(y, /&\\f/g, rule[x])))\n\t\t\t\tprops[k++] = z\n\n\treturn node(value, root, parent, offset === 0 ? RULESET : type, props, children, length, siblings)\n}\n\n/**\n * @param {number} value\n * @param {object} root\n * @param {object?} parent\n * @param {object[]} siblings\n * @return {object}\n */\nexport function comment (value, root, parent, siblings) {\n\treturn node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings)\n}\n\n/**\n * @param {string} value\n * @param {object} root\n * @param {object?} parent\n * @param {number} length\n * @param {object[]} siblings\n * @return {object}\n */\nexport function declaration (value, root, parent, length, siblings) {\n\treturn node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length, siblings)\n}\n","import {MS, MOZ, WEBKIT} from './Enum.js'\nimport {hash, charat, strlen, indexof, replace, substr, match} from './Utility.js'\n\n/**\n * @param {string} value\n * @param {number} length\n * @param {object[]} children\n * @return {string}\n */\nexport function prefix (value, length, children) {\n\tswitch (hash(value, length)) {\n\t\t// color-adjust\n\t\tcase 5103:\n\t\t\treturn WEBKIT + 'print-' + value + value\n\t\t// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)\n\t\tcase 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921:\n\t\t// text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break\n\t\tcase 5572: case 6356: case 5844: case 3191: case 6645: case 3005:\n\t\t// mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,\n\t\tcase 6391: case 5879: case 5623: case 6135: case 4599: case 4855:\n\t\t// background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)\n\t\tcase 4215: case 6389: case 5109: case 5365: case 5621: case 3829:\n\t\t\treturn WEBKIT + value + value\n\t\t// tab-size\n\t\tcase 4789:\n\t\t\treturn MOZ + value + value\n\t\t// appearance, user-select, transform, hyphens, text-size-adjust\n\t\tcase 5349: case 4246: case 4810: case 6968: case 2756:\n\t\t\treturn WEBKIT + value + MOZ + value + MS + value + value\n\t\t// writing-mode\n\t\tcase 5936:\n\t\t\tswitch (charat(value, length + 11)) {\n\t\t\t\t// vertical-l(r)\n\t\t\t\tcase 114:\n\t\t\t\t\treturn WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb') + value\n\t\t\t\t// vertical-r(l)\n\t\t\t\tcase 108:\n\t\t\t\t\treturn WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'tb-rl') + value\n\t\t\t\t// horizontal(-)tb\n\t\t\t\tcase 45:\n\t\t\t\t\treturn WEBKIT + value + MS + replace(value, /[svh]\\w+-[tblr]{2}/, 'lr') + value\n\t\t\t\t// default: fallthrough to below\n\t\t\t}\n\t\t// flex, flex-direction, scroll-snap-type, writing-mode\n\t\tcase 6828: case 4268: case 2903:\n\t\t\treturn WEBKIT + value + MS + value + value\n\t\t// order\n\t\tcase 6165:\n\t\t\treturn WEBKIT + value + MS + 'flex-' + value + value\n\t\t// align-items\n\t\tcase 5187:\n\t\t\treturn WEBKIT + value + replace(value, /(\\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value\n\t\t// align-self\n\t\tcase 5443:\n\t\t\treturn WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/g, '') + (!match(value, /flex-|baseline/) ? MS + 'grid-row-' + replace(value, /flex-|-self/g, '') : '') + value\n\t\t// align-content\n\t\tcase 4675:\n\t\t\treturn WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/g, '') + value\n\t\t// flex-shrink\n\t\tcase 5548:\n\t\t\treturn WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value\n\t\t// flex-basis\n\t\tcase 5292:\n\t\t\treturn WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value\n\t\t// flex-grow\n\t\tcase 6060:\n\t\t\treturn WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value\n\t\t// transition\n\t\tcase 4554:\n\t\t\treturn WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value\n\t\t// cursor\n\t\tcase 6187:\n\t\t\treturn replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value\n\t\t// background, background-image\n\t\tcase 5495: case 3959:\n\t\t\treturn replace(value, /(image-set\\([^]*)/, WEBKIT + '$1' + '$`$1')\n\t\t// justify-content\n\t\tcase 4968:\n\t\t\treturn replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value\n\t\t// justify-self\n\t\tcase 4200:\n\t\t\tif (!match(value, /flex-|baseline/)) return MS + 'grid-column-align' + substr(value, length) + value\n\t\t\tbreak\n\t\t// grid-template-(columns|rows)\n\t\tcase 2592: case 3360:\n\t\t\treturn MS + replace(value, 'template-', '') + value\n\t\t// grid-(row|column)-start\n\t\tcase 4384: case 3616:\n\t\t\tif (children && children.some(function (element, index) { return length = index, match(element.props, /grid-\\w+-end/) })) {\n\t\t\t\treturn ~indexof(value + (children = children[length].value), 'span', 0) ? value : (MS + replace(value, '-start', '') + value + MS + 'grid-row-span:' + (~indexof(children, 'span', 0) ? match(children, /\\d+/) : +match(children, /\\d+/) - +match(value, /\\d+/)) + ';')\n\t\t\t}\n\t\t\treturn MS + replace(value, '-start', '') + value\n\t\t// grid-(row|column)-end\n\t\tcase 4896: case 4128:\n\t\t\treturn (children && children.some(function (element) { return match(element.props, /grid-\\w+-start/) })) ? value : MS + replace(replace(value, '-end', '-span'), 'span ', '') + value\n\t\t// (margin|padding)-inline-(start|end)\n\t\tcase 4095: case 3583: case 4068: case 2532:\n\t\t\treturn replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value\n\t\t// (min|max)?(width|height|inline-size|block-size)\n\t\tcase 8116: case 7059: case 5753: case 5535:\n\t\tcase 5445: case 5701: case 4933: case 4677:\n\t\tcase 5533: case 5789: case 5021: case 4765:\n\t\t\t// stretch, max-content, min-content, fill-available\n\t\t\tif (strlen(value) - 1 - length > 6)\n\t\t\t\tswitch (charat(value, length + 1)) {\n\t\t\t\t\t// (m)ax-content, (m)in-content\n\t\t\t\t\tcase 109:\n\t\t\t\t\t\t// -\n\t\t\t\t\t\tif (charat(value, length + 4) !== 45)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t// (f)ill-available, (f)it-content\n\t\t\t\t\tcase 102:\n\t\t\t\t\t\treturn replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value\n\t\t\t\t\t// (s)tretch\n\t\t\t\t\tcase 115:\n\t\t\t\t\t\treturn ~indexof(value, 'stretch', 0) ? prefix(replace(value, 'stretch', 'fill-available'), length, children) + value : value\n\t\t\t\t}\n\t\t\tbreak\n\t\t// grid-(column|row)\n\t\tcase 5152: case 5920:\n\t\t\treturn replace(value, /(.+?):(\\d+)(\\s*\\/\\s*(span)?\\s*(\\d+))?(.*)/, function (_, a, b, c, d, e, f) { return (MS + a + ':' + b + f) + (c ? (MS + a + '-span:' + (d ? e : +e - +b)) + f : '') + value })\n\t\t// position: sticky\n\t\tcase 4949:\n\t\t\t// stick(y)?\n\t\t\tif (charat(value, length + 6) === 121)\n\t\t\t\treturn replace(value, ':', ':' + WEBKIT) + value\n\t\t\tbreak\n\t\t// display: (flex|inline-flex|grid|inline-grid)\n\t\tcase 6444:\n\t\t\tswitch (charat(value, charat(value, 14) === 45 ? 18 : 11)) {\n\t\t\t\t// (inline-)?fle(x)\n\t\t\t\tcase 120:\n\t\t\t\t\treturn replace(value, /(.+:)([^;\\s!]+)(;|(\\s+)?!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value\n\t\t\t\t// (inline-)?gri(d)\n\t\t\t\tcase 100:\n\t\t\t\t\treturn replace(value, ':', ':' + MS) + value\n\t\t\t}\n\t\t\tbreak\n\t\t// scroll-margin, scroll-margin-(top|right|bottom|left)\n\t\tcase 5719: case 2647: case 2135: case 3927: case 2391:\n\t\t\treturn replace(value, 'scroll-', 'scroll-snap-') + value\n\t}\n\n\treturn value\n}\n","import {IMPORT, LAYER, COMMENT, RULESET, DECLARATION, KEYFRAMES} from './Enum.js'\nimport {strlen} from './Utility.js'\n\n/**\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function serialize (children, callback) {\n\tvar output = ''\n\n\tfor (var i = 0; i < children.length; i++)\n\t\toutput += callback(children[i], i, children, callback) || ''\n\n\treturn output\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n * @return {string}\n */\nexport function stringify (element, index, children, callback) {\n\tswitch (element.type) {\n\t\tcase LAYER: if (element.children.length) break\n\t\tcase IMPORT: case DECLARATION: return element.return = element.return || element.value\n\t\tcase COMMENT: return ''\n\t\tcase KEYFRAMES: return element.return = element.value + '{' + serialize(element.children, callback) + '}'\n\t\tcase RULESET: if (!strlen(element.value = element.props.join(','))) return ''\n\t}\n\n\treturn strlen(children = serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''\n}\n","import {MS, MOZ, WEBKIT, RULESET, KEYFRAMES, DECLARATION} from './Enum.js'\nimport {match, charat, substr, strlen, sizeof, replace, combine, filter, assign} from './Utility.js'\nimport {copy, lift, tokenize} from './Tokenizer.js'\nimport {serialize} from './Serializer.js'\nimport {prefix} from './Prefixer.js'\n\n/**\n * @param {function[]} collection\n * @return {function}\n */\nexport function middleware (collection) {\n\tvar length = sizeof(collection)\n\n\treturn function (element, index, children, callback) {\n\t\tvar output = ''\n\n\t\tfor (var i = 0; i < length; i++)\n\t\t\toutput += collection[i](element, index, children, callback) || ''\n\n\t\treturn output\n\t}\n}\n\n/**\n * @param {function} callback\n * @return {function}\n */\nexport function rulesheet (callback) {\n\treturn function (element) {\n\t\tif (!element.root)\n\t\t\tif (element = element.return)\n\t\t\t\tcallback(element)\n\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n * @param {function} callback\n */\nexport function prefixer (element, index, children, callback) {\n\tif (element.length > -1)\n\t\tif (!element.return)\n\t\t\tswitch (element.type) {\n\t\t\t\tcase DECLARATION: element.return = prefix(element.value, element.length, children)\n\t\t\t\t\treturn\n\t\t\t\tcase KEYFRAMES:\n\t\t\t\t\treturn serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)\n\t\t\t\tcase RULESET:\n\t\t\t\t\tif (element.length)\n\t\t\t\t\t\treturn combine(children = element.props, function (value) {\n\t\t\t\t\t\t\tswitch (match(value, callback = /(::plac\\w+|:read-\\w+)/)) {\n\t\t\t\t\t\t\t\t// :read-(only|write)\n\t\t\t\t\t\t\t\tcase ':read-only': case ':read-write':\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(read-\\w+)/, ':' + MOZ + '$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [value]}))\n\t\t\t\t\t\t\t\t\tassign(element, {props: filter(children, callback)})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t// :placeholder\n\t\t\t\t\t\t\t\tcase '::placeholder':\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, ':' + WEBKIT + 'input-$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, ':' + MOZ + '$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [replace(value, /:(plac\\w+)/, MS + 'input-$1')]}))\n\t\t\t\t\t\t\t\t\tlift(copy(element, {props: [value]}))\n\t\t\t\t\t\t\t\t\tassign(element, {props: filter(children, callback)})\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn ''\n\t\t\t\t\t\t})\n\t\t\t}\n}\n\n/**\n * @param {object} element\n * @param {number} index\n * @param {object[]} children\n */\nexport function namespace (element) {\n\tswitch (element.type) {\n\t\tcase RULESET:\n\t\t\telement.props = element.props.map(function (value) {\n\t\t\t\treturn combine(tokenize(value), function (value, index, children) {\n\t\t\t\t\tswitch (charat(value, 0)) {\n\t\t\t\t\t\t// \\f\n\t\t\t\t\t\tcase 12:\n\t\t\t\t\t\t\treturn substr(value, 1, strlen(value))\n\t\t\t\t\t\t// \\0 ( + > ~\n\t\t\t\t\t\tcase 0: case 40: case 43: case 62: case 126:\n\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t// :\n\t\t\t\t\t\tcase 58:\n\t\t\t\t\t\t\tif (children[++index] === 'global')\n\t\t\t\t\t\t\t\tchildren[index] = '', children[++index] = '\\f' + substr(children[index], index = 1, -1)\n\t\t\t\t\t\t// \\s\n\t\t\t\t\t\tcase 32:\n\t\t\t\t\t\t\treturn index === 1 ? '' : value\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tswitch (index) {\n\t\t\t\t\t\t\t\tcase 0: element = value\n\t\t\t\t\t\t\t\t\treturn sizeof(children) > 1 ? '' : value\n\t\t\t\t\t\t\t\tcase index = sizeof(children) - 1: case 2:\n\t\t\t\t\t\t\t\t\treturn index === 2 ? value + element + element : value + element\n\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\treturn value\n\t\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t}\n}\n","var unitlessKeys = {\n animationIterationCount: 1,\n aspectRatio: 1,\n borderImageOutset: 1,\n borderImageSlice: 1,\n borderImageWidth: 1,\n boxFlex: 1,\n boxFlexGroup: 1,\n boxOrdinalGroup: 1,\n columnCount: 1,\n columns: 1,\n flex: 1,\n flexGrow: 1,\n flexPositive: 1,\n flexShrink: 1,\n flexNegative: 1,\n flexOrder: 1,\n gridRow: 1,\n gridRowEnd: 1,\n gridRowSpan: 1,\n gridRowStart: 1,\n gridColumn: 1,\n gridColumnEnd: 1,\n gridColumnSpan: 1,\n gridColumnStart: 1,\n msGridRow: 1,\n msGridRowSpan: 1,\n msGridColumn: 1,\n msGridColumnSpan: 1,\n fontWeight: 1,\n lineHeight: 1,\n opacity: 1,\n order: 1,\n orphans: 1,\n tabSize: 1,\n widows: 1,\n zIndex: 1,\n zoom: 1,\n WebkitLineClamp: 1,\n // SVG-related properties\n fillOpacity: 1,\n floodOpacity: 1,\n stopOpacity: 1,\n strokeDasharray: 1,\n strokeDashoffset: 1,\n strokeMiterlimit: 1,\n strokeOpacity: 1,\n strokeWidth: 1\n};\n\nexport { unitlessKeys as default };\n","import{__spreadArray as e,__assign as t}from\"tslib\";import n from\"@emotion/is-prop-valid\";import o,{useRef as r,useState as s,useMemo as i,useEffect as a,useContext as c,useDebugValue as l,createElement as u}from\"react\";import p from\"shallowequal\";import*as d from\"stylis\";import h from\"@emotion/unitless\";var f=\"undefined\"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||\"data-styled\",m=\"active\",y=\"data-styled-version\",v=\"6.1.13\",g=\"/*!sc*/\\n\",S=\"undefined\"!=typeof window&&\"HTMLElement\"in window,w=Boolean(\"boolean\"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:\"undefined\"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&\"\"!==process.env.REACT_APP_SC_DISABLE_SPEEDY?\"false\"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:\"undefined\"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&\"\"!==process.env.SC_DISABLE_SPEEDY?\"false\"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:\"production\"!==process.env.NODE_ENV),b={},E=/invalid hook call/i,N=new Set,P=function(t,n){if(\"production\"!==process.env.NODE_ENV){var o=n?' with the id of \"'.concat(n,'\"'):\"\",s=\"The component \".concat(t).concat(o,\" has been created dynamically.\\n\")+\"You may see this warning because you've called styled inside another component.\\nTo resolve this only create new StyledComponents outside of any render method and function component.\",i=console.error;try{var a=!0;console.error=function(t){for(var n=[],o=1;o?@[\\\\\\]^`{|}~-]+/g,D=/(^-|-$)/g;function R(e){return e.replace(O,\"-\").replace(D,\"\")}var T=/(a)(d)/gi,k=52,j=function(e){return String.fromCharCode(e+(e>25?39:97))};function x(e){var t,n=\"\";for(t=Math.abs(e);t>k;t=t/k|0)n=j(t%k)+n;return(j(t%k)+n).replace(T,\"$1-$2\")}var V,F=5381,M=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},z=function(e){return M(F,e)};function $(e){return x(z(e)>>>0)}function B(e){return\"production\"!==process.env.NODE_ENV&&\"string\"==typeof e&&e||e.displayName||e.name||\"Component\"}function L(e){return\"string\"==typeof e&&(\"production\"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var G=\"function\"==typeof Symbol&&Symbol.for,Y=G?Symbol.for(\"react.memo\"):60115,W=G?Symbol.for(\"react.forward_ref\"):60112,q={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},H={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},U={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},J=((V={})[W]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},V[Y]=U,V);function X(e){return(\"type\"in(t=e)&&t.type.$$typeof)===Y?U:\"$$typeof\"in e?J[e.$$typeof]:q;var t}var Z=Object.defineProperty,K=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols,ee=Object.getOwnPropertyDescriptor,te=Object.getPrototypeOf,ne=Object.prototype;function oe(e,t,n){if(\"string\"!=typeof t){if(ne){var o=te(t);o&&o!==ne&&oe(e,o,n)}var r=K(t);Q&&(r=r.concat(Q(t)));for(var s=X(e),i=X(t),a=0;a ({})}\\n```\\n\\n',8:'ThemeProvider: Please make your \"theme\" prop an object.\\n\\n',9:\"Missing document ``\\n\\n\",10:\"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\\n\\n\",11:\"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\\n\\n\",12:\"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\\\`\\\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\\n\\n\",13:\"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\\n\\n\",14:'ThemeProvider: \"theme\" prop is required.\\n\\n',15:\"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to ``, please make sure each plugin is uniquely-named, e.g.\\n\\n```js\\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\\n```\\n\\n\",16:\"Reached the limit of how many styled components may be created at group %s.\\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\\nas for instance in your render method then you may be running into this limitation.\\n\\n\",17:\"CSSStyleSheet could not be found on HTMLStyleElement.\\nHas styled-components' style tag been unmounted or altered by another script?\\n\",18:\"ThemeProvider: Please make sure your useTheme hook is within a ``\"}:{};function de(){for(var e=[],t=0;t0?\" Args: \".concat(n.join(\", \")):\"\")):new Error(de.apply(void 0,e([pe[t]],n,!1)).trim())}var fe=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n=this.groupSizes.length){for(var n=this.groupSizes,o=n.length,r=o;e>=r;)if((r<<=1)<0)throw he(16,\"\".concat(e));this.groupSizes=new Uint32Array(r),this.groupSizes.set(n),this.length=r;for(var s=o;s=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],o=this.indexOfGroup(e),r=o+n,s=o;sme))throw he(16,\"\".concat(t));return ye.set(e,t),ve.set(t,e),t},we=function(e,t){ge=t+1,ye.set(e,t),ve.set(t,e)},be=\"style[\".concat(f,\"][\").concat(y,'=\"').concat(v,'\"]'),Ee=new RegExp(\"^\".concat(f,'\\\\.g(\\\\d+)\\\\[id=\"([\\\\w\\\\d-]+)\"\\\\].*?\"([^\"]*)')),Ne=function(e,t,n){for(var o,r=n.split(\",\"),s=0,i=r.length;s=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e0&&(c+=\"\".concat(e,\",\"))}),o+=\"\".concat(i).concat(a,'{content:\"').concat(c,'\"}').concat(g)},s=0;s0?\".\".concat(t):e},u=c.slice();u.push(function(e){e.type===d.RULESET&&e.value.includes(\"&\")&&(e.props[0]=e.props[0].replace(je,n).replace(o,l))}),i.prefix&&u.push(d.prefixer),u.push(d.stringify);var p=function(e,r,s,a){void 0===r&&(r=\"\"),void 0===s&&(s=\"\"),void 0===a&&(a=\"&\"),t=a,n=r,o=new RegExp(\"\\\\\".concat(n,\"\\\\b\"),\"g\");var c=e.replace(xe,\"\"),l=d.compile(s||r?\"\".concat(s,\" \").concat(r,\" { \").concat(c,\" }\"):c);i.namespace&&(l=Ve(l,i.namespace));var p=[];return d.serialize(l,d.middleware(u.concat(d.rulesheet(function(e){return p.push(e)})))),p};return p.hash=c.length?c.reduce(function(e,t){return t.name||he(15),M(e,t.name)},F).toString():\"\",p}var Me=new ke,ze=Fe(),$e=o.createContext({shouldForwardProp:void 0,styleSheet:Me,stylis:ze}),Be=$e.Consumer,Le=o.createContext(void 0);function Ge(){return c($e)}function Ye(e){var t=s(e.stylisPlugins),n=t[0],r=t[1],c=Ge().styleSheet,l=i(function(){var t=c;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t},[e.disableCSSOMInjection,e.sheet,e.target,c]),u=i(function(){return Fe({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);a(function(){p(n,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]);var d=i(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:l,stylis:u}},[e.shouldForwardProp,l,u]);return o.createElement($e.Provider,{value:d},o.createElement(Le.Provider,{value:u},e.children))}var We=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=ze);var o=n.name+t.hash;e.hasNameForId(n.id,o)||e.insertRules(n.id,o,t(n.rules,o,\"@keyframes\"))},this.name=e,this.id=\"sc-keyframes-\".concat(e),this.rules=t,ue(this,function(){throw he(12,String(n.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=ze),this.name+e.hash},e}(),qe=function(e){return e>=\"A\"&&e<=\"Z\"};function He(e){for(var t=\"\",n=0;n>>0);if(!t.hasNameForId(this.componentId,s)){var i=n(r,\".\".concat(s),void 0,this.componentId);t.insertRules(this.componentId,s,i)}o=ie(o,s),this.staticRulesId=s}else{for(var a=M(this.baseHash,n.hash),c=\"\",l=0;l>>0);t.hasNameForId(this.componentId,d)||t.insertRules(this.componentId,d,n(c,\".\".concat(d),void 0,this.componentId)),o=ie(o,d)}}return o},e}(),et=o.createContext(void 0),tt=et.Consumer;function nt(){var e=c(et);if(!e)throw he(18);return e}function ot(e){var n=o.useContext(et),r=i(function(){return function(e,n){if(!e)throw he(14);if(re(e)){var o=e(n);if(\"production\"!==process.env.NODE_ENV&&(null===o||Array.isArray(o)||\"object\"!=typeof o))throw he(7);return o}if(Array.isArray(e)||\"object\"!=typeof e)throw he(8);return n?t(t({},n),e):e}(e.theme,n)},[e.theme,n]);return e.children?o.createElement(et.Provider,{value:r},e.children):null}var rt={},st=new Set;function it(e,r,s){var i=se(e),a=e,c=!L(e),p=r.attrs,d=void 0===p?_:p,h=r.componentId,f=void 0===h?function(e,t){var n=\"string\"!=typeof e?\"sc\":R(e);rt[n]=(rt[n]||0)+1;var o=\"\".concat(n,\"-\").concat($(v+n+rt[n]));return t?\"\".concat(t,\"-\").concat(o):o}(r.displayName,r.parentComponentId):h,m=r.displayName,y=void 0===m?function(e){return L(e)?\"styled.\".concat(e):\"Styled(\".concat(B(e),\")\")}(e):m,g=r.displayName&&r.componentId?\"\".concat(R(r.displayName),\"-\").concat(r.componentId):r.componentId||f,S=i&&a.attrs?a.attrs.concat(d).filter(Boolean):d,w=r.shouldForwardProp;if(i&&a.shouldForwardProp){var b=a.shouldForwardProp;if(r.shouldForwardProp){var E=r.shouldForwardProp;w=function(e,t){return b(e,t)&&E(e,t)}}else w=b}var N=new Qe(s,g,i?a.componentStyle:void 0);function O(e,r){return function(e,r,s){var i=e.attrs,a=e.componentStyle,c=e.defaultProps,p=e.foldedComponentIds,d=e.styledComponentId,h=e.target,f=o.useContext(et),m=Ge(),y=e.shouldForwardProp||m.shouldForwardProp;\"production\"!==process.env.NODE_ENV&&l(d);var v=I(r,f,c)||C,g=function(e,n,o){for(var r,s=t(t({},n),{className:void 0,theme:o}),i=0;i` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var E=function(e,t){var n=Ge(),o=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return\"production\"!==process.env.NODE_ENV&&l(o),o}(a,g);\"production\"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(E);var N=ie(p,d);return E&&(N+=\" \"+E),g.className&&(N+=\" \"+g.className),w[L(S)&&!A.has(S)?\"class\":\"className\"]=N,w.ref=s,u(S,w)}(D,e,r)}O.displayName=y;var D=o.forwardRef(O);return D.attrs=S,D.componentStyle=N,D.displayName=y,D.shouldForwardProp=w,D.foldedComponentIds=i?ie(a.foldedComponentIds,a.styledComponentId):\"\",D.styledComponentId=g,D.target=i?a.target:e,Object.defineProperty(D,\"defaultProps\",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=i?function(e){for(var t=[],n=1;n=200)){var s=t?' with the id of \"'.concat(t,'\"'):\"\";console.warn(\"Over \".concat(200,\" classes were generated for component \").concat(e).concat(s,\".\\n\")+\"Consider using the attrs method, together with a style object for frequently changed styles.\\nExample:\\n const Component = styled.div.attrs(props => ({\\n style: {\\n background: props.background,\\n },\\n }))`width: 100%;`\\n\\n \"),o=!0,n={}}}}(y,g)),ue(D,function(){return\".\".concat(D.styledComponentId)}),c&&oe(D,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),D}function at(e,t){for(var n=[e[0]],o=0,r=t.length;o2&&ke.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,o)},e}();function ft(n){for(var r=[],s=1;s meta tag to the stylesheet, or simply embedding it manually in your index.html section for a simpler app.\"),t.styleSheet.server&&u(r,e,t.styleSheet,n,t.stylis),o.useLayoutEffect(function(){if(!t.styleSheet.server)return u(r,e,t.styleSheet,n,t.stylis),function(){return c.removeStyles(r,t.styleSheet)}},[r,e,t.styleSheet,n,t.stylis]),null};function u(e,n,o,r,s){if(c.isStatic)c.renderStyles(e,b,o,s);else{var i=t(t({},n),{theme:I(n,r,l.defaultProps)});c.renderStyles(e,i,o,s)}}return o.memo(l)}function mt(t){for(var n=[],o=1;o\").concat(t,\"\")},this.getStyleTags=function(){if(e.sealed)throw he(2);return e._emitSheetCSS()},this.getStyleElement=function(){var n;if(e.sealed)throw he(2);var r=e.instance.toString();if(!r)return[];var s=((n={})[f]=\"\",n[y]=v,n.dangerouslySetInnerHTML={__html:r},n),i=Ce();return i&&(s.nonce=i),[o.createElement(\"style\",t({},s,{key:\"sc-0-0\"}))]},this.seal=function(){e.sealed=!0},this.instance=new ke({isServer:!0}),this.sealed=!1}return e.prototype.collectStyles=function(e){if(this.sealed)throw he(2);return o.createElement(Ye,{sheet:this.instance},e)},e.prototype.interleaveWithNodeStream=function(e){throw he(3)},e}(),gt={StyleSheet:ke,mainSheet:Me};\"production\"!==process.env.NODE_ENV&&\"undefined\"!=typeof navigator&&\"ReactNative\"===navigator.product&&console.warn(\"It looks like you've imported 'styled-components' on React Native.\\nPerhaps you're looking to import 'styled-components/native'?\\nRead more about this at https://www.styled-components.com/docs/basics#react-native\");var St=\"__sc-\".concat(f,\"__\");\"production\"!==process.env.NODE_ENV&&\"test\"!==process.env.NODE_ENV&&\"undefined\"!=typeof window&&(window[St]||(window[St]=0),1===window[St]&&console.warn(\"It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\\n\\nSee https://s-c.sh/2BAXzed for more info.\"),window[St]+=1);export{vt as ServerStyleSheet,Be as StyleSheetConsumer,$e as StyleSheetContext,Ye as StyleSheetManager,tt as ThemeConsumer,et as ThemeContext,ot as ThemeProvider,gt as __PRIVATE__,ft as createGlobalStyle,lt as css,dt as default,se as isStyledComponent,mt as keyframes,dt as styled,nt as useTheme,v as version,yt as withTheme};\n//# sourceMappingURL=styled-components.browser.esm.js.map\n","import{jsx as n,jsxs as e,Fragment as r}from\"react/jsx-runtime\";import t,{css as i}from\"styled-components\";import{useState as o,useCallback as a,useEffect as l,useRef as d}from\"react\";\n/*! *****************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */var s=function(){return s=Object.assign||function(n){for(var e,r=1,t=arguments.length;r input {\\n display: block;\\n opacity: 0;\\n position: absolute;\\n pointer-events: none;\\n }\\n\"],[\"\\n position: relative;\\n \",\";\\n &:focus-within {\\n outline: 2px solid black;\\n }\\n & > input {\\n display: block;\\n opacity: 0;\\n position: absolute;\\n pointer-events: none;\\n }\\n\"])),(function(n){return n.overRide?\"\":x})),g=t.div(f||(f=p([\"\\n border: dashed 2px \",\";\\n border-radius: 5px;\\n background-color: \",\";\\n opacity: 0.9;\\n position: absolute;\\n top: 0;\\n right: 0;\\n left: 0;\\n bottom: 0;\\n z-index: 999;\\n & > span {\\n position: absolute;\\n top: 50%;\\n left: 50%;\\n transform: translateX(-50%) translateY(-50%);\\n }\\n\"],[\"\\n border: dashed 2px \",\";\\n border-radius: 5px;\\n background-color: \",\";\\n opacity: 0.9;\\n position: absolute;\\n top: 0;\\n right: 0;\\n left: 0;\\n bottom: 0;\\n z-index: 999;\\n & > span {\\n position: absolute;\\n top: 50%;\\n left: 50%;\\n transform: translateX(-50%) translateY(-50%);\\n }\\n\"])),\"#666\",\"#999\"),m=t.div(v||(v=p([\"\\n display: flex;\\n justify-content: space-between;\\n flex-grow: 1;\\n & > span {\\n font-size: 12px;\\n color: \",\";\\n }\\n .file-types {\\n overflow: hidden;\\n white-space: nowrap;\\n text-overflow: ellipsis;\\n max-width: 100px;\\n }\\n\"],[\"\\n display: flex;\\n justify-content: space-between;\\n flex-grow: 1;\\n & > span {\\n font-size: 12px;\\n color: \",\";\\n }\\n .file-types {\\n overflow: hidden;\\n white-space: nowrap;\\n text-overflow: ellipsis;\\n max-width: 100px;\\n }\\n\"])),(function(n){return n.error?\"red\":\"#666\"})),y=t.span(h||(h=p([\"\\n font-size: 14px;\\n color: \",\";\\n span {\\n text-decoration: underline;\\n }\\n\"],[\"\\n font-size: 14px;\\n color: \",\";\\n span {\\n text-decoration: underline;\\n }\\n\"])),\"#666\"),w=function(n){return n/1024/1024},z=function(n){return void 0===n?\"\":n.map((function(n){return\".\".concat(n.toLowerCase())})).join(\",\")};function L(e){var r=e.types,t=e.minSize,i=e.maxSize;if(r){var o=r.toString(),a=\"\";return i&&(a+=\"size >= \".concat(i,\", \")),t&&(a+=\"size <= \".concat(t,\", \")),n(\"span\",s({title:\"\".concat(a,\"types: \").concat(o),className:\"file-types\"},{children:o}),void 0)}return null}function C(){return e(\"svg\",s({width:\"32\",height:\"32\",viewBox:\"0 0 32 32\",fill:\"none\",xmlns:\"http://www.w3.org/2000/svg\"},{children:[n(\"path\",{d:\"M5.33317 6.66667H22.6665V16H25.3332V6.66667C25.3332 5.196 24.1372 4 22.6665 4H5.33317C3.8625 4 2.6665 5.196 2.6665 6.66667V22.6667C2.6665 24.1373 3.8625 25.3333 5.33317 25.3333H15.9998V22.6667H5.33317V6.66667Z\",fill:\"#0658C2\"},void 0),n(\"path\",{d:\"M10.6665 14.6667L6.6665 20H21.3332L15.9998 12L11.9998 17.3333L10.6665 14.6667Z\",fill:\"#0658C2\"},void 0),n(\"path\",{d:\"M25.3332 18.6667H22.6665V22.6667H18.6665V25.3333H22.6665V29.3333H25.3332V25.3333H29.3332V22.6667H25.3332V18.6667Z\",fill:\"#0658C2\"},void 0)]}),void 0)}var H=0;var k=function(t,i,o,a,l,d){return o?n(\"span\",{children:\"File type/size error, Hovered on types!\"},void 0):n(y,{children:a?n(\"span\",{children:\"Upload disabled\"},void 0):n(r,t||i?{children:d?n(r,{children:n(\"span\",{children:d},void 0)},void 0):e(r,{children:[n(\"span\",{children:\"Uploaded Successfully!\"},void 0),\" Upload another?\"]},void 0)}:{children:e(r,l?{children:[n(\"span\",{children:l.split(\" \")[0]},void 0),\" \",l.substr(l.indexOf(\" \")+1)]}:{children:[n(\"span\",{children:\"Upload\"},void 0),\" or drop a file right here\"]},void 0)},void 0)},void 0)},E=function(t){var i=t.name,p=t.hoverTitle,c=t.types,u=t.handleChange,f=t.classes,v=t.children,h=t.maxSize,x=t.minSize,y=t.fileOrFiles,E=t.onSizeError,S=t.onTypeError,D=t.onSelect,V=t.onDrop,P=t.disabled,j=t.label,F=t.uploadedLabel,O=t.multiple,R=t.required,T=t.onDraggingStateChange,M=t.dropMessageStyle,U=t.ariaLabel,Z=t.ariaDescribedby,q=d(null),N=d(null),X=o(!1),Y=X[0],B=X[1],A=o(null),G=A[0],I=A[1],J=o(!1),K=J[0],Q=J[1],W=function(n){return c&&!function(n,e){var r=n.name.split(\".\").pop();return e.map((function(n){return n.toLowerCase()})).includes(r.toLowerCase())}(n,c)?(Q(!0),S&&S(\"File type is not supported\"),!1):h&&w(n.size)>h?(Q(!0),E&&E(\"File size is too big\"),!1):!(x&&w(n.size)0||c(!1)}),[]),h=a((function(n){n.preventDefault(),n.stopPropagation()}),[]),x=a((function(n){n.preventDefault(),n.stopPropagation(),c(!1),H=0;var e=n.dataTransfer.files;if(e&&e.length>0){var r=t?e:e[0],o=i(r);d&&o&&d(r)}}),[i]);return l((function(){var n=e.current;return n.addEventListener(\"click\",u),n.addEventListener(\"dragenter\",f),n.addEventListener(\"dragleave\",v),n.addEventListener(\"dragover\",h),n.addEventListener(\"drop\",x),function(){n.removeEventListener(\"click\",u),n.removeEventListener(\"dragenter\",f),n.removeEventListener(\"dragleave\",v),n.removeEventListener(\"dragover\",h),n.removeEventListener(\"drop\",x)}}),[u,f,v,h,x,e]),p}({labelRef:q,inputRef:N,multiple:O,handleChanges:$,onDrop:V});return l((function(){null==T||T(_)}),[_]),l((function(){y?(B(!0),I(y)):(N.current&&(N.current.value=\"\"),B(!1),I(null))}),[y]),e(b,s({overRide:v,className:\"\".concat(f||\"\",\" \").concat(P?\"is-disabled\":\"\"),ref:q,htmlFor:i,onClick:function(n){n.preventDefault(),n.stopPropagation()},\"aria-describedby\":Z,role:\"button\",\"aria-label\":U},{children:[n(\"input\",{onClick:function(n){n.stopPropagation(),N&&N.current&&(N.current.value=\"\",N.current.click())},onChange:function(n){var e=n.target.files,r=O?e:e[0],t=$(r);D&&t&&D(r)},accept:z(c),ref:N,type:\"file\",id:i,name:i,disabled:P,multiple:O,required:R},void 0),_&&n(g,s({style:M},{children:n(\"span\",{children:p||\"Drop Here\"},void 0)}),void 0),!v&&e(r,{children:[n(C,{},void 0),e(m,s({error:K},{children:[k(G,Y,K,P,j,F),n(L,{types:c,minSize:x,maxSize:h},void 0)]}),void 0)]},void 0),v]}),void 0)};export{E as FileUploader};\n","/*!\n\nJSZip v3.10.1 - A JavaScript class for generating and reading zip files\n\n\n(c) 2009-2016 Stuart Knightley \nDual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.\n\nJSZip uses the library pako released under the MIT license :\nhttps://github.com/nodeca/pako/blob/main/LICENSE\n*/\n\n!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{(\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:this).JSZip=e()}}(function(){return function s(a,o,h){function u(r,e){if(!o[r]){if(!a[r]){var t=\"function\"==typeof require&&require;if(!e&&t)return t(r,!0);if(l)return l(r,!0);var n=new Error(\"Cannot find module '\"+r+\"'\");throw n.code=\"MODULE_NOT_FOUND\",n}var i=o[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return u(t||e)},i,i.exports,s,a,o,h)}return o[r].exports}for(var l=\"function\"==typeof require&&require,e=0;e>2,s=(3&t)<<4|r>>4,a=1>6:64,o=2>4,r=(15&i)<<4|(s=p.indexOf(e.charAt(o++)))>>2,n=(3&s)<<6|(a=p.indexOf(e.charAt(o++))),l[h++]=t,64!==s&&(l[h++]=r),64!==a&&(l[h++]=n);return l}},{\"./support\":30,\"./utils\":32}],2:[function(e,t,r){\"use strict\";var n=e(\"./external\"),i=e(\"./stream/DataWorker\"),s=e(\"./stream/Crc32Probe\"),a=e(\"./stream/DataLengthProbe\");function o(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}o.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a(\"data_length\")),t=this;return e.on(\"end\",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error(\"Bug : uncompressed data size mismatch\")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo(\"compressedSize\",this.compressedSize).withStreamInfo(\"uncompressedSize\",this.uncompressedSize).withStreamInfo(\"crc32\",this.crc32).withStreamInfo(\"compression\",this.compression)}},o.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new a(\"uncompressedSize\")).pipe(t.compressWorker(r)).pipe(new a(\"compressedSize\")).withStreamInfo(\"compression\",t)},t.exports=o},{\"./external\":6,\"./stream/Crc32Probe\":25,\"./stream/DataLengthProbe\":26,\"./stream/DataWorker\":27}],3:[function(e,t,r){\"use strict\";var n=e(\"./stream/GenericWorker\");r.STORE={magic:\"\\0\\0\",compressWorker:function(){return new n(\"STORE compression\")},uncompressWorker:function(){return new n(\"STORE decompression\")}},r.DEFLATE=e(\"./flate\")},{\"./flate\":7,\"./stream/GenericWorker\":28}],4:[function(e,t,r){\"use strict\";var n=e(\"./utils\");var o=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?\"string\"!==n.getTypeOf(e)?function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},{\"./utils\":32}],5:[function(e,t,r){\"use strict\";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){\"use strict\";var n=null;n=\"undefined\"!=typeof Promise?Promise:e(\"lie\"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){\"use strict\";var n=\"undefined\"!=typeof Uint8Array&&\"undefined\"!=typeof Uint16Array&&\"undefined\"!=typeof Uint32Array,i=e(\"pako\"),s=e(\"./utils\"),a=e(\"./stream/GenericWorker\"),o=n?\"uint8array\":\"array\";function h(e,t){a.call(this,\"FlateWorker/\"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic=\"\\b\\0\",s.inherits(h,a),h.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(o,e.data),!1)},h.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},h.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},h.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},r.compressWorker=function(e){return new h(\"Deflate\",e)},r.uncompressWorker=function(){return new h(\"Inflate\",{})}},{\"./stream/GenericWorker\":28,\"./utils\":32,pako:38}],8:[function(e,t,r){\"use strict\";function A(e,t){var r,n=\"\";for(r=0;r>>=8;return n}function n(e,t,r,n,i,s){var a,o,h=e.file,u=e.compression,l=s!==O.utf8encode,f=I.transformTo(\"string\",s(h.name)),c=I.transformTo(\"string\",O.utf8encode(h.name)),d=h.comment,p=I.transformTo(\"string\",s(d)),m=I.transformTo(\"string\",O.utf8encode(d)),_=c.length!==h.name.length,g=m.length!==d.length,b=\"\",v=\"\",y=\"\",w=h.dir,k=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var S=0;t&&(S|=8),l||!_&&!g||(S|=2048);var z=0,C=0;w&&(z|=16),\"UNIX\"===i?(C=798,z|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(h.unixPermissions,w)):(C=20,z|=function(e){return 63&(e||0)}(h.dosPermissions)),a=k.getUTCHours(),a<<=6,a|=k.getUTCMinutes(),a<<=5,a|=k.getUTCSeconds()/2,o=k.getUTCFullYear()-1980,o<<=4,o|=k.getUTCMonth()+1,o<<=5,o|=k.getUTCDate(),_&&(v=A(1,1)+A(B(f),4)+c,b+=\"up\"+A(v.length,2)+v),g&&(y=A(1,1)+A(B(p),4)+m,b+=\"uc\"+A(y.length,2)+y);var E=\"\";return E+=\"\\n\\0\",E+=A(S,2),E+=u.magic,E+=A(a,2),E+=A(o,2),E+=A(x.crc32,4),E+=A(x.compressedSize,4),E+=A(x.uncompressedSize,4),E+=A(f.length,2),E+=A(b.length,2),{fileRecord:R.LOCAL_FILE_HEADER+E+f+b,dirRecord:R.CENTRAL_FILE_HEADER+A(C,2)+E+A(p.length,2)+\"\\0\\0\\0\\0\"+A(z,4)+A(n,4)+f+b+p}}var I=e(\"../utils\"),i=e(\"../stream/GenericWorker\"),O=e(\"../utf8\"),B=e(\"../crc32\"),R=e(\"../signature\");function s(e,t,r,n){i.call(this,\"ZipFileWorker\"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}I.inherits(s,i),s.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,i.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},s.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},s.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return R.DATA_DESCRIPTOR+A(e.crc32,4)+A(e.compressedSize,4)+A(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},s.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo(\"string\",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{\"../utils\":32}],19:[function(e,t,r){\"use strict\";var n=e(\"./Uint8ArrayReader\");function i(e){n.call(this,e)}e(\"../utils\").inherits(i,n),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{\"../utils\":32,\"./Uint8ArrayReader\":21}],20:[function(e,t,r){\"use strict\";var n=e(\"./DataReader\");function i(e){n.call(this,e)}e(\"../utils\").inherits(i,n),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{\"../utils\":32,\"./DataReader\":18}],21:[function(e,t,r){\"use strict\";var n=e(\"./ArrayReader\");function i(e){n.call(this,e)}e(\"../utils\").inherits(i,n),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{\"../utils\":32,\"./ArrayReader\":17}],22:[function(e,t,r){\"use strict\";var n=e(\"../utils\"),i=e(\"../support\"),s=e(\"./ArrayReader\"),a=e(\"./StringReader\"),o=e(\"./NodeBufferReader\"),h=e(\"./Uint8ArrayReader\");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),\"string\"!==t||i.uint8array?\"nodebuffer\"===t?new o(e):i.uint8array?new h(n.transformTo(\"uint8array\",e)):new s(n.transformTo(\"array\",e)):new a(e)}},{\"../support\":30,\"../utils\":32,\"./ArrayReader\":17,\"./NodeBufferReader\":19,\"./StringReader\":20,\"./Uint8ArrayReader\":21}],23:[function(e,t,r){\"use strict\";r.LOCAL_FILE_HEADER=\"PK\u0003\u0004\",r.CENTRAL_FILE_HEADER=\"PK\u0001\u0002\",r.CENTRAL_DIRECTORY_END=\"PK\u0005\u0006\",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR=\"PK\u0006\u0007\",r.ZIP64_CENTRAL_DIRECTORY_END=\"PK\u0006\u0006\",r.DATA_DESCRIPTOR=\"PK\u0007\\b\"},{}],24:[function(e,t,r){\"use strict\";var n=e(\"./GenericWorker\"),i=e(\"../utils\");function s(e){n.call(this,\"ConvertWorker to \"+e),this.destType=e}i.inherits(s,n),s.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{\"../utils\":32,\"./GenericWorker\":28}],25:[function(e,t,r){\"use strict\";var n=e(\"./GenericWorker\"),i=e(\"../crc32\");function s(){n.call(this,\"Crc32Probe\"),this.withStreamInfo(\"crc32\",0)}e(\"../utils\").inherits(s,n),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{\"../crc32\":4,\"../utils\":32,\"./GenericWorker\":28}],26:[function(e,t,r){\"use strict\";var n=e(\"../utils\"),i=e(\"./GenericWorker\");function s(e){i.call(this,\"DataLengthProbe for \"+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(s,i),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=s},{\"../utils\":32,\"./GenericWorker\":28}],27:[function(e,t,r){\"use strict\";var n=e(\"../utils\"),i=e(\"./GenericWorker\");function s(e){i.call(this,\"DataWorker\");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type=\"\",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}n.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case\"string\":e=this.data.substring(this.index,t);break;case\"uint8array\":e=this.data.subarray(this.index,t);break;case\"array\":case\"nodebuffer\":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{\"../utils\":32,\"./GenericWorker\":28}],28:[function(e,t,r){\"use strict\";function n(e){this.name=e||\"default\",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit(\"data\",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit(\"end\"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit(\"error\",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit(\"error\",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r \"+e:e}},t.exports=n},{}],29:[function(e,t,r){\"use strict\";var h=e(\"../utils\"),i=e(\"./ConvertWorker\"),s=e(\"./GenericWorker\"),u=e(\"../base64\"),n=e(\"../support\"),a=e(\"../external\"),o=null;if(n.nodestream)try{o=e(\"../nodejs/NodejsStreamOutputAdapter\")}catch(e){}function l(e,o){return new a.Promise(function(t,r){var n=[],i=e._internalType,s=e._outputType,a=e._mimeType;e.on(\"data\",function(e,t){n.push(e),o&&o(t)}).on(\"error\",function(e){n=[],r(e)}).on(\"end\",function(){try{var e=function(e,t,r){switch(e){case\"blob\":return h.newBlob(h.transformTo(\"arraybuffer\",t),r);case\"base64\":return u.encode(t);default:return h.transformTo(e,t)}}(s,function(e,t){var r,n=0,i=null,s=0;for(r=0;r>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t}(e)},s.utf8decode=function(e){return h.nodebuffer?o.transformTo(\"nodebuffer\",e).toString(\"utf-8\"):function(e){var t,r,n,i,s=e.length,a=new Array(2*s);for(t=r=0;t>10&1023,a[r++]=56320|1023&n)}return a.length!==r&&(a.subarray?a=a.subarray(0,r):a.length=r),o.applyFromCharCode(a)}(e=o.transformTo(h.uint8array?\"uint8array\":\"array\",e))},o.inherits(a,n),a.prototype.processChunk=function(e){var t=o.transformTo(h.uint8array?\"uint8array\":\"array\",e.data);if(this.leftOver&&this.leftOver.length){if(h.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var n=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t}(t),i=t;n!==t.length&&(h.uint8array?(i=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(i=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:s.utf8decode(i),meta:e.meta})},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=a,o.inherits(l,n),l.prototype.processChunk=function(e){this.push({data:s.utf8encode(e.data),meta:e.meta})},s.Utf8EncodeWorker=l},{\"./nodejsUtils\":14,\"./stream/GenericWorker\":28,\"./support\":30,\"./utils\":32}],32:[function(e,t,a){\"use strict\";var o=e(\"./support\"),h=e(\"./base64\"),r=e(\"./nodejsUtils\"),u=e(\"./external\");function n(e){return e}function l(e,t){for(var r=0;r>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||\"/\"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},r.buf2binstring=function(e){return l(e,e.length)},r.binstring2buf=function(e){for(var t=new h.Buf8(e.length),r=0,n=t.length;r>10&1023,o[n++]=56320|1023&i)}return l(o,n)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+u[e[r]]>t?r:t}},{\"./common\":41}],43:[function(e,t,r){\"use strict\";t.exports=function(e,t,r,n){for(var i=65535&e|0,s=e>>>16&65535|0,a=0;0!==r;){for(r-=a=2e3>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,r){\"use strict\";var h,c=e(\"../utils/common\"),u=e(\"./trees\"),d=e(\"./adler32\"),p=e(\"./crc32\"),n=e(\"./messages\"),l=0,f=4,m=0,_=-2,g=-1,b=4,i=2,v=8,y=9,s=286,a=30,o=19,w=2*s+1,k=15,x=3,S=258,z=S+x+1,C=42,E=113,A=1,I=2,O=3,B=4;function R(e,t){return e.msg=n[t],t}function T(e){return(e<<1)-(4e.avail_out&&(r=e.avail_out),0!==r&&(c.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function N(e,t){u._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,F(e.strm)}function U(e,t){e.pending_buf[e.pending++]=t}function P(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function L(e,t){var r,n,i=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match,h=e.strstart>e.w_size-z?e.strstart-(e.w_size-z):0,u=e.window,l=e.w_mask,f=e.prev,c=e.strstart+S,d=u[s+a-1],p=u[s+a];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===d&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&sh&&0!=--i);return a<=e.lookahead?a:e.lookahead}function j(e){var t,r,n,i,s,a,o,h,u,l,f=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-z)){for(c.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=r=e.hash_size;n=e.head[--t],e.head[t]=f<=n?n-f:0,--r;);for(t=r=f;n=e.prev[--t],e.prev[t]=f<=n?n-f:0,--r;);i+=f}if(0===e.strm.avail_in)break;if(a=e.strm,o=e.window,h=e.strstart+e.lookahead,u=i,l=void 0,l=a.avail_in,u=x)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<=x)if(n=u._tr_tally(e,e.strstart-e.match_start,e.match_length-x),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=x){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<=x&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-x,n=u._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-x),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(j(e),0===e.lookahead&&t===l)return A;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,N(e,!1),0===e.strm.avail_out))return A;if(e.strstart-e.block_start>=e.w_size-z&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):(e.strstart>e.block_start&&(N(e,!1),e.strm.avail_out),A)}),new M(4,4,8,4,Z),new M(4,5,16,8,Z),new M(4,6,32,32,Z),new M(4,4,16,16,W),new M(8,16,32,32,W),new M(8,16,128,128,W),new M(8,32,128,256,W),new M(32,128,258,1024,W),new M(32,258,258,4096,W)],r.deflateInit=function(e,t){return Y(e,t,v,15,8,0)},r.deflateInit2=Y,r.deflateReset=K,r.deflateResetKeep=G,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?_:(e.state.gzhead=t,m):_},r.deflate=function(e,t){var r,n,i,s;if(!e||!e.state||5>8&255),U(n,n.gzhead.time>>16&255),U(n,n.gzhead.time>>24&255),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(U(n,255&n.gzhead.extra.length),U(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(U(n,0),U(n,0),U(n,0),U(n,0),U(n,0),U(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),U(n,3),n.status=E);else{var a=v+(n.w_bits-8<<4)<<8;a|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=E,P(n,a),0!==n.strstart&&(P(n,e.adler>>>16),P(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending!==n.pending_buf_size));)U(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),F(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&F(e),n.pending+2<=n.pending_buf_size&&(U(n,255&e.adler),U(n,e.adler>>8&255),e.adler=0,n.status=E)):n.status=E),0!==n.pending){if(F(e),0===e.avail_out)return n.last_flush=-1,m}else if(0===e.avail_in&&T(t)<=T(r)&&t!==f)return R(e,-5);if(666===n.status&&0!==e.avail_in)return R(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==l&&666!==n.status){var o=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(j(e),0===e.lookahead)){if(t===l)return A;break}if(e.match_length=0,r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):3===n.strategy?function(e,t){for(var r,n,i,s,a=e.window;;){if(e.lookahead<=S){if(j(e),e.lookahead<=S&&t===l)return A;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=x&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=x?(r=u._tr_tally(e,1,e.match_length-x),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=u._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(N(e,!1),0===e.strm.avail_out))return A}return e.insert=0,t===f?(N(e,!0),0===e.strm.avail_out?O:B):e.last_lit&&(N(e,!1),0===e.strm.avail_out)?A:I}(n,t):h[n.level].func(n,t);if(o!==O&&o!==B||(n.status=666),o===A||o===O)return 0===e.avail_out&&(n.last_flush=-1),m;if(o===I&&(1===t?u._tr_align(n):5!==t&&(u._tr_stored_block(n,0,0,!1),3===t&&(D(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),F(e),0===e.avail_out))return n.last_flush=-1,m}return t!==f?m:n.wrap<=0?1:(2===n.wrap?(U(n,255&e.adler),U(n,e.adler>>8&255),U(n,e.adler>>16&255),U(n,e.adler>>24&255),U(n,255&e.total_in),U(n,e.total_in>>8&255),U(n,e.total_in>>16&255),U(n,e.total_in>>24&255)):(P(n,e.adler>>>16),P(n,65535&e.adler)),F(e),0=r.w_size&&(0===s&&(D(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new c.Buf8(r.w_size),c.arraySet(u,t,l-r.w_size,r.w_size,0),t=u,l=r.w_size),a=e.avail_in,o=e.next_in,h=e.input,e.avail_in=l,e.next_in=0,e.input=t,j(r);r.lookahead>=x;){for(n=r.strstart,i=r.lookahead-(x-1);r.ins_h=(r.ins_h<>>=y=v>>>24,p-=y,0===(y=v>>>16&255))C[s++]=65535&v;else{if(!(16&y)){if(0==(64&y)){v=m[(65535&v)+(d&(1<>>=y,p-=y),p<15&&(d+=z[n++]<>>=y=v>>>24,p-=y,!(16&(y=v>>>16&255))){if(0==(64&y)){v=_[(65535&v)+(d&(1<>>=y,p-=y,(y=s-a)>3,d&=(1<<(p-=w<<3))-1,e.next_in=n,e.next_out=s,e.avail_in=n>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new I.Buf16(320),this.work=new I.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=\"\",t.wrap&&(e.adler=1&t.wrap),t.mode=P,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new I.Buf32(n),t.distcode=t.distdyn=new I.Buf32(i),t.sane=1,t.back=-1,N):U}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,a(e)):U}function h(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(I.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n<(i=s.wsize-s.wnext)&&(i=n),I.arraySet(s.window,t,r-n,i,s.wnext),(n-=i)?(I.arraySet(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=B(r.check,E,2,0),l=u=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg=\"incorrect header check\",r.mode=30;break}if(8!=(15&u)){e.msg=\"unknown compression method\",r.mode=30;break}if(l-=4,k=8+(15&(u>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg=\"invalid window size\",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=3;case 3:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=B(r.check,E,4,0)),l=u=0,r.mode=4;case 4:for(;l<16;){if(0===o)break e;o--,u+=n[s++]<>8),512&r.flags&&(E[0]=255&u,E[1]=u>>>8&255,r.check=B(r.check,E,2,0)),l=u=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===o)break e;o--,u+=n[s++]<>>8&255,r.check=B(r.check,E,2,0)),l=u=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(o<(d=r.length)&&(d=o),d&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),I.arraySet(r.head.extra,n,s,d,k)),512&r.flags&&(r.check=B(r.check,n,d,s)),o-=d,s+=d,r.length-=d),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break e;for(d=0;k=n[s+d++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&d>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;l<32;){if(0===o)break e;o--,u+=n[s++]<>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===o)break e;o--,u+=n[s++]<>>=1)){case 0:r.mode=14;break;case 1:if(j(r),r.mode=20,6!==t)break;u>>>=2,l-=2;break e;case 2:r.mode=17;break;case 3:e.msg=\"invalid block type\",r.mode=30}u>>>=2,l-=2;break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===o)break e;o--,u+=n[s++]<>>16^65535)){e.msg=\"invalid stored block lengths\",r.mode=30;break}if(r.length=65535&u,l=u=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(d=r.length){if(o>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,286>>=3,l-=3}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=T(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg=\"invalid code lengths set\",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=_,l-=_,r.lens[r.have++]=b;else{if(16===b){for(z=_+2;l>>=_,l-=_,0===r.have){e.msg=\"invalid bit length repeat\",r.mode=30;break}k=r.lens[r.have-1],d=3+(3&u),u>>>=2,l-=2}else if(17===b){for(z=_+3;l>>=_)),u>>>=3,l-=3}else{for(z=_+7;l>>=_)),u>>>=7,l-=7}if(r.have+d>r.nlen+r.ndist){e.msg=\"invalid bit length repeat\",r.mode=30;break}for(;d--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){e.msg=\"invalid code -- missing end-of-block\",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},x=T(D,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg=\"invalid literal/lengths set\",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=T(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){e.msg=\"invalid distances set\",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=o&&258<=h){e.next_out=a,e.avail_out=h,e.next_in=s,e.avail_in=o,r.hold=u,r.bits=l,R(e,c),a=e.next_out,i=e.output,h=e.avail_out,s=e.next_in,n=e.input,o=e.avail_in,u=r.hold,l=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;g=(C=r.lencode[u&(1<>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,r.length=b,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=12;break}if(64&g){e.msg=\"invalid literal/length code\",r.mode=30;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(z=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;g=(C=r.distcode[u&(1<>>16&255,b=65535&C,!((_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>v)])>>>16&255,b=65535&C,!(v+(_=C>>>24)<=l);){if(0===o)break e;o--,u+=n[s++]<>>=v,l-=v,r.back+=v}if(u>>>=_,l-=_,r.back+=_,64&g){e.msg=\"invalid distance code\",r.mode=30;break}r.offset=b,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(z=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg=\"invalid distance too far back\",r.mode=30;break}r.mode=25;case 25:if(0===h)break e;if(d=c-h,r.offset>d){if((d=r.offset-d)>r.whave&&r.sane){e.msg=\"invalid distance too far back\",r.mode=30;break}p=d>r.wnext?(d-=r.wnext,r.wsize-d):r.wnext-d,d>r.length&&(d=r.length),m=r.window}else m=i,p=a-r.offset,d=r.length;for(hd?(m=R[T+a[v]],A[I+a[v]]):(m=96,0),h=1<>S)+(u-=h)]=p<<24|m<<16|_|0,0!==u;);for(h=1<>=1;if(0!==h?(E&=h-1,E+=h):E=0,v++,0==--O[b]){if(b===w)break;b=t[r+a[v]]}if(k>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function P(e,t,r){e.bi_valid>d-r?(e.bi_buf|=t<>d-e.bi_valid,e.bi_valid+=r-d):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function Z(e,t,r){var n,i,s=new Array(g+1),a=0;for(n=1;n<=g;n++)s[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var o=e[2*i+1];0!==o&&(e[2*i]=j(s[o]++,o))}}function W(e){var t;for(t=0;t>1;1<=r;r--)G(e,s,r);for(i=h;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,s[2*i]=s[2*r]+s[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,s[2*r+1]=s[2*n+1]=i,e.heap[1]=i++,G(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,s,a,o,h=t.dyn_tree,u=t.max_code,l=t.stat_desc.static_tree,f=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(s=0;s<=g;s++)e.bl_count[s]=0;for(h[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<_;r++)p<(s=h[2*h[2*(n=e.heap[r])+1]+1]+1)&&(s=p,m++),h[2*n+1]=s,u>=7;n>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return o;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return h;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=r+5,r+4<=i&&-1!==t?J(e,t,r,n):4===e.strategy||s===i?(P(e,2+(n?1:0),3),K(e,z,C)):(P(e,4+(n?1:0),3),function(e,t,r,n){var i;for(P(e,t-257,5),P(e,r-1,5),P(e,n-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(A[r]+u+1)]++,e.dyn_dtree[2*N(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){P(e,2,3),L(e,m,z),function(e){16===e.bi_valid?(U(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{\"../utils/common\":41}],53:[function(e,t,r){\"use strict\";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=\"\",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(e){!function(r,n){\"use strict\";if(!r.setImmediate){var i,s,t,a,o=1,h={},u=!1,l=r.document,e=Object.getPrototypeOf&&Object.getPrototypeOf(r);e=e&&e.setTimeout?e:r,i=\"[object process]\"==={}.toString.call(r.process)?function(e){process.nextTick(function(){c(e)})}:function(){if(r.postMessage&&!r.importScripts){var e=!0,t=r.onmessage;return r.onmessage=function(){e=!1},r.postMessage(\"\",\"*\"),r.onmessage=t,e}}()?(a=\"setImmediate$\"+Math.random()+\"$\",r.addEventListener?r.addEventListener(\"message\",d,!1):r.attachEvent(\"onmessage\",d),function(e){r.postMessage(a+e,\"*\")}):r.MessageChannel?((t=new MessageChannel).port1.onmessage=function(e){c(e.data)},function(e){t.port2.postMessage(e)}):l&&\"onreadystatechange\"in l.createElement(\"script\")?(s=l.documentElement,function(e){var t=l.createElement(\"script\");t.onreadystatechange=function(){c(e),t.onreadystatechange=null,s.removeChild(t),t=null},s.appendChild(t)}):function(e){setTimeout(c,0,e)},e.setImmediate=function(e){\"function\"!=typeof e&&(e=new Function(\"\"+e));for(var t=new Array(arguments.length-1),r=0;r= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n","//\n// Main\n//\nexport function memoize(fn, options) {\n var cache = options && options.cache ? options.cache : cacheDefault;\n var serializer = options && options.serializer ? options.serializer : serializerDefault;\n var strategy = options && options.strategy ? options.strategy : strategyDefault;\n return strategy(fn, {\n cache: cache,\n serializer: serializer,\n });\n}\n//\n// Strategy\n//\nfunction isPrimitive(value) {\n return (value == null || typeof value === 'number' || typeof value === 'boolean'); // || typeof value === \"string\" 'unsafe' primitive for our needs\n}\nfunction monadic(fn, cache, serializer, arg) {\n var cacheKey = isPrimitive(arg) ? arg : serializer(arg);\n var computedValue = cache.get(cacheKey);\n if (typeof computedValue === 'undefined') {\n computedValue = fn.call(this, arg);\n cache.set(cacheKey, computedValue);\n }\n return computedValue;\n}\nfunction variadic(fn, cache, serializer) {\n var args = Array.prototype.slice.call(arguments, 3);\n var cacheKey = serializer(args);\n var computedValue = cache.get(cacheKey);\n if (typeof computedValue === 'undefined') {\n computedValue = fn.apply(this, args);\n cache.set(cacheKey, computedValue);\n }\n return computedValue;\n}\nfunction assemble(fn, context, strategy, cache, serialize) {\n return strategy.bind(context, fn, cache, serialize);\n}\nfunction strategyDefault(fn, options) {\n var strategy = fn.length === 1 ? monadic : variadic;\n return assemble(fn, this, strategy, options.cache.create(), options.serializer);\n}\nfunction strategyVariadic(fn, options) {\n return assemble(fn, this, variadic, options.cache.create(), options.serializer);\n}\nfunction strategyMonadic(fn, options) {\n return assemble(fn, this, monadic, options.cache.create(), options.serializer);\n}\n//\n// Serializer\n//\nvar serializerDefault = function () {\n return JSON.stringify(arguments);\n};\n//\n// Cache\n//\nfunction ObjectWithoutPrototypeCache() {\n this.cache = Object.create(null);\n}\nObjectWithoutPrototypeCache.prototype.get = function (key) {\n return this.cache[key];\n};\nObjectWithoutPrototypeCache.prototype.set = function (key, value) {\n this.cache[key] = value;\n};\nvar cacheDefault = {\n create: function create() {\n // @ts-ignore\n return new ObjectWithoutPrototypeCache();\n },\n};\nexport var strategies = {\n variadic: strategyVariadic,\n monadic: strategyMonadic,\n};\n//# sourceMappingURL=index.js.map","import { __spreadArray } from \"tslib\";\nimport { memoize, strategies } from '@formatjs/fast-memoize';\n/**\n * Cannot do Math.log(x) / Math.log(10) bc if IEEE floating point issue\n * @param x number\n */\nexport function getMagnitude(x) {\n // Cannot count string length via Number.toString because it may use scientific notation\n // for very small or very large numbers.\n return Math.floor(Math.log(x) * Math.LOG10E);\n}\nexport function repeat(s, times) {\n if (typeof s.repeat === 'function') {\n return s.repeat(times);\n }\n var arr = new Array(times);\n for (var i = 0; i < arr.length; i++) {\n arr[i] = s;\n }\n return arr.join('');\n}\nexport function setInternalSlot(map, pl, field, value) {\n if (!map.get(pl)) {\n map.set(pl, Object.create(null));\n }\n var slots = map.get(pl);\n slots[field] = value;\n}\nexport function setMultiInternalSlots(map, pl, props) {\n for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {\n var k = _a[_i];\n setInternalSlot(map, pl, k, props[k]);\n }\n}\nexport function getInternalSlot(map, pl, field) {\n return getMultiInternalSlots(map, pl, field)[field];\n}\nexport function getMultiInternalSlots(map, pl) {\n var fields = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n fields[_i - 2] = arguments[_i];\n }\n var slots = map.get(pl);\n if (!slots) {\n throw new TypeError(\"\".concat(pl, \" InternalSlot has not been initialized\"));\n }\n return fields.reduce(function (all, f) {\n all[f] = slots[f];\n return all;\n }, Object.create(null));\n}\nexport function isLiteralPart(patternPart) {\n return patternPart.type === 'literal';\n}\n/*\n 17 ECMAScript Standard Built-in Objects:\n Every built-in Function object, including constructors, that is not\n identified as an anonymous function has a name property whose value\n is a String.\n\n Unless otherwise specified, the name property of a built-in Function\n object, if it exists, has the attributes { [[Writable]]: false,\n [[Enumerable]]: false, [[Configurable]]: true }.\n*/\nexport function defineProperty(target, name, _a) {\n var value = _a.value;\n Object.defineProperty(target, name, {\n configurable: true,\n enumerable: false,\n writable: true,\n value: value,\n });\n}\n/**\n * 7.3.5 CreateDataProperty\n * @param target\n * @param name\n * @param value\n */\nexport function createDataProperty(target, name, value) {\n Object.defineProperty(target, name, {\n configurable: true,\n enumerable: true,\n writable: true,\n value: value,\n });\n}\nexport var UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi;\nexport function invariant(condition, message, Err) {\n if (Err === void 0) { Err = Error; }\n if (!condition) {\n throw new Err(message);\n }\n}\nexport var createMemoizedNumberFormat = memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();\n}, {\n strategy: strategies.variadic,\n});\nexport var createMemoizedDateTimeFormat = memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();\n}, {\n strategy: strategies.variadic,\n});\nexport var createMemoizedPluralRules = memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();\n}, {\n strategy: strategies.variadic,\n});\nexport var createMemoizedLocale = memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.Locale).bind.apply(_a, __spreadArray([void 0], args, false)))();\n}, {\n strategy: strategies.variadic,\n});\nexport var createMemoizedListFormat = memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.ListFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();\n}, {\n strategy: strategies.variadic,\n});\n//# sourceMappingURL=utils.js.map","export var ErrorKind;\n(function (ErrorKind) {\n /** Argument is unclosed (e.g. `{0`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_CLOSING_BRACE\"] = 1] = \"EXPECT_ARGUMENT_CLOSING_BRACE\";\n /** Argument is empty (e.g. `{}`). */\n ErrorKind[ErrorKind[\"EMPTY_ARGUMENT\"] = 2] = \"EMPTY_ARGUMENT\";\n /** Argument is malformed (e.g. `{foo!}``) */\n ErrorKind[ErrorKind[\"MALFORMED_ARGUMENT\"] = 3] = \"MALFORMED_ARGUMENT\";\n /** Expect an argument type (e.g. `{foo,}`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_TYPE\"] = 4] = \"EXPECT_ARGUMENT_TYPE\";\n /** Unsupported argument type (e.g. `{foo,foo}`) */\n ErrorKind[ErrorKind[\"INVALID_ARGUMENT_TYPE\"] = 5] = \"INVALID_ARGUMENT_TYPE\";\n /** Expect an argument style (e.g. `{foo, number, }`) */\n ErrorKind[ErrorKind[\"EXPECT_ARGUMENT_STYLE\"] = 6] = \"EXPECT_ARGUMENT_STYLE\";\n /** The number skeleton is invalid. */\n ErrorKind[ErrorKind[\"INVALID_NUMBER_SKELETON\"] = 7] = \"INVALID_NUMBER_SKELETON\";\n /** The date time skeleton is invalid. */\n ErrorKind[ErrorKind[\"INVALID_DATE_TIME_SKELETON\"] = 8] = \"INVALID_DATE_TIME_SKELETON\";\n /** Exepct a number skeleton following the `::` (e.g. `{foo, number, ::}`) */\n ErrorKind[ErrorKind[\"EXPECT_NUMBER_SKELETON\"] = 9] = \"EXPECT_NUMBER_SKELETON\";\n /** Exepct a date time skeleton following the `::` (e.g. `{foo, date, ::}`) */\n ErrorKind[ErrorKind[\"EXPECT_DATE_TIME_SKELETON\"] = 10] = \"EXPECT_DATE_TIME_SKELETON\";\n /** Unmatched apostrophes in the argument style (e.g. `{foo, number, 'test`) */\n ErrorKind[ErrorKind[\"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\"] = 11] = \"UNCLOSED_QUOTE_IN_ARGUMENT_STYLE\";\n /** Missing select argument options (e.g. `{foo, select}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_OPTIONS\"] = 12] = \"EXPECT_SELECT_ARGUMENT_OPTIONS\";\n /** Expecting an offset value in `plural` or `selectordinal` argument (e.g `{foo, plural, offset}`) */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 13] = \"EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE\";\n /** Offset value in `plural` or `selectordinal` is invalid (e.g. `{foo, plural, offset: x}`) */\n ErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\"] = 14] = \"INVALID_PLURAL_ARGUMENT_OFFSET_VALUE\";\n /** Expecting a selector in `select` argument (e.g `{foo, select}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR\"] = 15] = \"EXPECT_SELECT_ARGUMENT_SELECTOR\";\n /** Expecting a selector in `plural` or `selectordinal` argument (e.g `{foo, plural}`) */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR\"] = 16] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR\";\n /** Expecting a message fragment after the `select` selector (e.g. `{foo, select, apple}`) */\n ErrorKind[ErrorKind[\"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\"] = 17] = \"EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\";\n /**\n * Expecting a message fragment after the `plural` or `selectordinal` selector\n * (e.g. `{foo, plural, one}`)\n */\n ErrorKind[ErrorKind[\"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\"] = 18] = \"EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT\";\n /** Selector in `plural` or `selectordinal` is malformed (e.g. `{foo, plural, =x {#}}`) */\n ErrorKind[ErrorKind[\"INVALID_PLURAL_ARGUMENT_SELECTOR\"] = 19] = \"INVALID_PLURAL_ARGUMENT_SELECTOR\";\n /**\n * Duplicate selectors in `plural` or `selectordinal` argument.\n * (e.g. {foo, plural, one {#} one {#}})\n */\n ErrorKind[ErrorKind[\"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\"] = 20] = \"DUPLICATE_PLURAL_ARGUMENT_SELECTOR\";\n /** Duplicate selectors in `select` argument.\n * (e.g. {foo, select, apple {apple} apple {apple}})\n */\n ErrorKind[ErrorKind[\"DUPLICATE_SELECT_ARGUMENT_SELECTOR\"] = 21] = \"DUPLICATE_SELECT_ARGUMENT_SELECTOR\";\n /** Plural or select argument option must have `other` clause. */\n ErrorKind[ErrorKind[\"MISSING_OTHER_CLAUSE\"] = 22] = \"MISSING_OTHER_CLAUSE\";\n /** The tag is malformed. (e.g. `foo) */\n ErrorKind[ErrorKind[\"INVALID_TAG\"] = 23] = \"INVALID_TAG\";\n /** The tag name is invalid. (e.g. `<123>foo`) */\n ErrorKind[ErrorKind[\"INVALID_TAG_NAME\"] = 25] = \"INVALID_TAG_NAME\";\n /** The closing tag does not match the opening tag. (e.g. `foo`) */\n ErrorKind[ErrorKind[\"UNMATCHED_CLOSING_TAG\"] = 26] = \"UNMATCHED_CLOSING_TAG\";\n /** The opening tag has unmatched closing tag. (e.g. `foo`) */\n ErrorKind[ErrorKind[\"UNCLOSED_TAG\"] = 27] = \"UNCLOSED_TAG\";\n})(ErrorKind || (ErrorKind = {}));\n//# sourceMappingURL=error.js.map","export var TYPE;\n(function (TYPE) {\n /**\n * Raw text\n */\n TYPE[TYPE[\"literal\"] = 0] = \"literal\";\n /**\n * Variable w/o any format, e.g `var` in `this is a {var}`\n */\n TYPE[TYPE[\"argument\"] = 1] = \"argument\";\n /**\n * Variable w/ number format\n */\n TYPE[TYPE[\"number\"] = 2] = \"number\";\n /**\n * Variable w/ date format\n */\n TYPE[TYPE[\"date\"] = 3] = \"date\";\n /**\n * Variable w/ time format\n */\n TYPE[TYPE[\"time\"] = 4] = \"time\";\n /**\n * Variable w/ select format\n */\n TYPE[TYPE[\"select\"] = 5] = \"select\";\n /**\n * Variable w/ plural format\n */\n TYPE[TYPE[\"plural\"] = 6] = \"plural\";\n /**\n * Only possible within plural argument.\n * This is the `#` symbol that will be substituted with the count.\n */\n TYPE[TYPE[\"pound\"] = 7] = \"pound\";\n /**\n * XML-like tag\n */\n TYPE[TYPE[\"tag\"] = 8] = \"tag\";\n})(TYPE || (TYPE = {}));\nexport var SKELETON_TYPE;\n(function (SKELETON_TYPE) {\n SKELETON_TYPE[SKELETON_TYPE[\"number\"] = 0] = \"number\";\n SKELETON_TYPE[SKELETON_TYPE[\"dateTime\"] = 1] = \"dateTime\";\n})(SKELETON_TYPE || (SKELETON_TYPE = {}));\n/**\n * Type Guards\n */\nexport function isLiteralElement(el) {\n return el.type === TYPE.literal;\n}\nexport function isArgumentElement(el) {\n return el.type === TYPE.argument;\n}\nexport function isNumberElement(el) {\n return el.type === TYPE.number;\n}\nexport function isDateElement(el) {\n return el.type === TYPE.date;\n}\nexport function isTimeElement(el) {\n return el.type === TYPE.time;\n}\nexport function isSelectElement(el) {\n return el.type === TYPE.select;\n}\nexport function isPluralElement(el) {\n return el.type === TYPE.plural;\n}\nexport function isPoundElement(el) {\n return el.type === TYPE.pound;\n}\nexport function isTagElement(el) {\n return el.type === TYPE.tag;\n}\nexport function isNumberSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.number);\n}\nexport function isDateTimeSkeleton(el) {\n return !!(el && typeof el === 'object' && el.type === SKELETON_TYPE.dateTime);\n}\nexport function createLiteralElement(value) {\n return {\n type: TYPE.literal,\n value: value,\n };\n}\nexport function createNumberElement(value, style) {\n return {\n type: TYPE.number,\n value: value,\n style: style,\n };\n}\n//# sourceMappingURL=types.js.map","// @generated from regex-gen.ts\nexport var SPACE_SEPARATOR_REGEX = /[ \\xA0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/;\nexport var WHITE_SPACE_REGEX = /[\\t-\\r \\x85\\u200E\\u200F\\u2028\\u2029]/;\n//# sourceMappingURL=regex.generated.js.map","/**\n * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js\n * with some tweaks\n */\nvar DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n/**\n * Parse Date time skeleton into Intl.DateTimeFormatOptions\n * Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * @public\n * @param skeleton skeleton string\n */\nexport function parseDateTimeSkeleton(skeleton) {\n var result = {};\n skeleton.replace(DATE_TIME_REGEX, function (match) {\n var len = match.length;\n switch (match[0]) {\n // Era\n case 'G':\n result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';\n break;\n // Year\n case 'y':\n result.year = len === 2 ? '2-digit' : 'numeric';\n break;\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n throw new RangeError('`Y/u/U/r` (year) patterns are not supported, use `y` instead');\n // Quarter\n case 'q':\n case 'Q':\n throw new RangeError('`q/Q` (quarter) patterns are not supported');\n // Month\n case 'M':\n case 'L':\n result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1];\n break;\n // Week\n case 'w':\n case 'W':\n throw new RangeError('`w/W` (week) patterns are not supported');\n case 'd':\n result.day = ['numeric', '2-digit'][len - 1];\n break;\n case 'D':\n case 'F':\n case 'g':\n throw new RangeError('`D/F/g` (day) patterns are not supported, use `d` instead');\n // Weekday\n case 'E':\n result.weekday = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';\n break;\n case 'e':\n if (len < 4) {\n throw new RangeError('`e..eee` (weekday) patterns are not supported');\n }\n result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];\n break;\n case 'c':\n if (len < 4) {\n throw new RangeError('`c..ccc` (weekday) patterns are not supported');\n }\n result.weekday = ['short', 'long', 'narrow', 'short'][len - 4];\n break;\n // Period\n case 'a': // AM, PM\n result.hour12 = true;\n break;\n case 'b': // am, pm, noon, midnight\n case 'B': // flexible day periods\n throw new RangeError('`b/B` (period) patterns are not supported, use `a` instead');\n // Hour\n case 'h':\n result.hourCycle = 'h12';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'H':\n result.hourCycle = 'h23';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'K':\n result.hourCycle = 'h11';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'k':\n result.hourCycle = 'h24';\n result.hour = ['numeric', '2-digit'][len - 1];\n break;\n case 'j':\n case 'J':\n case 'C':\n throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead');\n // Minute\n case 'm':\n result.minute = ['numeric', '2-digit'][len - 1];\n break;\n // Second\n case 's':\n result.second = ['numeric', '2-digit'][len - 1];\n break;\n case 'S':\n case 'A':\n throw new RangeError('`S/A` (second) patterns are not supported, use `s` instead');\n // Zone\n case 'z': // 1..3, 4: specific non-location format\n result.timeZoneName = len < 4 ? 'short' : 'long';\n break;\n case 'Z': // 1..3, 4, 5: The ISO8601 varios formats\n case 'O': // 1, 4: milliseconds in day short, long\n case 'v': // 1, 4: generic non-location format\n case 'V': // 1, 2, 3, 4: time zone ID or city\n case 'X': // 1, 2, 3, 4: The ISO8601 varios formats\n case 'x': // 1, 2, 3, 4: The ISO8601 varios formats\n throw new RangeError('`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead');\n }\n return '';\n });\n return result;\n}\n//# sourceMappingURL=date-time.js.map","// @generated from regex-gen.ts\nexport var WHITE_SPACE_REGEX = /[\\t-\\r \\x85\\u200E\\u200F\\u2028\\u2029]/i;\n//# sourceMappingURL=regex.generated.js.map","import { __assign } from \"tslib\";\nimport { WHITE_SPACE_REGEX } from './regex.generated';\nexport function parseNumberSkeletonFromString(skeleton) {\n if (skeleton.length === 0) {\n throw new Error('Number skeleton cannot be empty');\n }\n // Parse the skeleton\n var stringTokens = skeleton\n .split(WHITE_SPACE_REGEX)\n .filter(function (x) { return x.length > 0; });\n var tokens = [];\n for (var _i = 0, stringTokens_1 = stringTokens; _i < stringTokens_1.length; _i++) {\n var stringToken = stringTokens_1[_i];\n var stemAndOptions = stringToken.split('/');\n if (stemAndOptions.length === 0) {\n throw new Error('Invalid number skeleton');\n }\n var stem = stemAndOptions[0], options = stemAndOptions.slice(1);\n for (var _a = 0, options_1 = options; _a < options_1.length; _a++) {\n var option = options_1[_a];\n if (option.length === 0) {\n throw new Error('Invalid number skeleton');\n }\n }\n tokens.push({ stem: stem, options: options });\n }\n return tokens;\n}\nfunction icuUnitToEcma(unit) {\n return unit.replace(/^(.*?)-/, '');\n}\nvar FRACTION_PRECISION_REGEX = /^\\.(?:(0+)(\\*)?|(#+)|(0+)(#+))$/g;\nvar SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\\+|#+)?[rs]?$/g;\nvar INTEGER_WIDTH_REGEX = /(\\*)(0+)|(#+)(0+)|(0+)/g;\nvar CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;\nfunction parseSignificantPrecision(str) {\n var result = {};\n if (str[str.length - 1] === 'r') {\n result.roundingPriority = 'morePrecision';\n }\n else if (str[str.length - 1] === 's') {\n result.roundingPriority = 'lessPrecision';\n }\n str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) {\n // @@@ case\n if (typeof g2 !== 'string') {\n result.minimumSignificantDigits = g1.length;\n result.maximumSignificantDigits = g1.length;\n }\n // @@@+ case\n else if (g2 === '+') {\n result.minimumSignificantDigits = g1.length;\n }\n // .### case\n else if (g1[0] === '#') {\n result.maximumSignificantDigits = g1.length;\n }\n // .@@## or .@@@ case\n else {\n result.minimumSignificantDigits = g1.length;\n result.maximumSignificantDigits =\n g1.length + (typeof g2 === 'string' ? g2.length : 0);\n }\n return '';\n });\n return result;\n}\nfunction parseSign(str) {\n switch (str) {\n case 'sign-auto':\n return {\n signDisplay: 'auto',\n };\n case 'sign-accounting':\n case '()':\n return {\n currencySign: 'accounting',\n };\n case 'sign-always':\n case '+!':\n return {\n signDisplay: 'always',\n };\n case 'sign-accounting-always':\n case '()!':\n return {\n signDisplay: 'always',\n currencySign: 'accounting',\n };\n case 'sign-except-zero':\n case '+?':\n return {\n signDisplay: 'exceptZero',\n };\n case 'sign-accounting-except-zero':\n case '()?':\n return {\n signDisplay: 'exceptZero',\n currencySign: 'accounting',\n };\n case 'sign-never':\n case '+_':\n return {\n signDisplay: 'never',\n };\n }\n}\nfunction parseConciseScientificAndEngineeringStem(stem) {\n // Engineering\n var result;\n if (stem[0] === 'E' && stem[1] === 'E') {\n result = {\n notation: 'engineering',\n };\n stem = stem.slice(2);\n }\n else if (stem[0] === 'E') {\n result = {\n notation: 'scientific',\n };\n stem = stem.slice(1);\n }\n if (result) {\n var signDisplay = stem.slice(0, 2);\n if (signDisplay === '+!') {\n result.signDisplay = 'always';\n stem = stem.slice(2);\n }\n else if (signDisplay === '+?') {\n result.signDisplay = 'exceptZero';\n stem = stem.slice(2);\n }\n if (!CONCISE_INTEGER_WIDTH_REGEX.test(stem)) {\n throw new Error('Malformed concise eng/scientific notation');\n }\n result.minimumIntegerDigits = stem.length;\n }\n return result;\n}\nfunction parseNotationOptions(opt) {\n var result = {};\n var signOpts = parseSign(opt);\n if (signOpts) {\n return signOpts;\n }\n return result;\n}\n/**\n * https://github.com/unicode-org/icu/blob/master/docs/userguide/format_parse/numbers/skeletons.md#skeleton-stems-and-options\n */\nexport function parseNumberSkeleton(tokens) {\n var result = {};\n for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {\n var token = tokens_1[_i];\n switch (token.stem) {\n case 'percent':\n case '%':\n result.style = 'percent';\n continue;\n case '%x100':\n result.style = 'percent';\n result.scale = 100;\n continue;\n case 'currency':\n result.style = 'currency';\n result.currency = token.options[0];\n continue;\n case 'group-off':\n case ',_':\n result.useGrouping = false;\n continue;\n case 'precision-integer':\n case '.':\n result.maximumFractionDigits = 0;\n continue;\n case 'measure-unit':\n case 'unit':\n result.style = 'unit';\n result.unit = icuUnitToEcma(token.options[0]);\n continue;\n case 'compact-short':\n case 'K':\n result.notation = 'compact';\n result.compactDisplay = 'short';\n continue;\n case 'compact-long':\n case 'KK':\n result.notation = 'compact';\n result.compactDisplay = 'long';\n continue;\n case 'scientific':\n result = __assign(__assign(__assign({}, result), { notation: 'scientific' }), token.options.reduce(function (all, opt) { return (__assign(__assign({}, all), parseNotationOptions(opt))); }, {}));\n continue;\n case 'engineering':\n result = __assign(__assign(__assign({}, result), { notation: 'engineering' }), token.options.reduce(function (all, opt) { return (__assign(__assign({}, all), parseNotationOptions(opt))); }, {}));\n continue;\n case 'notation-simple':\n result.notation = 'standard';\n continue;\n // https://github.com/unicode-org/icu/blob/master/icu4c/source/i18n/unicode/unumberformatter.h\n case 'unit-width-narrow':\n result.currencyDisplay = 'narrowSymbol';\n result.unitDisplay = 'narrow';\n continue;\n case 'unit-width-short':\n result.currencyDisplay = 'code';\n result.unitDisplay = 'short';\n continue;\n case 'unit-width-full-name':\n result.currencyDisplay = 'name';\n result.unitDisplay = 'long';\n continue;\n case 'unit-width-iso-code':\n result.currencyDisplay = 'symbol';\n continue;\n case 'scale':\n result.scale = parseFloat(token.options[0]);\n continue;\n case 'rounding-mode-floor':\n result.roundingMode = 'floor';\n continue;\n case 'rounding-mode-ceiling':\n result.roundingMode = 'ceil';\n continue;\n case 'rounding-mode-down':\n result.roundingMode = 'trunc';\n continue;\n case 'rounding-mode-up':\n result.roundingMode = 'expand';\n continue;\n case 'rounding-mode-half-even':\n result.roundingMode = 'halfEven';\n continue;\n case 'rounding-mode-half-down':\n result.roundingMode = 'halfTrunc';\n continue;\n case 'rounding-mode-half-up':\n result.roundingMode = 'halfExpand';\n continue;\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width\n case 'integer-width':\n if (token.options.length > 1) {\n throw new RangeError('integer-width stems only accept a single optional option');\n }\n token.options[0].replace(INTEGER_WIDTH_REGEX, function (_, g1, g2, g3, g4, g5) {\n if (g1) {\n result.minimumIntegerDigits = g2.length;\n }\n else if (g3 && g4) {\n throw new Error('We currently do not support maximum integer digits');\n }\n else if (g5) {\n throw new Error('We currently do not support exact integer digits');\n }\n return '';\n });\n continue;\n }\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#integer-width\n if (CONCISE_INTEGER_WIDTH_REGEX.test(token.stem)) {\n result.minimumIntegerDigits = token.stem.length;\n continue;\n }\n if (FRACTION_PRECISION_REGEX.test(token.stem)) {\n // Precision\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#fraction-precision\n // precision-integer case\n if (token.options.length > 1) {\n throw new RangeError('Fraction-precision stems only accept a single optional option');\n }\n token.stem.replace(FRACTION_PRECISION_REGEX, function (_, g1, g2, g3, g4, g5) {\n // .000* case (before ICU67 it was .000+)\n if (g2 === '*') {\n result.minimumFractionDigits = g1.length;\n }\n // .### case\n else if (g3 && g3[0] === '#') {\n result.maximumFractionDigits = g3.length;\n }\n // .00## case\n else if (g4 && g5) {\n result.minimumFractionDigits = g4.length;\n result.maximumFractionDigits = g4.length + g5.length;\n }\n else {\n result.minimumFractionDigits = g1.length;\n result.maximumFractionDigits = g1.length;\n }\n return '';\n });\n var opt = token.options[0];\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display\n if (opt === 'w') {\n result = __assign(__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' });\n }\n else if (opt) {\n result = __assign(__assign({}, result), parseSignificantPrecision(opt));\n }\n continue;\n }\n // https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#significant-digits-precision\n if (SIGNIFICANT_PRECISION_REGEX.test(token.stem)) {\n result = __assign(__assign({}, result), parseSignificantPrecision(token.stem));\n continue;\n }\n var signOpts = parseSign(token.stem);\n if (signOpts) {\n result = __assign(__assign({}, result), signOpts);\n }\n var conciseScientificAndEngineeringOpts = parseConciseScientificAndEngineeringStem(token.stem);\n if (conciseScientificAndEngineeringOpts) {\n result = __assign(__assign({}, result), conciseScientificAndEngineeringOpts);\n }\n }\n return result;\n}\n//# sourceMappingURL=number.js.map","// @generated from time-data-gen.ts\n// prettier-ignore \nexport var timeData = {\n \"001\": [\n \"H\",\n \"h\"\n ],\n \"419\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"AC\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"AD\": [\n \"H\",\n \"hB\"\n ],\n \"AE\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"AF\": [\n \"H\",\n \"hb\",\n \"hB\",\n \"h\"\n ],\n \"AG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"AI\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"AL\": [\n \"h\",\n \"H\",\n \"hB\"\n ],\n \"AM\": [\n \"H\",\n \"hB\"\n ],\n \"AO\": [\n \"H\",\n \"hB\"\n ],\n \"AR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"AS\": [\n \"h\",\n \"H\"\n ],\n \"AT\": [\n \"H\",\n \"hB\"\n ],\n \"AU\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"AW\": [\n \"H\",\n \"hB\"\n ],\n \"AX\": [\n \"H\"\n ],\n \"AZ\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"BA\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"BB\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BD\": [\n \"h\",\n \"hB\",\n \"H\"\n ],\n \"BE\": [\n \"H\",\n \"hB\"\n ],\n \"BF\": [\n \"H\",\n \"hB\"\n ],\n \"BG\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"BH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"BI\": [\n \"H\",\n \"h\"\n ],\n \"BJ\": [\n \"H\",\n \"hB\"\n ],\n \"BL\": [\n \"H\",\n \"hB\"\n ],\n \"BM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BN\": [\n \"hb\",\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"BO\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"BQ\": [\n \"H\"\n ],\n \"BR\": [\n \"H\",\n \"hB\"\n ],\n \"BS\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"BT\": [\n \"h\",\n \"H\"\n ],\n \"BW\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"BY\": [\n \"H\",\n \"h\"\n ],\n \"BZ\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CA\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"CC\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CD\": [\n \"hB\",\n \"H\"\n ],\n \"CF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"CG\": [\n \"H\",\n \"hB\"\n ],\n \"CH\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"CI\": [\n \"H\",\n \"hB\"\n ],\n \"CK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CL\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CM\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"CN\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"CO\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CP\": [\n \"H\"\n ],\n \"CR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CU\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"CV\": [\n \"H\",\n \"hB\"\n ],\n \"CW\": [\n \"H\",\n \"hB\"\n ],\n \"CX\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"CY\": [\n \"h\",\n \"H\",\n \"hb\",\n \"hB\"\n ],\n \"CZ\": [\n \"H\"\n ],\n \"DE\": [\n \"H\",\n \"hB\"\n ],\n \"DG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"DJ\": [\n \"h\",\n \"H\"\n ],\n \"DK\": [\n \"H\"\n ],\n \"DM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"DO\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"DZ\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"EA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"EC\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"EE\": [\n \"H\",\n \"hB\"\n ],\n \"EG\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"EH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"ER\": [\n \"h\",\n \"H\"\n ],\n \"ES\": [\n \"H\",\n \"hB\",\n \"h\",\n \"hb\"\n ],\n \"ET\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"FI\": [\n \"H\"\n ],\n \"FJ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"FK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"FM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"FO\": [\n \"H\",\n \"h\"\n ],\n \"FR\": [\n \"H\",\n \"hB\"\n ],\n \"GA\": [\n \"H\",\n \"hB\"\n ],\n \"GB\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GD\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GE\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"GF\": [\n \"H\",\n \"hB\"\n ],\n \"GG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GH\": [\n \"h\",\n \"H\"\n ],\n \"GI\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"GL\": [\n \"H\",\n \"h\"\n ],\n \"GM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GN\": [\n \"H\",\n \"hB\"\n ],\n \"GP\": [\n \"H\",\n \"hB\"\n ],\n \"GQ\": [\n \"H\",\n \"hB\",\n \"h\",\n \"hb\"\n ],\n \"GR\": [\n \"h\",\n \"H\",\n \"hb\",\n \"hB\"\n ],\n \"GT\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"GU\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"GW\": [\n \"H\",\n \"hB\"\n ],\n \"GY\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"HK\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"HN\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"HR\": [\n \"H\",\n \"hB\"\n ],\n \"HU\": [\n \"H\",\n \"h\"\n ],\n \"IC\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"ID\": [\n \"H\"\n ],\n \"IE\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IL\": [\n \"H\",\n \"hB\"\n ],\n \"IM\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IN\": [\n \"h\",\n \"H\"\n ],\n \"IO\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"IQ\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"IR\": [\n \"hB\",\n \"H\"\n ],\n \"IS\": [\n \"H\"\n ],\n \"IT\": [\n \"H\",\n \"hB\"\n ],\n \"JE\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"JM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"JO\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"JP\": [\n \"H\",\n \"K\",\n \"h\"\n ],\n \"KE\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"KG\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"KH\": [\n \"hB\",\n \"h\",\n \"H\",\n \"hb\"\n ],\n \"KI\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KM\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"KN\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KP\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"KR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"KW\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"KY\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"KZ\": [\n \"H\",\n \"hB\"\n ],\n \"LA\": [\n \"H\",\n \"hb\",\n \"hB\",\n \"h\"\n ],\n \"LB\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"LC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"LI\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"LK\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"LR\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"LS\": [\n \"h\",\n \"H\"\n ],\n \"LT\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"LU\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"LV\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"LY\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"MA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"MC\": [\n \"H\",\n \"hB\"\n ],\n \"MD\": [\n \"H\",\n \"hB\"\n ],\n \"ME\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"MF\": [\n \"H\",\n \"hB\"\n ],\n \"MG\": [\n \"H\",\n \"h\"\n ],\n \"MH\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MK\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"ML\": [\n \"H\"\n ],\n \"MM\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"MN\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"MO\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"MP\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MQ\": [\n \"H\",\n \"hB\"\n ],\n \"MR\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"MS\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"MT\": [\n \"H\",\n \"h\"\n ],\n \"MU\": [\n \"H\",\n \"h\"\n ],\n \"MV\": [\n \"H\",\n \"h\"\n ],\n \"MW\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"MX\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"MY\": [\n \"hb\",\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"MZ\": [\n \"H\",\n \"hB\"\n ],\n \"NA\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"NC\": [\n \"H\",\n \"hB\"\n ],\n \"NE\": [\n \"H\"\n ],\n \"NF\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NG\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NI\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"NL\": [\n \"H\",\n \"hB\"\n ],\n \"NO\": [\n \"H\",\n \"h\"\n ],\n \"NP\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"NR\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NU\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"NZ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"OM\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"PA\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"PE\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"PF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"PG\": [\n \"h\",\n \"H\"\n ],\n \"PH\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"PK\": [\n \"h\",\n \"hB\",\n \"H\"\n ],\n \"PL\": [\n \"H\",\n \"h\"\n ],\n \"PM\": [\n \"H\",\n \"hB\"\n ],\n \"PN\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"PR\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"PS\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"PT\": [\n \"H\",\n \"hB\"\n ],\n \"PW\": [\n \"h\",\n \"H\"\n ],\n \"PY\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"QA\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"RE\": [\n \"H\",\n \"hB\"\n ],\n \"RO\": [\n \"H\",\n \"hB\"\n ],\n \"RS\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"RU\": [\n \"H\"\n ],\n \"RW\": [\n \"H\",\n \"h\"\n ],\n \"SA\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SB\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SC\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SD\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SE\": [\n \"H\"\n ],\n \"SG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SH\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"SI\": [\n \"H\",\n \"hB\"\n ],\n \"SJ\": [\n \"H\"\n ],\n \"SK\": [\n \"H\"\n ],\n \"SL\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"SM\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SN\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"SO\": [\n \"h\",\n \"H\"\n ],\n \"SR\": [\n \"H\",\n \"hB\"\n ],\n \"SS\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"ST\": [\n \"H\",\n \"hB\"\n ],\n \"SV\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"SX\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"SY\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"SZ\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"TA\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"TC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"TD\": [\n \"h\",\n \"H\",\n \"hB\"\n ],\n \"TF\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"TG\": [\n \"H\",\n \"hB\"\n ],\n \"TH\": [\n \"H\",\n \"h\"\n ],\n \"TJ\": [\n \"H\",\n \"h\"\n ],\n \"TL\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ],\n \"TM\": [\n \"H\",\n \"h\"\n ],\n \"TN\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"TO\": [\n \"h\",\n \"H\"\n ],\n \"TR\": [\n \"H\",\n \"hB\"\n ],\n \"TT\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"TW\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"TZ\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"UA\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"UG\": [\n \"hB\",\n \"hb\",\n \"H\",\n \"h\"\n ],\n \"UM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"US\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"UY\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"UZ\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"VA\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"VC\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VE\": [\n \"h\",\n \"H\",\n \"hB\",\n \"hb\"\n ],\n \"VG\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VI\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"VN\": [\n \"H\",\n \"h\"\n ],\n \"VU\": [\n \"h\",\n \"H\"\n ],\n \"WF\": [\n \"H\",\n \"hB\"\n ],\n \"WS\": [\n \"h\",\n \"H\"\n ],\n \"XK\": [\n \"H\",\n \"hB\",\n \"h\"\n ],\n \"YE\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"YT\": [\n \"H\",\n \"hB\"\n ],\n \"ZA\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"ZM\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"ZW\": [\n \"H\",\n \"h\"\n ],\n \"af-ZA\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"ar-001\": [\n \"h\",\n \"hB\",\n \"hb\",\n \"H\"\n ],\n \"ca-ES\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"en-001\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"en-HK\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"en-IL\": [\n \"H\",\n \"h\",\n \"hb\",\n \"hB\"\n ],\n \"en-MY\": [\n \"h\",\n \"hb\",\n \"H\",\n \"hB\"\n ],\n \"es-BR\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-ES\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"es-GQ\": [\n \"H\",\n \"h\",\n \"hB\",\n \"hb\"\n ],\n \"fr-CA\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"gl-ES\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"gu-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"hi-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"it-CH\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"it-IT\": [\n \"H\",\n \"h\",\n \"hB\"\n ],\n \"kn-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"ml-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"mr-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"pa-IN\": [\n \"hB\",\n \"hb\",\n \"h\",\n \"H\"\n ],\n \"ta-IN\": [\n \"hB\",\n \"h\",\n \"hb\",\n \"H\"\n ],\n \"te-IN\": [\n \"hB\",\n \"h\",\n \"H\"\n ],\n \"zu-ZA\": [\n \"H\",\n \"hB\",\n \"hb\",\n \"h\"\n ]\n};\n//# sourceMappingURL=time-data.generated.js.map","import { timeData } from './time-data.generated';\n/**\n * Returns the best matching date time pattern if a date time skeleton\n * pattern is provided with a locale. Follows the Unicode specification:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#table-mapping-requested-time-skeletons-to-patterns\n * @param skeleton date time skeleton pattern that possibly includes j, J or C\n * @param locale\n */\nexport function getBestPattern(skeleton, locale) {\n var skeletonCopy = '';\n for (var patternPos = 0; patternPos < skeleton.length; patternPos++) {\n var patternChar = skeleton.charAt(patternPos);\n if (patternChar === 'j') {\n var extraLength = 0;\n while (patternPos + 1 < skeleton.length &&\n skeleton.charAt(patternPos + 1) === patternChar) {\n extraLength++;\n patternPos++;\n }\n var hourLen = 1 + (extraLength & 1);\n var dayPeriodLen = extraLength < 2 ? 1 : 3 + (extraLength >> 1);\n var dayPeriodChar = 'a';\n var hourChar = getDefaultHourSymbolFromLocale(locale);\n if (hourChar == 'H' || hourChar == 'k') {\n dayPeriodLen = 0;\n }\n while (dayPeriodLen-- > 0) {\n skeletonCopy += dayPeriodChar;\n }\n while (hourLen-- > 0) {\n skeletonCopy = hourChar + skeletonCopy;\n }\n }\n else if (patternChar === 'J') {\n skeletonCopy += 'H';\n }\n else {\n skeletonCopy += patternChar;\n }\n }\n return skeletonCopy;\n}\n/**\n * Maps the [hour cycle type](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle)\n * of the given `locale` to the corresponding time pattern.\n * @param locale\n */\nfunction getDefaultHourSymbolFromLocale(locale) {\n var hourCycle = locale.hourCycle;\n if (hourCycle === undefined &&\n // @ts-ignore hourCycle(s) is not identified yet\n locale.hourCycles &&\n // @ts-ignore\n locale.hourCycles.length) {\n // @ts-ignore\n hourCycle = locale.hourCycles[0];\n }\n if (hourCycle) {\n switch (hourCycle) {\n case 'h24':\n return 'k';\n case 'h23':\n return 'H';\n case 'h12':\n return 'h';\n case 'h11':\n return 'K';\n default:\n throw new Error('Invalid hourCycle');\n }\n }\n // TODO: Once hourCycle is fully supported remove the following with data generation\n var languageTag = locale.language;\n var regionTag;\n if (languageTag !== 'root') {\n regionTag = locale.maximize().region;\n }\n var hourCycles = timeData[regionTag || ''] ||\n timeData[languageTag || ''] ||\n timeData[\"\".concat(languageTag, \"-001\")] ||\n timeData['001'];\n return hourCycles[0];\n}\n//# sourceMappingURL=date-time-pattern-generator.js.map","var _a;\nimport { __assign } from \"tslib\";\nimport { ErrorKind } from './error';\nimport { SKELETON_TYPE, TYPE, } from './types';\nimport { SPACE_SEPARATOR_REGEX } from './regex.generated';\nimport { parseNumberSkeleton, parseNumberSkeletonFromString, parseDateTimeSkeleton, } from '@formatjs/icu-skeleton-parser';\nimport { getBestPattern } from './date-time-pattern-generator';\nvar SPACE_SEPARATOR_START_REGEX = new RegExp(\"^\".concat(SPACE_SEPARATOR_REGEX.source, \"*\"));\nvar SPACE_SEPARATOR_END_REGEX = new RegExp(\"\".concat(SPACE_SEPARATOR_REGEX.source, \"*$\"));\nfunction createLocation(start, end) {\n return { start: start, end: end };\n}\n// #region Ponyfills\n// Consolidate these variables up top for easier toggling during debugging\nvar hasNativeStartsWith = !!String.prototype.startsWith && '_a'.startsWith('a', 1);\nvar hasNativeFromCodePoint = !!String.fromCodePoint;\nvar hasNativeFromEntries = !!Object.fromEntries;\nvar hasNativeCodePointAt = !!String.prototype.codePointAt;\nvar hasTrimStart = !!String.prototype.trimStart;\nvar hasTrimEnd = !!String.prototype.trimEnd;\nvar hasNativeIsSafeInteger = !!Number.isSafeInteger;\nvar isSafeInteger = hasNativeIsSafeInteger\n ? Number.isSafeInteger\n : function (n) {\n return (typeof n === 'number' &&\n isFinite(n) &&\n Math.floor(n) === n &&\n Math.abs(n) <= 0x1fffffffffffff);\n };\n// IE11 does not support y and u.\nvar REGEX_SUPPORTS_U_AND_Y = true;\ntry {\n var re = RE('([^\\\\p{White_Space}\\\\p{Pattern_Syntax}]*)', 'yu');\n /**\n * legacy Edge or Xbox One browser\n * Unicode flag support: supported\n * Pattern_Syntax support: not supported\n * See https://github.com/formatjs/formatjs/issues/2822\n */\n REGEX_SUPPORTS_U_AND_Y = ((_a = re.exec('a')) === null || _a === void 0 ? void 0 : _a[0]) === 'a';\n}\ncatch (_) {\n REGEX_SUPPORTS_U_AND_Y = false;\n}\nvar startsWith = hasNativeStartsWith\n ? // Native\n function startsWith(s, search, position) {\n return s.startsWith(search, position);\n }\n : // For IE11\n function startsWith(s, search, position) {\n return s.slice(position, position + search.length) === search;\n };\nvar fromCodePoint = hasNativeFromCodePoint\n ? String.fromCodePoint\n : // IE11\n function fromCodePoint() {\n var codePoints = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n codePoints[_i] = arguments[_i];\n }\n var elements = '';\n var length = codePoints.length;\n var i = 0;\n var code;\n while (length > i) {\n code = codePoints[i++];\n if (code > 0x10ffff)\n throw RangeError(code + ' is not a valid code point');\n elements +=\n code < 0x10000\n ? String.fromCharCode(code)\n : String.fromCharCode(((code -= 0x10000) >> 10) + 0xd800, (code % 0x400) + 0xdc00);\n }\n return elements;\n };\nvar fromEntries = \n// native\nhasNativeFromEntries\n ? Object.fromEntries\n : // Ponyfill\n function fromEntries(entries) {\n var obj = {};\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var _a = entries_1[_i], k = _a[0], v = _a[1];\n obj[k] = v;\n }\n return obj;\n };\nvar codePointAt = hasNativeCodePointAt\n ? // Native\n function codePointAt(s, index) {\n return s.codePointAt(index);\n }\n : // IE 11\n function codePointAt(s, index) {\n var size = s.length;\n if (index < 0 || index >= size) {\n return undefined;\n }\n var first = s.charCodeAt(index);\n var second;\n return first < 0xd800 ||\n first > 0xdbff ||\n index + 1 === size ||\n (second = s.charCodeAt(index + 1)) < 0xdc00 ||\n second > 0xdfff\n ? first\n : ((first - 0xd800) << 10) + (second - 0xdc00) + 0x10000;\n };\nvar trimStart = hasTrimStart\n ? // Native\n function trimStart(s) {\n return s.trimStart();\n }\n : // Ponyfill\n function trimStart(s) {\n return s.replace(SPACE_SEPARATOR_START_REGEX, '');\n };\nvar trimEnd = hasTrimEnd\n ? // Native\n function trimEnd(s) {\n return s.trimEnd();\n }\n : // Ponyfill\n function trimEnd(s) {\n return s.replace(SPACE_SEPARATOR_END_REGEX, '');\n };\n// Prevent minifier to translate new RegExp to literal form that might cause syntax error on IE11.\nfunction RE(s, flag) {\n return new RegExp(s, flag);\n}\n// #endregion\nvar matchIdentifierAtIndex;\nif (REGEX_SUPPORTS_U_AND_Y) {\n // Native\n var IDENTIFIER_PREFIX_RE_1 = RE('([^\\\\p{White_Space}\\\\p{Pattern_Syntax}]*)', 'yu');\n matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {\n var _a;\n IDENTIFIER_PREFIX_RE_1.lastIndex = index;\n var match = IDENTIFIER_PREFIX_RE_1.exec(s);\n return (_a = match[1]) !== null && _a !== void 0 ? _a : '';\n };\n}\nelse {\n // IE11\n matchIdentifierAtIndex = function matchIdentifierAtIndex(s, index) {\n var match = [];\n while (true) {\n var c = codePointAt(s, index);\n if (c === undefined || _isWhiteSpace(c) || _isPatternSyntax(c)) {\n break;\n }\n match.push(c);\n index += c >= 0x10000 ? 2 : 1;\n }\n return fromCodePoint.apply(void 0, match);\n };\n}\nvar Parser = /** @class */ (function () {\n function Parser(message, options) {\n if (options === void 0) { options = {}; }\n this.message = message;\n this.position = { offset: 0, line: 1, column: 1 };\n this.ignoreTag = !!options.ignoreTag;\n this.locale = options.locale;\n this.requiresOtherClause = !!options.requiresOtherClause;\n this.shouldParseSkeletons = !!options.shouldParseSkeletons;\n }\n Parser.prototype.parse = function () {\n if (this.offset() !== 0) {\n throw Error('parser can only be used once');\n }\n return this.parseMessage(0, '', false);\n };\n Parser.prototype.parseMessage = function (nestingLevel, parentArgType, expectingCloseTag) {\n var elements = [];\n while (!this.isEOF()) {\n var char = this.char();\n if (char === 123 /* `{` */) {\n var result = this.parseArgument(nestingLevel, expectingCloseTag);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n else if (char === 125 /* `}` */ && nestingLevel > 0) {\n break;\n }\n else if (char === 35 /* `#` */ &&\n (parentArgType === 'plural' || parentArgType === 'selectordinal')) {\n var position = this.clonePosition();\n this.bump();\n elements.push({\n type: TYPE.pound,\n location: createLocation(position, this.clonePosition()),\n });\n }\n else if (char === 60 /* `<` */ &&\n !this.ignoreTag &&\n this.peek() === 47 // char code for '/'\n ) {\n if (expectingCloseTag) {\n break;\n }\n else {\n return this.error(ErrorKind.UNMATCHED_CLOSING_TAG, createLocation(this.clonePosition(), this.clonePosition()));\n }\n }\n else if (char === 60 /* `<` */ &&\n !this.ignoreTag &&\n _isAlpha(this.peek() || 0)) {\n var result = this.parseTag(nestingLevel, parentArgType);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n else {\n var result = this.parseLiteral(nestingLevel, parentArgType);\n if (result.err) {\n return result;\n }\n elements.push(result.val);\n }\n }\n return { val: elements, err: null };\n };\n /**\n * A tag name must start with an ASCII lower/upper case letter. The grammar is based on the\n * [custom element name][] except that a dash is NOT always mandatory and uppercase letters\n * are accepted:\n *\n * ```\n * tag ::= \"<\" tagName (whitespace)* \"/>\" | \"<\" tagName (whitespace)* \">\" message \"\"\n * tagName ::= [a-z] (PENChar)*\n * PENChar ::=\n * \"-\" | \".\" | [0-9] | \"_\" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |\n * [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |\n * [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n * ```\n *\n * [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n * NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do\n * since other tag-based engines like React allow it\n */\n Parser.prototype.parseTag = function (nestingLevel, parentArgType) {\n var startPosition = this.clonePosition();\n this.bump(); // `<`\n var tagName = this.parseTagName();\n this.bumpSpace();\n if (this.bumpIf('/>')) {\n // Self closing tag\n return {\n val: {\n type: TYPE.literal,\n value: \"<\".concat(tagName, \"/>\"),\n location: createLocation(startPosition, this.clonePosition()),\n },\n err: null,\n };\n }\n else if (this.bumpIf('>')) {\n var childrenResult = this.parseMessage(nestingLevel + 1, parentArgType, true);\n if (childrenResult.err) {\n return childrenResult;\n }\n var children = childrenResult.val;\n // Expecting a close tag\n var endTagStartPosition = this.clonePosition();\n if (this.bumpIf('')) {\n return this.error(ErrorKind.INVALID_TAG, createLocation(endTagStartPosition, this.clonePosition()));\n }\n return {\n val: {\n type: TYPE.tag,\n value: tagName,\n children: children,\n location: createLocation(startPosition, this.clonePosition()),\n },\n err: null,\n };\n }\n else {\n return this.error(ErrorKind.UNCLOSED_TAG, createLocation(startPosition, this.clonePosition()));\n }\n }\n else {\n return this.error(ErrorKind.INVALID_TAG, createLocation(startPosition, this.clonePosition()));\n }\n };\n /**\n * This method assumes that the caller has peeked ahead for the first tag character.\n */\n Parser.prototype.parseTagName = function () {\n var startOffset = this.offset();\n this.bump(); // the first tag name character\n while (!this.isEOF() && _isPotentialElementNameChar(this.char())) {\n this.bump();\n }\n return this.message.slice(startOffset, this.offset());\n };\n Parser.prototype.parseLiteral = function (nestingLevel, parentArgType) {\n var start = this.clonePosition();\n var value = '';\n while (true) {\n var parseQuoteResult = this.tryParseQuote(parentArgType);\n if (parseQuoteResult) {\n value += parseQuoteResult;\n continue;\n }\n var parseUnquotedResult = this.tryParseUnquoted(nestingLevel, parentArgType);\n if (parseUnquotedResult) {\n value += parseUnquotedResult;\n continue;\n }\n var parseLeftAngleResult = this.tryParseLeftAngleBracket();\n if (parseLeftAngleResult) {\n value += parseLeftAngleResult;\n continue;\n }\n break;\n }\n var location = createLocation(start, this.clonePosition());\n return {\n val: { type: TYPE.literal, value: value, location: location },\n err: null,\n };\n };\n Parser.prototype.tryParseLeftAngleBracket = function () {\n if (!this.isEOF() &&\n this.char() === 60 /* `<` */ &&\n (this.ignoreTag ||\n // If at the opening tag or closing tag position, bail.\n !_isAlphaOrSlash(this.peek() || 0))) {\n this.bump(); // `<`\n return '<';\n }\n return null;\n };\n /**\n * Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes\n * a character that requires quoting (that is, \"only where needed\"), and works the same in\n * nested messages as on the top level of the pattern. The new behavior is otherwise compatible.\n */\n Parser.prototype.tryParseQuote = function (parentArgType) {\n if (this.isEOF() || this.char() !== 39 /* `'` */) {\n return null;\n }\n // Parse escaped char following the apostrophe, or early return if there is no escaped char.\n // Check if is valid escaped character\n switch (this.peek()) {\n case 39 /* `'` */:\n // double quote, should return as a single quote.\n this.bump();\n this.bump();\n return \"'\";\n // '{', '<', '>', '}'\n case 123:\n case 60:\n case 62:\n case 125:\n break;\n case 35: // '#'\n if (parentArgType === 'plural' || parentArgType === 'selectordinal') {\n break;\n }\n return null;\n default:\n return null;\n }\n this.bump(); // apostrophe\n var codePoints = [this.char()]; // escaped char\n this.bump();\n // read chars until the optional closing apostrophe is found\n while (!this.isEOF()) {\n var ch = this.char();\n if (ch === 39 /* `'` */) {\n if (this.peek() === 39 /* `'` */) {\n codePoints.push(39);\n // Bump one more time because we need to skip 2 characters.\n this.bump();\n }\n else {\n // Optional closing apostrophe.\n this.bump();\n break;\n }\n }\n else {\n codePoints.push(ch);\n }\n this.bump();\n }\n return fromCodePoint.apply(void 0, codePoints);\n };\n Parser.prototype.tryParseUnquoted = function (nestingLevel, parentArgType) {\n if (this.isEOF()) {\n return null;\n }\n var ch = this.char();\n if (ch === 60 /* `<` */ ||\n ch === 123 /* `{` */ ||\n (ch === 35 /* `#` */ &&\n (parentArgType === 'plural' || parentArgType === 'selectordinal')) ||\n (ch === 125 /* `}` */ && nestingLevel > 0)) {\n return null;\n }\n else {\n this.bump();\n return fromCodePoint(ch);\n }\n };\n Parser.prototype.parseArgument = function (nestingLevel, expectingCloseTag) {\n var openingBracePosition = this.clonePosition();\n this.bump(); // `{`\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n if (this.char() === 125 /* `}` */) {\n this.bump();\n return this.error(ErrorKind.EMPTY_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n // argument name\n var value = this.parseIdentifierIfPossible().value;\n if (!value) {\n return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n switch (this.char()) {\n // Simple argument: `{name}`\n case 125 /* `}` */: {\n this.bump(); // `}`\n return {\n val: {\n type: TYPE.argument,\n // value does not include the opening and closing braces.\n value: value,\n location: createLocation(openingBracePosition, this.clonePosition()),\n },\n err: null,\n };\n }\n // Argument with options: `{name, format, ...}`\n case 44 /* `,` */: {\n this.bump(); // `,`\n this.bumpSpace();\n if (this.isEOF()) {\n return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n return this.parseArgumentOptions(nestingLevel, expectingCloseTag, value, openingBracePosition);\n }\n default:\n return this.error(ErrorKind.MALFORMED_ARGUMENT, createLocation(openingBracePosition, this.clonePosition()));\n }\n };\n /**\n * Advance the parser until the end of the identifier, if it is currently on\n * an identifier character. Return an empty string otherwise.\n */\n Parser.prototype.parseIdentifierIfPossible = function () {\n var startingPosition = this.clonePosition();\n var startOffset = this.offset();\n var value = matchIdentifierAtIndex(this.message, startOffset);\n var endOffset = startOffset + value.length;\n this.bumpTo(endOffset);\n var endPosition = this.clonePosition();\n var location = createLocation(startingPosition, endPosition);\n return { value: value, location: location };\n };\n Parser.prototype.parseArgumentOptions = function (nestingLevel, expectingCloseTag, value, openingBracePosition) {\n var _a;\n // Parse this range:\n // {name, type, style}\n // ^---^\n var typeStartPosition = this.clonePosition();\n var argType = this.parseIdentifierIfPossible().value;\n var typeEndPosition = this.clonePosition();\n switch (argType) {\n case '':\n // Expecting a style string number, date, time, plural, selectordinal, or select.\n return this.error(ErrorKind.EXPECT_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));\n case 'number':\n case 'date':\n case 'time': {\n // Parse this range:\n // {name, number, style}\n // ^-------^\n this.bumpSpace();\n var styleAndLocation = null;\n if (this.bumpIf(',')) {\n this.bumpSpace();\n var styleStartPosition = this.clonePosition();\n var result = this.parseSimpleArgStyleIfPossible();\n if (result.err) {\n return result;\n }\n var style = trimEnd(result.val);\n if (style.length === 0) {\n return this.error(ErrorKind.EXPECT_ARGUMENT_STYLE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n var styleLocation = createLocation(styleStartPosition, this.clonePosition());\n styleAndLocation = { style: style, styleLocation: styleLocation };\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n var location_1 = createLocation(openingBracePosition, this.clonePosition());\n // Extract style or skeleton\n if (styleAndLocation && startsWith(styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style, '::', 0)) {\n // Skeleton starts with `::`.\n var skeleton = trimStart(styleAndLocation.style.slice(2));\n if (argType === 'number') {\n var result = this.parseNumberSkeletonFromString(skeleton, styleAndLocation.styleLocation);\n if (result.err) {\n return result;\n }\n return {\n val: { type: TYPE.number, value: value, location: location_1, style: result.val },\n err: null,\n };\n }\n else {\n if (skeleton.length === 0) {\n return this.error(ErrorKind.EXPECT_DATE_TIME_SKELETON, location_1);\n }\n var dateTimePattern = skeleton;\n // Get \"best match\" pattern only if locale is passed, if not, let it\n // pass as-is where `parseDateTimeSkeleton()` will throw an error\n // for unsupported patterns.\n if (this.locale) {\n dateTimePattern = getBestPattern(skeleton, this.locale);\n }\n var style = {\n type: SKELETON_TYPE.dateTime,\n pattern: dateTimePattern,\n location: styleAndLocation.styleLocation,\n parsedOptions: this.shouldParseSkeletons\n ? parseDateTimeSkeleton(dateTimePattern)\n : {},\n };\n var type = argType === 'date' ? TYPE.date : TYPE.time;\n return {\n val: { type: type, value: value, location: location_1, style: style },\n err: null,\n };\n }\n }\n // Regular style or no style.\n return {\n val: {\n type: argType === 'number'\n ? TYPE.number\n : argType === 'date'\n ? TYPE.date\n : TYPE.time,\n value: value,\n location: location_1,\n style: (_a = styleAndLocation === null || styleAndLocation === void 0 ? void 0 : styleAndLocation.style) !== null && _a !== void 0 ? _a : null,\n },\n err: null,\n };\n }\n case 'plural':\n case 'selectordinal':\n case 'select': {\n // Parse this range:\n // {name, plural, options}\n // ^---------^\n var typeEndPosition_1 = this.clonePosition();\n this.bumpSpace();\n if (!this.bumpIf(',')) {\n return this.error(ErrorKind.EXPECT_SELECT_ARGUMENT_OPTIONS, createLocation(typeEndPosition_1, __assign({}, typeEndPosition_1)));\n }\n this.bumpSpace();\n // Parse offset:\n // {name, plural, offset:1, options}\n // ^-----^\n //\n // or the first option:\n //\n // {name, plural, one {...} other {...}}\n // ^--^\n var identifierAndLocation = this.parseIdentifierIfPossible();\n var pluralOffset = 0;\n if (argType !== 'select' && identifierAndLocation.value === 'offset') {\n if (!this.bumpIf(':')) {\n return this.error(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n this.bumpSpace();\n var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, ErrorKind.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);\n if (result.err) {\n return result;\n }\n // Parse another identifier for option parsing\n this.bumpSpace();\n identifierAndLocation = this.parseIdentifierIfPossible();\n pluralOffset = result.val;\n }\n var optionsResult = this.tryParsePluralOrSelectOptions(nestingLevel, argType, expectingCloseTag, identifierAndLocation);\n if (optionsResult.err) {\n return optionsResult;\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n var location_2 = createLocation(openingBracePosition, this.clonePosition());\n if (argType === 'select') {\n return {\n val: {\n type: TYPE.select,\n value: value,\n options: fromEntries(optionsResult.val),\n location: location_2,\n },\n err: null,\n };\n }\n else {\n return {\n val: {\n type: TYPE.plural,\n value: value,\n options: fromEntries(optionsResult.val),\n offset: pluralOffset,\n pluralType: argType === 'plural' ? 'cardinal' : 'ordinal',\n location: location_2,\n },\n err: null,\n };\n }\n }\n default:\n return this.error(ErrorKind.INVALID_ARGUMENT_TYPE, createLocation(typeStartPosition, typeEndPosition));\n }\n };\n Parser.prototype.tryParseArgumentClose = function (openingBracePosition) {\n // Parse: {value, number, ::currency/GBP }\n //\n if (this.isEOF() || this.char() !== 125 /* `}` */) {\n return this.error(ErrorKind.EXPECT_ARGUMENT_CLOSING_BRACE, createLocation(openingBracePosition, this.clonePosition()));\n }\n this.bump(); // `}`\n return { val: true, err: null };\n };\n /**\n * See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659\n */\n Parser.prototype.parseSimpleArgStyleIfPossible = function () {\n var nestedBraces = 0;\n var startPosition = this.clonePosition();\n while (!this.isEOF()) {\n var ch = this.char();\n switch (ch) {\n case 39 /* `'` */: {\n // Treat apostrophe as quoting but include it in the style part.\n // Find the end of the quoted literal text.\n this.bump();\n var apostrophePosition = this.clonePosition();\n if (!this.bumpUntil(\"'\")) {\n return this.error(ErrorKind.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, createLocation(apostrophePosition, this.clonePosition()));\n }\n this.bump();\n break;\n }\n case 123 /* `{` */: {\n nestedBraces += 1;\n this.bump();\n break;\n }\n case 125 /* `}` */: {\n if (nestedBraces > 0) {\n nestedBraces -= 1;\n }\n else {\n return {\n val: this.message.slice(startPosition.offset, this.offset()),\n err: null,\n };\n }\n break;\n }\n default:\n this.bump();\n break;\n }\n }\n return {\n val: this.message.slice(startPosition.offset, this.offset()),\n err: null,\n };\n };\n Parser.prototype.parseNumberSkeletonFromString = function (skeleton, location) {\n var tokens = [];\n try {\n tokens = parseNumberSkeletonFromString(skeleton);\n }\n catch (e) {\n return this.error(ErrorKind.INVALID_NUMBER_SKELETON, location);\n }\n return {\n val: {\n type: SKELETON_TYPE.number,\n tokens: tokens,\n location: location,\n parsedOptions: this.shouldParseSkeletons\n ? parseNumberSkeleton(tokens)\n : {},\n },\n err: null,\n };\n };\n /**\n * @param nesting_level The current nesting level of messages.\n * This can be positive when parsing message fragment in select or plural argument options.\n * @param parent_arg_type The parent argument's type.\n * @param parsed_first_identifier If provided, this is the first identifier-like selector of\n * the argument. It is a by-product of a previous parsing attempt.\n * @param expecting_close_tag If true, this message is directly or indirectly nested inside\n * between a pair of opening and closing tags. The nested message will not parse beyond\n * the closing tag boundary.\n */\n Parser.prototype.tryParsePluralOrSelectOptions = function (nestingLevel, parentArgType, expectCloseTag, parsedFirstIdentifier) {\n var _a;\n var hasOtherClause = false;\n var options = [];\n var parsedSelectors = new Set();\n var selector = parsedFirstIdentifier.value, selectorLocation = parsedFirstIdentifier.location;\n // Parse:\n // one {one apple}\n // ^--^\n while (true) {\n if (selector.length === 0) {\n var startPosition = this.clonePosition();\n if (parentArgType !== 'select' && this.bumpIf('=')) {\n // Try parse `={number}` selector\n var result = this.tryParseDecimalInteger(ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, ErrorKind.INVALID_PLURAL_ARGUMENT_SELECTOR);\n if (result.err) {\n return result;\n }\n selectorLocation = createLocation(startPosition, this.clonePosition());\n selector = this.message.slice(startPosition.offset, this.offset());\n }\n else {\n break;\n }\n }\n // Duplicate selector clauses\n if (parsedSelectors.has(selector)) {\n return this.error(parentArgType === 'select'\n ? ErrorKind.DUPLICATE_SELECT_ARGUMENT_SELECTOR\n : ErrorKind.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, selectorLocation);\n }\n if (selector === 'other') {\n hasOtherClause = true;\n }\n // Parse:\n // one {one apple}\n // ^----------^\n this.bumpSpace();\n var openingBracePosition = this.clonePosition();\n if (!this.bumpIf('{')) {\n return this.error(parentArgType === 'select'\n ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT\n : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, createLocation(this.clonePosition(), this.clonePosition()));\n }\n var fragmentResult = this.parseMessage(nestingLevel + 1, parentArgType, expectCloseTag);\n if (fragmentResult.err) {\n return fragmentResult;\n }\n var argCloseResult = this.tryParseArgumentClose(openingBracePosition);\n if (argCloseResult.err) {\n return argCloseResult;\n }\n options.push([\n selector,\n {\n value: fragmentResult.val,\n location: createLocation(openingBracePosition, this.clonePosition()),\n },\n ]);\n // Keep track of the existing selectors\n parsedSelectors.add(selector);\n // Prep next selector clause.\n this.bumpSpace();\n (_a = this.parseIdentifierIfPossible(), selector = _a.value, selectorLocation = _a.location);\n }\n if (options.length === 0) {\n return this.error(parentArgType === 'select'\n ? ErrorKind.EXPECT_SELECT_ARGUMENT_SELECTOR\n : ErrorKind.EXPECT_PLURAL_ARGUMENT_SELECTOR, createLocation(this.clonePosition(), this.clonePosition()));\n }\n if (this.requiresOtherClause && !hasOtherClause) {\n return this.error(ErrorKind.MISSING_OTHER_CLAUSE, createLocation(this.clonePosition(), this.clonePosition()));\n }\n return { val: options, err: null };\n };\n Parser.prototype.tryParseDecimalInteger = function (expectNumberError, invalidNumberError) {\n var sign = 1;\n var startingPosition = this.clonePosition();\n if (this.bumpIf('+')) {\n }\n else if (this.bumpIf('-')) {\n sign = -1;\n }\n var hasDigits = false;\n var decimal = 0;\n while (!this.isEOF()) {\n var ch = this.char();\n if (ch >= 48 /* `0` */ && ch <= 57 /* `9` */) {\n hasDigits = true;\n decimal = decimal * 10 + (ch - 48);\n this.bump();\n }\n else {\n break;\n }\n }\n var location = createLocation(startingPosition, this.clonePosition());\n if (!hasDigits) {\n return this.error(expectNumberError, location);\n }\n decimal *= sign;\n if (!isSafeInteger(decimal)) {\n return this.error(invalidNumberError, location);\n }\n return { val: decimal, err: null };\n };\n Parser.prototype.offset = function () {\n return this.position.offset;\n };\n Parser.prototype.isEOF = function () {\n return this.offset() === this.message.length;\n };\n Parser.prototype.clonePosition = function () {\n // This is much faster than `Object.assign` or spread.\n return {\n offset: this.position.offset,\n line: this.position.line,\n column: this.position.column,\n };\n };\n /**\n * Return the code point at the current position of the parser.\n * Throws if the index is out of bound.\n */\n Parser.prototype.char = function () {\n var offset = this.position.offset;\n if (offset >= this.message.length) {\n throw Error('out of bound');\n }\n var code = codePointAt(this.message, offset);\n if (code === undefined) {\n throw Error(\"Offset \".concat(offset, \" is at invalid UTF-16 code unit boundary\"));\n }\n return code;\n };\n Parser.prototype.error = function (kind, location) {\n return {\n val: null,\n err: {\n kind: kind,\n message: this.message,\n location: location,\n },\n };\n };\n /** Bump the parser to the next UTF-16 code unit. */\n Parser.prototype.bump = function () {\n if (this.isEOF()) {\n return;\n }\n var code = this.char();\n if (code === 10 /* '\\n' */) {\n this.position.line += 1;\n this.position.column = 1;\n this.position.offset += 1;\n }\n else {\n this.position.column += 1;\n // 0 ~ 0x10000 -> unicode BMP, otherwise skip the surrogate pair.\n this.position.offset += code < 0x10000 ? 1 : 2;\n }\n };\n /**\n * If the substring starting at the current position of the parser has\n * the given prefix, then bump the parser to the character immediately\n * following the prefix and return true. Otherwise, don't bump the parser\n * and return false.\n */\n Parser.prototype.bumpIf = function (prefix) {\n if (startsWith(this.message, prefix, this.offset())) {\n for (var i = 0; i < prefix.length; i++) {\n this.bump();\n }\n return true;\n }\n return false;\n };\n /**\n * Bump the parser until the pattern character is found and return `true`.\n * Otherwise bump to the end of the file and return `false`.\n */\n Parser.prototype.bumpUntil = function (pattern) {\n var currentOffset = this.offset();\n var index = this.message.indexOf(pattern, currentOffset);\n if (index >= 0) {\n this.bumpTo(index);\n return true;\n }\n else {\n this.bumpTo(this.message.length);\n return false;\n }\n };\n /**\n * Bump the parser to the target offset.\n * If target offset is beyond the end of the input, bump the parser to the end of the input.\n */\n Parser.prototype.bumpTo = function (targetOffset) {\n if (this.offset() > targetOffset) {\n throw Error(\"targetOffset \".concat(targetOffset, \" must be greater than or equal to the current offset \").concat(this.offset()));\n }\n targetOffset = Math.min(targetOffset, this.message.length);\n while (true) {\n var offset = this.offset();\n if (offset === targetOffset) {\n break;\n }\n if (offset > targetOffset) {\n throw Error(\"targetOffset \".concat(targetOffset, \" is at invalid UTF-16 code unit boundary\"));\n }\n this.bump();\n if (this.isEOF()) {\n break;\n }\n }\n };\n /** advance the parser through all whitespace to the next non-whitespace code unit. */\n Parser.prototype.bumpSpace = function () {\n while (!this.isEOF() && _isWhiteSpace(this.char())) {\n this.bump();\n }\n };\n /**\n * Peek at the *next* Unicode codepoint in the input without advancing the parser.\n * If the input has been exhausted, then this returns null.\n */\n Parser.prototype.peek = function () {\n if (this.isEOF()) {\n return null;\n }\n var code = this.char();\n var offset = this.offset();\n var nextCode = this.message.charCodeAt(offset + (code >= 0x10000 ? 2 : 1));\n return nextCode !== null && nextCode !== void 0 ? nextCode : null;\n };\n return Parser;\n}());\nexport { Parser };\n/**\n * This check if codepoint is alphabet (lower & uppercase)\n * @param codepoint\n * @returns\n */\nfunction _isAlpha(codepoint) {\n return ((codepoint >= 97 && codepoint <= 122) ||\n (codepoint >= 65 && codepoint <= 90));\n}\nfunction _isAlphaOrSlash(codepoint) {\n return _isAlpha(codepoint) || codepoint === 47; /* '/' */\n}\n/** See `parseTag` function docs. */\nfunction _isPotentialElementNameChar(c) {\n return (c === 45 /* '-' */ ||\n c === 46 /* '.' */ ||\n (c >= 48 && c <= 57) /* 0..9 */ ||\n c === 95 /* '_' */ ||\n (c >= 97 && c <= 122) /** a..z */ ||\n (c >= 65 && c <= 90) /* A..Z */ ||\n c == 0xb7 ||\n (c >= 0xc0 && c <= 0xd6) ||\n (c >= 0xd8 && c <= 0xf6) ||\n (c >= 0xf8 && c <= 0x37d) ||\n (c >= 0x37f && c <= 0x1fff) ||\n (c >= 0x200c && c <= 0x200d) ||\n (c >= 0x203f && c <= 0x2040) ||\n (c >= 0x2070 && c <= 0x218f) ||\n (c >= 0x2c00 && c <= 0x2fef) ||\n (c >= 0x3001 && c <= 0xd7ff) ||\n (c >= 0xf900 && c <= 0xfdcf) ||\n (c >= 0xfdf0 && c <= 0xfffd) ||\n (c >= 0x10000 && c <= 0xeffff));\n}\n/**\n * Code point equivalent of regex `\\p{White_Space}`.\n * From: https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt\n */\nfunction _isWhiteSpace(c) {\n return ((c >= 0x0009 && c <= 0x000d) ||\n c === 0x0020 ||\n c === 0x0085 ||\n (c >= 0x200e && c <= 0x200f) ||\n c === 0x2028 ||\n c === 0x2029);\n}\n/**\n * Code point equivalent of regex `\\p{Pattern_Syntax}`.\n * See https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt\n */\nfunction _isPatternSyntax(c) {\n return ((c >= 0x0021 && c <= 0x0023) ||\n c === 0x0024 ||\n (c >= 0x0025 && c <= 0x0027) ||\n c === 0x0028 ||\n c === 0x0029 ||\n c === 0x002a ||\n c === 0x002b ||\n c === 0x002c ||\n c === 0x002d ||\n (c >= 0x002e && c <= 0x002f) ||\n (c >= 0x003a && c <= 0x003b) ||\n (c >= 0x003c && c <= 0x003e) ||\n (c >= 0x003f && c <= 0x0040) ||\n c === 0x005b ||\n c === 0x005c ||\n c === 0x005d ||\n c === 0x005e ||\n c === 0x0060 ||\n c === 0x007b ||\n c === 0x007c ||\n c === 0x007d ||\n c === 0x007e ||\n c === 0x00a1 ||\n (c >= 0x00a2 && c <= 0x00a5) ||\n c === 0x00a6 ||\n c === 0x00a7 ||\n c === 0x00a9 ||\n c === 0x00ab ||\n c === 0x00ac ||\n c === 0x00ae ||\n c === 0x00b0 ||\n c === 0x00b1 ||\n c === 0x00b6 ||\n c === 0x00bb ||\n c === 0x00bf ||\n c === 0x00d7 ||\n c === 0x00f7 ||\n (c >= 0x2010 && c <= 0x2015) ||\n (c >= 0x2016 && c <= 0x2017) ||\n c === 0x2018 ||\n c === 0x2019 ||\n c === 0x201a ||\n (c >= 0x201b && c <= 0x201c) ||\n c === 0x201d ||\n c === 0x201e ||\n c === 0x201f ||\n (c >= 0x2020 && c <= 0x2027) ||\n (c >= 0x2030 && c <= 0x2038) ||\n c === 0x2039 ||\n c === 0x203a ||\n (c >= 0x203b && c <= 0x203e) ||\n (c >= 0x2041 && c <= 0x2043) ||\n c === 0x2044 ||\n c === 0x2045 ||\n c === 0x2046 ||\n (c >= 0x2047 && c <= 0x2051) ||\n c === 0x2052 ||\n c === 0x2053 ||\n (c >= 0x2055 && c <= 0x205e) ||\n (c >= 0x2190 && c <= 0x2194) ||\n (c >= 0x2195 && c <= 0x2199) ||\n (c >= 0x219a && c <= 0x219b) ||\n (c >= 0x219c && c <= 0x219f) ||\n c === 0x21a0 ||\n (c >= 0x21a1 && c <= 0x21a2) ||\n c === 0x21a3 ||\n (c >= 0x21a4 && c <= 0x21a5) ||\n c === 0x21a6 ||\n (c >= 0x21a7 && c <= 0x21ad) ||\n c === 0x21ae ||\n (c >= 0x21af && c <= 0x21cd) ||\n (c >= 0x21ce && c <= 0x21cf) ||\n (c >= 0x21d0 && c <= 0x21d1) ||\n c === 0x21d2 ||\n c === 0x21d3 ||\n c === 0x21d4 ||\n (c >= 0x21d5 && c <= 0x21f3) ||\n (c >= 0x21f4 && c <= 0x22ff) ||\n (c >= 0x2300 && c <= 0x2307) ||\n c === 0x2308 ||\n c === 0x2309 ||\n c === 0x230a ||\n c === 0x230b ||\n (c >= 0x230c && c <= 0x231f) ||\n (c >= 0x2320 && c <= 0x2321) ||\n (c >= 0x2322 && c <= 0x2328) ||\n c === 0x2329 ||\n c === 0x232a ||\n (c >= 0x232b && c <= 0x237b) ||\n c === 0x237c ||\n (c >= 0x237d && c <= 0x239a) ||\n (c >= 0x239b && c <= 0x23b3) ||\n (c >= 0x23b4 && c <= 0x23db) ||\n (c >= 0x23dc && c <= 0x23e1) ||\n (c >= 0x23e2 && c <= 0x2426) ||\n (c >= 0x2427 && c <= 0x243f) ||\n (c >= 0x2440 && c <= 0x244a) ||\n (c >= 0x244b && c <= 0x245f) ||\n (c >= 0x2500 && c <= 0x25b6) ||\n c === 0x25b7 ||\n (c >= 0x25b8 && c <= 0x25c0) ||\n c === 0x25c1 ||\n (c >= 0x25c2 && c <= 0x25f7) ||\n (c >= 0x25f8 && c <= 0x25ff) ||\n (c >= 0x2600 && c <= 0x266e) ||\n c === 0x266f ||\n (c >= 0x2670 && c <= 0x2767) ||\n c === 0x2768 ||\n c === 0x2769 ||\n c === 0x276a ||\n c === 0x276b ||\n c === 0x276c ||\n c === 0x276d ||\n c === 0x276e ||\n c === 0x276f ||\n c === 0x2770 ||\n c === 0x2771 ||\n c === 0x2772 ||\n c === 0x2773 ||\n c === 0x2774 ||\n c === 0x2775 ||\n (c >= 0x2794 && c <= 0x27bf) ||\n (c >= 0x27c0 && c <= 0x27c4) ||\n c === 0x27c5 ||\n c === 0x27c6 ||\n (c >= 0x27c7 && c <= 0x27e5) ||\n c === 0x27e6 ||\n c === 0x27e7 ||\n c === 0x27e8 ||\n c === 0x27e9 ||\n c === 0x27ea ||\n c === 0x27eb ||\n c === 0x27ec ||\n c === 0x27ed ||\n c === 0x27ee ||\n c === 0x27ef ||\n (c >= 0x27f0 && c <= 0x27ff) ||\n (c >= 0x2800 && c <= 0x28ff) ||\n (c >= 0x2900 && c <= 0x2982) ||\n c === 0x2983 ||\n c === 0x2984 ||\n c === 0x2985 ||\n c === 0x2986 ||\n c === 0x2987 ||\n c === 0x2988 ||\n c === 0x2989 ||\n c === 0x298a ||\n c === 0x298b ||\n c === 0x298c ||\n c === 0x298d ||\n c === 0x298e ||\n c === 0x298f ||\n c === 0x2990 ||\n c === 0x2991 ||\n c === 0x2992 ||\n c === 0x2993 ||\n c === 0x2994 ||\n c === 0x2995 ||\n c === 0x2996 ||\n c === 0x2997 ||\n c === 0x2998 ||\n (c >= 0x2999 && c <= 0x29d7) ||\n c === 0x29d8 ||\n c === 0x29d9 ||\n c === 0x29da ||\n c === 0x29db ||\n (c >= 0x29dc && c <= 0x29fb) ||\n c === 0x29fc ||\n c === 0x29fd ||\n (c >= 0x29fe && c <= 0x2aff) ||\n (c >= 0x2b00 && c <= 0x2b2f) ||\n (c >= 0x2b30 && c <= 0x2b44) ||\n (c >= 0x2b45 && c <= 0x2b46) ||\n (c >= 0x2b47 && c <= 0x2b4c) ||\n (c >= 0x2b4d && c <= 0x2b73) ||\n (c >= 0x2b74 && c <= 0x2b75) ||\n (c >= 0x2b76 && c <= 0x2b95) ||\n c === 0x2b96 ||\n (c >= 0x2b97 && c <= 0x2bff) ||\n (c >= 0x2e00 && c <= 0x2e01) ||\n c === 0x2e02 ||\n c === 0x2e03 ||\n c === 0x2e04 ||\n c === 0x2e05 ||\n (c >= 0x2e06 && c <= 0x2e08) ||\n c === 0x2e09 ||\n c === 0x2e0a ||\n c === 0x2e0b ||\n c === 0x2e0c ||\n c === 0x2e0d ||\n (c >= 0x2e0e && c <= 0x2e16) ||\n c === 0x2e17 ||\n (c >= 0x2e18 && c <= 0x2e19) ||\n c === 0x2e1a ||\n c === 0x2e1b ||\n c === 0x2e1c ||\n c === 0x2e1d ||\n (c >= 0x2e1e && c <= 0x2e1f) ||\n c === 0x2e20 ||\n c === 0x2e21 ||\n c === 0x2e22 ||\n c === 0x2e23 ||\n c === 0x2e24 ||\n c === 0x2e25 ||\n c === 0x2e26 ||\n c === 0x2e27 ||\n c === 0x2e28 ||\n c === 0x2e29 ||\n (c >= 0x2e2a && c <= 0x2e2e) ||\n c === 0x2e2f ||\n (c >= 0x2e30 && c <= 0x2e39) ||\n (c >= 0x2e3a && c <= 0x2e3b) ||\n (c >= 0x2e3c && c <= 0x2e3f) ||\n c === 0x2e40 ||\n c === 0x2e41 ||\n c === 0x2e42 ||\n (c >= 0x2e43 && c <= 0x2e4f) ||\n (c >= 0x2e50 && c <= 0x2e51) ||\n c === 0x2e52 ||\n (c >= 0x2e53 && c <= 0x2e7f) ||\n (c >= 0x3001 && c <= 0x3003) ||\n c === 0x3008 ||\n c === 0x3009 ||\n c === 0x300a ||\n c === 0x300b ||\n c === 0x300c ||\n c === 0x300d ||\n c === 0x300e ||\n c === 0x300f ||\n c === 0x3010 ||\n c === 0x3011 ||\n (c >= 0x3012 && c <= 0x3013) ||\n c === 0x3014 ||\n c === 0x3015 ||\n c === 0x3016 ||\n c === 0x3017 ||\n c === 0x3018 ||\n c === 0x3019 ||\n c === 0x301a ||\n c === 0x301b ||\n c === 0x301c ||\n c === 0x301d ||\n (c >= 0x301e && c <= 0x301f) ||\n c === 0x3020 ||\n c === 0x3030 ||\n c === 0xfd3e ||\n c === 0xfd3f ||\n (c >= 0xfe45 && c <= 0xfe46));\n}\n//# sourceMappingURL=parser.js.map","import { __assign } from \"tslib\";\nimport { ErrorKind } from './error';\nimport { Parser } from './parser';\nimport { isDateElement, isDateTimeSkeleton, isNumberElement, isNumberSkeleton, isPluralElement, isSelectElement, isTagElement, isTimeElement, } from './types';\nfunction pruneLocation(els) {\n els.forEach(function (el) {\n delete el.location;\n if (isSelectElement(el) || isPluralElement(el)) {\n for (var k in el.options) {\n delete el.options[k].location;\n pruneLocation(el.options[k].value);\n }\n }\n else if (isNumberElement(el) && isNumberSkeleton(el.style)) {\n delete el.style.location;\n }\n else if ((isDateElement(el) || isTimeElement(el)) &&\n isDateTimeSkeleton(el.style)) {\n delete el.style.location;\n }\n else if (isTagElement(el)) {\n pruneLocation(el.children);\n }\n });\n}\nexport function parse(message, opts) {\n if (opts === void 0) { opts = {}; }\n opts = __assign({ shouldParseSkeletons: true, requiresOtherClause: true }, opts);\n var result = new Parser(message, opts).parse();\n if (result.err) {\n var error = SyntaxError(ErrorKind[result.err.kind]);\n // @ts-expect-error Assign to error object\n error.location = result.err.location;\n // @ts-expect-error Assign to error object\n error.originalMessage = result.err.message;\n throw error;\n }\n if (!(opts === null || opts === void 0 ? void 0 : opts.captureLocation)) {\n pruneLocation(result.val);\n }\n return result.val;\n}\nexport * from './types';\n// only for testing\nexport var _Parser = Parser;\n//# sourceMappingURL=index.js.map","import { __extends } from \"tslib\";\nexport var ErrorCode;\n(function (ErrorCode) {\n // When we have a placeholder but no value to format\n ErrorCode[\"MISSING_VALUE\"] = \"MISSING_VALUE\";\n // When value supplied is invalid\n ErrorCode[\"INVALID_VALUE\"] = \"INVALID_VALUE\";\n // When we need specific Intl API but it's not available\n ErrorCode[\"MISSING_INTL_API\"] = \"MISSING_INTL_API\";\n})(ErrorCode || (ErrorCode = {}));\nvar FormatError = /** @class */ (function (_super) {\n __extends(FormatError, _super);\n function FormatError(msg, code, originalMessage) {\n var _this = _super.call(this, msg) || this;\n _this.code = code;\n _this.originalMessage = originalMessage;\n return _this;\n }\n FormatError.prototype.toString = function () {\n return \"[formatjs Error: \".concat(this.code, \"] \").concat(this.message);\n };\n return FormatError;\n}(Error));\nexport { FormatError };\nvar InvalidValueError = /** @class */ (function (_super) {\n __extends(InvalidValueError, _super);\n function InvalidValueError(variableId, value, options, originalMessage) {\n return _super.call(this, \"Invalid values for \\\"\".concat(variableId, \"\\\": \\\"\").concat(value, \"\\\". Options are \\\"\").concat(Object.keys(options).join('\", \"'), \"\\\"\"), ErrorCode.INVALID_VALUE, originalMessage) || this;\n }\n return InvalidValueError;\n}(FormatError));\nexport { InvalidValueError };\nvar InvalidValueTypeError = /** @class */ (function (_super) {\n __extends(InvalidValueTypeError, _super);\n function InvalidValueTypeError(value, type, originalMessage) {\n return _super.call(this, \"Value for \\\"\".concat(value, \"\\\" must be of type \").concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;\n }\n return InvalidValueTypeError;\n}(FormatError));\nexport { InvalidValueTypeError };\nvar MissingValueError = /** @class */ (function (_super) {\n __extends(MissingValueError, _super);\n function MissingValueError(variableId, originalMessage) {\n return _super.call(this, \"The intl string context variable \\\"\".concat(variableId, \"\\\" was not provided to the string \\\"\").concat(originalMessage, \"\\\"\"), ErrorCode.MISSING_VALUE, originalMessage) || this;\n }\n return MissingValueError;\n}(FormatError));\nexport { MissingValueError };\n//# sourceMappingURL=error.js.map","import { isArgumentElement, isDateElement, isDateTimeSkeleton, isLiteralElement, isNumberElement, isNumberSkeleton, isPluralElement, isPoundElement, isSelectElement, isTagElement, isTimeElement, } from '@formatjs/icu-messageformat-parser';\nimport { ErrorCode, FormatError, InvalidValueError, InvalidValueTypeError, MissingValueError, } from './error';\nexport var PART_TYPE;\n(function (PART_TYPE) {\n PART_TYPE[PART_TYPE[\"literal\"] = 0] = \"literal\";\n PART_TYPE[PART_TYPE[\"object\"] = 1] = \"object\";\n})(PART_TYPE || (PART_TYPE = {}));\nfunction mergeLiteral(parts) {\n if (parts.length < 2) {\n return parts;\n }\n return parts.reduce(function (all, part) {\n var lastPart = all[all.length - 1];\n if (!lastPart ||\n lastPart.type !== PART_TYPE.literal ||\n part.type !== PART_TYPE.literal) {\n all.push(part);\n }\n else {\n lastPart.value += part.value;\n }\n return all;\n }, []);\n}\nexport function isFormatXMLElementFn(el) {\n return typeof el === 'function';\n}\n// TODO(skeleton): add skeleton support\nexport function formatToParts(els, locales, formatters, formats, values, currentPluralValue, \n// For debugging\noriginalMessage) {\n // Hot path for straight simple msg translations\n if (els.length === 1 && isLiteralElement(els[0])) {\n return [\n {\n type: PART_TYPE.literal,\n value: els[0].value,\n },\n ];\n }\n var result = [];\n for (var _i = 0, els_1 = els; _i < els_1.length; _i++) {\n var el = els_1[_i];\n // Exit early for string parts.\n if (isLiteralElement(el)) {\n result.push({\n type: PART_TYPE.literal,\n value: el.value,\n });\n continue;\n }\n // TODO: should this part be literal type?\n // Replace `#` in plural rules with the actual numeric value.\n if (isPoundElement(el)) {\n if (typeof currentPluralValue === 'number') {\n result.push({\n type: PART_TYPE.literal,\n value: formatters.getNumberFormat(locales).format(currentPluralValue),\n });\n }\n continue;\n }\n var varName = el.value;\n // Enforce that all required values are provided by the caller.\n if (!(values && varName in values)) {\n throw new MissingValueError(varName, originalMessage);\n }\n var value = values[varName];\n if (isArgumentElement(el)) {\n if (!value || typeof value === 'string' || typeof value === 'number') {\n value =\n typeof value === 'string' || typeof value === 'number'\n ? String(value)\n : '';\n }\n result.push({\n type: typeof value === 'string' ? PART_TYPE.literal : PART_TYPE.object,\n value: value,\n });\n continue;\n }\n // Recursively format plural and select parts' option — which can be a\n // nested pattern structure. The choosing of the option to use is\n // abstracted-by and delegated-to the part helper object.\n if (isDateElement(el)) {\n var style = typeof el.style === 'string'\n ? formats.date[el.style]\n : isDateTimeSkeleton(el.style)\n ? el.style.parsedOptions\n : undefined;\n result.push({\n type: PART_TYPE.literal,\n value: formatters\n .getDateTimeFormat(locales, style)\n .format(value),\n });\n continue;\n }\n if (isTimeElement(el)) {\n var style = typeof el.style === 'string'\n ? formats.time[el.style]\n : isDateTimeSkeleton(el.style)\n ? el.style.parsedOptions\n : formats.time.medium;\n result.push({\n type: PART_TYPE.literal,\n value: formatters\n .getDateTimeFormat(locales, style)\n .format(value),\n });\n continue;\n }\n if (isNumberElement(el)) {\n var style = typeof el.style === 'string'\n ? formats.number[el.style]\n : isNumberSkeleton(el.style)\n ? el.style.parsedOptions\n : undefined;\n if (style && style.scale) {\n value =\n value *\n (style.scale || 1);\n }\n result.push({\n type: PART_TYPE.literal,\n value: formatters\n .getNumberFormat(locales, style)\n .format(value),\n });\n continue;\n }\n if (isTagElement(el)) {\n var children = el.children, value_1 = el.value;\n var formatFn = values[value_1];\n if (!isFormatXMLElementFn(formatFn)) {\n throw new InvalidValueTypeError(value_1, 'function', originalMessage);\n }\n var parts = formatToParts(children, locales, formatters, formats, values, currentPluralValue);\n var chunks = formatFn(parts.map(function (p) { return p.value; }));\n if (!Array.isArray(chunks)) {\n chunks = [chunks];\n }\n result.push.apply(result, chunks.map(function (c) {\n return {\n type: typeof c === 'string' ? PART_TYPE.literal : PART_TYPE.object,\n value: c,\n };\n }));\n }\n if (isSelectElement(el)) {\n var opt = el.options[value] || el.options.other;\n if (!opt) {\n throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);\n }\n result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values));\n continue;\n }\n if (isPluralElement(el)) {\n var opt = el.options[\"=\".concat(value)];\n if (!opt) {\n if (!Intl.PluralRules) {\n throw new FormatError(\"Intl.PluralRules is not available in this environment.\\nTry polyfilling it using \\\"@formatjs/intl-pluralrules\\\"\\n\", ErrorCode.MISSING_INTL_API, originalMessage);\n }\n var rule = formatters\n .getPluralRules(locales, { type: el.pluralType })\n .select(value - (el.offset || 0));\n opt = el.options[rule] || el.options.other;\n }\n if (!opt) {\n throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);\n }\n result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values, value - (el.offset || 0)));\n continue;\n }\n }\n return mergeLiteral(result);\n}\n//# sourceMappingURL=formatters.js.map","/*\nCopyright (c) 2014, Yahoo! Inc. All rights reserved.\nCopyrights licensed under the New BSD License.\nSee the accompanying LICENSE file for terms.\n*/\nimport { __assign, __rest, __spreadArray } from \"tslib\";\nimport { memoize, strategies } from '@formatjs/fast-memoize';\nimport { parse, } from '@formatjs/icu-messageformat-parser';\nimport { formatToParts, PART_TYPE, } from './formatters';\n// -- MessageFormat --------------------------------------------------------\nfunction mergeConfig(c1, c2) {\n if (!c2) {\n return c1;\n }\n return __assign(__assign(__assign({}, (c1 || {})), (c2 || {})), Object.keys(c1).reduce(function (all, k) {\n all[k] = __assign(__assign({}, c1[k]), (c2[k] || {}));\n return all;\n }, {}));\n}\nfunction mergeConfigs(defaultConfig, configs) {\n if (!configs) {\n return defaultConfig;\n }\n return Object.keys(defaultConfig).reduce(function (all, k) {\n all[k] = mergeConfig(defaultConfig[k], configs[k]);\n return all;\n }, __assign({}, defaultConfig));\n}\nfunction createFastMemoizeCache(store) {\n return {\n create: function () {\n return {\n get: function (key) {\n return store[key];\n },\n set: function (key, value) {\n store[key] = value;\n },\n };\n },\n };\n}\nfunction createDefaultFormatters(cache) {\n if (cache === void 0) { cache = {\n number: {},\n dateTime: {},\n pluralRules: {},\n }; }\n return {\n getNumberFormat: memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.number),\n strategy: strategies.variadic,\n }),\n getDateTimeFormat: memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.dateTime),\n strategy: strategies.variadic,\n }),\n getPluralRules: memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.pluralRules),\n strategy: strategies.variadic,\n }),\n };\n}\nvar IntlMessageFormat = /** @class */ (function () {\n function IntlMessageFormat(message, locales, overrideFormats, opts) {\n if (locales === void 0) { locales = IntlMessageFormat.defaultLocale; }\n var _this = this;\n this.formatterCache = {\n number: {},\n dateTime: {},\n pluralRules: {},\n };\n this.format = function (values) {\n var parts = _this.formatToParts(values);\n // Hot path for straight simple msg translations\n if (parts.length === 1) {\n return parts[0].value;\n }\n var result = parts.reduce(function (all, part) {\n if (!all.length ||\n part.type !== PART_TYPE.literal ||\n typeof all[all.length - 1] !== 'string') {\n all.push(part.value);\n }\n else {\n all[all.length - 1] += part.value;\n }\n return all;\n }, []);\n if (result.length <= 1) {\n return result[0] || '';\n }\n return result;\n };\n this.formatToParts = function (values) {\n return formatToParts(_this.ast, _this.locales, _this.formatters, _this.formats, values, undefined, _this.message);\n };\n this.resolvedOptions = function () {\n var _a;\n return ({\n locale: ((_a = _this.resolvedLocale) === null || _a === void 0 ? void 0 : _a.toString()) ||\n Intl.NumberFormat.supportedLocalesOf(_this.locales)[0],\n });\n };\n this.getAst = function () { return _this.ast; };\n // Defined first because it's used to build the format pattern.\n this.locales = locales;\n this.resolvedLocale = IntlMessageFormat.resolveLocale(locales);\n if (typeof message === 'string') {\n this.message = message;\n if (!IntlMessageFormat.__parse) {\n throw new TypeError('IntlMessageFormat.__parse must be set to process `message` of type `string`');\n }\n var _a = opts || {}, formatters = _a.formatters, parseOpts = __rest(_a, [\"formatters\"]);\n // Parse string messages into an AST.\n this.ast = IntlMessageFormat.__parse(message, __assign(__assign({}, parseOpts), { locale: this.resolvedLocale }));\n }\n else {\n this.ast = message;\n }\n if (!Array.isArray(this.ast)) {\n throw new TypeError('A message must be provided as a String or AST.');\n }\n // Creates a new object with the specified `formats` merged with the default\n // formats.\n this.formats = mergeConfigs(IntlMessageFormat.formats, overrideFormats);\n this.formatters =\n (opts && opts.formatters) || createDefaultFormatters(this.formatterCache);\n }\n Object.defineProperty(IntlMessageFormat, \"defaultLocale\", {\n get: function () {\n if (!IntlMessageFormat.memoizedDefaultLocale) {\n IntlMessageFormat.memoizedDefaultLocale =\n new Intl.NumberFormat().resolvedOptions().locale;\n }\n return IntlMessageFormat.memoizedDefaultLocale;\n },\n enumerable: false,\n configurable: true\n });\n IntlMessageFormat.memoizedDefaultLocale = null;\n IntlMessageFormat.resolveLocale = function (locales) {\n if (typeof Intl.Locale === 'undefined') {\n return;\n }\n var supportedLocales = Intl.NumberFormat.supportedLocalesOf(locales);\n if (supportedLocales.length > 0) {\n return new Intl.Locale(supportedLocales[0]);\n }\n return new Intl.Locale(typeof locales === 'string' ? locales : locales[0]);\n };\n IntlMessageFormat.__parse = parse;\n // Default format options used as the prototype of the `formats` provided to the\n // constructor. These are used when constructing the internal Intl.NumberFormat\n // and Intl.DateTimeFormat instances.\n IntlMessageFormat.formats = {\n number: {\n integer: {\n maximumFractionDigits: 0,\n },\n currency: {\n style: 'currency',\n },\n percent: {\n style: 'percent',\n },\n },\n date: {\n short: {\n month: 'numeric',\n day: 'numeric',\n year: '2-digit',\n },\n medium: {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n },\n long: {\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n },\n full: {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n },\n },\n time: {\n short: {\n hour: 'numeric',\n minute: 'numeric',\n },\n medium: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n },\n long: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short',\n },\n full: {\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n timeZoneName: 'short',\n },\n },\n };\n return IntlMessageFormat;\n}());\nexport { IntlMessageFormat };\n//# sourceMappingURL=core.js.map","import { __extends } from \"tslib\";\nexport var IntlErrorCode;\n(function (IntlErrorCode) {\n IntlErrorCode[\"FORMAT_ERROR\"] = \"FORMAT_ERROR\";\n IntlErrorCode[\"UNSUPPORTED_FORMATTER\"] = \"UNSUPPORTED_FORMATTER\";\n IntlErrorCode[\"INVALID_CONFIG\"] = \"INVALID_CONFIG\";\n IntlErrorCode[\"MISSING_DATA\"] = \"MISSING_DATA\";\n IntlErrorCode[\"MISSING_TRANSLATION\"] = \"MISSING_TRANSLATION\";\n})(IntlErrorCode || (IntlErrorCode = {}));\nvar IntlError = /** @class */ (function (_super) {\n __extends(IntlError, _super);\n function IntlError(code, message, exception) {\n var _this = this;\n var err = exception\n ? exception instanceof Error\n ? exception\n : new Error(String(exception))\n : undefined;\n _this = _super.call(this, \"[@formatjs/intl Error \".concat(code, \"] \").concat(message, \"\\n\").concat(err ? \"\\n\".concat(err.message, \"\\n\").concat(err.stack) : '')) || this;\n _this.code = code;\n // @ts-ignore just so we don't need to declare dep on @types/node\n if (typeof Error.captureStackTrace === 'function') {\n // @ts-ignore just so we don't need to declare dep on @types/node\n Error.captureStackTrace(_this, IntlError);\n }\n return _this;\n }\n return IntlError;\n}(Error));\nexport { IntlError };\nvar UnsupportedFormatterError = /** @class */ (function (_super) {\n __extends(UnsupportedFormatterError, _super);\n function UnsupportedFormatterError(message, exception) {\n return _super.call(this, IntlErrorCode.UNSUPPORTED_FORMATTER, message, exception) || this;\n }\n return UnsupportedFormatterError;\n}(IntlError));\nexport { UnsupportedFormatterError };\nvar InvalidConfigError = /** @class */ (function (_super) {\n __extends(InvalidConfigError, _super);\n function InvalidConfigError(message, exception) {\n return _super.call(this, IntlErrorCode.INVALID_CONFIG, message, exception) || this;\n }\n return InvalidConfigError;\n}(IntlError));\nexport { InvalidConfigError };\nvar MissingDataError = /** @class */ (function (_super) {\n __extends(MissingDataError, _super);\n function MissingDataError(message, exception) {\n return _super.call(this, IntlErrorCode.MISSING_DATA, message, exception) || this;\n }\n return MissingDataError;\n}(IntlError));\nexport { MissingDataError };\nvar IntlFormatError = /** @class */ (function (_super) {\n __extends(IntlFormatError, _super);\n function IntlFormatError(message, locale, exception) {\n var _this = _super.call(this, IntlErrorCode.FORMAT_ERROR, \"\".concat(message, \"\\nLocale: \").concat(locale, \"\\n\"), exception) || this;\n _this.locale = locale;\n return _this;\n }\n return IntlFormatError;\n}(IntlError));\nexport { IntlFormatError };\nvar MessageFormatError = /** @class */ (function (_super) {\n __extends(MessageFormatError, _super);\n function MessageFormatError(message, locale, descriptor, exception) {\n var _this = _super.call(this, \"\".concat(message, \"\\nMessageID: \").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.id, \"\\nDefault Message: \").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage, \"\\nDescription: \").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.description, \"\\n\"), locale, exception) || this;\n _this.descriptor = descriptor;\n _this.locale = locale;\n return _this;\n }\n return MessageFormatError;\n}(IntlFormatError));\nexport { MessageFormatError };\nvar MissingTranslationError = /** @class */ (function (_super) {\n __extends(MissingTranslationError, _super);\n function MissingTranslationError(descriptor, locale) {\n var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, \"Missing message: \\\"\".concat(descriptor.id, \"\\\" for locale \\\"\").concat(locale, \"\\\", using \").concat(descriptor.defaultMessage\n ? \"default message (\".concat(typeof descriptor.defaultMessage === 'string'\n ? descriptor.defaultMessage\n : descriptor.defaultMessage\n .map(function (e) { var _a; return (_a = e.value) !== null && _a !== void 0 ? _a : JSON.stringify(e); })\n .join(), \")\")\n : 'id', \" as fallback.\")) || this;\n _this.descriptor = descriptor;\n return _this;\n }\n return MissingTranslationError;\n}(IntlError));\nexport { MissingTranslationError };\n//# sourceMappingURL=error.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { IntlMessageFormat } from 'intl-messageformat';\nimport { memoize, strategies } from '@formatjs/fast-memoize';\nimport { UnsupportedFormatterError } from './error';\nexport function filterProps(props, allowlist, defaults) {\n if (defaults === void 0) { defaults = {}; }\n return allowlist.reduce(function (filtered, name) {\n if (name in props) {\n filtered[name] = props[name];\n }\n else if (name in defaults) {\n filtered[name] = defaults[name];\n }\n return filtered;\n }, {});\n}\nvar defaultErrorHandler = function (error) {\n // @ts-ignore just so we don't need to declare dep on @types/node\n if (process.env.NODE_ENV !== 'production') {\n console.error(error);\n }\n};\nvar defaultWarnHandler = function (warning) {\n // @ts-ignore just so we don't need to declare dep on @types/node\n if (process.env.NODE_ENV !== 'production') {\n console.warn(warning);\n }\n};\nexport var DEFAULT_INTL_CONFIG = {\n formats: {},\n messages: {},\n timeZone: undefined,\n defaultLocale: 'en',\n defaultFormats: {},\n fallbackOnEmptyString: true,\n onError: defaultErrorHandler,\n onWarn: defaultWarnHandler,\n};\nexport function createIntlCache() {\n return {\n dateTime: {},\n number: {},\n message: {},\n relativeTime: {},\n pluralRules: {},\n list: {},\n displayNames: {},\n };\n}\nfunction createFastMemoizeCache(store) {\n return {\n create: function () {\n return {\n get: function (key) {\n return store[key];\n },\n set: function (key, value) {\n store[key] = value;\n },\n };\n },\n };\n}\n/**\n * Create intl formatters and populate cache\n * @param cache explicit cache to prevent leaking memory\n */\nexport function createFormatters(cache) {\n if (cache === void 0) { cache = createIntlCache(); }\n var RelativeTimeFormat = Intl.RelativeTimeFormat;\n var ListFormat = Intl.ListFormat;\n var DisplayNames = Intl.DisplayNames;\n var getDateTimeFormat = memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.dateTime),\n strategy: strategies.variadic,\n });\n var getNumberFormat = memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.number),\n strategy: strategies.variadic,\n });\n var getPluralRules = memoize(function () {\n var _a;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.pluralRules),\n strategy: strategies.variadic,\n });\n return {\n getDateTimeFormat: getDateTimeFormat,\n getNumberFormat: getNumberFormat,\n getMessageFormat: memoize(function (message, locales, overrideFormats, opts) {\n return new IntlMessageFormat(message, locales, overrideFormats, __assign({ formatters: {\n getNumberFormat: getNumberFormat,\n getDateTimeFormat: getDateTimeFormat,\n getPluralRules: getPluralRules,\n } }, (opts || {})));\n }, {\n cache: createFastMemoizeCache(cache.message),\n strategy: strategies.variadic,\n }),\n getRelativeTimeFormat: memoize(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.relativeTime),\n strategy: strategies.variadic,\n }),\n getPluralRules: getPluralRules,\n getListFormat: memoize(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.list),\n strategy: strategies.variadic,\n }),\n getDisplayNames: memoize(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args, false)))();\n }, {\n cache: createFastMemoizeCache(cache.displayNames),\n strategy: strategies.variadic,\n }),\n };\n}\nexport function getNamedFormat(formats, type, name, onError) {\n var formatType = formats && formats[type];\n var format;\n if (formatType) {\n format = formatType[name];\n }\n if (format) {\n return format;\n }\n onError(new UnsupportedFormatterError(\"No \".concat(type, \" format named: \").concat(name)));\n}\n//# sourceMappingURL=utils.js.map","import { __assign } from \"tslib\";\nimport { invariant } from '@formatjs/ecma402-abstract';\nimport { IntlMessageFormat, } from 'intl-messageformat';\nimport { MissingTranslationError, MessageFormatError } from './error';\nimport { TYPE } from '@formatjs/icu-messageformat-parser';\nfunction setTimeZoneInOptions(opts, timeZone) {\n return Object.keys(opts).reduce(function (all, k) {\n all[k] = __assign({ timeZone: timeZone }, opts[k]);\n return all;\n }, {});\n}\nfunction deepMergeOptions(opts1, opts2) {\n var keys = Object.keys(__assign(__assign({}, opts1), opts2));\n return keys.reduce(function (all, k) {\n all[k] = __assign(__assign({}, (opts1[k] || {})), (opts2[k] || {}));\n return all;\n }, {});\n}\nfunction deepMergeFormatsAndSetTimeZone(f1, timeZone) {\n if (!timeZone) {\n return f1;\n }\n var mfFormats = IntlMessageFormat.formats;\n return __assign(__assign(__assign({}, mfFormats), f1), { date: deepMergeOptions(setTimeZoneInOptions(mfFormats.date, timeZone), setTimeZoneInOptions(f1.date || {}, timeZone)), time: deepMergeOptions(setTimeZoneInOptions(mfFormats.time, timeZone), setTimeZoneInOptions(f1.time || {}, timeZone)) });\n}\nexport var formatMessage = function (_a, state, messageDescriptor, values, opts) {\n var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, fallbackOnEmptyString = _a.fallbackOnEmptyString, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;\n if (messageDescriptor === void 0) { messageDescriptor = { id: '' }; }\n var msgId = messageDescriptor.id, defaultMessage = messageDescriptor.defaultMessage;\n // `id` is a required field of a Message Descriptor.\n invariant(!!msgId, \"[@formatjs/intl] An `id` must be provided to format a message. You can either:\\n1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.io/docs/tooling/babel-plugin)\\nor [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer) OR\\n2. Configure your `eslint` config to include [eslint-plugin-formatjs](https://formatjs.io/docs/tooling/linter#enforce-id)\\nto autofix this issue\");\n var id = String(msgId);\n var message = \n // In case messages is Object.create(null)\n // e.g import('foo.json') from webpack)\n // See https://github.com/formatjs/formatjs/issues/1914\n messages &&\n Object.prototype.hasOwnProperty.call(messages, id) &&\n messages[id];\n // IMPORTANT: Hot path if `message` is AST with a single literal node\n if (Array.isArray(message) &&\n message.length === 1 &&\n message[0].type === TYPE.literal) {\n return message[0].value;\n }\n // IMPORTANT: Hot path straight lookup for performance\n if (!values &&\n message &&\n typeof message === 'string' &&\n !defaultRichTextElements) {\n return message.replace(/'\\{(.*?)\\}'/gi, \"{$1}\");\n }\n values = __assign(__assign({}, defaultRichTextElements), (values || {}));\n formats = deepMergeFormatsAndSetTimeZone(formats, timeZone);\n defaultFormats = deepMergeFormatsAndSetTimeZone(defaultFormats, timeZone);\n if (!message) {\n if (fallbackOnEmptyString === false && message === '') {\n return message;\n }\n if (!defaultMessage ||\n (locale && locale.toLowerCase() !== defaultLocale.toLowerCase())) {\n // This prevents warnings from littering the console in development\n // when no `messages` are passed into the for the\n // default locale.\n onError(new MissingTranslationError(messageDescriptor, locale));\n }\n if (defaultMessage) {\n try {\n var formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats, opts);\n return formatter.format(values);\n }\n catch (e) {\n onError(new MessageFormatError(\"Error formatting default message for: \\\"\".concat(id, \"\\\", rendering default message verbatim\"), locale, messageDescriptor, e));\n return typeof defaultMessage === 'string' ? defaultMessage : id;\n }\n }\n return id;\n }\n // We have the translated message\n try {\n var formatter = state.getMessageFormat(message, locale, formats, __assign({ formatters: state }, (opts || {})));\n return formatter.format(values);\n }\n catch (e) {\n onError(new MessageFormatError(\"Error formatting message: \\\"\".concat(id, \"\\\", using \").concat(defaultMessage ? 'default message' : 'id', \" as fallback.\"), locale, messageDescriptor, e));\n }\n if (defaultMessage) {\n try {\n var formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats, opts);\n return formatter.format(values);\n }\n catch (e) {\n onError(new MessageFormatError(\"Error formatting the default message for: \\\"\".concat(id, \"\\\", rendering message verbatim\"), locale, messageDescriptor, e));\n }\n }\n if (typeof message === 'string') {\n return message;\n }\n if (typeof defaultMessage === 'string') {\n return defaultMessage;\n }\n return id;\n};\n//# sourceMappingURL=message.js.map","import { __assign } from \"tslib\";\nimport { filterProps, getNamedFormat } from './utils';\nimport { IntlFormatError } from './error';\nvar DATE_TIME_FORMAT_OPTIONS = [\n 'formatMatcher',\n 'timeZone',\n 'hour12',\n 'weekday',\n 'era',\n 'year',\n 'month',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'timeZoneName',\n 'hourCycle',\n 'dateStyle',\n 'timeStyle',\n 'calendar',\n // 'dayPeriod',\n 'numberingSystem',\n 'fractionalSecondDigits',\n];\nexport function getFormatter(_a, type, getDateTimeFormat, options) {\n var locale = _a.locale, formats = _a.formats, onError = _a.onError, timeZone = _a.timeZone;\n if (options === void 0) { options = {}; }\n var format = options.format;\n var defaults = __assign(__assign({}, (timeZone && { timeZone: timeZone })), (format && getNamedFormat(formats, type, format, onError)));\n var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults);\n if (type === 'time' &&\n !filteredOptions.hour &&\n !filteredOptions.minute &&\n !filteredOptions.second &&\n !filteredOptions.timeStyle &&\n !filteredOptions.dateStyle) {\n // Add default formatting options if hour, minute, or second isn't defined.\n filteredOptions = __assign(__assign({}, filteredOptions), { hour: 'numeric', minute: 'numeric' });\n }\n return getDateTimeFormat(locale, filteredOptions);\n}\nexport function formatDate(config, getDateTimeFormat) {\n var _a = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n _a[_i - 2] = arguments[_i];\n }\n var value = _a[0], _b = _a[1], options = _b === void 0 ? {} : _b;\n var date = typeof value === 'string' ? new Date(value || 0) : value;\n try {\n return getFormatter(config, 'date', getDateTimeFormat, options).format(date);\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting date.', config.locale, e));\n }\n return String(date);\n}\nexport function formatTime(config, getDateTimeFormat) {\n var _a = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n _a[_i - 2] = arguments[_i];\n }\n var value = _a[0], _b = _a[1], options = _b === void 0 ? {} : _b;\n var date = typeof value === 'string' ? new Date(value || 0) : value;\n try {\n return getFormatter(config, 'time', getDateTimeFormat, options).format(date);\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting time.', config.locale, e));\n }\n return String(date);\n}\nexport function formatDateTimeRange(config, getDateTimeFormat) {\n var _a = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n _a[_i - 2] = arguments[_i];\n }\n var from = _a[0], to = _a[1], _b = _a[2], options = _b === void 0 ? {} : _b;\n var timeZone = config.timeZone, locale = config.locale, onError = config.onError;\n var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, timeZone ? { timeZone: timeZone } : {});\n try {\n return getDateTimeFormat(locale, filteredOptions).formatRange(from, to);\n }\n catch (e) {\n onError(new IntlFormatError('Error formatting date time range.', config.locale, e));\n }\n return String(from);\n}\nexport function formatDateToParts(config, getDateTimeFormat) {\n var _a = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n _a[_i - 2] = arguments[_i];\n }\n var value = _a[0], _b = _a[1], options = _b === void 0 ? {} : _b;\n var date = typeof value === 'string' ? new Date(value || 0) : value;\n try {\n return getFormatter(config, 'date', getDateTimeFormat, options).formatToParts(date); // TODO: remove this when https://github.com/microsoft/TypeScript/pull/50402 is merged\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting date.', config.locale, e));\n }\n return [];\n}\nexport function formatTimeToParts(config, getDateTimeFormat) {\n var _a = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n _a[_i - 2] = arguments[_i];\n }\n var value = _a[0], _b = _a[1], options = _b === void 0 ? {} : _b;\n var date = typeof value === 'string' ? new Date(value || 0) : value;\n try {\n return getFormatter(config, 'time', getDateTimeFormat, options).formatToParts(date); // TODO: remove this when https://github.com/microsoft/TypeScript/pull/50402 is merged\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting time.', config.locale, e));\n }\n return [];\n}\n//# sourceMappingURL=dateTime.js.map","import { filterProps } from './utils';\nimport { FormatError, ErrorCode } from 'intl-messageformat';\nimport { IntlFormatError } from './error';\nvar DISPLAY_NAMES_OPTONS = [\n 'style',\n 'type',\n 'fallback',\n 'languageDisplay',\n];\nexport function formatDisplayName(_a, getDisplayNames, value, options) {\n var locale = _a.locale, onError = _a.onError;\n var DisplayNames = Intl.DisplayNames;\n if (!DisplayNames) {\n onError(new FormatError(\"Intl.DisplayNames is not available in this environment.\\nTry polyfilling it using \\\"@formatjs/intl-displaynames\\\"\\n\", ErrorCode.MISSING_INTL_API));\n }\n var filteredOptions = filterProps(options, DISPLAY_NAMES_OPTONS);\n try {\n return getDisplayNames(locale, filteredOptions).of(value);\n }\n catch (e) {\n onError(new IntlFormatError('Error formatting display name.', locale, e));\n }\n}\n//# sourceMappingURL=displayName.js.map","import { __assign } from \"tslib\";\nimport { filterProps } from './utils';\nimport { FormatError, ErrorCode } from 'intl-messageformat';\nimport { IntlFormatError } from './error';\nvar LIST_FORMAT_OPTIONS = [\n 'type',\n 'style',\n];\nvar now = Date.now();\nfunction generateToken(i) {\n return \"\".concat(now, \"_\").concat(i, \"_\").concat(now);\n}\nexport function formatList(opts, getListFormat, values, options) {\n if (options === void 0) { options = {}; }\n var results = formatListToParts(opts, getListFormat, values, options).reduce(function (all, el) {\n var val = el.value;\n if (typeof val !== 'string') {\n all.push(val);\n }\n else if (typeof all[all.length - 1] === 'string') {\n all[all.length - 1] += val;\n }\n else {\n all.push(val);\n }\n return all;\n }, []);\n return results.length === 1 ? results[0] : results.length === 0 ? '' : results;\n}\nexport function formatListToParts(_a, getListFormat, values, options) {\n var locale = _a.locale, onError = _a.onError;\n if (options === void 0) { options = {}; }\n var ListFormat = Intl.ListFormat;\n if (!ListFormat) {\n onError(new FormatError(\"Intl.ListFormat is not available in this environment.\\nTry polyfilling it using \\\"@formatjs/intl-listformat\\\"\\n\", ErrorCode.MISSING_INTL_API));\n }\n var filteredOptions = filterProps(options, LIST_FORMAT_OPTIONS);\n try {\n var richValues_1 = {};\n var serializedValues = values.map(function (v, i) {\n if (typeof v === 'object') {\n var id = generateToken(i);\n richValues_1[id] = v;\n return id;\n }\n return String(v);\n });\n return getListFormat(locale, filteredOptions)\n .formatToParts(serializedValues)\n .map(function (part) {\n return part.type === 'literal'\n ? part\n : __assign(__assign({}, part), { value: richValues_1[part.value] || part.value });\n });\n }\n catch (e) {\n onError(new IntlFormatError('Error formatting list.', locale, e));\n }\n // @ts-ignore\n return values;\n}\n//# sourceMappingURL=list.js.map","import { filterProps } from './utils';\nimport { IntlFormatError } from './error';\nimport { ErrorCode, FormatError } from 'intl-messageformat';\nvar PLURAL_FORMAT_OPTIONS = ['type'];\nexport function formatPlural(_a, getPluralRules, value, options) {\n var locale = _a.locale, onError = _a.onError;\n if (options === void 0) { options = {}; }\n if (!Intl.PluralRules) {\n onError(new FormatError(\"Intl.PluralRules is not available in this environment.\\nTry polyfilling it using \\\"@formatjs/intl-pluralrules\\\"\\n\", ErrorCode.MISSING_INTL_API));\n }\n var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS);\n try {\n return getPluralRules(locale, filteredOptions).select(value);\n }\n catch (e) {\n onError(new IntlFormatError('Error formatting plural.', locale, e));\n }\n return 'other';\n}\n//# sourceMappingURL=plural.js.map","import { getNamedFormat, filterProps } from './utils';\nimport { FormatError, ErrorCode } from 'intl-messageformat';\nimport { IntlFormatError } from './error';\nvar RELATIVE_TIME_FORMAT_OPTIONS = ['numeric', 'style'];\nfunction getFormatter(_a, getRelativeTimeFormat, options) {\n var locale = _a.locale, formats = _a.formats, onError = _a.onError;\n if (options === void 0) { options = {}; }\n var format = options.format;\n var defaults = (!!format && getNamedFormat(formats, 'relative', format, onError)) || {};\n var filteredOptions = filterProps(options, RELATIVE_TIME_FORMAT_OPTIONS, defaults);\n return getRelativeTimeFormat(locale, filteredOptions);\n}\nexport function formatRelativeTime(config, getRelativeTimeFormat, value, unit, options) {\n if (options === void 0) { options = {}; }\n if (!unit) {\n unit = 'second';\n }\n var RelativeTimeFormat = Intl.RelativeTimeFormat;\n if (!RelativeTimeFormat) {\n config.onError(new FormatError(\"Intl.RelativeTimeFormat is not available in this environment.\\nTry polyfilling it using \\\"@formatjs/intl-relativetimeformat\\\"\\n\", ErrorCode.MISSING_INTL_API));\n }\n try {\n return getFormatter(config, getRelativeTimeFormat, options).format(value, unit);\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting relative time.', config.locale, e));\n }\n return String(value);\n}\n//# sourceMappingURL=relativeTime.js.map","import { IntlFormatError } from './error';\nimport { filterProps, getNamedFormat } from './utils';\nvar NUMBER_FORMAT_OPTIONS = [\n 'style',\n 'currency',\n 'unit',\n 'unitDisplay',\n 'useGrouping',\n 'minimumIntegerDigits',\n 'minimumFractionDigits',\n 'maximumFractionDigits',\n 'minimumSignificantDigits',\n 'maximumSignificantDigits',\n // ES2020 NumberFormat\n 'compactDisplay',\n 'currencyDisplay',\n 'currencySign',\n 'notation',\n 'signDisplay',\n 'unit',\n 'unitDisplay',\n 'numberingSystem',\n // ES2023 NumberFormat\n 'trailingZeroDisplay',\n 'roundingPriority',\n 'roundingIncrement',\n 'roundingMode',\n];\nexport function getFormatter(_a, getNumberFormat, options) {\n var locale = _a.locale, formats = _a.formats, onError = _a.onError;\n if (options === void 0) { options = {}; }\n var format = options.format;\n var defaults = ((format &&\n getNamedFormat(formats, 'number', format, onError)) ||\n {});\n var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults);\n return getNumberFormat(locale, filteredOptions);\n}\nexport function formatNumber(config, getNumberFormat, value, options) {\n if (options === void 0) { options = {}; }\n try {\n return getFormatter(config, getNumberFormat, options).format(value);\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting number.', config.locale, e));\n }\n return String(value);\n}\nexport function formatNumberToParts(config, getNumberFormat, value, options) {\n if (options === void 0) { options = {}; }\n try {\n return getFormatter(config, getNumberFormat, options).formatToParts(value);\n }\n catch (e) {\n config.onError(new IntlFormatError('Error formatting number.', config.locale, e));\n }\n return [];\n}\n//# sourceMappingURL=number.js.map","import { __assign } from \"tslib\";\nimport { createFormatters, DEFAULT_INTL_CONFIG } from './utils';\nimport { InvalidConfigError, MissingDataError } from './error';\nimport { formatNumber, formatNumberToParts } from './number';\nimport { formatRelativeTime } from './relativeTime';\nimport { formatDate, formatDateToParts, formatTime, formatTimeToParts, formatDateTimeRange, } from './dateTime';\nimport { formatPlural } from './plural';\nimport { formatMessage } from './message';\nimport { formatList, formatListToParts } from './list';\nimport { formatDisplayName } from './displayName';\nfunction messagesContainString(messages) {\n var firstMessage = messages ? messages[Object.keys(messages)[0]] : undefined;\n return typeof firstMessage === 'string';\n}\nfunction verifyConfigMessages(config) {\n if (config.onWarn &&\n config.defaultRichTextElements &&\n messagesContainString(config.messages || {})) {\n config.onWarn(\"[@formatjs/intl] \\\"defaultRichTextElements\\\" was specified but \\\"message\\\" was not pre-compiled. \\nPlease consider using \\\"@formatjs/cli\\\" to pre-compile your messages for performance.\\nFor more details see https://formatjs.io/docs/getting-started/message-distribution\");\n }\n}\n/**\n * Create intl object\n * @param config intl config\n * @param cache cache for formatter instances to prevent memory leak\n */\nexport function createIntl(config, cache) {\n var formatters = createFormatters(cache);\n var resolvedConfig = __assign(__assign({}, DEFAULT_INTL_CONFIG), config);\n var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;\n if (!locale) {\n if (onError) {\n onError(new InvalidConfigError(\"\\\"locale\\\" was not configured, using \\\"\".concat(defaultLocale, \"\\\" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details\")));\n }\n // Since there's no registered locale data for `locale`, this will\n // fallback to the `defaultLocale` to make sure things can render.\n // The `messages` are overridden to the `defaultProps` empty object\n // to maintain referential equality across re-renders. It's assumed\n // each contains a `defaultMessage` prop.\n resolvedConfig.locale = resolvedConfig.defaultLocale || 'en';\n }\n else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) {\n onError(new MissingDataError(\"Missing locale data for locale: \\\"\".concat(locale, \"\\\" in Intl.NumberFormat. Using default locale: \\\"\").concat(defaultLocale, \"\\\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details\")));\n }\n else if (!Intl.DateTimeFormat.supportedLocalesOf(locale).length &&\n onError) {\n onError(new MissingDataError(\"Missing locale data for locale: \\\"\".concat(locale, \"\\\" in Intl.DateTimeFormat. Using default locale: \\\"\").concat(defaultLocale, \"\\\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details\")));\n }\n verifyConfigMessages(resolvedConfig);\n return __assign(__assign({}, resolvedConfig), { formatters: formatters, formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), \n // @ts-expect-error TODO: will get to this later\n formatMessage: formatMessage.bind(null, resolvedConfig, formatters), \n // @ts-expect-error TODO: will get to this later\n $t: formatMessage.bind(null, resolvedConfig, formatters), formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat), formatListToParts: formatListToParts.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });\n}\n//# sourceMappingURL=create-intl.js.map","import { __assign } from \"tslib\";\nimport * as React from 'react';\nimport { invariant } from '@formatjs/ecma402-abstract';\nimport { DEFAULT_INTL_CONFIG as CORE_DEFAULT_INTL_CONFIG } from '@formatjs/intl';\nexport function invariantIntlContext(intl) {\n invariant(intl, '[React Intl] Could not find required `intl` object. ' +\n ' needs to exist in the component ancestry.');\n}\nexport var DEFAULT_INTL_CONFIG = __assign(__assign({}, CORE_DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });\n/**\n * Takes a `formatXMLElementFn`, and composes it in function, which passes\n * argument `parts` through, assigning unique key to each part, to prevent\n * \"Each child in a list should have a unique \"key\"\" React error.\n * @param formatXMLElementFn\n */\nexport function assignUniqueKeysToParts(formatXMLElementFn) {\n return function (parts) {\n // eslint-disable-next-line prefer-rest-params\n return formatXMLElementFn(React.Children.toArray(parts));\n };\n}\nexport function shallowEqual(objA, objB) {\n if (objA === objB) {\n return true;\n }\n if (!objA || !objB) {\n return false;\n }\n var aKeys = Object.keys(objA);\n var bKeys = Object.keys(objB);\n var len = aKeys.length;\n if (bKeys.length !== len) {\n return false;\n }\n for (var i = 0; i < len; i++) {\n var key = aKeys[i];\n if (objA[key] !== objB[key] ||\n !Object.prototype.hasOwnProperty.call(objB, key)) {\n return false;\n }\n }\n return true;\n}\n//# sourceMappingURL=utils.js.map","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n};\nvar KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n};\nvar FORWARD_REF_STATICS = {\n '$$typeof': true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true\n};\nvar MEMO_STATICS = {\n '$$typeof': true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\n\nfunction getStatics(component) {\n // React v16.11 and below\n if (reactIs.isMemo(component)) {\n return MEMO_STATICS;\n } // React v16.12 and above\n\n\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\n\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n\n var keys = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n var targetStatics = getStatics(targetComponent);\n var sourceStatics = getStatics(sourceComponent);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n }\n\n return targetComponent;\n}\n\nmodule.exports = hoistNonReactStatics;\n","import { __assign } from \"tslib\";\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport * as React from 'react';\nimport { invariantIntlContext } from '../utils';\nfunction getDisplayName(Component) {\n return Component.displayName || Component.name || 'Component';\n}\n// This is primarily dealing with packaging systems where multiple copies of react-intl\n// might exist\nvar IntlContext = typeof window !== 'undefined' && !window.__REACT_INTL_BYPASS_GLOBAL_CONTEXT__\n ? window.__REACT_INTL_CONTEXT__ ||\n (window.__REACT_INTL_CONTEXT__ = React.createContext(null))\n : React.createContext(null);\nvar IntlConsumer = IntlContext.Consumer, IntlProvider = IntlContext.Provider;\nexport var Provider = IntlProvider;\nexport var Context = IntlContext;\nexport default function injectIntl(WrappedComponent, options) {\n var _a = options || {}, _b = _a.intlPropName, intlPropName = _b === void 0 ? 'intl' : _b, _c = _a.forwardRef, forwardRef = _c === void 0 ? false : _c, _d = _a.enforceContext, enforceContext = _d === void 0 ? true : _d;\n var WithIntl = function (props) { return (React.createElement(IntlConsumer, null, function (intl) {\n var _a;\n if (enforceContext) {\n invariantIntlContext(intl);\n }\n var intlProp = (_a = {}, _a[intlPropName] = intl, _a);\n return (React.createElement(WrappedComponent, __assign({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null })));\n })); };\n WithIntl.displayName = \"injectIntl(\".concat(getDisplayName(WrappedComponent), \")\");\n WithIntl.WrappedComponent = WrappedComponent;\n if (forwardRef) {\n return hoistNonReactStatics(\n // @ts-expect-error\n React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, __assign({}, props, { forwardedRef: ref }))); }), WrappedComponent);\n }\n return hoistNonReactStatics(WithIntl, WrappedComponent);\n}\n//# sourceMappingURL=injectIntl.js.map","import * as React from 'react';\nimport { invariantIntlContext } from '../utils';\nimport { Context } from './injectIntl';\nexport default function useIntl() {\n var intl = React.useContext(Context);\n invariantIntlContext(intl);\n return intl;\n}\n//# sourceMappingURL=useIntl.js.map","import { __rest } from \"tslib\";\nimport * as React from 'react';\nimport useIntl from './useIntl';\nvar DisplayName;\n(function (DisplayName) {\n DisplayName[\"formatDate\"] = \"FormattedDate\";\n DisplayName[\"formatTime\"] = \"FormattedTime\";\n DisplayName[\"formatNumber\"] = \"FormattedNumber\";\n DisplayName[\"formatList\"] = \"FormattedList\";\n // Note that this DisplayName is the locale display name, not to be confused with\n // the name of the enum, which is for React component display name in dev tools.\n DisplayName[\"formatDisplayName\"] = \"FormattedDisplayName\";\n})(DisplayName || (DisplayName = {}));\nvar DisplayNameParts;\n(function (DisplayNameParts) {\n DisplayNameParts[\"formatDate\"] = \"FormattedDateParts\";\n DisplayNameParts[\"formatTime\"] = \"FormattedTimeParts\";\n DisplayNameParts[\"formatNumber\"] = \"FormattedNumberParts\";\n DisplayNameParts[\"formatList\"] = \"FormattedListParts\";\n})(DisplayNameParts || (DisplayNameParts = {}));\nexport var FormattedNumberParts = function (props) {\n var intl = useIntl();\n var value = props.value, children = props.children, formatProps = __rest(props, [\"value\", \"children\"]);\n return children(intl.formatNumberToParts(value, formatProps));\n};\nFormattedNumberParts.displayName = 'FormattedNumberParts';\nexport var FormattedListParts = function (props) {\n var intl = useIntl();\n var value = props.value, children = props.children, formatProps = __rest(props, [\"value\", \"children\"]);\n return children(intl.formatListToParts(value, formatProps));\n};\nFormattedNumberParts.displayName = 'FormattedNumberParts';\nexport function createFormattedDateTimePartsComponent(name) {\n var ComponentParts = function (props) {\n var intl = useIntl();\n var value = props.value, children = props.children, formatProps = __rest(props, [\"value\", \"children\"]);\n var date = typeof value === 'string' ? new Date(value || 0) : value;\n var formattedParts = name === 'formatDate'\n ? intl.formatDateToParts(date, formatProps)\n : intl.formatTimeToParts(date, formatProps);\n return children(formattedParts);\n };\n ComponentParts.displayName = DisplayNameParts[name];\n return ComponentParts;\n}\nexport function createFormattedComponent(name) {\n var Component = function (props) {\n var intl = useIntl();\n var value = props.value, children = props.children, formatProps = __rest(props\n // TODO: fix TS type definition for localeMatcher upstream\n , [\"value\", \"children\"]);\n // TODO: fix TS type definition for localeMatcher upstream\n var formattedValue = intl[name](value, formatProps);\n if (typeof children === 'function') {\n return children(formattedValue);\n }\n var Text = intl.textComponent || React.Fragment;\n return React.createElement(Text, null, formattedValue);\n };\n Component.displayName = DisplayName[name];\n return Component;\n}\n//# sourceMappingURL=createFormattedComponent.js.map","/*\n * Copyright 2015, Yahoo Inc.\n * Copyrights licensed under the New BSD License.\n * See the accompanying LICENSE file for terms.\n */\nimport { __assign, __rest, __spreadArray } from \"tslib\";\nimport { createIntl as coreCreateIntl, formatMessage as coreFormatMessage, } from '@formatjs/intl';\nimport * as React from 'react';\nimport { DEFAULT_INTL_CONFIG, assignUniqueKeysToParts } from '../utils';\nimport { isFormatXMLElementFn, } from 'intl-messageformat';\nfunction assignUniqueKeysToFormatXMLElementFnArgument(values) {\n if (!values) {\n return values;\n }\n return Object.keys(values).reduce(function (acc, k) {\n var v = values[k];\n acc[k] = isFormatXMLElementFn(v)\n ? assignUniqueKeysToParts(v)\n : v;\n return acc;\n }, {});\n}\nvar formatMessage = function (config, formatters, descriptor, rawValues) {\n var rest = [];\n for (var _i = 4; _i < arguments.length; _i++) {\n rest[_i - 4] = arguments[_i];\n }\n var values = assignUniqueKeysToFormatXMLElementFnArgument(rawValues);\n var chunks = coreFormatMessage.apply(void 0, __spreadArray([config,\n formatters,\n descriptor,\n values], rest, false));\n if (Array.isArray(chunks)) {\n return React.Children.toArray(chunks);\n }\n return chunks;\n};\n/**\n * Create intl object\n * @param config intl config\n * @param cache cache for formatter instances to prevent memory leak\n */\nexport var createIntl = function (_a, cache) {\n var rawDefaultRichTextElements = _a.defaultRichTextElements, config = __rest(_a, [\"defaultRichTextElements\"]);\n var defaultRichTextElements = assignUniqueKeysToFormatXMLElementFnArgument(rawDefaultRichTextElements);\n var coreIntl = coreCreateIntl(__assign(__assign(__assign({}, DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache);\n var resolvedConfig = {\n locale: coreIntl.locale,\n timeZone: coreIntl.timeZone,\n fallbackOnEmptyString: coreIntl.fallbackOnEmptyString,\n formats: coreIntl.formats,\n defaultLocale: coreIntl.defaultLocale,\n defaultFormats: coreIntl.defaultFormats,\n messages: coreIntl.messages,\n onError: coreIntl.onError,\n defaultRichTextElements: defaultRichTextElements,\n };\n return __assign(__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig, \n // @ts-expect-error fix this\n coreIntl.formatters), \n // @ts-expect-error fix this\n $t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });\n};\n//# sourceMappingURL=createIntl.js.map","/*\n * Copyright 2015, Yahoo Inc.\n * Copyrights licensed under the New BSD License.\n * See the accompanying LICENSE file for terms.\n */\nimport { __extends } from \"tslib\";\nimport { createIntlCache } from '@formatjs/intl';\nimport * as React from 'react';\nimport { DEFAULT_INTL_CONFIG, invariantIntlContext, shallowEqual } from '../utils';\nimport { Provider } from './injectIntl';\nimport { createIntl } from './createIntl';\nfunction processIntlConfig(config) {\n return {\n locale: config.locale,\n timeZone: config.timeZone,\n fallbackOnEmptyString: config.fallbackOnEmptyString,\n formats: config.formats,\n textComponent: config.textComponent,\n messages: config.messages,\n defaultLocale: config.defaultLocale,\n defaultFormats: config.defaultFormats,\n onError: config.onError,\n onWarn: config.onWarn,\n wrapRichTextChunksInFragment: config.wrapRichTextChunksInFragment,\n defaultRichTextElements: config.defaultRichTextElements,\n };\n}\nvar IntlProvider = /** @class */ (function (_super) {\n __extends(IntlProvider, _super);\n function IntlProvider() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.cache = createIntlCache();\n _this.state = {\n cache: _this.cache,\n intl: createIntl(processIntlConfig(_this.props), _this.cache),\n prevConfig: processIntlConfig(_this.props),\n };\n return _this;\n }\n IntlProvider.getDerivedStateFromProps = function (props, _a) {\n var prevConfig = _a.prevConfig, cache = _a.cache;\n var config = processIntlConfig(props);\n if (!shallowEqual(prevConfig, config)) {\n return {\n intl: createIntl(config, cache),\n prevConfig: config,\n };\n }\n return null;\n };\n IntlProvider.prototype.render = function () {\n invariantIntlContext(this.state.intl);\n return React.createElement(Provider, { value: this.state.intl }, this.props.children);\n };\n IntlProvider.displayName = 'IntlProvider';\n IntlProvider.defaultProps = DEFAULT_INTL_CONFIG;\n return IntlProvider;\n}(React.PureComponent));\nexport default IntlProvider;\n//# sourceMappingURL=provider.js.map","/*\n * Copyright 2015, Yahoo Inc.\n * Copyrights licensed under the New BSD License.\n * See the accompanying LICENSE file for terms.\n */\nimport { __rest } from \"tslib\";\nimport * as React from 'react';\nimport { shallowEqual } from '../utils';\nimport useIntl from './useIntl';\nfunction areEqual(prevProps, nextProps) {\n var values = prevProps.values, otherProps = __rest(prevProps, [\"values\"]);\n var nextValues = nextProps.values, nextOtherProps = __rest(nextProps, [\"values\"]);\n return (shallowEqual(nextValues, values) &&\n shallowEqual(otherProps, nextOtherProps));\n}\nfunction FormattedMessage(props) {\n var intl = useIntl();\n var formatMessage = intl.formatMessage, _a = intl.textComponent, Text = _a === void 0 ? React.Fragment : _a;\n var id = props.id, description = props.description, defaultMessage = props.defaultMessage, values = props.values, children = props.children, _b = props.tagName, Component = _b === void 0 ? Text : _b, ignoreTag = props.ignoreTag;\n var descriptor = { id: id, description: description, defaultMessage: defaultMessage };\n var nodes = formatMessage(descriptor, values, {\n ignoreTag: ignoreTag,\n });\n if (typeof children === 'function') {\n return children(Array.isArray(nodes) ? nodes : [nodes]);\n }\n if (Component) {\n return React.createElement(Component, null, React.Children.toArray(nodes));\n }\n return React.createElement(React.Fragment, null, nodes);\n}\nFormattedMessage.displayName = 'FormattedMessage';\nvar MemoizedFormattedMessage = React.memo(FormattedMessage, areEqual);\nMemoizedFormattedMessage.displayName = 'MemoizedFormattedMessage';\nexport default MemoizedFormattedMessage;\n//# sourceMappingURL=message.js.map","import { createFormattedComponent, createFormattedDateTimePartsComponent, } from './src/components/createFormattedComponent';\nimport injectIntl, { Provider as RawIntlProvider, Context as IntlContext, } from './src/components/injectIntl';\nimport useIntl from './src/components/useIntl';\nimport IntlProvider from './src/components/provider';\nimport { createIntl } from './src/components/createIntl';\nimport FormattedRelativeTime from './src/components/relative';\nimport FormattedPlural from './src/components/plural';\nimport FormattedMessage from './src/components/message';\nimport FormattedDateTimeRange from './src/components/dateTimeRange';\nexport { FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, IntlContext, IntlProvider, RawIntlProvider, createIntl, injectIntl, useIntl, };\nexport { createIntlCache, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode as ReactIntlErrorCode, IntlError as ReactIntlError, } from '@formatjs/intl';\nexport function defineMessages(msgs) {\n return msgs;\n}\nexport function defineMessage(msg) {\n return msg;\n}\n// IMPORTANT: Explicit here to prevent api-extractor from outputing `import('./src/types').CustomFormatConfig`\nexport var FormattedDate = createFormattedComponent('formatDate');\nexport var FormattedTime = createFormattedComponent('formatTime');\nexport var FormattedNumber = createFormattedComponent('formatNumber');\nexport var FormattedList = createFormattedComponent('formatList');\nexport var FormattedDisplayName = createFormattedComponent('formatDisplayName');\nexport var FormattedDateParts = createFormattedDateTimePartsComponent('formatDate');\nexport var FormattedTimeParts = createFormattedDateTimePartsComponent('formatTime');\nexport { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent';\n//# sourceMappingURL=index.js.map","import React, { useState, useEffect } from \"react\";\nimport { FileUploader } from \"react-drag-drop-files\";\nimport JSZip from \"jszip\";\nimport { useIntl } from 'react-intl';\n\nfunction stripPath(filename) {\n return filename.substring(filename.lastIndexOf(\"/\") + 1, filename.length);\n}\n\nconst fileTypes = [\"txt\", \"zip\", \"json\"];\n\nconst getFileFormat = (filename) => {\n // Ignore MacOS system files\n if (filename.substring(0, 8) === \"__MACOSX\") {\n return;\n }\n const fileName = filename.toLowerCase();\n if (fileName.endsWith(\".txt\") || fileName.endsWith(\".json\")) {\n return \"chat\";\n } else if (fileName.endsWith(\".zip\")) {\n return \"zip\";\n } else if (fileName.endsWith(\".jpg\") || fileName.endsWith(\".jpeg\") || fileName.endsWith(\".mp4\")) {\n return \"media\";\n }\n}\n\nconst FileUpload = ({ onFilesLoad, onDataFileLoad, onError}) => {\n const [files, setFiles] = useState();\n const [filesCount, setFilesCount] = useState();\n const intl = useIntl();\n\n const handleChange = (loadedFiles) => {\n setFilesCount(loadedFiles.length);\n for (let i = 0; i < loadedFiles.length; i++) {\n const file = loadedFiles[i];\n const fileFormat = getFileFormat(file.name); \n\n // Read a text or JSON export\n if (fileFormat === \"chat\") {\n var reader = new FileReader();\n reader.readAsText(file, \"UTF-8\");\n reader.onload = function (evt) {\n setFiles(prevFiles => (\n {...prevFiles, ...{[file.name]: evt.target.result}}\n ));\n }\n reader.onerror = function (evt) {\n onError(file.name);\n }\n\n // Read a Zip export\n } else if (fileFormat === \"zip\") {\n new JSZip().loadAsync( file )\n .then(function(zip) {\n Object.keys(zip.files).forEach(filename => {\n const fileFormat = getFileFormat(filename); \n if (fileFormat === \"chat\") {\n zip.files[filename].async(\"string\").then(function (data) {\n setFiles(prevFiles => (\n {...prevFiles, ...{[file.name]: data}}\n ));\n });\n } else if (fileFormat === \"media\") {\n zip.files[filename].async(\"arraybuffer\").then(function (data) {\n const buffer = new Uint8Array(data);\n const blob = new Blob([buffer.buffer]);\n onDataFileLoad(filename, blob)\n });\n }\n })\n });\n }\n };\n };\n\n useEffect(() => {\n if (files && Object.keys(files).length === filesCount) {\n onFilesLoad(files);\n }\n }, [files, onFilesLoad]);\n\n const loading = files && Object.keys(files).length !== filesCount;\n\n return (\n <>\n { loading ?

\n {intl.formatMessage({id: \"app.loading\", defaultMessage: \"Loading\"})} ...\n

: \"\"}\n
\n \n
\n\n \n );\n}\n\nexport default FileUpload;\n","/**\n * MapLibre GL JS\n * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt\n */\n(function (global, factory) {\ntypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\ntypeof define === 'function' && define.amd ? define(factory) :\n(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.maplibregl = factory());\n})(this, (function () { 'use strict';\n\n/* eslint-disable */\n\nvar maplibregl = {};\nvar modules = {};\nfunction define(moduleName, _dependencies, moduleFactory) {\n modules[moduleName] = moduleFactory;\n\n // to get the list of modules see generated dist/maplibre-gl-dev.js file (look for `define(` calls)\n if (moduleName !== 'index') {\n return;\n }\n\n // we assume that when an index module is initializing then other modules are loaded already\n var workerBundleString = 'var sharedModule = {}; (' + modules.shared + ')(sharedModule); (' + modules.worker + ')(sharedModule);'\n\n var sharedModule = {};\n // the order of arguments of a module factory depends on rollup (it decides who is whose dependency)\n // to check the correct order, see dist/maplibre-gl-dev.js file (look for `define(` calls)\n // we assume that for our 3 chunks it will generate 3 modules and their order is predefined like the following\n modules.shared(sharedModule);\n modules.index(maplibregl, sharedModule);\n\n if (typeof window !== 'undefined') {\n maplibregl.setWorkerUrl(window.URL.createObjectURL(new Blob([workerBundleString], { type: 'text/javascript' })));\n }\n\n return maplibregl;\n};\n\n\n\ndefine(\"shared\",[\"exports\"],(function(t){\"use strict\";function e(t,e,r,n){return new(r||(r=Promise))((function(i,s){function a(t){try{l(n.next(t));}catch(t){s(t);}}function o(t){try{l(n.throw(t));}catch(t){s(t);}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e);}))).then(a,o);}l((n=n.apply(t,e||[])).next());}))}function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,\"default\")?t.default:t}\"function\"==typeof SuppressedError&&SuppressedError;var n=i;function i(t,e){this.x=t,this.y=e;}i.prototype={clone:function(){return new i(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},i.convert=function(t){return t instanceof i?t:Array.isArray(t)?new i(t[0],t[1]):t};var s=r(n),a=o;function o(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n;}o.prototype={sampleCurveX:function(t){return ((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return ((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return (3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)i?a=r:o=r,r=.5*(o-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var l=r(a);let u,c;function h(){return null==u&&(u=\"undefined\"!=typeof OffscreenCanvas&&new OffscreenCanvas(1,1).getContext(\"2d\")&&\"function\"==typeof createImageBitmap),u}function p(){if(null==c&&(c=!1,h())){const t=5,e=new OffscreenCanvas(t,t).getContext(\"2d\",{willReadFrequently:!0});if(e){for(let r=0;ri.solve(t)}const d=f(.25,.1,.25,1);function y(t,e,r){return Math.min(r,Math.max(e,t))}function m(t,e,r){const n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function g(t,...e){for(const r of e)for(const e in r)t[e]=r[e];return t}let x=1;function v(t,e,r){const n={};for(const r in t)n[r]=e.call(this,t[r],r,t);return n}function b(t,e,r){const n={};for(const r in t)e.call(this,t[r],r,t)&&(n[r]=t[r]);return n}function w(t){return Array.isArray(t)?t.map(w):\"object\"==typeof t&&t?v(t,w):t}const _={};function A(t){_[t]||(\"undefined\"!=typeof console&&console.warn(t),_[t]=!0);}function S(t,e,r){return (r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function k(t){return \"undefined\"!=typeof WorkerGlobalScope&&void 0!==t&&t instanceof WorkerGlobalScope}let M=null;function I(t){return \"undefined\"!=typeof ImageBitmap&&t instanceof ImageBitmap}const z=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=\";function P(t,r,n,i,s){return e(this,void 0,void 0,(function*(){if(\"undefined\"==typeof VideoFrame)throw new Error(\"VideoFrame not supported\");const e=new VideoFrame(t,{timestamp:0});try{const a=null==e?void 0:e.format;if(!a||!a.startsWith(\"BGR\")&&!a.startsWith(\"RGB\"))throw new Error(`Unrecognized format ${a}`);const o=a.startsWith(\"BGR\"),l=new Uint8ClampedArray(i*s*4);if(yield e.copyTo(l,function(t,e,r,n,i){const s=4*Math.max(-e,0),a=(Math.max(0,r)-r)*n*4+s,o=4*n,l=Math.max(0,e),u=Math.max(0,r);return {rect:{x:l,y:u,width:Math.min(t.width,e+n)-l,height:Math.min(t.height,r+i)-u},layout:[{offset:a,stride:o}]}}(t,r,n,i,s)),o)for(let t=0;tk(self)?self.worker&&self.worker.referrer:(\"blob:\"===window.location.protocol?window.parent:window).location.href,O=function(t,r){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){const e=T(t.url);if(e)return e(t,r);if(k(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:\"GR\",data:t,targetMapId:$},r)}if(!(/^file:/.test(n=t.url)||/^file:/.test(D())&&!/^\\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,\"signal\"))return function(t,r){return e(this,void 0,void 0,(function*(){const e=new Request(t.url,{method:t.method||\"GET\",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:D(),signal:r.signal});\"json\"!==t.type||e.headers.has(\"Accept\")||e.headers.set(\"Accept\",\"application/json\");const n=yield fetch(e);if(!n.ok){const e=yield n.blob();throw new L(n.status,n.statusText,t.url,e)}let i;i=\"arrayBuffer\"===t.type||\"image\"===t.type?n.arrayBuffer():\"json\"===t.type?n.json():n.text();const s=yield i;if(r.signal.aborted)throw E();return {data:s,cacheControl:n.headers.get(\"Cache-Control\"),expires:n.headers.get(\"Expires\")}}))}(t,r);if(k(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:\"GR\",data:t,mustQueue:!0,targetMapId:$},r)}var n;return function(t,e){return new Promise(((r,n)=>{var i;const s=new XMLHttpRequest;s.open(t.method||\"GET\",t.url,!0),\"arrayBuffer\"!==t.type&&\"image\"!==t.type||(s.responseType=\"arraybuffer\");for(const e in t.headers)s.setRequestHeader(e,t.headers[e]);\"json\"===t.type&&(s.responseType=\"text\",(null===(i=t.headers)||void 0===i?void 0:i.Accept)||s.setRequestHeader(\"Accept\",\"application/json\")),s.withCredentials=\"include\"===t.credentials,s.onerror=()=>{n(new Error(s.statusText));},s.onload=()=>{if(!e.signal.aborted)if((s.status>=200&&s.status<300||0===s.status)&&null!==s.response){let e=s.response;if(\"json\"===t.type)try{e=JSON.parse(s.response);}catch(t){return void n(t)}r({data:e,cacheControl:s.getResponseHeader(\"Cache-Control\"),expires:s.getResponseHeader(\"Expires\")});}else {const e=new Blob([s.response],{type:s.getResponseHeader(\"Content-Type\")});n(new L(s.status,s.statusText,t.url,e));}},e.signal.addEventListener(\"abort\",(()=>{s.abort(),n(E());})),s.send(t.body);}))}(t,r)};function j(t){if(!t||t.indexOf(\"://\")<=0||0===t.indexOf(\"data:image/\")||0===t.indexOf(\"blob:\"))return !0;const e=new URL(t),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function R(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e));}function U(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1);}}class q{constructor(t,e={}){g(this,e),this.type=t;}}class N extends q{constructor(t,e={}){super(\"error\",g({error:t},e));}}class Z{on(t,e){return this._listeners=this._listeners||{},R(t,e,this._listeners),this}off(t,e){return U(t,e,this._listeners),U(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},R(t,e,this._oneTimeListeners),this):new Promise((e=>this.once(t,e)))}fire(t,e){\"string\"==typeof t&&(t=new q(t,e||{}));const r=t.type;if(this.listens(r)){t.target=this;const e=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(const r of e)r.call(this,t);const n=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(const e of n)U(r,e,this._oneTimeListeners),e.call(this,t);const i=this._eventedParent;i&&(g(t,\"function\"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(t));}else t instanceof N&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var G={$version:8,$root:{version:{required:!0,type:\"enum\",values:[8]},name:{type:\"string\"},metadata:{type:\"*\"},center:{type:\"array\",value:\"number\"},zoom:{type:\"number\"},bearing:{type:\"number\",default:0,period:360,units:\"degrees\"},pitch:{type:\"number\",default:0,units:\"degrees\"},light:{type:\"light\"},sky:{type:\"sky\"},projection:{type:\"projection\"},terrain:{type:\"terrain\"},sources:{required:!0,type:\"sources\"},sprite:{type:\"sprite\"},glyphs:{type:\"string\"},transition:{type:\"transition\"},layers:{required:!0,type:\"array\",value:\"layer\"}},sources:{\"*\":{type:\"source\"}},source:[\"source_vector\",\"source_raster\",\"source_raster_dem\",\"source_geojson\",\"source_video\",\"source_image\"],source_vector:{type:{required:!0,type:\"enum\",values:{vector:{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:\"enum\",values:{xyz:{},tms:{}},default:\"xyz\"},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},attribution:{type:\"string\"},promoteId:{type:\"promoteId\"},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_raster:{type:{required:!0,type:\"enum\",values:{raster:{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},tileSize:{type:\"number\",default:512,units:\"pixels\"},scheme:{type:\"enum\",values:{xyz:{},tms:{}},default:\"xyz\"},attribution:{type:\"string\"},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_raster_dem:{type:{required:!0,type:\"enum\",values:{\"raster-dem\":{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},tileSize:{type:\"number\",default:512,units:\"pixels\"},attribution:{type:\"string\"},encoding:{type:\"enum\",values:{terrarium:{},mapbox:{},custom:{}},default:\"mapbox\"},redFactor:{type:\"number\",default:1},blueFactor:{type:\"number\",default:1},greenFactor:{type:\"number\",default:1},baseShift:{type:\"number\",default:0},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_geojson:{type:{required:!0,type:\"enum\",values:{geojson:{}}},data:{required:!0,type:\"*\"},maxzoom:{type:\"number\",default:18},attribution:{type:\"string\"},buffer:{type:\"number\",default:128,maximum:512,minimum:0},filter:{type:\"*\"},tolerance:{type:\"number\",default:.375},cluster:{type:\"boolean\",default:!1},clusterRadius:{type:\"number\",default:50,minimum:0},clusterMaxZoom:{type:\"number\"},clusterMinPoints:{type:\"number\"},clusterProperties:{type:\"*\"},lineMetrics:{type:\"boolean\",default:!1},generateId:{type:\"boolean\",default:!1},promoteId:{type:\"promoteId\"}},source_video:{type:{required:!0,type:\"enum\",values:{video:{}}},urls:{required:!0,type:\"array\",value:\"string\"},coordinates:{required:!0,type:\"array\",length:4,value:{type:\"array\",length:2,value:\"number\"}}},source_image:{type:{required:!0,type:\"enum\",values:{image:{}}},url:{required:!0,type:\"string\"},coordinates:{required:!0,type:\"array\",length:4,value:{type:\"array\",length:2,value:\"number\"}}},layer:{id:{type:\"string\",required:!0},type:{type:\"enum\",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},\"fill-extrusion\":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:\"*\"},source:{type:\"string\"},\"source-layer\":{type:\"string\"},minzoom:{type:\"number\",minimum:0,maximum:24},maxzoom:{type:\"number\",minimum:0,maximum:24},filter:{type:\"filter\"},layout:{type:\"layout\"},paint:{type:\"paint\"}},layout:[\"layout_fill\",\"layout_line\",\"layout_circle\",\"layout_heatmap\",\"layout_fill-extrusion\",\"layout_symbol\",\"layout_raster\",\"layout_hillshade\",\"layout_background\"],layout_background:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_fill:{\"fill-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_circle:{\"circle-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_heatmap:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},\"layout_fill-extrusion\":{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_line:{\"line-cap\":{type:\"enum\",values:{butt:{},round:{},square:{}},default:\"butt\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-join\":{type:\"enum\",values:{bevel:{},round:{},miter:{}},default:\"miter\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-miter-limit\":{type:\"number\",default:2,requires:[{\"line-join\":\"miter\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-round-limit\":{type:\"number\",default:1.05,requires:[{\"line-join\":\"round\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_symbol:{\"symbol-placement\":{type:\"enum\",values:{point:{},line:{},\"line-center\":{}},default:\"point\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-spacing\":{type:\"number\",default:250,minimum:1,units:\"pixels\",requires:[{\"symbol-placement\":\"line\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-avoid-edges\":{type:\"boolean\",default:!1,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"symbol-z-order\":{type:\"enum\",values:{auto:{},\"viewport-y\":{},source:{}},default:\"auto\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-allow-overlap\":{type:\"boolean\",default:!1,requires:[\"icon-image\",{\"!\":\"icon-overlap\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-overlap\":{type:\"enum\",values:{never:{},always:{},cooperative:{}},requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-ignore-placement\":{type:\"boolean\",default:!1,requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-optional\":{type:\"boolean\",default:!1,requires:[\"icon-image\",\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-rotation-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-size\":{type:\"number\",default:1,minimum:0,units:\"factor of the original icon size\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-text-fit\":{type:\"enum\",values:{none:{},width:{},height:{},both:{}},default:\"none\",requires:[\"icon-image\",\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-text-fit-padding\":{type:\"array\",value:\"number\",length:4,default:[0,0,0,0],units:\"pixels\",requires:[\"icon-image\",\"text-field\",{\"icon-text-fit\":[\"both\",\"width\",\"height\"]}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-image\":{type:\"resolvedImage\",tokens:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-rotate\":{type:\"number\",default:0,period:360,units:\"degrees\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-padding\":{type:\"padding\",default:[2],units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-keep-upright\":{type:\"boolean\",default:!1,requires:[\"icon-image\",{\"icon-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-offset\":{type:\"array\",value:\"number\",length:2,default:[0,0],requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-anchor\":{type:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},default:\"center\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotation-alignment\":{type:\"enum\",values:{map:{},viewport:{},\"viewport-glyph\":{},auto:{}},default:\"auto\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-field\":{type:\"formatted\",default:\"\",tokens:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-font\":{type:\"array\",value:\"string\",default:[\"Open Sans Regular\",\"Arial Unicode MS Regular\"],requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-size\":{type:\"number\",default:16,minimum:0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-width\":{type:\"number\",default:10,minimum:0,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-line-height\":{type:\"number\",default:1.2,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-letter-spacing\":{type:\"number\",default:0,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-justify\":{type:\"enum\",values:{auto:{},left:{},center:{},right:{}},default:\"center\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-radial-offset\":{type:\"number\",units:\"ems\",default:0,requires:[\"text-field\"],\"property-type\":\"data-driven\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]}},\"text-variable-anchor\":{type:\"array\",value:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-variable-anchor-offset\":{type:\"variableAnchorOffsetCollection\",requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-anchor\":{type:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},default:\"center\",requires:[\"text-field\",{\"!\":\"text-variable-anchor\"}],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-angle\":{type:\"number\",default:45,units:\"degrees\",requires:[\"text-field\",{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-writing-mode\":{type:\"array\",value:\"enum\",values:{horizontal:{},vertical:{}},requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotate\":{type:\"number\",default:0,period:360,units:\"degrees\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-padding\":{type:\"number\",default:2,minimum:0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-keep-upright\":{type:\"boolean\",default:!0,requires:[\"text-field\",{\"text-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-transform\":{type:\"enum\",values:{none:{},uppercase:{},lowercase:{}},default:\"none\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-offset\":{type:\"array\",value:\"number\",units:\"ems\",length:2,default:[0,0],requires:[\"text-field\",{\"!\":\"text-radial-offset\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-allow-overlap\":{type:\"boolean\",default:!1,requires:[\"text-field\",{\"!\":\"text-overlap\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-overlap\":{type:\"enum\",values:{never:{},always:{},cooperative:{}},requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-ignore-placement\":{type:\"boolean\",default:!1,requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-optional\":{type:\"boolean\",default:!1,requires:[\"text-field\",\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_raster:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},layout_hillshade:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",\"property-type\":\"constant\"}},filter:{type:\"array\",value:\"*\"},filter_operator:{type:\"enum\",values:{\"==\":{},\"!=\":{},\">\":{},\">=\":{},\"<\":{},\"<=\":{},in:{},\"!in\":{},all:{},any:{},none:{},has:{},\"!has\":{}}},geometry_type:{type:\"enum\",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:\"expression\"},stops:{type:\"array\",value:\"function_stop\"},base:{type:\"number\",default:1,minimum:0},property:{type:\"string\",default:\"$zoom\"},type:{type:\"enum\",values:{identity:{},exponential:{},interval:{},categorical:{}},default:\"exponential\"},colorSpace:{type:\"enum\",values:{rgb:{},lab:{},hcl:{}},default:\"rgb\"},default:{type:\"*\",required:!1}},function_stop:{type:\"array\",minimum:0,maximum:24,value:[\"number\",\"color\"],length:2},expression:{type:\"array\",value:\"*\",minimum:1},light:{anchor:{type:\"enum\",default:\"viewport\",values:{map:{},viewport:{}},\"property-type\":\"data-constant\",transition:!1,expression:{interpolated:!1,parameters:[\"zoom\"]}},position:{type:\"array\",default:[1.15,210,30],length:3,value:\"number\",\"property-type\":\"data-constant\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]}},color:{type:\"color\",\"property-type\":\"data-constant\",default:\"#ffffff\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},intensity:{type:\"number\",\"property-type\":\"data-constant\",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0}},sky:{\"sky-color\":{type:\"color\",\"property-type\":\"data-constant\",default:\"#88C6FC\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"horizon-color\":{type:\"color\",\"property-type\":\"data-constant\",default:\"#ffffff\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"fog-color\":{type:\"color\",\"property-type\":\"data-constant\",default:\"#ffffff\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"fog-ground-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"horizon-fog-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"sky-horizon-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"atmosphere-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0}},terrain:{source:{type:\"string\",required:!0},exaggeration:{type:\"number\",minimum:0,default:1}},projection:{type:{type:\"enum\",default:\"mercator\",values:{mercator:{},globe:{}}}},paint:[\"paint_fill\",\"paint_line\",\"paint_circle\",\"paint_heatmap\",\"paint_fill-extrusion\",\"paint_symbol\",\"paint_raster\",\"paint_hillshade\",\"paint_background\"],paint_fill:{\"fill-antialias\":{type:\"boolean\",default:!0,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"fill-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-outline-color\":{type:\"color\",transition:!0,requires:[{\"!\":\"fill-pattern\"},{\"fill-antialias\":!0}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"fill-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"}},\"paint_fill-extrusion\":{\"fill-extrusion-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"fill-extrusion-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"fill-extrusion-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"fill-extrusion-height\":{type:\"number\",default:0,minimum:0,units:\"meters\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-base\":{type:\"number\",default:0,minimum:0,units:\"meters\",transition:!0,requires:[\"fill-extrusion-height\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-vertical-gradient\":{type:\"boolean\",default:!0,transition:!1,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_line:{\"line-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"line-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-width\":{type:\"number\",default:1,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-gap-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-offset\":{type:\"number\",default:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-dasharray\":{type:\"array\",value:\"number\",minimum:0,transition:!0,units:\"line widths\",requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"cross-faded\"},\"line-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"line-gradient\":{type:\"color\",transition:!1,requires:[{\"!\":\"line-dasharray\"},{\"!\":\"line-pattern\"},{source:\"geojson\",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:[\"line-progress\"]},\"property-type\":\"color-ramp\"}},paint_circle:{\"circle-radius\":{type:\"number\",default:5,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-blur\":{type:\"number\",default:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"circle-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-scale\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{}},default:\"viewport\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-stroke-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"}},paint_heatmap:{\"heatmap-radius\":{type:\"number\",default:30,minimum:1,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-weight\":{type:\"number\",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-intensity\":{type:\"number\",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"heatmap-color\":{type:\"color\",default:[\"interpolate\",[\"linear\"],[\"heatmap-density\"],0,\"rgba(0, 0, 255, 0)\",.1,\"royalblue\",.3,\"cyan\",.5,\"lime\",.7,\"yellow\",1,\"red\"],transition:!1,expression:{interpolated:!0,parameters:[\"heatmap-density\"]},\"property-type\":\"color-ramp\"},\"heatmap-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_symbol:{\"icon-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"icon-image\",\"icon-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-color\":{type:\"color\",default:\"#000000\",transition:!0,overridable:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"text-field\",\"text-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_raster:{\"raster-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-hue-rotate\":{type:\"number\",default:0,period:360,transition:!0,units:\"degrees\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-min\":{type:\"number\",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-max\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-saturation\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-contrast\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-resampling\":{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-fade-duration\":{type:\"number\",default:300,minimum:0,transition:!1,units:\"milliseconds\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_hillshade:{\"hillshade-illumination-direction\":{type:\"number\",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-illumination-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"viewport\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-exaggeration\":{type:\"number\",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-shadow-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-highlight-color\":{type:\"color\",default:\"#FFFFFF\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-accent-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_background:{\"background-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"background-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"background-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"cross-faded\"},\"background-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},transition:{duration:{type:\"number\",default:300,minimum:0,units:\"milliseconds\"},delay:{type:\"number\",default:0,minimum:0,units:\"milliseconds\"}},\"property-type\":{\"data-driven\":{type:\"property-type\"},\"cross-faded\":{type:\"property-type\"},\"cross-faded-data-driven\":{type:\"property-type\"},\"color-ramp\":{type:\"property-type\"},\"data-constant\":{type:\"property-type\"},constant:{type:\"property-type\"}},promoteId:{\"*\":{type:\"string\"}}};const K=[\"type\",\"source\",\"source-layer\",\"minzoom\",\"maxzoom\",\"filter\",\"layout\"];function X(t,e){const r={};for(const e in t)\"ref\"!==e&&(r[e]=t[e]);return K.forEach((t=>{t in e&&(r[t]=e[t]);})),r}function H(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return !1;for(let r=0;r`:\"value\"===t.itemType.kind?\"array\":`array<${e}>`}return t.kind}const _t=[lt,ut,ct,ht,pt,mt,ft,bt(dt),gt,xt,vt];function At(t,e){if(\"error\"===e.kind)return null;if(\"array\"===t.kind){if(\"array\"===e.kind&&(0===e.N&&\"value\"===e.itemType.kind||!At(t.itemType,e.itemType))&&(\"number\"!=typeof t.N||t.N===e.N))return null}else {if(t.kind===e.kind)return null;if(\"value\"===t.kind)for(const t of _t)if(!At(t,e))return null}return `Expected ${wt(t)} but found ${wt(e)} instead.`}function St(t,e){return e.some((e=>e.kind===t.kind))}function kt(t,e){return e.some((e=>\"null\"===e?null===t:\"array\"===e?Array.isArray(t):\"object\"===e?t&&!Array.isArray(t)&&\"object\"==typeof t:e===typeof t))}function Mt(t,e){return \"array\"===t.kind&&\"array\"===e.kind?t.itemType.kind===e.itemType.kind&&\"number\"==typeof t.N:t.kind===e.kind}const It=.96422,zt=.82521,Pt=4/29,Ct=6/29,Bt=3*Ct*Ct,Vt=Ct*Ct*Ct,Et=Math.PI/180,Ft=180/Math.PI;function Tt(t){return (t%=360)<0&&(t+=360),t}function $t([t,e,r,n]){let i,s;const a=Dt((.2225045*(t=Lt(t))+.7168786*(e=Lt(e))+.0606169*(r=Lt(r)))/1);t===e&&e===r?i=s=a:(i=Dt((.4360747*t+.3850649*e+.1430804*r)/It),s=Dt((.0139322*t+.0971045*e+.7141733*r)/zt));const o=116*a-16;return [o<0?0:o,500*(i-a),200*(a-s),n]}function Lt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Dt(t){return t>Vt?Math.pow(t,1/3):t/Bt+Pt}function Ot([t,e,r,n]){let i=(t+16)/116,s=isNaN(e)?i:i+e/500,a=isNaN(r)?i:i-r/200;return i=1*Rt(i),s=It*Rt(s),a=zt*Rt(a),[jt(3.1338561*s-1.6168667*i-.4906146*a),jt(-.9787684*s+1.9161415*i+.033454*a),jt(.0719453*s-.2289914*i+1.4052427*a),n]}function jt(t){return (t=t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055)<0?0:t>1?1:t}function Rt(t){return t>Ct?t*t*t:Bt*(t-Pt)}function Ut(t){return parseInt(t.padEnd(2,t),16)/255}function qt(t,e){return Nt(e?t/100:t,0,1)}function Nt(t,e,r){return Math.min(Math.max(e,t),r)}function Zt(t){return !t.some(Number.isNaN)}const Gt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Kt{constructor(t,e,r,n=1,i=!0){this.r=t,this.g=e,this.b=r,this.a=n,i||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter(\"rgb\",[t,e,r,n]));}static parse(t){if(t instanceof Kt)return t;if(\"string\"!=typeof t)return;const e=function(t){if(\"transparent\"===(t=t.toLowerCase().trim()))return [0,0,0,0];const e=Gt[t];if(e){const[t,r,n]=e;return [t/255,r/255,n/255,1]}if(t.startsWith(\"#\")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){const e=t.length<6?1:2;let r=1;return [Ut(t.slice(r,r+=e)),Ut(t.slice(r,r+=e)),Ut(t.slice(r,r+=e)),Ut(t.slice(r,r+e)||\"ff\")]}if(t.startsWith(\"rgb\")){const e=t.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(e){const[t,r,n,i,s,a,o,l,u,c,h,p]=e,f=[i||\" \",o||\" \",c].join(\"\");if(\" \"===f||\" /\"===f||\",,\"===f||\",,,\"===f){const t=[n,a,u].join(\"\"),e=\"%%%\"===t?100:\"\"===t?255:0;if(e){const t=[Nt(+r/e,0,1),Nt(+s/e,0,1),Nt(+l/e,0,1),h?qt(+h,p):1];if(Zt(t))return t}}return}}const r=t.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(r){const[t,e,n,i,s,a,o,l,u]=r,c=[n||\" \",s||\" \",o].join(\"\");if(\" \"===c||\" /\"===c||\",,\"===c||\",,,\"===c){const t=[+e,Nt(+i,0,100),Nt(+a,0,100),l?qt(+l,u):1];if(Zt(t))return function([t,e,r,n]){function i(n){const i=(n+t/30)%12,s=e*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(i-3,9-i,1))}return t=Tt(t),e/=100,r/=100,[i(0),i(8),i(4),n]}(t)}}}(t);return e?new Kt(...e,!1):void 0}get rgb(){const{r:t,g:e,b:r,a:n}=this,i=n||1/0;return this.overwriteGetter(\"rgb\",[t/i,e/i,r/i,n])}get hcl(){return this.overwriteGetter(\"hcl\",function(t){const[e,r,n,i]=$t(t),s=Math.sqrt(r*r+n*n);return [Math.round(1e4*s)?Tt(Math.atan2(n,r)*Ft):NaN,s,e,i]}(this.rgb))}get lab(){return this.overwriteGetter(\"lab\",$t(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){const[t,e,r,n]=this.rgb;return `rgba(${[t,e,r].map((t=>Math.round(255*t))).join(\",\")},${n})`}}Kt.black=new Kt(0,0,0,1),Kt.white=new Kt(1,1,1,1),Kt.transparent=new Kt(0,0,0,0),Kt.red=new Kt(1,0,0,1);class Xt{constructor(t,e,r){this.sensitivity=t?e?\"variant\":\"case\":e?\"accent\":\"base\",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:\"search\"});}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Ht{constructor(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i;}}class Yt{constructor(t){this.sections=t;}static fromString(t){return new Yt([new Ht(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Yt?t:Yt.fromString(t)}toString(){return 0===this.sections.length?\"\":this.sections.map((t=>t.text)).join(\"\")}}class Jt{constructor(t){this.values=t.slice();}static parse(t){if(t instanceof Jt)return t;if(\"number\"==typeof t)return new Jt([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if(\"number\"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]];}return new Jt(t)}}toString(){return JSON.stringify(this.values)}}const Wt=new Set([\"center\",\"left\",\"right\",\"top\",\"bottom\",\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"]);class Qt{constructor(t){this.values=t.slice();}static parse(t){if(t instanceof Qt)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e=0&&t<=255&&\"number\"==typeof e&&e>=0&&e<=255&&\"number\"==typeof r&&r>=0&&r<=255?void 0===n||\"number\"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(\", \")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(\"number\"==typeof n?[t,e,r,n]:[t,e,r]).join(\", \")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function re(t){if(null===t||\"string\"==typeof t||\"boolean\"==typeof t||\"number\"==typeof t||t instanceof Kt||t instanceof Xt||t instanceof Yt||t instanceof Jt||t instanceof Qt||t instanceof te)return !0;if(Array.isArray(t)){for(const e of t)if(!re(e))return !1;return !0}if(\"object\"==typeof t){for(const e in t)if(!re(t[e]))return !1;return !0}return !1}function ne(t){if(null===t)return lt;if(\"string\"==typeof t)return ct;if(\"boolean\"==typeof t)return ht;if(\"number\"==typeof t)return ut;if(t instanceof Kt)return pt;if(t instanceof Xt)return yt;if(t instanceof Yt)return mt;if(t instanceof Jt)return gt;if(t instanceof Qt)return vt;if(t instanceof te)return xt;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=ne(e);if(r){if(r===t)continue;r=dt;break}r=t;}return bt(r||dt,e)}return ft}function ie(t){const e=typeof t;return null===t?\"\":\"string\"===e||\"number\"===e||\"boolean\"===e?String(t):t instanceof Kt||t instanceof Yt||t instanceof Jt||t instanceof Qt||t instanceof te?t.toString():JSON.stringify(t)}class se{constructor(t,e){this.type=t,this.value=e;}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!re(t[1]))return e.error(\"invalid value\");const r=t[1];let n=ne(r);const i=e.expectedType;return \"array\"!==n.kind||0!==n.N||!i||\"array\"!==i.kind||\"number\"==typeof i.N&&0!==i.N||(n=i),new se(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return !0}}class ae{constructor(t){this.name=\"ExpressionEvaluationError\",this.message=t;}toJSON(){return this.message}}const oe={string:ct,number:ut,boolean:ht,object:ft};class le{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error(\"Expected at least one argument.\");let r,n=1;const i=t[0];if(\"array\"===i){let i,s;if(t.length>2){const r=t[1];if(\"string\"!=typeof r||!(r in oe)||\"object\"===r)return e.error('The item type argument of \"array\" must be one of string, number, boolean',1);i=oe[r],n++;}else i=dt;if(t.length>3){if(null!==t[2]&&(\"number\"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to \"array\" must be a positive integer literal',2);s=t[2],n++;}r=bt(i,s);}else {if(!oe[i])throw new Error(`Types doesn't contain name = ${i}`);r=oe[i];}const s=[];for(;nt.outputDefined()))}}const ue={\"to-boolean\":ht,\"to-color\":pt,\"to-number\":ut,\"to-string\":ct};class ce{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error(\"Expected at least one argument.\");const r=t[0];if(!ue[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if((\"to-boolean\"===r||\"to-string\"===r)&&2!==t.length)return e.error(\"Expected one argument.\");const n=ue[r],i=[];for(let r=1;r4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:ee(e[0],e[1],e[2],e[3]),!r))return new Kt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ae(r||`Could not parse color from value '${\"string\"==typeof e?e:JSON.stringify(e)}'`)}case\"padding\":{let e;for(const r of this.args){e=r.evaluate(t);const n=Jt.parse(e);if(n)return n}throw new ae(`Could not parse padding from value '${\"string\"==typeof e?e:JSON.stringify(e)}'`)}case\"variableAnchorOffsetCollection\":{let e;for(const r of this.args){e=r.evaluate(t);const n=Qt.parse(e);if(n)return n}throw new ae(`Could not parse variableAnchorOffsetCollection from value '${\"string\"==typeof e?e:JSON.stringify(e)}'`)}case\"number\":{let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new ae(`Could not convert ${JSON.stringify(e)} to number.`)}case\"formatted\":return Yt.fromString(ie(this.args[0].evaluate(t)));case\"resolvedImage\":return te.fromString(ie(this.args[0].evaluate(t)));default:return ie(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}}const he=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"];class pe{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?he[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&\"geometry\"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Kt.parse(t)),e}}class fe{constructor(t,e,r=[],n,i=new ot,s=[]){this.registry=t,this.path=r,this.key=r.map((t=>`[${t}]`)).join(\"\"),this.scope=i,this.errors=s,this.expectedType=n,this._isConstant=e;}parse(t,e,r,n,i={}){return e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)}_parse(t,e){function r(t,e,r){return \"assert\"===r?new le(e,[t]):\"coerce\"===r?new ce(e,[t]):t}if(null!==t&&\"string\"!=typeof t&&\"boolean\"!=typeof t&&\"number\"!=typeof t||(t=[\"literal\",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');const n=t[0];if(\"string\"!=typeof n)return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use [\"literal\", [...]].`,0),null;const i=this.registry[n];if(i){let n=i.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,i=n.type;if(\"string\"!==t.kind&&\"number\"!==t.kind&&\"boolean\"!==t.kind&&\"object\"!==t.kind&&\"array\"!==t.kind||\"value\"!==i.kind)if(\"color\"!==t.kind&&\"formatted\"!==t.kind&&\"resolvedImage\"!==t.kind||\"value\"!==i.kind&&\"string\"!==i.kind)if(\"padding\"!==t.kind||\"value\"!==i.kind&&\"number\"!==i.kind&&\"array\"!==i.kind)if(\"variableAnchorOffsetCollection\"!==t.kind||\"value\"!==i.kind&&\"array\"!==i.kind){if(this.checkSubtype(t,i))return null}else n=r(n,t,e.typeAnnotation||\"coerce\");else n=r(n,t,e.typeAnnotation||\"coerce\");else n=r(n,t,e.typeAnnotation||\"coerce\");else n=r(n,t,e.typeAnnotation||\"assert\");}if(!(n instanceof se)&&\"resolvedImage\"!==n.type.kind&&this._isConstant(n)){const t=new pe;try{n=new se(n.type,n.evaluate(t));}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression \"${n}\". If you wanted a literal array, use [\"literal\", [...]].`,0)}return this.error(void 0===t?\"'undefined' value invalid. Use null instead.\":\"object\"==typeof t?'Bare objects invalid. Use [\"literal\", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r){const n=\"number\"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new fe(this.registry,this._isConstant,n,e||null,i,this.errors)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join(\"\")}`;this.errors.push(new at(r,t));}checkSubtype(t,e){const r=At(t,e);return r&&this.error(r),r}}class de{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e;}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result);}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n=r.length)throw new ae(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e!==Math.floor(e))throw new ae(`Array index must be an integer, but found ${e} instead.`);return r[e]}eachChild(t){t(this.index),t(this.input);}outputDefined(){return !1}}class ge{constructor(t,e){this.type=ht,this.needle=t,this.haystack=e;}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,dt),n=e.parse(t[2],2,dt);return r&&n?St(r.type,[ht,ct,ut,lt,dt])?new ge(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${wt(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return !1;if(!kt(e,[\"boolean\",\"string\",\"number\",\"null\"]))throw new ae(`Expected first argument to be of type boolean, string, number or null, but found ${wt(ne(e))} instead.`);if(!kt(r,[\"string\",\"array\"]))throw new ae(`Expected second argument to be of type array or string, but found ${wt(ne(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack);}outputDefined(){return !0}}class xe{constructor(t,e,r){this.type=ut,this.needle=t,this.haystack=e,this.fromIndex=r;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,dt),n=e.parse(t[2],2,dt);if(!r||!n)return null;if(!St(r.type,[ht,ct,ut,lt,dt]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${wt(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,ut);return i?new xe(r,n,i):null}return new xe(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!kt(e,[\"boolean\",\"string\",\"number\",\"null\"]))throw new ae(`Expected first argument to be of type boolean, string, number or null, but found ${wt(ne(e))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(t)),kt(r,[\"string\"])){const t=r.indexOf(e,n);return -1===t?-1:[...r.slice(0,t)].length}if(kt(r,[\"array\"]))return r.indexOf(e,n);throw new ae(`Expected second argument to be of type array or string, but found ${wt(ne(r))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex);}outputDefined(){return !1}}class ve{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s;}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error(\"Expected an even number of arguments.\");let r,n;e.expectedType&&\"value\"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let a=2;aNumber.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(\"number\"==typeof t&&Math.floor(t)!==t)return u.error(\"Numeric branch labels must be integer values.\");if(r){if(u.checkSubtype(r,ne(t)))return null}else r=ne(t);if(void 0!==i[String(t)])return u.error(\"Branch labels must be unique.\");i[String(t)]=s.length;}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,s.push(c);}const a=e.parse(t[1],1,dt);if(!a)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?\"value\"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new ve(r,n,a,i,s,o):null}evaluate(t){const e=this.input.evaluate(t);return (ne(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}}class be{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r;}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error(\"Expected an odd number of arguments.\");let r;e.expectedType&&\"value\"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;ie.outputDefined()))&&this.otherwise.outputDefined()}}class we{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n;}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,dt),n=e.parse(t[2],2,ut);if(!r||!n)return null;if(!St(r.type,[bt(dt),ct,dt]))return e.error(`Expected first argument to be of type array or string, but found ${wt(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,ut);return i?new we(r.type,r,n,i):null}return new we(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);let n;if(this.endIndex&&(n=this.endIndex.evaluate(t)),kt(e,[\"string\"]))return [...e].slice(r,n).join(\"\");if(kt(e,[\"array\"]))return e.slice(r,n);throw new ae(`Expected first argument to be of type array or string, but found ${wt(ne(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex);}outputDefined(){return !1}}function _e(t,e){const r=t.length-1;let n,i,s=0,a=r,o=0;for(;s<=a;)if(o=Math.floor((s+a)/2),n=t[o],i=t[o+1],n<=e){if(o===r||ee))throw new ae(\"Input is not a number.\");a=o-1;}return 0}class Ae{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e);}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error(\"Expected an even number of arguments.\");const r=e.parse(t[1],1,ut);if(!r)return null;const n=[];let i=null;e.expectedType&&\"value\"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r=s)return e.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,n.push([s,u]);}return new Ae(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[_e(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Se(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,\"default\")?t.default:t}var ke=Me;function Me(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n;}Me.prototype={sampleCurveX:function(t){return ((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return ((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return (3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)i?a=r:o=r,r=.5*(o-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var Ie=Se(ke);function ze(t,e,r){return t+r*(e-t)}function Pe(t,e,r){return t.map(((t,n)=>ze(t,e[n],r)))}const Ce={number:ze,color:function(t,e,r,n=\"rgb\"){switch(n){case\"rgb\":{const[n,i,s,a]=Pe(t.rgb,e.rgb,r);return new Kt(n,i,s,a,!1)}case\"hcl\":{const[n,i,s,a]=t.hcl,[o,l,u,c]=e.hcl;let h,p;if(isNaN(n)||isNaN(o))isNaN(n)?isNaN(o)?h=NaN:(h=o,1!==s&&0!==s||(p=l)):(h=n,1!==u&&0!==u||(p=i));else {let t=o-n;o>n&&t>180?t-=360:o180&&(t+=360),h=n+r*t;}const[f,d,y,m]=function([t,e,r,n]){return t=isNaN(t)?0:t*Et,Ot([r,Math.cos(t)*e,Math.sin(t)*e,n])}([h,null!=p?p:ze(i,l,r),ze(s,u,r),ze(a,c,r)]);return new Kt(f,d,y,m,!1)}case\"lab\":{const[n,i,s,a]=Ot(Pe(t.lab,e.lab,r));return new Kt(n,i,s,a,!1)}}},array:Pe,padding:function(t,e,r){return new Jt(Pe(t.values,e.values,r))},variableAnchorOffsetCollection:function(t,e,r){const n=t.values,i=e.values;if(n.length!==i.length)throw new ae(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);const s=[];for(let t=0;t\"number\"!=typeof t||t<0||t>1)))return e.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\",1);n={name:\"cubic-bezier\",controlPoints:t};}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error(\"Expected an even number of arguments.\");if(i=e.parse(i,2,ut),!i)return null;const a=[];let o=null;\"interpolate-hcl\"===r||\"interpolate-lab\"===r?o=pt:e.expectedType&&\"value\"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t=r)return e.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,a.push([r,u]);}return Mt(o,ut)||Mt(o,pt)||Mt(o,gt)||Mt(o,vt)||Mt(o,bt(ut))?new Be(o,r,n,i,a):e.error(`Type ${wt(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=_e(e,n),a=Be.interpolationFactor(this.interpolation,n,e[s],e[s+1]),o=r[s].evaluate(t),l=r[s+1].evaluate(t);switch(this.operator){case\"interpolate\":return Ce[this.type.kind](o,l,a);case\"interpolate-hcl\":return Ce.color(o,l,a,\"hcl\");case\"interpolate-lab\":return Ce.color(o,l,a,\"lab\")}}eachChild(t){t(this.input);for(const e of this.outputs)t(e);}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}}function Ve(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}class Ee{constructor(t,e){this.type=t,this.args=e;}static parse(t,e){if(t.length<2)return e.error(\"Expectected at least one argument.\");let r=null;const n=e.expectedType;n&&\"value\"!==n.kind&&(r=n);const i=[];for(const n of t.slice(1)){const t=e.parse(n,1+i.length,r,void 0,{typeAnnotation:\"omit\"});if(!t)return null;r=r||t.type,i.push(t);}if(!r)throw new Error(\"No output type\");const s=n&&i.some((t=>At(n,t.type)));return new Ee(s?dt:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args)if(n++,r=i.evaluate(t),r&&r instanceof te&&!r.available&&(e||(e=r.name),r=null,n===this.args.length&&(r=e)),null!==r)break;return r}eachChild(t){this.args.forEach(t);}outputDefined(){return this.args.every((t=>t.outputDefined()))}}function Fe(t,e){return \"==\"===t||\"!=\"===t?\"boolean\"===e.kind||\"string\"===e.kind||\"number\"===e.kind||\"null\"===e.kind||\"value\"===e.kind:\"string\"===e.kind||\"number\"===e.kind||\"value\"===e.kind}function Te(t,e,r,n){return 0===n.compare(e,r)}function $e(t,e,r){const n=\"==\"!==t&&\"!=\"!==t;return class i{constructor(t,e,r){this.type=ht,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument=\"value\"===t.type.kind||\"value\"===e.type.kind;}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error(\"Expected two or three arguments.\");const r=t[0];let s=e.parse(t[1],1,dt);if(!s)return null;if(!Fe(r,s.type))return e.concat(1).error(`\"${r}\" comparisons are not supported for type '${wt(s.type)}'.`);let a=e.parse(t[2],2,dt);if(!a)return null;if(!Fe(r,a.type))return e.concat(2).error(`\"${r}\" comparisons are not supported for type '${wt(a.type)}'.`);if(s.type.kind!==a.type.kind&&\"value\"!==s.type.kind&&\"value\"!==a.type.kind)return e.error(`Cannot compare types '${wt(s.type)}' and '${wt(a.type)}'.`);n&&(\"value\"===s.type.kind&&\"value\"!==a.type.kind?s=new le(a.type,[s]):\"value\"!==s.type.kind&&\"value\"===a.type.kind&&(a=new le(s.type,[a])));let o=null;if(4===t.length){if(\"string\"!==s.type.kind&&\"string\"!==a.type.kind&&\"value\"!==s.type.kind&&\"value\"!==a.type.kind)return e.error(\"Cannot use collator to compare non-string types.\");if(o=e.parse(t[3],3,yt),!o)return null}return new i(s,a,o)}evaluate(i){const s=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=ne(s),r=ne(a);if(e.kind!==r.kind||\"string\"!==e.kind&&\"number\"!==e.kind)throw new ae(`Expected arguments for \"${t}\" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=ne(s),r=ne(a);if(\"string\"!==t.kind||\"string\"!==r.kind)return e(i,s,a)}return this.collator?r(i,s,a,this.collator.evaluate(i)):e(i,s,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator);}outputDefined(){return !0}}}const Le=$e(\"==\",(function(t,e,r){return e===r}),Te),De=$e(\"!=\",(function(t,e,r){return e!==r}),(function(t,e,r,n){return !Te(0,e,r,n)})),Oe=$e(\"<\",(function(t,e,r){return e\",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),Re=$e(\"<=\",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Ue=$e(\">=\",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class qe{constructor(t,e,r){this.type=yt,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e;}static parse(t,e){if(2!==t.length)return e.error(\"Expected one argument.\");const r=t[1];if(\"object\"!=typeof r||Array.isArray(r))return e.error(\"Collator options argument must be an object.\");const n=e.parse(void 0!==r[\"case-sensitive\"]&&r[\"case-sensitive\"],1,ht);if(!n)return null;const i=e.parse(void 0!==r[\"diacritic-sensitive\"]&&r[\"diacritic-sensitive\"],1,ht);if(!i)return null;let s=null;return r.locale&&(s=e.parse(r.locale,1,ct),!s)?null:new qe(n,i,s)}evaluate(t){return new Xt(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale);}outputDefined(){return !1}}class Ne{constructor(t,e,r,n,i){this.type=ct,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i;}static parse(t,e){if(3!==t.length)return e.error(\"Expected two arguments.\");const r=e.parse(t[1],1,ut);if(!r)return null;const n=t[2];if(\"object\"!=typeof n||Array.isArray(n))return e.error(\"NumberFormat options argument must be an object.\");let i=null;if(n.locale&&(i=e.parse(n.locale,1,ct),!i))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,ct),!s))return null;let a=null;if(n[\"min-fraction-digits\"]&&(a=e.parse(n[\"min-fraction-digits\"],1,ut),!a))return null;let o=null;return n[\"max-fraction-digits\"]&&(o=e.parse(n[\"max-fraction-digits\"],1,ut),!o)?null:new Ne(r,i,s,a,o)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?\"currency\":\"decimal\",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits);}outputDefined(){return !1}}class Ze{constructor(t){this.type=mt,this.sections=t;}static parse(t,e){if(t.length<2)return e.error(\"Expected at least one argument.\");const r=t[1];if(!Array.isArray(r)&&\"object\"==typeof r)return e.error(\"First argument must be an image or text section.\");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const s=t[r];if(i&&\"object\"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s[\"font-scale\"]&&(t=e.parse(s[\"font-scale\"],1,ut),!t))return null;let r=null;if(s[\"text-font\"]&&(r=e.parse(s[\"text-font\"],1,bt(ct)),!r))return null;let a=null;if(s[\"text-color\"]&&(a=e.parse(s[\"text-color\"],1,pt),!a))return null;const o=n[n.length-1];o.scale=t,o.font=r,o.textColor=a;}else {const s=e.parse(t[r],1,dt);if(!s)return null;const a=s.type.kind;if(\"string\"!==a&&\"value\"!==a&&\"null\"!==a&&\"resolvedImage\"!==a)return e.error(\"Formatted text type must be 'string', 'value', 'image' or 'null'.\");i=!0,n.push({content:s,scale:null,font:null,textColor:null});}}return new Ze(n)}evaluate(t){return new Yt(this.sections.map((e=>{const r=e.content.evaluate(t);return ne(r)===xt?new Ht(\"\",r,null,null,null):new Ht(ie(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(\",\"):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor);}outputDefined(){return !1}}class Ge{constructor(t){this.type=xt,this.input=t;}static parse(t,e){if(2!==t.length)return e.error(\"Expected two arguments.\");const r=e.parse(t[1],1,ct);return r?new Ge(r):e.error(\"No image name provided.\")}evaluate(t){const e=this.input.evaluate(t),r=te.fromString(e);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(e)>-1),r}eachChild(t){t(this.input);}outputDefined(){return !1}}class Ke{constructor(t){this.type=ut,this.input=t;}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?\"array\"!==r.type.kind&&\"string\"!==r.type.kind&&\"value\"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${wt(r.type)} instead.`):new Ke(r):null}evaluate(t){const e=this.input.evaluate(t);if(\"string\"==typeof e)return [...e].length;if(Array.isArray(e))return e.length;throw new ae(`Expected value to be of type string or array, but found ${wt(ne(e))} instead.`)}eachChild(t){t(this.input);}outputDefined(){return !1}}const Xe=8192;function He(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return [Math.round(r*i*Xe),Math.round(n*i*Xe)]}function Ye(t,e){const r=Math.pow(2,e.z);return [(i=(t[0]/Xe+e.x)/r,360*i-180),(n=(t[1]/Xe+e.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90)];var n,i;}function Je(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1]);}function We(t,e){return !(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Qe(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],a=t[1]-r[1];return n*a-s*i==0&&n*s<=0&&i*a<=0}function tr(t,e,r,n){return 0!=(i=[n[0]-r[0],n[1]-r[1]])[0]*(s=[e[0]-t[0],e[1]-t[1]])[1]-i[1]*s[0]&&!(!ar(t,e,r,n)||!ar(r,n,t,e));var i,s;}function er(t,e,r){for(const n of r)for(let r=0;r(i=t)[1]!=(a=o[e+1])[1]>i[1]&&i[0]<(a[0]-s[0])*(i[1]-s[1])/(a[1]-s[1])+s[0]&&(n=!n);}var i,s,a;return n}function nr(t,e){for(const r of e)if(rr(t,r))return !0;return !1}function ir(t,e){for(const r of t)if(!rr(r,e))return !1;for(let r=0;r0&&o<0||a<0&&o>0}function or(t,e,r){const n=[];for(let i=0;ir[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i;}Je(e,t);}function cr(t,e,r,n){const i=Math.pow(2,n.z)*Xe,s=[n.x*Xe,n.y*Xe],a=[];for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];ur(n,e,r,i),a.push(n);}return a}function hr(t,e,r,n){const i=Math.pow(2,n.z)*Xe,s=[n.x*Xe,n.y*Xe],a=[];for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];Je(e,r),t.push(r);}a.push(t);}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of a)for(const n of t)ur(n,e,r,i);}var o;return a}class pr{constructor(t,e){this.type=ht,this.geojson=t,this.geometries=e;}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(re(t[1])){const e=t[1];if(\"FeatureCollection\"===e.type){const t=[];for(const r of e.features){const{type:e,coordinates:n}=r.geometry;\"Polygon\"===e&&t.push(n),\"MultiPolygon\"===e&&t.push(...n);}if(t.length)return new pr(e,{type:\"MultiPolygon\",coordinates:t})}else if(\"Feature\"===e.type){const t=e.geometry.type;if(\"Polygon\"===t||\"MultiPolygon\"===t)return new pr(e,e.geometry)}else if(\"Polygon\"===e.type||\"MultiPolygon\"===e.type)return new pr(e,e)}return e.error(\"'within' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if(\"Point\"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(\"Polygon\"===e.type){const s=or(e.coordinates,n,i),a=cr(t.geometry(),r,n,i);if(!We(r,n))return !1;for(const t of a)if(!rr(t,s))return !1}if(\"MultiPolygon\"===e.type){const s=lr(e.coordinates,n,i),a=cr(t.geometry(),r,n,i);if(!We(r,n))return !1;for(const t of a)if(!nr(t,s))return !1}return !0}(t,this.geometries);if(\"LineString\"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(\"Polygon\"===e.type){const s=or(e.coordinates,n,i),a=hr(t.geometry(),r,n,i);if(!We(r,n))return !1;for(const t of a)if(!ir(t,s))return !1}if(\"MultiPolygon\"===e.type){const s=lr(e.coordinates,n,i),a=hr(t.geometry(),r,n,i);if(!We(r,n))return !1;for(const t of a)if(!sr(t,s))return !1}return !0}(t,this.geometries)}return !1}eachChild(){}outputDefined(){return !0}}let fr=class{constructor(t=[],e=((t,e)=>te?1:0)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t);}push(t){this.data.push(t),this._up(this.length++);}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return --this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i;}e[t]=n;}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t=0)break;e[t]=e[n],t=n;}e[t]=i;}};function dr(t,e,r,n,i){yr(t,e,r,n||t.length-1,i||gr);}function yr(t,e,r,n,i){for(;n>r;){if(n-r>600){var s=n-r+1,a=e-r+1,o=Math.log(s),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(s-l)/s)*(a-s/2<0?-1:1);yr(t,e,Math.max(r,Math.floor(e-a*l/s+u)),Math.min(n,Math.floor(e+(s-a)*l/s+u)),i);}var c=t[e],h=r,p=n;for(mr(t,r,e),i(t[n],c)>0&&mr(t,r,n);h0;)p--;}0===i(t[r],c)?mr(t,r,p):mr(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1);}}function mr(t,e,r){var n=t[e];t[e]=t[r],t[r]=n;}function gr(t,e){return te?1:0}function xr(t,e){if(t.length<=1)return [t];const r=[];let n,i;for(const e of t){const t=br(e);0!==t&&(e.area=Math.abs(t),void 0===i&&(i=t<0),i===t<0?(n&&r.push(n),n=[e]):n.push(e));}if(n&&r.push(n),e>1)for(let t=0;t1?(l=t[o+1][0],u=t[o+1][1]):p>0&&(l+=c/this.kx*p,u+=h/this.ky*p)),c=this.wrap(e[0]-l)*this.kx,h=(e[1]-u)*this.ky;const f=c*c+h*h;f180;)t-=360;return t}}function kr(t,e){return e[0]-t[0]}function Mr(t){return t[1]-t[0]+1}function Ir(t,e){return t[1]>=t[0]&&t[1]t[1])return [null,null];const r=Mr(t);if(e){if(2===r)return [t,null];const e=Math.floor(r/2);return [[t[0],t[0]+e],[t[0]+e,t[1]]]}if(1===r)return [t,null];const n=Math.floor(r/2)-1;return [[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function Pr(t,e){if(!Ir(e,t.length))return [1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)Je(r,t[n]);return r}function Cr(t){const e=[1/0,1/0,-1/0,-1/0];for(const r of t)for(const t of r)Je(e,t);return e}function Br(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Vr(t,e,r){if(!Br(t)||!Br(e))return NaN;let n=0,i=0;return t[2]e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]=n)return n;if(We(i,s)){if(Or(t,e))return 0}else if(Or(e,t))return 0;let a=1/0;for(const n of t)for(let t=0,i=n.length,s=i-1;t0;){const i=a.pop();if(i[0]>=s)continue;const l=i[1],u=e?50:100;if(Mr(l)<=u){if(!Ir(l,t.length))return NaN;if(e){const e=Dr(t,l,r,n);if(isNaN(e)||0===e)return e;s=Math.min(s,e);}else for(let e=l[0];e<=l[1];++e){const i=Lr(t[e],r,n);if(s=Math.min(s,i),0===s)return 0}}else {const r=zr(l,e);Rr(a,s,n,t,o,r[0]),Rr(a,s,n,t,o,r[1]);}}return s}function Nr(t,e,r,n,i,s=1/0){let a=Math.min(s,i.distance(t[0],r[0]));if(0===a)return a;const o=new fr([[0,[0,t.length-1],[0,r.length-1]]],kr);for(;o.length>0;){const s=o.pop();if(s[0]>=a)continue;const l=s[1],u=s[2],c=e?50:100,h=n?50:100;if(Mr(l)<=c&&Mr(u)<=h){if(!Ir(l,t.length)&&Ir(u,r.length))return NaN;let s;if(e&&n)s=Tr(t,l,r,u,i),a=Math.min(a,s);else if(e&&!n){const e=t.slice(l[0],l[1]+1);for(let t=u[0];t<=u[1];++t)if(s=Er(r[t],e,i),a=Math.min(a,s),0===a)return a}else if(!e&&n){const e=r.slice(u[0],u[1]+1);for(let r=l[0];r<=l[1];++r)if(s=Er(t[r],e,i),a=Math.min(a,s),0===a)return a}else s=$r(t,l,r,u,i),a=Math.min(a,s);}else {const s=zr(l,e),c=zr(u,n);Ur(o,a,i,t,r,s[0],c[0]),Ur(o,a,i,t,r,s[0],c[1]),Ur(o,a,i,t,r,s[1],c[0]),Ur(o,a,i,t,r,s[1],c[1]);}}return a}function Zr(t){return \"MultiPolygon\"===t.type?t.coordinates.map((t=>({type:\"Polygon\",coordinates:t}))):\"MultiLineString\"===t.type?t.coordinates.map((t=>({type:\"LineString\",coordinates:t}))):\"MultiPoint\"===t.type?t.coordinates.map((t=>({type:\"Point\",coordinates:t}))):[t]}class Gr{constructor(t,e){this.type=ut,this.geojson=t,this.geometries=e;}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(re(t[1])){const e=t[1];if(\"FeatureCollection\"===e.type)return new Gr(e,e.features.map((t=>Zr(t.geometry))).flat());if(\"Feature\"===e.type)return new Gr(e,Zr(e.geometry));if(\"type\"in e&&\"coordinates\"in e)return new Gr(e,Zr(e))}return e.error(\"'distance' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if(\"Point\"===t.geometryType())return function(t,e){const r=t.geometry(),n=r.flat().map((e=>Ye([e.x,e.y],t.canonical)));if(0===r.length)return NaN;const i=new Sr(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case\"Point\":s=Math.min(s,Nr(n,!1,[t.coordinates],!1,i,s));break;case\"LineString\":s=Math.min(s,Nr(n,!1,t.coordinates,!0,i,s));break;case\"Polygon\":s=Math.min(s,qr(n,!1,t.coordinates,i,s));}if(0===s)return s}return s}(t,this.geometries);if(\"LineString\"===t.geometryType())return function(t,e){const r=t.geometry(),n=r.flat().map((e=>Ye([e.x,e.y],t.canonical)));if(0===r.length)return NaN;const i=new Sr(n[0][1]);let s=1/0;for(const t of e){switch(t.type){case\"Point\":s=Math.min(s,Nr(n,!0,[t.coordinates],!1,i,s));break;case\"LineString\":s=Math.min(s,Nr(n,!0,t.coordinates,!0,i,s));break;case\"Polygon\":s=Math.min(s,qr(n,!0,t.coordinates,i,s));}if(0===s)return s}return s}(t,this.geometries);if(\"Polygon\"===t.geometryType())return function(t,e){const r=t.geometry();if(0===r.length||0===r[0].length)return NaN;const n=xr(r,0).map((e=>e.map((e=>e.map((e=>Ye([e.x,e.y],t.canonical))))))),i=new Sr(n[0][0][0][1]);let s=1/0;for(const t of e)for(const e of n){switch(t.type){case\"Point\":s=Math.min(s,qr([t.coordinates],!1,e,i,s));break;case\"LineString\":s=Math.min(s,qr(t.coordinates,!0,e,i,s));break;case\"Polygon\":s=Math.min(s,jr(e,t.coordinates,i,s));}if(0===s)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return !0}}const Kr={\"==\":Le,\"!=\":De,\">\":je,\"<\":Oe,\">=\":Ue,\"<=\":Re,array:le,at:me,boolean:le,case:be,coalesce:Ee,collator:qe,format:Ze,image:Ge,in:ge,\"index-of\":xe,interpolate:Be,\"interpolate-hcl\":Be,\"interpolate-lab\":Be,length:Ke,let:de,literal:se,match:ve,number:le,\"number-format\":Ne,object:le,slice:we,step:Ae,string:le,\"to-boolean\":ce,\"to-color\":ce,\"to-number\":ce,\"to-string\":ce,var:ye,within:pr,distance:Gr};class Xr{constructor(t,e,r,n){this.name=t,this.type=e,this._evaluate=r,this.args=n;}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t);}outputDefined(){return !1}static parse(t,e){const r=t[0],n=Xr.definitions[r];if(!n)return e.error(`Unknown expression \"${r}\". If you wanted a literal array, use [\"literal\", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let o=null;for(const[n,s]of a){o=new fe(e.registry,Qr,e.path,null,e.scope);const a=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(wt).join(\", \")})`:`(${wt(e.type)}...)`;var e;})).join(\" | \"),n=[];for(let r=1;r{r=e?r&&Qr(t):r&&t instanceof se;})),!!r&&tn(t)&&rn(t,[\"zoom\",\"heatmap-density\",\"line-progress\",\"accumulated\",\"is-supported-script\"])}function tn(t){if(t instanceof Xr){if(\"get\"===t.name&&1===t.args.length)return !1;if(\"feature-state\"===t.name)return !1;if(\"has\"===t.name&&1===t.args.length)return !1;if(\"properties\"===t.name||\"geometry-type\"===t.name||\"id\"===t.name)return !1;if(/^filter-/.test(t.name))return !1}if(t instanceof pr)return !1;if(t instanceof Gr)return !1;let e=!0;return t.eachChild((t=>{e&&!tn(t)&&(e=!1);})),e}function en(t){if(t instanceof Xr&&\"feature-state\"===t.name)return !1;let e=!0;return t.eachChild((t=>{e&&!en(t)&&(e=!1);})),e}function rn(t,e){if(t instanceof Xr&&e.indexOf(t.name)>=0)return !1;let r=!0;return t.eachChild((t=>{r&&!rn(t,e)&&(r=!1);})),r}function nn(t){return {result:\"success\",value:t}}function sn(t){return {result:\"error\",value:t}}function an(t){return \"data-driven\"===t[\"property-type\"]||\"cross-faded-data-driven\"===t[\"property-type\"]}function on(t){return !!t.expression&&t.expression.parameters.indexOf(\"zoom\")>-1}function ln(t){return !!t.expression&&t.expression.interpolated}function un(t){return t instanceof Number?\"number\":t instanceof String?\"string\":t instanceof Boolean?\"boolean\":Array.isArray(t)?\"array\":null===t?\"null\":typeof t}function cn(t){return \"object\"==typeof t&&null!==t&&!Array.isArray(t)}function hn(t){return t}function pn(t,e){const r=\"color\"===e.type,n=t.stops&&\"object\"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(ln(e)?\"exponential\":\"interval\");if(r||\"padding\"===e.type){const n=r?Kt.parse:Jt.parse;(t=st({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],n(t[1])]))),t.default=n(t.default?t.default:e.default);}if(t.colorSpace&&\"rgb\"!==(a=t.colorSpace)&&\"hcl\"!==a&&\"lab\"!==a)throw new Error(`Unknown color space: \"${t.colorSpace}\"`);var a;let o,l,u;if(\"exponential\"===s)o=mn;else if(\"interval\"===s)o=yn;else if(\"categorical\"===s){o=dn,l=Object.create(null);for(const e of t.stops)l[e[0]]=e[1];u=typeof t.stops[0][0];}else {if(\"identity\"!==s)throw new Error(`Unknown function type \"${s}\"`);o=gn;}if(n){const r={},n=[];for(let e=0;et[0])),evaluate:({zoom:r},n)=>mn({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r=\"exponential\"===s?{name:\"exponential\",base:void 0!==t.base?t.base:1}:null;return {kind:\"camera\",interpolationType:r,interpolationFactor:Be.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>o(t,e,r,l,u)}}return {kind:\"source\",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?fn(t.default,e.default):o(t,e,i,l,u)}}}function fn(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function dn(t,e,r,n,i){return fn(typeof r===i?n[r]:void 0,t.default,e.default)}function yn(t,e,r){if(\"number\"!==un(r))return fn(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=_e(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function mn(t,e,r){const n=void 0!==t.base?t.base:1;if(\"number\"!==un(r))return fn(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const s=_e(t.stops.map((t=>t[0])),r),a=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),o=t.stops[s][1],l=t.stops[s+1][1],u=Ce[e.type]||hn;return \"function\"==typeof o.evaluate?{evaluate(...e){const r=o.evaluate.apply(void 0,e),n=l.evaluate.apply(void 0,e);if(void 0!==r&&void 0!==n)return u(r,n,a,t.colorSpace)}}:u(o,l,a,t.colorSpace)}function gn(t,e,r){switch(e.type){case\"color\":r=Kt.parse(r);break;case\"formatted\":r=Yt.fromString(r.toString());break;case\"resolvedImage\":r=te.fromString(r.toString());break;case\"padding\":r=Jt.parse(r);break;default:un(r)===e.type||\"enum\"===e.type&&e.values[r]||(r=void 0);}return fn(r,t.default,e.default)}Xr.register(Kr,{error:[{kind:\"error\"},[ct],(t,[e])=>{throw new ae(e.evaluate(t))}],typeof:[ct,[dt],(t,[e])=>wt(ne(e.evaluate(t)))],\"to-rgba\":[bt(ut,4),[pt],(t,[e])=>{const[r,n,i,s]=e.evaluate(t).rgb;return [255*r,255*n,255*i,s]}],rgb:[pt,[ut,ut,ut],Hr],rgba:[pt,[ut,ut,ut,ut],Hr],has:{type:ht,overloads:[[[ct],(t,[e])=>Yr(e.evaluate(t),t.properties())],[[ct,ft],(t,[e,r])=>Yr(e.evaluate(t),r.evaluate(t))]]},get:{type:dt,overloads:[[[ct],(t,[e])=>Jr(e.evaluate(t),t.properties())],[[ct,ft],(t,[e,r])=>Jr(e.evaluate(t),r.evaluate(t))]]},\"feature-state\":[dt,[ct],(t,[e])=>Jr(e.evaluate(t),t.featureState||{})],properties:[ft,[],t=>t.properties()],\"geometry-type\":[ct,[],t=>t.geometryType()],id:[dt,[],t=>t.id()],zoom:[ut,[],t=>t.globals.zoom],\"heatmap-density\":[ut,[],t=>t.globals.heatmapDensity||0],\"line-progress\":[ut,[],t=>t.globals.lineProgress||0],accumulated:[dt,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],\"+\":[ut,Wr(ut),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],\"*\":[ut,Wr(ut),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],\"-\":{type:ut,overloads:[[[ut,ut],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[ut],(t,[e])=>-e.evaluate(t)]]},\"/\":[ut,[ut,ut],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],\"%\":[ut,[ut,ut],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[ut,[],()=>Math.LN2],pi:[ut,[],()=>Math.PI],e:[ut,[],()=>Math.E],\"^\":[ut,[ut,ut],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[ut,[ut],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[ut,[ut],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[ut,[ut],(t,[e])=>Math.log(e.evaluate(t))],log2:[ut,[ut],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[ut,[ut],(t,[e])=>Math.sin(e.evaluate(t))],cos:[ut,[ut],(t,[e])=>Math.cos(e.evaluate(t))],tan:[ut,[ut],(t,[e])=>Math.tan(e.evaluate(t))],asin:[ut,[ut],(t,[e])=>Math.asin(e.evaluate(t))],acos:[ut,[ut],(t,[e])=>Math.acos(e.evaluate(t))],atan:[ut,[ut],(t,[e])=>Math.atan(e.evaluate(t))],min:[ut,Wr(ut),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[ut,Wr(ut),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[ut,[ut],(t,[e])=>Math.abs(e.evaluate(t))],round:[ut,[ut],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[ut,[ut],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[ut,[ut],(t,[e])=>Math.ceil(e.evaluate(t))],\"filter-==\":[ht,[ct,dt],(t,[e,r])=>t.properties()[e.value]===r.value],\"filter-id-==\":[ht,[dt],(t,[e])=>t.id()===e.value],\"filter-type-==\":[ht,[ct],(t,[e])=>t.geometryType()===e.value],\"filter-<\":[ht,[ct,dt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n{const r=t.id(),n=e.value;return typeof r==typeof n&&r\":[ht,[ct,dt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],\"filter-id->\":[ht,[dt],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],\"filter-<=\":[ht,[ct,dt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],\"filter-id-<=\":[ht,[dt],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],\"filter->=\":[ht,[ct,dt],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],\"filter-id->=\":[ht,[dt],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],\"filter-has\":[ht,[dt],(t,[e])=>e.value in t.properties()],\"filter-has-id\":[ht,[],t=>null!==t.id()&&void 0!==t.id()],\"filter-type-in\":[ht,[bt(ct)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],\"filter-id-in\":[ht,[bt(dt)],(t,[e])=>e.value.indexOf(t.id())>=0],\"filter-in-small\":[ht,[ct,bt(dt)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],\"filter-in-large\":[ht,[ct,bt(dt)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return !0;e[i]>t?n=i-1:r=i+1;}return !1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:ht,overloads:[[[ht,ht],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[Wr(ht),(t,e)=>{for(const r of e)if(!r.evaluate(t))return !1;return !0}]]},any:{type:ht,overloads:[[[ht,ht],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[Wr(ht),(t,e)=>{for(const r of e)if(r.evaluate(t))return !0;return !1}]]},\"!\":[ht,[ht],(t,[e])=>!e.evaluate(t)],\"is-supported-script\":[ht,[ct],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return !r||r(e.evaluate(t))}],upcase:[ct,[ct],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ct,[ct],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ct,Wr(dt),(t,e)=>e.map((e=>ie(e.evaluate(t)))).join(\"\")],\"resolved-locale\":[ct,[yt],(t,[e])=>e.evaluate(t).resolvedLocale()]});class xn{constructor(t,e){var r;this.expression=t,this._warningHistory={},this._evaluator=new pe,this._defaultValue=e?\"color\"===(r=e).type&&cn(r.default)?new Kt(0,0,0,0):\"color\"===r.type?Kt.parse(r.default)||null:\"padding\"===r.type?Jt.parse(r.default)||null:\"variableAnchorOffsetCollection\"===r.type?Qt.parse(r.default)||null:void 0===r.default?null:r.default:null,this._enumValues=e&&\"enum\"===e.type?e.values:null;}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||\"number\"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new ae(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(\", \")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,\"undefined\"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function vn(t){return Array.isArray(t)&&t.length>0&&\"string\"==typeof t[0]&&t[0]in Kr}function bn(t,e){const r=new fe(Kr,Qr,[],e?function(t){const e={color:pt,string:ct,number:ut,enum:ct,boolean:ht,formatted:mt,padding:gt,resolvedImage:xt,variableAnchorOffsetCollection:vt};return \"array\"===t.type?bt(e[t.value]||dt,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&\"string\"===e.type?{typeAnnotation:\"coerce\"}:void 0);return n?nn(new xn(n,e)):sn(r.errors)}class wn{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent=\"constant\"!==t&&!en(e.expression);}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}}class _n{constructor(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=\"camera\"!==t&&!en(e.expression),this.interpolationType=n;}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?Be.interpolationFactor(this.interpolationType,t,e,r):0}}function An(t,e){const r=bn(t,e);if(\"error\"===r.result)return r;const n=r.value.expression,i=tn(n);if(!i&&!an(e))return sn([new at(\"\",\"data expressions not supported\")]);const s=rn(n,[\"zoom\"]);if(!s&&!on(e))return sn([new at(\"\",\"zoom expressions not supported\")]);const a=kn(n);return a||s?a instanceof at?sn([a]):a instanceof Be&&!ln(e)?sn([new at(\"\",'\"interpolate\" expressions cannot be used with this property')]):nn(a?new _n(i?\"camera\":\"composite\",r.value,a.labels,a instanceof Be?a.interpolation:void 0):new wn(i?\"constant\":\"source\",r.value)):sn([new at(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')])}class Sn{constructor(t,e){this._parameters=t,this._specification=e,st(this,pn(this._parameters,this._specification));}static deserialize(t){return new Sn(t._parameters,t._specification)}static serialize(t){return {_parameters:t._parameters,_specification:t._specification}}}function kn(t){let e=null;if(t instanceof de)e=kn(t.result);else if(t instanceof Ee){for(const r of t.args)if(e=kn(r),e)break}else (t instanceof Ae||t instanceof Be)&&t.input instanceof Xr&&\"zoom\"===t.input.name&&(e=t);return e instanceof at||t.eachChild((t=>{const r=kn(t);r instanceof at?e=r:!e&&r?e=new at(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.'):e&&r&&e!==r&&(e=new at(\"\",'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.'));})),e}function Mn(t){if(!0===t||!1===t)return !0;if(!Array.isArray(t)||0===t.length)return !1;switch(t[0]){case\"has\":return t.length>=2&&\"$id\"!==t[1]&&\"$type\"!==t[1];case\"in\":return t.length>=3&&(\"string\"!=typeof t[1]||Array.isArray(t[2]));case\"!in\":case\"!has\":case\"none\":return !1;case\"==\":case\"!=\":case\">\":case\">=\":case\"<\":case\"<=\":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case\"any\":case\"all\":for(const e of t.slice(1))if(!Mn(e)&&\"boolean\"!=typeof e)return !1;return !0;default:return !0}}const In={type:\"boolean\",default:!1,transition:!1,\"property-type\":\"data-driven\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]}};function zn(t){if(null==t)return {filter:()=>!0,needGeometry:!1};Mn(t)||(t=Bn(t));const e=bn(t,In);if(\"error\"===e.result)throw new Error(e.value.map((t=>`${t.key}: ${t.message}`)).join(\", \"));return {filter:(t,r,n)=>e.value.evaluate(t,r,{},n),needGeometry:Cn(t)}}function Pn(t,e){return te?1:0}function Cn(t){if(!Array.isArray(t))return !1;if(\"within\"===t[0]||\"distance\"===t[0])return !0;for(let e=1;e\"===e||\"<=\"===e||\">=\"===e?Vn(t[1],t[2],e):\"any\"===e?(r=t.slice(1),[\"any\"].concat(r.map(Bn))):\"all\"===e?[\"all\"].concat(t.slice(1).map(Bn)):\"none\"===e?[\"all\"].concat(t.slice(1).map(Bn).map(Tn)):\"in\"===e?En(t[1],t.slice(2)):\"!in\"===e?Tn(En(t[1],t.slice(2))):\"has\"===e?Fn(t[1]):\"!has\"!==e||Tn(Fn(t[1]));var r;}function Vn(t,e,r){switch(t){case\"$type\":return [`filter-type-${r}`,e];case\"$id\":return [`filter-id-${r}`,e];default:return [`filter-${r}`,t,e]}}function En(t,e){if(0===e.length)return !1;switch(t){case\"$type\":return [\"filter-type-in\",[\"literal\",e]];case\"$id\":return [\"filter-id-in\",[\"literal\",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?[\"filter-in-large\",t,[\"literal\",e.sort(Pn)]]:[\"filter-in-small\",t,[\"literal\",e]]}}function Fn(t){switch(t){case\"$type\":return !0;case\"$id\":return [\"filter-has-id\"];default:return [\"filter-has\",t]}}function Tn(t){return [\"!\",t]}function $n(t){const e=typeof t;if(\"number\"===e||\"boolean\"===e||\"string\"===e||null==t)return JSON.stringify(t);if(Array.isArray(t)){let e=\"[\";for(const r of t)e+=`${$n(r)},`;return `${e}]`}const r=Object.keys(t).sort();let n=\"{\";for(let e=0;en.maximum?[new it(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Nn(t){const e=t.valueSpec,r=On(t.value.type);let n,i,s,a={};const o=\"categorical\"!==r&&void 0===t.value.property,l=!o,u=\"array\"===un(t.value.stops)&&\"array\"===un(t.value.stops[0])&&\"object\"===un(t.value.stops[0][0]),c=Rn({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if(\"identity\"===r)return [new it(t.key,t.value,'identity function may not have a \"stops\" property')];let e=[];const n=t.value;return e=e.concat(Un({key:t.key,value:n,valueSpec:t.valueSpec,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),\"array\"===un(n)&&0===n.length&&e.push(new it(t.key,n,\"array must have at least one stop\")),e},default:function(t){return t.validateSpec({key:t.key,value:t.value,valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec})}}});return \"identity\"===r&&o&&c.push(new it(t.key,t.value,'missing required property \"property\"')),\"identity\"===r||t.value.stops||c.push(new it(t.key,t.value,'missing required property \"stops\"')),\"exponential\"===r&&t.valueSpec.expression&&!ln(t.valueSpec)&&c.push(new it(t.key,t.value,\"exponential functions not supported\")),t.styleSpec.$version>=8&&(l&&!an(t.valueSpec)?c.push(new it(t.key,t.value,\"property functions not supported\")):o&&!on(t.valueSpec)&&c.push(new it(t.key,t.value,\"zoom functions not supported\"))),\"categorical\"!==r&&!u||void 0!==t.value.property||c.push(new it(t.key,t.value,'\"property\" property is required')),c;function h(t){let r=[];const n=t.value,o=t.key;if(\"array\"!==un(n))return [new it(o,n,`array expected, ${un(n)} found`)];if(2!==n.length)return [new it(o,n,`array length 2 expected, length ${n.length} found`)];if(u){if(\"object\"!==un(n[0]))return [new it(o,n,`object expected, ${un(n[0])} found`)];if(void 0===n[0].zoom)return [new it(o,n,\"object stop key must have zoom\")];if(void 0===n[0].value)return [new it(o,n,\"object stop key must have value\")];if(s&&s>On(n[0].zoom))return [new it(o,n[0].zoom,\"stop zoom values must appear in ascending order\")];On(n[0].zoom)!==s&&(s=On(n[0].zoom),i=void 0,a={}),r=r.concat(Rn({key:`${o}[0]`,value:n[0],valueSpec:{zoom:{}},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:qn,value:p}}));}else r=r.concat(p({key:`${o}[0]`,value:n[0],valueSpec:{},validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec},n));return vn(jn(n[1]))?r.concat([new it(`${o}[1]`,n[1],\"expressions are not allowed in function stops.\")]):r.concat(t.validateSpec({key:`${o}[1]`,value:n[1],valueSpec:e,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec}))}function p(t,s){const o=un(t.value),l=On(t.value),u=null!==t.value?t.value:s;if(n){if(o!==n)return [new it(t.key,u,`${o} stop domain type must match previous stop domain type ${n}`)]}else n=o;if(\"number\"!==o&&\"string\"!==o&&\"boolean\"!==o)return [new it(t.key,u,\"stop domain value must be a number, string, or boolean\")];if(\"number\"!==o&&\"categorical\"!==r){let n=`number expected, ${o} found`;return an(e)&&void 0===r&&(n+='\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.'),[new it(t.key,u,n)]}return \"categorical\"!==r||\"number\"!==o||isFinite(l)&&Math.floor(l)===l?\"categorical\"!==r&&\"number\"===o&&void 0!==i&&lnew it(`${t.key}${e.key}`,t.value,e.message)));const r=e.value.expression||e.value._styleExpression.expression;if(\"property\"===t.expressionContext&&\"text-font\"===t.propertyKey&&!r.outputDefined())return [new it(t.key,t.value,`Invalid data expression for \"${t.propertyKey}\". Output values must be contained as literals within the expression.`)];if(\"property\"===t.expressionContext&&\"layout\"===t.propertyType&&!en(r))return [new it(t.key,t.value,'\"feature-state\" data expressions are not supported with layout properties.')];if(\"filter\"===t.expressionContext&&!en(r))return [new it(t.key,t.value,'\"feature-state\" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf(\"cluster\")){if(!rn(r,[\"zoom\",\"feature-state\"]))return [new it(t.key,t.value,'\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];if(\"cluster-initial\"===t.expressionContext&&!tn(r))return [new it(t.key,t.value,\"Feature data expressions are not supported with initial expression part of cluster properties.\")]}return []}function Gn(t){const e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(On(r))&&i.push(new it(e,r,`expected one of [${n.values.join(\", \")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(On(r))&&i.push(new it(e,r,`expected one of [${Object.keys(n.values).join(\", \")}], ${JSON.stringify(r)} found`)),i}function Kn(t){return Mn(jn(t.value))?Zn(st({},t,{expressionContext:\"filter\",valueSpec:{value:\"boolean\"}})):Xn(t)}function Xn(t){const e=t.value,r=t.key;if(\"array\"!==un(e))return [new it(r,e,`array expected, ${un(e)} found`)];const n=t.styleSpec;let i,s=[];if(e.length<1)return [new it(r,e,\"filter array must have at least 1 element\")];switch(s=s.concat(Gn({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),On(e[0])){case\"<\":case\"<=\":case\">\":case\">=\":e.length>=2&&\"$type\"===On(e[1])&&s.push(new it(r,e,`\"$type\" cannot be use with operator \"${e[0]}\"`));case\"==\":case\"!=\":3!==e.length&&s.push(new it(r,e,`filter array for operator \"${e[0]}\" must have 3 elements`));case\"in\":case\"!in\":e.length>=2&&(i=un(e[1]),\"string\"!==i&&s.push(new it(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a{t in r&&e.push(new it(n,r[t],`\"${t}\" is prohibited for ref layers`));})),i.layers.forEach((e=>{On(e.id)===o&&(t=e);})),t?t.ref?e.push(new it(n,r.ref,\"ref cannot reference another ref layer\")):a=On(t.type):e.push(new it(n,r.ref,`ref layer \"${o}\" not found`));}else if(\"background\"!==a)if(r.source){const t=i.sources&&i.sources[r.source],s=t&&On(t.type);t?\"vector\"===s&&\"raster\"===a?e.push(new it(n,r.source,`layer \"${r.id}\" requires a raster source`)):\"raster-dem\"!==s&&\"hillshade\"===a?e.push(new it(n,r.source,`layer \"${r.id}\" requires a raster-dem source`)):\"raster\"===s&&\"raster\"!==a?e.push(new it(n,r.source,`layer \"${r.id}\" requires a vector source`)):\"vector\"!==s||r[\"source-layer\"]?\"raster-dem\"===s&&\"hillshade\"!==a?e.push(new it(n,r.source,\"raster-dem source can only be used with layer type 'hillshade'.\")):\"line\"!==a||!r.paint||!r.paint[\"line-gradient\"]||\"geojson\"===s&&t.lineMetrics||e.push(new it(n,r,`layer \"${r.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new it(n,r,`layer \"${r.id}\" must specify a \"source-layer\"`)):e.push(new it(n,r.source,`source \"${r.source}\" not found`));}else e.push(new it(n,r,'missing required property \"source\"'));return e=e.concat(Rn({key:n,value:r,valueSpec:s.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{\"*\":()=>[],type:()=>t.validateSpec({key:`${n}.type`,value:r.type,valueSpec:s.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:\"type\"}),filter:Kn,layout:t=>Rn({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{\"*\":t=>Jn(st({layerType:a},t))}}),paint:t=>Rn({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{\"*\":t=>Yn(st({layerType:a},t))}})}})),e}function Qn(t){const e=t.value,r=t.key,n=un(e);return \"string\"!==n?[new it(r,e,`string expected, ${n} found`)]:[]}const ti={promoteId:function({key:t,value:e}){if(\"string\"===un(e))return Qn({key:t,value:e});{const r=[];for(const n in e)r.push(...Qn({key:`${t}.${n}`,value:e[n]}));return r}}};function ei(t){const e=t.value,r=t.key,n=t.styleSpec,i=t.style,s=t.validateSpec;if(!e.type)return [new it(r,e,'\"type\" is required')];const a=On(e.type);let o;switch(a){case\"vector\":case\"raster\":return o=Rn({key:r,value:e,valueSpec:n[`source_${a.replace(\"-\",\"_\")}`],style:t.style,styleSpec:n,objectElementValidators:ti,validateSpec:s}),o;case\"raster-dem\":return o=function(t){var e;const r=null!==(e=t.sourceName)&&void 0!==e?e:\"\",n=t.value,i=t.styleSpec,s=i.source_raster_dem,a=t.style;let o=[];const l=un(n);if(void 0===n)return o;if(\"object\"!==l)return o.push(new it(\"source_raster_dem\",n,`object expected, ${l} found`)),o;const u=\"custom\"===On(n.encoding),c=[\"redFactor\",\"greenFactor\",\"blueFactor\",\"baseShift\"],h=t.value.encoding?`\"${t.value.encoding}\"`:\"Default\";for(const e in n)!u&&c.includes(e)?o.push(new it(e,n[e],`In \"${r}\": \"${e}\" is only valid when \"encoding\" is set to \"custom\". ${h} encoding found`)):s[e]?o=o.concat(t.validateSpec({key:e,value:n[e],valueSpec:s[e],validateSpec:t.validateSpec,style:a,styleSpec:i})):o.push(new it(e,n[e],`unknown property \"${e}\"`));return o}({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:s}),o;case\"geojson\":if(o=Rn({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:s,objectElementValidators:ti}),e.cluster)for(const t in e.clusterProperties){const[n,i]=e.clusterProperties[t],a=\"string\"==typeof n?[n,[\"accumulated\"],[\"get\",t]]:n;o.push(...Zn({key:`${r}.${t}.map`,value:i,validateSpec:s,expressionContext:\"cluster-map\"})),o.push(...Zn({key:`${r}.${t}.reduce`,value:a,validateSpec:s,expressionContext:\"cluster-reduce\"}));}return o;case\"video\":return Rn({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:s,styleSpec:n});case\"image\":return Rn({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:s,styleSpec:n});case\"canvas\":return [new it(r,null,\"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\",\"source.canvas\")];default:return Gn({key:`${r}.type`,value:e.type,valueSpec:{values:[\"vector\",\"raster\",\"raster-dem\",\"geojson\",\"video\",\"image\"]},style:i,validateSpec:s,styleSpec:n})}}function ri(t){const e=t.value,r=t.styleSpec,n=r.light,i=t.style;let s=[];const a=un(e);if(void 0===e)return s;if(\"object\"!==a)return s=s.concat([new it(\"light\",e,`object expected, ${a} found`)]),s;for(const a in e){const o=a.match(/^(.*)-transition$/);s=s.concat(o&&n[o[1]]&&n[o[1]].transition?t.validateSpec({key:a,value:e[a],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r}):n[a]?t.validateSpec({key:a,value:e[a],valueSpec:n[a],validateSpec:t.validateSpec,style:i,styleSpec:r}):[new it(a,e[a],`unknown property \"${a}\"`)]);}return s}function ni(t){const e=t.value,r=t.styleSpec,n=r.sky,i=t.style,s=un(e);if(void 0===e)return [];if(\"object\"!==s)return [new it(\"sky\",e,`object expected, ${s} found`)];let a=[];for(const s in e)a=a.concat(n[s]?t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r}):[new it(s,e[s],`unknown property \"${s}\"`)]);return a}function ii(t){const e=t.value,r=t.styleSpec,n=r.terrain,i=t.style;let s=[];const a=un(e);if(void 0===e)return s;if(\"object\"!==a)return s=s.concat([new it(\"terrain\",e,`object expected, ${a} found`)]),s;for(const a in e)s=s.concat(n[a]?t.validateSpec({key:a,value:e[a],valueSpec:n[a],validateSpec:t.validateSpec,style:i,styleSpec:r}):[new it(a,e[a],`unknown property \"${a}\"`)]);return s}function si(t){let e=[];const r=t.value,n=t.key;if(Array.isArray(r)){const i=[],s=[];for(const a in r)r[a].id&&i.includes(r[a].id)&&e.push(new it(n,r,`all the sprites' ids must be unique, but ${r[a].id} is duplicated`)),i.push(r[a].id),r[a].url&&s.includes(r[a].url)&&e.push(new it(n,r,`all the sprites' URLs must be unique, but ${r[a].url} is duplicated`)),s.push(r[a].url),e=e.concat(Rn({key:`${n}[${a}]`,value:r[a],valueSpec:{id:{type:\"string\",required:!0},url:{type:\"string\",required:!0}},validateSpec:t.validateSpec}));return e}return Qn({key:n,value:r})}const ai={\"*\":()=>[],array:Un,boolean:function(t){const e=t.value,r=t.key,n=un(e);return \"boolean\"!==n?[new it(r,e,`boolean expected, ${n} found`)]:[]},number:qn,color:function(t){const e=t.key,r=t.value,n=un(r);return \"string\"!==n?[new it(e,r,`color expected, ${n} found`)]:Kt.parse(String(r))?[]:[new it(e,r,`color expected, \"${r}\" found`)]},constants:Dn,enum:Gn,filter:Kn,function:Nn,layer:Wn,object:Rn,source:ei,light:ri,sky:ni,terrain:ii,projection:function(t){const e=t.value,r=t.styleSpec,n=r.projection,i=t.style,s=un(e);if(void 0===e)return [];if(\"object\"!==s)return [new it(\"projection\",e,`object expected, ${s} found`)];let a=[];for(const s in e)a=a.concat(n[s]?t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r}):[new it(s,e[s],`unknown property \"${s}\"`)]);return a},string:Qn,formatted:function(t){return 0===Qn(t).length?[]:Zn(t)},resolvedImage:function(t){return 0===Qn(t).length?[]:Zn(t)},padding:function(t){const e=t.key,r=t.value;if(\"array\"===un(r)){if(r.length<1||r.length>4)return [new it(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const n={type:\"number\"};let i=[];for(let s=0;s[]}})),t.constants&&(r=r.concat(Dn({key:\"constants\",value:t.constants,style:t,styleSpec:e,validateSpec:oi}))),hi(r)}function ci(t){return function(e){return t({...e,validateSpec:oi})}}function hi(t){return [].concat(t).sort(((t,e)=>t.line-e.line))}function pi(t){return function(...e){return hi(t.apply(this,e))}}ui.source=pi(ci(ei)),ui.sprite=pi(ci(si)),ui.glyphs=pi(ci(li)),ui.light=pi(ci(ri)),ui.sky=pi(ci(ni)),ui.terrain=pi(ci(ii)),ui.layer=pi(ci(Wn)),ui.filter=pi(ci(Kn)),ui.paintProperty=pi(ci(Yn)),ui.layoutProperty=pi(ci(Jn));const fi=ui,di=fi.light,yi=fi.sky,mi=fi.paintProperty,gi=fi.layoutProperty;function xi(t,e){let r=!1;if(e&&e.length)for(const n of e)t.fire(new N(new Error(n.message))),r=!0;return r}class vi{constructor(t,e,r){const n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const i=new Int32Array(this.arrayBuffer);t=i[0],this.d=(e=i[1])+2*(r=i[2]);for(let t=0;t=u[l+0]&&n>=u[l+1])?(a[h]=!0,s.push(i[h])):a[h]=!1;}}}}_forEachCell(t,e,r,n,i,s,a,o){const l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){const u=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,t,e,r,n,u,s,a,o))return}}_convertFromCellCoord(t){return (t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,e=3+this.cells.length+1+1;let r=0;for(let t=0;t=0)continue;const s=t[n];i[n]=bi[r].shallow.indexOf(n)>=0?s:ki(s,e);}t instanceof Error&&(i.message=t.message);}if(i.$name)throw new Error(\"$name property is reserved for worker serialization logic.\");return \"Object\"!==r&&(i.$name=r),i}function Mi(t){if(Si(t))return t;if(Array.isArray(t))return t.map(Mi);if(\"object\"!=typeof t)throw new Error(\"can't deserialize object of type \"+typeof t);const e=Ai(t)||\"Object\";if(!bi[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=bi[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const r of Object.keys(t)){if(\"$name\"===r)continue;const i=t[r];n[r]=bi[e].shallow.indexOf(r)>=0?i:Mi(i);}return n}class Ii{constructor(){this.first=!0;}update(t,e){const r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoomt>=128&&t<=255,\"Hangul Jamo\":t=>t>=4352&&t<=4607,Khmer:t=>t>=6016&&t<=6143,\"General Punctuation\":t=>t>=8192&&t<=8303,\"Letterlike Symbols\":t=>t>=8448&&t<=8527,\"Number Forms\":t=>t>=8528&&t<=8591,\"Miscellaneous Technical\":t=>t>=8960&&t<=9215,\"Control Pictures\":t=>t>=9216&&t<=9279,\"Optical Character Recognition\":t=>t>=9280&&t<=9311,\"Enclosed Alphanumerics\":t=>t>=9312&&t<=9471,\"Geometric Shapes\":t=>t>=9632&&t<=9727,\"Miscellaneous Symbols\":t=>t>=9728&&t<=9983,\"Miscellaneous Symbols and Arrows\":t=>t>=11008&&t<=11263,\"Ideographic Description Characters\":t=>t>=12272&&t<=12287,\"CJK Symbols and Punctuation\":t=>t>=12288&&t<=12351,Katakana:t=>t>=12448&&t<=12543,Kanbun:t=>t>=12688&&t<=12703,\"CJK Strokes\":t=>t>=12736&&t<=12783,\"Enclosed CJK Letters and Months\":t=>t>=12800&&t<=13055,\"CJK Compatibility\":t=>t>=13056&&t<=13311,\"Yijing Hexagram Symbols\":t=>t>=19904&&t<=19967,\"Private Use Area\":t=>t>=57344&&t<=63743,\"Vertical Forms\":t=>t>=65040&&t<=65055,\"CJK Compatibility Forms\":t=>t>=65072&&t<=65103,\"Small Form Variants\":t=>t>=65104&&t<=65135,\"Halfwidth and Fullwidth Forms\":t=>t>=65280&&t<=65519};function Pi(t){for(const e of t)if(Ti(e.charCodeAt(0)))return !0;return !1}function Ci(t){for(const e of t)if(!Ei(e.charCodeAt(0)))return !1;return !0}function Bi(t){const e=t.map((t=>{try{return new RegExp(`\\\\p{sc=${t}}`,\"u\").source}catch(t){return null}})).filter((t=>t));return new RegExp(e.join(\"|\"),\"u\")}const Vi=Bi([\"Arab\",\"Dupl\",\"Mong\",\"Ougr\",\"Syrc\"]);function Ei(t){return !Vi.test(String.fromCodePoint(t))}const Fi=Bi([\"Bopo\",\"Hani\",\"Hira\",\"Kana\",\"Kits\",\"Nshu\",\"Tang\",\"Yiii\"]);function Ti(t){return !(746!==t&&747!==t&&(t<4352||!(zi[\"CJK Compatibility Forms\"](t)&&!(t>=65097&&t<=65103)||zi[\"CJK Compatibility\"](t)||zi[\"CJK Strokes\"](t)||!(!zi[\"CJK Symbols and Punctuation\"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||zi[\"Enclosed CJK Letters and Months\"](t)||zi[\"Ideographic Description Characters\"](t)||zi.Kanbun(t)||zi.Katakana(t)&&12540!==t||!(!zi[\"Halfwidth and Fullwidth Forms\"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!zi[\"Small Form Variants\"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||zi[\"Vertical Forms\"](t)||zi[\"Yijing Hexagram Symbols\"](t)||/\\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\\p{sc=Hang}/u.test(String.fromCodePoint(t))||Fi.test(String.fromCodePoint(t)))))}function $i(t){return !(Ti(t)||function(t){return !!(zi[\"Latin-1 Supplement\"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||zi[\"General Punctuation\"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||zi[\"Letterlike Symbols\"](t)||zi[\"Number Forms\"](t)||zi[\"Miscellaneous Technical\"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||zi[\"Control Pictures\"](t)&&9251!==t||zi[\"Optical Character Recognition\"](t)||zi[\"Enclosed Alphanumerics\"](t)||zi[\"Geometric Shapes\"](t)||zi[\"Miscellaneous Symbols\"](t)&&!(t>=9754&&t<=9759)||zi[\"Miscellaneous Symbols and Arrows\"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||zi[\"CJK Symbols and Punctuation\"](t)||zi.Katakana(t)||zi[\"Private Use Area\"](t)||zi[\"CJK Compatibility Forms\"](t)||zi[\"Small Form Variants\"](t)||zi[\"Halfwidth and Fullwidth Forms\"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}const Li=Bi([\"Adlm\",\"Arab\",\"Armi\",\"Avst\",\"Chrs\",\"Cprt\",\"Egyp\",\"Elym\",\"Gara\",\"Hatr\",\"Hebr\",\"Hung\",\"Khar\",\"Lydi\",\"Mand\",\"Mani\",\"Mend\",\"Merc\",\"Mero\",\"Narb\",\"Nbat\",\"Nkoo\",\"Orkh\",\"Palm\",\"Phli\",\"Phlp\",\"Phnx\",\"Prti\",\"Rohg\",\"Samr\",\"Sarb\",\"Sogo\",\"Syrc\",\"Thaa\",\"Todr\",\"Yezi\"]);function Di(t){return Li.test(String.fromCodePoint(t))}function Oi(t,e){return !(!e&&Di(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||zi.Khmer(t))}function ji(t){for(const e of t)if(Di(e.charCodeAt(0)))return !0;return !1}const Ri=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus=\"unavailable\",this.pluginURL=null;}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL;}getState(){return {pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText;}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Ui{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ii,this.transition={});}isSupportedScript(t){return function(t,e){for(const r of t)if(!Oi(r.charCodeAt(0),e))return !1;return !0}(t,\"loaded\"===Ri.getRTLTextPluginStatus())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}}class qi{constructor(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(cn(t))return new Sn(t,e);if(vn(t)){const r=An(t,e);if(\"error\"===r.result)throw new Error(r.value.map((t=>`${t.key}: ${t.message}`)).join(\", \"));return r.value}{let r=t;return \"color\"===e.type&&\"string\"==typeof t?r=Kt.parse(t):\"padding\"!==e.type||\"number\"!=typeof t&&!Array.isArray(t)?\"variableAnchorOffsetCollection\"===e.type&&Array.isArray(t)&&(r=Qt.parse(t)):r=Jt.parse(t),{kind:\"constant\",evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification);}isDataDriven(){return \"source\"===this.expression.kind||\"composite\"===this.expression.kind}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}}class Ni{constructor(t){this.property=t,this.value=new qi(t,void 0);}transitioned(t,e){return new Gi(this.property,this.value,e,g({},t.transition,this.transition),t.now)}untransitioned(){return new Gi(this.property,this.value,null,{},0)}}class Zi{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues);}getValue(t){return w(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ni(this._values[t].property)),this._values[t].value=new qi(this._values[t].property,null===e?void 0:w(e));}getTransition(t){return w(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Ni(this._values[t].property)),this._values[t].transition=w(e)||void 0;}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n);}return t}transitioned(t,e){const r=new Ki(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new Ki(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class Gi{constructor(t,e,r,n,i){this.property=t,this.value=e,this.begin=i+n.delay||0,this.end=this.begin+n.duration||0,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r);}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}}return i}}class Ki{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues);}possiblyEvaluate(t,e,r){const n=new Yi(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return !0;return !1}}class Xi{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues);}hasValue(t){return void 0!==this._values[t].value}getValue(t){return w(this._values[t].value)}setValue(t,e){this._values[t]=new qi(this._values[t].property,null===e?void 0:w(e));}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);}return t}possiblyEvaluate(t,e,r){const n=new Yi(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}}class Hi{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r;}isConstant(){return \"constant\"===this.value.kind}constantOr(t){return \"constant\"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n)}}class Yi{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues);}get(t){return this._values[t]}}class Ji{constructor(t){this.specification=t;}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error(\"Value should not be data driven\");return t.expression.evaluate(e)}interpolate(t,e,r){const n=Ce[this.specification.type];return n?n(t,e,r):t}}class Wi{constructor(t,e){this.specification=t,this.overrides=e;}possiblyEvaluate(t,e,r,n){return new Hi(this,\"constant\"===t.expression.kind||\"camera\"===t.expression.kind?{kind:\"constant\",value:t.expression.evaluate(e,null,{},r,n)}:t.expression,e)}interpolate(t,e,r){if(\"constant\"!==t.value.kind||\"constant\"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Hi(this,{kind:\"constant\",value:void 0},t.parameters);const n=Ce[this.specification.type];if(n){const i=n(t.value.value,e.value.value,r);return new Hi(this,{kind:\"constant\",value:i},t.parameters)}return t}evaluate(t,e,r,n,i,s){return \"constant\"===t.kind?t.value:t.evaluate(e,r,n,i,s)}}class Qi extends Wi{possiblyEvaluate(t,e,r,n){if(void 0===t.value)return new Hi(this,{kind:\"constant\",value:void 0},e);if(\"constant\"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n),s=\"resolvedImage\"===t.property.specification.type&&\"string\"!=typeof i?i.name:i,a=this._calculate(s,s,s,e);return new Hi(this,{kind:\"constant\",value:a},e)}if(\"camera\"===t.expression.kind){const r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Hi(this,{kind:\"constant\",value:r},e)}return new Hi(this,t.expression,e)}evaluate(t,e,r,n,i,s){if(\"source\"===t.kind){const a=t.evaluate(e,r,n,i,s);return this._calculate(a,a,a,e)}return \"composite\"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,n),t.evaluate({zoom:Math.floor(e.zoom)},r,n),t.evaluate({zoom:Math.floor(e.zoom)+1},r,n),e):t.value}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class ts{constructor(t){this.specification=t;}possiblyEvaluate(t,e,r,n){if(void 0!==t.value){if(\"constant\"===t.expression.kind){const i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new Ui(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Ui(Math.floor(e.zoom),e)),t.expression.evaluate(new Ui(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}}class es{constructor(t){this.specification=t;}possiblyEvaluate(t,e,r,n){return !!t.expression.evaluate(e,null,{},r,n)}interpolate(){return !1}}class rs{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const e in t){const r=t[e];r.specification.overridable&&this.overridableProperties.push(e);const n=this.defaultPropertyValues[e]=new qi(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new Ni(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({});}}}wi(\"DataDrivenProperty\",Wi),wi(\"DataConstantProperty\",Ji),wi(\"CrossFadedDataDrivenProperty\",Qi),wi(\"CrossFadedProperty\",ts),wi(\"ColorRampProperty\",es);const ns=\"-transition\";class is extends Z{constructor(t,e){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},\"custom\"!==t.type&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,\"background\"!==t.type&&(this.source=t.source,this.sourceLayer=t[\"source-layer\"],this.filter=t.filter),e.layout&&(this._unevaluatedLayout=new Xi(e.layout)),e.paint)){this._transitionablePaint=new Zi(e.paint);for(const e in t.paint)this.setPaintProperty(e,t.paint[e],{validate:!1});for(const e in t.layout)this.setLayoutProperty(e,t.layout[e],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Yi(e.paint);}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return \"visibility\"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e,r={}){null!=e&&this._validate(gi,`layers.${this.id}.layout.${t}`,t,e,r)||(\"visibility\"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e);}getPaintProperty(t){return t.endsWith(ns)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(null!=e&&this._validate(mi,`layers.${this.id}.paint.${t}`,t,e,r))return !1;if(t.endsWith(ns))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{const r=this._transitionablePaint._values[t],n=\"cross-faded-data-driven\"===r.property.specification[\"property-type\"],i=r.value.isDataDriven(),s=r.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);const a=this._transitionablePaint._values[t].value;return a.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(t,s,a)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return !1}isHidden(t){return !!(this.minzoom&&t=this.maxzoom)||\"none\"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint);}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e);}serialize(){const t={id:this.id,type:this.type,source:this.source,\"source-layer\":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),b(t,((t,e)=>!(void 0===t||\"layout\"===e&&!Object.keys(t).length||\"paint\"===e&&!Object.keys(t).length)))}_validate(t,e,r,n,i={}){return (!i||!1!==i.validate)&&xi(this,t.call(fi,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:G,style:{glyphs:!0,sprite:!0}}))}is3D(){return !1}isTileClipped(){return !1}hasOffscreenPass(){return !1}resize(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Hi&&an(e.property.specification)&&(\"source\"===e.value.kind||\"composite\"===e.value.kind)&&e.value.isStateDependent)return !0}return !1}}const ss={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class as{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8;}}class os{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0);}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews());}clear(){this.length=0;}resize(t){this.reserve(t),this.length=t;}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e);}}_refreshViews(){throw new Error(\"_refreshViews() must be implemented by each concrete StructArray layout\")}}function ls(t,e=1){let r=0,n=0;return {members:t.map((t=>{const i=ss[t.type].BYTES_PER_ELEMENT,s=r=us(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:s}})),size:us(r,Math.max(n,e)),alignment:e}}function us(t,e){return Math.ceil(t/e)*e}class cs extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}cs.prototype.bytesPerElement=4,wi(\"StructArrayLayout2i4\",cs);class hs extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}hs.prototype.bytesPerElement=6,wi(\"StructArrayLayout3i6\",hs);class ps extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,t}}ps.prototype.bytesPerElement=8,wi(\"StructArrayLayout4i8\",ps);class fs extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}fs.prototype.bytesPerElement=12,wi(\"StructArrayLayout2i4i12\",fs);class ds extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=4*t,l=8*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=s,this.uint8[l+7]=a,t}}ds.prototype.bytesPerElement=8,wi(\"StructArrayLayout2i4ub8\",ds);class ys extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}ys.prototype.bytesPerElement=8,wi(\"StructArrayLayout2f8\",ys);class ms extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u){const c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,s,a,o,l,u)}emplace(t,e,r,n,i,s,a,o,l,u,c){const h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=s,this.uint16[h+5]=a,this.uint16[h+6]=o,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,t}}ms.prototype.bytesPerElement=20,wi(\"StructArrayLayout10ui20\",ms);class gs extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,a,o,l,u,c,h)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=s,this.uint16[f+5]=a,this.uint16[f+6]=o,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t}}gs.prototype.bytesPerElement=24,wi(\"StructArrayLayout4i4ui4i24\",gs);class xs extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}xs.prototype.bytesPerElement=12,wi(\"StructArrayLayout3f12\",xs);class vs extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}vs.prototype.bytesPerElement=4,wi(\"StructArrayLayout1ul4\",vs);class bs extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,s,a,o,l)}emplace(t,e,r,n,i,s,a,o,l,u){const c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=s,this.int16[c+5]=a,this.uint32[h+3]=o,this.uint16[c+8]=l,this.uint16[c+9]=u,t}}bs.prototype.bytesPerElement=20,wi(\"StructArrayLayout6i1ul2ui20\",bs);class ws extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}ws.prototype.bytesPerElement=12,wi(\"StructArrayLayout2i2i2i12\",ws);class _s extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=4*t,o=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[o+6]=i,this.int16[o+7]=s,t}}_s.prototype.bytesPerElement=16,wi(\"StructArrayLayout2f1f2i16\",_s);class As extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=16*t,l=4*t,u=8*t;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[l+1]=n,this.float32[l+2]=i,this.int16[u+6]=s,this.int16[u+7]=a,t}}As.prototype.bytesPerElement=16,wi(\"StructArrayLayout2ub2f2i16\",As);class Ss extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}Ss.prototype.bytesPerElement=6,wi(\"StructArrayLayout3ui6\",Ss);class ks extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m){const g=this.length;return this.resize(g+1),this.emplace(g,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g){const x=24*t,v=12*t,b=48*t;return this.int16[x+0]=e,this.int16[x+1]=r,this.uint16[x+2]=n,this.uint16[x+3]=i,this.uint32[v+2]=s,this.uint32[v+3]=a,this.uint32[v+4]=o,this.uint16[x+10]=l,this.uint16[x+11]=u,this.uint16[x+12]=c,this.float32[v+7]=h,this.float32[v+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=d,this.uint8[b+38]=y,this.uint32[v+10]=m,this.int16[x+22]=g,t}}ks.prototype.bytesPerElement=48,wi(\"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48\",ks);class Ms extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S,k,M,I){const z=this.length;return this.resize(z+1),this.emplace(z,t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S,k,M,I)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S,k,M,I,z){const P=32*t,C=16*t;return this.int16[P+0]=e,this.int16[P+1]=r,this.int16[P+2]=n,this.int16[P+3]=i,this.int16[P+4]=s,this.int16[P+5]=a,this.int16[P+6]=o,this.int16[P+7]=l,this.uint16[P+8]=u,this.uint16[P+9]=c,this.uint16[P+10]=h,this.uint16[P+11]=p,this.uint16[P+12]=f,this.uint16[P+13]=d,this.uint16[P+14]=y,this.uint16[P+15]=m,this.uint16[P+16]=g,this.uint16[P+17]=x,this.uint16[P+18]=v,this.uint16[P+19]=b,this.uint16[P+20]=w,this.uint16[P+21]=_,this.uint16[P+22]=A,this.uint32[C+12]=S,this.float32[C+13]=k,this.float32[C+14]=M,this.uint16[P+30]=I,this.uint16[P+31]=z,t}}Ms.prototype.bytesPerElement=64,wi(\"StructArrayLayout8i15ui1ul2f2ui64\",Ms);class Is extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Is.prototype.bytesPerElement=4,wi(\"StructArrayLayout1f4\",Is);class zs extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[6*t+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}zs.prototype.bytesPerElement=12,wi(\"StructArrayLayout1ui2f12\",zs);class Ps extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t}}Ps.prototype.bytesPerElement=8,wi(\"StructArrayLayout1ul2ui8\",Ps);class Cs extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}Cs.prototype.bytesPerElement=4,wi(\"StructArrayLayout2ui4\",Cs);class Bs extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer);}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Bs.prototype.bytesPerElement=2,wi(\"StructArrayLayout1ui2\",Bs);class Vs extends os{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer);}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,t}}Vs.prototype.bytesPerElement=16,wi(\"StructArrayLayout4f16\",Vs);class Es extends as{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 s(this.anchorPointX,this.anchorPointY)}}Es.prototype.size=20;class Fs extends bs{get(t){return new Es(this,t)}}wi(\"CollisionBoxArray\",Fs);class Ts extends as{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t;}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t;}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t;}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Ts.prototype.size=48;class $s extends ks{get(t){return new Ts(this,t)}}wi(\"PlacedSymbolArray\",$s);class Ls extends as{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t;}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Ls.prototype.size=64;class Ds extends Ms{get(t){return new Ls(this,t)}}wi(\"SymbolInstanceArray\",Ds);class Os extends Is{getoffsetX(t){return this.float32[1*t+0]}}wi(\"GlyphOffsetArray\",Os);class js extends hs{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}wi(\"SymbolLineVertexArray\",js);class Rs extends as{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Rs.prototype.size=12;class Us extends zs{get(t){return new Rs(this,t)}}wi(\"TextAnchorOffsetArray\",Us);class qs extends as{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]}}qs.prototype.size=8;class Ns extends Ps{get(t){return new qs(this,t)}}wi(\"FeatureIndexArray\",Ns);class Zs extends cs{}class Gs extends cs{}class Ks extends cs{}class Xs extends fs{}class Hs extends ds{}class Ys extends ys{}class Js extends ms{}class Ws extends gs{}class Qs extends xs{}class ta extends vs{}class ea extends ws{}class ra extends As{}class na extends Ss{}class ia extends Cs{}const sa=ls([{name:\"a_pos\",components:2,type:\"Int16\"}],4),{members:aa}=sa;class oa{constructor(t=[]){this.segments=t;}prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>oa.MAX_VERTEX_ARRAY_LENGTH&&A(`Max vertices per segment is ${oa.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>oa.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy();}static simpleSegment(t,e,r,n){return new oa([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function la(t,e){return 256*(t=y(Math.floor(t),0,255))+y(Math.floor(e),0,255)}oa.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,wi(\"SegmentVector\",oa);const ua=ls([{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 ca={exports:{}},ha={exports:{}};ha.exports=function(t,e){var r,n,i,s,a,o,l,u;for(n=t.length-(r=3&t.length),i=e,a=3432918353,o=461845907,u=0;u>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295;}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0};var pa=ha.exports,fa={exports:{}};fa.exports=function(t,e){for(var r,n=t.length,i=e^n,s=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16);}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0};var da=pa,ya=fa.exports;ca.exports=da,ca.exports.murmur3=da,ca.exports.murmur2=ya;var ma=r(ca.exports);class ga{constructor(){this.ids=[],this.positions=[],this.indexed=!1;}add(t,e,r,n){this.ids.push(xa(t)),this.positions.push(e,r,n);}getPositions(t){if(!this.indexed)throw new Error(\"Trying to get index, but feature positions are not indexed\");const e=xa(t);let r=0,n=this.ids.length-1;for(;r>1;this.ids[t]>=e?n=t:r=t+1;}const i=[];for(;this.ids[r]===e;)i.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return i}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return va(r,n,0,r.length-1),e&&e.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){const e=new ga;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function xa(t){const e=+t;return !isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ma(String(t))}function va(t,e,r,n){for(;r>1];let s=r-1,a=n+1;for(;;){do{s++;}while(t[s]i);if(s>=a)break;ba(t,s,a),ba(e,3*s,3*a),ba(e,3*s+1,3*a+1),ba(e,3*s+2,3*a+2);}a-r`u_${t}`)),this.type=r;}setUniform(t,e,r){t.set(r.constantOr(this.value));}getBinding(t,e,r){return \"color\"===this.type?new Sa(t,e):new _a(t,e)}}class za{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1;}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr;}setUniform(t,e,r,n){const i=\"u_pattern_to\"===n?this.patternTo:\"u_pattern_from\"===n?this.patternFrom:\"u_pixel_ratio_to\"===n?this.pixelRatioTo:\"u_pixel_ratio_from\"===n?this.pixelRatioFrom:null;i&&t.set(i);}getBinding(t,e,r){return \"u_pattern\"===r.substr(0,9)?new Aa(t,e):new _a(t,e)}}class Pa{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:\"Float32\",components:\"color\"===r?2:1,offset:0}))),this.paintVertexArray=new n;}populatePaintArray(t,e,r,n,i){const s=this.paintVertexArray.length,a=this.expression.evaluate(new Ui(0),e,{},n,[],i);this.paintVertexArray.resize(t),this._setPaintValue(s,t,a);}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:0},r,n);this._setPaintValue(t,e,i);}_setPaintValue(t,e,r){if(\"color\"===this.type){const n=Ma(r);for(let r=t;r`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:\"Float32\",components:\"color\"===r?4:2,offset:0}))),this.paintVertexArray=new s;}populatePaintArray(t,e,r,n,i){const s=this.expression.evaluate(new Ui(this.zoom),e,{},n,[],i),a=this.expression.evaluate(new Ui(this.zoom+1),e,{},n,[],i),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,s,a);}updatePaintArray(t,e,r,n){const i=this.expression.evaluate({zoom:this.zoom},r,n),s=this.expression.evaluate({zoom:this.zoom+1},r,n);this._setPaintValue(t,e,i,s);}_setPaintValue(t,e,r,n){if(\"color\"===this.type){const i=Ma(r),s=Ma(n);for(let r=t;r`#define HAS_UNIFORM_${t}`)));}return t}getBinderAttributes(){const t=[];for(const e in this.binders){const r=this.binders[e];if(r instanceof Pa||r instanceof Ca)for(let e=0;e!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Va(n,e,r);this.needsUpload=!1,this._featureMap=new ga,this._bufferOffset=0;}populatePaintArrays(t,e,r,n,i,s){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s);void 0!==e.id&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0;}updatePaintArrays(t,e,r,n){for(const i of r)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(t,this._featureMap,e,i,n)||this.needsUpload;}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1;}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy();}}function Fa(t,e){return {\"text-opacity\":[\"opacity\"],\"icon-opacity\":[\"opacity\"],\"text-color\":[\"fill_color\"],\"icon-color\":[\"fill_color\"],\"text-halo-color\":[\"halo_color\"],\"icon-halo-color\":[\"halo_color\"],\"text-halo-blur\":[\"halo_blur\"],\"icon-halo-blur\":[\"halo_blur\"],\"text-halo-width\":[\"halo_width\"],\"icon-halo-width\":[\"halo_width\"],\"line-gap-width\":[\"gapwidth\"],\"line-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"],\"fill-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"],\"fill-extrusion-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"]}[t]||[t.replace(`${e}-`,\"\").replace(/-/g,\"_\")]}function Ta(t,e,r){const n={color:{source:ys,composite:Vs},number:{source:Is,composite:ys}},i=function(t){return {\"line-pattern\":{source:Js,composite:Js},\"fill-pattern\":{source:Js,composite:Js},\"fill-extrusion-pattern\":{source:Js,composite:Js}}[t]}(t);return i&&i[r]||n[e][r]}wi(\"ConstantBinder\",Ia),wi(\"CrossFadedConstantBinder\",za),wi(\"SourceExpressionBinder\",Pa),wi(\"CrossFadedCompositeBinder\",Ba),wi(\"CompositeExpressionBinder\",Ca),wi(\"ProgramConfiguration\",Va,{omit:[\"_buffers\"]}),wi(\"ProgramConfigurationSet\",Ea);const $a=8192,La=Math.pow(2,14)-1,Da=-La-1;function Oa(t){const e=$a/t.extent,r=t.loadGeometry();for(let t=0;tr.x+1||sr.y+1)&&A(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\");}}return r}function ja(t,e){return {type:t.type,id:t.id,properties:t.properties,geometry:e?Oa(t):[]}}function Ra(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2);}class Ua{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Gs,this.indexArray=new na,this.segments=new oa,this.programConfigurations=new Ea(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){const n=this.layers[0],i=[];let s=null,a=!1;\"circle\"===n.type&&(s=n.layout.get(\"circle-sort-key\"),a=!s.isConstant());for(const{feature:e,id:n,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=ja(e,t);if(!this.layers[0]._featureFilter.filter(new Ui(this.zoom),u,r))continue;const c=a?s.evaluate(u,{},r):void 0,h={id:n,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Oa(e),patterns:{},sortKey:c};i.push(h);}a&&i.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of i){const{geometry:i,index:s,sourceLayerIndex:a}=n,o=t[s].feature;this.addFeature(n,i,s,r),e.featureIndex.insert(o,i,s,a,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,aa),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}addFeature(t,e,r,n){for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=$a||n<0||n>=$a)continue;const i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),s=i.vertexLength;Ra(this.layoutVertexArray,r,n,-1,-1),Ra(this.layoutVertexArray,r,n,1,-1),Ra(this.layoutVertexArray,r,n,1,1),Ra(this.layoutVertexArray,r,n,-1,1),this.indexArray.emplaceBack(s,s+1,s+2),this.indexArray.emplaceBack(s,s+3,s+2),i.vertexLength+=4,i.primitiveLength+=2;}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n);}}function qa(t,e){for(let r=0;r1){if(Ka(t,e))return !0;for(let n=0;n1?r:r.sub(e)._mult(i)._add(e))}function Ja(t,e){let r,n,i,s=!1;for(let a=0;ae.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s);}return s}function Wa(t,e){let r=!1;for(let n=0,i=t.length-1;ne.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(r=!r);}return r}function Qa(t,e,r){const n=r[0],i=r[2];if(t.xi.x&&e.x>i.x||t.yi.y&&e.y>i.y)return !1;const s=S(t,e,r[0]);return s!==S(t,e,r[1])||s!==S(t,e,r[2])||s!==S(t,e,r[3])}function to(t,e,r){const n=e.paint.get(t).value;return \"constant\"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function eo(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ro(t,e,r,n,i){if(!e[0]&&!e[1])return t;const a=s.convert(e)._mult(i);\"viewport\"===r&&a._rotate(-n);const o=[];for(let e=0;eyo(t,e)))}(l,o),p=c?u*a:u;for(const t of n)for(const e of t){const t=c?e:yo(e,o);let r=p;const n=po([],[e.x,e.y,0,1],o);if(\"viewport\"===this.paint.get(\"circle-pitch-scale\")&&\"map\"===this.paint.get(\"circle-pitch-alignment\")?r*=n[3]/s.cameraToCenterDistance:\"map\"===this.paint.get(\"circle-pitch-scale\")&&\"viewport\"===this.paint.get(\"circle-pitch-alignment\")&&(r*=s.cameraToCenterDistance/n[3]),Na(h,t,r))return !0}return !1}}function yo(t,e){const r=po([],[t.x,t.y,0,1],e);return new s(r[0]/r[3],r[1]/r[3])}class mo extends Ua{}let go;wi(\"HeatmapBucket\",mo,{omit:[\"layers\"]});var xo={get paint(){return go=go||new rs({\"heatmap-radius\":new Wi(G.paint_heatmap[\"heatmap-radius\"]),\"heatmap-weight\":new Wi(G.paint_heatmap[\"heatmap-weight\"]),\"heatmap-intensity\":new Ji(G.paint_heatmap[\"heatmap-intensity\"]),\"heatmap-color\":new es(G.paint_heatmap[\"heatmap-color\"]),\"heatmap-opacity\":new Ji(G.paint_heatmap[\"heatmap-opacity\"])})}};function vo(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*r*n}`)}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function bo(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;const i=vo({},{width:e,height:r},n);wo(t,i,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},n),t.width=e,t.height=r,t.data=i.data;}function wo(t,e,r,n,i,s){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError(\"out of range source coordinates for image copy\");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError(\"out of range destination coordinates for image copy\");const a=t.data,o=e.data;if(a===o)throw new Error(\"srcData equals dstData, so image is already copied\");for(let l=0;l{e[t.evaluationKey]=s;const a=t.expression.evaluate(e);i.data[r+n+0]=Math.floor(255*a.r/a.a),i.data[r+n+1]=Math.floor(255*a.g/a.a),i.data[r+n+2]=Math.floor(255*a.b/a.a),i.data[r+n+3]=Math.floor(255*a.a);};if(t.clips)for(let e=0,i=0;e80*r){o=1/0,l=1/0;let e=-1/0,n=-1/0;for(let s=r;se&&(e=r),i>n&&(n=i);}u=Math.max(e-o,n-l),u=0!==u?32767/u:0;}return To(s,a,r,o,l,u,0),a}function Eo(t,e,r,n,i){let s;if(i===function(t,e,r,n){let i=0;for(let s=e,a=r-n;s0)for(let i=e;i=e;i-=n)s=tl(i/n|0,t[i],t[i+1],s);return s&&Xo(s,s.next)&&(el(s),s=s.next),s}function Fo(t,e){if(!t)return t;e||(e=t);let r,n=t;do{if(r=!1,n.steiner||!Xo(n,n.next)&&0!==Ko(n.prev,n,n.next))n=n.next;else {if(el(n),n=e=n.prev,n===n.next)break;r=!0;}}while(r||n!==e);return e}function To(t,e,r,n,i,s,a){if(!t)return;!a&&s&&function(t,e,r,n){let i=t;do{0===i.z&&(i.z=qo(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,r=1;do{let n,i=t;t=null;let s=null;for(e=0;i;){e++;let a=i,o=0;for(let t=0;t0||l>0&&a;)0!==o&&(0===l||!a||i.z<=a.z)?(n=i,i=i.nextZ,o--):(n=a,a=a.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=a;}s.nextZ=null,r*=2;}while(e>1)}(i);}(t,n,i,s);let o=t;for(;t.prev!==t.next;){const l=t.prev,u=t.next;if(s?Lo(t,n,i,s):$o(t))e.push(l.i,t.i,u.i),el(t),t=u.next,o=u.next;else if((t=u)===o){a?1===a?To(t=Do(Fo(t),e),e,r,n,i,s,2):2===a&&Oo(t,e,r,n,i,s):To(Fo(t),e,r,n,i,s,1);break}}}function $o(t){const e=t.prev,r=t,n=t.next;if(Ko(e,r,n)>=0)return !1;const i=e.x,s=r.x,a=n.x,o=e.y,l=r.y,u=n.y,c=is?i>a?i:a:s>a?s:a,f=o>l?o>u?o:u:l>u?l:u;let d=n.next;for(;d!==e;){if(d.x>=c&&d.x<=p&&d.y>=h&&d.y<=f&&Zo(i,o,s,l,a,u,d.x,d.y)&&Ko(d.prev,d,d.next)>=0)return !1;d=d.next;}return !0}function Lo(t,e,r,n){const i=t.prev,s=t,a=t.next;if(Ko(i,s,a)>=0)return !1;const o=i.x,l=s.x,u=a.x,c=i.y,h=s.y,p=a.y,f=ol?o>u?o:u:l>u?l:u,m=c>h?c>p?c:p:h>p?h:p,g=qo(f,d,e,r,n),x=qo(y,m,e,r,n);let v=t.prevZ,b=t.nextZ;for(;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==a&&Zo(o,c,l,h,u,p,v.x,v.y)&&Ko(v.prev,v,v.next)>=0)return !1;if(v=v.prevZ,b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==a&&Zo(o,c,l,h,u,p,b.x,b.y)&&Ko(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==i&&v!==a&&Zo(o,c,l,h,u,p,v.x,v.y)&&Ko(v.prev,v,v.next)>=0)return !1;v=v.prevZ;}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==i&&b!==a&&Zo(o,c,l,h,u,p,b.x,b.y)&&Ko(b.prev,b,b.next)>=0)return !1;b=b.nextZ;}return !0}function Do(t,e){let r=t;do{const n=r.prev,i=r.next.next;!Xo(n,i)&&Ho(n,r,r.next,i)&&Wo(n,i)&&Wo(i,n)&&(e.push(n.i,r.i,i.i),el(r),el(r.next),r=t=i),r=r.next;}while(r!==t);return Fo(r)}function Oo(t,e,r,n,i,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Go(a,t)){let o=Qo(a,t);return a=Fo(a,a.next),o=Fo(o,o.next),To(a,e,r,n,i,s,0),void To(o,e,r,n,i,s,0)}t=t.next;}a=a.next;}while(a!==t)}function jo(t,e){return t.x-e.x}function Ro(t,e){const r=function(t,e){let r=e;const n=t.x,i=t.y;let s,a=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){const t=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(t<=n&&t>a&&(a=t,s=r.x=r.x&&r.x>=l&&n!==r.x&&Zo(is.x||r.x===s.x&&Uo(s,r)))&&(s=r,c=e);}r=r.next;}while(r!==o);return s}(t,e);if(!r)return e;const n=Qo(r,t);return Fo(n,n.next),Fo(r,r.next)}function Uo(t,e){return Ko(t.prev,t,e.prev)<0&&Ko(e.next,t,t.next)<0}function qo(t,e,r,n,i){return (t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function No(t){let e=t,r=t;do{(e.x=(t-a)*(s-o)&&(t-a)*(n-o)>=(r-a)*(e-o)&&(r-a)*(s-o)>=(i-a)*(n-o)}function Go(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Ho(r,r.next,t,e))return !0;r=r.next;}while(r!==t);return !1}(t,e)&&(Wo(t,e)&&Wo(e,t)&&function(t,e){let r=t,n=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;}while(r!==t);return n}(t,e)&&(Ko(t.prev,t,e.prev)||Ko(t,e.prev,e))||Xo(t,e)&&Ko(t.prev,t,t.next)>0&&Ko(e.prev,e,e.next)>0)}function Ko(t,e,r){return (e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Xo(t,e){return t.x===e.x&&t.y===e.y}function Ho(t,e,r,n){const i=Jo(Ko(t,e,r)),s=Jo(Ko(t,e,n)),a=Jo(Ko(r,n,t)),o=Jo(Ko(r,n,e));return i!==s&&a!==o||!(0!==i||!Yo(t,r,e))||!(0!==s||!Yo(t,n,e))||!(0!==a||!Yo(r,t,n))||!(0!==o||!Yo(r,e,n))}function Yo(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Jo(t){return t>0?1:t<0?-1:0}function Wo(t,e){return Ko(t.prev,t,t.next)<0?Ko(t,e,t.next)>=0&&Ko(t,t.prev,e)>=0:Ko(t,e,t.prev)<0||Ko(t,t.next,e)<0}function Qo(t,e){const r=rl(t.i,t.x,t.y),n=rl(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function tl(t,e,r,n){const i=rl(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function el(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ);}function rl(t,e,r){return {i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function nl(t,e,r){const n=r.patternDependencies;let i=!1;for(const r of e){const e=r.paint.get(`${t}-pattern`);e.isConstant()||(i=!0);const s=e.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0);}return i}function il(t,e,r,n,i){const s=i.patternDependencies;for(const a of e){const e=a.paint.get(`${t}-pattern`).value;if(\"constant\"!==e.kind){let t=e.evaluate({zoom:n-1},r,{},i.availableImages),o=e.evaluate({zoom:n},r,{},i.availableImages),l=e.evaluate({zoom:n+1},r,{},i.availableImages);t=t&&t.name?t.name:t,o=o&&o.name?o.name:o,l=l&&l.name?l.name:l,s[t]=!0,s[o]=!0,s[l]=!0,r.patterns[a.id]={min:t,mid:o,max:l};}}return r}class sl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ks,this.indexArray=new na,this.indexArray2=new ia,this.programConfigurations=new Ea(t.layers,t.zoom),this.segments=new oa,this.segments2=new oa,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.hasPattern=nl(\"fill\",this.layers,e);const n=this.layers[0].layout.get(\"fill-sort-key\"),i=!n.isConstant(),s=[];for(const{feature:a,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=ja(a,t);if(!this.layers[0]._featureFilter.filter(new Ui(this.zoom),c,r))continue;const h=i?n.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Oa(a),patterns:{},sortKey:h};s.push(p);}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=il(\"fill\",this.layers,n,this.zoom,e);this.patternFeatures.push(t);}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Bo),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy());}addFeature(t,e,r,n,i){for(const t of xr(e,500)){let e=0;for(const r of t)e+=r.length;const r=this.segments.prepareSegment(e,this.layoutVertexArray,this.indexArray),n=r.vertexLength,i=[],s=[];for(const e of t){if(0===e.length)continue;e!==t[0]&&s.push(i.length/2);const r=this.segments2.prepareSegment(e.length,this.layoutVertexArray,this.indexArray2),n=r.vertexLength;this.layoutVertexArray.emplaceBack(e[0].x,e[0].y),this.indexArray2.emplaceBack(n+e.length-1,n),i.push(e[0].x),i.push(e[0].y);for(let t=1;t>3;}if(i--,1===n||2===n)s+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&o.push(e),e=[]),e.push(new dl(s,a));else {if(7!==n)throw new Error(\"unknown command \"+n);e&&e.push(e[0].clone());}}return e&&o.push(e),o},ml.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,u=-1/0;t.pos>3;}if(n--,1===r||2===r)(i+=t.readSVarint())o&&(o=i),(s+=t.readSVarint())u&&(u=s);else if(7!==r)throw new Error(\"unknown command \"+r)}return [a,l,o,u]},ml.prototype.toGeoJSON=function(t,e,r){var n,i,s=this.extent*Math.pow(2,r),a=this.extent*t,o=this.extent*e,l=this.loadGeometry(),u=ml.types[this.type];function c(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null;}return e}(r));}wl.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error(\"feature index out of bounds\");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new vl(this._pbf,e,this.extent,this._keys,this._values)};var Al=bl;function Sl(t,e,r){if(3===t){var n=new Al(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n);}}fl.VectorTile=function(t,e){this.layers=t.readFields(Sl,{},e);},fl.VectorTileFeature=yl,fl.VectorTileLayer=bl;const kl=fl.VectorTileFeature.types,Ml=Math.pow(2,13);function Il(t,e,r,n,i,s,a,o){t.emplaceBack(e,r,2*Math.floor(n*Ml)+a,i*Ml*2,s*Ml*2,Math.round(o));}class zl{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Xs,this.centroidVertexArray=new Zs,this.indexArray=new na,this.programConfigurations=new Ea(t.layers,t.zoom),this.segments=new oa,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.features=[],this.hasPattern=nl(\"fill-extrusion\",this.layers,e);for(const{feature:n,id:i,index:s,sourceLayerIndex:a}of t){const t=this.layers[0]._featureFilter.needGeometry,o=ja(n,t);if(!this.layers[0]._featureFilter.filter(new Ui(this.zoom),o,r))continue;const l={id:i,sourceLayerIndex:a,index:s,geometry:t?o.geometry:Oa(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(il(\"fill-extrusion\",this.layers,l,this.zoom,e)):this.addFeature(l,l.geometry,s,r,{}),e.featureIndex.insert(n,l.geometry,s,a,this.index,!0);}}addFeatures(t,e,r){for(const t of this.features){const{geometry:n}=t;this.addFeature(t,n,t.index,e,r);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,pl),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,hl.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy());}addFeature(t,e,r,n,i){for(const r of xr(e,500)){const e={x:0,y:0,vertexCount:0};let n=0;for(const t of r)n+=t.length;let i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const t of r){if(0===t.length)continue;if(Cl(t))continue;let r=0;for(let n=0;n=1){const a=t[n-1];if(!Pl(s,a)){i.vertexLength+4>oa.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const t=s.sub(a)._perp()._unit(),n=a.dist(s);r+n>32768&&(r=0),Il(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,0,r),Il(this.layoutVertexArray,s.x,s.y,t.x,t.y,0,1,r),e.x+=2*s.x,e.y+=2*s.y,e.vertexCount+=2,r+=n,Il(this.layoutVertexArray,a.x,a.y,t.x,t.y,0,0,r),Il(this.layoutVertexArray,a.x,a.y,t.x,t.y,0,1,r),e.x+=2*a.x,e.y+=2*a.y,e.vertexCount+=2;const o=i.vertexLength;this.indexArray.emplaceBack(o,o+2,o+1),this.indexArray.emplaceBack(o+1,o+2,o+3),i.vertexLength+=4,i.primitiveLength+=2;}}}}if(i.vertexLength+n>oa.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(n,this.layoutVertexArray,this.indexArray)),\"Polygon\"!==kl[t.type])continue;const s=[],a=[],o=i.vertexLength;for(const t of r)if(0!==t.length){t!==r[0]&&a.push(s.length/2);for(let r=0;r$a)||t.y===e.y&&(t.y<0||t.y>$a)}function Cl(t){return t.every((t=>t.x<0))||t.every((t=>t.x>$a))||t.every((t=>t.y<0))||t.every((t=>t.y>$a))}let Bl;wi(\"FillExtrusionBucket\",zl,{omit:[\"layers\",\"features\"]});var Vl={get paint(){return Bl=Bl||new rs({\"fill-extrusion-opacity\":new Ji(G[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"]),\"fill-extrusion-color\":new Wi(G[\"paint_fill-extrusion\"][\"fill-extrusion-color\"]),\"fill-extrusion-translate\":new Ji(G[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"]),\"fill-extrusion-translate-anchor\":new Ji(G[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"]),\"fill-extrusion-pattern\":new Qi(G[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"]),\"fill-extrusion-height\":new Wi(G[\"paint_fill-extrusion\"][\"fill-extrusion-height\"]),\"fill-extrusion-base\":new Wi(G[\"paint_fill-extrusion\"][\"fill-extrusion-base\"]),\"fill-extrusion-vertical-gradient\":new Ji(G[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"])})}};class El extends is{constructor(t){super(t,Vl);}createBucket(t){return new zl(t)}queryRadius(){return eo(this.paint.get(\"fill-extrusion-translate\"))}is3D(){return !0}queryIntersectsFeature(t,e,r,n,i,a,o,l){const u=ro(t,this.paint.get(\"fill-extrusion-translate\"),this.paint.get(\"fill-extrusion-translate-anchor\"),a.angle,o),c=this.paint.get(\"fill-extrusion-height\").evaluate(e,r),h=this.paint.get(\"fill-extrusion-base\").evaluate(e,r),p=function(t,e,r,n){const i=[];for(const r of t){const t=[r.x,r.y,0,1];po(t,t,e),i.push(new s(t[0]/t[3],t[1]/t[3]));}return i}(u,l),f=function(t,e,r,n){const i=[],a=[],o=n[8]*e,l=n[9]*e,u=n[10]*e,c=n[11]*e,h=n[8]*r,p=n[9]*r,f=n[10]*r,d=n[11]*r;for(const e of t){const t=[],r=[];for(const i of e){const e=i.x,a=i.y,y=n[0]*e+n[4]*a+n[12],m=n[1]*e+n[5]*a+n[13],g=n[2]*e+n[6]*a+n[14],x=n[3]*e+n[7]*a+n[15],v=g+u,b=x+c,w=y+h,_=m+p,A=g+f,S=x+d,k=new s((y+o)/b,(m+l)/b);k.z=v/b,t.push(k);const M=new s(w/S,_/S);M.z=A/S,r.push(M);}i.push(t),a.push(r);}return [i,a]}(n,h,c,l);return function(t,e,r){let n=1/0;Za(r,e)&&(n=Tl(r,e[0]));for(let i=0;it.id)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={};})),this.layoutVertexArray=new Hs,this.layoutVertexArray2=new Ys,this.indexArray=new na,this.programConfigurations=new Ea(t.layers,t.zoom),this.segments=new oa,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id));}populate(t,e,r){this.hasPattern=nl(\"line\",this.layers,e);const n=this.layers[0].layout.get(\"line-sort-key\"),i=!n.isConstant(),s=[];for(const{feature:e,id:a,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=ja(e,t);if(!this.layers[0]._featureFilter.filter(new Ui(this.zoom),u,r))continue;const c=i?n.evaluate(u,{},r):void 0,h={id:a,properties:e.properties,type:e.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Oa(e),patterns:{},sortKey:c};s.push(h);}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=il(\"line\",this.layers,n,this.zoom,e);this.patternFeatures.push(t);}else this.addFeature(n,i,s,r,{});e.featureIndex.insert(t[s].feature,i,s,a,this.index);}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r);}addFeatures(t,e,r){for(const t of this.patternFeatures)this.addFeature(t,t.geometry,t.index,e,r);}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return !this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Ol)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ll),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0;}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy());}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,\"mapbox_clip_start\")&&Object.prototype.hasOwnProperty.call(t.properties,\"mapbox_clip_end\"))return {start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,e,r,n,i){const s=this.layers[0].layout,a=s.get(\"line-join\").evaluate(t,{}),o=s.get(\"line-cap\"),l=s.get(\"line-miter-limit\"),u=s.get(\"line-round-limit\");this.lineClips=this.lineFeatureClips(t);for(const r of e)this.addLine(r,t,a,o,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,n);}addLine(t,e,r,n,i,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let e=0;e=2&&t[o-1].equals(t[o-2]);)o--;let l=0;for(;l0;if(w&&e>l){const t=h.dist(p);if(t>2*u){const e=h.sub(h.sub(p)._mult(u/t)._round());this.updateDistance(p,e),this.addCurrentVertex(e,d,0,0,c),p=e;}}const A=p&&f;let S=A?r:a?\"butt\":n;if(A&&\"round\"===S&&(vi&&(S=\"bevel\"),\"bevel\"===S&&(v>2&&(S=\"flipbevel\"),v100)m=y.mult(-1);else {const t=v*d.add(y).mag()/d.sub(y).mag();m._perp()._mult(t*(_?-1:1));}this.addCurrentVertex(h,m,0,0,c),this.addCurrentVertex(h,m.mult(-1),0,0,c);}else if(\"bevel\"===S||\"fakeround\"===S){const t=-Math.sqrt(v*v-1),e=_?t:0,r=_?0:t;if(p&&this.addCurrentVertex(h,d,e,r,c),\"fakeround\"===S){const t=Math.round(180*b/Math.PI/20);for(let e=1;e2*u){const e=h.add(f.sub(h)._mult(u/t)._round());this.updateDistance(h,e),this.addCurrentVertex(e,y,0,0,c),h=e;}}}}addCurrentVertex(t,e,r,n,i,s=!1){const a=e.y*n-e.x,o=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,s,!1,r,i),this.addHalfVertex(t,a,o,s,!0,-n,i),this.distance>Ul/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,n,i,s));}addHalfVertex({x:t,y:e},r,n,i,s,a,o){const l=.5*(this.lineClips?this.scaledDistance*(Ul-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1)|(63&l)<<2,l>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),s?this.e2=u:this.e1=u;}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance;}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance();}}let Nl,Zl;wi(\"LineBucket\",ql,{omit:[\"layers\",\"patternFeatures\"]});var Gl={get paint(){return Zl=Zl||new rs({\"line-opacity\":new Wi(G.paint_line[\"line-opacity\"]),\"line-color\":new Wi(G.paint_line[\"line-color\"]),\"line-translate\":new Ji(G.paint_line[\"line-translate\"]),\"line-translate-anchor\":new Ji(G.paint_line[\"line-translate-anchor\"]),\"line-width\":new Wi(G.paint_line[\"line-width\"]),\"line-gap-width\":new Wi(G.paint_line[\"line-gap-width\"]),\"line-offset\":new Wi(G.paint_line[\"line-offset\"]),\"line-blur\":new Wi(G.paint_line[\"line-blur\"]),\"line-dasharray\":new ts(G.paint_line[\"line-dasharray\"]),\"line-pattern\":new Qi(G.paint_line[\"line-pattern\"]),\"line-gradient\":new es(G.paint_line[\"line-gradient\"])})},get layout(){return Nl=Nl||new rs({\"line-cap\":new Ji(G.layout_line[\"line-cap\"]),\"line-join\":new Wi(G.layout_line[\"line-join\"]),\"line-miter-limit\":new Ji(G.layout_line[\"line-miter-limit\"]),\"line-round-limit\":new Ji(G.layout_line[\"line-round-limit\"]),\"line-sort-key\":new Wi(G.layout_line[\"line-sort-key\"])})}};class Kl extends Wi{possiblyEvaluate(t,e){return e=new Ui(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,n){return e=g({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}let Xl;class Hl extends is{constructor(t){super(t,Gl),this.gradientVersion=0,Xl||(Xl=new Kl(Gl.paint.properties[\"line-width\"].specification),Xl.useIntegerZoom=!0);}_handleSpecialPaintPropertyUpdate(t){if(\"line-gradient\"===t){const t=this.gradientExpression();this.stepInterpolant=!!function(t){return void 0!==t._styleExpression}(t)&&t._styleExpression.expression instanceof Ae,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER;}}gradientExpression(){return this._transitionablePaint._values[\"line-gradient\"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values[\"line-floorwidth\"]=Xl.possiblyEvaluate(this._transitioningPaint._values[\"line-width\"].value,t);}createBucket(t){return new ql(t)}queryRadius(t){const e=t,r=Yl(to(\"line-width\",this,e),to(\"line-gap-width\",this,e)),n=to(\"line-offset\",this,e);return r/2+Math.abs(n)+eo(this.paint.get(\"line-translate\"))}queryIntersectsFeature(t,e,r,n,i,a,o){const l=ro(t,this.paint.get(\"line-translate\"),this.paint.get(\"line-translate-anchor\"),a.angle,o),u=o/2*Yl(this.paint.get(\"line-width\").evaluate(e,r),this.paint.get(\"line-gap-width\").evaluate(e,r)),c=this.paint.get(\"line-offset\").evaluate(e,r);return c&&(n=function(t,e){const r=[];for(let n=0;n=3)for(let e=0;e0?e+2*t:t}const Jl=ls([{name:\"a_pos_offset\",components:4,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint16\"},{name:\"a_pixeloffset\",components:4,type:\"Int16\"}],4),Wl=ls([{name:\"a_projected_pos\",components:3,type:\"Float32\"}],4);ls([{name:\"a_fade_opacity\",components:1,type:\"Uint32\"}],4);const Ql=ls([{name:\"a_placed\",components:2,type:\"Uint8\"},{name:\"a_shift\",components:2,type:\"Float32\"},{name:\"a_box_real\",components:2,type:\"Int16\"}]);ls([{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 tu=ls([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_anchor_pos\",components:2,type:\"Int16\"},{name:\"a_extrude\",components:2,type:\"Int16\"}],4),eu=ls([{name:\"a_pos\",components:2,type:\"Float32\"},{name:\"a_radius\",components:1,type:\"Float32\"},{name:\"a_flags\",components:2,type:\"Int16\"}],4);function ru(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get(\"text-transform\").evaluate(r,{});return \"uppercase\"===n?t=t.toLocaleUpperCase():\"lowercase\"===n&&(t=t.toLocaleLowerCase()),Ri.applyArabicShaping&&(t=Ri.applyArabicShaping(t)),t}(t.text,e,r);})),t}ls([{name:\"triangle\",components:3,type:\"Uint16\"}]),ls([{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\"}]),ls([{type:\"Int16\",name:\"anchorX\"},{type:\"Int16\",name:\"anchorY\"},{type:\"Int16\",name:\"rightJustifiedTextSymbolIndex\"},{type:\"Int16\",name:\"centerJustifiedTextSymbolIndex\"},{type:\"Int16\",name:\"leftJustifiedTextSymbolIndex\"},{type:\"Int16\",name:\"verticalPlacedTextSymbolIndex\"},{type:\"Int16\",name:\"placedIconSymbolIndex\"},{type:\"Int16\",name:\"verticalPlacedIconSymbolIndex\"},{type:\"Uint16\",name:\"key\"},{type:\"Uint16\",name:\"textBoxStartIndex\"},{type:\"Uint16\",name:\"textBoxEndIndex\"},{type:\"Uint16\",name:\"verticalTextBoxStartIndex\"},{type:\"Uint16\",name:\"verticalTextBoxEndIndex\"},{type:\"Uint16\",name:\"iconBoxStartIndex\"},{type:\"Uint16\",name:\"iconBoxEndIndex\"},{type:\"Uint16\",name:\"verticalIconBoxStartIndex\"},{type:\"Uint16\",name:\"verticalIconBoxEndIndex\"},{type:\"Uint16\",name:\"featureIndex\"},{type:\"Uint16\",name:\"numHorizontalGlyphVertices\"},{type:\"Uint16\",name:\"numVerticalGlyphVertices\"},{type:\"Uint16\",name:\"numIconVertices\"},{type:\"Uint16\",name:\"numVerticalIconVertices\"},{type:\"Uint16\",name:\"useRuntimeCollisionCircles\"},{type:\"Uint32\",name:\"crossTileID\"},{type:\"Float32\",name:\"textBoxScale\"},{type:\"Float32\",name:\"collisionCircleDiameter\"},{type:\"Uint16\",name:\"textAnchorOffsetStartIndex\"},{type:\"Uint16\",name:\"textAnchorOffsetEndIndex\"}]),ls([{type:\"Float32\",name:\"offsetX\"}]),ls([{type:\"Int16\",name:\"x\"},{type:\"Int16\",name:\"y\"},{type:\"Int16\",name:\"tileUnitDistanceFromAnchor\"}]),ls([{type:\"Uint16\",name:\"textAnchor\"},{type:\"Float32\",components:2,name:\"textOffset\"}]);const nu={\"!\":\"︕\",\"#\":\"#\",$:\"$\",\"%\":\"%\",\"&\":\"&\",\"(\":\"︵\",\")\":\"︶\",\"*\":\"*\",\"+\":\"+\",\",\":\"︐\",\"-\":\"︲\",\".\":\"・\",\"/\":\"/\",\":\":\"︓\",\";\":\"︔\",\"<\":\"︿\",\"=\":\"=\",\">\":\"﹀\",\"?\":\"︖\",\"@\":\"@\",\"[\":\"﹇\",\"\\\\\":\"\\",\"]\":\"﹈\",\"^\":\"^\",_:\"︳\",\"`\":\"`\",\"{\":\"︷\",\"|\":\"―\",\"}\":\"︸\",\"~\":\"~\",\"¢\":\"¢\",\"£\":\"£\",\"¥\":\"¥\",\"¦\":\"¦\",\"¬\":\"¬\",\"¯\":\" ̄\",\"–\":\"︲\",\"—\":\"︱\",\"‘\":\"﹃\",\"’\":\"﹄\",\"“\":\"﹁\",\"”\":\"﹂\",\"…\":\"︙\",\"‧\":\"・\",\"₩\":\"₩\",\"、\":\"︑\",\"。\":\"︒\",\"〈\":\"︿\",\"〉\":\"﹀\",\"《\":\"︽\",\"》\":\"︾\",\"「\":\"﹁\",\"」\":\"﹂\",\"『\":\"﹃\",\"』\":\"﹄\",\"【\":\"︻\",\"】\":\"︼\",\"〔\":\"︹\",\"〕\":\"︺\",\"〖\":\"︗\",\"〗\":\"︘\",\"!\":\"︕\",\"(\":\"︵\",\")\":\"︶\",\",\":\"︐\",\"-\":\"︲\",\".\":\"・\",\":\":\"︓\",\";\":\"︔\",\"<\":\"︿\",\">\":\"﹀\",\"?\":\"︖\",\"[\":\"﹇\",\"]\":\"﹈\",\"_\":\"︳\",\"{\":\"︷\",\"|\":\"―\",\"}\":\"︸\",\"⦅\":\"︵\",\"⦆\":\"︶\",\"。\":\"︒\",\"「\":\"﹁\",\"」\":\"﹂\"};var iu=24,su=lu,au=function(t,e,r,n,i){var s,a,o=8*i-n-1,l=(1<>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,s=f&(1<<-c)-1,f>>=-c,c+=o;c>0;s=256*s+t[e+h],h+=p,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===s)s=1-u;else {if(s===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),s-=u;}return (f?-1:1)*a*Math.pow(2,s-n)},ou=function(t,e,r,n,i,s){var a,o,l,u=8*s-i-1,c=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,d=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*l-1)*Math.pow(2,i),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&o,f+=d,o/=256,i-=8);for(a=a<0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*y;};function lu(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length;}lu.Varint=0,lu.Fixed64=1,lu.Bytes=2,lu.Fixed32=5;var uu=4294967296,cu=1/uu,hu=\"undefined\"==typeof TextDecoder?null:new TextDecoder(\"utf-8\");function pu(t){return t.type===lu.Bytes?t.readVarint()+t.pos:t.pos+1}function fu(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function du(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i];}function yu(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24;}function Mu(t,e){return (t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}lu.prototype={destroy:function(){this.buf=null;},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,s=this.pos;this.type=7&n,t(i,e,this),this.pos===s&&this.skip(n);}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Su(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Mu(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Su(this.buf,this.pos)+Su(this.buf,this.pos+4)*uu;return this.pos+=8,t},readSFixed64:function(){var t=Su(this.buf,this.pos)+Mu(this.buf,this.pos+4)*uu;return this.pos+=8,t},readFloat:function(){var t=au(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=au(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,s=r.buf;if(n=(112&(i=s[r.pos++]))>>4,i<128)return fu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<3,i<128)return fu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<10,i<128)return fu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<17,i<128)return fu(t,n,e);if(n|=(127&(i=s[r.pos++]))<<24,i<128)return fu(t,n,e);if(n|=(1&(i=s[r.pos++]))<<31,i<128)return fu(t,n,e);throw new Error(\"Expected varint not more than 10 bytes\")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&hu?function(t,e,r){return hu.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n=\"\",i=e;i239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(s=t[i+1]))&&(u=(31&l)<<6|63&s)<=127&&(u=null):3===c?(a=t[i+2],128==(192&(s=t[i+1]))&&128==(192&a)&&((u=(15&l)<<12|(63&s)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[i+2],o=t[i+3],128==(192&(s=t[i+1]))&&128==(192&a)&&128==(192&o)&&((u=(15&l)<<18|(63&s)<<12|(63&a)<<6|63&o)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c;}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==lu.Bytes)return t.push(this.readVarint(e));var r=pu(this);for(t=t||[];this.pos127;);else if(e===lu.Bytes)this.pos=this.readVarint()+this.pos;else if(e===lu.Fixed32)this.pos+=4;else {if(e!==lu.Fixed64)throw new Error(\"Unimplemented type: \"+e);this.pos+=8;}},writeTag:function(t,e){this.writeVarint(t<<3|e);},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error(\"Given varint doesn't fit into 10 bytes\");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7);}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))));}(n,e);}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))));},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t);},writeBoolean:function(t){this.writeVarint(Boolean(t));},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,s=0;s55295&&n<57344){if(!i){n>56319||s+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null;}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128);}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&du(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r;},writeFloat:function(t){this.realloc(4),ou(this.buf,t,this.pos,!0,23,4),this.pos+=4;},writeDouble:function(t){this.realloc(8),ou(this.buf,t,this.pos,!0,52,8),this.pos+=8;},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&du(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n;},writeMessage:function(t,e,r){this.writeTag(t,lu.Bytes),this.writeRawMessage(e,r);},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,yu,e);},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,mu,e);},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,vu,e);},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,gu,e);},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,xu,e);},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,bu,e);},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,wu,e);},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,_u,e);},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Au,e);},writeBytesField:function(t,e){this.writeTag(t,lu.Bytes),this.writeBytes(e);},writeFixed32Field:function(t,e){this.writeTag(t,lu.Fixed32),this.writeFixed32(e);},writeSFixed32Field:function(t,e){this.writeTag(t,lu.Fixed32),this.writeSFixed32(e);},writeFixed64Field:function(t,e){this.writeTag(t,lu.Fixed64),this.writeFixed64(e);},writeSFixed64Field:function(t,e){this.writeTag(t,lu.Fixed64),this.writeSFixed64(e);},writeVarintField:function(t,e){this.writeTag(t,lu.Varint),this.writeVarint(e);},writeSVarintField:function(t,e){this.writeTag(t,lu.Varint),this.writeSVarint(e);},writeStringField:function(t,e){this.writeTag(t,lu.Bytes),this.writeString(e);},writeFloatField:function(t,e){this.writeTag(t,lu.Fixed32),this.writeFloat(e);},writeDoubleField:function(t,e){this.writeTag(t,lu.Fixed64),this.writeDouble(e);},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e));}};var Iu=r(su);const zu=3;function Pu(t,e,r){1===t&&r.readMessage(Cu,e);}function Cu(t,e,r){if(3===t){const{id:t,bitmap:n,width:i,height:s,left:a,top:o,advance:l}=r.readMessage(Bu,{});e.push({id:t,bitmap:new _o({width:i+2*zu,height:s+2*zu},n),metrics:{width:i,height:s,left:a,top:o,advance:l}});}}function Bu(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint());}const Vu=zu;function Eu(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();t=0&&r>=t&&Uu[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e);}substring(t,e){const r=new ju;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(Ou.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ru(e,r,n,i,s,a,o,l,u,c,h,p,f,d,y){const m=ju.fromFeature(e,s);let g;p===t.ah.vertical&&m.verticalizePunctuation();const{processBidirectionalText:x,processStyledBidirectionalText:v}=Ri;if(x&&1===m.sections.length){g=[];const t=x(m.toString(),Yu(m,c,a,r,i,d));for(const e of t){const t=new ju;t.text=e,t.sections=m.sections;for(let r=0;r0&&n>_&&(_=n);}else {const t=n[y.fontStack],e=t&&t[g];if(e&&e.rect)A=e.rect,b=e.metrics;else {const t=r[y.fontStack],e=t&&t[g];if(!e)continue;b=e.metrics;}x=(s-y.scale)*iu;}M?(e.verticalizable=!0,w.push({glyph:g,imageName:S,x:f,y:d+x,vertical:M,scale:y.scale,fontStack:y.fontStack,sectionIndex:m,metrics:b,rect:A}),f+=k*y.scale+c):(w.push({glyph:g,imageName:S,x:f,y:d+x,vertical:M,scale:y.scale,fontStack:y.fontStack,sectionIndex:m,metrics:b,rect:A}),f+=b.advance*y.scale+c);}0!==w.length&&(y=Math.max(f-c,y),Wu(w,0,w.length-1,g,_)),f=0;const A=a*s+_;b.lineOffset=Math.max(_,l),d+=A,m=Math.max(A,m),++x;}var v;const b=d-Du,{horizontalAlign:w,verticalAlign:_}=Ju(o);((function(t,e,r,n,i,s,a,o,l){const u=(e-r)*i;let c=0;c=s!==a?-o*n-Du:(-n*l+.5)*a;for(const e of t)for(const t of e.positionedGlyphs)t.x+=u,t.y+=c;}))(e.positionedLines,g,w,_,y,m,a,b,s.length),e.top+=-_*b,e.bottom=e.top+b,e.left+=-w*y,e.right=e.left+y;}(w,r,n,i,g,o,l,u,p,c,f,y),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return !1;return !0}(b)&&w}const Uu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},qu={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Nu={40:!0};function Zu(t,e,r,n,i,s){if(e.imageName){const t=n[e.imageName];return t?t.displaySize[0]*e.scale*iu/s+i:0}{const n=r[e.fontStack],s=n&&n[t];return s?s.metrics.advance*e.scale+i:0}}function Gu(t,e,r,n){const i=Math.pow(t-e,2);return n?t=0;let u=0;for(let r=0;ru){const t=Math.ceil(s/u);i*=t/a,a=t;}return {x1:n,y1:i,x2:n+s,y2:i+a}}function ec(t,e,r,n,i,s){const a=t.image;let o;if(a.content){const t=a.content,e=a.pixelRatio||1;o=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e];}const l=e.left*s,u=e.right*s;let c,h,p,f;\"width\"===r||\"both\"===r?(f=i[0]+l-n[3],h=i[0]+u+n[1]):(f=i[0]+(l+u-a.displaySize[0])/2,h=f+a.displaySize[0]);const d=e.top*s,y=e.bottom*s;return \"height\"===r||\"both\"===r?(c=i[1]+d-n[0],p=i[1]+y+n[2]):(c=i[1]+(d+y-a.displaySize[1])/2,p=c+a.displaySize[1]),{image:a,top:c,right:h,bottom:p,left:f,collisionPadding:o}}const rc=255,nc=128,ic=rc*nc;function sc(t,e){const{expression:r}=e;if(\"constant\"===r.kind)return {kind:\"constant\",layoutSize:r.evaluate(new Ui(t+1))};if(\"source\"===r.kind)return {kind:\"source\"};{const{zoomStops:e,interpolationType:n}=r;let i=0;for(;it.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=lo([]),this.placementViewportMatrix=lo([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=sc(this.zoom,r[\"text-size\"]),this.iconSizeData=sc(this.zoom,r[\"icon-size\"]);const n=this.layers[0].layout,i=n.get(\"symbol-sort-key\"),s=n.get(\"symbol-z-order\");this.canOverlap=\"never\"!==ac(n,\"text-overlap\",\"text-allow-overlap\")||\"never\"!==ac(n,\"icon-overlap\",\"icon-allow-overlap\")||n.get(\"text-ignore-placement\")||n.get(\"icon-ignore-placement\"),this.sortFeaturesByKey=\"viewport-y\"!==s&&!i.isConstant(),this.sortFeaturesByY=(\"viewport-y\"===s||\"auto\"===s&&!this.sortFeaturesByKey)&&this.canOverlap,\"point\"===n.get(\"symbol-placement\")&&(this.writingModes=n.get(\"text-writing-mode\").map((e=>t.ah[e]))),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=e.sourceID;}createArrays(){this.text=new pc(new Ea(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new pc(new Ea(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new Os,this.lineVertexArray=new js,this.symbolInstances=new Ds,this.textAnchorOffsets=new Us;}calculateGlyphDependencies(t,e,r,n,i){for(let s=0;s0)&&(\"constant\"!==a.value.kind||a.value.value.length>0),c=\"constant\"!==l.value.kind||!!l.value.value||Object.keys(l.parameters).length>0,h=s.get(\"symbol-sort-key\");if(this.features=[],!u&&!c)return;const p=r.iconDependencies,f=r.glyphDependencies,d=r.availableImages,y=new Ui(this.zoom);for(const{feature:r,id:o,index:l,sourceLayerIndex:m}of e){const e=i._featureFilter.needGeometry,g=ja(r,e);if(!i._featureFilter.filter(y,g,n))continue;let x,v;if(e||(g.geometry=Oa(r)),u){const t=i.getValueAndResolveTokens(\"text-field\",g,n,d),e=Yt.factory(t),r=this.hasRTLText=this.hasRTLText||hc(e);(!r||\"unavailable\"===Ri.getRTLTextPluginStatus()||r&&Ri.isParsed())&&(x=ru(e,i,g));}if(c){const t=i.getValueAndResolveTokens(\"icon-image\",g,n,d);v=t instanceof te?t:te.fromString(t);}if(!x&&!v)continue;const b=this.sortFeaturesByKey?h.evaluate(g,{},n):void 0;if(this.features.push({id:o,text:x,icon:v,index:l,sourceLayerIndex:m,geometry:g.geometry,properties:r.properties,type:oc[r.type],sortKey:b}),v&&(p[v.name]=!0),x){const e=a.evaluate(g,{},n).join(\",\"),r=\"viewport\"!==s.get(\"text-rotation-alignment\")&&\"point\"!==s.get(\"symbol-placement\");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(t.ah.vertical)>=0;for(const t of x.sections)if(t.image)p[t.image.name]=!0;else {const n=Pi(x.toString()),i=t.fontStack||e,s=f[i]=f[i]||{};this.calculateGlyphDependencies(t.text,s,r,this.allowVerticalPlacement,n);}}}\"line\"===s.get(\"symbol-placement\")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++;}function a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return `${t}:${n.x}:${n.y}`}for(let u=0;ut.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey));}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r));}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return !this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0;}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy();}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData();}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]);const i={};for(let n=t.segment+1;n=0;r--)i[r]={x:e[r].x,y:e[r].y,tileUnitDistanceFromAnchor:n},r>0&&(n+=e[r-1].dist(e[r]));for(let t=0;t0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;en[t]-n[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1});}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex),[e.rightJustifiedTextSymbolIndex,e.centerJustifiedTextSymbolIndex,e.leftJustifiedTextSymbolIndex].forEach(((t,e,r)=>{t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t);})),e.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,e.verticalPlacedTextSymbolIndex),e.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.placedIconSymbolIndex),e.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,e.verticalPlacedIconSymbolIndex);}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray);}}}let yc,mc;wi(\"SymbolBucket\",dc,{omit:[\"layers\",\"collisionBoxArray\",\"features\",\"compareText\"]}),dc.MAX_GLYPHS=65535,dc.addDynamicAttributes=cc;var gc={get paint(){return mc=mc||new rs({\"icon-opacity\":new Wi(G.paint_symbol[\"icon-opacity\"]),\"icon-color\":new Wi(G.paint_symbol[\"icon-color\"]),\"icon-halo-color\":new Wi(G.paint_symbol[\"icon-halo-color\"]),\"icon-halo-width\":new Wi(G.paint_symbol[\"icon-halo-width\"]),\"icon-halo-blur\":new Wi(G.paint_symbol[\"icon-halo-blur\"]),\"icon-translate\":new Ji(G.paint_symbol[\"icon-translate\"]),\"icon-translate-anchor\":new Ji(G.paint_symbol[\"icon-translate-anchor\"]),\"text-opacity\":new Wi(G.paint_symbol[\"text-opacity\"]),\"text-color\":new Wi(G.paint_symbol[\"text-color\"],{runtimeType:pt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),\"text-halo-color\":new Wi(G.paint_symbol[\"text-halo-color\"]),\"text-halo-width\":new Wi(G.paint_symbol[\"text-halo-width\"]),\"text-halo-blur\":new Wi(G.paint_symbol[\"text-halo-blur\"]),\"text-translate\":new Ji(G.paint_symbol[\"text-translate\"]),\"text-translate-anchor\":new Ji(G.paint_symbol[\"text-translate-anchor\"])})},get layout(){return yc=yc||new rs({\"symbol-placement\":new Ji(G.layout_symbol[\"symbol-placement\"]),\"symbol-spacing\":new Ji(G.layout_symbol[\"symbol-spacing\"]),\"symbol-avoid-edges\":new Ji(G.layout_symbol[\"symbol-avoid-edges\"]),\"symbol-sort-key\":new Wi(G.layout_symbol[\"symbol-sort-key\"]),\"symbol-z-order\":new Ji(G.layout_symbol[\"symbol-z-order\"]),\"icon-allow-overlap\":new Ji(G.layout_symbol[\"icon-allow-overlap\"]),\"icon-overlap\":new Ji(G.layout_symbol[\"icon-overlap\"]),\"icon-ignore-placement\":new Ji(G.layout_symbol[\"icon-ignore-placement\"]),\"icon-optional\":new Ji(G.layout_symbol[\"icon-optional\"]),\"icon-rotation-alignment\":new Ji(G.layout_symbol[\"icon-rotation-alignment\"]),\"icon-size\":new Wi(G.layout_symbol[\"icon-size\"]),\"icon-text-fit\":new Ji(G.layout_symbol[\"icon-text-fit\"]),\"icon-text-fit-padding\":new Ji(G.layout_symbol[\"icon-text-fit-padding\"]),\"icon-image\":new Wi(G.layout_symbol[\"icon-image\"]),\"icon-rotate\":new Wi(G.layout_symbol[\"icon-rotate\"]),\"icon-padding\":new Wi(G.layout_symbol[\"icon-padding\"]),\"icon-keep-upright\":new Ji(G.layout_symbol[\"icon-keep-upright\"]),\"icon-offset\":new Wi(G.layout_symbol[\"icon-offset\"]),\"icon-anchor\":new Wi(G.layout_symbol[\"icon-anchor\"]),\"icon-pitch-alignment\":new Ji(G.layout_symbol[\"icon-pitch-alignment\"]),\"text-pitch-alignment\":new Ji(G.layout_symbol[\"text-pitch-alignment\"]),\"text-rotation-alignment\":new Ji(G.layout_symbol[\"text-rotation-alignment\"]),\"text-field\":new Wi(G.layout_symbol[\"text-field\"]),\"text-font\":new Wi(G.layout_symbol[\"text-font\"]),\"text-size\":new Wi(G.layout_symbol[\"text-size\"]),\"text-max-width\":new Wi(G.layout_symbol[\"text-max-width\"]),\"text-line-height\":new Ji(G.layout_symbol[\"text-line-height\"]),\"text-letter-spacing\":new Wi(G.layout_symbol[\"text-letter-spacing\"]),\"text-justify\":new Wi(G.layout_symbol[\"text-justify\"]),\"text-radial-offset\":new Wi(G.layout_symbol[\"text-radial-offset\"]),\"text-variable-anchor\":new Ji(G.layout_symbol[\"text-variable-anchor\"]),\"text-variable-anchor-offset\":new Wi(G.layout_symbol[\"text-variable-anchor-offset\"]),\"text-anchor\":new Wi(G.layout_symbol[\"text-anchor\"]),\"text-max-angle\":new Ji(G.layout_symbol[\"text-max-angle\"]),\"text-writing-mode\":new Ji(G.layout_symbol[\"text-writing-mode\"]),\"text-rotate\":new Wi(G.layout_symbol[\"text-rotate\"]),\"text-padding\":new Ji(G.layout_symbol[\"text-padding\"]),\"text-keep-upright\":new Ji(G.layout_symbol[\"text-keep-upright\"]),\"text-transform\":new Wi(G.layout_symbol[\"text-transform\"]),\"text-offset\":new Wi(G.layout_symbol[\"text-offset\"]),\"text-allow-overlap\":new Ji(G.layout_symbol[\"text-allow-overlap\"]),\"text-overlap\":new Ji(G.layout_symbol[\"text-overlap\"]),\"text-ignore-placement\":new Ji(G.layout_symbol[\"text-ignore-placement\"]),\"text-optional\":new Ji(G.layout_symbol[\"text-optional\"])})}};class xc{constructor(t){if(void 0===t.property.overrides)throw new Error(\"overrides must be provided to instantiate FormatSectionOverride class\");this.type=t.property.overrides?t.property.overrides.runtimeType:lt,this.defaultValue=t;}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression);}outputDefined(){return !1}serialize(){return null}}wi(\"FormatSectionOverride\",xc,{omit:[\"defaultValue\"]});class vc extends is{constructor(t){super(t,gc);}recalculate(t,e){if(super.recalculate(t,e),\"auto\"===this.layout.get(\"icon-rotation-alignment\")&&(this.layout._values[\"icon-rotation-alignment\"]=\"point\"!==this.layout.get(\"symbol-placement\")?\"map\":\"viewport\"),\"auto\"===this.layout.get(\"text-rotation-alignment\")&&(this.layout._values[\"text-rotation-alignment\"]=\"point\"!==this.layout.get(\"symbol-placement\")?\"map\":\"viewport\"),\"auto\"===this.layout.get(\"text-pitch-alignment\")&&(this.layout._values[\"text-pitch-alignment\"]=\"map\"===this.layout.get(\"text-rotation-alignment\")?\"map\":\"viewport\"),\"auto\"===this.layout.get(\"icon-pitch-alignment\")&&(this.layout._values[\"icon-pitch-alignment\"]=this.layout.get(\"icon-rotation-alignment\")),\"point\"===this.layout.get(\"symbol-placement\")){const t=this.layout.get(\"text-writing-mode\");if(t){const e=[];for(const r of t)e.indexOf(r)<0&&e.push(r);this.layout._values[\"text-writing-mode\"]=e;}else this.layout._values[\"text-writing-mode\"]=[\"horizontal\"];}this._setPaintOverrides();}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||vn(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>t&&r in t?String(t[r]):\"\"))}(e.properties,i)}createBucket(t){return new dc(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error(\"Should take a different path in FeatureIndex\")}_setPaintOverrides(){for(const t of gc.paint.overridableProperties){if(!vc.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new xc(e),n=new xn(r,e.property.specification);let i=null;i=\"constant\"===e.value.kind||\"source\"===e.value.kind?new wn(\"source\",n):new _n(\"composite\",n,e.value.zoomStops),this.paint._values[t]=new Hi(e.property,i,e.parameters);}}_handleOverridablePaintPropertyUpdate(t,e,r){return !(!this.layout||e.isDataDriven()||r.isDataDriven())&&vc.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get(\"text-field\"),n=gc.paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if(\"constant\"===r.value.kind&&r.value.value instanceof Yt)s(r.value.value.sections);else if(\"source\"===r.value.kind){const t=e=>{i||(e instanceof se&&ne(e.value)===mt?s(e.value.sections):e instanceof Ze?s(e.sections):e.eachChild(t));},e=r.value;e._styleExpression&&t(e._styleExpression.expression);}return i}}let bc;var wc={get paint(){return bc=bc||new rs({\"background-color\":new Ji(G.paint_background[\"background-color\"]),\"background-pattern\":new ts(G.paint_background[\"background-pattern\"]),\"background-opacity\":new Ji(G.paint_background[\"background-opacity\"])})}};class _c extends is{constructor(t){super(t,wc);}}let Ac;var Sc={get paint(){return Ac=Ac||new rs({\"raster-opacity\":new Ji(G.paint_raster[\"raster-opacity\"]),\"raster-hue-rotate\":new Ji(G.paint_raster[\"raster-hue-rotate\"]),\"raster-brightness-min\":new Ji(G.paint_raster[\"raster-brightness-min\"]),\"raster-brightness-max\":new Ji(G.paint_raster[\"raster-brightness-max\"]),\"raster-saturation\":new Ji(G.paint_raster[\"raster-saturation\"]),\"raster-contrast\":new Ji(G.paint_raster[\"raster-contrast\"]),\"raster-resampling\":new Ji(G.paint_raster[\"raster-resampling\"]),\"raster-fade-duration\":new Ji(G.paint_raster[\"raster-fade-duration\"])})}};class kc extends is{constructor(t){super(t,Sc);}}class Mc extends is{constructor(t){super(t,{}),this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl);},this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl);},this.implementation=t;}is3D(){return \"3d\"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return !1}serialize(){throw new Error(\"Custom layers cannot be serialized\")}}class Ic{constructor(t){this._methodToThrottle=t,this._triggered=!1,\"undefined\"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle();});}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle();}),0));}remove(){delete this._channel,this._methodToThrottle=()=>{};}}const zc=6371008.8;class Pc{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error(\"Invalid LngLat latitude value: must be between -90 and 90\")}wrap(){return new Pc(m(this.lng,-180,180),this.lat)}toArray(){return [this.lng,this.lat]}toString(){return `LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return zc*Math.acos(Math.min(i,1))}static convert(t){if(t instanceof Pc)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Pc(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&\"object\"==typeof t&&null!==t)return new Pc(Number(\"lng\"in t?t.lng:t.lon),Number(t.lat));throw new Error(\"`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]\")}}const Cc=2*Math.PI*zc;function Bc(t){return Cc*Math.cos(t*Math.PI/180)}function Vc(t){return (180+t)/360}function Ec(t){return (180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Fc(t,e){return t/Bc(e)}function Tc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}class $c{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r;}static fromLngLat(t,e=0){const r=Pc.convert(t);return new $c(Vc(r.lng),Ec(r.lat),Fc(e,r.lat))}toLngLat(){return new Pc(360*this.x-180,Tc(this.y))}toAltitude(){return this.z*Bc(Tc(this.y))}meterInMercatorCoordinateUnits(){return 1/Cc*(t=Tc(this.y),1/Math.cos(t*Math.PI/180));var t;}}function Lc(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return [t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}class Dc{constructor(t,e,r){if(!function(t,e,r){return !(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}(t,e,r))throw new Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=Rc(0,t,t,e,r);}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){const n=(s=this.y,a=this.z,o=Lc(256*(i=this.x),256*(s=Math.pow(2,a)-s-1),a),l=Lc(256*(i+1),256*(s+1),a),o[0]+\",\"+o[1]+\",\"+l[0]+\",\"+l[1]);var i,s,a,o,l;const u=function(t,e,r){let n,i=\"\";for(let s=t;s>0;s--)n=1<1?\"@2x\":\"\").replace(/{quadkey}/g,u).replace(/{bbox-epsg-3857}/g,n)}isChildOf(t){const e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){const e=Math.pow(2,this.z);return new s((t.x*e-this.x)*$a,(t.y*e-this.y)*$a)}toString(){return `${this.z}/${this.x}/${this.y}`}}class Oc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Rc(t,e.z,e.z,e.x,e.y);}}class jc{constructor(t,e,r,n,i){if(t= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Dc(r,+n,+i),this.key=Rc(e,t,r,n,i);}clone(){return new jc(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const e=this.canonical.z-t;return t>this.canonical.z?new jc(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new jc(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-t;return t>this.canonical.z?Rc(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Rc(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return !1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return [new jc(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return [new jc(e,this.wrap,e,r,n),new jc(e,this.wrap,e,r+1,n),new jc(e,this.wrap,e,r,n+1),new jc(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=r),r=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError(\"out of range source coordinates for DEM data\");return (e+1)*this.stride+(t+1)}unpack(t,e,r){return t*this.redFactor+e*this.greenFactor+r*this.blueFactor-this.baseShift}getPixels(){return new Ao({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error(\"dem dimension mismatch\");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1;}switch(r){case-1:s=a-1;break;case 1:a=s+1;}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Nc{constructor(t,e,r,n,i){this.type=\"Feature\",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,this.id=i;}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t;}toJSON(){const t={geometry:this.geometry};for(const e in this)\"_geometry\"!==e&&\"_vectorTileFeature\"!==e&&(t[e]=this[e]);return t}}class Zc{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new vi($a,16,0),this.grid3D=new vi($a,16,0),this.featureIndexArray=new Ns,this.promoteId=e;}insert(t,e,r,n,i,s){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);const o=s?this.grid3D:this.grid;for(let t=0;t=0&&n[3]>=0&&o.insert(a,n[0],n[1],n[2],n[3]);}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new fl.VectorTile(new Iu(this.rawTileData)).layers,this.sourceLayerCoder=new qc(this.vtLayers?Object.keys(this.vtLayers).sort():[\"_geojsonTileLayer\"])),this.vtLayers}query(t,e,r,n){this.loadVTLayers();const i=t.params||{},a=$a/t.tileSize/t.scale,o=zn(i.filter),l=t.queryGeometry,u=t.queryPadding*a,c=Kc(l),h=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),p=Kc(t.cameraQueryGeometry),f=this.grid3D.query(p.minX-u,p.minY-u,p.maxX+u,p.maxY+u,((e,r,n,i)=>function(t,e,r,n,i){for(const s of t)if(e<=s.x&&r<=s.y&&n>=s.x&&i>=s.y)return !0;const a=[new s(e,r),new s(e,i),new s(n,i),new s(n,r)];if(t.length>2)for(const e of a)if(Wa(t,e))return !0;for(let e=0;e(p||(p=Oa(e)),r.queryIntersectsFeature(l,e,n,p,this.z,t.transform,a,t.pixelPosMatrix))));}return d}loadMatchingFeature(t,e,r,n,i,s,a,o,l,u,c){const h=this.bucketLayerIDs[e];if(s&&!function(t,e){for(let r=0;r=0)return !0;return !1}(s,h))return;const p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(n);if(i.needGeometry){const t=ja(f,!0);if(!i.filter(new Ui(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!i.filter(new Ui(this.tileID.overscaledZ),f))return;const d=this.getId(f,p);for(let e=0;e{const a=e instanceof Yi?e.get(s):null;return a&&a.evaluate?a.evaluate(r,n,i):a}))}function Kc(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);return {minX:e,minY:r,maxX:n,maxY:i}}function Xc(t,e){return e-t}function Hc(t,e,r,n,i){const a=[];for(let o=0;o=n&&c.x>=n||(o.x>=n?o=new s(n,o.y+(n-o.x)/(c.x-o.x)*(c.y-o.y))._round():c.x>=n&&(c=new s(n,o.y+(n-o.x)/(c.x-o.x)*(c.y-o.y))._round()),o.y>=i&&c.y>=i||(o.y>=i?o=new s(o.x+(i-o.y)/(c.y-o.y)*(c.x-o.x),i)._round():c.y>=i&&(c=new s(o.x+(i-o.y)/(c.y-o.y)*(c.x-o.x),i)._round()),u&&o.equals(u[u.length-1])||(u=[o],a.push(u)),u.push(c)))));}}return a}wi(\"FeatureIndex\",Zc,{omit:[\"rawTileData\",\"sourceLayerCoder\"]});class Yc extends s{constructor(t,e,r,n){super(t,e),this.angle=r,void 0!==n&&(this.segment=n);}clone(){return new Yc(this.x,this.y,this.angle,this.segment)}}function Jc(t,e,r,n,i){if(void 0===e.segment||0===r)return !0;let s=e,a=e.segment+1,o=0;for(;o>-r/2;){if(a--,a<0)return !1;o-=t[a].dist(s),s=t[a];}o+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;on;)u-=l.shift().angleDelta;if(u>i)return !1;a++,o+=e.dist(r);}return !0}function Wc(t){let e=0;for(let r=0;ru){const c=(u-l)/s,h=Ce.number(n.x,i.x,c),p=Ce.number(n.y,i.y,c),f=new Yc(h,p,i.angleTo(n),r);return f._round(),!a||Jc(t,f,o,a,e)?f:void 0}l+=s;}}function rh(t,e,r,n,i,s,a,o,l){const u=Qc(n,s,a),c=th(n,i),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h=0&&g=0&&x=0&&p+u<=c){const r=new Yc(g,x,y,e);r._round(),n&&!Jc(t,r,s,n,i)||f.push(r);}}h+=d;}return o||f.length||a||(f=nh(t,h/2,r,n,i,s,a,!0,l)),f}wi(\"Anchor\",Yc);const ih=Fu;function sh(t,e,r,n){const i=[],a=t.image,o=a.pixelRatio,l=a.paddedRect.w-2*ih,u=a.paddedRect.h-2*ih;let c={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom};const h=a.stretchX||[[0,l]],p=a.stretchY||[[0,u]],f=(t,e)=>t+e[1]-e[0],d=h.reduce(f,0),y=p.reduce(f,0),m=l-d,g=u-y;let x=0,v=d,b=0,w=y,_=0,A=m,S=0,k=g;if(a.content&&n){const e=a.content,r=e[2]-e[0],n=e[3]-e[1];(a.textFitWidth||a.textFitHeight)&&(c=tc(t)),x=ah(h,0,e[0]),b=ah(p,0,e[1]),v=ah(h,e[0],e[2]),w=ah(p,e[1],e[3]),_=e[0]-x,S=e[1]-b,A=r-v,k=n-w;}const M=c.x1,I=c.y1,z=c.x2-M,P=c.y2-I,C=(t,n,i,l)=>{const u=lh(t.stretch-x,v,z,M),c=uh(t.fixed-_,A,t.stretch,d),h=lh(n.stretch-b,w,P,I),p=uh(n.fixed-S,k,n.stretch,y),f=lh(i.stretch-x,v,z,M),m=uh(i.fixed-_,A,i.stretch,d),g=lh(l.stretch-b,w,P,I),C=uh(l.fixed-S,k,l.stretch,y),B=new s(u,h),V=new s(f,h),E=new s(f,g),F=new s(u,g),T=new s(c/o,p/o),$=new s(m/o,C/o),L=e*Math.PI/180;if(L){const t=Math.sin(L),e=Math.cos(L),r=[e,-t,t,e];B._matMult(r),V._matMult(r),F._matMult(r),E._matMult(r);}const D=t.stretch+t.fixed,O=n.stretch+n.fixed;return {tl:B,tr:V,bl:F,br:E,tex:{x:a.paddedRect.x+ih+D,y:a.paddedRect.y+ih+O,w:i.stretch+i.fixed-D,h:l.stretch+l.fixed-O},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:T,pixelOffsetBR:$,minFontScaleX:A/o/z,minFontScaleY:k/o/P,isSDF:r}};if(n&&(a.stretchX||a.stretchY)){const t=oh(h,m,d),e=oh(p,g,y);for(let r=0;r0&&(n=Math.max(10,n),this.circleDiameter=n);}else {const u=(null===(h=a.image)||void 0===h?void 0:h.content)&&(a.image.textFitWidth||a.image.textFitHeight)?tc(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};u.y1=u.y1*o-l[0],u.y2=u.y2*o+l[2],u.x1=u.x1*o-l[3],u.x2=u.x2*o+l[1];const p=a.collisionPadding;if(p&&(u.x1-=p[0]*o,u.y1-=p[1]*o,u.x2+=p[2]*o,u.y2+=p[3]*o),c){const t=new s(u.x1,u.y1),e=new s(u.x2,u.y1),r=new s(u.x1,u.y2),n=new s(u.x2,u.y2),i=c*Math.PI/180;t._rotate(i),e._rotate(i),r._rotate(i),n._rotate(i),u.x1=Math.min(t.x,e.x,r.x,n.x),u.x2=Math.max(t.x,e.x,r.x,n.x),u.y1=Math.min(t.y,e.y,r.y,n.y),u.y2=Math.max(t.y,e.y,r.y,n.y);}t.emplaceBack(e.x,e.y,u.x1,u.y1,u.x2,u.y2,r,n,i);}this.boxEndIndex=t.length;}}class hh{constructor(t=[],e=((t,e)=>te?1:0)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t);}push(t){this.data.push(t),this._up(this.length++);}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return --this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i;}e[t]=n;}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t=0)break;e[t]=e[n],t=n;}e[t]=i;}}function ph(t,e=1,r=!1){let n=1/0,i=1/0,a=-1/0,o=-1/0;const l=t[0];for(let t=0;ta)&&(a=e.x),(!t||e.y>o)&&(o=e.y);}const u=Math.min(a-n,o-i);let c=u/2;const h=new hh([],fh);if(0===u)return new s(n,i);for(let e=n;ep.d||!p.d)&&(p=n,r&&console.log(\"found best %d after %d probes\",Math.round(1e4*n.d)/1e4,f)),n.max-p.d<=e||(c=n.h/2,h.push(new dh(n.p.x-c,n.p.y-c,c,t)),h.push(new dh(n.p.x+c,n.p.y-c,c,t)),h.push(new dh(n.p.x-c,n.p.y+c,c,t)),h.push(new dh(n.p.x+c,n.p.y+c,c,t)),f+=4);}return r&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function fh(t,e){return e.max-t.max}function dh(t,e,r,n){this.p=new s(t,e),this.h=r,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;it.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,Ya(t,i,o));}}return (r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2;}var yh;t.aq=void 0,(yh=t.aq||(t.aq={}))[yh.center=1]=\"center\",yh[yh.left=2]=\"left\",yh[yh.right=3]=\"right\",yh[yh.top=4]=\"top\",yh[yh.bottom=5]=\"bottom\",yh[yh[\"top-left\"]=6]=\"top-left\",yh[yh[\"top-right\"]=7]=\"top-right\",yh[yh[\"bottom-left\"]=8]=\"bottom-left\",yh[yh[\"bottom-right\"]=9]=\"bottom-right\";const mh=7,gh=Number.POSITIVE_INFINITY;function xh(t,e){return e[1]!==gh?function(t,e,r){let n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case\"top-right\":case\"top-left\":case\"top\":i=r-mh;break;case\"bottom-right\":case\"bottom-left\":case\"bottom\":i=-r+mh;}switch(t){case\"top-right\":case\"bottom-right\":case\"right\":n=-e;break;case\"top-left\":case\"bottom-left\":case\"left\":n=e;}return [n,i]}(t,e[0],e[1]):function(t,e){let r=0,n=0;e<0&&(e=0);const i=e/Math.SQRT2;switch(t){case\"top-right\":case\"top-left\":n=i-mh;break;case\"bottom-right\":case\"bottom-left\":n=-i+mh;break;case\"bottom\":n=-e+mh;break;case\"top\":n=e-mh;}switch(t){case\"top-right\":case\"bottom-right\":r=-i;break;case\"top-left\":case\"bottom-left\":r=i;break;case\"left\":r=e;break;case\"right\":r=-e;}return [r,n]}(t,e[0])}function vh(t,e,r){var n;const i=t.layout,s=null===(n=i.get(\"text-variable-anchor-offset\"))||void 0===n?void 0:n.evaluate(e,{},r);if(s){const t=s.values,e=[];for(let r=0;rt*iu));n.startsWith(\"top\")?i[1]-=mh:n.startsWith(\"bottom\")&&(i[1]+=mh),e[r+1]=i;}return new Qt(e)}const a=i.get(\"text-variable-anchor\");if(a){let n;n=void 0!==t._unevaluatedLayout.getValue(\"text-radial-offset\")?[i.get(\"text-radial-offset\").evaluate(e,{},r)*iu,gh]:i.get(\"text-offset\").evaluate(e,{},r).map((t=>t*iu));const s=[];for(const t of a)s.push(t,xh(t,n));return new Qt(s)}return null}function bh(t){switch(t){case\"right\":case\"top-right\":case\"bottom-right\":return \"right\";case\"left\":case\"top-left\":case\"bottom-left\":return \"left\"}return \"center\"}function wh(e,r,n,i,s,a,o,l,u,c,h){let p=a.textMaxSize.evaluate(r,{});void 0===p&&(p=o);const f=e.layers[0].layout,d=f.get(\"icon-offset\").evaluate(r,{},h),y=Ah(n.horizontal),m=o/24,g=e.tilePixelRatio*m,x=e.tilePixelRatio*p/24,v=e.tilePixelRatio*l,b=e.tilePixelRatio*f.get(\"symbol-spacing\"),w=f.get(\"text-padding\")*e.tilePixelRatio,_=function(t,e,r,n=1){const i=t.get(\"icon-padding\").evaluate(e,{},r),s=i&&i.values;return [s[0]*n,s[1]*n,s[2]*n,s[3]*n]}(f,r,h,e.tilePixelRatio),S=f.get(\"text-max-angle\")/180*Math.PI,k=\"viewport\"!==f.get(\"text-rotation-alignment\")&&\"point\"!==f.get(\"symbol-placement\"),M=\"map\"===f.get(\"icon-rotation-alignment\")&&\"point\"!==f.get(\"symbol-placement\"),I=f.get(\"symbol-placement\"),z=b/2,P=f.get(\"icon-text-fit\");let C;i&&\"none\"!==P&&(e.allowVerticalPlacement&&n.vertical&&(C=ec(i,n.vertical,P,f.get(\"icon-text-fit-padding\"),d,m)),y&&(i=ec(i,y,P,f.get(\"icon-text-fit-padding\"),d,m)));const B=(l,p)=>{p.x<0||p.x>=$a||p.y<0||p.y>=$a||function(e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,S,k,M){const I=e.addToLineVertexArray(r,n);let z,P,C,B,V=0,E=0,F=0,T=0,$=-1,L=-1;const D={};let O=ma(\"\");if(e.allowVerticalPlacement&&i.vertical){const t=l.layout.get(\"text-rotate\").evaluate(w,{},k)+90;C=new ch(u,r,c,h,p,i.vertical,f,d,y,t),o&&(B=new ch(u,r,c,h,p,o,g,x,y,t));}if(s){const n=l.layout.get(\"icon-rotate\").evaluate(w,{}),i=\"none\"!==l.layout.get(\"icon-text-fit\"),a=sh(s,n,S,i),f=o?sh(o,n,S,i):void 0;P=new ch(u,r,c,h,p,s,g,x,!1,n),V=4*a.length;const d=e.iconSizeData;let y=null;\"source\"===d.kind?(y=[nc*l.layout.get(\"icon-size\").evaluate(w,{})],y[0]>ic&&A(`${e.layerIds[0]}: Value for \"icon-size\" is >= ${rc}. Reduce your \"icon-size\".`)):\"composite\"===d.kind&&(y=[nc*_.compositeIconSizes[0].evaluate(w,{},k),nc*_.compositeIconSizes[1].evaluate(w,{},k)],(y[0]>ic||y[1]>ic)&&A(`${e.layerIds[0]}: Value for \"icon-size\" is >= ${rc}. Reduce your \"icon-size\".`)),e.addSymbols(e.icon,a,y,b,v,w,t.ah.none,r,I.lineStartIndex,I.lineLength,-1,k),$=e.icon.placedSymbolArray.length-1,f&&(E=4*f.length,e.addSymbols(e.icon,f,y,b,v,w,t.ah.vertical,r,I.lineStartIndex,I.lineLength,-1,k),L=e.icon.placedSymbolArray.length-1);}const j=Object.keys(i.horizontal);for(const n of j){const s=i.horizontal[n];if(!z){O=ma(s.text);const t=l.layout.get(\"text-rotate\").evaluate(w,{},k);z=new ch(u,r,c,h,p,s,f,d,y,t);}const o=1===s.positionedLines.length;if(F+=_h(e,r,s,a,l,y,w,m,I,i.vertical?t.ah.horizontal:t.ah.horizontalOnly,o?j:[n],D,$,_,k),o)break}i.vertical&&(T+=_h(e,r,i.vertical,a,l,y,w,m,I,t.ah.vertical,[\"vertical\"],D,L,_,k));const R=z?z.boxStartIndex:e.collisionBoxArray.length,U=z?z.boxEndIndex:e.collisionBoxArray.length,q=C?C.boxStartIndex:e.collisionBoxArray.length,N=C?C.boxEndIndex:e.collisionBoxArray.length,Z=P?P.boxStartIndex:e.collisionBoxArray.length,G=P?P.boxEndIndex:e.collisionBoxArray.length,K=B?B.boxStartIndex:e.collisionBoxArray.length,X=B?B.boxEndIndex:e.collisionBoxArray.length;let H=-1;const Y=(t,e)=>t&&t.circleDiameter?Math.max(t.circleDiameter,e):e;H=Y(z,H),H=Y(C,H),H=Y(P,H),H=Y(B,H);const J=H>-1?1:0;J&&(H*=M/iu),e.glyphOffsetArray.length>=dc.MAX_GLYPHS&&A(\"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"),void 0!==w.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,w.sortKey);const W=vh(l,w,k),[Q,tt]=function(e,r){const n=e.length,i=null==r?void 0:r.values;if((null==i?void 0:i.length)>0)for(let r=0;r=0?D.right:-1,D.center>=0?D.center:-1,D.left>=0?D.left:-1,D.vertical||-1,$,L,O,R,U,q,N,Z,G,K,X,c,F,T,V,E,J,0,f,H,Q,tt);}(e,p,l,n,i,s,C,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,g,[w,w,w,w],k,u,v,_,M,d,r,a,c,h,o);};if(\"line\"===I)for(const t of Hc(r.geometry,0,0,$a,$a)){const r=rh(t,b,S,n.vertical||y,i,24,x,e.overscaling,$a);for(const n of r)y&&Sh(e,y.text,z,n)||B(t,n);}else if(\"line-center\"===I){for(const t of r.geometry)if(t.length>1){const e=eh(t,S,n.vertical||y,i,24,x);e&&B(t,e);}}else if(\"Polygon\"===r.type)for(const t of xr(r.geometry,0)){const e=ph(t,16);B(t[0],new Yc(e.x,e.y,0));}else if(\"LineString\"===r.type)for(const t of r.geometry)B(t,new Yc(t[0].x,t[0].y,0));else if(\"Point\"===r.type)for(const t of r.geometry)for(const e of t)B([e],new Yc(e.x,e.y,0));}function _h(t,e,r,n,i,a,o,l,u,c,h,p,f,d,y){const m=function(t,e,r,n,i,a,o,l){const u=n.layout.get(\"text-rotate\").evaluate(a,{})*Math.PI/180,c=[];for(const t of e.positionedLines)for(const n of t.positionedGlyphs){if(!n.rect)continue;const a=n.rect||{};let h=Vu+1,p=!0,f=1,d=0;const y=(i||l)&&n.vertical,m=n.metrics.advance*n.scale/2;if(l&&e.verticalizable&&(d=t.lineOffset/2-(n.imageName?-(iu-n.metrics.width*n.scale)/2:(n.scale-1)*iu)),n.imageName){const t=o[n.imageName];p=t.sdf,f=t.pixelRatio,h=Fu/f;}const g=i?[n.x+m,n.y]:[0,0];let x=i?[0,0]:[n.x+m+r[0],n.y+r[1]-d],v=[0,0];y&&(v=x,x=[0,0]);const b=n.metrics.isDoubleResolution?2:1,w=(n.metrics.left-h)*n.scale-m+x[0],_=(-n.metrics.top-h)*n.scale+x[1],A=w+a.w/b*n.scale/f,S=_+a.h/b*n.scale/f,k=new s(w,_),M=new s(A,_),I=new s(w,S),z=new s(A,S);if(y){const t=new s(-m,m-Du),e=-Math.PI/2,r=iu/2-m,i=new s(5-Du-r,-(n.imageName?r:0)),a=new s(...v);k._rotateAround(e,t)._add(i)._add(a),M._rotateAround(e,t)._add(i)._add(a),I._rotateAround(e,t)._add(i)._add(a),z._rotateAround(e,t)._add(i)._add(a);}if(u){const t=Math.sin(u),e=Math.cos(u),r=[e,-t,t,e];k._matMult(r),M._matMult(r),I._matMult(r),z._matMult(r);}const P=new s(0,0),C=new s(0,0);c.push({tl:k,tr:M,bl:I,br:z,tex:a,writingMode:e.writingMode,glyphOffset:g,sectionIndex:n.sectionIndex,isSDF:p,pixelOffsetTL:P,pixelOffsetBR:C,minFontScaleX:0,minFontScaleY:0});}return c}(0,r,l,i,a,o,n,t.allowVerticalPlacement),g=t.textSizeData;let x=null;\"source\"===g.kind?(x=[nc*i.layout.get(\"text-size\").evaluate(o,{})],x[0]>ic&&A(`${t.layerIds[0]}: Value for \"text-size\" is >= ${rc}. Reduce your \"text-size\".`)):\"composite\"===g.kind&&(x=[nc*d.compositeTextSizes[0].evaluate(o,{},y),nc*d.compositeTextSizes[1].evaluate(o,{},y)],(x[0]>ic||x[1]>ic)&&A(`${t.layerIds[0]}: Value for \"text-size\" is >= ${rc}. Reduce your \"text-size\".`)),t.addSymbols(t.text,m,x,l,a,o,c,e,u.lineStartIndex,u.lineLength,f,y);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*m.length}function Ah(t){for(const e in t)return t[e];return null}function Sh(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const i=kh[15&r];if(!i)throw new Error(\"Unrecognized array type.\");const[s]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new Mh(a,s,i,t)}constructor(t,e=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=kh.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,o=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+a+o),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t);}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Ih(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,n){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");const{ids:i,coords:s,nodeSize:a}=this,o=[0,i.length-1,0],l=[];for(;o.length;){const u=o.pop()||0,c=o.pop()||0,h=o.pop()||0;if(c-h<=a){for(let a=h;a<=c;a++){const o=s[2*a],u=s[2*a+1];o>=t&&o<=r&&u>=e&&u<=n&&l.push(i[a]);}continue}const p=h+c>>1,f=s[2*p],d=s[2*p+1];f>=t&&f<=r&&d>=e&&d<=n&&l.push(i[p]),(0===u?t<=f:e<=d)&&(o.push(h),o.push(p-1),o.push(1-u)),(0===u?r>=f:n>=d)&&(o.push(p+1),o.push(c),o.push(1-u));}return l}within(t,e,r){if(!this._finished)throw new Error(\"Data not yet indexed - call index.finish().\");const{ids:n,coords:i,nodeSize:s}=this,a=[0,n.length-1,0],o=[],l=r*r;for(;a.length;){const u=a.pop()||0,c=a.pop()||0,h=a.pop()||0;if(c-h<=s){for(let r=h;r<=c;r++)Bh(i[2*r],i[2*r+1],t,e)<=l&&o.push(n[r]);continue}const p=h+c>>1,f=i[2*p],d=i[2*p+1];Bh(f,d,t,e)<=l&&o.push(n[p]),(0===u?t-r<=f:e-r<=d)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?t+r>=f:e+r>=d)&&(a.push(p+1),a.push(c),a.push(1-u));}return o}}function Ih(t,e,r,n,i,s){if(i-n<=r)return;const a=n+i>>1;zh(t,e,a,n,i,s),Ih(t,e,r,n,a-1,1-s),Ih(t,e,r,a+1,i,1-s);}function zh(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const a=i-n+1,o=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(o-a/2<0?-1:1);zh(t,e,r,Math.max(n,Math.floor(r-o*u/a+c)),Math.min(i,Math.floor(r+(a-o)*u/a+c)),s);}const a=e[2*r+s];let o=n,l=i;for(Ph(t,e,n,r),e[2*i+s]>a&&Ph(t,e,n,i);oa;)l--;}e[2*n+s]===a?Ph(t,e,n,l):(l++,Ph(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1);}}function Ph(t,e,r,n){Ch(t,r,n),Ch(e,2*r,2*n),Ch(e,2*r+1,2*n+1);}function Ch(t,e,r){const n=t[e];t[e]=t[r],t[r]=n;}function Bh(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}var Vh;t.bg=void 0,(Vh=t.bg||(t.bg={})).create=\"create\",Vh.load=\"load\",Vh.fullLoad=\"fullLoad\";let Eh=null,Fh=[];const Th=1e3/60,$h=\"loadTime\",Lh=\"fullLoadTime\",Dh={mark(t){performance.mark(t);},frame(t){const e=t;null!=Eh&&Fh.push(e-Eh),Eh=e;},clearMetrics(){Eh=null,Fh=[],performance.clearMeasures($h),performance.clearMeasures(Lh);for(const e in t.bg)performance.clearMarks(t.bg[e]);},getPerformanceMetrics(){performance.measure($h,t.bg.create,t.bg.load),performance.measure(Lh,t.bg.create,t.bg.fullLoad);const e=performance.getEntriesByName($h)[0].duration,r=performance.getEntriesByName(Lh)[0].duration,n=Fh.length,i=1/(Fh.reduce(((t,e)=>t+e),0)/n/1e3),s=Fh.filter((t=>t>Th)).reduce(((t,e)=>t+(e-Th)/Th),0);return {loadTime:e,fullLoadTime:r,fps:i,percentDroppedFrames:s/(n+s)*100,totalFrames:n}}};t.$=class extends ps{},t.A=oo,t.B=yi,t.C=function(t){if(null==M){const e=t.navigator?t.navigator.userAgent:null;M=!!t.safari||!(!e||!(/\\b(iPad|iPhone|iPod)\\b/.test(e)||e.match(\"Safari\")&&!e.match(\"Chrome\")));}return M},t.D=Ji,t.E=Z,t.F=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Ic((()=>this.process())),this.subscription=function(t,e,r,n){return t.addEventListener(e,r,!1),{unsubscribe:()=>{t.removeEventListener(e,r,!1);}}}(this.target,\"message\",(t=>this.receive(t))),this.globalScope=k(self)?t:window;}registerMessageHandler(t,e){this.messageHandlers[t]=e;}sendAsync(t,e){return new Promise(((r,n)=>{const i=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[i]={resolve:r,reject:n},e&&e.signal.addEventListener(\"abort\",(()=>{delete this.resolveRejects[i];const e={id:i,type:\"\",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(e);}),{once:!0});const s=[],a=Object.assign(Object.assign({},t),{id:i,sourceMapId:this.mapId,origin:location.origin,data:ki(t.data,s)});this.target.postMessage(a,{transfer:s});}))}receive(t){const e=t.data,r=e.id;if(!(\"file://\"!==e.origin&&\"file://\"!==location.origin&&\"resource://android\"!==e.origin&&\"resource://android\"!==location.origin&&e.origin!==location.origin||e.targetMapId&&this.mapId!==e.targetMapId)){if(\"\"===e.type){delete this.tasks[r];const t=this.abortControllers[r];return delete this.abortControllers[r],void(t&&t.abort())}if(k(self)||e.mustQueue)return this.tasks[r]=e,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,e);}}process(){if(0===this.taskQueue.length)return;const t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e);}processTask(t,r){return e(this,void 0,void 0,(function*(){if(\"\"===r.type){const e=this.resolveRejects[t];if(delete this.resolveRejects[t],!e)return;return void(r.error?e.reject(Mi(r.error)):e.resolve(Mi(r.data)))}if(!this.messageHandlers[r.type])return void this.completeTask(t,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(\", \")}`));const e=Mi(r.data),n=new AbortController;this.abortControllers[t]=n;try{const i=yield this.messageHandlers[r.type](r.sourceMapId,e,n);this.completeTask(t,null,i);}catch(e){this.completeTask(t,e);}}))}completeTask(t,e,r){const n=[];delete this.abortControllers[t];const i={id:t,type:\"\",sourceMapId:this.mapId,origin:location.origin,error:e?ki(e):null,data:ki(r,n)};this.target.postMessage(i,{transfer:n});}remove(){this.invoker.remove(),this.subscription.unsubscribe();}},t.G=$,t.H=function(){var t=new oo(16);return oo!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.I=Tu,t.J=function(t,e,r){var n,i,s,a,o,l,u,c,h,p,f,d,y=r[0],m=r[1],g=r[2];return e===t?(t[12]=e[0]*y+e[4]*m+e[8]*g+e[12],t[13]=e[1]*y+e[5]*m+e[9]*g+e[13],t[14]=e[2]*y+e[6]*m+e[10]*g+e[14],t[15]=e[3]*y+e[7]*m+e[11]*g+e[15]):(i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],t[0]=n=e[0],t[1]=i,t[2]=s,t[3]=a,t[4]=o,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=f,t[11]=d,t[12]=n*y+o*m+h*g+e[12],t[13]=i*y+l*m+p*g+e[13],t[14]=s*y+u*m+f*g+e[14],t[15]=a*y+c*m+d*g+e[15]),t},t.K=function(t,e,r){var n=r[0],i=r[1],s=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.L=uo,t.M=function(t,e){const r={};for(let n=0;n{const e=window.document.createElement(\"video\");return e.muted=!0,new Promise((r=>{e.onloadstart=()=>{r(e);};for(const r of t){const t=window.document.createElement(\"source\");j(r)||(e.crossOrigin=\"Anonymous\"),t.src=r,e.appendChild(t);}}))},t.a4=function(){return x++},t.a5=Fs,t.a6=dc,t.a7=zn,t.a8=ja,t.a9=Nc,t.aA=function(t){if(\"custom\"===t.type)return new Mc(t);switch(t.type){case\"background\":return new _c(t);case\"circle\":return new fo(t);case\"fill\":return new ul(t);case\"fill-extrusion\":return new El(t);case\"heatmap\":return new Mo(t);case\"hillshade\":return new Po(t);case\"line\":return new Hl(t);case\"raster\":return new kc(t);case\"symbol\":return new vc(t)}},t.aB=w,t.aC=function(t,e){if(!t)return [{command:\"setStyle\",args:[e]}];let r=[];try{if(!H(t.version,e.version))return [{command:\"setStyle\",args:[e]}];H(t.center,e.center)||r.push({command:\"setCenter\",args:[e.center]}),H(t.zoom,e.zoom)||r.push({command:\"setZoom\",args:[e.zoom]}),H(t.bearing,e.bearing)||r.push({command:\"setBearing\",args:[e.bearing]}),H(t.pitch,e.pitch)||r.push({command:\"setPitch\",args:[e.pitch]}),H(t.sprite,e.sprite)||r.push({command:\"setSprite\",args:[e.sprite]}),H(t.glyphs,e.glyphs)||r.push({command:\"setGlyphs\",args:[e.glyphs]}),H(t.transition,e.transition)||r.push({command:\"setTransition\",args:[e.transition]}),H(t.light,e.light)||r.push({command:\"setLight\",args:[e.light]}),H(t.terrain,e.terrain)||r.push({command:\"setTerrain\",args:[e.terrain]}),H(t.sky,e.sky)||r.push({command:\"setSky\",args:[e.sky]}),H(t.projection,e.projection)||r.push({command:\"setProjection\",args:[e.projection]});const n={},i=[];!function(t,e,r,n){let i;for(i in e=e||{},t=t||{})Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)||W(i,r,n));for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)?H(t[i],e[i])||(\"geojson\"===t[i].type&&\"geojson\"===e[i].type&&tt(t,e,i)?Y(r,{command:\"setGeoJSONSourceData\",args:[i,e[i].data]}):Q(i,e,r,n)):J(i,e,r));}(t.sources,e.sources,i,n);const s=[];t.layers&&t.layers.forEach((t=>{\"source\"in t&&n[t.source]?r.push({command:\"removeLayer\",args:[t.id]}):s.push(t);})),r=r.concat(i),function(t,e,r){e=e||[];const n=(t=t||[]).map(rt),i=e.map(rt),s=t.reduce(nt,{}),a=e.reduce(nt,{}),o=n.slice(),l=Object.create(null);let u,c,h,p,f;for(let t=0,e=0;t@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\\"((?:[^\"\\\\]|\\\\.)*)\\\")))?/g,((t,r,n,i)=>{const s=n||i;return e[r]=!s||s.toLowerCase(),\"\"})),e[\"max-age\"]){const t=parseInt(e[\"max-age\"],10);isNaN(t)?delete e[\"max-age\"]:e[\"max-age\"]=t;}return e},t.ab=function(t,e){const r=[];for(const n in t)n in e||r.push(n);return r},t.ac=y,t.ad=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[0],a=e[1],o=e[2],l=e[3],u=e[4],c=e[5],h=e[6],p=e[7];return e!==t&&(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[0]=s*i+u*n,t[1]=a*i+c*n,t[2]=o*i+h*n,t[3]=l*i+p*n,t[4]=u*i-s*n,t[5]=c*i-a*n,t[6]=h*i-o*n,t[7]=p*i-l*n,t},t.ae=function(t){var e=new oo(16);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},t.af=po,t.ag=function(t,e){let r=0,n=0;if(\"constant\"===t.kind)n=t.layoutSize;else if(\"source\"!==t.kind){const{interpolationType:i,minZoom:s,maxZoom:a}=t,o=i?y(Be.interpolationFactor(i,e,s,a),0,1):0;\"camera\"===t.kind?n=Ce.number(t.minSize,t.maxSize,o):r=o;}return {uSizeT:r,uSize:n}},t.ai=function(t,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:i}){return \"source\"===t.kind?n/nc:\"composite\"===t.kind?Ce.number(n/nc,i/nc,r):e},t.aj=cc,t.ak=function(t,e,r,n){const i=e.y-t.y,a=e.x-t.x,o=n.y-r.y,l=n.x-r.x,u=o*a-l*i;if(0===u)return null;const c=(l*(t.y-r.y)-o*(t.x-r.x))/u;return new s(t.x+c*a,t.y+c*i)},t.al=Hc,t.am=qa,t.an=lo,t.ao=function(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);return [e,r,n,i]},t.ap=iu,t.ar=ac,t.as=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],f=e[11],d=e[12],y=e[13],m=e[14],g=e[15],x=r*o-n*a,v=r*l-i*a,b=r*u-s*a,w=n*l-i*o,_=n*u-s*o,A=i*u-s*l,S=c*y-h*d,k=c*m-p*d,M=c*g-f*d,I=h*m-p*y,z=h*g-f*y,P=p*g-f*m,C=x*P-v*z+b*I+w*M-_*k+A*S;return C?(t[0]=(o*P-l*z+u*I)*(C=1/C),t[1]=(i*z-n*P-s*I)*C,t[2]=(y*A-m*_+g*w)*C,t[3]=(p*_-h*A-f*w)*C,t[4]=(l*M-a*P-u*k)*C,t[5]=(r*P-i*M+s*k)*C,t[6]=(m*b-d*A-g*v)*C,t[7]=(c*A-p*b+f*v)*C,t[8]=(a*z-o*M+u*S)*C,t[9]=(n*M-r*z-s*S)*C,t[10]=(d*_-y*b+g*x)*C,t[11]=(h*b-c*_-f*x)*C,t[12]=(o*k-a*I-l*S)*C,t[13]=(r*I-n*k+i*S)*C,t[14]=(y*v-d*w-m*x)*C,t[15]=(c*w-h*v+p*x)*C,t):null},t.at=bh,t.au=Ju,t.av=Mh,t.aw=function(){const t={},e=G.$version;for(const r in G.$root){const n=G.$root[r];if(n.required){let i=null;i=\"version\"===r?e:\"array\"===n.type?[]:{},null!=i&&(t[r]=i);}}return t},t.ax=Ii,t.ay=D,t.az=function(t){t=t.slice();const e=Object.create(null);for(let r=0;r25||n<0||n>=1||r<0||r>=1)},t.bc=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.bd=class extends hs{},t.be=zc,t.bf=Dh,t.bh=L,t.bi=function(t,e){F.REGISTERED_PROTOCOLS[t]=e;},t.bj=function(t){delete F.REGISTERED_PROTOCOLS[t];},t.bk=function(t,e){const r={};for(let n=0;nt*iu));}let v=o?\"center\":n.get(\"text-justify\").evaluate(i,{},e.canonical);const b=\"point\"===n.get(\"symbol-placement\")?n.get(\"text-max-width\").evaluate(i,{},e.canonical)*iu:1/0,w=()=>{e.bucket.allowVerticalPlacement&&Pi(s)&&(d.vertical=Ru(y,e.glyphMap,e.glyphPositions,e.imagePositions,c,b,a,m,\"left\",f,g,t.ah.vertical,!0,p,h));};if(!o&&x){const r=new Set;if(\"auto\"===v)for(let t=0;te(void 0,void 0,void 0,(function*(){if(0===t.byteLength)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(t)],{type:\"image/png\"});try{return createImageBitmap(e)}catch(t){throw new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),t.e=g,t.f=t=>new Promise(((e,r)=>{const n=new Image;n.onload=()=>{e(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame((()=>{n.src=z;}));},n.onerror=()=>r(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"));const i=new Blob([new Uint8Array(t)],{type:\"image/png\"});n.src=t.byteLength?URL.createObjectURL(i):z;})),t.g=T,t.h=(t,e)=>O(g(t,{type:\"json\"}),e),t.i=k,t.j=N,t.k=q,t.l=(t,e)=>O(g(t,{type:\"arrayBuffer\"}),e),t.m=O,t.n=function(t){return new Iu(t).readFields(Pu,[])},t.o=_o,t.p=Eu,t.q=rs,t.r=di,t.s=j,t.t=xi,t.u=fi,t.v=G,t.w=A,t.x=function([t,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(r),y:t*Math.sin(e)*Math.sin(r),z:t*Math.cos(r)}},t.y=Ce,t.z=Ui;}));\n\ndefine(\"worker\",[\"./shared\"],(function(e){\"use strict\";class t{constructor(e){this.keyCache={},e&&this.replace(e);}replace(e){this._layerConfigs={},this._layers={},this.update(e,[]);}update(t,o){for(const o of t){this._layerConfigs[o.id]=o;const t=this._layers[o.id]=e.aA(o);t._featureFilter=e.a7(t.filter),this.keyCache[o.id]&&delete this.keyCache[o.id];}for(const e of o)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const i=e.bk(Object.values(this._layerConfigs),this.keyCache);for(const e of i){const t=e.map((e=>this._layers[e.id])),o=t[0];if(\"none\"===o.visibility)continue;const i=o.source||\"\";let s=this.familiesBySource[i];s||(s=this.familiesBySource[i]={});const r=o.sourceLayer||\"_geojsonTileLayer\";let n=s[r];n||(n=s[r]=[]),n.push(t);}}}class o{constructor(t){const o={},i=[];for(const e in t){const s=t[e],r=o[e]={};for(const e in s){const t=s[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const o={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};i.push(o),r[e]={rect:o,metrics:t.metrics};}}const{w:s,h:r}=e.p(i),n=new e.o({width:s||1,height:r||1});for(const i in t){const s=t[i];for(const t in s){const r=s[+t];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;const a=o[i][t].rect;e.o.copy(r.bitmap,n,{x:0,y:0},{x:a.x+1,y:a.y+1},r.bitmap);}}this.image=n,this.positions=o;}}e.bl(\"GlyphAtlas\",o);class i{constructor(t){this.tileID=new e.S(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[];}parse(t,i,r,n){return e._(this,void 0,void 0,(function*(){this.status=\"parsing\",this.data=t,this.collisionBoxArray=new e.a5;const a=new e.bm(Object.keys(t.layers).sort()),l=new e.bn(this.tileID,this.promoteId);l.bucketLayerIDs=[];const c={},u={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:r},h=i.familiesBySource[this.source];for(const o in h){const i=t.layers[o];if(!i)continue;1===i.version&&e.w(`Vector tile source \"${this.source}\" layer \"${o}\" does not use vector tile spec v2 and therefore may have some rendering errors.`);const n=a.encode(o),d=[];for(let e=0;e=o.maxzoom||\"none\"!==o.visibility&&(s(t,this.zoom,r),(c[o.id]=o.createBucket({index:l.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:n,sourceID:this.source})).populate(d,u,this.tileID.canonical),l.bucketLayerIDs.push(t.map((e=>e.id))));}}const d=e.aF(u.glyphDependencies,(e=>Object.keys(e).map(Number)));this.inFlightDependencies.forEach((e=>null==e?void 0:e.abort())),this.inFlightDependencies=[];let f=Promise.resolve({});if(Object.keys(d).length){const e=new AbortController;this.inFlightDependencies.push(e),f=n.sendAsync({type:\"GG\",data:{stacks:d,source:this.source,tileID:this.tileID,type:\"glyphs\"}},e);}const g=Object.keys(u.iconDependencies);let p=Promise.resolve({});if(g.length){const e=new AbortController;this.inFlightDependencies.push(e),p=n.sendAsync({type:\"GI\",data:{icons:g,source:this.source,tileID:this.tileID,type:\"icons\"}},e);}const m=Object.keys(u.patternDependencies);let y=Promise.resolve({});if(m.length){const e=new AbortController;this.inFlightDependencies.push(e),y=n.sendAsync({type:\"GI\",data:{icons:m,source:this.source,tileID:this.tileID,type:\"patterns\"}},e);}const[v,w,x]=yield Promise.all([f,p,y]),b=new o(v),S=new e.bo(w,x);for(const t in c){const o=c[t];o instanceof e.a6?(s(o.layers,this.zoom,r),e.bp({bucket:o,glyphMap:v,glyphPositions:b.positions,imageMap:w,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):o.hasPattern&&(o instanceof e.bq||o instanceof e.br||o instanceof e.bs)&&(s(o.layers,this.zoom,r),o.addFeatures(u,this.tileID.canonical,S.patternPositions));}return this.status=\"done\",{buckets:Object.values(c).filter((e=>!e.isEmpty())),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:b.image,imageAtlas:S,glyphMap:this.returnDependencies?v:null,iconMap:this.returnDependencies?w:null,glyphPositions:this.returnDependencies?b.positions:null}}))}}function s(t,o,i){const s=new e.z(o);for(const e of t)e.recalculate(s,i);}class r{constructor(e,t,o){this.actor=e,this.layerIndex=t,this.availableImages=o,this.fetching={},this.loading={},this.loaded={};}loadVectorTile(t,o){return e._(this,void 0,void 0,(function*(){const i=yield e.l(t.request,o);try{return {vectorTile:new e.bt.VectorTile(new e.bu(i.data)),rawData:i.data,cacheControl:i.cacheControl,expires:i.expires}}catch(e){const o=new Uint8Array(i.data);let s=`Unable to parse the tile at ${t.request.url}, `;throw s+=31===o[0]&&139===o[1]?\"please make sure the data is not gzipped and that you have configured the relevant header in the server\":`got error: ${e.message}`,new Error(s)}}))}loadTile(t){return e._(this,void 0,void 0,(function*(){const o=t.uid,s=!!(t&&t.request&&t.request.collectResourceTiming)&&new e.bv(t.request),r=new i(t);this.loading[o]=r;const n=new AbortController;r.abort=n;try{const i=yield this.loadVectorTile(t,n);if(delete this.loading[o],!i)return null;const a=i.rawData,l={};i.expires&&(l.expires=i.expires),i.cacheControl&&(l.cacheControl=i.cacheControl);const c={};if(s){const e=s.finish();e&&(c.resourceTiming=JSON.parse(JSON.stringify(e)));}r.vectorTile=i.vectorTile;const u=r.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[o]=r,this.fetching[o]={rawTileData:a,cacheControl:l,resourceTiming:c};try{const t=yield u;return e.e({rawTileData:a.slice(0)},t,l,c)}finally{delete this.fetching[o];}}catch(e){throw delete this.loading[o],r.status=\"done\",this.loaded[o]=r,e}}))}reloadTile(t){return e._(this,void 0,void 0,(function*(){const o=t.uid;if(!this.loaded||!this.loaded[o])throw new Error(\"Should not be trying to reload a tile that was never loaded or has been removed\");const i=this.loaded[o];if(i.showCollisionBoxes=t.showCollisionBoxes,\"parsing\"===i.status){const t=yield i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor);let s;if(this.fetching[o]){const{rawTileData:i,cacheControl:r,resourceTiming:n}=this.fetching[o];delete this.fetching[o],s=e.e({rawTileData:i.slice(0)},t,r,n);}else s=t;return s}if(\"done\"===i.status&&i.vectorTile)return i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.actor)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){const e=this.loading,o=t.uid;e&&e[o]&&e[o].abort&&(e[o].abort.abort(),delete e[o]);}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[t.uid]&&delete this.loaded[t.uid];}))}}class n{constructor(){this.loaded={};}loadTile(t){return e._(this,void 0,void 0,(function*(){const{uid:o,encoding:i,rawImageData:s,redFactor:r,greenFactor:n,blueFactor:a,baseShift:l}=t,c=s.width+2,u=s.height+2,h=e.b(s)?new e.R({width:c,height:u},yield e.bw(s,-1,-1,c,u)):s,d=new e.bx(o,h,i,r,n,a,l);return this.loaded=this.loaded||{},this.loaded[o]=d,d}))}removeTile(e){const t=this.loaded,o=e.uid;t&&t[o]&&delete t[o];}}function a(e,t){if(0!==e.length){l(e[0],t);for(var o=1;o=Math.abs(a)?o-l+a:a-l+o,o=l;}o+i>=0!=!!t&&e.reverse();}var c=e.by((function e(t,o){var i,s=t&&t.type;if(\"FeatureCollection\"===s)for(i=0;i>31}function I(e,t){for(var o=e.loadGeometry(),i=e.type,s=0,r=0,n=o.length,a=0;ae},D=Math.fround||(C=new Float32Array(1),e=>(C[0]=+e,C[0]));var C;const L=3,O=5,F=6;class z{constructor(e){this.options=Object.assign(Object.create(T),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[];}load(e){const{log:t,minZoom:o,maxZoom:i}=this.options;t&&console.time(\"total time\");const s=`prepare ${e.length} points`;t&&console.time(s),this.points=e;const r=[];for(let t=0;t=o;e--){const o=+Date.now();n=this.trees[e]=this._createTree(this._cluster(n,e)),t&&console.log(\"z%d: %d clusters in %dms\",e,n.numItems,+Date.now()-o);}return t&&console.timeEnd(\"total time\"),this}getClusters(e,t){let o=((e[0]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[1]));let s=180===e[2]?180:((e[2]+180)%360+360)%360-180;const r=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)o=-180,s=180;else if(o>s){const e=this.getClusters([o,i,180,r],t),n=this.getClusters([-180,i,s,r],t);return e.concat(n)}const n=this.trees[this._limitZoom(t)],a=n.range(G(o),j(r),G(s),j(i)),l=n.data,c=[];for(const e of a){const t=this.stride*e;c.push(l[t+O]>1?A(l,t,this.clusterProps):this.points[l[t+L]]);}return c}getChildren(e){const t=this._getOriginId(e),o=this._getOriginZoom(e),i=\"No cluster with the specified id.\",s=this.trees[o];if(!s)throw new Error(i);const r=s.data;if(t*this.stride>=r.length)throw new Error(i);const n=this.options.radius/(this.options.extent*Math.pow(2,o-1)),a=s.within(r[t*this.stride],r[t*this.stride+1],n),l=[];for(const t of a){const o=t*this.stride;r[o+4]===e&&l.push(r[o+O]>1?A(r,o,this.clusterProps):this.points[r[o+L]]);}if(0===l.length)throw new Error(i);return l}getLeaves(e,t,o){const i=[];return this._appendLeaves(i,e,t=t||10,o=o||0,0),i}getTile(e,t,o){const i=this.trees[this._limitZoom(e)],s=Math.pow(2,e),{extent:r,radius:n}=this.options,a=n/r,l=(o-a)/s,c=(o+1+a)/s,u={features:[]};return this._addTileFeatures(i.range((t-a)/s,l,(t+1+a)/s,c),i.data,t,o,s,u),0===t&&this._addTileFeatures(i.range(1-a/s,l,1,c),i.data,s,o,s,u),t===s-1&&this._addTileFeatures(i.range(0,l,a/s,c),i.data,-1,o,s,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const o=this.getChildren(e);if(t++,1!==o.length)break;e=o[0].properties.cluster_id;}return t}_appendLeaves(e,t,o,i,s){const r=this.getChildren(t);for(const t of r){const r=t.properties;if(r&&r.cluster?s+r.point_count<=i?s+=r.point_count:s=this._appendLeaves(e,r.cluster_id,o,i,s):s1;let l,c,u;if(a)l=E(t,e,this.clusterProps),c=t[e],u=t[e+1];else {const o=this.points[t[e+L]];l=o.properties;const[i,s]=o.geometry.coordinates;c=G(i),u=j(s);}const h={type:1,geometry:[[Math.round(this.options.extent*(c*s-o)),Math.round(this.options.extent*(u*s-i))]],tags:l};let d;d=a||this.options.generateId?t[e+L]:this.points[t[e+L]].id,void 0!==d&&(h.id=d),r.features.push(h);}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:o,extent:i,reduce:s,minPoints:r}=this.options,n=o/(i*Math.pow(2,t)),a=e.data,l=[],c=this.stride;for(let o=0;ot&&(f+=a[o+O]);}if(f>d&&f>=r){let e,r=i*d,n=u*d,g=-1;const p=((o/c|0)<<5)+(t+1)+this.points.length;for(const i of h){const l=i*c;if(a[l+2]<=t)continue;a[l+2]=t;const u=a[l+O];r+=a[l]*u,n+=a[l+1]*u,a[l+4]=p,s&&(e||(e=this._map(a,o,!0),g=this.clusterProps.length,this.clusterProps.push(e)),s(e,this._map(a,l)));}a[o+4]=p,l.push(r/f,n/f,1/0,p,-1,f),s&&l.push(g);}else {for(let e=0;e1)for(const e of h){const o=e*c;if(!(a[o+2]<=t)){a[o+2]=t;for(let e=0;e>5}_getOriginZoom(e){return (e-this.points.length)%32}_map(e,t,o){if(e[t+O]>1){const i=this.clusterProps[e[t+F]];return o?Object.assign({},i):i}const i=this.points[e[t+L]].properties,s=this.options.map(i);return o&&s===i?Object.assign({},s):s}}function A(e,t,o){return {type:\"Feature\",id:e[t+L],properties:E(e,t,o),geometry:{type:\"Point\",coordinates:[(i=e[t],360*(i-.5)),R(e[t+1])]}};var i;}function E(e,t,o){const i=e[t+O],s=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?Math.round(i/100)/10+\"k\":i,r=e[t+F],n=-1===r?{}:Object.assign({},o[r]);return Object.assign(n,{cluster:!0,cluster_id:e[t+L],point_count:i,point_count_abbreviated:s})}function G(e){return e/360+.5}function j(e){const t=Math.sin(e*Math.PI/180),o=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return o<0?0:o>1?1:o}function R(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function Z(e,t,o,i){let s=i;const r=t+(o-t>>1);let n,a=o-t;const l=e[t],c=e[t+1],u=e[o],h=e[o+1];for(let i=t+3;is)n=i,s=t;else if(t===s){const e=Math.abs(i-r);ei&&(n-t>3&&Z(e,t,n,i),e[n+2]=s,o-n>3&&Z(e,n,o,i));}function N(e,t,o,i,s,r){let n=s-o,a=r-i;if(0!==n||0!==a){const l=((e-o)*n+(t-i)*a)/(n*n+a*a);l>1?(o=s,i=r):l>0&&(o+=n*l,i+=a*l);}return n=e-o,a=t-i,n*n+a*a}function J(e,t,o,i){const s={id:null==e?null:e,type:t,geometry:o,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(\"Point\"===t||\"MultiPoint\"===t||\"LineString\"===t)W(s,o);else if(\"Polygon\"===t)W(s,o[0]);else if(\"MultiLineString\"===t)for(const e of o)W(s,e);else if(\"MultiPolygon\"===t)for(const e of o)W(s,e[0]);return s}function W(e,t){for(let o=0;o0&&(n+=i?(s*l-a*r)/2:Math.sqrt(Math.pow(a-s,2)+Math.pow(l-r,2))),s=a,r=l;}const a=t.length-3;t[2]=1,Z(t,0,a,o),t[a+2]=1,t.size=Math.abs(n),t.start=0,t.end=t.size;}function q(e,t,o,i){for(let s=0;s1?1:o}function U(e,t,o,i,s,r,n,a){if(i/=t,r>=(o/=t)&&n=i)return null;const l=[];for(const t of e){const e=t.geometry;let r=t.type;const n=0===s?t.minX:t.minY,c=0===s?t.maxX:t.maxY;if(n>=o&&c=i)continue;let u=[];if(\"Point\"===r||\"MultiPoint\"===r)$(e,u,o,i,s);else if(\"LineString\"===r)K(e,u,o,i,s,!1,a.lineMetrics);else if(\"MultiLineString\"===r)ee(e,u,o,i,s,!1);else if(\"Polygon\"===r)ee(e,u,o,i,s,!0);else if(\"MultiPolygon\"===r)for(const t of e){const e=[];ee(t,e,o,i,s,!0),e.length&&u.push(e);}if(u.length){if(a.lineMetrics&&\"LineString\"===r){for(const e of u)l.push(J(t.id,r,e,t.tags));continue}\"LineString\"!==r&&\"MultiLineString\"!==r||(1===u.length?(r=\"LineString\",u=u[0]):r=\"MultiLineString\"),\"Point\"!==r&&\"MultiPoint\"!==r||(r=3===u.length?\"Point\":\"MultiPoint\"),l.push(J(t.id,r,u,t.tags));}}return l.length?l:null}function $(e,t,o,i,s){for(let r=0;r=o&&n<=i&&te(t,e[r],e[r+1],e[r+2]);}}function K(e,t,o,i,s,r,n){let a=Q(e);const l=0===s?oe:ie;let c,u,h=e.start;for(let d=0;do&&(u=l(a,f,g,m,y,o),n&&(a.start=h+c*u)):v>i?w=o&&(u=l(a,f,g,m,y,o),x=!0),w>i&&v<=i&&(u=l(a,f,g,m,y,i),x=!0),!r&&x&&(n&&(a.end=h+c*u),t.push(a),a=Q(e)),n&&(h+=c);}let d=e.length-3;const f=e[d],g=e[d+1],p=0===s?f:g;p>=o&&p<=i&&te(a,f,g,e[d+2]),d=a.length-3,r&&d>=3&&(a[d]!==a[0]||a[d+1]!==a[1])&&te(a,a[0],a[1],a[2]),a.length&&t.push(a);}function Q(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ee(e,t,o,i,s,r){for(const n of e)K(n,t,o,i,s,r,!1);}function te(e,t,o,i){e.push(t,o,i);}function oe(e,t,o,i,s,r){const n=(r-t)/(i-t);return te(e,r,o+(s-o)*n,1),n}function ie(e,t,o,i,s,r){const n=(r-o)/(s-o);return te(e,t+(i-t)*n,r,1),n}function se(e,t){const o=[];for(let i=0;i0&&t.size<(s?n:i))return void(o.numPoints+=t.length/3);const a=[];for(let e=0;en)&&(o.numSimplified++,a.push(t[e],t[e+1])),o.numPoints++;s&&function(e,t){let o=0;for(let t=0,i=e.length,s=i-2;t0===t)for(let t=0,o=e.length;t24)throw new Error(\"maxZoom should be in the 0-24 range\");if(t.promoteId&&t.generateId)throw new Error(\"promoteId and generateId cannot be used together.\");let i=function(e,t){const o=[];if(\"FeatureCollection\"===e.type)for(let i=0;i1&&console.time(\"creation\"),d=this.tiles[h]=le(e,t,o,i,l),this.tileCoords.push({z:t,x:o,y:i}),c)){c>1&&(console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\",t,o,i,d.numFeatures,d.numPoints,d.numSimplified),console.timeEnd(\"creation\"));const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++;}if(d.source=e,null==s){if(t===l.indexMaxZoom||d.numPoints<=l.indexMaxPoints)continue}else {if(t===l.maxZoom||t===s)continue;if(null!=s){const e=s-t;if(o!==r>>e||i!==n>>e)continue}}if(d.source=null,0===e.length)continue;c>1&&console.time(\"clipping\");const f=.5*l.buffer/l.extent,g=.5-f,p=.5+f,m=1+f;let y=null,v=null,w=null,x=null,b=U(e,u,o-f,o+p,0,d.minX,d.maxX,l),S=U(e,u,o+g,o+m,0,d.minX,d.maxX,l);e=null,b&&(y=U(b,u,i-f,i+p,1,d.minY,d.maxY,l),v=U(b,u,i+g,i+m,1,d.minY,d.maxY,l),b=null),S&&(w=U(S,u,i-f,i+p,1,d.minY,d.maxY,l),x=U(S,u,i+g,i+m,1,d.minY,d.maxY,l),S=null),c>1&&console.timeEnd(\"clipping\"),a.push(y||[],t+1,2*o,2*i),a.push(v||[],t+1,2*o,2*i+1),a.push(w||[],t+1,2*o+1,2*i),a.push(x||[],t+1,2*o+1,2*i+1);}}getTile(e,t,o){e=+e,t=+t,o=+o;const i=this.options,{extent:s,debug:r}=i;if(e<0||e>24)return null;const n=1<1&&console.log(\"drilling down to z%d-%d-%d\",e,t,o);let l,c=e,u=t,h=o;for(;!l&&c>0;)c--,u>>=1,h>>=1,l=this.tiles[fe(c,u,h)];return l&&l.source?(r>1&&(console.log(\"found parent tile z%d-%d-%d\",c,u,h),console.time(\"drilling down\")),this.splitTile(l.source,c,u,h,e,t,o),r>1&&console.timeEnd(\"drilling down\"),this.tiles[a]?ne(this.tiles[a],s):null):null}}function fe(e,t,o){return 32*((1<{n.properties=e;const t={};for(const e of a)t[e]=i[e].evaluate(r,n);return t},t.reduce=(e,t)=>{n.properties=t;for(const t of a)r.accumulated=e[t],e[t]=s[t].evaluate(r,n);},t}(t)).load((yield this._pendingData).features):(s=yield this._pendingData,new de(s,t.geojsonVtOptions)),this.loaded={};const o={};if(i){const e=i.finish();e&&(o.resourceTiming={},o.resourceTiming[t.source]=JSON.parse(JSON.stringify(e)));}return o}catch(t){if(delete this._pendingRequest,e.bB(t))return {abandoned:!0};throw t}var s;}))}getData(){return e._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(e){const t=this.loaded;return t&&t[e.uid]?super.reloadTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,o){return e._(this,void 0,void 0,(function*(){let i=yield this.loadGeoJSON(t,o);if(delete this._pendingRequest,\"object\"!=typeof i)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(c(i,!0),t.filter){const o=e.bC(t.filter,{type:\"boolean\",\"property-type\":\"data-driven\",overridable:!1,transition:!1});if(\"error\"===o.result)throw new Error(o.value.map((e=>`${e.key}: ${e.message}`)).join(\", \"));const s=i.features.filter((e=>o.value.evaluate({zoom:0},e)));i={type:\"FeatureCollection\",features:s};}return i}))}loadGeoJSON(t,o){return e._(this,void 0,void 0,(function*(){const{promoteId:i}=t;if(t.request){const s=yield e.h(t.request,o);return this._dataUpdateable=pe(s.data,i)?me(s.data,i):void 0,s.data}if(\"string\"==typeof t.data)try{const e=JSON.parse(t.data);return this._dataUpdateable=pe(e,i)?me(e,i):void 0,e}catch(e){throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}if(!t.dataDiff)throw new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${t.source}`);return function(e,t,o){var i,s,r,n;if(t.removeAll&&e.clear(),t.remove)for(const o of t.remove)e.delete(o);if(t.add)for(const i of t.add){const t=ge(i,o);null!=t&&e.set(t,i);}if(t.update)for(const o of t.update){let t=e.get(o.id);if(null==t)continue;const a=!o.removeAllProperties&&((null===(i=o.removeProperties)||void 0===i?void 0:i.length)>0||(null===(s=o.addOrUpdateProperties)||void 0===s?void 0:s.length)>0);if((o.newGeometry||o.removeAllProperties||a)&&(t=Object.assign({},t),e.set(o.id,t),a&&(t.properties=Object.assign({},t.properties))),o.newGeometry&&(t.geometry=o.newGeometry),o.removeAllProperties)t.properties={};else if((null===(r=o.removeProperties)||void 0===r?void 0:r.length)>0)for(const e of o.removeProperties)Object.prototype.hasOwnProperty.call(t.properties,e)&&delete t.properties[e];if((null===(n=o.addOrUpdateProperties)||void 0===n?void 0:n.length)>0)for(const{key:e,value:i}of o.addOrUpdateProperties)t.properties[e]=i;}}(this._dataUpdateable,t.dataDiff,i),{type:\"FeatureCollection\",features:Array.from(this._dataUpdateable.values())}}))}removeSource(t){return e._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort();}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset)}}class ve{constructor(t){this.self=t,this.actor=new e.F(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw new Error(`Worker source with name \"${e}\" already registered.`);this.externalWorkerSourceTypes[e]=t;},this.self.addProtocol=e.bi,this.self.removeProtocol=e.bj,this.self.registerRTLTextPlugin=t=>{if(e.bD.isParsed())throw new Error(\"RTL text plugin already registered.\");e.bD.setMethods(t);},this.actor.registerMessageHandler(\"LDT\",((e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t))),this.actor.registerMessageHandler(\"RDT\",((t,o)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(t,o.source).removeTile(o);})))),this.actor.registerMessageHandler(\"GCEZ\",((t,o)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,o.type,o.source).getClusterExpansionZoom(o)})))),this.actor.registerMessageHandler(\"GCC\",((t,o)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,o.type,o.source).getClusterChildren(o)})))),this.actor.registerMessageHandler(\"GCL\",((t,o)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,o.type,o.source).getClusterLeaves(o)})))),this.actor.registerMessageHandler(\"LD\",((e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t))),this.actor.registerMessageHandler(\"GD\",((e,t)=>this._getWorkerSource(e,t.type,t.source).getData())),this.actor.registerMessageHandler(\"LT\",((e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t))),this.actor.registerMessageHandler(\"RT\",((e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t))),this.actor.registerMessageHandler(\"AT\",((e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t))),this.actor.registerMessageHandler(\"RMT\",((e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t))),this.actor.registerMessageHandler(\"RS\",((t,o)=>e._(this,void 0,void 0,(function*(){if(!this.workerSources[t]||!this.workerSources[t][o.type]||!this.workerSources[t][o.type][o.source])return;const e=this.workerSources[t][o.type][o.source];delete this.workerSources[t][o.type][o.source],void 0!==e.removeSource&&e.removeSource(o);})))),this.actor.registerMessageHandler(\"RM\",(t=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t];})))),this.actor.registerMessageHandler(\"SR\",((t,o)=>e._(this,void 0,void 0,(function*(){this.referrer=o;})))),this.actor.registerMessageHandler(\"SRPS\",((e,t)=>this._syncRTLPluginState(e,t))),this.actor.registerMessageHandler(\"IS\",((t,o)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(o);})))),this.actor.registerMessageHandler(\"SI\",((e,t)=>this._setImages(e,t))),this.actor.registerMessageHandler(\"UL\",((t,o)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).update(o.layers,o.removedIds);})))),this.actor.registerMessageHandler(\"SL\",((t,o)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).replace(o);}))));}_setImages(t,o){return e._(this,void 0,void 0,(function*(){this.availableImages[t]=o;for(const e in this.workerSources[t]){const i=this.workerSources[t][e];for(const e in i)i[e].availableImages=o;}}))}_syncRTLPluginState(t,o){return e._(this,void 0,void 0,(function*(){if(e.bD.isParsed())return e.bD.getState();if(\"loading\"!==o.pluginStatus)return e.bD.setState(o),o;const t=o.pluginURL;if(this.self.importScripts(t),e.bD.isParsed()){const o={pluginStatus:\"loaded\",pluginURL:t};return e.bD.setState(o),o}throw e.bD.setState({pluginStatus:\"error\",pluginURL:\"\"}),new Error(`RTL Text Plugin failed to import scripts from ${t}`)}))}_getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}_getLayerIndex(e){let o=this.layerIndexes[e];return o||(o=this.layerIndexes[e]=new t),o}_getWorkerSource(e,t,o){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][o]){const i={sendAsync:(t,o)=>(t.targetMapId=e,this.actor.sendAsync(t,o))};switch(t){case\"vector\":this.workerSources[e][t][o]=new r(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case\"geojson\":this.workerSources[e][t][o]=new ye(i,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][o]=new this.externalWorkerSourceTypes[t](i,this._getLayerIndex(e),this._getAvailableImages(e));}}return this.workerSources[e][t][o]}_getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new n),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new ve(self)),ve}));\n\ndefine(\"index\",[\"exports\",\"./shared\"],(function(t,e){\"use strict\";var i=\"4.7.1\";let a,s;const o={now:\"undefined\"!=typeof performance&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:t=>new Promise(((i,a)=>{const s=requestAnimationFrame(i);t.signal.addEventListener(\"abort\",(()=>{cancelAnimationFrame(s),a(e.c());}));})),getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){const e=window.document.createElement(\"canvas\"),i=e.getContext(\"2d\",{willReadFrequently:!0});if(!i)throw new Error(\"failed to create canvas 2d context\");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:t=>(a||(a=document.createElement(\"a\")),a.href=t,a.href),hardwareConcurrency:\"undefined\"!=typeof navigator&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return !!matchMedia&&(null==s&&(s=matchMedia(\"(prefers-reduced-motion: reduce)\")),s.matches)}};class r{static testProp(t){if(!r.docStyle)return t[0];for(let e=0;e{window.removeEventListener(\"click\",r.suppressClickInternal,!0);}),0);}static getScale(t){const e=t.getBoundingClientRect();return {x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,i,a){const s=i.boundingClientRect;return new e.P((a.clientX-s.left)/i.x-t.clientLeft,(a.clientY-s.top)/i.y-t.clientTop)}static mousePos(t,e){const i=r.getScale(t);return r.getPoint(t,i,e)}static touchPos(t,e){const i=[],a=r.getScale(t);for(let s=0;s{l&&d(l),l=null,u=!0;},h.onerror=()=>{c=!0,l=null;},h.src=\"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=\"),function(t){let i,a,s,o;t.resetRequestQueue=()=>{i=[],a=0,s=0,o={};},t.addThrottleControl=t=>{const e=s++;return o[e]=t,e},t.removeThrottleControl=t=>{delete o[t],l();},t.getImage=(t,a,s=!0)=>new Promise(((o,r)=>{n.supported&&(t.headers||(t.headers={}),t.headers.accept=\"image/webp,*/*\"),e.e(t,{type:\"image\"}),i.push({abortController:a,requestParameters:t,supportImageRefresh:s,state:\"queued\",onError:t=>{r(t);},onSuccess:t=>{o(t);}}),l();}));const r=t=>e._(this,void 0,void 0,(function*(){t.state=\"running\";const{requestParameters:i,supportImageRefresh:s,onError:o,onSuccess:r,abortController:n}=t,c=!1===s&&!e.i(self)&&!e.g(i.url)&&(!i.headers||Object.keys(i.headers).reduce(((t,e)=>t&&\"accept\"===e),!0));a++;const u=c?h(i,n):e.m(i,n);try{const i=yield u;delete t.abortController,t.state=\"completed\",i.data instanceof HTMLImageElement||e.b(i.data)?r(i):i.data&&r({data:yield(d=i.data,\"function\"==typeof createImageBitmap?e.d(d):e.f(d)),cacheControl:i.cacheControl,expires:i.expires});}catch(e){delete t.abortController,o(e);}finally{a--,l();}var d;})),l=()=>{const t=(()=>{for(const t of Object.keys(o))if(o[t]())return !0;return !1})()?e.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:e.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let e=a;e0;e++){const t=i.shift();t.abortController.signal.aborted?e--:r(t);}},h=(t,i)=>new Promise(((a,s)=>{const o=new Image,r=t.url,n=t.credentials;n&&\"include\"===n?o.crossOrigin=\"use-credentials\":(n&&\"same-origin\"===n||!e.s(r))&&(o.crossOrigin=\"anonymous\"),i.signal.addEventListener(\"abort\",(()=>{o.src=\"\",s(e.c());})),o.fetchPriority=\"high\",o.onload=()=>{o.onerror=o.onload=null,a({data:o});},o.onerror=()=>{o.onerror=o.onload=null,i.signal.aborted||s(new Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"));},o.src=r;}));}(_||(_={})),_.resetRequestQueue();class p{constructor(t){this._transformRequestFn=t;}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t;}}function m(t){var i=new e.A(3);return i[0]=t[0],i[1]=t[1],i[2]=t[2],i}var f,g=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t};f=new e.A(3),e.A!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0);var v=function(t){var e=t[0],i=t[1];return e*e+i*i};function x(t){const e=[];if(\"string\"==typeof t)e.push({id:\"default\",url:t});else if(t&&t.length>0){const i=[];for(const{id:a,url:s}of t){const t=`${a}${s}`;-1===i.indexOf(t)&&(i.push(t),e.push({id:a,url:s}));}}return e}function y(t,e,i){const a=t.split(\"?\");return a[0]+=`${e}${i}`,a.join(\"?\")}!function(){var t=new e.A(2);e.A!=Float32Array&&(t[0]=0,t[1]=0);}();class b{constructor(t,e,i,a){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this.update(e,a);}update(t,i,a){const{width:s,height:o}=t,r=!(this.size&&this.size[0]===s&&this.size[1]===o||a),{context:n}=this,{gl:l}=n;if(this.useMipmap=Boolean(i&&i.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1),n.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!i||!1!==i.premultiply)),r)this.size=[s,o],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.b(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,s,o,0,this.format,l.UNSIGNED_BYTE,t.data);else {const{x:i,y:r}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||e.b(t)?l.texSubImage2D(l.TEXTURE_2D,0,i,r,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,i,r,s,o,l.RGBA,l.UNSIGNED_BYTE,t.data);}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D);}bind(t,e,i){const{context:a}=this,{gl:s}=a;s.bindTexture(s.TEXTURE_2D,this.texture),i!==s.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=s.LINEAR),t!==this.filter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,e),this.wrap=e);}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null;}}function w(t){const{userImage:e}=t;return !!(e&&e.render&&e.render())&&(t.data.replace(new Uint8Array(e.data.buffer)),!0)}class T extends e.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.R({width:1,height:1}),this.dirty=!0;}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:t,promiseResolve:e}of this.requestors)e(this._getImagesForIds(t));this.requestors=[];}}getImage(t){const i=this.images[t];if(i&&!i.data&&i.spriteData){const t=i.spriteData;i.data=new e.R({width:t.width,height:t.height},t.context.getImageData(t.x,t.y,t.width,t.height).data),i.spriteData=null;}return i}addImage(t,e){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e);}_validate(t,i){let a=!0;const s=i.data||i.spriteData;return this._validateStretch(i.stretchX,s&&s.width)||(this.fire(new e.j(new Error(`Image \"${t}\" has invalid \"stretchX\" value`))),a=!1),this._validateStretch(i.stretchY,s&&s.height)||(this.fire(new e.j(new Error(`Image \"${t}\" has invalid \"stretchY\" value`))),a=!1),this._validateContent(i.content,i)||(this.fire(new e.j(new Error(`Image \"${t}\" has invalid \"content\" value`))),a=!1),a}_validateStretch(t,e){if(!t)return !0;let i=0;for(const a of t){if(a[0]{let a=!0;if(!this.isLoaded())for(const e of t)this.images[e]||(a=!1);this.isLoaded()||a?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e});}))}_getImagesForIds(t){const i={};for(const a of t){let t=this.getImage(a);t||(this.fire(new e.k(\"styleimagemissing\",{id:a})),t=this.getImage(a)),t?i[a]={data:t.data.clone(),pixelRatio:t.pixelRatio,sdf:t.sdf,version:t.version,stretchX:t.stretchX,stretchY:t.stretchY,content:t.content,textFitWidth:t.textFitWidth,textFitHeight:t.textFitHeight,hasRenderCallback:Boolean(t.userImage&&t.userImage.render)}:e.w(`Image \"${a}\" could not be loaded. Please make sure you have added the image with map.addImage() or a \"sprite\" property in your style. You can provide missing images by listening for the \"styleimagemissing\" map event.`);}return i}getPixelSize(){const{width:t,height:e}=this.atlasImage;return {width:t,height:e}}getPattern(t){const i=this.patterns[t],a=this.getImage(t);if(!a)return null;if(i&&i.position.version===a.version)return i.position;if(i)i.position.version=a.version;else {const i={w:a.data.width+2,h:a.data.height+2,x:0,y:0},s=new e.I(i,a);this.patterns[t]={bin:i,position:s};}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new b(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE);}_updatePatternAtlas(){const t=[];for(const e in this.patterns)t.push(this.patterns[e].bin);const{w:i,h:a}=e.p(t),s=this.atlasImage;s.resize({width:i||1,height:a||1});for(const t in this.patterns){const{bin:i}=this.patterns[t],a=i.x+1,o=i.y+1,r=this.getImage(t).data,n=r.width,l=r.height;e.R.copy(r,s,{x:0,y:0},{x:a,y:o},{width:n,height:l}),e.R.copy(r,s,{x:0,y:l-1},{x:a,y:o-1},{width:n,height:1}),e.R.copy(r,s,{x:0,y:0},{x:a,y:o+l},{width:n,height:1}),e.R.copy(r,s,{x:n-1,y:0},{x:a-1,y:o},{width:1,height:l}),e.R.copy(r,s,{x:0,y:0},{x:a+n,y:o},{width:1,height:l});}this.dirty=!0;}beginFrame(){this.callbackDispatchedThisFrame={};}dispatchRenderCallbacks(t){for(const i of t){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const t=this.getImage(i);t||e.w(`Image with ID: \"${i}\" was not found`),w(t)&&this.updateImage(i,t);}}}const I=1e20;function E(t,e,i,a,s,o,r,n,l){for(let h=e;h-1);l++,o[l]=n,r[l]=h,r[l+1]=I;}for(let n=0,l=0;n65535)throw new Error(\"glyphs > 65535 not supported\");if(e.ranges[s])return {stack:t,id:i,glyph:a};if(!this.url)throw new Error(\"glyphsUrl is not set\");if(!e.requests[s]){const i=C.loadGlyphRange(t,s,this.url,this.requestManager);e.requests[s]=i;}const o=yield e.requests[s];for(const t in o)this._doesCharSupportLocalGlyph(+t)||(e.glyphs[+t]=o[+t]);return e.ranges[s]=!0,{stack:t,id:i,glyph:o[i]||null}}))}_doesCharSupportLocalGlyph(t){return !!this.localIdeographFontFamily&&/\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}/u.test(String.fromCodePoint(t))}_tinySDF(t,i,a){const s=this.localIdeographFontFamily;if(!s)return;if(!this._doesCharSupportLocalGlyph(a))return;let o=t.tinySDF;if(!o){let e=\"400\";/bold/i.test(i)?e=\"900\":/medium/i.test(i)?e=\"500\":/light/i.test(i)&&(e=\"200\"),o=t.tinySDF=new C.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:s,fontWeight:e});}const r=o.draw(String.fromCharCode(a));return {id:a,bitmap:new e.o({width:r.width||60,height:r.height||60},r.data),metrics:{width:r.glyphWidth/2||24,height:r.glyphHeight/2||24,left:r.glyphLeft/2+.5||0,top:r.glyphTop/2-27.5||-8,advance:r.glyphAdvance/2||24,isDoubleResolution:!0}}}}C.loadGlyphRange=function(t,i,a,s){return e._(this,void 0,void 0,(function*(){const o=256*i,r=o+255,n=s.transformRequest(a.replace(\"{fontstack}\",t).replace(\"{range}\",`${o}-${r}`),\"Glyphs\"),l=yield e.l(n,new AbortController);if(!l||!l.data)throw new Error(`Could not load glyph range. range: ${i}, ${o}-${r}`);const h={};for(const t of e.n(l.data))h[t.id]=t;return h}))},C.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:a=.25,fontFamily:s=\"sans-serif\",fontWeight:o=\"normal\",fontStyle:r=\"normal\"}={}){this.buffer=e,this.cutoff=a,this.radius=i;const n=this.size=t+4*e,l=this._createCanvas(n),h=this.ctx=l.getContext(\"2d\",{willReadFrequently:!0});h.font=`${r} ${o} ${t}px ${s}`,h.textBaseline=\"alphabetic\",h.textAlign=\"left\",h.fillStyle=\"black\",this.gridOuter=new Float64Array(n*n),this.gridInner=new Float64Array(n*n),this.f=new Float64Array(n),this.z=new Float64Array(n+1),this.v=new Uint16Array(n);}_createCanvas(t){const e=document.createElement(\"canvas\");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:a,actualBoundingBoxLeft:s,actualBoundingBoxRight:o}=this.ctx.measureText(t),r=Math.ceil(i),n=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-s))),l=Math.min(this.size-this.buffer,r+Math.ceil(a)),h=n+2*this.buffer,c=l+2*this.buffer,u=Math.max(h*c,0),d=new Uint8ClampedArray(u),_={data:d,width:h,height:c,glyphWidth:n,glyphHeight:l,glyphTop:r,glyphLeft:0,glyphAdvance:e};if(0===n||0===l)return _;const{ctx:p,buffer:m,gridInner:f,gridOuter:g}=this;p.clearRect(m,m,n,l),p.fillText(t,m,m+r);const v=p.getImageData(m,m,n,l);g.fill(I,0,u),f.fill(0,0,u);for(let t=0;t0?t*t:0,f[a]=t<0?t*t:0;}}E(g,0,0,h,c,h,this.f,this.v,this.z),E(f,m,m,n,l,h,this.f,this.v,this.z);for(let t=0;t1&&(r=t[++o]);const l=Math.abs(n-r.left),h=Math.abs(n-r.right),c=Math.min(l,h);let u;const d=e/i*(a+1);if(r.isDash){const t=a-Math.abs(d);u=Math.sqrt(c*c+t*t);}else u=a-Math.sqrt(c*c+d*d);this.data[s+n]=Math.max(0,Math.min(255,u+128));}}}addRegularDash(t){for(let e=t.length-1;e>=0;--e){const i=t[e],a=t[e+1];i.zeroLength?t.splice(e,1):a&&a.isDash===i.isDash&&(a.left=i.left,t.splice(e,1));}const e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);const a=this.width*this.nextRow;let s=0,o=t[s];for(let e=0;e1&&(o=t[++s]);const i=Math.abs(e-o.left),r=Math.abs(e-o.right),n=Math.min(i,r);this.data[a+e]=Math.max(0,Math.min(255,(o.isDash?n:-n)+128));}}addDash(t,i){const a=i?7:0,s=2*a+1;if(this.nextRow+s>this.height)return e.w(\"LineAtlas out of space\"),null;let o=0;for(let e=0;e{t.terminate();})),this.workers=null);}isPreloaded(){return !!this.active[k]}numActive(){return Object.keys(this.active).length}}const F=Math.floor(o.hardwareConcurrency/2);let B,O;function N(){return B||(B=new L),B}L.workerCount=e.C(globalThis)?Math.max(Math.min(F,3),1):1;class U{constructor(t,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;const a=this.workerPool.acquire(i);for(let t=0;t{t.remove();})),this.actors=[],t&&this.workerPool.release(this.id);}registerMessageHandler(t,e){for(const i of this.actors)i.registerMessageHandler(t,e);}}function j(){return O||(O=new U(N(),e.G),O.registerMessageHandler(\"GR\",((t,i,a)=>e.m(i,a)))),O}function Z(t,i){const a=e.H();return e.J(a,a,[1,1,0]),e.K(a,a,[.5*t.width,.5*t.height,1]),e.L(a,a,t.calculatePosMatrix(i.toUnwrapped()))}function q(t,e,i,a,s,o){const r=function(t,e,i){if(t)for(const a of t){const t=e[a];if(t&&t.source===i&&\"fill-extrusion\"===t.type)return !0}else for(const t in e){const a=e[t];if(a.source===i&&\"fill-extrusion\"===a.type)return !0}return !1}(s&&s.layers,e,t.id),n=o.maxPitchScaleFactor(),l=t.tilesIn(a,n,r);l.sort(V);const h=[];for(const a of l)h.push({wrappedTileID:a.tileID.wrapped().key,queryResults:a.tile.queryRenderedFeatures(e,i,t._state,a.queryGeometry,a.cameraQueryGeometry,a.scale,s,o,n,Z(t.transform,a.tileID))});const c=function(t){const e={},i={};for(const a of t){const t=a.queryResults,s=a.wrappedTileID,o=i[s]=i[s]||{};for(const i in t){const a=t[i],s=o[i]=o[i]||{},r=e[i]=e[i]||[];for(const t of a)s[t.featureIndex]||(s[t.featureIndex]=!0,r.push(t));}}return e}(h);for(const e in c)c[e].forEach((e=>{const i=e.feature,a=t.getFeatureState(i.layer[\"source-layer\"],i.id);i.source=i.layer.source,i.layer[\"source-layer\"]&&(i.sourceLayer=i.layer[\"source-layer\"]),i.state=a;}));return c}function V(t,e){const i=t.tileID,a=e.tileID;return i.overscaledZ-a.overscaledZ||i.canonical.y-a.canonical.y||i.wrap-a.wrap||i.canonical.x-a.canonical.x}function G(t,i,a){return e._(this,void 0,void 0,(function*(){let s=t;if(t.url?s=(yield e.h(i.transformRequest(t.url,\"Source\"),a)).data:yield o.frameAsync(a),!s)return null;const r=e.M(e.e(s,t),[\"tiles\",\"minzoom\",\"maxzoom\",\"attribution\",\"bounds\",\"scheme\",\"tileSize\",\"encoding\"]);return \"vector_layers\"in s&&s.vector_layers&&(r.vectorLayerIds=s.vector_layers.map((t=>t.id))),r}))}class H{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])));}setNorthEast(t){return this._ne=t instanceof e.N?new e.N(t.lng,t.lat):e.N.convert(t),this}setSouthWest(t){return this._sw=t instanceof e.N?new e.N(t.lng,t.lat):e.N.convert(t),this}extend(t){const i=this._sw,a=this._ne;let s,o;if(t instanceof e.N)s=t,o=t;else {if(!(t instanceof H))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(H.convert(t)):this.extend(e.N.convert(t)):t&&(\"lng\"in t||\"lon\"in t)&&\"lat\"in t?this.extend(e.N.convert(t)):this;if(s=t._sw,o=t._ne,!s||!o)return this}return i||a?(i.lng=Math.min(s.lng,i.lng),i.lat=Math.min(s.lat,i.lat),a.lng=Math.max(o.lng,a.lng),a.lat=Math.max(o.lat,a.lat)):(this._sw=new e.N(s.lng,s.lat),this._ne=new e.N(o.lng,o.lat)),this}getCenter(){return new e.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new e.N(this.getWest(),this.getNorth())}getSouthEast(){return new e.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return [this._sw.toArray(),this._ne.toArray()]}toString(){return `LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return !(this._sw&&this._ne)}contains(t){const{lng:i,lat:a}=e.N.convert(t);let s=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&s}static convert(t){return t instanceof H?t:t?new H(t):t}static fromLngLat(t,i=0){const a=360*i/40075017,s=a/Math.cos(Math.PI/180*t.lat);return new H(new e.N(t.lng-s,t.lat-a),new e.N(t.lng+s,t.lat+a))}adjustAntiMeridian(){const t=new e.N(this._sw.lng,this._sw.lat),i=new e.N(this._ne.lng,this._ne.lat);return new H(t,t.lng>i.lng?new e.N(i.lng+360,i.lat):i)}}class W{constructor(t,e,i){this.bounds=H.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24;}validateBounds(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const i=Math.pow(2,t.z),a=Math.floor(e.O(this.bounds.getWest())*i),s=Math.floor(e.Q(this.bounds.getNorth())*i),o=Math.ceil(e.O(this.bounds.getEast())*i),r=Math.ceil(e.Q(this.bounds.getSouth())*i);return t.x>=a&&t.x=s&&t.y{this._options.tiles=t;})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t;})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null);}serialize(){return e.e({},this._options)}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(e,\"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};i.request.collectResourceTiming=this._collectResourceTiming;let a=\"RT\";if(t.actor&&\"expired\"!==t.state){if(\"loading\"===t.state)return new Promise(((e,i)=>{t.reloadPromise={resolve:e,reject:i};}))}else t.actor=this.dispatcher.getActor(),a=\"LT\";t.abortController=new AbortController;try{const e=yield t.actor.sendAsync({type:a,data:i},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,e);}catch(e){if(delete t.abortController,t.aborted)return;if(e&&404!==e.status)throw e;this._afterTileLoadWorkerResponse(t,null);}}))}_afterTileLoadWorkerResponse(t,e){if(e&&e.resourceTiming&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.loadVectorData(e,this.map.painter),t.reloadPromise){const e=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(e.resolve).catch(e.reject);}}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:\"AT\",data:{uid:t.uid,type:this.type,source:this.id}}));}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:\"RMT\",data:{uid:t.uid,type:this.type,source:this.id}}));}))}hasTransition(){return !1}}class X extends e.E{constructor(t,i,a,s){super(),this.id=t,this.dispatcher=a,this.setEventedParent(s),this.type=\"raster\",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=\"xyz\",this.tileSize=512,this._loaded=!1,this._options=e.e({type:\"raster\"},i),e.e(this,e.M(i,[\"url\",\"scheme\",\"tileSize\"]));}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new e.k(\"dataloading\",{dataType:\"source\"})),this._tileJSONRequest=new AbortController;try{const t=yield G(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,t&&(e.e(this,t),t.bounds&&(this.tileBounds=new W(t.bounds,this.minzoom,this.maxzoom)),this.fire(new e.k(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})),this.fire(new e.k(\"data\",{dataType:\"source\",sourceDataType:\"content\"})));}catch(t){this._tileJSONRequest=null,this.fire(new e.j(t));}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load();}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null);}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load();}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t;})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t;})),this}serialize(){return e.e({},this._options)}hasTile(t){return !this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const i=yield _.getImage(this.map._requestManager.transformRequest(e,\"Tile\"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state=\"unloaded\");if(i&&i.data){this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const e=this.map.painter.context,a=e.gl,s=i.data;t.texture=this.map.painter.getTileTexture(s.width),t.texture?t.texture.update(s,{useMipmap:!0}):(t.texture=new b(e,s,a.RGBA,{useMipmap:!0}),t.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE,a.LINEAR_MIPMAP_NEAREST)),t.state=\"loaded\";}}catch(e){if(delete t.abortController,t.aborted)t.state=\"unloaded\";else if(e)throw t.state=\"errored\",e}}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController);}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture);}))}hasTransition(){return !1}}class K extends X{constructor(t,i,a,s){super(t,i,a,s),this.type=\"raster-dem\",this.maxzoom=22,this._options=e.e({type:\"raster-dem\"},i),this.encoding=i.encoding||\"mapbox\",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift;}loadTile(t){return e._(this,void 0,void 0,(function*(){const i=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=this.map._requestManager.transformRequest(i,\"Tile\");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const i=yield _.getImage(a,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state=\"unloaded\");if(i&&i.data){const a=i.data;this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});const s=e.b(a)&&e.U()?a:yield this.readImageNow(a),o={type:this.type,uid:t.uid,source:this.id,rawImageData:s,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!t.actor||\"expired\"===t.state){t.actor=this.dispatcher.getActor();const e=yield t.actor.sendAsync({type:\"LDT\",data:o});t.dem=e,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state=\"loaded\";}}}catch(e){if(delete t.abortController,t.aborted)t.state=\"unloaded\";else if(e)throw t.state=\"errored\",e}}))}readImageNow(t){return e._(this,void 0,void 0,(function*(){if(\"undefined\"!=typeof VideoFrame&&e.V()){const i=t.width+2,a=t.height+2;try{return new e.R({width:i,height:a},yield e.W(t,-1,-1,i,a))}catch(t){}}return o.getImageData(t,1)}))}_getNeighboringTiles(t){const i=t.canonical,a=Math.pow(2,i.z),s=(i.x-1+a)%a,o=0===i.x?t.wrap-1:t.wrap,r=(i.x+1+a)%a,n=i.x+1===a?t.wrap+1:t.wrap,l={};return l[new e.S(t.overscaledZ,o,i.z,s,i.y).key]={backfilled:!1},l[new e.S(t.overscaledZ,n,i.z,r,i.y).key]={backfilled:!1},i.y>0&&(l[new e.S(t.overscaledZ,o,i.z,s,i.y-1).key]={backfilled:!1},l[new e.S(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.S(t.overscaledZ,n,i.z,r,i.y-1).key]={backfilled:!1}),i.y+10&&e.e(s,{resourceTiming:a}),this.fire(new e.k(\"data\",Object.assign(Object.assign({},s),{sourceDataType:\"metadata\"}))),this.fire(new e.k(\"data\",Object.assign(Object.assign({},s),{sourceDataType:\"content\"})));}catch(t){if(this._pendingLoads--,this._removed)return void this.fire(new e.k(\"dataabort\",{dataType:\"source\"}));this.fire(new e.j(t));}}))}loaded(){return 0===this._pendingLoads}loadTile(t){return e._(this,void 0,void 0,(function*(){const e=t.actor?\"RT\":\"LT\";t.actor=this.actor;const i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.abortController=new AbortController;const a=yield this.actor.sendAsync({type:e,data:i},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(a,this.map.painter,\"RT\"===e);}))}abortTile(t){return e._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0;}))}unloadTile(t){return e._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:\"RMT\",data:{uid:t.uid,type:this.type,source:this.id}});}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:\"RS\",data:{type:this.type,source:this.id}});}serialize(){return e.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return !1}}var Y=e.Y([{name:\"a_pos\",type:\"Int16\",components:2},{name:\"a_texture_pos\",type:\"Int16\",components:2}]);class Q extends e.E{constructor(t,e,i,a){super(),this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type=\"image\",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(a),this.options=e;}load(t){return e._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new e.k(\"dataloading\",{dataType:\"source\"})),this.url=this.options.url,this._request=new AbortController;try{const e=yield _.getImage(this.map._requestManager.transformRequest(this.url,\"Image\"),this._request);this._request=null,this._loaded=!0,e&&e.data&&(this.image=e.data,t&&(this.coordinates=t),this._finishLoading());}catch(t){this._request=null,this._loaded=!0,this.fire(new e.j(t));}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>{this.texture=null;})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new e.k(\"data\",{dataType:\"source\",sourceDataType:\"metadata\"})));}onAdd(t){this.map=t,this.load();}onRemove(){this._request&&(this._request.abort(),this._request=null);}setCoordinates(t){this.coordinates=t;const i=t.map(e.Z.fromLngLat);this.tileID=function(t){let i=1/0,a=1/0,s=-1/0,o=-1/0;for(const e of t)i=Math.min(i,e.x),a=Math.min(a,e.y),s=Math.max(s,e.x),o=Math.max(o,e.y);const r=Math.max(s-i,o-a),n=Math.max(0,Math.floor(-Math.log(r)/Math.LN2)),l=Math.pow(2,n);return new e.a1(n,Math.floor((i+s)/2*l),Math.floor((a+o)/2*l))}(i),this.minzoom=this.maxzoom=this.tileID.z;const a=i.map((t=>this.tileID.getTilePoint(t)._round()));return this._boundsArray=new e.$,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,e.X,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,e.X),this._boundsArray.emplaceBack(a[2].x,a[2].y,e.X,e.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new e.k(\"data\",{dataType:\"source\",sourceDataType:\"content\"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;const t=this.map.painter.context,i=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Y.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new b(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let a=!1;for(const t in this.tiles){const e=this.tiles[t];\"loaded\"!==e.state&&(e.state=\"loaded\",e.texture=this.texture,a=!0);}a&&this.fire(new e.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}));}loadTile(t){return e._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state=\"errored\";}))}serialize(){return {type:\"image\",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return !1}}class tt extends Q{constructor(t,e,i,a){super(t,e,i,a),this.roundZoom=!0,this.type=\"video\",this.options=e;}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const e of t.urls)this.urls.push(this.map._requestManager.transformRequest(e,\"Source\").url);try{const t=yield e.a3(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener(\"playing\",(()=>{this.map.triggerRepaint();})),this.map&&this.video.play(),this._finishLoading();}catch(t){this.fire(new e.j(t));}}))}pause(){this.video&&this.video.pause();}play(){this.video&&this.video.play();}seek(t){if(this.video){const i=this.video.seekable;ti.end(0)?this.fire(new e.j(new e.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=t;}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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,i=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Y.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new b(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let a=!1;for(const t in this.tiles){const e=this.tiles[t];\"loaded\"!==e.state&&(e.state=\"loaded\",e.texture=this.texture,a=!0);}a&&this.fire(new e.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}));}serialize(){return {type:\"video\",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class et extends Q{constructor(t,i,a,s){super(t,i,a,s),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some((t=>!Array.isArray(t)||2!==t.length||t.some((t=>\"number\"!=typeof t))))||this.fire(new e.j(new e.a2(`sources.${t}`,null,'\"coordinates\" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new e.j(new e.a2(`sources.${t}`,null,'missing required property \"coordinates\"'))),i.animate&&\"boolean\"!=typeof i.animate&&this.fire(new e.j(new e.a2(`sources.${t}`,null,'optional \"animate\" property must be a boolean value'))),i.canvas?\"string\"==typeof i.canvas||i.canvas instanceof HTMLCanvasElement||this.fire(new e.j(new e.a2(`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.j(new e.a2(`sources.${t}`,null,'missing required property \"canvas\"'))),this.options=i,this.animate=void 0===i.animate||i.animate;}load(){return e._(this,void 0,void 0,(function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.j(new Error(\"Canvas dimensions cannot be less than or equal to zero.\"))):(this.play=function(){this._playing=!0,this.map.triggerRepaint();},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1);},this._finishLoading());}))}getCanvas(){return this.canvas}onAdd(t){this.map=t,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 i=this.map.painter.context,a=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,Y.members)),this.boundsSegments||(this.boundsSegments=e.a0.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new b(i,this.canvas,a.RGBA,{premultiply:!0});let s=!1;for(const t in this.tiles){const e=this.tiles[t];\"loaded\"!==e.state&&(e.state=\"loaded\",e.texture=this.texture,s=!0);}s&&this.fire(new e.k(\"data\",{dataType:\"source\",sourceDataType:\"idle\",sourceId:this.id}));}serialize(){return {type:\"canvas\",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of [this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return !0;return !1}}const it={},at=t=>{switch(t){case\"geojson\":return J;case\"image\":return Q;case\"raster\":return X;case\"raster-dem\":return K;case\"vector\":return $;case\"video\":return tt;case\"canvas\":return et}return it[t]},st=\"RTLPluginLoaded\";class ot extends e.E{constructor(){super(...arguments),this.status=\"unavailable\",this.url=null,this.dispatcher=j();}_syncState(t){return this.status=t,this.dispatcher.broadcast(\"SRPS\",{pluginStatus:t,pluginURL:this.url}).catch((t=>{throw this.status=\"error\",t}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status=\"unavailable\",this.url=null;}setRTLTextPlugin(t){return e._(this,arguments,void 0,(function*(t,e=!1){if(this.url)throw new Error(\"setRTLTextPlugin cannot be called multiple times.\");if(this.url=o.resolveURL(t),!this.url)throw new Error(`requested url ${t} is invalid`);if(\"unavailable\"===this.status){if(!e)return this._requestImport();this.status=\"deferred\",this._syncState(this.status);}else if(\"requested\"===this.status)return this._requestImport()}))}_requestImport(){return e._(this,void 0,void 0,(function*(){yield this._syncState(\"loading\"),this.status=\"loaded\",this.fire(new e.k(st));}))}lazyLoad(){\"unavailable\"===this.status?this.status=\"requested\":\"deferred\"===this.status&&this._requestImport();}}let rt=null;function nt(){return rt||(rt=new ot),rt}class lt{constructor(t,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=e.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state=\"loading\";}registerFadeDuration(t){const e=t+this.timeAdded;ee.getLayer(t))).filter(Boolean);if(0!==t.length){a.layers=t,a.stateDependentLayerIds&&(a.stateDependentLayers=a.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)i[e.id]=a;}}return i}(t.buckets,i.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.a6){if(this.hasSymbolBuckets=!0,!a)break;i.justReloaded=!0;}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const i=this.buckets[t];if(i instanceof e.a6&&i.hasRTLText){this.hasRTLText=!0,nt().lazyLoad();break}}this.queryPadding=0;for(const t in this.buckets){const e=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(t).queryRadius(e));}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage);}else this.collisionBoxArray=new e.a5;}unloadVectorData(){for(const t in this.buckets)this.buckets[t].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(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const i=this.buckets[e];i.uploadPending()&&i.upload(t);}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new b(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new b(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null);}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture);}queryRenderedFeatures(t,e,i,a,s,o,r,n,l,h){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:a,cameraQueryGeometry:s,scale:o,tileSize:this.tileSize,pixelPosMatrix:h,transform:n,params:r,queryPadding:this.queryPadding*l},t,e,i):{}}querySourceFeatures(t,i){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const s=a.loadVTLayers(),o=i&&i.sourceLayer?i.sourceLayer:\"\",r=s._geojsonTileLayer||s[o];if(!r)return;const n=e.a7(i&&i.filter),{z:l,x:h,y:c}=this.tileID.canonical,u={z:l,x:h,y:c};for(let i=0;it)e=!1;else if(i)if(this.expirationTime{this.remove(t,s);}),i)),this.data[a].push(s),this.order.push(a),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t);}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const i=t.wrapped().key,a=void 0===e?0:this.data[i].indexOf(e),s=this.data[i][a];return this.data[i].splice(a,1),s.timeout&&clearTimeout(s.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(s.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t);}return this}filter(t){const e=[];for(const i in this.data)for(const a of this.data[i])t(a.value)||e.push(a);for(const t of e)this.remove(t.value.tileID,t);}}class ct{constructor(){this.state={},this.stateChanges={},this.deletedStates={};}updateState(t,i,a){const s=String(i);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][s]=this.stateChanges[t][s]||{},e.e(this.stateChanges[t][s],a),null===this.deletedStates[t]){this.deletedStates[t]={};for(const e in this.state[t])e!==s&&(this.deletedStates[t][e]=null);}else if(this.deletedStates[t]&&null===this.deletedStates[t][s]){this.deletedStates[t][s]={};for(const e in this.state[t][s])a[e]||(this.deletedStates[t][s][e]=null);}else for(const e in a)this.deletedStates[t]&&this.deletedStates[t][s]&&null===this.deletedStates[t][s][e]&&delete this.deletedStates[t][s][e];}removeFeatureState(t,e,i){if(null===this.deletedStates[t])return;const a=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},i&&void 0!==e)null!==this.deletedStates[t][a]&&(this.deletedStates[t][a]=this.deletedStates[t][a]||{},this.deletedStates[t][a][i]=null);else if(void 0!==e)if(this.stateChanges[t]&&this.stateChanges[t][a])for(i in this.deletedStates[t][a]={},this.stateChanges[t][a])this.deletedStates[t][a][i]=null;else this.deletedStates[t][a]=null;else this.deletedStates[t]=null;}getState(t,i){const a=String(i),s=e.e({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(null===this.deletedStates[t])return {};if(this.deletedStates[t]){const e=this.deletedStates[t][i];if(null===e)return {};for(const t in e)delete s[t];}return s}initializeTileState(t,e){t.setFeatureState(this.state,e);}coalesceChanges(t,i){const a={};for(const t in this.stateChanges){this.state[t]=this.state[t]||{};const i={};for(const a in this.stateChanges[t])this.state[t][a]||(this.state[t][a]={}),e.e(this.state[t][a],this.stateChanges[t][a]),i[a]=this.state[t][a];a[t]=i;}for(const t in this.deletedStates){this.state[t]=this.state[t]||{};const i={};if(null===this.deletedStates[t])for(const e in this.state[t])i[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 i of Object.keys(this.deletedStates[t][e]))delete this.state[t][e][i];i[e]=this.state[t][e];}a[t]=a[t]||{},e.e(a[t],i);}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(a).length)for(const e in t)t[e].setFeatureState(a,i);}}class ut extends e.E{constructor(t,e,i){super(),this.id=t,this.dispatcher=i,this.on(\"data\",(t=>this._dataHandler(t))),this.on(\"dataloading\",(()=>{this._sourceErrored=!1;})),this.on(\"error\",(()=>{this._sourceErrored=this._source.loaded();})),this._source=((t,e,i,a)=>{const s=new(at(e.type))(t,e,i,a);if(s.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${s.id}`);return s})(t,e,i,this),this._tiles={},this._cache=new ht(0,(t=>this._unloadTile(t))),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ct,this._didEmitContent=!1,this._updated=!1;}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(t);}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t);}loaded(){if(this._sourceErrored)return !0;if(!this._sourceLoaded)return !1;if(!this._source.loaded())return !1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return !0;if(!this._updated)return !1;for(const t in this._tiles){const e=this._tiles[t];if(\"loaded\"!==e.state&&\"errored\"!==e.state)return !1}return !0}getSource(){return this._source}pause(){this._paused=!0;}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain);}_loadTile(t,i,a){return e._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(t),this._tileLoaded(t,i,a);}catch(i){t.state=\"errored\",404!==i.status?this._source.fire(new e.j(i,{tile:t})):this.update(this.transform,this.terrain);}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t);}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new e.k(\"dataabort\",{tile:t,coord:t.tileID,dataType:\"source\"}));}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const i=this._tiles[e];i.upload(t),i.prepare(this.map.style.imageManager);}}getIds(){return Object.values(this._tiles).map((t=>t.tileID)).sort(dt).map((t=>t.key))}getRenderableIds(t){const i=[];for(const e in this._tiles)this._isIdRenderable(e,t)&&i.push(this._tiles[e]);return t?i.sort(((t,i)=>{const a=t.tileID,s=i.tileID,o=new e.P(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),r=new e.P(s.canonical.x,s.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-s.overscaledZ||r.y-o.y||r.x-o.x})).map((t=>t.tileID.key)):i.map((t=>t.tileID)).sort(dt).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return !!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else {this._cache.reset();for(const t in this._tiles)\"errored\"!==this._tiles[t].state&&this._reloadTile(t,\"reloading\");}}_reloadTile(t,i){return e._(this,void 0,void 0,(function*(){const e=this._tiles[t];e&&(\"loading\"!==e.state&&(e.state=i),yield this._loadTile(e,t,i));}))}_tileLoaded(t,i,a){t.timeAdded=o.now(),\"expired\"===a&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,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.k(\"data\",{dataType:\"source\",tile:t,coord:t.tileID}));}_backfillDEM(t){const e=this.getRenderableIds();for(let a=0;a1||(Math.abs(i)>1&&(1===Math.abs(i+s)?i+=s:1===Math.abs(i-s)&&(i-=s)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,i,a),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)));}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,i,a){for(const s in this._tiles){let o=this._tiles[s];if(a[s]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>i)continue;let r=o.tileID;for(;o&&o.tileID.overscaledZ>e+1;){const t=o.tileID.scaledTo(o.tileID.overscaledZ-1);o=this._tiles[t.key],o&&o.hasData()&&(r=t);}let n=r;for(;n.overscaledZ>e;)if(n=n.scaledTo(n.overscaledZ-1),t[n.key]){a[r.key]=r;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const i=this._loadedParentTiles[t.key];return i&&i.tileID.overscaledZ>=e?i:null}for(let i=t.overscaledZ-1;i>=e;i--){const e=t.scaledTo(i),a=this._getLoadedTile(e);if(a)return a}}findLoadedSibling(t){return this._getLoadedTile(t)}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const i=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,s=Math.floor(i*a*(null===this._maxTileCacheZoomLevels?e.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),o=\"number\"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(o);}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const i in this._tiles){const a=this._tiles[i];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+e),t[a.tileID.key]=a;}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(t,this._tiles[t]);}}_updateCoveredAndRetainedTiles(t,e,i,a,s,r){const n={},l={},h=Object.keys(t),c=o.now();for(const i of h){const a=t[i],s=this._tiles[i];if(!s||0!==s.fadeEndTime&&s.fadeEndTime<=c)continue;const o=this.findLoadedParent(a,e),r=this.findLoadedSibling(a),h=o||r||null;h&&(this._addTile(h.tileID),n[h.tileID.key]=h.tileID),l[i]=a;}this._retainLoadedChildren(l,a,i,t);for(const e in n)t[e]||(this._coveredTiles[e]=!0,t[e]=n[e]);if(r){const e={},i={};for(const t of s)this._tiles[t.key].hasData()?e[t.key]=t:i[t.key]=t;for(const a in i){const s=i[a].children(this._source.maxzoom);this._tiles[s[0].key]&&this._tiles[s[1].key]&&this._tiles[s[2].key]&&this._tiles[s[3].key]&&(e[s[0].key]=t[s[0].key]=s[0],e[s[1].key]=t[s[1].key]=s[1],e[s[2].key]=t[s[2].key]=s[2],e[s[3].key]=t[s[3].key]=s[3],delete i[a]);}for(const a in i){const s=i[a],o=this.findLoadedParent(s,this._source.minzoom),r=this.findLoadedSibling(s),n=o||r||null;if(n){e[n.tileID.key]=t[n.tileID.key]=n.tileID;for(const t in e)e[t].isChildOf(n.tileID)&&delete e[t];}}for(const t in this._tiles)e[t]||(this._coveredTiles[t]=!0);}}update(t,i){if(!this._sourceLoaded||this._paused)return;let a;this.transform=t,this.terrain=i,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new e.S(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i}),this._source.hasTile&&(a=a.filter((t=>this._source.hasTile(t))))):a=[];const s=t.coveringZoomLevel(this._source),o=Math.max(s-ut.maxOverzooming,this._source.minzoom),r=Math.max(s+ut.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const t={};for(const e of a)if(e.canonical.z>this._source.minzoom){const i=e.scaledTo(e.canonical.z-1);t[i.key]=i;const a=e.scaledTo(Math.max(this._source.minzoom,Math.min(e.canonical.z,5)));t[a.key]=a;}a=a.concat(Object.values(t));}const n=0===a.length&&!this._updated&&this._didEmitContent;this._updated=!0,n&&this.fire(new e.k(\"data\",{sourceDataType:\"idle\",dataType:\"source\",sourceId:this.id}));const l=this._updateRetainedTiles(a,s);_t(this._source.type)&&this._updateCoveredAndRetainedTiles(l,o,r,s,a,i);for(const t in l)this._tiles[t].clearFadeHold();const h=e.ab(this._tiles,l);for(const t of h){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(t);}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache();}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t);}_updateRetainedTiles(t,e){var i;const a={},s={},o=Math.max(e-ut.maxOverzooming,this._source.minzoom),r=Math.max(e+ut.maxUnderzooming,this._source.minzoom),n={};for(const i of t){const t=this._addTile(i);a[i.key]=i,t.hasData()||ethis._source.maxzoom){const t=r.children(this._source.maxzoom)[0],e=this.getTile(t);if(e&&e.hasData()){a[t.key]=t;continue}}else {const t=r.children(this._source.maxzoom);if(a[t[0].key]&&a[t[1].key]&&a[t[2].key]&&a[t[3].key])continue}let n=t.wasRequested();for(let e=r.overscaledZ-1;e>=o;--e){const o=r.scaledTo(e);if(s[o.key])break;if(s[o.key]=!0,t=this.getTile(o),!t&&n&&(t=this._addTile(o)),t){const e=t.hasData();if((e||!(null===(i=this.map)||void 0===i?void 0:i.cancelPendingTileRequestsWhileZooming)||n)&&(a[o.key]=o),n=t.wasRequested(),e)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let i,a=this._tiles[t].tileID;for(;a.overscaledZ>0;){if(a.key in this._loadedParentTiles){i=this._loadedParentTiles[a.key];break}e.push(a.key);const t=a.scaledTo(a.overscaledZ-1);if(i=this._getLoadedTile(t),i)break;a=t;}for(const t of e)this._loadedParentTiles[t]=i;}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const t in this._tiles){const e=this._tiles[t].tileID,i=this._getLoadedTile(e);this._loadedSiblingTiles[e.key]=i;}}_addTile(t){let i=this._tiles[t.key];if(i)return i;i=this._cache.getAndRemove(t),i&&(this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,i)));const a=i;return i||(i=new lt(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state)),i.uses++,this._tiles[t.key]=i,a||this._source.fire(new e.k(\"dataloading\",{tile:i,coord:i.tileID,dataType:\"source\"})),i}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,\"expired\"),delete this._timers[t];}),i));}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&\"reloading\"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))));}_dataHandler(t){const e=t.sourceDataType;\"source\"===t.dataType&&\"metadata\"===e&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&\"source\"===t.dataType&&\"content\"===e&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0);}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset();}tilesIn(t,i,a){const s=[],o=this.transform;if(!o)return s;const r=a?o.getCameraQueryGeometry(t):t,n=t.map((t=>o.pointCoordinate(t,this.terrain))),l=r.map((t=>o.pointCoordinate(t,this.terrain))),h=this.getIds();let c=1/0,u=1/0,d=-1/0,_=-1/0;for(const t of l)c=Math.min(c,t.x),u=Math.min(u,t.y),d=Math.max(d,t.x),_=Math.max(_,t.y);for(let t=0;t=0&&f[1].y+m>=0){const t=n.map((t=>r.getTilePoint(t))),e=l.map((t=>r.getTilePoint(t)));s.push({tile:a,tileID:r,queryGeometry:t,cameraQueryGeometry:e,scale:p});}}return s}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.posMatrix=this.transform.calculatePosMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return !0;if(_t(this._source.type)){const t=o.now();for(const e in this._tiles)if(this._tiles[e].fadeEndTime>=t)return !0}return !1}setFeatureState(t,e,i){this._state.updateState(t=t||\"_geojsonTileLayer\",e,i);}removeFeatureState(t,e,i){this._state.removeFeatureState(t=t||\"_geojsonTileLayer\",e,i);}getFeatureState(t,e){return this._state.getState(t=t||\"_geojsonTileLayer\",e)}setDependencies(t,e,i){const a=this._tiles[t];a&&a.setDependencies(e,i);}reloadTilesForDependencies(t,e){for(const i in this._tiles)this._tiles[i].hasDependency(t,e)&&this._reloadTile(i,\"reloading\");this._cache.filter((i=>!i.hasDependency(t,e)));}}function dt(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),a=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||a-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function _t(t){return \"raster\"===t||\"image\"===t||\"video\"===t}ut.maxOverzooming=10,ut.maxUnderzooming=3;class pt{constructor(t,e){this.reset(t,e);}reset(t,e){this.points=t||[],this._distances=[0];for(let t=1;t0?(s-r)/n:0;return this.points[o].mult(1-l).add(this.points[i].mult(l))}}function mt(t,e){let i=!0;return \"always\"===t||\"never\"!==t&&\"never\"!==e||(i=!1),i}class ft{constructor(t,e,i){const a=this.boxCells=[],s=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let t=0;tthis.width||a<0||e>this.height)return [];const n=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=a){if(s)return [{key:null,x1:t,y1:e,x2:i,y2:a}];for(let t=0;t0}hitTestCircle(t,e,i,a,s){const o=t-i,r=t+i,n=e-i,l=e+i;if(r<0||o>this.width||l<0||n>this.height)return !1;const h=[];return this._forEachCell(o,n,r,l,this._queryCellCircle,h,{hitTest:!0,overlapMode:a,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},s),h.length>0}_queryCell(t,e,i,a,s,o,r,n){const{seenUids:l,hitTest:h,overlapMode:c}=r,u=this.boxCells[s];if(null!==u){const s=this.bboxes;for(const r of u)if(!l.box[r]){l.box[r]=!0;const u=4*r,d=this.boxKeys[r];if(t<=s[u+2]&&e<=s[u+3]&&i>=s[u+0]&&a>=s[u+1]&&(!n||n(d))&&(!h||!mt(c,d.overlapMode))&&(o.push({key:d,x1:s[u],y1:s[u+1],x2:s[u+2],y2:s[u+3]}),h))return !0}}const d=this.circleCells[s];if(null!==d){const s=this.circles;for(const r of d)if(!l.circle[r]){l.circle[r]=!0;const u=3*r,d=this.circleKeys[r];if(this._circleAndRectCollide(s[u],s[u+1],s[u+2],t,e,i,a)&&(!n||n(d))&&(!h||!mt(c,d.overlapMode))){const t=s[u],e=s[u+1],i=s[u+2];if(o.push({key:d,x1:t-i,y1:e-i,x2:t+i,y2:e+i}),h)return !0}}}return !1}_queryCellCircle(t,e,i,a,s,o,r,n){const{circle:l,seenUids:h,overlapMode:c}=r,u=this.boxCells[s];if(null!==u){const t=this.bboxes;for(const e of u)if(!h.box[e]){h.box[e]=!0;const i=4*e,a=this.boxKeys[e];if(this._circleAndRectCollide(l.x,l.y,l.radius,t[i+0],t[i+1],t[i+2],t[i+3])&&(!n||n(a))&&!mt(c,a.overlapMode))return o.push(!0),!0}}const d=this.circleCells[s];if(null!==d){const t=this.circles;for(const e of d)if(!h.circle[e]){h.circle[e]=!0;const i=3*e,a=this.circleKeys[e];if(this._circlesCollide(t[i],t[i+1],t[i+2],l.x,l.y,l.radius)&&(!n||n(a))&&!mt(c,a.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,i,a,s,o,r,n){const l=this._convertToXCellCoord(t),h=this._convertToYCellCoord(e),c=this._convertToXCellCoord(i),u=this._convertToYCellCoord(a);for(let d=l;d<=c;d++)for(let l=h;l<=u;l++)if(s.call(this,t,e,i,a,this.xCellCount*l+d,o,r,n))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,a,s,o){const r=a-t,n=s-e,l=i+o;return l*l>r*r+n*n}_circleAndRectCollide(t,e,i,a,s,o,r){const n=(o-a)/2,l=Math.abs(t-(a+n));if(l>n+i)return !1;const h=(r-s)/2,c=Math.abs(e-(s+h));if(c>h+i)return !1;if(l<=n||c<=h)return !0;const u=l-n,d=c-h;return u*u+d*d<=i*i}}function gt(t,i,a,s,o){const r=e.H();return i?(e.K(r,r,[1/o,1/o,1]),a||e.ad(r,r,s.angle)):e.L(r,s.labelPlaneMatrix,t),r}function vt(t,i,a,s,o){if(i){const i=e.ae(t);return e.K(i,i,[o,o,1]),a||e.ad(i,i,-s.angle),i}return s.glCoordMatrix}function xt(t,i,a,s){let o;s?(o=[t,i,s(t,i),1],e.af(o,o,a)):(o=[t,i,0,1],kt(o,o,a));const r=o[3];return {point:new e.P(o[0]/r,o[1]/r),signedDistanceFromCamera:r,isOccluded:!1}}function yt(t,e){return .5+t/e*.5}function bt(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function wt(t,i,a,s,o,r,n,l,h,c,u,d,_,p,m){const f=s?t.textSizeData:t.iconSizeData,g=e.ag(f,a.transform.zoom),v=[256/a.width*2+1,256/a.height*2+1],x=s?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;x.clear();const y=t.lineVertexArray,b=s?t.text.placedSymbolArray:t.icon.placedSymbolArray,w=a.transform.width/a.transform.height;let T=!1;for(let s=0;sMath.abs(a.x-i.x)*s?{useVertical:!0}:(t===e.ah.vertical?i.ya.x)?{needsFlipping:!0}:null}function Et(t,i,a,s,o,r,n,l,h,c,u){const d=a/24,_=i.lineOffsetX*d,p=i.lineOffsetY*d;let m;if(i.numGlyphs>1){const e=i.glyphStartIndex+i.numGlyphs,a=i.lineStartIndex,r=i.lineStartIndex+i.lineLength,h=Tt(d,l,_,p,s,i,u,t);if(!h)return {notEnoughRoom:!0};const f=xt(h.first.point.x,h.first.point.y,n,t.getElevation).point,g=xt(h.last.point.x,h.last.point.y,n,t.getElevation).point;if(o&&!s){const t=It(i.writingMode,f,g,c);if(t)return t}m=[h.first];for(let o=i.glyphStartIndex+1;o0?n.point:function(t,e,i,a,s,o){return Pt(t,e,i,1,s,o)}(t.tileAnchorPoint,o,a,0,r,t),h=It(i.writingMode,a,l,c);if(h)return h}const a=Mt(d*l.getoffsetX(i.glyphStartIndex),_,p,s,i.segment,i.lineStartIndex,i.lineStartIndex+i.lineLength,t,u);if(!a||t.projectionCache.anyProjectionOccluded)return {notEnoughRoom:!0};m=[a];}for(const t of m)e.aj(h,t.point,t.angle);return {}}function Pt(t,e,i,a,s,o){const r=t.add(t.sub(e)._unit()),n=void 0!==s?xt(r.x,r.y,s,o.getElevation).point:St(r.x,r.y,o).point,l=i.sub(n);return i.add(l._mult(a/l.mag()))}function Ct(t,i,a){const s=i.projectionCache;if(s.projections[t])return s.projections[t];const o=new e.P(i.lineVertexArray.getx(t),i.lineVertexArray.gety(t)),r=St(o.x,o.y,i);if(r.signedDistanceFromCamera>0)return s.projections[t]=r.point,s.anyProjectionOccluded=s.anyProjectionOccluded||r.isOccluded,r.point;const n=t-a.direction;return function(t,e,i,a,s){return Pt(t,e,i,a,void 0,s)}(0===a.distanceFromAnchor?i.tileAnchorPoint:new e.P(i.lineVertexArray.getx(n),i.lineVertexArray.gety(n)),o,a.previousVertex,a.absOffsetX-a.distanceFromAnchor+1,i)}function St(t,e,i){const a=t+i.translation[0],s=e+i.translation[1];let o;return !i.pitchWithMap&&i.projection.useSpecialProjectionForSymbols?(o=i.projection.projectTileCoordinates(a,s,i.unwrappedTileID,i.getElevation),o.point.x=(.5*o.point.x+.5)*i.width,o.point.y=(.5*-o.point.y+.5)*i.height):(o=xt(a,s,i.labelPlaneMatrix,i.getElevation),o.isOccluded=!1),o}function zt(t,e,i){return t._unit()._perp()._mult(e*i)}function Dt(t,i,a,s,o,r,n,l,h){if(l.projectionCache.offsets[t])return l.projectionCache.offsets[t];const c=a.add(i);if(t+h.direction=o)return l.projectionCache.offsets[t]=c,c;const u=Ct(t+h.direction,l,h),d=zt(u.sub(a),n,h.direction),_=a.add(d),p=u.add(d);return l.projectionCache.offsets[t]=e.ak(r,c,_,p)||c,l.projectionCache.offsets[t]}function Mt(t,e,i,a,s,o,r,n,l){const h=a?t-e:t+e;let c=h>0?1:-1,u=0;a&&(c*=-1,u=Math.PI),c<0&&(u+=Math.PI);let d,_=c>0?o+s:o+s+1;n.projectionCache.cachedAnchorPoint?d=n.projectionCache.cachedAnchorPoint:(d=St(n.tileAnchorPoint.x,n.tileAnchorPoint.y,n).point,n.projectionCache.cachedAnchorPoint=d);let p,m,f=d,g=d,v=0,x=0;const y=Math.abs(h),b=[];let w;for(;v+x<=y;){if(_+=c,_=r)return null;v+=x,g=f,m=p;const t={absOffsetX:y,direction:c,distanceFromAnchor:v,previousVertex:g};if(f=Ct(_,n,t),0===i)b.push(g),w=f.sub(g);else {let e;const a=f.sub(g);e=0===a.mag()?zt(Ct(_+c,n,t).sub(f),i,c):zt(a,i,c),m||(m=g.add(e)),p=Dt(_,e,f,o,r,m,i,n,t),b.push(m),w=p.sub(m);}x=w.mag();}const T=w._mult((y-v)/x)._add(m||g),I=u+Math.atan2(f.y-g.y,f.x-g.x);return b.push(T),{point:T,angle:l?I:0,path:b}}const At=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Rt(t,e){for(let i=0;i=1;t--)l.push(r.path[t]);for(let t=1;tt.signedDistanceFromCamera<=0))?[]:t.map((t=>t.point));}let m=[];if(l.length>0){const t=l[0].clone(),i=l[0].clone();for(let e=1;e=a.x&&i.x<=s.x&&t.y>=a.y&&i.y<=s.y?[l]:i.xs.x||i.ys.y?[]:e.al([l],a.x,a.y,s.x,s.y);}for(const e of m){o.reset(e,.25*i);let a=0;a=o.length<=.5*i?1:Math.ceil(o.paddedLength/u)+1;for(let e=0;ext(t.x,t.y,i,e.getElevation)))}queryRenderedSymbols(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return {};const i=[];let a=1/0,s=1/0,o=-1/0,r=-1/0;for(const n of t){const t=new e.P(n.x+Lt,n.y+Lt);a=Math.min(a,t.x),s=Math.min(s,t.y),o=Math.max(o,t.x),r=Math.max(r,t.y),i.push(t);}const n=this.grid.query(a,s,o,r).concat(this.ignoredGrid.query(a,s,o,r)),l={},h={};for(const t of n){const a=t.key;if(void 0===l[a.bucketInstanceId]&&(l[a.bucketInstanceId]={}),l[a.bucketInstanceId][a.featureIndex])continue;const s=[new e.P(t.x1,t.y1),new e.P(t.x2,t.y1),new e.P(t.x2,t.y2),new e.P(t.x1,t.y2)];e.am(i,s)&&(l[a.bucketInstanceId][a.featureIndex]=!0,void 0===h[a.bucketInstanceId]&&(h[a.bucketInstanceId]=[]),h[a.bucketInstanceId].push(a.featureIndex));}return h}insertCollisionBox(t,e,i,a,s,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:s,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3]);}insertCollisionCircles(t,e,i,a,s,o){const r=i?this.ignoredGrid:this.grid,n={bucketInstanceId:a,featureIndex:s,collisionGroupID:o,overlapMode:e};for(let e=0;e=this.screenRightBoundary||athis.screenBottomBoundary}isInsideGrid(t,e,i,a){return i>=0&&t=0&&ethis.projectAndGetPerspectiveRatio(a,t.x,t.y,s,h)));I=t.some((t=>!t.isOccluded)),T=t.map((t=>t.point));}else I=!0;return {box:e.ao(T),allPointsOccluded:!I}}}function Bt(t,i,a){return i*(e.X/(t.tileSize*Math.pow(2,a-t.tileID.overscaledZ)))}class Ot{constructor(t,e,i,a){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):a&&i?1:0,this.placed=i;}isHidden(){return 0===this.opacity&&!this.placed}}class Nt{constructor(t,e,i,a,s){this.text=new Ot(t?t.text:null,e,i,s),this.icon=new Ot(t?t.icon:null,e,a,s);}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ut{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i;}}class jt{constructor(){this.invProjMatrix=e.H(),this.viewportMatrix=e.H(),this.circles=[];}}class Zt{constructor(t,e,i,a,s){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=a,this.tileID=s;}}class qt{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={};}get(t){if(this.crossSourceCollisions)return {ID:0,predicate:null};if(!this.collisionGroups[t]){const e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:t=>t.collisionGroupID===e};}return this.collisionGroups[t]}}function Vt(t,i,a,s,o){const{horizontalAlign:r,verticalAlign:n}=e.au(t);return new e.P(-(r-.5)*i+s[0]*o,-(n-.5)*a+s[1]*o)}class Gt{constructor(t,e,i,a,s,o){this.transform=t.clone(),this.terrain=i,this.collisionIndex=new Ft(this.transform,e),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new qt(s),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={};}_getTerrainElevationFunc(t){const e=this.terrain;return e?(i,a)=>e.getElevation(t,i,a):null}getBucketParts(t,i,a,s){const o=a.getBucket(i),r=a.latestFeatureIndex;if(!o||!r||i.id!==o.layerIds[0])return;const n=a.collisionBoxArray,l=o.layers[0].layout,h=o.layers[0].paint,c=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),u=a.tileSize/e.X,d=a.tileID.toUnwrapped(),_=this.transform.calculatePosMatrix(d),p=\"map\"===l.get(\"text-pitch-alignment\"),m=\"map\"===l.get(\"text-rotation-alignment\"),f=Bt(a,1,this.transform.zoom),g=this.collisionIndex.mapProjection.translatePosition(this.transform,a,h.get(\"text-translate\"),h.get(\"text-translate-anchor\")),v=this.collisionIndex.mapProjection.translatePosition(this.transform,a,h.get(\"icon-translate\"),h.get(\"icon-translate-anchor\")),x=gt(_,p,m,this.transform,f);let y=null;if(p){const t=vt(_,p,m,this.transform,f);y=e.L([],this.transform.labelPlaneMatrix,t);}this.retainedQueryData[o.bucketInstanceId]=new Zt(o.bucketInstanceId,r,o.sourceLayerIndex,o.index,a.tileID);const b={bucket:o,layout:l,translationText:g,translationIcon:v,posMatrix:_,unwrappedTileID:d,textLabelPlaneMatrix:x,labelToScreenMatrix:y,scale:c,textPixelRatio:u,holdingForFade:a.holdingForFade(),collisionBoxArray:n,partiallyEvaluatedTextSize:e.ag(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(s)for(const e of o.sortKeyRanges){const{sortKey:i,symbolInstanceStart:a,symbolInstanceEnd:s}=e;t.push({sortKey:i,symbolInstanceStart:a,symbolInstanceEnd:s,parameters:b});}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:b});}attemptAnchorPlacement(t,i,a,s,o,r,n,l,h,c,u,d,_,p,m,f,g,v,x){const y=e.aq[t.textAnchor],b=[t.textOffset0,t.textOffset1],w=Vt(y,a,s,b,o),T=this.collisionIndex.placeCollisionBox(i,d,l,h,c,n,r,f,u.predicate,x,w);if((!v||this.collisionIndex.placeCollisionBox(v,d,l,h,c,n,r,g,u.predicate,x,w).placeable)&&T.placeable){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[_.crossTileID]&&this.prevPlacement.placements[_.crossTileID]&&this.prevPlacement.placements[_.crossTileID].text&&(t=this.prevPlacement.variableOffsets[_.crossTileID].anchor),0===_.crossTileID)throw new Error(\"symbolInstance.crossTileID can't be 0\");return this.variableOffsets[_.crossTileID]={textOffset:b,width:a,height:s,anchor:y,textBoxScale:o,prevAnchor:t},this.markUsedJustification(p,y,_,m),p.allowVerticalPlacement&&(this.markUsedOrientation(p,m,_),this.placedOrientations[_.crossTileID]=m),{shift:w,placedGlyphBoxes:T}}}placeLayerBucketPart(t,i,a){const{bucket:s,layout:o,translationText:r,translationIcon:n,posMatrix:l,unwrappedTileID:h,textLabelPlaneMatrix:c,labelToScreenMatrix:u,textPixelRatio:d,holdingForFade:_,collisionBoxArray:p,partiallyEvaluatedTextSize:m,collisionGroup:f}=t.parameters,g=o.get(\"text-optional\"),v=o.get(\"icon-optional\"),x=e.ar(o,\"text-overlap\",\"text-allow-overlap\"),y=\"always\"===x,b=e.ar(o,\"icon-overlap\",\"icon-allow-overlap\"),w=\"always\"===b,T=\"map\"===o.get(\"text-rotation-alignment\"),I=\"map\"===o.get(\"text-pitch-alignment\"),E=\"none\"!==o.get(\"icon-text-fit\"),P=\"viewport-y\"===o.get(\"symbol-z-order\"),C=y&&(w||!s.hasIconData()||v),S=w&&(y||!s.hasTextData()||g);!s.collisionArrays&&p&&s.deserializeCollisionBoxes(p);const z=this._getTerrainElevationFunc(this.retainedQueryData[s.bucketInstanceId].tileID),D=(t,p,w)=>{var P,D;if(i[t.crossTileID])return;if(_)return void(this.placements[t.crossTileID]=new Ut(!1,!1,!1));let M=!1,A=!1,R=!0,k=null,L={box:null,placeable:!1,offscreen:null},F={box:null,placeable:!1,offscreen:null},B=null,O=null,N=null,U=0,j=0,Z=0;p.textFeatureIndex?U=p.textFeatureIndex:t.useRuntimeCollisionCircles&&(U=t.featureIndex),p.verticalTextFeatureIndex&&(j=p.verticalTextFeatureIndex);const q=p.textBox;if(q){const i=i=>{let a=e.ah.horizontal;if(s.allowVerticalPlacement&&!i&&this.prevPlacement){const e=this.prevPlacement.placedOrientations[t.crossTileID];e&&(this.placedOrientations[t.crossTileID]=e,a=e,this.markUsedOrientation(s,a,t));}return a},o=(i,a)=>{if(s.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&p.verticalTextBox){for(const t of s.writingModes)if(t===e.ah.vertical?(L=a(),F=L):L=i(),L&&L.placeable)break}else L=i();},c=t.textAnchorOffsetStartIndex,u=t.textAnchorOffsetEndIndex;if(u===c){const a=(e,i)=>{const a=this.collisionIndex.placeCollisionBox(e,x,d,l,h,I,T,r,f.predicate,z);return a&&a.placeable&&(this.markUsedOrientation(s,i,t),this.placedOrientations[t.crossTileID]=i),a};o((()=>a(q,e.ah.horizontal)),(()=>{const i=p.verticalTextBox;return s.allowVerticalPlacement&&t.numVerticalGlyphVertices>0&&i?a(i,e.ah.vertical):{box:null,offscreen:null}})),i(L&&L.placeable);}else {let _=e.aq[null===(D=null===(P=this.prevPlacement)||void 0===P?void 0:P.variableOffsets[t.crossTileID])||void 0===D?void 0:D.anchor];const m=(i,o,p)=>{const m=i.x2-i.x1,g=i.y2-i.y1,v=t.textBoxScale,y=E&&\"never\"===b?o:null;let w=null,P=\"never\"===x?1:2,C=\"never\";_&&P++;for(let e=0;em(q,p.iconBox,e.ah.horizontal)),(()=>{const i=p.verticalTextBox;return s.allowVerticalPlacement&&(!L||!L.placeable)&&t.numVerticalGlyphVertices>0&&i?m(i,p.verticalIconBox,e.ah.vertical):{box:null,occluded:!0,offscreen:null}})),L&&(M=L.placeable,R=L.offscreen);const g=i(L&&L.placeable);if(!M&&this.prevPlacement){const e=this.prevPlacement.variableOffsets[t.crossTileID];e&&(this.variableOffsets[t.crossTileID]=e,this.markUsedJustification(s,e.anchor,t,g));}}}if(B=L,M=B&&B.placeable,R=B&&B.offscreen,t.useRuntimeCollisionCircles){const i=s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex),n=e.ai(s.textSizeData,m,i),d=o.get(\"text-padding\");O=this.collisionIndex.placeCollisionCircles(x,i,s.lineVertexArray,s.glyphOffsetArray,n,l,h,c,u,a,I,f.predicate,t.collisionCircleDiameter,d,r,z),O.circles.length&&O.collisionDetected&&!a&&e.w(\"Collisions detected, but collision boxes are not shown\"),M=y||O.circles.length>0&&!O.collisionDetected,R=R&&O.offscreen;}if(p.iconFeatureIndex&&(Z=p.iconFeatureIndex),p.iconBox){const t=t=>this.collisionIndex.placeCollisionBox(t,b,d,l,h,I,T,n,f.predicate,z,E&&k?k:void 0);F&&F.placeable&&p.verticalIconBox?(N=t(p.verticalIconBox),A=N.placeable):(N=t(p.iconBox),A=N.placeable),R=R&&N.offscreen;}const V=g||0===t.numHorizontalGlyphVertices&&0===t.numVerticalGlyphVertices,G=v||0===t.numIconVertices;V||G?G?V||(A=A&&M):M=A&&M:A=M=A&&M;const H=A&&N.placeable;if(M&&B.placeable&&this.collisionIndex.insertCollisionBox(B.box,x,o.get(\"text-ignore-placement\"),s.bucketInstanceId,F&&F.placeable&&j?j:U,f.ID),H&&this.collisionIndex.insertCollisionBox(N.box,b,o.get(\"icon-ignore-placement\"),s.bucketInstanceId,Z,f.ID),O&&M&&this.collisionIndex.insertCollisionCircles(O.circles,x,o.get(\"text-ignore-placement\"),s.bucketInstanceId,U,f.ID),a&&this.storeCollisionData(s.bucketInstanceId,w,p,B,N,O),0===t.crossTileID)throw new Error(\"symbolInstance.crossTileID can't be 0\");if(0===s.bucketInstanceId)throw new Error(\"bucket.bucketInstanceId can't be 0\");this.placements[t.crossTileID]=new Ut(M||C,A||S,R||s.justReloaded),i[t.crossTileID]=!0;};if(P){if(0!==t.symbolInstanceStart)throw new Error(\"bucket.bucketInstanceId should be 0\");const e=s.getSortedSymbolIndexes(this.transform.angle);for(let t=e.length-1;t>=0;--t){const i=e[t];D(s.symbolInstances.get(i),s.collisionArrays[i],i);}}else for(let e=t.symbolInstanceStart;e=0&&(t.text.placedSymbolArray.get(e).crossTileID=o>=0&&e!==o?0:a.crossTileID);}markUsedOrientation(t,i,a){const s=i===e.ah.horizontal||i===e.ah.horizontalOnly?i:0,o=i===e.ah.vertical?i:0,r=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const e of r)t.text.placedSymbolArray.get(e).placedOrientation=s;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=o);}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const e=this.prevPlacement;let i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;const a=e?e.symbolFadeChange(t):1,s=e?e.opacities:{},o=e?e.variableOffsets:{},r=e?e.placedOrientations:{};for(const t in this.placements){const e=this.placements[t],o=s[t];o?(this.opacities[t]=new Nt(o,a,e.text,e.icon),i=i||e.text!==o.text.placed||e.icon!==o.icon.placed):(this.opacities[t]=new Nt(null,a,e.text,e.icon,e.skipFade),i=i||e.text||e.icon);}for(const t in s){const e=s[t];if(!this.opacities[t]){const s=new Nt(e,a,!1,!1);s.isHidden()||(this.opacities[t]=s,i=i||e.text.placed||e.icon.placed);}}for(const t in o)this.variableOffsets[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.variableOffsets[t]=o[t]);for(const t in r)this.placedOrientations[t]||!this.opacities[t]||this.opacities[t].isHidden()||(this.placedOrientations[t]=r[t]);if(e&&void 0===e.lastPlacementChangeTime)throw new Error(\"Last placement time for previous placement is not defined\");i?this.lastPlacementChangeTime=t:\"number\"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t);}updateLayerOpacities(t,e){const i={};for(const a of e){const e=a.getBucket(t);e&&a.latestFeatureIndex&&t.id===e.layerIds[0]&&this.updateBucketOpacities(e,a.tileID,i,a.collisionBoxArray);}}updateBucketOpacities(t,i,a,s){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const o=t.layers[0],r=o.layout,n=new Nt(null,0,!1,!1,!0),l=r.get(\"text-allow-overlap\"),h=r.get(\"icon-allow-overlap\"),c=o._unevaluatedLayout.hasValue(\"text-variable-anchor\")||o._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"),u=\"map\"===r.get(\"text-rotation-alignment\"),d=\"map\"===r.get(\"text-pitch-alignment\"),_=\"none\"!==r.get(\"icon-text-fit\"),p=new Nt(null,0,l&&(h||!t.hasIconData()||r.get(\"icon-optional\")),h&&(l||!t.hasTextData()||r.get(\"text-optional\")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const m=(t,e,i)=>{for(let a=0;a0,v=this.placedOrientations[s.crossTileID],x=v===e.ah.vertical,y=v===e.ah.horizontal||v===e.ah.horizontalOnly;if(o>0||r>0){const e=te(h.text);m(t.text,o,x?ee:e),m(t.text,r,y?ee:e);const i=h.text.isHidden();[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((e=>{e>=0&&(t.text.placedSymbolArray.get(e).hidden=i||x?1:0);})),s.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).hidden=i||y?1:0);const a=this.variableOffsets[s.crossTileID];a&&this.markUsedJustification(t,a.anchor,s,v);const n=this.placedOrientations[s.crossTileID];n&&(this.markUsedJustification(t,\"left\",s,n),this.markUsedOrientation(t,n,s));}if(g){const e=te(h.icon),i=!(_&&s.verticalPlacedIconSymbolIndex&&x);s.placedIconSymbolIndex>=0&&(m(t.icon,s.numIconVertices,i?e:ee),t.icon.placedSymbolArray.get(s.placedIconSymbolIndex).hidden=h.icon.isHidden()),s.verticalPlacedIconSymbolIndex>=0&&(m(t.icon,s.numVerticalIconVertices,i?ee:e),t.icon.placedSymbolArray.get(s.verticalPlacedIconSymbolIndex).hidden=h.icon.isHidden());}const b=f&&f.has(i)?f.get(i):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const a=t.collisionArrays[i];if(a){let i=new e.P(0,0);if(a.textBox||a.verticalTextBox){let e=!0;if(c){const t=this.variableOffsets[l];t?(i=Vt(t.anchor,t.width,t.height,t.textOffset,t.textBoxScale),u&&i._rotate(d?this.transform.angle:-this.transform.angle)):e=!1;}if(a.textBox||a.verticalTextBox){let s;a.textBox&&(s=x),a.verticalTextBox&&(s=y),Ht(t.textCollisionBox.collisionVertexArray,h.text.placed,!e||s,b.text,i.x,i.y);}}if(a.iconBox||a.verticalIconBox){const e=Boolean(!y&&a.verticalIconBox);let s;a.iconBox&&(s=e),a.verticalIconBox&&(s=!e),Ht(t.iconCollisionBox.collisionVertexArray,h.icon.placed,s,b.icon,_?i.x:0,_?i.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(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0;}}function Ht(t,e,i,a,s,o){a&&0!==a.length||(a=[0,0,0,0]);const r=a[0]-Lt,n=a[1]-Lt,l=a[2]-Lt,h=a[3]-Lt;t.emplaceBack(e?1:0,i?1:0,s||0,o||0,r,n),t.emplaceBack(e?1:0,i?1:0,s||0,o||0,l,n),t.emplaceBack(e?1:0,i?1:0,s||0,o||0,l,h),t.emplaceBack(e?1:0,i?1:0,s||0,o||0,r,h);}const Wt=Math.pow(2,25),$t=Math.pow(2,24),Xt=Math.pow(2,17),Kt=Math.pow(2,16),Jt=Math.pow(2,9),Yt=Math.pow(2,8),Qt=Math.pow(2,1);function te(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;const e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*Wt+e*$t+i*Xt+e*Kt+i*Jt+e*Yt+i*Qt+e}const ee=0;function ie(){return {isOccluded:(t,e,i)=>!1,getPitchedTextCorrection:(t,e,i)=>1,get useSpecialProjectionForSymbols(){return !1},projectTileCoordinates(t,e,i,a){throw new Error(\"Not implemented.\")},translatePosition:(t,e,i,a)=>function(t,e,i,a,s=!1){if(!i[0]&&!i[1])return [0,0];const o=s?\"map\"===a?t.angle:0:\"viewport\"===a?-t.angle:0;if(o){const t=Math.sin(o),e=Math.cos(o);i=[i[0]*e-i[1]*t,i[0]*t+i[1]*e];}return [s?i[0]:Bt(e,i[0],t.zoom),s?i[1]:Bt(e,i[1],t.zoom)]}(t,e,i,a),getCircleRadiusCorrection:t=>1}}class ae{constructor(t){this._sortAcrossTiles=\"viewport-y\"!==t.layout.get(\"symbol-z-order\")&&!t.layout.get(\"symbol-sort-key\").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[];}continuePlacement(t,e,i,a,s){const o=this._bucketParts;for(;this._currentTileIndext.sortKey-e.sortKey)));this._currentPartIndex!this._forceFullPlacement&&o.now()-a>2;for(;this._currentPlacementIndex>=0;){const a=e[t[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if(\"symbol\"===a.type&&(!a.minzoom||a.minzoom<=o)&&(!a.maxzoom||a.maxzoom>o)){if(this._inProgressLayer||(this._inProgressLayer=new ae(a)),this._inProgressLayer.continuePlacement(i[a.source],this.placement,this._showCollisionBoxes,a,s))return;delete this._inProgressLayer;}this._currentPlacementIndex--;}this._done=!0;}commit(t){return this.placement.commit(t),this.placement}}const oe=512/e.X/2;class re{constructor(t,i,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const s=new Map;for(let t=0;t({x:Math.floor(t.anchorX*oe),y:Math.floor(t.anchorY*oe)}))),crossTileIDs:i.map((t=>t.crossTileID))};if(a.positions.length>128){const t=new e.av(a.positions.length,16,Uint16Array);for(const{x:e,y:i}of a.positions)t.add(e,i);t.finish(),delete a.positions,a.index=t;}this._symbolsByKey[t]=a;}}getScaledCoordinates(t,i){const{x:a,y:s,z:o}=this.tileID.canonical,{x:r,y:n,z:l}=i.canonical,h=oe/Math.pow(2,l-o),c=(n*e.X+t.anchorY)*h,u=s*e.X*oe;return {x:Math.floor((r*e.X+t.anchorX)*h-a*e.X*oe),y:Math.floor(c-u)}}findMatches(t,e,i){const a=this.tileID.canonical.zt))}}class ne{constructor(){this.maxCrossTileID=0;}generate(){return ++this.maxCrossTileID}}class le{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0;}handleWrapJump(t){const e=Math.round((t-this.lng)/360);if(0!==e)for(const t in this.indexes){const i=this.indexes[t],a={};for(const t in i){const s=i[t];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+e),a[s.tileID.key]=s;}this.indexes[t]=a;}this.lng=t;}addBucket(t,e,i){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return !1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key]);}for(let t=0;tt.overscaledZ)for(const i in s){const o=s[i];o.tileID.isChildOf(t)&&o.findMatches(e.symbolInstances,t,a);}else {const o=s[t.scaledTo(Number(i)).key];o&&o.findMatches(e.symbolInstances,t,a);}}for(let t=0;t{e[t]=!0;}));for(const t in this.layerIndexes)e[t]||delete this.layerIndexes[t];}}const ce=(t,i)=>e.t(t,i&&i.filter((t=>\"source.canvas\"!==t.identifier))),ue=e.aw();class de extends e.E{constructor(t,i={}){super(),this._rtlPluginLoaded=()=>{for(const t in this.sourceCaches){const e=this.sourceCaches[t].getSource().type;\"vector\"!==e&&\"geojson\"!==e||this.sourceCaches[t].reload();}},this.map=t,this.dispatcher=new U(N(),t._getMapId()),this.dispatcher.registerMessageHandler(\"GG\",((t,e)=>this.getGlyphs(t,e))),this.dispatcher.registerMessageHandler(\"GI\",((t,e)=>this.getImages(t,e))),this.imageManager=new T,this.imageManager.setEventedParent(this),this.glyphManager=new C(t._requestManager,i.localIdeographFontFamily),this.lineAtlas=new R(256,512),this.crossTileSymbolIndex=new he,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new e.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast(\"SR\",e.ay()),nt().on(st,this._rtlPluginLoaded),this.on(\"data\",(t=>{if(\"source\"!==t.dataType||\"metadata\"!==t.sourceDataType)return;const e=this.sourceCaches[t.sourceId];if(!e)return;const i=e.getSource();if(i&&i.vectorLayerIds)for(const t in this._layers){const e=this._layers[t];e.source===i.id&&this._validateLayer(e);}}));}loadURL(t,i={},a){this.fire(new e.k(\"dataloading\",{dataType:\"style\"})),i.validate=\"boolean\"!=typeof i.validate||i.validate;const s=this.map._requestManager.transformRequest(t,\"Style\");this._loadStyleRequest=new AbortController;const o=this._loadStyleRequest;e.h(s,this._loadStyleRequest).then((t=>{this._loadStyleRequest=null,this._load(t.data,i,a);})).catch((t=>{this._loadStyleRequest=null,t&&!o.signal.aborted&&this.fire(new e.j(t));}));}loadJSON(t,i={},a){this.fire(new e.k(\"dataloading\",{dataType:\"style\"})),this._frameRequest=new AbortController,o.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,i.validate=!1!==i.validate,this._load(t,i,a);})).catch((()=>{}));}loadEmpty(){this.fire(new e.k(\"dataloading\",{dataType:\"style\"})),this._load(ue,{validate:!1});}_load(t,i,a){var s;const o=i.transformStyle?i.transformStyle(a,t):t;if(!i.validate||!ce(this,e.u(o))){this._loaded=!0,this.stylesheet=o;for(const t in o.sources)this.addSource(t,o.sources[t],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new D(this.stylesheet.light),this.sky=new A(this.stylesheet.sky),this.map.setTerrain(null!==(s=this.stylesheet.terrain)&&void 0!==s?s:null),this.fire(new e.k(\"data\",{dataType:\"style\"})),this.fire(new e.k(\"style.load\"));}}_createLayers(){const t=e.az(this.stylesheet.layers);this.dispatcher.broadcast(\"SL\",t),this._order=t.map((t=>t.id)),this._layers={},this._serializedLayers=null;for(const i of t){const t=e.aA(i);t.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=t;}}_loadSprite(t,i=!1,a=void 0){let s;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(t,i,a,s){return e._(this,void 0,void 0,(function*(){const r=x(t),n=a>1?\"@2x\":\"\",l={},h={};for(const{id:t,url:a}of r){const o=i.transformRequest(y(a,n,\".json\"),\"SpriteJSON\");l[t]=e.h(o,s);const r=i.transformRequest(y(a,n,\".png\"),\"SpriteImage\");h[t]=_.getImage(r,s);}return yield Promise.all([...Object.values(l),...Object.values(h)]),function(t,i){return e._(this,void 0,void 0,(function*(){const e={};for(const a in t){e[a]={};const s=o.getImageCanvasContext((yield i[a]).data),r=(yield t[a]).data;for(const t in r){const{width:i,height:o,x:n,y:l,sdf:h,pixelRatio:c,stretchX:u,stretchY:d,content:_,textFitWidth:p,textFitHeight:m}=r[t];e[a][t]={data:null,pixelRatio:c,sdf:h,stretchX:u,stretchY:d,content:_,textFitWidth:p,textFitHeight:m,spriteData:{width:i,height:o,x:n,y:l,context:s}};}}return e}))}(l,h)}))}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((t=>{if(this._spriteRequest=null,t)for(const e in t){this._spritesImagesIds[e]=[];const a=this._spritesImagesIds[e]?this._spritesImagesIds[e].filter((e=>!(e in t))):[];for(const t of a)this.imageManager.removeImage(t),this._changedImages[t]=!0;for(const a in t[e]){const s=\"default\"===e?a:`${e}:${a}`;this._spritesImagesIds[e].push(s),s in this.imageManager.images?this.imageManager.updateImage(s,t[e][a],!1):this.imageManager.addImage(s,t[e][a]),i&&(this._changedImages[s]=!0);}}})).catch((t=>{this._spriteRequest=null,s=t,this.fire(new e.j(s));})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast(\"SI\",this._availableImages),this.fire(new e.k(\"data\",{dataType:\"style\"})),a&&a(s);}));}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(\"SI\",this._availableImages),this.fire(new e.k(\"data\",{dataType:\"style\"}));}_validateLayer(t){const i=this.sourceCaches[t.source];if(!i)return;const a=t.sourceLayer;if(!a)return;const s=i.getSource();(\"geojson\"===s.type||s.vectorLayerIds&&-1===s.vectorLayerIds.indexOf(a))&&this.fire(new e.j(new Error(`Source layer \"${a}\" does not exist on source \"${s.id}\" as specified by style layer \"${t.id}\".`)));}loaded(){if(!this._loaded)return !1;if(Object.keys(this._updatedSources).length)return !1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return !1;return !!this.imageManager.isLoaded()}_serializeByIds(t,i=!1){const a=this._serializedAllLayers();if(!t||0===t.length)return Object.values(i?e.aB(a):a);const s=[];for(const o of t)if(a[o]){const t=i?e.aB(a[o]):a[o];s.push(t);}return s}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const e=Object.keys(this._layers);for(const i of e){const e=this._layers[i];\"custom\"!==e.type&&(t[i]=e.serialize());}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return !0;if(this.sky&&this.sky.hasTransition())return !0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return !0;for(const t in this._layers)if(this._layers[t].hasTransition())return !0;return !1}_checkLoaded(){if(!this._loaded)throw new Error(\"Style is not done loading.\")}update(t){if(!this._loaded)return;const i=this._changed;if(i){const e=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);(e.length||i.length)&&this._updateWorkerLayers(e,i);for(const t in this._updatedSources){const e=this._updatedSources[t];if(\"reload\"===e)this._reloadSource(t);else {if(\"clear\"!==e)throw new Error(`Invalid action ${e}`);this._clearSource(t);}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const e in this._updatedPaintProps)this._layers[e].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates();}const a={};for(const t in this.sourceCaches){const e=this.sourceCaches[t];a[t]=e.used,e.used=!1;}for(const e of this._order){const i=this._layers[e];i.recalculate(t,this._availableImages),!i.isHidden(t.zoom)&&i.source&&(this.sourceCaches[i.source].used=!0);}for(const t in a){const i=this.sourceCaches[t];!!a[t]!=!!i.used&&i.fire(new e.k(\"data\",{sourceDataType:\"visibility\",dataType:\"source\",sourceId:t}));}this.light.recalculate(t),this.sky.recalculate(t),this.z=t.zoom,i&&this.fire(new e.k(\"data\",{dataType:\"style\"}));}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies([\"icons\",\"patterns\"],t);this._changedImages={};}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies([\"glyphs\"],[\"\"]);this._glyphsDidChange=!1;}}_updateWorkerLayers(t,e){this.dispatcher.broadcast(\"UL\",{layers:this._serializeByIds(t,!1),removedIds:e});}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1;}setState(t,i={}){var a;this._checkLoaded();const s=this.serialize();if(t=i.transformStyle?i.transformStyle(s,t):t,(null===(a=i.validate)||void 0===a||a)&&ce(this,e.u(t)))return !1;(t=e.aB(t)).layers=e.az(t.layers);const o=e.aC(s,t),r=this._getOperationsToPerform(o);if(r.unimplemented.length>0)throw new Error(`Unimplemented: ${r.unimplemented.join(\", \")}.`);if(0===r.operations.length)return !1;for(const t of r.operations)t();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){const e=[],i=[];for(const a of t)switch(a.command){case\"setCenter\":case\"setZoom\":case\"setBearing\":case\"setPitch\":continue;case\"addLayer\":e.push((()=>this.addLayer.apply(this,a.args)));break;case\"removeLayer\":e.push((()=>this.removeLayer.apply(this,a.args)));break;case\"setPaintProperty\":e.push((()=>this.setPaintProperty.apply(this,a.args)));break;case\"setLayoutProperty\":e.push((()=>this.setLayoutProperty.apply(this,a.args)));break;case\"setFilter\":e.push((()=>this.setFilter.apply(this,a.args)));break;case\"addSource\":e.push((()=>this.addSource.apply(this,a.args)));break;case\"removeSource\":e.push((()=>this.removeSource.apply(this,a.args)));break;case\"setLayerZoomRange\":e.push((()=>this.setLayerZoomRange.apply(this,a.args)));break;case\"setLight\":e.push((()=>this.setLight.apply(this,a.args)));break;case\"setGeoJSONSourceData\":e.push((()=>this.setGeoJSONSourceData.apply(this,a.args)));break;case\"setGlyphs\":e.push((()=>this.setGlyphs.apply(this,a.args)));break;case\"setSprite\":e.push((()=>this.setSprite.apply(this,a.args)));break;case\"setSky\":e.push((()=>this.setSky.apply(this,a.args)));break;case\"setTerrain\":e.push((()=>this.map.setTerrain.apply(this,a.args)));break;case\"setTransition\":e.push((()=>{}));break;default:i.push(a.command);}return {operations:e,unimplemented:i}}addImage(t,i){if(this.getImage(t))return this.fire(new e.j(new Error(`An image named \"${t}\" already exists.`)));this.imageManager.addImage(t,i),this._afterImageUpdated(t);}updateImage(t,e){this.imageManager.updateImage(t,e);}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new e.j(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(\"SI\",this._availableImages),this.fire(new e.k(\"data\",{dataType:\"style\"}));}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,a={}){if(this._checkLoaded(),void 0!==this.sourceCaches[t])throw new Error(`Source \"${t}\" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(\", \")}.`);if([\"vector\",\"raster\",\"geojson\",\"video\",\"image\"].indexOf(i.type)>=0&&this._validate(e.u.source,`sources.${t}`,i,null,a))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const s=this.sourceCaches[t]=new ut(t,i,this.dispatcher);s.style=this,s.setEventedParent(this,(()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:t}))),s.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 i in this._layers)if(this._layers[i].source===t)return this.fire(new e.j(new Error(`Source \"${t}\" cannot be removed while layer \"${i}\" is using it.`)));const i=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],i.fire(new e.k(\"data\",{sourceDataType:\"metadata\",dataType:\"source\",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0;}setGeoJSONSourceData(t,e){if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error(`There is no source with this ID=${t}`);const i=this.sourceCaches[t].getSource();if(\"geojson\"!==i.type)throw new Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0;}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,i,a={}){this._checkLoaded();const s=t.id;if(this.getLayer(s))return void this.fire(new e.j(new Error(`Layer \"${s}\" already exists on this map.`)));let o;if(\"custom\"===t.type){if(ce(this,e.aD(t)))return;o=e.aA(t);}else {if(\"source\"in t&&\"object\"==typeof t.source&&(this.addSource(s,t.source),t=e.aB(t),t=e.e(t,{source:s})),this._validate(e.u.layer,`layers.${s}`,t,{arrayIndex:-1},a))return;o=e.aA(t),this._validateLayer(o),o.setEventedParent(this,{layer:{id:s}});}const r=i?this._order.indexOf(i):this._order.length;if(i&&-1===r)this.fire(new e.j(new Error(`Cannot add layer \"${s}\" before non-existing layer \"${i}\".`)));else {if(this._order.splice(r,0,s),this._layerOrderChanged=!0,this._layers[s]=o,this._removedLayers[s]&&o.source&&\"custom\"!==o.type){const t=this._removedLayers[s];delete this._removedLayers[s],t.type!==o.type?this._updatedSources[o.source]=\"clear\":(this._updatedSources[o.source]=\"reload\",this.sourceCaches[o.source].pause());}this._updateLayer(o),o.onAdd&&o.onAdd(this.map);}}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new e.j(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===i)return;const a=this._order.indexOf(t);this._order.splice(a,1);const s=i?this._order.indexOf(i):this._order.length;i&&-1===s?this.fire(new e.j(new Error(`Cannot move layer \"${t}\" before non-existing layer \"${i}\".`))):(this._order.splice(s,0,t),this._layerOrderChanged=!0);}removeLayer(t){this._checkLoaded();const i=this._layers[t];if(!i)return void this.fire(new e.j(new Error(`Cannot remove non-existing layer \"${t}\".`)));i.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map);}getLayer(t){return this._layers[t]}getLayersOrder(){return [...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,a){this._checkLoaded();const s=this.getLayer(t);s?s.minzoom===i&&s.maxzoom===a||(null!=i&&(s.minzoom=i),null!=a&&(s.maxzoom=a),this._updateLayer(s)):this.fire(new e.j(new Error(`Cannot set the zoom range of non-existing layer \"${t}\".`)));}setFilter(t,i,a={}){this._checkLoaded();const s=this.getLayer(t);if(s){if(!e.aE(s.filter,i))return null==i?(s.filter=void 0,void this._updateLayer(s)):void(this._validate(e.u.filter,`layers.${s.id}.filter`,i,null,a)||(s.filter=e.aB(i),this._updateLayer(s)))}else this.fire(new e.j(new Error(`Cannot filter non-existing layer \"${t}\".`)));}getFilter(t){return e.aB(this.getLayer(t).filter)}setLayoutProperty(t,i,a,s={}){this._checkLoaded();const o=this.getLayer(t);o?e.aE(o.getLayoutProperty(i),a)||(o.setLayoutProperty(i,a,s),this._updateLayer(o)):this.fire(new e.j(new Error(`Cannot style non-existing layer \"${t}\".`)));}getLayoutProperty(t,i){const a=this.getLayer(t);if(a)return a.getLayoutProperty(i);this.fire(new e.j(new Error(`Cannot get style of non-existing layer \"${t}\".`)));}setPaintProperty(t,i,a,s={}){this._checkLoaded();const o=this.getLayer(t);o?e.aE(o.getPaintProperty(i),a)||(o.setPaintProperty(i,a,s)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null):this.fire(new e.j(new Error(`Cannot style non-existing layer \"${t}\".`)));}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,i){this._checkLoaded();const a=t.source,s=t.sourceLayer,o=this.sourceCaches[a];if(void 0===o)return void this.fire(new e.j(new Error(`The source '${a}' does not exist in the map's style.`)));const r=o.getSource().type;\"geojson\"===r&&s?this.fire(new e.j(new Error(\"GeoJSON sources cannot have a sourceLayer parameter.\"))):\"vector\"!==r||s?(void 0===t.id&&this.fire(new e.j(new Error(\"The feature id parameter must be provided.\"))),o.setFeatureState(s,t.id,i)):this.fire(new e.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));}removeFeatureState(t,i){this._checkLoaded();const a=t.source,s=this.sourceCaches[a];if(void 0===s)return void this.fire(new e.j(new Error(`The source '${a}' does not exist in the map's style.`)));const o=s.getSource().type,r=\"vector\"===o?t.sourceLayer:void 0;\"vector\"!==o||r?i&&\"string\"!=typeof t.id&&\"number\"!=typeof t.id?this.fire(new e.j(new Error(\"A feature id is required to remove its specific state property.\"))):s.removeFeatureState(r,t.id,i):this.fire(new e.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));}getFeatureState(t){this._checkLoaded();const i=t.source,a=t.sourceLayer,s=this.sourceCaches[i];if(void 0!==s)return \"vector\"!==s.getSource().type||a?(void 0===t.id&&this.fire(new e.j(new Error(\"The feature id parameter must be provided.\"))),s.getFeatureState(a,t.id)):void this.fire(new e.j(new Error(\"The sourceLayer parameter must be provided for vector source types.\")));this.fire(new e.j(new Error(`The source '${i}' does not exist in the map's style.`)));}getTransition(){return e.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=e.aF(this.sourceCaches,(t=>t.serialize())),i=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,s=this.stylesheet;return e.aG({version:s.version,name:s.name,metadata:s.metadata,light:s.light,sky:s.sky,center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,sprite:s.sprite,glyphs:s.glyphs,transition:s.transition,sources:t,layers:i,terrain:a},(t=>void 0!==t))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&\"raster\"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]=\"reload\",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0;}_flattenAndSortRenderedFeatures(t){const e=t=>\"fill-extrusion\"===this._layers[t].type,i={},a=[];for(let s=this._order.length-1;s>=0;s--){const o=this._order[s];if(e(o)){i[o]=s;for(const e of t){const t=e[o];if(t)for(const e of t)a.push(e);}}}a.sort(((t,e)=>e.intersectionZ-t.intersectionZ));const s=[];for(let o=this._order.length-1;o>=0;o--){const r=this._order[o];if(e(r))for(let t=a.length-1;t>=0;t--){const e=a[t].feature;if(i[e.layer.id]{const a=i.featureSortOrder;if(a){const i=a.indexOf(t.featureIndex);return a.indexOf(e.featureIndex)-i}return e.featureIndex-t.featureIndex}));for(const t of s)e.push(t);}}for(const e in n)n[e].forEach((a=>{const s=a.feature,o=i[t[e].source].getFeatureState(s.layer[\"source-layer\"],s.id);s.source=s.layer.source,s.layer[\"source-layer\"]&&(s.sourceLayer=s.layer[\"source-layer\"]),s.state=o;}));return n}(this._layers,r,this.sourceCaches,t,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(t,i){i&&i.filter&&this._validate(e.u.filter,\"querySourceFeatures.filter\",i.filter,null,i);const a=this.sourceCaches[t];return a?function(t,e){const i=t.getRenderableIds().map((e=>t.getTileByID(e))),a=[],s={};for(let t=0;tt.getTileByID(e))).sort(((t,e)=>e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)));}const a=this.crossTileSymbolIndex.addLayer(i,l[i.source],t.center.lng);r=r||a;}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((s=s||this._layerOrderChanged||0===i)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(o.now(),t.zoom))&&(this.pauseablePlacement=new se(t,this.map.terrain,this._order,s,e,i,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(o.now()),n=!0),r&&this.pauseablePlacement.placement.setStale()),n||r)for(const t of this._order){const e=this._layers[t];\"symbol\"===e.type&&this.placement.updateLayerOpacities(e,l[e.source]);}return !this.pauseablePlacement.isDone()||this.placement.hasTransitions(o.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles();}getImages(t,i){return e._(this,void 0,void 0,(function*(){const t=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const e=this.sourceCaches[i.source];return e&&e.setDependencies(i.tileID.key,i.type,i.icons),t}))}getGlyphs(t,i){return e._(this,void 0,void 0,(function*(){const t=yield this.glyphManager.getGlyphs(i.stacks),e=this.sourceCaches[i.source];return e&&e.setDependencies(i.tileID.key,i.type,[\"\"]),t}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}){this._checkLoaded(),t&&this._validate(e.u.glyphs,\"glyphs\",t,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t));}addSprite(t,i,a={},s){this._checkLoaded();const o=[{id:t,url:i}],r=[...x(this.stylesheet.sprite),...o];this._validate(e.u.sprite,\"sprite\",r,null,a)||(this.stylesheet.sprite=r,this._loadSprite(o,!0,s));}removeSprite(t){this._checkLoaded();const i=x(this.stylesheet.sprite);if(i.find((e=>e.id===t))){if(this._spritesImagesIds[t])for(const e of this._spritesImagesIds[t])this.imageManager.removeImage(e),this._changedImages[e]=!0;i.splice(i.findIndex((e=>e.id===t)),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(\"SI\",this._availableImages),this.fire(new e.k(\"data\",{dataType:\"style\"}));}else this.fire(new e.j(new Error(`Sprite \"${t}\" doesn't exists on this map.`)));}getSprite(){return x(this.stylesheet.sprite)}setSprite(t,i={},a){this._checkLoaded(),t&&this._validate(e.u.sprite,\"sprite\",t,null,i)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)));}}var _e=e.Y([{name:\"a_pos\",type:\"Int16\",components:2}]);const pe={prelude:me(\"#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\\n\",\"#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_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_exaggeration;\\n#else\\nreturn 0.0;\\n#endif\\n}\"),background:me(\"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:me(\"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:me(\"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);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}\"),clippingMask:me(\"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:me(\"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,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}\"),heatmapTexture:me(\"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:me(\"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_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}\"),collisionCircle:me(\"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:me(\"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:me(\"#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:me(\"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:me(\"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:me(\"#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:me(\"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 height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\\n#else\\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\\n#endif\\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);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:me(\"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 height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\\n#else\\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\\n#endif\\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float 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:me(\"#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:me(\"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:me(\"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:me(\"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:me(\"#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:me(\"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:me(\"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:me(\"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}\",\"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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\\n#pragma mapbox: define lowp float opacity\\nvoid main() {\\n#pragma mapbox: initialize lowp float opacity\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}\"),symbolSDF:me(\"#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 inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\\n#ifdef OVERDRAW_INSPECTOR\\ngl_FragColor=vec4(1.0);\\n#endif\\n}\",\"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 bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}\"),symbolTextAndIcon:me(\"#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}\",\"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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}\\n#pragma mapbox: define highp vec4 fill_color\\n#pragma mapbox: define highp vec4 halo_color\\n#pragma mapbox: define lowp float opacity\\n#pragma mapbox: define lowp float halo_width\\n#pragma mapbox: define lowp float halo_blur\\nvoid main() {\\n#pragma mapbox: initialize highp vec4 fill_color\\n#pragma mapbox: initialize highp vec4 halo_color\\n#pragma mapbox: initialize lowp float opacity\\n#pragma mapbox: initialize lowp float halo_width\\n#pragma mapbox: initialize lowp float halo_blur\\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\\ncamera_to_anchor_distance/u_camera_to_center_distance :\\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}\"),terrain:me(\"uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}\",\"attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}\"),terrainDepth:me(\"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);}\",\"attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}\"),terrainCoords:me(\"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);}\",\"attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}\"),sky:me(\"uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}\",\"attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}\")};function me(t,e){const i=/#pragma mapbox: ([\\w]+) ([\\w]+) ([\\w]+) ([\\w]+)/g,a=e.match(/attribute ([\\w]+) ([\\w]+)/g),s=t.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),o=e.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),r=o?o.concat(s):s,n={};return {fragmentSource:t=t.replace(i,((t,e,i,a,s)=>(n[s]=!0,\"define\"===e?`\\n#ifndef HAS_UNIFORM_u_${s}\\nvarying ${i} ${a} ${s};\\n#else\\nuniform ${i} ${a} u_${s};\\n#endif\\n`:`\\n#ifdef HAS_UNIFORM_u_${s}\\n ${i} ${a} ${s} = u_${s};\\n#endif\\n`))),vertexSource:e=e.replace(i,((t,e,i,a,s)=>{const o=\"float\"===a?\"vec2\":\"vec4\",r=s.match(/color/)?\"color\":o;return n[s]?\"define\"===e?`\\n#ifndef HAS_UNIFORM_u_${s}\\nuniform lowp float u_${s}_t;\\nattribute ${i} ${o} a_${s};\\nvarying ${i} ${a} ${s};\\n#else\\nuniform ${i} ${a} u_${s};\\n#endif\\n`:\"vec4\"===r?`\\n#ifndef HAS_UNIFORM_u_${s}\\n ${s} = a_${s};\\n#else\\n ${i} ${a} ${s} = u_${s};\\n#endif\\n`:`\\n#ifndef HAS_UNIFORM_u_${s}\\n ${s} = unpack_mix_${r}(a_${s}, u_${s}_t);\\n#else\\n ${i} ${a} ${s} = u_${s};\\n#endif\\n`:\"define\"===e?`\\n#ifndef HAS_UNIFORM_u_${s}\\nuniform lowp float u_${s}_t;\\nattribute ${i} ${o} a_${s};\\n#else\\nuniform ${i} ${a} u_${s};\\n#endif\\n`:\"vec4\"===r?`\\n#ifndef HAS_UNIFORM_u_${s}\\n ${i} ${a} ${s} = a_${s};\\n#else\\n ${i} ${a} ${s} = u_${s};\\n#endif\\n`:`\\n#ifndef HAS_UNIFORM_u_${s}\\n ${i} ${a} ${s} = unpack_mix_${r}(a_${s}, u_${s}_t);\\n#else\\n ${i} ${a} ${s} = u_${s};\\n#endif\\n`})),staticAttributes:a,staticUniforms:r}}class fe{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null;}bind(t,e,i,a,s,o,r,n,l){this.context=t;let h=this.boundPaintVertexBuffers.length!==a.length;for(let t=0;!h&&t({u_matrix:t,u_texture:0,u_ele_delta:i,u_fog_matrix:a,u_fog_color:s?s.properties.get(\"fog-color\"):e.aM.white,u_fog_ground_blend:s?s.properties.get(\"fog-ground-blend\"):1,u_fog_ground_blend_opacity:s?s.calculateFogBlendOpacity(o):0,u_horizon_color:s?s.properties.get(\"horizon-color\"):e.aM.white,u_horizon_fog_blend:s?s.properties.get(\"horizon-fog-blend\"):1});function ve(t){const e=[];for(let i=0;i({u_depth:new e.aH(t,i.u_depth),u_terrain:new e.aH(t,i.u_terrain),u_terrain_dim:new e.aI(t,i.u_terrain_dim),u_terrain_matrix:new e.aJ(t,i.u_terrain_matrix),u_terrain_unpack:new e.aK(t,i.u_terrain_unpack),u_terrain_exaggeration:new e.aI(t,i.u_terrain_exaggeration)}))(t,b),this.binderUniforms=a?a.getUniforms(t,b):[];}draw(t,e,i,a,s,o,r,n,l,h,c,u,d,_,p,m,f,g){const v=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(a),t.setColorMode(s),t.setCullFace(o),n){t.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,n.depthTexture),t.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,n.texture);for(const t in this.terrainUniforms)this.terrainUniforms[t].set(n[t]);}for(const t in this.fixedUniforms)this.fixedUniforms[t].set(r[t]);p&&p.setUniforms(t,this.binderUniforms,d,{zoom:_});let x=0;switch(e){case v.LINES:x=2;break;case v.TRIANGLES:x=3;break;case v.LINE_STRIP:x=1;}for(const i of u.get()){const a=i.vaos||(i.vaos={});(a[l]||(a[l]=new fe)).bind(t,this,h,p?p.getPaintVertexBuffers():[],c,i.vertexOffset,m,f,g),v.drawElements(e,i.primitiveLength*x,v.UNSIGNED_SHORT,i.primitiveOffset*x*2);}}}function ye(t,e,i){const a=1/Bt(i,1,e.transform.tileZoom),s=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,e.transform.tileZoom)/s,r=o*(i.tileID.canonical.x+i.tileID.wrap*s),n=o*i.tileID.canonical.y;return {u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[a,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[r>>16,n>>16],u_pixel_coord_lower:[65535&r,65535&n]}}const be=(t,i,a,s)=>{const o=i.style.light,r=o.properties.get(\"position\"),n=[r.x,r.y,r.z],l=function(){var t=new e.A(9);return e.A!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}();\"viewport\"===o.properties.get(\"anchor\")&&function(t,e){var i=Math.sin(e),a=Math.cos(e);t[0]=a,t[1]=i,t[2]=0,t[3]=-i,t[4]=a,t[5]=0,t[6]=0,t[7]=0,t[8]=1;}(l,-i.transform.angle),function(t,e,i){var a=e[0],s=e[1],o=e[2];t[0]=a*i[0]+s*i[3]+o*i[6],t[1]=a*i[1]+s*i[4]+o*i[7],t[2]=a*i[2]+s*i[5]+o*i[8];}(n,n,l);const h=o.properties.get(\"color\");return {u_matrix:t,u_lightpos:n,u_lightintensity:o.properties.get(\"intensity\"),u_lightcolor:[h.r,h.g,h.b],u_vertical_gradient:+a,u_opacity:s}},we=(t,i,a,s,o,r,n)=>e.e(be(t,i,a,s),ye(r,i,n),{u_height_factor:-Math.pow(2,o.overscaledZ)/n.tileSize/8}),Te=t=>({u_matrix:t}),Ie=(t,i,a,s)=>e.e(Te(t),ye(a,i,s)),Ee=(t,e)=>({u_matrix:t,u_world:e}),Pe=(t,i,a,s,o)=>e.e(Ie(t,i,a,s),{u_world:o}),Ce=(t,e,i,a)=>{const s=t.transform;let o,r;if(\"map\"===a.paint.get(\"circle-pitch-alignment\")){const t=Bt(i,1,s.zoom);o=!0,r=[t,t];}else o=!1,r=s.pixelsToGLUnits;return {u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+(\"map\"===a.paint.get(\"circle-pitch-scale\")),u_matrix:t.translatePosMatrix(e.posMatrix,i,a.paint.get(\"circle-translate\"),a.paint.get(\"circle-translate-anchor\")),u_pitch_with_map:+o,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:r}},Se=(t,e,i)=>({u_matrix:t,u_inv_matrix:e,u_camera_to_center_distance:i.cameraToCenterDistance,u_viewport_size:[i.width,i.height]}),ze=(t,e,i=1)=>({u_matrix:t,u_color:e,u_overlay:0,u_overlay_scale:i}),De=t=>({u_matrix:t}),Me=(t,e,i,a)=>({u_matrix:t,u_extrude_scale:Bt(e,1,i),u_intensity:a}),Ae=(t,i,a,s)=>{const o=e.H();e.aP(o,0,t.width,t.height,0,0,1);const r=t.context.gl;return {u_matrix:o,u_world:[r.drawingBufferWidth,r.drawingBufferHeight],u_image:a,u_color_ramp:s,u_opacity:i.paint.get(\"heatmap-opacity\")}};function Re(t,i){const a=Math.pow(2,i.canonical.z),s=i.canonical.y;return [new e.Z(0,s/a).toLngLat().lat,new e.Z(0,(s+1)/a).toLngLat().lat]}const ke=(t,e,i,a)=>{const s=t.transform;return {u_matrix:Ne(t,e,i,a),u_ratio:1/Bt(e,1,s.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]]}},Le=(t,i,a,s,o)=>e.e(ke(t,i,a,o),{u_image:0,u_image_height:s}),Fe=(t,e,i,a,s)=>{const o=t.transform,r=Oe(e,o);return {u_matrix:Ne(t,e,i,s),u_texsize:e.imageAtlasTexture.size,u_ratio:1/Bt(e,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[r,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Be=(t,i,a,s,o,r)=>{const n=t.lineAtlas,l=Oe(i,t.transform),h=\"round\"===a.layout.get(\"line-cap\"),c=n.getDash(s.from,h),u=n.getDash(s.to,h),d=c.width*o.fromScale,_=u.width*o.toScale;return e.e(ke(t,i,a,r),{u_patternscale_a:[l/d,-c.height/2],u_patternscale_b:[l/_,-u.height/2],u_sdfgamma:n.width/(256*Math.min(d,_)*t.pixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:u.y,u_mix:o.t})};function Oe(t,e){return 1/Bt(t,1,e.tileZoom)}function Ne(t,e,i,a){return t.translatePosMatrix(a?a.posMatrix:e.tileID.posMatrix,e,i.paint.get(\"line-translate\"),i.paint.get(\"line-translate-anchor\"))}const Ue=(t,e,i,a,s)=>{return {u_matrix:t,u_tl_parent:e,u_scale_parent:i,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*s.paint.get(\"raster-opacity\"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get(\"raster-brightness-min\"),u_brightness_high:s.paint.get(\"raster-brightness-max\"),u_saturation_factor:(r=s.paint.get(\"raster-saturation\"),r>0?1-1/(1.001-r):-r),u_contrast_factor:(o=s.paint.get(\"raster-contrast\"),o>0?1/(1-o):1+o),u_spin_weights:je(s.paint.get(\"raster-hue-rotate\"))};var o,r;};function je(t){t*=Math.PI/180;const e=Math.sin(t),i=Math.cos(t);return [(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const Ze=(t,e,i,a,s,o,r,n,l,h,c,u,d,_)=>{const p=r.transform;return {u_is_size_zoom_constant:+(\"constant\"===t||\"source\"===t),u_is_size_feature_constant:+(\"constant\"===t||\"camera\"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:p.width/p.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:n,u_label_plane_matrix:l,u_coord_matrix:h,u_is_text:+u,u_pitch_with_map:+a,u_is_along_line:s,u_is_variable_anchor:o,u_texsize:d,u_texture:0,u_translation:c,u_pitched_scale:_}},qe=(t,i,a,s,o,r,n,l,h,c,u,d,_,p,m)=>{const f=n.transform;return e.e(Ze(t,i,a,s,o,r,n,l,h,c,u,d,_,m),{u_gamma_scale:s?Math.cos(f._pitch)*f.cameraToCenterDistance:1,u_device_pixel_ratio:n.pixelRatio,u_is_halo:+p})},Ve=(t,i,a,s,o,r,n,l,h,c,u,d,_,p)=>e.e(qe(t,i,a,s,o,r,n,l,h,c,u,!0,d,!0,p),{u_texsize_icon:_,u_texture_icon:1}),Ge=(t,e,i)=>({u_matrix:t,u_opacity:e,u_color:i}),He=(t,i,a,s,o,r)=>e.e(function(t,e,i,a){const s=i.imageManager.getPattern(t.from.toString()),o=i.imageManager.getPattern(t.to.toString()),{width:r,height:n}=i.imageManager.getPixelSize(),l=Math.pow(2,a.tileID.overscaledZ),h=a.tileSize*Math.pow(2,i.transform.tileZoom)/l,c=h*(a.tileID.canonical.x+a.tileID.wrap*l),u=h*a.tileID.canonical.y;return {u_image:0,u_pattern_tl_a:s.tl,u_pattern_br_a:s.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[r,n],u_mix:e.t,u_pattern_size_a:s.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/Bt(a,1,i.transform.tileZoom),u_pixel_coord_upper:[c>>16,u>>16],u_pixel_coord_lower:[65535&c,65535&u]}}(s,r,a,o),{u_matrix:t,u_opacity:i}),We={fillExtrusion:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_lightpos:new e.aN(t,i.u_lightpos),u_lightintensity:new e.aI(t,i.u_lightintensity),u_lightcolor:new e.aN(t,i.u_lightcolor),u_vertical_gradient:new e.aI(t,i.u_vertical_gradient),u_opacity:new e.aI(t,i.u_opacity)}),fillExtrusionPattern:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_lightpos:new e.aN(t,i.u_lightpos),u_lightintensity:new e.aI(t,i.u_lightintensity),u_lightcolor:new e.aN(t,i.u_lightcolor),u_vertical_gradient:new e.aI(t,i.u_vertical_gradient),u_height_factor:new e.aI(t,i.u_height_factor),u_image:new e.aH(t,i.u_image),u_texsize:new e.aO(t,i.u_texsize),u_pixel_coord_upper:new e.aO(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(t,i.u_pixel_coord_lower),u_scale:new e.aN(t,i.u_scale),u_fade:new e.aI(t,i.u_fade),u_opacity:new e.aI(t,i.u_opacity)}),fill:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix)}),fillPattern:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_image:new e.aH(t,i.u_image),u_texsize:new e.aO(t,i.u_texsize),u_pixel_coord_upper:new e.aO(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(t,i.u_pixel_coord_lower),u_scale:new e.aN(t,i.u_scale),u_fade:new e.aI(t,i.u_fade)}),fillOutline:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_world:new e.aO(t,i.u_world)}),fillOutlinePattern:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_world:new e.aO(t,i.u_world),u_image:new e.aH(t,i.u_image),u_texsize:new e.aO(t,i.u_texsize),u_pixel_coord_upper:new e.aO(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(t,i.u_pixel_coord_lower),u_scale:new e.aN(t,i.u_scale),u_fade:new e.aI(t,i.u_fade)}),circle:(t,i)=>({u_camera_to_center_distance:new e.aI(t,i.u_camera_to_center_distance),u_scale_with_map:new e.aH(t,i.u_scale_with_map),u_pitch_with_map:new e.aH(t,i.u_pitch_with_map),u_extrude_scale:new e.aO(t,i.u_extrude_scale),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_matrix:new e.aJ(t,i.u_matrix)}),collisionBox:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_pixel_extrude_scale:new e.aO(t,i.u_pixel_extrude_scale)}),collisionCircle:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_inv_matrix:new e.aJ(t,i.u_inv_matrix),u_camera_to_center_distance:new e.aI(t,i.u_camera_to_center_distance),u_viewport_size:new e.aO(t,i.u_viewport_size)}),debug:(t,i)=>({u_color:new e.aL(t,i.u_color),u_matrix:new e.aJ(t,i.u_matrix),u_overlay:new e.aH(t,i.u_overlay),u_overlay_scale:new e.aI(t,i.u_overlay_scale)}),clippingMask:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix)}),heatmap:(t,i)=>({u_extrude_scale:new e.aI(t,i.u_extrude_scale),u_intensity:new e.aI(t,i.u_intensity),u_matrix:new e.aJ(t,i.u_matrix)}),heatmapTexture:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_world:new e.aO(t,i.u_world),u_image:new e.aH(t,i.u_image),u_color_ramp:new e.aH(t,i.u_color_ramp),u_opacity:new e.aI(t,i.u_opacity)}),hillshade:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_image:new e.aH(t,i.u_image),u_latrange:new e.aO(t,i.u_latrange),u_light:new e.aO(t,i.u_light),u_shadow:new e.aL(t,i.u_shadow),u_highlight:new e.aL(t,i.u_highlight),u_accent:new e.aL(t,i.u_accent)}),hillshadePrepare:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_image:new e.aH(t,i.u_image),u_dimension:new e.aO(t,i.u_dimension),u_zoom:new e.aI(t,i.u_zoom),u_unpack:new e.aK(t,i.u_unpack)}),line:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_ratio:new e.aI(t,i.u_ratio),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.aO(t,i.u_units_to_pixels)}),lineGradient:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_ratio:new e.aI(t,i.u_ratio),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.aO(t,i.u_units_to_pixels),u_image:new e.aH(t,i.u_image),u_image_height:new e.aI(t,i.u_image_height)}),linePattern:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_texsize:new e.aO(t,i.u_texsize),u_ratio:new e.aI(t,i.u_ratio),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_image:new e.aH(t,i.u_image),u_units_to_pixels:new e.aO(t,i.u_units_to_pixels),u_scale:new e.aN(t,i.u_scale),u_fade:new e.aI(t,i.u_fade)}),lineSDF:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_ratio:new e.aI(t,i.u_ratio),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_units_to_pixels:new e.aO(t,i.u_units_to_pixels),u_patternscale_a:new e.aO(t,i.u_patternscale_a),u_patternscale_b:new e.aO(t,i.u_patternscale_b),u_sdfgamma:new e.aI(t,i.u_sdfgamma),u_image:new e.aH(t,i.u_image),u_tex_y_a:new e.aI(t,i.u_tex_y_a),u_tex_y_b:new e.aI(t,i.u_tex_y_b),u_mix:new e.aI(t,i.u_mix)}),raster:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_tl_parent:new e.aO(t,i.u_tl_parent),u_scale_parent:new e.aI(t,i.u_scale_parent),u_buffer_scale:new e.aI(t,i.u_buffer_scale),u_fade_t:new e.aI(t,i.u_fade_t),u_opacity:new e.aI(t,i.u_opacity),u_image0:new e.aH(t,i.u_image0),u_image1:new e.aH(t,i.u_image1),u_brightness_low:new e.aI(t,i.u_brightness_low),u_brightness_high:new e.aI(t,i.u_brightness_high),u_saturation_factor:new e.aI(t,i.u_saturation_factor),u_contrast_factor:new e.aI(t,i.u_contrast_factor),u_spin_weights:new e.aN(t,i.u_spin_weights)}),symbolIcon:(t,i)=>({u_is_size_zoom_constant:new e.aH(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aH(t,i.u_is_size_feature_constant),u_size_t:new e.aI(t,i.u_size_t),u_size:new e.aI(t,i.u_size),u_camera_to_center_distance:new e.aI(t,i.u_camera_to_center_distance),u_pitch:new e.aI(t,i.u_pitch),u_rotate_symbol:new e.aH(t,i.u_rotate_symbol),u_aspect_ratio:new e.aI(t,i.u_aspect_ratio),u_fade_change:new e.aI(t,i.u_fade_change),u_matrix:new e.aJ(t,i.u_matrix),u_label_plane_matrix:new e.aJ(t,i.u_label_plane_matrix),u_coord_matrix:new e.aJ(t,i.u_coord_matrix),u_is_text:new e.aH(t,i.u_is_text),u_pitch_with_map:new e.aH(t,i.u_pitch_with_map),u_is_along_line:new e.aH(t,i.u_is_along_line),u_is_variable_anchor:new e.aH(t,i.u_is_variable_anchor),u_texsize:new e.aO(t,i.u_texsize),u_texture:new e.aH(t,i.u_texture),u_translation:new e.aO(t,i.u_translation),u_pitched_scale:new e.aI(t,i.u_pitched_scale)}),symbolSDF:(t,i)=>({u_is_size_zoom_constant:new e.aH(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aH(t,i.u_is_size_feature_constant),u_size_t:new e.aI(t,i.u_size_t),u_size:new e.aI(t,i.u_size),u_camera_to_center_distance:new e.aI(t,i.u_camera_to_center_distance),u_pitch:new e.aI(t,i.u_pitch),u_rotate_symbol:new e.aH(t,i.u_rotate_symbol),u_aspect_ratio:new e.aI(t,i.u_aspect_ratio),u_fade_change:new e.aI(t,i.u_fade_change),u_matrix:new e.aJ(t,i.u_matrix),u_label_plane_matrix:new e.aJ(t,i.u_label_plane_matrix),u_coord_matrix:new e.aJ(t,i.u_coord_matrix),u_is_text:new e.aH(t,i.u_is_text),u_pitch_with_map:new e.aH(t,i.u_pitch_with_map),u_is_along_line:new e.aH(t,i.u_is_along_line),u_is_variable_anchor:new e.aH(t,i.u_is_variable_anchor),u_texsize:new e.aO(t,i.u_texsize),u_texture:new e.aH(t,i.u_texture),u_gamma_scale:new e.aI(t,i.u_gamma_scale),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_is_halo:new e.aH(t,i.u_is_halo),u_translation:new e.aO(t,i.u_translation),u_pitched_scale:new e.aI(t,i.u_pitched_scale)}),symbolTextAndIcon:(t,i)=>({u_is_size_zoom_constant:new e.aH(t,i.u_is_size_zoom_constant),u_is_size_feature_constant:new e.aH(t,i.u_is_size_feature_constant),u_size_t:new e.aI(t,i.u_size_t),u_size:new e.aI(t,i.u_size),u_camera_to_center_distance:new e.aI(t,i.u_camera_to_center_distance),u_pitch:new e.aI(t,i.u_pitch),u_rotate_symbol:new e.aH(t,i.u_rotate_symbol),u_aspect_ratio:new e.aI(t,i.u_aspect_ratio),u_fade_change:new e.aI(t,i.u_fade_change),u_matrix:new e.aJ(t,i.u_matrix),u_label_plane_matrix:new e.aJ(t,i.u_label_plane_matrix),u_coord_matrix:new e.aJ(t,i.u_coord_matrix),u_is_text:new e.aH(t,i.u_is_text),u_pitch_with_map:new e.aH(t,i.u_pitch_with_map),u_is_along_line:new e.aH(t,i.u_is_along_line),u_is_variable_anchor:new e.aH(t,i.u_is_variable_anchor),u_texsize:new e.aO(t,i.u_texsize),u_texsize_icon:new e.aO(t,i.u_texsize_icon),u_texture:new e.aH(t,i.u_texture),u_texture_icon:new e.aH(t,i.u_texture_icon),u_gamma_scale:new e.aI(t,i.u_gamma_scale),u_device_pixel_ratio:new e.aI(t,i.u_device_pixel_ratio),u_is_halo:new e.aH(t,i.u_is_halo),u_translation:new e.aO(t,i.u_translation),u_pitched_scale:new e.aI(t,i.u_pitched_scale)}),background:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_opacity:new e.aI(t,i.u_opacity),u_color:new e.aL(t,i.u_color)}),backgroundPattern:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_opacity:new e.aI(t,i.u_opacity),u_image:new e.aH(t,i.u_image),u_pattern_tl_a:new e.aO(t,i.u_pattern_tl_a),u_pattern_br_a:new e.aO(t,i.u_pattern_br_a),u_pattern_tl_b:new e.aO(t,i.u_pattern_tl_b),u_pattern_br_b:new e.aO(t,i.u_pattern_br_b),u_texsize:new e.aO(t,i.u_texsize),u_mix:new e.aI(t,i.u_mix),u_pattern_size_a:new e.aO(t,i.u_pattern_size_a),u_pattern_size_b:new e.aO(t,i.u_pattern_size_b),u_scale_a:new e.aI(t,i.u_scale_a),u_scale_b:new e.aI(t,i.u_scale_b),u_pixel_coord_upper:new e.aO(t,i.u_pixel_coord_upper),u_pixel_coord_lower:new e.aO(t,i.u_pixel_coord_lower),u_tile_units_to_pixels:new e.aI(t,i.u_tile_units_to_pixels)}),terrain:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_texture:new e.aH(t,i.u_texture),u_ele_delta:new e.aI(t,i.u_ele_delta),u_fog_matrix:new e.aJ(t,i.u_fog_matrix),u_fog_color:new e.aL(t,i.u_fog_color),u_fog_ground_blend:new e.aI(t,i.u_fog_ground_blend),u_fog_ground_blend_opacity:new e.aI(t,i.u_fog_ground_blend_opacity),u_horizon_color:new e.aL(t,i.u_horizon_color),u_horizon_fog_blend:new e.aI(t,i.u_horizon_fog_blend)}),terrainDepth:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_ele_delta:new e.aI(t,i.u_ele_delta)}),terrainCoords:(t,i)=>({u_matrix:new e.aJ(t,i.u_matrix),u_texture:new e.aH(t,i.u_texture),u_terrain_coords_id:new e.aI(t,i.u_terrain_coords_id),u_ele_delta:new e.aI(t,i.u_ele_delta)}),sky:(t,i)=>({u_sky_color:new e.aL(t,i.u_sky_color),u_horizon_color:new e.aL(t,i.u_horizon_color),u_horizon:new e.aI(t,i.u_horizon),u_sky_horizon_blend:new e.aI(t,i.u_sky_horizon_blend)})};class $e{constructor(t,e,i){this.context=t;const a=t.gl;this.buffer=a.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;}bind(){this.context.bindElementBuffer.set(this.buffer);}updateData(t){const e=this.context.gl;if(!this.dynamicDraw)throw new Error(\"Attempted to update data while not in dynamic mode.\");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer);}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer);}}const Xe={Int8:\"BYTE\",Uint8:\"UNSIGNED_BYTE\",Int16:\"SHORT\",Uint16:\"UNSIGNED_SHORT\",Int32:\"INT\",Uint32:\"UNSIGNED_INT\",Float32:\"FLOAT\"};class Ke{constructor(t,e,i,a){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=a,this.context=t;const s=t.gl;this.buffer=s.createBuffer(),t.bindVertexBuffer.set(this.buffer),s.bufferData(s.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?s.DYNAMIC_DRAW:s.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer;}bind(){this.context.bindVertexBuffer.set(this.buffer);}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer);}enableAttributes(t,e){for(let i=0;i0){const i=e.H();e.aQ(i,m.placementInvProjMatrix,t.transform.glCoordMatrix),e.aQ(i,i,m.placementViewportMatrix),h.push({circleArray:g,circleOffset:u,transform:p.posMatrix,invTransform:i,coord:p}),c+=g.length/4,u=c;}f&&l.draw(r,n.LINES,Oi.disabled,Ui.disabled,t.colorModeForRenderPass(),ji.disabled,{u_matrix:p.posMatrix,u_pixel_extrude_scale:[1/(d=t.transform).width,1/d.height]},t.style.map.terrain&&t.style.map.terrain.getTerrainData(p),a.id,f.layoutVertexBuffer,f.indexBuffer,f.segments,null,t.transform.zoom,null,null,f.collisionVertexBuffer);}var d;if(!o||!h.length)return;const _=t.useProgram(\"collisionCircle\"),p=new e.aR;p.resize(4*c),p._trim();let m=0;for(const t of h)for(let e=0;e=0&&(v[x.associatedIconIndex]={shiftedAnchor:D,angle:M});}else Rt(x.numGlyphs,f);}if(c){g.clear();const i=t.icon.placedSymbolArray;for(let t=0;tt.style.map.terrain.getElevation(l,e,i):null,i=\"map\"===a.layout.get(\"text-rotation-alignment\");wt(h,l.posMatrix,t,o,U,Z,v,c,i,f,l.toUnwrapped(),m.width,m.height,q,e);}const H=l.posMatrix,W=o&&E||G,$=x||W?Vi:U,X=j,K=_&&0!==a.paint.get(o?\"text-halo-width\":\"icon-halo-width\").constantOr(1);let J;J=_?h.iconsInText?Ve(I.kind,D,y,v,x,W,t,H,$,X,q,A,F,C):qe(I.kind,D,y,v,x,W,t,H,$,X,q,o,A,!0,C):Ze(I.kind,D,y,v,x,W,t,H,$,X,q,o,A,C);const Y={program:z,buffers:u,uniformValues:J,atlasTexture:R,atlasTextureIcon:B,atlasInterpolation:k,atlasInterpolationIcon:L,isSDF:_,hasHalo:K};if(w&&h.canOverlap){T=!0;const t=u.segments.get();for(const i of t)P.push({segments:new e.a0([i]),sortKey:i.sortKey,state:Y,terrainData:M});}else P.push({segments:u.segments,sortKey:0,state:Y,terrainData:M});}T&&P.sort(((t,e)=>t.sortKey-e.sortKey));for(const e of P){const i=e.state;if(_.activeTexture.set(p.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,p.CLAMP_TO_EDGE),i.atlasTextureIcon&&(_.activeTexture.set(p.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,p.CLAMP_TO_EDGE)),i.isSDF){const s=i.uniformValues;i.hasHalo&&(s.u_is_halo=1,Ki(i.buffers,e.segments,a,t,i.program,I,u,d,s,e.terrainData)),s.u_is_halo=0;}Ki(i.buffers,e.segments,a,t,i.program,I,u,d,i.uniformValues,e.terrainData);}}function Ki(t,e,i,a,s,o,r,n,l,h){const c=a.context;s.draw(c,c.gl.TRIANGLES,o,r,n,ji.disabled,l,h,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,a.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer);}function Ji(t,i,a,s){const o=t.context,r=o.gl,n=Ui.disabled,l=new Fi([r.ONE,r.ONE],e.aM.transparent,[!0,!0,!0,!0]),h=i.getBucket(a);if(!h)return;const c=s.key;let u=a.heatmapFbos.get(c);u||(u=Qi(o,i.tileSize,i.tileSize),a.heatmapFbos.set(c,u)),o.bindFramebuffer.set(u.framebuffer),o.viewport.set([0,0,i.tileSize,i.tileSize]),o.clear({color:e.aM.transparent});const d=h.programConfigurations.get(a.id),_=t.useProgram(\"heatmap\",d),p=t.style.map.terrain.getTerrainData(s);_.draw(o,r.TRIANGLES,Oi.disabled,n,l,ji.disabled,Me(s.posMatrix,i,t.transform.zoom,a.paint.get(\"heatmap-intensity\")),p,a.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,a.paint,t.transform.zoom,d);}function Yi(t,e,i){const a=t.context,s=a.gl;a.setColorMode(t.colorModeForRenderPass());const o=ta(a,e),r=i.key,n=e.heatmapFbos.get(r);n&&(a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,n.colorAttachment.get()),a.activeTexture.set(s.TEXTURE1),o.bind(s.LINEAR,s.CLAMP_TO_EDGE),t.useProgram(\"heatmapTexture\").draw(a,s.TRIANGLES,Oi.disabled,Ui.disabled,t.colorModeForRenderPass(),ji.disabled,Ae(t,e,0,1),null,e.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,e.paint,t.transform.zoom),n.destroy(),e.heatmapFbos.delete(r));}function Qi(t,e,i){var a,s;const o=t.gl,r=o.createTexture();o.bindTexture(o.TEXTURE_2D,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR);const n=null!==(a=t.HALF_FLOAT)&&void 0!==a?a:o.UNSIGNED_BYTE,l=null!==(s=t.RGBA16F)&&void 0!==s?s:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,l,e,i,0,o.RGBA,n,null);const h=t.createFramebuffer(e,i,!1,!1);return h.colorAttachment.set(r),h}function ta(t,e){return e.colorRampTexture||(e.colorRampTexture=new b(t,e.colorRamp,t.gl.RGBA)),e.colorRampTexture}function ea(t,e,i,a,s){if(!i||!a||!a.imageAtlas)return;const o=a.imageAtlas.patternPositions;let r=o[i.to.toString()],n=o[i.from.toString()];if(!r&&n&&(r=n),!n&&r&&(n=r),!r||!n){const t=s.getPaintProperty(e);r=o[t],n=o[t];}r&&n&&t.setConstantPatternPositions(r,n);}function ia(t,e,i,a,s,o,r){const n=t.context.gl,l=\"fill-pattern\",h=i.paint.get(l),c=h&&h.constantOr(1),u=i.getCrossfadeParameters();let d,_,p,m,f;r?(_=c&&!i.getPaintProperty(\"fill-outline-color\")?\"fillOutlinePattern\":\"fillOutline\",d=n.LINES):(_=c?\"fillPattern\":\"fill\",d=n.TRIANGLES);const g=h.constantOr(null);for(const h of a){const a=e.getTile(h);if(c&&!a.patternsLoaded())continue;const v=a.getBucket(i);if(!v)continue;const x=v.programConfigurations.get(i.id),y=t.useProgram(_,x),b=t.style.map.terrain&&t.style.map.terrain.getTerrainData(h);c&&(t.context.activeTexture.set(n.TEXTURE0),a.imageAtlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE),x.updatePaintBuffers(u)),ea(x,l,g,a,i);const w=b?h:null,T=t.translatePosMatrix(w?w.posMatrix:h.posMatrix,a,i.paint.get(\"fill-translate\"),i.paint.get(\"fill-translate-anchor\"));if(r){m=v.indexBuffer2,f=v.segments2;const e=[n.drawingBufferWidth,n.drawingBufferHeight];p=\"fillOutlinePattern\"===_&&c?Pe(T,t,u,a,e):Ee(T,e);}else m=v.indexBuffer,f=v.segments,p=c?Ie(T,t,u,a):Te(T);y.draw(t.context,d,s,t.stencilModeForClipping(h),o,ji.disabled,p,b,i.id,v.layoutVertexBuffer,m,f,i.paint,t.transform.zoom,x);}}function aa(t,e,i,a,s,o,r){const n=t.context,l=n.gl,h=\"fill-extrusion-pattern\",c=i.paint.get(h),u=c.constantOr(1),d=i.getCrossfadeParameters(),_=i.paint.get(\"fill-extrusion-opacity\"),p=c.constantOr(null);for(const c of a){const a=e.getTile(c),m=a.getBucket(i);if(!m)continue;const f=t.style.map.terrain&&t.style.map.terrain.getTerrainData(c),g=m.programConfigurations.get(i.id),v=t.useProgram(u?\"fillExtrusionPattern\":\"fillExtrusion\",g);u&&(t.context.activeTexture.set(l.TEXTURE0),a.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),g.updatePaintBuffers(d)),ea(g,h,p,a,i);const x=t.translatePosMatrix(c.posMatrix,a,i.paint.get(\"fill-extrusion-translate\"),i.paint.get(\"fill-extrusion-translate-anchor\")),y=i.paint.get(\"fill-extrusion-vertical-gradient\"),b=u?we(x,t,y,_,c,d,a):be(x,t,y,_);v.draw(n,n.gl.TRIANGLES,s,o,r,ji.backCCW,b,f,i.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,i.paint,t.transform.zoom,g,t.style.map.terrain&&m.centroidVertexBuffer);}}function sa(t,e,i,a,s,o,r){const n=t.context,l=n.gl,h=i.fbo;if(!h)return;const c=t.useProgram(\"hillshade\"),u=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);n.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,h.colorAttachment.get()),c.draw(n,l.TRIANGLES,s,o,r,ji.disabled,((t,e,i,a)=>{const s=i.paint.get(\"hillshade-shadow-color\"),o=i.paint.get(\"hillshade-highlight-color\"),r=i.paint.get(\"hillshade-accent-color\");let n=i.paint.get(\"hillshade-illumination-direction\")*(Math.PI/180);\"viewport\"===i.paint.get(\"hillshade-illumination-anchor\")&&(n-=t.transform.angle);const l=!t.options.moving;return {u_matrix:a?a.posMatrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:Re(0,e.tileID),u_light:[i.paint.get(\"hillshade-exaggeration\"),n],u_shadow:s,u_highlight:o,u_accent:r}})(t,i,a,u?e:null),u,a.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments);}function oa(t,i,a,s,o,r){const n=t.context,l=n.gl,h=i.dem;if(h&&h.data){const c=h.dim,u=h.stride,d=h.getPixels();if(n.activeTexture.set(l.TEXTURE1),n.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(u),i.demTexture){const t=i.demTexture;t.update(d,{premultiply:!1}),t.bind(l.NEAREST,l.CLAMP_TO_EDGE);}else i.demTexture=new b(n,d,l.RGBA,{premultiply:!1}),i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);n.activeTexture.set(l.TEXTURE0);let _=i.fbo;if(!_){const t=new b(n,{width:c,height:c,data:null},l.RGBA);t.bind(l.LINEAR,l.CLAMP_TO_EDGE),_=i.fbo=n.createFramebuffer(c,c,!0,!1),_.colorAttachment.set(t.texture);}n.bindFramebuffer.set(_.framebuffer),n.viewport.set([0,0,c,c]),t.useProgram(\"hillshadePrepare\").draw(n,l.TRIANGLES,s,o,r,ji.disabled,((t,i)=>{const a=i.stride,s=e.H();return e.aP(s,0,e.X,-e.X,0,0,1),e.J(s,s,[0,-e.X,0]),{u_matrix:s,u_image:1,u_dimension:[a,a],u_zoom:t.overscaledZ,u_unpack:i.getUnpackVector()}})(i.tileID,h),null,a.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),i.needsHillshadePrepare=!1;}}function ra(t,i,a,s,r,n){const l=s.paint.get(\"raster-fade-duration\");if(!n&&l>0){const s=o.now(),n=(s-t.timeAdded)/l,h=i?(s-i.timeAdded)/l:-1,c=a.getSource(),u=r.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),d=!i||Math.abs(i.tileID.overscaledZ-u)>Math.abs(t.tileID.overscaledZ-u),_=d&&t.refreshedUponExpiration?1:e.ac(d?n:1-h,0,1);return t.refreshedUponExpiration&&n>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-_}:{opacity:_,mix:0}}return {opacity:1,mix:0}}const na=new e.aM(1,0,0,1),la=new e.aM(0,1,0,1),ha=new e.aM(0,0,1,1),ca=new e.aM(1,0,1,1),ua=new e.aM(0,1,1,1);function da(t,e,i,a){pa(t,0,e+i/2,t.transform.width,i,a);}function _a(t,e,i,a){pa(t,e-i/2,0,i,t.transform.height,a);}function pa(t,e,i,a,s,o){const r=t.context,n=r.gl;n.enable(n.SCISSOR_TEST),n.scissor(e*t.pixelRatio,i*t.pixelRatio,a*t.pixelRatio,s*t.pixelRatio),r.clear({color:o}),n.disable(n.SCISSOR_TEST);}function ma(t,i,a){const s=t.context,o=s.gl,r=a.posMatrix,n=t.useProgram(\"debug\"),l=Oi.disabled,h=Ui.disabled,c=t.colorModeForRenderPass(),u=\"$debug\",d=t.style.map.terrain&&t.style.map.terrain.getTerrainData(a);s.activeTexture.set(o.TEXTURE0);const _=i.getTileByID(a.key).latestRawTileData,p=Math.floor((_&&_.byteLength||0)/1024),m=i.getTile(a).tileSize,f=512/Math.min(m,512)*(a.overscaledZ/t.transform.zoom)*.5;let g=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(g+=` => ${a.overscaledZ}`),function(t,e){t.initDebugOverlayCanvas();const i=t.debugOverlayCanvas,a=t.context.gl,s=t.debugOverlayCanvas.getContext(\"2d\");s.clearRect(0,0,i.width,i.height),s.shadowColor=\"white\",s.shadowBlur=2,s.lineWidth=1.5,s.strokeStyle=\"white\",s.textBaseline=\"top\",s.font=\"bold 36px Open Sans, sans-serif\",s.fillText(e,5,5),s.strokeText(e,5,5),t.debugOverlayTexture.update(i),t.debugOverlayTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE);}(t,`${g} ${p}kB`),n.draw(s,o.TRIANGLES,l,h,Fi.alphaBlended,ji.disabled,ze(r,e.aM.transparent,f),null,u,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),n.draw(s,o.LINE_STRIP,l,h,c,ji.disabled,ze(r,e.aM.red),d,u,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments);}function fa(t,e,i){const a=t.context,s=a.gl,o=t.colorModeForRenderPass(),r=new Oi(s.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D),n=t.useProgram(\"terrain\"),l=e.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,t.width,t.height]);for(const h of i){const i=t.renderToTexture.getTexture(h),c=e.getTerrainData(h.tileID);a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,i.texture);const u=t.transform.calculatePosMatrix(h.tileID.toUnwrapped()),d=e.getMeshFrameDelta(t.transform.zoom),_=t.transform.calculateFogMatrix(h.tileID.toUnwrapped()),p=ge(u,d,_,t.style.sky,t.transform.pitch);n.draw(a,s.TRIANGLES,r,Ui.disabled,o,ji.backCCW,p,c,\"terrain\",l.vertexBuffer,l.indexBuffer,l.segments);}}class ga{constructor(t,e,i){this.vertexBuffer=t,this.indexBuffer=e,this.segments=i;}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null;}}class va{constructor(t,i){this.context=new Bi(t),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:e.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ut.maxUnderzooming+ut.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new he;}resize(t,e,i){if(this.width=Math.floor(t*i),this.height=Math.floor(e*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const t of this.style._order)this.style._layers[t].resize();}setup(){const t=this.context,i=new e.aX;i.emplaceBack(0,0),i.emplaceBack(e.X,0),i.emplaceBack(0,e.X),i.emplaceBack(e.X,e.X),this.tileExtentBuffer=t.createVertexBuffer(i,_e.members),this.tileExtentSegments=e.a0.simpleSegment(0,0,4,2);const a=new e.aX;a.emplaceBack(0,0),a.emplaceBack(e.X,0),a.emplaceBack(0,e.X),a.emplaceBack(e.X,e.X),this.debugBuffer=t.createVertexBuffer(a,_e.members),this.debugSegments=e.a0.simpleSegment(0,0,4,5);const s=new e.$;s.emplaceBack(0,0,0,0),s.emplaceBack(e.X,0,e.X,0),s.emplaceBack(0,e.X,0,e.X),s.emplaceBack(e.X,e.X,e.X,e.X),this.rasterBoundsBuffer=t.createVertexBuffer(s,Y.members),this.rasterBoundsSegments=e.a0.simpleSegment(0,0,4,2);const o=new e.aX;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,_e.members),this.viewportSegments=e.a0.simpleSegment(0,0,4,2);const r=new e.aZ;r.emplaceBack(0),r.emplaceBack(1),r.emplaceBack(3),r.emplaceBack(2),r.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(r);const n=new e.aY;n.emplaceBack(0,1,2),n.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(n);const l=this.context.gl;this.stencilClearMode=new Ui({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO);}clearStencil(){const t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=e.H();e.aP(a,0,this.width,this.height,0,0,1),e.K(a,a,[i.drawingBufferWidth,i.drawingBufferHeight,0]),this.useProgram(\"clippingMask\").draw(t,i.TRIANGLES,Oi.disabled,this.stencilClearMode,Fi.disabled,ji.disabled,De(a),null,\"$clipping\",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments);}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;const i=this.context,a=i.gl;this.nextStencilID+e.length>256&&this.clearStencil(),i.setColorMode(Fi.disabled),i.setDepthMode(Oi.disabled);const s=this.useProgram(\"clippingMask\");this._tileClippingMaskIDs={};for(const t of e){const e=this._tileClippingMaskIDs[t.key]=this.nextStencilID++,o=this.style.map.terrain&&this.style.map.terrain.getTerrainData(t);s.draw(i,a.TRIANGLES,Oi.disabled,new Ui({func:a.ALWAYS,mask:0},e,255,a.KEEP,a.KEEP,a.REPLACE),Fi.disabled,ji.disabled,De(t.posMatrix),o,\"$clipping\",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments);}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,e=this.context.gl;return new Ui({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){const e=this.context.gl;return new Ui({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){const e=this.context.gl,i=t.sort(((t,e)=>e.overscaledZ-t.overscaledZ)),a=i[i.length-1].overscaledZ,s=i[0].overscaledZ-a+1;if(s>1){this.currentStencilSource=void 0,this.nextStencilID+s>256&&this.clearStencil();const t={};for(let i=0;i({u_sky_color:t.properties.get(\"sky-color\"),u_horizon_color:t.properties.get(\"horizon-color\"),u_horizon:(e.height/2+e.getHorizon())*i,u_sky_horizon_blend:t.properties.get(\"sky-horizon-blend\")*e.height/2*i}))(i,t.style.map.transform,t.pixelRatio),r=new Oi(s.LEQUAL,Oi.ReadWrite,[0,1]),n=Ui.disabled,l=t.colorModeForRenderPass(),h=t.useProgram(\"sky\");if(!i.mesh){const t=new e.aX;t.emplaceBack(-1,-1),t.emplaceBack(1,-1),t.emplaceBack(1,1),t.emplaceBack(-1,1);const s=new e.aY;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),i.mesh=new ga(a.createVertexBuffer(t,_e.members),a.createIndexBuffer(s),e.a0.simpleSegment(0,0,t.length,s.length));}h.draw(a,s.TRIANGLES,r,n,l,ji.disabled,o,void 0,\"sky\",i.mesh.vertexBuffer,i.mesh.indexBuffer,i.mesh.segments);}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass=\"opaque\",this.currentLayer=a.length-1;this.currentLayer>=0;this.currentLayer--){const t=this.style._layers[a[this.currentLayer]],e=s[t.source],i=r[t.source];this._renderTileClippingMasks(t,i),this.renderLayer(this,e,t,i);}for(this.renderPass=\"translucent\",this.currentLayer=0;this.currentLayeri.source&&!i.isHidden(e)?[t.sourceCaches[i.source]]:[])),s=a.filter((t=>\"vector\"===t.getSource().type)),o=a.filter((t=>\"vector\"!==t.getSource().type)),r=t=>{(!i||i.getSource().maxzoomr(t))),i||o.forEach((t=>r(t))),i}(this.style,this.transform.zoom);t&&function(t,e,i){for(let a=0;a0),s&&(e.b0(i,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(t,i){const a=t.context,s=a.gl,o=Fi.unblended,r=new Oi(s.LEQUAL,Oi.ReadWrite,[0,1]),n=i.getTerrainMesh(),l=i.sourceCache.getRenderableTiles(),h=t.useProgram(\"terrainDepth\");a.bindFramebuffer.set(i.getFramebuffer(\"depth\").framebuffer),a.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),a.clear({color:e.aM.transparent,depth:1});for(const e of l){const l=i.getTerrainData(e.tileID),c={u_matrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped()),u_ele_delta:i.getMeshFrameDelta(t.transform.zoom)};h.draw(a,s.TRIANGLES,r,Ui.disabled,o,ji.backCCW,c,l,\"terrain\",n.vertexBuffer,n.indexBuffer,n.segments);}a.bindFramebuffer.set(null),a.viewport.set([0,0,t.width,t.height]);}(this,this.style.map.terrain),function(t,i){const a=t.context,s=a.gl,o=Fi.unblended,r=new Oi(s.LEQUAL,Oi.ReadWrite,[0,1]),n=i.getTerrainMesh(),l=i.getCoordsTexture(),h=i.sourceCache.getRenderableTiles(),c=t.useProgram(\"terrainCoords\");a.bindFramebuffer.set(i.getFramebuffer(\"coords\").framebuffer),a.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),a.clear({color:e.aM.transparent,depth:1}),i.coordsIndex=[];for(const e of h){const h=i.getTerrainData(e.tileID);a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,l.texture);const u={u_matrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped()),u_terrain_coords_id:(255-i.coordsIndex.length)/255,u_texture:0,u_ele_delta:i.getMeshFrameDelta(t.transform.zoom)};c.draw(a,s.TRIANGLES,r,Ui.disabled,o,ji.backCCW,u,h,\"terrain\",n.vertexBuffer,n.indexBuffer,n.segments),i.coordsIndex.push(e.tileID.key);}a.bindFramebuffer.set(null),a.viewport.set([0,0,t.width,t.height]);}(this,this.style.map.terrain));}renderLayer(t,i,a,s){if(!a.isHidden(this.transform.zoom)&&(\"background\"===a.type||\"custom\"===a.type||(s||[]).length))switch(this.id=a.id,a.type){case\"symbol\":!function(t,i,a,s,o){if(\"translucent\"!==t.renderPass)return;const r=Ui.disabled,n=t.colorModeForRenderPass();(a._unevaluatedLayout.hasValue(\"text-variable-anchor\")||a._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"))&&function(t,i,a,s,o,r,n,l,h){const c=i.transform,u=ie(),d=\"map\"===o,_=\"map\"===r;for(const o of t){const t=s.getTile(o),r=t.getBucket(a);if(!r||!r.text||!r.text.segments.get().length)continue;const p=e.ag(r.textSizeData,c.zoom),m=Bt(t,1,i.transform.zoom),f=gt(o.posMatrix,_,d,i.transform,m),g=\"none\"!==a.layout.get(\"icon-text-fit\")&&r.hasIconData();if(p){const e=Math.pow(2,c.zoom-t.tileID.overscaledZ),a=i.style.map.terrain?(t,e)=>i.style.map.terrain.getElevation(o,t,e):null,s=u.translatePosition(c,t,n,l);Wi(r,d,_,h,c,f,o.posMatrix,e,p,g,u,s,o.toUnwrapped(),a);}}}(s,t,a,i,a.layout.get(\"text-rotation-alignment\"),a.layout.get(\"text-pitch-alignment\"),a.paint.get(\"text-translate\"),a.paint.get(\"text-translate-anchor\"),o),0!==a.paint.get(\"icon-opacity\").constantOr(1)&&Xi(t,i,a,s,!1,a.paint.get(\"icon-translate\"),a.paint.get(\"icon-translate-anchor\"),a.layout.get(\"icon-rotation-alignment\"),a.layout.get(\"icon-pitch-alignment\"),a.layout.get(\"icon-keep-upright\"),r,n),0!==a.paint.get(\"text-opacity\").constantOr(1)&&Xi(t,i,a,s,!0,a.paint.get(\"text-translate\"),a.paint.get(\"text-translate-anchor\"),a.layout.get(\"text-rotation-alignment\"),a.layout.get(\"text-pitch-alignment\"),a.layout.get(\"text-keep-upright\"),r,n),i.map.showCollisionBoxes&&(qi(t,i,a,s,!0),qi(t,i,a,s,!1));}(t,i,a,s,this.style.placement.variableOffsets);break;case\"circle\":!function(t,i,a,s){if(\"translucent\"!==t.renderPass)return;const o=a.paint.get(\"circle-opacity\"),r=a.paint.get(\"circle-stroke-width\"),n=a.paint.get(\"circle-stroke-opacity\"),l=!a.layout.get(\"circle-sort-key\").isConstant();if(0===o.constantOr(1)&&(0===r.constantOr(1)||0===n.constantOr(1)))return;const h=t.context,c=h.gl,u=t.depthModeForSublayer(0,Oi.ReadOnly),d=Ui.disabled,_=t.colorModeForRenderPass(),p=[];for(let o=0;ot.sortKey-e.sortKey));for(const e of p){const{programConfiguration:i,program:s,layoutVertexBuffer:o,indexBuffer:r,uniformValues:n,terrainData:l}=e.state;s.draw(h,c.TRIANGLES,u,d,_,ji.disabled,n,l,a.id,o,r,e.segments,a.paint,t.transform.zoom,i);}}(t,i,a,s);break;case\"heatmap\":!function(t,i,a,s){if(0===a.paint.get(\"heatmap-opacity\"))return;const o=t.context;if(t.style.map.terrain){for(const e of s){const s=i.getTile(e);i.hasRenderableParent(e)||(\"offscreen\"===t.renderPass?Ji(t,s,a,e):\"translucent\"===t.renderPass&&Yi(t,a,e));}o.viewport.set([0,0,t.width,t.height]);}else \"offscreen\"===t.renderPass?function(t,i,a,s){const o=t.context,r=o.gl,n=Ui.disabled,l=new Fi([r.ONE,r.ONE],e.aM.transparent,[!0,!0,!0,!0]);((function(t,i,a){const s=t.gl;t.activeTexture.set(s.TEXTURE1),t.viewport.set([0,0,i.width/4,i.height/4]);let o=a.heatmapFbos.get(e.aU);o?(s.bindTexture(s.TEXTURE_2D,o.colorAttachment.get()),t.bindFramebuffer.set(o.framebuffer)):(o=Qi(t,i.width/4,i.height/4),a.heatmapFbos.set(e.aU,o));}))(o,t,a),o.clear({color:e.aM.transparent});for(let e=0;e20&&o.texParameterf(o.TEXTURE_2D,s.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,s.extTextureFilterAnisotropicMax);const y=t.style.map.terrain&&t.style.map.terrain.getTerrainData(a),b=y?a:null,w=b?b.posMatrix:t.transform.calculatePosMatrix(a.toUnwrapped(),d),T=Ue(w,v||[0,0],g||1,f,i);r instanceof Q?n.draw(s,o.TRIANGLES,c,Ui.disabled,l,ji.disabled,T,y,i.id,r.boundsBuffer,t.quadTriangleIndexBuffer,r.boundsSegments):n.draw(s,o.TRIANGLES,c,h[a.overscaledZ],l,ji.disabled,T,y,i.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments);}}(t,i,a,s);break;case\"background\":!function(t,e,i,a){const s=i.paint.get(\"background-color\"),o=i.paint.get(\"background-opacity\");if(0===o)return;const r=t.context,n=r.gl,l=t.transform,h=l.tileSize,c=i.paint.get(\"background-pattern\");if(t.isPatternMissing(c))return;const u=!c&&1===s.a&&1===o&&t.opaquePassEnabledForLayer()?\"opaque\":\"translucent\";if(t.renderPass!==u)return;const d=Ui.disabled,_=t.depthModeForSublayer(0,\"opaque\"===u?Oi.ReadWrite:Oi.ReadOnly),p=t.colorModeForRenderPass(),m=t.useProgram(c?\"backgroundPattern\":\"background\"),f=a||l.coveringTiles({tileSize:h,terrain:t.style.map.terrain});c&&(r.activeTexture.set(n.TEXTURE0),t.imageManager.bind(t.context));const g=i.getCrossfadeParameters();for(const e of f){const l=a?e.posMatrix:t.transform.calculatePosMatrix(e.toUnwrapped()),u=c?He(l,o,t,c,{tileID:e,tileSize:h},g):Ge(l,o,s),f=t.style.map.terrain&&t.style.map.terrain.getTerrainData(e);m.draw(r,n.TRIANGLES,_,d,p,ji.disabled,u,f,i.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments);}}(t,0,a,s);break;case\"custom\":!function(t,e,i){const a=t.context,s=i.implementation;if(\"offscreen\"===t.renderPass){const e=s.prerender;e&&(t.setCustomLayerDefaults(),a.setColorMode(t.colorModeForRenderPass()),e.call(s,a.gl,t.transform.customLayerMatrix()),a.setDirty(),t.setBaseState());}else if(\"translucent\"===t.renderPass){t.setCustomLayerDefaults(),a.setColorMode(t.colorModeForRenderPass()),a.setStencilMode(Ui.disabled);const e=\"3d\"===s.renderingMode?new Oi(t.context.gl.LEQUAL,Oi.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,Oi.ReadOnly);a.setDepthMode(e),s.render(a.gl,t.transform.customLayerMatrix(),{farZ:t.transform.farZ,nearZ:t.transform.nearZ,fov:t.transform._fov,modelViewProjectionMatrix:t.transform.modelViewProjectionMatrix,projectionMatrix:t.transform.projectionMatrix}),a.setDirty(),t.setBaseState(),a.bindFramebuffer.set(null);}}(t,0,a);}}translatePosMatrix(t,i,a,s,o){if(!a[0]&&!a[1])return t;const r=o?\"map\"===s?this.transform.angle:0:\"viewport\"===s?-this.transform.angle:0;if(r){const t=Math.sin(r),e=Math.cos(r);a=[a[0]*e-a[1]*t,a[0]*t+a[1]*e];}const n=[o?a[0]:Bt(i,a[0],this.transform.zoom),o?a[1]:Bt(i,a[1],this.transform.zoom),0],l=new Float32Array(16);return e.J(l,t,n),l}saveTileTexture(t){const e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t];}getTileTexture(t){const e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return !1;if(!t.from||!t.to)return !0;const e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return !e||!i}useProgram(t,e){this.cache=this.cache||{};const i=t+(e?e.cacheKey:\"\")+(this._showOverdrawInspector?\"/overdraw\":\"\")+(this.style.map.terrain?\"/terrain\":\"\");return this.cache[i]||(this.cache[i]=new xe(this.context,pe[t],e,We[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD);}initDebugOverlayCanvas(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement(\"canvas\"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new b(this.context,this.debugOverlayCanvas,this.context.gl.RGBA));}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy();}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}class xa{constructor(t,e){this.points=t,this.planes=e;}static fromInvProjectionMatrix(t,i,a){const s=Math.pow(2,a),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((a=>{const o=1/(a=e.af([],a,t))[3]/i*s;return e.b1(a,a,[o,o,1/a[3],o])})),r=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=function(t,e){var i=e[0],a=e[1],s=e[2],o=i*i+a*a+s*s;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}([],function(t,e,i){var a=e[0],s=e[1],o=e[2],r=i[0],n=i[1],l=i[2];return t[0]=s*l-o*n,t[1]=o*r-a*l,t[2]=a*n-s*r,t}([],g([],o[t[0]],o[t[1]]),g([],o[t[2]],o[t[1]]))),i=-((a=e)[0]*(s=o[t[1]])[0]+a[1]*s[1]+a[2]*s[2]);var a,s;return e.concat(i)}));return new xa(o,r)}}class ya{constructor(t,e){this.min=t,this.max=e,this.center=function(t,e,i){return t[0]=.5*e[0],t[1]=.5*e[1],t[2]=.5*e[2],t}([],function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}([],this.min,this.max));}quadrant(t){const e=[t%2==0,t<2],i=m(this.min),a=m(this.max);for(let t=0;t=0&&r++;if(0===r)return 0;r!==i.length&&(a=!1);}if(a)return 2;for(let e=0;e<3;e++){let i=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let s=0;sthis.max[e]-this.min[e])return 0}return 1}}class ba{constructor(t=0,e=0,i=0,a=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(a)||a<0)throw new Error(\"Invalid value for edge-insets, top, bottom, left and right must all be numbers\");this.top=t,this.bottom=e,this.left=i,this.right=a;}interpolate(t,i,a){return null!=i.top&&null!=t.top&&(this.top=e.y.number(t.top,i.top,a)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.y.number(t.bottom,i.bottom,a)),null!=i.left&&null!=t.left&&(this.left=e.y.number(t.left,i.left,a)),null!=i.right&&null!=t.right&&(this.right=e.y.number(t.right,i.right,a)),this}getCenter(t,i){const a=e.ac((this.left+t-this.right)/2,0,t),s=e.ac((this.top+i-this.bottom)/2,0,i);return new e.P(a,s)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new ba(this.top,this.bottom,this.left,this.right)}toJSON(){return {top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const wa=85.051129;class Ta{constructor(t,i,a,s,o){this.tileSize=512,this._renderWorldCopies=void 0===o||!!o,this._minZoom=t||0,this._maxZoom=i||22,this._minPitch=null==a?0:a,this._maxPitch=null==s?60:s,this.setMaxBounds(),this.width=0,this.height=0,this._center=new e.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ba,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0;}clone(){const t=new Ta(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.lngRange=t.lngRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.minElevationForCurrentTile=t.minElevationForCurrentTile,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices();}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t));}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t));}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t));}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t));}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t;}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new e.P(this.width,this.height)}get bearing(){return -this.angle/Math.PI*180}set bearing(t){const i=-e.b3(t,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=function(){var t=new e.A(4);return e.A!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}(),function(t,e,i){var a=e[0],s=e[1],o=e[2],r=e[3],n=Math.sin(i),l=Math.cos(i);t[0]=a*l+o*n,t[1]=s*l+r*n,t[2]=a*-n+o*l,t[3]=s*-n+r*l;}(this.rotationMatrix,this.rotationMatrix,this.angle));}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const i=e.ac(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices());}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices());}get zoom(){return this._zoom}set zoom(t){const e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices());}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices());}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices());}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices());}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this._constrain(),this._calcMatrices();}coveringZoomLevel(t){const e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(t){const i=[new e.b4(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new e.P(0,0)),s=this.pointCoordinate(new e.P(this.width,0)),o=this.pointCoordinate(new e.P(this.width,this.height)),r=this.pointCoordinate(new e.P(0,this.height)),n=Math.floor(Math.min(a.x,s.x,o.x,r.x)),l=Math.floor(Math.max(a.x,s.x,o.x,r.x)),h=1;for(let a=n-h;a<=l+h;a++)0!==a&&i.push(new e.b4(a,t));}return i}coveringTiles(t){var i,a;let s=this.coveringZoomLevel(t);const o=s;if(void 0!==t.minzoom&&st.maxzoom&&(s=t.maxzoom);const r=this.pointCoordinate(this.getCameraPoint()),n=e.Z.fromLngLat(this.center),l=Math.pow(2,s),h=[l*r.x,l*r.y,0],c=[l*n.x,l*n.y,0],u=xa.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,s);let d=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(d=s);const _=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,p=t=>({aabb:new ya([t*l,0,0],[(t+1)*l,l,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}),m=[],f=[],g=s,x=t.reparseOverscaled?o:s;if(this._renderWorldCopies)for(let t=1;t<=3;t++)m.push(p(-t)),m.push(p(t));for(m.push(p(0));m.length>0;){const s=m.pop(),o=s.x,r=s.y;let n=s.fullyVisible;if(!n){const t=s.aabb.intersects(u);if(0===t)continue;n=2===t;}const l=t.terrain?h:c,p=s.aabb.distanceX(l),y=s.aabb.distanceY(l),b=Math.max(Math.abs(p),Math.abs(y));if(s.zoom===g||b>_+(1<=d){const t=g-s.zoom,i=h[0]-.5-(o<>1),u=s.zoom+1;let d=s.aabb.quadrant(l);if(t.terrain){const o=new e.S(u,s.wrap,u,h,c),r=t.terrain.getMinMaxElevation(o),n=null!==(i=r.minElevation)&&void 0!==i?i:this.elevation,l=null!==(a=r.maxElevation)&&void 0!==a?a:this.elevation;d=new ya([d.min[0],d.min[1],n],[d.max[0],d.max[1],l]);}m.push({aabb:d,zoom:u,x:h,y:c,wrap:s.wrap,fullyVisible:n});}}return f.sort(((t,e)=>t.distanceSq-e.distanceSq)).map((t=>t.tileID))}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices();}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const i=e.ac(t.lat,-85.051129,wa);return new e.P(e.O(t.lng)*this.worldSize,e.Q(i)*this.worldSize)}unproject(t){return new e.Z(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return {lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const i=this.elevation,a=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,s=this.pointLocation(this.centerPoint,t),o=t.getElevationForLngLatZoom(s,this.tileZoom);if(!(this.elevation-o))return;const r=a+i-o,n=Math.cos(this._pitch)*this.cameraToCenterDistance/r/e.b5(1,s.lat),l=this.scaleZoom(n/this.tileSize);this._elevation=o,this._center=s,this.zoom=l;}setLocationAtPoint(t,i){const a=this.pointCoordinate(i),s=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(t),r=new e.Z(o.x-(a.x-s.x),o.y-(a.y-s.y));this.center=this.coordinateLocation(r),this._renderWorldCopies&&(this.center=this.center.wrap());}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),e.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(t){return e.Z.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,i){if(i){const e=i.pointCoordinate(t);if(null!=e)return e}const a=[t.x,t.y,0,1],s=[t.x,t.y,1,1];e.af(a,a,this.pixelMatrixInverse),e.af(s,s,this.pixelMatrixInverse);const o=a[3],r=s[3],n=a[1]/o,l=s[1]/r,h=a[2]/o,c=s[2]/r,u=h===c?0:(0-h)/(c-h);return new e.Z(e.y.number(a[0]/o,s[0]/r,u)/this.worldSize,e.y.number(n,l,u)/this.worldSize)}coordinatePoint(t,i=0,a=this.pixelMatrix){const s=[t.x*this.worldSize,t.y*this.worldSize,i,1];return e.af(s,s,a),new e.P(s[0]/s[3],s[1]/s[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return (new H).extend(this.pointLocation(new e.P(0,t))).extend(this.pointLocation(new e.P(this.width,t))).extend(this.pointLocation(new e.P(this.width,this.height))).extend(this.pointLocation(new e.P(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new H([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(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,wa]);}calculateTileMatrix(t){const i=t.canonical,a=this.worldSize/this.zoomScale(i.z),s=i.x+Math.pow(2,i.z)*t.wrap,o=e.an(new Float64Array(16));return e.J(o,o,[s*a,i.y*a,0]),e.K(o,o,[a/e.X,a/e.X,1]),o}calculatePosMatrix(t,i=!1){const a=t.key,s=i?this._alignedPosMatrixCache:this._posMatrixCache;if(s[a])return s[a];const o=this.calculateTileMatrix(t);return e.L(o,i?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,o),s[a]=new Float32Array(o),s[a]}calculateFogMatrix(t){const i=t.key,a=this._fogMatrixCache;if(a[i])return a[i];const s=this.calculateTileMatrix(t);return e.L(s,this.fogMatrix,s),a[i]=new Float32Array(s),a[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(t,i){i=e.ac(+i,this.minZoom,this.maxZoom);const a={center:new e.N(t.lng,t.lat),zoom:i};let s=this.lngRange;if(!this._renderWorldCopies&&null===s){const t=180-1e-10;s=[-t,t];}const o=this.tileSize*this.zoomScale(a.zoom);let r=0,n=o,l=0,h=o,c=0,u=0;const{x:d,y:_}=this.size;if(this.latRange){const t=this.latRange;r=e.Q(t[1])*o,n=e.Q(t[0])*o,n-r<_&&(c=_/(n-r));}s&&(l=e.b3(e.O(s[0])*o,0,o),h=e.b3(e.O(s[1])*o,0,o),hn&&(g=n-t);}if(s){const t=(l+h)/2;let i=p;this._renderWorldCopies&&(i=e.b3(p,t-o/2,t+o/2));const a=d/2;i-ah&&(f=h-a);}if(void 0!==f||void 0!==g){const t=new e.P(null!=f?f:p,null!=g?g:m);a.center=this.unproject.call({worldSize:o},t).wrap();}return a}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:e,zoom:i}=this.getConstrained(this.center,this.zoom);this.center=e,this.zoom=i,this._unmodified=t,this._constraining=!1;}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,i=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=e.b5(1,this.center.lat)*this.worldSize;let s=e.an(new Float64Array(16));e.K(s,s,[this.width/2,-this.height/2,1]),e.J(s,s,[1,-1,0]),this.labelPlaneMatrix=s,s=e.an(new Float64Array(16)),e.K(s,s,[1,-1,1]),e.J(s,s,[-1,-1,0]),e.K(s,s,[2/this.width,2/this.height,1]),this.glCoordMatrix=s;const o=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),r=Math.min(this.elevation,this.minElevationForCurrentTile),n=o-r*this._pixelPerMeter/Math.cos(this._pitch),l=r<0?n:o,h=Math.PI/2+this._pitch,c=this._fov*(.5+t.y/this.height),u=Math.sin(c)*l/Math.sin(e.ac(Math.PI-h-c,.01,Math.PI-.01)),d=this.getHorizon(),_=2*Math.atan(d/this.cameraToCenterDistance)*(.5+t.y/(2*d)),p=Math.sin(_)*l/Math.sin(e.ac(Math.PI-h-_,.01,Math.PI-.01)),m=Math.min(u,p);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*m+l),this.nearZ=this.height/50,s=new Float64Array(16),e.b6(s,this._fov,this.width/this.height,this.nearZ,this.farZ),s[8]=2*-t.x/this.width,s[9]=2*t.y/this.height,this.projectionMatrix=e.ae(s),e.K(s,s,[1,-1,1]),e.J(s,s,[0,0,-this.cameraToCenterDistance]),e.b7(s,s,this._pitch),e.ad(s,s,this.angle),e.J(s,s,[-i,-a,0]),this.mercatorMatrix=e.K([],s,[this.worldSize,this.worldSize,this.worldSize]),e.K(s,s,[1,1,this._pixelPerMeter]),this.pixelMatrix=e.L(new Float64Array(16),this.labelPlaneMatrix,s),e.J(s,s,[0,0,-this.elevation]),this.modelViewProjectionMatrix=s,this.invModelViewProjectionMatrix=e.as([],s),this.fogMatrix=new Float64Array(16),e.b6(this.fogMatrix,this._fov,this.width/this.height,o,this.farZ),this.fogMatrix[8]=2*-t.x/this.width,this.fogMatrix[9]=2*t.y/this.height,e.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),e.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),e.b7(this.fogMatrix,this.fogMatrix,this._pitch),e.ad(this.fogMatrix,this.fogMatrix,this.angle),e.J(this.fogMatrix,this.fogMatrix,[-i,-a,0]),e.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),e.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=e.L(new Float64Array(16),this.labelPlaneMatrix,s);const f=this.width%2/2,g=this.height%2/2,v=Math.cos(this.angle),x=Math.sin(this.angle),y=i-Math.round(i)+v*f+x*g,b=a-Math.round(a)+v*g+x*f,w=new Float64Array(s);if(e.J(w,w,[y>.5?y-1:y,b>.5?b-1:b,0]),this.alignedModelViewProjectionMatrix=w,s=e.as(new Float64Array(16),this.pixelMatrix),!s)throw new Error(\"failed to invert matrix\");this.pixelMatrixInverse=s,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={};}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new e.P(0,0)),i=[t.x*this.worldSize,t.y*this.worldSize,0,1];return e.af(i,i,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.P(0,t))}getCameraQueryGeometry(t){const i=this.getCameraPoint();if(1===t.length)return [t[0],i];{let a=i.x,s=i.y,o=i.x,r=i.y;for(const e of t)a=Math.min(a,e.x),s=Math.min(s,e.y),o=Math.max(o,e.x),r=Math.max(r,e.y);return [new e.P(a,s),new e.P(o,s),new e.P(o,r),new e.P(a,r),new e.P(a,s)]}}lngLatToCameraDepth(t,i){const a=this.locationCoordinate(t),s=[a.x*this.worldSize,a.y*this.worldSize,i,1];return e.af(s,s,this.modelViewProjectionMatrix),s[2]/s[3]}}function Ia(t,e){let i,a=!1,s=null,o=null;const r=()=>{s=null,a&&(t.apply(o,i),s=setTimeout(r,e),a=!1);};return (...t)=>(a=!0,o=this,i=t,s||r(),s)}class Ea{constructor(t){this._getCurrentHash=()=>{const t=window.location.hash.replace(\"#\",\"\");if(this._hashName){let e;return t.split(\"&\").map((t=>t.split(\"=\"))).forEach((t=>{t[0]===this._hashName&&(e=t);})),(e&&e[1]||\"\").split(\"/\")}return t.split(\"/\")},this._onHashChange=()=>{const t=this._getCurrentHash();if(t.length>=3&&!t.some((t=>isNaN(t)))){const e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return !1},this._updateHashUnthrottled=()=>{const t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t);},this._removeHash=()=>{const t=this._getCurrentHash();if(0===t.length)return;const e=t.join(\"/\");let i=e;i.split(\"&\").length>0&&(i=i.split(\"&\")[0]),this._hashName&&(i=`${this._hashName}=${e}`);let a=window.location.hash.replace(i,\"\");a.startsWith(\"#&\")?a=a.slice(0,1)+a.slice(2):\"#\"===a&&(a=\"\");let s=window.location.href.replace(/(#.+)?$/,a);s=s.replace(\"&&\",\"&\"),window.history.replaceState(window.history.state,null,s);},this._updateHash=Ia(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t);}addTo(t){return this._map=t,addEventListener(\"hashchange\",this._onHashChange,!1),this._map.on(\"moveend\",this._updateHash),this}remove(){return removeEventListener(\"hashchange\",this._onHashChange,!1),this._map.off(\"moveend\",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){const e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,a=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),s=Math.pow(10,a),o=Math.round(e.lng*s)/s,r=Math.round(e.lat*s)/s,n=this._map.getBearing(),l=this._map.getPitch();let h=\"\";if(h+=t?`/${o}/${r}/${i}`:`${i}/${r}/${o}`,(n||l)&&(h+=\"/\"+Math.round(10*n)/10),l&&(h+=`/${Math.round(l)}`),this._hashName){const t=this._hashName;let e=!1;const i=window.location.hash.slice(1).split(\"&\").map((i=>{const a=i.split(\"=\")[0];return a===t?(e=!0,`${a}=${h}`):i})).filter((t=>t));return e||i.push(`${t}=${h}`),`#${i.join(\"&\")}`}return `#${h}`}}const Pa={linearity:.3,easing:e.b8(0,0,.3,1)},Ca=e.e({deceleration:2500,maxSpeed:1400},Pa),Sa=e.e({deceleration:20,maxSpeed:1400},Pa),za=e.e({deceleration:1e3,maxSpeed:360},Pa),Da=e.e({deceleration:1e3,maxSpeed:90},Pa);class Ma{constructor(t){this._map=t,this.clear();}clear(){this._inertiaBuffer=[];}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:o.now(),settings:t});}_drainInertiaBuffer(){const t=this._inertiaBuffer,e=o.now();for(;t.length>0&&e-t[0].time>160;)t.shift();}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,pan:new e.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:t}of this._inertiaBuffer)i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,t.panDelta&&i.pan._add(t.panDelta),t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(i.pan.mag()){const o=Ra(i.pan.mag(),a,e.e({},Ca,t||{}));s.offset=i.pan.mult(o.amount/i.pan.mag()),s.center=this._map.transform.center,Aa(s,o);}if(i.zoom){const t=Ra(i.zoom,a,Sa);s.zoom=this._map.transform.zoom+t.amount,Aa(s,t);}if(i.bearing){const t=Ra(i.bearing,a,za);s.bearing=this._map.transform.bearing+e.ac(t.amount,-179,179),Aa(s,t);}if(i.pitch){const t=Ra(i.pitch,a,Da);s.pitch=this._map.transform.pitch+t.amount,Aa(s,t);}if(s.zoom||s.bearing){const t=void 0===i.pinchAround?i.around:i.pinchAround;s.around=t?this._map.unproject(t):this._map.getCenter();}return this.clear(),e.e(s,{noMoveStart:!0})}}function Aa(t,e){(!t.duration||t.durationi.unproject(t))),l=o.reduce(((t,e,i,a)=>t.add(e.div(a.length))),new e.P(0,0));super(t,{points:o,point:l,lngLats:n,lngLat:i.unproject(l),originalEvent:a}),this._defaultPrevented=!1;}}class Fa extends e.k{preventDefault(){this._defaultPrevented=!0;}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1;}}class Ba{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance;}reset(){delete this._mousedownPos;}wheel(t){return this._firePreventable(new Fa(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new ka(t.type,this._map,t))}mouseup(t){this._map.fire(new ka(t.type,this._map,t));}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new ka(t.type,this._map,t));}dblclick(t){return this._firePreventable(new ka(t.type,this._map,t))}mouseover(t){this._map.fire(new ka(t.type,this._map,t));}mouseout(t){this._map.fire(new ka(t.type,this._map,t));}touchstart(t){return this._firePreventable(new La(t.type,this._map,t))}touchmove(t){this._map.fire(new La(t.type,this._map,t));}touchend(t){this._map.fire(new La(t.type,this._map,t));}touchcancel(t){this._map.fire(new La(t.type,this._map,t));}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return {}}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class Oa{constructor(t){this._map=t;}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent;}mousemove(t){this._map.fire(new ka(t.type,this._map,t));}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1;}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new ka(\"contextmenu\",this._map,this._contextMenuEvent)),delete this._contextMenuEvent);}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new ka(t.type,this._map,t)),this._map.listens(\"contextmenu\")&&t.preventDefault();}isEnabled(){return !0}isActive(){return !1}enable(){}disable(){}}class Na{constructor(t){this._map=t;}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return {lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.pointLocation(e.P.convert(t),this._map.terrain)}}class Ua{constructor(t,e){this._map=t,this._tr=new Na(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1;}isEnabled(){return !!this._enabled}isActive(){return !!this._active}enable(){this.isEnabled()||(this._enabled=!0);}disable(){this.isEnabled()&&(this._enabled=!1);}mousedown(t,e){this.isEnabled()&&t.shiftKey&&0===t.button&&(r.disableDrag(),this._startPos=this._lastPos=e,this._active=!0);}mousemoveWindow(t,e){if(!this._active)return;const i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)t.fitScreenCoordinates(a,s,this._tr.bearing,{linear:!0})};this._fireEvent(\"boxzoomcancel\",t);}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent(\"boxzoomcancel\",t));}reset(){this._active=!1,this._container.classList.remove(\"maplibregl-crosshair\"),this._box&&(r.remove(this._box),this._box=null),r.enableDrag(),delete this._startPos,delete this._lastPos;}_fireEvent(t,i){return this._map.fire(new e.k(t,{originalEvent:i}))}}function ja(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);const i={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(t){const i=new e.P(0,0);for(const e of t)i._add(e);return i.div(t.length)}(i),this.touches=ja(a,i)));}touchmove(t,e,i){if(this.aborted||!this.centroid)return;const a=ja(i,e);for(const t in this.touches){const e=a[t];(!e||e.dist(this.touches[t])>30)&&(this.aborted=!0);}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){const t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}}class qa{constructor(t){this.singleTap=new Za(t),this.numTaps=t.numTaps,this.reset();}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset();}touchstart(t,e,i){this.singleTap.touchstart(t,e,i);}touchmove(t,e,i){this.singleTap.touchmove(t,e,i);}touchend(t,e,i){const a=this.singleTap.touchend(t,e,i);if(a){const e=t.timeStamp-this.lastTime<500,i=!this.lastTap||this.lastTap.dist(a)<30;if(e&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=a,this.count===this.numTaps)return this.reset(),a}}}class Va{constructor(t){this._tr=new Na(t),this._zoomIn=new qa({numTouches:1,numTaps:2}),this._zoomOut=new qa({numTouches:2,numTaps:1}),this.reset();}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset();}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i);}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i);}touchend(t,e,i){const a=this._zoomIn.touchend(t,e,i),s=this._zoomOut.touchend(t,e,i),o=this._tr;return a?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom+1,around:o.unproject(a)},{originalEvent:t})}):s?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:e=>e.easeTo({duration:300,zoom:o.zoom-1,around:o.unproject(s)},{originalEvent:t})}):void 0}touchcancel(){this.reset();}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class Ga{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset();}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t);}_move(...t){const e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0));}dragMove(t,e){if(!this.isEnabled())return;const i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const a=e.length?e[0]:e;return !this._moved&&a.dist(i){t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault();};},Ka=({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const a=new Wa({checkCorrectEvent:t=>0===r.mouseButton(t)&&t.ctrlKey||2===r.mouseButton(t)});return new Ga({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:a,enable:t,assignEvents:Xa})},Ja=({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const a=new Wa({checkCorrectEvent:t=>0===r.mouseButton(t)&&t.ctrlKey||2===r.mouseButton(t)});return new Ga({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:a,enable:t,assignEvents:Xa})};class Ya{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset();}reset(){this._active=!1,this._touches={},this._sum=new e.P(0,0);}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._active){if(!this._shouldBePrevented(i.length))return t.preventDefault(),this._calculateTransform(t,e,i);this._map.cooperativeGestures.notifyGestureBlocked(\"touch_pan\",t);}}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&this._shouldBePrevented(i.length)&&this.reset();}touchcancel(){this.reset();}_calculateTransform(t,i,a){a.length>0&&(this._active=!0);const s=ja(a,i),o=new e.P(0,0),r=new e.P(0,0);let n=0;for(const t in s){const e=s[t],i=this._touches[t];i&&(o._add(e),r._add(e.sub(i)),n++,s[t]=e);}if(this._touches=s,this._shouldBePrevented(n)||!r.mag())return;const l=r.div(n);return this._sum._add(l),this._sum.mag()Math.abs(t.x)}class rs extends Qa{constructor(t){super(),this._currentTouchCount=0,this._map=t;}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints;}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length;}_start(t){this._lastPoints=t,os(t[0].sub(t[1]))&&(this._valid=!1);}_move(t,e,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const a=t[0].sub(this._lastPoints[0]),s=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(a,s,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(a.y+s.y)/2*-.5}):void 0}gestureBeginsVertically(t,e,i){if(void 0!==this._valid)return this._valid;const a=t.mag()>=2,s=e.mag()>=2;if(!a&&!s)return;if(!a||!s)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;const o=t.y>0==e.y>0;return os(t)&&os(e)&&o}}const ns={panStep:100,bearingStep:15,pitchStep:10};class ls{constructor(t){this._tr=new Na(t);const e=ns;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1;}reset(){this._active=!1;}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,a=0,s=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),s=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),s=1);break;case 38:t.shiftKey?a=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?a=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,a=0),{cameraAnimation:r=>{const n=this._tr;r.easeTo({duration:300,easeId:\"keyboardHandler\",easing:hs,zoom:e?Math.round(n.zoom)+e*(t.shiftKey?2:1):n.zoom,bearing:n.bearing+i*this._bearingStep,pitch:n.pitch+a*this._pitchStep,offset:[-s*this._panStep,-o*this._panStep],center:n.center},{originalEvent:t});}}}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 hs(t){return t*(2-t)}const cs=4.000244140625;class us{constructor(t,e){this._onTimeout=t=>{this._type=\"wheel\",this._delta-=this._lastValue,this._active||this._start(t);},this._map=t,this._tr=new Na(t),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222;}setZoomRate(t){this._defaultZoomRate=t;}setWheelZoomRate(t){this._wheelZoomRate=t;}isEnabled(){return !!this._enabled}isActive(){return !!this._active||void 0!==this._finishTimeout}isZooming(){return !!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&\"center\"===t.around);}disable(){this.isEnabled()&&(this._enabled=!1);}_shouldBePrevented(t){return !!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked(\"wheel_zoom\",t);let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const i=o.now(),a=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==e&&e%cs==0?this._type=\"wheel\":0!==e&&Math.abs(e)<4?this._type=\"trackpad\":a>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(a*e)<200?\"trackpad\":\"wheel\",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault();}_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 i=r.mousePos(this._map.getCanvas(),t),a=this._tr;this._around=i.y>a.transform.height/2-a.transform.getHorizon()?e.N.convert(this._aroundCenter?a.center:a.unproject(i)):e.N.convert(a.center),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame());}renderFrame(){if(!this._frameId)return;if(this._frameId=null,!this.isActive())return;const t=this._tr.transform;if(0!==this._delta){const e=\"wheel\"===this._type&&Math.abs(this._delta)>cs?this._wheelZoomRate:this._defaultZoomRate;let i=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==i&&(i=1/i);const a=\"number\"==typeof this._targetZoom?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(a*i))),\"wheel\"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0;}const i=\"number\"==typeof this._targetZoom?this._targetZoom:t.zoom,a=this._startZoom,s=this._easing;let r,n=!1;const l=o.now()-this._lastWheelEventTime;if(\"wheel\"===this._type&&a&&s&&l){const t=Math.min(l/200,1),o=s(t);r=e.y.number(a,i,o),t<1?this._frameId||(this._frameId=!0):n=!0;}else r=i,n=!0;return this._active=!0,n&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout;}),200)),{noInertia:!0,needsRenderFrame:!n,zoomDelta:r-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let i=e.b9;if(this._prevEase){const t=this._prevEase,a=(o.now()-t.start)/t.duration,s=t.easing(a+.01)-t.easing(a),r=.27/Math.sqrt(s*s+1e-4)*.01,n=Math.sqrt(.0729-r*r);i=e.b8(r,n,.25,1);}return this._prevEase={start:o.now(),duration:t,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);}}class ds{constructor(t,e){this._clickZoom=t,this._tapZoom=e;}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 _s{constructor(t){this._tr=new Na(t),this.reset();}reset(){this._active=!1;}dblclick(t,e){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(e)},{originalEvent:t});}}}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class ps{constructor(){this._tap=new qa({numTouches:1,numTaps:1}),this.reset();}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset();}touchstart(t,e,i){if(!this._swipePoint)if(this._tapTime){const a=e[0],s=t.timeStamp-this._tapTime<500,o=this._tapPoint.dist(a)<30;s&&o?i.length>0&&(this._swipePoint=a,this._swipeTouch=i[0].identifier):this.reset();}else this._tap.touchstart(t,e,i);}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;const a=e[0],s=a.y-this._swipePoint.y;return this._swipePoint=a,t.preventDefault(),this._active=!0,{zoomDelta:s/128}}}else this._tap.touchmove(t,e,i);}touchend(t,e,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else {const a=this._tap.touchend(t,e,i);a&&(this._tapTime=t.timeStamp,this._tapPoint=a);}}touchcancel(){this.reset();}enable(){this._enabled=!0;}disable(){this._enabled=!1,this.reset();}isEnabled(){return this._enabled}isActive(){return this._active}}class ms{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i;}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add(\"maplibregl-touch-drag-pan\");}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove(\"maplibregl-touch-drag-pan\");}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class fs{constructor(t,e,i){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=i;}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 gs{constructor(t,e,i,a){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=a,this._rotationDisabled=!1,this._enabled=!0;}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add(\"maplibregl-touch-zoom-rotate\");}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove(\"maplibregl-touch-zoom-rotate\");}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable();}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable();}}class vs{constructor(t,e){this._bypassKey=-1!==navigator.userAgent.indexOf(\"Mac\")?\"metaKey\":\"ctrlKey\",this._map=t,this._options=e,this._enabled=!1;}isActive(){return !1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add(\"maplibregl-cooperative-gestures\"),this._container=r.create(\"div\",\"maplibregl-cooperative-gesture-screen\",t);let e=this._map._getUIString(\"CooperativeGesturesHandler.WindowsHelpText\");\"metaKey\"===this._bypassKey&&(e=this._map._getUIString(\"CooperativeGesturesHandler.MacHelpText\"));const i=this._map._getUIString(\"CooperativeGesturesHandler.MobileHelpText\"),a=document.createElement(\"div\");a.className=\"maplibregl-desktop-message\",a.textContent=e,this._container.appendChild(a);const s=document.createElement(\"div\");s.className=\"maplibregl-mobile-message\",s.textContent=i,this._container.appendChild(s),this._container.setAttribute(\"aria-hidden\",\"true\");}_destroyUI(){this._container&&(r.remove(this._container),this._map.getCanvasContainer().classList.remove(\"maplibregl-cooperative-gestures\")),delete this._container;}enable(){this._setupUI(),this._enabled=!0;}disable(){this._enabled=!1,this._destroyUI();}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,i){this._enabled&&(this._map.fire(new e.k(\"cooperativegestureprevented\",{gestureType:t,originalEvent:i})),this._container.classList.add(\"maplibregl-show\"),setTimeout((()=>{this._container.classList.remove(\"maplibregl-show\");}),100));}}const xs=t=>t.zoom||t.drag||t.pitch||t.rotate;class ys extends e.k{}function bs(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}class ws{constructor(t,e){this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`);},this.handleEvent=(t,e)=>{if(\"blur\"===t.type)return void this.stop(!0);this._updatingCamera=!0;const i=\"renderFrame\"===t.type?void 0:t,a={needsRenderFrame:!1},s={},o={},n=t.touches,l=n?this._getMapTouches(n):void 0,h=l?r.touchPos(this._map.getCanvas(),l):r.mousePos(this._map.getCanvas(),t);for(const{handlerName:r,handler:n,allowed:c}of this._handlers){if(!n.isEnabled())continue;let u;this._blockedByActive(o,c,r)?n.reset():n[e||t.type]&&(u=n[e||t.type](t,h,l),this.mergeHandlerResult(a,s,u,r,i),u&&u.needsRenderFrame&&this._triggerRenderFrame()),(u||n.isActive())&&(o[r]=n);}const c={};for(const t in this._previousActiveHandlers)o[t]||(c[t]=i);this._previousActiveHandlers=o,(Object.keys(c).length||bs(a))&&(this._changes.push([a,s,c]),this._triggerRenderFrame()),(Object.keys(o).length||bs(a))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:u}=a;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map));},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ma(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(e);const i=this._el;this._listeners=[[i,\"touchstart\",{passive:!0}],[i,\"touchmove\",{passive:!1}],[i,\"touchend\",void 0],[i,\"touchcancel\",void 0],[i,\"mousedown\",void 0],[i,\"mousemove\",void 0],[i,\"mouseup\",void 0],[document,\"mousemove\",{capture:!0}],[document,\"mouseup\",void 0],[i,\"mouseover\",void 0],[i,\"mouseout\",void 0],[i,\"dblclick\",void 0],[i,\"click\",void 0],[i,\"keydown\",{capture:!1}],[i,\"keyup\",void 0],[i,\"wheel\",{passive:!1}],[i,\"contextmenu\",void 0],[window,\"blur\",void 0]];for(const[t,e,i]of this._listeners)r.addEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i);}destroy(){for(const[t,e,i]of this._listeners)r.removeEventListener(t,e,t===document?this.handleWindowEvent:this.handleEvent,i);}_addDefaultHandlers(t){const e=this._map,i=e.getCanvasContainer();this._add(\"mapEvent\",new Ba(e,t));const a=e.boxZoom=new Ua(e,t);this._add(\"boxZoom\",a),t.interactive&&t.boxZoom&&a.enable();const s=e.cooperativeGestures=new vs(e,t.cooperativeGestures);this._add(\"cooperativeGestures\",s),t.cooperativeGestures&&s.enable();const o=new Va(e),n=new _s(e);e.doubleClickZoom=new ds(n,o),this._add(\"tapZoom\",o),this._add(\"clickZoom\",n),t.interactive&&t.doubleClickZoom&&e.doubleClickZoom.enable();const l=new ps;this._add(\"tapDragZoom\",l);const h=e.touchPitch=new rs(e);this._add(\"touchPitch\",h),t.interactive&&t.touchPitch&&e.touchPitch.enable(t.touchPitch);const c=Ka(t),u=Ja(t);e.dragRotate=new fs(t,c,u),this._add(\"mouseRotate\",c,[\"mousePitch\"]),this._add(\"mousePitch\",u,[\"mouseRotate\"]),t.interactive&&t.dragRotate&&e.dragRotate.enable();const d=(({enable:t,clickTolerance:e})=>{const i=new Wa({checkCorrectEvent:t=>0===r.mouseButton(t)&&!t.ctrlKey});return new Ga({clickTolerance:e,move:(t,e)=>({around:e,panDelta:e.sub(t)}),activateOnStart:!0,moveStateManager:i,enable:t,assignEvents:Xa})})(t),_=new Ya(t,e);e.dragPan=new ms(i,d,_),this._add(\"mousePan\",d),this._add(\"touchPan\",_,[\"touchZoom\",\"touchRotate\"]),t.interactive&&t.dragPan&&e.dragPan.enable(t.dragPan);const p=new ss,m=new is;e.touchZoomRotate=new gs(i,m,p,l),this._add(\"touchRotate\",p,[\"touchPan\",\"touchZoom\"]),this._add(\"touchZoom\",m,[\"touchPan\",\"touchRotate\"]),t.interactive&&t.touchZoomRotate&&e.touchZoomRotate.enable(t.touchZoomRotate);const f=e.scrollZoom=new us(e,(()=>this._triggerRenderFrame()));this._add(\"scrollZoom\",f,[\"mousePan\"]),t.interactive&&t.scrollZoom&&e.scrollZoom.enable(t.scrollZoom);const g=e.keyboard=new ls(e);this._add(\"keyboard\",g),t.interactive&&t.keyboard&&e.keyboard.enable(),this._add(\"blockableMapEvent\",new Oa(e));}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e;}stop(t){if(!this._updatingCamera){for(const{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[];}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return !0;return !1}isZooming(){return !!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return !!this._eventsInProgress.rotate}isMoving(){return Boolean(xs(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(const a in t)if(a!==i&&(!e||e.indexOf(a)<0))return !0;return !1}_getMapTouches(t){const e=[];for(const i of t)this._el.contains(i.target)&&e.push(i);return e}mergeHandlerResult(t,i,a,s,o){if(!a)return;e.e(t,a);const r={handlerName:s,originalEvent:a.originalEvent||o};void 0!==a.zoomDelta&&(i.zoom=r),void 0!==a.panDelta&&(i.drag=r),void 0!==a.pitchDelta&&(i.pitch=r),void 0!==a.bearingDelta&&(i.rotate=r);}_applyChanges(){const t={},i={},a={};for(const[s,o,r]of this._changes)s.panDelta&&(t.panDelta=(t.panDelta||new e.P(0,0))._add(s.panDelta)),s.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(t.around=s.around),void 0!==s.pinchAround&&(t.pinchAround=s.pinchAround),s.noInertia&&(t.noInertia=s.noInertia),e.e(i,o),e.e(a,r);this._updateMapTransform(t,i,a),this._changes=[];}_updateMapTransform(t,e,i){const a=this._map,s=a._getTransformForUpdate(),o=a.terrain;if(!(bs(t)||o&&this._terrainMovement))return this._fireEvents(e,i,!0);let{panDelta:r,zoomDelta:n,bearingDelta:l,pitchDelta:h,around:c,pinchAround:u}=t;void 0!==u&&(c=u),a._stop(!0),c=c||a.transform.centerPoint;const d=s.pointLocation(r?c.sub(r):c);l&&(s.bearing+=l),h&&(s.pitch+=h),n&&(s.zoom+=n),o?this._terrainMovement||!e.drag&&!e.zoom?e.drag&&this._terrainMovement?s.center=s.pointLocation(s.centerPoint.sub(r)):s.setLocationAtPoint(d,c):(this._terrainMovement=!0,this._map._elevationFreeze=!0,s.setLocationAtPoint(d,c)):s.setLocationAtPoint(d,c),a._applyUpdatedTransform(s),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0);}_fireEvents(t,i,a){const s=xs(this._eventsInProgress),r=xs(t),n={};for(const e in t){const{originalEvent:i}=t[e];this._eventsInProgress[e]||(n[`${e}start`]=i),this._eventsInProgress[e]=t[e];}!s&&r&&this._fireEvent(\"movestart\",r.originalEvent);for(const t in n)this._fireEvent(t,n[t]);r&&this._fireEvent(\"move\",r.originalEvent);for(const e in t){const{originalEvent:i}=t[e];this._fireEvent(e,i);}const l={};let h;for(const t in this._eventsInProgress){const{handlerName:e,originalEvent:a}=this._eventsInProgress[t];this._handlersById[e].isActive()||(delete this._eventsInProgress[t],h=i[e]||a,l[`${t}end`]=h);}for(const t in l)this._fireEvent(t,l[t]);const c=xs(this._eventsInProgress),u=(s||r)&&!c;if(u&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const t=this._map._getTransformForUpdate();t.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(t);}if(a&&u){this._updatingCamera=!0;const t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),i=t=>0!==t&&-this._bearingSnap{delete this._frameId,this.handleEvent(new ys(\"renderFrame\",{timeStamp:t})),this._applyChanges();}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame());}}class Ts extends e.E{constructor(t,e){super(),this._renderFrameCallback=()=>{const t=Math.min((o.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop();},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=e.bearingSnap,this.on(\"moveend\",(()=>{delete this._requestedCameraState;}));}getCenter(){return new e.N(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}panBy(t,i,a){return t=e.P.convert(t).mult(-1),this.panTo(this.transform.center,e.e({offset:t},i),a)}panTo(t,i,a){return this.easeTo(e.e({center:t},i),a)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,i,a){return this.easeTo(e.e({zoom:t},i),a)}zoomIn(t,e){return this.zoomTo(this.getZoom()+1,t,e),this}zoomOut(t,e){return this.zoomTo(this.getZoom()-1,t,e),this}getBearing(){return this.transform.bearing}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,i,a){return this.easeTo(e.e({bearing:t},i),a)}resetNorth(t,i){return this.rotateTo(0,e.e({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(e.e({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(t,e){return Math.abs(this.getBearing()){if(this._zooming&&(s.zoom=e.y.number(r,g,a)),this._rotating&&(s.bearing=e.y.number(n,c,a)),this._pitching&&(s.pitch=e.y.number(l,u,a)),this._padding&&(s.interpolatePadding(h,d,a),p=s.centerPoint.add(_)),this.terrain&&!t.freezeElevation&&this._updateElevation(a),b)s.setLocationAtPoint(b,w);else {const t=s.zoomScale(s.zoom-r),e=g>r?Math.min(2,y):Math.max(.5,y),i=Math.pow(e,1-a),o=s.unproject(v.add(x.mult(a*i)).mult(t));s.setLocationAtPoint(s.renderWorldCopies?o.wrap():o,p);}this._applyUpdatedTransform(s),this._fireMoveEvents(i);}),(e=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i,e);}),t),this}_prepareEase(t,i,a={}){this._moving=!0,i||a.moving||this.fire(new e.k(\"movestart\",t)),this._zooming&&!a.zooming&&this.fire(new e.k(\"zoomstart\",t)),this._rotating&&!a.rotating&&this.fire(new e.k(\"rotatestart\",t)),this._pitching&&!a.pitching&&this.fire(new e.k(\"pitchstart\",t));}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0;}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&i!==this._elevationTarget){const e=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(e-(i-(e*t+this._elevationStart))/(1-t)),this._elevationTarget=i;}this.transform.elevation=e.y.number(this._elevationStart,this._elevationTarget,t);}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain);}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){const e=t.getCameraPosition(),i=this.terrain.getElevationForLngLatZoom(e.lngLat,t.zoom);if(e.altitudethis._elevateCameraIfInsideTerrain(t))),this.transformCameraUpdate&&e.push((t=>this.transformCameraUpdate(t))),!e.length)return;const i=t.clone();for(const t of e){const e=i.clone(),{center:a,zoom:s,pitch:o,bearing:r,elevation:n}=t(e);a&&(e.center=a),void 0!==s&&(e.zoom=s),void 0!==o&&(e.pitch=o),void 0!==r&&(e.bearing=r),void 0!==n&&(e.elevation=n),i.apply(e);}this.transform.apply(i);}_fireMoveEvents(t){this.fire(new e.k(\"move\",t)),this._zooming&&this.fire(new e.k(\"zoom\",t)),this._rotating&&this.fire(new e.k(\"rotate\",t)),this._pitching&&this.fire(new e.k(\"pitch\",t));}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const a=this._zooming,s=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new e.k(\"zoomend\",t)),s&&this.fire(new e.k(\"rotateend\",t)),o&&this.fire(new e.k(\"pitchend\",t)),this.fire(new e.k(\"moveend\",t));}flyTo(t,i){var a;if(!t.essential&&o.prefersReducedMotion){const a=e.M(t,[\"center\",\"zoom\",\"bearing\",\"pitch\",\"around\"]);return this.jumpTo(a,i)}this.stop(),t=e.e({offset:[0,0],speed:1.2,curve:1.42,easing:e.b9},t);const s=this._getTransformForUpdate(),r=s.zoom,n=s.bearing,l=s.pitch,h=s.padding,c=\"bearing\"in t?this._normalizeBearing(t.bearing,n):n,u=\"pitch\"in t?+t.pitch:l,d=\"padding\"in t?t.padding:s.padding,_=e.P.convert(t.offset);let p=s.centerPoint.add(_);const m=s.pointLocation(p),{center:f,zoom:g}=s.getConstrained(e.N.convert(t.center||m),null!==(a=t.zoom)&&void 0!==a?a:r);this._normalizeCenter(f,s);const v=s.zoomScale(g-r),x=s.project(m),y=s.project(f).sub(x);let b=t.curve;const w=Math.max(s.width,s.height),T=w/v,I=y.mag();if(\"minZoom\"in t){const i=e.ac(Math.min(t.minZoom,r,g),s.minZoom,s.maxZoom),a=w/s.zoomScale(i-r);b=Math.sqrt(a/I*2);}const E=b*b;function P(t){const e=(T*T-w*w+(t?-1:1)*E*E*I*I)/(2*(t?T:w)*E*I);return Math.log(Math.sqrt(e*e+1)-e)}function C(t){return (Math.exp(t)-Math.exp(-t))/2}function S(t){return (Math.exp(t)+Math.exp(-t))/2}const z=P(!1);let D=function(t){return S(z)/S(z+b*t)},M=function(t){return w*((S(z)*(C(e=z+b*t)/S(e))-C(z))/E)/I;var e;},A=(P(!0)-z)/b;if(Math.abs(I)<1e-6||!isFinite(A)){if(Math.abs(w-T)<1e-6)return this.easeTo(t,i);const e=T0,D=t=>Math.exp(e*b*t);}return t.duration=\"duration\"in t?+t.duration:1e3*A/(\"screenSpeed\"in t?+t.screenSpeed/b:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=n!==c,this._pitching=u!==l,this._padding=!s.isPaddingEqual(d),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(f),this._ease((a=>{const o=a*A,m=1/D(o);s.zoom=1===a?g:r+s.scaleZoom(m),this._rotating&&(s.bearing=e.y.number(n,c,a)),this._pitching&&(s.pitch=e.y.number(l,u,a)),this._padding&&(s.interpolatePadding(h,d,a),p=s.centerPoint.add(_)),this.terrain&&!t.freezeElevation&&this._updateElevation(a);const v=1===a?f:s.unproject(x.add(y.mult(M(o))).mult(m));s.setLocationAtPoint(s.renderWorldCopies?v.wrap():v,p),this._applyUpdatedTransform(s),this._fireMoveEvents(i);}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(i);}),t),this}isEasing(){return !!this._easeFrameId}stop(){return this._stop()}_stop(t,e){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,e);}return t||null===(i=this.handlers)||void 0===i||i.stop(!1),this}_ease(t,e,i){!1===i.animate||0===i.duration?(t(1),e()):(this._easeStart=o.now(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback));}_normalizeBearing(t,i){t=e.b3(t,-180,180);const a=Math.abs(t-i);return Math.abs(t-360-i)180?-360:i<-180?360:0;}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(e.N.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}const Is={compact:!0,customAttribution:'
MapLibre'};class Es{constructor(t=Is){this._toggleAttribution=()=>{this._container.classList.contains(\"maplibregl-compact\")&&(this._container.classList.contains(\"maplibregl-compact-show\")?(this._container.setAttribute(\"open\",\"\"),this._container.classList.remove(\"maplibregl-compact-show\")):(this._container.classList.add(\"maplibregl-compact-show\"),this._container.removeAttribute(\"open\")));},this._updateData=t=>{!t||\"metadata\"!==t.sourceDataType&&\"visibility\"!==t.sourceDataType&&\"style\"!==t.dataType&&\"terrain\"!==t.type||this._updateAttributions();},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute(\"open\",\"\"):this._container.classList.contains(\"maplibregl-compact\")||this._container.classList.contains(\"maplibregl-attrib-empty\")||(this._container.setAttribute(\"open\",\"\"),this._container.classList.add(\"maplibregl-compact\",\"maplibregl-compact-show\")):(this._container.setAttribute(\"open\",\"\"),this._container.classList.contains(\"maplibregl-compact\")&&this._container.classList.remove(\"maplibregl-compact\",\"maplibregl-compact-show\"));},this._updateCompactMinimize=()=>{this._container.classList.contains(\"maplibregl-compact\")&&this._container.classList.contains(\"maplibregl-compact-show\")&&this._container.classList.remove(\"maplibregl-compact-show\");},this.options=t;}getDefaultPosition(){return \"bottom-right\"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=r.create(\"details\",\"maplibregl-ctrl maplibregl-ctrl-attrib\"),this._compactButton=r.create(\"summary\",\"maplibregl-ctrl-attrib-button\",this._container),this._compactButton.addEventListener(\"click\",this._toggleAttribution),this._setElementTitle(this._compactButton,\"ToggleAttribution\"),this._innerContainer=r.create(\"div\",\"maplibregl-ctrl-attrib-inner\",this._container),this._updateAttributions(),this._updateCompact(),this._map.on(\"styledata\",this._updateData),this._map.on(\"sourcedata\",this._updateData),this._map.on(\"terrain\",this._updateData),this._map.on(\"resize\",this._updateCompact),this._map.on(\"drag\",this._updateCompactMinimize),this._container}onRemove(){r.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(t,e){const i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute(\"aria-label\",i);}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((t=>\"string\"!=typeof t?\"\":t))):\"string\"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id;}const e=this._map.style.sourceCaches;for(const i in e){const a=e[i];if(a.used||a.usedForTerrain){const e=a.getSource();e.attribution&&t.indexOf(e.attribution)<0&&t.push(e.attribution);}}t=t.filter((t=>String(t).trim())),t.sort(((t,e)=>t.length-e.length)),t=t.filter(((e,i)=>{for(let a=i+1;a=0)return !1;return !0}));const i=t.join(\" | \");i!==this._attribHTML&&(this._attribHTML=i,t.length?(this._innerContainer.innerHTML=i,this._container.classList.remove(\"maplibregl-attrib-empty\")):this._container.classList.add(\"maplibregl-attrib-empty\"),this._updateCompact(),this._editLink=null);}}class Ps{constructor(t={}){this._updateCompact=()=>{const t=this._container.children;if(t.length){const e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&e.classList.add(\"maplibregl-compact\"):e.classList.remove(\"maplibregl-compact\");}},this.options=t;}getDefaultPosition(){return \"bottom-left\"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=r.create(\"div\",\"maplibregl-ctrl\");const e=r.create(\"a\",\"maplibregl-ctrl-logo\");return e.target=\"_blank\",e.rel=\"noopener nofollow\",e.href=\"https://maplibre.org/\",e.setAttribute(\"aria-label\",this._map._getUIString(\"LogoControl.Title\")),e.setAttribute(\"rel\",\"noopener nofollow\"),this._container.appendChild(e),this._container.style.display=\"block\",this._map.on(\"resize\",this._updateCompact),this._updateCompact(),this._container}onRemove(){r.remove(this._container),this._map.off(\"resize\",this._updateCompact),this._map=void 0,this._compact=void 0;}}class Cs{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1;}add(t){const e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){const e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(const e of i)if(e.id===t)return void(e.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error(\"Attempting to run(), but is already running.\");const e=this._currentlyRunning=this._queue;this._queue=[];for(const i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1;}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[];}}var Ss=e.Y([{name:\"a_pos3d\",type:\"Int16\",components:3}]);class zs extends e.E{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom;}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;}update(t,i){this.sourceCache.update(t,i),this._renderableTilesKeys=[];const a={};for(const s of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))a[s.key]=!0,this._renderableTilesKeys.push(s.key),this._tiles[s.key]||(s.posMatrix=new Float64Array(16),e.aP(s.posMatrix,0,e.X,0,e.X,0,1),this._tiles[s.key]=new lt(s,this.tileSize));for(const t in this._tiles)a[t]||delete this._tiles[t];}freeRtt(t){for(const e in this._tiles){const i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[]);}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const i={};for(const a of this._renderableTilesKeys){const s=this._tiles[a].tileID;if(s.canonical.equals(t.canonical)){const s=t.clone();s.posMatrix=new Float64Array(16),e.aP(s.posMatrix,0,e.X,0,e.X,0,1),i[a]=s;}else if(s.canonical.isChildOf(t.canonical)){const o=t.clone();o.posMatrix=new Float64Array(16);const r=s.canonical.z-t.canonical.z,n=s.canonical.x-(s.canonical.x>>r<>r<>r;e.aP(o.posMatrix,0,h,0,h,0,1),e.J(o.posMatrix,o.posMatrix,[-n*h,-l*h,0]),i[a]=o;}else if(t.canonical.isChildOf(s.canonical)){const o=t.clone();o.posMatrix=new Float64Array(16);const r=t.canonical.z-s.canonical.z,n=t.canonical.x-(t.canonical.x>>r<>r<>r;e.aP(o.posMatrix,0,e.X,0,e.X,0,1),e.J(o.posMatrix,o.posMatrix,[n*h,l*h,0]),e.K(o.posMatrix,o.posMatrix,[1/2**r,1/2**r,0]),i[a]=o;}}return i}getSourceTile(t,e){const i=this.sourceCache._source;let a=t.overscaledZ-this.deltaZoom;if(a>i.maxzoom&&(a=i.maxzoom),a=i.minzoom&&(!s||!s.dem);)s=this.sourceCache.getTileByID(t.scaledTo(a--).key);return s}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter((e=>e.timeAdded>=t))}}class Ds{constructor(t,e,i){this.painter=t,this.sourceCache=new zs(e),this.options=i,this.exaggeration=\"number\"==typeof i.exaggeration?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024;}getDEMElevation(t,i,a,s=e.X){var o;if(!(i>=0&&i=0&&at.canonical.z&&(t.canonical.z>=a?s=t.canonical.z-a:e.w(\"cannot calculate elevation if elevation maxzoom > source.maxzoom\"));const o=t.canonical.x-(t.canonical.x>>s<>s<>8<<4|t>>8,i[e+3]=0;const a=new e.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),s=new b(t,a,t.gl.RGBA,{premultiply:!1});return s.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=s,s}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),a=this.painter.context,s=a.gl,o=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),r=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),n=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer(\"coords\").framebuffer),s.readPixels(o,n-r-1,1,1,s.RGBA,s.UNSIGNED_BYTE,i),a.bindFramebuffer.set(null);const l=i[0]+(i[2]>>4<<8),h=i[1]+((15&i[2])<<8),c=this.coordsIndex[255-i[3]],u=c&&this.sourceCache.getTileByID(c);if(!u)return null;const d=this._coordsTextureSize,_=(1<t.id!==e)),this._recentlyUsed.push(t.id);}stampObject(t){t.stamp=++this._stamp;}getOrCreateFreeObject(){for(const t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error(\"No free RenderPool available, call freeAllObjects() required!\");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1;}freeAllObjects(){for(const t of this._objects)this.freeObject(t);}isFull(){return !(this._objects.length!t.inUse))}}const As={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Rs{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new Ms(t.context,30,e.sourceCache.tileSize*e.qualityFactor);}destruct(){this.pool.destruct();}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter((i=>!t._layers[i].isHidden(e))),this._coordsDescendingInv={};for(const e in t.sourceCaches){this._coordsDescendingInv[e]={};const i=t.sourceCaches[e].getVisibleCoordinates();for(const t of i){const i=this.terrain.sourceCache.getTerrainCoords(t);for(const t in i)this._coordsDescendingInv[e][t]||(this._coordsDescendingInv[e][t]=[]),this._coordsDescendingInv[e][t].push(i[t]);}}this._coordsDescendingInvStr={};for(const e of t._order){const i=t._layers[e],a=i.source;if(As[i.type]&&!this._coordsDescendingInvStr[a]){this._coordsDescendingInvStr[a]={};for(const t in this._coordsDescendingInv[a])this._coordsDescendingInvStr[a][t]=this._coordsDescendingInv[a][t].map((t=>t.key)).sort().join();}}for(const t of this._renderableTiles)for(const e in this._coordsDescendingInvStr){const i=this._coordsDescendingInvStr[e][t.tileID.key];i&&i!==t.rttCoords[e]&&(t.rtt=[]);}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return !1;const i=t.type,a=this.painter,s=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(As[i]&&(this._prevType&&As[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(t.id),!s))return !0;if(As[this._prevType]||As[i]&&s){this._prevType=i;const t=this._stacks.length-1,s=this._stacks[t]||[];for(const i of this._renderableTiles){if(this.pool.isFull()&&(fa(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(i),i.rtt[t]){const e=this.pool.getObjectForId(i.rtt[t].id);if(e.stamp===i.rtt[t].stamp){this.pool.useObject(e);continue}}const o=this.pool.getOrCreateFreeObject();this.pool.useObject(o),this.pool.stampObject(o),i.rtt[t]={id:o.id,stamp:o.stamp},a.context.bindFramebuffer.set(o.fbo.framebuffer),a.context.clear({color:e.aM.transparent,stencil:0}),a.currentStencilSource=void 0;for(let t=0;t{t.touchstart=t.dragStart,t.touchmoveWindow=t.dragMove,t.touchend=t.dragEnd;},Os={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ns{constructor(t,i,a=!1){this.mousedown=t=>{this.startMouse(e.e({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),r.mousePos(this.element,t)),r.addEventListener(window,\"mousemove\",this.mousemove),r.addEventListener(window,\"mouseup\",this.mouseup);},this.mousemove=t=>{this.moveMouse(t,r.mousePos(this.element,t));},this.mouseup=t=>{this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp();},this.touchstart=t=>{1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),r.addEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),r.addEventListener(window,\"touchend\",this.touchend));},this.touchmove=t=>{1!==t.targetTouches.length?this.reset():(this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos));},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp();},this._clickTolerance=10;const s=t.dragRotate._mouseRotate.getClickTolerance(),o=t.dragRotate._mousePitch.getClickTolerance();this.element=i,this.mouseRotate=Ka({clickTolerance:s,enable:!0}),this.touchRotate=(({enable:t,clickTolerance:e,bearingDegreesPerPixelMoved:i=.8})=>{const a=new $a;return new Ga({clickTolerance:e,move:(t,e)=>({bearingDelta:(e.x-t.x)*i}),moveStateManager:a,enable:t,assignEvents:Bs})})({clickTolerance:s,enable:!0}),this.map=t,a&&(this.mousePitch=Ja({clickTolerance:o,enable:!0}),this.touchPitch=(({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:i=-.5})=>{const a=new $a;return new Ga({clickTolerance:e,move:(t,e)=>({pitchDelta:(e.y-t.y)*i}),moveStateManager:a,enable:t,assignEvents:Bs})})({clickTolerance:o,enable:!0})),r.addEventListener(i,\"mousedown\",this.mousedown),r.addEventListener(i,\"touchstart\",this.touchstart,{passive:!1}),r.addEventListener(i,\"touchcancel\",this.reset);}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),r.disableDrag();}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),r.disableDrag();}moveMouse(t,e){const i=this.map,{bearingDelta:a}=this.mouseRotate.dragMove(t,e)||{};if(a&&i.setBearing(i.getBearing()+a),this.mousePitch){const{pitchDelta:a}=this.mousePitch.dragMove(t,e)||{};a&&i.setPitch(i.getPitch()+a);}}moveTouch(t,e){const i=this.map,{bearingDelta:a}=this.touchRotate.dragMove(t,e)||{};if(a&&i.setBearing(i.getBearing()+a),this.touchPitch){const{pitchDelta:a}=this.touchPitch.dragMove(t,e)||{};a&&i.setPitch(i.getPitch()+a);}}off(){const t=this.element;r.removeEventListener(t,\"mousedown\",this.mousedown),r.removeEventListener(t,\"touchstart\",this.touchstart,{passive:!1}),r.removeEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),r.removeEventListener(window,\"touchend\",this.touchend),r.removeEventListener(t,\"touchcancel\",this.reset),this.offTemp();}offTemp(){r.enableDrag(),r.removeEventListener(window,\"mousemove\",this.mousemove),r.removeEventListener(window,\"mouseup\",this.mouseup),r.removeEventListener(window,\"touchmove\",this.touchmove,{passive:!1}),r.removeEventListener(window,\"touchend\",this.touchend);}}let Us;function js(t,i,a){const s=new e.N(t.lng,t.lat);if(t=new e.N(t.lng,t.lat),i){const s=new e.N(t.lng-360,t.lat),o=new e.N(t.lng+360,t.lat),r=a.locationPoint(t).distSqr(i);a.locationPoint(s).distSqr(i)180;){const e=a.locationPoint(t);if(e.x>=0&&e.y>=0&&e.x<=a.width&&e.y<=a.height)break;t.lng>a.center.lng?t.lng-=360:t.lng+=360;}return t.lng!==s.lng&&a.locationPoint(t).y>a.height/2-a.getHorizon()?t:s}const Zs={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 qs(t,e,i){const a=t.classList;for(const t in Zs)a.remove(`maplibregl-${i}-anchor-${t}`);a.add(`maplibregl-${i}-anchor-${e}`);}class Vs extends e.E{constructor(t){if(super(),this._onKeyPress=t=>{const e=t.code,i=t.charCode||t.keyCode;\"Space\"!==e&&\"Enter\"!==e&&32!==i&&13!==i||this.togglePopup();},this._onMapClick=t=>{const e=t.originalEvent.target,i=this._element;this._popup&&(e===i||i.contains(e))&&this.togglePopup();},this._update=t=>{var e;if(!this._map)return;const i=this._map.loaded()&&!this._map.isMoving();(\"terrain\"===(null==t?void 0:t.type)||\"render\"===(null==t?void 0:t.type)&&!i)&&this._map.once(\"render\",this._update),this._lngLat=this._map.transform.renderWorldCopies?js(this._lngLat,this._flatPos,this._map.transform):null===(e=this._lngLat)||void 0===e?void 0:e.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let a=\"\";\"viewport\"===this._rotationAlignment||\"auto\"===this._rotationAlignment?a=`rotateZ(${this._rotation}deg)`:\"map\"===this._rotationAlignment&&(a=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let s=\"\";\"viewport\"===this._pitchAlignment||\"auto\"===this._pitchAlignment?s=\"rotateX(0deg)\":\"map\"===this._pitchAlignment&&(s=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&\"moveend\"!==t.type||(this._pos=this._pos.round()),r.setTransform(this._element,`${Zs[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s} ${a}`),o.frameAsync(new AbortController).then((()=>{this._updateOpacity(t&&\"moveend\"===t.type);})).catch((()=>{}));},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.k(\"dragstart\"))),this.fire(new e.k(\"drag\")));},this._onUp=()=>{this._element.style.pointerEvents=\"auto\",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off(\"mousemove\",this._onMove),this._map.off(\"touchmove\",this._onMove),\"active\"===this._state&&this.fire(new e.k(\"dragend\")),this._state=\"inactive\";},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state=\"pending\",this._map.on(\"mousemove\",this._onMove),this._map.on(\"touchmove\",this._onMove),this._map.once(\"mouseup\",this._onUp),this._map.once(\"touchend\",this._onUp));},this._anchor=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._subpixelPositioning=t&&t.subpixelPositioning||!1,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,this.setOpacity(),this.setOpacity(null==t?void 0:t.opacity,null==t?void 0:t.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=e.P.convert(t&&t.offset||[0,0]);else {this._defaultMarker=!0,this._element=r.create(\"div\");const i=r.createNS(\"http://www.w3.org/2000/svg\",\"svg\"),a=41,s=27;i.setAttributeNS(null,\"display\",\"block\"),i.setAttributeNS(null,\"height\",`${a}px`),i.setAttributeNS(null,\"width\",`${s}px`),i.setAttributeNS(null,\"viewBox\",`0 0 ${s} ${a}`);const o=r.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 n=r.createNS(\"http://www.w3.org/2000/svg\",\"g\");n.setAttributeNS(null,\"fill-rule\",\"nonzero\");const l=r.createNS(\"http://www.w3.org/2000/svg\",\"g\");l.setAttributeNS(null,\"transform\",\"translate(3.0, 29.0)\"),l.setAttributeNS(null,\"fill\",\"#000000\");const h=[{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 t of h){const e=r.createNS(\"http://www.w3.org/2000/svg\",\"ellipse\");e.setAttributeNS(null,\"opacity\",\"0.04\"),e.setAttributeNS(null,\"cx\",\"10.5\"),e.setAttributeNS(null,\"cy\",\"5.80029008\"),e.setAttributeNS(null,\"rx\",t.rx),e.setAttributeNS(null,\"ry\",t.ry),l.appendChild(e);}const c=r.createNS(\"http://www.w3.org/2000/svg\",\"g\");c.setAttributeNS(null,\"fill\",this._color);const u=r.createNS(\"http://www.w3.org/2000/svg\",\"path\");u.setAttributeNS(null,\"d\",\"M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z\"),c.appendChild(u);const d=r.createNS(\"http://www.w3.org/2000/svg\",\"g\");d.setAttributeNS(null,\"opacity\",\"0.25\"),d.setAttributeNS(null,\"fill\",\"#000000\");const _=r.createNS(\"http://www.w3.org/2000/svg\",\"path\");_.setAttributeNS(null,\"d\",\"M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z\"),d.appendChild(_);const p=r.createNS(\"http://www.w3.org/2000/svg\",\"g\");p.setAttributeNS(null,\"transform\",\"translate(6.0, 7.0)\"),p.setAttributeNS(null,\"fill\",\"#FFFFFF\");const m=r.createNS(\"http://www.w3.org/2000/svg\",\"g\");m.setAttributeNS(null,\"transform\",\"translate(8.0, 8.0)\");const f=r.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=r.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\"),m.appendChild(f),m.appendChild(g),n.appendChild(l),n.appendChild(c),n.appendChild(d),n.appendChild(p),n.appendChild(m),i.appendChild(n),i.setAttributeNS(null,\"height\",a*this._scale+\"px\"),i.setAttributeNS(null,\"width\",s*this._scale+\"px\"),this._element.appendChild(i),this._offset=e.P.convert(t&&t.offset||[0,-14]);}if(this._element.classList.add(\"maplibregl-marker\"),this._element.addEventListener(\"dragstart\",(t=>{t.preventDefault();})),this._element.addEventListener(\"mousedown\",(t=>{t.preventDefault();})),qs(this._element,this._anchor,\"marker\"),t&&t.className)for(const e of t.className.split(\" \"))this._element.classList.add(e);this._popup=null;}addTo(t){return this.remove(),this._map=t,this._element.setAttribute(\"aria-label\",t._getUIString(\"Marker.Title\")),t.getCanvasContainer().appendChild(this._element),t.on(\"move\",this._update),t.on(\"moveend\",this._update),t.on(\"terrain\",this._update),this.setDraggable(this._draggable),this._update(),this._map.on(\"click\",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off(\"click\",this._onMapClick),this._map.off(\"move\",this._update),this._map.off(\"moveend\",this._update),this._map.off(\"terrain\",this._update),this._map.off(\"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),r.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.N.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener(\"keypress\",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute(\"tabindex\")),t){if(!(\"offset\"in t.options)){const e=38.1,i=13.5,a=Math.abs(i)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],\"top-left\":[0,0],\"top-right\":[0,0],bottom:[0,-e],\"bottom-left\":[a,-1*(e-i+a)],\"bottom-right\":[-a,-1*(e-i+a)],left:[i,-1*(e-i)],right:[-i,-1*(e-i)]}:this._offset;}this._popup=t,this._originalTabIndex=this._element.getAttribute(\"tabindex\"),this._originalTabIndex||this._element.setAttribute(\"tabindex\",\"0\"),this._element.addEventListener(\"keypress\",this._onKeyPress);}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var i,a;if(!(null===(i=this._map)||void 0===i?void 0:i.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(t)this._opacityTimeout=null;else {if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null;}),100);}const s=this._map,o=s.terrain.depthAtPoint(this._pos),r=s.terrain.getElevationForLngLatZoom(this._lngLat,s.transform.tileZoom);if(s.transform.lngLatToCameraDepth(this._lngLat,r)-o<.006)return void(this._element.style.opacity=this._opacity);const n=-this._offset.y/s.transform._pixelPerMeter,l=Math.sin(s.getPitch()*Math.PI/180)*n,h=s.terrain.depthAtPoint(new e.P(this._pos.x,this._pos.y-this._offset.y)),c=s.transform.lngLatToCameraDepth(this._lngLat,r+l)-h>.006;(null===(a=this._popup)||void 0===a?void 0:a.isOpen())&&c&&this._popup.remove(),this._element.style.opacity=c?this._opacityWhenCovered:this._opacity;}getOffset(){return this._offset}setOffset(t){return this._offset=e.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t);}removeClassName(t){this._element.classList.remove(t);}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(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(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||\"auto\",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&\"auto\"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,e){return void 0===t&&void 0===e&&(this._opacity=\"1\",this._opacityWhenCovered=\"0.2\"),void 0!==t&&(this._opacity=t),void 0!==e&&(this._opacityWhenCovered=e),this._map&&this._updateOpacity(!0),this}}const Gs={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Hs=0,Ws=!1;const $s={maxWidth:100,unit:\"metric\"};function Xs(t,e,i){const a=i&&i.maxWidth||100,s=t._container.clientHeight/2,o=t.unproject([0,s]),r=t.unproject([a,s]),n=o.distanceTo(r);if(i&&\"imperial\"===i.unit){const i=3.2808*n;i>5280?Ks(e,a,i/5280,t._getUIString(\"ScaleControl.Miles\")):Ks(e,a,i,t._getUIString(\"ScaleControl.Feet\"));}else i&&\"nautical\"===i.unit?Ks(e,a,n/1852,t._getUIString(\"ScaleControl.NauticalMiles\")):n>=1e3?Ks(e,a,n/1e3,t._getUIString(\"ScaleControl.Kilometers\")):Ks(e,a,n,t._getUIString(\"ScaleControl.Meters\"));}function Ks(t,e,i,a){const s=function(t){const e=Math.pow(10,`${Math.floor(t)}`.length-1);let i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(t){const e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(i),e*i}(i);t.style.width=e*(s/i)+\"px\",t.innerHTML=`${s} ${a}`;}const Js={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:\"\",maxWidth:\"240px\",subpixelPositioning:!1},Ys=[\"a[href]\",\"[tabindex]:not([tabindex='-1'])\",\"[contenteditable]:not([contenteditable='false'])\",\"button:not([disabled])\",\"input:not([disabled])\",\"select:not([disabled])\",\"textarea:not([disabled])\"].join(\", \");function Qs(t){if(t){if(\"number\"==typeof t){const i=Math.round(Math.abs(t)/Math.SQRT2);return {center:new e.P(0,0),top:new e.P(0,t),\"top-left\":new e.P(i,i),\"top-right\":new e.P(-i,i),bottom:new e.P(0,-t),\"bottom-left\":new e.P(i,-i),\"bottom-right\":new e.P(-i,-i),left:new e.P(t,0),right:new e.P(-t,0)}}if(t instanceof e.P||Array.isArray(t)){const i=e.P.convert(t);return {center:i,top:i,\"top-left\":i,\"top-right\":i,bottom:i,\"bottom-left\":i,\"bottom-right\":i,left:i,right:i}}return {center:e.P.convert(t.center||[0,0]),top:e.P.convert(t.top||[0,0]),\"top-left\":e.P.convert(t[\"top-left\"]||[0,0]),\"top-right\":e.P.convert(t[\"top-right\"]||[0,0]),bottom:e.P.convert(t.bottom||[0,0]),\"bottom-left\":e.P.convert(t[\"bottom-left\"]||[0,0]),\"bottom-right\":e.P.convert(t[\"bottom-right\"]||[0,0]),left:e.P.convert(t.left||[0,0]),right:e.P.convert(t.right||[0,0])}}return Qs(new e.P(0,0))}const to=i;t.AJAXError=e.bh,t.Evented=e.E,t.LngLat=e.N,t.MercatorCoordinate=e.Z,t.Point=e.P,t.addProtocol=e.bi,t.config=e.a,t.removeProtocol=e.bj,t.AttributionControl=Es,t.BoxZoomHandler=Ua,t.CanvasSource=et,t.CooperativeGesturesHandler=vs,t.DoubleClickZoomHandler=ds,t.DragPanHandler=ms,t.DragRotateHandler=fs,t.EdgeInsets=ba,t.FullscreenControl=class extends e.E{constructor(t={}){super(),this._onFullscreenChange=()=>{var t;let e=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;null===(t=null==e?void 0:e.shadowRoot)||void 0===t?void 0:t.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange();},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen();},this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:e.w(\"Full screen control 'container' must be a DOM element.\")),\"onfullscreenchange\"in document?this._fullscreenchange=\"fullscreenchange\":\"onmozfullscreenchange\"in document?this._fullscreenchange=\"mozfullscreenchange\":\"onwebkitfullscreenchange\"in document?this._fullscreenchange=\"webkitfullscreenchange\":\"onmsfullscreenchange\"in document&&(this._fullscreenchange=\"MSFullscreenChange\");}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._setupUI(),this._controlContainer}onRemove(){r.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange);}_setupUI(){const t=this._fullscreenButton=r.create(\"button\",\"maplibregl-ctrl-fullscreen\",this._controlContainer);r.create(\"span\",\"maplibregl-ctrl-icon\",t).setAttribute(\"aria-hidden\",\"true\"),t.type=\"button\",this._updateTitle(),this._fullscreenButton.addEventListener(\"click\",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange);}_updateTitle(){const t=this._getTitle();this._fullscreenButton.setAttribute(\"aria-label\",t),this._fullscreenButton.title=t;}_getTitle(){return this._map._getUIString(this._isFullscreen()?\"FullscreenControl.Exit\":\"FullscreenControl.Enter\")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(\"maplibregl-ctrl-shrink\"),this._fullscreenButton.classList.toggle(\"maplibregl-ctrl-fullscreen\"),this._updateTitle(),this._fullscreen?(this.fire(new e.k(\"fullscreenstart\")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new e.k(\"fullscreenend\")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable());}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen();}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen();}_togglePseudoFullScreen(){this._container.classList.toggle(\"maplibregl-pseudo-fullscreen\"),this._handleFullscreenChange(),this._map.resize();}},t.GeoJSONSource=J,t.GeolocateControl=class extends e.E{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.k(\"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\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");break;case\"BACKGROUND\":case\"BACKGROUND_ERROR\":this._watchState=\"BACKGROUND\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background\");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&\"OFF\"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&\"ACTIVE_LOCK\"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove(\"maplibregl-user-location-dot-stale\"),this.fire(new e.k(\"geolocate\",t)),this._finish();}},this._updateCamera=t=>{const i=new e.N(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,s=this._map.getBearing(),o=e.e({bearing:s},this.options.fitBoundsOptions),r=H.fromLngLat(i,a);this._map.fitBounds(r,o,{geolocateSource:!0});},this._updateMarker=t=>{if(t){const i=new e.N(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove();},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius();},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState=\"OFF\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background-error\"),this._geolocateButton.disabled=!0;const t=this._map._getUIString(\"GeolocateControl.LocationNotAvailable\");this._geolocateButton.title=t,this._geolocateButton.setAttribute(\"aria-label\",t),void 0!==this._geolocationWatchID&&this._clearWatch();}else {if(3===t.code&&Ws)return;this._setErrorState();}\"OFF\"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add(\"maplibregl-user-location-dot-stale\"),this.fire(new e.k(\"error\",t)),this._finish();}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0;},this._setupUI=()=>{this._map&&(this._container.addEventListener(\"contextmenu\",(t=>t.preventDefault())),this._geolocateButton=r.create(\"button\",\"maplibregl-ctrl-geolocate\",this._container),r.create(\"span\",\"maplibregl-ctrl-icon\",this._geolocateButton).setAttribute(\"aria-hidden\",\"true\"),this._geolocateButton.type=\"button\",this._geolocateButton.disabled=!0);},this._finishSetupUI=t=>{if(this._map){if(!1===t){e.w(\"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 t=this._map._getUIString(\"GeolocateControl.FindMyLocation\");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute(\"aria-label\",t);}this.options.trackUserLocation&&(this._geolocateButton.setAttribute(\"aria-pressed\",\"false\"),this._watchState=\"OFF\"),this.options.showUserLocation&&(this._dotElement=r.create(\"div\",\"maplibregl-user-location-dot\"),this._userLocationDotMarker=new Vs({element:this._dotElement}),this._circleElement=r.create(\"div\",\"maplibregl-user-location-accuracy-circle\"),this._accuracyCircleMarker=new Vs({element:this._circleElement,pitchAlignment:\"map\"}),this.options.trackUserLocation&&(this._watchState=\"OFF\"),this._map.on(\"zoom\",this._onZoom)),this._geolocateButton.addEventListener(\"click\",(()=>this.trigger())),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\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this.fire(new e.k(\"trackuserlocationend\")),this.fire(new e.k(\"userlocationlostfocus\")));}));}},this.options=e.e({},Gs,t);}onAdd(t){return this._map=t,this._container=r.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._setupUI(),function(){return e._(this,arguments,void 0,(function*(t=!1){if(void 0!==Us&&!t)return Us;if(void 0===window.navigator.permissions)return Us=!!window.navigator.geolocation,Us;try{const t=yield window.navigator.permissions.query({name:\"geolocation\"});Us=\"denied\"!==t.state;}catch(t){Us=!!window.navigator.geolocation;}return Us}))}().then((t=>this._finishSetupUI(t))),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(),r.remove(this._container),this._map.off(\"zoom\",this._onZoom),this._map=void 0,Hs=0,Ws=!1;}_isOutOfMapMaxBounds(t){const e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitudee.getEast()||i.latitudee.getNorth())}_setErrorState(){switch(this._watchState){case\"WAITING_ACTIVE\":this._watchState=\"ACTIVE_ERROR\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active-error\");break;case\"ACTIVE_LOCK\":this._watchState=\"ACTIVE_ERROR\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\");break;case\"BACKGROUND\":this._watchState=\"BACKGROUND_ERROR\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-background-error\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\");break;case\"ACTIVE_ERROR\":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const t=this._map.getBounds(),e=t.getSouthEast(),i=t.getNorthEast(),a=e.distanceTo(i),s=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${s}px`,this._circleElement.style.height=`${s}px`;}trigger(){if(!this._setup)return e.w(\"Geolocate control triggered before added to a map\"),!1;if(this.options.trackUserLocation){switch(this._watchState){case\"OFF\":this._watchState=\"WAITING_ACTIVE\",this.fire(new e.k(\"trackuserlocationstart\"));break;case\"WAITING_ACTIVE\":case\"ACTIVE_LOCK\":case\"ACTIVE_ERROR\":case\"BACKGROUND_ERROR\":Hs--,Ws=!1,this._watchState=\"OFF\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-active-error\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"),this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background-error\"),this.fire(new e.k(\"trackuserlocationend\"));break;case\"BACKGROUND\":this._watchState=\"ACTIVE_LOCK\",this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-background\"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.k(\"trackuserlocationstart\")),this.fire(new e.k(\"userlocationfocus\"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case\"WAITING_ACTIVE\":this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");break;case\"ACTIVE_LOCK\":this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-active\");break;case\"OFF\":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(\"OFF\"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.setAttribute(\"aria-pressed\",\"true\"),Hs++,Hs>1?(t={maximumAge:6e5,timeout:0},Ws=!0):(t=this.options.positionOptions,Ws=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t);}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return !0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove(\"maplibregl-ctrl-geolocate-waiting\"),this._geolocateButton.setAttribute(\"aria-pressed\",\"false\"),this.options.showUserLocation&&this._updateMarker(null);}},t.Hash=Ea,t.ImageSource=Q,t.KeyboardHandler=ls,t.LngLatBounds=H,t.LogoControl=Ps,t.Map=class extends Ts{constructor(t){e.bf.mark(e.bg.create);const i=Object.assign(Object.assign({},Fs),t);if(null!=i.minZoom&&null!=i.maxZoom&&i.minZoom>i.maxZoom)throw new Error(\"maxZoom must be greater than or equal to minZoom\");if(null!=i.minPitch&&null!=i.maxPitch&&i.minPitch>i.maxPitch)throw new Error(\"maxPitch must be greater than or equal to minPitch\");if(null!=i.minPitch&&i.minPitch<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(null!=i.maxPitch&&i.maxPitch>85)throw new Error(\"maxPitch must be less than or equal to 85\");if(super(new Ta(i.minZoom,i.maxZoom,i.minPitch,i.maxPitch,i.renderWorldCopies),{bearingSnap:i.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Cs,this._controls=[],this._mapId=e.a4(),this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new e.k(\"webglcontextlost\",{originalEvent:t}));},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new e.k(\"webglcontextrestored\",{originalEvent:t}));},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update();},this._interactive=i.interactive,this._maxTileCacheSize=i.maxTileCacheSize,this._maxTileCacheZoomLevels=i.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=!0===i.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=!0===i.preserveDrawingBuffer,this._antialias=!0===i.antialias,this._trackResize=!0===i.trackResize,this._bearingSnap=i.bearingSnap,this._refreshExpiredTiles=!0===i.refreshExpiredTiles,this._fadeDuration=i.fadeDuration,this._crossSourceCollisions=!0===i.crossSourceCollisions,this._collectResourceTiming=!0===i.collectResourceTiming,this._locale=Object.assign(Object.assign({},ks),i.locale),this._clickTolerance=i.clickTolerance,this._overridePixelRatio=i.pixelRatio,this._maxCanvasSize=i.maxCanvasSize,this.transformCameraUpdate=i.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=!0===i.cancelPendingTileRequestsWhileZooming,this._imageQueueHandle=_.addThrottleControl((()=>this.isMoving())),this._requestManager=new p(i.transformRequest),\"string\"==typeof i.container){if(this._container=document.getElementById(i.container),!this._container)throw new Error(`Container '${i.container}' not found.`)}else {if(!(i.container instanceof HTMLElement))throw new Error(\"Invalid type: 'container' must be a String or HTMLElement.\");this._container=i.container;}if(i.maxBounds&&this.setMaxBounds(i.maxBounds),this._setupContainer(),this._setupPainter(),this.on(\"move\",(()=>this._update(!1))).on(\"moveend\",(()=>this._update(!1))).on(\"zoom\",(()=>this._update(!0))).on(\"terrain\",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0);})).once(\"idle\",(()=>{this._idleTriggered=!0;})),\"undefined\"!=typeof window){addEventListener(\"online\",this._onWindowOnline,!1);let t=!1;const e=Ia((t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw());}),50);this._resizeObserver=new ResizeObserver((i=>{t?e(i):t=!0;})),this._resizeObserver.observe(this._container);}this.handlers=new ws(this,i),this._hash=i.hash&&new Ea(\"string\"==typeof i.hash&&i.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch}),i.bounds&&(this.resize(),this.fitBounds(i.bounds,e.e({},i.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=i.localIdeographFontFamily,this._validateStyle=i.validateStyle,i.style&&this.setStyle(i.style,{localIdeographFontFamily:i.localIdeographFontFamily}),i.attributionControl&&this.addControl(new Es(\"boolean\"==typeof i.attributionControl?void 0:i.attributionControl)),i.maplibreLogo&&this.addControl(new Ps,i.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.k(`${t.dataType}data`,t));})),this.on(\"dataloading\",(t=>{this.fire(new e.k(`${t.dataType}dataloading`,t));})),this.on(\"dataabort\",(t=>{this.fire(new e.k(\"sourcedataabort\",t));}));}_getMapId(){return this._mapId}addControl(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():\"top-right\"),!t||!t.onAdd)return this.fire(new e.j(new Error(\"Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.\")));const a=t.onAdd(this);this._controls.push(t);const s=this._controlPositions[i];return -1!==i.indexOf(\"bottom\")?s.insertBefore(a,s.firstChild):s.appendChild(a),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new e.j(new Error(\"Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.\")));const i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,e,i,a){return null==a&&this.terrain&&(a=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,e,i,a)}resize(t){var i;const a=this._containerDimensions(),s=a[0],o=a[1],r=this._getClampedPixelRatio(s,o);if(this._resizeCanvas(s,o,r),this.painter.resize(s,o,r),this.painter.overLimit()){const t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];const e=this._getClampedPixelRatio(s,o);this._resizeCanvas(s,o,e),this.painter.resize(s,o,e);}this.transform.resize(s,o),null===(i=this._requestedCameraState)||void 0===i||i.resize(s,o);const n=!this._moving;return n&&(this.stop(),this.fire(new e.k(\"movestart\",t)).fire(new e.k(\"move\",t))),this.fire(new e.k(\"resize\",t)),n&&this.fire(new e.k(\"moveend\",t)),this}_getClampedPixelRatio(t,e){const{0:i,1:a}=this._maxCanvasSize,s=this.getPixelRatio(),o=t*s,r=e*s;return Math.min(o>i?i/o:1,r>a?a/r:1)*s}getPixelRatio(){var t;return null!==(t=this._overridePixelRatio)&&void 0!==t?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize();}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(H.convert(t)),this._update()}setMinZoom(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error(\"maxZoom must be greater than the current minZoom\")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=null==t?0:t)<0)throw new Error(\"minPitch must be greater than or equal to 0\");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()85)throw new Error(\"maxPitch must be less than or equal to 85\");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error(\"maxPitch must be greater than the current minPitch\")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(t){return this.transform.locationPoint(e.N.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.pointLocation(e.P.convert(t),this.terrain)}isMoving(){var t;return this._moving||(null===(t=this.handlers)||void 0===t?void 0:t.isMoving())}isZooming(){var t;return this._zooming||(null===(t=this.handlers)||void 0===t?void 0:t.isZooming())}isRotating(){var t;return this._rotating||(null===(t=this.handlers)||void 0===t?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if(\"mouseenter\"===t||\"mouseover\"===t){let a=!1;const s=s=>{const o=e.filter((t=>this.getLayer(t))),r=0!==o.length?this.queryRenderedFeatures(s.point,{layers:o}):[];r.length?a||(a=!0,i.call(this,new ka(t,this,s.originalEvent,{features:r}))):a=!1;};return {layers:e,listener:i,delegates:{mousemove:s,mouseout:()=>{a=!1;}}}}if(\"mouseleave\"===t||\"mouseout\"===t){let a=!1;const s=s=>{const o=e.filter((t=>this.getLayer(t)));(0!==o.length?this.queryRenderedFeatures(s.point,{layers:o}):[]).length?a=!0:a&&(a=!1,i.call(this,new ka(t,this,s.originalEvent)));},o=e=>{a&&(a=!1,i.call(this,new ka(t,this,e.originalEvent)));};return {layers:e,listener:i,delegates:{mousemove:s,mouseout:o}}}{const a=t=>{const a=e.filter((t=>this.getLayer(t))),s=0!==a.length?this.queryRenderedFeatures(t.point,{layers:a}):[];s.length&&(t.features=s,i.call(this,t),delete t.features);};return {layers:e,listener:i,delegates:{[t]:a}}}}_saveDelegatedListener(t,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(e);}_removeDelegatedListener(t,e,i){if(!this._delegatedListeners||!this._delegatedListeners[t])return;const a=this._delegatedListeners[t];for(let t=0;te.includes(t)))){for(const t in s.delegates)this.off(t,s.delegates[t]);return void a.splice(t,1)}}}on(t,e,i){if(void 0===i)return super.on(t,e);const a=this._createDelegatedListener(t,\"string\"==typeof e?[e]:e,i);this._saveDelegatedListener(t,a);for(const t in a.delegates)this.on(t,a.delegates[t]);return this}once(t,e,i){if(void 0===i)return super.once(t,e);const a=\"string\"==typeof e?[e]:e,s=this._createDelegatedListener(t,a,i);for(const e in s.delegates){const o=s.delegates[e];s.delegates[e]=(...e)=>{this._removeDelegatedListener(t,a,i),o(...e);};}this._saveDelegatedListener(t,s);for(const t in s.delegates)this.once(t,s.delegates[t]);return this}off(t,e,i){return void 0===i?super.off(t,e):(this._removeDelegatedListener(t,\"string\"==typeof e?[e]:e,i),this)}queryRenderedFeatures(t,i){if(!this.style)return [];let a;const s=t instanceof e.P||Array.isArray(t),o=s?t:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(s?{}:t)||{},o instanceof e.P||\"number\"==typeof o[0])a=[e.P.convert(o)];else {const t=e.P.convert(o[0]),i=e.P.convert(o[1]);a=[t,new e.P(i.x,t.y),i,new e.P(t.x,i.y),t];}return this.style.queryRenderedFeatures(a,i,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(t,i){return !1!==(i=e.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(t,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){const e=this._locale[t];if(null==e)throw new Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once(\"style.load\",(()=>this._updateStyle(t,e)));const i=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new de(this,e||{}),this.style.setEventedParent(this,{style:this.style}),\"string\"==typeof t?this.style.loadURL(t,e,i):this.style.loadJSON(t,e,i),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new de(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty());}_diffStyle(t,i){if(\"string\"==typeof t){const a=this._requestManager.transformRequest(t,\"Style\");e.h(a,new AbortController).then((t=>{this._updateDiff(t.data,i);})).catch((t=>{t&&this.fire(new e.j(t));}));}else \"object\"==typeof t&&this._updateDiff(t,i);}_updateDiff(t,i){try{this.style.setState(t,i)&&this._update(!0);}catch(a){e.w(`Unable to perform style diff: ${a.message||a.error||a}. Rebuilding the style from scratch.`),this._updateStyle(t,i);}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():e.w(\"There is no style added to the map.\")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){const i=this.style&&this.style.sourceCaches[t];if(void 0!==i)return i.loaded();this.fire(new e.j(new Error(`There is no source with ID '${t}'`)));}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off(\"data\",this._terrainDataCallback),t){const i=this.style.sourceCaches[t.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);null===this.terrain&&i.reload();for(const i in this.style._layers){const a=this.style._layers[i];\"hillshade\"===a.type&&a.source===t.source&&e.w(\"You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.\");}this.terrain=new Ds(this.painter,i,t),this.painter.renderToTexture=new Rs(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=e=>{\"style\"===e.dataType?this.terrain.sourceCache.freeRtt():\"source\"===e.dataType&&e.tile&&(e.sourceId!==t.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(e.tile.tileID));},this.style.on(\"data\",this._terrainDataCallback);}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new e.k(\"terrain\",{terrain:t})),this}getTerrain(){var t,e;return null!==(e=null===(t=this.terrain)||void 0===t?void 0:t.options)&&void 0!==e?e:null}areTilesLoaded(){const t=this.style&&this.style.sourceCaches;for(const e in t){const i=t[e]._tiles;for(const t in i){const e=i[t];if(\"loaded\"!==e.state&&\"errored\"!==e.state)return !1}}return !0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(t,i,a={}){const{pixelRatio:s=1,sdf:r=!1,stretchX:n,stretchY:l,content:h,textFitWidth:c,textFitHeight:u}=a;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||e.b(i))){if(void 0===i.width||void 0===i.height)return this.fire(new e.j(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:a,height:o,data:d}=i,_=i;return this.style.addImage(t,{data:new e.R({width:a,height:o},new Uint8Array(d)),pixelRatio:s,stretchX:n,stretchY:l,content:h,textFitWidth:c,textFitHeight:u,sdf:r,version:0,userImage:_}),_.onAdd&&_.onAdd(this,t),this}}{const{width:a,height:d,data:_}=o.getImageData(i);this.style.addImage(t,{data:new e.R({width:a,height:d},_),pixelRatio:s,stretchX:n,stretchY:l,content:h,textFitWidth:c,textFitHeight:u,sdf:r,version:0});}}updateImage(t,i){const a=this.style.getImage(t);if(!a)return this.fire(new e.j(new Error(\"The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.\")));const s=i instanceof HTMLImageElement||e.b(i)?o.getImageData(i):i,{width:r,height:n,data:l}=s;if(void 0===r||void 0===n)return this.fire(new e.j(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(r!==a.data.width||n!==a.data.height)return this.fire(new e.j(new Error(\"The width and height of the updated image must be that same as the previous version of the image\")));const h=!(i instanceof HTMLImageElement||e.b(i));return a.data.replace(l,h),this.style.updateImage(t,a),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new e.j(new Error(\"Missing required image id\"))),!1)}removeImage(t){this.style.removeImage(t);}loadImage(t){return _.getImage(this._requestManager.transformRequest(t,\"Image\"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,a={}){return this.style.setPaintProperty(t,e,i,a),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,a={}){return this.style.setLayoutProperty(t,e,i,a),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(t=>{t||this._update(!0);})),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(t=>{t||this._update(!0);})),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(t){return this._lazyInitEmptyStyle(),this.style.setSky(t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupContainer(){const t=this._container;t.classList.add(\"maplibregl-map\");const e=this._canvasContainer=r.create(\"div\",\"maplibregl-canvas-container\",t);this._interactive&&e.classList.add(\"maplibregl-interactive\"),this._canvas=r.create(\"canvas\",\"maplibregl-canvas\",e),this._canvas.addEventListener(\"webglcontextlost\",this._contextLost,!1),this._canvas.addEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.setAttribute(\"tabindex\",this._interactive?\"0\":\"-1\"),this._canvas.setAttribute(\"aria-label\",this._getUIString(\"Map.Title\")),this._canvas.setAttribute(\"role\",\"region\");const i=this._containerDimensions(),a=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],a);const s=this._controlContainer=r.create(\"div\",\"maplibregl-control-container\",t),o=this._controlPositions={};[\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"].forEach((t=>{o[t]=r.create(\"div\",`maplibregl-ctrl-${t} `,s);})),this._container.addEventListener(\"scroll\",this._onMapScroll,!1);}_resizeCanvas(t,e,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`;}_setupPainter(){const t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let e=null;this._canvas.addEventListener(\"webglcontextcreationerror\",(i=>{e={requestedAttributes:t},i&&(e.statusMessage=i.statusMessage,e.type=i.type);}),{once:!0});const i=this._canvas.getContext(\"webgl2\",t)||this._canvas.getContext(\"webgl\",t);if(!i){const t=\"Failed to initialize WebGL\";throw e?(e.message=t,new Error(JSON.stringify(e))):new Error(t)}this.painter=new va(i,this.transform),n.testSupport(i);}loaded(){return !this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t);}_render(t){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let a=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const t=this.transform.zoom,s=o.now();this.style.zoomHistory.update(t,s);const r=new e.z(t,{now:s,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=r.crossFadingFactor();1===n&&n===this._crossFadingFactor||(a=!0,this._crossFadingFactor=n),this.style.update(r);}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new e.k(\"render\")),this.loaded()&&!this._loaded&&(this._loaded=!0,e.bf.mark(e.bg.load),this.fire(new e.k(\"load\"))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new e.k(\"idle\")),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0,e.bf.mark(e.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),\"undefined\"!=typeof window&&removeEventListener(\"online\",this._onWindowOnline,!1),_.removeThrottleControl(this._imageQueueHandle),null===(t=this._resizeObserver)||void 0===t||t.disconnect();const i=this.painter.context.gl.getExtension(\"WEBGL_lose_context\");(null==i?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.removeEventListener(\"webglcontextlost\",this._contextLost,!1),r.remove(this._canvasContainer),r.remove(this._controlContainer),this._container.classList.remove(\"maplibregl-map\"),e.bf.clearMetrics(),this._removed=!0,this.fire(new e.k(\"remove\"));}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,o.frameAsync(this._frameRequest).then((t=>{e.bf.frame(t),this._frameRequest=null,this._render(t);})).catch((()=>{})));}get showTileBoundaries(){return !!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update());}get showPadding(){return !!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update());}get showCollisionBoxes(){return !!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update());}get showOverdrawInspector(){return !!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update());}get repaint(){return !!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint());}get vertices(){return !!this._vertices}set vertices(t){this._vertices=t,this._update();}get version(){return Ls}getCameraTargetElevation(){return this.transform.elevation}},t.MapMouseEvent=ka,t.MapTouchEvent=La,t.MapWheelEvent=Fa,t.Marker=Vs,t.NavigationControl=class{constructor(t){this._updateZoomButtons=()=>{const t=this._map.getZoom(),e=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute(\"aria-disabled\",e.toString()),this._zoomOutButton.setAttribute(\"aria-disabled\",i.toString());},this._rotateCompassArrow=()=>{const t=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=t;},this._setButtonTitle=(t,e)=>{const i=this._map._getUIString(`NavigationControl.${e}`);t.title=i,t.setAttribute(\"aria-label\",i);},this.options=e.e({},Os,t),this._container=r.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._container.addEventListener(\"contextmenu\",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton(\"maplibregl-ctrl-zoom-in\",(t=>this._map.zoomIn({},{originalEvent:t}))),r.create(\"span\",\"maplibregl-ctrl-icon\",this._zoomInButton).setAttribute(\"aria-hidden\",\"true\"),this._zoomOutButton=this._createButton(\"maplibregl-ctrl-zoom-out\",(t=>this._map.zoomOut({},{originalEvent:t}))),r.create(\"span\",\"maplibregl-ctrl-icon\",this._zoomOutButton).setAttribute(\"aria-hidden\",\"true\")),this.options.showCompass&&(this._compass=this._createButton(\"maplibregl-ctrl-compass\",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t});})),this._compassIcon=r.create(\"span\",\"maplibregl-ctrl-icon\",this._compass),this._compassIcon.setAttribute(\"aria-hidden\",\"true\"));}onAdd(t){return this._map=t,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 Ns(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){r.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(t,e){const i=r.create(\"button\",t,this._container);return i.type=\"button\",i.addEventListener(\"click\",e),i}},t.Popup=class extends e.E{constructor(t){super(),this.remove=()=>(this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off(\"move\",this._update),this._map.off(\"move\",this._onClose),this._map.off(\"click\",this._onClose),this._map.off(\"remove\",this.remove),this._map.off(\"mousemove\",this._onMouseMove),this._map.off(\"mouseup\",this._onMouseUp),this._map.off(\"drag\",this._onDrag),this._map._canvasContainer.classList.remove(\"maplibregl-track-pointer\"),delete this._map,this.fire(new e.k(\"close\"))),this),this._onMouseUp=t=>{this._update(t.point);},this._onMouseMove=t=>{this._update(t.point);},this._onDrag=t=>{this._update(t.point);},this._update=t=>{var e;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=r.create(\"div\",\"maplibregl-popup\",this._map.getContainer()),this._tip=r.create(\"div\",\"maplibregl-popup-tip\",this._container),this._container.appendChild(this._content),this.options.className)for(const t of this.options.className.split(\" \"))this._container.classList.add(t);this._closeButton&&this._closeButton.setAttribute(\"aria-label\",this._map._getUIString(\"Popup.Close\")),this._trackPointer&&this._container.classList.add(\"maplibregl-popup-track-pointer\");}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?js(this._lngLat,this._flatPos,this._map.transform):null===(e=this._lngLat)||void 0===e?void 0:e.wrap(),this._trackPointer&&!t)return;const i=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let a=this.options.anchor;const s=Qs(this.options.offset);if(!a){const t=this._container.offsetWidth,e=this._container.offsetHeight;let o;o=i.y+s.bottom.ythis._map.transform.height-e?[\"bottom\"]:[],i.xthis._map.transform.width-t/2&&o.push(\"right\"),a=0===o.length?\"bottom\":o.join(\"-\");}let o=i.add(s[a]);this.options.subpixelPositioning||(o=o.round()),r.setTransform(this._container,`${Zs[a]} translate(${o.x}px,${o.y}px)`),qs(this._container,a,\"popup\");},this._onClose=()=>{this.remove();},this.options=e.e(Object.create(Js),t);}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\"),this._map._canvasContainer.classList.add(\"maplibregl-track-pointer\")):this._map.on(\"move\",this._update),this.fire(new e.k(\"open\")),this}isOpen(){return !!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=e.N.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on(\"move\",this._update),this._map.off(\"mousemove\",this._onMouseMove),this._container&&this._container.classList.remove(\"maplibregl-popup-track-pointer\"),this._map._canvasContainer.classList.remove(\"maplibregl-track-pointer\")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off(\"move\",this._update),this._map.on(\"mousemove\",this._onMouseMove),this._map.on(\"drag\",this._onDrag),this._container&&this._container.classList.add(\"maplibregl-popup-track-pointer\"),this._map._canvasContainer.classList.add(\"maplibregl-track-pointer\")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){const e=document.createDocumentFragment(),i=document.createElement(\"body\");let a;for(i.innerHTML=t;a=i.firstChild,a;)e.appendChild(a);return this.setDOMContent(e)}getMaxWidth(){var t;return null===(t=this._container)||void 0===t?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=r.create(\"div\",\"maplibregl-popup-content\",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t;}_createCloseButton(){this.options.closeButton&&(this._closeButton=r.create(\"button\",\"maplibregl-popup-close-button\",this._content),this._closeButton.type=\"button\",this._closeButton.innerHTML=\"×\",this._closeButton.addEventListener(\"click\",this._onClose));}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const t=this._container.querySelector(Ys);t&&t.focus();}},t.RasterDEMTileSource=K,t.RasterTileSource=X,t.ScaleControl=class{constructor(t){this._onMove=()=>{Xs(this._map,this._container,this.options);},this.setUnit=t=>{this.options.unit=t,Xs(this._map,this._container,this.options);},this.options=Object.assign(Object.assign({},$s),t);}getDefaultPosition(){return \"bottom-left\"}onAdd(t){return this._map=t,this._container=r.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-scale\",t.getContainer()),this._map.on(\"move\",this._onMove),this._onMove(),this._container}onRemove(){r.remove(this._container),this._map.off(\"move\",this._onMove),this._map=void 0;}},t.ScrollZoomHandler=us,t.Style=de,t.TerrainControl=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon();},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove(\"maplibregl-ctrl-terrain\"),this._terrainButton.classList.remove(\"maplibregl-ctrl-terrain-enabled\"),this._map.terrain?(this._terrainButton.classList.add(\"maplibregl-ctrl-terrain-enabled\"),this._terrainButton.title=this._map._getUIString(\"TerrainControl.Disable\")):(this._terrainButton.classList.add(\"maplibregl-ctrl-terrain\"),this._terrainButton.title=this._map._getUIString(\"TerrainControl.Enable\"));},this.options=t;}onAdd(t){return this._map=t,this._container=r.create(\"div\",\"maplibregl-ctrl maplibregl-ctrl-group\"),this._terrainButton=r.create(\"button\",\"maplibregl-ctrl-terrain\",this._container),r.create(\"span\",\"maplibregl-ctrl-icon\",this._terrainButton).setAttribute(\"aria-hidden\",\"true\"),this._terrainButton.type=\"button\",this._terrainButton.addEventListener(\"click\",this._toggleTerrain),this._updateTerrainIcon(),this._map.on(\"terrain\",this._updateTerrainIcon),this._container}onRemove(){r.remove(this._container),this._map.off(\"terrain\",this._updateTerrainIcon),this._map=void 0;}},t.TwoFingersTouchPitchHandler=rs,t.TwoFingersTouchRotateHandler=ss,t.TwoFingersTouchZoomHandler=is,t.TwoFingersTouchZoomRotateHandler=gs,t.VectorTileSource=$,t.VideoSource=tt,t.addSourceType=(t,i)=>e._(void 0,void 0,void 0,(function*(){if(at(t))throw new Error(`A source type called \"${t}\" already exists.`);((t,e)=>{it[t]=e;})(t,i);})),t.clearPrewarmedResources=function(){const t=B;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(k),B=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()\"));},t.getMaxParallelImageRequests=function(){return e.a.MAX_PARALLEL_IMAGE_REQUESTS},t.getRTLTextPluginStatus=function(){return nt().getRTLTextPluginStatus()},t.getVersion=function(){return to},t.getWorkerCount=function(){return L.workerCount},t.getWorkerUrl=function(){return e.a.WORKER_URL},t.importScriptInWorkers=function(t){return j().broadcast(\"IS\",t)},t.prewarm=function(){N().acquire(k);},t.setMaxParallelImageRequests=function(t){e.a.MAX_PARALLEL_IMAGE_REQUESTS=t;},t.setRTLTextPlugin=function(t,e){return nt().setRTLTextPlugin(t,e)},t.setWorkerCount=function(t){L.workerCount=t;},t.setWorkerUrl=function(t){e.a.WORKER_URL=t;};}));\n\n//\n// Our custom intro provides a specialized \"define()\" function, called by the\n// AMD modules below, that sets up the worker blob URL and then executes the\n// main module, storing its exported value as 'maplibregl'\n\n\nvar maplibregl$1 = maplibregl;\n\nreturn maplibregl$1;\n\n}));\n//# sourceMappingURL=maplibre-gl.js.map\n","export const osm = {\n \"version\": 8,\n\t\"sources\": {\n \"osm\": {\n\t\t\t\"type\": \"raster\",\n\t\t\t\"tiles\": [\"https://a.tile.openstreetmap.org/{z}/{x}/{y}.png\"],\n\t\t\t\"tileSize\": 256,\n \"attribution\": \"© OpenStreetMap Contributors\",\n \"maxzoom\": 19\n }\n },\n \"layers\": [\n {\n \"id\": \"osm\",\n \"type\": \"raster\",\n \"source\": \"osm\" // This must match the source key above\n }\n ]\n};\n","/**\n * @license React\n * react-dom-server-legacy.browser.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var aa=require(\"react\");function l(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;c