diff --git a/govuk_step2/assets/About-0a746f16.js b/govuk_step2/assets/About-0a746f16.js new file mode 100644 index 000000000..c988a62e4 --- /dev/null +++ b/govuk_step2/assets/About-0a746f16.js @@ -0,0 +1,15 @@ +import{S as D,i as J,s as O,c as Y,a as Q,e as d,b as Te,d as k,l as V,u as Z,g as x,f as ee,t as m,h,j as b,k as Ie,m as Pe,p as P,n as g,o as E,ag as Se,ax as y,q as r,ay as je,r as We,ah as Le,ai as Re,H as Ue,x as A,y as M,A as T,v as qe,w as ze,z as Ge}from"./maplibre_helpers-1770e886.js";function He(l,e){const t={},n={},a={$$scope:1};let o=l.length;for(;o--;){const s=l[o],p=e[o];if(p){for(const u in s)u in p||(n[u]=1);for(const u in p)a[u]||(t[u]=p[u],a[u]=1);l[o]=p}else for(const u in s)a[u]=1}for(const s in n)s in t||(t[s]=void 0);return t}function Xe(l){let e,t,n,a;const o=l[2].default,s=Y(o,l,l[1],null);let p=[{type:"button"},{class:"govuk-button govuk-button--secondary"},{"data-module":"govuk-button"},l[0]],u={};for(let f=0;f{t(0,e=Q(Q({},e),Ie(s))),"$$scope"in s&&t(1,a=s.$$scope)},e=Ie(e),[e,a,n,o]}class De extends D{constructor(e){super(),J(this,e,ye,Xe,O,{})}}const ct="/atip/govuk_step2/assets/authorities-80e824dc.geojson";function Je(l){let e,t;const n=l[2].default,a=Y(n,l,l[1],null);return{c(){e=d("a"),a&&a.c(),P(e,"href",l[0]),P(e,"target","_blank"),P(e,"rel","noreferrer")},m(o,s){k(o,e,s),a&&a.m(e,null),t=!0},p(o,[s]){a&&a.p&&(!t||s&2)&&Z(a,n,o,o[1],t?ee(n,o[1],s,null):x(o[1]),null),(!t||s&1)&&P(e,"href",o[0])},i(o){t||(m(a,o),t=!0)},o(o){h(a,o),t=!1},d(o){o&&b(e),a&&a.d(o)}}}function Oe(l,e,t){let{$$slots:n={},$$scope:a}=e,{href:o}=e;return l.$$set=s=>{"href"in s&&t(0,o=s.href),"$$scope"in s&&t(1,a=s.$$scope)},[o,a,n]}class S extends D{constructor(e){super(),J(this,e,Oe,Je,O,{href:0})}}function Ee(l){let e,t;return e=new De({props:{$$slots:{default:[Fe]},$$scope:{ctx:l}}}),e.$on("click",l[5]),{c(){A(e.$$.fragment)},m(n,a){M(e,n,a),t=!0},p(n,a){const o={};a&128&&(o.$$scope={dirty:a,ctx:n}),e.$set(o)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){h(e.$$.fragment,n),t=!1},d(n){T(e,n)}}}function Fe(l){let e;return{c(){e=g("X")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Ke(l){let e,t,n,a,o,s,p,u,f,v,c=l[2]&&Ee(l);const I=l[4].default,w=Y(I,l,l[7],null);return{c(){e=d("div"),t=d("div"),n=d("div"),a=d("h1"),o=g(l[1]),s=E(),c&&c.c(),p=E(),w&&w.c(),P(a,"class","govuk-heading-l"),Se(n,"display","flex"),Se(n,"justify-content","space-between"),P(t,"class","content centered-fullscreen svelte-stcgp5"),P(e,"class","background svelte-stcgp5"),y(e,"open",l[0]),y(e,"closed",!l[0])},m($,C){k($,e,C),r(e,t),r(t,n),r(n,a),r(a,o),r(n,s),c&&c.m(n,null),r(t,p),w&&w.m(t,null),u=!0,f||(v=[V(t,"click",je(Ne)),V(e,"click",l[6])],f=!0)},p($,[C]){(!u||C&2)&&We(o,$[1]),$[2]?c?(c.p($,C),C&4&&m(c,1)):(c=Ee($),c.c(),m(c,1),c.m(n,null)):c&&(Le(),h(c,1,1,()=>{c=null}),Re()),w&&w.p&&(!u||C&128)&&Z(w,I,$,$[7],u?ee(I,$[7],C,null):x($[7]),null),(!u||C&1)&&y(e,"open",$[0]),(!u||C&1)&&y(e,"closed",!$[0])},i($){u||(m(c),m(w,$),u=!0)},o($){h(c),h(w,$),u=!1},d($){$&&b(e),c&&c.d(),w&&w.d($),f=!1,Ue(v)}}}const Ne=()=>null;function Qe(l,e,t){let{$$slots:n={},$$scope:a}=e,{title:o}=e,{open:s=!1}=e,{displayEscapeButton:p=!0}=e,{canCloseByClickingBackground:u=!0}=e;const f=()=>t(0,s=!1),v=()=>{u&&t(0,s=!1)};return l.$$set=c=>{"title"in c&&t(1,o=c.title),"open"in c&&t(0,s=c.open),"displayEscapeButton"in c&&t(2,p=c.displayEscapeButton),"canCloseByClickingBackground"in c&&t(3,u=c.canCloseByClickingBackground),"$$scope"in c&&t(7,a=c.$$scope)},[s,o,p,u,n,f,v,a]}class Ve extends D{constructor(e){super(),J(this,e,Qe,Ke,O,{title:1,open:0,displayEscapeButton:2,canCloseByClickingBackground:3})}}function Ye(l){let e;return{c(){e=g("open source project")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Ze(l){let e;return{c(){e=g("Dustin Carlino")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function xe(l){let e;return{c(){e=g("Madison Wang")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function et(l){let e;return{c(){e=g("Ben Ritter")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function tt(l){let e;return{c(){e=g("OpenStreetMap")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function nt(l){let e;return{c(){e=g("MapLibre")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function lt(l){let e;return{c(){e=g("GeoRust")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function st(l){let e;return{c(){e=g("osm2streets")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function at(l){let e;return{c(){e=g("Material icons")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function ot(l){let e;return{c(){e=g("start an issue on Github")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function rt(l){let e,t,n,a,o,s,p,u,f,v,c,I,w,$,C,j,te,F,ne,B,le,W,se,L,ae,R,oe,U,re,q,ue,ie,z,fe,G,ce,H,pe,$e,ge,_e,K,de,N,X;return a=new S({props:{href:"https://github.com/acteng/atip",$$slots:{default:[Ye]},$$scope:{ctx:l}}}),f=new S({props:{href:"https://www.turing.ac.uk/people/researchers/dustin-carlino",$$slots:{default:[Ze]},$$scope:{ctx:l}}}),$=new S({props:{href:"https://www.linkedin.com/in/madison-wang-841977bb/",$$slots:{default:[xe]},$$scope:{ctx:l}}}),j=new S({props:{href:"https://github.com/BudgieInWA",$$slots:{default:[et]},$$scope:{ctx:l}}}),W=new S({props:{href:"https://www.openstreetmap.org/about",$$slots:{default:[tt]},$$scope:{ctx:l}}}),L=new S({props:{href:"https://maplibre.org/",$$slots:{default:[nt]},$$scope:{ctx:l}}}),R=new S({props:{href:"https://georust.org/",$$slots:{default:[lt]},$$scope:{ctx:l}}}),U=new S({props:{href:"https://github.com/a-b-street/osm2streets",$$slots:{default:[st]},$$scope:{ctx:l}}}),q=new S({props:{href:"https://material.io/resources/icons/",$$slots:{default:[at]},$$scope:{ctx:l}}}),G=new S({props:{href:"https://github.com/acteng/atip/issues/new",$$slots:{default:[ot]},$$scope:{ctx:l}}}),{c(){e=d("div"),t=d("p"),n=g(`ATIP v2 is an + `),A(a.$$.fragment),o=g(" supported by Active Travel England and developed by:"),s=E(),p=d("ul"),u=d("li"),A(f.$$.fragment),v=g(": lead developer, from The Alan Turing Institute"),c=E(),I=d("li"),w=g(`With UX help from + `),A($.$$.fragment),C=g(` and CSS help from + `),A(j.$$.fragment),te=E(),F=d("li"),F.textContent=`With great thanks to ATIP's various users for feedback, testing, and + ideas`,ne=E(),B=d("p"),le=g(`ATIP builds on + `),A(W.$$.fragment),se=g(` + contributors, + `),A(L.$$.fragment),ae=g(`, + `),A(R.$$.fragment),oe=g(`, + `),A(U.$$.fragment),re=g(`, + `),A(q.$$.fragment),ue=g(", and other open source projects."),ie=E(),z=d("p"),fe=g("We want your feedback about ATIP! Please "),A(G.$$.fragment),ce=g(` + or email + `),H=d("a"),H.textContent="dcarlino@turing.ac.uk",pe=g("."),$e=E(),ge=d("hr"),_e=E(),K=d("h2"),K.textContent="Recent changes",de=E(),N=d("ul"),N.innerHTML=`
  • v2 launched on 2 June 2023. Changes: a complete UI rewrite, new draw + tools, drawing areas snapped to roads, splitting routes, multiple data schemas, + speed limit layer, lane visualization layer
  • v1 launched in March 2023
  • `,P(H,"href","mailto: dcarlino@turing.ac.uk"),P(e,"class","govuk-prose")},m(i,_){k(i,e,_),r(e,t),r(t,n),M(a,t,null),r(t,o),r(e,s),r(e,p),r(p,u),M(f,u,null),r(u,v),r(p,c),r(p,I),r(I,w),M($,I,null),r(I,C),M(j,I,null),r(p,te),r(p,F),r(e,ne),r(e,B),r(B,le),M(W,B,null),r(B,se),M(L,B,null),r(B,ae),M(R,B,null),r(B,oe),M(U,B,null),r(B,re),M(q,B,null),r(B,ue),r(e,ie),r(e,z),r(z,fe),M(G,z,null),r(z,ce),r(z,H),r(z,pe),r(e,$e),r(e,ge),r(e,_e),r(e,K),r(e,de),r(e,N),X=!0},p(i,_){const me={};_&4&&(me.$$scope={dirty:_,ctx:i}),a.$set(me);const he={};_&4&&(he.$$scope={dirty:_,ctx:i}),f.$set(he);const ke={};_&4&&(ke.$$scope={dirty:_,ctx:i}),$.$set(ke);const be={};_&4&&(be.$$scope={dirty:_,ctx:i}),j.$set(be);const we={};_&4&&(we.$$scope={dirty:_,ctx:i}),W.$set(we);const ve={};_&4&&(ve.$$scope={dirty:_,ctx:i}),L.$set(ve);const Be={};_&4&&(Be.$$scope={dirty:_,ctx:i}),R.$set(Be);const Ce={};_&4&&(Ce.$$scope={dirty:_,ctx:i}),U.$set(Ce);const Ae={};_&4&&(Ae.$$scope={dirty:_,ctx:i}),q.$set(Ae);const Me={};_&4&&(Me.$$scope={dirty:_,ctx:i}),G.$set(Me)},i(i){X||(m(a.$$.fragment,i),m(f.$$.fragment,i),m($.$$.fragment,i),m(j.$$.fragment,i),m(W.$$.fragment,i),m(L.$$.fragment,i),m(R.$$.fragment,i),m(U.$$.fragment,i),m(q.$$.fragment,i),m(G.$$.fragment,i),X=!0)},o(i){h(a.$$.fragment,i),h(f.$$.fragment,i),h($.$$.fragment,i),h(j.$$.fragment,i),h(W.$$.fragment,i),h(L.$$.fragment,i),h(R.$$.fragment,i),h(U.$$.fragment,i),h(q.$$.fragment,i),h(G.$$.fragment,i),X=!1},d(i){i&&b(e),T(a),T(f),T($),T(j),T(W),T(L),T(R),T(U),T(q),T(G)}}}function ut(l){let e,t,n;function a(s){l[1](s)}let o={title:"About the Active Travel Infrastructure Platform",$$slots:{default:[rt]},$$scope:{ctx:l}};return l[0]!==void 0&&(o.open=l[0]),e=new Ve({props:o}),qe.push(()=>ze(e,"open",a)),{c(){A(e.$$.fragment)},m(s,p){M(e,s,p),n=!0},p(s,[p]){const u={};p&4&&(u.$$scope={dirty:p,ctx:s}),!t&&p&1&&(t=!0,u.open=s[0],Ge(()=>t=!1)),e.$set(u)},i(s){n||(m(e.$$.fragment,s),n=!0)},o(s){h(e.$$.fragment,s),n=!1},d(s){T(e,s)}}}function it(l,e,t){let{open:n}=e;function a(o){n=o,t(0,n)}return l.$$set=o=>{"open"in o&&t(0,n=o.open)},[n,a]}class pt extends D{constructor(e){super(),J(this,e,it,ut,O,{open:0})}}export{pt as A,Ve as M,De as S,ct as a,He as g}; diff --git a/govuk_step2/assets/About-38986094.js b/govuk_step2/assets/About-38986094.js deleted file mode 100644 index f39b35914..000000000 --- a/govuk_step2/assets/About-38986094.js +++ /dev/null @@ -1,15 +0,0 @@ -import{S as N,i as Q,s as V,aq as Be,e as _,f as C,j as m,ar as Ae,as as Me,at as Te,p as w,q as v,r as h,t as c,c as P,a8 as ve,ap as H,k as s,n as K,au as je,x as Ie,v as Pe,P as Ee,b as Se,a as We,d as A,m as M,o as qe,u as T}from"./maplibre_helpers-ba9572ec.js";const tt="/atip/govuk_step2/assets/authorities-80e824dc.geojson";function Le(l){let e,t;const n=l[2].default,a=Be(n,l,l[1],null);return{c(){e=_("a"),a&&a.c(),C(e,"href",l[0]),C(e,"target","_blank"),C(e,"rel","noreferrer")},m(o,i){m(o,e,i),a&&a.m(e,null),t=!0},p(o,[i]){a&&a.p&&(!t||i&2)&&Ae(a,n,o,o[1],t?Te(n,o[1],i,null):Me(o[1]),null),(!t||i&1)&&C(e,"href",o[0])},i(o){t||(w(a,o),t=!0)},o(o){v(a,o),t=!1},d(o){o&&h(e),a&&a.d(o)}}}function Re(l,e,t){let{$$slots:n={},$$scope:a}=e,{href:o}=e;return l.$$set=i=>{"href"in i&&t(0,o=i.href),"$$scope"in i&&t(1,a=i.$$scope)},[o,a,n]}class I extends N{constructor(e){super(),Q(this,e,Re,Le,V,{href:0})}}function Ce(l){let e,t,n;return{c(){e=_("button"),e.textContent="X",C(e,"class","govuk-button govuk-button--secondary svelte-xtjo4w"),C(e,"data-module","govuk-button"),C(e,"type","button")},m(a,o){m(a,e,o),t||(n=K(e,"click",l[6]),t=!0)},p:Ee,d(a){a&&h(e),t=!1,n()}}}function Ue(l){let e,t,n,a,o,i,g,p,k,E,u=l[2]&&Ce(l);const j=l[5].default,d=Be(j,l,l[4],null);return{c(){e=_("div"),t=_("div"),n=_("div"),a=_("h1"),o=c(l[1]),i=P(),u&&u.c(),g=P(),d&&d.c(),C(a,"class","govuk-heading-l"),ve(n,"display","flex"),ve(n,"justify-content","space-between"),C(t,"class","content centered-fullscreen svelte-xtjo4w"),C(e,"class","background svelte-xtjo4w"),H(e,"open",l[0]),H(e,"closed",!l[0])},m(f,B){m(f,e,B),s(e,t),s(t,n),s(n,a),s(a,o),s(n,i),u&&u.m(n,null),s(t,g),d&&d.m(t,null),p=!0,k||(E=[K(t,"click",je(Ge)),K(e,"click",l[7])],k=!0)},p(f,[B]){(!p||B&2)&&Ie(o,f[1]),f[2]?u?u.p(f,B):(u=Ce(f),u.c(),u.m(n,null)):u&&(u.d(1),u=null),d&&d.p&&(!p||B&16)&&Ae(d,j,f,f[4],p?Te(j,f[4],B,null):Me(f[4]),null),(!p||B&1)&&H(e,"open",f[0]),(!p||B&1)&&H(e,"closed",!f[0])},i(f){p||(w(d,f),p=!0)},o(f){v(d,f),p=!1},d(f){f&&h(e),u&&u.d(),d&&d.d(f),k=!1,Pe(E)}}}const Ge=()=>null;function Xe(l,e,t){let{$$slots:n={},$$scope:a}=e,{title:o}=e,{open:i=!1}=e,{displayEscapeButton:g=!0}=e,{canCloseByClickingBackground:p=!0}=e;const k=()=>t(0,i=!1),E=()=>{p&&t(0,i=!1)};return l.$$set=u=>{"title"in u&&t(1,o=u.title),"open"in u&&t(0,i=u.open),"displayEscapeButton"in u&&t(2,g=u.displayEscapeButton),"canCloseByClickingBackground"in u&&t(3,p=u.canCloseByClickingBackground),"$$scope"in u&&t(4,a=u.$$scope)},[i,o,g,p,a,n,k,E]}class ze extends N{constructor(e){super(),Q(this,e,Xe,Ue,V,{title:1,open:0,displayEscapeButton:2,canCloseByClickingBackground:3})}}function De(l){let e;return{c(){e=c("open source project")},m(t,n){m(t,e,n)},d(t){t&&h(e)}}}function He(l){let e;return{c(){e=c("Dustin Carlino")},m(t,n){m(t,e,n)},d(t){t&&h(e)}}}function Je(l){let e;return{c(){e=c("Madison Wang")},m(t,n){m(t,e,n)},d(t){t&&h(e)}}}function Oe(l){let e;return{c(){e=c("Ben Ritter")},m(t,n){m(t,e,n)},d(t){t&&h(e)}}}function Fe(l){let e;return{c(){e=c("OpenStreetMap")},m(t,n){m(t,e,n)},d(t){t&&h(e)}}}function Ke(l){let e;return{c(){e=c("MapLibre")},m(t,n){m(t,e,n)},d(t){t&&h(e)}}}function Ne(l){let e;return{c(){e=c("GeoRust")},m(t,n){m(t,e,n)},d(t){t&&h(e)}}}function Qe(l){let e;return{c(){e=c("osm2streets")},m(t,n){m(t,e,n)},d(t){t&&h(e)}}}function Ve(l){let e;return{c(){e=c("Material icons")},m(t,n){m(t,e,n)},d(t){t&&h(e)}}}function Ye(l){let e;return{c(){e=c("start an issue on Github")},m(t,n){m(t,e,n)},d(t){t&&h(e)}}}function Ze(l){let e,t,n,a,o,i,g,p,k,E,u,j,d,f,B,S,Y,J,Z,b,x,W,y,q,ee,L,te,R,ne,U,le,se,G,ae,X,oe,z,re,ie,ue,fe,O,ce,F,D;return a=new I({props:{href:"https://github.com/acteng/atip",$$slots:{default:[De]},$$scope:{ctx:l}}}),k=new I({props:{href:"https://www.turing.ac.uk/people/researchers/dustin-carlino",$$slots:{default:[He]},$$scope:{ctx:l}}}),f=new I({props:{href:"https://www.linkedin.com/in/madison-wang-841977bb/",$$slots:{default:[Je]},$$scope:{ctx:l}}}),S=new I({props:{href:"https://github.com/BudgieInWA",$$slots:{default:[Oe]},$$scope:{ctx:l}}}),W=new I({props:{href:"https://www.openstreetmap.org/about",$$slots:{default:[Fe]},$$scope:{ctx:l}}}),q=new I({props:{href:"https://maplibre.org/",$$slots:{default:[Ke]},$$scope:{ctx:l}}}),L=new I({props:{href:"https://georust.org/",$$slots:{default:[Ne]},$$scope:{ctx:l}}}),R=new I({props:{href:"https://github.com/a-b-street/osm2streets",$$slots:{default:[Qe]},$$scope:{ctx:l}}}),U=new I({props:{href:"https://material.io/resources/icons/",$$slots:{default:[Ve]},$$scope:{ctx:l}}}),X=new I({props:{href:"https://github.com/acteng/atip/issues/new",$$slots:{default:[Ye]},$$scope:{ctx:l}}}),{c(){e=_("div"),t=_("p"),n=c(`ATIP v2 is an - `),A(a.$$.fragment),o=c(" supported by Active Travel England and developed by:"),i=P(),g=_("ul"),p=_("li"),A(k.$$.fragment),E=c(": lead developer, from The Alan Turing Institute"),u=P(),j=_("li"),d=c(`With UX help from - `),A(f.$$.fragment),B=c(` and CSS help from - `),A(S.$$.fragment),Y=P(),J=_("li"),J.textContent=`With great thanks to ATIP's various users for feedback, testing, and - ideas`,Z=P(),b=_("p"),x=c(`ATIP builds on - `),A(W.$$.fragment),y=c(` - contributors, - `),A(q.$$.fragment),ee=c(`, - `),A(L.$$.fragment),te=c(`, - `),A(R.$$.fragment),ne=c(`, - `),A(U.$$.fragment),le=c(", and other open source projects."),se=P(),G=_("p"),ae=c("We want your feedback about ATIP! Please "),A(X.$$.fragment),oe=c(` - or email - `),z=_("a"),z.textContent="dcarlino@turing.ac.uk",re=c("."),ie=P(),ue=_("hr"),fe=P(),O=_("h2"),O.textContent="Recent changes",ce=P(),F=_("ul"),F.innerHTML=`
  • v2 launched on 2 June 2023. Changes: a complete UI rewrite, new draw - tools, drawing areas snapped to roads, splitting routes, multiple data schemas, - speed limit layer, lane visualization layer
  • v1 launched in March 2023
  • `,C(z,"href","mailto: dcarlino@turing.ac.uk"),C(e,"class","govuk-prose")},m(r,$){m(r,e,$),s(e,t),s(t,n),M(a,t,null),s(t,o),s(e,i),s(e,g),s(g,p),M(k,p,null),s(p,E),s(g,u),s(g,j),s(j,d),M(f,j,null),s(j,B),M(S,j,null),s(g,Y),s(g,J),s(e,Z),s(e,b),s(b,x),M(W,b,null),s(b,y),M(q,b,null),s(b,ee),M(L,b,null),s(b,te),M(R,b,null),s(b,ne),M(U,b,null),s(b,le),s(e,se),s(e,G),s(G,ae),M(X,G,null),s(G,oe),s(G,z),s(G,re),s(e,ie),s(e,ue),s(e,fe),s(e,O),s(e,ce),s(e,F),D=!0},p(r,$){const pe={};$&4&&(pe.$$scope={dirty:$,ctx:r}),a.$set(pe);const $e={};$&4&&($e.$$scope={dirty:$,ctx:r}),k.$set($e);const ge={};$&4&&(ge.$$scope={dirty:$,ctx:r}),f.$set(ge);const _e={};$&4&&(_e.$$scope={dirty:$,ctx:r}),S.$set(_e);const de={};$&4&&(de.$$scope={dirty:$,ctx:r}),W.$set(de);const me={};$&4&&(me.$$scope={dirty:$,ctx:r}),q.$set(me);const he={};$&4&&(he.$$scope={dirty:$,ctx:r}),L.$set(he);const ke={};$&4&&(ke.$$scope={dirty:$,ctx:r}),R.$set(ke);const be={};$&4&&(be.$$scope={dirty:$,ctx:r}),U.$set(be);const we={};$&4&&(we.$$scope={dirty:$,ctx:r}),X.$set(we)},i(r){D||(w(a.$$.fragment,r),w(k.$$.fragment,r),w(f.$$.fragment,r),w(S.$$.fragment,r),w(W.$$.fragment,r),w(q.$$.fragment,r),w(L.$$.fragment,r),w(R.$$.fragment,r),w(U.$$.fragment,r),w(X.$$.fragment,r),D=!0)},o(r){v(a.$$.fragment,r),v(k.$$.fragment,r),v(f.$$.fragment,r),v(S.$$.fragment,r),v(W.$$.fragment,r),v(q.$$.fragment,r),v(L.$$.fragment,r),v(R.$$.fragment,r),v(U.$$.fragment,r),v(X.$$.fragment,r),D=!1},d(r){r&&h(e),T(a),T(k),T(f),T(S),T(W),T(q),T(L),T(R),T(U),T(X)}}}function xe(l){let e,t,n;function a(i){l[1](i)}let o={title:"About the Active Travel Infrastructure Platform",$$slots:{default:[Ze]},$$scope:{ctx:l}};return l[0]!==void 0&&(o.open=l[0]),e=new ze({props:o}),Se.push(()=>We(e,"open",a)),{c(){A(e.$$.fragment)},m(i,g){M(e,i,g),n=!0},p(i,[g]){const p={};g&4&&(p.$$scope={dirty:g,ctx:i}),!t&&g&1&&(t=!0,p.open=i[0],qe(()=>t=!1)),e.$set(p)},i(i){n||(w(e.$$.fragment,i),n=!0)},o(i){v(e.$$.fragment,i),n=!1},d(i){T(e,i)}}}function ye(l,e,t){let{open:n}=e;function a(o){n=o,t(0,n)}return l.$$set=o=>{"open"in o&&t(0,n=o.open)},[n,a]}class nt extends N{constructor(e){super(),Q(this,e,ye,xe,V,{open:0})}}export{nt as A,ze as M,tt as a}; diff --git a/govuk_step2/assets/About-a404c456.css b/govuk_step2/assets/About-a404c456.css deleted file mode 100644 index bf66295ac..000000000 --- a/govuk_step2/assets/About-a404c456.css +++ /dev/null @@ -1 +0,0 @@ -.background.svelte-xtjo4w{position:fixed;z-index:10;left:0;top:0;width:100%;height:100%;background-color:#00000080;display:block}button.svelte-xtjo4w{background-color:#f5f5f5}.content.svelte-xtjo4w{background:white;padding:30px;border:1px solid black}.centered-fullscreen.svelte-xtjo4w{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);overflow:scroll}.open.svelte-xtjo4w{display:block}.closed.svelte-xtjo4w{display:none} diff --git a/govuk_step2/assets/About-ac64a19d.css b/govuk_step2/assets/About-ac64a19d.css new file mode 100644 index 000000000..2db1d7153 --- /dev/null +++ b/govuk_step2/assets/About-ac64a19d.css @@ -0,0 +1 @@ +.background.svelte-stcgp5{position:fixed;z-index:10;left:0;top:0;width:100%;height:100%;background-color:#00000080;display:block}.content.svelte-stcgp5{background:white;padding:30px;border:1px solid black}.centered-fullscreen.svelte-stcgp5{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);overflow:scroll}.open.svelte-stcgp5{display:block}.closed.svelte-stcgp5{display:none} diff --git a/govuk_step2/assets/ZoomOutMap-bce6f057.js b/govuk_step2/assets/ZoomOutMap-586e4465.js similarity index 54% rename from govuk_step2/assets/ZoomOutMap-bce6f057.js rename to govuk_step2/assets/ZoomOutMap-586e4465.js index 7df7cf99a..977b88aee 100644 --- a/govuk_step2/assets/ZoomOutMap-bce6f057.js +++ b/govuk_step2/assets/ZoomOutMap-586e4465.js @@ -1,2 +1,2 @@ -import{v as pe,q as B,p as $,S as j,i as P,s as F,e as h,t as O,g as ee,h as _e,f as m,j as v,k as y,l as te,n as R,P as I,r as w,A as be,K as ve,aq as W,c as q,av as se,ar as J,as as Z,at as A,D as V,G as we,J as ne,I as le,H as ke,N as Se,M as Ce,L as oe,ao as ie,O as $e,x as Le,a9 as me,aa as ge,al as ae,y as N,Q as he,d as Me,m as Oe,u as Ie,a8 as z,aw as qe,w as Be,b as De,ag as Fe,z as ze}from"./maplibre_helpers-ba9572ec.js";function ft(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function pt(s,e){B(s,1,1,()=>{e.delete(s.key)})}function _t(s,e,n,t,l,o,i,r,c,a,u,g){let f=s.length,p=o.length,b=f;const k={};for(;b--;)k[s[b].key]=b;const d=[],_=new Map,U=new Map,X=[];for(b=p;b--;){const S=g(l,o,b),L=n(S);let M=i.get(L);M?t&&X.push(()=>M.p(S,e)):(M=a(L,S),M.c()),_.set(L,d[b]=M),L in k&&U.set(L,Math.abs(b-k[L]))}const Y=new Set,x=new Set;function K(S){$(S,1),S.m(r,u),i.set(S.key,S),u=S.first,p--}for(;f&&p;){const S=d[p-1],L=s[f-1],M=S.key,G=L.key;S===L?(u=S.first,f--,p--):_.has(G)?!i.has(M)||Y.has(M)?K(S):x.has(G)?f--:U.get(M)>U.get(G)?(x.add(M),K(S)):(Y.add(G),f--):(c(L,i),f--)}for(;f--;){const S=s[f];_.has(S.key)||c(S,i)}for(;p;)K(d[p-1]);return pe(X),d}function je(s){let e,n,t,l,o,i,r;return{c(){e=h("div"),n=O(`Basemap: - `),t=h("select"),l=h("option"),l.textContent="Streets",o=h("option"),o.textContent="Satellite",l.__value="streets",ee(l,l.__value),o.__value="hybrid",ee(o,o.__value),s[0]===void 0&&_e(()=>s[2].call(t)),m(e,"class","svelte-1tbnm6i")},m(c,a){v(c,e,a),y(e,n),y(e,t),y(t,l),y(t,o),te(t,s[0],!0),i||(r=[R(t,"change",s[2]),R(t,"change",s[1])],i=!0)},p(c,[a]){a&1&&te(t,c[0])},i:I,o:I,d(c){c&&w(e),i=!1,pe(r)}}}function Pe(s,e,n){let{style:t}=e;function l(){let i=new URLSearchParams(window.location.search);i.set("style",t);let r=`${window.location.pathname}?${i.toString()}${window.location.hash}`;window.location.href=r}function o(){t=be(this),n(0,t)}return s.$$set=i=>{"style"in i&&n(0,t=i.style)},[t,l,o]}class mt extends j{constructor(e){super(),P(this,e,Pe,je,F,{style:0})}}const T=[];function D(s,e=I){let n;const t=new Set;function l(r){if(F(s,r)&&(s=r,n)){const c=!T.length;for(const a of t)a[1](),T.push(a,s);if(c){for(let a=0;a{t.delete(a),t.size===0&&n&&(n(),n=null)}}return{set:l,update:o,subscribe:i}}function Ee(s){return s=="google"||s=="bing"}function gt(s){return{v1:"Scheme Design",v2:"Experimental Scheme Design",planning:"Development Planning",criticals:"Critical Issues",atf4:"ATF4 Scheme"}[s]}const H=D(null),ht=D(null),ye=D(ve()),Te=D(null),Re=D(null),Ge=D(null),Ne=D(null),We=D(Je());We.subscribe(s=>window.localStorage.setItem("userSettings",JSON.stringify(s)));const yt=D("edit-attribute"),bt=D(!1);function vt(s){let e=new Set;for(let t of s.features)e.add(t.id);let n=e.size+1;for(;e.has(n);)n++;return n}function wt(s){console.log(`Deleting intervention ${s}`),ye.update(e=>(e.features=e.features.filter(n=>n.id!=s),e)),Te.set(null),Re.set(null),Ge.set(null),Ne.set(null)}function Je(){let s={streetViewImagery:"google",avoidDoublingBack:!1};try{let e=JSON.parse(window.localStorage.getItem("userSettings")||"{}");Ee(e.streetViewImagery)&&(s.streetViewImagery=e.streetViewImagery),typeof e.avoidDoublingBack=="boolean"&&(s.avoidDoublingBack=e.avoidDoublingBack)}catch(e){console.log(`Couldn't parse userSettings from local storage: ${e}`)}return s}const Ze=s=>({}),re=s=>({}),Ae=s=>({}),ce=s=>({});function Ve(s){let e,n,t,l,o,i,r,c,a,u,g;const f=s[3].sidebar,p=W(f,s,s[2],ce),b=s[3].main,k=W(b,s,s[2],re);return{c(){e=h("div"),n=h("aside"),t=h("div"),p&&p.c(),l=q(),o=h("button"),o.textContent="→",r=q(),c=h("main"),k&&k.c(),m(t,"class","sidebar-content content-container svelte-ect12w"),m(o,"type","button"),m(o,"class","sidebar-toggle rounded-rect svelte-ect12w"),m(n,"class",i=se(s[0]?"":"collapsed")+" svelte-ect12w"),m(c,"class","svelte-ect12w"),m(e,"class","overall-layout svelte-ect12w")},m(d,_){v(d,e,_),y(e,n),y(n,t),p&&p.m(t,null),y(n,l),y(n,o),y(e,r),y(e,c),k&&k.m(c,null),a=!0,u||(g=R(o,"click",s[1]),u=!0)},p(d,[_]){p&&p.p&&(!a||_&4)&&J(p,f,d,d[2],a?A(f,d[2],_,Ae):Z(d[2]),ce),(!a||_&1&&i!==(i=se(d[0]?"":"collapsed")+" svelte-ect12w"))&&m(n,"class",i),k&&k.p&&(!a||_&4)&&J(k,b,d,d[2],a?A(b,d[2],_,Ze):Z(d[2]),re)},i(d){a||($(p,d),$(k,d),a=!0)},o(d){B(p,d),B(k,d),a=!1},d(d){d&&w(e),p&&p.d(d),k&&k.d(d),u=!1,g()}}}function He(s,e,n){let{$$slots:t={},$$scope:l}=e,o=!0;function i(){n(0,o=!o)}return s.$$set=r=>{"$$scope"in r&&n(2,l=r.$$scope)},[o,i,l,t]}class kt extends j{constructor(e){super(),P(this,e,He,Ve,F,{})}}const C={area:"#D94324",route:"#555F5E",crossing:"#4daf4a",other:"#984ea3",preapp:"#e41a1c",outline:"#377eb8","reserved matters":"#4daf4a","local plan":"#984ea3",hovering:"black",lineEndpointColor:"black"},Ue=10,Q=10;let E="interventions";function Ke(s,e,n){let t,l;V(s,H,u=>n(1,t=u)),V(s,ye,u=>n(2,l=u));let{schema:o}=e;we(t,E,l);const i=["match",["get","intervention_type"],"area",C.area,"route",C.route,"crossing",C.crossing,"other",C.other,"white"],r=["match",["get","reference_type",["get","planning"]],"preapp",C.preapp,"outline",C.outline,"reserved matters",C["reserved matters"],"local plan",C["local plan"],"white"],c=["!=","hide_while_editing",!0];return ne(t,{id:"interventions-points",source:E,filter:["all",Se,c,["!=","endpoint",!0]],color:i,radius:Ue}),le(t,{id:"interventions-lines",source:E,filter:["all",Ce,c],color:i,width:Q}),ne(t,{id:"interventions-lines-endpoints",source:E,filter:["==","endpoint",!0],radius:.5*Q,opacity:0,strokeColor:C.lineEndpointColor,strokeWidth:2}),ke(t,{id:"interventions-polygons",source:E,filter:["all",oe,c],color:o=="planning"?r:i,opacity:.2}),le(t,{id:"interventions-polygon-outlines",source:E,filter:["all",oe,c],color:o=="planning"?r:i,opacity:.5,width:.7*Q}),s.$$set=u=>{"schema"in u&&n(0,o=u.schema)},s.$$.update=()=>{if(s.$$.dirty&6){let u=JSON.parse(JSON.stringify(l)),g=[];for(let f of u.features)if(f.geometry.type=="LineString"&&!f.properties.hide_while_editing)for(let p of[f.geometry.coordinates[0],f.geometry.coordinates[f.geometry.coordinates.length-1]])g.push({type:"Feature",properties:{endpoint:!0},geometry:{type:"Point",coordinates:p}});u.features=u.features.concat(g),t.getSource(E).setData(u)}},[o,t,l]}class St extends j{constructor(e){super(),P(this,e,Ke,null,F,{schema:0})}}function Qe(s){const e=s-1;return e*e*e+1}function ue(s,{delay:e=0,duration:n=400,easing:t=Qe,axis:l="y"}={}){const o=getComputedStyle(s),i=+o.opacity,r=l==="y"?"height":"width",c=parseFloat(o[r]),a=l==="y"?["top","bottom"]:["left","right"],u=a.map(_=>`${_[0].toUpperCase()}${_.slice(1)}`),g=parseFloat(o[`padding${u[0]}`]),f=parseFloat(o[`padding${u[1]}`]),p=parseFloat(o[`margin${u[0]}`]),b=parseFloat(o[`margin${u[1]}`]),k=parseFloat(o[`border${u[0]}Width`]),d=parseFloat(o[`border${u[1]}Width`]);return{delay:e,duration:n,easing:t,css:_=>`overflow: hidden;opacity: ${Math.min(_*20,1)*i};${r}: ${_*c}px;padding-${a[0]}: ${_*g}px;padding-${a[1]}: ${_*f}px;margin-${a[0]}: ${_*p}px;margin-${a[1]}: ${_*b}px;border-${a[0]}-width: ${_*k}px;border-${a[1]}-width: ${_*d}px;`}}function de(s){let e,n,t;const l=s[3].default,o=W(l,s,s[2],null);return{c(){e=h("div"),o&&o.c()},m(i,r){v(i,e,r),o&&o.m(e,null),t=!0},p(i,r){o&&o.p&&(!t||r&4)&&J(o,l,i,i[2],t?A(l,i[2],r,null):Z(i[2]),null)},i(i){t||($(o,i),i&&_e(()=>{t&&(n||(n=ae(e,ue,{duration:100},!0)),n.run(1))}),t=!0)},o(i){B(o,i),i&&(n||(n=ae(e,ue,{duration:100},!1)),n.run(0)),t=!1},d(i){i&&w(e),o&&o.d(i),i&&n&&n.end()}}}function Xe(s){let e,n,t,l,o,i,r,c,a,u,g=s[0]&&de(s);return{c(){e=h("button"),n=ie("svg"),t=ie("path"),l=q(),o=O(s[1]),i=q(),g&&g.c(),r=$e(),m(t,"d","M9 5l7 7-7 7"),m(n,"style","tran"),m(n,"width","20"),m(n,"height","20"),m(n,"fill","none"),m(n,"stroke-linecap","round"),m(n,"stroke-linejoin","round"),m(n,"stroke-width","2"),m(n,"viewBox","0 0 24 24"),m(n,"stroke","currentColor"),m(n,"class","svelte-una9lq"),m(e,"aria-expanded",s[0]),m(e,"class","svelte-una9lq")},m(f,p){v(f,e,p),y(e,n),y(n,t),y(e,l),y(e,o),v(f,i,p),g&&g.m(f,p),v(f,r,p),c=!0,a||(u=R(e,"click",s[4]),a=!0)},p(f,[p]){(!c||p&2)&&Le(o,f[1]),(!c||p&1)&&m(e,"aria-expanded",f[0]),f[0]?g?(g.p(f,p),p&1&&$(g,1)):(g=de(f),g.c(),$(g,1),g.m(r.parentNode,r)):g&&(me(),B(g,1,1,()=>{g=null}),ge())},i(f){c||($(g),c=!0)},o(f){B(g),c=!1},d(f){f&&(w(e),w(i),w(r)),g&&g.d(f),a=!1,u()}}}function Ye(s,e,n){let{$$slots:t={},$$scope:l}=e,{label:o}=e,{open:i=!1}=e;const r=()=>n(0,i=!i);return s.$$set=c=>{"label"in c&&n(1,o=c.label),"open"in c&&n(0,i=c.open),"$$scope"in c&&n(2,l=c.$$scope)},[i,o,l,t,r]}class xe extends j{constructor(e){super(),P(this,e,Ye,Xe,F,{label:1,open:0})}}function et(s,e,n){let t;V(s,H,a=>n(2,t=a));let{layers:l}=e,{contents:o}=e,i=new N.Popup({closeButton:!1,closeOnClick:!1,maxWidth:"none"});t.on("mousemove",r),t.on("mouseout",c),he(()=>{t.off("mousemove",r),t.off("mouseout",c),i.remove()});function r(a){if(!l.every(g=>t.getLayer(g))){i.remove();return}let u=t.queryRenderedFeatures(a.point,{layers:l});u.length>0?i.setLngLat(a.lngLat).setHTML(o(u[0].properties)).addTo(t):i.remove()}function c(){i.remove()}return s.$$set=a=>{"layers"in a&&n(0,l=a.layers),"contents"in a&&n(1,o=a.contents)},[l,o]}class Ct extends j{constructor(e){super(),P(this,e,et,null,F,{layers:0,contents:1})}}function tt(s){let e,n,t,l,o,i,r,c,a,u,g,f,p,b,k;return{c(){e=h("li"),n=h("span"),t=O("Areas"),l=q(),o=h("li"),i=h("span"),r=O("Routes"),c=q(),a=h("li"),u=h("span"),g=O("Crossings"),f=q(),p=h("li"),b=h("span"),k=O("Other"),m(n,"class","svelte-l42ea0"),z(n,"background",C.area),m(i,"class","svelte-l42ea0"),z(i,"background",C.route),m(u,"class","svelte-l42ea0"),z(u,"background",C.crossing),m(b,"class","svelte-l42ea0"),z(b,"background",C.other)},m(d,_){v(d,e,_),y(e,n),y(e,t),v(d,l,_),v(d,o,_),y(o,i),y(o,r),v(d,c,_),v(d,a,_),y(a,u),y(a,g),v(d,f,_),v(d,p,_),y(p,b),y(p,k)},p:I,d(d){d&&(w(e),w(l),w(o),w(c),w(a),w(f),w(p))}}}function st(s){let e,n,t,l,o,i,r,c,a,u,g,f,p,b,k;return{c(){e=h("li"),n=h("span"),t=O("Preapp"),l=q(),o=h("li"),i=h("span"),r=O("Outline"),c=q(),a=h("li"),u=h("span"),g=O("Reserved matters"),f=q(),p=h("li"),b=h("span"),k=O("Local plan"),m(n,"class","svelte-l42ea0"),z(n,"background",C.preapp),m(i,"class","svelte-l42ea0"),z(i,"background",C.outline),m(u,"class","svelte-l42ea0"),z(u,"background",C["reserved matters"]),m(b,"class","svelte-l42ea0"),z(b,"background",C["local plan"])},m(d,_){v(d,e,_),y(e,n),y(e,t),v(d,l,_),v(d,o,_),y(o,i),y(o,r),v(d,c,_),v(d,a,_),y(a,u),y(a,g),v(d,f,_),v(d,p,_),y(p,b),y(p,k)},p:I,d(d){d&&(w(e),w(l),w(o),w(c),w(a),w(f),w(p))}}}function nt(s){let e;function n(o,i){return o[0]=="planning"?st:tt}let t=n(s),l=t(s);return{c(){e=h("ul"),l.c()},m(o,i){v(o,e,i),l.m(e,null)},p(o,i){t===(t=n(o))&&l?l.p(o,i):(l.d(1),l=t(o),l&&(l.c(),l.m(e,null)))},d(o){o&&w(e),l.d()}}}function lt(s){let e,n,t;return n=new xe({props:{label:"Objects",open:!0,$$slots:{default:[nt]},$$scope:{ctx:s}}}),{c(){e=h("div"),Me(n.$$.fragment),m(e,"class","svelte-l42ea0")},m(l,o){v(l,e,o),Oe(n,e,null),t=!0},p(l,[o]){const i={};o&3&&(i.$$scope={dirty:o,ctx:l}),n.$set(i)},i(l){t||($(n.$$.fragment,l),t=!0)},o(l){B(n.$$.fragment,l),t=!1},d(l){l&&w(e),Ie(n)}}}function ot(s,e,n){let{schema:t}=e;return s.$$set=l=>{"schema"in l&&n(0,t=l.schema)},[t]}class $t extends j{constructor(e){super(),P(this,e,ot,lt,F,{schema:0})}}function fe(s){let e;const n=s[4].default,t=W(n,s,s[3],null);return{c(){t&&t.c()},m(l,o){t&&t.m(l,o),e=!0},p(l,o){t&&t.p&&(!e||o&8)&&J(t,n,l,l[3],e?A(n,l[3],o,null):Z(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){B(t,l),e=!1},d(l){t&&t.d(l)}}}function it(s){let e,n,t=s[1]&&fe(s);return{c(){e=h("div"),t&&t.c(),m(e,"class","map svelte-12dpf1u")},m(l,o){v(l,e,o),t&&t.m(e,null),s[5](e),n=!0},p(l,[o]){l[1]?t?(t.p(l,o),o&2&&$(t,1)):(t=fe(l),t.c(),$(t,1),t.m(e,null)):t&&(me(),B(t,1,1,()=>{t=null}),ge())},i(l){n||($(t),n=!0)},o(l){B(t),n=!1},d(l){l&&w(e),t&&t.d(),s[5](null)}}}function at(s,e,n){let{$$slots:t={},$$scope:l}=e,{style:o}=e,i,r,c=!1;qe("setCamera",!window.location.hash),Be(()=>{i=new N.Map({container:r,style:`https://api.maptiler.com/maps/${o}/style.json?key=MZEJTanw3WpxRvt7qDfo`,hash:!0}),i.addControl(new N.ScaleControl({})),i.addControl(new N.NavigationControl({visualizePitch:!0}),"bottom-right"),i.on("load",()=>{n(1,c=!0),H.set(i)}),new ResizeObserver(()=>{i.resize()}).observe(r)}),he(()=>{i.remove()});function a(u){De[u?"unshift":"push"](()=>{r=u,n(0,r)})}return s.$$set=u=>{"style"in u&&n(2,o=u.style),"$$scope"in u&&n(3,l=u.$$scope)},[r,c,o,l,t,a]}class Lt extends j{constructor(e){super(),P(this,e,at,it,F,{style:2})}}const rt="/atip/govuk_step2/assets/zoom_out_map-b2e1091a.svg";function ct(s){let e,n,t,l,o;return{c(){e=h("button"),n=h("img"),Fe(n.src,t=rt)||m(n,"src",t),m(n,"alt","Zoom to show entire boundary"),m(e,"type","button"),m(e,"title","Zoom to show entire boundary"),m(e,"class","svelte-qzjsqo")},m(i,r){v(i,e,r),y(e,n),l||(o=R(e,"click",s[0]),l=!0)},p:I,i:I,o:I,d(i){i&&w(e),l=!1,o()}}}function ut(s,e,n){let t;V(s,H,i=>n(2,t=i));let{boundaryGeojson:l}=e;function o(){t.fitBounds(ze(l),{padding:20,animate:!0,duration:500})}return s.$$set=i=>{"boundaryGeojson"in i&&n(1,l=i.boundaryGeojson)},[o,l]}class Mt extends j{constructor(e){super(),P(this,e,ut,ct,F,{boundaryGeojson:1})}}export{mt as B,xe as C,St as I,kt as L,Ct as M,Mt as Z,Re as a,Ue as b,C as c,yt as d,ft as e,Te as f,ye as g,ue as h,bt as i,_t as j,pt as k,Q as l,H as m,vt as n,Ne as o,wt as p,gt as q,ht as r,Ge as s,Lt as t,We as u,$t as v}; +import{H as pe,h as D,t as $,S as j,i as E,s as q,e as h,n as I,C as ee,E as _e,p as m,d as v,q as y,G as te,l as R,Y as O,j as w,K as be,U as ve,c as N,o as B,az as se,u as Z,g as A,f as J,N as V,P as we,T as ne,R as le,Q as ke,X as Se,W as Ce,V as oe,aw as ie,D as $e,r as Le,ah as me,ai as ge,at as ae,I as G,Z as he,x as Me,y as Ie,A as Oe,ag as z,aA as Be,B as De,v as Fe,ao as qe,J as ze}from"./maplibre_helpers-1770e886.js";function ft(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function pt(s,e){D(s,1,1,()=>{e.delete(s.key)})}function _t(s,e,n,t,l,o,i,r,c,a,u,g){let f=s.length,p=o.length,b=f;const k={};for(;b--;)k[s[b].key]=b;const d=[],_=new Map,H=new Map,X=[];for(b=p;b--;){const S=g(l,o,b),L=n(S);let M=i.get(L);M?t&&X.push(()=>M.p(S,e)):(M=a(L,S),M.c()),_.set(L,d[b]=M),L in k&&H.set(L,Math.abs(b-k[L]))}const Y=new Set,x=new Set;function K(S){$(S,1),S.m(r,u),i.set(S.key,S),u=S.first,p--}for(;f&&p;){const S=d[p-1],L=s[f-1],M=S.key,W=L.key;S===L?(u=S.first,f--,p--):_.has(W)?!i.has(M)||Y.has(M)?K(S):x.has(W)?f--:H.get(M)>H.get(W)?(x.add(M),K(S)):(Y.add(W),f--):(c(L,i),f--)}for(;f--;){const S=s[f];_.has(S.key)||c(S,i)}for(;p;)K(d[p-1]);return pe(X),d}function je(s){let e,n,t,l,o,i,r;return{c(){e=h("div"),n=I(`Basemap: + `),t=h("select"),l=h("option"),l.textContent="Streets",o=h("option"),o.textContent="Satellite",l.__value="streets",ee(l,l.__value),o.__value="hybrid",ee(o,o.__value),s[0]===void 0&&_e(()=>s[2].call(t)),m(e,"class","svelte-1tbnm6i")},m(c,a){v(c,e,a),y(e,n),y(e,t),y(t,l),y(t,o),te(t,s[0],!0),i||(r=[R(t,"change",s[2]),R(t,"change",s[1])],i=!0)},p(c,[a]){a&1&&te(t,c[0])},i:O,o:O,d(c){c&&w(e),i=!1,pe(r)}}}function Ee(s,e,n){let{style:t}=e;function l(){let i=new URLSearchParams(window.location.search);i.set("style",t);let r=`${window.location.pathname}?${i.toString()}${window.location.hash}`;window.location.href=r}function o(){t=be(this),n(0,t)}return s.$$set=i=>{"style"in i&&n(0,t=i.style)},[t,l,o]}class mt extends j{constructor(e){super(),E(this,e,Ee,je,q,{style:0})}}const T=[];function F(s,e=O){let n;const t=new Set;function l(r){if(q(s,r)&&(s=r,n)){const c=!T.length;for(const a of t)a[1](),T.push(a,s);if(c){for(let a=0;a{t.delete(a),t.size===0&&n&&(n(),n=null)}}return{set:l,update:o,subscribe:i}}function Pe(s){return s=="google"||s=="bing"}function gt(s){return{v1:"Scheme Design",v2:"Experimental Scheme Design",planning:"Development Planning",criticals:"Critical Issues",atf4:"ATF4 Scheme"}[s]}const U=F(null),ht=F(null),ye=F(ve()),Te=F(null),Re=F(null),We=F(null),Ge=F(null),Ne=F(Ze());Ne.subscribe(s=>window.localStorage.setItem("userSettings",JSON.stringify(s)));const yt=F("edit-attribute"),bt=F(!1);function vt(s){let e=new Set;for(let t of s.features)e.add(t.id);let n=e.size+1;for(;e.has(n);)n++;return n}function wt(s){console.log(`Deleting intervention ${s}`),ye.update(e=>(e.features=e.features.filter(n=>n.id!=s),e)),Te.set(null),Re.set(null),We.set(null),Ge.set(null)}function Ze(){let s={streetViewImagery:"google",avoidDoublingBack:!1};try{let e=JSON.parse(window.localStorage.getItem("userSettings")||"{}");Pe(e.streetViewImagery)&&(s.streetViewImagery=e.streetViewImagery),typeof e.avoidDoublingBack=="boolean"&&(s.avoidDoublingBack=e.avoidDoublingBack)}catch(e){console.log(`Couldn't parse userSettings from local storage: ${e}`)}return s}const Ae=s=>({}),re=s=>({}),Je=s=>({}),ce=s=>({});function Ve(s){let e,n,t,l,o,i,r,c,a,u,g;const f=s[3].sidebar,p=N(f,s,s[2],ce),b=s[3].main,k=N(b,s,s[2],re);return{c(){e=h("div"),n=h("aside"),t=h("div"),p&&p.c(),l=B(),o=h("button"),o.textContent="→",r=B(),c=h("main"),k&&k.c(),m(t,"class","sidebar-content content-container svelte-ect12w"),m(o,"type","button"),m(o,"class","sidebar-toggle rounded-rect svelte-ect12w"),m(n,"class",i=se(s[0]?"":"collapsed")+" svelte-ect12w"),m(c,"class","svelte-ect12w"),m(e,"class","overall-layout svelte-ect12w")},m(d,_){v(d,e,_),y(e,n),y(n,t),p&&p.m(t,null),y(n,l),y(n,o),y(e,r),y(e,c),k&&k.m(c,null),a=!0,u||(g=R(o,"click",s[1]),u=!0)},p(d,[_]){p&&p.p&&(!a||_&4)&&Z(p,f,d,d[2],a?J(f,d[2],_,Je):A(d[2]),ce),(!a||_&1&&i!==(i=se(d[0]?"":"collapsed")+" svelte-ect12w"))&&m(n,"class",i),k&&k.p&&(!a||_&4)&&Z(k,b,d,d[2],a?J(b,d[2],_,Ae):A(d[2]),re)},i(d){a||($(p,d),$(k,d),a=!0)},o(d){D(p,d),D(k,d),a=!1},d(d){d&&w(e),p&&p.d(d),k&&k.d(d),u=!1,g()}}}function Ue(s,e,n){let{$$slots:t={},$$scope:l}=e,o=!0;function i(){n(0,o=!o)}return s.$$set=r=>{"$$scope"in r&&n(2,l=r.$$scope)},[o,i,l,t]}class kt extends j{constructor(e){super(),E(this,e,Ue,Ve,q,{})}}const C={area:"#D94324",route:"#555F5E",crossing:"#4daf4a",other:"#984ea3",preapp:"#e41a1c",outline:"#377eb8","reserved matters":"#4daf4a","local plan":"#984ea3",hovering:"black",lineEndpointColor:"black"},He=10,Q=10;let P="interventions";function Ke(s,e,n){let t,l;V(s,U,u=>n(1,t=u)),V(s,ye,u=>n(2,l=u));let{schema:o}=e;we(t,P,l);const i=["match",["get","intervention_type"],"area",C.area,"route",C.route,"crossing",C.crossing,"other",C.other,"white"],r=["match",["get","reference_type",["get","planning"]],"preapp",C.preapp,"outline",C.outline,"reserved matters",C["reserved matters"],"local plan",C["local plan"],"white"],c=["!=","hide_while_editing",!0];return ne(t,{id:"interventions-points",source:P,filter:["all",Se,c,["!=","endpoint",!0]],color:i,radius:He}),le(t,{id:"interventions-lines",source:P,filter:["all",Ce,c],color:i,width:Q}),ne(t,{id:"interventions-lines-endpoints",source:P,filter:["==","endpoint",!0],radius:.5*Q,opacity:0,strokeColor:C.lineEndpointColor,strokeWidth:2}),ke(t,{id:"interventions-polygons",source:P,filter:["all",oe,c],color:o=="planning"?r:i,opacity:.2}),le(t,{id:"interventions-polygon-outlines",source:P,filter:["all",oe,c],color:o=="planning"?r:i,opacity:.5,width:.7*Q}),s.$$set=u=>{"schema"in u&&n(0,o=u.schema)},s.$$.update=()=>{if(s.$$.dirty&6){let u=JSON.parse(JSON.stringify(l)),g=[];for(let f of u.features)if(f.geometry.type=="LineString"&&!f.properties.hide_while_editing)for(let p of[f.geometry.coordinates[0],f.geometry.coordinates[f.geometry.coordinates.length-1]])g.push({type:"Feature",properties:{endpoint:!0},geometry:{type:"Point",coordinates:p}});u.features=u.features.concat(g),t.getSource(P).setData(u)}},[o,t,l]}class St extends j{constructor(e){super(),E(this,e,Ke,null,q,{schema:0})}}function Qe(s){const e=s-1;return e*e*e+1}function ue(s,{delay:e=0,duration:n=400,easing:t=Qe,axis:l="y"}={}){const o=getComputedStyle(s),i=+o.opacity,r=l==="y"?"height":"width",c=parseFloat(o[r]),a=l==="y"?["top","bottom"]:["left","right"],u=a.map(_=>`${_[0].toUpperCase()}${_.slice(1)}`),g=parseFloat(o[`padding${u[0]}`]),f=parseFloat(o[`padding${u[1]}`]),p=parseFloat(o[`margin${u[0]}`]),b=parseFloat(o[`margin${u[1]}`]),k=parseFloat(o[`border${u[0]}Width`]),d=parseFloat(o[`border${u[1]}Width`]);return{delay:e,duration:n,easing:t,css:_=>`overflow: hidden;opacity: ${Math.min(_*20,1)*i};${r}: ${_*c}px;padding-${a[0]}: ${_*g}px;padding-${a[1]}: ${_*f}px;margin-${a[0]}: ${_*p}px;margin-${a[1]}: ${_*b}px;border-${a[0]}-width: ${_*k}px;border-${a[1]}-width: ${_*d}px;`}}function de(s){let e,n,t;const l=s[3].default,o=N(l,s,s[2],null);return{c(){e=h("div"),o&&o.c()},m(i,r){v(i,e,r),o&&o.m(e,null),t=!0},p(i,r){o&&o.p&&(!t||r&4)&&Z(o,l,i,i[2],t?J(l,i[2],r,null):A(i[2]),null)},i(i){t||($(o,i),i&&_e(()=>{t&&(n||(n=ae(e,ue,{duration:100},!0)),n.run(1))}),t=!0)},o(i){D(o,i),i&&(n||(n=ae(e,ue,{duration:100},!1)),n.run(0)),t=!1},d(i){i&&w(e),o&&o.d(i),i&&n&&n.end()}}}function Xe(s){let e,n,t,l,o,i,r,c,a,u,g=s[0]&&de(s);return{c(){e=h("button"),n=ie("svg"),t=ie("path"),l=B(),o=I(s[1]),i=B(),g&&g.c(),r=$e(),m(t,"d","M9 5l7 7-7 7"),m(n,"style","tran"),m(n,"width","20"),m(n,"height","20"),m(n,"fill","none"),m(n,"stroke-linecap","round"),m(n,"stroke-linejoin","round"),m(n,"stroke-width","2"),m(n,"viewBox","0 0 24 24"),m(n,"stroke","currentColor"),m(n,"class","svelte-una9lq"),m(e,"aria-expanded",s[0]),m(e,"class","svelte-una9lq")},m(f,p){v(f,e,p),y(e,n),y(n,t),y(e,l),y(e,o),v(f,i,p),g&&g.m(f,p),v(f,r,p),c=!0,a||(u=R(e,"click",s[4]),a=!0)},p(f,[p]){(!c||p&2)&&Le(o,f[1]),(!c||p&1)&&m(e,"aria-expanded",f[0]),f[0]?g?(g.p(f,p),p&1&&$(g,1)):(g=de(f),g.c(),$(g,1),g.m(r.parentNode,r)):g&&(me(),D(g,1,1,()=>{g=null}),ge())},i(f){c||($(g),c=!0)},o(f){D(g),c=!1},d(f){f&&(w(e),w(i),w(r)),g&&g.d(f),a=!1,u()}}}function Ye(s,e,n){let{$$slots:t={},$$scope:l}=e,{label:o}=e,{open:i=!1}=e;const r=()=>n(0,i=!i);return s.$$set=c=>{"label"in c&&n(1,o=c.label),"open"in c&&n(0,i=c.open),"$$scope"in c&&n(2,l=c.$$scope)},[i,o,l,t,r]}class xe extends j{constructor(e){super(),E(this,e,Ye,Xe,q,{label:1,open:0})}}function et(s,e,n){let t;V(s,U,a=>n(2,t=a));let{layers:l}=e,{contents:o}=e,i=new G.Popup({closeButton:!1,closeOnClick:!1,maxWidth:"none"});t.on("mousemove",r),t.on("mouseout",c),he(()=>{t.off("mousemove",r),t.off("mouseout",c),i.remove()});function r(a){if(!l.every(g=>t.getLayer(g))){i.remove();return}let u=t.queryRenderedFeatures(a.point,{layers:l});u.length>0?i.setLngLat(a.lngLat).setHTML(o(u[0].properties)).addTo(t):i.remove()}function c(){i.remove()}return s.$$set=a=>{"layers"in a&&n(0,l=a.layers),"contents"in a&&n(1,o=a.contents)},[l,o]}class Ct extends j{constructor(e){super(),E(this,e,et,null,q,{layers:0,contents:1})}}function tt(s){let e,n,t,l,o,i,r,c,a,u,g,f,p,b,k;return{c(){e=h("li"),n=h("span"),t=I("Areas"),l=B(),o=h("li"),i=h("span"),r=I("Routes"),c=B(),a=h("li"),u=h("span"),g=I("Crossings"),f=B(),p=h("li"),b=h("span"),k=I("Other"),m(n,"class","svelte-l42ea0"),z(n,"background",C.area),m(i,"class","svelte-l42ea0"),z(i,"background",C.route),m(u,"class","svelte-l42ea0"),z(u,"background",C.crossing),m(b,"class","svelte-l42ea0"),z(b,"background",C.other)},m(d,_){v(d,e,_),y(e,n),y(e,t),v(d,l,_),v(d,o,_),y(o,i),y(o,r),v(d,c,_),v(d,a,_),y(a,u),y(a,g),v(d,f,_),v(d,p,_),y(p,b),y(p,k)},p:O,d(d){d&&(w(e),w(l),w(o),w(c),w(a),w(f),w(p))}}}function st(s){let e,n,t,l,o,i,r,c,a,u,g,f,p,b,k;return{c(){e=h("li"),n=h("span"),t=I("Preapp"),l=B(),o=h("li"),i=h("span"),r=I("Outline"),c=B(),a=h("li"),u=h("span"),g=I("Reserved matters"),f=B(),p=h("li"),b=h("span"),k=I("Local plan"),m(n,"class","svelte-l42ea0"),z(n,"background",C.preapp),m(i,"class","svelte-l42ea0"),z(i,"background",C.outline),m(u,"class","svelte-l42ea0"),z(u,"background",C["reserved matters"]),m(b,"class","svelte-l42ea0"),z(b,"background",C["local plan"])},m(d,_){v(d,e,_),y(e,n),y(e,t),v(d,l,_),v(d,o,_),y(o,i),y(o,r),v(d,c,_),v(d,a,_),y(a,u),y(a,g),v(d,f,_),v(d,p,_),y(p,b),y(p,k)},p:O,d(d){d&&(w(e),w(l),w(o),w(c),w(a),w(f),w(p))}}}function nt(s){let e;function n(o,i){return o[0]=="planning"?st:tt}let t=n(s),l=t(s);return{c(){e=h("ul"),l.c()},m(o,i){v(o,e,i),l.m(e,null)},p(o,i){t===(t=n(o))&&l?l.p(o,i):(l.d(1),l=t(o),l&&(l.c(),l.m(e,null)))},d(o){o&&w(e),l.d()}}}function lt(s){let e,n,t;return n=new xe({props:{label:"Objects",open:!0,$$slots:{default:[nt]},$$scope:{ctx:s}}}),{c(){e=h("div"),Me(n.$$.fragment),m(e,"class","svelte-l42ea0")},m(l,o){v(l,e,o),Ie(n,e,null),t=!0},p(l,[o]){const i={};o&3&&(i.$$scope={dirty:o,ctx:l}),n.$set(i)},i(l){t||($(n.$$.fragment,l),t=!0)},o(l){D(n.$$.fragment,l),t=!1},d(l){l&&w(e),Oe(n)}}}function ot(s,e,n){let{schema:t}=e;return s.$$set=l=>{"schema"in l&&n(0,t=l.schema)},[t]}class $t extends j{constructor(e){super(),E(this,e,ot,lt,q,{schema:0})}}function fe(s){let e;const n=s[4].default,t=N(n,s,s[3],null);return{c(){t&&t.c()},m(l,o){t&&t.m(l,o),e=!0},p(l,o){t&&t.p&&(!e||o&8)&&Z(t,n,l,l[3],e?J(n,l[3],o,null):A(l[3]),null)},i(l){e||($(t,l),e=!0)},o(l){D(t,l),e=!1},d(l){t&&t.d(l)}}}function it(s){let e,n,t=s[1]&&fe(s);return{c(){e=h("div"),t&&t.c(),m(e,"class","map svelte-12dpf1u")},m(l,o){v(l,e,o),t&&t.m(e,null),s[5](e),n=!0},p(l,[o]){l[1]?t?(t.p(l,o),o&2&&$(t,1)):(t=fe(l),t.c(),$(t,1),t.m(e,null)):t&&(me(),D(t,1,1,()=>{t=null}),ge())},i(l){n||($(t),n=!0)},o(l){D(t),n=!1},d(l){l&&w(e),t&&t.d(),s[5](null)}}}function at(s,e,n){let{$$slots:t={},$$scope:l}=e,{style:o}=e,i,r,c=!1;Be("setCamera",!window.location.hash),De(()=>{i=new G.Map({container:r,style:`https://api.maptiler.com/maps/${o}/style.json?key=MZEJTanw3WpxRvt7qDfo`,hash:!0}),i.addControl(new G.ScaleControl({})),i.addControl(new G.NavigationControl({visualizePitch:!0}),"bottom-right"),i.on("load",()=>{n(1,c=!0),U.set(i)}),new ResizeObserver(()=>{i.resize()}).observe(r)}),he(()=>{i.remove()});function a(u){Fe[u?"unshift":"push"](()=>{r=u,n(0,r)})}return s.$$set=u=>{"style"in u&&n(2,o=u.style),"$$scope"in u&&n(3,l=u.$$scope)},[r,c,o,l,t,a]}class Lt extends j{constructor(e){super(),E(this,e,at,it,q,{style:2})}}const rt="/atip/govuk_step2/assets/zoom_out_map-b2e1091a.svg";function ct(s){let e,n,t,l,o;return{c(){e=h("button"),n=h("img"),qe(n.src,t=rt)||m(n,"src",t),m(n,"alt","Zoom to show entire boundary"),m(e,"type","button"),m(e,"title","Zoom to show entire boundary"),m(e,"class","svelte-qzjsqo")},m(i,r){v(i,e,r),y(e,n),l||(o=R(e,"click",s[0]),l=!0)},p:O,i:O,o:O,d(i){i&&w(e),l=!1,o()}}}function ut(s,e,n){let t;V(s,U,i=>n(2,t=i));let{boundaryGeojson:l}=e;function o(){t.fitBounds(ze(l),{padding:20,animate:!0,duration:500})}return s.$$set=i=>{"boundaryGeojson"in i&&n(1,l=i.boundaryGeojson)},[o,l]}class Mt extends j{constructor(e){super(),E(this,e,ut,ct,q,{boundaryGeojson:1})}}export{mt as B,xe as C,St as I,kt as L,Ct as M,Mt as Z,Re as a,He as b,C as c,yt as d,ft as e,Te as f,ye as g,ue as h,bt as i,_t as j,pt as k,Q as l,U as m,vt as n,Ge as o,wt as p,gt as q,ht as r,We as s,Lt as t,Ne as u,$t as v}; diff --git a/govuk_step2/assets/main-148b0136.css b/govuk_step2/assets/all-148b0136.css similarity index 100% rename from govuk_step2/assets/main-148b0136.css rename to govuk_step2/assets/all-148b0136.css diff --git a/govuk_step2/assets/main-cc41765e.js b/govuk_step2/assets/all-4fc69598.js similarity index 100% rename from govuk_step2/assets/main-cc41765e.js rename to govuk_step2/assets/all-4fc69598.js diff --git a/govuk_step2/assets/main-893dc30f.js b/govuk_step2/assets/main-893dc30f.js new file mode 100644 index 000000000..7d7f6a000 --- /dev/null +++ b/govuk_step2/assets/main-893dc30f.js @@ -0,0 +1 @@ +import{S as z,i as K,s as R,c as oe,a as W,e as _,b as x,d as $,l as P,u as se,g as ae,f as ie,t as B,h as C,j as v,k as ee,m as fe,n as H,o as w,p as h,q as c,r as ue,F as ce,v as re,w as de,x as T,y as N,z as pe,A as j,B as me,C as V,D as _e,E as he,G as te,H as be,I as ge,J as $e,K as ve}from"./maplibre_helpers-1770e886.js";import{i as ye}from"./all-4fc69598.js";import{g as we,S as ke,A as Ae,a as Se}from"./About-0a746f16.js";function Be(l){let e,t,i,r;const u=l[2].default,s=oe(u,l,l[1],null);let a=[{type:"button"},{class:"govuk-button"},{"data-module":"govuk-button"},l[0]],o={};for(let n=0;n{t(0,e=W(W({},e),ee(s))),"$$scope"in s&&t(1,r=s.$$scope)},e=ee(e),[e,r,i,u]}class Ee extends z{constructor(e){super(),K(this,e,Ce,Be,R,{})}}function Fe(l){let e,t,i,r,u;const s=l[3].default,a=oe(s,l,l[2],null);return{c(){e=_("div"),t=_("label"),i=H(l[0]),r=w(),a&&a.c(),h(t,"class","govuk-label"),h(t,"for",l[1]),h(e,"class","govuk-form-group")},m(o,n){$(o,e,n),c(e,t),c(t,i),c(e,r),a&&a.m(e,null),u=!0},p(o,[n]){(!u||n&1)&&ue(i,o[0]),(!u||n&2)&&h(t,"for",o[1]),a&&a.p&&(!u||n&4)&&se(a,s,o,o[2],u?ie(s,o[2],n,null):ae(o[2]),null)},i(o){u||(B(a,o),u=!0)},o(o){C(a,o),u=!1},d(o){o&&v(e),a&&a.d(o)}}}function Ie(l,e,t){let{$$slots:i={},$$scope:r}=e,{label:u}=e,{id:s}=e;return l.$$set=a=>{"label"in a&&t(0,u=a.label),"id"in a&&t(1,s=a.id),"$$scope"in a&&t(2,r=a.$$scope)},[u,s,r,i]}class le extends z{constructor(e){super(),K(this,e,Ie,Fe,R,{label:0,id:1})}}function Te(l){let e;return{c(){e=H("About")},m(t,i){$(t,e,i)},d(t){t&&v(e)}}}function Ne(l){let e,t,i,r,u;return{c(){e=_("input"),t=w(),i=_("datalist"),h(e,"class","govuk-input govuk-input--width-20"),h(e,"id","inputValue"),h(e,"data-testid","transport-authority"),h(e,"list","authorities-list"),h(i,"id","authorities-list")},m(s,a){$(s,e,a),V(e,l[0]),$(s,t,a),$(s,i,a),l[11](i),r||(u=P(e,"input",l[10]),r=!0)},p(s,a){a&1&&e.value!==s[0]&&V(e,s[0])},d(s){s&&(v(e),v(t),v(i)),l[11](null),r=!1,u()}}}function je(l){let e;return{c(){e=H("Start")},m(t,i){$(t,e,i)},d(t){t&&v(e)}}}function ne(l){let e,t;return{c(){e=_("i"),t=H(l[4])},m(i,r){$(i,e,r),c(e,t)},p(i,r){r&16&&ue(t,i[4])},d(i){i&&v(e)}}}function De(l){let e,t,i,r,u,s,a,o=l[4]&&ne(l);return{c(){e=_("select"),t=_("option"),t.textContent="Transport Authorities",i=_("option"),i.textContent="Local Authority District",r=w(),o&&o.c(),u=_e(),t.__value="TA",V(t,t.__value),i.__value="LAD",V(i,i.__value),h(e,"id","showBoundaries"),h(e,"class","govuk-select"),l[3]===void 0&&he(()=>l[12].call(e))},m(n,d){$(n,e,d),c(e,t),c(e,i),te(e,l[3],!0),$(n,r,d),o&&o.m(n,d),$(n,u,d),s||(a=[P(e,"change",l[12]),P(e,"change",l[6])],s=!0)},p(n,d){d&8&&te(e,n[3]),n[4]?o?o.p(n,d):(o=ne(n),o.c(),o.m(u.parentNode,u)):o&&(o.d(1),o=null)},d(n){n&&(v(e),v(r),v(u)),o&&o.d(n),s=!1,be(a)}}}function Je(l){let e,t,i,r,u,s,a,o,n,d,I,J,A,L,O,M,S,q,y,p,m,g,E;u=new ke({props:{$$slots:{default:[Te]},$$scope:{ctx:l}}}),u.$on("click",l[9]),a=new le({props:{label:"Select Transport Authority or Local Authority District",id:"inputValue",$$slots:{default:[Ne]},$$scope:{ctx:l}}}),n=new Ee({props:{disabled:!l[5],$$slots:{default:[je]},$$scope:{ctx:l}}}),n.$on("click",l[8]),A=new le({props:{label:"Or pick from the map",id:"showBoundaries",$$slots:{default:[De]},$$scope:{ctx:l}}}),S=new ce({props:{label:"Or upload an ATIP GeoJSON file",loadFile:l[7]}});function k(f){l[13](f)}let F={};return l[1]!==void 0&&(F.open=l[1]),m=new Ae({props:F}),re.push(()=>de(m,"open",k)),{c(){e=_("div"),t=_("div"),i=_("h1"),i.textContent="Welcome to ATIP v2",r=w(),T(u.$$.fragment),s=w(),T(a.$$.fragment),o=w(),T(n.$$.fragment),d=w(),I=_("hr"),J=w(),T(A.$$.fragment),L=w(),O=_("hr"),M=w(),T(S.$$.fragment),q=w(),y=_("div"),y.innerHTML='
    ',p=w(),T(m.$$.fragment),h(i,"class","govuk-heading-l"),h(t,"class","govuk-grid-column-one-half left svelte-lyn11h"),h(y,"class","govuk-grid-column-one-half"),h(e,"class","govuk-grid-row")},m(f,b){$(f,e,b),c(e,t),c(t,i),c(t,r),N(u,t,null),c(t,s),N(a,t,null),c(t,o),N(n,t,null),c(t,d),c(t,I),c(t,J),N(A,t,null),c(t,L),c(t,O),c(t,M),N(S,t,null),c(e,q),c(e,y),$(f,p,b),N(m,f,b),E=!0},p(f,[b]){const Z={};b&65536&&(Z.$$scope={dirty:b,ctx:f}),u.$set(Z);const Q={};b&65541&&(Q.$$scope={dirty:b,ctx:f}),a.$set(Q);const U={};b&32&&(U.disabled=!f[5]),b&65536&&(U.$$scope={dirty:b,ctx:f}),n.$set(U);const X={};b&65560&&(X.$$scope={dirty:b,ctx:f}),A.$set(X);const Y={};!g&&b&2&&(g=!0,Y.open=f[1],pe(()=>g=!1)),m.$set(Y)},i(f){E||(B(u.$$.fragment,f),B(a.$$.fragment,f),B(n.$$.fragment,f),B(A.$$.fragment,f),B(S.$$.fragment,f),B(m.$$.fragment,f),E=!0)},o(f){C(u.$$.fragment,f),C(a.$$.fragment,f),C(n.$$.fragment,f),C(A.$$.fragment,f),C(S.$$.fragment,f),C(m.$$.fragment,f),E=!1},d(f){f&&(v(e),v(p)),j(u),j(a),j(n),j(A),j(S),j(m,f)}}}let G="boundary",D="boundary-layer";function Le(l){if(l.features.length>0){let e=l.features[0].properties;for(let t of["planning","v2","criticals"])if(e&&t in e)return t}return"v1"}function Oe(l,e,t){let i,r=!1,u,s,a=new Set,o=null,n="TA";function d(){o==null||o.setFilter(D,["==",["get","level"],n])}let I=null;me(async()=>{ye();const p=await(await fetch(Se)).text(),m=JSON.parse(p);for(let k of m.features){let F=document.createElement("option");F.value=k.properties.name,s.appendChild(F),a.add(k.properties.name)}o=new ge.Map({container:"map",style:"https://api.maptiler.com/maps/streets/style.json?key=MZEJTanw3WpxRvt7qDfo"});let g=null;function E(){g!==null&&o.setFeatureState({source:G,id:g},{hover:!1})}o.on("load",function(){o.fitBounds($e(m),{padding:20,animate:!1}),o.addSource(G,{type:"geojson",data:m,generateId:!0}),o.addLayer({id:D,source:G,filter:["==",["get","level"],n],type:"fill",paint:{"fill-color":"rgb(200, 100, 240)","fill-outline-color":"rgb(200, 100, 240)","fill-opacity":["case",["boolean",["feature-state","hover"],!1],.8,.4]}}),o.on("mousemove",D,k=>{k.features.length>0&&(E(),g=k.features[0].id,t(4,I=k.features[0].properties.name),o.setFeatureState({source:G,id:g},{hover:!0}))}),o.on("mouseleave",D,()=>{E(),g=null,t(4,I=null)}),o.on("click",D,function(k){let F=k.features[0].properties.name;window.location.href=`scheme.html?authority=${F}`})})});function J(y){try{let p=JSON.parse(y);if(!p.authority)throw new Error("File doesn't have an authority set; is it an ATIP file?");if(!a.has(p.authority))throw new Error(`Unknown authority ${p.authority}`);let m=p.authority,g=Le(p);g!="v1"&&(m+=`_${g}`),window.localStorage.setItem(m,JSON.stringify(p)),window.location.href=`scheme.html?authority=${p.authority}&schema=${g}`}catch(p){window.alert(`Couldn't load scheme from a file: ${p}`)}}function A(){window.location.href=`scheme.html?authority=${u}`}const L=()=>t(1,r=!r);function O(){u=this.value,t(0,u)}function M(y){re[y?"unshift":"push"](()=>{s=y,t(2,s)})}function S(){n=ve(this),t(3,n)}function q(y){r=y,t(1,r)}return l.$$.update=()=>{l.$$.dirty&1&&t(5,i=a.has(u))},[u,r,s,n,I,i,d,J,A,L,O,M,S,q]}class Me extends z{constructor(e){super(),K(this,e,Oe,Je,R,{})}}document.body.className=document.body.className?document.body.className+" js-enabled":"js-enabled";new Me({target:document.getElementById("app")}); diff --git a/govuk_step2/assets/main-e149dfc7.js b/govuk_step2/assets/main-e149dfc7.js deleted file mode 100644 index 5cbcbbef2..000000000 --- a/govuk_step2/assets/main-e149dfc7.js +++ /dev/null @@ -1 +0,0 @@ -import{S as de,i as fe,s as pe,F as ce,b as ie,a as he,e as r,c as h,t as re,d as ee,f as l,g as V,h as me,j as W,k as t,l as te,m as oe,n as N,o as ve,p as ae,q as le,r as z,u as ne,v as be,w as ge,x as _e,y as ye,z as we,A as ke}from"./maplibre_helpers-ba9572ec.js";import{i as Ae}from"./main-cc41765e.js";import{A as Se,a as Ce}from"./About-38986094.js";function se(o){let i,e;return{c(){i=r("i"),e=re(o[4])},m(p,m){W(p,i,m),t(i,e)},p(p,m){m&16&&_e(e,p[4])},d(p){p&&z(i)}}}function Te(o){let i,e,p,m,v,T,b,s,S,c,B,F,L,w,O,I,J,D,k,n,g,_,u,d,y,H,R,Z,K,$,Q,M,P,C,G,E,U,X,f=o[4]&&se(o);$=new ce({props:{label:"Or upload an ATIP GeoJSON file",loadFile:o[7]}});function ue(a){o[13](a)}let Y={};return o[1]!==void 0&&(Y.open=o[1]),C=new Se({props:Y}),ie.push(()=>he(C,"open",ue)),{c(){i=r("div"),e=r("div"),p=r("h1"),p.textContent="Welcome to ATIP v2",m=h(),v=r("button"),v.textContent="About",T=h(),b=r("div"),s=r("label"),s.textContent="Select Transport Authority or Local Authority District",S=h(),c=r("input"),B=h(),F=r("datalist"),L=h(),w=r("button"),O=re("Start"),J=h(),D=r("hr"),k=h(),n=r("div"),g=r("label"),g.textContent="Or pick from the map",_=h(),u=r("select"),d=r("option"),d.textContent="Transport Authorities",y=r("option"),y.textContent="Local Authority District",H=h(),f&&f.c(),R=h(),Z=r("hr"),K=h(),ee($.$$.fragment),Q=h(),M=r("div"),M.innerHTML='
    ',P=h(),ee(C.$$.fragment),l(p,"class","govuk-heading-l"),l(v,"class","govuk-button govuk-button--secondary"),l(v,"data-module","govuk-button"),l(s,"class","govuk-label"),l(s,"for","inputValue"),l(c,"class","govuk-input govuk-input--width-20"),l(c,"id","inputValue"),l(c,"name","inputValue"),l(c,"data-testid","transport-authority"),l(c,"list","authorities-list"),l(F,"id","authorities-list"),l(b,"class","govuk-form-group"),l(w,"class","govuk-button"),l(w,"data-module","govuk-button"),w.disabled=I=!o[5],l(g,"class","govuk-label"),l(g,"for","showBoundaries"),d.__value="TA",V(d,d.__value),y.__value="LAD",V(y,y.__value),l(u,"id","showBoundaries"),l(u,"name","showBoundaries"),l(u,"class","govuk-select"),o[3]===void 0&&me(()=>o[12].call(u)),l(n,"class","govuk-form-group"),l(e,"class","govuk-grid-column-one-half left svelte-lyn11h"),l(M,"class","govuk-grid-column-one-half"),l(i,"class","govuk-grid-row")},m(a,A){W(a,i,A),t(i,e),t(e,p),t(e,m),t(e,v),t(e,T),t(e,b),t(b,s),t(b,S),t(b,c),V(c,o[0]),t(b,B),t(b,F),o[11](F),t(e,L),t(e,w),t(w,O),t(e,J),t(e,D),t(e,k),t(e,n),t(n,g),t(n,_),t(n,u),t(u,d),t(u,y),te(u,o[3],!0),t(n,H),f&&f.m(n,null),t(e,R),t(e,Z),t(e,K),oe($,e,null),t(i,Q),t(i,M),W(a,P,A),oe(C,a,A),E=!0,U||(X=[N(v,"click",o[9]),N(c,"input",o[10]),N(w,"click",o[8]),N(u,"change",o[12]),N(u,"change",o[6])],U=!0)},p(a,[A]){A&1&&c.value!==a[0]&&V(c,a[0]),(!E||A&32&&I!==(I=!a[5]))&&(w.disabled=I),A&8&&te(u,a[3]),a[4]?f?f.p(a,A):(f=se(a),f.c(),f.m(n,null)):f&&(f.d(1),f=null);const x={};!G&&A&2&&(G=!0,x.open=a[1],ve(()=>G=!1)),C.$set(x)},i(a){E||(ae($.$$.fragment,a),ae(C.$$.fragment,a),E=!0)},o(a){le($.$$.fragment,a),le(C.$$.fragment,a),E=!1},d(a){a&&(z(i),z(P)),o[11](null),f&&f.d(),ne($),ne(C,a),U=!1,be(X)}}}let q="boundary",j="boundary-layer";function Be(o){if(o.features.length>0){let i=o.features[0].properties;for(let e of["planning","v2","criticals"])if(i&&e in i)return e}return"v1"}function Fe(o,i,e){let p,m=!1,v,T,b=new Set,s=null,S="TA";function c(){s==null||s.setFilter(j,["==",["get","level"],S])}let B=null;ge(async()=>{Ae();const n=await(await fetch(Ce)).text(),g=JSON.parse(n);for(let d of g.features){let y=document.createElement("option");y.value=d.properties.name,T.appendChild(y),b.add(d.properties.name)}s=new ye.Map({container:"map",style:"https://api.maptiler.com/maps/streets/style.json?key=MZEJTanw3WpxRvt7qDfo"});let _=null;function u(){_!==null&&s.setFeatureState({source:q,id:_},{hover:!1})}s.on("load",function(){s.fitBounds(we(g),{padding:20,animate:!1}),s.addSource(q,{type:"geojson",data:g,generateId:!0}),s.addLayer({id:j,source:q,filter:["==",["get","level"],S],type:"fill",paint:{"fill-color":"rgb(200, 100, 240)","fill-outline-color":"rgb(200, 100, 240)","fill-opacity":["case",["boolean",["feature-state","hover"],!1],.8,.4]}}),s.on("mousemove",j,d=>{d.features.length>0&&(u(),_=d.features[0].id,e(4,B=d.features[0].properties.name),s.setFeatureState({source:q,id:_},{hover:!0}))}),s.on("mouseleave",j,()=>{u(),_=null,e(4,B=null)}),s.on("click",j,function(d){let y=d.features[0].properties.name;window.location.href=`scheme.html?authority=${y}`})})});function F(k){try{let n=JSON.parse(k);if(!n.authority)throw new Error("File doesn't have an authority set; is it an ATIP file?");if(!b.has(n.authority))throw new Error(`Unknown authority ${n.authority}`);let g=n.authority,_=Be(n);_!="v1"&&(g+=`_${_}`),window.localStorage.setItem(g,JSON.stringify(n)),window.location.href=`scheme.html?authority=${n.authority}&schema=${_}`}catch(n){window.alert(`Couldn't load scheme from a file: ${n}`)}}function L(){window.location.href=`scheme.html?authority=${v}`}const w=()=>e(1,m=!m);function O(){v=this.value,e(0,v)}function I(k){ie[k?"unshift":"push"](()=>{T=k,e(2,T)})}function J(){S=ke(this),e(3,S)}function D(k){m=k,e(1,m)}return o.$$.update=()=>{o.$$.dirty&1&&e(5,p=b.has(v))},[v,m,T,S,B,p,c,F,L,w,O,I,J,D]}class Ie extends de{constructor(i){super(),fe(this,i,Fe,Te,pe,{})}}document.body.className=document.body.className?document.body.className+" js-enabled":"js-enabled";new Ie({target:document.getElementById("app")}); diff --git a/govuk_step2/assets/maplibre_helpers-ba9572ec.js b/govuk_step2/assets/maplibre_helpers-1770e886.js similarity index 74% rename from govuk_step2/assets/maplibre_helpers-ba9572ec.js rename to govuk_step2/assets/maplibre_helpers-1770e886.js index 5cbf2ca0b..bb5567ad6 100644 --- a/govuk_step2/assets/maplibre_helpers-ba9572ec.js +++ b/govuk_step2/assets/maplibre_helpers-1770e886.js @@ -1,8 +1,8 @@ -var Hp=Object.defineProperty;var Kp=(I,C,B)=>C in I?Hp(I,C,{enumerable:!0,configurable:!0,writable:!0,value:B}):I[C]=B;var Xc=(I,C,B)=>(Kp(I,typeof C!="symbol"?C+"":C,B),B);(function(){const C=document.createElement("link").relList;if(C&&C.supports&&C.supports("modulepreload"))return;for(const se of document.querySelectorAll('link[rel="modulepreload"]'))G(se);new MutationObserver(se=>{for(const oe of se)if(oe.type==="childList")for(const Te of oe.addedNodes)Te.tagName==="LINK"&&Te.rel==="modulepreload"&&G(Te)}).observe(document,{childList:!0,subtree:!0});function B(se){const oe={};return se.integrity&&(oe.integrity=se.integrity),se.referrerPolicy&&(oe.referrerPolicy=se.referrerPolicy),se.crossOrigin==="use-credentials"?oe.credentials="include":se.crossOrigin==="anonymous"?oe.credentials="omit":oe.credentials="same-origin",oe}function G(se){if(se.ep)return;se.ep=!0;const oe=B(se);fetch(se.href,oe)}})();function Vn(){}const Yp=I=>I;function Jp(I,C){for(const B in C)I[B]=C[B];return I}function Gu(I){return I()}function $u(){return Object.create(null)}function fa(I){I.forEach(Gu)}function eh(I){return typeof I=="function"}function Qp(I,C){return I!=I?C==C:I!==C||I&&typeof I=="object"||typeof I=="function"}let Ml;function rm(I,C){return Ml||(Ml=document.createElement("a")),Ml.href=C,I===Ml.href}function ef(I){return Object.keys(I).length===0}function Xu(I,...C){if(I==null){for(const G of C)G(void 0);return Vn}const B=I.subscribe(...C);return B.unsubscribe?()=>B.unsubscribe():B}function nm(I){let C;return Xu(I,B=>C=B)(),C}function sm(I,C,B){I.$$.on_destroy.push(Xu(C,B))}function am(I,C,B,G){if(I){const se=Wu(I,C,B,G);return I[0](se)}}function Wu(I,C,B,G){return I[1]&&G?Jp(B.ctx.slice(),I[1](G(C))):B.ctx}function om(I,C,B,G){if(I[2]&&G){const se=I[2](G(B));if(C.dirty===void 0)return se;if(typeof se=="object"){const oe=[],Te=Math.max(C.dirty.length,se.length);for(let h=0;h32){const C=[],B=I.ctx.length/32;for(let G=0;Gwindow.performance.now():()=>Date.now(),th=Hu?I=>requestAnimationFrame(I):Vn;const da=new Set;function Ku(I){da.forEach(C=>{C.c(I)||(da.delete(C),C.f())}),da.size!==0&&th(Ku)}function rf(I){let C;return da.size===0&&th(Ku),{promise:new Promise(B=>{da.add(C={c:I,f:B})}),abort(){da.delete(C)}}}function bo(I,C){I.appendChild(C)}function Yu(I){if(!I)return document;const C=I.getRootNode?I.getRootNode():I.ownerDocument;return C&&C.host?C:I.ownerDocument}function nf(I){const C=Cl("style");return C.textContent="/* empty */",sf(Yu(I),C),C.sheet}function sf(I,C){return bo(I.head||I,C),C.sheet}function af(I,C,B){I.insertBefore(C,B||null)}function ih(I){I.parentNode&&I.parentNode.removeChild(I)}function um(I,C){for(let B=0;BI.removeEventListener(C,B,G)}function fm(I){return function(C){return C.stopPropagation(),I.call(this,C)}}function ps(I,C,B){B==null?I.removeAttribute(C):I.getAttribute(C)!==B&&I.setAttribute(C,B)}function mm(I){let C;return{p(...B){C=B,C.forEach(G=>I.push(G))},r(){C.forEach(B=>I.splice(I.indexOf(B),1))}}}function gm(I){return I===""?null:+I}function cf(I){return Array.from(I.childNodes)}function hf(I,C){C=""+C,I.data!==C&&(I.data=C)}function _m(I,C){I.value=C??""}function ym(I,C,B,G){B==null?I.style.removeProperty(C):I.style.setProperty(C,B,G?"important":"")}function xm(I,C,B){for(let G=0;G>>0}function df(I,C){const B={stylesheet:nf(C),rules:{}};return kl.set(I,B),B}function qu(I,C,B,G,se,oe,Te,h=0){const _e=16.666/G;let Y=`{ -`;for(let zt=0;zt<=1;zt+=_e){const nt=C+(B-C)*oe(zt);Y+=zt*100+`%{${Te(nt,1-nt)}} -`}const Qe=Y+`100% {${Te(B,1-B)}} -}`,ye=`__svelte_${uf(Qe)}_${h}`,_t=Yu(I),{stylesheet:Et,rules:it}=kl.get(_t)||df(_t,I);it[ye]||(it[ye]=!0,Et.insertRule(`@keyframes ${ye} ${Qe}`,Et.cssRules.length));const At=I.style.animation||"";return I.style.animation=`${At?`${At}, `:""}${ye} ${G}ms linear ${se}ms 1 both`,Dl+=1,ye}function pf(I,C){const B=(I.style.animation||"").split(", "),G=B.filter(C?oe=>oe.indexOf(C)<0:oe=>oe.indexOf("__svelte")===-1),se=B.length-G.length;se&&(I.style.animation=G.join(", "),Dl-=se,Dl||ff())}function ff(){th(()=>{Dl||(kl.forEach(I=>{const{ownerNode:C}=I.stylesheet;C&&ih(C)}),kl.clear())})}let To;function wo(I){To=I}function Eo(){if(!To)throw new Error("Function called outside component initialization");return To}function wm(I){Eo().$$.on_mount.push(I)}function Tm(I){Eo().$$.on_destroy.push(I)}function Em(){const I=Eo();return(C,B,{cancelable:G=!1}={})=>{const se=I.$$.callbacks[C];if(se){const oe=Ju(C,B,{cancelable:G});return se.slice().forEach(Te=>{Te.call(I,oe)}),!oe.defaultPrevented}return!0}}function Sm(I,C){return Eo().$$.context.set(I,C),C}function Im(I){return Eo().$$.context.get(I)}const ua=[],Kc=[];let pa=[];const Yc=[],mf=Promise.resolve();let Jc=!1;function gf(){Jc||(Jc=!0,mf.then(Qu))}function Ll(I){pa.push(I)}function Am(I){Yc.push(I)}const Wc=new Set;let ha=0;function Qu(){if(ha!==0)return;const I=To;do{try{for(;haI.indexOf(G)===-1?C.push(G):B.push(G)),B.forEach(G=>G()),pa=C}let vo;function xf(){return vo||(vo=Promise.resolve(),vo.then(()=>{vo=null})),vo}function Hc(I,C,B){I.dispatchEvent(Ju(`${C?"intro":"outro"}${B}`))}const zl=new Set;let dn;function Pm(){dn={r:0,c:[],p:dn}}function Mm(){dn.r||fa(dn.c),dn=dn.p}function vf(I,C){I&&I.i&&(zl.delete(I),I.i(C))}function Cm(I,C,B,G){if(I&&I.o){if(zl.has(I))return;zl.add(I),dn.c.push(()=>{zl.delete(I),G&&(B&&I.d(1),G())}),I.o(C)}else G&&G()}const bf={duration:0};function zm(I,C,B,G){let oe=C(I,B,{direction:"both"}),Te=G?0:1,h=null,_e=null,Y=null,Qe;function ye(){Y&&pf(I,Y)}function _t(it,At){const zt=it.b-Te;return At*=Math.abs(zt),{a:Te,b:it.b,d:zt,duration:At,start:it.start,end:it.start+At,group:it.group}}function Et(it){const{delay:At=0,duration:zt=300,easing:nt=Yp,tick:Qt=Vn,css:mt}=oe||bf,_i={start:tf()+At,b:it};it||(_i.group=dn,dn.r+=1),"inert"in I&&(it?Qe!==void 0&&(I.inert=Qe):(Qe=I.inert,I.inert=!0)),h||_e?_e=_i:(mt&&(ye(),Y=qu(I,Te,it,zt,At,nt,mt)),it&&Qt(0,1),h=_t(_i,zt),Ll(()=>Hc(I,it,"start")),rf(Wt=>{if(_e&&Wt>_e.start&&(h=_t(_e,zt),_e=null,Hc(I,h.b,"start"),mt&&(ye(),Y=qu(I,Te,h.b,h.duration,0,nt,oe.css))),h){if(Wt>=h.end)Qt(Te=h.b,1-Te),Hc(I,h.b,"end"),_e||(h.b?ye():--h.group.r||fa(h.group.c)),h=null;else if(Wt>=h.start){const sr=Wt-h.start;Te=h.a+h.d*nt(sr/h.duration),Qt(Te,1-Te)}}return!!(h||_e)}))}return{run(it){eh(oe)?xf().then(()=>{oe=oe({direction:it?"in":"out"}),Et(it)}):Et(it)},end(){ye(),h=_e=null}}}function km(I,C,B){const G=I.$$.props[C];G!==void 0&&(I.$$.bound[G]=B,B(I.$$.ctx[G]))}function Dm(I){I&&I.c()}function wf(I,C,B){const{fragment:G,after_update:se}=I.$$;G&&G.m(C,B),Ll(()=>{const oe=I.$$.on_mount.map(Gu).filter(eh);I.$$.on_destroy?I.$$.on_destroy.push(...oe):fa(oe),I.$$.on_mount=[]}),se.forEach(Ll)}function Tf(I,C){const B=I.$$;B.fragment!==null&&(yf(B.after_update),fa(B.on_destroy),B.fragment&&B.fragment.d(C),B.on_destroy=B.fragment=null,B.ctx=[])}function Ef(I,C){I.$$.dirty[0]===-1&&(ua.push(I),gf(),I.$$.dirty.fill(0)),I.$$.dirty[C/31|0]|=1<{const it=Et.length?Et[0]:_t;return Y.ctx&&se(Y.ctx[ye],Y.ctx[ye]=it)&&(!Y.skip_bound&&Y.bound[ye]&&Y.bound[ye](it),Qe&&Ef(I,ye)),_t}):[],Y.update(),Qe=!0,fa(Y.before_update),Y.fragment=G?G(Y.ctx):!1,C.target){if(C.hydrate){const ye=cf(C.target);Y.fragment&&Y.fragment.l(ye),ye.forEach(ih)}else Y.fragment&&Y.fragment.c();C.intro&&vf(I.$$.fragment),wf(I,C.target,C.anchor),Qu()}wo(_e)}class If{constructor(){Xc(this,"$$");Xc(this,"$$set")}$destroy(){Tf(this,1),this.$destroy=Vn}$on(C,B){if(!eh(B))return Vn;const G=this.$$.callbacks[C]||(this.$$.callbacks[C]=[]);return G.push(B),()=>{const se=G.indexOf(B);se!==-1&&G.splice(se,1)}}$set(C){this.$$set&&!ef(C)&&(this.$$.skip_bound=!0,this.$$set(C),this.$$.skip_bound=!1)}}const Af="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Af);var Pf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lm(I){return I&&I.__esModule&&Object.prototype.hasOwnProperty.call(I,"default")?I.default:I}function Bm(I){if(I.__esModule)return I;var C=I.default;if(typeof C=="function"){var B=function G(){if(this instanceof G){var se=[null];se.push.apply(se,arguments);var oe=Function.bind.apply(C,se);return new oe}return C.apply(this,arguments)};B.prototype=C.prototype}else B={};return Object.defineProperty(B,"__esModule",{value:!0}),Object.keys(I).forEach(function(G){var se=Object.getOwnPropertyDescriptor(I,G);Object.defineProperty(B,G,se.get?se:{enumerable:!0,get:function(){return I[G]}})}),B}var ed={exports:{}};(function(I,C){(function(B,G){I.exports=G()})(Pf,function(){var B,G,se;function oe(h,_e){if(!B)B=_e;else if(!G)G=_e;else{var Y="var sharedChunk = {}; ("+B+")(sharedChunk); ("+G+")(sharedChunk);",Qe={};B(Qe),se=_e(Qe),typeof window<"u"&&(se.workerUrl=window.URL.createObjectURL(new Blob([Y],{type:"text/javascript"})))}}oe(["exports"],function(h){function _e(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Y=Qe;function Qe(i,e){this.x=i,this.y=e}Qe.prototype={clone:function(){return new Qe(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),l=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Qe.convert=function(i){return i instanceof Qe?i:Array.isArray(i)?new Qe(i[0],i[1]):i};var ye=_e(Y),_t=Et;function Et(i,e,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}Et.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var it=_e(_t);function At(i,e,r,s){const l=new it(i,e,r,s);return function(u){return l.solve(u)}}const zt=At(.25,.1,.25,1);function nt(i,e,r){return Math.min(r,Math.max(e,i))}function Qt(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function mt(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let _i=1;function Wt(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function sr(i,e,r){const s={};for(const l in i)s[l]=e.call(r||this,i[l],l,i);return s}function fn(i,e,r){const s={};for(const l in i)e.call(r||this,i[l],l,i)&&(s[l]=i[l]);return s}function Ei(i){return Array.isArray(i)?i.map(Ei):typeof i=="object"&&i?sr(i,Ei):i}const Gr={};function ci(i){Gr[i]||(typeof console<"u"&&console.warn(i),Gr[i]=!0)}function gt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function ga(i){let e=0;for(let r,s,l=0,u=i.length,d=u-1;lcancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(mn||(mn=document.createElement("a")),mn.href=i,mn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Wr==null&&(Wr=matchMedia("(prefers-reduced-motion: reduce)")),Wr.matches)}},Nn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class Dr extends Error{constructor(e,r,s,l){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=l}}const yi=$i()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,qi=i=>Nn.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function si(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:yi(),signal:r.signal});let l=!1,u=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),u||fetch(s).then(d=>d.ok?(f=>{(i.type==="arrayBuffer"||i.type==="image"?f.arrayBuffer():i.type==="json"?f.json():f.text()).then(g=>{u||(l=!0,e(null,g,f.headers.get("Cache-Control"),f.headers.get("Expires")))}).catch(g=>{u||e(new Error(g.message))})})(d):d.blob().then(f=>e(new Dr(d.status,d.statusText,i.url,f)))).catch(d=>{d.code!==20&&e(new Error(d.message))}),{cancel:()=>{u=!0,l||r.abort()}}}const _n=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if($i()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!$i())return(qi(i.url)||si)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(yi())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return si(i,e);if($i()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,l){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(u.responseType="arraybuffer");for(const d in s.headers)u.setRequestHeader(d,s.headers[d]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{l(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let d=u.response;if(s.type==="json")try{d=JSON.parse(u.response)}catch(f){return l(f)}l(null,d,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const d=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});l(new Dr(u.status,u.statusText,s.url,d))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},yn=function(i,e){return _n(mt(i,{type:"arrayBuffer"}),e)};function Hr(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function Lr(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function xr(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class vr{constructor(e,r={}){mt(this,r),this.type=e}}class ji extends vr{constructor(e,r={}){super("error",mt({error:e},r))}}class xn{on(e,r){return this._listeners=this._listeners||{},Lr(e,r,this._listeners),this}off(e,r){return xr(e,r,this._listeners),xr(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Lr(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new vr(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of l)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of u)xr(s,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(mt(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof ji&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var le={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},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:{}},default:"mapbox"},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-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},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 Br=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function $n(i,e){const r={};for(const s in i)s!=="ref"&&(r[s]=i[s]);return Br.forEach(s=>{s in e&&(r[s]=e[s])}),r}function xt(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const jn=[Rr,ve,Ye,He,Si,wr,Ht,ai(Xe),Yi,Tr];function or(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!or(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of jn)if(!or(r,e))return null}}return`Expected ${wt(i)} but found ${wt(e)} instead.`}function V(i,e){return e.some(r=>r.kind===i.kind)}function S(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function P(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const D=.96422,q=.82521,j=4/29,J=6/29,W=3*J*J,Z=J*J*J,ee=Math.PI/180,he=180/Math.PI;function de(i){return(i%=360)<0&&(i+=360),i}function ue([i,e,r,s]){let l,u;const d=Ge((.2225045*(i=Ne(i))+.7168786*(e=Ne(e))+.0606169*(r=Ne(r)))/1);i===e&&e===r?l=u=d:(l=Ge((.4360747*i+.3850649*e+.1430804*r)/D),u=Ge((.0139322*i+.0971045*e+.7141733*r)/q));const f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-u),s]}function Ne(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ge(i){return i>Z?Math.pow(i,1/3):i/W+j}function Le([i,e,r,s]){let l=(i+16)/116,u=isNaN(e)?l:l+e/500,d=isNaN(r)?l:l-r/200;return l=1*Ze(l),u=D*Ze(u),d=q*Ze(d),[Oe(3.1338561*u-1.6168667*l-.4906146*d),Oe(-.9787684*u+1.9161415*l+.033454*d),Oe(.0719453*u-.2289914*l+1.4052427*d),s]}function Oe(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function Ze(i){return i>J?i*i*i:W*(i-j)}function st(i){return parseInt(i.padEnd(2,i),16)/255}function Je(i,e){return ot(e?i/100:i,0,1)}function ot(i,e,r){return Math.min(Math.max(e,i),r)}function vt(i){return!i.some(Number.isNaN)}const $t={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 je{constructor(e,r,s,l=1,u=!0){this.r=e,this.g=r,this.b=s,this.a=l,u||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,s,l]))}static parse(e){if(e instanceof je)return e;if(typeof e!="string")return;const r=function(s){if((s=s.toLowerCase())==="transparent")return[0,0,0,0];const l=$t[s];if(l){const[d,f,g]=l;return[d/255,f/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const d=s.length<6?1:2;let f=1;return[st(s.slice(f,f+=d)),st(s.slice(f,f+=d)),st(s.slice(f,f+=d)),st(s.slice(f,f+d)||"ff")]}if(s.startsWith("rgb")){const d=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,g,v,b,E,A,M,k,U,F,K,Q]=d,X=[b||" ",M||" ",F].join("");if(X===" "||X===" /"||X===",,"||X===",,,"){const ie=[v,A,U].join(""),ne=ie==="%%%"?100:ie===""?255:0;if(ne){const ce=[ot(+g/ne,0,1),ot(+E/ne,0,1),ot(+k/ne,0,1),K?Je(+K,Q):1];if(vt(ce))return ce}}return}}const u=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,f,g,v,b,E,A,M,k]=u,U=[g||" ",b||" ",A].join("");if(U===" "||U===" /"||U===",,"||U===",,,"){const F=[+f,ot(+v,0,100),ot(+E,0,100),M?Je(+M,k):1];if(vt(F))return function([K,Q,X,ie]){function ne(ce){const ke=(ce+K/30)%12,Be=Q*Math.min(X,1-X);return X-Be*Math.max(-1,Math.min(ke-3,9-ke,1))}return K=de(K),Q/=100,X/=100,[ne(0),ne(8),ne(4),ie]}(F)}}}(e);return r?new je(...r,!1):void 0}get rgb(){const{r:e,g:r,b:s,a:l}=this,u=l||1/0;return this.overwriteGetter("rgb",[e/u,r/u,s/u,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,s,l,u]=ue(e),d=Math.sqrt(s*s+l*l);return[Math.round(1e4*d)?de(Math.atan2(l,s)*he):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ue(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,s,l]=this.rgb;return`rgba(${[e,r,s].map(u=>Math.round(255*u)).join(",")},${l})`}}je.black=new je(0,0,0,1),je.white=new je(1,1,1,1),je.transparent=new je(0,0,0,0),je.red=new je(1,0,0,1);class kt{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Fr{constructor(e,r,s,l,u){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class oi{constructor(e){this.sections=e}static fromString(e){return new oi([new Fr(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof oi?e:oi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class zi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof zi)return e;if(typeof e=="number")return new zi([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new zi(e)}}toString(){return JSON.stringify(this.values)}}class Zi{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Zi({name:e,available:!1}):null}}function wn(i,e,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ms(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof je||i instanceof kt||i instanceof oi||i instanceof zi||i instanceof Zi)return!0;if(Array.isArray(i)){for(const e of i)if(!ms(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ms(i[e]))return!1;return!0}return!1}function qt(i){if(i===null)return Rr;if(typeof i=="string")return Ye;if(typeof i=="boolean")return He;if(typeof i=="number")return ve;if(i instanceof je)return Si;if(i instanceof kt)return br;if(i instanceof oi)return wr;if(i instanceof zi)return Yi;if(i instanceof Zi)return Tr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=qt(s);if(r){if(r===l)continue;r=Xe;break}r=l}return ai(r||Xe,e)}return Ht}function Zn(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof je||i instanceof oi||i instanceof zi||i instanceof Zi?i.toString():JSON.stringify(i)}class Or{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ms(e[1]))return r.error("invalid value");const s=e[1];let l=qt(s);const u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new Or(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Rt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const gs={string:Ye,number:ve,boolean:He,object:Ht};class Ji{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let s,l=1;const u=e[0];if(u==="array"){let f,g;if(e.length>2){const v=e[1];if(typeof v!="string"||!(v in gs)||v==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=gs[v],l++}else f=Xe;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],l++}s=ai(f,g)}else{if(!gs[u])throw new Error(`Types doesn't contain name = ${u}`);s=gs[u]}const d=[];for(;le.outputDefined())}}const So={"to-boolean":He,"to-color":Si,"to-number":ve,"to-string":Ye};class li{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[0];if(!So[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=So[s],u=[];for(let d=1;d4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:wn(r[0],r[1],r[2],r[3]),!s))return new je(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Rt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const s of this.args){r=s.evaluate(e);const l=zi.parse(r);if(l)return l}throw new Rt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new Rt(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?oi.fromString(Zn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Zi.fromString(Zn(this.args[0].evaluate(e))):Zn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const _a=["Unknown","Point","LineString","Polygon"];class _s{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"?_a[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=je.parse(e)),r}}class Ur{constructor(e,r,s=[],l,u=new bn,d=[]){this.registry=e,this.path=s,this.key=s.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=d,this.expectedType=l,this._isConstant=r}parse(e,r,s,l,u={}){return r?this.concat(r,s,l)._parse(e,u):this._parse(e,u)}_parse(e,r){function s(l,u,d){return d==="assert"?new Ji(u,[l]):d==="coerce"?new li(u,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[l];if(u){let d=u.parse(e,this);if(!d)return null;if(this.expectedType){const f=this.expectedType,g=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Or)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new _s;try{d=new Or(d.type,d.evaluate(f))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,s){const l=typeof e=="number"?this.path.concat(e):this.path,u=s?this.scope.concat(s):this.scope;return new Ur(this.registry,this._isConstant,l,r||null,u,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new hi(s,e))}checkSubtype(e,r){const s=or(e,r);return s&&this.error(s),s}}class dt{constructor(e,r,s){this.type=br,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,He);if(!l)return null;const u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,He);if(!u)return null;let d=null;return s.locale&&(d=r.parse(s.locale,1,Ye),!d)?null:new dt(l,u,d)}evaluate(e){return new kt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const Vr=8192;function Gn(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function ys(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Io(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*Vr),Math.round(s*l*Vr)]}function Ao(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return s*d-u*l==0&&s*u<=0&&l*d<=0}function ya(i,e){let r=!1;for(let d=0,f=e.length;d(s=i)[1]!=(u=g[v+1])[1]>s[1]&&s[0]<(u[0]-l[0])*(s[1]-l[1])/(u[1]-l[1])+l[0]&&(r=!r)}}var s,l,u;return r}function Po(i,e){for(let r=0;r0&&f<0||d<0&&f>0}function Ul(i,e,r){for(const v of r)for(let b=0;br[2]){const l=.5*s;let u=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;u===0&&(u=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=u}Gn(e,i)}function Co(i,e,r,s){const l=Math.pow(2,s.z)*Vr,u=[s.x*Vr,s.y*Vr],d=[];for(const f of i)for(const g of f){const v=[g.x+u[0],g.y+u[1]];wa(v,e,r,l),d.push(v)}return d}function zo(i,e,r,s){const l=Math.pow(2,s.z)*Vr,u=[s.x*Vr,s.y*Vr],d=[];for(const g of i){const v=[];for(const b of g){const E=[b.x+u[0],b.y+u[1]];Gn(e,E),v.push(E)}d.push(v)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of d)for(const v of g)wa(v,e,r,l)}var f;return d}class Er{constructor(e,r){this.type=He,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ms(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let l=0;l!Array.isArray(v)||v.length===e.length-1);let g=null;for(const[v,b]of f){g=new Ur(r.registry,vs,r.path,null,r.scope);const E=[];let A=!1;for(let M=1;M{return A=E,Array.isArray(A)?`(${A.map(wt).join(", ")})`:`(${wt(A.type)}...)`;var A}).join(" | "),b=[];for(let E=1;E{r=e?r&&vs(s):r&&s instanceof Or}),!!r&&Xn(i)&&bs(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Xn(i){if(i instanceof Gi&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Er)return!1;let e=!0;return i.eachChild(r=>{e&&!Xn(r)&&(e=!1)}),e}function Tn(i){if(i instanceof Gi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Tn(r)&&(e=!1)}),e}function bs(i,e){if(i instanceof Gi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!bs(s,e)&&(r=!1)}),r}function ws(i,e){const r=i.length-1;let s,l,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),s=i[f],l=i[f+1],s<=e){if(f===r||ee))throw new Rt("Input is not a number.");d=f-1}return 0}class En{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,u]of s)this.labels.push(l),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(e[1],1,ve);if(!s)return null;const l=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',v);const E=r.parse(g,b,u);if(!E)return null;u=u||E.type,l.push([f,E])}return new En(u,s,l)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;return l>=r[u-1]?s[u-1].evaluate(e):s[ws(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Sn(i,e,r){return i+r*(e-i)}function Ts(i,e,r){return i.map((s,l)=>Sn(s,e[l],r))}const ki={number:Sn,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[l,u,d,f]=Ts(i.rgb,e.rgb,r);return new je(l,u,d,f,!1)}case"hcl":{const[l,u,d,f]=i.hcl,[g,v,b,E]=e.hcl;let A,M;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?A=NaN:(A=g,d!==1&&d!==0||(M=v)):(A=l,b!==1&&b!==0||(M=u));else{let Q=g-l;g>l&&Q>180?Q-=360:g180&&(Q+=360),A=l+r*Q}const[k,U,F,K]=function([Q,X,ie,ne]){return Q=isNaN(Q)?0:Q*ee,Le([ie,Math.cos(Q)*X,Math.sin(Q)*X,ne])}([A,M??Sn(u,v,r),Sn(d,b,r),Sn(f,E,r)]);return new je(k,U,F,K,!1)}case"lab":{const[l,u,d,f]=Le(Ts(i.lab,e.lab,r));return new je(l,u,d,f,!1)}}},array:Ts,padding:function(i,e,r){return new zi(Ts(i.values,e.values,r))}};class Di{constructor(e,r,s,l,u){this.type=e,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(e,r,s,l){let u=0;if(e.name==="exponential")u=Ta(r,e.base,s,l);else if(e.name==="linear")u=Ta(r,1,s,l);else if(e.name==="cubic-bezier"){const d=e.controlPoints;u=new it(d[0],d[1],d[2],d[3]).solve(Ta(r,1,s,l))}return u}static parse(e,r){let[s,l,u,...d]=e;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const v=l[1];if(typeof v!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:v}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const v=l.slice(1);if(v.length!==4||v.some(b=>typeof b!="number"||b<0||b>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:v}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,ve),!u)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Si:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let v=0;v=b)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const k=r.parse(E,M,g);if(!k)return null;g=g||k.type,f.push([b,k])}return P(g,ve)||P(g,Si)||P(g,Yi)||P(g,ai(ve))?new Di(g,s,l,u,f):r.error(`Type ${wt(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;if(l>=r[u-1])return s[u-1].evaluate(e);const d=ws(r,l),f=Di.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=s[d].evaluate(e),v=s[d+1].evaluate(e);switch(this.operator){case"interpolate":return ki[this.type.kind](g,v,f);case"interpolate-hcl":return ki.color(g,v,f,"hcl");case"interpolate-lab":return ki.color(g,v,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Ta(i,e,r,s){const l=s-r,u=i-r;return l===0?0:e===1?u/l:(Math.pow(e,u)-1)/(Math.pow(e,l)-1)}class Es{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const u=[];for(const f of e.slice(1)){const g=r.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,u.push(g)}if(!s)throw new Error("No output type");const d=l&&u.some(f=>or(l,f.type));return new Es(d?Xe:s,u)}evaluate(e){let r,s=null,l=0;for(const u of this.args)if(l++,s=u.evaluate(e),s&&s instanceof Zi&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Ss{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u=s.length)throw new Rt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Rt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Wn{constructor(e,r){this.type=He,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Xe),l=r.parse(e[2],2,Xe);return s&&l?V(s.type,[He,Ye,ve,Rr,Xe])?new Wn(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${wt(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!S(r,["boolean","string","number","null"]))throw new Rt(`Expected first argument to be of type boolean, string, number or null, but found ${wt(qt(r))} instead.`);if(!S(s,["string","array"]))throw new Rt(`Expected second argument to be of type array or string, but found ${wt(qt(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Qr{constructor(e,r,s){this.type=ve,this.needle=e,this.haystack=r,this.fromIndex=s}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Xe),l=r.parse(e[2],2,Xe);if(!s||!l)return null;if(!V(s.type,[He,Ye,ve,Rr,Xe]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${wt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ve);return u?new Qr(s,l,u):null}return new Qr(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!S(r,["boolean","string","number","null"]))throw new Rt(`Expected first argument to be of type boolean, string, number or null, but found ${wt(qt(r))} instead.`);if(!S(s,["string","array"]))throw new Rt(`Expected second argument to be of type array or string, but found ${wt(qt(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(r,l)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class lt{constructor(e,r,s,l,u,d){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const u={},d=[];for(let v=2;vNumber.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof k=="number"&&Math.floor(k)!==k)return A.error("Numeric branch labels must be integer values.");if(s){if(A.checkSubtype(s,qt(k)))return null}else s=qt(k);if(u[String(k)]!==void 0)return A.error("Branch labels must be unique.");u[String(k)]=d.length}const M=r.parse(E,v,l);if(!M)return null;l=l||M.type,d.push(M)}const f=r.parse(e[1],1,Xe);if(!f)return null;const g=r.parse(e[e.length-1],e.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new lt(s,l,f,u,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(qt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Sa{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let d=1;dr.outputDefined())&&this.otherwise.outputDefined()}}class Is{constructor(e,r,s,l){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Xe),l=r.parse(e[2],2,ve);if(!s||!l)return null;if(!V(s.type,[ai(Xe),Ye,Xe]))return r.error(`Expected first argument to be of type array or string, but found ${wt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ve);return u?new Is(s.type,s,l,u):null}return new Is(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!S(r,["string","array"]))throw new Rt(`Expected first argument to be of type array or string, but found ${wt(qt(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(s,l)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function ko(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Do(i,e,r,s){return s.compare(e,r)===0}function In(i,e,r){const s=i!=="=="&&i!=="!=";return class td{constructor(u,d,f){this.type=He,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let g=d.parse(u[1],1,Xe);if(!g)return null;if(!ko(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${wt(g.type)}'.`);let v=d.parse(u[2],2,Xe);if(!v)return null;if(!ko(f,v.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${wt(v.type)}'.`);if(g.type.kind!==v.type.kind&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error(`Cannot compare types '${wt(g.type)}' and '${wt(v.type)}'.`);s&&(g.type.kind==="value"&&v.type.kind!=="value"?g=new Ji(v.type,[g]):g.type.kind!=="value"&&v.type.kind==="value"&&(v=new Ji(g.type,[v])));let b=null;if(u.length===4){if(g.type.kind!=="string"&&v.type.kind!=="string"&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(b=d.parse(u[3],3,br),!b)return null}return new td(g,v,b)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=qt(d),v=qt(f);if(g.kind!==v.kind||g.kind!=="string"&&g.kind!=="number")throw new Rt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${v.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=qt(d),v=qt(f);if(g.kind!=="string"||v.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Nl=In("==",function(i,e,r){return e===r},Do),$l=In("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!Do(0,e,r,s)}),ql=In("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),Zl=In("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),Gl=In(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Ia{constructor(e,r,s,l,u){this.type=Ye,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,ve);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,Ye),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,Ye),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,ve),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,ve),!g)?null:new Ia(s,u,d,f,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class As{constructor(e){this.type=wr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,ve),!g))return null;let v=null;if(f["text-font"]&&(v=r.parse(f["text-font"],1,ai(Ye)),!v))return null;let b=null;if(f["text-color"]&&(b=r.parse(f["text-color"],1,Si),!b))return null;const E=l[l.length-1];E.scale=g,E.font=v,E.textColor=b}else{const g=r.parse(e[d],1,Xe);if(!g)return null;const v=g.type.kind;if(v!=="string"&&v!=="value"&&v!=="null"&&v!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new As(l)}evaluate(e){return new oi(this.sections.map(r=>{const s=r.content.evaluate(e);return qt(s)===Tr?new Fr("",s,null,null,null):new Fr(Zn(s),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class Aa{constructor(e){this.type=Tr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Ye);return s?new Aa(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=Zi.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Pa{constructor(e){this.type=ve,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${wt(s.type)} instead.`):new Pa(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Rt(`Expected value to be of type string or array, but found ${wt(qt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const An={"==":Nl,"!=":$l,">":jl,"<":ql,">=":Gl,"<=":Zl,array:Ji,at:Ea,boolean:Ji,case:Sa,coalesce:Es,collator:dt,format:As,image:Aa,in:Wn,"index-of":Qr,interpolate:Di,"interpolate-hcl":Di,"interpolate-lab":Di,length:Pa,let:Ss,literal:Or,match:lt,number:Ji,"number-format":Ia,object:Ji,slice:Is,step:En,string:Ji,"to-boolean":li,"to-color":li,"to-number":li,"to-string":li,var:xs,within:Er};function Lo(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const u=l?l.evaluate(i):1,d=wn(e,r,s,u);if(d)throw new Rt(d);return new je(e/255,r/255,s/255,u,!1)}function Bo(i,e){return i in e}function Ma(i,e){const r=e[i];return r===void 0?null:r}function en(i){return{type:i}}function Ro(i){return{result:"success",value:i}}function Pn(i){return{result:"error",value:i}}function Mn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Fo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Ca(i){return!!i.expression&&i.expression.interpolated}function ft(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Ps(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Xl(i){return i}function Oo(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),u=i.type||(Ca(e)?"exponential":"interval");if(r||e.type==="padding"){const b=r?je.parse:zi.parse;(i=ar({},i)).stops&&(i.stops=i.stops.map(E=>[E[0],b(E[1])])),i.default=b(i.default?i.default:e.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,g,v;if(u==="exponential")f=Uo;else if(u==="interval")f=za;else if(u==="categorical"){f=Wl,g=Object.create(null);for(const b of i.stops)g[b[0]]=b[1];v=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=Hl}if(s){const b={},E=[];for(let k=0;kk[0]),evaluate:({zoom:k},U)=>Uo({stops:A,base:i.base},e,k).evaluate(k,U)}}if(l){const b=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:Di.interpolationFactor.bind(void 0,b),zoomStops:i.stops.map(E=>E[0]),evaluate:({zoom:E})=>f(i,e,E,g,v)}}return{kind:"source",evaluate(b,E){const A=E&&E.properties?E.properties[i.property]:void 0;return A===void 0?Hn(i.default,e.default):f(i,e,A,g,v)}}}function Hn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Wl(i,e,r,s,l){return Hn(typeof r===l?s[r]:void 0,i.default,e.default)}function za(i,e,r){if(ft(r)!=="number")return Hn(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=ws(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function Uo(i,e,r){const s=i.base!==void 0?i.base:1;if(ft(r)!=="number")return Hn(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const u=ws(i.stops.map(b=>b[0]),r),d=function(b,E,A,M){const k=M-A,U=b-A;return k===0?0:E===1?U/k:(Math.pow(E,U)-1)/(Math.pow(E,k)-1)}(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],g=i.stops[u+1][1],v=ki[e.type]||Xl;return typeof f.evaluate=="function"?{evaluate(...b){const E=f.evaluate.apply(void 0,b),A=g.evaluate.apply(void 0,b);if(E!==void 0&&A!==void 0)return v(E,A,d,i.colorSpace)}}:v(f,g,d,i.colorSpace)}function Hl(i,e,r){switch(e.type){case"color":r=je.parse(r);break;case"formatted":r=oi.fromString(r.toString());break;case"resolvedImage":r=Zi.fromString(r.toString());break;case"padding":r=zi.parse(r);break;default:ft(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Hn(r,i.default,e.default)}Gi.register(An,{error:[{kind:"error"},[Ye],(i,[e])=>{throw new Rt(e.evaluate(i))}],typeof:[Ye,[Xe],(i,[e])=>wt(qt(e.evaluate(i)))],"to-rgba":[ai(ve,4),[Si],(i,[e])=>{const[r,s,l,u]=e.evaluate(i).rgb;return[255*r,255*s,255*l,u]}],rgb:[Si,[ve,ve,ve],Lo],rgba:[Si,[ve,ve,ve,ve],Lo],has:{type:He,overloads:[[[Ye],(i,[e])=>Bo(e.evaluate(i),i.properties())],[[Ye,Ht],(i,[e,r])=>Bo(e.evaluate(i),r.evaluate(i))]]},get:{type:Xe,overloads:[[[Ye],(i,[e])=>Ma(e.evaluate(i),i.properties())],[[Ye,Ht],(i,[e,r])=>Ma(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Xe,[Ye],(i,[e])=>Ma(e.evaluate(i),i.featureState||{})],properties:[Ht,[],i=>i.properties()],"geometry-type":[Ye,[],i=>i.geometryType()],id:[Xe,[],i=>i.id()],zoom:[ve,[],i=>i.globals.zoom],"heatmap-density":[ve,[],i=>i.globals.heatmapDensity||0],"line-progress":[ve,[],i=>i.globals.lineProgress||0],accumulated:[Xe,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ve,en(ve),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[ve,en(ve),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:ve,overloads:[[[ve,ve],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[ve],(i,[e])=>-e.evaluate(i)]]},"/":[ve,[ve,ve],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[ve,[ve,ve],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[ve,[],()=>Math.LN2],pi:[ve,[],()=>Math.PI],e:[ve,[],()=>Math.E],"^":[ve,[ve,ve],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[ve,[ve],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[ve,[ve],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[ve,[ve],(i,[e])=>Math.log(e.evaluate(i))],log2:[ve,[ve],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[ve,[ve],(i,[e])=>Math.sin(e.evaluate(i))],cos:[ve,[ve],(i,[e])=>Math.cos(e.evaluate(i))],tan:[ve,[ve],(i,[e])=>Math.tan(e.evaluate(i))],asin:[ve,[ve],(i,[e])=>Math.asin(e.evaluate(i))],acos:[ve,[ve],(i,[e])=>Math.acos(e.evaluate(i))],atan:[ve,[ve],(i,[e])=>Math.atan(e.evaluate(i))],min:[ve,en(ve),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[ve,en(ve),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[ve,[ve],(i,[e])=>Math.abs(e.evaluate(i))],round:[ve,[ve],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[ve,[ve],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[ve,[ve],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[He,[Ye,Xe],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[He,[Xe],(i,[e])=>i.id()===e.value],"filter-type-==":[He,[Ye],(i,[e])=>i.geometryType()===e.value],"filter-<":[He,[Ye,Xe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s{const r=i.id(),s=e.value;return typeof r==typeof s&&r":[He,[Ye,Xe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[He,[Xe],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[He,[Ye,Xe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[He,[Xe],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[He,[Ye,Xe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[He,[Xe],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[He,[Xe],(i,[e])=>e.value in i.properties()],"filter-has-id":[He,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[He,[ai(Ye)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[He,[ai(Xe)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[He,[Ye,ai(Xe)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[He,[Ye,ai(Xe)],(i,[e,r])=>function(s,l,u,d){for(;u<=d;){const f=u+d>>1;if(l[f]===s)return!0;l[f]>s?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:He,overloads:[[[He,He],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[en(He),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:He,overloads:[[[He,He],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[en(He),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[He,[He],(i,[e])=>!e.evaluate(i)],"is-supported-script":[He,[Ye],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Ye,[Ye],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Ye,[Ye],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Ye,en(Xe),(i,e)=>e.map(r=>Zn(r.evaluate(i))).join("")],"resolved-locale":[Ye,[br],(i,[e])=>e.evaluate(i).resolvedLocale()]});class ka{constructor(e,r){var s;this.expression=e,this._warningHistory={},this._evaluator=new _s,this._defaultValue=r?(s=r).type==="color"&&Ps(s.default)?new je(0,0,0,0):s.type==="color"?je.parse(s.default)||null:s.type==="padding"?zi.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new Rt(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Ms(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in An}function Ct(i,e){const r=new Ur(An,vs,[],e?function(l){const u={color:Si,string:Ye,number:ve,enum:Ye,boolean:He,formatted:wr,padding:Yi,resolvedImage:Tr};return l.type==="array"?ai(u[l.value]||Xe,l.length):u[l.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Ro(new ka(s,e)):Pn(r.errors)}class Da{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Tn(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}}class rt{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Tn(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}interpolationFactor(e,r,s){return this.interpolationType?Di.interpolationFactor(this.interpolationType,e,r,s):0}}function Cs(i,e){const r=Ct(i,e);if(r.result==="error")return r;const s=r.value.expression,l=Xn(s);if(!l&&!Mn(e))return Pn([new hi("","data expressions not supported")]);const u=bs(s,["zoom"]);if(!u&&!Fo(e))return Pn([new hi("","zoom expressions not supported")]);const d=bt(s);return d||u?d instanceof hi?Pn([d]):d instanceof Di&&!Ca(e)?Pn([new hi("",'"interpolate" expressions cannot be used with this property')]):Ro(d?new rt(l?"camera":"composite",r.value,d.labels,d instanceof Di?d.interpolation:void 0):new Da(l?"constant":"source",r.value)):Pn([new hi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Tt{constructor(e,r){this._parameters=e,this._specification=r,ar(this,Oo(this._parameters,this._specification))}static deserialize(e){return new Tt(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function bt(i){let e=null;if(i instanceof Ss)e=bt(i.result);else if(i instanceof Es){for(const r of i.args)if(e=bt(r),e)break}else(i instanceof En||i instanceof Di)&&i.input instanceof Gi&&i.input.name==="zoom"&&(e=i);return e instanceof hi||i.eachChild(r=>{const s=bt(r);s instanceof hi?e=s:!e&&s?e=new hi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new hi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Cn(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Cn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Vo={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function La(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Cn(i)||(i=zs(i));const e=Ct(i,Vo);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>e.value.evaluate(r,s,{},l),needGeometry:No(i)}}function Kl(i,e){return ie?1:0}function No(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?ks(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(zs))):e==="all"?["all"].concat(i.slice(1).map(zs)):e==="none"?["all"].concat(i.slice(1).map(zs).map(Kn)):e==="in"?Ba(i[1],i.slice(2)):e==="!in"?Kn(Ba(i[1],i.slice(2))):e==="has"?Ra(i[1]):e==="!has"?Kn(Ra(i[1])):e!=="within"||i;var r}function ks(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Ba(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Kl)]]:["filter-in-small",i,["literal",e]]}}function Ra(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Kn(i){return["!",i]}function Yn(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const u of i)l+=`${Yn(u)},`;return`${l}]`}const r=Object.keys(i).sort();let s="{";for(let l=0;ls.maximum?[new be(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function jo(i){const e=i.valueSpec,r=Ft(i.value.type);let s,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,v=ft(i.value.stops)==="array"&&ft(i.value.stops[0])==="array"&&ft(i.value.stops[0][0])==="object",b=Xi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(M){if(r==="identity")return[new be(M.key,M.value,'identity function may not have a "stops" property')];let k=[];const U=M.value;return k=k.concat(qo({key:M.key,value:U,valueSpec:M.valueSpec,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:E})),ft(U)==="array"&&U.length===0&&k.push(new be(M.key,U,"array must have at least one stop")),k},default:function(M){return M.validateSpec({key:M.key,value:M.value,valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec})}}});return r==="identity"&&f&&b.push(new be(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||b.push(new be(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Ca(i.valueSpec)&&b.push(new be(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Mn(i.valueSpec)?b.push(new be(i.key,i.value,"property functions not supported")):f&&!Fo(i.valueSpec)&&b.push(new be(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!v||i.value.property!==void 0||b.push(new be(i.key,i.value,'"property" property is required')),b;function E(M){let k=[];const U=M.value,F=M.key;if(ft(U)!=="array")return[new be(F,U,`array expected, ${ft(U)} found`)];if(U.length!==2)return[new be(F,U,`array length 2 expected, length ${U.length} found`)];if(v){if(ft(U[0])!=="object")return[new be(F,U,`object expected, ${ft(U[0])} found`)];if(U[0].zoom===void 0)return[new be(F,U,"object stop key must have zoom")];if(U[0].value===void 0)return[new be(F,U,"object stop key must have value")];if(u&&u>Ft(U[0].zoom))return[new be(F,U[0].zoom,"stop zoom values must appear in ascending order")];Ft(U[0].zoom)!==u&&(u=Ft(U[0].zoom),l=void 0,d={}),k=k.concat(Xi({key:`${F}[0]`,value:U[0],valueSpec:{zoom:{}},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:Fa,value:A}}))}else k=k.concat(A({key:`${F}[0]`,value:U[0],valueSpec:{},validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec},U));return Ms(tn(U[1]))?k.concat([new be(`${F}[1]`,U[1],"expressions are not allowed in function stops.")]):k.concat(M.validateSpec({key:`${F}[1]`,value:U[1],valueSpec:e,validateSpec:M.validateSpec,style:M.style,styleSpec:M.styleSpec}))}function A(M,k){const U=ft(M.value),F=Ft(M.value),K=M.value!==null?M.value:k;if(s){if(U!==s)return[new be(M.key,K,`${U} stop domain type must match previous stop domain type ${s}`)]}else s=U;if(U!=="number"&&U!=="string"&&U!=="boolean")return[new be(M.key,K,"stop domain value must be a number, string, or boolean")];if(U!=="number"&&r!=="categorical"){let Q=`number expected, ${U} found`;return Mn(e)&&r===void 0&&(Q+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new be(M.key,K,Q)]}return r!=="categorical"||U!=="number"||isFinite(F)&&Math.floor(F)===F?r!=="categorical"&&U==="number"&&l!==void 0&&Fnew be(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new be(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Tn(r))return[new be(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Tn(r))return[new be(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!bs(r,["zoom","feature-state"]))return[new be(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Xn(r))return[new be(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Jn(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(Ft(r))===-1&&l.push(new be(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Ft(r))===-1&&l.push(new be(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function zn(i){return Cn(tn(i.value))?rn(ar({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Zo(i)}function Zo(i){const e=i.value,r=i.key;if(ft(e)!=="array")return[new be(r,e,`array expected, ${ft(e)} found`)];const s=i.styleSpec;let l,u=[];if(e.length<1)return[new be(r,e,"filter array must have at least 1 element")];switch(u=u.concat(Jn({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),Ft(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ft(e[1])==="$type"&&u.push(new be(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new be(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=ft(e[1]),l!=="string"&&u.push(new be(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;d{v in r&&e.push(new be(s,r[v],`"${v}" is prohibited for ref layers`))}),l.layers.forEach(v=>{Ft(v.id)===f&&(g=v)}),g?g.ref?e.push(new be(s,r.ref,"ref cannot reference another ref layer")):d=Ft(g.type):e.push(new be(s,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const g=l.sources&&l.sources[r.source],v=g&&Ft(g.type);g?v==="vector"&&d==="raster"?e.push(new be(s,r.source,`layer "${r.id}" requires a raster source`)):v==="raster"&&d!=="raster"?e.push(new be(s,r.source,`layer "${r.id}" requires a vector source`)):v!=="vector"||r["source-layer"]?v==="raster-dem"&&d!=="hillshade"?e.push(new be(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||v==="geojson"&&g.lineMetrics||e.push(new be(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new be(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new be(s,r.source,`source "${r.source}" not found`))}else e.push(new be(s,r,'missing required property "source"'));return e=e.concat(Xi({key:s,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:zn,layout:g=>Xi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Go(ar({layerType:d},v))}}),paint:g=>Xi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Ua(ar({layerType:d},v))}})}})),e}function lr(i){const e=i.value,r=i.key,s=ft(e);return s!=="string"?[new be(r,e,`string expected, ${s} found`)]:[]}const Ls={promoteId:function({key:i,value:e}){if(ft(e)==="string")return lr({key:i,value:e});{const r=[];for(const s in e)r.push(...lr({key:`${i}.${s}`,value:e[s]}));return r}}};function Bs(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,u=i.validateSpec;if(!e.type)return[new be(r,e,'"type" is required')];const d=Ft(e.type);let f;switch(d){case"vector":case"raster":case"raster-dem":return f=Xi({key:r,value:e,valueSpec:s[`source_${d.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:Ls,validateSpec:u}),f;case"geojson":if(f=Xi({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:u,objectElementValidators:Ls}),e.cluster)for(const g in e.clusterProperties){const[v,b]=e.clusterProperties[g],E=typeof v=="string"?[v,["accumulated"],["get",g]]:v;f.push(...rn({key:`${r}.${g}.map`,value:b,validateSpec:u,expressionContext:"cluster-map"})),f.push(...rn({key:`${r}.${g}.reduce`,value:E,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return Xi({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:u,styleSpec:s});case"image":return Xi({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:u,styleSpec:s});case"canvas":return[new be(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Jn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:u,styleSpec:s})}}function Xo(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let u=[];const d=ft(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new be("light",e,`object expected, ${d} found`)]),u;for(const f in e){const g=f.match(/^(.*)-transition$/);u=u.concat(g&&s[g[1]]&&s[g[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new be(f,e[f],`unknown property "${f}"`)])}return u}function Qn(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let u=[];const d=ft(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new be("terrain",e,`object expected, ${d} found`)]),u;for(const f in e)u=u.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new be(f,e[f],`unknown property "${f}"`)]);return u}function Wo(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],u=[];for(const d in r)r[d].id&&l.includes(r[d].id)&&e.push(new be(s,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&u.includes(r[d].url)&&e.push(new be(s,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),e=e.concat(Xi({key:`${s}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return lr({key:s,value:r})}const Ho={"*":()=>[],array:qo,boolean:function(i){const e=i.value,r=i.key,s=ft(e);return s!=="boolean"?[new be(r,e,`boolean expected, ${s} found`)]:[]},number:Fa,color:function(i){const e=i.key,r=i.value,s=ft(r);return s!=="string"?[new be(e,r,`color expected, ${s} found`)]:je.parse(String(r))?[]:[new be(e,r,`color expected, "${r}" found`)]},constants:$o,enum:Jn,filter:zn,function:jo,layer:Ds,object:Xi,source:Bs,light:Xo,terrain:Qn,string:lr,formatted:function(i){return lr(i).length===0?[]:rn(i)},resolvedImage:function(i){return lr(i).length===0?[]:rn(i)},padding:function(i){const e=i.key,r=i.value;if(ft(r)==="array"){if(r.length<1||r.length>4)return[new be(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let u=0;u[]}})),i.constants&&(r=r.concat($o({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:es}))),ts(r)}function Wi(i){return function(e){return i({...e,validateSpec:es})}}function ts(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function jt(i){return function(...e){return ts(i.apply(this,e))}}cr.source=jt(Wi(Bs)),cr.sprite=jt(Wi(Wo)),cr.glyphs=jt(Wi(Ko)),cr.light=jt(Wi(Xo)),cr.terrain=jt(Wi(Qn)),cr.layer=jt(Wi(Ds)),cr.filter=jt(Wi(zn)),cr.paintProperty=jt(Wi(Ua)),cr.layoutProperty=jt(Wi(Go));const Nr=cr,Jl=Nr.light,Ql=Nr.paintProperty,ec=Nr.layoutProperty;function kn(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new ji(new Error(s.message))),r=!0;return r}class is{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(s=d[2]);for(let g=0;g=E[k+0]&&l>=E[k+1])?(f[M]=!0,d.push(b[M])):f[M]=!1}}}}_forEachCell(e,r,s,l,u,d,f,g){const v=this._convertToCellCoord(e),b=this._convertToCellCoord(r),E=this._convertToCellCoord(s),A=this._convertToCellCoord(l);for(let M=v;M<=E;M++)for(let k=b;k<=A;k++){const U=this.d*k+M;if((!g||g(this._convertFromCellCoord(M),this._convertFromCellCoord(k),this._convertFromCellCoord(M+1),this._convertFromCellCoord(k+1)))&&u.call(this,e,r,s,l,U,d,f,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let s=0;for(let d=0;d=0)continue;const d=i[u];l[u]=hr[s].shallow.indexOf(u)>=0?d:rs(d,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof i)}function Sr(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Rs(i)||Xr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Sr);if(typeof i=="object"){const e=i.$name||"Object";if(!hr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=hr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const u=i[l];s[l]=hr[e].shallow.indexOf(l)>=0?u:Sr(u)}return s}throw new Error("can't deserialize object of type "+typeof i)}class Yo{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Fs(i){for(const e of i)if(Os(e.charCodeAt(0)))return!0;return!1}function Va(i){for(const e of i)if(!Jo(e.charCodeAt(0)))return!1;return!0}function Jo(i){return!(Ae.Arabic(i)||Ae["Arabic Supplement"](i)||Ae["Arabic Extended-A"](i)||Ae["Arabic Presentation Forms-A"](i)||Ae["Arabic Presentation Forms-B"](i))}function Os(i){return!(i!==746&&i!==747&&(i<4352||!(Ae["Bopomofo Extended"](i)||Ae.Bopomofo(i)||Ae["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Ae["CJK Compatibility Ideographs"](i)||Ae["CJK Compatibility"](i)||Ae["CJK Radicals Supplement"](i)||Ae["CJK Strokes"](i)||!(!Ae["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Ae["CJK Unified Ideographs Extension A"](i)||Ae["CJK Unified Ideographs"](i)||Ae["Enclosed CJK Letters and Months"](i)||Ae["Hangul Compatibility Jamo"](i)||Ae["Hangul Jamo Extended-A"](i)||Ae["Hangul Jamo Extended-B"](i)||Ae["Hangul Jamo"](i)||Ae["Hangul Syllables"](i)||Ae.Hiragana(i)||Ae["Ideographic Description Characters"](i)||Ae.Kanbun(i)||Ae["Kangxi Radicals"](i)||Ae["Katakana Phonetic Extensions"](i)||Ae.Katakana(i)&&i!==12540||!(!Ae["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Ae["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Ae["Unified Canadian Aboriginal Syllabics"](i)||Ae["Unified Canadian Aboriginal Syllabics Extended"](i)||Ae["Vertical Forms"](i)||Ae["Yijing Hexagram Symbols"](i)||Ae["Yi Syllables"](i)||Ae["Yi Radicals"](i))))}function Qo(i){return!(Os(i)||function(e){return!!(Ae["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Ae["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Ae["Letterlike Symbols"](e)||Ae["Number Forms"](e)||Ae["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Ae["Control Pictures"](e)&&e!==9251||Ae["Optical Character Recognition"](e)||Ae["Enclosed Alphanumerics"](e)||Ae["Geometric Shapes"](e)||Ae["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ae["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ae["CJK Symbols and Punctuation"](e)||Ae.Katakana(e)||Ae["Private Use Area"](e)||Ae["CJK Compatibility Forms"](e)||Ae["Small Form Variants"](e)||Ae["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Us(i){return i>=1424&&i<=2303||Ae["Arabic Presentation Forms-A"](i)||Ae["Arabic Presentation Forms-B"](i)}function Vs(i,e){return!(!e&&Us(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Ae.Khmer(i))}function el(i){for(const e of i)if(Us(e.charCodeAt(0)))return!0;return!1}const Na="deferred",Ns="loading",$a="loaded";let ns=null,Ii="unavailable",$r=null;const tl=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Ii="error"),ns&&ns(i)};function qa(){$s.fire(new vr("pluginStateChange",{pluginStatus:Ii,pluginURL:$r}))}const $s=new xn,ja=function(){return Ii},il=function(){if(Ii!==Na||!$r)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ii=Ns,qa(),$r&&yn({url:$r},i=>{i?tl(i):(Ii=$a,qa())})},Hi={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ii===$a||Hi.applyArabicShaping!=null,isLoading:()=>Ii===Ns,setState(i){if(!$i())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Ii=i.pluginStatus,$r=i.pluginURL},isParsed(){if(!$i())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Hi.applyArabicShaping!=null&&Hi.processBidirectionalText!=null&&Hi.processStyledBidirectionalText!=null},getPluginURL(){if(!$i())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return $r}};class Pt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Yo,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!Vs(l.charCodeAt(0),s))return!1;return!0}(e,Hi.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class qs{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(Ps(s))return new Tt(s,l);if(Ms(s)){const u=Cs(s,l);if(u.result==="error")throw new Error(u.value.map(d=>`${d.key}: ${d.message}`).join(", "));return u.value}{let u=s;return l.type==="color"&&typeof s=="string"?u=je.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)||(u=zi.parse(s)),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class Za{constructor(e){this.property=e,this.value=new qs(e,void 0)}transitioned(e,r){return new ss(this.property,this.value,r,mt({},e.transition,this.transition),e.now)}untransitioned(){return new ss(this.property,this.value,null,{},0)}}class rl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ei(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Za(this._values[e].property)),this._values[e].value=new qs(this._values[e].property,r===null?void 0:Ei(r))}getTransition(e){return Ei(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Za(this._values[e].property)),this._values[e].transition=Ei(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const s=new nl(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(e,r._values[l]);return s}untransitioned(){const e=new nl(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class ss{constructor(e,r,s,l,u){this.property=e,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const l=e.now||0,u=this.value.possiblyEvaluate(e,r,s),d=this.prior;if(d){if(l>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(l=1)return 1;const v=g*g,b=v*g;return 4*(g<.5?b:3*(g-v)+b-.75)}(f))}}return u}}class nl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new js(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Ga{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return Ei(this._values[e].value)}setValue(e,r){this._values[e]=new qs(this._values[e].property,r===null?void 0:Ei(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const l=new js(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}}class ur{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,l){return this.property.evaluate(this.value,this.parameters,e,r,s,l)}}class js{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Fe{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,s){const l=ki[this.specification.type];return l?l(e,r,s):e}}class $e{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new ur(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,l)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new ur(this,{kind:"constant",value:void 0},e.parameters);const l=ki[this.specification.type];if(l){const u=l(e.value.value,r.value.value,s);return new ur(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,r,s,l,u,d){return e.kind==="constant"?e.value:e.evaluate(r,s,l,u,d)}}class as extends $e{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new ur(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l),d=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new ur(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new ur(this,{kind:"constant",value:u},r)}return new ur(this,e.expression,r)}evaluate(e,r,s,l,u,d){if(e.kind==="source"){const f=e.evaluate(r,s,l,u,d);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,l),e.evaluate({zoom:Math.floor(r.zoom)},s,l),e.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):e.value}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Xa{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new Pt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Pt(Math.floor(r.zoom),r)),e.expression.evaluate(new Pt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Wa{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class Ai{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new qs(s,void 0),u=this.defaultTransitionablePropertyValues[r]=new Za(s);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}De("DataDrivenProperty",$e),De("DataConstantProperty",Fe),De("CrossFadedDataDrivenProperty",as),De("CrossFadedProperty",Xa),De("ColorRampProperty",Wa);const sl="-transition";class dr extends xn{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Ga(r.layout)),r.paint)){this._transitionablePaint=new rl(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new js(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(ec,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(sl)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(Ql,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(sl))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,f,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),fn(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,u={}){return(!u||u.validate!==!1)&&kn(this,e.call(Nr,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:le,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof ur&&Mn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const tc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ir{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Dt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Zt(i,e=1){let r=0,s=0;return{members:i.map(l=>{const u=tc[l.type].BYTES_PER_ELEMENT,d=r=al(r,Math.max(e,u)),f=l.components||1;return s=Math.max(s,u),r+=u*f,{name:l.name,type:l.type,components:f,offset:d}}),size:al(r,Math.max(s,e)),alignment:e}}function al(i,e){return Math.ceil(i/e)*e}class Dn extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=s,e}}Dn.prototype.bytesPerElement=4,De("StructArrayLayout2i4",Dn);class Zs extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=s,this.int16[u+2]=l,e}}Zs.prototype.bytesPerElement=6,De("StructArrayLayout3i6",Zs);class Ha extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,this.int16[d+3]=u,e}}Ha.prototype.bytesPerElement=8,De("StructArrayLayout4i8",Ha);class pr extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}pr.prototype.bytesPerElement=12,De("StructArrayLayout2i4i12",pr);class Gs extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=4*e,v=8*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[v+4]=l,this.uint8[v+5]=u,this.uint8[v+6]=d,this.uint8[v+7]=f,e}}Gs.prototype.bytesPerElement=8,De("StructArrayLayout2i4ub8",Gs);class nn extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=s,e}}nn.prototype.bytesPerElement=8,De("StructArrayLayout2f8",nn);class Xs extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,s,l,u,d,f,g,v,b)}emplace(e,r,s,l,u,d,f,g,v,b,E){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=s,this.uint16[A+2]=l,this.uint16[A+3]=u,this.uint16[A+4]=d,this.uint16[A+5]=f,this.uint16[A+6]=g,this.uint16[A+7]=v,this.uint16[A+8]=b,this.uint16[A+9]=E,e}}Xs.prototype.bytesPerElement=20,De("StructArrayLayout10ui20",Xs);class os extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,v,b,E,A){const M=this.length;return this.resize(M+1),this.emplace(M,e,r,s,l,u,d,f,g,v,b,E,A)}emplace(e,r,s,l,u,d,f,g,v,b,E,A,M){const k=12*e;return this.int16[k+0]=r,this.int16[k+1]=s,this.int16[k+2]=l,this.int16[k+3]=u,this.uint16[k+4]=d,this.uint16[k+5]=f,this.uint16[k+6]=g,this.uint16[k+7]=v,this.int16[k+8]=b,this.int16[k+9]=E,this.int16[k+10]=A,this.int16[k+11]=M,e}}os.prototype.bytesPerElement=24,De("StructArrayLayout4i4ui4i24",os);class Ka extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=s,this.float32[u+2]=l,e}}Ka.prototype.bytesPerElement=12,De("StructArrayLayout3f12",Ka);class Ln extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}Ln.prototype.bytesPerElement=4,De("StructArrayLayout1ul4",Ln);class sn extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,r,s,l,u,d,f,g,v)}emplace(e,r,s,l,u,d,f,g,v,b){const E=10*e,A=5*e;return this.int16[E+0]=r,this.int16[E+1]=s,this.int16[E+2]=l,this.int16[E+3]=u,this.int16[E+4]=d,this.int16[E+5]=f,this.uint32[A+3]=g,this.uint16[E+8]=v,this.uint16[E+9]=b,e}}sn.prototype.bytesPerElement=20,De("StructArrayLayout6i1ul2ui20",sn);class Ya extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}Ya.prototype.bytesPerElement=12,De("StructArrayLayout2i2i2i12",Ya);class Ws extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l,u)}emplace(e,r,s,l,u,d){const f=4*e,g=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[g+6]=u,this.int16[g+7]=d,e}}Ws.prototype.bytesPerElement=16,De("StructArrayLayout2f1f2i16",Ws);class an extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=12*e,f=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=s,this.float32[f+1]=l,this.float32[f+2]=u,e}}an.prototype.bytesPerElement=12,De("StructArrayLayout2ub2f12",an);class Hs extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=s,this.uint16[u+2]=l,e}}Hs.prototype.bytesPerElement=6,De("StructArrayLayout3ui6",Hs);class Ja extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,v,b,E,A,M,k,U,F,K){const Q=this.length;return this.resize(Q+1),this.emplace(Q,e,r,s,l,u,d,f,g,v,b,E,A,M,k,U,F,K)}emplace(e,r,s,l,u,d,f,g,v,b,E,A,M,k,U,F,K,Q){const X=24*e,ie=12*e,ne=48*e;return this.int16[X+0]=r,this.int16[X+1]=s,this.uint16[X+2]=l,this.uint16[X+3]=u,this.uint32[ie+2]=d,this.uint32[ie+3]=f,this.uint32[ie+4]=g,this.uint16[X+10]=v,this.uint16[X+11]=b,this.uint16[X+12]=E,this.float32[ie+7]=A,this.float32[ie+8]=M,this.uint8[ne+36]=k,this.uint8[ne+37]=U,this.uint8[ne+38]=F,this.uint32[ie+10]=K,this.int16[X+22]=Q,e}}Ja.prototype.bytesPerElement=48,De("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ja);class Ks extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,v,b,E,A,M,k,U,F,K,Q,X,ie,ne,ce,ke,Be,Pe,Se,we,Me){const Ie=this.length;return this.resize(Ie+1),this.emplace(Ie,e,r,s,l,u,d,f,g,v,b,E,A,M,k,U,F,K,Q,X,ie,ne,ce,ke,Be,Pe,Se,we,Me)}emplace(e,r,s,l,u,d,f,g,v,b,E,A,M,k,U,F,K,Q,X,ie,ne,ce,ke,Be,Pe,Se,we,Me,Ie){const ge=34*e,Ve=17*e;return this.int16[ge+0]=r,this.int16[ge+1]=s,this.int16[ge+2]=l,this.int16[ge+3]=u,this.int16[ge+4]=d,this.int16[ge+5]=f,this.int16[ge+6]=g,this.int16[ge+7]=v,this.uint16[ge+8]=b,this.uint16[ge+9]=E,this.uint16[ge+10]=A,this.uint16[ge+11]=M,this.uint16[ge+12]=k,this.uint16[ge+13]=U,this.uint16[ge+14]=F,this.uint16[ge+15]=K,this.uint16[ge+16]=Q,this.uint16[ge+17]=X,this.uint16[ge+18]=ie,this.uint16[ge+19]=ne,this.uint16[ge+20]=ce,this.uint16[ge+21]=ke,this.uint16[ge+22]=Be,this.uint32[Ve+12]=Pe,this.float32[Ve+13]=Se,this.float32[Ve+14]=we,this.float32[Ve+15]=Me,this.float32[Ve+16]=Ie,e}}Ks.prototype.bytesPerElement=68,De("StructArrayLayout8i15ui1ul4f68",Ks);class Ys extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}Ys.prototype.bytesPerElement=4,De("StructArrayLayout1f4",Ys);class Js extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=s,this.uint16[u+3]=l,e}}Js.prototype.bytesPerElement=8,De("StructArrayLayout1ul2ui8",Js);class o extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=s,e}}o.prototype.bytesPerElement=4,De("StructArrayLayout2ui4",o);class t extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}t.prototype.bytesPerElement=2,De("StructArrayLayout1ui2",t);class n extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,this.float32[d+3]=u,e}}n.prototype.bytesPerElement=16,De("StructArrayLayout4f16",n);class a extends Ir{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 ye(this.anchorPointX,this.anchorPointY)}}a.prototype.size=20;class c extends sn{get(e){return new a(this,e)}}De("CollisionBoxArray",c);class p extends Ir{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}p.prototype.size=48;class m extends Ja{get(e){return new p(this,e)}}De("PlacedSymbolArray",m);class y extends Ir{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}y.prototype.size=68;class _ extends Ks{get(e){return new y(this,e)}}De("SymbolInstanceArray",_);class x extends Ys{getoffsetX(e){return this.float32[1*e+0]}}De("GlyphOffsetArray",x);class T extends Zs{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}De("SymbolLineVertexArray",T);class w extends Ir{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]}}w.prototype.size=8;class z extends Js{get(e){return new w(this,e)}}De("FeatureIndexArray",z);class O extends Dn{}class L extends Dn{}class R extends Dn{}class $ extends pr{}class H extends Gs{}class re extends nn{}class N extends Xs{}class te extends os{}class ae extends Ka{}class pe extends Ln{}class me extends Ya{}class xe extends an{}class fe extends Hs{}class Ce extends o{}const Ue=Zt([{name:"a_pos",components:2,type:"Int16"}],4),{members:We}=Ue;class Ee{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let u=this.segments[this.segments.length-1];return e>Ee.MAX_VERTEX_ARRAY_LENGTH&&ci(`Max vertices per segment is ${Ee.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Ee.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==l)&&(u={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(u.sortKey=l),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,s,l){return new Ee([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function qe(i,e){return 256*(i=nt(Math.floor(i),0,255))+nt(Math.floor(e),0,255)}Ee.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,De("SegmentVector",Ee);const ze=Zt([{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 ct={exports:{}},Ot={exports:{}};Ot.exports=function(i,e){var r,s,l,u,d,f,g,v;for(s=i.length-(r=3&i.length),l=e,d=3432918353,f=461845907,v=0;v>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(v+2))<<16;case 2:g^=(255&i.charCodeAt(v+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(v)))*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var ht=Ot.exports,Ke={exports:{}};Ke.exports=function(i,e){for(var r,s=i.length,l=e^s,u=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++u;switch(s){case 3:l^=(255&i.charCodeAt(u+2))<<16;case 2:l^=(255&i.charCodeAt(u+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(u)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Lt=ht,xi=Ke.exports;ct.exports=Lt,ct.exports.murmur3=Lt,ct.exports.murmur2=xi;var Ut=_e(ct.exports);class ei{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Li(e)),this.positions.push(r,s,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Li(e);let s=0,l=this.ids.length-1;for(;s>1;this.ids[d]>=r?l=d:s=d+1}const u=[];for(;this.ids[s]===r;)u.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return u}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return Qi(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new ei;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Li(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Ut(String(i))}function Qi(i,e,r,s){for(;r>1];let u=r-1,d=s+1;for(;;){do u++;while(i[u]l);if(u>=d)break;er(i,u,d),er(e,3*u,3*d),er(e,3*u+1,3*d+1),er(e,3*u+2,3*d+2)}d-r`u_${l}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new ui(e,r):new fr(e,r)}}class ii{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,s,l){const u=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&e.set(u)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new ls(e,r):new fr(e,r)}}class pt{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,u){const d=this.paintVertexArray.length,f=this.expression.evaluate(new Pt(0),r,{},l,[],u);this.paintVertexArray.resize(e),this._setPaintValue(d,e,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,u)}_setPaintValue(e,r,s){if(this.type==="color"){const l=ut(s);for(let u=e;u`u_${f}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,s,l,u){const d=this.expression.evaluate(new Pt(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new Pt(this.zoom+1),r,{},l,[],u),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,d,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:this.zoom},s,l),d=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,u,d)}_setPaintValue(e,r,s,l){if(this.type==="color"){const u=ut(s),d=ut(l);for(let f=e;f`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof pt||s instanceof Yt)for(let l=0;l!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Qs(l,r,s);this.needsUpload=!1,this._featureMap=new ei,this._bufferOffset=0}populatePaintArrays(e,r,s,l,u,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,l,u,d);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,l){for(const u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function ic(i,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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function ol(i,e,r){const s={color:{source:nn,composite:n},number:{source:Ys,composite:nn}},l=function(u){return{"line-pattern":{source:N,composite:N},"fill-pattern":{source:N,composite:N},"fill-extrusion-pattern":{source:N,composite:N}}[u]}(i);return l&&l[r]||s[e][r]}De("ConstantBinder",Kt),De("CrossFadedConstantBinder",ii),De("SourceExpressionBinder",pt),De("CrossFadedCompositeBinder",Bi),De("CompositeExpressionBinder",Yt),De("ProgramConfiguration",Qs,{omit:["_buffers"]}),De("ProgramConfigurationSet",Ar);var St=8192;const Qa=Math.pow(2,14)-1,cs=-Qa-1;function Pr(i){const e=St/i.extent,r=i.loadGeometry();for(let s=0;sd.x+1||gd.y+1)&&ci("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function hs(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Pr(i):[]}}function ll(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class rc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new L,this.indexArray=new fe,this.segments=new Ee,this.programConfigurations=new Ar(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const l=this.layers[0],u=[];let d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(const{feature:g,id:v,index:b,sourceLayerIndex:E}of e){const A=this.layers[0]._featureFilter.needGeometry,M=hs(g,A);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),M,s))continue;const k=f?d.evaluate(M,{},s):void 0,U={id:v,properties:g.properties,type:g.type,sourceLayerIndex:E,index:b,geometry:A?M.geometry:Pr(g),patterns:{},sortKey:k};u.push(U)}f&&u.sort((g,v)=>g.sortKey-v.sortKey);for(const g of u){const{geometry:v,index:b,sourceLayerIndex:E}=g,A=e[b].feature;this.addFeature(g,v,b,s),r.featureIndex.insert(A,v,b,E,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,We),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,s,l){for(const u of r)for(const d of u){const f=d.x,g=d.y;if(f<0||f>=St||g<0||g>=St)continue;const v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),b=v.vertexLength;ll(this.layoutVertexArray,f,g,-1,-1),ll(this.layoutVertexArray,f,g,1,-1),ll(this.layoutVertexArray,f,g,1,1),ll(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(b,b+1,b+2),this.indexArray.emplaceBack(b,b+3,b+2),v.vertexLength+=4,v.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function uh(i,e){for(let r=0;r1){if(nc(i,e))return!0;for(let s=0;s1?r:r.sub(e)._mult(l)._add(e))}function fh(i,e){let r,s,l,u=!1;for(let d=0;de.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(u=!u)}return u}function ea(i,e){let r=!1;for(let s=0,l=i.length-1;se.y!=d.y>e.y&&e.x<(d.x-u.x)*(e.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function md(i,e,r){const s=r[0],l=r[2];if(i.xl.x&&e.x>l.x||i.yl.y&&e.y>l.y)return!1;const u=gt(i,e,r[0]);return u!==gt(i,e,r[1])||u!==gt(i,e,r[2])||u!==gt(i,e,r[3])}function eo(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function cl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function hl(i,e,r,s,l){if(!e[0]&&!e[1])return i;const u=ye.convert(e)._mult(l);r==="viewport"&&u._rotate(-s);const d=[];for(let f=0;fi.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||s.x>e.width-l.width||s.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=e.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g{e[i.evaluationKey]=g;const v=i.expression.evaluate(e);l.data[d+f+0]=Math.floor(255*v.r/v.a),l.data[d+f+1]=Math.floor(255*v.g/v.a),l.data[d+f+2]=Math.floor(255*v.b/v.a),l.data[d+f+3]=Math.floor(255*v.a)};if(i.clips)for(let d=0,f=0;d80*r){s=u=i[0],l=d=i[1];for(var k=r;ku&&(u=f),g>d&&(d=g);v=(v=Math.max(u-s,d-l))!==0?32767/v:0}return ro(A,M,r,s,l,v,0),M}function Eh(i,e,r,s,l){var u,d;if(l===dc(i,e,r,s)>0)for(u=e;u=e;u-=s)d=Ah(u,i[u],i[u+1],d);return d&&pl(d,d.next)&&(so(d),d=d.next),d}function us(i,e){if(!i)return i;e||(e=i);var r,s=i;do if(r=!1,s.steiner||!pl(s,s.next)&&Vt(s.prev,s,s.next)!==0)s=s.next;else{if(so(s),(s=e=s.prev)===s.next)break;r=!0}while(r||s!==e);return e}function ro(i,e,r,s,l,u,d){if(i){!d&&u&&function(b,E,A,M){var k=b;do k.z===0&&(k.z=hc(k.x,k.y,E,A,M)),k.prevZ=k.prev,k.nextZ=k.next,k=k.next;while(k!==b);k.prevZ.nextZ=null,k.prevZ=null,function(U){var F,K,Q,X,ie,ne,ce,ke,Be=1;do{for(K=U,U=null,ie=null,ne=0;K;){for(ne++,Q=K,ce=0,F=0;F0||ke>0&&Q;)ce!==0&&(ke===0||!Q||K.z<=Q.z)?(X=K,K=K.nextZ,ce--):(X=Q,Q=Q.nextZ,ke--),ie?ie.nextZ=X:U=X,X.prevZ=ie,ie=X;K=Q}ie.nextZ=null,Be*=2}while(ne>1)}(k)}(i,s,l,u);for(var f,g,v=i;i.prev!==i.next;)if(f=i.prev,g=i.next,u?Td(i,s,l,u):wd(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),so(i),i=g.next,v=g.next;else if((i=g)===v){d?d===1?ro(i=Ed(us(i),e,r),e,r,s,l,u,2):d===2&&Sd(i,e,r,s,l,u):ro(us(i),e,r,s,l,u,1);break}}}function wd(i){var e=i.prev,r=i,s=i.next;if(Vt(e,r,s)>=0)return!1;for(var l=e.x,u=r.x,d=s.x,f=e.y,g=r.y,v=s.y,b=lu?l>d?l:d:u>d?u:d,M=f>g?f>v?f:v:g>v?g:v,k=s.next;k!==e;){if(k.x>=b&&k.x<=A&&k.y>=E&&k.y<=M&&ia(l,f,u,g,d,v,k.x,k.y)&&Vt(k.prev,k,k.next)>=0)return!1;k=k.next}return!0}function Td(i,e,r,s){var l=i.prev,u=i,d=i.next;if(Vt(l,u,d)>=0)return!1;for(var f=l.x,g=u.x,v=d.x,b=l.y,E=u.y,A=d.y,M=fg?f>v?f:v:g>v?g:v,F=b>E?b>A?b:A:E>A?E:A,K=hc(M,k,e,r,s),Q=hc(U,F,e,r,s),X=i.prevZ,ie=i.nextZ;X&&X.z>=K&&ie&&ie.z<=Q;){if(X.x>=M&&X.x<=U&&X.y>=k&&X.y<=F&&X!==l&&X!==d&&ia(f,b,g,E,v,A,X.x,X.y)&&Vt(X.prev,X,X.next)>=0||(X=X.prevZ,ie.x>=M&&ie.x<=U&&ie.y>=k&&ie.y<=F&&ie!==l&&ie!==d&&ia(f,b,g,E,v,A,ie.x,ie.y)&&Vt(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;X&&X.z>=K;){if(X.x>=M&&X.x<=U&&X.y>=k&&X.y<=F&&X!==l&&X!==d&&ia(f,b,g,E,v,A,X.x,X.y)&&Vt(X.prev,X,X.next)>=0)return!1;X=X.prevZ}for(;ie&&ie.z<=Q;){if(ie.x>=M&&ie.x<=U&&ie.y>=k&&ie.y<=F&&ie!==l&&ie!==d&&ia(f,b,g,E,v,A,ie.x,ie.y)&&Vt(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function Ed(i,e,r){var s=i;do{var l=s.prev,u=s.next.next;!pl(l,u)&&Sh(l,s,s.next,u)&&no(l,u)&&no(u,l)&&(e.push(l.i/r|0),e.push(s.i/r|0),e.push(u.i/r|0),so(s),so(s.next),s=i=u),s=s.next}while(s!==i);return us(s)}function Sd(i,e,r,s,l,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&Cd(d,f)){var g=Ih(d,f);return d=us(d,d.next),g=us(g,g.next),ro(d,e,r,s,l,u,0),void ro(g,e,r,s,l,u,0)}f=f.next}d=d.next}while(d!==i)}function Id(i,e){return i.x-e.x}function Ad(i,e){var r=function(l,u){var d,f=u,g=l.x,v=l.y,b=-1/0;do{if(v<=f.y&&v>=f.next.y&&f.next.y!==f.y){var E=f.x+(v-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(E<=g&&E>b&&(b=E,d=f.x=f.x&&f.x>=k&&g!==f.x&&ia(vd.x||f.x===d.x&&Pd(d,f)))&&(d=f,F=A)),f=f.next;while(f!==M);return d}(i,e);if(!r)return e;var s=Ih(r,i);return us(s,s.next),us(r,r.next)}function Pd(i,e){return Vt(i.prev,i,e.prev)<0&&Vt(e.next,i,i.next)<0}function hc(i,e,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Md(i){var e=i,r=i;do(e.x=(i-d)*(u-f)&&(i-d)*(s-f)>=(r-d)*(e-f)&&(r-d)*(u-f)>=(l-d)*(s-f)}function Cd(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){var l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&Sh(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(no(i,e)&&no(e,i)&&function(r,s){var l=r,u=!1,d=(r.x+s.x)/2,f=(r.y+s.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&d<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(u=!u),l=l.next;while(l!==r);return u}(i,e)&&(Vt(i.prev,i,e.prev)||Vt(i,e.prev,e))||pl(i,e)&&Vt(i.prev,i,i.next)>0&&Vt(e.prev,e,e.next)>0)}function Vt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function pl(i,e){return i.x===e.x&&i.y===e.y}function Sh(i,e,r,s){var l=ml(Vt(i,e,r)),u=ml(Vt(i,e,s)),d=ml(Vt(r,s,i)),f=ml(Vt(r,s,e));return l!==u&&d!==f||!(l!==0||!fl(i,r,e))||!(u!==0||!fl(i,s,e))||!(d!==0||!fl(r,i,s))||!(f!==0||!fl(r,e,s))}function fl(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function ml(i){return i>0?1:i<0?-1:0}function no(i,e){return Vt(i.prev,i,i.next)<0?Vt(i,e,i.next)>=0&&Vt(i,i.prev,e)>=0:Vt(i,e,i.prev)<0||Vt(i,i.next,e)<0}function Ih(i,e){var r=new uc(i.i,i.x,i.y),s=new uc(e.i,e.x,e.y),l=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,u.next=s,s.prev=u,s}function Ah(i,e,r,s){var l=new uc(i,e,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function so(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function uc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function dc(i,e,r,s){for(var l=0,u=e,d=r-s;u0&&r.holes.push(s+=i[l-1].length)}return r};var Ph=_e(cc.exports);function zd(i,e,r,s,l){Mh(i,e,r||0,s||i.length-1,l||kd)}function Mh(i,e,r,s,l){for(;s>r;){if(s-r>600){var u=s-r+1,d=e-r+1,f=Math.log(u),g=.5*Math.exp(2*f/3),v=.5*Math.sqrt(f*g*(u-g)/u)*(d-u/2<0?-1:1);Mh(i,e,Math.max(r,Math.floor(e-d*g/u+v)),Math.min(s,Math.floor(e+(u-d)*g/u+v)),l)}var b=i[e],E=r,A=s;for(ao(i,r,e),l(i[s],b)>0&&ao(i,r,s);E0;)A--}l(i[r],b)===0?ao(i,r,A):ao(i,++A,s),A<=e&&(r=A+1),e<=A&&(s=A-1)}}function ao(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function kd(i,e){return ie?1:0}function pc(i,e){const r=i.length;if(r<=1)return[i];const s=[];let l,u;for(let d=0;d1)for(let d=0;dr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new R,this.indexArray=new fe,this.indexArray2=new Ce,this.programConfigurations=new Ar(e.layers,e.zoom),this.segments=new Ee,this.segments2=new Ee,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=fc("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:v,sourceLayerIndex:b}of e){const E=this.layers[0]._featureFilter.needGeometry,A=hs(f,E);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),A,s))continue;const M=u?l.evaluate(A,{},s,r.availableImages):void 0,k={id:g,properties:f.properties,type:f.type,sourceLayerIndex:b,index:v,geometry:E?A.geometry:Pr(f),patterns:{},sortKey:M};d.push(k)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:v,sourceLayerIndex:b}=f;if(this.hasPattern){const E=mc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,g,v,s,{});r.featureIndex.insert(e[v].feature,g,v,b,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,bd),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,s,l,u){for(const d of pc(r,500)){let f=0;for(const M of d)f+=M.length;const g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),v=g.vertexLength,b=[],E=[];for(const M of d){if(M.length===0)continue;M!==d[0]&&E.push(b.length/2);const k=this.segments2.prepareSegment(M.length,this.layoutVertexArray,this.indexArray2),U=k.vertexLength;this.layoutVertexArray.emplaceBack(M[0].x,M[0].y),this.indexArray2.emplaceBack(U+M.length-1,U),b.push(M[0].x),b.push(M[0].y);for(let F=1;F>3}if(l--,s===1||s===2)u+=i.readSVarint(),d+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new Od(u,d));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},ra.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,u=0,d=1/0,f=-1/0,g=1/0,v=-1/0;i.pos>3}if(s--,r===1||r===2)(l+=i.readSVarint())f&&(f=l),(u+=i.readSVarint())v&&(v=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,f,v]},ra.prototype.toGeoJSON=function(i,e,r){var s,l,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*e,g=this.loadGeometry(),v=ra.types[this.type];function b(M){for(var k=0;k>3;l=d===1?s.readString():d===2?s.readFloat():d===3?s.readDouble():d===4?s.readVarint64():d===5?s.readVarint():d===6?s.readSVarint():d===7?s.readBoolean():null}return l}(r))}Lh.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new Nd(this._pbf,e,this.extent,this._keys,this._values)};var qd=Dh;function jd(i,e,r){if(i===3){var s=new qd(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Bn.VectorTile=function(i,e){this.layers=i.readFields(jd,{},e)},Bn.VectorTileFeature=kh,Bn.VectorTileLayer=Dh;const Zd=Bn.VectorTileFeature.types,_c=Math.pow(2,13);function oo(i,e,r,s,l,u,d,f){i.emplaceBack(e,r,2*Math.floor(s*_c)+d,l*_c*2,u*_c*2,Math.round(f))}class yc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new $,this.centroidVertexArray=new O,this.indexArray=new fe,this.programConfigurations=new Ar(e.layers,e.zoom),this.segments=new Ee,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=fc("fill-extrusion",this.layers,r);for(const{feature:l,id:u,index:d,sourceLayerIndex:f}of e){const g=this.layers[0]._featureFilter.needGeometry,v=hs(l,g);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),v,s))continue;const b={id:u,sourceLayerIndex:f,index:d,geometry:g?v.geometry:Pr(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(mc("fill-extrusion",this.layers,b,this.zoom,r)):this.addFeature(b,b.geometry,d,s,{}),r.featureIndex.insert(l,b.geometry,d,f,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:u}=l;this.addFeature(l,u,l.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Rd.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,s,l,u){const d={x:0,y:0,vertexCount:0};for(const f of pc(r,500)){let g=0;for(const k of f)g+=k.length;let v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const k of f){if(k.length===0||Xd(k))continue;let U=0;for(let F=0;F=1){const Q=k[F-1];if(!Gd(K,Q)){v.vertexLength+4>Ee.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const X=K.sub(Q)._perp()._unit(),ie=Q.dist(K);U+ie>32768&&(U=0),oo(this.layoutVertexArray,K.x,K.y,X.x,X.y,0,0,U),oo(this.layoutVertexArray,K.x,K.y,X.x,X.y,0,1,U),d.x+=2*K.x,d.y+=2*K.y,d.vertexCount+=2,U+=ie,oo(this.layoutVertexArray,Q.x,Q.y,X.x,X.y,0,0,U),oo(this.layoutVertexArray,Q.x,Q.y,X.x,X.y,0,1,U),d.x+=2*Q.x,d.y+=2*Q.y,d.vertexCount+=2;const ne=v.vertexLength;this.indexArray.emplaceBack(ne,ne+2,ne+1),this.indexArray.emplaceBack(ne+1,ne+2,ne+3),v.vertexLength+=4,v.primitiveLength+=2}}}}if(v.vertexLength+g>Ee.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Zd[e.type]!=="Polygon")continue;const b=[],E=[],A=v.vertexLength;for(const k of f)if(k.length!==0){k!==f[0]&&E.push(b.length/2);for(let U=0;USt)||i.y===e.y&&(i.y<0||i.y>St)}function Xd(i){return i.every(e=>e.x<0)||i.every(e=>e.x>St)||i.every(e=>e.y<0)||i.every(e=>e.y>St)}let Bh;De("FillExtrusionBucket",yc,{omit:["layers","features"]});var Wd={get paint(){return Bh=Bh||new Ai({"fill-extrusion-opacity":new Fe(le["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new $e(le["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Fe(le["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Fe(le["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new as(le["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new $e(le["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new $e(le["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Fe(le["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};function lo(i,e){return i.x*e.x+i.y*e.y}function Rh(i,e){if(i.length===1){let r=0;const s=e[r++];let l;for(;!l||s.equals(l);)if(l=e[r++],!l)return 1/0;for(;rr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new H,this.layoutVertexArray2=new re,this.indexArray=new fe,this.programConfigurations=new Ar(e.layers,e.zoom),this.segments=new Ee,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=fc("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:v,sourceLayerIndex:b}of e){const E=this.layers[0]._featureFilter.needGeometry,A=hs(f,E);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),A,s))continue;const M=u?l.evaluate(A,{},s):void 0,k={id:g,properties:f.properties,type:f.type,sourceLayerIndex:b,index:v,geometry:E?A.geometry:Pr(f),patterns:{},sortKey:M};d.push(k)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:v,sourceLayerIndex:b}=f;if(this.hasPattern){const E=mc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,g,v,s,{});r.featureIndex.insert(e[v].feature,g,v,b,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Jd)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Kd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,s,l,u){const d=this.layers[0].layout,f=d.get("line-join").evaluate(e,{}),g=d.get("line-cap"),v=d.get("line-miter-limit"),b=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,f,g,v,b);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}addLine(e,r,s,l,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let K=0;K=2&&e[g-1].equals(e[g-2]);)g--;let v=0;for(;v0;if(ke&&K>v){const we=A.dist(M);if(we>2*b){const Me=A.sub(A.sub(M)._mult(b/we)._round());this.updateDistance(M,Me),this.addCurrentVertex(Me,U,0,0,E),M=Me}}const Pe=M&&k;let Se=Pe?s:f?"butt":l;if(Pe&&Se==="round"&&(neu&&(Se="bevel"),Se==="bevel"&&(ne>2&&(Se="flipbevel"),ne100)Q=F.mult(-1);else{const we=ne*U.add(F).mag()/U.sub(F).mag();Q._perp()._mult(we*(Be?-1:1))}this.addCurrentVertex(A,Q,0,0,E),this.addCurrentVertex(A,Q.mult(-1),0,0,E)}else if(Se==="bevel"||Se==="fakeround"){const we=-Math.sqrt(ne*ne-1),Me=Be?we:0,Ie=Be?0:we;if(M&&this.addCurrentVertex(A,U,Me,Ie,E),Se==="fakeround"){const ge=Math.round(180*ce/Math.PI/20);for(let Ve=1;Ve2*b){const Me=A.add(k.sub(A)._mult(b/we)._round());this.updateDistance(A,Me),this.addCurrentVertex(Me,F,0,0,E),A=Me}}}}addCurrentVertex(e,r,s,l,u,d=!1){const f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,d,!1,s,u),this.addHalfVertex(e,f,g,d,!0,-l,u),this.distance>Fh/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,s,l,u,d))}addHalfVertex({x:e,y:r},s,l,u,d,f,g){const v=.5*(this.lineClips?this.scaledDistance*(Fh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&v)<<2,v>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const b=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,b),g.primitiveLength++),d?this.e2=b:this.e1=b}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let Oh,Uh;De("LineBucket",xc,{omit:["layers","patternFeatures"]});var Vh={get paint(){return Uh=Uh||new Ai({"line-opacity":new $e(le.paint_line["line-opacity"]),"line-color":new $e(le.paint_line["line-color"]),"line-translate":new Fe(le.paint_line["line-translate"]),"line-translate-anchor":new Fe(le.paint_line["line-translate-anchor"]),"line-width":new $e(le.paint_line["line-width"]),"line-gap-width":new $e(le.paint_line["line-gap-width"]),"line-offset":new $e(le.paint_line["line-offset"]),"line-blur":new $e(le.paint_line["line-blur"]),"line-dasharray":new Xa(le.paint_line["line-dasharray"]),"line-pattern":new as(le.paint_line["line-pattern"]),"line-gradient":new Wa(le.paint_line["line-gradient"])})},get layout(){return Oh=Oh||new Ai({"line-cap":new Fe(le.layout_line["line-cap"]),"line-join":new $e(le.layout_line["line-join"]),"line-miter-limit":new Fe(le.layout_line["line-miter-limit"]),"line-round-limit":new Fe(le.layout_line["line-round-limit"]),"line-sort-key":new $e(le.layout_line["line-sort-key"])})}};class tp extends $e{possiblyEvaluate(e,r){return r=new Pt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,s,l){return r=mt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let gl;function Nh(i,e){return e>0?e+2*i:i}const ip=Zt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),rp=Zt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Zt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const np=Zt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Zt([{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 $h=Zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),sp=Zt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ap(i,e,r){return i.sections.forEach(s=>{s.text=function(l,u,d){const f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),Hi.applyArabicShaping&&(l=Hi.applyArabicShaping(l)),l}(s.text,e,r)}),i}Zt([{name:"triangle",components:3,type:"Uint16"}]),Zt([{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"}]),Zt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Zt([{type:"Float32",name:"offsetX"}]),Zt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const co={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ri=24,qh=yt,jh=function(i,e,r,s,l){var u,d,f=8*l-s-1,g=(1<>1,b=-7,E=r?l-1:0,A=r?-1:1,M=i[e+E];for(E+=A,u=M&(1<<-b)-1,M>>=-b,b+=f;b>0;u=256*u+i[e+E],E+=A,b-=8);for(d=u&(1<<-b)-1,u>>=-b,b+=s;b>0;d=256*d+i[e+E],E+=A,b-=8);if(u===0)u=1-v;else{if(u===g)return d?NaN:1/0*(M?-1:1);d+=Math.pow(2,s),u-=v}return(M?-1:1)*d*Math.pow(2,u-s)},Zh=function(i,e,r,s,l,u){var d,f,g,v=8*u-l-1,b=(1<>1,A=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,M=s?0:u-1,k=s?1:-1,U=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,d=b):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+E>=1?A/g:A*Math.pow(2,1-E))*g>=2&&(d++,g/=2),d+E>=b?(f=0,d=b):d+E>=1?(f=(e*g-1)*Math.pow(2,l),d+=E):(f=e*Math.pow(2,E-1)*Math.pow(2,l),d=0));l>=8;i[r+M]=255&f,M+=k,f/=256,l-=8);for(d=d<0;i[r+M]=255&d,M+=k,d/=256,v-=8);i[r+M-k]|=128*U};function yt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}yt.Varint=0,yt.Fixed64=1,yt.Bytes=2,yt.Fixed32=5;var vc=4294967296,Gh=1/vc,Xh=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function on(i){return i.type===yt.Bytes?i.readVarint()+i.pos:i.pos+1}function na(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Wh(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function op(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Hh(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}yt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos>3,u=this.pos;this.type=7&s,i(l,e,this),this.pos===u&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=_l(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Hh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=_l(this.buf,this.pos)+_l(this.buf,this.pos+4)*vc;return this.pos+=8,i},readSFixed64:function(){var i=_l(this.buf,this.pos)+Hh(this.buf,this.pos+4)*vc;return this.pos+=8,i},readFloat:function(){var i=jh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=jh(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(l,u,d){var f,g,v=d.buf;if(f=(112&(g=v[d.pos++]))>>4,g<128||(f|=(127&(g=v[d.pos++]))<<3,g<128)||(f|=(127&(g=v[d.pos++]))<<10,g<128)||(f|=(127&(g=v[d.pos++]))<<17,g<128)||(f|=(127&(g=v[d.pos++]))<<24,g<128)||(f|=(1&(g=v[d.pos++]))<<31,g<128))return na(l,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Xh?function(r,s,l){return Xh.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var u="",d=s;d239?4:b>223?3:b>191?2:1;if(d+A>l)break;A===1?b<128&&(E=b):A===2?(192&(f=r[d+1]))==128&&(E=(31&b)<<6|63&f)<=127&&(E=null):A===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((E=(15&b)<<12|(63&f)<<6|63&g)<=2047||E>=55296&&E<=57343)&&(E=null)):A===4&&(g=r[d+2],v=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&v)==128&&((E=(15&b)<<18|(63&f)<<12|(63&g)<<6|63&v)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,A=1):E>65535&&(E-=65536,u+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),u+=String.fromCharCode(E),d+=A}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==yt.Bytes)return i.push(this.readVarint(e));var r=on(this);for(i=i||[];this.pos127;);else if(e===yt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===yt.Fixed32)this.pos+=4;else{if(e!==yt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,r){var s,l;if(e>=0?(s=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(s,0,r),function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(l,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(s,l,u){for(var d,f,g=0;g55295&&d<57344){if(!f){d>56319||g+1===l.length?(s[u++]=239,s[u++]=191,s[u++]=189):f=d;continue}if(d<56320){s[u++]=239,s[u++]=191,s[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(s[u++]=239,s[u++]=191,s[u++]=189,f=null);d<128?s[u++]=d:(d<2048?s[u++]=d>>6|192:(d<65536?s[u++]=d>>12|224:(s[u++]=d>>18|240,s[u++]=d>>12&63|128),s[u++]=d>>6&63|128),s[u++]=63&d|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Wh(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Zh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Zh(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Wh(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,yt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,op,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,lp,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,up,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,cp,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,hp,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,dp,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,pp,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,fp,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,mp,e)},writeBytesField:function(i,e){this.writeTag(i,yt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,yt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,yt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,yt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,yt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,yt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,yt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,yt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,yt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,yt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var bc=_e(qh);const wc=3;function gp(i,e,r){i===1&&r.readMessage(_p,e)}function _p(i,e,r){if(i===3){const{id:s,bitmap:l,width:u,height:d,left:f,top:g,advance:v}=r.readMessage(yp,{});e.push({id:s,bitmap:new io({width:u+2*wc,height:d+2*wc},l),metrics:{width:u,height:d,left:f,top:g,advance:v}})}}function yp(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const Kh=wc;function Yh(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,u=0;for(const d of i)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,u=Math.max(u,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===g.w&&d.h===g.h){const v=s.pop();f=0&&s>=e&&xl[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new aa;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(uo.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function yl(i,e,r,s,l,u,d,f,g,v,b,E,A,M,k,U){const F=aa.fromFeature(i,l);let K;E===h.WritingMode.vertical&&F.verticalizePunctuation();const{processBidirectionalText:Q,processStyledBidirectionalText:X}=Hi;if(Q&&F.sections.length===1){K=[];const ce=Q(F.toString(),Ec(F,v,u,e,s,M,k));for(const ke of ce){const Be=new aa;Be.text=ke,Be.sections=F.sections;for(let Pe=0;Pe0&&cn>Ui&&(Ui=cn)}else{const nr=Be[tt.fontStack],Vi=nr&&nr[gi];if(Vi&&Vi.rect)Mr=Vi.rect,mr=Vi.metrics;else{const cn=ke[tt.fontStack],_o=cn&&cn[gi];if(!_o)continue;mr=_o.metrics}Ti=(fi-tt.scale)*ri}gr?(ce.verticalizable=!0,Oi.push({glyph:gi,imageName:Cr,x:It,y:Mt+Ti,vertical:gr,scale:tt.scale,fontStack:tt.fontStack,sectionIndex:Ki,metrics:mr,rect:Mr}),It+=ln*tt.scale+Ve):(Oi.push({glyph:gi,imageName:Cr,x:It,y:Mt+Ti,vertical:gr,scale:tt.scale,fontStack:tt.fontStack,sectionIndex:Ki,metrics:mr,rect:Mr}),It+=mr.advance*tt.scale+Ve)}Oi.length!==0&&(Jt=Math.max(It-Ve,Jt),bp(Oi,0,Oi.length-1,di,Ui)),It=0;const Bt=we*fi+Ui;Mi.lineOffset=Math.max(Ui,wi),Mt+=Bt,rr=Math.max(Bt,rr),++Gt}var ni;const pi=Mt-ho,{horizontalAlign:bi,verticalAlign:Fi}=Sc(Me);(function(Xt,fi,wi,Mi,Oi,Ui,Bt,mi,tt){const Ki=(fi-wi)*Oi;let gi=0;gi=Ui!==Bt?-mi*Mi-ho:(-Mi*tt+.5)*Bt;for(const Ti of Xt)for(const mr of Ti.positionedGlyphs)mr.x+=Ki,mr.y+=gi})(ce.positionedLines,di,bi,Fi,Jt,rr,we,pi,Se.length),ce.top+=-Fi*pi,ce.bottom=ce.top+pi,ce.left+=-bi*Jt,ce.right=ce.left+Jt}(ne,e,r,s,K,d,f,g,E,v,A,U),!function(ce){for(const ke of ce)if(ke.positionedGlyphs.length!==0)return!1;return!0}(ie)&&ne}const xl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},xp={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Qh(i,e,r,s,l,u){if(e.imageName){const d=s[e.imageName];return d?d.displaySize[0]*e.scale*ri/u+l:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+l:0}}function eu(i,e,r,s){const l=Math.pow(i-e,2);return s?i=0;let b=0;for(let A=0;Ad.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=ac([]),this.placementViewportMatrix=ac([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=nu(this.zoom,r["text-size"]),this.iconSizeData=nu(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=Ic(s,"text-overlap","text-allow-overlap")!=="never"||Ic(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(d=>h.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new Pc(new Ar(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Pc(new Ar(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new x,this.lineVertexArray=new T,this.symbolInstances=new _}calculateGlyphDependencies(e,r,s,l,u){for(let d=0;d0)&&(d.value.kind!=="constant"||d.value.value.length>0),b=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,E=u.get("symbol-sort-key");if(this.features=[],!v&&!b)return;const A=r.iconDependencies,M=r.glyphDependencies,k=r.availableImages,U=new Pt(this.zoom);for(const{feature:F,id:K,index:Q,sourceLayerIndex:X}of e){const ie=l._featureFilter.needGeometry,ne=hs(F,ie);if(!l._featureFilter.filter(U,ne,s))continue;let ce,ke;if(ie||(ne.geometry=Pr(F)),v){const Pe=l.getValueAndResolveTokens("text-field",ne,s,k),Se=oi.factory(Pe);Sp(Se)&&(this.hasRTLText=!0),(!this.hasRTLText||ja()==="unavailable"||this.hasRTLText&&Hi.isParsed())&&(ce=ap(Se,l,ne))}if(b){const Pe=l.getValueAndResolveTokens("icon-image",ne,s,k);ke=Pe instanceof Zi?Pe:Zi.fromString(Pe)}if(!ce&&!ke)continue;const Be=this.sortFeaturesByKey?E.evaluate(ne,{},s):void 0;if(this.features.push({id:K,text:ce,icon:ke,index:Q,sourceLayerIndex:X,geometry:ne.geometry,properties:F.properties,type:Tp[F.type],sortKey:Be}),ke&&(A[ke.name]=!0),ce){const Pe=d.evaluate(ne,{},s).join(","),Se=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(h.WritingMode.vertical)>=0;for(const we of ce.sections)if(we.image)A[we.image.name]=!0;else{const Me=Fs(ce.toString()),Ie=we.fontStack||Pe,ge=M[Ie]=M[Ie]||{};this.calculateGlyphDependencies(we.text,ge,Se,this.allowVerticalPlacement,Me)}}}u.get("symbol-placement")==="line"&&(this.features=function(F){const K={},Q={},X=[];let ie=0;function ne(Pe){X.push(F[Pe]),ie++}function ce(Pe,Se,we){const Me=Q[Pe];return delete Q[Pe],Q[Se]=Me,X[Me].geometry[0].pop(),X[Me].geometry[0]=X[Me].geometry[0].concat(we[0]),Me}function ke(Pe,Se,we){const Me=K[Se];return delete K[Se],K[Pe]=Me,X[Me].geometry[0].shift(),X[Me].geometry[0]=we[0].concat(X[Me].geometry[0]),Me}function Be(Pe,Se,we){const Me=we?Se[0][Se[0].length-1]:Se[0][0];return`${Pe}:${Me.x}:${Me.y}`}for(let Pe=0;PePe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((F,K)=>F.sortKey-K.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const s=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const d={};for(let f=e.segment+1;f=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const s=e.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;ul[f]-l[g]||u[g]-u[f]),d}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,u,d)=>{l>=0&&d.indexOf(l)===u&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let su,au;De("SymbolBucket",oa,{omit:["layers","collisionBoxArray","features","compareText"]}),oa.MAX_GLYPHS=65535,oa.addDynamicAttributes=Ac;var Cc={get paint(){return au=au||new Ai({"icon-opacity":new $e(le.paint_symbol["icon-opacity"]),"icon-color":new $e(le.paint_symbol["icon-color"]),"icon-halo-color":new $e(le.paint_symbol["icon-halo-color"]),"icon-halo-width":new $e(le.paint_symbol["icon-halo-width"]),"icon-halo-blur":new $e(le.paint_symbol["icon-halo-blur"]),"icon-translate":new Fe(le.paint_symbol["icon-translate"]),"icon-translate-anchor":new Fe(le.paint_symbol["icon-translate-anchor"]),"text-opacity":new $e(le.paint_symbol["text-opacity"]),"text-color":new $e(le.paint_symbol["text-color"],{runtimeType:Si,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new $e(le.paint_symbol["text-halo-color"]),"text-halo-width":new $e(le.paint_symbol["text-halo-width"]),"text-halo-blur":new $e(le.paint_symbol["text-halo-blur"]),"text-translate":new Fe(le.paint_symbol["text-translate"]),"text-translate-anchor":new Fe(le.paint_symbol["text-translate-anchor"])})},get layout(){return su=su||new Ai({"symbol-placement":new Fe(le.layout_symbol["symbol-placement"]),"symbol-spacing":new Fe(le.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Fe(le.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new $e(le.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Fe(le.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Fe(le.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Fe(le.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Fe(le.layout_symbol["icon-ignore-placement"]),"icon-optional":new Fe(le.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Fe(le.layout_symbol["icon-rotation-alignment"]),"icon-size":new $e(le.layout_symbol["icon-size"]),"icon-text-fit":new Fe(le.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Fe(le.layout_symbol["icon-text-fit-padding"]),"icon-image":new $e(le.layout_symbol["icon-image"]),"icon-rotate":new $e(le.layout_symbol["icon-rotate"]),"icon-padding":new $e(le.layout_symbol["icon-padding"]),"icon-keep-upright":new Fe(le.layout_symbol["icon-keep-upright"]),"icon-offset":new $e(le.layout_symbol["icon-offset"]),"icon-anchor":new $e(le.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Fe(le.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Fe(le.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Fe(le.layout_symbol["text-rotation-alignment"]),"text-field":new $e(le.layout_symbol["text-field"]),"text-font":new $e(le.layout_symbol["text-font"]),"text-size":new $e(le.layout_symbol["text-size"]),"text-max-width":new $e(le.layout_symbol["text-max-width"]),"text-line-height":new Fe(le.layout_symbol["text-line-height"]),"text-letter-spacing":new $e(le.layout_symbol["text-letter-spacing"]),"text-justify":new $e(le.layout_symbol["text-justify"]),"text-radial-offset":new $e(le.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Fe(le.layout_symbol["text-variable-anchor"]),"text-anchor":new $e(le.layout_symbol["text-anchor"]),"text-max-angle":new Fe(le.layout_symbol["text-max-angle"]),"text-writing-mode":new Fe(le.layout_symbol["text-writing-mode"]),"text-rotate":new $e(le.layout_symbol["text-rotate"]),"text-padding":new Fe(le.layout_symbol["text-padding"]),"text-keep-upright":new Fe(le.layout_symbol["text-keep-upright"]),"text-transform":new $e(le.layout_symbol["text-transform"]),"text-offset":new $e(le.layout_symbol["text-offset"]),"text-allow-overlap":new Fe(le.layout_symbol["text-allow-overlap"]),"text-overlap":new Fe(le.layout_symbol["text-overlap"]),"text-ignore-placement":new Fe(le.layout_symbol["text-ignore-placement"]),"text-optional":new Fe(le.layout_symbol["text-optional"])})}};class ou{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Rr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}De("FormatSectionOverride",ou,{omit:["defaultValue"]});class bl extends dr{constructor(e){super(e,Cc)}recalculate(e,r){if(super.recalculate(e,r),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 s=this.layout.get("text-writing-mode");if(s){const l=[];for(const u of s)l.indexOf(u)<0&&l.push(u);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const u=this.layout.get(e).evaluate(r,{},s,l),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||Ms(d.value)||!u?u:function(f,g){return g.replace(/{([^{}]+)}/g,(v,b)=>b in f?String(f[b]):"")}(r.properties,u)}createBucket(e){return new oa(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Cc.paint.overridableProperties){if(!bl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new ou(r),l=new ka(s,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new Da("source",l):new rt("composite",l,r.value.zoomStops),this.paint._values[e]=new ur(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&bl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=Cc.paint.properties[r];let u=!1;const d=f=>{for(const g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof oi)d(s.value.value.sections);else if(s.value.kind==="source"){const f=v=>{u||(v instanceof Or&&qt(v.value)===wr?d(v.value.sections):v instanceof As?d(v.sections):v.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return u}}let lu;var Ip={get paint(){return lu=lu||new Ai({"background-color":new Fe(le.paint_background["background-color"]),"background-pattern":new Xa(le.paint_background["background-pattern"]),"background-opacity":new Fe(le.paint_background["background-opacity"])})}};let cu;var Ap={get paint(){return cu=cu||new Ai({"raster-opacity":new Fe(le.paint_raster["raster-opacity"]),"raster-hue-rotate":new Fe(le.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Fe(le.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Fe(le.paint_raster["raster-brightness-max"]),"raster-saturation":new Fe(le.paint_raster["raster-saturation"]),"raster-contrast":new Fe(le.paint_raster["raster-contrast"]),"raster-resampling":new Fe(le.paint_raster["raster-resampling"]),"raster-fade-duration":new Fe(le.paint_raster["raster-fade-duration"])})}};class Pp extends dr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}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")}}const Mp={circle:class extends dr{constructor(i){super(i,gd)}createBucket(i){return new rc(i)}queryRadius(i){const e=i;return eo("circle-radius",this,e)+eo("circle-stroke-width",this,e)+cl(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=hl(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,d),v=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),b=this.paint.get("circle-pitch-alignment")==="map",E=b?g:function(M,k){return M.map(U=>yh(U,k))}(g,f),A=b?v*d:v;for(const M of s)for(const k of M){const U=b?k:yh(k,f);let F=A;const K=ul([],[k.x,k.y,0,1],f);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?F*=K[3]/u.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(F*=u.cameraToCenterDistance/K[3]),dd(E,U,F))return!0}return!1}},heatmap:class extends dr{createBucket(i){return new xh(i)}constructor(i){super(i,yd),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=wh({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends dr{constructor(i){super(i,xd)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends dr{constructor(i){super(i,Ld)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new gc(i)}queryRadius(){return cl(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d){return dh(hl(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,d),s)}isTileClipped(){return!0}},"fill-extrusion":class extends dr{constructor(i){super(i,Wd)}createBucket(i){return new yc(i)}queryRadius(){return cl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=hl(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,d),v=this.paint.get("fill-extrusion-height").evaluate(e,r),b=this.paint.get("fill-extrusion-base").evaluate(e,r),E=function(M,k,U,F){const K=[];for(const Q of M){const X=[Q.x,Q.y,0,1];ul(X,X,k),K.push(new ye(X[0]/X[3],X[1]/X[3]))}return K}(g,f),A=function(M,k,U,F){const K=[],Q=[],X=F[8]*k,ie=F[9]*k,ne=F[10]*k,ce=F[11]*k,ke=F[8]*U,Be=F[9]*U,Pe=F[10]*U,Se=F[11]*U;for(const we of M){const Me=[],Ie=[];for(const ge of we){const Ve=ge.x,Re=ge.y,et=F[0]*Ve+F[4]*Re+F[12],It=F[1]*Ve+F[5]*Re+F[13],Mt=F[2]*Ve+F[6]*Re+F[14],Jt=F[3]*Ve+F[7]*Re+F[15],rr=Mt+ne,di=Jt+ce,Gt=et+ke,ni=It+Be,pi=Mt+Pe,bi=Jt+Se,Fi=new ye((et+X)/di,(It+ie)/di);Fi.z=rr/di,Me.push(Fi);const Xt=new ye(Gt/bi,ni/bi);Xt.z=pi/bi,Ie.push(Xt)}K.push(Me),Q.push(Ie)}return[K,Q]}(s,b,v,f);return function(M,k,U){let F=1/0;dh(U,k)&&(F=Rh(U,k[0]));for(let K=0;K=3){for(let U=0;U{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const zc=63710088e-1;class On{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new On(Qt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,s=this.lat*r,l=e.lat*r,u=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return zc*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof On)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new On(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new On(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const hu=2*Math.PI*zc;function uu(i){return hu*Math.cos(i*Math.PI/180)}function du(i){return(180+i)/360}function pu(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function fu(i,e){return i/uu(e)}function kc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class wl{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=On.convert(e);return new wl(du(s.lng),pu(s.lat),fu(r,s.lat))}toLngLat(){return new On(360*this.x-180,kc(this.y))}toAltitude(){return this.z*uu(kc(this.y))}meterInMercatorCoordinateUnits(){return 1/hu*(e=kc(this.y),1/Math.cos(e*Math.PI/180));var e}}function mu(i,e,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class Dc{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=s,this.key=fo(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const l=(d=this.y,f=this.z,g=mu(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),v=mu(256*(u+1),256*(d+1),f),g[0]+","+g[1]+","+v[0]+","+v[1]);var u,d,f,g,v;const b=function(E,A,M){let k,U="";for(let F=E;F>0;F--)k=1<1?"@2x":"").replace(/{quadkey}/g,b).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new ye((e.x*r-this.x)*St,(e.y*r-this.y)*St)}toString(){return`${this.z}/${this.x}/${this.y}`}}class gu{constructor(e,r){this.wrap=e,this.canonical=r,this.key=fo(e,r.z,r.z,r.x,r.y)}}class ir{constructor(e,r,s,l,u){if(e= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Dc(s,+l,+u),this.key=fo(r,e,s,l,u)}clone(){return new ir(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new ir(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ir(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?fo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):fo(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new ir(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new ir(r,this.wrap,r,s,l),new ir(r,this.wrap,r,s+1,l),new ir(r,this.wrap,r,s,l+1),new ir(r,this.wrap,r,s+1,l+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=f),f=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,s){return(256*e*256+256*r+s)/10-1e4}_unpackTerrarium(e,r,s){return 256*e+r+s/256-32768}getPixels(){return new tr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,u=r*this.dim+this.dim,d=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:l=u-1;break;case 1:u=l+1}switch(s){case-1:d=f-1;break;case 1:f=d+1}const g=-r*this.dim,v=-s*this.dim;for(let b=d;b=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class xu{constructor(e,r,s,l,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=u}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(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class vu{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new is(St,16,0),this.grid3D=new is(St,16,0),this.featureIndexArray=new z,this.promoteId=r}insert(e,r,s,l,u,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,u);const g=d?this.grid3D:this.grid;for(let v=0;v=0&&E[3]>=0&&g.insert(f,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Bn.VectorTile(new bc(this.rawTileData)).layers,this.sourceLayerCoder=new yu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const u=e.params||{},d=St/e.tileSize/e.scale,f=La(u.filter),g=e.queryGeometry,v=e.queryPadding*d,b=wu(g),E=this.grid.query(b.minX-v,b.minY-v,b.maxX+v,b.maxY+v),A=wu(e.cameraQueryGeometry),M=this.grid3D.query(A.minX-v,A.minY-v,A.maxX+v,A.maxY+v,(F,K,Q,X)=>function(ie,ne,ce,ke,Be){for(const Se of ie)if(ne<=Se.x&&ce<=Se.y&&ke>=Se.x&&Be>=Se.y)return!0;const Pe=[new ye(ne,ce),new ye(ne,Be),new ye(ke,Be),new ye(ke,ce)];if(ie.length>2){for(const Se of Pe)if(ea(ie,Se))return!0}for(let Se=0;Se(X||(X=Pr(ie)),ne.queryIntersectsFeature(g,ie,ce,X,this.z,e.transform,d,e.pixelPosMatrix)))}return k}loadMatchingFeature(e,r,s,l,u,d,f,g,v,b,E){const A=this.bucketLayerIDs[r];if(d&&!function(F,K){for(let Q=0;Q=0)return!0;return!1}(d,A))return;const M=this.sourceLayerCoder.decode(s),k=this.vtLayers[M].feature(l);if(u.needGeometry){const F=hs(k,!0);if(!u.filter(new Pt(this.tileID.overscaledZ),F,this.tileID.canonical))return}else if(!u.filter(new Pt(this.tileID.overscaledZ),k))return;const U=this.getId(k,M);for(let F=0;F{const f=e instanceof js?e.get(d):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function wu(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y);return{minX:e,minY:r,maxX:s,maxY:l}}function zp(i,e){return e-i}function Tu(i,e,r,s,l){const u=[];for(let d=0;d=s&&E.x>=s||(b.x>=s?b=new ye(s,b.y+(s-b.x)/(E.x-b.x)*(E.y-b.y))._round():E.x>=s&&(E=new ye(s,b.y+(s-b.x)/(E.x-b.x)*(E.y-b.y))._round()),b.y>=l&&E.y>=l||(b.y>=l?b=new ye(b.x+(l-b.y)/(E.y-b.y)*(E.x-b.x),l)._round():E.y>=l&&(E=new ye(b.x+(l-b.y)/(E.y-b.y)*(E.x-b.x),l)._round()),g&&b.equals(g[g.length-1])||(g=[b],u.push(g)),g.push(E)))))}}return u}De("FeatureIndex",vu,{omit:["rawTileData","sourceLayerCoder"]});class Un extends ye{constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Un(this.x,this.y,this.angle,this.segment)}}function Eu(i,e,r,s,l){if(e.segment===void 0)return!0;let u=e,d=e.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;const g=[];let v=0;for(;fs;)v-=g.shift().angleDelta;if(v>l)return!1;d++,f+=b.dist(E)}return!0}function Su(i){let e=0;for(let r=0;rv){const k=(v-g)/M,U=ki.number(E.x,A.x,k),F=ki.number(E.y,A.y,k),K=new Un(U,F,A.angleTo(E),b);return K._round(),!d||Eu(i,K,f,d,e)?K:void 0}g+=M}}function Dp(i,e,r,s,l,u,d,f,g){const v=Iu(s,u,d),b=Au(s,l),E=b*d,A=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-E=0&&ie=0&&ne=0&&A+v<=b){const ce=new Un(ie,ne,Q,k);ce._round(),s&&!Eu(i,ce,u,s,l)||M.push(ce)}}E+=K}return f||M.length||d||(M=Pu(i,E/2,r,s,l,u,d,!0,g)),M}De("Anchor",Un);const la=Ri;function Mu(i,e,r,s){const l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2*la,g=u.paddedRect.h-2*la,v=i.right-i.left,b=i.bottom-i.top,E=u.stretchX||[[0,f]],A=u.stretchY||[[0,g]],M=(we,Me)=>we+Me[1]-Me[0],k=E.reduce(M,0),U=A.reduce(M,0),F=f-k,K=g-U;let Q=0,X=k,ie=0,ne=U,ce=0,ke=F,Be=0,Pe=K;if(u.content&&s){const we=u.content;Q=Tl(E,0,we[0]),ie=Tl(A,0,we[1]),X=Tl(E,we[0],we[2]),ne=Tl(A,we[1],we[3]),ce=we[0]-Q,Be=we[1]-ie,ke=we[2]-we[0]-X,Pe=we[3]-we[1]-ne}const Se=(we,Me,Ie,ge)=>{const Ve=El(we.stretch-Q,X,v,i.left),Re=Sl(we.fixed-ce,ke,we.stretch,k),et=El(Me.stretch-ie,ne,b,i.top),It=Sl(Me.fixed-Be,Pe,Me.stretch,U),Mt=El(Ie.stretch-Q,X,v,i.left),Jt=Sl(Ie.fixed-ce,ke,Ie.stretch,k),rr=El(ge.stretch-ie,ne,b,i.top),di=Sl(ge.fixed-Be,Pe,ge.stretch,U),Gt=new ye(Ve,et),ni=new ye(Mt,et),pi=new ye(Mt,rr),bi=new ye(Ve,rr),Fi=new ye(Re/d,It/d),Xt=new ye(Jt/d,di/d),fi=e*Math.PI/180;if(fi){const Oi=Math.sin(fi),Ui=Math.cos(fi),Bt=[Ui,-Oi,Oi,Ui];Gt._matMult(Bt),ni._matMult(Bt),bi._matMult(Bt),pi._matMult(Bt)}const wi=we.stretch+we.fixed,Mi=Me.stretch+Me.fixed;return{tl:Gt,tr:ni,bl:bi,br:pi,tex:{x:u.paddedRect.x+la+wi,y:u.paddedRect.y+la+Mi,w:Ie.stretch+Ie.fixed-wi,h:ge.stretch+ge.fixed-Mi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Fi,pixelOffsetBR:Xt,minFontScaleX:ke/d/v,minFontScaleY:Pe/d/b,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){const we=Cu(E,F,k),Me=Cu(A,K,U);for(let Ie=0;Ie0&&(k=Math.max(10,k),this.circleDiameter=k)}else{let E=d.top*f-g[0],A=d.bottom*f+g[2],M=d.left*f-g[3],k=d.right*f+g[1];const U=d.collisionPadding;if(U&&(M-=U[0]*f,E-=U[1]*f,k+=U[2]*f,A+=U[3]*f),b){const F=new ye(M,E),K=new ye(k,E),Q=new ye(M,A),X=new ye(k,A),ie=b*Math.PI/180;F._rotate(ie),K._rotate(ie),Q._rotate(ie),X._rotate(ie),M=Math.min(F.x,K.x,Q.x,X.x),k=Math.max(F.x,K.x,Q.x,X.x),E=Math.min(F.y,K.y,Q.y,X.y),A=Math.max(F.y,K.y,Q.y,X.y)}e.emplaceBack(r.x,r.y,M,E,k,A,s,l,u)}this.boxEndIndex=e.length}}class Lp{constructor(e=[],r=Bp){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,l=r[e];for(;e>0;){const u=e-1>>1,d=r[u];if(s(l,d)>=0)break;r[e]=d,e=u}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,u=r[e];for(;e=0)break;r[e]=f,e=d}r[e]=u}}function Bp(i,e){return ie?1:0}function Rp(i,e=1,r=!1){let s=1/0,l=1/0,u=-1/0,d=-1/0;const f=i[0];for(let M=0;Mu)&&(u=k.x),(!M||k.y>d)&&(d=k.y)}const g=Math.min(u-s,d-l);let v=g/2;const b=new Lp([],Fp);if(g===0)return new ye(s,l);for(let M=s;ME.d||!E.d)&&(E=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,A)),M.max-E.d<=e||(v=M.h/2,b.push(new ca(M.p.x-v,M.p.y-v,v,i)),b.push(new ca(M.p.x+v,M.p.y-v,v,i)),b.push(new ca(M.p.x-v,M.p.y+v,v,i)),b.push(new ca(M.p.x+v,M.p.y+v,v,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${E.d}`)),E.p}function Fp(i,e){return e.max-i.max}function ca(i,e,r,s){this.p=new ye(i,e),this.h=r,this.d=function(l,u){let d=!1,f=1/0;for(let g=0;gl.y!=k.y>l.y&&l.x<(k.x-M.x)*(l.y-M.y)/(k.y-M.y)+M.x&&(d=!d),f=Math.min(f,ph(l,M,k))}}return(d?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}const Lc=Number.POSITIVE_INFINITY;function zu(i,e){return e[1]!==Lc?function(r,s,l){let u=0,d=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-l}switch(r){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}return[u,d]}(i,e[0],e[1]):function(r,s){let l=0,u=0;s<0&&(s=0);const d=s/Math.sqrt(2);switch(r){case"top-right":case"top-left":u=d-7;break;case"bottom-right":case"bottom-left":u=7-d;break;case"bottom":u=7-s;break;case"top":u=s-7}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=s;break;case"right":l=-s}return[l,u]}(i,e[0])}function Bc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Op(i,e,r,s,l,u,d,f,g,v,b){let E=u.textMaxSize.evaluate(e,{});E===void 0&&(E=d);const A=i.layers[0].layout,M=A.get("icon-offset").evaluate(e,{},b),k=Du(r.horizontal),U=d/24,F=i.tilePixelRatio*U,K=i.tilePixelRatio*E/24,Q=i.tilePixelRatio*f,X=i.tilePixelRatio*A.get("symbol-spacing"),ie=A.get("text-padding")*i.tilePixelRatio,ne=function(ge,Ve,Re,et=1){const It=ge.get("icon-padding").evaluate(Ve,{},Re),Mt=It&&It.values;return[Mt[0]*et,Mt[1]*et,Mt[2]*et,Mt[3]*et]}(A,e,b,i.tilePixelRatio),ce=A.get("text-max-angle")/180*Math.PI,ke=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",Be=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",Pe=A.get("symbol-placement"),Se=X/2,we=A.get("icon-text-fit");let Me;s&&we!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Me=ru(s,r.vertical,we,A.get("icon-text-fit-padding"),M,U)),k&&(s=ru(s,k,we,A.get("icon-text-fit-padding"),M,U)));const Ie=(ge,Ve)=>{Ve.x<0||Ve.x>=St||Ve.y<0||Ve.y>=St||function(Re,et,It,Mt,Jt,rr,di,Gt,ni,pi,bi,Fi,Xt,fi,wi,Mi,Oi,Ui,Bt,mi,tt,Ki,gi,Ti,mr){const Mr=Re.addToLineVertexArray(et,It);let Cr,ln,gr,nr,Vi=0,cn=0,_o=0,Fu=0,qc=-1,jc=-1;const hn={};let Ou=Ut(""),Zc=0,Gc=0;if(Gt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Zc,Gc]=Gt.layout.get("text-offset").evaluate(tt,{},Ti).map(Ni=>Ni*ri):(Zc=Gt.layout.get("text-radial-offset").evaluate(tt,{},Ti)*ri,Gc=Lc),Re.allowVerticalPlacement&&Mt.vertical){const Ni=Gt.layout.get("text-rotate").evaluate(tt,{},Ti)+90;gr=new Il(ni,et,pi,bi,Fi,Mt.vertical,Xt,fi,wi,Ni),di&&(nr=new Il(ni,et,pi,bi,Fi,di,Oi,Ui,wi,Ni))}if(Jt){const Ni=Gt.layout.get("icon-rotate").evaluate(tt,{}),jr=Gt.layout.get("icon-text-fit")!=="none",yo=Mu(Jt,Ni,gi,jr),xo=di?Mu(di,Ni,gi,jr):void 0;ln=new Il(ni,et,pi,bi,Fi,Jt,Oi,Ui,!1,Ni),Vi=4*yo.length;const Nu=Re.iconSizeData;let ds=null;Nu.kind==="source"?(ds=[qr*Gt.layout.get("icon-size").evaluate(tt,{})],ds[0]>Fn&&ci(`${Re.layerIds[0]}: Value for "icon-size" is >= ${po}. Reduce your "icon-size".`)):Nu.kind==="composite"&&(ds=[qr*Ki.compositeIconSizes[0].evaluate(tt,{},Ti),qr*Ki.compositeIconSizes[1].evaluate(tt,{},Ti)],(ds[0]>Fn||ds[1]>Fn)&&ci(`${Re.layerIds[0]}: Value for "icon-size" is >= ${po}. Reduce your "icon-size".`)),Re.addSymbols(Re.icon,yo,ds,mi,Bt,tt,h.WritingMode.none,et,Mr.lineStartIndex,Mr.lineLength,-1,Ti),qc=Re.icon.placedSymbolArray.length-1,xo&&(cn=4*xo.length,Re.addSymbols(Re.icon,xo,ds,mi,Bt,tt,h.WritingMode.vertical,et,Mr.lineStartIndex,Mr.lineLength,-1,Ti),jc=Re.icon.placedSymbolArray.length-1)}const Uu=Object.keys(Mt.horizontal);for(const Ni of Uu){const jr=Mt.horizontal[Ni];if(!Cr){Ou=Ut(jr.text);const xo=Gt.layout.get("text-rotate").evaluate(tt,{},Ti);Cr=new Il(ni,et,pi,bi,Fi,jr,Xt,fi,wi,xo)}const yo=jr.positionedLines.length===1;if(_o+=ku(Re,et,jr,rr,Gt,wi,tt,Mi,Mr,Mt.vertical?h.WritingMode.horizontal:h.WritingMode.horizontalOnly,yo?Uu:[Ni],hn,qc,Ki,Ti),yo)break}Mt.vertical&&(Fu+=ku(Re,et,Mt.vertical,rr,Gt,wi,tt,Mi,Mr,h.WritingMode.vertical,["vertical"],hn,jc,Ki,Ti));const Np=Cr?Cr.boxStartIndex:Re.collisionBoxArray.length,$p=Cr?Cr.boxEndIndex:Re.collisionBoxArray.length,qp=gr?gr.boxStartIndex:Re.collisionBoxArray.length,jp=gr?gr.boxEndIndex:Re.collisionBoxArray.length,Zp=ln?ln.boxStartIndex:Re.collisionBoxArray.length,Gp=ln?ln.boxEndIndex:Re.collisionBoxArray.length,Xp=nr?nr.boxStartIndex:Re.collisionBoxArray.length,Wp=nr?nr.boxEndIndex:Re.collisionBoxArray.length;let zr=-1;const Pl=(Ni,jr)=>Ni&&Ni.circleDiameter?Math.max(Ni.circleDiameter,jr):jr;zr=Pl(Cr,zr),zr=Pl(gr,zr),zr=Pl(ln,zr),zr=Pl(nr,zr);const Vu=zr>-1?1:0;Vu&&(zr*=mr/ri),Re.glyphOffsetArray.length>=oa.MAX_GLYPHS&&ci("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),tt.sortKey!==void 0&&Re.addToSortKeyRanges(Re.symbolInstances.length,tt.sortKey),Re.symbolInstances.emplaceBack(et.x,et.y,hn.right>=0?hn.right:-1,hn.center>=0?hn.center:-1,hn.left>=0?hn.left:-1,hn.vertical||-1,qc,jc,Ou,Np,$p,qp,jp,Zp,Gp,Xp,Wp,pi,_o,Fu,Vi,cn,Vu,0,Xt,Zc,Gc,zr)}(i,Ve,ge,r,s,l,Me,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,F,[ie,ie,ie,ie],ke,g,Q,ne,Be,M,e,u,v,b,d)};if(Pe==="line")for(const ge of Tu(e.geometry,0,0,St,St)){const Ve=Dp(ge,X,ce,r.vertical||k,s,24,K,i.overscaling,St);for(const Re of Ve)k&&Up(i,k.text,Se,Re)||Ie(ge,Re)}else if(Pe==="line-center"){for(const ge of e.geometry)if(ge.length>1){const Ve=kp(ge,ce,r.vertical||k,s,24,K);Ve&&Ie(ge,Ve)}}else if(e.type==="Polygon")for(const ge of pc(e.geometry,0)){const Ve=Rp(ge,16);Ie(ge[0],new Un(Ve.x,Ve.y,0))}else if(e.type==="LineString")for(const ge of e.geometry)Ie(ge,new Un(ge[0].x,ge[0].y,0));else if(e.type==="Point")for(const ge of e.geometry)for(const Ve of ge)Ie([Ve],new Un(Ve.x,Ve.y,0))}function ku(i,e,r,s,l,u,d,f,g,v,b,E,A,M,k){const U=function(Q,X,ie,ne,ce,ke,Be,Pe){const Se=ne.layout.get("text-rotate").evaluate(ke,{})*Math.PI/180,we=[];for(const Me of X.positionedLines)for(const Ie of Me.positionedGlyphs){if(!Ie.rect)continue;const ge=Ie.rect||{};let Ve=Kh+1,Re=!0,et=1,It=0;const Mt=(ce||Pe)&&Ie.vertical,Jt=Ie.metrics.advance*Ie.scale/2;if(Pe&&X.verticalizable&&(It=Me.lineOffset/2-(Ie.imageName?-(ri-Ie.metrics.width*Ie.scale)/2:(Ie.scale-1)*ri)),Ie.imageName){const Bt=Be[Ie.imageName];Re=Bt.sdf,et=Bt.pixelRatio,Ve=Ri/et}const rr=ce?[Ie.x+Jt,Ie.y]:[0,0];let di=ce?[0,0]:[Ie.x+Jt+ie[0],Ie.y+ie[1]-It],Gt=[0,0];Mt&&(Gt=di,di=[0,0]);const ni=(Ie.metrics.left-Ve)*Ie.scale-Jt+di[0],pi=(-Ie.metrics.top-Ve)*Ie.scale+di[1],bi=ni+ge.w*Ie.scale/et,Fi=pi+ge.h*Ie.scale/et,Xt=new ye(ni,pi),fi=new ye(bi,pi),wi=new ye(ni,Fi),Mi=new ye(bi,Fi);if(Mt){const Bt=new ye(-Jt,Jt-ho),mi=-Math.PI/2,tt=ri/2-Jt,Ki=new ye(5-ho-tt,-(Ie.imageName?tt:0)),gi=new ye(...Gt);Xt._rotateAround(mi,Bt)._add(Ki)._add(gi),fi._rotateAround(mi,Bt)._add(Ki)._add(gi),wi._rotateAround(mi,Bt)._add(Ki)._add(gi),Mi._rotateAround(mi,Bt)._add(Ki)._add(gi)}if(Se){const Bt=Math.sin(Se),mi=Math.cos(Se),tt=[mi,-Bt,Bt,mi];Xt._matMult(tt),fi._matMult(tt),wi._matMult(tt),Mi._matMult(tt)}const Oi=new ye(0,0),Ui=new ye(0,0);we.push({tl:Xt,tr:fi,bl:wi,br:Mi,tex:ge,writingMode:X.writingMode,glyphOffset:rr,sectionIndex:Ie.sectionIndex,isSDF:Re,pixelOffsetTL:Oi,pixelOffsetBR:Ui,minFontScaleX:0,minFontScaleY:0})}return we}(0,r,f,l,u,d,s,i.allowVerticalPlacement),F=i.textSizeData;let K=null;F.kind==="source"?(K=[qr*l.layout.get("text-size").evaluate(d,{})],K[0]>Fn&&ci(`${i.layerIds[0]}: Value for "text-size" is >= ${po}. Reduce your "text-size".`)):F.kind==="composite"&&(K=[qr*M.compositeTextSizes[0].evaluate(d,{},k),qr*M.compositeTextSizes[1].evaluate(d,{},k)],(K[0]>Fn||K[1]>Fn)&&ci(`${i.layerIds[0]}: Value for "text-size" is >= ${po}. Reduce your "text-size".`)),i.addSymbols(i.text,U,K,f,u,d,v,e,g.lineStartIndex,g.lineLength,A,k);for(const Q of b)E[Q]=i.text.placedSymbolArray.length-1;return 4*U.length}function Du(i){for(const e in i)return i[e];return null}function Up(i,e,r,s){const l=i.compareText;if(e in l){const u=l[e];for(let d=u.length-1;d>=0;d--)if(s.dist(u[d])>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const u=Lu[15&s];if(!u)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new Rc(f,d,u,e)}constructor(e,r=64,s=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=Lu.indexOf(this.ArrayType),d=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=r,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Fc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:d,nodeSize:f}=this,g=[0,u.length-1,0],v=[];for(;g.length;){const b=g.pop()||0,E=g.pop()||0,A=g.pop()||0;if(E-A<=f){for(let F=A;F<=E;F++){const K=d[2*F],Q=d[2*F+1];K>=e&&K<=s&&Q>=r&&Q<=l&&v.push(u[F])}continue}const M=A+E>>1,k=d[2*M],U=d[2*M+1];k>=e&&k<=s&&U>=r&&U<=l&&v.push(u[M]),(b===0?e<=k:r<=U)&&(g.push(A),g.push(M-1),g.push(1-b)),(b===0?s>=k:l>=U)&&(g.push(M+1),g.push(E),g.push(1-b))}return v}within(e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:d}=this,f=[0,l.length-1,0],g=[],v=s*s;for(;f.length;){const b=f.pop()||0,E=f.pop()||0,A=f.pop()||0;if(E-A<=d){for(let F=A;F<=E;F++)Ru(u[2*F],u[2*F+1],e,r)<=v&&g.push(l[F]);continue}const M=A+E>>1,k=u[2*M],U=u[2*M+1];Ru(k,U,e,r)<=v&&g.push(l[M]),(b===0?e-s<=k:r-s<=U)&&(f.push(A),f.push(M-1),f.push(1-b)),(b===0?e+s>=k:r+s>=U)&&(f.push(M+1),f.push(E),f.push(1-b))}return g}}function Fc(i,e,r,s,l,u){if(l-s<=r)return;const d=s+l>>1;Bu(i,e,d,s,l,u),Fc(i,e,r,s,d-1,1-u),Fc(i,e,r,d+1,l,1-u)}function Bu(i,e,r,s,l,u){for(;l>s;){if(l-s>600){const v=l-s+1,b=r-s+1,E=Math.log(v),A=.5*Math.exp(2*E/3),M=.5*Math.sqrt(E*A*(v-A)/v)*(b-v/2<0?-1:1);Bu(i,e,r,Math.max(s,Math.floor(r-b*A/v+M)),Math.min(l,Math.floor(r+(v-b)*A/v+M)),u)}const d=e[2*r+u];let f=s,g=l;for(mo(i,e,s,r),e[2*l+u]>d&&mo(i,e,s,l);fd;)g--}e[2*s+u]===d?mo(i,e,s,g):(g++,mo(i,e,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function mo(i,e,r,s){Oc(i,r,s),Oc(e,2*r,2*s),Oc(e,2*r+1,2*s+1)}function Oc(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function Ru(i,e,r,s){const l=i-r,u=e-s;return l*l+u*u}var Uc;h.PerformanceMarkers=void 0,(Uc=h.PerformanceMarkers||(h.PerformanceMarkers={})).create="create",Uc.load="load",Uc.fullLoad="fullLoad";let Al=null,go=[];const Vc=1e3/60,Nc="loadTime",$c="fullLoadTime",Vp={mark(i){performance.mark(i)},frame(i){const e=i;Al!=null&&go.push(e-Al),Al=e},clearMetrics(){Al=null,go=[],performance.clearMeasures(Nc),performance.clearMeasures($c);for(const i in h.PerformanceMarkers)performance.clearMarks(h.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure(Nc,h.PerformanceMarkers.create,h.PerformanceMarkers.load),performance.measure($c,h.PerformanceMarkers.create,h.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName(Nc)[0].duration,e=performance.getEntriesByName($c)[0].duration,r=go.length,s=1/(go.reduce((u,d)=>u+d,0)/r/1e3),l=go.filter(u=>u>Vc).reduce((u,d)=>u+(d-Vc)/Vc,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};h.AJAXError=Dr,h.ARRAY_TYPE=ta,h.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Wt(["receive","process"],this),this.invoker=new Cp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=$i()?i:window}send(i,e,r,s,l=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const d=kr(this.globalScope)?void 0:[];return this.target.postMessage({id:u,type:i,hasCallback:!!r,targetMapId:s,mustQueue:l,sourceMapId:this.mapId,data:rs(e,d)},d),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"",targetMapId:s,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type===""){delete this.tasks[r];const s=this.cancelCallbacks[r];delete this.cancelCallbacks[r],s&&s()}else $i()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type===""){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Sr(e.error)):r(null,Sr(e.data)))}else{let r=!1;const s=kr(this.globalScope)?void 0:[],l=e.hasCallback?(f,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:f?rs(f):null,data:rs(g,s)},s)}:f=>{r=!0};let u=null;const d=Sr(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,d,l);else if(this.parent.getWorkerSource){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],d.source)[f[1]](d,l)}else l(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},h.AlphaImage=io,h.CanonicalTileID=Dc,h.CollisionBoxArray=c,h.CollisionCircleLayoutArray=class extends Ws{},h.Color=je,h.DEMData=_u,h.DataConstantProperty=Fe,h.DictionaryCoder=yu,h.EXTENT=St,h.ErrorEvent=ji,h.EvaluationParameters=Pt,h.Event=vr,h.Evented=xn,h.FeatureIndex=vu,h.FillBucket=gc,h.FillExtrusionBucket=yc,h.GeoJSONFeature=xu,h.ImageAtlas=Jh,h.ImagePosition=Tc,h.KDBush=Rc,h.LineBucket=xc,h.LineStripIndexArray=class extends t{},h.LngLat=On,h.MercatorCoordinate=wl,h.ONE_EM=ri,h.OverscaledTileID=ir,h.PerformanceUtils=Vp,h.Point=ye,h.Pos3dArray=class extends Zs{},h.PosArray=O,h.Properties=Ai,h.Protobuf=bc,h.QuadTriangleArray=class extends Hs{},h.RGBAImage=tr,h.RasterBoundsArray=class extends Ha{},h.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},h.SegmentVector=Ee,h.SymbolBucket=oa,h.Transitionable=rl,h.TriangleIndexArray=fe,h.Uniform1f=fr,h.Uniform1i=class extends vi{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},h.Uniform2f=class extends vi{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},h.Uniform3f=class extends vi{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},h.Uniform4f=ls,h.UniformColor=ui,h.UniformMatrix4f=class extends vi{constructor(i,e){super(i,e),this.current=ti}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},h.UnwrappedTileID=gu,h.ValidationError=be,h.ZoomHistory=Yo,h.addDynamicAttributes=Ac,h.arrayBufferToImage=function(i,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=yr})},r.onerror=()=>e(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 s=new Blob([new Uint8Array(i)],{type:"image/png"});r.src=i.byteLength?URL.createObjectURL(s):yr},h.arrayBufferToImageBitmap=function(i,e){const r=new Blob([new Uint8Array(i)],{type:"image/png"});createImageBitmap(r).then(s=>{e(null,s)}).catch(s=>{e(new Error(`Could not load image because of ${s.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},h.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let s=i.length;const l=new Array(i.length);let u=null;i.forEach((d,f)=>{e(d,(g,v)=>{g&&(u=g),l[f]=v,--s==0&&r(u,l)})})},h.bezier=At,h.bindAll=Wt,h.clamp=nt,h.clipLine=Tu,h.clone=function(i){var e=new ta(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},h.clone$1=Ei,h.collisionCircleLayout=sp,h.config=Nn,h.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},h.create=function(){var i=new ta(16);return ta!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},h.createExpression=Ct,h.createFilter=La,h.createLayout=Zt,h.createStyleLayer=function(i){return i.type==="custom"?new Pp(i):new Mp[i.type](i)},h.deepEqual=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let s=0;s{s[d.source]?r.push({command:at.removeLayer,args:[d.id]}):u.push(d)}),r=r.concat(l),function(d,f,g){f=f||[];const v=(d=d||[]).map(vn),b=f.map(vn),E=d.reduce(Jr,{}),A=f.reduce(Jr,{}),M=v.slice(),k=Object.create(null);let U,F,K,Q,X,ie,ne;for(U=0,F=0;U{}}},h.groupByLayout=function(i,e){const r={};for(let l=0;l@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,u)=>{const d=l||u;return e[s]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},h.parseGlyphPbf=function(i){return new bc(i).readFields(gp,[])},h.pbf=qh,h.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=St/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,s={layoutIconSize:r["icon-size"].possiblyEvaluate(new Pt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Pt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Pt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:v}=i.bucket.textSizeData;s.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Pt(g),i.canonical),r["text-size"].possiblyEvaluate(new Pt(v),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:v}=i.bucket.iconSizeData;s.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Pt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Pt(v),i.canonical)]}const l=e.get("text-line-height")*ri,u=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",d=e.get("text-keep-upright"),f=e.get("text-size");for(const g of i.bucket.features){const v=e.get("text-font").evaluate(g,{},i.canonical).join(","),b=f.evaluate(g,{},i.canonical),E=s.layoutTextSize.evaluate(g,{},i.canonical),A=s.layoutIconSize.evaluate(g,{},i.canonical),M={horizontal:{},vertical:void 0},k=g.text;let U,F=[0,0];if(k){const X=k.toString(),ie=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*ri,ne=Va(X)?ie:0,ce=e.get("text-anchor").evaluate(g,{},i.canonical),ke=e.get("text-variable-anchor");if(!ke){const Me=e.get("text-radial-offset").evaluate(g,{},i.canonical);F=Me?zu(ce,[Me*ri,Lc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Ie=>Ie*ri)}let Be=u?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Pe=e.get("symbol-placement"),Se=Pe==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*ri:0,we=()=>{i.bucket.allowVerticalPlacement&&Fs(X)&&(M.vertical=yl(k,i.glyphMap,i.glyphPositions,i.imagePositions,v,Se,l,ce,"left",ne,F,h.WritingMode.vertical,!0,Pe,E,b))};if(!u&&ke){const Me=Be==="auto"?ke.map(ge=>Bc(ge)):[Be];let Ie=!1;for(let ge=0;gethis._layers[de.id]),J=j[0];if(J.visibility==="none")continue;const W=J.source||"";let Z=this.familiesBySource[W];Z||(Z=this.familiesBySource[W]={});const ee=J.sourceLayer||"_geojsonTileLayer";let he=Z[ee];he||(he=Z[ee]=[]),he.push(j)}}}class Y{constructor(S){const P={},D=[];for(const W in S){const Z=S[W],ee=P[W]={};for(const he in Z){const de=Z[+he];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const ue={x:0,y:0,w:de.bitmap.width+2,h:de.bitmap.height+2};D.push(ue),ee[he]={rect:ue,metrics:de.metrics}}}const{w:q,h:j}=h.potpack(D),J=new h.AlphaImage({width:q||1,height:j||1});for(const W in S){const Z=S[W];for(const ee in Z){const he=Z[+ee];if(!he||he.bitmap.width===0||he.bitmap.height===0)continue;const de=P[W][ee].rect;h.AlphaImage.copy(he.bitmap,J,{x:0,y:0},{x:de.x+1,y:de.y+1},he.bitmap)}}this.image=J,this.positions=P}}h.register("GlyphAtlas",Y);class Qe{constructor(S){this.tileID=new h.OverscaledTileID(S.tileID.overscaledZ,S.tileID.wrap,S.tileID.canonical.z,S.tileID.canonical.x,S.tileID.canonical.y),this.uid=S.uid,this.zoom=S.zoom,this.pixelRatio=S.pixelRatio,this.tileSize=S.tileSize,this.source=S.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=S.showCollisionBoxes,this.collectResourceTiming=!!S.collectResourceTiming,this.returnDependencies=!!S.returnDependencies,this.promoteId=S.promoteId}parse(S,P,D,q,j){this.status="parsing",this.data=S,this.collisionBoxArray=new h.CollisionBoxArray;const J=new h.DictionaryCoder(Object.keys(S.layers).sort()),W=new h.FeatureIndex(this.tileID,this.promoteId);W.bucketLayerIDs=[];const Z={},ee={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:D},he=P.familiesBySource[this.source];for(const Je in he){const ot=S.layers[Je];if(!ot)continue;ot.version===1&&h.warnOnce(`Vector tile source "${this.source}" layer "${Je}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const vt=J.encode(Je),$t=[];for(let je=0;je=kt.maxzoom||kt.visibility!=="none"&&(ye(je,this.zoom,D),(Z[kt.id]=kt.createBucket({index:W.bucketLayerIDs.length,layers:je,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:vt,sourceID:this.source})).populate($t,ee,this.tileID.canonical),W.bucketLayerIDs.push(je.map(Fr=>Fr.id)))}}let de,ue,Ne,Ge;const Le=h.mapObject(ee.glyphDependencies,Je=>Object.keys(Je).map(Number));Object.keys(Le).length?q.send("getGlyphs",{uid:this.uid,stacks:Le,source:this.source,tileID:this.tileID,type:"glyphs"},(Je,ot)=>{de||(de=Je,ue=ot,st.call(this))}):ue={};const Oe=Object.keys(ee.iconDependencies);Oe.length?q.send("getImages",{icons:Oe,source:this.source,tileID:this.tileID,type:"icons"},(Je,ot)=>{de||(de=Je,Ne=ot,st.call(this))}):Ne={};const Ze=Object.keys(ee.patternDependencies);function st(){if(de)return j(de);if(ue&&Ne&&Ge){const Je=new Y(ue),ot=new h.ImageAtlas(Ne,Ge);for(const vt in Z){const $t=Z[vt];$t instanceof h.SymbolBucket?(ye($t.layers,this.zoom,D),h.performSymbolLayout({bucket:$t,glyphMap:ue,glyphPositions:Je.positions,imageMap:Ne,imagePositions:ot.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):$t.hasPattern&&($t instanceof h.LineBucket||$t instanceof h.FillBucket||$t instanceof h.FillExtrusionBucket)&&(ye($t.layers,this.zoom,D),$t.addFeatures(ee,this.tileID.canonical,ot.patternPositions))}this.status="done",j(null,{buckets:Object.values(Z).filter(vt=>!vt.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Je.image,imageAtlas:ot,glyphMap:this.returnDependencies?ue:null,iconMap:this.returnDependencies?Ne:null,glyphPositions:this.returnDependencies?Je.positions:null})}}Ze.length?q.send("getImages",{icons:Ze,source:this.source,tileID:this.tileID,type:"patterns"},(Je,ot)=>{de||(de=Je,Ge=ot,st.call(this))}):Ge={},st.call(this)}}function ye(V,S,P){const D=new h.EvaluationParameters(S);for(const q of V)q.recalculate(D,P)}function _t(V,S){const P=h.getArrayBuffer(V.request,(D,q,j,J)=>{D?S(D):q&&S(null,{vectorTile:new h.vectorTile.VectorTile(new h.Protobuf(q)),rawData:q,cacheControl:j,expires:J})});return()=>{P.cancel(),S()}}class Et{constructor(S,P,D,q){this.actor=S,this.layerIndex=P,this.availableImages=D,this.loadVectorData=q||_t,this.loading={},this.loaded={}}loadTile(S,P){const D=S.uid;this.loading||(this.loading={});const q=!!(S&&S.request&&S.request.collectResourceTiming)&&new h.RequestPerformance(S.request),j=this.loading[D]=new Qe(S);j.abort=this.loadVectorData(S,(J,W)=>{if(delete this.loading[D],J||!W)return j.status="done",this.loaded[D]=j,P(J);const Z=W.rawData,ee={};W.expires&&(ee.expires=W.expires),W.cacheControl&&(ee.cacheControl=W.cacheControl);const he={};if(q){const de=q.finish();de&&(he.resourceTiming=JSON.parse(JSON.stringify(de)))}j.vectorTile=W.vectorTile,j.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,(de,ue)=>{if(de||!ue)return P(de);P(null,h.extend({rawTileData:Z.slice(0)},ue,ee,he))}),this.loaded=this.loaded||{},this.loaded[D]=j})}reloadTile(S,P){const D=this.loaded,q=S.uid,j=this;if(D&&D[q]){const J=D[q];J.showCollisionBoxes=S.showCollisionBoxes;const W=(Z,ee)=>{const he=J.reloadCallback;he&&(delete J.reloadCallback,J.parse(J.vectorTile,j.layerIndex,this.availableImages,j.actor,he)),P(Z,ee)};J.status==="parsing"?J.reloadCallback=W:J.status==="done"&&(J.vectorTile?J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor,W):W())}}abortTile(S,P){const D=this.loading,q=S.uid;D&&D[q]&&D[q].abort&&(D[q].abort(),delete D[q]),P()}removeTile(S,P){const D=this.loaded,q=S.uid;D&&D[q]&&delete D[q],P()}}class it{constructor(){this.loaded={}}loadTile(S,P){const{uid:D,encoding:q,rawImageData:j}=S,J=h.isImageBitmap(j)?this.getImageData(j):j,W=new h.DEMData(D,J,q);this.loaded=this.loaded||{},this.loaded[D]=W,P(null,W)}getImageData(S){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(S.width,S.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=S.width,this.offscreenCanvas.height=S.height,this.offscreenCanvasContext.drawImage(S,0,0,S.width,S.height);const P=this.offscreenCanvasContext.getImageData(-1,-1,S.width+2,S.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new h.RGBAImage({width:P.width,height:P.height},P.data)}removeTile(S){const P=this.loaded,D=S.uid;P&&P[D]&&delete P[D]}}function At(V,S){if(V.length!==0){zt(V[0],S);for(var P=1;P=Math.abs(W)?P-Z+W:W-Z+P,P=Z}P+D>=0!=!!S&&V.reverse()}var nt=h.getDefaultExportFromCjs(function V(S,P){var D,q=S&&S.type;if(q==="FeatureCollection")for(D=0;D>31}function yr(V,S){for(var P=V.loadGeometry(),D=V.type,q=0,j=0,J=P.length,W=0;WV},Nn=Math.fround||(Dr=new Float32Array(1),V=>(Dr[0]=+V,Dr[0]));var Dr;const yi=3,qi=5,si=6;class _n{constructor(S){this.options=Object.assign(Object.create(gn),S),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(S){const{log:P,minZoom:D,maxZoom:q}=this.options;P&&console.time("total time");const j=`prepare ${S.length} points`;P&&console.time(j),this.points=S;const J=[];for(let Z=0;Z=D;Z--){const ee=+Date.now();W=this.trees[Z]=this._createTree(this._cluster(W,Z)),P&&console.log("z%d: %d clusters in %dms",Z,W.numItems,+Date.now()-ee)}return P&&console.timeEnd("total time"),this}getClusters(S,P){let D=((S[0]+180)%360+360)%360-180;const q=Math.max(-90,Math.min(90,S[1]));let j=S[2]===180?180:((S[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,S[3]));if(S[2]-S[0]>=360)D=-180,j=180;else if(D>j){const de=this.getClusters([D,q,180,J],P),ue=this.getClusters([-180,q,j,J],P);return de.concat(ue)}const W=this.trees[this._limitZoom(P)],Z=W.range(Lr(D),xr(J),Lr(j),xr(q)),ee=W.data,he=[];for(const de of Z){const ue=this.stride*de;he.push(ee[ue+qi]>1?yn(ee,ue,this.clusterProps):this.points[ee[ue+yi]])}return he}getChildren(S){const P=this._getOriginId(S),D=this._getOriginZoom(S),q="No cluster with the specified id.",j=this.trees[D];if(!j)throw new Error(q);const J=j.data;if(P*this.stride>=J.length)throw new Error(q);const W=this.options.radius/(this.options.extent*Math.pow(2,D-1)),Z=j.within(J[P*this.stride],J[P*this.stride+1],W),ee=[];for(const he of Z){const de=he*this.stride;J[de+4]===S&&ee.push(J[de+qi]>1?yn(J,de,this.clusterProps):this.points[J[de+yi]])}if(ee.length===0)throw new Error(q);return ee}getLeaves(S,P,D){const q=[];return this._appendLeaves(q,S,P=P||10,D=D||0,0),q}getTile(S,P,D){const q=this.trees[this._limitZoom(S)],j=Math.pow(2,S),{extent:J,radius:W}=this.options,Z=W/J,ee=(D-Z)/j,he=(D+1+Z)/j,de={features:[]};return this._addTileFeatures(q.range((P-Z)/j,ee,(P+1+Z)/j,he),q.data,P,D,j,de),P===0&&this._addTileFeatures(q.range(1-Z/j,ee,1,he),q.data,j,D,j,de),P===j-1&&this._addTileFeatures(q.range(0,ee,Z/j,he),q.data,-1,D,j,de),de.features.length?de:null}getClusterExpansionZoom(S){let P=this._getOriginZoom(S)-1;for(;P<=this.options.maxZoom;){const D=this.getChildren(S);if(P++,D.length!==1)break;S=D[0].properties.cluster_id}return P}_appendLeaves(S,P,D,q,j){const J=this.getChildren(P);for(const W of J){const Z=W.properties;if(Z&&Z.cluster?j+Z.point_count<=q?j+=Z.point_count:j=this._appendLeaves(S,Z.cluster_id,D,q,j):j1;let he,de,ue;if(ee)he=Hr(P,Z,this.clusterProps),de=P[Z],ue=P[Z+1];else{const Le=this.points[P[Z+yi]];he=Le.properties;const[Oe,Ze]=Le.geometry.coordinates;de=Lr(Oe),ue=xr(Ze)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(de*j-D)),Math.round(this.options.extent*(ue*j-q))]],tags:he};let Ge;Ge=ee||this.options.generateId?P[Z+yi]:this.points[P[Z+yi]].id,Ge!==void 0&&(Ne.id=Ge),J.features.push(Ne)}}_limitZoom(S){return Math.max(this.options.minZoom,Math.min(Math.floor(+S),this.options.maxZoom+1))}_cluster(S,P){const{radius:D,extent:q,reduce:j,minPoints:J}=this.options,W=D/(q*Math.pow(2,P)),Z=S.data,ee=[],he=this.stride;for(let de=0;deP&&(Oe+=Z[st+qi])}if(Oe>Le&&Oe>=J){let Ze,st=ue*Le,Je=Ne*Le,ot=-1;const vt=((de/he|0)<<5)+(P+1)+this.points.length;for(const $t of Ge){const je=$t*he;if(Z[je+2]<=P)continue;Z[je+2]=P;const kt=Z[je+qi];st+=Z[je]*kt,Je+=Z[je+1]*kt,Z[je+4]=vt,j&&(Ze||(Ze=this._map(Z,de,!0),ot=this.clusterProps.length,this.clusterProps.push(Ze)),j(Ze,this._map(Z,je)))}Z[de+4]=vt,ee.push(st/Oe,Je/Oe,1/0,vt,-1,Oe),j&&ee.push(ot)}else{for(let Ze=0;Ze1)for(const Ze of Ge){const st=Ze*he;if(!(Z[st+2]<=P)){Z[st+2]=P;for(let Je=0;Je>5}_getOriginZoom(S){return(S-this.points.length)%32}_map(S,P,D){if(S[P+qi]>1){const J=this.clusterProps[S[P+si]];return D?Object.assign({},J):J}const q=this.points[S[P+yi]].properties,j=this.options.map(q);return D&&j===q?Object.assign({},j):j}}function yn(V,S,P){return{type:"Feature",id:V[S+yi],properties:Hr(V,S,P),geometry:{type:"Point",coordinates:[(D=V[S],360*(D-.5)),vr(V[S+1])]}};var D}function Hr(V,S,P){const D=V[S+qi],q=D>=1e4?`${Math.round(D/1e3)}k`:D>=1e3?Math.round(D/100)/10+"k":D,j=V[S+si],J=j===-1?{}:Object.assign({},P[j]);return Object.assign(J,{cluster:!0,cluster_id:V[S+yi],point_count:D,point_count_abbreviated:q})}function Lr(V){return V/360+.5}function xr(V){const S=Math.sin(V*Math.PI/180),P=.5-.25*Math.log((1+S)/(1-S))/Math.PI;return P<0?0:P>1?1:P}function vr(V){const S=(180-360*V)*Math.PI/180;return 360*Math.atan(Math.exp(S))/Math.PI-90}function ji(V,S,P,D){for(var q,j=D,J=P-S>>1,W=P-S,Z=V[S],ee=V[S+1],he=V[P],de=V[P+1],ue=S+3;uej)q=ue,j=Ne;else if(Ne===j){var Ge=Math.abs(ue-J);GeD&&(q-S>3&&ji(V,S,q,D),V[q+2]=j,P-q>3&&ji(V,q,P,D))}function xn(V,S,P,D,q,j){var J=q-P,W=j-D;if(J!==0||W!==0){var Z=((V-P)*J+(S-D)*W)/(J*J+W*W);Z>1?(P=q,D=j):Z>0&&(P+=J*Z,D+=W*Z)}return(J=V-P)*J+(W=S-D)*W}function le(V,S,P,D){var q={id:V===void 0?null:V,type:S,geometry:P,tags:D,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(j){var J=j.geometry,W=j.type;if(W==="Point"||W==="MultiPoint"||W==="LineString")Br(j,J);else if(W==="Polygon"||W==="MultiLineString")for(var Z=0;Z0&&(J+=D?(q*ee-Z*j)/2:Math.sqrt(Math.pow(Z-q,2)+Math.pow(ee-j,2))),q=Z,j=ee}var he=S.length-3;S[2]=1,ji(S,0,he,P),S[he+2]=1,S.size=Math.abs(J),S.start=0,S.end=S.size}function Kr(V,S,P,D){for(var q=0;q1?1:P}function Nt(V,S,P,D,q,j,J,W){if(D/=S,j>=(P/=S)&&J=D)return null;for(var Z=[],ee=0;ee=P&&Ge=D)){var Le=[];if(ue==="Point"||ue==="MultiPoint")Yr(de,Le,P,D,q);else if(ue==="LineString")vn(de,Le,P,D,q,!1,W.lineMetrics);else if(ue==="MultiLineString")be(de,Le,P,D,q,!1);else if(ue==="Polygon")be(de,Le,P,D,q,!0);else if(ue==="MultiPolygon")for(var Oe=0;Oe=P&&J<=D&&(S.push(V[j]),S.push(V[j+1]),S.push(V[j+2]))}}function vn(V,S,P,D,q,j,J){for(var W,Z,ee=Jr(V),he=q===0?hi:bn,de=V.start,ue=0;ueP&&(Z=he(ee,Ne,Ge,Oe,Ze,P),J&&(ee.start=de+W*Z)):st>D?Je=P&&(Z=he(ee,Ne,Ge,Oe,Ze,P),ot=!0),Je>D&&st<=D&&(Z=he(ee,Ne,Ge,Oe,Ze,D),ot=!0),!j&&ot&&(J&&(ee.end=de+W*Z),S.push(ee),ee=Jr(V)),J&&(de+=W)}var vt=V.length-3;Ne=V[vt],Ge=V[vt+1],Le=V[vt+2],(st=q===0?Ne:Ge)>=P&&st<=D&&ar(ee,Ne,Ge,Le),vt=ee.length-3,j&&vt>=3&&(ee[vt]!==ee[0]||ee[vt+1]!==ee[1])&&ar(ee,ee[0],ee[1],ee[2]),ee.length&&S.push(ee)}function Jr(V){var S=[];return S.size=V.size,S.start=V.start,S.end=V.end,S}function be(V,S,P,D,q,j){for(var J=0;JJ.maxX&&(J.maxX=he),de>J.maxY&&(J.maxY=de)}return J}function Ht(V,S,P,D){var q=S.geometry,j=S.type,J=[];if(j==="Point"||j==="MultiPoint")for(var W=0;W0&&S.size<(q?J:D))P.numPoints+=S.length/3;else{for(var W=[],Z=0;ZJ)&&(P.numSimplified++,W.push(S[Z]),W.push(S[Z+1])),P.numPoints++;q&&function(ee,he){for(var de=0,ue=0,Ne=ee.length,Ge=Ne-2;ue0===he)for(ue=0,Ne=ee.length;ue24)throw new Error("maxZoom should be in the 0-24 range");if(S.promoteId&&S.generateId)throw new Error("promoteId and generateId cannot be used together.");var D=function(q,j){var J=[];if(q.type==="FeatureCollection")for(var W=0;W1&&console.time("creation"),ue=this.tiles[de]=Si(V,S,P,D,Z),this.tileCoords.push({z:S,x:P,y:D}),ee)){ee>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",S,P,D,ue.numFeatures,ue.numPoints,ue.numSimplified),console.timeEnd("creation"));var Ne="z"+S;this.stats[Ne]=(this.stats[Ne]||0)+1,this.total++}if(ue.source=V,q){if(S===Z.maxZoom||S===q)continue;var Ge=1<1&&console.time("clipping");var Le,Oe,Ze,st,Je,ot,vt=.5*Z.buffer/Z.extent,$t=.5-vt,je=.5+vt,kt=1+vt;Le=Oe=Ze=st=null,Je=Nt(V,he,P-vt,P+je,0,ue.minX,ue.maxX,Z),ot=Nt(V,he,P+$t,P+kt,0,ue.minX,ue.maxX,Z),V=null,Je&&(Le=Nt(Je,he,D-vt,D+je,1,ue.minY,ue.maxY,Z),Oe=Nt(Je,he,D+$t,D+kt,1,ue.minY,ue.maxY,Z),Je=null),ot&&(Ze=Nt(ot,he,D-vt,D+je,1,ue.minY,ue.maxY,Z),st=Nt(ot,he,D+$t,D+kt,1,ue.minY,ue.maxY,Z),ot=null),ee>1&&console.timeEnd("clipping"),W.push(Le||[],S+1,2*P,2*D),W.push(Oe||[],S+1,2*P,2*D+1),W.push(Ze||[],S+1,2*P+1,2*D),W.push(st||[],S+1,2*P+1,2*D+1)}}},br.prototype.getTile=function(V,S,P){var D=this.options,q=D.extent,j=D.debug;if(V<0||V>24)return null;var J=1<1&&console.log("drilling down to z%d-%d-%d",V,S,P);for(var Z,ee=V,he=S,de=P;!Z&&ee>0;)ee--,he=Math.floor(he/2),de=Math.floor(de/2),Z=this.tiles[wr(ee,he,de)];return Z&&Z.source?(j>1&&console.log("found parent tile z%d-%d-%d",ee,he,de),j>1&&console.time("drilling down"),this.splitTile(Z.source,ee,he,de,V,S,P),j>1&&console.timeEnd("drilling down"),this.tiles[W]?Ye(this.tiles[W],q):null):null};class jn extends Et{constructor(S,P,D,q){super(S,P,D,wt),this._dataUpdateable=new Map,this.loadGeoJSON=(j,J)=>{const{promoteId:W}=j;if(j.request)return h.getJSON(j.request,(Z,ee,he,de)=>{this._dataUpdateable=Tr(ee,W)?ai(ee,W):void 0,J(Z,ee,he,de)});if(typeof j.data=="string")try{const Z=JSON.parse(j.data);this._dataUpdateable=Tr(Z,W)?ai(Z,W):void 0,J(null,Z)}catch{J(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`))}else j.dataDiff?this._dataUpdateable?(function(Z,ee,he){var de,ue,Ne,Ge;if(ee.removeAll&&Z.clear(),ee.remove)for(const Le of ee.remove)Z.delete(Le);if(ee.add)for(const Le of ee.add){const Oe=Yi(Le,he);Oe!=null&&Z.set(Oe,Le)}if(ee.update)for(const Le of ee.update){let Oe=Z.get(Le.id);if(Oe==null)continue;const Ze=!Le.removeAllProperties&&(((de=Le.removeProperties)===null||de===void 0?void 0:de.length)>0||((ue=Le.addOrUpdateProperties)===null||ue===void 0?void 0:ue.length)>0);if((Le.newGeometry||Le.removeAllProperties||Ze)&&(Oe={...Oe},Z.set(Le.id,Oe),Ze&&(Oe.properties={...Oe.properties})),Le.newGeometry&&(Oe.geometry=Le.newGeometry),Le.removeAllProperties)Oe.properties={};else if(((Ne=Le.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0)for(const st of Le.removeProperties)Object.prototype.hasOwnProperty.call(Oe.properties,st)&&delete Oe.properties[st];if(((Ge=Le.addOrUpdateProperties)===null||Ge===void 0?void 0:Ge.length)>0)for(const{key:st,value:Je}of Le.addOrUpdateProperties)Oe.properties[st]=Je}}(this._dataUpdateable,j.dataDiff,W),J(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):J(new Error(`Cannot update existing geojson data in ${j.source}`)):J(new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},q&&(this.loadGeoJSON=q)}loadData(S,P){var D;(D=this._pendingRequest)===null||D===void 0||D.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const q=!!(S&&S.request&&S.request.collectResourceTiming)&&new h.RequestPerformance(S.request);this._pendingCallback=P,this._pendingRequest=this.loadGeoJSON(S,(j,J)=>{if(delete this._pendingCallback,delete this._pendingRequest,j||!J)return P(j);if(typeof J!="object")return P(new Error(`Input data given to '${S.source}' is not a valid GeoJSON object.`));{nt(J,!0);try{if(S.filter){const Z=h.createExpression(S.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Z.result==="error")throw new Error(Z.value.map(he=>`${he.key}: ${he.message}`).join(", "));J={type:"FeatureCollection",features:J.features.filter(he=>Z.value.evaluate({zoom:0},he))}}this._geoJSONIndex=S.cluster?new _n(function({superclusterOptions:Z,clusterProperties:ee}){if(!ee||!Z)return Z;const he={},de={},ue={accumulated:null,zoom:0},Ne={properties:null},Ge=Object.keys(ee);for(const Le of Ge){const[Oe,Ze]=ee[Le],st=h.createExpression(Ze),Je=h.createExpression(typeof Oe=="string"?[Oe,["accumulated"],["get",Le]]:Oe);he[Le]=st.value,de[Le]=Je.value}return Z.map=Le=>{Ne.properties=Le;const Oe={};for(const Ze of Ge)Oe[Ze]=he[Ze].evaluate(ue,Ne);return Oe},Z.reduce=(Le,Oe)=>{Ne.properties=Oe;for(const Ze of Ge)ue.accumulated=Le[Ze],Le[Ze]=de[Ze].evaluate(ue,Ne)},Z}(S)).load(J.features):function(Z,ee){return new br(Z,ee)}(J,S.geojsonVtOptions)}catch(Z){return P(Z)}this.loaded={};const W={};if(q){const Z=q.finish();Z&&(W.resourceTiming={},W.resourceTiming[S.source]=JSON.parse(JSON.stringify(Z)))}P(null,W)}})}reloadTile(S,P){const D=this.loaded;return D&&D[S.uid]?super.reloadTile(S,P):this.loadTile(S,P)}removeSource(S,P){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),P()}getClusterExpansionZoom(S,P){try{P(null,this._geoJSONIndex.getClusterExpansionZoom(S.clusterId))}catch(D){P(D)}}getClusterChildren(S,P){try{P(null,this._geoJSONIndex.getChildren(S.clusterId))}catch(D){P(D)}}getClusterLeaves(S,P){try{P(null,this._geoJSONIndex.getLeaves(S.clusterId,S.limit,S.offset))}catch(D){P(D)}}}class or{constructor(S){this.self=S,this.actor=new h.Actor(S,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Et,geojson:jn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(P,D)=>{if(this.workerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.workerSourceTypes[P]=D},this.self.registerRTLTextPlugin=P=>{if(h.plugin.isParsed())throw new Error("RTL text plugin already registered.");h.plugin.applyArabicShaping=P.applyArabicShaping,h.plugin.processBidirectionalText=P.processBidirectionalText,h.plugin.processStyledBidirectionalText=P.processStyledBidirectionalText}}setReferrer(S,P){this.referrer=P}setImages(S,P,D){this.availableImages[S]=P;for(const q in this.workerSources[S]){const j=this.workerSources[S][q];for(const J in j)j[J].availableImages=P}D()}setLayers(S,P,D){this.getLayerIndex(S).replace(P),D()}updateLayers(S,P,D){this.getLayerIndex(S).update(P.layers,P.removedIds),D()}loadTile(S,P,D){this.getWorkerSource(S,P.type,P.source).loadTile(P,D)}loadDEMTile(S,P,D){this.getDEMWorkerSource(S,P.source).loadTile(P,D)}reloadTile(S,P,D){this.getWorkerSource(S,P.type,P.source).reloadTile(P,D)}abortTile(S,P,D){this.getWorkerSource(S,P.type,P.source).abortTile(P,D)}removeTile(S,P,D){this.getWorkerSource(S,P.type,P.source).removeTile(P,D)}removeDEMTile(S,P){this.getDEMWorkerSource(S,P.source).removeTile(P)}removeSource(S,P,D){if(!this.workerSources[S]||!this.workerSources[S][P.type]||!this.workerSources[S][P.type][P.source])return;const q=this.workerSources[S][P.type][P.source];delete this.workerSources[S][P.type][P.source],q.removeSource!==void 0?q.removeSource(P,D):D()}loadWorkerSource(S,P,D){try{this.self.importScripts(P.url),D()}catch(q){D(q.toString())}}syncRTLPluginState(S,P,D){try{h.plugin.setState(P);const q=h.plugin.getPluginURL();if(h.plugin.isLoaded()&&!h.plugin.isParsed()&&q!=null){this.self.importScripts(q);const j=h.plugin.isParsed();D(j?void 0:new Error(`RTL Text Plugin failed to import scripts from ${q}`),j)}}catch(q){D(q.toString())}}getAvailableImages(S){let P=this.availableImages[S];return P||(P=[]),P}getLayerIndex(S){let P=this.layerIndexes[S];return P||(P=this.layerIndexes[S]=new _e),P}getWorkerSource(S,P,D){if(this.workerSources[S]||(this.workerSources[S]={}),this.workerSources[S][P]||(this.workerSources[S][P]={}),!this.workerSources[S][P][D]){const q={send:(j,J,W)=>{this.actor.send(j,J,W,S)}};this.workerSources[S][P][D]=new this.workerSourceTypes[P](q,this.getLayerIndex(S),this.getAvailableImages(S))}return this.workerSources[S][P][D]}getDEMWorkerSource(S,P){return this.demWorkerSources[S]||(this.demWorkerSources[S]={}),this.demWorkerSources[S][P]||(this.demWorkerSources[S][P]=new it),this.demWorkerSources[S][P]}}return h.isWorker()&&(self.worker=new or(self)),or}),oe(["./shared"],function(h){var _e="3.1.0";class Y{static testProp(t){if(!Y.docStyle)return t[0];for(let n=0;n{window.removeEventListener("click",Y.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new h.Point(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),c=[];for(let p=0;p{t=[],n=0,a=0,c={}},o.addThrottleControl=x=>{const T=a++;return c[T]=x,T},o.removeThrottleControl=x=>{delete c[x],y()},o.getImage=(x,T,w=!0)=>{Qe.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*");const z={requestParameters:x,supportImageRefresh:w,callback:T,cancelled:!1,completed:!1,cancel:()=>{z.completed||z.cancelled||(z.cancelled=!0,z.innerRequest&&(z.innerRequest.cancel(),n--),y())}};return t.push(z),y(),z};const p=x=>{const{requestParameters:T,supportImageRefresh:w,callback:z}=x;return h.extend(T,{type:"image"}),(w!==!1||h.isWorker()||h.getProtocolAction(T.url)||T.headers&&!Object.keys(T.headers).reduce((O,L)=>O&&L==="accept",!0)?h.makeRequest:_)(T,(O,L,R,$)=>{m(x,z,O,L,R,$)})},m=(x,T,w,z,O,L)=>{w?T(w):z instanceof HTMLImageElement||z instanceof ImageBitmap?T(null,z):z&&((R,$)=>{typeof createImageBitmap=="function"?h.arrayBufferToImageBitmap(R,$):h.arrayBufferToImage(R,$)})(z,(R,$)=>{R!=null?T(R):$!=null&&T(null,$,{cacheControl:O,expires:L})}),x.cancelled||(x.completed=!0,n--,y())},y=()=>{const x=(()=>{const T=Object.keys(c);let w=!1;if(T.length>0){for(const z of T)if(w=c[z](),w)break}return w})()?h.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:h.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let T=n;T0;T++){const w=t.shift();if(w.cancelled){T--;continue}const z=p(w);n++,w.innerRequest=z}},_=(x,T)=>{const w=new Image,z=x.url;let O=!1;const L=x.credentials;return L&&L==="include"?w.crossOrigin="use-credentials":(L&&L==="same-origin"||!h.sameOrigin(z))&&(w.crossOrigin="anonymous"),w.fetchPriority="high",w.onload=()=>{T(null,w),w.onerror=w.onload=null},w.onerror=()=>{O||T(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),w.onerror=w.onload=null},w.src=z,{cancel:()=>{O=!0,w.src=""}}}}(zt||(zt={})),zt.resetRequestQueue();var nt,Qt=zt;(function(o){o.Glyphs="Glyphs",o.Image="Image",o.Source="Source",o.SpriteImage="SpriteImage",o.SpriteJSON="SpriteJSON",o.Style="Style",o.Tile="Tile",o.Unknown="Unknown"})(nt||(nt={}));class mt{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,a){const c=function(p){const m=p.match(_i);if(!m)throw new Error(`Unable to parse URL "${p}"`);return{protocol:m[1],authority:m[2],path:m[3]||"/",params:m[4]?m[4].split("&"):[]}}(t);return c.path+=`${n}${a}`,function(p){const m=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${m}`}(c)}setTransformRequest(t){this._transformRequestFn=t}}const _i=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Wt(o){var t=new h.ARRAY_TYPE(3);return t[0]=o[0],t[1]=o[1],t[2]=o[2],t}var sr,fn=function(o,t,n){return o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],o};sr=new h.ARRAY_TYPE(3),h.ARRAY_TYPE!=Float32Array&&(sr[0]=0,sr[1]=0,sr[2]=0);var Ei=function(o){var t=o[0],n=o[1];return t*t+n*n};function Gr(o){const t=[];if(typeof o=="string")t.push({id:"default",url:o});else if(o&&o.length>0){const n=[];for(const{id:a,url:c}of o){const p=`${a}${c}`;n.indexOf(p)===-1&&(n.push(p),t.push({id:a,url:c}))}}return t}function ci(o,t,n,a,c){if(a)return void o(a);if(c!==Object.values(t).length||c!==Object.values(n).length)return;const p={};for(const m in t){p[m]={};const y=h.exported.getImageCanvasContext(n[m]),_=t[m];for(const x in _){const{width:T,height:w,x:z,y:O,sdf:L,pixelRatio:R,stretchX:$,stretchY:H,content:re}=_[x];p[m][x]={data:null,pixelRatio:R,sdf:L,stretchX:$,stretchY:H,content:re,spriteData:{width:T,height:w,x:z,y:O,context:y}}}}o(null,p)}(function(){var o=new h.ARRAY_TYPE(2);h.ARRAY_TYPE!=Float32Array&&(o[0]=0,o[1]=0)})();class gt{constructor(t,n,a,c){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(n,c)}update(t,n,a){const{width:c,height:p}=t,m=!(this.size&&this.size[0]===c&&this.size[1]===p||a),{context:y}=this,{gl:_}=y;if(this.useMipmap=!!(n&&n.useMipmap),_.bindTexture(_.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.pixelStoreUnpackPremultiplyAlpha.set(this.format===_.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[c,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||h.isImageBitmap(t)?_.texImage2D(_.TEXTURE_2D,0,this.format,this.format,_.UNSIGNED_BYTE,t):_.texImage2D(_.TEXTURE_2D,0,this.format,c,p,0,this.format,_.UNSIGNED_BYTE,t.data);else{const{x,y:T}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||h.isImageBitmap(t)?_.texSubImage2D(_.TEXTURE_2D,0,x,T,_.RGBA,_.UNSIGNED_BYTE,t):_.texSubImage2D(_.TEXTURE_2D,0,x,T,c,p,_.RGBA,_.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&_.generateMipmap(_.TEXTURE_2D)}bind(t,n,a){const{context:c}=this,{gl:p}=c;p.bindTexture(p.TEXTURE_2D,this.texture),a!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,a||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,n),this.wrap=n)}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 ga(o){const{userImage:t}=o;return!!(t&&t.render&&t.render())&&(o.data.replace(new Uint8Array(t.data.buffer)),!0)}class $i extends h.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new h.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:a}of this.requestors)this._notify(n,a);this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new h.RGBAImage({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c&&c.width)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,c&&c.height)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const c of t){if(c[0]-1);_++,p[_]=y,m[_]=x,m[_+1]=_r}for(let y=0,_=0;y{let y=this.entries[c];y||(y=this.entries[c]={glyphs:{},requests:{},ranges:{}});let _=y.glyphs[p];if(_!==void 0)return void m(null,{stack:c,id:p,glyph:_});if(_=this._tinySDF(y,c,p),_)return y.glyphs[p]=_,void m(null,{stack:c,id:p,glyph:_});const x=Math.floor(p/256);if(256*x>65535)return void m(new Error("glyphs > 65535 not supported"));if(y.ranges[x])return void m(null,{stack:c,id:p,glyph:_});if(!this.url)return void m(new Error("glyphsUrl is not set"));let T=y.requests[x];T||(T=y.requests[x]=[],yr.loadGlyphRange(c,x,this.url,this.requestManager,(w,z)=>{if(z){for(const O in z)this._doesCharSupportLocalGlyph(+O)||(y.glyphs[+O]=z[+O]);y.ranges[x]=!0}for(const O of T)O(w,z);delete y.requests[x]})),T.push((w,z)=>{w?m(w):z&&m(null,{stack:c,id:p,glyph:z[p]||null})})},(c,p)=>{if(c)n(c);else if(p){const m={};for(const{stack:y,id:_,glyph:x}of p)(m[y]||(m[y]={}))[_]=x&&{id:x.id,bitmap:x.bitmap.clone(),metrics:x.metrics};n(null,m)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(h.unicodeBlockLookup["CJK Unified Ideographs"](t)||h.unicodeBlockLookup["Hangul Syllables"](t)||h.unicodeBlockLookup.Hiragana(t)||h.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const c=this.localIdeographFontFamily;if(!c||!this._doesCharSupportLocalGlyph(a))return;let p=t.tinySDF;if(!p){let y="400";/bold/i.test(n)?y="900":/medium/i.test(n)?y="500":/light/i.test(n)&&(y="200"),p=t.tinySDF=new yr.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:c,fontWeight:y})}const m=p.draw(String.fromCharCode(a));return{id:a,bitmap:new h.AlphaImage({width:m.width||30,height:m.height||30},m.data),metrics:{width:m.glyphWidth||24,height:m.glyphHeight||24,left:m.glyphLeft||0,top:m.glyphTop-27||-8,advance:m.glyphAdvance||24}}}}yr.loadGlyphRange=function(o,t,n,a,c){const p=256*t,m=p+255,y=a.transformRequest(n.replace("{fontstack}",o).replace("{range}",`${p}-${m}`),nt.Glyphs);h.getArrayBuffer(y,(_,x)=>{if(_)c(_);else if(x){const T={};for(const w of h.parseGlyphPbf(x))T[w.id]=w;c(null,T)}})},yr.TinySDF=class{constructor({fontSize:o=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:c="sans-serif",fontWeight:p="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const y=this.size=o+4*t,_=this._createCanvas(y),x=this.ctx=_.getContext("2d",{willReadFrequently:!0});x.font=`${m} ${p} ${o}px ${c}`,x.textBaseline="alphabetic",x.textAlign="left",x.fillStyle="black",this.gridOuter=new Float64Array(y*y),this.gridInner=new Float64Array(y*y),this.f=new Float64Array(y),this.z=new Float64Array(y+1),this.v=new Uint16Array(y)}_createCanvas(o){const t=document.createElement("canvas");return t.width=t.height=o,t}draw(o){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:c,actualBoundingBoxRight:p}=this.ctx.measureText(o),m=Math.ceil(n),y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-c))),_=Math.min(this.size-this.buffer,m+Math.ceil(a)),x=y+2*this.buffer,T=_+2*this.buffer,w=Math.max(x*T,0),z=new Uint8ClampedArray(w),O={data:z,width:x,height:T,glyphWidth:y,glyphHeight:_,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(y===0||_===0)return O;const{ctx:L,buffer:R,gridInner:$,gridOuter:H}=this;L.clearRect(R,R,y,_),L.fillText(o,R,R+m);const re=L.getImageData(R,R,y,_);H.fill(_r,0,w),$.fill(0,0,w);for(let N=0;N<_;N++)for(let te=0;te0?me*me:0,$[pe]=me<0?me*me:0}}kr(H,0,0,x,T,x,this.f,this.v,this.z),kr($,R,R,y,_,x,this.f,this.v,this.z);for(let N=0;N1&&(_=t[++y]);const T=Math.abs(x-_.left),w=Math.abs(x-_.right),z=Math.min(T,w);let O;const L=p/a*(c+1);if(_.isDash){const R=c-Math.abs(L);O=Math.sqrt(z*z+R*R)}else O=c-Math.sqrt(z*z+L*L);this.data[m+x]=Math.max(0,Math.min(255,O+128))}}}addRegularDash(t){for(let y=t.length-1;y>=0;--y){const _=t[y],x=t[y+1];_.zeroLength?t.splice(y,1):x&&x.isDash===_.isDash&&(x.left=_.left,t.splice(y,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const c=this.width*this.nextRow;let p=0,m=t[p];for(let y=0;y1&&(m=t[++p]);const _=Math.abs(y-m.left),x=Math.abs(y-m.right),T=Math.min(_,x);this.data[c+y]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(t,n){const a=n?7:0,c=2*a+1;if(this.nextRow+c>this.height)return h.warnOnce("LineAtlas out of space"),null;let p=0;for(let y=0;y{c.send(t,n,p)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function qi(o,t,n){const a=function(c,p){if(c)return n(c);if(p){const m=h.pick(h.extend(p,o),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(m.vectorLayers=p.vector_layers,m.vectorLayerIds=m.vectorLayers.map(y=>y.id)),n(null,m)}};return o.url?h.getJSON(t.transformRequest(o.url,nt.Source),a):h.exported.frame(()=>a(null,o))}yi.Actor=h.Actor;class si{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?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 h.LngLat?new h.LngLat(t.lng,t.lat):h.LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof h.LngLat?new h.LngLat(t.lng,t.lat):h.LngLat.convert(t),this}extend(t){const n=this._sw,a=this._ne;let c,p;if(t instanceof h.LngLat)c=t,p=t;else{if(!(t instanceof si))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(si.convert(t)):this.extend(h.LngLat.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(h.LngLat.convert(t)):this;if(c=t._sw,p=t._ne,!c||!p)return this}return n||a?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),a.lng=Math.max(p.lng,a.lng),a.lat=Math.max(p.lat,a.lat)):(this._sw=new h.LngLat(c.lng,c.lat),this._ne=new h.LngLat(p.lng,p.lat)),this}getCenter(){return new h.LngLat((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 h.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new h.LngLat(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:n,lat:a}=h.LngLat.convert(t);let c=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&c}static convert(t){return t instanceof si?t:t&&new si(t)}static fromLngLat(t,n=0){const a=360*n/40075017,c=a/Math.cos(Math.PI/180*t.lat);return new si(new h.LngLat(t.lng-c,t.lat-a),new h.LngLat(t.lng+c,t.lat+a))}}class _n{constructor(t,n,a){this.bounds=si.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[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 n=Math.pow(2,t.z),a=Math.floor(h.mercatorXfromLng(this.bounds.getWest())*n),c=Math.floor(h.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(h.mercatorXfromLng(this.bounds.getEast())*n),m=Math.ceil(h.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x=c&&t.y{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new h.ErrorEvent(t)):n&&(h.extend(this,n),n.bounds&&(this.tileBounds=new _n(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),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}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return h.extend({},this._options)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c={request:this.map._requestManager.transformRequest(a,nt.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function p(m,y){return delete t.request,t.aborted?n(null):m&&m.status!==404?n(m):(y&&y.resourceTiming&&(t.resourceTiming=y.resourceTiming),this.map._refreshExpiredTiles&&y&&t.setExpiryData(y),t.loadVectorData(y,this.map.painter),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}c.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",c,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",c,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Hr extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.setEventedParent(c),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=h.extend({type:"raster"},n),h.extend(this,h.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=qi(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new h.ErrorEvent(t)):n&&(h.extend(this,n),n.bounds&&(this.tileBounds=new _n(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return h.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=Qt.getImage(this.map._requestManager.transformRequest(a,nt.Tile),(c,p,m)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(c)t.state="errored",n(c);else if(p){this.map._refreshExpiredTiles&&m&&t.setExpiryData(m);const y=this.map.painter.context,_=y.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new gt(y,p,_.RGBA,{useMipmap:!0}),t.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST),y.extTextureFilterAnisotropic&&_.texParameterf(_.TEXTURE_2D,y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,y.extTextureFilterAnisotropicMax)),t.state="loaded",n(null)}},this.map._refreshExpiredTiles)}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}class Lr extends Hr{constructor(t,n,a,c){super(t,n,a,c),this.type="raster-dem",this.maxzoom=22,this._options=h.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function c(p,m){p&&(t.state="errored",n(p)),m&&(t.dem=m,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=Qt.getImage(this.map._requestManager.transformRequest(a,nt.Tile),function(p,m){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(p)t.state="errored",n(p);else if(m){this.map._refreshExpiredTiles&&t.setExpiryData(m),delete m.cacheControl,delete m.expires;const y=h.isImageBitmap(m)&&(gn==null&&(gn=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),gn)?m:h.exported.getImageData(m,1),_={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:y,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",_,c.bind(this)))}}.bind(this),this.map._refreshExpiredTiles),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),c=(n.x-1+a)%a,p=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+a)%a,y=n.x+1===a?t.wrap+1:t.wrap,_={};return _[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,y,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(_[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y-1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,y,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1{if(this._pendingLoads--,this._removed||c&&c.abandoned)return void this.fire(new h.Event("dataabort",{dataType:"source"}));let p=null;if(c&&c.resourceTiming&&c.resourceTiming[this.id]&&(p=c.resourceTiming[this.id].slice(0)),a)return void this.fire(new h.ErrorEvent(a));const m={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&h.extend(m,{resourceTiming:p}),this.fire(new h.Event("data",{...m,sourceDataType:"metadata"})),this.fire(new h.Event("data",{...m,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const a=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const c={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.request=this.actor.send(a,c,(p,m)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(m,this.map.painter,a==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return h.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var vr=h.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ji extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(c),this.options=n}load(t,n){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=Qt.getImage(this.map._requestManager.transformRequest(this.url,nt.Image),(a,c)=>{this._request=null,this._loaded=!0,a?this.fire(new h.ErrorEvent(a)):c&&(this.image=c,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(h.MercatorCoordinate.fromLngLat);this.tileID=function(c){let p=1/0,m=1/0,y=-1/0,_=-1/0;for(const z of c)p=Math.min(p,z.x),m=Math.min(m,z.y),y=Math.max(y,z.x),_=Math.max(_,z.y);const x=Math.max(y-p,_-m),T=Math.max(0,Math.floor(-Math.log(x)/Math.LN2)),w=Math.pow(2,T);return new h.CanonicalTileID(T,Math.floor((p+y)/2*w),Math.floor((m+_)/2*w))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(c=>this.tileID.getTilePoint(c)._round());return this._boundsArray=new h.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,h.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,h.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,h.EXTENT,h.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,vr.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new gt(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,a=!0)}a&&this.fire(new h.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class xn extends ji{constructor(t,n,a,c){super(t,n,a,c),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,nt.Source).url);h.getVideo(this.urls,(n,a)=>{this._loaded=!0,n?this.fire(new h.ErrorEvent(n)):a&&(this.video=a,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;tn.end(0)?this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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 t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,vr.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new gt(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,a=!0)}a&&this.fire(new h.Event("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 le extends ji{constructor(t,n,a,c){super(t,n,a,c),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(m=>typeof m!="number"))||this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new h.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(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()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,a=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,vr.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new gt(n,this.canvas,a.RGBA,{premultiply:!0});let c=!1;for(const p in this.tiles){const m=this.tiles[p];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,c=!0)}c&&this.fire(new h.Event("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 Br={vector:yn,raster:Hr,"raster-dem":Lr,geojson:xr,video:xn,image:ji,canvas:le};function $n(o,t){const n=h.create();return h.translate(n,n,[1,1,0]),h.scale(n,n,[.5*o.width,.5*o.height,1]),h.multiply(n,n,o.calculatePosMatrix(t.toUnwrapped()))}function xt(o,t,n,a,c,p){const m=function(w,z,O){if(w)for(const L of w){const R=z[L];if(R&&R.source===O&&R.type==="fill-extrusion")return!0}else for(const L in z){const R=z[L];if(R.source===O&&R.type==="fill-extrusion")return!0}return!1}(c&&c.layers,t,o.id),y=p.maxPitchScaleFactor(),_=o.tilesIn(a,y,m);_.sort(at);const x=[];for(const w of _)x.push({wrappedTileID:w.tileID.wrapped().key,queryResults:w.tile.queryRenderedFeatures(t,n,o._state,w.queryGeometry,w.cameraQueryGeometry,w.scale,c,p,y,$n(o.transform,w.tileID))});const T=function(w){const z={},O={};for(const L of w){const R=L.queryResults,$=L.wrappedTileID,H=O[$]=O[$]||{};for(const re in R){const N=R[re],te=H[re]=H[re]||{},ae=z[re]=z[re]||[];for(const pe of N)te[pe.featureIndex]||(te[pe.featureIndex]=!0,ae.push(pe))}}return z}(x);for(const w in T)T[w].forEach(z=>{const O=z.feature,L=o.getFeatureState(O.layer["source-layer"],O.id);O.source=O.layer.source,O.layer["source-layer"]&&(O.sourceLayer=O.layer["source-layer"]),O.state=L});return T}function at(o,t){const n=o.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class Kr{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=h.uniqueId(),this.uses=0,this.tileSize=n,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 n=t+this.timeAdded;np.getLayer(x)).filter(Boolean);if(_.length!==0){y.layers=_,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(x=>_.filter(T=>T.id===x)[0]));for(const x of _)m[x.id]=y}}return m}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,h.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const c in this.buckets){const p=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(c).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new h.CollisionBoxArray}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 a in this.buckets){const c=this.buckets[a];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new gt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new gt(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,c,p,m,y,_,x,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:p,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:_,params:y,queryPadding:this.queryPadding*x},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const c=a.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",m=c._geojsonTileLayer||c[p];if(!m)return;const y=h.createFilter(n&&n.filter),{z:_,x,y:T}=this.tileID.canonical,w={z:_,x,y:T};for(let z=0;za)c=!1;else if(n)if(this.expirationTime{this.remove(t,p)},a)),this.data[c].push(p),this.order.push(c),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}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 n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const a=t.wrapped().key,c=n===void 0?0:this.data[a].indexOf(n),p=this.data[a][c];return this.data[a].splice(c,1),p.timeout&&clearTimeout(p.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(p.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const a in this.data)for(const c of this.data[a])t(c.value)||n.push(c);for(const a of n)this.remove(a.value.tileID,a)}}class fs{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const c=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][c]=this.stateChanges[t][c]||{},h.extend(this.stateChanges[t][c],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==c&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][c]===null){this.deletedStates[t][c]={};for(const p in this.state[t][c])a[p]||(this.deletedStates[t][c][p]=null)}else for(const p in a)this.deletedStates[t]&&this.deletedStates[t][c]&&this.deletedStates[t][c][p]===null&&delete this.deletedStates[t][c][p]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const c=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][c]!==null&&(this.deletedStates[t][c]=this.deletedStates[t][c]||{},this.deletedStates[t][c][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][c])for(a in this.deletedStates[t][c]={},this.stateChanges[t][c])this.deletedStates[t][c][a]=null;else this.deletedStates[t][c]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),c=h.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const m in p)delete c[m]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const c in this.stateChanges){this.state[c]=this.state[c]||{};const p={};for(const m in this.stateChanges[c])this.state[c][m]||(this.state[c][m]={}),h.extend(this.state[c][m],this.stateChanges[c][m]),p[m]=this.state[c][m];a[c]=p}for(const c in this.deletedStates){this.state[c]=this.state[c]||{};const p={};if(this.deletedStates[c]===null)for(const m in this.state[c])p[m]={},this.state[c][m]={};else for(const m in this.deletedStates[c]){if(this.deletedStates[c][m]===null)this.state[c][m]={};else for(const y of Object.keys(this.deletedStates[c][m]))delete this.state[c][m][y];p[m]=this.state[c][m]}a[c]=a[c]||{},h.extend(a[c],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const c in t)t[c].setFeatureState(a,n)}}class Nt extends h.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",c=>{c.dataType==="source"&&c.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&c.dataType==="source"&&c.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(c,p,m,y){const _=new Br[p.type](c,p,m,y);if(_.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${_.id}`);return h.bindAll(["load","abort","unload","serialize","prepare"],_),_}(t,n,a,this),this._tiles={},this._cache=new qn(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new fs,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||!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 t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")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,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new h.Event("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 n in this._tiles){const a=this._tiles[n];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Yr).map(t=>t.key)}getRenderableIds(t){const n=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&n.push(this._tiles[a]);return t?n.sort((a,c)=>{const p=a.tileID,m=c.tileID,y=new h.Point(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),_=new h.Point(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-m.overscaledZ||_.y-y.y||_.x-y.x}).map(a=>a.tileID.key):n.map(a=>a.tileID).sort(Yr).map(a=>a.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=n),this._loadTile(a,this._tileLoaded.bind(this,a,t,n)))}_tileLoaded(t,n,a,c){if(c)return t.state="errored",void(c.status!==404?this._source.fire(new h.ErrorEvent(c,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=h.exported.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new h.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let c=0;c1||(Math.abs(m)>1&&(Math.abs(m+_)===1?m+=_:Math.abs(m-_)===1&&(m-=_)),p.dem&&c.dem&&(c.dem.backfillBorder(p.dem,m,y),c.neighboringTiles&&c.neighboringTiles[x]&&(c.neighboringTiles[x].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,a,c){for(const p in this._tiles){let m=this._tiles[p];if(c[p]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>a)continue;let y=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const x=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[x.key],m&&m.hasData()&&(y=x)}let _=y;for(;_.overscaledZ>n;)if(_=_.scaledTo(_.overscaledZ-1),t[_.key]){c[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=t.overscaledZ-1;a>=n;a--){const c=t.scaledTo(a),p=this._getLoadedTile(c);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*a*(this._maxTileCacheZoomLevels===null?h.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const a={};for(const c in this._tiles){const p=this._tiles[c];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),a[p.tileID.key]=p}this._tiles=a;for(const c in this._timers)clearTimeout(this._timers[c]),delete this._timers[c];for(const c in this._tiles)this._setTileReloadTimer(c,this._tiles[c])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new h.OverscaledTileID(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter(T=>this._source.hasTile(T)))):a=[];const c=t.coveringZoomLevel(this._source),p=Math.max(c-Nt.maxOverzooming,this._source.minzoom),m=Math.max(c+Nt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const T={};for(const w of a)if(w.canonical.z>this._source.minzoom){const z=w.scaledTo(w.canonical.z-1);T[z.key]=z;const O=w.scaledTo(Math.max(this._source.minzoom,Math.min(w.canonical.z,5)));T[O.key]=O}a=a.concat(Object.values(T))}const y=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,y&&this.fire(new h.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const _=this._updateRetainedTiles(a,c);if(vn(this._source.type)){const T={},w={},z=Object.keys(_),O=h.exported.now();for(const L of z){const R=_[L],$=this._tiles[L];if(!$||$.fadeEndTime!==0&&$.fadeEndTime<=O)continue;const H=this.findLoadedParent(R,p);H&&(this._addTile(H.tileID),T[H.tileID.key]=H.tileID),w[L]=R}this._retainLoadedChildren(w,c,m,_);for(const L in T)_[L]||(this._coveredTiles[L]=!0,_[L]=T[L]);if(n){const L={},R={};for(const $ of a)this._tiles[$.key].hasData()?L[$.key]=$:R[$.key]=$;for(const $ in R){const H=R[$].children(this._source.maxzoom);this._tiles[H[0].key]&&this._tiles[H[1].key]&&this._tiles[H[2].key]&&this._tiles[H[3].key]&&(L[H[0].key]=_[H[0].key]=H[0],L[H[1].key]=_[H[1].key]=H[1],L[H[2].key]=_[H[2].key]=H[2],L[H[3].key]=_[H[3].key]=H[3],delete R[$])}for(const $ in R){const H=this.findLoadedParent(R[$],this._source.minzoom);if(H){L[H.tileID.key]=_[H.tileID.key]=H.tileID;for(const re in L)L[re].isChildOf(H.tileID)&&delete L[re]}}for(const $ in this._tiles)L[$]||(this._coveredTiles[$]=!0)}}for(const T in _)this._tiles[T].clearFadeHold();const x=h.keysDifference(this._tiles,_);for(const T of x){const w=this._tiles[T];w.hasSymbolBuckets&&!w.holdingForFade()?w.setHoldDuration(this.map._fadeDuration):w.hasSymbolBuckets&&!w.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const a={},c={},p=Math.max(n-Nt.maxOverzooming,this._source.minzoom),m=Math.max(n+Nt.maxUnderzooming,this._source.minzoom),y={};for(const _ of t){const x=this._addTile(_);a[_.key]=_,x.hasData()||nthis._source.maxzoom){const w=_.children(this._source.maxzoom)[0],z=this.getTile(w);if(z&&z.hasData()){a[w.key]=w;continue}}else{const w=_.children(this._source.maxzoom);if(a[w[0].key]&&a[w[1].key]&&a[w[2].key]&&a[w[3].key])continue}let T=x.wasRequested();for(let w=_.overscaledZ-1;w>=p;--w){const z=_.scaledTo(w);if(c[z.key])break;if(c[z.key]=!0,x=this.getTile(z),!x&&T&&(x=this._addTile(z)),x){const O=x.hasData();if((T||O)&&(a[z.key]=z),T=x.wasRequested(),O)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let a,c=this._tiles[t].tileID;for(;c.overscaledZ>0;){if(c.key in this._loadedParentTiles){a=this._loadedParentTiles[c.key];break}n.push(c.key);const p=c.scaledTo(c.overscaledZ-1);if(a=this._getLoadedTile(p),a)break;c=p}for(const p of n)this._loadedParentTiles[p]=a}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new Kr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new h.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,a){const c=[],p=this.transform;if(!p)return c;const m=a?p.getCameraQueryGeometry(t):t,y=t.map(L=>p.pointCoordinate(L,this.terrain)),_=m.map(L=>p.pointCoordinate(L,this.terrain)),x=this.getIds();let T=1/0,w=1/0,z=-1/0,O=-1/0;for(const L of _)T=Math.min(T,L.x),w=Math.min(w,L.y),z=Math.max(z,L.x),O=Math.max(O,L.y);for(let L=0;L=0&&N[1].y+re>=0){const te=y.map(pe=>$.getTilePoint(pe)),ae=_.map(pe=>$.getTilePoint(pe));c.push({tile:R,tileID:$,queryGeometry:te,cameraQueryGeometry:ae,scale:H})}}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(vn(this._source.type)){const t=h.exported.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,a){this._state.updateState(t=t||"_geojsonTileLayer",n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,a)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,a){const c=this._tiles[t];c&&c.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a in this._tiles)this._tiles[a].hasDependency(t,n)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,n))}}function Yr(o,t){const n=Math.abs(2*o.wrap)-+(o.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return o.overscaledZ-t.overscaledZ||a-n||t.canonical.y-o.canonical.y||t.canonical.x-o.canonical.x}function vn(o){return o==="raster"||o==="image"||o==="video"}Nt.maxOverzooming=10,Nt.maxUnderzooming=3;const Jr="mapboxgl_preloaded_worker_pool";class be{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Jr]}numActive(){return Object.keys(this.active).length}}const ar=Math.floor(h.exported.hardwareConcurrency/2);let hi;function bn(){return hi||(hi=new be),hi}be.workerCount=h.isSafari(globalThis)?Math.max(Math.min(ar,3),1):1;class Rr{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let a=1;a0?(c-m)/y:0;return this.points[p].mult(1-_).add(this.points[n].mult(_))}}function ve(o,t){let n=!0;return o==="always"||o!=="never"&&t!=="never"||(n=!1),n}class Ye{constructor(t,n,a){const c=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let m=0;mthis.width||c<0||n>this.height)return[];const _=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=c){if(p)return[{key:null,x1:t,y1:n,x2:a,y2:c}];for(let x=0;x0}hitTestCircle(t,n,a,c,p){const m=t-a,y=t+a,_=n-a,x=n+a;if(y<0||m>this.width||x<0||_>this.height)return!1;const T=[];return this._forEachCell(m,_,y,x,this._queryCellCircle,T,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},p),T.length>0}_queryCell(t,n,a,c,p,m,y,_){const{seenUids:x,hitTest:T,overlapMode:w}=y,z=this.boxCells[p];if(z!==null){const L=this.bboxes;for(const R of z)if(!x.box[R]){x.box[R]=!0;const $=4*R,H=this.boxKeys[R];if(t<=L[$+2]&&n<=L[$+3]&&a>=L[$+0]&&c>=L[$+1]&&(!_||_(H))&&(!T||!ve(w,H.overlapMode))&&(m.push({key:H,x1:L[$],y1:L[$+1],x2:L[$+2],y2:L[$+3]}),T))return!0}}const O=this.circleCells[p];if(O!==null){const L=this.circles;for(const R of O)if(!x.circle[R]){x.circle[R]=!0;const $=3*R,H=this.circleKeys[R];if(this._circleAndRectCollide(L[$],L[$+1],L[$+2],t,n,a,c)&&(!_||_(H))&&(!T||!ve(w,H.overlapMode))){const re=L[$],N=L[$+1],te=L[$+2];if(m.push({key:H,x1:re-te,y1:N-te,x2:re+te,y2:N+te}),T)return!0}}}return!1}_queryCellCircle(t,n,a,c,p,m,y,_){const{circle:x,seenUids:T,overlapMode:w}=y,z=this.boxCells[p];if(z!==null){const L=this.bboxes;for(const R of z)if(!T.box[R]){T.box[R]=!0;const $=4*R,H=this.boxKeys[R];if(this._circleAndRectCollide(x.x,x.y,x.radius,L[$+0],L[$+1],L[$+2],L[$+3])&&(!_||_(H))&&!ve(w,H.overlapMode))return m.push(!0),!0}}const O=this.circleCells[p];if(O!==null){const L=this.circles;for(const R of O)if(!T.circle[R]){T.circle[R]=!0;const $=3*R,H=this.circleKeys[R];if(this._circlesCollide(L[$],L[$+1],L[$+2],x.x,x.y,x.radius)&&(!_||_(H))&&!ve(w,H.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,a,c,p,m,y,_){const x=this._convertToXCellCoord(t),T=this._convertToYCellCoord(n),w=this._convertToXCellCoord(a),z=this._convertToYCellCoord(c);for(let O=x;O<=w;O++)for(let L=T;L<=z;L++)if(p.call(this,t,n,a,c,this.xCellCount*L+O,m,y,_))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,n,a,c,p,m){const y=c-t,_=p-n,x=a+m;return x*x>y*y+_*_}_circleAndRectCollide(t,n,a,c,p,m,y){const _=(m-c)/2,x=Math.abs(t-(c+_));if(x>_+a)return!1;const T=(y-p)/2,w=Math.abs(n-(p+T));if(w>T+a)return!1;if(x<=_||w<=T)return!0;const z=x-_,O=w-T;return z*z+O*O<=a*a}}function He(o,t,n,a,c){const p=h.create();return t?(h.scale(p,p,[1/c,1/c,1]),n||h.rotateZ(p,p,a.angle)):h.multiply(p,a.labelPlaneMatrix,o),p}function Si(o,t,n,a,c){if(t){const p=h.clone(o);return h.scale(p,p,[c,c,1]),n||h.rotateZ(p,p,-a.angle),p}return a.glCoordMatrix}function Ht(o,t,n){let a;n?(a=[o.x,o.y,n(o.x,o.y),1],h.transformMat4(a,a,t)):(a=[o.x,o.y,0,1],q(a,a,t));const c=a[3];return{point:new h.Point(a[0]/c,a[1]/c),signedDistanceFromCamera:c}}function Xe(o,t){return .5+o/t*.5}function br(o,t){const n=o[0]/o[3],a=o[1]/o[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function wr(o,t,n,a,c,p,m,y,_,x){const T=a?o.textSizeData:o.iconSizeData,w=h.evaluateSizeForZoom(T,n.transform.zoom),z=[256/n.width*2+1,256/n.height*2+1],O=a?o.text.dynamicLayoutVertexArray:o.icon.dynamicLayoutVertexArray;O.clear();const L=o.lineVertexArray,R=a?o.text.placedSymbolArray:o.icon.placedSymbolArray,$=n.transform.width/n.transform.height;let H=!1;for(let re=0;reMath.abs(n.x-t.x)*a?{useVertical:!0}:(o===h.WritingMode.vertical?t.yn.x)?{needsFlipping:!0}:null}function ai(o,t,n,a,c,p,m,y,_,x,T,w,z,O,L,R){const $=t/24,H=o.lineOffsetX*$,re=o.lineOffsetY*$;let N;if(o.numGlyphs>1){const te=o.glyphStartIndex+o.numGlyphs,ae=o.lineStartIndex,pe=o.lineStartIndex+o.lineLength,me=Yi($,y,H,re,n,T,w,o,_,p,z,L,R);if(!me)return{notEnoughRoom:!0};const xe=Ht(me.first.point,m,R).point,fe=Ht(me.last.point,m,R).point;if(a&&!n){const Ce=Tr(o.writingMode,xe,fe,O);if(Ce)return Ce}N=[me.first];for(let Ce=o.glyphStartIndex+1;Ce0?xe.point:wt(w,me,ae,1,c,R),Ce=Tr(o.writingMode,ae,fe,O);if(Ce)return Ce}const te=S($*y.getoffsetX(o.glyphStartIndex),H,re,n,T,w,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,_,p,z,L,R);if(!te)return{notEnoughRoom:!0};N=[te]}for(const te of N)h.addDynamicAttributes(x,te.point,te.angle);return{}}function wt(o,t,n,a,c,p){const m=Ht(o.add(o.sub(t)._unit()),c,p).point,y=n.sub(m);return n.add(y._mult(a/y.mag()))}function jn(o,t){const{projectionCache:n,lineVertexArray:a,labelPlaneMatrix:c,tileAnchorPoint:p,distanceFromAnchor:m,getElevation:y,previousVertex:_,direction:x,absOffsetX:T}=t;if(n.projections[o])return n.projections[o];const w=new h.Point(a.getx(o),a.gety(o)),z=Ht(w,c,y);if(z.signedDistanceFromCamera>0)return n.projections[o]=z.point,z.point;const O=o-x;return wt(m===0?p:new h.Point(a.getx(O),a.gety(O)),w,_,T-m+1,c,y)}function or(o,t,n){return o._unit()._perp()._mult(t*n)}function V(o,t,n,a,c,p,m,y){const{projectionCache:_,direction:x}=y;if(_.offsets[o])return _.offsets[o];const T=n.add(t);if(o+x=c)return _.offsets[o]=T,T;const w=jn(o+x,y),z=or(w.sub(n),m,x),O=n.add(z),L=w.add(z);return _.offsets[o]=h.findLineIntersection(p,T,O,L)||T,_.offsets[o]}function S(o,t,n,a,c,p,m,y,_,x,T,w,z,O){const L=a?o-t:o+t;let R=L>0?1:-1,$=0;a&&(R*=-1,$=Math.PI),R<0&&($+=Math.PI);let H,re,N=R>0?y+m:y+m+1,te=c,ae=c,pe=0,me=0;const xe=Math.abs(L),fe=[];let Ce;for(;pe+me<=xe;){if(N+=R,N=_)return null;pe+=me,ae=te,re=H;const Ee={projectionCache:w,lineVertexArray:x,labelPlaneMatrix:T,tileAnchorPoint:p,distanceFromAnchor:pe,getElevation:O,previousVertex:ae,direction:R,absOffsetX:xe};if(te=jn(N,Ee),n===0)fe.push(ae),Ce=te.sub(ae);else{let qe;const ze=te.sub(ae);qe=ze.mag()===0?or(jn(N+R,Ee).sub(te),n,R):or(ze,n,R),re||(re=ae.add(qe)),H=V(N,qe,te,y,_,re,n,Ee),fe.push(re),Ce=H.sub(re)}me=Ce.mag()}const Ue=Ce._mult((xe-pe)/me)._add(re||ae),We=$+Math.atan2(te.y-ae.y,te.x-ae.x);return fe.push(Ue),{point:Ue,angle:z?We:0,path:fe}}const P=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function D(o,t){for(let n=0;n=1;ht--)ze.push(Ee.path[ht]);for(let ht=1;htHt(Ke,_,L));ze=ht.some(Ke=>Ke.signedDistanceFromCamera<=0)?[]:ht.map(Ke=>Ke.point)}let Ot=[];if(ze.length>0){const ht=ze[0].clone(),Ke=ze[0].clone();for(let Lt=1;Lt=Ce.x&&Ke.x<=Ue.x&&ht.y>=Ce.y&&Ke.y<=Ue.y?[ze]:Ke.xUe.x||Ke.yUe.y?[]:h.clipLine([ze],Ce.x,Ce.y,Ue.x,Ue.y)}for(const ht of Ot){We.reset(ht,.25*fe);let Ke=0;Ke=We.length<=.5*fe?1:Math.ceil(We.paddedLength/ct)+1;for(let Lt=0;Lt=this.screenRightBoundary||cthis.screenBottomBoundary}isInsideGrid(t,n,a,c){return a>=0&&t=0&&na.collisionGroupID===n}}return this.collisionGroups[t]}}function Ge(o,t,n,a,c){const{horizontalAlign:p,verticalAlign:m}=h.getAnchorAlignment(o),y=-(p-.5)*t,_=-(m-.5)*n,x=h.evaluateVariableOffset(o,a);return new h.Point(y+x[0]*c,_+x[1]*c)}function Le(o,t,n,a,c,p){const{x1:m,x2:y,y1:_,y2:x,anchorPointX:T,anchorPointY:w}=o,z=new h.Point(t,n);return a&&z._rotate(c?p:-p),{x1:m+z.x,y1:_+z.y,x2:y+z.x,y2:x+z.y,anchorPointX:T,anchorPointY:w}}class Oe{constructor(t,n,a,c,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new J(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Ne(c),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,c){const p=a.getBucket(n),m=a.latestFeatureIndex;if(!p||!m||n.id!==p.layerIds[0])return;const y=a.collisionBoxArray,_=p.layers[0].layout,x=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),T=a.tileSize/h.EXTENT,w=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),z=_.get("text-pitch-alignment")==="map",O=_.get("text-rotation-alignment")==="map",L=W(a,1,this.transform.zoom),R=He(w,z,O,this.transform,L);let $=null;if(z){const re=Si(w,z,O,this.transform,L);$=h.multiply([],this.transform.labelPlaneMatrix,re)}this.retainedQueryData[p.bucketInstanceId]=new ue(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,a.tileID);const H={bucket:p,layout:_,posMatrix:w,textLabelPlaneMatrix:R,labelToScreenMatrix:$,scale:x,textPixelRatio:T,holdingForFade:a.holdingForFade(),collisionBoxArray:y,partiallyEvaluatedTextSize:h.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(c)for(const re of p.sortKeyRanges){const{sortKey:N,symbolInstanceStart:te,symbolInstanceEnd:ae}=re;t.push({sortKey:N,symbolInstanceStart:te,symbolInstanceEnd:ae,parameters:H})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:H})}attemptAnchorPlacement(t,n,a,c,p,m,y,_,x,T,w,z,O,L,R,$){const H=[z.textOffset0,z.textOffset1],re=Ge(t,a,c,H,p),N=this.collisionIndex.placeCollisionBox(Le(n,re.x,re.y,m,y,this.transform.angle),w,_,x,T.predicate,$);if((!R||this.collisionIndex.placeCollisionBox(Le(R,re.x,re.y,m,y,this.transform.angle),w,_,x,T.predicate,$).box.length!==0)&&N.box.length>0){let te;if(this.prevPlacement&&this.prevPlacement.variableOffsets[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID]&&this.prevPlacement.placements[z.crossTileID].text&&(te=this.prevPlacement.variableOffsets[z.crossTileID].anchor),z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[z.crossTileID]={textOffset:H,width:a,height:c,anchor:t,textBoxScale:p,prevAnchor:te},this.markUsedJustification(O,t,z,L),O.allowVerticalPlacement&&(this.markUsedOrientation(O,L,z),this.placedOrientations[z.crossTileID]=L),{shift:re,placedGlyphBoxes:N}}}placeLayerBucketPart(t,n,a){const{bucket:c,layout:p,posMatrix:m,textLabelPlaneMatrix:y,labelToScreenMatrix:_,textPixelRatio:x,holdingForFade:T,collisionBoxArray:w,partiallyEvaluatedTextSize:z,collisionGroup:O}=t.parameters,L=p.get("text-optional"),R=p.get("icon-optional"),$=h.getOverlapMode(p,"text-overlap","text-allow-overlap"),H=$==="always",re=h.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),N=re==="always",te=p.get("text-rotation-alignment")==="map",ae=p.get("text-pitch-alignment")==="map",pe=p.get("icon-text-fit")!=="none",me=p.get("symbol-z-order")==="viewport-y",xe=H&&(N||!c.hasIconData()||R),fe=N&&(H||!c.hasTextData()||L);!c.collisionArrays&&w&&c.deserializeCollisionBoxes(w);const Ce=this.retainedQueryData[c.bucketInstanceId].tileID,Ue=this.terrain?(Ee,qe)=>this.terrain.getElevation(Ce,Ee,qe):null,We=(Ee,qe)=>{if(n[Ee.crossTileID])return;if(T)return void(this.placements[Ee.crossTileID]=new he(!1,!1,!1));let ze=!1,ct=!1,Ot=!0,ht=null,Ke={box:null,offscreen:null},Lt={box:null,offscreen:null},xi=null,Ut=null,ei=null,Li=0,Qi=0,er=0;qe.textFeatureIndex?Li=qe.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(Li=Ee.featureIndex),qe.verticalTextFeatureIndex&&(Qi=qe.verticalTextFeatureIndex);const vi=qe.textBox;if(vi){const ui=ut=>{let Kt=h.WritingMode.horizontal;if(c.allowVerticalPlacement&&!ut&&this.prevPlacement){const ii=this.prevPlacement.placedOrientations[Ee.crossTileID];ii&&(this.placedOrientations[Ee.crossTileID]=ii,Kt=ii,this.markUsedOrientation(c,Kt,Ee))}return Kt},ti=(ut,Kt)=>{if(c.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&qe.verticalTextBox){for(const ii of c.writingModes)if(ii===h.WritingMode.vertical?(Ke=Kt(),Lt=Ke):Ke=ut(),Ke&&Ke.box&&Ke.box.length)break}else Ke=ut()};if(p.get("text-variable-anchor")){let ut=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ee.crossTileID]){const pt=this.prevPlacement.variableOffsets[Ee.crossTileID];ut.indexOf(pt.anchor)>0&&(ut=ut.filter(Yt=>Yt!==pt.anchor),ut.unshift(pt.anchor))}const Kt=(pt,Yt,Bi)=>{const Qs=pt.x2-pt.x1,Ar=pt.y2-pt.y1,ic=Ee.textBoxScale,ol=pe&&re==="never"?Yt:null;let St={box:[],offscreen:!1};const Qa=$!=="never"?2*ut.length:ut.length;for(let cs=0;cs=ut.length?$:"never",Ee,c,Bi,ol,Ue);if(Pr&&(St=Pr.placedGlyphBoxes,St&&St.box&&St.box.length)){ze=!0,ht=Pr.shift;break}}return St};ti(()=>Kt(vi,qe.iconBox,h.WritingMode.horizontal),()=>{const pt=qe.verticalTextBox;return c.allowVerticalPlacement&&!(Ke&&Ke.box&&Ke.box.length)&&Ee.numVerticalGlyphVertices>0&&pt?Kt(pt,qe.verticalIconBox,h.WritingMode.vertical):{box:null,offscreen:null}}),Ke&&(ze=Ke.box,Ot=Ke.offscreen);const ii=ui(Ke&&Ke.box);if(!ze&&this.prevPlacement){const pt=this.prevPlacement.variableOffsets[Ee.crossTileID];pt&&(this.variableOffsets[Ee.crossTileID]=pt,this.markUsedJustification(c,pt.anchor,Ee,ii))}}else{const ut=(Kt,ii)=>{const pt=this.collisionIndex.placeCollisionBox(Kt,$,x,m,O.predicate,Ue);return pt&&pt.box&&pt.box.length&&(this.markUsedOrientation(c,ii,Ee),this.placedOrientations[Ee.crossTileID]=ii),pt};ti(()=>ut(vi,h.WritingMode.horizontal),()=>{const Kt=qe.verticalTextBox;return c.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&Kt?ut(Kt,h.WritingMode.vertical):{box:null,offscreen:null}}),ui(Ke&&Ke.box&&Ke.box.length)}}if(xi=Ke,ze=xi&&xi.box&&xi.box.length>0,Ot=xi&&xi.offscreen,Ee.useRuntimeCollisionCircles){const ui=c.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),ti=h.evaluateSizeForFeature(c.textSizeData,z,ui),ut=p.get("text-padding");Ut=this.collisionIndex.placeCollisionCircles($,ui,c.lineVertexArray,c.glyphOffsetArray,ti,m,y,_,a,ae,O.predicate,Ee.collisionCircleDiameter,ut,Ue),Ut.circles.length&&Ut.collisionDetected&&!a&&h.warnOnce("Collisions detected, but collision boxes are not shown"),ze=H||Ut.circles.length>0&&!Ut.collisionDetected,Ot=Ot&&Ut.offscreen}if(qe.iconFeatureIndex&&(er=qe.iconFeatureIndex),qe.iconBox){const ui=ti=>{const ut=pe&&ht?Le(ti,ht.x,ht.y,te,ae,this.transform.angle):ti;return this.collisionIndex.placeCollisionBox(ut,re,x,m,O.predicate,Ue)};Lt&&Lt.box&&Lt.box.length&&qe.verticalIconBox?(ei=ui(qe.verticalIconBox),ct=ei.box.length>0):(ei=ui(qe.iconBox),ct=ei.box.length>0),Ot=Ot&&ei.offscreen}const fr=L||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,ls=R||Ee.numIconVertices===0;if(fr||ls?ls?fr||(ct=ct&&ze):ze=ct&&ze:ct=ze=ct&&ze,ze&&xi&&xi.box&&this.collisionIndex.insertCollisionBox(xi.box,$,p.get("text-ignore-placement"),c.bucketInstanceId,Lt&&Lt.box&&Qi?Qi:Li,O.ID),ct&&ei&&this.collisionIndex.insertCollisionBox(ei.box,re,p.get("icon-ignore-placement"),c.bucketInstanceId,er,O.ID),Ut&&(ze&&this.collisionIndex.insertCollisionCircles(Ut.circles,$,p.get("text-ignore-placement"),c.bucketInstanceId,Li,O.ID),a)){const ui=c.bucketInstanceId;let ti=this.collisionCircleArrays[ui];ti===void 0&&(ti=this.collisionCircleArrays[ui]=new de);for(let ut=0;ut=0;--qe){const ze=Ee[qe];We(c.symbolInstances.get(ze),c.collisionArrays[ze])}}else for(let Ee=t.symbolInstanceStart;Ee=0&&(t.text.placedSymbolArray.get(y).crossTileID=p>=0&&y!==p?0:a.crossTileID)}markUsedOrientation(t,n,a){const c=n===h.WritingMode.horizontal||n===h.WritingMode.horizontalOnly?n:0,p=n===h.WritingMode.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const y of m)t.text.placedSymbolArray.get(y).placedOrientation=c;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const _ in this.placements){const x=this.placements[_],T=p[_];T?(this.opacities[_]=new ee(T,c,x.text,x.icon),a=a||x.text!==T.text.placed||x.icon!==T.icon.placed):(this.opacities[_]=new ee(null,c,x.text,x.icon,x.skipFade),a=a||x.text||x.icon)}for(const _ in p){const x=p[_];if(!this.opacities[_]){const T=new ee(x,c,!1,!1);T.isHidden()||(this.opacities[_]=T,a=a||x.text.placed||x.icon.placed)}}for(const _ in m)this.variableOffsets[_]||!this.opacities[_]||this.opacities[_].isHidden()||(this.variableOffsets[_]=m[_]);for(const _ in y)this.placedOrientations[_]||!this.opacities[_]||this.opacities[_].isHidden()||(this.placedOrientations[_]=y[_]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const c of n){const p=c.getBucket(t);p&&c.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,a,c.collisionBoxArray)}}updateBucketOpacities(t,n,a){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 c=t.layers[0].layout,p=new ee(null,0,!1,!1,!0),m=c.get("text-allow-overlap"),y=c.get("icon-allow-overlap"),_=c.get("text-variable-anchor"),x=c.get("text-rotation-alignment")==="map",T=c.get("text-pitch-alignment")==="map",w=c.get("icon-text-fit")!=="none",z=new ee(null,0,m&&(y||!t.hasIconData()||c.get("icon-optional")),y&&(m||!t.hasTextData()||c.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const O=(L,R,$)=>{for(let H=0;H0,ae=this.placedOrientations[R.crossTileID],pe=ae===h.WritingMode.vertical,me=ae===h.WritingMode.horizontal||ae===h.WritingMode.horizontalOnly;if($>0||H>0){const xe=Fr(N.text);O(t.text,$,pe?oi:xe),O(t.text,H,me?oi:xe);const fe=N.text.isHidden();[R.rightJustifiedTextSymbolIndex,R.centerJustifiedTextSymbolIndex,R.leftJustifiedTextSymbolIndex].forEach(We=>{We>=0&&(t.text.placedSymbolArray.get(We).hidden=fe||pe?1:0)}),R.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(R.verticalPlacedTextSymbolIndex).hidden=fe||me?1:0);const Ce=this.variableOffsets[R.crossTileID];Ce&&this.markUsedJustification(t,Ce.anchor,R,ae);const Ue=this.placedOrientations[R.crossTileID];Ue&&(this.markUsedJustification(t,"left",R,Ue),this.markUsedOrientation(t,Ue,R))}if(te){const xe=Fr(N.icon),fe=!(w&&R.verticalPlacedIconSymbolIndex&&pe);R.placedIconSymbolIndex>=0&&(O(t.icon,R.numIconVertices,fe?xe:oi),t.icon.placedSymbolArray.get(R.placedIconSymbolIndex).hidden=N.icon.isHidden()),R.verticalPlacedIconSymbolIndex>=0&&(O(t.icon,R.numVerticalIconVertices,fe?oi:xe),t.icon.placedSymbolArray.get(R.verticalPlacedIconSymbolIndex).hidden=N.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const xe=t.collisionArrays[L];if(xe){let fe=new h.Point(0,0);if(xe.textBox||xe.verticalTextBox){let Ue=!0;if(_){const We=this.variableOffsets[re];We?(fe=Ge(We.anchor,We.width,We.height,We.textOffset,We.textBoxScale),x&&fe._rotate(T?this.transform.angle:-this.transform.angle)):Ue=!1}xe.textBox&&Ze(t.textCollisionBox.collisionVertexArray,N.text.placed,!Ue||pe,fe.x,fe.y),xe.verticalTextBox&&Ze(t.textCollisionBox.collisionVertexArray,N.text.placed,!Ue||me,fe.x,fe.y)}const Ce=!!(!me&&xe.verticalIconBox);xe.iconBox&&Ze(t.iconCollisionBox.collisionVertexArray,N.icon.placed,Ce,w?fe.x:0,w?fe.y:0),xe.verticalIconBox&&Ze(t.iconCollisionBox.collisionVertexArray,N.icon.placed,!Ce,w?fe.x:0,w?fe.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 L=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=L.invProjMatrix,t.placementViewportMatrix=L.viewportMatrix,t.collisionCircleArray=L.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?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 Ze(o,t,n,a,c){o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0)}const st=Math.pow(2,25),Je=Math.pow(2,24),ot=Math.pow(2,17),vt=Math.pow(2,16),$t=Math.pow(2,9),je=Math.pow(2,8),kt=Math.pow(2,1);function Fr(o){if(o.opacity===0&&!o.placed)return 0;if(o.opacity===1&&o.placed)return 4294967295;const t=o.placed?1:0,n=Math.floor(127*o.opacity);return n*st+t*Je+n*ot+t*vt+n*$t+t*je+n*kt+t}const oi=0;class zi{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,c,p){const m=this._bucketParts;for(;this._currentTileIndexy.sortKey-_.sortKey));this._currentPartIndex!this._forceFullPlacement&&h.exported.now()-c>2;for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],y=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=y)&&(!m.maxzoom||m.maxzoom>y)){if(this._inProgressLayer||(this._inProgressLayer=new zi(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const wn=512/h.EXTENT/2;class ms{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const c=new Map;for(let p=0;p({x:Math.floor(_.anchorX*wn),y:Math.floor(_.anchorY*wn)})),crossTileIDs:m.map(_=>_.crossTileID)};if(y.positions.length>128){const _=new h.KDBush(y.positions.length,16,Uint16Array);for(const{x,y:T}of y.positions)_.add(x,T);_.finish(),delete y.positions,y.index=_}this._symbolsByKey[p]=y}}getScaledCoordinates(t,n){const{x:a,y:c,z:p}=this.tileID.canonical,{x:m,y,z:_}=n.canonical,x=wn/Math.pow(2,_-p),T=(y*h.EXTENT+t.anchorY)*x,w=c*h.EXTENT*wn;return{x:Math.floor((m*h.EXTENT+t.anchorX)*x-a*h.EXTENT*wn),y:Math.floor(T-w)}}findMatches(t,n,a){const c=this.tileID.canonical.zt)}}class qt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Zn{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const c=this.indexes[a],p={};for(const m in c){const y=c[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),p[y.tileID.key]=y}this.indexes[a]=p}this.lng=t}addBucket(t,n,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;pt.overscaledZ)for(const y in m){const _=m[y];_.tileID.isChildOf(t)&&_.findMatches(n.symbolInstances,t,c)}else{const y=m[t.scaledTo(Number(p)).key];y&&y.findMatches(n.symbolInstances,t,c)}}for(let p=0;p{n[a]=!0});for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}const Rt=(o,t)=>h.emitValidationErrors(o,t&&t.filter(n=>n.identifier!=="source.canvas")),gs=h.pick(h.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Ji=h.pick(h.operations,["setCenter","setZoom","setBearing","setPitch"]),So=h.emptyStyle();class li extends h.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new yi(bn(),this,t._getMapId()),this.imageManager=new $i,this.imageManager.setEventedParent(this),this.glyphManager=new yr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Dr(256,512),this.crossTileSymbolIndex=new Or,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new h.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",h.getReferrer());const a=this;this._rtlTextPluginCallback=li.registerForPluginStateChange(c=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:c.pluginStatus,pluginURL:c.pluginURL},(p,m)=>{if(h.triggerPluginCompletionEvent(p),m&&m.every(y=>y))for(const y in a.sourceCaches){const _=a.sourceCaches[y].getSource().type;_!=="vector"&&_!=="geojson"||a.sourceCaches[y].reload()}})}),this.on("data",c=>{if(c.dataType!=="source"||c.sourceDataType!=="metadata")return;const p=this.sourceCaches[c.sourceId];if(!p)return;const m=p.getSource();if(m&&m.vectorLayerIds)for(const y in this._layers){const _=this._layers[y];_.source===m.id&&this._validateLayer(_)}})}loadURL(t,n={},a){this.fire(new h.Event("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const c=this.map._requestManager.transformRequest(t,nt.Style);this._request=h.getJSON(c,(p,m)=>{this._request=null,p?this.fire(new h.ErrorEvent(p)):m&&this._load(m,n,a)})}loadJSON(t,n={},a){this.fire(new h.Event("dataloading",{dataType:"style"})),this._request=h.exported.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,a)})}loadEmpty(){this.fire(new h.Event("dataloading",{dataType:"style"})),this._load(So,{validate:!1})}_load(t,n,a){const c=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!Rt(this,h.validateStyle(c))){this._loaded=!0,this.stylesheet=c;for(const p in c.sources)this.addSource(p,c.sources[p],{validate:!1});c.sprite?this._loadSprite(c.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(c.glyphs),this._createLayers(),this.light=new Nn(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new h.Event("data",{dataType:"style"})),this.fire(new h.Event("style.load"))}}_createLayers(){const t=h.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const a=h.createStyleLayer(n);a.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=a}}_loadSprite(t,n=!1,a=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(c,p,m,y){const _=Gr(c),x=_.length,T=m>1?"@2x":"",w={},z={},O={};for(const{id:L,url:R}of _){const $=p.transformRequest(p.normalizeSpriteURL(R,T,".json"),nt.SpriteJSON),H=`${L}_${$.url}`;w[H]=h.getJSON($,(te,ae)=>{delete w[H],z[L]=ae,ci(y,z,O,te,x)});const re=p.transformRequest(p.normalizeSpriteURL(R,T,".png"),nt.SpriteImage),N=`${L}_${re.url}`;w[N]=Qt.getImage(re,(te,ae)=>{delete w[N],O[L]=ae,ci(y,z,O,te,x)})}return{cancel(){for(const L of Object.values(w))L.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(c,p)=>{if(this._spriteRequest=null,c)this.fire(new h.ErrorEvent(c));else if(p)for(const m in p){this._spritesImagesIds[m]=[];const y=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(_=>!(_ in p)):[];for(const _ of y)this.imageManager.removeImage(_),this._changedImages[_]=!0;for(const _ in p[m]){const x=m==="default"?_:`${m}:${_}`;this._spritesImagesIds[m].push(x),x in this.imageManager.images?this.imageManager.updateImage(x,p[m][_],!1):this.imageManager.addImage(x,p[m][_]),n&&(this._changedImages[x]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"})),a&&a(c)})}_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("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&c.vectorLayerIds.indexOf(a)===-1)&&this.fire(new h.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${c.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||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){const n=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n);const a=[];for(const c of t)n[c]&&a.push(n[c]);return a}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const a of n){const c=this._layers[a];c.type!=="custom"&&(t[a]=c.serialize())}return t}hasTransitions(){if(this.light&&this.light.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 n=this._changed;if(this._changed){const c=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(c.length||p.length)&&this._updateWorkerLayers(c,p);for(const m in this._updatedSources){const y=this._updatedSources[m];if(y==="reload")this._reloadSource(m);else{if(y!=="clear")throw new Error(`Invalid action ${y}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const c in this.sourceCaches){const p=this.sourceCaches[c];a[c]=p.used,p.used=!1}for(const c of this._order){const p=this._layers[c];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const c in a){const p=this.sourceCaches[c];a[c]!==p.used&&p.fire(new h.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new h.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].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,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,Rt(this,h.validateStyle(t)))return!1;(t=h.clone$1(t)).layers=h.derefLayers(t.layers);const c=h.diffStyles(a,t).filter(m=>!(m.command in Ji));if(c.length===0)return!1;const p=c.filter(m=>!(m.command in gs));if(p.length>0)throw new Error(`Unimplemented: ${p.map(m=>m.command).join(", ")}.`);for(const m of c)m.command!=="setTransition"&&this[m.command].apply(this,m.args);return this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new h.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new h.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(h.validateStyle.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const c=this.sourceCaches[t]=new Nt(t,n,this.dispatcher);c.style=this,c.setEventedParent(this,()=>({isSourceLoaded:c.loaded(),source:c.serialize(),sourceId:t})),c.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new h.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new h.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new h.ErrorEvent(new Error(`Layer "${c}" already exists on this map.`)));let p;if(t.type==="custom"){if(Rt(this,h.validateCustomStyleLayer(t)))return;p=h.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(c,t.source),t=h.clone$1(t),t=h.extend(t,{source:c})),this._validate(h.validateStyle.layer,`layers.${c}`,t,{arrayIndex:-1},a))return;p=h.createStyleLayer(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:c}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new h.ErrorEvent(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,c),this._layerOrderChanged=!0,this._layers[c]=p,this._removedLayers[c]&&p.source&&p.type!=="custom"){const y=this._removedLayers[c];delete this._removedLayers[c],y.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new h.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new h.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(c,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new h.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===a||(n!=null&&(c.minzoom=n),a!=null&&(c.maxzoom=a),this._updateLayer(c)):this.fire(new h.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!h.deepEqual(c.filter,n))return n==null?(c.filter=void 0,void this._updateLayer(c)):void(this._validate(h.validateStyle.filter,`layers.${c.id}.filter`,n,null,a)||(c.filter=h.clone$1(n),this._updateLayer(c)))}else this.fire(new h.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return h.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?h.deepEqual(p.getLayoutProperty(n),a)||(p.setLayoutProperty(n,a,c),this._updateLayer(p)):this.fire(new h.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new h.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?h.deepEqual(p.getPaintProperty(n),a)||(p.setPaintProperty(n,a,c)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new h.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,c=t.sourceLayer,p=this.sourceCaches[a];if(p===void 0)return void this.fire(new h.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const m=p.getSource().type;m==="geojson"&&c?this.fire(new h.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||c?(t.id===void 0&&this.fire(new h.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(c,t.id,n)):this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,c=this.sourceCaches[a];if(c===void 0)return void this.fire(new h.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const p=c.getSource().type,m=p==="vector"?t.sourceLayer:void 0;p!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new h.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(m,t.id,n):this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,c=this.sourceCaches[n];if(c!==void 0)return c.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new h.ErrorEvent(new Error("The feature id parameter must be provided."))),c.getFeatureState(a,t.id)):void this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return h.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const t=h.mapObject(this.sourceCaches,c=>c.serialize()),n=this._serializeByIds(this._order),a=this.stylesheet;return h.filterObject({version:a.version,name:a.name,metadata:a.metadata,light:a.light,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,sources:t,layers:n},c=>c!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=m=>this._layers[m].type==="fill-extrusion",a={},c=[];for(let m=this._order.length-1;m>=0;m--){const y=this._order[m];if(n(y)){a[y]=m;for(const _ of t){const x=_[y];if(x)for(const T of x)c.push(T)}}}c.sort((m,y)=>y.intersectionZ-m.intersectionZ);const p=[];for(let m=this._order.length-1;m>=0;m--){const y=this._order[m];if(n(y))for(let _=c.length-1;_>=0;_--){const x=c[_].feature;if(a[x.layer.id]{const xe=H.featureSortOrder;if(xe){const fe=xe.indexOf(pe.featureIndex);return xe.indexOf(me.featureIndex)-fe}return me.featureIndex-pe.featureIndex});for(const pe of ae)te.push(pe)}}for(const H in L)L[H].forEach(re=>{const N=re.feature,te=x[y[H].source].getFeatureState(N.layer["source-layer"],N.id);N.source=N.layer.source,N.layer["source-layer"]&&(N.sourceLayer=N.layer["source-layer"]),N.state=te});return L}(this._layers,m,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(h.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(c,p){const m=c.getRenderableIds().map(x=>c.getTileByID(x)),y=[],_={};for(let x=0;xz.getTileByID(O)).sort((O,L)=>L.tileID.overscaledZ-O.tileID.overscaledZ||(O.tileID.isLessThan(L.tileID)?-1:1))}const w=this.crossTileSymbolIndex.addLayer(T,_[T.source],t.center.lng);m=m||w}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(h.exported.now(),t.zoom))&&(this.pauseablePlacement=new Zi(t,this.map.terrain,this._order,p,n,a,c,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,_),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(h.exported.now()),y=!0),m&&this.pauseablePlacement.placement.setStale()),y||m)for(const x of this._order){const T=this._layers[x];T.type==="symbol"&&this.placement.updateLayerOpacities(T,_[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(h.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,a){this.imageManager.getImages(n.icons,a),this._updateTilesForChangedImages();const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,a){this.glyphManager.getGlyphs(n.stacks,a);const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,a){return h.makeRequest(n,a)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(h.validateStyle.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,a={},c){this._checkLoaded();const p=[{id:t,url:n}],m=[...Gr(this.stylesheet.sprite),...p];this._validate(h.validateStyle.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(p,!0,c))}removeSprite(t){this._checkLoaded();const n=Gr(this.stylesheet.sprite);if(n.find(a=>a.id===t)){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex(a=>a.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}else this.fire(new h.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Gr(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(h.validateStyle.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}}li.getSourceType=function(o){return Br[o]},li.setSourceType=function(o,t){Br[o]=t},li.registerForPluginStateChange=h.registerForPluginStateChange;var _a=h.createLayout([{name:"a_pos",type:"Int16",components:2}]),_s="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Ur={prelude:dt(`#ifdef GL_ES +var Hp=Object.defineProperty;var Kp=(I,M,L)=>M in I?Hp(I,M,{enumerable:!0,configurable:!0,writable:!0,value:L}):I[M]=L;var Xc=(I,M,L)=>(Kp(I,typeof M!="symbol"?M+"":M,L),L);(function(){const M=document.createElement("link").relList;if(M&&M.supports&&M.supports("modulepreload"))return;for(const se of document.querySelectorAll('link[rel="modulepreload"]'))j(se);new MutationObserver(se=>{for(const oe of se)if(oe.type==="childList")for(const Te of oe.addedNodes)Te.tagName==="LINK"&&Te.rel==="modulepreload"&&j(Te)}).observe(document,{childList:!0,subtree:!0});function L(se){const oe={};return se.integrity&&(oe.integrity=se.integrity),se.referrerPolicy&&(oe.referrerPolicy=se.referrerPolicy),se.crossOrigin==="use-credentials"?oe.credentials="include":se.crossOrigin==="anonymous"?oe.credentials="omit":oe.credentials="same-origin",oe}function j(se){if(se.ep)return;se.ep=!0;const oe=L(se);fetch(se.href,oe)}})();function Nn(){}const Yp=I=>I;function Jp(I,M){for(const L in M)I[L]=M[L];return I}function Gu(I){return I()}function $u(){return Object.create(null)}function fa(I){I.forEach(Gu)}function eh(I){return typeof I=="function"}function Qp(I,M){return I!=I?M==M:I!==M||I&&typeof I=="object"||typeof I=="function"}let Ml;function nm(I,M){return Ml||(Ml=document.createElement("a")),Ml.href=M,I===Ml.href}function ef(I){return Object.keys(I).length===0}function Xu(I,...M){if(I==null){for(const j of M)j(void 0);return Nn}const L=I.subscribe(...M);return L.unsubscribe?()=>L.unsubscribe():L}function sm(I){let M;return Xu(I,L=>M=L)(),M}function am(I,M,L){I.$$.on_destroy.push(Xu(M,L))}function om(I,M,L,j){if(I){const se=Wu(I,M,L,j);return I[0](se)}}function Wu(I,M,L,j){return I[1]&&j?Jp(L.ctx.slice(),I[1](j(M))):L.ctx}function lm(I,M,L,j){if(I[2]&&j){const se=I[2](j(L));if(M.dirty===void 0)return se;if(typeof se=="object"){const oe=[],Te=Math.max(M.dirty.length,se.length);for(let h=0;h32){const M=[],L=I.ctx.length/32;for(let j=0;jwindow.performance.now():()=>Date.now(),th=Hu?I=>requestAnimationFrame(I):Nn;const da=new Set;function Ku(I){da.forEach(M=>{M.c(I)||(da.delete(M),M.f())}),da.size!==0&&th(Ku)}function rf(I){let M;return da.size===0&&th(Ku),{promise:new Promise(L=>{da.add(M={c:I,f:L})}),abort(){da.delete(M)}}}function bo(I,M){I.appendChild(M)}function Yu(I){if(!I)return document;const M=I.getRootNode?I.getRootNode():I.ownerDocument;return M&&M.host?M:I.ownerDocument}function nf(I){const M=Cl("style");return M.textContent="/* empty */",sf(Yu(I),M),M.sheet}function sf(I,M){return bo(I.head||I,M),M.sheet}function af(I,M,L){I.insertBefore(M,L||null)}function ih(I){I.parentNode&&I.parentNode.removeChild(I)}function pm(I,M){for(let L=0;LI.removeEventListener(M,L,j)}function gm(I){return function(M){return M.stopPropagation(),I.call(this,M)}}function Vn(I,M,L){L==null?I.removeAttribute(M):I.getAttribute(M)!==L&&I.setAttribute(M,L)}const cf=["width","height"];function _m(I,M){const L=Object.getOwnPropertyDescriptors(I.__proto__);for(const j in M)M[j]==null?I.removeAttribute(j):j==="style"?I.style.cssText=M[j]:j==="__value"?I.value=I[j]=M[j]:L[j]&&L[j].set&&cf.indexOf(j)===-1?I[j]=M[j]:Vn(I,j,M[j])}function ym(I){let M;return{p(...L){M=L,M.forEach(j=>I.push(j))},r(){M.forEach(L=>I.splice(I.indexOf(L),1))}}}function xm(I){return I===""?null:+I}function hf(I){return Array.from(I.childNodes)}function uf(I,M){M=""+M,I.data!==M&&(I.data=M)}function vm(I,M){I.value=M??""}function bm(I,M,L,j){L==null?I.style.removeProperty(M):I.style.setProperty(M,L,j?"important":"")}function wm(I,M,L){for(let j=0;j>>0}function pf(I,M){const L={stylesheet:nf(M),rules:{}};return zl.set(I,L),L}function qu(I,M,L,j,se,oe,Te,h=0){const _e=16.666/j;let Y=`{ +`;for(let kt=0;kt<=1;kt+=_e){const nt=M+(L-M)*oe(kt);Y+=kt*100+`%{${Te(nt,1-nt)}} +`}const Qe=Y+`100% {${Te(L,1-L)}} +}`,ye=`__svelte_${df(Qe)}_${h}`,_t=Yu(I),{stylesheet:Et,rules:it}=zl.get(_t)||pf(_t,I);it[ye]||(it[ye]=!0,Et.insertRule(`@keyframes ${ye} ${Qe}`,Et.cssRules.length));const At=I.style.animation||"";return I.style.animation=`${At?`${At}, `:""}${ye} ${j}ms linear ${se}ms 1 both`,Dl+=1,ye}function ff(I,M){const L=(I.style.animation||"").split(", "),j=L.filter(M?oe=>oe.indexOf(M)<0:oe=>oe.indexOf("__svelte")===-1),se=L.length-j.length;se&&(I.style.animation=j.join(", "),Dl-=se,Dl||mf())}function mf(){th(()=>{Dl||(zl.forEach(I=>{const{ownerNode:M}=I.stylesheet;M&&ih(M)}),zl.clear())})}let To;function wo(I){To=I}function Eo(){if(!To)throw new Error("Function called outside component initialization");return To}function Sm(I){Eo().$$.on_mount.push(I)}function Im(I){Eo().$$.on_destroy.push(I)}function Am(){const I=Eo();return(M,L,{cancelable:j=!1}={})=>{const se=I.$$.callbacks[M];if(se){const oe=Ju(M,L,{cancelable:j});return se.slice().forEach(Te=>{Te.call(I,oe)}),!oe.defaultPrevented}return!0}}function Pm(I,M){return Eo().$$.context.set(I,M),M}function Mm(I){return Eo().$$.context.get(I)}function Cm(I,M){const L=I.$$.callbacks[M.type];L&&L.slice().forEach(j=>j.call(this,M))}const ua=[],Kc=[];let pa=[];const Yc=[],gf=Promise.resolve();let Jc=!1;function _f(){Jc||(Jc=!0,gf.then(Qu))}function Ll(I){pa.push(I)}function km(I){Yc.push(I)}const Wc=new Set;let ha=0;function Qu(){if(ha!==0)return;const I=To;do{try{for(;haI.indexOf(j)===-1?M.push(j):L.push(j)),L.forEach(j=>j()),pa=M}let vo;function vf(){return vo||(vo=Promise.resolve(),vo.then(()=>{vo=null})),vo}function Hc(I,M,L){I.dispatchEvent(Ju(`${M?"intro":"outro"}${L}`))}const kl=new Set;let dn;function zm(){dn={r:0,c:[],p:dn}}function Dm(){dn.r||fa(dn.c),dn=dn.p}function bf(I,M){I&&I.i&&(kl.delete(I),I.i(M))}function Lm(I,M,L,j){if(I&&I.o){if(kl.has(I))return;kl.add(I),dn.c.push(()=>{kl.delete(I),j&&(L&&I.d(1),j())}),I.o(M)}else j&&j()}const wf={duration:0};function Bm(I,M,L,j){let oe=M(I,L,{direction:"both"}),Te=j?0:1,h=null,_e=null,Y=null,Qe;function ye(){Y&&ff(I,Y)}function _t(it,At){const kt=it.b-Te;return At*=Math.abs(kt),{a:Te,b:it.b,d:kt,duration:At,start:it.start,end:it.start+At,group:it.group}}function Et(it){const{delay:At=0,duration:kt=300,easing:nt=Yp,tick:Qt=Nn,css:mt}=oe||wf,_i={start:tf()+At,b:it};it||(_i.group=dn,dn.r+=1),"inert"in I&&(it?Qe!==void 0&&(I.inert=Qe):(Qe=I.inert,I.inert=!0)),h||_e?_e=_i:(mt&&(ye(),Y=qu(I,Te,it,kt,At,nt,mt)),it&&Qt(0,1),h=_t(_i,kt),Ll(()=>Hc(I,it,"start")),rf(Wt=>{if(_e&&Wt>_e.start&&(h=_t(_e,kt),_e=null,Hc(I,h.b,"start"),mt&&(ye(),Y=qu(I,Te,h.b,h.duration,0,nt,oe.css))),h){if(Wt>=h.end)Qt(Te=h.b,1-Te),Hc(I,h.b,"end"),_e||(h.b?ye():--h.group.r||fa(h.group.c)),h=null;else if(Wt>=h.start){const sr=Wt-h.start;Te=h.a+h.d*nt(sr/h.duration),Qt(Te,1-Te)}}return!!(h||_e)}))}return{run(it){eh(oe)?vf().then(()=>{oe=oe({direction:it?"in":"out"}),Et(it)}):Et(it)},end(){ye(),h=_e=null}}}function Rm(I,M,L){const j=I.$$.props[M];j!==void 0&&(I.$$.bound[j]=L,L(I.$$.ctx[j]))}function Fm(I){I&&I.c()}function Tf(I,M,L){const{fragment:j,after_update:se}=I.$$;j&&j.m(M,L),Ll(()=>{const oe=I.$$.on_mount.map(Gu).filter(eh);I.$$.on_destroy?I.$$.on_destroy.push(...oe):fa(oe),I.$$.on_mount=[]}),se.forEach(Ll)}function Ef(I,M){const L=I.$$;L.fragment!==null&&(xf(L.after_update),fa(L.on_destroy),L.fragment&&L.fragment.d(M),L.on_destroy=L.fragment=null,L.ctx=[])}function Sf(I,M){I.$$.dirty[0]===-1&&(ua.push(I),_f(),I.$$.dirty.fill(0)),I.$$.dirty[M/31|0]|=1<{const it=Et.length?Et[0]:_t;return Y.ctx&&se(Y.ctx[ye],Y.ctx[ye]=it)&&(!Y.skip_bound&&Y.bound[ye]&&Y.bound[ye](it),Qe&&Sf(I,ye)),_t}):[],Y.update(),Qe=!0,fa(Y.before_update),Y.fragment=j?j(Y.ctx):!1,M.target){if(M.hydrate){const ye=hf(M.target);Y.fragment&&Y.fragment.l(ye),ye.forEach(ih)}else Y.fragment&&Y.fragment.c();M.intro&&bf(I.$$.fragment),Tf(I,M.target,M.anchor),Qu()}wo(_e)}class Af{constructor(){Xc(this,"$$");Xc(this,"$$set")}$destroy(){Ef(this,1),this.$destroy=Nn}$on(M,L){if(!eh(L))return Nn;const j=this.$$.callbacks[M]||(this.$$.callbacks[M]=[]);return j.push(L),()=>{const se=j.indexOf(L);se!==-1&&j.splice(se,1)}}$set(M){this.$$set&&!ef(M)&&(this.$$.skip_bound=!0,this.$$set(M),this.$$.skip_bound=!1)}}const Pf="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Pf);var Mf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Om(I){return I&&I.__esModule&&Object.prototype.hasOwnProperty.call(I,"default")?I.default:I}function Um(I){if(I.__esModule)return I;var M=I.default;if(typeof M=="function"){var L=function j(){if(this instanceof j){var se=[null];se.push.apply(se,arguments);var oe=Function.bind.apply(M,se);return new oe}return M.apply(this,arguments)};L.prototype=M.prototype}else L={};return Object.defineProperty(L,"__esModule",{value:!0}),Object.keys(I).forEach(function(j){var se=Object.getOwnPropertyDescriptor(I,j);Object.defineProperty(L,j,se.get?se:{enumerable:!0,get:function(){return I[j]}})}),L}var ed={exports:{}};(function(I,M){(function(L,j){I.exports=j()})(Mf,function(){var L,j,se;function oe(h,_e){if(!L)L=_e;else if(!j)j=_e;else{var Y="var sharedChunk = {}; ("+L+")(sharedChunk); ("+j+")(sharedChunk);",Qe={};L(Qe),se=_e(Qe),typeof window<"u"&&(se.workerUrl=window.URL.createObjectURL(new Blob([Y],{type:"text/javascript"})))}}oe(["exports"],function(h){function _e(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Y=Qe;function Qe(i,e){this.x=i,this.y=e}Qe.prototype={clone:function(){return new Qe(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),s=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=s,this},_rotateAround:function(i,e){var r=Math.cos(i),s=Math.sin(i),l=e.y+s*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-s*(this.y-e.y),this.y=l,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},Qe.convert=function(i){return i instanceof Qe?i:Array.isArray(i)?new Qe(i[0],i[1]):i};var ye=_e(Y),_t=Et;function Et(i,e,r,s){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(s-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=s}Et.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,s=0;s<8;s++){var l=this.sampleCurveX(r)-i;if(Math.abs(l)l?d=r:f=r,r=.5*(f-d)+d;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};var it=_e(_t);function At(i,e,r,s){const l=new it(i,e,r,s);return function(u){return l.solve(u)}}const kt=At(.25,.1,.25,1);function nt(i,e,r){return Math.min(r,Math.max(e,i))}function Qt(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function mt(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let _i=1;function Wt(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function sr(i,e,r){const s={};for(const l in i)s[l]=e.call(r||this,i[l],l,i);return s}function fn(i,e,r){const s={};for(const l in i)e.call(r||this,i[l],l,i)&&(s[l]=i[l]);return s}function Ei(i){return Array.isArray(i)?i.map(Ei):typeof i=="object"&&i?sr(i,Ei):i}const Gr={};function ci(i){Gr[i]||(typeof console<"u"&&console.warn(i),Gr[i]=!0)}function gt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function ga(i){let e=0;for(let r,s,l=0,u=i.length,d=u-1;lcancelAnimationFrame(e)}},getImageData(i,e=0){return this.getImageCanvasContext(i).getImageData(-e,-e,i.width+2*e,i.height+2*e)},getImageCanvasContext(i){const e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=i.width,e.height=i.height,r.drawImage(i,0,0,i.width,i.height),r},resolveURL:i=>(mn||(mn=document.createElement("a")),mn.href=i,mn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Wr==null&&(Wr=matchMedia("(prefers-reduced-motion: reduce)")),Wr.matches)}},$n={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class Dr extends Error{constructor(e,r,s,l){super(`AJAXError: ${r} (${e}): ${s}`),this.status=e,this.statusText=r,this.url=s,this.body=l}}const yi=$i()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,qi=i=>$n.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function si(i,e){const r=new AbortController,s=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:yi(),signal:r.signal});let l=!1,u=!1;return i.type==="json"&&s.headers.set("Accept","application/json"),u||fetch(s).then(d=>d.ok?(f=>{(i.type==="arrayBuffer"||i.type==="image"?f.arrayBuffer():i.type==="json"?f.json():f.text()).then(g=>{u||(l=!0,e(null,g,f.headers.get("Cache-Control"),f.headers.get("Expires")))}).catch(g=>{u||e(new Error(g.message))})})(d):d.blob().then(f=>e(new Dr(d.status,d.statusText,i.url,f)))).catch(d=>{d.code!==20&&e(new Error(d.message))}),{cancel:()=>{u=!0,l||r.abort()}}}const _n=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if($i()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!$i())return(qi(i.url)||si)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(yi())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return si(i,e);if($i()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(s,l){const u=new XMLHttpRequest;u.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(u.responseType="arraybuffer");for(const d in s.headers)u.setRequestHeader(d,s.headers[d]);return s.type==="json"&&(u.responseType="text",u.setRequestHeader("Accept","application/json")),u.withCredentials=s.credentials==="include",u.onerror=()=>{l(new Error(u.statusText))},u.onload=()=>{if((u.status>=200&&u.status<300||u.status===0)&&u.response!==null){let d=u.response;if(s.type==="json")try{d=JSON.parse(u.response)}catch(f){return l(f)}l(null,d,u.getResponseHeader("Cache-Control"),u.getResponseHeader("Expires"))}else{const d=new Blob([u.response],{type:u.getResponseHeader("Content-Type")});l(new Dr(u.status,u.statusText,s.url,d))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},yn=function(i,e){return _n(mt(i,{type:"arrayBuffer"}),e)};function Hr(i){if(!i||i.indexOf("://")<=0||i.indexOf("data:image/")===0||i.indexOf("blob:")===0)return!0;const e=new URL(i),r=window.location;return e.protocol===r.protocol&&e.host===r.host}function Lr(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function xr(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class vr{constructor(e,r={}){mt(this,r),this.type=e}}class ji extends vr{constructor(e,r={}){super("error",mt({error:e},r))}}class xn{on(e,r){return this._listeners=this._listeners||{},Lr(e,r,this._listeners),this}off(e,r){return xr(e,r,this._listeners),xr(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Lr(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new vr(e,r||{}));const s=e.type;if(this.listens(s)){e.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const f of l)f.call(this,e);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const f of u)xr(s,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(mt(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof ji&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var le={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},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:{}},default:"mapbox"},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-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},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 Br=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function qn(i,e){const r={};for(const s in i)s!=="ref"&&(r[s]=i[s]);return Br.forEach(s=>{s in e&&(r[s]=e[s])}),r}function xt(i,e){if(Array.isArray(i)){if(!Array.isArray(e)||i.length!==e.length)return!1;for(let r=0;r`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Zn=[Rr,ve,Ye,He,Si,wr,Ht,ai(Xe),Yi,Tr];function or(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!or(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of Zn)if(!or(r,e))return null}}return`Expected ${wt(i)} but found ${wt(e)} instead.`}function V(i,e){return e.some(r=>r.kind===i.kind)}function S(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}function P(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const D=.96422,q=.82521,Z=4/29,J=6/29,W=3*J*J,G=J*J*J,ee=Math.PI/180,he=180/Math.PI;function de(i){return(i%=360)<0&&(i+=360),i}function ue([i,e,r,s]){let l,u;const d=Ge((.2225045*(i=Ne(i))+.7168786*(e=Ne(e))+.0606169*(r=Ne(r)))/1);i===e&&e===r?l=u=d:(l=Ge((.4360747*i+.3850649*e+.1430804*r)/D),u=Ge((.0139322*i+.0971045*e+.7141733*r)/q));const f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-u),s]}function Ne(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Ge(i){return i>G?Math.pow(i,1/3):i/W+Z}function Le([i,e,r,s]){let l=(i+16)/116,u=isNaN(e)?l:l+e/500,d=isNaN(r)?l:l-r/200;return l=1*Ze(l),u=D*Ze(u),d=q*Ze(d),[Oe(3.1338561*u-1.6168667*l-.4906146*d),Oe(-.9787684*u+1.9161415*l+.033454*d),Oe(.0719453*u-.2289914*l+1.4052427*d),s]}function Oe(i){return(i=i<=.00304?12.92*i:1.055*Math.pow(i,1/2.4)-.055)<0?0:i>1?1:i}function Ze(i){return i>J?i*i*i:W*(i-Z)}function st(i){return parseInt(i.padEnd(2,i),16)/255}function Je(i,e){return ot(e?i/100:i,0,1)}function ot(i,e,r){return Math.min(Math.max(e,i),r)}function vt(i){return!i.some(Number.isNaN)}const $t={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 je{constructor(e,r,s,l=1,u=!0){this.r=e,this.g=r,this.b=s,this.a=l,u||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[e,r,s,l]))}static parse(e){if(e instanceof je)return e;if(typeof e!="string")return;const r=function(s){if((s=s.toLowerCase())==="transparent")return[0,0,0,0];const l=$t[s];if(l){const[d,f,g]=l;return[d/255,f/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const d=s.length<6?1:2;let f=1;return[st(s.slice(f,f+=d)),st(s.slice(f,f+=d)),st(s.slice(f,f+=d)),st(s.slice(f,f+d)||"ff")]}if(s.startsWith("rgb")){const d=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[f,g,v,b,E,A,C,z,U,F,K,Q]=d,X=[b||" ",C||" ",F].join("");if(X===" "||X===" /"||X===",,"||X===",,,"){const ie=[v,A,U].join(""),ne=ie==="%%%"?100:ie===""?255:0;if(ne){const ce=[ot(+g/ne,0,1),ot(+E/ne,0,1),ot(+z/ne,0,1),K?Je(+K,Q):1];if(vt(ce))return ce}}return}}const u=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(u){const[d,f,g,v,b,E,A,C,z]=u,U=[g||" ",b||" ",A].join("");if(U===" "||U===" /"||U===",,"||U===",,,"){const F=[+f,ot(+v,0,100),ot(+E,0,100),C?Je(+C,z):1];if(vt(F))return function([K,Q,X,ie]){function ne(ce){const ze=(ce+K/30)%12,Be=Q*Math.min(X,1-X);return X-Be*Math.max(-1,Math.min(ze-3,9-ze,1))}return K=de(K),Q/=100,X/=100,[ne(0),ne(8),ne(4),ie]}(F)}}}(e);return r?new je(...r,!1):void 0}get rgb(){const{r:e,g:r,b:s,a:l}=this,u=l||1/0;return this.overwriteGetter("rgb",[e/u,r/u,s/u,l])}get hcl(){return this.overwriteGetter("hcl",function(e){const[r,s,l,u]=ue(e),d=Math.sqrt(s*s+l*l);return[Math.round(1e4*d)?de(Math.atan2(l,s)*he):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ue(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){const[e,r,s,l]=this.rgb;return`rgba(${[e,r,s].map(u=>Math.round(255*u)).join(",")},${l})`}}je.black=new je(0,0,0,1),je.white=new je(1,1,1,1),je.transparent=new je(0,0,0,0),je.red=new je(1,0,0,1);class zt{constructor(e,r,s){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Fr{constructor(e,r,s,l,u){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class oi{constructor(e){this.sections=e}static fromString(e){return new oi([new Fr(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof oi?e:oi.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class ki{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ki)return e;if(typeof e=="number")return new ki([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new ki(e)}}toString(){return JSON.stringify(this.values)}}class Zi{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Zi({name:e,available:!1}):null}}function wn(i,e,r,s){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[i,e,r,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[i,e,r,s]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ms(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof je||i instanceof zt||i instanceof oi||i instanceof ki||i instanceof Zi)return!0;if(Array.isArray(i)){for(const e of i)if(!ms(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ms(i[e]))return!1;return!0}return!1}function qt(i){if(i===null)return Rr;if(typeof i=="string")return Ye;if(typeof i=="boolean")return He;if(typeof i=="number")return ve;if(i instanceof je)return Si;if(i instanceof zt)return br;if(i instanceof oi)return wr;if(i instanceof ki)return Yi;if(i instanceof Zi)return Tr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=qt(s);if(r){if(r===l)continue;r=Xe;break}r=l}return ai(r||Xe,e)}return Ht}function Gn(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof je||i instanceof oi||i instanceof ki||i instanceof Zi?i.toString():JSON.stringify(i)}class Or{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ms(e[1]))return r.error("invalid value");const s=e[1];let l=qt(s);const u=r.expectedType;return l.kind!=="array"||l.N!==0||!u||u.kind!=="array"||typeof u.N=="number"&&u.N!==0||(l=u),new Or(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Rt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const gs={string:Ye,number:ve,boolean:He,object:Ht};class Ji{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let s,l=1;const u=e[0];if(u==="array"){let f,g;if(e.length>2){const v=e[1];if(typeof v!="string"||!(v in gs)||v==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=gs[v],l++}else f=Xe;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],l++}s=ai(f,g)}else{if(!gs[u])throw new Error(`Types doesn't contain name = ${u}`);s=gs[u]}const d=[];for(;le.outputDefined())}}const So={"to-boolean":He,"to-color":Si,"to-number":ve,"to-string":Ye};class li{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[0];if(!So[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return r.error("Expected one argument.");const l=So[s],u=[];for(let d=1;d4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:wn(r[0],r[1],r[2],r[3]),!s))return new je(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Rt(s||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const s of this.args){r=s.evaluate(e);const l=ki.parse(r);if(l)return l}throw new Rt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const s of this.args){if(r=s.evaluate(e),r===null)return 0;const l=Number(r);if(!isNaN(l))return l}throw new Rt(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?oi.fromString(Gn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Zi.fromString(Gn(this.args[0].evaluate(e))):Gn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const _a=["Unknown","Point","LineString","Polygon"];class _s{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"?_a[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=je.parse(e)),r}}class Ur{constructor(e,r,s=[],l,u=new bn,d=[]){this.registry=e,this.path=s,this.key=s.map(f=>`[${f}]`).join(""),this.scope=u,this.errors=d,this.expectedType=l,this._isConstant=r}parse(e,r,s,l,u={}){return r?this.concat(r,s,l)._parse(e,u):this._parse(e,u)}_parse(e,r){function s(l,u,d){return d==="assert"?new Ji(u,[l]):d==="coerce"?new li(u,[l]):l}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const l=e[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const u=this.registry[l];if(u){let d=u.parse(e,this);if(!d)return null;if(this.expectedType){const f=this.expectedType,g=d.type;if(f.kind!=="string"&&f.kind!=="number"&&f.kind!=="boolean"&&f.kind!=="object"&&f.kind!=="array"||g.kind!=="value")if(f.kind!=="color"&&f.kind!=="formatted"&&f.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(f.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(f,g))return null}else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"coerce");else d=s(d,f,r.typeAnnotation||"assert")}if(!(d instanceof Or)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new _s;try{d=new Or(d.type,d.evaluate(f))}catch(g){return this.error(g.message),null}}return d}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,s){const l=typeof e=="number"?this.path.concat(e):this.path,u=s?this.scope.concat(s):this.scope;return new Ur(this.registry,this._isConstant,l,r||null,u,this.errors)}error(e,...r){const s=`${this.key}${r.map(l=>`[${l}]`).join("")}`;this.errors.push(new hi(s,e))}checkSubtype(e,r){const s=or(e,r);return s&&this.error(s),s}}class dt{constructor(e,r,s){this.type=br,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return r.error("Collator options argument must be an object.");const l=r.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,He);if(!l)return null;const u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,He);if(!u)return null;let d=null;return s.locale&&(d=r.parse(s.locale,1,Ye),!d)?null:new dt(l,u,d)}evaluate(e){return new zt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const Vr=8192;function Xn(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function ys(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Io(i,e){const r=(180+i[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,l=Math.pow(2,e.z);return[Math.round(r*l*Vr),Math.round(s*l*Vr)]}function Ao(i,e,r){const s=i[0]-e[0],l=i[1]-e[1],u=i[0]-r[0],d=i[1]-r[1];return s*d-u*l==0&&s*u<=0&&l*d<=0}function ya(i,e){let r=!1;for(let d=0,f=e.length;d(s=i)[1]!=(u=g[v+1])[1]>s[1]&&s[0]<(u[0]-l[0])*(s[1]-l[1])/(u[1]-l[1])+l[0]&&(r=!r)}}var s,l,u;return r}function Po(i,e){for(let r=0;r0&&f<0||d<0&&f>0}function Ul(i,e,r){for(const v of r)for(let b=0;br[2]){const l=.5*s;let u=i[0]-r[0]>l?-s:r[0]-i[0]>l?s:0;u===0&&(u=i[0]-r[2]>l?-s:r[2]-i[0]>l?s:0),i[0]+=u}Xn(e,i)}function Co(i,e,r,s){const l=Math.pow(2,s.z)*Vr,u=[s.x*Vr,s.y*Vr],d=[];for(const f of i)for(const g of f){const v=[g.x+u[0],g.y+u[1]];wa(v,e,r,l),d.push(v)}return d}function ko(i,e,r,s){const l=Math.pow(2,s.z)*Vr,u=[s.x*Vr,s.y*Vr],d=[];for(const g of i){const v=[];for(const b of g){const E=[b.x+u[0],b.y+u[1]];Xn(e,E),v.push(E)}d.push(v)}if(e[2]-e[0]<=l/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const g of d)for(const v of g)wa(v,e,r,l)}var f;return d}class Er{constructor(e,r){this.type=He,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ms(e[1])){const s=e[1];if(s.type==="FeatureCollection")for(let l=0;l!Array.isArray(v)||v.length===e.length-1);let g=null;for(const[v,b]of f){g=new Ur(r.registry,vs,r.path,null,r.scope);const E=[];let A=!1;for(let C=1;C{return A=E,Array.isArray(A)?`(${A.map(wt).join(", ")})`:`(${wt(A.type)}...)`;var A}).join(" | "),b=[];for(let E=1;E{r=e?r&&vs(s):r&&s instanceof Or}),!!r&&Wn(i)&&bs(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Wn(i){if(i instanceof Gi&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Er)return!1;let e=!0;return i.eachChild(r=>{e&&!Wn(r)&&(e=!1)}),e}function Tn(i){if(i instanceof Gi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Tn(r)&&(e=!1)}),e}function bs(i,e){if(i instanceof Gi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!bs(s,e)&&(r=!1)}),r}function ws(i,e){const r=i.length-1;let s,l,u=0,d=r,f=0;for(;u<=d;)if(f=Math.floor((u+d)/2),s=i[f],l=i[f+1],s<=e){if(f===r||ee))throw new Rt("Input is not a number.");d=f-1}return 0}class En{constructor(e,r,s){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[l,u]of s)this.labels.push(l),this.outputs.push(u)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const s=r.parse(e[1],1,ve);if(!s)return null;const l=[];let u=null;r.expectedType&&r.expectedType.kind!=="value"&&(u=r.expectedType);for(let d=1;d=f)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',v);const E=r.parse(g,b,u);if(!E)return null;u=u||E.type,l.push([f,E])}return new En(u,s,l)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;return l>=r[u-1]?s[u-1].evaluate(e):s[ws(r,l)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Sn(i,e,r){return i+r*(e-i)}function Ts(i,e,r){return i.map((s,l)=>Sn(s,e[l],r))}const zi={number:Sn,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[l,u,d,f]=Ts(i.rgb,e.rgb,r);return new je(l,u,d,f,!1)}case"hcl":{const[l,u,d,f]=i.hcl,[g,v,b,E]=e.hcl;let A,C;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?A=NaN:(A=g,d!==1&&d!==0||(C=v)):(A=l,b!==1&&b!==0||(C=u));else{let Q=g-l;g>l&&Q>180?Q-=360:g180&&(Q+=360),A=l+r*Q}const[z,U,F,K]=function([Q,X,ie,ne]){return Q=isNaN(Q)?0:Q*ee,Le([ie,Math.cos(Q)*X,Math.sin(Q)*X,ne])}([A,C??Sn(u,v,r),Sn(d,b,r),Sn(f,E,r)]);return new je(z,U,F,K,!1)}case"lab":{const[l,u,d,f]=Le(Ts(i.lab,e.lab,r));return new je(l,u,d,f,!1)}}},array:Ts,padding:function(i,e,r){return new ki(Ts(i.values,e.values,r))}};class Di{constructor(e,r,s,l,u){this.type=e,this.operator=r,this.interpolation=s,this.input=l,this.labels=[],this.outputs=[];for(const[d,f]of u)this.labels.push(d),this.outputs.push(f)}static interpolationFactor(e,r,s,l){let u=0;if(e.name==="exponential")u=Ta(r,e.base,s,l);else if(e.name==="linear")u=Ta(r,1,s,l);else if(e.name==="cubic-bezier"){const d=e.controlPoints;u=new it(d[0],d[1],d[2],d[3]).solve(Ta(r,1,s,l))}return u}static parse(e,r){let[s,l,u,...d]=e;if(!Array.isArray(l)||l.length===0)return r.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const v=l[1];if(typeof v!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:v}}else{if(l[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const v=l.slice(1);if(v.length!==4||v.some(b=>typeof b!="number"||b<0||b>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:v}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(u=r.parse(u,2,ve),!u)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Si:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let v=0;v=b)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const z=r.parse(E,C,g);if(!z)return null;g=g||z.type,f.push([b,z])}return P(g,ve)||P(g,Si)||P(g,Yi)||P(g,ai(ve))?new Di(g,s,l,u,f):r.error(`Type ${wt(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,s=this.outputs;if(r.length===1)return s[0].evaluate(e);const l=this.input.evaluate(e);if(l<=r[0])return s[0].evaluate(e);const u=r.length;if(l>=r[u-1])return s[u-1].evaluate(e);const d=ws(r,l),f=Di.interpolationFactor(this.interpolation,l,r[d],r[d+1]),g=s[d].evaluate(e),v=s[d+1].evaluate(e);switch(this.operator){case"interpolate":return zi[this.type.kind](g,v,f);case"interpolate-hcl":return zi.color(g,v,f,"hcl");case"interpolate-lab":return zi.color(g,v,f,"lab")}}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Ta(i,e,r,s){const l=s-r,u=i-r;return l===0?0:e===1?u/l:(Math.pow(e,u)-1)/(Math.pow(e,l)-1)}class Es{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let s=null;const l=r.expectedType;l&&l.kind!=="value"&&(s=l);const u=[];for(const f of e.slice(1)){const g=r.parse(f,1+u.length,s,void 0,{typeAnnotation:"omit"});if(!g)return null;s=s||g.type,u.push(g)}if(!s)throw new Error("No output type");const d=l&&u.some(f=>or(l,f.type));return new Es(d?Xe:s,u)}evaluate(e){let r,s=null,l=0;for(const u of this.args)if(l++,s=u.evaluate(e),s&&s instanceof Zi&&!s.available&&(r||(r=s.name),s=null,l===this.args.length&&(s=r)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Ss{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let u=1;u=s.length)throw new Rt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Rt(`Array index must be an integer, but found ${r} instead.`);return s[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class Hn{constructor(e,r){this.type=He,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Xe),l=r.parse(e[2],2,Xe);return s&&l?V(s.type,[He,Ye,ve,Rr,Xe])?new Hn(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${wt(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!S(r,["boolean","string","number","null"]))throw new Rt(`Expected first argument to be of type boolean, string, number or null, but found ${wt(qt(r))} instead.`);if(!S(s,["string","array"]))throw new Rt(`Expected second argument to be of type array or string, but found ${wt(qt(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Qr{constructor(e,r,s){this.type=ve,this.needle=e,this.haystack=r,this.fromIndex=s}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Xe),l=r.parse(e[2],2,Xe);if(!s||!l)return null;if(!V(s.type,[He,Ye,ve,Rr,Xe]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${wt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ve);return u?new Qr(s,l,u):null}return new Qr(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!S(r,["boolean","string","number","null"]))throw new Rt(`Expected first argument to be of type boolean, string, number or null, but found ${wt(qt(r))} instead.`);if(!S(s,["string","array"]))throw new Rt(`Expected second argument to be of type array or string, but found ${wt(qt(s))} instead.`);if(this.fromIndex){const l=this.fromIndex.evaluate(e);return s.indexOf(r,l)}return s.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class lt{constructor(e,r,s,l,u,d){this.inputType=e,this.type=r,this.input=s,this.cases=l,this.outputs=u,this.otherwise=d}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let s,l;r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);const u={},d=[];for(let v=2;vNumber.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return A.error("Numeric branch labels must be integer values.");if(s){if(A.checkSubtype(s,qt(z)))return null}else s=qt(z);if(u[String(z)]!==void 0)return A.error("Branch labels must be unique.");u[String(z)]=d.length}const C=r.parse(E,v,l);if(!C)return null;l=l||C.type,d.push(C)}const f=r.parse(e[1],1,Xe);if(!f)return null;const g=r.parse(e[e.length-1],e.length-1,l);return g?f.type.kind!=="value"&&r.concat(1).checkSubtype(s,f.type)?null:new lt(s,l,f,u,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(qt(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class Sa{constructor(e,r,s){this.type=e,this.branches=r,this.otherwise=s}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let s;r.expectedType&&r.expectedType.kind!=="value"&&(s=r.expectedType);const l=[];for(let d=1;dr.outputDefined())&&this.otherwise.outputDefined()}}class Is{constructor(e,r,s,l){this.type=e,this.input=r,this.beginIndex=s,this.endIndex=l}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const s=r.parse(e[1],1,Xe),l=r.parse(e[2],2,ve);if(!s||!l)return null;if(!V(s.type,[ai(Xe),Ye,Xe]))return r.error(`Expected first argument to be of type array or string, but found ${wt(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,ve);return u?new Is(s.type,s,l,u):null}return new Is(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!S(r,["string","array"]))throw new Rt(`Expected first argument to be of type array or string, but found ${wt(qt(r))} instead.`);if(this.endIndex){const l=this.endIndex.evaluate(e);return r.slice(s,l)}return r.slice(s)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function zo(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Do(i,e,r,s){return s.compare(e,r)===0}function In(i,e,r){const s=i!=="=="&&i!=="!=";return class td{constructor(u,d,f){this.type=He,this.lhs=u,this.rhs=d,this.collator=f,this.hasUntypedArgument=u.type.kind==="value"||d.type.kind==="value"}static parse(u,d){if(u.length!==3&&u.length!==4)return d.error("Expected two or three arguments.");const f=u[0];let g=d.parse(u[1],1,Xe);if(!g)return null;if(!zo(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${wt(g.type)}'.`);let v=d.parse(u[2],2,Xe);if(!v)return null;if(!zo(f,v.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${wt(v.type)}'.`);if(g.type.kind!==v.type.kind&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error(`Cannot compare types '${wt(g.type)}' and '${wt(v.type)}'.`);s&&(g.type.kind==="value"&&v.type.kind!=="value"?g=new Ji(v.type,[g]):g.type.kind!=="value"&&v.type.kind==="value"&&(v=new Ji(g.type,[v])));let b=null;if(u.length===4){if(g.type.kind!=="string"&&v.type.kind!=="string"&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error("Cannot use collator to compare non-string types.");if(b=d.parse(u[3],3,br),!b)return null}return new td(g,v,b)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=qt(d),v=qt(f);if(g.kind!==v.kind||g.kind!=="string"&&g.kind!=="number")throw new Rt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${v.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=qt(d),v=qt(f);if(g.kind!=="string"||v.kind!=="string")return e(u,d,f)}return this.collator?r(u,d,f,this.collator.evaluate(u)):e(u,d,f)}eachChild(u){u(this.lhs),u(this.rhs),this.collator&&u(this.collator)}outputDefined(){return!0}}}const Nl=In("==",function(i,e,r){return e===r},Do),$l=In("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!Do(0,e,r,s)}),ql=In("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),Zl=In("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),Gl=In(">=",function(i,e,r){return e>=r},function(i,e,r,s){return s.compare(e,r)>=0});class Ia{constructor(e,r,s,l,u){this.type=Ye,this.number=e,this.locale=r,this.currency=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const s=r.parse(e[1],1,ve);if(!s)return null;const l=e[2];if(typeof l!="object"||Array.isArray(l))return r.error("NumberFormat options argument must be an object.");let u=null;if(l.locale&&(u=r.parse(l.locale,1,Ye),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,Ye),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,ve),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,ve),!g)?null:new Ia(s,u,d,f,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class As{constructor(e){this.type=wr,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return r.error("First argument must be an image or text section.");const l=[];let u=!1;for(let d=1;d<=e.length-1;++d){const f=e[d];if(u&&typeof f=="object"&&!Array.isArray(f)){u=!1;let g=null;if(f["font-scale"]&&(g=r.parse(f["font-scale"],1,ve),!g))return null;let v=null;if(f["text-font"]&&(v=r.parse(f["text-font"],1,ai(Ye)),!v))return null;let b=null;if(f["text-color"]&&(b=r.parse(f["text-color"],1,Si),!b))return null;const E=l[l.length-1];E.scale=g,E.font=v,E.textColor=b}else{const g=r.parse(e[d],1,Xe);if(!g)return null;const v=g.type.kind;if(v!=="string"&&v!=="value"&&v!=="null"&&v!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");u=!0,l.push({content:g,scale:null,font:null,textColor:null})}}return new As(l)}evaluate(e){return new oi(this.sections.map(r=>{const s=r.content.evaluate(e);return qt(s)===Tr?new Fr("",s,null,null,null):new Fr(Gn(s),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class Aa{constructor(e){this.type=Tr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Ye);return s?new Aa(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=Zi.fromString(r);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(r)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Pa{constructor(e){this.type=ve,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=r.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${wt(s.type)} instead.`):new Pa(s):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new Rt(`Expected value to be of type string or array, but found ${wt(qt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const An={"==":Nl,"!=":$l,">":jl,"<":ql,">=":Gl,"<=":Zl,array:Ji,at:Ea,boolean:Ji,case:Sa,coalesce:Es,collator:dt,format:As,image:Aa,in:Hn,"index-of":Qr,interpolate:Di,"interpolate-hcl":Di,"interpolate-lab":Di,length:Pa,let:Ss,literal:Or,match:lt,number:Ji,"number-format":Ia,object:Ji,slice:Is,step:En,string:Ji,"to-boolean":li,"to-color":li,"to-number":li,"to-string":li,var:xs,within:Er};function Lo(i,[e,r,s,l]){e=e.evaluate(i),r=r.evaluate(i),s=s.evaluate(i);const u=l?l.evaluate(i):1,d=wn(e,r,s,u);if(d)throw new Rt(d);return new je(e/255,r/255,s/255,u,!1)}function Bo(i,e){return i in e}function Ma(i,e){const r=e[i];return r===void 0?null:r}function en(i){return{type:i}}function Ro(i){return{result:"success",value:i}}function Pn(i){return{result:"error",value:i}}function Mn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Fo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Ca(i){return!!i.expression&&i.expression.interpolated}function ft(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Ps(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Xl(i){return i}function Oo(i,e){const r=e.type==="color",s=i.stops&&typeof i.stops[0][0]=="object",l=s||!(s||i.property!==void 0),u=i.type||(Ca(e)?"exponential":"interval");if(r||e.type==="padding"){const b=r?je.parse:ki.parse;(i=ar({},i)).stops&&(i.stops=i.stops.map(E=>[E[0],b(E[1])])),i.default=b(i.default?i.default:e.default)}if(i.colorSpace&&(d=i.colorSpace)!=="rgb"&&d!=="hcl"&&d!=="lab")throw new Error(`Unknown color space: "${i.colorSpace}"`);var d;let f,g,v;if(u==="exponential")f=Uo;else if(u==="interval")f=ka;else if(u==="categorical"){f=Wl,g=Object.create(null);for(const b of i.stops)g[b[0]]=b[1];v=typeof i.stops[0][0]}else{if(u!=="identity")throw new Error(`Unknown function type "${u}"`);f=Hl}if(s){const b={},E=[];for(let z=0;zz[0]),evaluate:({zoom:z},U)=>Uo({stops:A,base:i.base},e,z).evaluate(z,U)}}if(l){const b=u==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:b,interpolationFactor:Di.interpolationFactor.bind(void 0,b),zoomStops:i.stops.map(E=>E[0]),evaluate:({zoom:E})=>f(i,e,E,g,v)}}return{kind:"source",evaluate(b,E){const A=E&&E.properties?E.properties[i.property]:void 0;return A===void 0?Kn(i.default,e.default):f(i,e,A,g,v)}}}function Kn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Wl(i,e,r,s,l){return Kn(typeof r===l?s[r]:void 0,i.default,e.default)}function ka(i,e,r){if(ft(r)!=="number")return Kn(i.default,e.default);const s=i.stops.length;if(s===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[s-1][0])return i.stops[s-1][1];const l=ws(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function Uo(i,e,r){const s=i.base!==void 0?i.base:1;if(ft(r)!=="number")return Kn(i.default,e.default);const l=i.stops.length;if(l===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[l-1][0])return i.stops[l-1][1];const u=ws(i.stops.map(b=>b[0]),r),d=function(b,E,A,C){const z=C-A,U=b-A;return z===0?0:E===1?U/z:(Math.pow(E,U)-1)/(Math.pow(E,z)-1)}(r,s,i.stops[u][0],i.stops[u+1][0]),f=i.stops[u][1],g=i.stops[u+1][1],v=zi[e.type]||Xl;return typeof f.evaluate=="function"?{evaluate(...b){const E=f.evaluate.apply(void 0,b),A=g.evaluate.apply(void 0,b);if(E!==void 0&&A!==void 0)return v(E,A,d,i.colorSpace)}}:v(f,g,d,i.colorSpace)}function Hl(i,e,r){switch(e.type){case"color":r=je.parse(r);break;case"formatted":r=oi.fromString(r.toString());break;case"resolvedImage":r=Zi.fromString(r.toString());break;case"padding":r=ki.parse(r);break;default:ft(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Kn(r,i.default,e.default)}Gi.register(An,{error:[{kind:"error"},[Ye],(i,[e])=>{throw new Rt(e.evaluate(i))}],typeof:[Ye,[Xe],(i,[e])=>wt(qt(e.evaluate(i)))],"to-rgba":[ai(ve,4),[Si],(i,[e])=>{const[r,s,l,u]=e.evaluate(i).rgb;return[255*r,255*s,255*l,u]}],rgb:[Si,[ve,ve,ve],Lo],rgba:[Si,[ve,ve,ve,ve],Lo],has:{type:He,overloads:[[[Ye],(i,[e])=>Bo(e.evaluate(i),i.properties())],[[Ye,Ht],(i,[e,r])=>Bo(e.evaluate(i),r.evaluate(i))]]},get:{type:Xe,overloads:[[[Ye],(i,[e])=>Ma(e.evaluate(i),i.properties())],[[Ye,Ht],(i,[e,r])=>Ma(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Xe,[Ye],(i,[e])=>Ma(e.evaluate(i),i.featureState||{})],properties:[Ht,[],i=>i.properties()],"geometry-type":[Ye,[],i=>i.geometryType()],id:[Xe,[],i=>i.id()],zoom:[ve,[],i=>i.globals.zoom],"heatmap-density":[ve,[],i=>i.globals.heatmapDensity||0],"line-progress":[ve,[],i=>i.globals.lineProgress||0],accumulated:[Xe,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[ve,en(ve),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[ve,en(ve),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:ve,overloads:[[[ve,ve],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[ve],(i,[e])=>-e.evaluate(i)]]},"/":[ve,[ve,ve],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[ve,[ve,ve],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[ve,[],()=>Math.LN2],pi:[ve,[],()=>Math.PI],e:[ve,[],()=>Math.E],"^":[ve,[ve,ve],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[ve,[ve],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[ve,[ve],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[ve,[ve],(i,[e])=>Math.log(e.evaluate(i))],log2:[ve,[ve],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[ve,[ve],(i,[e])=>Math.sin(e.evaluate(i))],cos:[ve,[ve],(i,[e])=>Math.cos(e.evaluate(i))],tan:[ve,[ve],(i,[e])=>Math.tan(e.evaluate(i))],asin:[ve,[ve],(i,[e])=>Math.asin(e.evaluate(i))],acos:[ve,[ve],(i,[e])=>Math.acos(e.evaluate(i))],atan:[ve,[ve],(i,[e])=>Math.atan(e.evaluate(i))],min:[ve,en(ve),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[ve,en(ve),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[ve,[ve],(i,[e])=>Math.abs(e.evaluate(i))],round:[ve,[ve],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[ve,[ve],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[ve,[ve],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[He,[Ye,Xe],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[He,[Xe],(i,[e])=>i.id()===e.value],"filter-type-==":[He,[Ye],(i,[e])=>i.geometryType()===e.value],"filter-<":[He,[Ye,Xe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s{const r=i.id(),s=e.value;return typeof r==typeof s&&r":[He,[Ye,Xe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[He,[Xe],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[He,[Ye,Xe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[He,[Xe],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[He,[Ye,Xe],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[He,[Xe],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[He,[Xe],(i,[e])=>e.value in i.properties()],"filter-has-id":[He,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[He,[ai(Ye)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[He,[ai(Xe)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[He,[Ye,ai(Xe)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[He,[Ye,ai(Xe)],(i,[e,r])=>function(s,l,u,d){for(;u<=d;){const f=u+d>>1;if(l[f]===s)return!0;l[f]>s?d=f-1:u=f+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:He,overloads:[[[He,He],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[en(He),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:He,overloads:[[[He,He],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[en(He),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[He,[He],(i,[e])=>!e.evaluate(i)],"is-supported-script":[He,[Ye],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Ye,[Ye],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Ye,[Ye],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Ye,en(Xe),(i,e)=>e.map(r=>Gn(r.evaluate(i))).join("")],"resolved-locale":[Ye,[br],(i,[e])=>e.evaluate(i).resolvedLocale()]});class za{constructor(e,r){var s;this.expression=e,this._warningHistory={},this._evaluator=new _s,this._defaultValue=r?(s=r).type==="color"&&Ps(s.default)?new je(0,0,0,0):s.type==="color"?je.parse(s.default)||null:s.type==="padding"?ki.parse(s.default)||null:s.default===void 0?null:s.default:null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=s,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d,this.expression.evaluate(this._evaluator)}evaluate(e,r,s,l,u,d){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=s||null,this._evaluator.canonical=l,this._evaluator.availableImages=u||null,this._evaluator.formattedSection=d||null;try{const f=this.expression.evaluate(this._evaluator);if(f==null||typeof f=="number"&&f!=f)return this._defaultValue;if(this._enumValues&&!(f in this._enumValues))throw new Rt(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(f)} instead.`);return f}catch(f){return this._warningHistory[f.message]||(this._warningHistory[f.message]=!0,typeof console<"u"&&console.warn(f.message)),this._defaultValue}}}function Ms(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in An}function Ct(i,e){const r=new Ur(An,vs,[],e?function(l){const u={color:Si,string:Ye,number:ve,enum:Ye,boolean:He,formatted:wr,padding:Yi,resolvedImage:Tr};return l.type==="array"?ai(u[l.value]||Xe,l.length):u[l.type]}(e):void 0),s=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Ro(new za(s,e)):Pn(r.errors)}class Da{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Tn(r.expression)}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}}class rt{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Tn(r.expression),this.interpolationType=l}evaluateWithoutErrorHandling(e,r,s,l,u,d){return this._styleExpression.evaluateWithoutErrorHandling(e,r,s,l,u,d)}evaluate(e,r,s,l,u,d){return this._styleExpression.evaluate(e,r,s,l,u,d)}interpolationFactor(e,r,s){return this.interpolationType?Di.interpolationFactor(this.interpolationType,e,r,s):0}}function Cs(i,e){const r=Ct(i,e);if(r.result==="error")return r;const s=r.value.expression,l=Wn(s);if(!l&&!Mn(e))return Pn([new hi("","data expressions not supported")]);const u=bs(s,["zoom"]);if(!u&&!Fo(e))return Pn([new hi("","zoom expressions not supported")]);const d=bt(s);return d||u?d instanceof hi?Pn([d]):d instanceof Di&&!Ca(e)?Pn([new hi("",'"interpolate" expressions cannot be used with this property')]):Ro(d?new rt(l?"camera":"composite",r.value,d.labels,d instanceof Di?d.interpolation:void 0):new Da(l?"constant":"source",r.value)):Pn([new hi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Tt{constructor(e,r){this._parameters=e,this._specification=r,ar(this,Oo(this._parameters,this._specification))}static deserialize(e){return new Tt(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function bt(i){let e=null;if(i instanceof Ss)e=bt(i.result);else if(i instanceof Es){for(const r of i.args)if(e=bt(r),e)break}else(i instanceof En||i instanceof Di)&&i.input instanceof Gi&&i.input.name==="zoom"&&(e=i);return e instanceof hi||i.eachChild(r=>{const s=bt(r);s instanceof hi?e=s:!e&&s?e=new hi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new hi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Cn(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Cn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Vo={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function La(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Cn(i)||(i=ks(i));const e=Ct(i,Vo);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,s,l)=>e.value.evaluate(r,s,{},l),needGeometry:No(i)}}function Kl(i,e){return ie?1:0}function No(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?zs(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(ks))):e==="all"?["all"].concat(i.slice(1).map(ks)):e==="none"?["all"].concat(i.slice(1).map(ks).map(Yn)):e==="in"?Ba(i[1],i.slice(2)):e==="!in"?Yn(Ba(i[1],i.slice(2))):e==="has"?Ra(i[1]):e==="!has"?Yn(Ra(i[1])):e!=="within"||i;var r}function zs(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Ba(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Kl)]]:["filter-in-small",i,["literal",e]]}}function Ra(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Yn(i){return["!",i]}function Jn(i){const e=typeof i;if(e==="number"||e==="boolean"||e==="string"||i==null)return JSON.stringify(i);if(Array.isArray(i)){let l="[";for(const u of i)l+=`${Jn(u)},`;return`${l}]`}const r=Object.keys(i).sort();let s="{";for(let l=0;ls.maximum?[new be(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function jo(i){const e=i.valueSpec,r=Ft(i.value.type);let s,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,v=ft(i.value.stops)==="array"&&ft(i.value.stops[0])==="array"&&ft(i.value.stops[0][0])==="object",b=Xi({key:i.key,value:i.value,valueSpec:i.styleSpec.function,validateSpec:i.validateSpec,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(C){if(r==="identity")return[new be(C.key,C.value,'identity function may not have a "stops" property')];let z=[];const U=C.value;return z=z.concat(qo({key:C.key,value:U,valueSpec:C.valueSpec,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,arrayElementValidator:E})),ft(U)==="array"&&U.length===0&&z.push(new be(C.key,U,"array must have at least one stop")),z},default:function(C){return C.validateSpec({key:C.key,value:C.value,valueSpec:e,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec})}}});return r==="identity"&&f&&b.push(new be(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||b.push(new be(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Ca(i.valueSpec)&&b.push(new be(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Mn(i.valueSpec)?b.push(new be(i.key,i.value,"property functions not supported")):f&&!Fo(i.valueSpec)&&b.push(new be(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!v||i.value.property!==void 0||b.push(new be(i.key,i.value,'"property" property is required')),b;function E(C){let z=[];const U=C.value,F=C.key;if(ft(U)!=="array")return[new be(F,U,`array expected, ${ft(U)} found`)];if(U.length!==2)return[new be(F,U,`array length 2 expected, length ${U.length} found`)];if(v){if(ft(U[0])!=="object")return[new be(F,U,`object expected, ${ft(U[0])} found`)];if(U[0].zoom===void 0)return[new be(F,U,"object stop key must have zoom")];if(U[0].value===void 0)return[new be(F,U,"object stop key must have value")];if(u&&u>Ft(U[0].zoom))return[new be(F,U[0].zoom,"stop zoom values must appear in ascending order")];Ft(U[0].zoom)!==u&&(u=Ft(U[0].zoom),l=void 0,d={}),z=z.concat(Xi({key:`${F}[0]`,value:U[0],valueSpec:{zoom:{}},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,objectElementValidators:{zoom:Fa,value:A}}))}else z=z.concat(A({key:`${F}[0]`,value:U[0],valueSpec:{},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec},U));return Ms(tn(U[1]))?z.concat([new be(`${F}[1]`,U[1],"expressions are not allowed in function stops.")]):z.concat(C.validateSpec({key:`${F}[1]`,value:U[1],valueSpec:e,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec}))}function A(C,z){const U=ft(C.value),F=Ft(C.value),K=C.value!==null?C.value:z;if(s){if(U!==s)return[new be(C.key,K,`${U} stop domain type must match previous stop domain type ${s}`)]}else s=U;if(U!=="number"&&U!=="string"&&U!=="boolean")return[new be(C.key,K,"stop domain value must be a number, string, or boolean")];if(U!=="number"&&r!=="categorical"){let Q=`number expected, ${U} found`;return Mn(e)&&r===void 0&&(Q+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new be(C.key,K,Q)]}return r!=="categorical"||U!=="number"||isFinite(F)&&Math.floor(F)===F?r!=="categorical"&&U==="number"&&l!==void 0&&Fnew be(`${i.key}${s.key}`,i.value,s.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new be(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Tn(r))return[new be(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Tn(r))return[new be(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!bs(r,["zoom","feature-state"]))return[new be(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Wn(r))return[new be(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Qn(i){const e=i.key,r=i.value,s=i.valueSpec,l=[];return Array.isArray(s.values)?s.values.indexOf(Ft(r))===-1&&l.push(new be(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf(Ft(r))===-1&&l.push(new be(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function kn(i){return Cn(tn(i.value))?rn(ar({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Zo(i)}function Zo(i){const e=i.value,r=i.key;if(ft(e)!=="array")return[new be(r,e,`array expected, ${ft(e)} found`)];const s=i.styleSpec;let l,u=[];if(e.length<1)return[new be(r,e,"filter array must have at least 1 element")];switch(u=u.concat(Qn({key:`${r}[0]`,value:e[0],valueSpec:s.filter_operator,style:i.style,styleSpec:i.styleSpec})),Ft(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ft(e[1])==="$type"&&u.push(new be(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new be(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=ft(e[1]),l!=="string"&&u.push(new be(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;d{v in r&&e.push(new be(s,r[v],`"${v}" is prohibited for ref layers`))}),l.layers.forEach(v=>{Ft(v.id)===f&&(g=v)}),g?g.ref?e.push(new be(s,r.ref,"ref cannot reference another ref layer")):d=Ft(g.type):e.push(new be(s,r.ref,`ref layer "${f}" not found`))}else if(d!=="background")if(r.source){const g=l.sources&&l.sources[r.source],v=g&&Ft(g.type);g?v==="vector"&&d==="raster"?e.push(new be(s,r.source,`layer "${r.id}" requires a raster source`)):v==="raster"&&d!=="raster"?e.push(new be(s,r.source,`layer "${r.id}" requires a vector source`)):v!=="vector"||r["source-layer"]?v==="raster-dem"&&d!=="hillshade"?e.push(new be(s,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):d!=="line"||!r.paint||!r.paint["line-gradient"]||v==="geojson"&&g.lineMetrics||e.push(new be(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new be(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new be(s,r.source,`source "${r.source}" not found`))}else e.push(new be(s,r,'missing required property "source"'));return e=e.concat(Xi({key:s,value:r,valueSpec:u.layer,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,objectElementValidators:{"*":()=>[],type:()=>i.validateSpec({key:`${s}.type`,value:r.type,valueSpec:u.layer.type,style:i.style,styleSpec:i.styleSpec,validateSpec:i.validateSpec,object:r,objectKey:"type"}),filter:kn,layout:g=>Xi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Go(ar({layerType:d},v))}}),paint:g=>Xi({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Ua(ar({layerType:d},v))}})}})),e}function lr(i){const e=i.value,r=i.key,s=ft(e);return s!=="string"?[new be(r,e,`string expected, ${s} found`)]:[]}const Ls={promoteId:function({key:i,value:e}){if(ft(e)==="string")return lr({key:i,value:e});{const r=[];for(const s in e)r.push(...lr({key:`${i}.${s}`,value:e[s]}));return r}}};function Bs(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,u=i.validateSpec;if(!e.type)return[new be(r,e,'"type" is required')];const d=Ft(e.type);let f;switch(d){case"vector":case"raster":case"raster-dem":return f=Xi({key:r,value:e,valueSpec:s[`source_${d.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:Ls,validateSpec:u}),f;case"geojson":if(f=Xi({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:u,objectElementValidators:Ls}),e.cluster)for(const g in e.clusterProperties){const[v,b]=e.clusterProperties[g],E=typeof v=="string"?[v,["accumulated"],["get",g]]:v;f.push(...rn({key:`${r}.${g}.map`,value:b,validateSpec:u,expressionContext:"cluster-map"})),f.push(...rn({key:`${r}.${g}.reduce`,value:E,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return Xi({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:u,styleSpec:s});case"image":return Xi({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:u,styleSpec:s});case"canvas":return[new be(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Qn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:l,validateSpec:u,styleSpec:s})}}function Xo(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let u=[];const d=ft(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new be("light",e,`object expected, ${d} found`)]),u;for(const f in e){const g=f.match(/^(.*)-transition$/);u=u.concat(g&&s[g[1]]&&s[g[1]].transition?i.validateSpec({key:f,value:e[f],valueSpec:r.transition,validateSpec:i.validateSpec,style:l,styleSpec:r}):s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new be(f,e[f],`unknown property "${f}"`)])}return u}function es(i){const e=i.value,r=i.styleSpec,s=r.terrain,l=i.style;let u=[];const d=ft(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new be("terrain",e,`object expected, ${d} found`)]),u;for(const f in e)u=u.concat(s[f]?i.validateSpec({key:f,value:e[f],valueSpec:s[f],validateSpec:i.validateSpec,style:l,styleSpec:r}):[new be(f,e[f],`unknown property "${f}"`)]);return u}function Wo(i){let e=[];const r=i.value,s=i.key;if(Array.isArray(r)){const l=[],u=[];for(const d in r)r[d].id&&l.includes(r[d].id)&&e.push(new be(s,r,`all the sprites' ids must be unique, but ${r[d].id} is duplicated`)),l.push(r[d].id),r[d].url&&u.includes(r[d].url)&&e.push(new be(s,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),e=e.concat(Xi({key:`${s}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return lr({key:s,value:r})}const Ho={"*":()=>[],array:qo,boolean:function(i){const e=i.value,r=i.key,s=ft(e);return s!=="boolean"?[new be(r,e,`boolean expected, ${s} found`)]:[]},number:Fa,color:function(i){const e=i.key,r=i.value,s=ft(r);return s!=="string"?[new be(e,r,`color expected, ${s} found`)]:je.parse(String(r))?[]:[new be(e,r,`color expected, "${r}" found`)]},constants:$o,enum:Qn,filter:kn,function:jo,layer:Ds,object:Xi,source:Bs,light:Xo,terrain:es,string:lr,formatted:function(i){return lr(i).length===0?[]:rn(i)},resolvedImage:function(i){return lr(i).length===0?[]:rn(i)},padding:function(i){const e=i.key,r=i.value;if(ft(r)==="array"){if(r.length<1||r.length>4)return[new be(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const s={type:"number"};let l=[];for(let u=0;u[]}})),i.constants&&(r=r.concat($o({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:ts}))),is(r)}function Wi(i){return function(e){return i({...e,validateSpec:ts})}}function is(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function jt(i){return function(...e){return is(i.apply(this,e))}}cr.source=jt(Wi(Bs)),cr.sprite=jt(Wi(Wo)),cr.glyphs=jt(Wi(Ko)),cr.light=jt(Wi(Xo)),cr.terrain=jt(Wi(es)),cr.layer=jt(Wi(Ds)),cr.filter=jt(Wi(kn)),cr.paintProperty=jt(Wi(Ua)),cr.layoutProperty=jt(Wi(Go));const Nr=cr,Jl=Nr.light,Ql=Nr.paintProperty,ec=Nr.layoutProperty;function zn(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new ji(new Error(s.message))),r=!0;return r}class rs{constructor(e,r,s){const l=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const d=new Int32Array(this.arrayBuffer);e=d[0],this.d=(r=d[1])+2*(s=d[2]);for(let g=0;g=E[z+0]&&l>=E[z+1])?(f[C]=!0,d.push(b[C])):f[C]=!1}}}}_forEachCell(e,r,s,l,u,d,f,g){const v=this._convertToCellCoord(e),b=this._convertToCellCoord(r),E=this._convertToCellCoord(s),A=this._convertToCellCoord(l);for(let C=v;C<=E;C++)for(let z=b;z<=A;z++){const U=this.d*z+C;if((!g||g(this._convertFromCellCoord(C),this._convertFromCellCoord(z),this._convertFromCellCoord(C+1),this._convertFromCellCoord(z+1)))&&u.call(this,e,r,s,l,U,d,f,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let s=0;for(let d=0;d=0)continue;const d=i[u];l[u]=hr[s].shallow.indexOf(u)>=0?d:ns(d,e)}i instanceof Error&&(l.message=i.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(l.$name=s),l}throw new Error("can't serialize object of type "+typeof i)}function Sr(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Rs(i)||Xr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Sr);if(typeof i=="object"){const e=i.$name||"Object";if(!hr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=hr[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const s=Object.create(r.prototype);for(const l of Object.keys(i)){if(l==="$name")continue;const u=i[l];s[l]=hr[e].shallow.indexOf(l)>=0?u:Sr(u)}return s}throw new Error("can't deserialize object of type "+typeof i)}class Yo{constructor(){this.first=!0}update(e,r){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=r):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Fs(i){for(const e of i)if(Os(e.charCodeAt(0)))return!0;return!1}function Va(i){for(const e of i)if(!Jo(e.charCodeAt(0)))return!1;return!0}function Jo(i){return!(Ae.Arabic(i)||Ae["Arabic Supplement"](i)||Ae["Arabic Extended-A"](i)||Ae["Arabic Presentation Forms-A"](i)||Ae["Arabic Presentation Forms-B"](i))}function Os(i){return!(i!==746&&i!==747&&(i<4352||!(Ae["Bopomofo Extended"](i)||Ae.Bopomofo(i)||Ae["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Ae["CJK Compatibility Ideographs"](i)||Ae["CJK Compatibility"](i)||Ae["CJK Radicals Supplement"](i)||Ae["CJK Strokes"](i)||!(!Ae["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Ae["CJK Unified Ideographs Extension A"](i)||Ae["CJK Unified Ideographs"](i)||Ae["Enclosed CJK Letters and Months"](i)||Ae["Hangul Compatibility Jamo"](i)||Ae["Hangul Jamo Extended-A"](i)||Ae["Hangul Jamo Extended-B"](i)||Ae["Hangul Jamo"](i)||Ae["Hangul Syllables"](i)||Ae.Hiragana(i)||Ae["Ideographic Description Characters"](i)||Ae.Kanbun(i)||Ae["Kangxi Radicals"](i)||Ae["Katakana Phonetic Extensions"](i)||Ae.Katakana(i)&&i!==12540||!(!Ae["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Ae["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Ae["Unified Canadian Aboriginal Syllabics"](i)||Ae["Unified Canadian Aboriginal Syllabics Extended"](i)||Ae["Vertical Forms"](i)||Ae["Yijing Hexagram Symbols"](i)||Ae["Yi Syllables"](i)||Ae["Yi Radicals"](i))))}function Qo(i){return!(Os(i)||function(e){return!!(Ae["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Ae["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Ae["Letterlike Symbols"](e)||Ae["Number Forms"](e)||Ae["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Ae["Control Pictures"](e)&&e!==9251||Ae["Optical Character Recognition"](e)||Ae["Enclosed Alphanumerics"](e)||Ae["Geometric Shapes"](e)||Ae["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ae["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ae["CJK Symbols and Punctuation"](e)||Ae.Katakana(e)||Ae["Private Use Area"](e)||Ae["CJK Compatibility Forms"](e)||Ae["Small Form Variants"](e)||Ae["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Us(i){return i>=1424&&i<=2303||Ae["Arabic Presentation Forms-A"](i)||Ae["Arabic Presentation Forms-B"](i)}function Vs(i,e){return!(!e&&Us(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Ae.Khmer(i))}function el(i){for(const e of i)if(Us(e.charCodeAt(0)))return!0;return!1}const Na="deferred",Ns="loading",$a="loaded";let ss=null,Ii="unavailable",$r=null;const tl=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Ii="error"),ss&&ss(i)};function qa(){$s.fire(new vr("pluginStateChange",{pluginStatus:Ii,pluginURL:$r}))}const $s=new xn,ja=function(){return Ii},il=function(){if(Ii!==Na||!$r)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ii=Ns,qa(),$r&&yn({url:$r},i=>{i?tl(i):(Ii=$a,qa())})},Hi={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ii===$a||Hi.applyArabicShaping!=null,isLoading:()=>Ii===Ns,setState(i){if(!$i())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Ii=i.pluginStatus,$r=i.pluginURL},isParsed(){if(!$i())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Hi.applyArabicShaping!=null&&Hi.processBidirectionalText!=null&&Hi.processStyledBidirectionalText!=null},getPluginURL(){if(!$i())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return $r}};class Pt{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Yo,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!Vs(l.charCodeAt(0),s))return!1;return!0}(e,Hi.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*r}}}class qs{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(Ps(s))return new Tt(s,l);if(Ms(s)){const u=Cs(s,l);if(u.result==="error")throw new Error(u.value.map(d=>`${d.key}: ${d.message}`).join(", "));return u.value}{let u=s;return l.type==="color"&&typeof s=="string"?u=je.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)||(u=ki.parse(s)),{kind:"constant",evaluate:()=>u}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,s){return this.property.possiblyEvaluate(this,e,r,s)}}class Za{constructor(e){this.property=e,this.value=new qs(e,void 0)}transitioned(e,r){return new as(this.property,this.value,r,mt({},e.transition,this.transition),e.now)}untransitioned(){return new as(this.property,this.value,null,{},0)}}class rl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ei(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Za(this._values[e].property)),this._values[e].value=new qs(this._values[e].property,r===null?void 0:Ei(r))}getTransition(e){return Ei(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Za(this._values[e].property)),this._values[e].transition=Ei(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s);const l=this.getTransition(r);l!==void 0&&(e[`${r}-transition`]=l)}return e}transitioned(e,r){const s=new nl(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].transitioned(e,r._values[l]);return s}untransitioned(){const e=new nl(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class as{constructor(e,r,s,l,u){this.property=e,this.value=r,this.begin=u+l.delay||0,this.end=this.begin+l.duration||0,e.specification.transition&&(l.delay||l.duration)&&(this.prior=s)}possiblyEvaluate(e,r,s){const l=e.now||0,u=this.value.possiblyEvaluate(e,r,s),d=this.prior;if(d){if(l>this.end)return this.prior=null,u;if(this.value.isDataDriven())return this.prior=null,u;if(l=1)return 1;const v=g*g,b=v*g;return 4*(g<.5?b:3*(g-v)+b-.75)}(f))}}return u}}class nl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new js(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Ga{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return Ei(this._values[e].value)}setValue(e,r){this._values[e]=new qs(this._values[e].property,r===null?void 0:Ei(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const s=this.getValue(r);s!==void 0&&(e[r]=s)}return e}possiblyEvaluate(e,r,s){const l=new js(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}}class ur{constructor(e,r,s){this.property=e,this.value=r,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,s,l){return this.property.evaluate(this.value,this.parameters,e,r,s,l)}}class js{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Fe{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,s){const l=zi[this.specification.type];return l?l(e,r,s):e}}class $e{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new ur(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},s,l)}:e.expression,r)}interpolate(e,r,s){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new ur(this,{kind:"constant",value:void 0},e.parameters);const l=zi[this.specification.type];if(l){const u=l(e.value.value,r.value.value,s);return new ur(this,{kind:"constant",value:u},e.parameters)}return e}evaluate(e,r,s,l,u,d){return e.kind==="constant"?e.value:e.evaluate(r,s,l,u,d)}}class os extends $e{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new ur(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l),d=e.property.specification.type==="resolvedImage"&&typeof u!="string"?u.name:u,f=this._calculate(d,d,d,r);return new ur(this,{kind:"constant",value:f},r)}if(e.expression.kind==="camera"){const u=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new ur(this,{kind:"constant",value:u},r)}return new ur(this,e.expression,r)}evaluate(e,r,s,l,u,d){if(e.kind==="source"){const f=e.evaluate(r,s,l,u,d);return this._calculate(f,f,f,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},s,l),e.evaluate({zoom:Math.floor(r.zoom)},s,l),e.evaluate({zoom:Math.floor(r.zoom)+1},s,l),r):e.value}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Xa{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){if(e.value!==void 0){if(e.expression.kind==="constant"){const u=e.expression.evaluate(r,null,{},s,l);return this._calculate(u,u,u,r)}return this._calculate(e.expression.evaluate(new Pt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Pt(Math.floor(r.zoom),r)),e.expression.evaluate(new Pt(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,s,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:s,to:r}}interpolate(e){return e}}class Wa{constructor(e){this.specification=e}possiblyEvaluate(e,r,s,l){return!!e.expression.evaluate(r,null,{},s,l)}interpolate(){return!1}}class Ai{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const s=e[r];s.specification.overridable&&this.overridableProperties.push(r);const l=this.defaultPropertyValues[r]=new qs(s,void 0),u=this.defaultTransitionablePropertyValues[r]=new Za(s);this.defaultTransitioningPropertyValues[r]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=l.possiblyEvaluate({})}}}De("DataDrivenProperty",$e),De("DataConstantProperty",Fe),De("CrossFadedDataDrivenProperty",os),De("CrossFadedProperty",Xa),De("ColorRampProperty",Wa);const sl="-transition";class dr extends xn{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Ga(r.layout)),r.paint)){this._transitionablePaint=new rl(r.paint);for(const s in e.paint)this.setPaintProperty(s,e.paint[s],{validate:!1});for(const s in e.layout)this.setLayoutProperty(s,e.layout[s],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new js(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,s={}){r!=null&&this._validate(ec,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(sl)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(Ql,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(sl))return this._transitionablePaint.setTransition(e.slice(0,-11),r||void 0),!1;{const l=this._transitionablePaint._values[e],u=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),f=l.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||d||u||this._handleOverridablePaintPropertyUpdate(e,f,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,s){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),fn(e,(r,s)=>!(r===void 0||s==="layout"&&!Object.keys(r).length||s==="paint"&&!Object.keys(r).length))}_validate(e,r,s,l,u={}){return(!u||u.validate!==!1)&&zn(this,e.call(Nr,{key:r,layerType:this.type,objectKey:s,value:l,styleSpec:le,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof ur&&Mn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const tc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ir{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Dt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Zt(i,e=1){let r=0,s=0;return{members:i.map(l=>{const u=tc[l.type].BYTES_PER_ELEMENT,d=r=al(r,Math.max(e,u)),f=l.components||1;return s=Math.max(s,u),r+=u*f,{name:l.name,type:l.type,components:f,offset:d}}),size:al(r,Math.max(s,e)),alignment:e}}function al(i,e){return Math.ceil(i/e)*e}class Dn extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.int16[l+0]=r,this.int16[l+1]=s,e}}Dn.prototype.bytesPerElement=4,De("StructArrayLayout2i4",Dn);class Zs extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.int16[u+0]=r,this.int16[u+1]=s,this.int16[u+2]=l,e}}Zs.prototype.bytesPerElement=6,De("StructArrayLayout3i6",Zs);class Ha extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.int16[d+0]=r,this.int16[d+1]=s,this.int16[d+2]=l,this.int16[d+3]=u,e}}Ha.prototype.bytesPerElement=8,De("StructArrayLayout4i8",Ha);class pr extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}pr.prototype.bytesPerElement=12,De("StructArrayLayout2i4i12",pr);class Gs extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=4*e,v=8*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.uint8[v+4]=l,this.uint8[v+5]=u,this.uint8[v+6]=d,this.uint8[v+7]=f,e}}Gs.prototype.bytesPerElement=8,De("StructArrayLayout2i4ub8",Gs);class nn extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.float32[l+0]=r,this.float32[l+1]=s,e}}nn.prototype.bytesPerElement=8,De("StructArrayLayout2f8",nn);class Xs extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,s,l,u,d,f,g,v,b)}emplace(e,r,s,l,u,d,f,g,v,b,E){const A=10*e;return this.uint16[A+0]=r,this.uint16[A+1]=s,this.uint16[A+2]=l,this.uint16[A+3]=u,this.uint16[A+4]=d,this.uint16[A+5]=f,this.uint16[A+6]=g,this.uint16[A+7]=v,this.uint16[A+8]=b,this.uint16[A+9]=E,e}}Xs.prototype.bytesPerElement=20,De("StructArrayLayout10ui20",Xs);class ls extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,v,b,E,A){const C=this.length;return this.resize(C+1),this.emplace(C,e,r,s,l,u,d,f,g,v,b,E,A)}emplace(e,r,s,l,u,d,f,g,v,b,E,A,C){const z=12*e;return this.int16[z+0]=r,this.int16[z+1]=s,this.int16[z+2]=l,this.int16[z+3]=u,this.uint16[z+4]=d,this.uint16[z+5]=f,this.uint16[z+6]=g,this.uint16[z+7]=v,this.int16[z+8]=b,this.int16[z+9]=E,this.int16[z+10]=A,this.int16[z+11]=C,e}}ls.prototype.bytesPerElement=24,De("StructArrayLayout4i4ui4i24",ls);class Ka extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.float32[u+0]=r,this.float32[u+1]=s,this.float32[u+2]=l,e}}Ka.prototype.bytesPerElement=12,De("StructArrayLayout3f12",Ka);class Ln extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}Ln.prototype.bytesPerElement=4,De("StructArrayLayout1ul4",Ln);class sn extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,v){const b=this.length;return this.resize(b+1),this.emplace(b,e,r,s,l,u,d,f,g,v)}emplace(e,r,s,l,u,d,f,g,v,b){const E=10*e,A=5*e;return this.int16[E+0]=r,this.int16[E+1]=s,this.int16[E+2]=l,this.int16[E+3]=u,this.int16[E+4]=d,this.int16[E+5]=f,this.uint32[A+3]=g,this.uint16[E+8]=v,this.uint16[E+9]=b,e}}sn.prototype.bytesPerElement=20,De("StructArrayLayout6i1ul2ui20",sn);class Ya extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d){const f=this.length;return this.resize(f+1),this.emplace(f,e,r,s,l,u,d)}emplace(e,r,s,l,u,d,f){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=s,this.int16[g+2]=l,this.int16[g+3]=u,this.int16[g+4]=d,this.int16[g+5]=f,e}}Ya.prototype.bytesPerElement=12,De("StructArrayLayout2i2i2i12",Ya);class Ws extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u){const d=this.length;return this.resize(d+1),this.emplace(d,e,r,s,l,u)}emplace(e,r,s,l,u,d){const f=4*e,g=8*e;return this.float32[f+0]=r,this.float32[f+1]=s,this.float32[f+2]=l,this.int16[g+6]=u,this.int16[g+7]=d,e}}Ws.prototype.bytesPerElement=16,De("StructArrayLayout2f1f2i16",Ws);class an extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=12*e,f=3*e;return this.uint8[d+0]=r,this.uint8[d+1]=s,this.float32[f+1]=l,this.float32[f+2]=u,e}}an.prototype.bytesPerElement=12,De("StructArrayLayout2ub2f12",an);class Hs extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=3*e;return this.uint16[u+0]=r,this.uint16[u+1]=s,this.uint16[u+2]=l,e}}Hs.prototype.bytesPerElement=6,De("StructArrayLayout3ui6",Hs);class Ja extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,v,b,E,A,C,z,U,F,K){const Q=this.length;return this.resize(Q+1),this.emplace(Q,e,r,s,l,u,d,f,g,v,b,E,A,C,z,U,F,K)}emplace(e,r,s,l,u,d,f,g,v,b,E,A,C,z,U,F,K,Q){const X=24*e,ie=12*e,ne=48*e;return this.int16[X+0]=r,this.int16[X+1]=s,this.uint16[X+2]=l,this.uint16[X+3]=u,this.uint32[ie+2]=d,this.uint32[ie+3]=f,this.uint32[ie+4]=g,this.uint16[X+10]=v,this.uint16[X+11]=b,this.uint16[X+12]=E,this.float32[ie+7]=A,this.float32[ie+8]=C,this.uint8[ne+36]=z,this.uint8[ne+37]=U,this.uint8[ne+38]=F,this.uint32[ie+10]=K,this.int16[X+22]=Q,e}}Ja.prototype.bytesPerElement=48,De("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ja);class Ks extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l,u,d,f,g,v,b,E,A,C,z,U,F,K,Q,X,ie,ne,ce,ze,Be,Pe,Se,we,Me){const Ie=this.length;return this.resize(Ie+1),this.emplace(Ie,e,r,s,l,u,d,f,g,v,b,E,A,C,z,U,F,K,Q,X,ie,ne,ce,ze,Be,Pe,Se,we,Me)}emplace(e,r,s,l,u,d,f,g,v,b,E,A,C,z,U,F,K,Q,X,ie,ne,ce,ze,Be,Pe,Se,we,Me,Ie){const ge=34*e,Ve=17*e;return this.int16[ge+0]=r,this.int16[ge+1]=s,this.int16[ge+2]=l,this.int16[ge+3]=u,this.int16[ge+4]=d,this.int16[ge+5]=f,this.int16[ge+6]=g,this.int16[ge+7]=v,this.uint16[ge+8]=b,this.uint16[ge+9]=E,this.uint16[ge+10]=A,this.uint16[ge+11]=C,this.uint16[ge+12]=z,this.uint16[ge+13]=U,this.uint16[ge+14]=F,this.uint16[ge+15]=K,this.uint16[ge+16]=Q,this.uint16[ge+17]=X,this.uint16[ge+18]=ie,this.uint16[ge+19]=ne,this.uint16[ge+20]=ce,this.uint16[ge+21]=ze,this.uint16[ge+22]=Be,this.uint32[Ve+12]=Pe,this.float32[Ve+13]=Se,this.float32[Ve+14]=we,this.float32[Ve+15]=Me,this.float32[Ve+16]=Ie,e}}Ks.prototype.bytesPerElement=68,De("StructArrayLayout8i15ui1ul4f68",Ks);class Ys extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}Ys.prototype.bytesPerElement=4,De("StructArrayLayout1f4",Ys);class Js extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,r,s)}emplace(e,r,s,l){const u=4*e;return this.uint32[2*e+0]=r,this.uint16[u+2]=s,this.uint16[u+3]=l,e}}Js.prototype.bytesPerElement=8,De("StructArrayLayout1ul2ui8",Js);class o extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const s=this.length;return this.resize(s+1),this.emplace(s,e,r)}emplace(e,r,s){const l=2*e;return this.uint16[l+0]=r,this.uint16[l+1]=s,e}}o.prototype.bytesPerElement=4,De("StructArrayLayout2ui4",o);class t extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}t.prototype.bytesPerElement=2,De("StructArrayLayout1ui2",t);class n extends Dt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,r,s,l)}emplace(e,r,s,l,u){const d=4*e;return this.float32[d+0]=r,this.float32[d+1]=s,this.float32[d+2]=l,this.float32[d+3]=u,e}}n.prototype.bytesPerElement=16,De("StructArrayLayout4f16",n);class a extends Ir{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 ye(this.anchorPointX,this.anchorPointY)}}a.prototype.size=20;class c extends sn{get(e){return new a(this,e)}}De("CollisionBoxArray",c);class p extends Ir{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}p.prototype.size=48;class m extends Ja{get(e){return new p(this,e)}}De("PlacedSymbolArray",m);class y extends Ir{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}y.prototype.size=68;class _ extends Ks{get(e){return new y(this,e)}}De("SymbolInstanceArray",_);class x extends Ys{getoffsetX(e){return this.float32[1*e+0]}}De("GlyphOffsetArray",x);class T extends Zs{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}De("SymbolLineVertexArray",T);class w extends Ir{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]}}w.prototype.size=8;class k extends Js{get(e){return new w(this,e)}}De("FeatureIndexArray",k);class O extends Dn{}class B extends Dn{}class R extends Dn{}class $ extends pr{}class H extends Gs{}class re extends nn{}class N extends Xs{}class te extends ls{}class ae extends Ka{}class pe extends Ln{}class me extends Ya{}class xe extends an{}class fe extends Hs{}class Ce extends o{}const Ue=Zt([{name:"a_pos",components:2,type:"Int16"}],4),{members:We}=Ue;class Ee{constructor(e=[]){this.segments=e}prepareSegment(e,r,s,l){let u=this.segments[this.segments.length-1];return e>Ee.MAX_VERTEX_ARRAY_LENGTH&&ci(`Max vertices per segment is ${Ee.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>Ee.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==l)&&(u={vertexOffset:r.length,primitiveOffset:s.length,vertexLength:0,primitiveLength:0},l!==void 0&&(u.sortKey=l),this.segments.push(u)),u}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,s,l){return new Ee([{vertexOffset:e,primitiveOffset:r,vertexLength:s,primitiveLength:l,vaos:{},sortKey:0}])}}function qe(i,e){return 256*(i=nt(Math.floor(i),0,255))+nt(Math.floor(e),0,255)}Ee.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,De("SegmentVector",Ee);const ke=Zt([{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 ct={exports:{}},Ot={exports:{}};Ot.exports=function(i,e){var r,s,l,u,d,f,g,v;for(s=i.length-(r=3&i.length),l=e,d=3432918353,f=461845907,v=0;v>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295)<<13|l>>>19))+((5*(l>>>16)&65535)<<16)&4294967295))+((58964+(u>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(v+2))<<16;case 2:g^=(255&i.charCodeAt(v+1))<<8;case 1:l^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(v)))*d+(((g>>>16)*d&65535)<<16)&4294967295)<<15|g>>>17))*f+(((g>>>16)*f&65535)<<16)&4294967295}return l^=i.length,l=2246822507*(65535&(l^=l>>>16))+((2246822507*(l>>>16)&65535)<<16)&4294967295,l=3266489909*(65535&(l^=l>>>13))+((3266489909*(l>>>16)&65535)<<16)&4294967295,(l^=l>>>16)>>>0};var ht=Ot.exports,Ke={exports:{}};Ke.exports=function(i,e){for(var r,s=i.length,l=e^s,u=0;s>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(u)|(255&i.charCodeAt(++u))<<8|(255&i.charCodeAt(++u))<<16|(255&i.charCodeAt(++u))<<24))+((1540483477*(r>>>16)&65535)<<16),l=1540483477*(65535&l)+((1540483477*(l>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),s-=4,++u;switch(s){case 3:l^=(255&i.charCodeAt(u+2))<<16;case 2:l^=(255&i.charCodeAt(u+1))<<8;case 1:l=1540483477*(65535&(l^=255&i.charCodeAt(u)))+((1540483477*(l>>>16)&65535)<<16)}return l=1540483477*(65535&(l^=l>>>13))+((1540483477*(l>>>16)&65535)<<16),(l^=l>>>15)>>>0};var Lt=ht,xi=Ke.exports;ct.exports=Lt,ct.exports.murmur3=Lt,ct.exports.murmur2=xi;var Ut=_e(ct.exports);class ei{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Li(e)),this.positions.push(r,s,l)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Li(e);let s=0,l=this.ids.length-1;for(;s>1;this.ids[d]>=r?l=d:s=d+1}const u=[];for(;this.ids[s]===r;)u.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return u}static serialize(e,r){const s=new Float64Array(e.ids),l=new Uint32Array(e.positions);return Qi(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new ei;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Li(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Ut(String(i))}function Qi(i,e,r,s){for(;r>1];let u=r-1,d=s+1;for(;;){do u++;while(i[u]l);if(u>=d)break;er(i,u,d),er(e,3*u,3*d),er(e,3*u+1,3*d+1),er(e,3*u+2,3*d+2)}d-r`u_${l}`),this.type=s}setUniform(e,r,s){e.set(s.constantOr(this.value))}getBinding(e,r,s){return this.type==="color"?new ui(e,r):new fr(e,r)}}class ii{constructor(e,r){this.uniformNames=r.map(s=>`u_${s}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,s,l){const u=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;u&&e.set(u)}getBinding(e,r,s){return s.substr(0,9)==="u_pattern"?new cs(e,r):new fr(e,r)}}class pt{constructor(e,r,s,l){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=r.map(u=>({name:`a_${u}`,type:"Float32",components:s==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(e,r,s,l,u){const d=this.paintVertexArray.length,f=this.expression.evaluate(new Pt(0),r,{},l,[],u);this.paintVertexArray.resize(e),this._setPaintValue(d,e,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:0},s,l);this._setPaintValue(e,r,u)}_setPaintValue(e,r,s){if(this.type==="color"){const l=ut(s);for(let u=e;u`u_${f}_t`),this.type=s,this.useIntegerZoom=l,this.zoom=u,this.maxValue=0,this.paintVertexAttributes=r.map(f=>({name:`a_${f}`,type:"Float32",components:s==="color"?4:2,offset:0})),this.paintVertexArray=new d}populatePaintArray(e,r,s,l,u){const d=this.expression.evaluate(new Pt(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new Pt(this.zoom+1),r,{},l,[],u),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,d,f)}updatePaintArray(e,r,s,l){const u=this.expression.evaluate({zoom:this.zoom},s,l),d=this.expression.evaluate({zoom:this.zoom+1},s,l);this._setPaintValue(e,r,u,d)}_setPaintValue(e,r,s,l){if(this.type==="color"){const u=ut(s),d=ut(l);for(let f=e;f`#define HAS_UNIFORM_${l}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const s=this.binders[r];if(s instanceof pt||s instanceof Yt)for(let l=0;l!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new Qs(l,r,s);this.needsUpload=!1,this._featureMap=new ei,this._bufferOffset=0}populatePaintArrays(e,r,s,l,u,d){for(const f in this.programConfigurations)this.programConfigurations[f].populatePaintArrays(e,r,l,u,d);r.id!==void 0&&this._featureMap.add(r.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,s,l){for(const u of s)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(e,this._featureMap,r,u,l)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function ic(i,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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function ol(i,e,r){const s={color:{source:nn,composite:n},number:{source:Ys,composite:nn}},l=function(u){return{"line-pattern":{source:N,composite:N},"fill-pattern":{source:N,composite:N},"fill-extrusion-pattern":{source:N,composite:N}}[u]}(i);return l&&l[r]||s[e][r]}De("ConstantBinder",Kt),De("CrossFadedConstantBinder",ii),De("SourceExpressionBinder",pt),De("CrossFadedCompositeBinder",Bi),De("CompositeExpressionBinder",Yt),De("ProgramConfiguration",Qs,{omit:["_buffers"]}),De("ProgramConfigurationSet",Ar);var St=8192;const Qa=Math.pow(2,14)-1,hs=-Qa-1;function Pr(i){const e=St/i.extent,r=i.loadGeometry();for(let s=0;sd.x+1||gd.y+1)&&ci("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function us(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Pr(i):[]}}function ll(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class rc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new B,this.indexArray=new fe,this.segments=new Ee,this.programConfigurations=new Ar(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){const l=this.layers[0],u=[];let d=null,f=!1;l.type==="circle"&&(d=l.layout.get("circle-sort-key"),f=!d.isConstant());for(const{feature:g,id:v,index:b,sourceLayerIndex:E}of e){const A=this.layers[0]._featureFilter.needGeometry,C=us(g,A);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),C,s))continue;const z=f?d.evaluate(C,{},s):void 0,U={id:v,properties:g.properties,type:g.type,sourceLayerIndex:E,index:b,geometry:A?C.geometry:Pr(g),patterns:{},sortKey:z};u.push(U)}f&&u.sort((g,v)=>g.sortKey-v.sortKey);for(const g of u){const{geometry:v,index:b,sourceLayerIndex:E}=g,A=e[b].feature;this.addFeature(g,v,b,s),r.featureIndex.insert(A,v,b,E,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,We),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,s,l){for(const u of r)for(const d of u){const f=d.x,g=d.y;if(f<0||f>=St||g<0||g>=St)continue;const v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),b=v.vertexLength;ll(this.layoutVertexArray,f,g,-1,-1),ll(this.layoutVertexArray,f,g,1,-1),ll(this.layoutVertexArray,f,g,1,1),ll(this.layoutVertexArray,f,g,-1,1),this.indexArray.emplaceBack(b,b+1,b+2),this.indexArray.emplaceBack(b,b+3,b+2),v.vertexLength+=4,v.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{},l)}}function uh(i,e){for(let r=0;r1){if(nc(i,e))return!0;for(let s=0;s1?r:r.sub(e)._mult(l)._add(e))}function fh(i,e){let r,s,l,u=!1;for(let d=0;de.y!=l.y>e.y&&e.x<(l.x-s.x)*(e.y-s.y)/(l.y-s.y)+s.x&&(u=!u)}return u}function ea(i,e){let r=!1;for(let s=0,l=i.length-1;se.y!=d.y>e.y&&e.x<(d.x-u.x)*(e.y-u.y)/(d.y-u.y)+u.x&&(r=!r)}return r}function md(i,e,r){const s=r[0],l=r[2];if(i.xl.x&&e.x>l.x||i.yl.y&&e.y>l.y)return!1;const u=gt(i,e,r[0]);return u!==gt(i,e,r[1])||u!==gt(i,e,r[2])||u!==gt(i,e,r[3])}function eo(i,e,r){const s=e.paint.get(i).value;return s.kind==="constant"?s.value:r.programConfigurations.get(e.id).getMaxValue(i)}function cl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function hl(i,e,r,s,l){if(!e[0]&&!e[1])return i;const u=ye.convert(e)._mult(l);r==="viewport"&&u._rotate(-s);const d=[];for(let f=0;fi.width||l.height>i.height||r.x>i.width-l.width||r.y>i.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>e.width||l.height>e.height||s.x>e.width-l.width||s.y>e.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const d=i.data,f=e.data;if(d===f)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g{e[i.evaluationKey]=g;const v=i.expression.evaluate(e);l.data[d+f+0]=Math.floor(255*v.r/v.a),l.data[d+f+1]=Math.floor(255*v.g/v.a),l.data[d+f+2]=Math.floor(255*v.b/v.a),l.data[d+f+3]=Math.floor(255*v.a)};if(i.clips)for(let d=0,f=0;d80*r){s=u=i[0],l=d=i[1];for(var z=r;zu&&(u=f),g>d&&(d=g);v=(v=Math.max(u-s,d-l))!==0?32767/v:0}return ro(A,C,r,s,l,v,0),C}function Eh(i,e,r,s,l){var u,d;if(l===dc(i,e,r,s)>0)for(u=e;u=e;u-=s)d=Ah(u,i[u],i[u+1],d);return d&&pl(d,d.next)&&(so(d),d=d.next),d}function ds(i,e){if(!i)return i;e||(e=i);var r,s=i;do if(r=!1,s.steiner||!pl(s,s.next)&&Vt(s.prev,s,s.next)!==0)s=s.next;else{if(so(s),(s=e=s.prev)===s.next)break;r=!0}while(r||s!==e);return e}function ro(i,e,r,s,l,u,d){if(i){!d&&u&&function(b,E,A,C){var z=b;do z.z===0&&(z.z=hc(z.x,z.y,E,A,C)),z.prevZ=z.prev,z.nextZ=z.next,z=z.next;while(z!==b);z.prevZ.nextZ=null,z.prevZ=null,function(U){var F,K,Q,X,ie,ne,ce,ze,Be=1;do{for(K=U,U=null,ie=null,ne=0;K;){for(ne++,Q=K,ce=0,F=0;F0||ze>0&&Q;)ce!==0&&(ze===0||!Q||K.z<=Q.z)?(X=K,K=K.nextZ,ce--):(X=Q,Q=Q.nextZ,ze--),ie?ie.nextZ=X:U=X,X.prevZ=ie,ie=X;K=Q}ie.nextZ=null,Be*=2}while(ne>1)}(z)}(i,s,l,u);for(var f,g,v=i;i.prev!==i.next;)if(f=i.prev,g=i.next,u?Td(i,s,l,u):wd(i))e.push(f.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),so(i),i=g.next,v=g.next;else if((i=g)===v){d?d===1?ro(i=Ed(ds(i),e,r),e,r,s,l,u,2):d===2&&Sd(i,e,r,s,l,u):ro(ds(i),e,r,s,l,u,1);break}}}function wd(i){var e=i.prev,r=i,s=i.next;if(Vt(e,r,s)>=0)return!1;for(var l=e.x,u=r.x,d=s.x,f=e.y,g=r.y,v=s.y,b=lu?l>d?l:d:u>d?u:d,C=f>g?f>v?f:v:g>v?g:v,z=s.next;z!==e;){if(z.x>=b&&z.x<=A&&z.y>=E&&z.y<=C&&ia(l,f,u,g,d,v,z.x,z.y)&&Vt(z.prev,z,z.next)>=0)return!1;z=z.next}return!0}function Td(i,e,r,s){var l=i.prev,u=i,d=i.next;if(Vt(l,u,d)>=0)return!1;for(var f=l.x,g=u.x,v=d.x,b=l.y,E=u.y,A=d.y,C=fg?f>v?f:v:g>v?g:v,F=b>E?b>A?b:A:E>A?E:A,K=hc(C,z,e,r,s),Q=hc(U,F,e,r,s),X=i.prevZ,ie=i.nextZ;X&&X.z>=K&&ie&&ie.z<=Q;){if(X.x>=C&&X.x<=U&&X.y>=z&&X.y<=F&&X!==l&&X!==d&&ia(f,b,g,E,v,A,X.x,X.y)&&Vt(X.prev,X,X.next)>=0||(X=X.prevZ,ie.x>=C&&ie.x<=U&&ie.y>=z&&ie.y<=F&&ie!==l&&ie!==d&&ia(f,b,g,E,v,A,ie.x,ie.y)&&Vt(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;X&&X.z>=K;){if(X.x>=C&&X.x<=U&&X.y>=z&&X.y<=F&&X!==l&&X!==d&&ia(f,b,g,E,v,A,X.x,X.y)&&Vt(X.prev,X,X.next)>=0)return!1;X=X.prevZ}for(;ie&&ie.z<=Q;){if(ie.x>=C&&ie.x<=U&&ie.y>=z&&ie.y<=F&&ie!==l&&ie!==d&&ia(f,b,g,E,v,A,ie.x,ie.y)&&Vt(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function Ed(i,e,r){var s=i;do{var l=s.prev,u=s.next.next;!pl(l,u)&&Sh(l,s,s.next,u)&&no(l,u)&&no(u,l)&&(e.push(l.i/r|0),e.push(s.i/r|0),e.push(u.i/r|0),so(s),so(s.next),s=i=u),s=s.next}while(s!==i);return ds(s)}function Sd(i,e,r,s,l,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&Cd(d,f)){var g=Ih(d,f);return d=ds(d,d.next),g=ds(g,g.next),ro(d,e,r,s,l,u,0),void ro(g,e,r,s,l,u,0)}f=f.next}d=d.next}while(d!==i)}function Id(i,e){return i.x-e.x}function Ad(i,e){var r=function(l,u){var d,f=u,g=l.x,v=l.y,b=-1/0;do{if(v<=f.y&&v>=f.next.y&&f.next.y!==f.y){var E=f.x+(v-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(E<=g&&E>b&&(b=E,d=f.x=f.x&&f.x>=z&&g!==f.x&&ia(vd.x||f.x===d.x&&Pd(d,f)))&&(d=f,F=A)),f=f.next;while(f!==C);return d}(i,e);if(!r)return e;var s=Ih(r,i);return ds(s,s.next),ds(r,r.next)}function Pd(i,e){return Vt(i.prev,i,e.prev)<0&&Vt(e.next,i,i.next)<0}function hc(i,e,r,s,l){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*l|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*l|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Md(i){var e=i,r=i;do(e.x=(i-d)*(u-f)&&(i-d)*(s-f)>=(r-d)*(e-f)&&(r-d)*(u-f)>=(l-d)*(s-f)}function Cd(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,s){var l=r;do{if(l.i!==r.i&&l.next.i!==r.i&&l.i!==s.i&&l.next.i!==s.i&&Sh(l,l.next,r,s))return!0;l=l.next}while(l!==r);return!1}(i,e)&&(no(i,e)&&no(e,i)&&function(r,s){var l=r,u=!1,d=(r.x+s.x)/2,f=(r.y+s.y)/2;do l.y>f!=l.next.y>f&&l.next.y!==l.y&&d<(l.next.x-l.x)*(f-l.y)/(l.next.y-l.y)+l.x&&(u=!u),l=l.next;while(l!==r);return u}(i,e)&&(Vt(i.prev,i,e.prev)||Vt(i,e.prev,e))||pl(i,e)&&Vt(i.prev,i,i.next)>0&&Vt(e.prev,e,e.next)>0)}function Vt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function pl(i,e){return i.x===e.x&&i.y===e.y}function Sh(i,e,r,s){var l=ml(Vt(i,e,r)),u=ml(Vt(i,e,s)),d=ml(Vt(r,s,i)),f=ml(Vt(r,s,e));return l!==u&&d!==f||!(l!==0||!fl(i,r,e))||!(u!==0||!fl(i,s,e))||!(d!==0||!fl(r,i,s))||!(f!==0||!fl(r,e,s))}function fl(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function ml(i){return i>0?1:i<0?-1:0}function no(i,e){return Vt(i.prev,i,i.next)<0?Vt(i,e,i.next)>=0&&Vt(i,i.prev,e)>=0:Vt(i,e,i.prev)<0||Vt(i,i.next,e)<0}function Ih(i,e){var r=new uc(i.i,i.x,i.y),s=new uc(e.i,e.x,e.y),l=i.next,u=e.prev;return i.next=e,e.prev=i,r.next=l,l.prev=r,s.next=r,r.prev=s,u.next=s,s.prev=u,s}function Ah(i,e,r,s){var l=new uc(i,e,r);return s?(l.next=s.next,l.prev=s,s.next.prev=l,s.next=l):(l.prev=l,l.next=l),l}function so(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function uc(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function dc(i,e,r,s){for(var l=0,u=e,d=r-s;u0&&r.holes.push(s+=i[l-1].length)}return r};var Ph=_e(cc.exports);function kd(i,e,r,s,l){Mh(i,e,r||0,s||i.length-1,l||zd)}function Mh(i,e,r,s,l){for(;s>r;){if(s-r>600){var u=s-r+1,d=e-r+1,f=Math.log(u),g=.5*Math.exp(2*f/3),v=.5*Math.sqrt(f*g*(u-g)/u)*(d-u/2<0?-1:1);Mh(i,e,Math.max(r,Math.floor(e-d*g/u+v)),Math.min(s,Math.floor(e+(u-d)*g/u+v)),l)}var b=i[e],E=r,A=s;for(ao(i,r,e),l(i[s],b)>0&&ao(i,r,s);E0;)A--}l(i[r],b)===0?ao(i,r,A):ao(i,++A,s),A<=e&&(r=A+1),e<=A&&(s=A-1)}}function ao(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function zd(i,e){return ie?1:0}function pc(i,e){const r=i.length;if(r<=1)return[i];const s=[];let l,u;for(let d=0;d1)for(let d=0;dr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new R,this.indexArray=new fe,this.indexArray2=new Ce,this.programConfigurations=new Ar(e.layers,e.zoom),this.segments=new Ee,this.segments2=new Ee,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=fc("fill",this.layers,r);const l=this.layers[0].layout.get("fill-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:v,sourceLayerIndex:b}of e){const E=this.layers[0]._featureFilter.needGeometry,A=us(f,E);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),A,s))continue;const C=u?l.evaluate(A,{},s,r.availableImages):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:b,index:v,geometry:E?A.geometry:Pr(f),patterns:{},sortKey:C};d.push(z)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:v,sourceLayerIndex:b}=f;if(this.hasPattern){const E=mc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,g,v,s,{});r.featureIndex.insert(e[v].feature,g,v,b,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,bd),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,s,l,u){for(const d of pc(r,500)){let f=0;for(const C of d)f+=C.length;const g=this.segments.prepareSegment(f,this.layoutVertexArray,this.indexArray),v=g.vertexLength,b=[],E=[];for(const C of d){if(C.length===0)continue;C!==d[0]&&E.push(b.length/2);const z=this.segments2.prepareSegment(C.length,this.layoutVertexArray,this.indexArray2),U=z.vertexLength;this.layoutVertexArray.emplaceBack(C[0].x,C[0].y),this.indexArray2.emplaceBack(U+C.length-1,U),b.push(C[0].x),b.push(C[0].y);for(let F=1;F>3}if(l--,s===1||s===2)u+=i.readSVarint(),d+=i.readSVarint(),s===1&&(e&&f.push(e),e=[]),e.push(new Od(u,d));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},ra.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,s=0,l=0,u=0,d=1/0,f=-1/0,g=1/0,v=-1/0;i.pos>3}if(s--,r===1||r===2)(l+=i.readSVarint())f&&(f=l),(u+=i.readSVarint())v&&(v=u);else if(r!==7)throw new Error("unknown command "+r)}return[d,g,f,v]},ra.prototype.toGeoJSON=function(i,e,r){var s,l,u=this.extent*Math.pow(2,r),d=this.extent*i,f=this.extent*e,g=this.loadGeometry(),v=ra.types[this.type];function b(C){for(var z=0;z>3;l=d===1?s.readString():d===2?s.readFloat():d===3?s.readDouble():d===4?s.readVarint64():d===5?s.readVarint():d===6?s.readSVarint():d===7?s.readBoolean():null}return l}(r))}Lh.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new Nd(this._pbf,e,this.extent,this._keys,this._values)};var qd=Dh;function jd(i,e,r){if(i===3){var s=new qd(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Bn.VectorTile=function(i,e){this.layers=i.readFields(jd,{},e)},Bn.VectorTileFeature=zh,Bn.VectorTileLayer=Dh;const Zd=Bn.VectorTileFeature.types,_c=Math.pow(2,13);function oo(i,e,r,s,l,u,d,f){i.emplaceBack(e,r,2*Math.floor(s*_c)+d,l*_c*2,u*_c*2,Math.round(f))}class yc{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new $,this.centroidVertexArray=new O,this.indexArray=new fe,this.programConfigurations=new Ar(e.layers,e.zoom),this.segments=new Ee,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.features=[],this.hasPattern=fc("fill-extrusion",this.layers,r);for(const{feature:l,id:u,index:d,sourceLayerIndex:f}of e){const g=this.layers[0]._featureFilter.needGeometry,v=us(l,g);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),v,s))continue;const b={id:u,sourceLayerIndex:f,index:d,geometry:g?v.geometry:Pr(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(mc("fill-extrusion",this.layers,b,this.zoom,r)):this.addFeature(b,b.geometry,d,s,{}),r.featureIndex.insert(l,b.geometry,d,f,this.index,!0)}}addFeatures(e,r,s){for(const l of this.features){const{geometry:u}=l;this.addFeature(l,u,l.index,r,s)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Fd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Rd.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,s,l,u){const d={x:0,y:0,vertexCount:0};for(const f of pc(r,500)){let g=0;for(const z of f)g+=z.length;let v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const z of f){if(z.length===0||Xd(z))continue;let U=0;for(let F=0;F=1){const Q=z[F-1];if(!Gd(K,Q)){v.vertexLength+4>Ee.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const X=K.sub(Q)._perp()._unit(),ie=Q.dist(K);U+ie>32768&&(U=0),oo(this.layoutVertexArray,K.x,K.y,X.x,X.y,0,0,U),oo(this.layoutVertexArray,K.x,K.y,X.x,X.y,0,1,U),d.x+=2*K.x,d.y+=2*K.y,d.vertexCount+=2,U+=ie,oo(this.layoutVertexArray,Q.x,Q.y,X.x,X.y,0,0,U),oo(this.layoutVertexArray,Q.x,Q.y,X.x,X.y,0,1,U),d.x+=2*Q.x,d.y+=2*Q.y,d.vertexCount+=2;const ne=v.vertexLength;this.indexArray.emplaceBack(ne,ne+2,ne+1),this.indexArray.emplaceBack(ne+1,ne+2,ne+3),v.vertexLength+=4,v.primitiveLength+=2}}}}if(v.vertexLength+g>Ee.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),Zd[e.type]!=="Polygon")continue;const b=[],E=[],A=v.vertexLength;for(const z of f)if(z.length!==0){z!==f[0]&&E.push(b.length/2);for(let U=0;USt)||i.y===e.y&&(i.y<0||i.y>St)}function Xd(i){return i.every(e=>e.x<0)||i.every(e=>e.x>St)||i.every(e=>e.y<0)||i.every(e=>e.y>St)}let Bh;De("FillExtrusionBucket",yc,{omit:["layers","features"]});var Wd={get paint(){return Bh=Bh||new Ai({"fill-extrusion-opacity":new Fe(le["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new $e(le["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Fe(le["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Fe(le["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new os(le["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new $e(le["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new $e(le["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Fe(le["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};function lo(i,e){return i.x*e.x+i.y*e.y}function Rh(i,e){if(i.length===1){let r=0;const s=e[r++];let l;for(;!l||s.equals(l);)if(l=e[r++],!l)return 1/0;for(;rr.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new H,this.layoutVertexArray2=new re,this.indexArray=new fe,this.programConfigurations=new Ar(e.layers,e.zoom),this.segments=new Ee,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,s){this.hasPattern=fc("line",this.layers,r);const l=this.layers[0].layout.get("line-sort-key"),u=!l.isConstant(),d=[];for(const{feature:f,id:g,index:v,sourceLayerIndex:b}of e){const E=this.layers[0]._featureFilter.needGeometry,A=us(f,E);if(!this.layers[0]._featureFilter.filter(new Pt(this.zoom),A,s))continue;const C=u?l.evaluate(A,{},s):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:b,index:v,geometry:E?A.geometry:Pr(f),patterns:{},sortKey:C};d.push(z)}u&&d.sort((f,g)=>f.sortKey-g.sortKey);for(const f of d){const{geometry:g,index:v,sourceLayerIndex:b}=f;if(this.hasPattern){const E=mc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(f,g,v,s,{});r.featureIndex.insert(e[v].feature,g,v,b,this.index)}}update(e,r,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,s)}addFeatures(e,r,s){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,r,s)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Jd)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Kd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,s,l,u){const d=this.layers[0].layout,f=d.get("line-join").evaluate(e,{}),g=d.get("line-cap"),v=d.get("line-miter-limit"),b=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,f,g,v,b);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,u,l)}addLine(e,r,s,l,u,d){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let K=0;K=2&&e[g-1].equals(e[g-2]);)g--;let v=0;for(;v0;if(ze&&K>v){const we=A.dist(C);if(we>2*b){const Me=A.sub(A.sub(C)._mult(b/we)._round());this.updateDistance(C,Me),this.addCurrentVertex(Me,U,0,0,E),C=Me}}const Pe=C&&z;let Se=Pe?s:f?"butt":l;if(Pe&&Se==="round"&&(neu&&(Se="bevel"),Se==="bevel"&&(ne>2&&(Se="flipbevel"),ne100)Q=F.mult(-1);else{const we=ne*U.add(F).mag()/U.sub(F).mag();Q._perp()._mult(we*(Be?-1:1))}this.addCurrentVertex(A,Q,0,0,E),this.addCurrentVertex(A,Q.mult(-1),0,0,E)}else if(Se==="bevel"||Se==="fakeround"){const we=-Math.sqrt(ne*ne-1),Me=Be?we:0,Ie=Be?0:we;if(C&&this.addCurrentVertex(A,U,Me,Ie,E),Se==="fakeround"){const ge=Math.round(180*ce/Math.PI/20);for(let Ve=1;Ve2*b){const Me=A.add(z.sub(A)._mult(b/we)._round());this.updateDistance(A,Me),this.addCurrentVertex(Me,F,0,0,E),A=Me}}}}addCurrentVertex(e,r,s,l,u,d=!1){const f=r.y*l-r.x,g=-r.y-r.x*l;this.addHalfVertex(e,r.x+r.y*s,r.y-r.x*s,d,!1,s,u),this.addHalfVertex(e,f,g,d,!0,-l,u),this.distance>Fh/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,r,s,l,u,d))}addHalfVertex({x:e,y:r},s,l,u,d,f,g){const v=.5*(this.lineClips?this.scaledDistance*(Fh-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(u?1:0),(r<<1)+(d?1:0),Math.round(63*s)+128,Math.round(63*l)+128,1+(f===0?0:f<0?-1:1)|(63&v)<<2,v>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const b=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,b),g.primitiveLength++),d?this.e2=b:this.e1=b}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}let Oh,Uh;De("LineBucket",xc,{omit:["layers","patternFeatures"]});var Vh={get paint(){return Uh=Uh||new Ai({"line-opacity":new $e(le.paint_line["line-opacity"]),"line-color":new $e(le.paint_line["line-color"]),"line-translate":new Fe(le.paint_line["line-translate"]),"line-translate-anchor":new Fe(le.paint_line["line-translate-anchor"]),"line-width":new $e(le.paint_line["line-width"]),"line-gap-width":new $e(le.paint_line["line-gap-width"]),"line-offset":new $e(le.paint_line["line-offset"]),"line-blur":new $e(le.paint_line["line-blur"]),"line-dasharray":new Xa(le.paint_line["line-dasharray"]),"line-pattern":new os(le.paint_line["line-pattern"]),"line-gradient":new Wa(le.paint_line["line-gradient"])})},get layout(){return Oh=Oh||new Ai({"line-cap":new Fe(le.layout_line["line-cap"]),"line-join":new $e(le.layout_line["line-join"]),"line-miter-limit":new Fe(le.layout_line["line-miter-limit"]),"line-round-limit":new Fe(le.layout_line["line-round-limit"]),"line-sort-key":new $e(le.layout_line["line-sort-key"])})}};class tp extends $e{possiblyEvaluate(e,r){return r=new Pt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,s,l){return r=mt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let gl;function Nh(i,e){return e>0?e+2*i:i}const ip=Zt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),rp=Zt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Zt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const np=Zt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Zt([{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 $h=Zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),sp=Zt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ap(i,e,r){return i.sections.forEach(s=>{s.text=function(l,u,d){const f=u.layout.get("text-transform").evaluate(d,{});return f==="uppercase"?l=l.toLocaleUpperCase():f==="lowercase"&&(l=l.toLocaleLowerCase()),Hi.applyArabicShaping&&(l=Hi.applyArabicShaping(l)),l}(s.text,e,r)}),i}Zt([{name:"triangle",components:3,type:"Uint16"}]),Zt([{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"}]),Zt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Zt([{type:"Float32",name:"offsetX"}]),Zt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const co={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var ri=24,qh=yt,jh=function(i,e,r,s,l){var u,d,f=8*l-s-1,g=(1<>1,b=-7,E=r?l-1:0,A=r?-1:1,C=i[e+E];for(E+=A,u=C&(1<<-b)-1,C>>=-b,b+=f;b>0;u=256*u+i[e+E],E+=A,b-=8);for(d=u&(1<<-b)-1,u>>=-b,b+=s;b>0;d=256*d+i[e+E],E+=A,b-=8);if(u===0)u=1-v;else{if(u===g)return d?NaN:1/0*(C?-1:1);d+=Math.pow(2,s),u-=v}return(C?-1:1)*d*Math.pow(2,u-s)},Zh=function(i,e,r,s,l,u){var d,f,g,v=8*u-l-1,b=(1<>1,A=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=s?0:u-1,z=s?1:-1,U=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,d=b):(d=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-d))<1&&(d--,g*=2),(e+=d+E>=1?A/g:A*Math.pow(2,1-E))*g>=2&&(d++,g/=2),d+E>=b?(f=0,d=b):d+E>=1?(f=(e*g-1)*Math.pow(2,l),d+=E):(f=e*Math.pow(2,E-1)*Math.pow(2,l),d=0));l>=8;i[r+C]=255&f,C+=z,f/=256,l-=8);for(d=d<0;i[r+C]=255&d,C+=z,d/=256,v-=8);i[r+C-z]|=128*U};function yt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}yt.Varint=0,yt.Fixed64=1,yt.Bytes=2,yt.Fixed32=5;var vc=4294967296,Gh=1/vc,Xh=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function on(i){return i.type===yt.Bytes?i.readVarint()+i.pos:i.pos+1}function na(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Wh(i,e,r){var s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(s);for(var l=r.pos-1;l>=i;l--)r.buf[l+s]=r.buf[l]}function op(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Hh(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}yt.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos>3,u=this.pos;this.type=7&s,i(l,e,this),this.pos===u&&this.skip(s)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=_l(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Hh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=_l(this.buf,this.pos)+_l(this.buf,this.pos+4)*vc;return this.pos+=8,i},readSFixed64:function(){var i=_l(this.buf,this.pos)+Hh(this.buf,this.pos+4)*vc;return this.pos+=8,i},readFloat:function(){var i=jh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=jh(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,s=this.buf;return e=127&(r=s[this.pos++]),r<128?e:(e|=(127&(r=s[this.pos++]))<<7,r<128?e:(e|=(127&(r=s[this.pos++]))<<14,r<128?e:(e|=(127&(r=s[this.pos++]))<<21,r<128?e:function(l,u,d){var f,g,v=d.buf;if(f=(112&(g=v[d.pos++]))>>4,g<128||(f|=(127&(g=v[d.pos++]))<<3,g<128)||(f|=(127&(g=v[d.pos++]))<<10,g<128)||(f|=(127&(g=v[d.pos++]))<<17,g<128)||(f|=(127&(g=v[d.pos++]))<<24,g<128)||(f|=(1&(g=v[d.pos++]))<<31,g<128))return na(l,f,u);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=s[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Xh?function(r,s,l){return Xh.decode(r.subarray(s,l))}(this.buf,e,i):function(r,s,l){for(var u="",d=s;d239?4:b>223?3:b>191?2:1;if(d+A>l)break;A===1?b<128&&(E=b):A===2?(192&(f=r[d+1]))==128&&(E=(31&b)<<6|63&f)<=127&&(E=null):A===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((E=(15&b)<<12|(63&f)<<6|63&g)<=2047||E>=55296&&E<=57343)&&(E=null)):A===4&&(g=r[d+2],v=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&v)==128&&((E=(15&b)<<18|(63&f)<<12|(63&g)<<6|63&v)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,A=1):E>65535&&(E-=65536,u+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),u+=String.fromCharCode(E),d+=A}return u}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==yt.Bytes)return i.push(this.readVarint(e));var r=on(this);for(i=i||[];this.pos127;);else if(e===yt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===yt.Fixed32)this.pos+=4;else{if(e!==yt.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,r){var s,l;if(e>=0?(s=e%4294967296|0,l=e/4294967296|0):(l=~(-e/4294967296),4294967295^(s=~(-e%4294967296))?s=s+1|0:(s=0,l=l+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(u,d,f){f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,u>>>=7,f.buf[f.pos++]=127&u|128,f.buf[f.pos]=127&(u>>>=7)}(s,0,r),function(u,d){var f=(7&u)<<4;d.buf[d.pos++]|=f|((u>>>=3)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u|((u>>>=7)?128:0),u&&(d.buf[d.pos++]=127&u)))))}(l,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(s,l,u){for(var d,f,g=0;g55295&&d<57344){if(!f){d>56319||g+1===l.length?(s[u++]=239,s[u++]=191,s[u++]=189):f=d;continue}if(d<56320){s[u++]=239,s[u++]=191,s[u++]=189,f=d;continue}d=f-55296<<10|d-56320|65536,f=null}else f&&(s[u++]=239,s[u++]=191,s[u++]=189,f=null);d<128?s[u++]=d:(d<2048?s[u++]=d>>6|192:(d<65536?s[u++]=d>>12|224:(s[u++]=d>>18|240,s[u++]=d>>12&63|128),s[u++]=d>>6&63|128),s[u++]=63&d|128)}return u}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&Wh(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Zh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Zh(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Wh(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,yt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,op,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,lp,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,up,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,cp,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,hp,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,dp,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,pp,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,fp,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,mp,e)},writeBytesField:function(i,e){this.writeTag(i,yt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,yt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,yt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,yt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,yt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,yt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,yt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,yt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,yt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,yt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var bc=_e(qh);const wc=3;function gp(i,e,r){i===1&&r.readMessage(_p,e)}function _p(i,e,r){if(i===3){const{id:s,bitmap:l,width:u,height:d,left:f,top:g,advance:v}=r.readMessage(yp,{});e.push({id:s,bitmap:new io({width:u+2*wc,height:d+2*wc},l),metrics:{width:u,height:d,left:f,top:g,advance:v}})}}function yp(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}const Kh=wc;function Yh(i){let e=0,r=0;for(const d of i)e+=d.w*d.h,r=Math.max(r,d.w);i.sort((d,f)=>f.h-d.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let l=0,u=0;for(const d of i)for(let f=s.length-1;f>=0;f--){const g=s[f];if(!(d.w>g.w||d.h>g.h)){if(d.x=g.x,d.y=g.y,u=Math.max(u,d.y+d.h),l=Math.max(l,d.x+d.w),d.w===g.w&&d.h===g.h){const v=s.pop();f=0&&s>=e&&xl[this.text.charCodeAt(s)];s--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const s=new aa;return s.text=this.text.substring(e,r),s.sectionIndex=this.sectionIndex.slice(e,r),s.sections=this.sections,s}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(uo.forText(e.scale,e.fontStack||r));const s=this.sections.length-1;for(let l=0;l=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function yl(i,e,r,s,l,u,d,f,g,v,b,E,A,C,z,U){const F=aa.fromFeature(i,l);let K;E===h.WritingMode.vertical&&F.verticalizePunctuation();const{processBidirectionalText:Q,processStyledBidirectionalText:X}=Hi;if(Q&&F.sections.length===1){K=[];const ce=Q(F.toString(),Ec(F,v,u,e,s,C,z));for(const ze of ce){const Be=new aa;Be.text=ze,Be.sections=F.sections;for(let Pe=0;Pe0&&cn>Ui&&(Ui=cn)}else{const nr=Be[tt.fontStack],Vi=nr&&nr[gi];if(Vi&&Vi.rect)Mr=Vi.rect,mr=Vi.metrics;else{const cn=ze[tt.fontStack],_o=cn&&cn[gi];if(!_o)continue;mr=_o.metrics}Ti=(fi-tt.scale)*ri}gr?(ce.verticalizable=!0,Oi.push({glyph:gi,imageName:Cr,x:It,y:Mt+Ti,vertical:gr,scale:tt.scale,fontStack:tt.fontStack,sectionIndex:Ki,metrics:mr,rect:Mr}),It+=ln*tt.scale+Ve):(Oi.push({glyph:gi,imageName:Cr,x:It,y:Mt+Ti,vertical:gr,scale:tt.scale,fontStack:tt.fontStack,sectionIndex:Ki,metrics:mr,rect:Mr}),It+=mr.advance*tt.scale+Ve)}Oi.length!==0&&(Jt=Math.max(It-Ve,Jt),bp(Oi,0,Oi.length-1,di,Ui)),It=0;const Bt=we*fi+Ui;Mi.lineOffset=Math.max(Ui,wi),Mt+=Bt,rr=Math.max(Bt,rr),++Gt}var ni;const pi=Mt-ho,{horizontalAlign:bi,verticalAlign:Fi}=Sc(Me);(function(Xt,fi,wi,Mi,Oi,Ui,Bt,mi,tt){const Ki=(fi-wi)*Oi;let gi=0;gi=Ui!==Bt?-mi*Mi-ho:(-Mi*tt+.5)*Bt;for(const Ti of Xt)for(const mr of Ti.positionedGlyphs)mr.x+=Ki,mr.y+=gi})(ce.positionedLines,di,bi,Fi,Jt,rr,we,pi,Se.length),ce.top+=-Fi*pi,ce.bottom=ce.top+pi,ce.left+=-bi*Jt,ce.right=ce.left+Jt}(ne,e,r,s,K,d,f,g,E,v,A,U),!function(ce){for(const ze of ce)if(ze.positionedGlyphs.length!==0)return!1;return!0}(ie)&&ne}const xl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},xp={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Qh(i,e,r,s,l,u){if(e.imageName){const d=s[e.imageName];return d?d.displaySize[0]*e.scale*ri/u+l:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+l:0}}function eu(i,e,r,s){const l=Math.pow(i-e,2);return s?i=0;let b=0;for(let A=0;Ad.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=ac([]),this.placementViewportMatrix=ac([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=nu(this.zoom,r["text-size"]),this.iconSizeData=nu(this.zoom,r["icon-size"]);const s=this.layers[0].layout,l=s.get("symbol-sort-key"),u=s.get("symbol-z-order");this.canOverlap=Ic(s,"text-overlap","text-allow-overlap")!=="never"||Ic(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=u!=="viewport-y"&&!l.isConstant(),this.sortFeaturesByY=(u==="viewport-y"||u==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map(d=>h.WritingMode[d])),this.stateDependentLayerIds=this.layers.filter(d=>d.isStateDependent()).map(d=>d.id),this.sourceID=e.sourceID}createArrays(){this.text=new Pc(new Ar(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Pc(new Ar(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new x,this.lineVertexArray=new T,this.symbolInstances=new _}calculateGlyphDependencies(e,r,s,l,u){for(let d=0;d0)&&(d.value.kind!=="constant"||d.value.value.length>0),b=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,E=u.get("symbol-sort-key");if(this.features=[],!v&&!b)return;const A=r.iconDependencies,C=r.glyphDependencies,z=r.availableImages,U=new Pt(this.zoom);for(const{feature:F,id:K,index:Q,sourceLayerIndex:X}of e){const ie=l._featureFilter.needGeometry,ne=us(F,ie);if(!l._featureFilter.filter(U,ne,s))continue;let ce,ze;if(ie||(ne.geometry=Pr(F)),v){const Pe=l.getValueAndResolveTokens("text-field",ne,s,z),Se=oi.factory(Pe);Sp(Se)&&(this.hasRTLText=!0),(!this.hasRTLText||ja()==="unavailable"||this.hasRTLText&&Hi.isParsed())&&(ce=ap(Se,l,ne))}if(b){const Pe=l.getValueAndResolveTokens("icon-image",ne,s,z);ze=Pe instanceof Zi?Pe:Zi.fromString(Pe)}if(!ce&&!ze)continue;const Be=this.sortFeaturesByKey?E.evaluate(ne,{},s):void 0;if(this.features.push({id:K,text:ce,icon:ze,index:Q,sourceLayerIndex:X,geometry:ne.geometry,properties:F.properties,type:Tp[F.type],sortKey:Be}),ze&&(A[ze.name]=!0),ce){const Pe=d.evaluate(ne,{},s).join(","),Se=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(h.WritingMode.vertical)>=0;for(const we of ce.sections)if(we.image)A[we.image.name]=!0;else{const Me=Fs(ce.toString()),Ie=we.fontStack||Pe,ge=C[Ie]=C[Ie]||{};this.calculateGlyphDependencies(we.text,ge,Se,this.allowVerticalPlacement,Me)}}}u.get("symbol-placement")==="line"&&(this.features=function(F){const K={},Q={},X=[];let ie=0;function ne(Pe){X.push(F[Pe]),ie++}function ce(Pe,Se,we){const Me=Q[Pe];return delete Q[Pe],Q[Se]=Me,X[Me].geometry[0].pop(),X[Me].geometry[0]=X[Me].geometry[0].concat(we[0]),Me}function ze(Pe,Se,we){const Me=K[Se];return delete K[Se],K[Pe]=Me,X[Me].geometry[0].shift(),X[Me].geometry[0]=we[0].concat(X[Me].geometry[0]),Me}function Be(Pe,Se,we){const Me=we?Se[0][Se[0].length-1]:Se[0][0];return`${Pe}:${Me.x}:${Me.y}`}for(let Pe=0;PePe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((F,K)=>F.sortKey-K.sortKey)}update(e,r,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,s),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,s))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const s=this.lineVertexArray.length;if(e.segment!==void 0){let l=e.dist(r[e.segment+1]),u=e.dist(r[e.segment]);const d={};for(let f=e.segment+1;f=0;f--)d[f]={x:r[f].x,y:r[f].y,tileUnitDistanceFromAnchor:u},f>0&&(u+=r[f-1].dist(r[f]));for(let f=0;f0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,r){const s=e.placedSymbolArray.get(r),l=s.vertexStartIndex+4*s.numGlyphs;for(let u=s.vertexStartIndex;ul[f]-l[g]||u[g]-u[f]),d}addToSortKeyRanges(e,r){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===r?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const r of this.symbolInstanceIndexes){const s=this.symbolInstances.get(r);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach((l,u,d)=>{l>=0&&d.indexOf(l)===u&&this.addIndicesForPlacedSymbol(this.text,l)}),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let su,au;De("SymbolBucket",oa,{omit:["layers","collisionBoxArray","features","compareText"]}),oa.MAX_GLYPHS=65535,oa.addDynamicAttributes=Ac;var Cc={get paint(){return au=au||new Ai({"icon-opacity":new $e(le.paint_symbol["icon-opacity"]),"icon-color":new $e(le.paint_symbol["icon-color"]),"icon-halo-color":new $e(le.paint_symbol["icon-halo-color"]),"icon-halo-width":new $e(le.paint_symbol["icon-halo-width"]),"icon-halo-blur":new $e(le.paint_symbol["icon-halo-blur"]),"icon-translate":new Fe(le.paint_symbol["icon-translate"]),"icon-translate-anchor":new Fe(le.paint_symbol["icon-translate-anchor"]),"text-opacity":new $e(le.paint_symbol["text-opacity"]),"text-color":new $e(le.paint_symbol["text-color"],{runtimeType:Si,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new $e(le.paint_symbol["text-halo-color"]),"text-halo-width":new $e(le.paint_symbol["text-halo-width"]),"text-halo-blur":new $e(le.paint_symbol["text-halo-blur"]),"text-translate":new Fe(le.paint_symbol["text-translate"]),"text-translate-anchor":new Fe(le.paint_symbol["text-translate-anchor"])})},get layout(){return su=su||new Ai({"symbol-placement":new Fe(le.layout_symbol["symbol-placement"]),"symbol-spacing":new Fe(le.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Fe(le.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new $e(le.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Fe(le.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Fe(le.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Fe(le.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Fe(le.layout_symbol["icon-ignore-placement"]),"icon-optional":new Fe(le.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Fe(le.layout_symbol["icon-rotation-alignment"]),"icon-size":new $e(le.layout_symbol["icon-size"]),"icon-text-fit":new Fe(le.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Fe(le.layout_symbol["icon-text-fit-padding"]),"icon-image":new $e(le.layout_symbol["icon-image"]),"icon-rotate":new $e(le.layout_symbol["icon-rotate"]),"icon-padding":new $e(le.layout_symbol["icon-padding"]),"icon-keep-upright":new Fe(le.layout_symbol["icon-keep-upright"]),"icon-offset":new $e(le.layout_symbol["icon-offset"]),"icon-anchor":new $e(le.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Fe(le.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Fe(le.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Fe(le.layout_symbol["text-rotation-alignment"]),"text-field":new $e(le.layout_symbol["text-field"]),"text-font":new $e(le.layout_symbol["text-font"]),"text-size":new $e(le.layout_symbol["text-size"]),"text-max-width":new $e(le.layout_symbol["text-max-width"]),"text-line-height":new Fe(le.layout_symbol["text-line-height"]),"text-letter-spacing":new $e(le.layout_symbol["text-letter-spacing"]),"text-justify":new $e(le.layout_symbol["text-justify"]),"text-radial-offset":new $e(le.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Fe(le.layout_symbol["text-variable-anchor"]),"text-anchor":new $e(le.layout_symbol["text-anchor"]),"text-max-angle":new Fe(le.layout_symbol["text-max-angle"]),"text-writing-mode":new Fe(le.layout_symbol["text-writing-mode"]),"text-rotate":new $e(le.layout_symbol["text-rotate"]),"text-padding":new Fe(le.layout_symbol["text-padding"]),"text-keep-upright":new Fe(le.layout_symbol["text-keep-upright"]),"text-transform":new $e(le.layout_symbol["text-transform"]),"text-offset":new $e(le.layout_symbol["text-offset"]),"text-allow-overlap":new Fe(le.layout_symbol["text-allow-overlap"]),"text-overlap":new Fe(le.layout_symbol["text-overlap"]),"text-ignore-placement":new Fe(le.layout_symbol["text-ignore-placement"]),"text-optional":new Fe(le.layout_symbol["text-optional"])})}};class ou{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Rr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}De("FormatSectionOverride",ou,{omit:["defaultValue"]});class bl extends dr{constructor(e){super(e,Cc)}recalculate(e,r){if(super.recalculate(e,r),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 s=this.layout.get("text-writing-mode");if(s){const l=[];for(const u of s)l.indexOf(u)<0&&l.push(u);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,s,l){const u=this.layout.get(e).evaluate(r,{},s,l),d=this._unevaluatedLayout._values[e];return d.isDataDriven()||Ms(d.value)||!u?u:function(f,g){return g.replace(/{([^{}]+)}/g,(v,b)=>b in f?String(f[b]):"")}(r.properties,u)}createBucket(e){return new oa(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Cc.paint.overridableProperties){if(!bl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new ou(r),l=new za(s,r.property.specification);let u=null;u=r.value.kind==="constant"||r.value.kind==="source"?new Da("source",l):new rt("composite",l,r.value.zoomStops),this.paint._values[e]=new ur(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&bl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=Cc.paint.properties[r];let u=!1;const d=f=>{for(const g of f)if(l.overrides&&l.overrides.hasOverride(g))return void(u=!0)};if(s.value.kind==="constant"&&s.value.value instanceof oi)d(s.value.value.sections);else if(s.value.kind==="source"){const f=v=>{u||(v instanceof Or&&qt(v.value)===wr?d(v.value.sections):v instanceof As?d(v.sections):v.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return u}}let lu;var Ip={get paint(){return lu=lu||new Ai({"background-color":new Fe(le.paint_background["background-color"]),"background-pattern":new Xa(le.paint_background["background-pattern"]),"background-opacity":new Fe(le.paint_background["background-opacity"])})}};let cu;var Ap={get paint(){return cu=cu||new Ai({"raster-opacity":new Fe(le.paint_raster["raster-opacity"]),"raster-hue-rotate":new Fe(le.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Fe(le.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Fe(le.paint_raster["raster-brightness-max"]),"raster-saturation":new Fe(le.paint_raster["raster-saturation"]),"raster-contrast":new Fe(le.paint_raster["raster-contrast"]),"raster-resampling":new Fe(le.paint_raster["raster-resampling"]),"raster-fade-duration":new Fe(le.paint_raster["raster-fade-duration"])})}};class Pp extends dr{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}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")}}const Mp={circle:class extends dr{constructor(i){super(i,gd)}createBucket(i){return new rc(i)}queryRadius(i){const e=i;return eo("circle-radius",this,e)+eo("circle-stroke-width",this,e)+cl(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=hl(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),u.angle,d),v=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),b=this.paint.get("circle-pitch-alignment")==="map",E=b?g:function(C,z){return C.map(U=>yh(U,z))}(g,f),A=b?v*d:v;for(const C of s)for(const z of C){const U=b?z:yh(z,f);let F=A;const K=ul([],[z.x,z.y,0,1],f);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?F*=K[3]/u.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(F*=u.cameraToCenterDistance/K[3]),dd(E,U,F))return!0}return!1}},heatmap:class extends dr{createBucket(i){return new xh(i)}constructor(i){super(i,yd),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=wh({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends dr{constructor(i){super(i,xd)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends dr{constructor(i){super(i,Ld)}recalculate(i,e){super.recalculate(i,e);const r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new gc(i)}queryRadius(){return cl(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d){return dh(hl(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,d),s)}isTileClipped(){return!0}},"fill-extrusion":class extends dr{constructor(i){super(i,Wd)}createBucket(i){return new yc(i)}queryRadius(){return cl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=hl(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),u.angle,d),v=this.paint.get("fill-extrusion-height").evaluate(e,r),b=this.paint.get("fill-extrusion-base").evaluate(e,r),E=function(C,z,U,F){const K=[];for(const Q of C){const X=[Q.x,Q.y,0,1];ul(X,X,z),K.push(new ye(X[0]/X[3],X[1]/X[3]))}return K}(g,f),A=function(C,z,U,F){const K=[],Q=[],X=F[8]*z,ie=F[9]*z,ne=F[10]*z,ce=F[11]*z,ze=F[8]*U,Be=F[9]*U,Pe=F[10]*U,Se=F[11]*U;for(const we of C){const Me=[],Ie=[];for(const ge of we){const Ve=ge.x,Re=ge.y,et=F[0]*Ve+F[4]*Re+F[12],It=F[1]*Ve+F[5]*Re+F[13],Mt=F[2]*Ve+F[6]*Re+F[14],Jt=F[3]*Ve+F[7]*Re+F[15],rr=Mt+ne,di=Jt+ce,Gt=et+ze,ni=It+Be,pi=Mt+Pe,bi=Jt+Se,Fi=new ye((et+X)/di,(It+ie)/di);Fi.z=rr/di,Me.push(Fi);const Xt=new ye(Gt/bi,ni/bi);Xt.z=pi/bi,Ie.push(Xt)}K.push(Me),Q.push(Ie)}return[K,Q]}(s,b,v,f);return function(C,z,U){let F=1/0;dh(U,z)&&(F=Rh(U,z[0]));for(let K=0;K=3){for(let U=0;U{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const kc=63710088e-1;class On{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new On(Qt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,s=this.lat*r,l=e.lat*r,u=Math.sin(s)*Math.sin(l)+Math.cos(s)*Math.cos(l)*Math.cos((e.lng-this.lng)*r);return kc*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof On)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new On(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new On(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const hu=2*Math.PI*kc;function uu(i){return hu*Math.cos(i*Math.PI/180)}function du(i){return(180+i)/360}function pu(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function fu(i,e){return i/uu(e)}function zc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class wl{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=On.convert(e);return new wl(du(s.lng),pu(s.lat),fu(r,s.lat))}toLngLat(){return new On(360*this.x-180,zc(this.y))}toAltitude(){return this.z*uu(zc(this.y))}meterInMercatorCoordinateUnits(){return 1/hu*(e=zc(this.y),1/Math.cos(e*Math.PI/180));var e}}function mu(i,e,r){var s=2*Math.PI*6378137/256/Math.pow(2,r);return[i*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class Dc{constructor(e,r,s){if(e<0||e>25||s<0||s>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=s,this.key=fo(0,e,e,r,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,s){const l=(d=this.y,f=this.z,g=mu(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),v=mu(256*(u+1),256*(d+1),f),g[0]+","+g[1]+","+v[0]+","+v[1]);var u,d,f,g,v;const b=function(E,A,C){let z,U="";for(let F=E;F>0;F--)z=1<1?"@2x":"").replace(/{quadkey}/g,b).replace(/{bbox-epsg-3857}/g,l)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new ye((e.x*r-this.x)*St,(e.y*r-this.y)*St)}toString(){return`${this.z}/${this.x}/${this.y}`}}class gu{constructor(e,r){this.wrap=e,this.canonical=r,this.key=fo(e,r.z,r.z,r.x,r.y)}}class ir{constructor(e,r,s,l,u){if(e= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Dc(s,+l,+u),this.key=fo(r,e,s,l,u)}clone(){return new ir(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new ir(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ir(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?fo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):fo(this.wrap*+r,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new ir(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,s=2*this.canonical.x,l=2*this.canonical.y;return[new ir(r,this.wrap,r,s,l),new ir(r,this.wrap,r,s+1,l),new ir(r,this.wrap,r,s,l+1),new ir(r,this.wrap,r,s+1,l+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=f),f=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,s){return(256*e*256+256*r+s)/10-1e4}_unpackTerrarium(e,r,s){return 256*e+r+s/256-32768}getPixels(){return new tr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let l=r*this.dim,u=r*this.dim+this.dim,d=s*this.dim,f=s*this.dim+this.dim;switch(r){case-1:l=u-1;break;case 1:u=l+1}switch(s){case-1:d=f-1;break;case 1:f=d+1}const g=-r*this.dim,v=-s*this.dim;for(let b=d;b=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class xu{constructor(e,r,s,l,u){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=s,e._y=l,this.properties=e.properties,this.id=u}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(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class vu{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new rs(St,16,0),this.grid3D=new rs(St,16,0),this.featureIndexArray=new k,this.promoteId=r}insert(e,r,s,l,u,d){const f=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,l,u);const g=d?this.grid3D:this.grid;for(let v=0;v=0&&E[3]>=0&&g.insert(f,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Bn.VectorTile(new bc(this.rawTileData)).layers,this.sourceLayerCoder=new yu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const u=e.params||{},d=St/e.tileSize/e.scale,f=La(u.filter),g=e.queryGeometry,v=e.queryPadding*d,b=wu(g),E=this.grid.query(b.minX-v,b.minY-v,b.maxX+v,b.maxY+v),A=wu(e.cameraQueryGeometry),C=this.grid3D.query(A.minX-v,A.minY-v,A.maxX+v,A.maxY+v,(F,K,Q,X)=>function(ie,ne,ce,ze,Be){for(const Se of ie)if(ne<=Se.x&&ce<=Se.y&&ze>=Se.x&&Be>=Se.y)return!0;const Pe=[new ye(ne,ce),new ye(ne,Be),new ye(ze,Be),new ye(ze,ce)];if(ie.length>2){for(const Se of Pe)if(ea(ie,Se))return!0}for(let Se=0;Se(X||(X=Pr(ie)),ne.queryIntersectsFeature(g,ie,ce,X,this.z,e.transform,d,e.pixelPosMatrix)))}return z}loadMatchingFeature(e,r,s,l,u,d,f,g,v,b,E){const A=this.bucketLayerIDs[r];if(d&&!function(F,K){for(let Q=0;Q=0)return!0;return!1}(d,A))return;const C=this.sourceLayerCoder.decode(s),z=this.vtLayers[C].feature(l);if(u.needGeometry){const F=us(z,!0);if(!u.filter(new Pt(this.tileID.overscaledZ),F,this.tileID.canonical))return}else if(!u.filter(new Pt(this.tileID.overscaledZ),z))return;const U=this.getId(z,C);for(let F=0;F{const f=e instanceof js?e.get(d):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function wu(i){let e=1/0,r=1/0,s=-1/0,l=-1/0;for(const u of i)e=Math.min(e,u.x),r=Math.min(r,u.y),s=Math.max(s,u.x),l=Math.max(l,u.y);return{minX:e,minY:r,maxX:s,maxY:l}}function kp(i,e){return e-i}function Tu(i,e,r,s,l){const u=[];for(let d=0;d=s&&E.x>=s||(b.x>=s?b=new ye(s,b.y+(s-b.x)/(E.x-b.x)*(E.y-b.y))._round():E.x>=s&&(E=new ye(s,b.y+(s-b.x)/(E.x-b.x)*(E.y-b.y))._round()),b.y>=l&&E.y>=l||(b.y>=l?b=new ye(b.x+(l-b.y)/(E.y-b.y)*(E.x-b.x),l)._round():E.y>=l&&(E=new ye(b.x+(l-b.y)/(E.y-b.y)*(E.x-b.x),l)._round()),g&&b.equals(g[g.length-1])||(g=[b],u.push(g)),g.push(E)))))}}return u}De("FeatureIndex",vu,{omit:["rawTileData","sourceLayerCoder"]});class Un extends ye{constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Un(this.x,this.y,this.angle,this.segment)}}function Eu(i,e,r,s,l){if(e.segment===void 0)return!0;let u=e,d=e.segment+1,f=0;for(;f>-r/2;){if(d--,d<0)return!1;f-=i[d].dist(u),u=i[d]}f+=i[d].dist(i[d+1]),d++;const g=[];let v=0;for(;fs;)v-=g.shift().angleDelta;if(v>l)return!1;d++,f+=b.dist(E)}return!0}function Su(i){let e=0;for(let r=0;rv){const z=(v-g)/C,U=zi.number(E.x,A.x,z),F=zi.number(E.y,A.y,z),K=new Un(U,F,A.angleTo(E),b);return K._round(),!d||Eu(i,K,f,d,e)?K:void 0}g+=C}}function Dp(i,e,r,s,l,u,d,f,g){const v=Iu(s,u,d),b=Au(s,l),E=b*d,A=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-E=0&&ie=0&&ne=0&&A+v<=b){const ce=new Un(ie,ne,Q,z);ce._round(),s&&!Eu(i,ce,u,s,l)||C.push(ce)}}E+=K}return f||C.length||d||(C=Pu(i,E/2,r,s,l,u,d,!0,g)),C}De("Anchor",Un);const la=Ri;function Mu(i,e,r,s){const l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2*la,g=u.paddedRect.h-2*la,v=i.right-i.left,b=i.bottom-i.top,E=u.stretchX||[[0,f]],A=u.stretchY||[[0,g]],C=(we,Me)=>we+Me[1]-Me[0],z=E.reduce(C,0),U=A.reduce(C,0),F=f-z,K=g-U;let Q=0,X=z,ie=0,ne=U,ce=0,ze=F,Be=0,Pe=K;if(u.content&&s){const we=u.content;Q=Tl(E,0,we[0]),ie=Tl(A,0,we[1]),X=Tl(E,we[0],we[2]),ne=Tl(A,we[1],we[3]),ce=we[0]-Q,Be=we[1]-ie,ze=we[2]-we[0]-X,Pe=we[3]-we[1]-ne}const Se=(we,Me,Ie,ge)=>{const Ve=El(we.stretch-Q,X,v,i.left),Re=Sl(we.fixed-ce,ze,we.stretch,z),et=El(Me.stretch-ie,ne,b,i.top),It=Sl(Me.fixed-Be,Pe,Me.stretch,U),Mt=El(Ie.stretch-Q,X,v,i.left),Jt=Sl(Ie.fixed-ce,ze,Ie.stretch,z),rr=El(ge.stretch-ie,ne,b,i.top),di=Sl(ge.fixed-Be,Pe,ge.stretch,U),Gt=new ye(Ve,et),ni=new ye(Mt,et),pi=new ye(Mt,rr),bi=new ye(Ve,rr),Fi=new ye(Re/d,It/d),Xt=new ye(Jt/d,di/d),fi=e*Math.PI/180;if(fi){const Oi=Math.sin(fi),Ui=Math.cos(fi),Bt=[Ui,-Oi,Oi,Ui];Gt._matMult(Bt),ni._matMult(Bt),bi._matMult(Bt),pi._matMult(Bt)}const wi=we.stretch+we.fixed,Mi=Me.stretch+Me.fixed;return{tl:Gt,tr:ni,bl:bi,br:pi,tex:{x:u.paddedRect.x+la+wi,y:u.paddedRect.y+la+Mi,w:Ie.stretch+Ie.fixed-wi,h:ge.stretch+ge.fixed-Mi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Fi,pixelOffsetBR:Xt,minFontScaleX:ze/d/v,minFontScaleY:Pe/d/b,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){const we=Cu(E,F,z),Me=Cu(A,K,U);for(let Ie=0;Ie0&&(z=Math.max(10,z),this.circleDiameter=z)}else{let E=d.top*f-g[0],A=d.bottom*f+g[2],C=d.left*f-g[3],z=d.right*f+g[1];const U=d.collisionPadding;if(U&&(C-=U[0]*f,E-=U[1]*f,z+=U[2]*f,A+=U[3]*f),b){const F=new ye(C,E),K=new ye(z,E),Q=new ye(C,A),X=new ye(z,A),ie=b*Math.PI/180;F._rotate(ie),K._rotate(ie),Q._rotate(ie),X._rotate(ie),C=Math.min(F.x,K.x,Q.x,X.x),z=Math.max(F.x,K.x,Q.x,X.x),E=Math.min(F.y,K.y,Q.y,X.y),A=Math.max(F.y,K.y,Q.y,X.y)}e.emplaceBack(r.x,r.y,C,E,z,A,s,l,u)}this.boxEndIndex=e.length}}class Lp{constructor(e=[],r=Bp){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:s}=this,l=r[e];for(;e>0;){const u=e-1>>1,d=r[u];if(s(l,d)>=0)break;r[e]=d,e=u}r[e]=l}_down(e){const{data:r,compare:s}=this,l=this.length>>1,u=r[e];for(;e=0)break;r[e]=f,e=d}r[e]=u}}function Bp(i,e){return ie?1:0}function Rp(i,e=1,r=!1){let s=1/0,l=1/0,u=-1/0,d=-1/0;const f=i[0];for(let C=0;Cu)&&(u=z.x),(!C||z.y>d)&&(d=z.y)}const g=Math.min(u-s,d-l);let v=g/2;const b=new Lp([],Fp);if(g===0)return new ye(s,l);for(let C=s;CE.d||!E.d)&&(E=C,r&&console.log("found best %d after %d probes",Math.round(1e4*C.d)/1e4,A)),C.max-E.d<=e||(v=C.h/2,b.push(new ca(C.p.x-v,C.p.y-v,v,i)),b.push(new ca(C.p.x+v,C.p.y-v,v,i)),b.push(new ca(C.p.x-v,C.p.y+v,v,i)),b.push(new ca(C.p.x+v,C.p.y+v,v,i)),A+=4)}return r&&(console.log(`num probes: ${A}`),console.log(`best distance: ${E.d}`)),E.p}function Fp(i,e){return e.max-i.max}function ca(i,e,r,s){this.p=new ye(i,e),this.h=r,this.d=function(l,u){let d=!1,f=1/0;for(let g=0;gl.y!=z.y>l.y&&l.x<(z.x-C.x)*(l.y-C.y)/(z.y-C.y)+C.x&&(d=!d),f=Math.min(f,ph(l,C,z))}}return(d?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}const Lc=Number.POSITIVE_INFINITY;function ku(i,e){return e[1]!==Lc?function(r,s,l){let u=0,d=0;switch(s=Math.abs(s),l=Math.abs(l),r){case"top-right":case"top-left":case"top":d=l-7;break;case"bottom-right":case"bottom-left":case"bottom":d=7-l}switch(r){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}return[u,d]}(i,e[0],e[1]):function(r,s){let l=0,u=0;s<0&&(s=0);const d=s/Math.sqrt(2);switch(r){case"top-right":case"top-left":u=d-7;break;case"bottom-right":case"bottom-left":u=7-d;break;case"bottom":u=7-s;break;case"top":u=s-7}switch(r){case"top-right":case"bottom-right":l=-d;break;case"top-left":case"bottom-left":l=d;break;case"left":l=s;break;case"right":l=-s}return[l,u]}(i,e[0])}function Bc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Op(i,e,r,s,l,u,d,f,g,v,b){let E=u.textMaxSize.evaluate(e,{});E===void 0&&(E=d);const A=i.layers[0].layout,C=A.get("icon-offset").evaluate(e,{},b),z=Du(r.horizontal),U=d/24,F=i.tilePixelRatio*U,K=i.tilePixelRatio*E/24,Q=i.tilePixelRatio*f,X=i.tilePixelRatio*A.get("symbol-spacing"),ie=A.get("text-padding")*i.tilePixelRatio,ne=function(ge,Ve,Re,et=1){const It=ge.get("icon-padding").evaluate(Ve,{},Re),Mt=It&&It.values;return[Mt[0]*et,Mt[1]*et,Mt[2]*et,Mt[3]*et]}(A,e,b,i.tilePixelRatio),ce=A.get("text-max-angle")/180*Math.PI,ze=A.get("text-rotation-alignment")!=="viewport"&&A.get("symbol-placement")!=="point",Be=A.get("icon-rotation-alignment")==="map"&&A.get("symbol-placement")!=="point",Pe=A.get("symbol-placement"),Se=X/2,we=A.get("icon-text-fit");let Me;s&&we!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Me=ru(s,r.vertical,we,A.get("icon-text-fit-padding"),C,U)),z&&(s=ru(s,z,we,A.get("icon-text-fit-padding"),C,U)));const Ie=(ge,Ve)=>{Ve.x<0||Ve.x>=St||Ve.y<0||Ve.y>=St||function(Re,et,It,Mt,Jt,rr,di,Gt,ni,pi,bi,Fi,Xt,fi,wi,Mi,Oi,Ui,Bt,mi,tt,Ki,gi,Ti,mr){const Mr=Re.addToLineVertexArray(et,It);let Cr,ln,gr,nr,Vi=0,cn=0,_o=0,Fu=0,qc=-1,jc=-1;const hn={};let Ou=Ut(""),Zc=0,Gc=0;if(Gt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Zc,Gc]=Gt.layout.get("text-offset").evaluate(tt,{},Ti).map(Ni=>Ni*ri):(Zc=Gt.layout.get("text-radial-offset").evaluate(tt,{},Ti)*ri,Gc=Lc),Re.allowVerticalPlacement&&Mt.vertical){const Ni=Gt.layout.get("text-rotate").evaluate(tt,{},Ti)+90;gr=new Il(ni,et,pi,bi,Fi,Mt.vertical,Xt,fi,wi,Ni),di&&(nr=new Il(ni,et,pi,bi,Fi,di,Oi,Ui,wi,Ni))}if(Jt){const Ni=Gt.layout.get("icon-rotate").evaluate(tt,{}),jr=Gt.layout.get("icon-text-fit")!=="none",yo=Mu(Jt,Ni,gi,jr),xo=di?Mu(di,Ni,gi,jr):void 0;ln=new Il(ni,et,pi,bi,Fi,Jt,Oi,Ui,!1,Ni),Vi=4*yo.length;const Nu=Re.iconSizeData;let ps=null;Nu.kind==="source"?(ps=[qr*Gt.layout.get("icon-size").evaluate(tt,{})],ps[0]>Fn&&ci(`${Re.layerIds[0]}: Value for "icon-size" is >= ${po}. Reduce your "icon-size".`)):Nu.kind==="composite"&&(ps=[qr*Ki.compositeIconSizes[0].evaluate(tt,{},Ti),qr*Ki.compositeIconSizes[1].evaluate(tt,{},Ti)],(ps[0]>Fn||ps[1]>Fn)&&ci(`${Re.layerIds[0]}: Value for "icon-size" is >= ${po}. Reduce your "icon-size".`)),Re.addSymbols(Re.icon,yo,ps,mi,Bt,tt,h.WritingMode.none,et,Mr.lineStartIndex,Mr.lineLength,-1,Ti),qc=Re.icon.placedSymbolArray.length-1,xo&&(cn=4*xo.length,Re.addSymbols(Re.icon,xo,ps,mi,Bt,tt,h.WritingMode.vertical,et,Mr.lineStartIndex,Mr.lineLength,-1,Ti),jc=Re.icon.placedSymbolArray.length-1)}const Uu=Object.keys(Mt.horizontal);for(const Ni of Uu){const jr=Mt.horizontal[Ni];if(!Cr){Ou=Ut(jr.text);const xo=Gt.layout.get("text-rotate").evaluate(tt,{},Ti);Cr=new Il(ni,et,pi,bi,Fi,jr,Xt,fi,wi,xo)}const yo=jr.positionedLines.length===1;if(_o+=zu(Re,et,jr,rr,Gt,wi,tt,Mi,Mr,Mt.vertical?h.WritingMode.horizontal:h.WritingMode.horizontalOnly,yo?Uu:[Ni],hn,qc,Ki,Ti),yo)break}Mt.vertical&&(Fu+=zu(Re,et,Mt.vertical,rr,Gt,wi,tt,Mi,Mr,h.WritingMode.vertical,["vertical"],hn,jc,Ki,Ti));const Np=Cr?Cr.boxStartIndex:Re.collisionBoxArray.length,$p=Cr?Cr.boxEndIndex:Re.collisionBoxArray.length,qp=gr?gr.boxStartIndex:Re.collisionBoxArray.length,jp=gr?gr.boxEndIndex:Re.collisionBoxArray.length,Zp=ln?ln.boxStartIndex:Re.collisionBoxArray.length,Gp=ln?ln.boxEndIndex:Re.collisionBoxArray.length,Xp=nr?nr.boxStartIndex:Re.collisionBoxArray.length,Wp=nr?nr.boxEndIndex:Re.collisionBoxArray.length;let kr=-1;const Pl=(Ni,jr)=>Ni&&Ni.circleDiameter?Math.max(Ni.circleDiameter,jr):jr;kr=Pl(Cr,kr),kr=Pl(gr,kr),kr=Pl(ln,kr),kr=Pl(nr,kr);const Vu=kr>-1?1:0;Vu&&(kr*=mr/ri),Re.glyphOffsetArray.length>=oa.MAX_GLYPHS&&ci("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),tt.sortKey!==void 0&&Re.addToSortKeyRanges(Re.symbolInstances.length,tt.sortKey),Re.symbolInstances.emplaceBack(et.x,et.y,hn.right>=0?hn.right:-1,hn.center>=0?hn.center:-1,hn.left>=0?hn.left:-1,hn.vertical||-1,qc,jc,Ou,Np,$p,qp,jp,Zp,Gp,Xp,Wp,pi,_o,Fu,Vi,cn,Vu,0,Xt,Zc,Gc,kr)}(i,Ve,ge,r,s,l,Me,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,F,[ie,ie,ie,ie],ze,g,Q,ne,Be,C,e,u,v,b,d)};if(Pe==="line")for(const ge of Tu(e.geometry,0,0,St,St)){const Ve=Dp(ge,X,ce,r.vertical||z,s,24,K,i.overscaling,St);for(const Re of Ve)z&&Up(i,z.text,Se,Re)||Ie(ge,Re)}else if(Pe==="line-center"){for(const ge of e.geometry)if(ge.length>1){const Ve=zp(ge,ce,r.vertical||z,s,24,K);Ve&&Ie(ge,Ve)}}else if(e.type==="Polygon")for(const ge of pc(e.geometry,0)){const Ve=Rp(ge,16);Ie(ge[0],new Un(Ve.x,Ve.y,0))}else if(e.type==="LineString")for(const ge of e.geometry)Ie(ge,new Un(ge[0].x,ge[0].y,0));else if(e.type==="Point")for(const ge of e.geometry)for(const Ve of ge)Ie([Ve],new Un(Ve.x,Ve.y,0))}function zu(i,e,r,s,l,u,d,f,g,v,b,E,A,C,z){const U=function(Q,X,ie,ne,ce,ze,Be,Pe){const Se=ne.layout.get("text-rotate").evaluate(ze,{})*Math.PI/180,we=[];for(const Me of X.positionedLines)for(const Ie of Me.positionedGlyphs){if(!Ie.rect)continue;const ge=Ie.rect||{};let Ve=Kh+1,Re=!0,et=1,It=0;const Mt=(ce||Pe)&&Ie.vertical,Jt=Ie.metrics.advance*Ie.scale/2;if(Pe&&X.verticalizable&&(It=Me.lineOffset/2-(Ie.imageName?-(ri-Ie.metrics.width*Ie.scale)/2:(Ie.scale-1)*ri)),Ie.imageName){const Bt=Be[Ie.imageName];Re=Bt.sdf,et=Bt.pixelRatio,Ve=Ri/et}const rr=ce?[Ie.x+Jt,Ie.y]:[0,0];let di=ce?[0,0]:[Ie.x+Jt+ie[0],Ie.y+ie[1]-It],Gt=[0,0];Mt&&(Gt=di,di=[0,0]);const ni=(Ie.metrics.left-Ve)*Ie.scale-Jt+di[0],pi=(-Ie.metrics.top-Ve)*Ie.scale+di[1],bi=ni+ge.w*Ie.scale/et,Fi=pi+ge.h*Ie.scale/et,Xt=new ye(ni,pi),fi=new ye(bi,pi),wi=new ye(ni,Fi),Mi=new ye(bi,Fi);if(Mt){const Bt=new ye(-Jt,Jt-ho),mi=-Math.PI/2,tt=ri/2-Jt,Ki=new ye(5-ho-tt,-(Ie.imageName?tt:0)),gi=new ye(...Gt);Xt._rotateAround(mi,Bt)._add(Ki)._add(gi),fi._rotateAround(mi,Bt)._add(Ki)._add(gi),wi._rotateAround(mi,Bt)._add(Ki)._add(gi),Mi._rotateAround(mi,Bt)._add(Ki)._add(gi)}if(Se){const Bt=Math.sin(Se),mi=Math.cos(Se),tt=[mi,-Bt,Bt,mi];Xt._matMult(tt),fi._matMult(tt),wi._matMult(tt),Mi._matMult(tt)}const Oi=new ye(0,0),Ui=new ye(0,0);we.push({tl:Xt,tr:fi,bl:wi,br:Mi,tex:ge,writingMode:X.writingMode,glyphOffset:rr,sectionIndex:Ie.sectionIndex,isSDF:Re,pixelOffsetTL:Oi,pixelOffsetBR:Ui,minFontScaleX:0,minFontScaleY:0})}return we}(0,r,f,l,u,d,s,i.allowVerticalPlacement),F=i.textSizeData;let K=null;F.kind==="source"?(K=[qr*l.layout.get("text-size").evaluate(d,{})],K[0]>Fn&&ci(`${i.layerIds[0]}: Value for "text-size" is >= ${po}. Reduce your "text-size".`)):F.kind==="composite"&&(K=[qr*C.compositeTextSizes[0].evaluate(d,{},z),qr*C.compositeTextSizes[1].evaluate(d,{},z)],(K[0]>Fn||K[1]>Fn)&&ci(`${i.layerIds[0]}: Value for "text-size" is >= ${po}. Reduce your "text-size".`)),i.addSymbols(i.text,U,K,f,u,d,v,e,g.lineStartIndex,g.lineLength,A,z);for(const Q of b)E[Q]=i.text.placedSymbolArray.length-1;return 4*U.length}function Du(i){for(const e in i)return i[e];return null}function Up(i,e,r,s){const l=i.compareText;if(e in l){const u=l[e];for(let d=u.length-1;d>=0;d--)if(s.dist(u[d])>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const u=Lu[15&s];if(!u)throw new Error("Unrecognized array type.");const[d]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new Rc(f,d,u,e)}constructor(e,r=64,s=Float64Array,l){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const u=Lu.indexOf(this.ArrayType),d=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-f%8)%8;if(u<0)throw new Error(`Unexpected typed array class: ${s}.`);l&&l instanceof ArrayBuffer?(this.data=l,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+d+f+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+u]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=r,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Fc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:u,coords:d,nodeSize:f}=this,g=[0,u.length-1,0],v=[];for(;g.length;){const b=g.pop()||0,E=g.pop()||0,A=g.pop()||0;if(E-A<=f){for(let F=A;F<=E;F++){const K=d[2*F],Q=d[2*F+1];K>=e&&K<=s&&Q>=r&&Q<=l&&v.push(u[F])}continue}const C=A+E>>1,z=d[2*C],U=d[2*C+1];z>=e&&z<=s&&U>=r&&U<=l&&v.push(u[C]),(b===0?e<=z:r<=U)&&(g.push(A),g.push(C-1),g.push(1-b)),(b===0?s>=z:l>=U)&&(g.push(C+1),g.push(E),g.push(1-b))}return v}within(e,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:d}=this,f=[0,l.length-1,0],g=[],v=s*s;for(;f.length;){const b=f.pop()||0,E=f.pop()||0,A=f.pop()||0;if(E-A<=d){for(let F=A;F<=E;F++)Ru(u[2*F],u[2*F+1],e,r)<=v&&g.push(l[F]);continue}const C=A+E>>1,z=u[2*C],U=u[2*C+1];Ru(z,U,e,r)<=v&&g.push(l[C]),(b===0?e-s<=z:r-s<=U)&&(f.push(A),f.push(C-1),f.push(1-b)),(b===0?e+s>=z:r+s>=U)&&(f.push(C+1),f.push(E),f.push(1-b))}return g}}function Fc(i,e,r,s,l,u){if(l-s<=r)return;const d=s+l>>1;Bu(i,e,d,s,l,u),Fc(i,e,r,s,d-1,1-u),Fc(i,e,r,d+1,l,1-u)}function Bu(i,e,r,s,l,u){for(;l>s;){if(l-s>600){const v=l-s+1,b=r-s+1,E=Math.log(v),A=.5*Math.exp(2*E/3),C=.5*Math.sqrt(E*A*(v-A)/v)*(b-v/2<0?-1:1);Bu(i,e,r,Math.max(s,Math.floor(r-b*A/v+C)),Math.min(l,Math.floor(r+(v-b)*A/v+C)),u)}const d=e[2*r+u];let f=s,g=l;for(mo(i,e,s,r),e[2*l+u]>d&&mo(i,e,s,l);fd;)g--}e[2*s+u]===d?mo(i,e,s,g):(g++,mo(i,e,g,l)),g<=r&&(s=g+1),r<=g&&(l=g-1)}}function mo(i,e,r,s){Oc(i,r,s),Oc(e,2*r,2*s),Oc(e,2*r+1,2*s+1)}function Oc(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function Ru(i,e,r,s){const l=i-r,u=e-s;return l*l+u*u}var Uc;h.PerformanceMarkers=void 0,(Uc=h.PerformanceMarkers||(h.PerformanceMarkers={})).create="create",Uc.load="load",Uc.fullLoad="fullLoad";let Al=null,go=[];const Vc=1e3/60,Nc="loadTime",$c="fullLoadTime",Vp={mark(i){performance.mark(i)},frame(i){const e=i;Al!=null&&go.push(e-Al),Al=e},clearMetrics(){Al=null,go=[],performance.clearMeasures(Nc),performance.clearMeasures($c);for(const i in h.PerformanceMarkers)performance.clearMarks(h.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure(Nc,h.PerformanceMarkers.create,h.PerformanceMarkers.load),performance.measure($c,h.PerformanceMarkers.create,h.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName(Nc)[0].duration,e=performance.getEntriesByName($c)[0].duration,r=go.length,s=1/(go.reduce((u,d)=>u+d,0)/r/1e3),l=go.filter(u=>u>Vc).reduce((u,d)=>u+(d-Vc)/Vc,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};h.AJAXError=Dr,h.ARRAY_TYPE=ta,h.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Wt(["receive","process"],this),this.invoker=new Cp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=$i()?i:window}send(i,e,r,s,l=!1){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[u]=r);const d=zr(this.globalScope)?void 0:[];return this.target.postMessage({id:u,type:i,hasCallback:!!r,targetMapId:s,mustQueue:l,sourceMapId:this.mapId,data:ns(e,d)},d),{cancel:()=>{r&&delete this.callbacks[u],this.target.postMessage({id:u,type:"",targetMapId:s,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type===""){delete this.tasks[r];const s=this.cancelCallbacks[r];delete this.cancelCallbacks[r],s&&s()}else $i()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type===""){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Sr(e.error)):r(null,Sr(e.data)))}else{let r=!1;const s=zr(this.globalScope)?void 0:[],l=e.hasCallback?(f,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:f?ns(f):null,data:ns(g,s)},s)}:f=>{r=!0};let u=null;const d=Sr(e.data);if(this.parent[e.type])u=this.parent[e.type](e.sourceMapId,d,l);else if(this.parent.getWorkerSource){const f=e.type.split(".");u=this.parent.getWorkerSource(e.sourceMapId,f[0],d.source)[f[1]](d,l)}else l(new Error(`Could not find function ${e.type}`));!r&&u&&u.cancel&&(this.cancelCallbacks[i]=u.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},h.AlphaImage=io,h.CanonicalTileID=Dc,h.CollisionBoxArray=c,h.CollisionCircleLayoutArray=class extends Ws{},h.Color=je,h.DEMData=_u,h.DataConstantProperty=Fe,h.DictionaryCoder=yu,h.EXTENT=St,h.ErrorEvent=ji,h.EvaluationParameters=Pt,h.Event=vr,h.Evented=xn,h.FeatureIndex=vu,h.FillBucket=gc,h.FillExtrusionBucket=yc,h.GeoJSONFeature=xu,h.ImageAtlas=Jh,h.ImagePosition=Tc,h.KDBush=Rc,h.LineBucket=xc,h.LineStripIndexArray=class extends t{},h.LngLat=On,h.MercatorCoordinate=wl,h.ONE_EM=ri,h.OverscaledTileID=ir,h.PerformanceUtils=Vp,h.Point=ye,h.Pos3dArray=class extends Zs{},h.PosArray=O,h.Properties=Ai,h.Protobuf=bc,h.QuadTriangleArray=class extends Hs{},h.RGBAImage=tr,h.RasterBoundsArray=class extends Ha{},h.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},h.SegmentVector=Ee,h.SymbolBucket=oa,h.Transitionable=rl,h.TriangleIndexArray=fe,h.Uniform1f=fr,h.Uniform1i=class extends vi{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},h.Uniform2f=class extends vi{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},h.Uniform3f=class extends vi{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},h.Uniform4f=cs,h.UniformColor=ui,h.UniformMatrix4f=class extends vi{constructor(i,e){super(i,e),this.current=ti}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},h.UnwrappedTileID=gu,h.ValidationError=be,h.ZoomHistory=Yo,h.addDynamicAttributes=Ac,h.arrayBufferToImage=function(i,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>{r.src=yr})},r.onerror=()=>e(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 s=new Blob([new Uint8Array(i)],{type:"image/png"});r.src=i.byteLength?URL.createObjectURL(s):yr},h.arrayBufferToImageBitmap=function(i,e){const r=new Blob([new Uint8Array(i)],{type:"image/png"});createImageBitmap(r).then(s=>{e(null,s)}).catch(s=>{e(new Error(`Could not load image because of ${s.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},h.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let s=i.length;const l=new Array(i.length);let u=null;i.forEach((d,f)=>{e(d,(g,v)=>{g&&(u=g),l[f]=v,--s==0&&r(u,l)})})},h.bezier=At,h.bindAll=Wt,h.clamp=nt,h.clipLine=Tu,h.clone=function(i){var e=new ta(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},h.clone$1=Ei,h.collisionCircleLayout=sp,h.config=$n,h.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},h.create=function(){var i=new ta(16);return ta!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},h.createExpression=Ct,h.createFilter=La,h.createLayout=Zt,h.createStyleLayer=function(i){return i.type==="custom"?new Pp(i):new Mp[i.type](i)},h.deepEqual=function i(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(let s=0;s{s[d.source]?r.push({command:at.removeLayer,args:[d.id]}):u.push(d)}),r=r.concat(l),function(d,f,g){f=f||[];const v=(d=d||[]).map(vn),b=f.map(vn),E=d.reduce(Jr,{}),A=f.reduce(Jr,{}),C=v.slice(),z=Object.create(null);let U,F,K,Q,X,ie,ne;for(U=0,F=0;U{}}},h.groupByLayout=function(i,e){const r={};for(let l=0;l@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,s,l,u)=>{const d=l||u;return e[s]=!d||d.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},h.parseGlyphPbf=function(i){return new bc(i).readFields(gp,[])},h.pbf=qh,h.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=St/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,s={layoutIconSize:r["icon-size"].possiblyEvaluate(new Pt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Pt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Pt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:v}=i.bucket.textSizeData;s.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Pt(g),i.canonical),r["text-size"].possiblyEvaluate(new Pt(v),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:v}=i.bucket.iconSizeData;s.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Pt(g),i.canonical),r["icon-size"].possiblyEvaluate(new Pt(v),i.canonical)]}const l=e.get("text-line-height")*ri,u=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",d=e.get("text-keep-upright"),f=e.get("text-size");for(const g of i.bucket.features){const v=e.get("text-font").evaluate(g,{},i.canonical).join(","),b=f.evaluate(g,{},i.canonical),E=s.layoutTextSize.evaluate(g,{},i.canonical),A=s.layoutIconSize.evaluate(g,{},i.canonical),C={horizontal:{},vertical:void 0},z=g.text;let U,F=[0,0];if(z){const X=z.toString(),ie=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*ri,ne=Va(X)?ie:0,ce=e.get("text-anchor").evaluate(g,{},i.canonical),ze=e.get("text-variable-anchor");if(!ze){const Me=e.get("text-radial-offset").evaluate(g,{},i.canonical);F=Me?ku(ce,[Me*ri,Lc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Ie=>Ie*ri)}let Be=u?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Pe=e.get("symbol-placement"),Se=Pe==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*ri:0,we=()=>{i.bucket.allowVerticalPlacement&&Fs(X)&&(C.vertical=yl(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,Se,l,ce,"left",ne,F,h.WritingMode.vertical,!0,Pe,E,b))};if(!u&&ze){const Me=Be==="auto"?ze.map(ge=>Bc(ge)):[Be];let Ie=!1;for(let ge=0;gethis._layers[de.id]),J=Z[0];if(J.visibility==="none")continue;const W=J.source||"";let G=this.familiesBySource[W];G||(G=this.familiesBySource[W]={});const ee=J.sourceLayer||"_geojsonTileLayer";let he=G[ee];he||(he=G[ee]=[]),he.push(Z)}}}class Y{constructor(S){const P={},D=[];for(const W in S){const G=S[W],ee=P[W]={};for(const he in G){const de=G[+he];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const ue={x:0,y:0,w:de.bitmap.width+2,h:de.bitmap.height+2};D.push(ue),ee[he]={rect:ue,metrics:de.metrics}}}const{w:q,h:Z}=h.potpack(D),J=new h.AlphaImage({width:q||1,height:Z||1});for(const W in S){const G=S[W];for(const ee in G){const he=G[+ee];if(!he||he.bitmap.width===0||he.bitmap.height===0)continue;const de=P[W][ee].rect;h.AlphaImage.copy(he.bitmap,J,{x:0,y:0},{x:de.x+1,y:de.y+1},he.bitmap)}}this.image=J,this.positions=P}}h.register("GlyphAtlas",Y);class Qe{constructor(S){this.tileID=new h.OverscaledTileID(S.tileID.overscaledZ,S.tileID.wrap,S.tileID.canonical.z,S.tileID.canonical.x,S.tileID.canonical.y),this.uid=S.uid,this.zoom=S.zoom,this.pixelRatio=S.pixelRatio,this.tileSize=S.tileSize,this.source=S.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=S.showCollisionBoxes,this.collectResourceTiming=!!S.collectResourceTiming,this.returnDependencies=!!S.returnDependencies,this.promoteId=S.promoteId}parse(S,P,D,q,Z){this.status="parsing",this.data=S,this.collisionBoxArray=new h.CollisionBoxArray;const J=new h.DictionaryCoder(Object.keys(S.layers).sort()),W=new h.FeatureIndex(this.tileID,this.promoteId);W.bucketLayerIDs=[];const G={},ee={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:D},he=P.familiesBySource[this.source];for(const Je in he){const ot=S.layers[Je];if(!ot)continue;ot.version===1&&h.warnOnce(`Vector tile source "${this.source}" layer "${Je}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const vt=J.encode(Je),$t=[];for(let je=0;je=zt.maxzoom||zt.visibility!=="none"&&(ye(je,this.zoom,D),(G[zt.id]=zt.createBucket({index:W.bucketLayerIDs.length,layers:je,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:vt,sourceID:this.source})).populate($t,ee,this.tileID.canonical),W.bucketLayerIDs.push(je.map(Fr=>Fr.id)))}}let de,ue,Ne,Ge;const Le=h.mapObject(ee.glyphDependencies,Je=>Object.keys(Je).map(Number));Object.keys(Le).length?q.send("getGlyphs",{uid:this.uid,stacks:Le,source:this.source,tileID:this.tileID,type:"glyphs"},(Je,ot)=>{de||(de=Je,ue=ot,st.call(this))}):ue={};const Oe=Object.keys(ee.iconDependencies);Oe.length?q.send("getImages",{icons:Oe,source:this.source,tileID:this.tileID,type:"icons"},(Je,ot)=>{de||(de=Je,Ne=ot,st.call(this))}):Ne={};const Ze=Object.keys(ee.patternDependencies);function st(){if(de)return Z(de);if(ue&&Ne&&Ge){const Je=new Y(ue),ot=new h.ImageAtlas(Ne,Ge);for(const vt in G){const $t=G[vt];$t instanceof h.SymbolBucket?(ye($t.layers,this.zoom,D),h.performSymbolLayout({bucket:$t,glyphMap:ue,glyphPositions:Je.positions,imageMap:Ne,imagePositions:ot.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):$t.hasPattern&&($t instanceof h.LineBucket||$t instanceof h.FillBucket||$t instanceof h.FillExtrusionBucket)&&(ye($t.layers,this.zoom,D),$t.addFeatures(ee,this.tileID.canonical,ot.patternPositions))}this.status="done",Z(null,{buckets:Object.values(G).filter(vt=>!vt.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Je.image,imageAtlas:ot,glyphMap:this.returnDependencies?ue:null,iconMap:this.returnDependencies?Ne:null,glyphPositions:this.returnDependencies?Je.positions:null})}}Ze.length?q.send("getImages",{icons:Ze,source:this.source,tileID:this.tileID,type:"patterns"},(Je,ot)=>{de||(de=Je,Ge=ot,st.call(this))}):Ge={},st.call(this)}}function ye(V,S,P){const D=new h.EvaluationParameters(S);for(const q of V)q.recalculate(D,P)}function _t(V,S){const P=h.getArrayBuffer(V.request,(D,q,Z,J)=>{D?S(D):q&&S(null,{vectorTile:new h.vectorTile.VectorTile(new h.Protobuf(q)),rawData:q,cacheControl:Z,expires:J})});return()=>{P.cancel(),S()}}class Et{constructor(S,P,D,q){this.actor=S,this.layerIndex=P,this.availableImages=D,this.loadVectorData=q||_t,this.loading={},this.loaded={}}loadTile(S,P){const D=S.uid;this.loading||(this.loading={});const q=!!(S&&S.request&&S.request.collectResourceTiming)&&new h.RequestPerformance(S.request),Z=this.loading[D]=new Qe(S);Z.abort=this.loadVectorData(S,(J,W)=>{if(delete this.loading[D],J||!W)return Z.status="done",this.loaded[D]=Z,P(J);const G=W.rawData,ee={};W.expires&&(ee.expires=W.expires),W.cacheControl&&(ee.cacheControl=W.cacheControl);const he={};if(q){const de=q.finish();de&&(he.resourceTiming=JSON.parse(JSON.stringify(de)))}Z.vectorTile=W.vectorTile,Z.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,(de,ue)=>{if(de||!ue)return P(de);P(null,h.extend({rawTileData:G.slice(0)},ue,ee,he))}),this.loaded=this.loaded||{},this.loaded[D]=Z})}reloadTile(S,P){const D=this.loaded,q=S.uid,Z=this;if(D&&D[q]){const J=D[q];J.showCollisionBoxes=S.showCollisionBoxes;const W=(G,ee)=>{const he=J.reloadCallback;he&&(delete J.reloadCallback,J.parse(J.vectorTile,Z.layerIndex,this.availableImages,Z.actor,he)),P(G,ee)};J.status==="parsing"?J.reloadCallback=W:J.status==="done"&&(J.vectorTile?J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor,W):W())}}abortTile(S,P){const D=this.loading,q=S.uid;D&&D[q]&&D[q].abort&&(D[q].abort(),delete D[q]),P()}removeTile(S,P){const D=this.loaded,q=S.uid;D&&D[q]&&delete D[q],P()}}class it{constructor(){this.loaded={}}loadTile(S,P){const{uid:D,encoding:q,rawImageData:Z}=S,J=h.isImageBitmap(Z)?this.getImageData(Z):Z,W=new h.DEMData(D,J,q);this.loaded=this.loaded||{},this.loaded[D]=W,P(null,W)}getImageData(S){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(S.width,S.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=S.width,this.offscreenCanvas.height=S.height,this.offscreenCanvasContext.drawImage(S,0,0,S.width,S.height);const P=this.offscreenCanvasContext.getImageData(-1,-1,S.width+2,S.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new h.RGBAImage({width:P.width,height:P.height},P.data)}removeTile(S){const P=this.loaded,D=S.uid;P&&P[D]&&delete P[D]}}function At(V,S){if(V.length!==0){kt(V[0],S);for(var P=1;P=Math.abs(W)?P-G+W:W-G+P,P=G}P+D>=0!=!!S&&V.reverse()}var nt=h.getDefaultExportFromCjs(function V(S,P){var D,q=S&&S.type;if(q==="FeatureCollection")for(D=0;D>31}function yr(V,S){for(var P=V.loadGeometry(),D=V.type,q=0,Z=0,J=P.length,W=0;WV},$n=Math.fround||(Dr=new Float32Array(1),V=>(Dr[0]=+V,Dr[0]));var Dr;const yi=3,qi=5,si=6;class _n{constructor(S){this.options=Object.assign(Object.create(gn),S),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(S){const{log:P,minZoom:D,maxZoom:q}=this.options;P&&console.time("total time");const Z=`prepare ${S.length} points`;P&&console.time(Z),this.points=S;const J=[];for(let G=0;G=D;G--){const ee=+Date.now();W=this.trees[G]=this._createTree(this._cluster(W,G)),P&&console.log("z%d: %d clusters in %dms",G,W.numItems,+Date.now()-ee)}return P&&console.timeEnd("total time"),this}getClusters(S,P){let D=((S[0]+180)%360+360)%360-180;const q=Math.max(-90,Math.min(90,S[1]));let Z=S[2]===180?180:((S[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,S[3]));if(S[2]-S[0]>=360)D=-180,Z=180;else if(D>Z){const de=this.getClusters([D,q,180,J],P),ue=this.getClusters([-180,q,Z,J],P);return de.concat(ue)}const W=this.trees[this._limitZoom(P)],G=W.range(Lr(D),xr(J),Lr(Z),xr(q)),ee=W.data,he=[];for(const de of G){const ue=this.stride*de;he.push(ee[ue+qi]>1?yn(ee,ue,this.clusterProps):this.points[ee[ue+yi]])}return he}getChildren(S){const P=this._getOriginId(S),D=this._getOriginZoom(S),q="No cluster with the specified id.",Z=this.trees[D];if(!Z)throw new Error(q);const J=Z.data;if(P*this.stride>=J.length)throw new Error(q);const W=this.options.radius/(this.options.extent*Math.pow(2,D-1)),G=Z.within(J[P*this.stride],J[P*this.stride+1],W),ee=[];for(const he of G){const de=he*this.stride;J[de+4]===S&&ee.push(J[de+qi]>1?yn(J,de,this.clusterProps):this.points[J[de+yi]])}if(ee.length===0)throw new Error(q);return ee}getLeaves(S,P,D){const q=[];return this._appendLeaves(q,S,P=P||10,D=D||0,0),q}getTile(S,P,D){const q=this.trees[this._limitZoom(S)],Z=Math.pow(2,S),{extent:J,radius:W}=this.options,G=W/J,ee=(D-G)/Z,he=(D+1+G)/Z,de={features:[]};return this._addTileFeatures(q.range((P-G)/Z,ee,(P+1+G)/Z,he),q.data,P,D,Z,de),P===0&&this._addTileFeatures(q.range(1-G/Z,ee,1,he),q.data,Z,D,Z,de),P===Z-1&&this._addTileFeatures(q.range(0,ee,G/Z,he),q.data,-1,D,Z,de),de.features.length?de:null}getClusterExpansionZoom(S){let P=this._getOriginZoom(S)-1;for(;P<=this.options.maxZoom;){const D=this.getChildren(S);if(P++,D.length!==1)break;S=D[0].properties.cluster_id}return P}_appendLeaves(S,P,D,q,Z){const J=this.getChildren(P);for(const W of J){const G=W.properties;if(G&&G.cluster?Z+G.point_count<=q?Z+=G.point_count:Z=this._appendLeaves(S,G.cluster_id,D,q,Z):Z1;let he,de,ue;if(ee)he=Hr(P,G,this.clusterProps),de=P[G],ue=P[G+1];else{const Le=this.points[P[G+yi]];he=Le.properties;const[Oe,Ze]=Le.geometry.coordinates;de=Lr(Oe),ue=xr(Ze)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(de*Z-D)),Math.round(this.options.extent*(ue*Z-q))]],tags:he};let Ge;Ge=ee||this.options.generateId?P[G+yi]:this.points[P[G+yi]].id,Ge!==void 0&&(Ne.id=Ge),J.features.push(Ne)}}_limitZoom(S){return Math.max(this.options.minZoom,Math.min(Math.floor(+S),this.options.maxZoom+1))}_cluster(S,P){const{radius:D,extent:q,reduce:Z,minPoints:J}=this.options,W=D/(q*Math.pow(2,P)),G=S.data,ee=[],he=this.stride;for(let de=0;deP&&(Oe+=G[st+qi])}if(Oe>Le&&Oe>=J){let Ze,st=ue*Le,Je=Ne*Le,ot=-1;const vt=((de/he|0)<<5)+(P+1)+this.points.length;for(const $t of Ge){const je=$t*he;if(G[je+2]<=P)continue;G[je+2]=P;const zt=G[je+qi];st+=G[je]*zt,Je+=G[je+1]*zt,G[je+4]=vt,Z&&(Ze||(Ze=this._map(G,de,!0),ot=this.clusterProps.length,this.clusterProps.push(Ze)),Z(Ze,this._map(G,je)))}G[de+4]=vt,ee.push(st/Oe,Je/Oe,1/0,vt,-1,Oe),Z&&ee.push(ot)}else{for(let Ze=0;Ze1)for(const Ze of Ge){const st=Ze*he;if(!(G[st+2]<=P)){G[st+2]=P;for(let Je=0;Je>5}_getOriginZoom(S){return(S-this.points.length)%32}_map(S,P,D){if(S[P+qi]>1){const J=this.clusterProps[S[P+si]];return D?Object.assign({},J):J}const q=this.points[S[P+yi]].properties,Z=this.options.map(q);return D&&Z===q?Object.assign({},Z):Z}}function yn(V,S,P){return{type:"Feature",id:V[S+yi],properties:Hr(V,S,P),geometry:{type:"Point",coordinates:[(D=V[S],360*(D-.5)),vr(V[S+1])]}};var D}function Hr(V,S,P){const D=V[S+qi],q=D>=1e4?`${Math.round(D/1e3)}k`:D>=1e3?Math.round(D/100)/10+"k":D,Z=V[S+si],J=Z===-1?{}:Object.assign({},P[Z]);return Object.assign(J,{cluster:!0,cluster_id:V[S+yi],point_count:D,point_count_abbreviated:q})}function Lr(V){return V/360+.5}function xr(V){const S=Math.sin(V*Math.PI/180),P=.5-.25*Math.log((1+S)/(1-S))/Math.PI;return P<0?0:P>1?1:P}function vr(V){const S=(180-360*V)*Math.PI/180;return 360*Math.atan(Math.exp(S))/Math.PI-90}function ji(V,S,P,D){for(var q,Z=D,J=P-S>>1,W=P-S,G=V[S],ee=V[S+1],he=V[P],de=V[P+1],ue=S+3;ueZ)q=ue,Z=Ne;else if(Ne===Z){var Ge=Math.abs(ue-J);GeD&&(q-S>3&&ji(V,S,q,D),V[q+2]=Z,P-q>3&&ji(V,q,P,D))}function xn(V,S,P,D,q,Z){var J=q-P,W=Z-D;if(J!==0||W!==0){var G=((V-P)*J+(S-D)*W)/(J*J+W*W);G>1?(P=q,D=Z):G>0&&(P+=J*G,D+=W*G)}return(J=V-P)*J+(W=S-D)*W}function le(V,S,P,D){var q={id:V===void 0?null:V,type:S,geometry:P,tags:D,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Z){var J=Z.geometry,W=Z.type;if(W==="Point"||W==="MultiPoint"||W==="LineString")Br(Z,J);else if(W==="Polygon"||W==="MultiLineString")for(var G=0;G0&&(J+=D?(q*ee-G*Z)/2:Math.sqrt(Math.pow(G-q,2)+Math.pow(ee-Z,2))),q=G,Z=ee}var he=S.length-3;S[2]=1,ji(S,0,he,P),S[he+2]=1,S.size=Math.abs(J),S.start=0,S.end=S.size}function Kr(V,S,P,D){for(var q=0;q1?1:P}function Nt(V,S,P,D,q,Z,J,W){if(D/=S,Z>=(P/=S)&&J=D)return null;for(var G=[],ee=0;ee=P&&Ge=D)){var Le=[];if(ue==="Point"||ue==="MultiPoint")Yr(de,Le,P,D,q);else if(ue==="LineString")vn(de,Le,P,D,q,!1,W.lineMetrics);else if(ue==="MultiLineString")be(de,Le,P,D,q,!1);else if(ue==="Polygon")be(de,Le,P,D,q,!0);else if(ue==="MultiPolygon")for(var Oe=0;Oe=P&&J<=D&&(S.push(V[Z]),S.push(V[Z+1]),S.push(V[Z+2]))}}function vn(V,S,P,D,q,Z,J){for(var W,G,ee=Jr(V),he=q===0?hi:bn,de=V.start,ue=0;ueP&&(G=he(ee,Ne,Ge,Oe,Ze,P),J&&(ee.start=de+W*G)):st>D?Je=P&&(G=he(ee,Ne,Ge,Oe,Ze,P),ot=!0),Je>D&&st<=D&&(G=he(ee,Ne,Ge,Oe,Ze,D),ot=!0),!Z&&ot&&(J&&(ee.end=de+W*G),S.push(ee),ee=Jr(V)),J&&(de+=W)}var vt=V.length-3;Ne=V[vt],Ge=V[vt+1],Le=V[vt+2],(st=q===0?Ne:Ge)>=P&&st<=D&&ar(ee,Ne,Ge,Le),vt=ee.length-3,Z&&vt>=3&&(ee[vt]!==ee[0]||ee[vt+1]!==ee[1])&&ar(ee,ee[0],ee[1],ee[2]),ee.length&&S.push(ee)}function Jr(V){var S=[];return S.size=V.size,S.start=V.start,S.end=V.end,S}function be(V,S,P,D,q,Z){for(var J=0;JJ.maxX&&(J.maxX=he),de>J.maxY&&(J.maxY=de)}return J}function Ht(V,S,P,D){var q=S.geometry,Z=S.type,J=[];if(Z==="Point"||Z==="MultiPoint")for(var W=0;W0&&S.size<(q?J:D))P.numPoints+=S.length/3;else{for(var W=[],G=0;GJ)&&(P.numSimplified++,W.push(S[G]),W.push(S[G+1])),P.numPoints++;q&&function(ee,he){for(var de=0,ue=0,Ne=ee.length,Ge=Ne-2;ue0===he)for(ue=0,Ne=ee.length;ue24)throw new Error("maxZoom should be in the 0-24 range");if(S.promoteId&&S.generateId)throw new Error("promoteId and generateId cannot be used together.");var D=function(q,Z){var J=[];if(q.type==="FeatureCollection")for(var W=0;W1&&console.time("creation"),ue=this.tiles[de]=Si(V,S,P,D,G),this.tileCoords.push({z:S,x:P,y:D}),ee)){ee>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",S,P,D,ue.numFeatures,ue.numPoints,ue.numSimplified),console.timeEnd("creation"));var Ne="z"+S;this.stats[Ne]=(this.stats[Ne]||0)+1,this.total++}if(ue.source=V,q){if(S===G.maxZoom||S===q)continue;var Ge=1<1&&console.time("clipping");var Le,Oe,Ze,st,Je,ot,vt=.5*G.buffer/G.extent,$t=.5-vt,je=.5+vt,zt=1+vt;Le=Oe=Ze=st=null,Je=Nt(V,he,P-vt,P+je,0,ue.minX,ue.maxX,G),ot=Nt(V,he,P+$t,P+zt,0,ue.minX,ue.maxX,G),V=null,Je&&(Le=Nt(Je,he,D-vt,D+je,1,ue.minY,ue.maxY,G),Oe=Nt(Je,he,D+$t,D+zt,1,ue.minY,ue.maxY,G),Je=null),ot&&(Ze=Nt(ot,he,D-vt,D+je,1,ue.minY,ue.maxY,G),st=Nt(ot,he,D+$t,D+zt,1,ue.minY,ue.maxY,G),ot=null),ee>1&&console.timeEnd("clipping"),W.push(Le||[],S+1,2*P,2*D),W.push(Oe||[],S+1,2*P,2*D+1),W.push(Ze||[],S+1,2*P+1,2*D),W.push(st||[],S+1,2*P+1,2*D+1)}}},br.prototype.getTile=function(V,S,P){var D=this.options,q=D.extent,Z=D.debug;if(V<0||V>24)return null;var J=1<1&&console.log("drilling down to z%d-%d-%d",V,S,P);for(var G,ee=V,he=S,de=P;!G&&ee>0;)ee--,he=Math.floor(he/2),de=Math.floor(de/2),G=this.tiles[wr(ee,he,de)];return G&&G.source?(Z>1&&console.log("found parent tile z%d-%d-%d",ee,he,de),Z>1&&console.time("drilling down"),this.splitTile(G.source,ee,he,de,V,S,P),Z>1&&console.timeEnd("drilling down"),this.tiles[W]?Ye(this.tiles[W],q):null):null};class Zn extends Et{constructor(S,P,D,q){super(S,P,D,wt),this._dataUpdateable=new Map,this.loadGeoJSON=(Z,J)=>{const{promoteId:W}=Z;if(Z.request)return h.getJSON(Z.request,(G,ee,he,de)=>{this._dataUpdateable=Tr(ee,W)?ai(ee,W):void 0,J(G,ee,he,de)});if(typeof Z.data=="string")try{const G=JSON.parse(Z.data);this._dataUpdateable=Tr(G,W)?ai(G,W):void 0,J(null,G)}catch{J(new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`))}else Z.dataDiff?this._dataUpdateable?(function(G,ee,he){var de,ue,Ne,Ge;if(ee.removeAll&&G.clear(),ee.remove)for(const Le of ee.remove)G.delete(Le);if(ee.add)for(const Le of ee.add){const Oe=Yi(Le,he);Oe!=null&&G.set(Oe,Le)}if(ee.update)for(const Le of ee.update){let Oe=G.get(Le.id);if(Oe==null)continue;const Ze=!Le.removeAllProperties&&(((de=Le.removeProperties)===null||de===void 0?void 0:de.length)>0||((ue=Le.addOrUpdateProperties)===null||ue===void 0?void 0:ue.length)>0);if((Le.newGeometry||Le.removeAllProperties||Ze)&&(Oe={...Oe},G.set(Le.id,Oe),Ze&&(Oe.properties={...Oe.properties})),Le.newGeometry&&(Oe.geometry=Le.newGeometry),Le.removeAllProperties)Oe.properties={};else if(((Ne=Le.removeProperties)===null||Ne===void 0?void 0:Ne.length)>0)for(const st of Le.removeProperties)Object.prototype.hasOwnProperty.call(Oe.properties,st)&&delete Oe.properties[st];if(((Ge=Le.addOrUpdateProperties)===null||Ge===void 0?void 0:Ge.length)>0)for(const{key:st,value:Je}of Le.addOrUpdateProperties)Oe.properties[st]=Je}}(this._dataUpdateable,Z.dataDiff,W),J(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):J(new Error(`Cannot update existing geojson data in ${Z.source}`)):J(new Error(`Input data given to '${Z.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},q&&(this.loadGeoJSON=q)}loadData(S,P){var D;(D=this._pendingRequest)===null||D===void 0||D.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const q=!!(S&&S.request&&S.request.collectResourceTiming)&&new h.RequestPerformance(S.request);this._pendingCallback=P,this._pendingRequest=this.loadGeoJSON(S,(Z,J)=>{if(delete this._pendingCallback,delete this._pendingRequest,Z||!J)return P(Z);if(typeof J!="object")return P(new Error(`Input data given to '${S.source}' is not a valid GeoJSON object.`));{nt(J,!0);try{if(S.filter){const G=h.createExpression(S.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(G.result==="error")throw new Error(G.value.map(he=>`${he.key}: ${he.message}`).join(", "));J={type:"FeatureCollection",features:J.features.filter(he=>G.value.evaluate({zoom:0},he))}}this._geoJSONIndex=S.cluster?new _n(function({superclusterOptions:G,clusterProperties:ee}){if(!ee||!G)return G;const he={},de={},ue={accumulated:null,zoom:0},Ne={properties:null},Ge=Object.keys(ee);for(const Le of Ge){const[Oe,Ze]=ee[Le],st=h.createExpression(Ze),Je=h.createExpression(typeof Oe=="string"?[Oe,["accumulated"],["get",Le]]:Oe);he[Le]=st.value,de[Le]=Je.value}return G.map=Le=>{Ne.properties=Le;const Oe={};for(const Ze of Ge)Oe[Ze]=he[Ze].evaluate(ue,Ne);return Oe},G.reduce=(Le,Oe)=>{Ne.properties=Oe;for(const Ze of Ge)ue.accumulated=Le[Ze],Le[Ze]=de[Ze].evaluate(ue,Ne)},G}(S)).load(J.features):function(G,ee){return new br(G,ee)}(J,S.geojsonVtOptions)}catch(G){return P(G)}this.loaded={};const W={};if(q){const G=q.finish();G&&(W.resourceTiming={},W.resourceTiming[S.source]=JSON.parse(JSON.stringify(G)))}P(null,W)}})}reloadTile(S,P){const D=this.loaded;return D&&D[S.uid]?super.reloadTile(S,P):this.loadTile(S,P)}removeSource(S,P){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),P()}getClusterExpansionZoom(S,P){try{P(null,this._geoJSONIndex.getClusterExpansionZoom(S.clusterId))}catch(D){P(D)}}getClusterChildren(S,P){try{P(null,this._geoJSONIndex.getChildren(S.clusterId))}catch(D){P(D)}}getClusterLeaves(S,P){try{P(null,this._geoJSONIndex.getLeaves(S.clusterId,S.limit,S.offset))}catch(D){P(D)}}}class or{constructor(S){this.self=S,this.actor=new h.Actor(S,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Et,geojson:Zn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(P,D)=>{if(this.workerSourceTypes[P])throw new Error(`Worker source with name "${P}" already registered.`);this.workerSourceTypes[P]=D},this.self.registerRTLTextPlugin=P=>{if(h.plugin.isParsed())throw new Error("RTL text plugin already registered.");h.plugin.applyArabicShaping=P.applyArabicShaping,h.plugin.processBidirectionalText=P.processBidirectionalText,h.plugin.processStyledBidirectionalText=P.processStyledBidirectionalText}}setReferrer(S,P){this.referrer=P}setImages(S,P,D){this.availableImages[S]=P;for(const q in this.workerSources[S]){const Z=this.workerSources[S][q];for(const J in Z)Z[J].availableImages=P}D()}setLayers(S,P,D){this.getLayerIndex(S).replace(P),D()}updateLayers(S,P,D){this.getLayerIndex(S).update(P.layers,P.removedIds),D()}loadTile(S,P,D){this.getWorkerSource(S,P.type,P.source).loadTile(P,D)}loadDEMTile(S,P,D){this.getDEMWorkerSource(S,P.source).loadTile(P,D)}reloadTile(S,P,D){this.getWorkerSource(S,P.type,P.source).reloadTile(P,D)}abortTile(S,P,D){this.getWorkerSource(S,P.type,P.source).abortTile(P,D)}removeTile(S,P,D){this.getWorkerSource(S,P.type,P.source).removeTile(P,D)}removeDEMTile(S,P){this.getDEMWorkerSource(S,P.source).removeTile(P)}removeSource(S,P,D){if(!this.workerSources[S]||!this.workerSources[S][P.type]||!this.workerSources[S][P.type][P.source])return;const q=this.workerSources[S][P.type][P.source];delete this.workerSources[S][P.type][P.source],q.removeSource!==void 0?q.removeSource(P,D):D()}loadWorkerSource(S,P,D){try{this.self.importScripts(P.url),D()}catch(q){D(q.toString())}}syncRTLPluginState(S,P,D){try{h.plugin.setState(P);const q=h.plugin.getPluginURL();if(h.plugin.isLoaded()&&!h.plugin.isParsed()&&q!=null){this.self.importScripts(q);const Z=h.plugin.isParsed();D(Z?void 0:new Error(`RTL Text Plugin failed to import scripts from ${q}`),Z)}}catch(q){D(q.toString())}}getAvailableImages(S){let P=this.availableImages[S];return P||(P=[]),P}getLayerIndex(S){let P=this.layerIndexes[S];return P||(P=this.layerIndexes[S]=new _e),P}getWorkerSource(S,P,D){if(this.workerSources[S]||(this.workerSources[S]={}),this.workerSources[S][P]||(this.workerSources[S][P]={}),!this.workerSources[S][P][D]){const q={send:(Z,J,W)=>{this.actor.send(Z,J,W,S)}};this.workerSources[S][P][D]=new this.workerSourceTypes[P](q,this.getLayerIndex(S),this.getAvailableImages(S))}return this.workerSources[S][P][D]}getDEMWorkerSource(S,P){return this.demWorkerSources[S]||(this.demWorkerSources[S]={}),this.demWorkerSources[S][P]||(this.demWorkerSources[S][P]=new it),this.demWorkerSources[S][P]}}return h.isWorker()&&(self.worker=new or(self)),or}),oe(["./shared"],function(h){var _e="3.1.0";class Y{static testProp(t){if(!Y.docStyle)return t[0];for(let n=0;n{window.removeEventListener("click",Y.suppressClickInternal,!0)},0)}static mousePos(t,n){const a=t.getBoundingClientRect();return new h.Point(n.clientX-a.left-t.clientLeft,n.clientY-a.top-t.clientTop)}static touchPos(t,n){const a=t.getBoundingClientRect(),c=[];for(let p=0;p{t=[],n=0,a=0,c={}},o.addThrottleControl=x=>{const T=a++;return c[T]=x,T},o.removeThrottleControl=x=>{delete c[x],y()},o.getImage=(x,T,w=!0)=>{Qe.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*");const k={requestParameters:x,supportImageRefresh:w,callback:T,cancelled:!1,completed:!1,cancel:()=>{k.completed||k.cancelled||(k.cancelled=!0,k.innerRequest&&(k.innerRequest.cancel(),n--),y())}};return t.push(k),y(),k};const p=x=>{const{requestParameters:T,supportImageRefresh:w,callback:k}=x;return h.extend(T,{type:"image"}),(w!==!1||h.isWorker()||h.getProtocolAction(T.url)||T.headers&&!Object.keys(T.headers).reduce((O,B)=>O&&B==="accept",!0)?h.makeRequest:_)(T,(O,B,R,$)=>{m(x,k,O,B,R,$)})},m=(x,T,w,k,O,B)=>{w?T(w):k instanceof HTMLImageElement||k instanceof ImageBitmap?T(null,k):k&&((R,$)=>{typeof createImageBitmap=="function"?h.arrayBufferToImageBitmap(R,$):h.arrayBufferToImage(R,$)})(k,(R,$)=>{R!=null?T(R):$!=null&&T(null,$,{cacheControl:O,expires:B})}),x.cancelled||(x.completed=!0,n--,y())},y=()=>{const x=(()=>{const T=Object.keys(c);let w=!1;if(T.length>0){for(const k of T)if(w=c[k](),w)break}return w})()?h.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:h.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let T=n;T0;T++){const w=t.shift();if(w.cancelled){T--;continue}const k=p(w);n++,w.innerRequest=k}},_=(x,T)=>{const w=new Image,k=x.url;let O=!1;const B=x.credentials;return B&&B==="include"?w.crossOrigin="use-credentials":(B&&B==="same-origin"||!h.sameOrigin(k))&&(w.crossOrigin="anonymous"),w.fetchPriority="high",w.onload=()=>{T(null,w),w.onerror=w.onload=null},w.onerror=()=>{O||T(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),w.onerror=w.onload=null},w.src=k,{cancel:()=>{O=!0,w.src=""}}}}(kt||(kt={})),kt.resetRequestQueue();var nt,Qt=kt;(function(o){o.Glyphs="Glyphs",o.Image="Image",o.Source="Source",o.SpriteImage="SpriteImage",o.SpriteJSON="SpriteJSON",o.Style="Style",o.Tile="Tile",o.Unknown="Unknown"})(nt||(nt={}));class mt{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,a){const c=function(p){const m=p.match(_i);if(!m)throw new Error(`Unable to parse URL "${p}"`);return{protocol:m[1],authority:m[2],path:m[3]||"/",params:m[4]?m[4].split("&"):[]}}(t);return c.path+=`${n}${a}`,function(p){const m=p.params.length?`?${p.params.join("&")}`:"";return`${p.protocol}://${p.authority}${p.path}${m}`}(c)}setTransformRequest(t){this._transformRequestFn=t}}const _i=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Wt(o){var t=new h.ARRAY_TYPE(3);return t[0]=o[0],t[1]=o[1],t[2]=o[2],t}var sr,fn=function(o,t,n){return o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],o};sr=new h.ARRAY_TYPE(3),h.ARRAY_TYPE!=Float32Array&&(sr[0]=0,sr[1]=0,sr[2]=0);var Ei=function(o){var t=o[0],n=o[1];return t*t+n*n};function Gr(o){const t=[];if(typeof o=="string")t.push({id:"default",url:o});else if(o&&o.length>0){const n=[];for(const{id:a,url:c}of o){const p=`${a}${c}`;n.indexOf(p)===-1&&(n.push(p),t.push({id:a,url:c}))}}return t}function ci(o,t,n,a,c){if(a)return void o(a);if(c!==Object.values(t).length||c!==Object.values(n).length)return;const p={};for(const m in t){p[m]={};const y=h.exported.getImageCanvasContext(n[m]),_=t[m];for(const x in _){const{width:T,height:w,x:k,y:O,sdf:B,pixelRatio:R,stretchX:$,stretchY:H,content:re}=_[x];p[m][x]={data:null,pixelRatio:R,sdf:B,stretchX:$,stretchY:H,content:re,spriteData:{width:T,height:w,x:k,y:O,context:y}}}}o(null,p)}(function(){var o=new h.ARRAY_TYPE(2);h.ARRAY_TYPE!=Float32Array&&(o[0]=0,o[1]=0)})();class gt{constructor(t,n,a,c){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(n,c)}update(t,n,a){const{width:c,height:p}=t,m=!(this.size&&this.size[0]===c&&this.size[1]===p||a),{context:y}=this,{gl:_}=y;if(this.useMipmap=!!(n&&n.useMipmap),_.bindTexture(_.TEXTURE_2D,this.texture),y.pixelStoreUnpackFlipY.set(!1),y.pixelStoreUnpack.set(1),y.pixelStoreUnpackPremultiplyAlpha.set(this.format===_.RGBA&&(!n||n.premultiply!==!1)),m)this.size=[c,p],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||h.isImageBitmap(t)?_.texImage2D(_.TEXTURE_2D,0,this.format,this.format,_.UNSIGNED_BYTE,t):_.texImage2D(_.TEXTURE_2D,0,this.format,c,p,0,this.format,_.UNSIGNED_BYTE,t.data);else{const{x,y:T}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||h.isImageBitmap(t)?_.texSubImage2D(_.TEXTURE_2D,0,x,T,_.RGBA,_.UNSIGNED_BYTE,t):_.texSubImage2D(_.TEXTURE_2D,0,x,T,c,p,_.RGBA,_.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&_.generateMipmap(_.TEXTURE_2D)}bind(t,n,a){const{context:c}=this,{gl:p}=c;p.bindTexture(p.TEXTURE_2D,this.texture),a!==p.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=p.LINEAR),t!==this.filter&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,t),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,a||t),this.filter=t),n!==this.wrap&&(p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,n),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,n),this.wrap=n)}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 ga(o){const{userImage:t}=o;return!!(t&&t.render&&t.render())&&(o.data.replace(new Uint8Array(t.data.buffer)),!0)}class $i extends h.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new h.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:a}of this.requestors)this._notify(n,a);this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new h.RGBAImage({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;const c=n.data||n.spriteData;return this._validateStretch(n.stretchX,c&&c.width)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,c&&c.height)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new h.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const c of t){if(c[0]-1);_++,p[_]=y,m[_]=x,m[_+1]=_r}for(let y=0,_=0;y{let y=this.entries[c];y||(y=this.entries[c]={glyphs:{},requests:{},ranges:{}});let _=y.glyphs[p];if(_!==void 0)return void m(null,{stack:c,id:p,glyph:_});if(_=this._tinySDF(y,c,p),_)return y.glyphs[p]=_,void m(null,{stack:c,id:p,glyph:_});const x=Math.floor(p/256);if(256*x>65535)return void m(new Error("glyphs > 65535 not supported"));if(y.ranges[x])return void m(null,{stack:c,id:p,glyph:_});if(!this.url)return void m(new Error("glyphsUrl is not set"));let T=y.requests[x];T||(T=y.requests[x]=[],yr.loadGlyphRange(c,x,this.url,this.requestManager,(w,k)=>{if(k){for(const O in k)this._doesCharSupportLocalGlyph(+O)||(y.glyphs[+O]=k[+O]);y.ranges[x]=!0}for(const O of T)O(w,k);delete y.requests[x]})),T.push((w,k)=>{w?m(w):k&&m(null,{stack:c,id:p,glyph:k[p]||null})})},(c,p)=>{if(c)n(c);else if(p){const m={};for(const{stack:y,id:_,glyph:x}of p)(m[y]||(m[y]={}))[_]=x&&{id:x.id,bitmap:x.bitmap.clone(),metrics:x.metrics};n(null,m)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(h.unicodeBlockLookup["CJK Unified Ideographs"](t)||h.unicodeBlockLookup["Hangul Syllables"](t)||h.unicodeBlockLookup.Hiragana(t)||h.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,a){const c=this.localIdeographFontFamily;if(!c||!this._doesCharSupportLocalGlyph(a))return;let p=t.tinySDF;if(!p){let y="400";/bold/i.test(n)?y="900":/medium/i.test(n)?y="500":/light/i.test(n)&&(y="200"),p=t.tinySDF=new yr.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:c,fontWeight:y})}const m=p.draw(String.fromCharCode(a));return{id:a,bitmap:new h.AlphaImage({width:m.width||30,height:m.height||30},m.data),metrics:{width:m.glyphWidth||24,height:m.glyphHeight||24,left:m.glyphLeft||0,top:m.glyphTop-27||-8,advance:m.glyphAdvance||24}}}}yr.loadGlyphRange=function(o,t,n,a,c){const p=256*t,m=p+255,y=a.transformRequest(n.replace("{fontstack}",o).replace("{range}",`${p}-${m}`),nt.Glyphs);h.getArrayBuffer(y,(_,x)=>{if(_)c(_);else if(x){const T={};for(const w of h.parseGlyphPbf(x))T[w.id]=w;c(null,T)}})},yr.TinySDF=class{constructor({fontSize:o=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:c="sans-serif",fontWeight:p="normal",fontStyle:m="normal"}={}){this.buffer=t,this.cutoff=a,this.radius=n;const y=this.size=o+4*t,_=this._createCanvas(y),x=this.ctx=_.getContext("2d",{willReadFrequently:!0});x.font=`${m} ${p} ${o}px ${c}`,x.textBaseline="alphabetic",x.textAlign="left",x.fillStyle="black",this.gridOuter=new Float64Array(y*y),this.gridInner=new Float64Array(y*y),this.f=new Float64Array(y),this.z=new Float64Array(y+1),this.v=new Uint16Array(y)}_createCanvas(o){const t=document.createElement("canvas");return t.width=t.height=o,t}draw(o){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:c,actualBoundingBoxRight:p}=this.ctx.measureText(o),m=Math.ceil(n),y=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(p-c))),_=Math.min(this.size-this.buffer,m+Math.ceil(a)),x=y+2*this.buffer,T=_+2*this.buffer,w=Math.max(x*T,0),k=new Uint8ClampedArray(w),O={data:k,width:x,height:T,glyphWidth:y,glyphHeight:_,glyphTop:m,glyphLeft:0,glyphAdvance:t};if(y===0||_===0)return O;const{ctx:B,buffer:R,gridInner:$,gridOuter:H}=this;B.clearRect(R,R,y,_),B.fillText(o,R,R+m);const re=B.getImageData(R,R,y,_);H.fill(_r,0,w),$.fill(0,0,w);for(let N=0;N<_;N++)for(let te=0;te0?me*me:0,$[pe]=me<0?me*me:0}}zr(H,0,0,x,T,x,this.f,this.v,this.z),zr($,R,R,y,_,x,this.f,this.v,this.z);for(let N=0;N1&&(_=t[++y]);const T=Math.abs(x-_.left),w=Math.abs(x-_.right),k=Math.min(T,w);let O;const B=p/a*(c+1);if(_.isDash){const R=c-Math.abs(B);O=Math.sqrt(k*k+R*R)}else O=c-Math.sqrt(k*k+B*B);this.data[m+x]=Math.max(0,Math.min(255,O+128))}}}addRegularDash(t){for(let y=t.length-1;y>=0;--y){const _=t[y],x=t[y+1];_.zeroLength?t.splice(y,1):x&&x.isDash===_.isDash&&(x.left=_.left,t.splice(y,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const c=this.width*this.nextRow;let p=0,m=t[p];for(let y=0;y1&&(m=t[++p]);const _=Math.abs(y-m.left),x=Math.abs(y-m.right),T=Math.min(_,x);this.data[c+y]=Math.max(0,Math.min(255,(m.isDash?T:-T)+128))}}addDash(t,n){const a=n?7:0,c=2*a+1;if(this.nextRow+c>this.height)return h.warnOnce("LineAtlas out of space"),null;let p=0;for(let y=0;y{c.send(t,n,p)},a=a||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(n=>{n.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function qi(o,t,n){const a=function(c,p){if(c)return n(c);if(p){const m=h.pick(h.extend(p,o),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);p.vector_layers&&(m.vectorLayers=p.vector_layers,m.vectorLayerIds=m.vectorLayers.map(y=>y.id)),n(null,m)}};return o.url?h.getJSON(t.transformRequest(o.url,nt.Source),a):h.exported.frame(()=>a(null,o))}yi.Actor=h.Actor;class si{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):Array.isArray(t)&&(t.length===4?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 h.LngLat?new h.LngLat(t.lng,t.lat):h.LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof h.LngLat?new h.LngLat(t.lng,t.lat):h.LngLat.convert(t),this}extend(t){const n=this._sw,a=this._ne;let c,p;if(t instanceof h.LngLat)c=t,p=t;else{if(!(t instanceof si))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(si.convert(t)):this.extend(h.LngLat.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(h.LngLat.convert(t)):this;if(c=t._sw,p=t._ne,!c||!p)return this}return n||a?(n.lng=Math.min(c.lng,n.lng),n.lat=Math.min(c.lat,n.lat),a.lng=Math.max(p.lng,a.lng),a.lat=Math.max(p.lat,a.lat)):(this._sw=new h.LngLat(c.lng,c.lat),this._ne=new h.LngLat(p.lng,p.lat)),this}getCenter(){return new h.LngLat((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 h.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new h.LngLat(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:n,lat:a}=h.LngLat.convert(t);let c=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&c}static convert(t){return t instanceof si?t:t&&new si(t)}static fromLngLat(t,n=0){const a=360*n/40075017,c=a/Math.cos(Math.PI/180*t.lat);return new si(new h.LngLat(t.lng-c,t.lat-a),new h.LngLat(t.lng+c,t.lat+a))}}class _n{constructor(t,n,a){this.bounds=si.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[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 n=Math.pow(2,t.z),a=Math.floor(h.mercatorXfromLng(this.bounds.getWest())*n),c=Math.floor(h.mercatorYfromLat(this.bounds.getNorth())*n),p=Math.ceil(h.mercatorXfromLng(this.bounds.getEast())*n),m=Math.ceil(h.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=a&&t.x=c&&t.y{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new h.ErrorEvent(t)):n&&(h.extend(this,n),n.bounds&&(this.tileBounds=new _n(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),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}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return h.extend({},this._options)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),c={request:this.map._requestManager.transformRequest(a,nt.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function p(m,y){return delete t.request,t.aborted?n(null):m&&m.status!==404?n(m):(y&&y.resourceTiming&&(t.resourceTiming=y.resourceTiming),this.map._refreshExpiredTiles&&y&&t.setExpiryData(y),t.loadVectorData(y,this.map.painter),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}c.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",c,p.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",c,p.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Hr extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.setEventedParent(c),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=h.extend({type:"raster"},n),h.extend(this,h.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=qi(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new h.ErrorEvent(t)):n&&(h.extend(this,n),n.bounds&&(this.tileBounds=new _n(n.bounds,this.minzoom,this.maxzoom)),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return h.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=Qt.getImage(this.map._requestManager.transformRequest(a,nt.Tile),(c,p,m)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(c)t.state="errored",n(c);else if(p){this.map._refreshExpiredTiles&&m&&t.setExpiryData(m);const y=this.map.painter.context,_=y.gl;t.texture=this.map.painter.getTileTexture(p.width),t.texture?t.texture.update(p,{useMipmap:!0}):(t.texture=new gt(y,p,_.RGBA,{useMipmap:!0}),t.texture.bind(_.LINEAR,_.CLAMP_TO_EDGE,_.LINEAR_MIPMAP_NEAREST),y.extTextureFilterAnisotropic&&_.texParameterf(_.TEXTURE_2D,y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,y.extTextureFilterAnisotropicMax)),t.state="loaded",n(null)}},this.map._refreshExpiredTiles)}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}class Lr extends Hr{constructor(t,n,a,c){super(t,n,a,c),this.type="raster-dem",this.maxzoom=22,this._options=h.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const a=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function c(p,m){p&&(t.state="errored",n(p)),m&&(t.dem=m,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=Qt.getImage(this.map._requestManager.transformRequest(a,nt.Tile),function(p,m){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(p)t.state="errored",n(p);else if(m){this.map._refreshExpiredTiles&&t.setExpiryData(m),delete m.cacheControl,delete m.expires;const y=h.isImageBitmap(m)&&(gn==null&&(gn=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),gn)?m:h.exported.getImageData(m,1),_={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:y,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",_,c.bind(this)))}}.bind(this),this.map._refreshExpiredTiles),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),c=(n.x-1+a)%a,p=n.x===0?t.wrap-1:t.wrap,m=(n.x+1+a)%a,y=n.x+1===a?t.wrap+1:t.wrap,_={};return _[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,y,n.z,m,n.y).key]={backfilled:!1},n.y>0&&(_[new h.OverscaledTileID(t.overscaledZ,p,n.z,c,n.y-1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},_[new h.OverscaledTileID(t.overscaledZ,y,n.z,m,n.y-1).key]={backfilled:!1}),n.y+1{if(this._pendingLoads--,this._removed||c&&c.abandoned)return void this.fire(new h.Event("dataabort",{dataType:"source"}));let p=null;if(c&&c.resourceTiming&&c.resourceTiming[this.id]&&(p=c.resourceTiming[this.id].slice(0)),a)return void this.fire(new h.ErrorEvent(a));const m={dataType:"source"};this._collectResourceTiming&&p&&p.length>0&&h.extend(m,{resourceTiming:p}),this.fire(new h.Event("data",{...m,sourceDataType:"metadata"})),this.fire(new h.Event("data",{...m,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const a=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const c={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.request=this.actor.send(a,c,(p,m)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):p?n(p):(t.loadVectorData(m,this.map.painter,a==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return h.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var vr=h.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class ji extends h.Evented{constructor(t,n,a,c){super(),this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(c),this.options=n}load(t,n){this._loaded=!1,this.fire(new h.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=Qt.getImage(this.map._requestManager.transformRequest(this.url,nt.Image),(a,c)=>{this._request=null,this._loaded=!0,a?this.fire(new h.ErrorEvent(a)):c&&(this.image=c,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(h.MercatorCoordinate.fromLngLat);this.tileID=function(c){let p=1/0,m=1/0,y=-1/0,_=-1/0;for(const k of c)p=Math.min(p,k.x),m=Math.min(m,k.y),y=Math.max(y,k.x),_=Math.max(_,k.y);const x=Math.max(y-p,_-m),T=Math.max(0,Math.floor(-Math.log(x)/Math.LN2)),w=Math.pow(2,T);return new h.CanonicalTileID(T,Math.floor((p+y)/2*w),Math.floor((m+_)/2*w))}(n),this.minzoom=this.maxzoom=this.tileID.z;const a=n.map(c=>this.tileID.getTilePoint(c)._round());return this._boundsArray=new h.RasterBoundsArray,this._boundsArray.emplaceBack(a[0].x,a[0].y,0,0),this._boundsArray.emplaceBack(a[1].x,a[1].y,h.EXTENT,0),this._boundsArray.emplaceBack(a[3].x,a[3].y,0,h.EXTENT),this._boundsArray.emplaceBack(a[2].x,a[2].y,h.EXTENT,h.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new h.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,vr.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new gt(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,a=!0)}a&&this.fire(new h.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class xn extends ji{constructor(t,n,a,c){super(t,n,a,c),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,nt.Source).url);h.getVideo(this.urls,(n,a)=>{this._loaded=!0,n?this.fire(new h.ErrorEvent(n)):a&&(this.video=a,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;tn.end(0)?this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,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 t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,vr.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new gt(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const c in this.tiles){const p=this.tiles[c];p.state!=="loaded"&&(p.state="loaded",p.texture=this.texture,a=!0)}a&&this.fire(new h.Event("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 le extends ji{constructor(t,n,a,c){super(t,n,a,c),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(p=>!Array.isArray(p)||p.length!==2||p.some(m=>typeof m!="number"))||this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new h.ErrorEvent(new h.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new h.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(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()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,a=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,vr.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new gt(n,this.canvas,a.RGBA,{premultiply:!0});let c=!1;for(const p in this.tiles){const m=this.tiles[p];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,c=!0)}c&&this.fire(new h.Event("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 Br={vector:yn,raster:Hr,"raster-dem":Lr,geojson:xr,video:xn,image:ji,canvas:le};function qn(o,t){const n=h.create();return h.translate(n,n,[1,1,0]),h.scale(n,n,[.5*o.width,.5*o.height,1]),h.multiply(n,n,o.calculatePosMatrix(t.toUnwrapped()))}function xt(o,t,n,a,c,p){const m=function(w,k,O){if(w)for(const B of w){const R=k[B];if(R&&R.source===O&&R.type==="fill-extrusion")return!0}else for(const B in k){const R=k[B];if(R.source===O&&R.type==="fill-extrusion")return!0}return!1}(c&&c.layers,t,o.id),y=p.maxPitchScaleFactor(),_=o.tilesIn(a,y,m);_.sort(at);const x=[];for(const w of _)x.push({wrappedTileID:w.tileID.wrapped().key,queryResults:w.tile.queryRenderedFeatures(t,n,o._state,w.queryGeometry,w.cameraQueryGeometry,w.scale,c,p,y,qn(o.transform,w.tileID))});const T=function(w){const k={},O={};for(const B of w){const R=B.queryResults,$=B.wrappedTileID,H=O[$]=O[$]||{};for(const re in R){const N=R[re],te=H[re]=H[re]||{},ae=k[re]=k[re]||[];for(const pe of N)te[pe.featureIndex]||(te[pe.featureIndex]=!0,ae.push(pe))}}return k}(x);for(const w in T)T[w].forEach(k=>{const O=k.feature,B=o.getFeatureState(O.layer["source-layer"],O.id);O.source=O.layer.source,O.layer["source-layer"]&&(O.sourceLayer=O.layer["source-layer"]),O.state=B});return T}function at(o,t){const n=o.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}class Kr{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=h.uniqueId(),this.uses=0,this.tileSize=n,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 n=t+this.timeAdded;np.getLayer(x)).filter(Boolean);if(_.length!==0){y.layers=_,y.stateDependentLayerIds&&(y.stateDependentLayers=y.stateDependentLayerIds.map(x=>_.filter(T=>T.id===x)[0]));for(const x of _)m[x.id]=y}}return m}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.SymbolBucket){if(this.hasSymbolBuckets=!0,!a)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const c in this.buckets){const p=this.buckets[c];if(p instanceof h.SymbolBucket&&p.hasRTLText){this.hasRTLText=!0,h.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const c in this.buckets){const p=this.buckets[c];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(c).queryRadius(p))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new h.CollisionBoxArray}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 a in this.buckets){const c=this.buckets[a];c.uploadPending()&&c.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new gt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new gt(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,c,p,m,y,_,x,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:c,cameraQueryGeometry:p,scale:m,tileSize:this.tileSize,pixelPosMatrix:T,transform:_,params:y,queryPadding:this.queryPadding*x},t,n,a):{}}querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const c=a.loadVTLayers(),p=n&&n.sourceLayer?n.sourceLayer:"",m=c._geojsonTileLayer||c[p];if(!m)return;const y=h.createFilter(n&&n.filter),{z:_,x,y:T}=this.tileID.canonical,w={z:_,x,y:T};for(let k=0;ka)c=!1;else if(n)if(this.expirationTime{this.remove(t,p)},a)),this.data[c].push(p),this.order.push(c),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}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 n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const a=t.wrapped().key,c=n===void 0?0:this.data[a].indexOf(n),p=this.data[a][c];return this.data[a].splice(c,1),p.timeout&&clearTimeout(p.timeout),this.data[a].length===0&&delete this.data[a],this.onRemove(p.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const a in this.data)for(const c of this.data[a])t(c.value)||n.push(c);for(const a of n)this.remove(a.value.tileID,a)}}class fs{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,a){const c=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][c]=this.stateChanges[t][c]||{},h.extend(this.stateChanges[t][c],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==c&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][c]===null){this.deletedStates[t][c]={};for(const p in this.state[t][c])a[p]||(this.deletedStates[t][c][p]=null)}else for(const p in a)this.deletedStates[t]&&this.deletedStates[t][c]&&this.deletedStates[t][c][p]===null&&delete this.deletedStates[t][c][p]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const c=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][c]!==null&&(this.deletedStates[t][c]=this.deletedStates[t][c]||{},this.deletedStates[t][c][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][c])for(a in this.deletedStates[t][c]={},this.stateChanges[t][c])this.deletedStates[t][c][a]=null;else this.deletedStates[t][c]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),c=h.extend({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const p=this.deletedStates[t][n];if(p===null)return{};for(const m in p)delete c[m]}return c}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const c in this.stateChanges){this.state[c]=this.state[c]||{};const p={};for(const m in this.stateChanges[c])this.state[c][m]||(this.state[c][m]={}),h.extend(this.state[c][m],this.stateChanges[c][m]),p[m]=this.state[c][m];a[c]=p}for(const c in this.deletedStates){this.state[c]=this.state[c]||{};const p={};if(this.deletedStates[c]===null)for(const m in this.state[c])p[m]={},this.state[c][m]={};else for(const m in this.deletedStates[c]){if(this.deletedStates[c][m]===null)this.state[c][m]={};else for(const y of Object.keys(this.deletedStates[c][m]))delete this.state[c][m][y];p[m]=this.state[c][m]}a[c]=a[c]||{},h.extend(a[c],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0)for(const c in t)t[c].setFeatureState(a,n)}}class Nt extends h.Evented{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",c=>{c.dataType==="source"&&c.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&c.dataType==="source"&&c.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(c,p,m,y){const _=new Br[p.type](c,p,m,y);if(_.id!==c)throw new Error(`Expected Source id to be ${c} instead of ${_.id}`);return h.bindAll(["load","abort","unload","serialize","prepare"],_),_}(t,n,a,this),this._tiles={},this._cache=new jn(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new fs,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||!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 t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")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,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new h.Event("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 n in this._tiles){const a=this._tiles[n];a.upload(t),a.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Yr).map(t=>t.key)}getRenderableIds(t){const n=[];for(const a in this._tiles)this._isIdRenderable(a,t)&&n.push(this._tiles[a]);return t?n.sort((a,c)=>{const p=a.tileID,m=c.tileID,y=new h.Point(p.canonical.x,p.canonical.y)._rotate(this.transform.angle),_=new h.Point(m.canonical.x,m.canonical.y)._rotate(this.transform.angle);return p.overscaledZ-m.overscaledZ||_.y-y.y||_.x-y.x}).map(a=>a.tileID.key):n.map(a=>a.tileID).sort(Yr).map(a=>a.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const a=this._tiles[t];a&&(a.state!=="loading"&&(a.state=n),this._loadTile(a,this._tileLoaded.bind(this,a,t,n)))}_tileLoaded(t,n,a,c){if(c)return t.state="errored",void(c.status!==404?this._source.fire(new h.ErrorEvent(c,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=h.exported.now(),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new h.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let c=0;c1||(Math.abs(m)>1&&(Math.abs(m+_)===1?m+=_:Math.abs(m-_)===1&&(m-=_)),p.dem&&c.dem&&(c.dem.backfillBorder(p.dem,m,y),c.neighboringTiles&&c.neighboringTiles[x]&&(c.neighboringTiles[x].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,a,c){for(const p in this._tiles){let m=this._tiles[p];if(c[p]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>a)continue;let y=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const x=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[x.key],m&&m.hasData()&&(y=x)}let _=y;for(;_.overscaledZ>n;)if(_=_.scaledTo(_.overscaledZ-1),t[_.key]){c[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const a=this._loadedParentTiles[t.key];return a&&a.tileID.overscaledZ>=n?a:null}for(let a=t.overscaledZ-1;a>=n;a--){const c=t.scaledTo(a),p=this._getLoadedTile(c);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,c=Math.floor(n*a*(this._maxTileCacheZoomLevels===null?h.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),p=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(p)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const a={};for(const c in this._tiles){const p=this._tiles[c];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),a[p.tileID.key]=p}this._tiles=a;for(const c in this._timers)clearTimeout(this._timers[c]),delete this._timers[c];for(const c in this._tiles)this._setTileReloadTimer(c,this._tiles[c])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let a;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(T=>new h.OverscaledTileID(T.canonical.z,T.wrap,T.canonical.z,T.canonical.x,T.canonical.y)):(a=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(a=a.filter(T=>this._source.hasTile(T)))):a=[];const c=t.coveringZoomLevel(this._source),p=Math.max(c-Nt.maxOverzooming,this._source.minzoom),m=Math.max(c+Nt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const T={};for(const w of a)if(w.canonical.z>this._source.minzoom){const k=w.scaledTo(w.canonical.z-1);T[k.key]=k;const O=w.scaledTo(Math.max(this._source.minzoom,Math.min(w.canonical.z,5)));T[O.key]=O}a=a.concat(Object.values(T))}const y=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,y&&this.fire(new h.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const _=this._updateRetainedTiles(a,c);if(vn(this._source.type)){const T={},w={},k=Object.keys(_),O=h.exported.now();for(const B of k){const R=_[B],$=this._tiles[B];if(!$||$.fadeEndTime!==0&&$.fadeEndTime<=O)continue;const H=this.findLoadedParent(R,p);H&&(this._addTile(H.tileID),T[H.tileID.key]=H.tileID),w[B]=R}this._retainLoadedChildren(w,c,m,_);for(const B in T)_[B]||(this._coveredTiles[B]=!0,_[B]=T[B]);if(n){const B={},R={};for(const $ of a)this._tiles[$.key].hasData()?B[$.key]=$:R[$.key]=$;for(const $ in R){const H=R[$].children(this._source.maxzoom);this._tiles[H[0].key]&&this._tiles[H[1].key]&&this._tiles[H[2].key]&&this._tiles[H[3].key]&&(B[H[0].key]=_[H[0].key]=H[0],B[H[1].key]=_[H[1].key]=H[1],B[H[2].key]=_[H[2].key]=H[2],B[H[3].key]=_[H[3].key]=H[3],delete R[$])}for(const $ in R){const H=this.findLoadedParent(R[$],this._source.minzoom);if(H){B[H.tileID.key]=_[H.tileID.key]=H.tileID;for(const re in B)B[re].isChildOf(H.tileID)&&delete B[re]}}for(const $ in this._tiles)B[$]||(this._coveredTiles[$]=!0)}}for(const T in _)this._tiles[T].clearFadeHold();const x=h.keysDifference(this._tiles,_);for(const T of x){const w=this._tiles[T];w.hasSymbolBuckets&&!w.holdingForFade()?w.setHoldDuration(this.map._fadeDuration):w.hasSymbolBuckets&&!w.symbolFadeFinished()||this._removeTile(T)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const a={},c={},p=Math.max(n-Nt.maxOverzooming,this._source.minzoom),m=Math.max(n+Nt.maxUnderzooming,this._source.minzoom),y={};for(const _ of t){const x=this._addTile(_);a[_.key]=_,x.hasData()||nthis._source.maxzoom){const w=_.children(this._source.maxzoom)[0],k=this.getTile(w);if(k&&k.hasData()){a[w.key]=w;continue}}else{const w=_.children(this._source.maxzoom);if(a[w[0].key]&&a[w[1].key]&&a[w[2].key]&&a[w[3].key])continue}let T=x.wasRequested();for(let w=_.overscaledZ-1;w>=p;--w){const k=_.scaledTo(w);if(c[k.key])break;if(c[k.key]=!0,x=this.getTile(k),!x&&T&&(x=this._addTile(k)),x){const O=x.hasData();if((T||O)&&(a[k.key]=k),T=x.wasRequested(),O)break}}}return a}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let a,c=this._tiles[t].tileID;for(;c.overscaledZ>0;){if(c.key in this._loadedParentTiles){a=this._loadedParentTiles[c.key];break}n.push(c.key);const p=c.scaledTo(c.overscaledZ-1);if(a=this._getLoadedTile(p),a)break;c=p}for(const p of n)this._loadedParentTiles[p]=a}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const a=n;return n||(n=new Kr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,a||this._source.fire(new h.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},a))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,a){const c=[],p=this.transform;if(!p)return c;const m=a?p.getCameraQueryGeometry(t):t,y=t.map(B=>p.pointCoordinate(B,this.terrain)),_=m.map(B=>p.pointCoordinate(B,this.terrain)),x=this.getIds();let T=1/0,w=1/0,k=-1/0,O=-1/0;for(const B of _)T=Math.min(T,B.x),w=Math.min(w,B.y),k=Math.max(k,B.x),O=Math.max(O,B.y);for(let B=0;B=0&&N[1].y+re>=0){const te=y.map(pe=>$.getTilePoint(pe)),ae=_.map(pe=>$.getTilePoint(pe));c.push({tile:R,tileID:$,queryGeometry:te,cameraQueryGeometry:ae,scale:H})}}return c}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(a=>this._tiles[a].tileID);for(const a of n)a.posMatrix=this.transform.calculatePosMatrix(a.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(vn(this._source.type)){const t=h.exported.now();for(const n in this._tiles)if(this._tiles[n].fadeEndTime>=t)return!0}return!1}setFeatureState(t,n,a){this._state.updateState(t=t||"_geojsonTileLayer",n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,a)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,a){const c=this._tiles[t];c&&c.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a in this._tiles)this._tiles[a].hasDependency(t,n)&&this._reloadTile(a,"reloading");this._cache.filter(a=>!a.hasDependency(t,n))}}function Yr(o,t){const n=Math.abs(2*o.wrap)-+(o.wrap<0),a=Math.abs(2*t.wrap)-+(t.wrap<0);return o.overscaledZ-t.overscaledZ||a-n||t.canonical.y-o.canonical.y||t.canonical.x-o.canonical.x}function vn(o){return o==="raster"||o==="image"||o==="video"}Nt.maxOverzooming=10,Nt.maxUnderzooming=3;const Jr="mapboxgl_preloaded_worker_pool";class be{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Jr]}numActive(){return Object.keys(this.active).length}}const ar=Math.floor(h.exported.hardwareConcurrency/2);let hi;function bn(){return hi||(hi=new be),hi}be.workerCount=h.isSafari(globalThis)?Math.max(Math.min(ar,3),1):1;class Rr{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let a=1;a0?(c-m)/y:0;return this.points[p].mult(1-_).add(this.points[n].mult(_))}}function ve(o,t){let n=!0;return o==="always"||o!=="never"&&t!=="never"||(n=!1),n}class Ye{constructor(t,n,a){const c=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let m=0;mthis.width||c<0||n>this.height)return[];const _=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=c){if(p)return[{key:null,x1:t,y1:n,x2:a,y2:c}];for(let x=0;x0}hitTestCircle(t,n,a,c,p){const m=t-a,y=t+a,_=n-a,x=n+a;if(y<0||m>this.width||x<0||_>this.height)return!1;const T=[];return this._forEachCell(m,_,y,x,this._queryCellCircle,T,{hitTest:!0,overlapMode:c,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},p),T.length>0}_queryCell(t,n,a,c,p,m,y,_){const{seenUids:x,hitTest:T,overlapMode:w}=y,k=this.boxCells[p];if(k!==null){const B=this.bboxes;for(const R of k)if(!x.box[R]){x.box[R]=!0;const $=4*R,H=this.boxKeys[R];if(t<=B[$+2]&&n<=B[$+3]&&a>=B[$+0]&&c>=B[$+1]&&(!_||_(H))&&(!T||!ve(w,H.overlapMode))&&(m.push({key:H,x1:B[$],y1:B[$+1],x2:B[$+2],y2:B[$+3]}),T))return!0}}const O=this.circleCells[p];if(O!==null){const B=this.circles;for(const R of O)if(!x.circle[R]){x.circle[R]=!0;const $=3*R,H=this.circleKeys[R];if(this._circleAndRectCollide(B[$],B[$+1],B[$+2],t,n,a,c)&&(!_||_(H))&&(!T||!ve(w,H.overlapMode))){const re=B[$],N=B[$+1],te=B[$+2];if(m.push({key:H,x1:re-te,y1:N-te,x2:re+te,y2:N+te}),T)return!0}}}return!1}_queryCellCircle(t,n,a,c,p,m,y,_){const{circle:x,seenUids:T,overlapMode:w}=y,k=this.boxCells[p];if(k!==null){const B=this.bboxes;for(const R of k)if(!T.box[R]){T.box[R]=!0;const $=4*R,H=this.boxKeys[R];if(this._circleAndRectCollide(x.x,x.y,x.radius,B[$+0],B[$+1],B[$+2],B[$+3])&&(!_||_(H))&&!ve(w,H.overlapMode))return m.push(!0),!0}}const O=this.circleCells[p];if(O!==null){const B=this.circles;for(const R of O)if(!T.circle[R]){T.circle[R]=!0;const $=3*R,H=this.circleKeys[R];if(this._circlesCollide(B[$],B[$+1],B[$+2],x.x,x.y,x.radius)&&(!_||_(H))&&!ve(w,H.overlapMode))return m.push(!0),!0}}}_forEachCell(t,n,a,c,p,m,y,_){const x=this._convertToXCellCoord(t),T=this._convertToYCellCoord(n),w=this._convertToXCellCoord(a),k=this._convertToYCellCoord(c);for(let O=x;O<=w;O++)for(let B=T;B<=k;B++)if(p.call(this,t,n,a,c,this.xCellCount*B+O,m,y,_))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,n,a,c,p,m){const y=c-t,_=p-n,x=a+m;return x*x>y*y+_*_}_circleAndRectCollide(t,n,a,c,p,m,y){const _=(m-c)/2,x=Math.abs(t-(c+_));if(x>_+a)return!1;const T=(y-p)/2,w=Math.abs(n-(p+T));if(w>T+a)return!1;if(x<=_||w<=T)return!0;const k=x-_,O=w-T;return k*k+O*O<=a*a}}function He(o,t,n,a,c){const p=h.create();return t?(h.scale(p,p,[1/c,1/c,1]),n||h.rotateZ(p,p,a.angle)):h.multiply(p,a.labelPlaneMatrix,o),p}function Si(o,t,n,a,c){if(t){const p=h.clone(o);return h.scale(p,p,[c,c,1]),n||h.rotateZ(p,p,-a.angle),p}return a.glCoordMatrix}function Ht(o,t,n){let a;n?(a=[o.x,o.y,n(o.x,o.y),1],h.transformMat4(a,a,t)):(a=[o.x,o.y,0,1],q(a,a,t));const c=a[3];return{point:new h.Point(a[0]/c,a[1]/c),signedDistanceFromCamera:c}}function Xe(o,t){return .5+o/t*.5}function br(o,t){const n=o[0]/o[3],a=o[1]/o[3];return n>=-t[0]&&n<=t[0]&&a>=-t[1]&&a<=t[1]}function wr(o,t,n,a,c,p,m,y,_,x){const T=a?o.textSizeData:o.iconSizeData,w=h.evaluateSizeForZoom(T,n.transform.zoom),k=[256/n.width*2+1,256/n.height*2+1],O=a?o.text.dynamicLayoutVertexArray:o.icon.dynamicLayoutVertexArray;O.clear();const B=o.lineVertexArray,R=a?o.text.placedSymbolArray:o.icon.placedSymbolArray,$=n.transform.width/n.transform.height;let H=!1;for(let re=0;reMath.abs(n.x-t.x)*a?{useVertical:!0}:(o===h.WritingMode.vertical?t.yn.x)?{needsFlipping:!0}:null}function ai(o,t,n,a,c,p,m,y,_,x,T,w,k,O,B,R){const $=t/24,H=o.lineOffsetX*$,re=o.lineOffsetY*$;let N;if(o.numGlyphs>1){const te=o.glyphStartIndex+o.numGlyphs,ae=o.lineStartIndex,pe=o.lineStartIndex+o.lineLength,me=Yi($,y,H,re,n,T,w,o,_,p,k,B,R);if(!me)return{notEnoughRoom:!0};const xe=Ht(me.first.point,m,R).point,fe=Ht(me.last.point,m,R).point;if(a&&!n){const Ce=Tr(o.writingMode,xe,fe,O);if(Ce)return Ce}N=[me.first];for(let Ce=o.glyphStartIndex+1;Ce0?xe.point:wt(w,me,ae,1,c,R),Ce=Tr(o.writingMode,ae,fe,O);if(Ce)return Ce}const te=S($*y.getoffsetX(o.glyphStartIndex),H,re,n,T,w,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,_,p,k,B,R);if(!te)return{notEnoughRoom:!0};N=[te]}for(const te of N)h.addDynamicAttributes(x,te.point,te.angle);return{}}function wt(o,t,n,a,c,p){const m=Ht(o.add(o.sub(t)._unit()),c,p).point,y=n.sub(m);return n.add(y._mult(a/y.mag()))}function Zn(o,t){const{projectionCache:n,lineVertexArray:a,labelPlaneMatrix:c,tileAnchorPoint:p,distanceFromAnchor:m,getElevation:y,previousVertex:_,direction:x,absOffsetX:T}=t;if(n.projections[o])return n.projections[o];const w=new h.Point(a.getx(o),a.gety(o)),k=Ht(w,c,y);if(k.signedDistanceFromCamera>0)return n.projections[o]=k.point,k.point;const O=o-x;return wt(m===0?p:new h.Point(a.getx(O),a.gety(O)),w,_,T-m+1,c,y)}function or(o,t,n){return o._unit()._perp()._mult(t*n)}function V(o,t,n,a,c,p,m,y){const{projectionCache:_,direction:x}=y;if(_.offsets[o])return _.offsets[o];const T=n.add(t);if(o+x=c)return _.offsets[o]=T,T;const w=Zn(o+x,y),k=or(w.sub(n),m,x),O=n.add(k),B=w.add(k);return _.offsets[o]=h.findLineIntersection(p,T,O,B)||T,_.offsets[o]}function S(o,t,n,a,c,p,m,y,_,x,T,w,k,O){const B=a?o-t:o+t;let R=B>0?1:-1,$=0;a&&(R*=-1,$=Math.PI),R<0&&($+=Math.PI);let H,re,N=R>0?y+m:y+m+1,te=c,ae=c,pe=0,me=0;const xe=Math.abs(B),fe=[];let Ce;for(;pe+me<=xe;){if(N+=R,N=_)return null;pe+=me,ae=te,re=H;const Ee={projectionCache:w,lineVertexArray:x,labelPlaneMatrix:T,tileAnchorPoint:p,distanceFromAnchor:pe,getElevation:O,previousVertex:ae,direction:R,absOffsetX:xe};if(te=Zn(N,Ee),n===0)fe.push(ae),Ce=te.sub(ae);else{let qe;const ke=te.sub(ae);qe=ke.mag()===0?or(Zn(N+R,Ee).sub(te),n,R):or(ke,n,R),re||(re=ae.add(qe)),H=V(N,qe,te,y,_,re,n,Ee),fe.push(re),Ce=H.sub(re)}me=Ce.mag()}const Ue=Ce._mult((xe-pe)/me)._add(re||ae),We=$+Math.atan2(te.y-ae.y,te.x-ae.x);return fe.push(Ue),{point:Ue,angle:k?We:0,path:fe}}const P=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function D(o,t){for(let n=0;n=1;ht--)ke.push(Ee.path[ht]);for(let ht=1;htHt(Ke,_,B));ke=ht.some(Ke=>Ke.signedDistanceFromCamera<=0)?[]:ht.map(Ke=>Ke.point)}let Ot=[];if(ke.length>0){const ht=ke[0].clone(),Ke=ke[0].clone();for(let Lt=1;Lt=Ce.x&&Ke.x<=Ue.x&&ht.y>=Ce.y&&Ke.y<=Ue.y?[ke]:Ke.xUe.x||Ke.yUe.y?[]:h.clipLine([ke],Ce.x,Ce.y,Ue.x,Ue.y)}for(const ht of Ot){We.reset(ht,.25*fe);let Ke=0;Ke=We.length<=.5*fe?1:Math.ceil(We.paddedLength/ct)+1;for(let Lt=0;Lt=this.screenRightBoundary||cthis.screenBottomBoundary}isInsideGrid(t,n,a,c){return a>=0&&t=0&&na.collisionGroupID===n}}return this.collisionGroups[t]}}function Ge(o,t,n,a,c){const{horizontalAlign:p,verticalAlign:m}=h.getAnchorAlignment(o),y=-(p-.5)*t,_=-(m-.5)*n,x=h.evaluateVariableOffset(o,a);return new h.Point(y+x[0]*c,_+x[1]*c)}function Le(o,t,n,a,c,p){const{x1:m,x2:y,y1:_,y2:x,anchorPointX:T,anchorPointY:w}=o,k=new h.Point(t,n);return a&&k._rotate(c?p:-p),{x1:m+k.x,y1:_+k.y,x2:y+k.x,y2:x+k.y,anchorPointX:T,anchorPointY:w}}class Oe{constructor(t,n,a,c,p){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new J(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Ne(c),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,a,c){const p=a.getBucket(n),m=a.latestFeatureIndex;if(!p||!m||n.id!==p.layerIds[0])return;const y=a.collisionBoxArray,_=p.layers[0].layout,x=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),T=a.tileSize/h.EXTENT,w=this.transform.calculatePosMatrix(a.tileID.toUnwrapped()),k=_.get("text-pitch-alignment")==="map",O=_.get("text-rotation-alignment")==="map",B=W(a,1,this.transform.zoom),R=He(w,k,O,this.transform,B);let $=null;if(k){const re=Si(w,k,O,this.transform,B);$=h.multiply([],this.transform.labelPlaneMatrix,re)}this.retainedQueryData[p.bucketInstanceId]=new ue(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,a.tileID);const H={bucket:p,layout:_,posMatrix:w,textLabelPlaneMatrix:R,labelToScreenMatrix:$,scale:x,textPixelRatio:T,holdingForFade:a.holdingForFade(),collisionBoxArray:y,partiallyEvaluatedTextSize:h.evaluateSizeForZoom(p.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(p.sourceID)};if(c)for(const re of p.sortKeyRanges){const{sortKey:N,symbolInstanceStart:te,symbolInstanceEnd:ae}=re;t.push({sortKey:N,symbolInstanceStart:te,symbolInstanceEnd:ae,parameters:H})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:H})}attemptAnchorPlacement(t,n,a,c,p,m,y,_,x,T,w,k,O,B,R,$){const H=[k.textOffset0,k.textOffset1],re=Ge(t,a,c,H,p),N=this.collisionIndex.placeCollisionBox(Le(n,re.x,re.y,m,y,this.transform.angle),w,_,x,T.predicate,$);if((!R||this.collisionIndex.placeCollisionBox(Le(R,re.x,re.y,m,y,this.transform.angle),w,_,x,T.predicate,$).box.length!==0)&&N.box.length>0){let te;if(this.prevPlacement&&this.prevPlacement.variableOffsets[k.crossTileID]&&this.prevPlacement.placements[k.crossTileID]&&this.prevPlacement.placements[k.crossTileID].text&&(te=this.prevPlacement.variableOffsets[k.crossTileID].anchor),k.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[k.crossTileID]={textOffset:H,width:a,height:c,anchor:t,textBoxScale:p,prevAnchor:te},this.markUsedJustification(O,t,k,B),O.allowVerticalPlacement&&(this.markUsedOrientation(O,B,k),this.placedOrientations[k.crossTileID]=B),{shift:re,placedGlyphBoxes:N}}}placeLayerBucketPart(t,n,a){const{bucket:c,layout:p,posMatrix:m,textLabelPlaneMatrix:y,labelToScreenMatrix:_,textPixelRatio:x,holdingForFade:T,collisionBoxArray:w,partiallyEvaluatedTextSize:k,collisionGroup:O}=t.parameters,B=p.get("text-optional"),R=p.get("icon-optional"),$=h.getOverlapMode(p,"text-overlap","text-allow-overlap"),H=$==="always",re=h.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),N=re==="always",te=p.get("text-rotation-alignment")==="map",ae=p.get("text-pitch-alignment")==="map",pe=p.get("icon-text-fit")!=="none",me=p.get("symbol-z-order")==="viewport-y",xe=H&&(N||!c.hasIconData()||R),fe=N&&(H||!c.hasTextData()||B);!c.collisionArrays&&w&&c.deserializeCollisionBoxes(w);const Ce=this.retainedQueryData[c.bucketInstanceId].tileID,Ue=this.terrain?(Ee,qe)=>this.terrain.getElevation(Ce,Ee,qe):null,We=(Ee,qe)=>{if(n[Ee.crossTileID])return;if(T)return void(this.placements[Ee.crossTileID]=new he(!1,!1,!1));let ke=!1,ct=!1,Ot=!0,ht=null,Ke={box:null,offscreen:null},Lt={box:null,offscreen:null},xi=null,Ut=null,ei=null,Li=0,Qi=0,er=0;qe.textFeatureIndex?Li=qe.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(Li=Ee.featureIndex),qe.verticalTextFeatureIndex&&(Qi=qe.verticalTextFeatureIndex);const vi=qe.textBox;if(vi){const ui=ut=>{let Kt=h.WritingMode.horizontal;if(c.allowVerticalPlacement&&!ut&&this.prevPlacement){const ii=this.prevPlacement.placedOrientations[Ee.crossTileID];ii&&(this.placedOrientations[Ee.crossTileID]=ii,Kt=ii,this.markUsedOrientation(c,Kt,Ee))}return Kt},ti=(ut,Kt)=>{if(c.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&qe.verticalTextBox){for(const ii of c.writingModes)if(ii===h.WritingMode.vertical?(Ke=Kt(),Lt=Ke):Ke=ut(),Ke&&Ke.box&&Ke.box.length)break}else Ke=ut()};if(p.get("text-variable-anchor")){let ut=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ee.crossTileID]){const pt=this.prevPlacement.variableOffsets[Ee.crossTileID];ut.indexOf(pt.anchor)>0&&(ut=ut.filter(Yt=>Yt!==pt.anchor),ut.unshift(pt.anchor))}const Kt=(pt,Yt,Bi)=>{const Qs=pt.x2-pt.x1,Ar=pt.y2-pt.y1,ic=Ee.textBoxScale,ol=pe&&re==="never"?Yt:null;let St={box:[],offscreen:!1};const Qa=$!=="never"?2*ut.length:ut.length;for(let hs=0;hs=ut.length?$:"never",Ee,c,Bi,ol,Ue);if(Pr&&(St=Pr.placedGlyphBoxes,St&&St.box&&St.box.length)){ke=!0,ht=Pr.shift;break}}return St};ti(()=>Kt(vi,qe.iconBox,h.WritingMode.horizontal),()=>{const pt=qe.verticalTextBox;return c.allowVerticalPlacement&&!(Ke&&Ke.box&&Ke.box.length)&&Ee.numVerticalGlyphVertices>0&&pt?Kt(pt,qe.verticalIconBox,h.WritingMode.vertical):{box:null,offscreen:null}}),Ke&&(ke=Ke.box,Ot=Ke.offscreen);const ii=ui(Ke&&Ke.box);if(!ke&&this.prevPlacement){const pt=this.prevPlacement.variableOffsets[Ee.crossTileID];pt&&(this.variableOffsets[Ee.crossTileID]=pt,this.markUsedJustification(c,pt.anchor,Ee,ii))}}else{const ut=(Kt,ii)=>{const pt=this.collisionIndex.placeCollisionBox(Kt,$,x,m,O.predicate,Ue);return pt&&pt.box&&pt.box.length&&(this.markUsedOrientation(c,ii,Ee),this.placedOrientations[Ee.crossTileID]=ii),pt};ti(()=>ut(vi,h.WritingMode.horizontal),()=>{const Kt=qe.verticalTextBox;return c.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&Kt?ut(Kt,h.WritingMode.vertical):{box:null,offscreen:null}}),ui(Ke&&Ke.box&&Ke.box.length)}}if(xi=Ke,ke=xi&&xi.box&&xi.box.length>0,Ot=xi&&xi.offscreen,Ee.useRuntimeCollisionCircles){const ui=c.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),ti=h.evaluateSizeForFeature(c.textSizeData,k,ui),ut=p.get("text-padding");Ut=this.collisionIndex.placeCollisionCircles($,ui,c.lineVertexArray,c.glyphOffsetArray,ti,m,y,_,a,ae,O.predicate,Ee.collisionCircleDiameter,ut,Ue),Ut.circles.length&&Ut.collisionDetected&&!a&&h.warnOnce("Collisions detected, but collision boxes are not shown"),ke=H||Ut.circles.length>0&&!Ut.collisionDetected,Ot=Ot&&Ut.offscreen}if(qe.iconFeatureIndex&&(er=qe.iconFeatureIndex),qe.iconBox){const ui=ti=>{const ut=pe&&ht?Le(ti,ht.x,ht.y,te,ae,this.transform.angle):ti;return this.collisionIndex.placeCollisionBox(ut,re,x,m,O.predicate,Ue)};Lt&&Lt.box&&Lt.box.length&&qe.verticalIconBox?(ei=ui(qe.verticalIconBox),ct=ei.box.length>0):(ei=ui(qe.iconBox),ct=ei.box.length>0),Ot=Ot&&ei.offscreen}const fr=B||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,cs=R||Ee.numIconVertices===0;if(fr||cs?cs?fr||(ct=ct&&ke):ke=ct&&ke:ct=ke=ct&&ke,ke&&xi&&xi.box&&this.collisionIndex.insertCollisionBox(xi.box,$,p.get("text-ignore-placement"),c.bucketInstanceId,Lt&&Lt.box&&Qi?Qi:Li,O.ID),ct&&ei&&this.collisionIndex.insertCollisionBox(ei.box,re,p.get("icon-ignore-placement"),c.bucketInstanceId,er,O.ID),Ut&&(ke&&this.collisionIndex.insertCollisionCircles(Ut.circles,$,p.get("text-ignore-placement"),c.bucketInstanceId,Li,O.ID),a)){const ui=c.bucketInstanceId;let ti=this.collisionCircleArrays[ui];ti===void 0&&(ti=this.collisionCircleArrays[ui]=new de);for(let ut=0;ut=0;--qe){const ke=Ee[qe];We(c.symbolInstances.get(ke),c.collisionArrays[ke])}}else for(let Ee=t.symbolInstanceStart;Ee=0&&(t.text.placedSymbolArray.get(y).crossTileID=p>=0&&y!==p?0:a.crossTileID)}markUsedOrientation(t,n,a){const c=n===h.WritingMode.horizontal||n===h.WritingMode.horizontalOnly?n:0,p=n===h.WritingMode.vertical?n:0,m=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const y of m)t.text.placedSymbolArray.get(y).placedOrientation=c;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const c=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const _ in this.placements){const x=this.placements[_],T=p[_];T?(this.opacities[_]=new ee(T,c,x.text,x.icon),a=a||x.text!==T.text.placed||x.icon!==T.icon.placed):(this.opacities[_]=new ee(null,c,x.text,x.icon,x.skipFade),a=a||x.text||x.icon)}for(const _ in p){const x=p[_];if(!this.opacities[_]){const T=new ee(x,c,!1,!1);T.isHidden()||(this.opacities[_]=T,a=a||x.text.placed||x.icon.placed)}}for(const _ in m)this.variableOffsets[_]||!this.opacities[_]||this.opacities[_].isHidden()||(this.variableOffsets[_]=m[_]);for(const _ in y)this.placedOrientations[_]||!this.opacities[_]||this.opacities[_].isHidden()||(this.placedOrientations[_]=y[_]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const c of n){const p=c.getBucket(t);p&&c.latestFeatureIndex&&t.id===p.layerIds[0]&&this.updateBucketOpacities(p,a,c.collisionBoxArray)}}updateBucketOpacities(t,n,a){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 c=t.layers[0].layout,p=new ee(null,0,!1,!1,!0),m=c.get("text-allow-overlap"),y=c.get("icon-allow-overlap"),_=c.get("text-variable-anchor"),x=c.get("text-rotation-alignment")==="map",T=c.get("text-pitch-alignment")==="map",w=c.get("icon-text-fit")!=="none",k=new ee(null,0,m&&(y||!t.hasIconData()||c.get("icon-optional")),y&&(m||!t.hasTextData()||c.get("text-optional")),!0);!t.collisionArrays&&a&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(a);const O=(B,R,$)=>{for(let H=0;H0,ae=this.placedOrientations[R.crossTileID],pe=ae===h.WritingMode.vertical,me=ae===h.WritingMode.horizontal||ae===h.WritingMode.horizontalOnly;if($>0||H>0){const xe=Fr(N.text);O(t.text,$,pe?oi:xe),O(t.text,H,me?oi:xe);const fe=N.text.isHidden();[R.rightJustifiedTextSymbolIndex,R.centerJustifiedTextSymbolIndex,R.leftJustifiedTextSymbolIndex].forEach(We=>{We>=0&&(t.text.placedSymbolArray.get(We).hidden=fe||pe?1:0)}),R.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(R.verticalPlacedTextSymbolIndex).hidden=fe||me?1:0);const Ce=this.variableOffsets[R.crossTileID];Ce&&this.markUsedJustification(t,Ce.anchor,R,ae);const Ue=this.placedOrientations[R.crossTileID];Ue&&(this.markUsedJustification(t,"left",R,Ue),this.markUsedOrientation(t,Ue,R))}if(te){const xe=Fr(N.icon),fe=!(w&&R.verticalPlacedIconSymbolIndex&&pe);R.placedIconSymbolIndex>=0&&(O(t.icon,R.numIconVertices,fe?xe:oi),t.icon.placedSymbolArray.get(R.placedIconSymbolIndex).hidden=N.icon.isHidden()),R.verticalPlacedIconSymbolIndex>=0&&(O(t.icon,R.numVerticalIconVertices,fe?oi:xe),t.icon.placedSymbolArray.get(R.verticalPlacedIconSymbolIndex).hidden=N.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const xe=t.collisionArrays[B];if(xe){let fe=new h.Point(0,0);if(xe.textBox||xe.verticalTextBox){let Ue=!0;if(_){const We=this.variableOffsets[re];We?(fe=Ge(We.anchor,We.width,We.height,We.textOffset,We.textBoxScale),x&&fe._rotate(T?this.transform.angle:-this.transform.angle)):Ue=!1}xe.textBox&&Ze(t.textCollisionBox.collisionVertexArray,N.text.placed,!Ue||pe,fe.x,fe.y),xe.verticalTextBox&&Ze(t.textCollisionBox.collisionVertexArray,N.text.placed,!Ue||me,fe.x,fe.y)}const Ce=!!(!me&&xe.verticalIconBox);xe.iconBox&&Ze(t.iconCollisionBox.collisionVertexArray,N.icon.placed,Ce,w?fe.x:0,w?fe.y:0),xe.verticalIconBox&&Ze(t.iconCollisionBox.collisionVertexArray,N.icon.placed,!Ce,w?fe.x:0,w?fe.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 B=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=B.invProjMatrix,t.placementViewportMatrix=B.viewportMatrix,t.collisionCircleArray=B.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?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 Ze(o,t,n,a,c){o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0),o.emplaceBack(t?1:0,n?1:0,a||0,c||0)}const st=Math.pow(2,25),Je=Math.pow(2,24),ot=Math.pow(2,17),vt=Math.pow(2,16),$t=Math.pow(2,9),je=Math.pow(2,8),zt=Math.pow(2,1);function Fr(o){if(o.opacity===0&&!o.placed)return 0;if(o.opacity===1&&o.placed)return 4294967295;const t=o.placed?1:0,n=Math.floor(127*o.opacity);return n*st+t*Je+n*ot+t*vt+n*$t+t*je+n*zt+t}const oi=0;class ki{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,c,p){const m=this._bucketParts;for(;this._currentTileIndexy.sortKey-_.sortKey));this._currentPartIndex!this._forceFullPlacement&&h.exported.now()-c>2;for(;this._currentPlacementIndex>=0;){const m=n[t[this._currentPlacementIndex]],y=this.placement.collisionIndex.transform.zoom;if(m.type==="symbol"&&(!m.minzoom||m.minzoom<=y)&&(!m.maxzoom||m.maxzoom>y)){if(this._inProgressLayer||(this._inProgressLayer=new ki(m)),this._inProgressLayer.continuePlacement(a[m.source],this.placement,this._showCollisionBoxes,m,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const wn=512/h.EXTENT/2;class ms{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const c=new Map;for(let p=0;p({x:Math.floor(_.anchorX*wn),y:Math.floor(_.anchorY*wn)})),crossTileIDs:m.map(_=>_.crossTileID)};if(y.positions.length>128){const _=new h.KDBush(y.positions.length,16,Uint16Array);for(const{x,y:T}of y.positions)_.add(x,T);_.finish(),delete y.positions,y.index=_}this._symbolsByKey[p]=y}}getScaledCoordinates(t,n){const{x:a,y:c,z:p}=this.tileID.canonical,{x:m,y,z:_}=n.canonical,x=wn/Math.pow(2,_-p),T=(y*h.EXTENT+t.anchorY)*x,w=c*h.EXTENT*wn;return{x:Math.floor((m*h.EXTENT+t.anchorX)*x-a*h.EXTENT*wn),y:Math.floor(T-w)}}findMatches(t,n,a){const c=this.tileID.canonical.zt)}}class qt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Gn{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const c=this.indexes[a],p={};for(const m in c){const y=c[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),p[y.tileID.key]=y}this.indexes[a]=p}this.lng=t}addBucket(t,n,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;pt.overscaledZ)for(const y in m){const _=m[y];_.tileID.isChildOf(t)&&_.findMatches(n.symbolInstances,t,c)}else{const y=m[t.scaledTo(Number(p)).key];y&&y.findMatches(n.symbolInstances,t,c)}}for(let p=0;p{n[a]=!0});for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}const Rt=(o,t)=>h.emitValidationErrors(o,t&&t.filter(n=>n.identifier!=="source.canvas")),gs=h.pick(h.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Ji=h.pick(h.operations,["setCenter","setZoom","setBearing","setPitch"]),So=h.emptyStyle();class li extends h.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new yi(bn(),this,t._getMapId()),this.imageManager=new $i,this.imageManager.setEventedParent(this),this.glyphManager=new yr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Dr(256,512),this.crossTileSymbolIndex=new Or,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new h.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",h.getReferrer());const a=this;this._rtlTextPluginCallback=li.registerForPluginStateChange(c=>{a.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:c.pluginStatus,pluginURL:c.pluginURL},(p,m)=>{if(h.triggerPluginCompletionEvent(p),m&&m.every(y=>y))for(const y in a.sourceCaches){const _=a.sourceCaches[y].getSource().type;_!=="vector"&&_!=="geojson"||a.sourceCaches[y].reload()}})}),this.on("data",c=>{if(c.dataType!=="source"||c.sourceDataType!=="metadata")return;const p=this.sourceCaches[c.sourceId];if(!p)return;const m=p.getSource();if(m&&m.vectorLayerIds)for(const y in this._layers){const _=this._layers[y];_.source===m.id&&this._validateLayer(_)}})}loadURL(t,n={},a){this.fire(new h.Event("dataloading",{dataType:"style"})),n.validate=typeof n.validate!="boolean"||n.validate;const c=this.map._requestManager.transformRequest(t,nt.Style);this._request=h.getJSON(c,(p,m)=>{this._request=null,p?this.fire(new h.ErrorEvent(p)):m&&this._load(m,n,a)})}loadJSON(t,n={},a){this.fire(new h.Event("dataloading",{dataType:"style"})),this._request=h.exported.frame(()=>{this._request=null,n.validate=n.validate!==!1,this._load(t,n,a)})}loadEmpty(){this.fire(new h.Event("dataloading",{dataType:"style"})),this._load(So,{validate:!1})}_load(t,n,a){const c=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!Rt(this,h.validateStyle(c))){this._loaded=!0,this.stylesheet=c;for(const p in c.sources)this.addSource(p,c.sources[p],{validate:!1});c.sprite?this._loadSprite(c.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(c.glyphs),this._createLayers(),this.light=new $n(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new h.Event("data",{dataType:"style"})),this.fire(new h.Event("style.load"))}}_createLayers(){const t=h.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(n=>n.id),this._layers={},this._serializedLayers=null;for(const n of t){const a=h.createStyleLayer(n);a.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=a}}_loadSprite(t,n=!1,a=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(c,p,m,y){const _=Gr(c),x=_.length,T=m>1?"@2x":"",w={},k={},O={};for(const{id:B,url:R}of _){const $=p.transformRequest(p.normalizeSpriteURL(R,T,".json"),nt.SpriteJSON),H=`${B}_${$.url}`;w[H]=h.getJSON($,(te,ae)=>{delete w[H],k[B]=ae,ci(y,k,O,te,x)});const re=p.transformRequest(p.normalizeSpriteURL(R,T,".png"),nt.SpriteImage),N=`${B}_${re.url}`;w[N]=Qt.getImage(re,(te,ae)=>{delete w[N],O[B]=ae,ci(y,k,O,te,x)})}return{cancel(){for(const B of Object.values(w))B.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(c,p)=>{if(this._spriteRequest=null,c)this.fire(new h.ErrorEvent(c));else if(p)for(const m in p){this._spritesImagesIds[m]=[];const y=this._spritesImagesIds[m]?this._spritesImagesIds[m].filter(_=>!(_ in p)):[];for(const _ of y)this.imageManager.removeImage(_),this._changedImages[_]=!0;for(const _ in p[m]){const x=m==="default"?_:`${m}:${_}`;this._spritesImagesIds[m].push(x),x in this.imageManager.images?this.imageManager.updateImage(x,p[m][_],!1):this.imageManager.addImage(x,p[m][_]),n&&(this._changedImages[x]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"})),a&&a(c)})}_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("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const c=n.getSource();(c.type==="geojson"||c.vectorLayerIds&&c.vectorLayerIds.indexOf(a)===-1)&&this.fire(new h.ErrorEvent(new Error(`Source layer "${a}" does not exist on source "${c.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||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){const n=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n);const a=[];for(const c of t)n[c]&&a.push(n[c]);return a}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const a of n){const c=this._layers[a];c.type!=="custom"&&(t[a]=c.serialize())}return t}hasTransitions(){if(this.light&&this.light.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 n=this._changed;if(this._changed){const c=Object.keys(this._updatedLayers),p=Object.keys(this._removedLayers);(c.length||p.length)&&this._updateWorkerLayers(c,p);for(const m in this._updatedSources){const y=this._updatedSources[m];if(y==="reload")this._reloadSource(m);else{if(y!=="clear")throw new Error(`Invalid action ${y}`);this._clearSource(m)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const m in this._updatedPaintProps)this._layers[m].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const a={};for(const c in this.sourceCaches){const p=this.sourceCaches[c];a[c]=p.used,p.used=!1}for(const c of this._order){const p=this._layers[c];p.recalculate(t,this._availableImages),!p.isHidden(t.zoom)&&p.source&&(this.sourceCaches[p.source].used=!0)}for(const c in a){const p=this.sourceCaches[c];a[c]!==p.used&&p.fire(new h.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:c}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new h.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].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,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){this._checkLoaded();const a=this.serialize();if(t=n.transformStyle?n.transformStyle(a,t):t,Rt(this,h.validateStyle(t)))return!1;(t=h.clone$1(t)).layers=h.derefLayers(t.layers);const c=h.diffStyles(a,t).filter(m=>!(m.command in Ji));if(c.length===0)return!1;const p=c.filter(m=>!(m.command in gs));if(p.length>0)throw new Error(`Unimplemented: ${p.map(m=>m.command).join(", ")}.`);for(const m of c)m.command!=="setTransition"&&this[m.command].apply(this,m.args);return this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new h.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new h.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(h.validateStyle.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const c=this.sourceCaches[t]=new Nt(t,n,this.dispatcher);c.style=this,c.setEventedParent(this,()=>({isSourceLoaded:c.loaded(),source:c.serialize(),sourceId:t})),c.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new h.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new h.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.sourceCaches[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const c=t.id;if(this.getLayer(c))return void this.fire(new h.ErrorEvent(new Error(`Layer "${c}" already exists on this map.`)));let p;if(t.type==="custom"){if(Rt(this,h.validateCustomStyleLayer(t)))return;p=h.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(c,t.source),t=h.clone$1(t),t=h.extend(t,{source:c})),this._validate(h.validateStyle.layer,`layers.${c}`,t,{arrayIndex:-1},a))return;p=h.createStyleLayer(t),this._validateLayer(p),p.setEventedParent(this,{layer:{id:c}})}const m=n?this._order.indexOf(n):this._order.length;if(n&&m===-1)this.fire(new h.ErrorEvent(new Error(`Cannot add layer "${c}" before non-existing layer "${n}".`)));else{if(this._order.splice(m,0,c),this._layerOrderChanged=!0,this._layers[c]=p,this._removedLayers[c]&&p.source&&p.type!=="custom"){const y=this._removedLayers[c];delete this._removedLayers[c],y.type!==p.type?this._updatedSources[p.source]="clear":(this._updatedSources[p.source]="reload",this.sourceCaches[p.source].pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new h.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const c=n?this._order.indexOf(n):this._order.length;n&&c===-1?this.fire(new h.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(c,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new h.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const c=this.getLayer(t);c?c.minzoom===n&&c.maxzoom===a||(n!=null&&(c.minzoom=n),a!=null&&(c.maxzoom=a),this._updateLayer(c)):this.fire(new h.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const c=this.getLayer(t);if(c){if(!h.deepEqual(c.filter,n))return n==null?(c.filter=void 0,void this._updateLayer(c)):void(this._validate(h.validateStyle.filter,`layers.${c.id}.filter`,n,null,a)||(c.filter=h.clone$1(n),this._updateLayer(c)))}else this.fire(new h.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return h.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?h.deepEqual(p.getLayoutProperty(n),a)||(p.setLayoutProperty(n,a,c),this._updateLayer(p)):this.fire(new h.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new h.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,c={}){this._checkLoaded();const p=this.getLayer(t);p?h.deepEqual(p.getPaintProperty(n),a)||(p.setPaintProperty(n,a,c)&&this._updateLayer(p),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new h.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,c=t.sourceLayer,p=this.sourceCaches[a];if(p===void 0)return void this.fire(new h.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const m=p.getSource().type;m==="geojson"&&c?this.fire(new h.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):m!=="vector"||c?(t.id===void 0&&this.fire(new h.ErrorEvent(new Error("The feature id parameter must be provided."))),p.setFeatureState(c,t.id,n)):this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,c=this.sourceCaches[a];if(c===void 0)return void this.fire(new h.ErrorEvent(new Error(`The source '${a}' does not exist in the map's style.`)));const p=c.getSource().type,m=p==="vector"?t.sourceLayer:void 0;p!=="vector"||m?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new h.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):c.removeFeatureState(m,t.id,n):this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,c=this.sourceCaches[n];if(c!==void 0)return c.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new h.ErrorEvent(new Error("The feature id parameter must be provided."))),c.getFeatureState(a,t.id)):void this.fire(new h.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return h.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){const t=h.mapObject(this.sourceCaches,c=>c.serialize()),n=this._serializeByIds(this._order),a=this.stylesheet;return h.filterObject({version:a.version,name:a.name,metadata:a.metadata,light:a.light,center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,sprite:a.sprite,glyphs:a.glyphs,transition:a.transition,sources:t,layers:n},c=>c!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=m=>this._layers[m].type==="fill-extrusion",a={},c=[];for(let m=this._order.length-1;m>=0;m--){const y=this._order[m];if(n(y)){a[y]=m;for(const _ of t){const x=_[y];if(x)for(const T of x)c.push(T)}}}c.sort((m,y)=>y.intersectionZ-m.intersectionZ);const p=[];for(let m=this._order.length-1;m>=0;m--){const y=this._order[m];if(n(y))for(let _=c.length-1;_>=0;_--){const x=c[_].feature;if(a[x.layer.id]{const xe=H.featureSortOrder;if(xe){const fe=xe.indexOf(pe.featureIndex);return xe.indexOf(me.featureIndex)-fe}return me.featureIndex-pe.featureIndex});for(const pe of ae)te.push(pe)}}for(const H in B)B[H].forEach(re=>{const N=re.feature,te=x[y[H].source].getFeatureState(N.layer["source-layer"],N.id);N.source=N.layer.source,N.layer["source-layer"]&&(N.sourceLayer=N.layer["source-layer"]),N.state=te});return B}(this._layers,m,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(p)}querySourceFeatures(t,n){n&&n.filter&&this._validate(h.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.sourceCaches[t];return a?function(c,p){const m=c.getRenderableIds().map(x=>c.getTileByID(x)),y=[],_={};for(let x=0;xk.getTileByID(O)).sort((O,B)=>B.tileID.overscaledZ-O.tileID.overscaledZ||(O.tileID.isLessThan(B.tileID)?-1:1))}const w=this.crossTileSymbolIndex.addLayer(T,_[T.source],t.center.lng);m=m||w}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((p=p||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(h.exported.now(),t.zoom))&&(this.pauseablePlacement=new Zi(t,this.map.terrain,this._order,p,n,a,c,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,_),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(h.exported.now()),y=!0),m&&this.pauseablePlacement.placement.setStale()),y||m)for(const x of this._order){const T=this._layers[x];T.type==="symbol"&&this.placement.updateLayerOpacities(T,_[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(h.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,a){this.imageManager.getImages(n.icons,a),this._updateTilesForChangedImages();const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,a){this.glyphManager.getGlyphs(n.stacks,a);const c=this.sourceCaches[n.source];c&&c.setDependencies(n.tileID.key,n.type,[""])}getResource(t,n,a){return h.makeRequest(n,a)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(h.validateStyle.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,n,a={},c){this._checkLoaded();const p=[{id:t,url:n}],m=[...Gr(this.stylesheet.sprite),...p];this._validate(h.validateStyle.sprite,"sprite",m,null,a)||(this.stylesheet.sprite=m,this._loadSprite(p,!0,c))}removeSprite(t){this._checkLoaded();const n=Gr(this.stylesheet.sprite);if(n.find(a=>a.id===t)){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex(a=>a.id===t),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new h.Event("data",{dataType:"style"}))}else this.fire(new h.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Gr(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(h.validateStyle.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}}li.getSourceType=function(o){return Br[o]},li.setSourceType=function(o,t){Br[o]=t},li.registerForPluginStateChange=h.registerForPluginStateChange;var _a=h.createLayout([{name:"a_pos",type:"Int16",components:2}]),_s="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const Ur={prelude:dt(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -526,58 +526,58 @@ void main() { #pragma mapbox: initialize lowp float halo_blur vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : -u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:dt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",_s),terrainDepth:dt("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);}",_s),terrainCoords:dt("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);}",_s)};function dt(o,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/attribute ([\w]+) ([\w]+)/g),c=o.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=p?p.concat(c):c,y={};return{fragmentSource:o=o.replace(n,(_,x,T,w,z)=>(y[z]=!0,x==="define"?` -#ifndef HAS_UNIFORM_u_${z} -varying ${T} ${w} ${z}; +u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:dt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",_s),terrainDepth:dt("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);}",_s),terrainCoords:dt("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);}",_s)};function dt(o,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/attribute ([\w]+) ([\w]+)/g),c=o.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),p=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),m=p?p.concat(c):c,y={};return{fragmentSource:o=o.replace(n,(_,x,T,w,k)=>(y[k]=!0,x==="define"?` +#ifndef HAS_UNIFORM_u_${k} +varying ${T} ${w} ${k}; #else -uniform ${T} ${w} u_${z}; +uniform ${T} ${w} u_${k}; #endif `:` -#ifdef HAS_UNIFORM_u_${z} - ${T} ${w} ${z} = u_${z}; -#endif -`)),vertexSource:t=t.replace(n,(_,x,T,w,z)=>{const O=w==="float"?"vec2":"vec4",L=z.match(/color/)?"color":O;return y[z]?x==="define"?` -#ifndef HAS_UNIFORM_u_${z} -uniform lowp float u_${z}_t; -attribute ${T} ${O} a_${z}; -varying ${T} ${w} ${z}; +#ifdef HAS_UNIFORM_u_${k} + ${T} ${w} ${k} = u_${k}; +#endif +`)),vertexSource:t=t.replace(n,(_,x,T,w,k)=>{const O=w==="float"?"vec2":"vec4",B=k.match(/color/)?"color":O;return y[k]?x==="define"?` +#ifndef HAS_UNIFORM_u_${k} +uniform lowp float u_${k}_t; +attribute ${T} ${O} a_${k}; +varying ${T} ${w} ${k}; #else -uniform ${T} ${w} u_${z}; +uniform ${T} ${w} u_${k}; #endif -`:L==="vec4"?` -#ifndef HAS_UNIFORM_u_${z} - ${z} = a_${z}; +`:B==="vec4"?` +#ifndef HAS_UNIFORM_u_${k} + ${k} = a_${k}; #else - ${T} ${w} ${z} = u_${z}; + ${T} ${w} ${k} = u_${k}; #endif `:` -#ifndef HAS_UNIFORM_u_${z} - ${z} = unpack_mix_${L}(a_${z}, u_${z}_t); +#ifndef HAS_UNIFORM_u_${k} + ${k} = unpack_mix_${B}(a_${k}, u_${k}_t); #else - ${T} ${w} ${z} = u_${z}; + ${T} ${w} ${k} = u_${k}; #endif `:x==="define"?` -#ifndef HAS_UNIFORM_u_${z} -uniform lowp float u_${z}_t; -attribute ${T} ${O} a_${z}; +#ifndef HAS_UNIFORM_u_${k} +uniform lowp float u_${k}_t; +attribute ${T} ${O} a_${k}; #else -uniform ${T} ${w} u_${z}; +uniform ${T} ${w} u_${k}; #endif -`:L==="vec4"?` -#ifndef HAS_UNIFORM_u_${z} - ${T} ${w} ${z} = a_${z}; +`:B==="vec4"?` +#ifndef HAS_UNIFORM_u_${k} + ${T} ${w} ${k} = a_${k}; #else - ${T} ${w} ${z} = u_${z}; + ${T} ${w} ${k} = u_${k}; #endif `:` -#ifndef HAS_UNIFORM_u_${z} - ${T} ${w} ${z} = unpack_mix_${L}(a_${z}, u_${z}_t); +#ifndef HAS_UNIFORM_u_${k} + ${T} ${w} ${k} = unpack_mix_${B}(a_${k}, u_${k}_t); #else - ${T} ${w} ${z} = u_${z}; + ${T} ${w} ${k} = u_${k}; #endif -`}),staticAttributes:a,staticUniforms:m}}class Vr{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,a,c,p,m,y,_,x){this.context=t;let T=this.boundPaintVertexBuffers.length!==c.length;for(let w=0;!T&&w({u_depth:new h.Uniform1i(me,xe.u_depth),u_terrain:new h.Uniform1i(me,xe.u_terrain),u_terrain_dim:new h.Uniform1f(me,xe.u_terrain_dim),u_terrain_matrix:new h.UniformMatrix4f(me,xe.u_terrain_matrix),u_terrain_unpack:new h.Uniform4f(me,xe.u_terrain_unpack),u_terrain_exaggeration:new h.Uniform1f(me,xe.u_terrain_exaggeration)}))(t,pe),this.binderUniforms=c?c.getUniforms(t,pe):[]}draw(t,n,a,c,p,m,y,_,x,T,w,z,O,L,R,$,H,re){const N=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(c),t.setColorMode(p),t.setCullFace(m),_){t.activeTexture.set(N.TEXTURE2),N.bindTexture(N.TEXTURE_2D,_.depthTexture),t.activeTexture.set(N.TEXTURE3),N.bindTexture(N.TEXTURE_2D,_.texture);for(const ae in this.terrainUniforms)this.terrainUniforms[ae].set(_[ae])}for(const ae in this.fixedUniforms)this.fixedUniforms[ae].set(y[ae]);R&&R.setUniforms(t,this.binderUniforms,O,{zoom:L});let te=0;switch(n){case N.LINES:te=2;break;case N.TRIANGLES:te=3;break;case N.LINE_STRIP:te=1}for(const ae of z.get()){const pe=ae.vaos||(ae.vaos={});(pe[x]||(pe[x]=new Vr)).bind(t,this,T,R?R.getPaintVertexBuffers():[],w,ae.vertexOffset,$,H,re),N.drawElements(n,ae.primitiveLength*te,N.UNSIGNED_SHORT,ae.primitiveOffset*te*2)}}}function Io(o,t,n){const a=1/W(n,1,t.transform.tileZoom),c=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/c,m=p*(n.tileID.canonical.x+n.tileID.wrap*c),y=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,o.fromScale,o.toScale],u_fade:o.t,u_pixel_coord_upper:[m>>16,y>>16],u_pixel_coord_lower:[65535&m,65535&y]}}const Ao=(o,t,n,a)=>{const c=t.style.light,p=c.properties.get("position"),m=[p.x,p.y,p.z],y=function(){var x=new h.ARRAY_TYPE(9);return h.ARRAY_TYPE!=Float32Array&&(x[1]=0,x[2]=0,x[3]=0,x[5]=0,x[6]=0,x[7]=0),x[0]=1,x[4]=1,x[8]=1,x}();c.properties.get("anchor")==="viewport"&&function(x,T){var w=Math.sin(T),z=Math.cos(T);x[0]=z,x[1]=w,x[2]=0,x[3]=-w,x[4]=z,x[5]=0,x[6]=0,x[7]=0,x[8]=1}(y,-t.transform.angle),function(x,T,w){var z=T[0],O=T[1],L=T[2];x[0]=z*w[0]+O*w[3]+L*w[6],x[1]=z*w[1]+O*w[4]+L*w[7],x[2]=z*w[2]+O*w[5]+L*w[8]}(m,m,y);const _=c.properties.get("color");return{u_matrix:o,u_lightpos:m,u_lightintensity:c.properties.get("intensity"),u_lightcolor:[_.r,_.g,_.b],u_vertical_gradient:+n,u_opacity:a}},ya=(o,t,n,a,c,p,m)=>h.extend(Ao(o,t,n,a),Io(p,t,m),{u_height_factor:-Math.pow(2,c.overscaledZ)/m.tileSize/8}),Po=o=>({u_matrix:o}),xa=(o,t,n,a)=>h.extend(Po(o),Io(n,t,a)),Ul=(o,t)=>({u_matrix:o,u_world:t}),Mo=(o,t,n,a,c)=>h.extend(xa(o,t,n,a),{u_world:c}),Vl=(o,t,n,a)=>{const c=o.transform;let p,m;if(a.paint.get("circle-pitch-alignment")==="map"){const y=W(n,1,c.zoom);p=!0,m=[y,y]}else p=!1,m=c.pixelsToGLUnits;return{u_camera_to_center_distance:c.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:o.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:o.pixelRatio,u_extrude_scale:m}},va=(o,t,n)=>{const a=W(n,1,t.zoom),c=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:o,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*c),t.pixelsToGLUnits[1]/(a*c)],u_overscale_factor:p}},ba=(o,t,n=1)=>({u_matrix:o,u_color:t,u_overlay:0,u_overlay_scale:n}),wa=o=>({u_matrix:o}),Co=(o,t,n,a)=>({u_matrix:o,u_extrude_scale:W(t,1,n),u_intensity:a});function zo(o,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new h.MercatorCoordinate(0,a/n).toLngLat().lat,new h.MercatorCoordinate(0,(a+1)/n).toLngLat().lat]}const Er=(o,t,n,a)=>{const c=o.transform;return{u_matrix:Tn(o,t,n,a),u_ratio:1/W(t,1,c.zoom),u_device_pixel_ratio:o.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},xs=(o,t,n,a,c)=>h.extend(Er(o,t,n,c),{u_image:0,u_image_height:a}),Gi=(o,t,n,a,c)=>{const p=o.transform,m=Xn(t,p);return{u_matrix:Tn(o,t,n,c),u_texsize:t.imageAtlasTexture.size,u_ratio:1/W(t,1,p.zoom),u_device_pixel_ratio:o.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},vs=(o,t,n,a,c,p)=>{const m=o.lineAtlas,y=Xn(t,o.transform),_=n.layout.get("line-cap")==="round",x=m.getDash(a.from,_),T=m.getDash(a.to,_),w=x.width*c.fromScale,z=T.width*c.toScale;return h.extend(Er(o,t,n,p),{u_patternscale_a:[y/w,-x.height/2],u_patternscale_b:[y/z,-T.height/2],u_sdfgamma:m.width/(256*Math.min(w,z)*o.pixelRatio)/2,u_image:0,u_tex_y_a:x.y,u_tex_y_b:T.y,u_mix:c.t})};function Xn(o,t){return 1/W(o,1,t.tileZoom)}function Tn(o,t,n,a){return o.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const bs=(o,t,n,a,c)=>{return{u_matrix:o,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*c.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:c.paint.get("raster-brightness-min"),u_brightness_high:c.paint.get("raster-brightness-max"),u_saturation_factor:(m=c.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(p=c.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:ws(c.paint.get("raster-hue-rotate"))};var p,m};function ws(o){o*=Math.PI/180;const t=Math.sin(o),n=Math.cos(o);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const En=(o,t,n,a,c,p,m,y,_,x)=>{const T=c.transform;return{u_is_size_zoom_constant:+(o==="constant"||o==="source"),u_is_size_feature_constant:+(o==="constant"||o==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:T.cameraToCenterDistance,u_pitch:T.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:T.width/T.height,u_fade_change:c.options.fadeDuration?c.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:y,u_is_text:+_,u_pitch_with_map:+a,u_texsize:x,u_texture:0}},Sn=(o,t,n,a,c,p,m,y,_,x,T)=>{const w=c.transform;return h.extend(En(o,t,n,a,c,p,m,y,_,x),{u_gamma_scale:a?Math.cos(w._pitch)*w.cameraToCenterDistance:1,u_device_pixel_ratio:c.pixelRatio,u_is_halo:+T})},Ts=(o,t,n,a,c,p,m,y,_,x)=>h.extend(Sn(o,t,n,a,c,p,m,y,!0,_,!0),{u_texsize_icon:x,u_texture_icon:1}),ki=(o,t,n)=>({u_matrix:o,u_opacity:t,u_color:n}),Di=(o,t,n,a,c,p)=>h.extend(function(m,y,_,x){const T=_.imageManager.getPattern(m.from.toString()),w=_.imageManager.getPattern(m.to.toString()),{width:z,height:O}=_.imageManager.getPixelSize(),L=Math.pow(2,x.tileID.overscaledZ),R=x.tileSize*Math.pow(2,_.transform.tileZoom)/L,$=R*(x.tileID.canonical.x+x.tileID.wrap*L),H=R*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:w.tl,u_pattern_br_b:w.br,u_texsize:[z,O],u_mix:y.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:w.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/W(x,1,_.transform.tileZoom),u_pixel_coord_upper:[$>>16,H>>16],u_pixel_coord_lower:[65535&$,65535&H]}}(a,p,n,c),{u_matrix:o,u_opacity:t}),Ta={fillExtrusion:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_lightpos:new h.Uniform3f(o,t.u_lightpos),u_lightintensity:new h.Uniform1f(o,t.u_lightintensity),u_lightcolor:new h.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new h.Uniform1f(o,t.u_vertical_gradient),u_opacity:new h.Uniform1f(o,t.u_opacity)}),fillExtrusionPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_lightpos:new h.Uniform3f(o,t.u_lightpos),u_lightintensity:new h.Uniform1f(o,t.u_lightintensity),u_lightcolor:new h.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new h.Uniform1f(o,t.u_vertical_gradient),u_height_factor:new h.Uniform1f(o,t.u_height_factor),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade),u_opacity:new h.Uniform1f(o,t.u_opacity)}),fill:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),fillPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),fillOutline:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world)}),fillOutlinePattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),circle:(o,t)=>({u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_scale_with_map:new h.Uniform1i(o,t.u_scale_with_map),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_extrude_scale:new h.Uniform2f(o,t.u_extrude_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),collisionBox:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pixels_to_tile_units:new h.Uniform1f(o,t.u_pixels_to_tile_units),u_extrude_scale:new h.Uniform2f(o,t.u_extrude_scale),u_overscale_factor:new h.Uniform1f(o,t.u_overscale_factor)}),collisionCircle:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_inv_matrix:new h.UniformMatrix4f(o,t.u_inv_matrix),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_viewport_size:new h.Uniform2f(o,t.u_viewport_size)}),debug:(o,t)=>({u_color:new h.UniformColor(o,t.u_color),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_overlay:new h.Uniform1i(o,t.u_overlay),u_overlay_scale:new h.Uniform1f(o,t.u_overlay_scale)}),clippingMask:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),heatmap:(o,t)=>({u_extrude_scale:new h.Uniform1f(o,t.u_extrude_scale),u_intensity:new h.Uniform1f(o,t.u_intensity),u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),heatmapTexture:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world),u_image:new h.Uniform1i(o,t.u_image),u_color_ramp:new h.Uniform1i(o,t.u_color_ramp),u_opacity:new h.Uniform1f(o,t.u_opacity)}),hillshade:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_latrange:new h.Uniform2f(o,t.u_latrange),u_light:new h.Uniform2f(o,t.u_light),u_shadow:new h.UniformColor(o,t.u_shadow),u_highlight:new h.UniformColor(o,t.u_highlight),u_accent:new h.UniformColor(o,t.u_accent)}),hillshadePrepare:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_dimension:new h.Uniform2f(o,t.u_dimension),u_zoom:new h.Uniform1f(o,t.u_zoom),u_unpack:new h.Uniform4f(o,t.u_unpack)}),line:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels)}),lineGradient:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_image:new h.Uniform1i(o,t.u_image),u_image_height:new h.Uniform1f(o,t.u_image_height)}),linePattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texsize:new h.Uniform2f(o,t.u_texsize),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_image:new h.Uniform1i(o,t.u_image),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),lineSDF:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_patternscale_a:new h.Uniform2f(o,t.u_patternscale_a),u_patternscale_b:new h.Uniform2f(o,t.u_patternscale_b),u_sdfgamma:new h.Uniform1f(o,t.u_sdfgamma),u_image:new h.Uniform1i(o,t.u_image),u_tex_y_a:new h.Uniform1f(o,t.u_tex_y_a),u_tex_y_b:new h.Uniform1f(o,t.u_tex_y_b),u_mix:new h.Uniform1f(o,t.u_mix)}),raster:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_tl_parent:new h.Uniform2f(o,t.u_tl_parent),u_scale_parent:new h.Uniform1f(o,t.u_scale_parent),u_buffer_scale:new h.Uniform1f(o,t.u_buffer_scale),u_fade_t:new h.Uniform1f(o,t.u_fade_t),u_opacity:new h.Uniform1f(o,t.u_opacity),u_image0:new h.Uniform1i(o,t.u_image0),u_image1:new h.Uniform1i(o,t.u_image1),u_brightness_low:new h.Uniform1f(o,t.u_brightness_low),u_brightness_high:new h.Uniform1f(o,t.u_brightness_high),u_saturation_factor:new h.Uniform1f(o,t.u_saturation_factor),u_contrast_factor:new h.Uniform1f(o,t.u_contrast_factor),u_spin_weights:new h.Uniform3f(o,t.u_spin_weights)}),symbolIcon:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texture:new h.Uniform1i(o,t.u_texture)}),symbolSDF:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texture:new h.Uniform1i(o,t.u_texture),u_gamma_scale:new h.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new h.Uniform1i(o,t.u_is_halo)}),symbolTextAndIcon:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texsize_icon:new h.Uniform2f(o,t.u_texsize_icon),u_texture:new h.Uniform1i(o,t.u_texture),u_texture_icon:new h.Uniform1i(o,t.u_texture_icon),u_gamma_scale:new h.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new h.Uniform1i(o,t.u_is_halo)}),background:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_opacity:new h.Uniform1f(o,t.u_opacity),u_color:new h.UniformColor(o,t.u_color)}),backgroundPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_opacity:new h.Uniform1f(o,t.u_opacity),u_image:new h.Uniform1i(o,t.u_image),u_pattern_tl_a:new h.Uniform2f(o,t.u_pattern_tl_a),u_pattern_br_a:new h.Uniform2f(o,t.u_pattern_br_a),u_pattern_tl_b:new h.Uniform2f(o,t.u_pattern_tl_b),u_pattern_br_b:new h.Uniform2f(o,t.u_pattern_br_b),u_texsize:new h.Uniform2f(o,t.u_texsize),u_mix:new h.Uniform1f(o,t.u_mix),u_pattern_size_a:new h.Uniform2f(o,t.u_pattern_size_a),u_pattern_size_b:new h.Uniform2f(o,t.u_pattern_size_b),u_scale_a:new h.Uniform1f(o,t.u_scale_a),u_scale_b:new h.Uniform1f(o,t.u_scale_b),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_tile_units_to_pixels:new h.Uniform1f(o,t.u_tile_units_to_pixels)}),terrain:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texture:new h.Uniform1i(o,t.u_texture),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)}),terrainDepth:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)}),terrainCoords:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texture:new h.Uniform1i(o,t.u_texture),u_terrain_coords_id:new h.Uniform1f(o,t.u_terrain_coords_id),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)})};class Es{constructor(t,n,a){this.context=t;const c=t.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ss={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ea{constructor(t,n,a,c){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=c,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete n.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 n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let a=0;a0){const Ce=h.create(),Ue=me;h.mul(Ce,pe.placementInvProjMatrix,o.transform.glCoordMatrix),h.mul(Ce,Ce,pe.placementViewportMatrix),T.push({circleArray:fe,circleOffset:z,transform:Ue,invTransform:Ce,coord:te}),w+=fe.length/4,z=w}xe&&x.draw(y,_.LINES,rt.disabled,Tt.disabled,o.colorModeForRenderPass(),bt.disabled,va(me,o.transform,ae),o.style.map.terrain&&o.style.map.terrain.getTerrainData(te),n.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,null,o.transform.zoom,null,null,xe.collisionVertexBuffer)}if(!m||!T.length)return;const O=o.useProgram("collisionCircle"),L=new h.CollisionCircleLayoutArray;L.resize(4*w),L._trim();let R=0;for(const N of T)for(let te=0;te=0&&(L[$.associatedIconIndex]={shiftedAnchor:We,angle:Ee})}else D($.numGlyphs,z)}if(x){O.clear();const R=o.icon.placedSymbolArray;for(let $=0;$o.style.map.terrain.getElevation(xe,Qs,Ar):null,Bi=n.layout.get("text-rotation-alignment")==="map";wr(Ce,xe.posMatrix,o,c,er,vi,$,x,Bi,Yt)}const ui=o.translatePosMatrix(xe.posMatrix,fe,p,m),ti=H||c&&pe||ls?La:er,ut=o.translatePosMatrix(vi,fe,p,m,!0),Kt=Ee&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ii;ii=Ee?Ce.iconsInText?Ts(qe.kind,Ot,re,$,o,ui,ti,ut,Ke,ei):Sn(qe.kind,Ot,re,$,o,ui,ti,ut,c,Ke,!0):En(qe.kind,Ot,re,$,o,ui,ti,ut,c,Ke);const pt={program:ct,buffers:Ue,uniformValues:ii,atlasTexture:Lt,atlasTextureIcon:Li,atlasInterpolation:xi,atlasInterpolationIcon:Ut,isSDF:Ee,hasHalo:Kt};if(N&&Ce.canOverlap){te=!0;const Yt=Ue.segments.get();for(const Bi of Yt)me.push({segments:new h.SegmentVector([Bi]),sortKey:Bi.sortKey,state:pt,terrainData:ht})}else me.push({segments:Ue.segments,sortKey:0,state:pt,terrainData:ht})}te&&me.sort((xe,fe)=>xe.sortKey-fe.sortKey);for(const xe of me){const fe=xe.state;if(z.activeTexture.set(O.TEXTURE0),fe.atlasTexture.bind(fe.atlasInterpolation,O.CLAMP_TO_EDGE),fe.atlasTextureIcon&&(z.activeTexture.set(O.TEXTURE1),fe.atlasTextureIcon&&fe.atlasTextureIcon.bind(fe.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),fe.isSDF){const Ce=fe.uniformValues;fe.hasHalo&&(Ce.u_is_halo=1,Ba(fe.buffers,xe.segments,n,o,fe.program,ae,T,w,Ce,xe.terrainData)),Ce.u_is_halo=0}Ba(fe.buffers,xe.segments,n,o,fe.program,ae,T,w,fe.uniformValues,xe.terrainData)}}function Ba(o,t,n,a,c,p,m,y,_,x){const T=a.context;c.draw(T,T.gl.TRIANGLES,p,m,y,bt.disabled,_,x,n.id,o.layoutVertexBuffer,o.indexBuffer,t,n.paint,a.transform.zoom,o.programConfigurations.get(n.id),o.dynamicLayoutVertexBuffer,o.opacityVertexBuffer)}function Ra(o,t,n,a,c){if(!n||!a||!a.imageAtlas)return;const p=a.imageAtlas.patternPositions;let m=p[n.to.toString()],y=p[n.from.toString()];if(!m||!y){const _=c.getPaintProperty(t);m=p[_],y=p[_]}m&&y&&o.setConstantPatternPositions(m,y)}function Kn(o,t,n,a,c,p,m){const y=o.context.gl,_="fill-pattern",x=n.paint.get(_),T=x&&x.constantOr(1),w=n.getCrossfadeParameters();let z,O,L,R,$;m?(O=T&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",z=y.LINES):(O=T?"fillPattern":"fill",z=y.TRIANGLES);const H=x.constantOr(null);for(const re of a){const N=t.getTile(re);if(T&&!N.patternsLoaded())continue;const te=N.getBucket(n);if(!te)continue;const ae=te.programConfigurations.get(n.id),pe=o.useProgram(O,ae),me=o.style.map.terrain&&o.style.map.terrain.getTerrainData(re);T&&(o.context.activeTexture.set(y.TEXTURE0),N.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),ae.updatePaintBuffers(w)),Ra(ae,_,H,N,n);const xe=me?re:null,fe=o.translatePosMatrix(xe?xe.posMatrix:re.posMatrix,N,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){R=te.indexBuffer2,$=te.segments2;const Ce=[y.drawingBufferWidth,y.drawingBufferHeight];L=O==="fillOutlinePattern"&&T?Mo(fe,o,w,N,Ce):Ul(fe,Ce)}else R=te.indexBuffer,$=te.segments,L=T?xa(fe,o,w,N):Po(fe);pe.draw(o.context,z,c,o.stencilModeForClipping(re),p,bt.disabled,L,me,n.id,te.layoutVertexBuffer,R,$,n.paint,o.transform.zoom,ae)}}function Yn(o,t,n,a,c,p,m){const y=o.context,_=y.gl,x="fill-extrusion-pattern",T=n.paint.get(x),w=T.constantOr(1),z=n.getCrossfadeParameters(),O=n.paint.get("fill-extrusion-opacity"),L=T.constantOr(null);for(const R of a){const $=t.getTile(R),H=$.getBucket(n);if(!H)continue;const re=o.style.map.terrain&&o.style.map.terrain.getTerrainData(R),N=H.programConfigurations.get(n.id),te=o.useProgram(w?"fillExtrusionPattern":"fillExtrusion",N);w&&(o.context.activeTexture.set(_.TEXTURE0),$.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),N.updatePaintBuffers(z)),Ra(N,x,L,$,n);const ae=o.translatePosMatrix(R.posMatrix,$,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),pe=n.paint.get("fill-extrusion-vertical-gradient"),me=w?ya(ae,o,pe,O,R,z,$):Ao(ae,o,pe,O);te.draw(y,y.gl.TRIANGLES,c,p,m,bt.backCCW,me,re,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,o.transform.zoom,N,o.style.map.terrain&&H.centroidVertexBuffer)}}function Yl(o,t,n,a,c,p,m){const y=o.context,_=y.gl,x=n.fbo;if(!x)return;const T=o.useProgram("hillshade"),w=o.style.map.terrain&&o.style.map.terrain.getTerrainData(t);y.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,x.colorAttachment.get()),T.draw(y,_.TRIANGLES,c,p,m,bt.disabled,((z,O,L,R)=>{const $=L.paint.get("hillshade-shadow-color"),H=L.paint.get("hillshade-highlight-color"),re=L.paint.get("hillshade-accent-color");let N=L.paint.get("hillshade-illumination-direction")*(Math.PI/180);L.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=z.transform.angle);const te=!z.options.moving;return{u_matrix:R?R.posMatrix:z.transform.calculatePosMatrix(O.tileID.toUnwrapped(),te),u_image:0,u_latrange:zo(0,O.tileID),u_light:[L.paint.get("hillshade-exaggeration"),N],u_shadow:$,u_highlight:H,u_accent:re}})(o,n,a,w?t:null),w,a.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}function $o(o,t,n,a,c,p){const m=o.context,y=m.gl,_=t.dem;if(_&&_.data){const x=_.dim,T=_.stride,w=_.getPixels();if(m.activeTexture.set(y.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||o.getTileTexture(T),t.demTexture){const O=t.demTexture;O.update(w,{premultiply:!1}),O.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new gt(m,w,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);m.activeTexture.set(y.TEXTURE0);let z=t.fbo;if(!z){const O=new gt(m,{width:x,height:x,data:null},y.RGBA);O.bind(y.LINEAR,y.CLAMP_TO_EDGE),z=t.fbo=m.createFramebuffer(x,x,!0,!1),z.colorAttachment.set(O.texture)}m.bindFramebuffer.set(z.framebuffer),m.viewport.set([0,0,x,x]),o.useProgram("hillshadePrepare").draw(m,y.TRIANGLES,a,c,p,bt.disabled,((O,L)=>{const R=L.stride,$=h.create();return h.ortho($,0,h.EXTENT,-h.EXTENT,0,0,1),h.translate($,$,[0,-h.EXTENT,0]),{u_matrix:$,u_image:1,u_dimension:[R,R],u_zoom:O.overscaledZ,u_unpack:L.getUnpackVector()}})(t.tileID,_),null,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Ft(o,t,n,a,c,p){const m=a.paint.get("raster-fade-duration");if(!p&&m>0){const y=h.exported.now(),_=(y-o.timeAdded)/m,x=t?(y-t.timeAdded)/m:-1,T=n.getSource(),w=c.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),z=!t||Math.abs(t.tileID.overscaledZ-w)>Math.abs(o.tileID.overscaledZ-w),O=z&&o.refreshedUponExpiration?1:h.clamp(z?_:1-x,0,1);return o.refreshedUponExpiration&&_>=1&&(o.refreshedUponExpiration=!1),t?{opacity:1,mix:1-O}:{opacity:O,mix:0}}return{opacity:1,mix:0}}const tn=new h.Color(1,0,0,1),Xi=new h.Color(0,1,0,1),qo=new h.Color(0,0,1,1),Fa=new h.Color(1,0,1,1),jo=new h.Color(0,1,1,1);function rn(o,t,n,a){zn(o,0,t+n/2,o.transform.width,n,a)}function Jn(o,t,n,a){zn(o,t-n/2,0,n,o.transform.height,a)}function zn(o,t,n,a,c,p){const m=o.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*o.pixelRatio,n*o.pixelRatio,a*o.pixelRatio,c*o.pixelRatio),m.clear({color:p}),y.disable(y.SCISSOR_TEST)}function Zo(o,t,n){const a=o.context,c=a.gl,p=n.posMatrix,m=o.useProgram("debug"),y=rt.disabled,_=Tt.disabled,x=o.colorModeForRenderPass(),T="$debug",w=o.style.map.terrain&&o.style.map.terrain.getTerrainData(n);a.activeTexture.set(c.TEXTURE0);const z=t.getTileByID(n.key).latestRawTileData,O=Math.floor((z&&z.byteLength||0)/1024),L=t.getTile(n).tileSize,R=512/Math.min(L,512)*(n.overscaledZ/o.transform.zoom)*.5;let $=n.canonical.toString();n.overscaledZ!==n.canonical.z&&($+=` => ${n.overscaledZ}`),function(H,re){H.initDebugOverlayCanvas();const N=H.debugOverlayCanvas,te=H.context.gl,ae=H.debugOverlayCanvas.getContext("2d");ae.clearRect(0,0,N.width,N.height),ae.shadowColor="white",ae.shadowBlur=2,ae.lineWidth=1.5,ae.strokeStyle="white",ae.textBaseline="top",ae.font="bold 36px Open Sans, sans-serif",ae.fillText(re,5,5),ae.strokeText(re,5,5),H.debugOverlayTexture.update(N),H.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(o,`${$} ${O}kB`),m.draw(a,c.TRIANGLES,y,_,Ct.alphaBlended,bt.disabled,ba(p,h.Color.transparent,R),null,T,o.debugBuffer,o.quadTriangleIndexBuffer,o.debugSegments),m.draw(a,c.LINE_STRIP,y,_,x,bt.disabled,ba(p,h.Color.red),w,T,o.debugBuffer,o.tileBorderIndexBuffer,o.debugSegments)}function Oa(o,t,n){const a=o.context,c=a.gl,p=o.colorModeForRenderPass(),m=new rt(c.LEQUAL,rt.ReadWrite,o.depthRangeFor3D),y=o.useProgram("terrain"),_=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,o.width,o.height]);for(const x of n){const T=o.renderToTexture.getTexture(x),w=t.getTerrainData(x.tileID);a.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,T.texture);const z={u_matrix:o.transform.calculatePosMatrix(x.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(o.transform.zoom)};y.draw(a,c.TRIANGLES,m,Tt.disabled,p,bt.backCCW,z,w,"terrain",_.vertexBuffer,_.indexBuffer,_.segments)}}const Ua={symbol:function(o,t,n,a,c){if(o.renderPass!=="translucent")return;const p=Tt.disabled,m=o.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(y,_,x,T,w,z,O){const L=_.transform,R=w==="map",$=z==="map";for(const H of y){const re=T.getTile(H),N=re.getBucket(x);if(!N||!N.text||!N.text.segments.get().length)continue;const te=h.evaluateSizeForZoom(N.textSizeData,L.zoom),ae=W(re,1,_.transform.zoom),pe=He(H.posMatrix,$,R,_.transform,ae),me=x.layout.get("icon-text-fit")!=="none"&&N.hasIconData();if(te){const xe=Math.pow(2,L.zoom-re.tileID.overscaledZ);No(N,R,$,O,L,pe,H.posMatrix,xe,te,me,_.style.map.terrain?(fe,Ce)=>_.style.map.terrain.getElevation(H,fe,Ce):null)}}}(a,o,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),c),n.paint.get("icon-opacity").constantOr(1)!==0&&ks(o,t,n,a,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),p,m),n.paint.get("text-opacity").constantOr(1)!==0&&ks(o,t,n,a,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),p,m),t.map.showCollisionBoxes&&(Vo(o,t,n,a,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Vo(o,t,n,a,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(o,t,n,a){if(o.renderPass!=="translucent")return;const c=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),y=!n.layout.get("circle-sort-key").isConstant();if(c.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const _=o.context,x=_.gl,T=o.depthModeForSublayer(0,rt.ReadOnly),w=Tt.disabled,z=o.colorModeForRenderPass(),O=[];for(let L=0;LL.sortKey-R.sortKey);for(const L of O){const{programConfiguration:R,program:$,layoutVertexBuffer:H,indexBuffer:re,uniformValues:N,terrainData:te}=L.state;$.draw(_,x.TRIANGLES,T,w,z,bt.disabled,N,te,n.id,H,re,L.segments,n.paint,o.transform.zoom,R)}},heatmap:function(o,t,n,a){if(n.paint.get("heatmap-opacity")!==0)if(o.renderPass==="offscreen"){const c=o.context,p=c.gl,m=Tt.disabled,y=new Ct([p.ONE,p.ONE],h.Color.transparent,[!0,!0,!0,!0]);(function(_,x,T){const w=_.gl;_.activeTexture.set(w.TEXTURE1),_.viewport.set([0,0,x.width/4,x.height/4]);let z=T.heatmapFbo;if(z)w.bindTexture(w.TEXTURE_2D,z.colorAttachment.get()),_.bindFramebuffer.set(z.framebuffer);else{const O=w.createTexture();w.bindTexture(w.TEXTURE_2D,O),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,w.CLAMP_TO_EDGE),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,w.CLAMP_TO_EDGE),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.LINEAR),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_MAG_FILTER,w.LINEAR),z=T.heatmapFbo=_.createFramebuffer(x.width/4,x.height/4,!1,!1),function(L,R,$,H){var re,N;const te=L.gl,ae=(re=L.HALF_FLOAT)!==null&&re!==void 0?re:te.UNSIGNED_BYTE,pe=(N=L.RGBA16F)!==null&&N!==void 0?N:te.RGBA;te.texImage2D(te.TEXTURE_2D,0,pe,R.width/4,R.height/4,0,te.RGBA,ae,null),H.colorAttachment.set($)}(_,x,O,z)}})(c,o,n),c.clear({color:h.Color.transparent});for(let _=0;_{const L=h.create();h.ortho(L,0,T.width,T.height,0,0,1);const R=T.context.gl;return{u_matrix:L,u_world:[R.drawingBufferWidth,R.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:w.paint.get("heatmap-opacity")}})(c,p),null,p.id,c.viewportBuffer,c.quadTriangleIndexBuffer,c.viewportSegments,p.paint,c.transform.zoom)}(o,n))},line:function(o,t,n,a){if(o.renderPass!=="translucent")return;const c=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(c.constantOr(1)===0||p.constantOr(1)===0)return;const m=o.depthModeForSublayer(0,rt.ReadOnly),y=o.colorModeForRenderPass(),_=n.paint.get("line-dasharray"),x=n.paint.get("line-pattern"),T=x.constantOr(1),w=n.paint.get("line-gradient"),z=n.getCrossfadeParameters(),O=T?"linePattern":_?"lineSDF":w?"lineGradient":"line",L=o.context,R=L.gl;let $=!0;for(const H of a){const re=t.getTile(H);if(T&&!re.patternsLoaded())continue;const N=re.getBucket(n);if(!N)continue;const te=N.programConfigurations.get(n.id),ae=o.context.program.get(),pe=o.useProgram(O,te),me=$||pe.program!==ae,xe=o.style.map.terrain&&o.style.map.terrain.getTerrainData(H),fe=x.constantOr(null);if(fe&&re.imageAtlas){const We=re.imageAtlas,Ee=We.patternPositions[fe.to.toString()],qe=We.patternPositions[fe.from.toString()];Ee&&qe&&te.setConstantPatternPositions(Ee,qe)}const Ce=xe?H:null,Ue=T?Gi(o,re,n,z,Ce):_?vs(o,re,n,_,z,Ce):w?xs(o,re,n,N.lineClipsArray.length,Ce):Er(o,re,n,Ce);if(T)L.activeTexture.set(R.TEXTURE0),re.imageAtlasTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),te.updatePaintBuffers(z);else if(_&&(me||o.lineAtlas.dirty))L.activeTexture.set(R.TEXTURE0),o.lineAtlas.bind(L);else if(w){const We=N.gradients[n.id];let Ee=We.texture;if(n.gradientVersion!==We.version){let qe=256;if(n.stepInterpolant){const ze=t.getSource().maxzoom,ct=H.canonical.z===ze?Math.ceil(1<256&&this.clearStencil(),a.setColorMode(Ct.disabled),a.setDepthMode(rt.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const y=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,_=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);p.draw(a,c.TRIANGLES,rt.disabled,new Tt({func:c.ALWAYS,mask:0},y,255,c.KEEP,c.KEEP,c.REPLACE),Ct.disabled,bt.disabled,wa(m.posMatrix),_,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Tt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Tt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,a=t.sort((m,y)=>y.overscaledZ-m.overscaledZ),c=a[a.length-1].overscaledZ,p=a[0].overscaledZ-c+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let y=0;y=0;this.currentLayer--){const _=this.style._layers[a[this.currentLayer]],x=c[_.source],T=p[_.source];this._renderTileClippingMasks(_,T),this.renderLayer(this,x,_,T)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer$.source&&!$.isHidden(T)?[x.sourceCaches[$.source]]:[]),O=z.filter($=>$.getSource().type==="vector"),L=z.filter($=>$.getSource().type!=="vector"),R=$=>{(!w||w.getSource().maxzoom<$.getSource().maxzoom)&&(w=$)};return O.forEach($=>R($)),w||L.forEach($=>R($)),w}(this.style,this.transform.zoom);_&&Ua.debug(this,_,_.getVisibleCoordinates())}this.options.showPadding&&function(_){const x=_.transform.padding;rn(_,_.transform.height-(x.top||0),3,tn),rn(_,x.bottom||0,3,Xi),Jn(_,x.left||0,3,qo),Jn(_,_.transform.width-(x.right||0),3,Fa);const T=_.transform.centerPoint;(function(w,z,O,L){zn(w,z-1,O-10,2,20,L),zn(w,z-10,O-1,20,2,L)})(_,T.x,_.transform.height-T.y,jo)}(this),this.context.setDefault()}renderLayer(t,n,a,c){a.isHidden(this.transform.zoom)||(a.type==="background"||a.type==="custom"||(c||[]).length)&&(this.id=a.id,Ua[a.type](t,n,a,c,this.style.placement.variableOffsets))}translatePosMatrix(t,n,a,c,p){if(!a[0]&&!a[1])return t;const m=p?c==="map"?this.transform.angle:0:c==="viewport"?-this.transform.angle:0;if(m){const x=Math.sin(m),T=Math.cos(m);a=[a[0]*T-a[1]*x,a[0]*x+a[1]*T]}const y=[p?a[0]:W(n,a[0],this.transform.zoom),p?a[1]:W(n,a[1],this.transform.zoom),0],_=new Float32Array(16);return h.translate(_,t,y),_}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n){this.cache=this.cache||{};const a=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new ys(this.context,t,Ur[t],n,Ta[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}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(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new gt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Ds{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,a){const c=Math.pow(2,a),p=[[-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(y=>{const _=1/(y=h.transformMat4([],y,t))[3]/n*c;return h.mul$1(y,y,[_,_,1/y[3],_])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const _=function(z,O){var L=O[0],R=O[1],$=O[2],H=L*L+R*R+$*$;return H>0&&(H=1/Math.sqrt(H)),z[0]=O[0]*H,z[1]=O[1]*H,z[2]=O[2]*H,z}([],function(z,O,L){var R=O[0],$=O[1],H=O[2],re=L[0],N=L[1],te=L[2];return z[0]=$*te-H*N,z[1]=H*re-R*te,z[2]=R*N-$*re,z}([],fn([],p[y[0]],p[y[1]]),fn([],p[y[2]],p[y[1]]))),x=-((T=_)[0]*(w=p[y[1]])[0]+T[1]*w[1]+T[2]*w[2]);var T,w;return _.concat(x)});return new Ds(p,m)}}class lr{constructor(t,n){this.min=t,this.max=n,this.center=function(a,c,p){return a[0]=.5*c[0],a[1]=.5*c[1],a[2]=.5*c[2],a}([],function(a,c,p){return a[0]=c[0]+p[0],a[1]=c[1]+p[1],a[2]=c[2]+p[2],a}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],a=Wt(this.min),c=Wt(this.max);for(let p=0;p=0&&m++;if(m===0)return 0;m!==n.length&&(a=!1)}if(a)return 2;for(let c=0;c<3;c++){let p=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let y=0;ythis.max[c]-this.min[c])return 0}return 1}}class Ls{constructor(t=0,n=0,a=0,c=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=a,this.right=c}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=h.interpolate.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=h.interpolate.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=h.interpolate.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=h.interpolate.number(t.right,n.right,a)),this}getCenter(t,n){const a=h.clamp((this.left+t-this.right)/2,0,t),c=h.clamp((this.top+n-this.bottom)/2,0,n);return new h.Point(a,c)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Ls(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Bs{constructor(t,n,a,c,p){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=p===void 0||!!p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=a??0,this._maxPitch=c??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new h.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ls,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new Bs(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.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,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){t===void 0?t=!0:t===null&&(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 h.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-h.wrap(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var a=new h.ARRAY_TYPE(4);return h.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a}(),function(a,c,p){var m=c[0],y=c[1],_=c[2],x=c[3],T=Math.sin(p),w=Math.cos(p);a[0]=m*w+_*T,a[1]=y*w+x*T,a[2]=m*-T+_*w,a[3]=y*-T+x*w}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=h.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(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 n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),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,n,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new h.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new h.Point(0,0)),c=this.pointCoordinate(new h.Point(this.width,0)),p=this.pointCoordinate(new h.Point(this.width,this.height)),m=this.pointCoordinate(new h.Point(0,this.height)),y=Math.floor(Math.min(a.x,c.x,p.x,m.x)),_=Math.floor(Math.max(a.x,c.x,p.x,m.x)),x=1;for(let T=y-x;T<=_+x;T++)T!==0&&n.push(new h.UnwrappedTileID(T,t))}return n}coveringTiles(t){var n,a;let c=this.coveringZoomLevel(t);const p=c;if(t.minzoom!==void 0&&ct.maxzoom&&(c=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),y=h.MercatorCoordinate.fromLngLat(this.center),_=Math.pow(2,c),x=[_*m.x,_*m.y,0],T=[_*y.x,_*y.y,0],w=Ds.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,c);let z=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(z=c);const O=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,L=N=>({aabb:new lr([N*_,0,0],[(N+1)*_,_,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),R=[],$=[],H=c,re=t.reparseOverscaled?p:c;if(this._renderWorldCopies)for(let N=1;N<=3;N++)R.push(L(-N)),R.push(L(N));for(R.push(L(0));R.length>0;){const N=R.pop(),te=N.x,ae=N.y;let pe=N.fullyVisible;if(!pe){const Ue=N.aabb.intersects(w);if(Ue===0)continue;pe=Ue===2}const me=t.terrain?x:T,xe=N.aabb.distanceX(me),fe=N.aabb.distanceY(me),Ce=Math.max(Math.abs(xe),Math.abs(fe));if(N.zoom===H||Ce>O+(1<=z){const Ue=H-N.zoom,We=x[0]-.5-(te<>1),qe=N.zoom+1;let ze=N.aabb.quadrant(Ue);if(t.terrain){const ct=new h.OverscaledTileID(qe,N.wrap,qe,We,Ee),Ot=t.terrain.getMinMaxElevation(ct),ht=(n=Ot.minElevation)!==null&&n!==void 0?n:this.elevation,Ke=(a=Ot.maxElevation)!==null&&a!==void 0?a:this.elevation;ze=new lr([ze.min[0],ze.min[1],ht],[ze.max[0],ze.max[1],Ke])}R.push({aabb:ze,zoom:qe,x:We,y:Ee,wrap:N.wrap,fullyVisible:pe})}}return $.sort((N,te)=>N.distanceSq-te.distanceSq).map(N=>N.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],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 n=h.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new h.Point(h.mercatorXfromLng(t.lng)*this.worldSize,h.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new h.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const a=h.MercatorCoordinate.fromLngLat(t.wrap()),c=(1<m&&(c=m-L)}if(this.lngRange){const O=(y+_)/2,L=h.wrap(w.x,O-this.worldSize/2,O+this.worldSize/2),R=x.x/2;L-R_&&(a=_-R)}a===void 0&&c===void 0||(this.center=this.unproject(new h.Point(a!==void 0?a:w.x,c!==void 0?c:w.y)).wrap()),this._unmodified=T,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=h.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let c=h.identity(new Float64Array(16));h.scale(c,c,[this.width/2,-this.height/2,1]),h.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=h.identity(new Float64Array(16)),h.scale(c,c,[1,-1,1]),h.translate(c,c,[-1,-1,0]),h.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const p=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,m=Math.PI/2+this._pitch,y=this._fov*(.5+t.y/this.height),_=Math.sin(y)*p/Math.sin(h.clamp(Math.PI-m-y,.01,Math.PI-.01)),x=this.getHorizon(),T=2*Math.atan(x/this.cameraToCenterDistance)*(.5+t.y/(2*x)),w=Math.sin(T)*p/Math.sin(h.clamp(Math.PI-m-T,.01,Math.PI-.01)),z=Math.min(_,w),O=1.01*(Math.cos(Math.PI/2-this._pitch)*z+p),L=this.height/50;c=new Float64Array(16),h.perspective(c,this._fov,this.width/this.height,L,O),c[8]=2*-t.x/this.width,c[9]=2*t.y/this.height,h.scale(c,c,[1,-1,1]),h.translate(c,c,[0,0,-this.cameraToCenterDistance]),h.rotateX(c,c,this._pitch),h.rotateZ(c,c,this.angle),h.translate(c,c,[-n,-a,0]),this.mercatorMatrix=h.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),h.scale(c,c,[1,1,this._pixelPerMeter]),this.pixelMatrix=h.multiply(new Float64Array(16),this.labelPlaneMatrix,c),h.translate(c,c,[0,0,-this.elevation]),this.projMatrix=c,this.invProjMatrix=h.invert([],c),this.pixelMatrix3D=h.multiply(new Float64Array(16),this.labelPlaneMatrix,c);const R=this.width%2/2,$=this.height%2/2,H=Math.cos(this.angle),re=Math.sin(this.angle),N=n-Math.round(n)+H*R+re*$,te=a-Math.round(a)+H*$+re*R,ae=new Float64Array(c);if(h.translate(ae,ae,[N>.5?N-1:N,te>.5?te-1:te,0]),this.alignedProjMatrix=ae,c=h.invert(new Float64Array(16),this.pixelMatrix),!c)throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new h.Point(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return h.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.Point(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let a=n.x,c=n.y,p=n.x,m=n.y;for(const y of t)a=Math.min(a,y.x),c=Math.min(c,y.y),p=Math.max(p,y.x),m=Math.max(m,y.y);return[new h.Point(a,c),new h.Point(p,c),new h.Point(p,m),new h.Point(a,m),new h.Point(a,c)]}}}class Xo{constructor(t){this._hashName=t&&encodeURIComponent(t),h.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,a){let c=!1,p=null;const m=()=>{p=null,c&&(n(),p=setTimeout(m,300),c=!1)};return()=>(c=!0,p||m(),p)}(this._updateHashUnthrottled.bind(this))}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()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,c=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,c),m=Math.round(n.lng*p)/p,y=Math.round(n.lat*p)/p,_=this._map.getBearing(),x=this._map.getPitch();let T="";if(T+=t?`/${m}/${y}/${a}`:`${a}/${y}/${m}`,(_||x)&&(T+="/"+Math.round(10*_)/10),x&&(T+=`/${Math.round(x)}`),this._hashName){const w=this._hashName;let z=!1;const O=window.location.hash.slice(1).split("&").map(L=>{const R=L.split("=")[0];return R===w?(z=!0,`${R}=${T}`):L}).filter(L=>L);return z||O.push(`${w}=${T}`),`#${O.join("&")}`}return`#${T}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(n=a)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=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:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const Qn={linearity:.3,easing:h.bezier(0,0,.3,1)},Wo=h.extend({deceleration:2500,maxSpeed:1400},Qn),Ho=h.extend({deceleration:20,maxSpeed:1400},Qn),es=h.extend({deceleration:1e3,maxSpeed:360},Qn),Ko=h.extend({deceleration:1e3,maxSpeed:90},Qn);class cr{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:h.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=h.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new h.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const p=ts(n.pan.mag(),a,h.extend({},Wo,t||{}));c.offset=n.pan.mult(p.amount/n.pan.mag()),c.center=this._map.transform.center,Wi(c,p)}if(n.zoom){const p=ts(n.zoom,a,Ho);c.zoom=this._map.transform.zoom+p.amount,Wi(c,p)}if(n.bearing){const p=ts(n.bearing,a,es);c.bearing=this._map.transform.bearing+h.clamp(p.amount,-179,179),Wi(c,p)}if(n.pitch){const p=ts(n.pitch,a,Ko);c.pitch=this._map.transform.pitch+p.amount,Wi(c,p)}if(c.zoom||c.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;c.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),h.extend(c,{noMoveStart:!0})}}function Wi(o,t){(!o.duration||o.durationn.unproject(_)),y=p.reduce((_,x,T,w)=>_.add(x.div(w.length)),new h.Point(0,0));super(t,{points:p,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:a}),this._defaultPrevented=!1}}class Jl extends h.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class Ql{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Jl(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new jt(t.type,this._map,t))}mouseup(t){this._map.fire(new jt(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new jt(t.type,this._map,t))}dblclick(t){return this._firePreventable(new jt(t.type,this._map,t))}mouseover(t){this._map.fire(new jt(t.type,this._map,t))}mouseout(t){this._map.fire(new jt(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Nr(t.type,this._map,t))}touchmove(t){this._map.fire(new Nr(t.type,this._map,t))}touchend(t){this._map.fire(new Nr(t.type,this._map,t))}touchcancel(t){this._map.fire(new Nr(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ec{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new jt(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new jt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new jt(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class kn{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(h.Point.convert(t),this._map.terrain)}}class is{constructor(t,n){this._map=t,this._tr=new kn(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(Y.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)p.fitScreenCoordinates(a,c,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(Y.remove(this._box),this._box=null),Y.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new h.Event(t,{originalEvent:n}))}}function hr(o,t){if(o.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${o.length}, points ${t.length}`);const n={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(c){const p=new h.Point(0,0);for(const m of c)p._add(m);return p.div(c.length)}(n),this.touches=hr(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const c=hr(a,n);for(const p in this.touches){const m=c[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class Rs{constructor(t){this.singleTap=new De(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const c=this.singleTap.touchend(t,n,a);if(c){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(c)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}}}class rs{constructor(t){this._tr=new kn(t),this._zoomIn=new Rs({numTouches:1,numTaps:2}),this._zoomOut=new Rs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const c=this._zoomIn.touchend(t,n,a),p=this._zoomOut.touchend(t,n,a),m=this._tr;return c?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(c)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(p)},{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 Sr{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 n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const c=n.length?n[0]:n;return!this._moved&&c.dist(a){o.mousedown=o.dragStart,o.mousemoveWindow=o.dragMove,o.mouseup=o.dragEnd,o.contextmenu=function(t){t.preventDefault()}},Jo=({enable:o,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const a=new Ae({checkCorrectEvent:c=>Y.mouseButton(c)===0&&c.ctrlKey||Y.mouseButton(c)===2});return new Sr({clickTolerance:t,move:(c,p)=>({bearingDelta:(p.x-c.x)*n}),moveStateManager:a,enable:o,assignEvents:Va})},Os=({enable:o,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new Ae({checkCorrectEvent:c=>Y.mouseButton(c)===0&&c.ctrlKey||Y.mouseButton(c)===2});return new Sr({clickTolerance:t,move:(c,p)=>({pitchDelta:(p.y-c.y)*n}),moveStateManager:a,enable:o,assignEvents:Va})};class Qo{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new h.Point(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._map._cooperativeGestures&&(this._minTouches===2&&a.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,a.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(a.length0&&(this._active=!0);const c=hr(a,n),p=new h.Point(0,0),m=new h.Point(0,0);let y=0;for(const x in c){const T=c[x],w=this._touches[x];w&&(p._add(T),m._add(T.sub(w)),y++,c[x]=T)}if(this._touches=c,yMath.abs(o.x)}class Ii extends Us{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,ns(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const c=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(c,p,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(c.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const c=t.mag()>=2,p=n.mag()>=2;if(!c&&!p)return;if(!c||!p)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return ns(t)&&ns(n)&&m}}const $r={panStep:100,bearingStep:15,pitchStep:10};class tl{constructor(t){this._tr=new kn(t);const n=$r;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,a=0,c=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?c=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?c=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,c=0),{cameraAnimation:y=>{const _=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:qa,zoom:n?Math.round(_.zoom)+n*(t.shiftKey?2:1):_.zoom,bearing:_.bearing+a*this._bearingStep,pitch:_.pitch+c*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:_.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 qa(o){return o*(2-o)}const $s=4.000244140625;class ja{constructor(t,n){this._map=t,this._tr=new kn(t),this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,h.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=h.exported.now(),c=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%$s==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":c>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(c*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=Y.mousePos(this._el,t),a=this._tr;this._around=h.LngLat.convert(this._aroundCenter?a.center:a.unproject(n)),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const y=this._type==="wheel"&&Math.abs(this._delta)>$s?this._wheelZoomRate:this._defaultZoomRate;let _=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&_!==0&&(_=1/_);const x=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(x*_))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,a=this._startZoom,c=this._easing;let p,m=!1;if(this._type==="wheel"&&a&&c){const y=Math.min((h.exported.now()-this._lastWheelEventTime)/200,1),_=c(y);p=h.interpolate.number(a,n,_),y<1?this._frameId||(this._frameId=!0):m=!0}else p=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=h.ease;if(this._prevEase){const a=this._prevEase,c=(h.exported.now()-a.start)/a.duration,p=a.easing(c+.01)-a.easing(c),m=.27/Math.sqrt(p*p+1e-4)*.01,y=Math.sqrt(.0729-m*m);n=h.bezier(m,y,.25,1)}return this._prevEase={start:h.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class il{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 Hi{constructor(t){this._tr=new kn(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pt{constructor(){this._tap=new Rs({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,a){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=n[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(t,n,a))}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const c=n[0],p=c.y-this._swipePoint.y;return this._swipePoint=c,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){this._tapTime?this._swipePoint&&a.length===0&&this.reset():this._tap.touchend(t,n,a)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qs{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}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 Za{constructor(t,n,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=a}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 rl{constructor(t,n,a,c){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=c,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()}}const ss=o=>o.zoom||o.drag||o.pitch||o.rotate;class nl extends h.Event{}function Ga(o){return o.panDelta&&o.panDelta.mag()||o.zoomDelta||o.bearingDelta||o.pitchDelta}class ur{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new cr(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),h.bindAll(["handleEvent","handleWindowEvent"],this);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[c,p,m]of this._listeners)Y.addEventListener(c,p,c===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,a]of this._listeners)Y.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new Ql(n,t));const c=n.boxZoom=new is(n,t);this._add("boxZoom",c);const p=new rs(n),m=new Hi(n);n.doubleClickZoom=new il(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new Pt;this._add("tapDragZoom",y);const _=n.touchPitch=new Ii(n);this._add("touchPitch",_);const x=Jo(t),T=Os(t);n.dragRotate=new Za(t,x,T),this._add("mouseRotate",x,["mousePitch"]),this._add("mousePitch",T,["mouseRotate"]);const w=(({enable:H,clickTolerance:re})=>{const N=new Ae({checkCorrectEvent:te=>Y.mouseButton(te)===0&&!te.ctrlKey});return new Sr({clickTolerance:re,move:(te,ae)=>({around:ae,panDelta:ae.sub(te)}),activateOnStart:!0,moveStateManager:N,enable:H,assignEvents:Va})})(t),z=new Qo(t,n);n.dragPan=new qs(a,w,z),this._add("mousePan",w),this._add("touchPan",z,["touchZoom","touchRotate"]);const O=new $a,L=new Na;n.touchZoomRotate=new rl(a,L,O,y),this._add("touchRotate",O,["touchPan","touchZoom"]),this._add("touchZoom",L,["touchPan","touchRotate"]);const R=n.scrollZoom=new ja(n,this);this._add("scrollZoom",R,["mousePan"]);const $=n.keyboard=new tl(n);this._add("keyboard",$),this._add("blockableMapEvent",new ec(n));for(const H of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[H]&&n[H].enable(t[H])}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.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!!ss(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,a){for(const c in t)if(c!==a&&(!n||n.indexOf(c)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const a=t.type==="renderFrame"?void 0:t,c={needsRenderFrame:!1},p={},m={},y=t.touches,_=y?this._getMapTouches(y):void 0,x=_?Y.touchPos(this._el,_):Y.mousePos(this._el,t);for(const{handlerName:z,handler:O,allowed:L}of this._handlers){if(!O.isEnabled())continue;let R;this._blockedByActive(m,L,z)?O.reset():O[n||t.type]&&(R=O[n||t.type](t,x,_),this.mergeHandlerResult(c,p,R,z,a),R&&R.needsRenderFrame&&this._triggerRenderFrame()),(R||O.isActive())&&(m[z]=O)}const T={};for(const z in this._previousActiveHandlers)m[z]||(T[z]=a);this._previousActiveHandlers=m,(Object.keys(T).length||Ga(c))&&(this._changes.push([c,p,T]),this._triggerRenderFrame()),(Object.keys(m).length||Ga(c))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:w}=c;w&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],w(this._map))}mergeHandlerResult(t,n,a,c,p){if(!a)return;h.extend(t,a);const m={handlerName:c,originalEvent:a.originalEvent||p};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},a={};for(const[c,p,m]of this._changes)c.panDelta&&(t.panDelta=(t.panDelta||new h.Point(0,0))._add(c.panDelta)),c.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+c.pitchDelta),c.around!==void 0&&(t.around=c.around),c.pinchAround!==void 0&&(t.pinchAround=c.pinchAround),c.noInertia&&(t.noInertia=c.noInertia),h.extend(n,p),h.extend(a,m);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const c=this._map,p=c._getTransformForUpdate(),m=c.terrain;if(!(Ga(t)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:y,zoomDelta:_,bearingDelta:x,pitchDelta:T,around:w,pinchAround:z}=t;z!==void 0&&(w=z),c._stop(!0),w=w||c.transform.centerPoint;const O=p.pointLocation(y?w.sub(y):w);x&&(p.bearing+=x),T&&(p.pitch+=T),_&&(p.zoom+=_),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?p.center=p.pointLocation(p.centerPoint.sub(y)):p.setLocationAtPoint(O,w):(this._terrainMovement=!0,p.freezeElevation=!0,p.setLocationAtPoint(O,w),this._map.once("moveend",()=>{p.freezeElevation=!1,this._terrainMovement=!1,p.recalculateZoom(c.terrain)})):p.setLocationAtPoint(O,w),c._applyUpdatedTransform(p),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const c=ss(this._eventsInProgress),p=ss(t),m={};for(const T in t){const{originalEvent:w}=t[T];this._eventsInProgress[T]||(m[`${T}start`]=w),this._eventsInProgress[T]=t[T]}!c&&p&&this._fireEvent("movestart",p.originalEvent);for(const T in m)this._fireEvent(T,m[T]);p&&this._fireEvent("move",p.originalEvent);for(const T in t){const{originalEvent:w}=t[T];this._fireEvent(T,w)}const y={};let _;for(const T in this._eventsInProgress){const{handlerName:w,originalEvent:z}=this._eventsInProgress[T];this._handlersById[w].isActive()||(delete this._eventsInProgress[T],_=n[w]||z,y[`${T}end`]=_)}for(const T in y)this._fireEvent(T,y[T]);const x=ss(this._eventsInProgress);if(a&&(c||p)&&!x){this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),w=z=>z!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new nl("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const js={extend:(o,...t)=>h.extend(o,...t),run(o){o()},logToElement(o,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+=`
    ${o}`)}};class Fe extends h.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,h.bindAll(["_renderFrameCallback"],this),this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new h.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,a){return t=h.Point.convert(t).mult(-1),this.panTo(this.transform.center,h.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(h.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(h.extend({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,a){return this.easeTo(h.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,h.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(h.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing()){if(this._zooming&&(a.zoom=h.interpolate.number(c,_,pe)),this._rotating&&(a.bearing=h.interpolate.number(p,x,pe)),this._pitching&&(a.pitch=h.interpolate.number(m,T,pe)),this._padding&&(a.interpolatePadding(y,w,pe),O=a.centerPoint.add(z)),this.terrain&&!t.freezeElevation&&this._updateElevation(pe),N)a.setLocationAtPoint(N,te);else{const me=a.zoomScale(a.zoom-c),xe=_>c?Math.min(2,re):Math.max(.5,re),fe=Math.pow(xe,1-pe),Ce=a.unproject($.add(H.mult(pe*fe)).mult(me));a.setLocationAtPoint(a.renderWorldCopies?Ce.wrap():Ce,O)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},pe=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,pe)},t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new h.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new h.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new h.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new h.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(t,this.terrain),this.transform.freezeElevation=!0}_updateElevation(t){const n=this.transform.getElevation(this._elevationCenter,this.terrain);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=h.interpolate.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const n=t.clone(),{center:a,zoom:c,pitch:p,bearing:m,elevation:y}=this.transformCameraUpdate(n);a&&(n.center=a),c!==void 0&&(n.zoom=c),p!==void 0&&(n.pitch=p),m!==void 0&&(n.bearing=m),y!==void 0&&(n.elevation=y),this.transform.apply(n)}_fireMoveEvents(t){this.fire(new h.Event("move",t)),this._zooming&&this.fire(new h.Event("zoom",t)),this._rotating&&this.fire(new h.Event("rotate",t)),this._pitching&&this.fire(new h.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,c=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new h.Event("zoomend",t)),c&&this.fire(new h.Event("rotateend",t)),p&&this.fire(new h.Event("pitchend",t)),this.fire(new h.Event("moveend",t))}flyTo(t,n){if(!t.essential&&h.exported.prefersReducedMotion){const ze=h.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ze,n)}this.stop(),t=h.extend({offset:[0,0],speed:1.2,curve:1.42,easing:h.ease},t);const a=this._getTransformForUpdate(),c=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),_="zoom"in t?h.clamp(+t.zoom,a.minZoom,a.maxZoom):c,x="bearing"in t?this._normalizeBearing(t.bearing,p):p,T="pitch"in t?+t.pitch:m,w="padding"in t?t.padding:a.padding,z=a.zoomScale(_-c),O=h.Point.convert(t.offset);let L=a.centerPoint.add(O);const R=a.pointLocation(L),$=h.LngLat.convert(t.center||R);this._normalizeCenter($);const H=a.project(R),re=a.project($).sub(H);let N=t.curve;const te=Math.max(a.width,a.height),ae=te/z,pe=re.mag();if("minZoom"in t){const ze=h.clamp(Math.min(t.minZoom,c,_),a.minZoom,a.maxZoom),ct=te/a.zoomScale(ze-c);N=Math.sqrt(ct/pe*2)}const me=N*N;function xe(ze){const ct=(ae*ae-te*te+(ze?-1:1)*me*me*pe*pe)/(2*(ze?ae:te)*me*pe);return Math.log(Math.sqrt(ct*ct+1)-ct)}function fe(ze){return(Math.exp(ze)-Math.exp(-ze))/2}function Ce(ze){return(Math.exp(ze)+Math.exp(-ze))/2}const Ue=xe(0);let We=function(ze){return Ce(Ue)/Ce(Ue+N*ze)},Ee=function(ze){return te*((Ce(Ue)*(fe(ct=Ue+N*ze)/Ce(ct))-fe(Ue))/me)/pe;var ct},qe=(xe(1)-Ue)/N;if(Math.abs(pe)<1e-6||!isFinite(qe)){if(Math.abs(te-ae)<1e-6)return this.easeTo(t,n);const ze=aet.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==x,this._pitching=T!==m,this._padding=!a.isPaddingEqual(w),this._prepareEase(n,!1),this.terrain&&this._prepareElevation($),this._ease(ze=>{const ct=ze*qe,Ot=1/We(ct);a.zoom=ze===1?_:c+a.scaleZoom(Ot),this._rotating&&(a.bearing=h.interpolate.number(p,x,ze)),this._pitching&&(a.pitch=h.interpolate.number(m,T,ze)),this._padding&&(a.interpolatePadding(y,w,ze),L=a.centerPoint.add(O)),this.terrain&&!t.freezeElevation&&this._updateElevation(ze);const ht=ze===1?$:a.unproject(H.add(re.mult(Ee(ct))).mult(Ot));a.setLocationAtPoint(a.renderWorldCopies?ht.wrap():ht,L),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=h.exported.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((h.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=h.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)180?-360:a<-180?360:0}queryTerrainElevation(t){return this.terrain?this.transform.getElevation(h.LngLat.convert(t),this.terrain)-this.transform.elevation:null}}class $e{constructor(t={}){this.options=t,h.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=Y.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=Y.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Y.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(){Y.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,n){const a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_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")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(c=>typeof c!="string"?"":c)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const c=this._map.style.stylesheet;this.styleOwner=c.owner,this.styleId=c.id}const n=this._map.style.sourceCaches;for(const c in n){const p=n[c];if(p.used||p.usedForTerrain){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(c=>String(c).trim()),t.sort((c,p)=>c.length-p.length),t=t.filter((c,p)=>{for(let m=p+1;m=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?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"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")}}class as{constructor(t={}){this.options=t,h.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=Y.create("div","maplibregl-ctrl");const n=Y.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){Y.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact"):n.classList.remove("maplibregl-compact")}}}class Xa{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(const c of a)if(c.id===t)return void(c.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Wa={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var Ai=h.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class sl extends h.Evented{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,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const a={};for(const c of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.posMatrix=new Float64Array(16),h.ortho(c.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),this._tiles[c.key]=new Kr(c,this.tileSize));for(const c in this._tiles)a[c]||delete this._tiles[c]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const c=this._tiles[a].tileID;if(c.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),h.ortho(p.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),n[a]=p}else if(c.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=c.canonical.z-t.canonical.z,y=c.canonical.x-(c.canonical.x>>m<>m<>m;h.ortho(p.posMatrix,0,x,0,x,0,1),h.translate(p.posMatrix,p.posMatrix,[-y*x,-_*x,0]),n[a]=p}else if(t.canonical.isChildOf(c.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=t.canonical.z-c.canonical.z,y=t.canonical.x-(t.canonical.x>>m<>m<>m;h.ortho(p.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),h.translate(p.posMatrix,p.posMatrix,[y*x,_*x,0]),h.scale(p.posMatrix,p.posMatrix,[1/2**m,1/2**m,0]),n[a]=p}}return n}getSourceTile(t,n){const a=this.sourceCache._source;let c=t.overscaledZ-this.deltaZoom;if(c>a.maxzoom&&(c=a.maxzoom),c=a.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(c--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class dr{constructor(t,n,a){this.painter=t,this.sourceCache=new sl(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,a,c=h.EXTENT){if(!(n>=0&&n=0&&at.canonical.z&&(t.canonical.z>=c?p=t.canonical.z-c:h.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>p<>p<>8<<4|p>>8,n[m+3]=0;const a=new h.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new gt(t,a,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){const n=new Uint8Array(4),a=this.painter.context,c=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const p=n[0]+(n[2]>>4<<8),m=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],_=y&&this.sourceCache.getTileByID(y);if(!_)return null;const x=this._coordsTextureSize,T=(1<<_.tileID.canonical.z)*x;return new h.MercatorCoordinate((_.tileID.canonical.x*x+p)/T,(_.tileID.canonical.y*x+m)/T,this.getElevation(_.tileID,p,m,x))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new h.Pos3dArray,a=new h.TriangleIndexArray,c=this.meshSize,p=h.EXTENT/c,m=c*c;for(let w=0;w<=c;w++)for(let z=0;z<=c;z++)n.emplaceBack(z*p,w*p,0);for(let w=0;wt.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];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)===!1}}const Ir={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Dt{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new tc(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(n)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const c=t.sourceCaches[a].getVisibleCoordinates();for(const p of c){const m=this.terrain.sourceCache.getTerrainCoords(p);for(const y in m)this._coordsDescendingInv[a][y]||(this._coordsDescendingInv[a][y]=[]),this._coordsDescendingInv[a][y].push(m[y])}}this._coordsDescendingInvStr={};for(const a of t._order){const c=t._layers[a],p=c.source;if(Ir[c.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const m in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][m]=this._coordsDescendingInv[p][m].map(y=>y.key).sort().join()}}for(const a of this._renderableTiles)for(const c in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[c][a.tileID.key];p&&p!==a.rttCoords[c]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,a=this.painter,c=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Ir[n]&&(this._prevType&&Ir[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!c))return!0;if(Ir[this._prevType]||Ir[n]&&c){this._prevType=n;const p=this._stacks.length-1,m=this._stacks[p]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(Oa(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[p]){const x=this.pool.getObjectForId(y.rtt[p].id);if(x.stamp===y.rtt[p].stamp){this.pool.useObject(x);continue}}const _=this.pool.getOrCreateFreeObject();this.pool.useObject(_),this.pool.stampObject(_),y.rtt[p]={id:_.id,stamp:_.stamp},a.context.bindFramebuffer.set(_.fbo.framebuffer),a.context.clear({color:h.Color.transparent,stencil:0}),a.currentStencilSource=void 0;for(let x=0;x{o.touchstart=o.dragStart,o.touchmoveWindow=o.dragMove,o.touchend=o.dragEnd},Zs={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ha{constructor(t,n,a=!1){this._clickTolerance=10;const c=t.dragRotate._mouseRotate.getClickTolerance(),p=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Jo({clickTolerance:c,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:y,bearingDegreesPerPixelMoved:_=.8})=>{const x=new Fs;return new Sr({clickTolerance:y,move:(T,w)=>({bearingDelta:(w.x-T.x)*_}),moveStateManager:x,enable:m,assignEvents:Dn})})({clickTolerance:c,enable:!0}),this.map=t,a&&(this.mousePitch=Os({clickTolerance:p,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:y,pitchDegreesPerPixelMoved:_=-.5})=>{const x=new Fs;return new Sr({clickTolerance:y,move:(T,w)=>({pitchDelta:(w.y-T.y)*_}),moveStateManager:x,enable:m,assignEvents:Dn})})({clickTolerance:p,enable:!0})),h.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),Y.addEventListener(n,"mousedown",this.mousedown),Y.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),Y.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),Y.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),Y.disableDrag()}moveMouse(t,n){const a=this.map,{bearingDelta:c}=this.mouseRotate.dragMove(t,n)||{};if(c&&a.setBearing(a.getBearing()+c),this.mousePitch){const{pitchDelta:p}=this.mousePitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}moveTouch(t,n){const a=this.map,{bearingDelta:c}=this.touchRotate.dragMove(t,n)||{};if(c&&a.setBearing(a.getBearing()+c),this.touchPitch){const{pitchDelta:p}=this.touchPitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}off(){const t=this.element;Y.removeEventListener(t,"mousedown",this.mousedown),Y.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),Y.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),Y.removeEventListener(window,"touchend",this.touchend),Y.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){Y.enableDrag(),Y.removeEventListener(window,"mousemove",this.mousemove),Y.removeEventListener(window,"mouseup",this.mouseup),Y.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),Y.removeEventListener(window,"touchend",this.touchend)}mousedown(t){this.startMouse(h.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),Y.mousePos(this.element,t)),Y.addEventListener(window,"mousemove",this.mousemove),Y.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.moveMouse(t,Y.mousePos(this.element,t))}mouseup(t){this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Y.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),Y.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),Y.addEventListener(window,"touchend",this.touchend))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=Y.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)180;){const a=n.locationPoint(o);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;o.lng>n.center.lng?o.lng-=360:o.lng+=360}return o}const nn={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 Xs(o,t,n){const a=o.classList;for(const c in nn)a.remove(`maplibregl-${n}-anchor-${c}`);a.add(`maplibregl-${n}-anchor-${t}`)}class os extends h.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=h.extend({element:t},n)),h.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=h.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=Y.create("div"),this._element.setAttribute("aria-label","Map marker");const a=Y.createNS("http://www.w3.org/2000/svg","svg"),c=41,p=27;a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height",`${c}px`),a.setAttributeNS(null,"width",`${p}px`),a.setAttributeNS(null,"viewBox",`0 0 ${p} ${c}`);const m=Y.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"stroke","none"),m.setAttributeNS(null,"stroke-width","1"),m.setAttributeNS(null,"fill","none"),m.setAttributeNS(null,"fill-rule","evenodd");const y=Y.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill-rule","nonzero");const _=Y.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{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 re of x){const N=Y.createNS("http://www.w3.org/2000/svg","ellipse");N.setAttributeNS(null,"opacity","0.04"),N.setAttributeNS(null,"cx","10.5"),N.setAttributeNS(null,"cy","5.80029008"),N.setAttributeNS(null,"rx",re.rx),N.setAttributeNS(null,"ry",re.ry),_.appendChild(N)}const T=Y.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const w=Y.createNS("http://www.w3.org/2000/svg","path");w.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"),T.appendChild(w);const z=Y.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const O=Y.createNS("http://www.w3.org/2000/svg","path");O.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"),z.appendChild(O);const L=Y.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"transform","translate(6.0, 7.0)"),L.setAttributeNS(null,"fill","#FFFFFF");const R=Y.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(8.0, 8.0)");const $=Y.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#000000"),$.setAttributeNS(null,"opacity","0.25"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962");const H=Y.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#FFFFFF"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962"),R.appendChild($),R.appendChild(H),y.appendChild(_),y.appendChild(T),y.appendChild(z),y.appendChild(L),y.appendChild(R),a.appendChild(y),a.setAttributeNS(null,"height",c*this._scale+"px"),a.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(a),this._offset=h.Point.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()}),Xs(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),Y.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=h.LngLat.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 c=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[c,-1*(38.1-13.5+c)],"bottom-right":[-c,-1*(38.1-13.5+c)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,a=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&a!==32&&a!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,a=this._element;this._popup&&(n===a||a.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Gs(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?a="rotateX(0deg)":this._pitchAlignment==="map"&&(a=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),Y.setTransform(this._element,`${nn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${n}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const c=this._map.unproject(this._pos),p=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=c.distanceTo(this._lngLat)>20*p?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=h.Point.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}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",this._state==="pending"&&(this._state="active",this.fire(new h.Event("dragstart"))),this.fire(new h.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new h.Event("dragend")),this._state="inactive"}_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))}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&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ka={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ln=0,sn=!1;const Ya={maxWidth:100,unit:"metric"};function Ws(o,t,n){const a=n&&n.maxWidth||100,c=o._container.clientHeight/2,p=o.unproject([0,c]),m=o.unproject([a,c]),y=p.distanceTo(m);if(n&&n.unit==="imperial"){const _=3.2808*y;_>5280?an(t,a,_/5280,o._getUIString("ScaleControl.Miles")):an(t,a,_,o._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?an(t,a,y/1852,o._getUIString("ScaleControl.NauticalMiles")):y>=1e3?an(t,a,y/1e3,o._getUIString("ScaleControl.Kilometers")):an(t,a,y,o._getUIString("ScaleControl.Meters"))}function an(o,t,n,a){const c=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let y=p/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(_){const x=Math.pow(10,Math.ceil(-Math.log(_)/Math.LN10));return Math.round(_*x)/x}(y),m*y}(n);o.style.width=t*(c/n)+"px",o.innerHTML=`${c} ${a}`}const Hs={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Ja=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ks(o){if(o){if(typeof o=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(o,2)));return{center:new h.Point(0,0),top:new h.Point(0,o),"top-left":new h.Point(t,t),"top-right":new h.Point(-t,t),bottom:new h.Point(0,-o),"bottom-left":new h.Point(t,-t),"bottom-right":new h.Point(-t,-t),left:new h.Point(o,0),right:new h.Point(-o,0)}}if(o instanceof h.Point||Array.isArray(o)){const t=h.Point.convert(o);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:h.Point.convert(o.center||[0,0]),top:h.Point.convert(o.top||[0,0]),"top-left":h.Point.convert(o["top-left"]||[0,0]),"top-right":h.Point.convert(o["top-right"]||[0,0]),bottom:h.Point.convert(o.bottom||[0,0]),"bottom-left":h.Point.convert(o["bottom-left"]||[0,0]),"bottom-right":h.Point.convert(o["bottom-right"]||[0,0]),left:h.Point.convert(o.left||[0,0]),right:h.Point.convert(o.right||[0,0])}}return Ks(new h.Point(0,0))}const Ys=_e,Js={setRTLTextPlugin:h.setRTLTextPlugin,getRTLTextPluginStatus:h.getRTLTextPluginStatus,Map:class extends Fe{constructor(o){var t;if(h.PerformanceUtils.mark(h.PerformanceMarkers.create),(o=h.extend({},al,o)).minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Bs(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies),{bearingSnap:o.bearingSnap}),this._interactive=o.interactive,this._cooperativeGestures=o.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=o.maxTileCacheSize,this._maxTileCacheZoomLevels=o.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=o.preserveDrawingBuffer,this._antialias=o.antialias,this._trackResize=o.trackResize,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=o.collectResourceTiming,this._renderTaskQueue=new Xa,this._controls=[],this._mapId=h.uniqueId(),this._locale=h.extend({},Wa,o.locale),this._clickTolerance=o.clickTolerance,this._pixelRatio=(t=o.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this.transformCameraUpdate=o.transformCameraUpdate,this._imageQueueHandle=Qt.addThrottleControl(()=>this.isMoving()),this._requestManager=new mt(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}if(o.maxBounds&&this.setMaxBounds(o.maxBounds),h.bindAll(["_onWindowOnline","_onMapScroll","_cooperativeGesturesOnWheel","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;this._resizeObserver=new ResizeObserver(a=>{n?this._trackResize&&this.resize(a)._update():n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new ur(this,o),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=o.hash&&new Xo(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,h.extend({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=o.localIdeographFontFamily,this._validateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new $e({customAttribution:o.customAttribution})),o.maplibreLogo&&this.addControl(new as,o.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new h.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new h.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new h.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(o,t){if(t===void 0&&(t=o.getDefaultPosition?o.getDefaultPosition():"top-right"),!o||!o.onAdd)return this.fire(new h.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=o.onAdd(this);this._controls.push(o);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(o){if(!o||!o.onRemove)return this.fire(new h.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(o);return t>-1&&this._controls.splice(t,1),o.onRemove(this),this}hasControl(o){return this._controls.indexOf(o)>-1}calculateCameraOptionsFromTo(o,t,n,a){return a==null&&this.terrain&&(a=this.transform.getElevation(n,this.terrain)),super.calculateCameraOptionsFromTo(o,t,n,a)}resize(o){var t;const n=this._containerDimensions(),a=n[0],c=n[1];this._resizeCanvas(a,c,this.getPixelRatio()),this.transform.resize(a,c),(t=this._requestedCameraState)===null||t===void 0||t.resize(a,c),this.painter.resize(a,c,this.getPixelRatio());const p=!this._moving;return p&&(this.stop(),this.fire(new h.Event("movestart",o)).fire(new h.Event("move",o))),this.fire(new h.Event("resize",o)),p&&this.fire(new h.Event("moveend",o)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(o){const[t,n]=this._containerDimensions();this._pixelRatio=o,this._resizeCanvas(t,n,o),this.painter.resize(t,n,o)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(o){return this.transform.setMaxBounds(si.convert(o)),this._update()}setMinZoom(o){if((o=o??-2)>=-2&&o<=this.transform.maxZoom)return this.transform.minZoom=o,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=o,this._update(),this.getZoom()>o&&this.setZoom(o),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(o){if((o=o??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(o>=0&&o<=this.transform.maxPitch)return this.transform.minPitch=o,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(o>=this.transform.minPitch)return this.transform.maxPitch=o,this._update(),this.getPitch()>o&&this.setPitch(o),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(o){return this.transform.renderWorldCopies=o,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(o){return this._cooperativeGestures=o,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(o){return this.transform.locationPoint(h.LngLat.convert(o),this.style&&this.terrain)}unproject(o){return this.transform.pointLocation(h.Point.convert(o),this.terrain)}isMoving(){var o;return this._moving||((o=this.handlers)===null||o===void 0?void 0:o.isMoving())}isZooming(){var o;return this._zooming||((o=this.handlers)===null||o===void 0?void 0:o.isZooming())}isRotating(){var o;return this._rotating||((o=this.handlers)===null||o===void 0?void 0:o.isRotating())}_createDelegatedListener(o,t,n){if(o==="mouseenter"||o==="mouseover"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:p=>{const m=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];m.length?a||(a=!0,n.call(this,new jt(o,this,p.originalEvent,{features:m}))):a=!1},mouseout:()=>{a=!1}}}}if(o==="mouseleave"||o==="mouseout"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new jt(o,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new jt(o,this,m.originalEvent)))}}}}{const a=c=>{const p=this.getLayer(t)?this.queryRenderedFeatures(c.point,{layers:[t]}):[];p.length&&(c.features=p,n.call(this,c),delete c.features)};return{layer:t,listener:n,delegates:{[o]:a}}}}on(o,t,n){if(n===void 0)return super.on(o,t);const a=this._createDelegatedListener(o,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[o]=this._delegatedListeners[o]||[],this._delegatedListeners[o].push(a);for(const c in a.delegates)this.on(c,a.delegates[c]);return this}once(o,t,n){if(n===void 0)return super.once(o,t);const a=this._createDelegatedListener(o,t,n);for(const c in a.delegates)this.once(c,a.delegates[c]);return this}off(o,t,n){return n===void 0?super.off(o,t):(this._delegatedListeners&&this._delegatedListeners[o]&&(a=>{const c=this._delegatedListeners[o];for(let p=0;pthis._updateStyle(o,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!o)),o?(this.style=new li(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof o=="string"?this.style.loadURL(o,t,n):this.style.loadJSON(o,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new li(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(o,t){if(typeof o=="string"){const n=this._requestManager.transformRequest(o,nt.Style);h.getJSON(n,(a,c)=>{a?this.fire(new h.ErrorEvent(a)):c&&this._updateDiff(c,t)})}else typeof o=="object"&&this._updateDiff(o,t)}_updateDiff(o,t){try{this.style.setState(o,t)&&this._update(!0)}catch(n){h.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(o,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():h.warnOnce("There is no style added to the map.")}addSource(o,t){return this._lazyInitEmptyStyle(),this.style.addSource(o,t),this._update(!0)}isSourceLoaded(o){const t=this.style&&this.style.sourceCaches[o];if(t!==void 0)return t.loaded();this.fire(new h.ErrorEvent(new Error(`There is no source with ID '${o}'`)))}setTerrain(o){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),o){const t=this.style.sourceCaches[o.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${o.source}`);for(const n in this.style._layers){const a=this.style._layers[n];a.type==="hillshade"&&a.source===o.source&&h.warnOnce("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 dr(this.painter,t,o),this.painter.renderToTexture=new Dt(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId===o.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(n.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.updateElevation(this.terrain);return this.fire(new h.Event("terrain",{terrain:o})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){const o=this.style&&this.style.sourceCaches;for(const t in o){const n=o[t]._tiles;for(const a in n){const c=n[a];if(c.state!=="loaded"&&c.state!=="errored")return!1}}return!0}addSourceType(o,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(o,t,n)}removeSource(o){return this.style.removeSource(o),this._update(!0)}getSource(o){return this.style.getSource(o)}addImage(o,t,{pixelRatio:n=1,sdf:a=!1,stretchX:c,stretchY:p,content:m}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||h.isImageBitmap(t)){const{width:y,height:_,data:x}=h.exported.getImageData(t);this.style.addImage(o,{data:new h.RGBAImage({width:y,height:_},x),pixelRatio:n,stretchX:c,stretchY:p,content:m,sdf:a,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new h.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:y,height:_,data:x}=t,T=t;this.style.addImage(o,{data:new h.RGBAImage({width:y,height:_},new Uint8Array(x)),pixelRatio:n,stretchX:c,stretchY:p,content:m,sdf:a,version:0,userImage:T}),T.onAdd&&T.onAdd(this,o)}}}updateImage(o,t){const n=this.style.getImage(o);if(!n)return this.fire(new h.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||h.isImageBitmap(t)?h.exported.getImageData(t):t,{width:c,height:p,data:m}=a;if(c===void 0||p===void 0)return this.fire(new h.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(c!==n.data.width||p!==n.data.height)return this.fire(new h.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||h.isImageBitmap(t));n.data.replace(m,y),this.style.updateImage(o,n)}getImage(o){return this.style.getImage(o)}hasImage(o){return o?!!this.style.getImage(o):(this.fire(new h.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(o){this.style.removeImage(o)}loadImage(o,t){Qt.getImage(this._requestManager.transformRequest(o,nt.Image),t)}listImages(){return this.style.listImages()}addLayer(o,t){return this._lazyInitEmptyStyle(),this.style.addLayer(o,t),this._update(!0)}moveLayer(o,t){return this.style.moveLayer(o,t),this._update(!0)}removeLayer(o){return this.style.removeLayer(o),this._update(!0)}getLayer(o){return this.style.getLayer(o)}setLayerZoomRange(o,t,n){return this.style.setLayerZoomRange(o,t,n),this._update(!0)}setFilter(o,t,n={}){return this.style.setFilter(o,t,n),this._update(!0)}getFilter(o){return this.style.getFilter(o)}setPaintProperty(o,t,n,a={}){return this.style.setPaintProperty(o,t,n,a),this._update(!0)}getPaintProperty(o,t){return this.style.getPaintProperty(o,t)}setLayoutProperty(o,t,n,a={}){return this.style.setLayoutProperty(o,t,n,a),this._update(!0)}getLayoutProperty(o,t){return this.style.getLayoutProperty(o,t)}setGlyphs(o,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(o,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(o,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(o,t,n,a=>{a||this._update(!0)}),this}removeSprite(o){return this._lazyInitEmptyStyle(),this.style.removeSprite(o),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(o,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(o,t,n=>{n||this._update(!0)}),this}setLight(o,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(o,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(o,t){return this.style.setFeatureState(o,t),this._update()}removeFeatureState(o,t){return this.style.removeFeatureState(o,t),this._update()}getFeatureState(o){return this.style.getFeatureState(o)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let o=0,t=0;return this._container&&(o=this._container.clientWidth||400,t=this._container.clientHeight||300),[o,t]}_setupContainer(){const o=this._container;o.classList.add("maplibregl-map");const t=this._canvasContainer=Y.create("div","maplibregl-canvas-container",o);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=Y.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const a=this._controlContainer=Y.create("div","maplibregl-control-container",o),c=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{c[p]=Y.create("div",`maplibregl-ctrl-${p} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_cooperativeGesturesOnWheel(o){this._onCooperativeGesture(o,o[this._metaKey],1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=Y.create("div","maplibregl-cooperative-gesture-screen",this._container);let o=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(o=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=` +`),te=_.createShader(_.FRAGMENT_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);_.shaderSource(te,re),_.compileShader(te),_.attachShader(this.program,te);const ae=_.createShader(_.VERTEX_SHADER);if(_.isContextLost())return void(this.failedToCreate=!0);_.shaderSource(ae,N),_.compileShader(ae),_.attachShader(this.program,ae),this.attributes={};const pe={};this.numAttributes=w.length;for(let me=0;me({u_depth:new h.Uniform1i(me,xe.u_depth),u_terrain:new h.Uniform1i(me,xe.u_terrain),u_terrain_dim:new h.Uniform1f(me,xe.u_terrain_dim),u_terrain_matrix:new h.UniformMatrix4f(me,xe.u_terrain_matrix),u_terrain_unpack:new h.Uniform4f(me,xe.u_terrain_unpack),u_terrain_exaggeration:new h.Uniform1f(me,xe.u_terrain_exaggeration)}))(t,pe),this.binderUniforms=c?c.getUniforms(t,pe):[]}draw(t,n,a,c,p,m,y,_,x,T,w,k,O,B,R,$,H,re){const N=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(c),t.setColorMode(p),t.setCullFace(m),_){t.activeTexture.set(N.TEXTURE2),N.bindTexture(N.TEXTURE_2D,_.depthTexture),t.activeTexture.set(N.TEXTURE3),N.bindTexture(N.TEXTURE_2D,_.texture);for(const ae in this.terrainUniforms)this.terrainUniforms[ae].set(_[ae])}for(const ae in this.fixedUniforms)this.fixedUniforms[ae].set(y[ae]);R&&R.setUniforms(t,this.binderUniforms,O,{zoom:B});let te=0;switch(n){case N.LINES:te=2;break;case N.TRIANGLES:te=3;break;case N.LINE_STRIP:te=1}for(const ae of k.get()){const pe=ae.vaos||(ae.vaos={});(pe[x]||(pe[x]=new Vr)).bind(t,this,T,R?R.getPaintVertexBuffers():[],w,ae.vertexOffset,$,H,re),N.drawElements(n,ae.primitiveLength*te,N.UNSIGNED_SHORT,ae.primitiveOffset*te*2)}}}function Io(o,t,n){const a=1/W(n,1,t.transform.tileZoom),c=Math.pow(2,n.tileID.overscaledZ),p=n.tileSize*Math.pow(2,t.transform.tileZoom)/c,m=p*(n.tileID.canonical.x+n.tileID.wrap*c),y=p*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,o.fromScale,o.toScale],u_fade:o.t,u_pixel_coord_upper:[m>>16,y>>16],u_pixel_coord_lower:[65535&m,65535&y]}}const Ao=(o,t,n,a)=>{const c=t.style.light,p=c.properties.get("position"),m=[p.x,p.y,p.z],y=function(){var x=new h.ARRAY_TYPE(9);return h.ARRAY_TYPE!=Float32Array&&(x[1]=0,x[2]=0,x[3]=0,x[5]=0,x[6]=0,x[7]=0),x[0]=1,x[4]=1,x[8]=1,x}();c.properties.get("anchor")==="viewport"&&function(x,T){var w=Math.sin(T),k=Math.cos(T);x[0]=k,x[1]=w,x[2]=0,x[3]=-w,x[4]=k,x[5]=0,x[6]=0,x[7]=0,x[8]=1}(y,-t.transform.angle),function(x,T,w){var k=T[0],O=T[1],B=T[2];x[0]=k*w[0]+O*w[3]+B*w[6],x[1]=k*w[1]+O*w[4]+B*w[7],x[2]=k*w[2]+O*w[5]+B*w[8]}(m,m,y);const _=c.properties.get("color");return{u_matrix:o,u_lightpos:m,u_lightintensity:c.properties.get("intensity"),u_lightcolor:[_.r,_.g,_.b],u_vertical_gradient:+n,u_opacity:a}},ya=(o,t,n,a,c,p,m)=>h.extend(Ao(o,t,n,a),Io(p,t,m),{u_height_factor:-Math.pow(2,c.overscaledZ)/m.tileSize/8}),Po=o=>({u_matrix:o}),xa=(o,t,n,a)=>h.extend(Po(o),Io(n,t,a)),Ul=(o,t)=>({u_matrix:o,u_world:t}),Mo=(o,t,n,a,c)=>h.extend(xa(o,t,n,a),{u_world:c}),Vl=(o,t,n,a)=>{const c=o.transform;let p,m;if(a.paint.get("circle-pitch-alignment")==="map"){const y=W(n,1,c.zoom);p=!0,m=[y,y]}else p=!1,m=c.pixelsToGLUnits;return{u_camera_to_center_distance:c.cameraToCenterDistance,u_scale_with_map:+(a.paint.get("circle-pitch-scale")==="map"),u_matrix:o.translatePosMatrix(t.posMatrix,n,a.paint.get("circle-translate"),a.paint.get("circle-translate-anchor")),u_pitch_with_map:+p,u_device_pixel_ratio:o.pixelRatio,u_extrude_scale:m}},va=(o,t,n)=>{const a=W(n,1,t.zoom),c=Math.pow(2,t.zoom-n.tileID.overscaledZ),p=n.tileID.overscaleFactor();return{u_matrix:o,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:a,u_extrude_scale:[t.pixelsToGLUnits[0]/(a*c),t.pixelsToGLUnits[1]/(a*c)],u_overscale_factor:p}},ba=(o,t,n=1)=>({u_matrix:o,u_color:t,u_overlay:0,u_overlay_scale:n}),wa=o=>({u_matrix:o}),Co=(o,t,n,a)=>({u_matrix:o,u_extrude_scale:W(t,1,n),u_intensity:a});function ko(o,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new h.MercatorCoordinate(0,a/n).toLngLat().lat,new h.MercatorCoordinate(0,(a+1)/n).toLngLat().lat]}const Er=(o,t,n,a)=>{const c=o.transform;return{u_matrix:Tn(o,t,n,a),u_ratio:1/W(t,1,c.zoom),u_device_pixel_ratio:o.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},xs=(o,t,n,a,c)=>h.extend(Er(o,t,n,c),{u_image:0,u_image_height:a}),Gi=(o,t,n,a,c)=>{const p=o.transform,m=Wn(t,p);return{u_matrix:Tn(o,t,n,c),u_texsize:t.imageAtlasTexture.size,u_ratio:1/W(t,1,p.zoom),u_device_pixel_ratio:o.pixelRatio,u_image:0,u_scale:[m,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/p.pixelsToGLUnits[0],1/p.pixelsToGLUnits[1]]}},vs=(o,t,n,a,c,p)=>{const m=o.lineAtlas,y=Wn(t,o.transform),_=n.layout.get("line-cap")==="round",x=m.getDash(a.from,_),T=m.getDash(a.to,_),w=x.width*c.fromScale,k=T.width*c.toScale;return h.extend(Er(o,t,n,p),{u_patternscale_a:[y/w,-x.height/2],u_patternscale_b:[y/k,-T.height/2],u_sdfgamma:m.width/(256*Math.min(w,k)*o.pixelRatio)/2,u_image:0,u_tex_y_a:x.y,u_tex_y_b:T.y,u_mix:c.t})};function Wn(o,t){return 1/W(o,1,t.tileZoom)}function Tn(o,t,n,a){return o.translatePosMatrix(a?a.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const bs=(o,t,n,a,c)=>{return{u_matrix:o,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:a.mix,u_opacity:a.opacity*c.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:c.paint.get("raster-brightness-min"),u_brightness_high:c.paint.get("raster-brightness-max"),u_saturation_factor:(m=c.paint.get("raster-saturation"),m>0?1-1/(1.001-m):-m),u_contrast_factor:(p=c.paint.get("raster-contrast"),p>0?1/(1-p):1+p),u_spin_weights:ws(c.paint.get("raster-hue-rotate"))};var p,m};function ws(o){o*=Math.PI/180;const t=Math.sin(o),n=Math.cos(o);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const En=(o,t,n,a,c,p,m,y,_,x)=>{const T=c.transform;return{u_is_size_zoom_constant:+(o==="constant"||o==="source"),u_is_size_feature_constant:+(o==="constant"||o==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:T.cameraToCenterDistance,u_pitch:T.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:T.width/T.height,u_fade_change:c.options.fadeDuration?c.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:y,u_is_text:+_,u_pitch_with_map:+a,u_texsize:x,u_texture:0}},Sn=(o,t,n,a,c,p,m,y,_,x,T)=>{const w=c.transform;return h.extend(En(o,t,n,a,c,p,m,y,_,x),{u_gamma_scale:a?Math.cos(w._pitch)*w.cameraToCenterDistance:1,u_device_pixel_ratio:c.pixelRatio,u_is_halo:+T})},Ts=(o,t,n,a,c,p,m,y,_,x)=>h.extend(Sn(o,t,n,a,c,p,m,y,!0,_,!0),{u_texsize_icon:x,u_texture_icon:1}),zi=(o,t,n)=>({u_matrix:o,u_opacity:t,u_color:n}),Di=(o,t,n,a,c,p)=>h.extend(function(m,y,_,x){const T=_.imageManager.getPattern(m.from.toString()),w=_.imageManager.getPattern(m.to.toString()),{width:k,height:O}=_.imageManager.getPixelSize(),B=Math.pow(2,x.tileID.overscaledZ),R=x.tileSize*Math.pow(2,_.transform.tileZoom)/B,$=R*(x.tileID.canonical.x+x.tileID.wrap*B),H=R*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:w.tl,u_pattern_br_b:w.br,u_texsize:[k,O],u_mix:y.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:w.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/W(x,1,_.transform.tileZoom),u_pixel_coord_upper:[$>>16,H>>16],u_pixel_coord_lower:[65535&$,65535&H]}}(a,p,n,c),{u_matrix:o,u_opacity:t}),Ta={fillExtrusion:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_lightpos:new h.Uniform3f(o,t.u_lightpos),u_lightintensity:new h.Uniform1f(o,t.u_lightintensity),u_lightcolor:new h.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new h.Uniform1f(o,t.u_vertical_gradient),u_opacity:new h.Uniform1f(o,t.u_opacity)}),fillExtrusionPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_lightpos:new h.Uniform3f(o,t.u_lightpos),u_lightintensity:new h.Uniform1f(o,t.u_lightintensity),u_lightcolor:new h.Uniform3f(o,t.u_lightcolor),u_vertical_gradient:new h.Uniform1f(o,t.u_vertical_gradient),u_height_factor:new h.Uniform1f(o,t.u_height_factor),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade),u_opacity:new h.Uniform1f(o,t.u_opacity)}),fill:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),fillPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),fillOutline:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world)}),fillOutlinePattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world),u_image:new h.Uniform1i(o,t.u_image),u_texsize:new h.Uniform2f(o,t.u_texsize),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),circle:(o,t)=>({u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_scale_with_map:new h.Uniform1i(o,t.u_scale_with_map),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_extrude_scale:new h.Uniform2f(o,t.u_extrude_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),collisionBox:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pixels_to_tile_units:new h.Uniform1f(o,t.u_pixels_to_tile_units),u_extrude_scale:new h.Uniform2f(o,t.u_extrude_scale),u_overscale_factor:new h.Uniform1f(o,t.u_overscale_factor)}),collisionCircle:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_inv_matrix:new h.UniformMatrix4f(o,t.u_inv_matrix),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_viewport_size:new h.Uniform2f(o,t.u_viewport_size)}),debug:(o,t)=>({u_color:new h.UniformColor(o,t.u_color),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_overlay:new h.Uniform1i(o,t.u_overlay),u_overlay_scale:new h.Uniform1f(o,t.u_overlay_scale)}),clippingMask:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),heatmap:(o,t)=>({u_extrude_scale:new h.Uniform1f(o,t.u_extrude_scale),u_intensity:new h.Uniform1f(o,t.u_intensity),u_matrix:new h.UniformMatrix4f(o,t.u_matrix)}),heatmapTexture:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_world:new h.Uniform2f(o,t.u_world),u_image:new h.Uniform1i(o,t.u_image),u_color_ramp:new h.Uniform1i(o,t.u_color_ramp),u_opacity:new h.Uniform1f(o,t.u_opacity)}),hillshade:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_latrange:new h.Uniform2f(o,t.u_latrange),u_light:new h.Uniform2f(o,t.u_light),u_shadow:new h.UniformColor(o,t.u_shadow),u_highlight:new h.UniformColor(o,t.u_highlight),u_accent:new h.UniformColor(o,t.u_accent)}),hillshadePrepare:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_image:new h.Uniform1i(o,t.u_image),u_dimension:new h.Uniform2f(o,t.u_dimension),u_zoom:new h.Uniform1f(o,t.u_zoom),u_unpack:new h.Uniform4f(o,t.u_unpack)}),line:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels)}),lineGradient:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_image:new h.Uniform1i(o,t.u_image),u_image_height:new h.Uniform1f(o,t.u_image_height)}),linePattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texsize:new h.Uniform2f(o,t.u_texsize),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_image:new h.Uniform1i(o,t.u_image),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_scale:new h.Uniform3f(o,t.u_scale),u_fade:new h.Uniform1f(o,t.u_fade)}),lineSDF:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ratio:new h.Uniform1f(o,t.u_ratio),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_units_to_pixels:new h.Uniform2f(o,t.u_units_to_pixels),u_patternscale_a:new h.Uniform2f(o,t.u_patternscale_a),u_patternscale_b:new h.Uniform2f(o,t.u_patternscale_b),u_sdfgamma:new h.Uniform1f(o,t.u_sdfgamma),u_image:new h.Uniform1i(o,t.u_image),u_tex_y_a:new h.Uniform1f(o,t.u_tex_y_a),u_tex_y_b:new h.Uniform1f(o,t.u_tex_y_b),u_mix:new h.Uniform1f(o,t.u_mix)}),raster:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_tl_parent:new h.Uniform2f(o,t.u_tl_parent),u_scale_parent:new h.Uniform1f(o,t.u_scale_parent),u_buffer_scale:new h.Uniform1f(o,t.u_buffer_scale),u_fade_t:new h.Uniform1f(o,t.u_fade_t),u_opacity:new h.Uniform1f(o,t.u_opacity),u_image0:new h.Uniform1i(o,t.u_image0),u_image1:new h.Uniform1i(o,t.u_image1),u_brightness_low:new h.Uniform1f(o,t.u_brightness_low),u_brightness_high:new h.Uniform1f(o,t.u_brightness_high),u_saturation_factor:new h.Uniform1f(o,t.u_saturation_factor),u_contrast_factor:new h.Uniform1f(o,t.u_contrast_factor),u_spin_weights:new h.Uniform3f(o,t.u_spin_weights)}),symbolIcon:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texture:new h.Uniform1i(o,t.u_texture)}),symbolSDF:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texture:new h.Uniform1i(o,t.u_texture),u_gamma_scale:new h.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new h.Uniform1i(o,t.u_is_halo)}),symbolTextAndIcon:(o,t)=>({u_is_size_zoom_constant:new h.Uniform1i(o,t.u_is_size_zoom_constant),u_is_size_feature_constant:new h.Uniform1i(o,t.u_is_size_feature_constant),u_size_t:new h.Uniform1f(o,t.u_size_t),u_size:new h.Uniform1f(o,t.u_size),u_camera_to_center_distance:new h.Uniform1f(o,t.u_camera_to_center_distance),u_pitch:new h.Uniform1f(o,t.u_pitch),u_rotate_symbol:new h.Uniform1i(o,t.u_rotate_symbol),u_aspect_ratio:new h.Uniform1f(o,t.u_aspect_ratio),u_fade_change:new h.Uniform1f(o,t.u_fade_change),u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_label_plane_matrix:new h.UniformMatrix4f(o,t.u_label_plane_matrix),u_coord_matrix:new h.UniformMatrix4f(o,t.u_coord_matrix),u_is_text:new h.Uniform1i(o,t.u_is_text),u_pitch_with_map:new h.Uniform1i(o,t.u_pitch_with_map),u_texsize:new h.Uniform2f(o,t.u_texsize),u_texsize_icon:new h.Uniform2f(o,t.u_texsize_icon),u_texture:new h.Uniform1i(o,t.u_texture),u_texture_icon:new h.Uniform1i(o,t.u_texture_icon),u_gamma_scale:new h.Uniform1f(o,t.u_gamma_scale),u_device_pixel_ratio:new h.Uniform1f(o,t.u_device_pixel_ratio),u_is_halo:new h.Uniform1i(o,t.u_is_halo)}),background:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_opacity:new h.Uniform1f(o,t.u_opacity),u_color:new h.UniformColor(o,t.u_color)}),backgroundPattern:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_opacity:new h.Uniform1f(o,t.u_opacity),u_image:new h.Uniform1i(o,t.u_image),u_pattern_tl_a:new h.Uniform2f(o,t.u_pattern_tl_a),u_pattern_br_a:new h.Uniform2f(o,t.u_pattern_br_a),u_pattern_tl_b:new h.Uniform2f(o,t.u_pattern_tl_b),u_pattern_br_b:new h.Uniform2f(o,t.u_pattern_br_b),u_texsize:new h.Uniform2f(o,t.u_texsize),u_mix:new h.Uniform1f(o,t.u_mix),u_pattern_size_a:new h.Uniform2f(o,t.u_pattern_size_a),u_pattern_size_b:new h.Uniform2f(o,t.u_pattern_size_b),u_scale_a:new h.Uniform1f(o,t.u_scale_a),u_scale_b:new h.Uniform1f(o,t.u_scale_b),u_pixel_coord_upper:new h.Uniform2f(o,t.u_pixel_coord_upper),u_pixel_coord_lower:new h.Uniform2f(o,t.u_pixel_coord_lower),u_tile_units_to_pixels:new h.Uniform1f(o,t.u_tile_units_to_pixels)}),terrain:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texture:new h.Uniform1i(o,t.u_texture),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)}),terrainDepth:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)}),terrainCoords:(o,t)=>({u_matrix:new h.UniformMatrix4f(o,t.u_matrix),u_texture:new h.Uniform1i(o,t.u_texture),u_terrain_coords_id:new h.Uniform1f(o,t.u_terrain_coords_id),u_ele_delta:new h.Uniform1f(o,t.u_ele_delta)})};class Es{constructor(t,n,a){this.context=t;const c=t.gl;this.buffer=c.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?c.DYNAMIC_DRAW:c.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Ss={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ea{constructor(t,n,a,c){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=c,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),t.bindVertexBuffer.set(this.buffer),p.bufferData(p.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||delete n.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 n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let a=0;a0){const Ce=h.create(),Ue=me;h.mul(Ce,pe.placementInvProjMatrix,o.transform.glCoordMatrix),h.mul(Ce,Ce,pe.placementViewportMatrix),T.push({circleArray:fe,circleOffset:k,transform:Ue,invTransform:Ce,coord:te}),w+=fe.length/4,k=w}xe&&x.draw(y,_.LINES,rt.disabled,Tt.disabled,o.colorModeForRenderPass(),bt.disabled,va(me,o.transform,ae),o.style.map.terrain&&o.style.map.terrain.getTerrainData(te),n.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,null,o.transform.zoom,null,null,xe.collisionVertexBuffer)}if(!m||!T.length)return;const O=o.useProgram("collisionCircle"),B=new h.CollisionCircleLayoutArray;B.resize(4*w),B._trim();let R=0;for(const N of T)for(let te=0;te=0&&(B[$.associatedIconIndex]={shiftedAnchor:We,angle:Ee})}else D($.numGlyphs,k)}if(x){O.clear();const R=o.icon.placedSymbolArray;for(let $=0;$o.style.map.terrain.getElevation(xe,Qs,Ar):null,Bi=n.layout.get("text-rotation-alignment")==="map";wr(Ce,xe.posMatrix,o,c,er,vi,$,x,Bi,Yt)}const ui=o.translatePosMatrix(xe.posMatrix,fe,p,m),ti=H||c&&pe||cs?La:er,ut=o.translatePosMatrix(vi,fe,p,m,!0),Kt=Ee&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ii;ii=Ee?Ce.iconsInText?Ts(qe.kind,Ot,re,$,o,ui,ti,ut,Ke,ei):Sn(qe.kind,Ot,re,$,o,ui,ti,ut,c,Ke,!0):En(qe.kind,Ot,re,$,o,ui,ti,ut,c,Ke);const pt={program:ct,buffers:Ue,uniformValues:ii,atlasTexture:Lt,atlasTextureIcon:Li,atlasInterpolation:xi,atlasInterpolationIcon:Ut,isSDF:Ee,hasHalo:Kt};if(N&&Ce.canOverlap){te=!0;const Yt=Ue.segments.get();for(const Bi of Yt)me.push({segments:new h.SegmentVector([Bi]),sortKey:Bi.sortKey,state:pt,terrainData:ht})}else me.push({segments:Ue.segments,sortKey:0,state:pt,terrainData:ht})}te&&me.sort((xe,fe)=>xe.sortKey-fe.sortKey);for(const xe of me){const fe=xe.state;if(k.activeTexture.set(O.TEXTURE0),fe.atlasTexture.bind(fe.atlasInterpolation,O.CLAMP_TO_EDGE),fe.atlasTextureIcon&&(k.activeTexture.set(O.TEXTURE1),fe.atlasTextureIcon&&fe.atlasTextureIcon.bind(fe.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),fe.isSDF){const Ce=fe.uniformValues;fe.hasHalo&&(Ce.u_is_halo=1,Ba(fe.buffers,xe.segments,n,o,fe.program,ae,T,w,Ce,xe.terrainData)),Ce.u_is_halo=0}Ba(fe.buffers,xe.segments,n,o,fe.program,ae,T,w,fe.uniformValues,xe.terrainData)}}function Ba(o,t,n,a,c,p,m,y,_,x){const T=a.context;c.draw(T,T.gl.TRIANGLES,p,m,y,bt.disabled,_,x,n.id,o.layoutVertexBuffer,o.indexBuffer,t,n.paint,a.transform.zoom,o.programConfigurations.get(n.id),o.dynamicLayoutVertexBuffer,o.opacityVertexBuffer)}function Ra(o,t,n,a,c){if(!n||!a||!a.imageAtlas)return;const p=a.imageAtlas.patternPositions;let m=p[n.to.toString()],y=p[n.from.toString()];if(!m||!y){const _=c.getPaintProperty(t);m=p[_],y=p[_]}m&&y&&o.setConstantPatternPositions(m,y)}function Yn(o,t,n,a,c,p,m){const y=o.context.gl,_="fill-pattern",x=n.paint.get(_),T=x&&x.constantOr(1),w=n.getCrossfadeParameters();let k,O,B,R,$;m?(O=T&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",k=y.LINES):(O=T?"fillPattern":"fill",k=y.TRIANGLES);const H=x.constantOr(null);for(const re of a){const N=t.getTile(re);if(T&&!N.patternsLoaded())continue;const te=N.getBucket(n);if(!te)continue;const ae=te.programConfigurations.get(n.id),pe=o.useProgram(O,ae),me=o.style.map.terrain&&o.style.map.terrain.getTerrainData(re);T&&(o.context.activeTexture.set(y.TEXTURE0),N.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),ae.updatePaintBuffers(w)),Ra(ae,_,H,N,n);const xe=me?re:null,fe=o.translatePosMatrix(xe?xe.posMatrix:re.posMatrix,N,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){R=te.indexBuffer2,$=te.segments2;const Ce=[y.drawingBufferWidth,y.drawingBufferHeight];B=O==="fillOutlinePattern"&&T?Mo(fe,o,w,N,Ce):Ul(fe,Ce)}else R=te.indexBuffer,$=te.segments,B=T?xa(fe,o,w,N):Po(fe);pe.draw(o.context,k,c,o.stencilModeForClipping(re),p,bt.disabled,B,me,n.id,te.layoutVertexBuffer,R,$,n.paint,o.transform.zoom,ae)}}function Jn(o,t,n,a,c,p,m){const y=o.context,_=y.gl,x="fill-extrusion-pattern",T=n.paint.get(x),w=T.constantOr(1),k=n.getCrossfadeParameters(),O=n.paint.get("fill-extrusion-opacity"),B=T.constantOr(null);for(const R of a){const $=t.getTile(R),H=$.getBucket(n);if(!H)continue;const re=o.style.map.terrain&&o.style.map.terrain.getTerrainData(R),N=H.programConfigurations.get(n.id),te=o.useProgram(w?"fillExtrusionPattern":"fillExtrusion",N);w&&(o.context.activeTexture.set(_.TEXTURE0),$.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),N.updatePaintBuffers(k)),Ra(N,x,B,$,n);const ae=o.translatePosMatrix(R.posMatrix,$,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),pe=n.paint.get("fill-extrusion-vertical-gradient"),me=w?ya(ae,o,pe,O,R,k,$):Ao(ae,o,pe,O);te.draw(y,y.gl.TRIANGLES,c,p,m,bt.backCCW,me,re,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,o.transform.zoom,N,o.style.map.terrain&&H.centroidVertexBuffer)}}function Yl(o,t,n,a,c,p,m){const y=o.context,_=y.gl,x=n.fbo;if(!x)return;const T=o.useProgram("hillshade"),w=o.style.map.terrain&&o.style.map.terrain.getTerrainData(t);y.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,x.colorAttachment.get()),T.draw(y,_.TRIANGLES,c,p,m,bt.disabled,((k,O,B,R)=>{const $=B.paint.get("hillshade-shadow-color"),H=B.paint.get("hillshade-highlight-color"),re=B.paint.get("hillshade-accent-color");let N=B.paint.get("hillshade-illumination-direction")*(Math.PI/180);B.paint.get("hillshade-illumination-anchor")==="viewport"&&(N-=k.transform.angle);const te=!k.options.moving;return{u_matrix:R?R.posMatrix:k.transform.calculatePosMatrix(O.tileID.toUnwrapped(),te),u_image:0,u_latrange:ko(0,O.tileID),u_light:[B.paint.get("hillshade-exaggeration"),N],u_shadow:$,u_highlight:H,u_accent:re}})(o,n,a,w?t:null),w,a.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}function $o(o,t,n,a,c,p){const m=o.context,y=m.gl,_=t.dem;if(_&&_.data){const x=_.dim,T=_.stride,w=_.getPixels();if(m.activeTexture.set(y.TEXTURE1),m.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||o.getTileTexture(T),t.demTexture){const O=t.demTexture;O.update(w,{premultiply:!1}),O.bind(y.NEAREST,y.CLAMP_TO_EDGE)}else t.demTexture=new gt(m,w,y.RGBA,{premultiply:!1}),t.demTexture.bind(y.NEAREST,y.CLAMP_TO_EDGE);m.activeTexture.set(y.TEXTURE0);let k=t.fbo;if(!k){const O=new gt(m,{width:x,height:x,data:null},y.RGBA);O.bind(y.LINEAR,y.CLAMP_TO_EDGE),k=t.fbo=m.createFramebuffer(x,x,!0,!1),k.colorAttachment.set(O.texture)}m.bindFramebuffer.set(k.framebuffer),m.viewport.set([0,0,x,x]),o.useProgram("hillshadePrepare").draw(m,y.TRIANGLES,a,c,p,bt.disabled,((O,B)=>{const R=B.stride,$=h.create();return h.ortho($,0,h.EXTENT,-h.EXTENT,0,0,1),h.translate($,$,[0,-h.EXTENT,0]),{u_matrix:$,u_image:1,u_dimension:[R,R],u_zoom:O.overscaledZ,u_unpack:B.getUnpackVector()}})(t.tileID,_),null,n.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Ft(o,t,n,a,c,p){const m=a.paint.get("raster-fade-duration");if(!p&&m>0){const y=h.exported.now(),_=(y-o.timeAdded)/m,x=t?(y-t.timeAdded)/m:-1,T=n.getSource(),w=c.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),k=!t||Math.abs(t.tileID.overscaledZ-w)>Math.abs(o.tileID.overscaledZ-w),O=k&&o.refreshedUponExpiration?1:h.clamp(k?_:1-x,0,1);return o.refreshedUponExpiration&&_>=1&&(o.refreshedUponExpiration=!1),t?{opacity:1,mix:1-O}:{opacity:O,mix:0}}return{opacity:1,mix:0}}const tn=new h.Color(1,0,0,1),Xi=new h.Color(0,1,0,1),qo=new h.Color(0,0,1,1),Fa=new h.Color(1,0,1,1),jo=new h.Color(0,1,1,1);function rn(o,t,n,a){kn(o,0,t+n/2,o.transform.width,n,a)}function Qn(o,t,n,a){kn(o,t-n/2,0,n,o.transform.height,a)}function kn(o,t,n,a,c,p){const m=o.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*o.pixelRatio,n*o.pixelRatio,a*o.pixelRatio,c*o.pixelRatio),m.clear({color:p}),y.disable(y.SCISSOR_TEST)}function Zo(o,t,n){const a=o.context,c=a.gl,p=n.posMatrix,m=o.useProgram("debug"),y=rt.disabled,_=Tt.disabled,x=o.colorModeForRenderPass(),T="$debug",w=o.style.map.terrain&&o.style.map.terrain.getTerrainData(n);a.activeTexture.set(c.TEXTURE0);const k=t.getTileByID(n.key).latestRawTileData,O=Math.floor((k&&k.byteLength||0)/1024),B=t.getTile(n).tileSize,R=512/Math.min(B,512)*(n.overscaledZ/o.transform.zoom)*.5;let $=n.canonical.toString();n.overscaledZ!==n.canonical.z&&($+=` => ${n.overscaledZ}`),function(H,re){H.initDebugOverlayCanvas();const N=H.debugOverlayCanvas,te=H.context.gl,ae=H.debugOverlayCanvas.getContext("2d");ae.clearRect(0,0,N.width,N.height),ae.shadowColor="white",ae.shadowBlur=2,ae.lineWidth=1.5,ae.strokeStyle="white",ae.textBaseline="top",ae.font="bold 36px Open Sans, sans-serif",ae.fillText(re,5,5),ae.strokeText(re,5,5),H.debugOverlayTexture.update(N),H.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(o,`${$} ${O}kB`),m.draw(a,c.TRIANGLES,y,_,Ct.alphaBlended,bt.disabled,ba(p,h.Color.transparent,R),null,T,o.debugBuffer,o.quadTriangleIndexBuffer,o.debugSegments),m.draw(a,c.LINE_STRIP,y,_,x,bt.disabled,ba(p,h.Color.red),w,T,o.debugBuffer,o.tileBorderIndexBuffer,o.debugSegments)}function Oa(o,t,n){const a=o.context,c=a.gl,p=o.colorModeForRenderPass(),m=new rt(c.LEQUAL,rt.ReadWrite,o.depthRangeFor3D),y=o.useProgram("terrain"),_=t.getTerrainMesh();a.bindFramebuffer.set(null),a.viewport.set([0,0,o.width,o.height]);for(const x of n){const T=o.renderToTexture.getTexture(x),w=t.getTerrainData(x.tileID);a.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,T.texture);const k={u_matrix:o.transform.calculatePosMatrix(x.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(o.transform.zoom)};y.draw(a,c.TRIANGLES,m,Tt.disabled,p,bt.backCCW,k,w,"terrain",_.vertexBuffer,_.indexBuffer,_.segments)}}const Ua={symbol:function(o,t,n,a,c){if(o.renderPass!=="translucent")return;const p=Tt.disabled,m=o.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(y,_,x,T,w,k,O){const B=_.transform,R=w==="map",$=k==="map";for(const H of y){const re=T.getTile(H),N=re.getBucket(x);if(!N||!N.text||!N.text.segments.get().length)continue;const te=h.evaluateSizeForZoom(N.textSizeData,B.zoom),ae=W(re,1,_.transform.zoom),pe=He(H.posMatrix,$,R,_.transform,ae),me=x.layout.get("icon-text-fit")!=="none"&&N.hasIconData();if(te){const xe=Math.pow(2,B.zoom-re.tileID.overscaledZ);No(N,R,$,O,B,pe,H.posMatrix,xe,te,me,_.style.map.terrain?(fe,Ce)=>_.style.map.terrain.getElevation(H,fe,Ce):null)}}}(a,o,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),c),n.paint.get("icon-opacity").constantOr(1)!==0&&zs(o,t,n,a,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),p,m),n.paint.get("text-opacity").constantOr(1)!==0&&zs(o,t,n,a,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),p,m),t.map.showCollisionBoxes&&(Vo(o,t,n,a,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Vo(o,t,n,a,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(o,t,n,a){if(o.renderPass!=="translucent")return;const c=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),y=!n.layout.get("circle-sort-key").isConstant();if(c.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const _=o.context,x=_.gl,T=o.depthModeForSublayer(0,rt.ReadOnly),w=Tt.disabled,k=o.colorModeForRenderPass(),O=[];for(let B=0;BB.sortKey-R.sortKey);for(const B of O){const{programConfiguration:R,program:$,layoutVertexBuffer:H,indexBuffer:re,uniformValues:N,terrainData:te}=B.state;$.draw(_,x.TRIANGLES,T,w,k,bt.disabled,N,te,n.id,H,re,B.segments,n.paint,o.transform.zoom,R)}},heatmap:function(o,t,n,a){if(n.paint.get("heatmap-opacity")!==0)if(o.renderPass==="offscreen"){const c=o.context,p=c.gl,m=Tt.disabled,y=new Ct([p.ONE,p.ONE],h.Color.transparent,[!0,!0,!0,!0]);(function(_,x,T){const w=_.gl;_.activeTexture.set(w.TEXTURE1),_.viewport.set([0,0,x.width/4,x.height/4]);let k=T.heatmapFbo;if(k)w.bindTexture(w.TEXTURE_2D,k.colorAttachment.get()),_.bindFramebuffer.set(k.framebuffer);else{const O=w.createTexture();w.bindTexture(w.TEXTURE_2D,O),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,w.CLAMP_TO_EDGE),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,w.CLAMP_TO_EDGE),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.LINEAR),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_MAG_FILTER,w.LINEAR),k=T.heatmapFbo=_.createFramebuffer(x.width/4,x.height/4,!1,!1),function(B,R,$,H){var re,N;const te=B.gl,ae=(re=B.HALF_FLOAT)!==null&&re!==void 0?re:te.UNSIGNED_BYTE,pe=(N=B.RGBA16F)!==null&&N!==void 0?N:te.RGBA;te.texImage2D(te.TEXTURE_2D,0,pe,R.width/4,R.height/4,0,te.RGBA,ae,null),H.colorAttachment.set($)}(_,x,O,k)}})(c,o,n),c.clear({color:h.Color.transparent});for(let _=0;_{const B=h.create();h.ortho(B,0,T.width,T.height,0,0,1);const R=T.context.gl;return{u_matrix:B,u_world:[R.drawingBufferWidth,R.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:w.paint.get("heatmap-opacity")}})(c,p),null,p.id,c.viewportBuffer,c.quadTriangleIndexBuffer,c.viewportSegments,p.paint,c.transform.zoom)}(o,n))},line:function(o,t,n,a){if(o.renderPass!=="translucent")return;const c=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(c.constantOr(1)===0||p.constantOr(1)===0)return;const m=o.depthModeForSublayer(0,rt.ReadOnly),y=o.colorModeForRenderPass(),_=n.paint.get("line-dasharray"),x=n.paint.get("line-pattern"),T=x.constantOr(1),w=n.paint.get("line-gradient"),k=n.getCrossfadeParameters(),O=T?"linePattern":_?"lineSDF":w?"lineGradient":"line",B=o.context,R=B.gl;let $=!0;for(const H of a){const re=t.getTile(H);if(T&&!re.patternsLoaded())continue;const N=re.getBucket(n);if(!N)continue;const te=N.programConfigurations.get(n.id),ae=o.context.program.get(),pe=o.useProgram(O,te),me=$||pe.program!==ae,xe=o.style.map.terrain&&o.style.map.terrain.getTerrainData(H),fe=x.constantOr(null);if(fe&&re.imageAtlas){const We=re.imageAtlas,Ee=We.patternPositions[fe.to.toString()],qe=We.patternPositions[fe.from.toString()];Ee&&qe&&te.setConstantPatternPositions(Ee,qe)}const Ce=xe?H:null,Ue=T?Gi(o,re,n,k,Ce):_?vs(o,re,n,_,k,Ce):w?xs(o,re,n,N.lineClipsArray.length,Ce):Er(o,re,n,Ce);if(T)B.activeTexture.set(R.TEXTURE0),re.imageAtlasTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),te.updatePaintBuffers(k);else if(_&&(me||o.lineAtlas.dirty))B.activeTexture.set(R.TEXTURE0),o.lineAtlas.bind(B);else if(w){const We=N.gradients[n.id];let Ee=We.texture;if(n.gradientVersion!==We.version){let qe=256;if(n.stepInterpolant){const ke=t.getSource().maxzoom,ct=H.canonical.z===ke?Math.ceil(1<256&&this.clearStencil(),a.setColorMode(Ct.disabled),a.setDepthMode(rt.disabled);const p=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const m of n){const y=this._tileClippingMaskIDs[m.key]=this.nextStencilID++,_=this.style.map.terrain&&this.style.map.terrain.getTerrainData(m);p.draw(a,c.TRIANGLES,rt.disabled,new Tt({func:c.ALWAYS,mask:0},y,255,c.KEEP,c.KEEP,c.REPLACE),Ct.disabled,bt.disabled,wa(m.posMatrix),_,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new Tt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new Tt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,a=t.sort((m,y)=>y.overscaledZ-m.overscaledZ),c=a[a.length-1].overscaledZ,p=a[0].overscaledZ-c+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let y=0;y=0;this.currentLayer--){const _=this.style._layers[a[this.currentLayer]],x=c[_.source],T=p[_.source];this._renderTileClippingMasks(_,T),this.renderLayer(this,x,_,T)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer$.source&&!$.isHidden(T)?[x.sourceCaches[$.source]]:[]),O=k.filter($=>$.getSource().type==="vector"),B=k.filter($=>$.getSource().type!=="vector"),R=$=>{(!w||w.getSource().maxzoom<$.getSource().maxzoom)&&(w=$)};return O.forEach($=>R($)),w||B.forEach($=>R($)),w}(this.style,this.transform.zoom);_&&Ua.debug(this,_,_.getVisibleCoordinates())}this.options.showPadding&&function(_){const x=_.transform.padding;rn(_,_.transform.height-(x.top||0),3,tn),rn(_,x.bottom||0,3,Xi),Qn(_,x.left||0,3,qo),Qn(_,_.transform.width-(x.right||0),3,Fa);const T=_.transform.centerPoint;(function(w,k,O,B){kn(w,k-1,O-10,2,20,B),kn(w,k-10,O-1,20,2,B)})(_,T.x,_.transform.height-T.y,jo)}(this),this.context.setDefault()}renderLayer(t,n,a,c){a.isHidden(this.transform.zoom)||(a.type==="background"||a.type==="custom"||(c||[]).length)&&(this.id=a.id,Ua[a.type](t,n,a,c,this.style.placement.variableOffsets))}translatePosMatrix(t,n,a,c,p){if(!a[0]&&!a[1])return t;const m=p?c==="map"?this.transform.angle:0:c==="viewport"?-this.transform.angle:0;if(m){const x=Math.sin(m),T=Math.cos(m);a=[a[0]*T-a[1]*x,a[0]*x+a[1]*T]}const y=[p?a[0]:W(n,a[0],this.transform.zoom),p?a[1]:W(n,a[1],this.transform.zoom),0],_=new Float32Array(16);return h.translate(_,t,y),_}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n){this.cache=this.cache||{};const a=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[a]||(this.cache[a]=new ys(this.context,t,Ur[t],n,Ta[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[a]}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(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new gt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Ds{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,a){const c=Math.pow(2,a),p=[[-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(y=>{const _=1/(y=h.transformMat4([],y,t))[3]/n*c;return h.mul$1(y,y,[_,_,1/y[3],_])}),m=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const _=function(k,O){var B=O[0],R=O[1],$=O[2],H=B*B+R*R+$*$;return H>0&&(H=1/Math.sqrt(H)),k[0]=O[0]*H,k[1]=O[1]*H,k[2]=O[2]*H,k}([],function(k,O,B){var R=O[0],$=O[1],H=O[2],re=B[0],N=B[1],te=B[2];return k[0]=$*te-H*N,k[1]=H*re-R*te,k[2]=R*N-$*re,k}([],fn([],p[y[0]],p[y[1]]),fn([],p[y[2]],p[y[1]]))),x=-((T=_)[0]*(w=p[y[1]])[0]+T[1]*w[1]+T[2]*w[2]);var T,w;return _.concat(x)});return new Ds(p,m)}}class lr{constructor(t,n){this.min=t,this.max=n,this.center=function(a,c,p){return a[0]=.5*c[0],a[1]=.5*c[1],a[2]=.5*c[2],a}([],function(a,c,p){return a[0]=c[0]+p[0],a[1]=c[1]+p[1],a[2]=c[2]+p[2],a}([],this.min,this.max))}quadrant(t){const n=[t%2==0,t<2],a=Wt(this.min),c=Wt(this.max);for(let p=0;p=0&&m++;if(m===0)return 0;m!==n.length&&(a=!1)}if(a)return 2;for(let c=0;c<3;c++){let p=Number.MAX_VALUE,m=-Number.MAX_VALUE;for(let y=0;ythis.max[c]-this.min[c])return 0}return 1}}class Ls{constructor(t=0,n=0,a=0,c=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(c)||c<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=a,this.right=c}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=h.interpolate.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=h.interpolate.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=h.interpolate.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=h.interpolate.number(t.right,n.right,a)),this}getCenter(t,n){const a=h.clamp((this.left+t-this.right)/2,0,t),c=h.clamp((this.top+n-this.bottom)/2,0,n);return new h.Point(a,c)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Ls(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Bs{constructor(t,n,a,c,p){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=p===void 0||!!p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=a??0,this._maxPitch=c??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new h.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ls,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new Bs(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.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,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){t===void 0?t=!0:t===null&&(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 h.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-h.wrap(t,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=function(){var a=new h.ARRAY_TYPE(4);return h.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0),a[0]=1,a[3]=1,a}(),function(a,c,p){var m=c[0],y=c[1],_=c[2],x=c[3],T=Math.sin(p),w=Math.cos(p);a[0]=m*w+_*T,a[1]=y*w+x*T,a[2]=m*-T+_*w,a[3]=y*-T+x*w}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=h.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(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 n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.tileZoom=Math.max(0,Math.floor(n)),this.scale=this.zoomScale(n),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,n,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new h.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const a=this.pointCoordinate(new h.Point(0,0)),c=this.pointCoordinate(new h.Point(this.width,0)),p=this.pointCoordinate(new h.Point(this.width,this.height)),m=this.pointCoordinate(new h.Point(0,this.height)),y=Math.floor(Math.min(a.x,c.x,p.x,m.x)),_=Math.floor(Math.max(a.x,c.x,p.x,m.x)),x=1;for(let T=y-x;T<=_+x;T++)T!==0&&n.push(new h.UnwrappedTileID(T,t))}return n}coveringTiles(t){var n,a;let c=this.coveringZoomLevel(t);const p=c;if(t.minzoom!==void 0&&ct.maxzoom&&(c=t.maxzoom);const m=this.pointCoordinate(this.getCameraPoint()),y=h.MercatorCoordinate.fromLngLat(this.center),_=Math.pow(2,c),x=[_*m.x,_*m.y,0],T=[_*y.x,_*y.y,0],w=Ds.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,c);let k=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(k=c);const O=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,B=N=>({aabb:new lr([N*_,0,0],[(N+1)*_,_,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),R=[],$=[],H=c,re=t.reparseOverscaled?p:c;if(this._renderWorldCopies)for(let N=1;N<=3;N++)R.push(B(-N)),R.push(B(N));for(R.push(B(0));R.length>0;){const N=R.pop(),te=N.x,ae=N.y;let pe=N.fullyVisible;if(!pe){const Ue=N.aabb.intersects(w);if(Ue===0)continue;pe=Ue===2}const me=t.terrain?x:T,xe=N.aabb.distanceX(me),fe=N.aabb.distanceY(me),Ce=Math.max(Math.abs(xe),Math.abs(fe));if(N.zoom===H||Ce>O+(1<=k){const Ue=H-N.zoom,We=x[0]-.5-(te<>1),qe=N.zoom+1;let ke=N.aabb.quadrant(Ue);if(t.terrain){const ct=new h.OverscaledTileID(qe,N.wrap,qe,We,Ee),Ot=t.terrain.getMinMaxElevation(ct),ht=(n=Ot.minElevation)!==null&&n!==void 0?n:this.elevation,Ke=(a=Ot.maxElevation)!==null&&a!==void 0?a:this.elevation;ke=new lr([ke.min[0],ke.min[1],ht],[ke.max[0],ke.max[1],Ke])}R.push({aabb:ke,zoom:qe,x:We,y:Ee,wrap:N.wrap,fullyVisible:pe})}}return $.sort((N,te)=>N.distanceSq-te.distanceSq).map(N=>N.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],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 n=h.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new h.Point(h.mercatorXfromLng(t.lng)*this.worldSize,h.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new h.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const a=h.MercatorCoordinate.fromLngLat(t.wrap()),c=(1<m&&(c=m-B)}if(this.lngRange){const O=(y+_)/2,B=h.wrap(w.x,O-this.worldSize/2,O+this.worldSize/2),R=x.x/2;B-R_&&(a=_-R)}a===void 0&&c===void 0||(this.center=this.unproject(new h.Point(a!==void 0?a:w.x,c!==void 0?c:w.y)).wrap()),this._unmodified=T,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,a=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=h.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let c=h.identity(new Float64Array(16));h.scale(c,c,[this.width/2,-this.height/2,1]),h.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=h.identity(new Float64Array(16)),h.scale(c,c,[1,-1,1]),h.translate(c,c,[-1,-1,0]),h.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const p=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,m=Math.PI/2+this._pitch,y=this._fov*(.5+t.y/this.height),_=Math.sin(y)*p/Math.sin(h.clamp(Math.PI-m-y,.01,Math.PI-.01)),x=this.getHorizon(),T=2*Math.atan(x/this.cameraToCenterDistance)*(.5+t.y/(2*x)),w=Math.sin(T)*p/Math.sin(h.clamp(Math.PI-m-T,.01,Math.PI-.01)),k=Math.min(_,w),O=1.01*(Math.cos(Math.PI/2-this._pitch)*k+p),B=this.height/50;c=new Float64Array(16),h.perspective(c,this._fov,this.width/this.height,B,O),c[8]=2*-t.x/this.width,c[9]=2*t.y/this.height,h.scale(c,c,[1,-1,1]),h.translate(c,c,[0,0,-this.cameraToCenterDistance]),h.rotateX(c,c,this._pitch),h.rotateZ(c,c,this.angle),h.translate(c,c,[-n,-a,0]),this.mercatorMatrix=h.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),h.scale(c,c,[1,1,this._pixelPerMeter]),this.pixelMatrix=h.multiply(new Float64Array(16),this.labelPlaneMatrix,c),h.translate(c,c,[0,0,-this.elevation]),this.projMatrix=c,this.invProjMatrix=h.invert([],c),this.pixelMatrix3D=h.multiply(new Float64Array(16),this.labelPlaneMatrix,c);const R=this.width%2/2,$=this.height%2/2,H=Math.cos(this.angle),re=Math.sin(this.angle),N=n-Math.round(n)+H*R+re*$,te=a-Math.round(a)+H*$+re*R,ae=new Float64Array(c);if(h.translate(ae,ae,[N>.5?N-1:N,te>.5?te-1:te,0]),this.alignedProjMatrix=ae,c=h.invert(new Float64Array(16),this.pixelMatrix),!c)throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new h.Point(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return h.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.Point(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let a=n.x,c=n.y,p=n.x,m=n.y;for(const y of t)a=Math.min(a,y.x),c=Math.min(c,y.y),p=Math.max(p,y.x),m=Math.max(m,y.y);return[new h.Point(a,c),new h.Point(p,c),new h.Point(p,m),new h.Point(a,m),new h.Point(a,c)]}}}class Xo{constructor(t){this._hashName=t&&encodeURIComponent(t),h.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,a){let c=!1,p=null;const m=()=>{p=null,c&&(n(),p=setTimeout(m,300),c=!1)};return()=>(c=!0,p||m(),p)}(this._updateHashUnthrottled.bind(this))}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()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,c=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,c),m=Math.round(n.lng*p)/p,y=Math.round(n.lat*p)/p,_=this._map.getBearing(),x=this._map.getPitch();let T="";if(T+=t?`/${m}/${y}/${a}`:`${a}/${y}/${m}`,(_||x)&&(T+="/"+Math.round(10*_)/10),x&&(T+=`/${Math.round(x)}`),this._hashName){const w=this._hashName;let k=!1;const O=window.location.hash.slice(1).split("&").map(B=>{const R=B.split("=")[0];return R===w?(k=!0,`${R}=${T}`):B}).filter(B=>B);return k||O.push(`${w}=${T}`),`#${O.join("&")}`}return`#${T}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(a=>a.split("=")).forEach(a=>{a[0]===this._hashName&&(n=a)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=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:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const es={linearity:.3,easing:h.bezier(0,0,.3,1)},Wo=h.extend({deceleration:2500,maxSpeed:1400},es),Ho=h.extend({deceleration:20,maxSpeed:1400},es),ts=h.extend({deceleration:1e3,maxSpeed:360},es),Ko=h.extend({deceleration:1e3,maxSpeed:90},es);class cr{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:h.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=h.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new h.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,c={};if(n.pan.mag()){const p=is(n.pan.mag(),a,h.extend({},Wo,t||{}));c.offset=n.pan.mult(p.amount/n.pan.mag()),c.center=this._map.transform.center,Wi(c,p)}if(n.zoom){const p=is(n.zoom,a,Ho);c.zoom=this._map.transform.zoom+p.amount,Wi(c,p)}if(n.bearing){const p=is(n.bearing,a,ts);c.bearing=this._map.transform.bearing+h.clamp(p.amount,-179,179),Wi(c,p)}if(n.pitch){const p=is(n.pitch,a,Ko);c.pitch=this._map.transform.pitch+p.amount,Wi(c,p)}if(c.zoom||c.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;c.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),h.extend(c,{noMoveStart:!0})}}function Wi(o,t){(!o.duration||o.durationn.unproject(_)),y=p.reduce((_,x,T,w)=>_.add(x.div(w.length)),new h.Point(0,0));super(t,{points:p,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:a}),this._defaultPrevented=!1}}class Jl extends h.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class Ql{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Jl(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new jt(t.type,this._map,t))}mouseup(t){this._map.fire(new jt(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new jt(t.type,this._map,t))}dblclick(t){return this._firePreventable(new jt(t.type,this._map,t))}mouseover(t){this._map.fire(new jt(t.type,this._map,t))}mouseout(t){this._map.fire(new jt(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Nr(t.type,this._map,t))}touchmove(t){this._map.fire(new Nr(t.type,this._map,t))}touchend(t){this._map.fire(new Nr(t.type,this._map,t))}touchcancel(t){this._map.fire(new Nr(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ec{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new jt(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new jt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new jt(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class zn{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(h.Point.convert(t),this._map.terrain)}}class rs{constructor(t,n){this._map=t,this._tr=new zn(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(Y.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)p.fitScreenCoordinates(a,c,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(Y.remove(this._box),this._box=null),Y.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new h.Event(t,{originalEvent:n}))}}function hr(o,t){if(o.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${o.length}, points ${t.length}`);const n={};for(let a=0;athis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=function(c){const p=new h.Point(0,0);for(const m of c)p._add(m);return p.div(c.length)}(n),this.touches=hr(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const c=hr(a,n);for(const p in this.touches){const m=c[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const c=!this.aborted&&this.centroid;if(this.reset(),c)return c}}}class Rs{constructor(t){this.singleTap=new De(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const c=this.singleTap.touchend(t,n,a);if(c){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(c)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=c,this.count===this.numTaps)return this.reset(),c}}}class ns{constructor(t){this._tr=new zn(t),this._zoomIn=new Rs({numTouches:1,numTaps:2}),this._zoomOut=new Rs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const c=this._zoomIn.touchend(t,n,a),p=this._zoomOut.touchend(t,n,a),m=this._tr;return c?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom+1,around:m.unproject(c)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:y=>y.easeTo({duration:300,zoom:m.zoom-1,around:m.unproject(p)},{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 Sr{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 n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=n.length?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const c=n.length?n[0]:n;return!this._moved&&c.dist(a){o.mousedown=o.dragStart,o.mousemoveWindow=o.dragMove,o.mouseup=o.dragEnd,o.contextmenu=function(t){t.preventDefault()}},Jo=({enable:o,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const a=new Ae({checkCorrectEvent:c=>Y.mouseButton(c)===0&&c.ctrlKey||Y.mouseButton(c)===2});return new Sr({clickTolerance:t,move:(c,p)=>({bearingDelta:(p.x-c.x)*n}),moveStateManager:a,enable:o,assignEvents:Va})},Os=({enable:o,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new Ae({checkCorrectEvent:c=>Y.mouseButton(c)===0&&c.ctrlKey||Y.mouseButton(c)===2});return new Sr({clickTolerance:t,move:(c,p)=>({pitchDelta:(p.y-c.y)*n}),moveStateManager:a,enable:o,assignEvents:Va})};class Qo{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new h.Point(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._map._cooperativeGestures&&(this._minTouches===2&&a.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,a.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(a.length0&&(this._active=!0);const c=hr(a,n),p=new h.Point(0,0),m=new h.Point(0,0);let y=0;for(const x in c){const T=c[x],w=this._touches[x];w&&(p._add(T),m._add(T.sub(w)),y++,c[x]=T)}if(this._touches=c,yMath.abs(o.x)}class Ii extends Us{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,ss(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const c=t[0].sub(this._lastPoints[0]),p=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(c,p,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(c.y+p.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const c=t.mag()>=2,p=n.mag()>=2;if(!c&&!p)return;if(!c||!p)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return ss(t)&&ss(n)&&m}}const $r={panStep:100,bearingStep:15,pitchStep:10};class tl{constructor(t){this._tr=new zn(t);const n=$r;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,a=0,c=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?c=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?c=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(a=0,c=0),{cameraAnimation:y=>{const _=this._tr;y.easeTo({duration:300,easeId:"keyboardHandler",easing:qa,zoom:n?Math.round(_.zoom)+n*(t.shiftKey?2:1):_.zoom,bearing:_.bearing+a*this._bearingStep,pitch:_.pitch+c*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:_.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 qa(o){return o*(2-o)}const $s=4.000244140625;class ja{constructor(t,n){this._map=t,this._tr=new zn(t),this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,h.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!t[this._map._metaKey])return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=h.exported.now(),c=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%$s==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":c>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(c*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=Y.mousePos(this._el,t),a=this._tr;this._around=h.LngLat.convert(this._aroundCenter?a.center:a.unproject(n)),this._aroundPoint=a.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const y=this._type==="wheel"&&Math.abs(this._delta)>$s?this._wheelZoomRate:this._defaultZoomRate;let _=2/(1+Math.exp(-Math.abs(this._delta*y)));this._delta<0&&_!==0&&(_=1/_);const x=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(x*_))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,a=this._startZoom,c=this._easing;let p,m=!1;if(this._type==="wheel"&&a&&c){const y=Math.min((h.exported.now()-this._lastWheelEventTime)/200,1),_=c(y);p=h.interpolate.number(a,n,_),y<1?this._frameId||(this._frameId=!0):m=!0}else p=n,m=!0;return this._active=!0,m&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!m,zoomDelta:p-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=h.ease;if(this._prevEase){const a=this._prevEase,c=(h.exported.now()-a.start)/a.duration,p=a.easing(c+.01)-a.easing(c),m=.27/Math.sqrt(p*p+1e-4)*.01,y=Math.sqrt(.0729-m*m);n=h.bezier(m,y,.25,1)}return this._prevEase={start:h.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class il{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 Hi{constructor(t){this._tr=new zn(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pt{constructor(){this._tap=new Rs({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,a){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=n[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(t,n,a))}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const c=n[0],p=c.y-this._swipePoint.y;return this._swipePoint=c,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){this._tapTime?this._swipePoint&&a.length===0&&this.reset():this._tap.touchend(t,n,a)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qs{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}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 Za{constructor(t,n,a){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=a}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 rl{constructor(t,n,a,c){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=c,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()}}const as=o=>o.zoom||o.drag||o.pitch||o.rotate;class nl extends h.Event{}function Ga(o){return o.panDelta&&o.panDelta.mag()||o.zoomDelta||o.bearingDelta||o.pitchDelta}class ur{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new cr(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),h.bindAll(["handleEvent","handleWindowEvent"],this);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[window,"blur",void 0]];for(const[c,p,m]of this._listeners)Y.addEventListener(c,p,c===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,a]of this._listeners)Y.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new Ql(n,t));const c=n.boxZoom=new rs(n,t);this._add("boxZoom",c);const p=new ns(n),m=new Hi(n);n.doubleClickZoom=new il(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new Pt;this._add("tapDragZoom",y);const _=n.touchPitch=new Ii(n);this._add("touchPitch",_);const x=Jo(t),T=Os(t);n.dragRotate=new Za(t,x,T),this._add("mouseRotate",x,["mousePitch"]),this._add("mousePitch",T,["mouseRotate"]);const w=(({enable:H,clickTolerance:re})=>{const N=new Ae({checkCorrectEvent:te=>Y.mouseButton(te)===0&&!te.ctrlKey});return new Sr({clickTolerance:re,move:(te,ae)=>({around:ae,panDelta:ae.sub(te)}),activateOnStart:!0,moveStateManager:N,enable:H,assignEvents:Va})})(t),k=new Qo(t,n);n.dragPan=new qs(a,w,k),this._add("mousePan",w),this._add("touchPan",k,["touchZoom","touchRotate"]);const O=new $a,B=new Na;n.touchZoomRotate=new rl(a,B,O,y),this._add("touchRotate",O,["touchPan","touchZoom"]),this._add("touchZoom",B,["touchPan","touchRotate"]);const R=n.scrollZoom=new ja(n,this);this._add("scrollZoom",R,["mousePan"]);const $=n.keyboard=new tl(n);this._add("keyboard",$),this._add("blockableMapEvent",new ec(n));for(const H of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[H]&&n[H].enable(t[H])}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.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!!as(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,a){for(const c in t)if(c!==a&&(!n||n.indexOf(c)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const a=t.type==="renderFrame"?void 0:t,c={needsRenderFrame:!1},p={},m={},y=t.touches,_=y?this._getMapTouches(y):void 0,x=_?Y.touchPos(this._el,_):Y.mousePos(this._el,t);for(const{handlerName:k,handler:O,allowed:B}of this._handlers){if(!O.isEnabled())continue;let R;this._blockedByActive(m,B,k)?O.reset():O[n||t.type]&&(R=O[n||t.type](t,x,_),this.mergeHandlerResult(c,p,R,k,a),R&&R.needsRenderFrame&&this._triggerRenderFrame()),(R||O.isActive())&&(m[k]=O)}const T={};for(const k in this._previousActiveHandlers)m[k]||(T[k]=a);this._previousActiveHandlers=m,(Object.keys(T).length||Ga(c))&&(this._changes.push([c,p,T]),this._triggerRenderFrame()),(Object.keys(m).length||Ga(c))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:w}=c;w&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],w(this._map))}mergeHandlerResult(t,n,a,c,p){if(!a)return;h.extend(t,a);const m={handlerName:c,originalEvent:a.originalEvent||p};a.zoomDelta!==void 0&&(n.zoom=m),a.panDelta!==void 0&&(n.drag=m),a.pitchDelta!==void 0&&(n.pitch=m),a.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},a={};for(const[c,p,m]of this._changes)c.panDelta&&(t.panDelta=(t.panDelta||new h.Point(0,0))._add(c.panDelta)),c.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+c.zoomDelta),c.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+c.bearingDelta),c.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+c.pitchDelta),c.around!==void 0&&(t.around=c.around),c.pinchAround!==void 0&&(t.pinchAround=c.pinchAround),c.noInertia&&(t.noInertia=c.noInertia),h.extend(n,p),h.extend(a,m);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const c=this._map,p=c._getTransformForUpdate(),m=c.terrain;if(!(Ga(t)||m&&this._terrainMovement))return this._fireEvents(n,a,!0);let{panDelta:y,zoomDelta:_,bearingDelta:x,pitchDelta:T,around:w,pinchAround:k}=t;k!==void 0&&(w=k),c._stop(!0),w=w||c.transform.centerPoint;const O=p.pointLocation(y?w.sub(y):w);x&&(p.bearing+=x),T&&(p.pitch+=T),_&&(p.zoom+=_),m?this._terrainMovement||!n.drag&&!n.zoom?n.drag&&this._terrainMovement?p.center=p.pointLocation(p.centerPoint.sub(y)):p.setLocationAtPoint(O,w):(this._terrainMovement=!0,p.freezeElevation=!0,p.setLocationAtPoint(O,w),this._map.once("moveend",()=>{p.freezeElevation=!1,this._terrainMovement=!1,p.recalculateZoom(c.terrain)})):p.setLocationAtPoint(O,w),c._applyUpdatedTransform(p),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_fireEvents(t,n,a){const c=as(this._eventsInProgress),p=as(t),m={};for(const T in t){const{originalEvent:w}=t[T];this._eventsInProgress[T]||(m[`${T}start`]=w),this._eventsInProgress[T]=t[T]}!c&&p&&this._fireEvent("movestart",p.originalEvent);for(const T in m)this._fireEvent(T,m[T]);p&&this._fireEvent("move",p.originalEvent);for(const T in t){const{originalEvent:w}=t[T];this._fireEvent(T,w)}const y={};let _;for(const T in this._eventsInProgress){const{handlerName:w,originalEvent:k}=this._eventsInProgress[T];this._handlersById[w].isActive()||(delete this._eventsInProgress[T],_=n[w]||k,y[`${T}end`]=_)}for(const T in y)this._fireEvent(T,y[T]);const x=as(this._eventsInProgress);if(a&&(c||p)&&!x){this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),w=k=>k!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new nl("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const js={extend:(o,...t)=>h.extend(o,...t),run(o){o()},logToElement(o,t=!1,n="log"){const a=window.document.getElementById(n);a&&(t&&(a.innerHTML=""),a.innerHTML+=`
    ${o}`)}};class Fe extends h.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,h.bindAll(["_renderFrameCallback"],this),this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new h.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,a){return t=h.Point.convert(t).mult(-1),this.panTo(this.transform.center,h.extend({offset:t},n),a)}panTo(t,n,a){return this.easeTo(h.extend({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(h.extend({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,a){return this.easeTo(h.extend({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,h.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(h.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing()){if(this._zooming&&(a.zoom=h.interpolate.number(c,_,pe)),this._rotating&&(a.bearing=h.interpolate.number(p,x,pe)),this._pitching&&(a.pitch=h.interpolate.number(m,T,pe)),this._padding&&(a.interpolatePadding(y,w,pe),O=a.centerPoint.add(k)),this.terrain&&!t.freezeElevation&&this._updateElevation(pe),N)a.setLocationAtPoint(N,te);else{const me=a.zoomScale(a.zoom-c),xe=_>c?Math.min(2,re):Math.max(.5,re),fe=Math.pow(xe,1-pe),Ce=a.unproject($.add(H.mult(pe*fe)).mult(me));a.setLocationAtPoint(a.renderWorldCopies?Ce.wrap():Ce,O)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},pe=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,pe)},t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new h.Event("movestart",t)),this._zooming&&!a.zooming&&this.fire(new h.Event("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new h.Event("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new h.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(t,this.terrain),this.transform.freezeElevation=!0}_updateElevation(t){const n=this.transform.getElevation(this._elevationCenter,this.terrain);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.elevation=h.interpolate.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;const n=t.clone(),{center:a,zoom:c,pitch:p,bearing:m,elevation:y}=this.transformCameraUpdate(n);a&&(n.center=a),c!==void 0&&(n.zoom=c),p!==void 0&&(n.pitch=p),m!==void 0&&(n.bearing=m),y!==void 0&&(n.elevation=y),this.transform.apply(n)}_fireMoveEvents(t){this.fire(new h.Event("move",t)),this._zooming&&this.fire(new h.Event("zoom",t)),this._rotating&&this.fire(new h.Event("rotate",t)),this._pitching&&this.fire(new h.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,c=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,a&&this.fire(new h.Event("zoomend",t)),c&&this.fire(new h.Event("rotateend",t)),p&&this.fire(new h.Event("pitchend",t)),this.fire(new h.Event("moveend",t))}flyTo(t,n){if(!t.essential&&h.exported.prefersReducedMotion){const ke=h.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(ke,n)}this.stop(),t=h.extend({offset:[0,0],speed:1.2,curve:1.42,easing:h.ease},t);const a=this._getTransformForUpdate(),c=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),_="zoom"in t?h.clamp(+t.zoom,a.minZoom,a.maxZoom):c,x="bearing"in t?this._normalizeBearing(t.bearing,p):p,T="pitch"in t?+t.pitch:m,w="padding"in t?t.padding:a.padding,k=a.zoomScale(_-c),O=h.Point.convert(t.offset);let B=a.centerPoint.add(O);const R=a.pointLocation(B),$=h.LngLat.convert(t.center||R);this._normalizeCenter($);const H=a.project(R),re=a.project($).sub(H);let N=t.curve;const te=Math.max(a.width,a.height),ae=te/k,pe=re.mag();if("minZoom"in t){const ke=h.clamp(Math.min(t.minZoom,c,_),a.minZoom,a.maxZoom),ct=te/a.zoomScale(ke-c);N=Math.sqrt(ct/pe*2)}const me=N*N;function xe(ke){const ct=(ae*ae-te*te+(ke?-1:1)*me*me*pe*pe)/(2*(ke?ae:te)*me*pe);return Math.log(Math.sqrt(ct*ct+1)-ct)}function fe(ke){return(Math.exp(ke)-Math.exp(-ke))/2}function Ce(ke){return(Math.exp(ke)+Math.exp(-ke))/2}const Ue=xe(0);let We=function(ke){return Ce(Ue)/Ce(Ue+N*ke)},Ee=function(ke){return te*((Ce(Ue)*(fe(ct=Ue+N*ke)/Ce(ct))-fe(Ue))/me)/pe;var ct},qe=(xe(1)-Ue)/N;if(Math.abs(pe)<1e-6||!isFinite(qe)){if(Math.abs(te-ae)<1e-6)return this.easeTo(t,n);const ke=aet.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=p!==x,this._pitching=T!==m,this._padding=!a.isPaddingEqual(w),this._prepareEase(n,!1),this.terrain&&this._prepareElevation($),this._ease(ke=>{const ct=ke*qe,Ot=1/We(ct);a.zoom=ke===1?_:c+a.scaleZoom(Ot),this._rotating&&(a.bearing=h.interpolate.number(p,x,ke)),this._pitching&&(a.pitch=h.interpolate.number(m,T,ke)),this._padding&&(a.interpolatePadding(y,w,ke),B=a.centerPoint.add(O)),this.terrain&&!t.freezeElevation&&this._updateElevation(ke);const ht=ke===1?$:a.unproject(H.add(re.mult(Ee(ct))).mult(Ot));a.setLocationAtPoint(a.renderWorldCopies?ht.wrap():ht,B),this._applyUpdatedTransform(a),this._fireMoveEvents(n)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(n)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const a=this._onEaseEnd;delete this._onEaseEnd,a.call(this,n)}if(!t){const a=this.handlers;a&&a.stop(!1)}return this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=h.exported.now(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((h.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=h.wrap(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)180?-360:a<-180?360:0}queryTerrainElevation(t){return this.terrain?this.transform.getElevation(h.LngLat.convert(t),this.terrain)-this.transform.elevation:null}}class $e{constructor(t={}){this.options=t,h.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=Y.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=Y.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Y.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(){Y.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,n){const a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_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")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(c=>typeof c!="string"?"":c)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const c=this._map.style.stylesheet;this.styleOwner=c.owner,this.styleId=c.id}const n=this._map.style.sourceCaches;for(const c in n){const p=n[c];if(p.used||p.usedForTerrain){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t=t.filter(c=>String(c).trim()),t.sort((c,p)=>c.length-p.length),t=t.filter((c,p)=>{for(let m=p+1;m=0)return!1;return!0});const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?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"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")}}class os{constructor(t={}){this.options=t,h.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=Y.create("div","maplibregl-ctrl");const n=Y.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){Y.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact"):n.classList.remove("maplibregl-compact")}}}class Xa{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;for(const c of a)if(c.id===t)return void(c.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Wa={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var Ai=h.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class sl extends h.Evented{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,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];const a={};for(const c of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))a[c.key]=!0,this._renderableTilesKeys.push(c.key),this._tiles[c.key]||(c.posMatrix=new Float64Array(16),h.ortho(c.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),this._tiles[c.key]=new Kr(c,this.tileSize));for(const c in this._tiles)a[c]||delete this._tiles[c]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const a of this._renderableTilesKeys){const c=this._tiles[a].tileID;if(c.canonical.equals(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16),h.ortho(p.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),n[a]=p}else if(c.canonical.isChildOf(t.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=c.canonical.z-t.canonical.z,y=c.canonical.x-(c.canonical.x>>m<>m<>m;h.ortho(p.posMatrix,0,x,0,x,0,1),h.translate(p.posMatrix,p.posMatrix,[-y*x,-_*x,0]),n[a]=p}else if(t.canonical.isChildOf(c.canonical)){const p=t.clone();p.posMatrix=new Float64Array(16);const m=t.canonical.z-c.canonical.z,y=t.canonical.x-(t.canonical.x>>m<>m<>m;h.ortho(p.posMatrix,0,h.EXTENT,0,h.EXTENT,0,1),h.translate(p.posMatrix,p.posMatrix,[y*x,_*x,0]),h.scale(p.posMatrix,p.posMatrix,[1/2**m,1/2**m,0]),n[a]=p}}return n}getSourceTile(t,n){const a=this.sourceCache._source;let c=t.overscaledZ-this.deltaZoom;if(c>a.maxzoom&&(c=a.maxzoom),c=a.minzoom&&(!p||!p.dem);)p=this.sourceCache.getTileByID(t.scaledTo(c--).key);return p}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeAdded>=t)}}class dr{constructor(t,n,a){this.painter=t,this.sourceCache=new sl(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,n,a,c=h.EXTENT){if(!(n>=0&&n=0&&at.canonical.z&&(t.canonical.z>=c?p=t.canonical.z-c:h.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const m=t.canonical.x-(t.canonical.x>>p<>p<>8<<4|p>>8,n[m+3]=0;const a=new h.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),c=new gt(t,a,t.gl.RGBA,{premultiply:!1});return c.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=c,c}pointCoordinate(t){const n=new Uint8Array(4),a=this.painter.context,c=a.gl;a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),c.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,c.RGBA,c.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const p=n[0]+(n[2]>>4<<8),m=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],_=y&&this.sourceCache.getTileByID(y);if(!_)return null;const x=this._coordsTextureSize,T=(1<<_.tileID.canonical.z)*x;return new h.MercatorCoordinate((_.tileID.canonical.x*x+p)/T,(_.tileID.canonical.y*x+m)/T,this.getElevation(_.tileID,p,m,x))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.painter.context,n=new h.Pos3dArray,a=new h.TriangleIndexArray,c=this.meshSize,p=h.EXTENT/c,m=c*c;for(let w=0;w<=c;w++)for(let k=0;k<=c;k++)n.emplaceBack(k*p,w*p,0);for(let w=0;wt.id!==n),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];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)===!1}}const Ir={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Dt{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new tc(t.context,30,n.sourceCache.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(a=>!t._layers[a].isHidden(n)),this._coordsDescendingInv={};for(const a in t.sourceCaches){this._coordsDescendingInv[a]={};const c=t.sourceCaches[a].getVisibleCoordinates();for(const p of c){const m=this.terrain.sourceCache.getTerrainCoords(p);for(const y in m)this._coordsDescendingInv[a][y]||(this._coordsDescendingInv[a][y]=[]),this._coordsDescendingInv[a][y].push(m[y])}}this._coordsDescendingInvStr={};for(const a of t._order){const c=t._layers[a],p=c.source;if(Ir[c.type]&&!this._coordsDescendingInvStr[p]){this._coordsDescendingInvStr[p]={};for(const m in this._coordsDescendingInv[p])this._coordsDescendingInvStr[p][m]=this._coordsDescendingInv[p][m].map(y=>y.key).sort().join()}}for(const a of this._renderableTiles)for(const c in this._coordsDescendingInvStr){const p=this._coordsDescendingInvStr[c][a.tileID.key];p&&p!==a.rttCoords[c]&&(a.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const n=t.type,a=this.painter,c=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Ir[n]&&(this._prevType&&Ir[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!c))return!0;if(Ir[this._prevType]||Ir[n]&&c){this._prevType=n;const p=this._stacks.length-1,m=this._stacks[p]||[];for(const y of this._renderableTiles){if(this.pool.isFull()&&(Oa(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(y),y.rtt[p]){const x=this.pool.getObjectForId(y.rtt[p].id);if(x.stamp===y.rtt[p].stamp){this.pool.useObject(x);continue}}const _=this.pool.getOrCreateFreeObject();this.pool.useObject(_),this.pool.stampObject(_),y.rtt[p]={id:_.id,stamp:_.stamp},a.context.bindFramebuffer.set(_.fbo.framebuffer),a.context.clear({color:h.Color.transparent,stencil:0}),a.currentStencilSource=void 0;for(let x=0;x{o.touchstart=o.dragStart,o.touchmoveWindow=o.dragMove,o.touchend=o.dragEnd},Zs={showCompass:!0,showZoom:!0,visualizePitch:!1};class Ha{constructor(t,n,a=!1){this._clickTolerance=10;const c=t.dragRotate._mouseRotate.getClickTolerance(),p=t.dragRotate._mousePitch.getClickTolerance();this.element=n,this.mouseRotate=Jo({clickTolerance:c,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:y,bearingDegreesPerPixelMoved:_=.8})=>{const x=new Fs;return new Sr({clickTolerance:y,move:(T,w)=>({bearingDelta:(w.x-T.x)*_}),moveStateManager:x,enable:m,assignEvents:Dn})})({clickTolerance:c,enable:!0}),this.map=t,a&&(this.mousePitch=Os({clickTolerance:p,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:y,pitchDegreesPerPixelMoved:_=-.5})=>{const x=new Fs;return new Sr({clickTolerance:y,move:(T,w)=>({pitchDelta:(w.y-T.y)*_}),moveStateManager:x,enable:m,assignEvents:Dn})})({clickTolerance:p,enable:!0})),h.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),Y.addEventListener(n,"mousedown",this.mousedown),Y.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),Y.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),Y.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),Y.disableDrag()}moveMouse(t,n){const a=this.map,{bearingDelta:c}=this.mouseRotate.dragMove(t,n)||{};if(c&&a.setBearing(a.getBearing()+c),this.mousePitch){const{pitchDelta:p}=this.mousePitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}moveTouch(t,n){const a=this.map,{bearingDelta:c}=this.touchRotate.dragMove(t,n)||{};if(c&&a.setBearing(a.getBearing()+c),this.touchPitch){const{pitchDelta:p}=this.touchPitch.dragMove(t,n)||{};p&&a.setPitch(a.getPitch()+p)}}off(){const t=this.element;Y.removeEventListener(t,"mousedown",this.mousedown),Y.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),Y.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),Y.removeEventListener(window,"touchend",this.touchend),Y.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){Y.enableDrag(),Y.removeEventListener(window,"mousemove",this.mousemove),Y.removeEventListener(window,"mouseup",this.mouseup),Y.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),Y.removeEventListener(window,"touchend",this.touchend)}mousedown(t){this.startMouse(h.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),Y.mousePos(this.element,t)),Y.addEventListener(window,"mousemove",this.mousemove),Y.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.moveMouse(t,Y.mousePos(this.element,t))}mouseup(t){this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Y.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),Y.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),Y.addEventListener(window,"touchend",this.touchend))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=Y.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)180;){const a=n.locationPoint(o);if(a.x>=0&&a.y>=0&&a.x<=n.width&&a.y<=n.height)break;o.lng>n.center.lng?o.lng-=360:o.lng+=360}return o}const nn={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 Xs(o,t,n){const a=o.classList;for(const c in nn)a.remove(`maplibregl-${n}-anchor-${c}`);a.add(`maplibregl-${n}-anchor-${t}`)}class ls extends h.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=h.extend({element:t},n)),h.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=h.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=Y.create("div"),this._element.setAttribute("aria-label","Map marker");const a=Y.createNS("http://www.w3.org/2000/svg","svg"),c=41,p=27;a.setAttributeNS(null,"display","block"),a.setAttributeNS(null,"height",`${c}px`),a.setAttributeNS(null,"width",`${p}px`),a.setAttributeNS(null,"viewBox",`0 0 ${p} ${c}`);const m=Y.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"stroke","none"),m.setAttributeNS(null,"stroke-width","1"),m.setAttributeNS(null,"fill","none"),m.setAttributeNS(null,"fill-rule","evenodd");const y=Y.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill-rule","nonzero");const _=Y.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{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 re of x){const N=Y.createNS("http://www.w3.org/2000/svg","ellipse");N.setAttributeNS(null,"opacity","0.04"),N.setAttributeNS(null,"cx","10.5"),N.setAttributeNS(null,"cy","5.80029008"),N.setAttributeNS(null,"rx",re.rx),N.setAttributeNS(null,"ry",re.ry),_.appendChild(N)}const T=Y.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const w=Y.createNS("http://www.w3.org/2000/svg","path");w.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"),T.appendChild(w);const k=Y.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"opacity","0.25"),k.setAttributeNS(null,"fill","#000000");const O=Y.createNS("http://www.w3.org/2000/svg","path");O.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"),k.appendChild(O);const B=Y.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const R=Y.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(8.0, 8.0)");const $=Y.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#000000"),$.setAttributeNS(null,"opacity","0.25"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962");const H=Y.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#FFFFFF"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962"),R.appendChild($),R.appendChild(H),y.appendChild(_),y.appendChild(T),y.appendChild(k),y.appendChild(B),y.appendChild(R),a.appendChild(y),a.setAttributeNS(null,"height",c*this._scale+"px"),a.setAttributeNS(null,"width",p*this._scale+"px"),this._element.appendChild(a),this._offset=h.Point.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",a=>{a.preventDefault()}),this._element.addEventListener("mousedown",a=>{a.preventDefault()}),Xs(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),Y.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=h.LngLat.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 c=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[c,-1*(38.1-13.5+c)],"bottom-right":[-c,-1*(38.1-13.5+c)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,a=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&a!==32&&a!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,a=this._element;this._popup&&(n===a||a.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Gs(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?a="rotateX(0deg)":this._pitchAlignment==="map"&&(a=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),Y.setTransform(this._element,`${nn[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${n}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const c=this._map.unproject(this._pos),p=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=c.distanceTo(this._lngLat)>20*p?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=h.Point.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}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",this._state==="pending"&&(this._state="active",this.fire(new h.Event("dragstart"))),this.fire(new h.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new h.Event("dragend")),this._state="inactive"}_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))}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&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ka={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ln=0,sn=!1;const Ya={maxWidth:100,unit:"metric"};function Ws(o,t,n){const a=n&&n.maxWidth||100,c=o._container.clientHeight/2,p=o.unproject([0,c]),m=o.unproject([a,c]),y=p.distanceTo(m);if(n&&n.unit==="imperial"){const _=3.2808*y;_>5280?an(t,a,_/5280,o._getUIString("ScaleControl.Miles")):an(t,a,_,o._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?an(t,a,y/1852,o._getUIString("ScaleControl.NauticalMiles")):y>=1e3?an(t,a,y/1e3,o._getUIString("ScaleControl.Kilometers")):an(t,a,y,o._getUIString("ScaleControl.Meters"))}function an(o,t,n,a){const c=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let y=p/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(_){const x=Math.pow(10,Math.ceil(-Math.log(_)/Math.LN10));return Math.round(_*x)/x}(y),m*y}(n);o.style.width=t*(c/n)+"px",o.innerHTML=`${c} ${a}`}const Hs={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Ja=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ks(o){if(o){if(typeof o=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(o,2)));return{center:new h.Point(0,0),top:new h.Point(0,o),"top-left":new h.Point(t,t),"top-right":new h.Point(-t,t),bottom:new h.Point(0,-o),"bottom-left":new h.Point(t,-t),"bottom-right":new h.Point(-t,-t),left:new h.Point(o,0),right:new h.Point(-o,0)}}if(o instanceof h.Point||Array.isArray(o)){const t=h.Point.convert(o);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:h.Point.convert(o.center||[0,0]),top:h.Point.convert(o.top||[0,0]),"top-left":h.Point.convert(o["top-left"]||[0,0]),"top-right":h.Point.convert(o["top-right"]||[0,0]),bottom:h.Point.convert(o.bottom||[0,0]),"bottom-left":h.Point.convert(o["bottom-left"]||[0,0]),"bottom-right":h.Point.convert(o["bottom-right"]||[0,0]),left:h.Point.convert(o.left||[0,0]),right:h.Point.convert(o.right||[0,0])}}return Ks(new h.Point(0,0))}const Ys=_e,Js={setRTLTextPlugin:h.setRTLTextPlugin,getRTLTextPluginStatus:h.getRTLTextPluginStatus,Map:class extends Fe{constructor(o){var t;if(h.PerformanceUtils.mark(h.PerformanceMarkers.create),(o=h.extend({},al,o)).minZoom!=null&&o.maxZoom!=null&&o.minZoom>o.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(o.minPitch!=null&&o.maxPitch!=null&&o.minPitch>o.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(o.minPitch!=null&&o.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(o.maxPitch!=null&&o.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Bs(o.minZoom,o.maxZoom,o.minPitch,o.maxPitch,o.renderWorldCopies),{bearingSnap:o.bearingSnap}),this._interactive=o.interactive,this._cooperativeGestures=o.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=o.maxTileCacheSize,this._maxTileCacheZoomLevels=o.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=o.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=o.preserveDrawingBuffer,this._antialias=o.antialias,this._trackResize=o.trackResize,this._bearingSnap=o.bearingSnap,this._refreshExpiredTiles=o.refreshExpiredTiles,this._fadeDuration=o.fadeDuration,this._crossSourceCollisions=o.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=o.collectResourceTiming,this._renderTaskQueue=new Xa,this._controls=[],this._mapId=h.uniqueId(),this._locale=h.extend({},Wa,o.locale),this._clickTolerance=o.clickTolerance,this._pixelRatio=(t=o.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this.transformCameraUpdate=o.transformCameraUpdate,this._imageQueueHandle=Qt.addThrottleControl(()=>this.isMoving()),this._requestManager=new mt(o.transformRequest),typeof o.container=="string"){if(this._container=document.getElementById(o.container),!this._container)throw new Error(`Container '${o.container}' not found.`)}else{if(!(o.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=o.container}if(o.maxBounds&&this.setMaxBounds(o.maxBounds),h.bindAll(["_onWindowOnline","_onMapScroll","_cooperativeGesturesOnWheel","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let n=!1;this._resizeObserver=new ResizeObserver(a=>{n?this._trackResize&&this.resize(a)._update():n=!0}),this._resizeObserver.observe(this._container)}this.handlers=new ur(this,o),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=o.hash&&new Xo(typeof o.hash=="string"&&o.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch}),o.bounds&&(this.resize(),this.fitBounds(o.bounds,h.extend({},o.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=o.localIdeographFontFamily,this._validateStyle=o.validateStyle,o.style&&this.setStyle(o.style,{localIdeographFontFamily:o.localIdeographFontFamily}),o.attributionControl&&this.addControl(new $e({customAttribution:o.customAttribution})),o.maplibreLogo&&this.addControl(new os,o.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new h.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new h.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new h.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(o,t){if(t===void 0&&(t=o.getDefaultPosition?o.getDefaultPosition():"top-right"),!o||!o.onAdd)return this.fire(new h.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=o.onAdd(this);this._controls.push(o);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(o){if(!o||!o.onRemove)return this.fire(new h.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(o);return t>-1&&this._controls.splice(t,1),o.onRemove(this),this}hasControl(o){return this._controls.indexOf(o)>-1}calculateCameraOptionsFromTo(o,t,n,a){return a==null&&this.terrain&&(a=this.transform.getElevation(n,this.terrain)),super.calculateCameraOptionsFromTo(o,t,n,a)}resize(o){var t;const n=this._containerDimensions(),a=n[0],c=n[1];this._resizeCanvas(a,c,this.getPixelRatio()),this.transform.resize(a,c),(t=this._requestedCameraState)===null||t===void 0||t.resize(a,c),this.painter.resize(a,c,this.getPixelRatio());const p=!this._moving;return p&&(this.stop(),this.fire(new h.Event("movestart",o)).fire(new h.Event("move",o))),this.fire(new h.Event("resize",o)),p&&this.fire(new h.Event("moveend",o)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(o){const[t,n]=this._containerDimensions();this._pixelRatio=o,this._resizeCanvas(t,n,o),this.painter.resize(t,n,o)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(o){return this.transform.setMaxBounds(si.convert(o)),this._update()}setMinZoom(o){if((o=o??-2)>=-2&&o<=this.transform.maxZoom)return this.transform.minZoom=o,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=o,this._update(),this.getZoom()>o&&this.setZoom(o),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(o){if((o=o??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(o>=0&&o<=this.transform.maxPitch)return this.transform.minPitch=o,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(o>=this.transform.minPitch)return this.transform.maxPitch=o,this._update(),this.getPitch()>o&&this.setPitch(o),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(o){return this.transform.renderWorldCopies=o,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(o){return this._cooperativeGestures=o,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(o){return this.transform.locationPoint(h.LngLat.convert(o),this.style&&this.terrain)}unproject(o){return this.transform.pointLocation(h.Point.convert(o),this.terrain)}isMoving(){var o;return this._moving||((o=this.handlers)===null||o===void 0?void 0:o.isMoving())}isZooming(){var o;return this._zooming||((o=this.handlers)===null||o===void 0?void 0:o.isZooming())}isRotating(){var o;return this._rotating||((o=this.handlers)===null||o===void 0?void 0:o.isRotating())}_createDelegatedListener(o,t,n){if(o==="mouseenter"||o==="mouseover"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:p=>{const m=this.getLayer(t)?this.queryRenderedFeatures(p.point,{layers:[t]}):[];m.length?a||(a=!0,n.call(this,new jt(o,this,p.originalEvent,{features:m}))):a=!1},mouseout:()=>{a=!1}}}}if(o==="mouseleave"||o==="mouseout"){let a=!1;return{layer:t,listener:n,delegates:{mousemove:m=>{(this.getLayer(t)?this.queryRenderedFeatures(m.point,{layers:[t]}):[]).length?a=!0:a&&(a=!1,n.call(this,new jt(o,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new jt(o,this,m.originalEvent)))}}}}{const a=c=>{const p=this.getLayer(t)?this.queryRenderedFeatures(c.point,{layers:[t]}):[];p.length&&(c.features=p,n.call(this,c),delete c.features)};return{layer:t,listener:n,delegates:{[o]:a}}}}on(o,t,n){if(n===void 0)return super.on(o,t);const a=this._createDelegatedListener(o,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[o]=this._delegatedListeners[o]||[],this._delegatedListeners[o].push(a);for(const c in a.delegates)this.on(c,a.delegates[c]);return this}once(o,t,n){if(n===void 0)return super.once(o,t);const a=this._createDelegatedListener(o,t,n);for(const c in a.delegates)this.once(c,a.delegates[c]);return this}off(o,t,n){return n===void 0?super.off(o,t):(this._delegatedListeners&&this._delegatedListeners[o]&&(a=>{const c=this._delegatedListeners[o];for(let p=0;pthis._updateStyle(o,t));const n=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!o)),o?(this.style=new li(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof o=="string"?this.style.loadURL(o,t,n):this.style.loadJSON(o,t,n),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new li(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(o,t){if(typeof o=="string"){const n=this._requestManager.transformRequest(o,nt.Style);h.getJSON(n,(a,c)=>{a?this.fire(new h.ErrorEvent(a)):c&&this._updateDiff(c,t)})}else typeof o=="object"&&this._updateDiff(o,t)}_updateDiff(o,t){try{this.style.setState(o,t)&&this._update(!0)}catch(n){h.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(o,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():h.warnOnce("There is no style added to the map.")}addSource(o,t){return this._lazyInitEmptyStyle(),this.style.addSource(o,t),this._update(!0)}isSourceLoaded(o){const t=this.style&&this.style.sourceCaches[o];if(t!==void 0)return t.loaded();this.fire(new h.ErrorEvent(new Error(`There is no source with ID '${o}'`)))}setTerrain(o){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),o){const t=this.style.sourceCaches[o.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${o.source}`);for(const n in this.style._layers){const a=this.style._layers[n];a.type==="hillshade"&&a.source===o.source&&h.warnOnce("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 dr(this.painter,t,o),this.painter.renderToTexture=new Dt(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId===o.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(n.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.updateElevation(this.terrain);return this.fire(new h.Event("terrain",{terrain:o})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){const o=this.style&&this.style.sourceCaches;for(const t in o){const n=o[t]._tiles;for(const a in n){const c=n[a];if(c.state!=="loaded"&&c.state!=="errored")return!1}}return!0}addSourceType(o,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(o,t,n)}removeSource(o){return this.style.removeSource(o),this._update(!0)}getSource(o){return this.style.getSource(o)}addImage(o,t,{pixelRatio:n=1,sdf:a=!1,stretchX:c,stretchY:p,content:m}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||h.isImageBitmap(t)){const{width:y,height:_,data:x}=h.exported.getImageData(t);this.style.addImage(o,{data:new h.RGBAImage({width:y,height:_},x),pixelRatio:n,stretchX:c,stretchY:p,content:m,sdf:a,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new h.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:y,height:_,data:x}=t,T=t;this.style.addImage(o,{data:new h.RGBAImage({width:y,height:_},new Uint8Array(x)),pixelRatio:n,stretchX:c,stretchY:p,content:m,sdf:a,version:0,userImage:T}),T.onAdd&&T.onAdd(this,o)}}}updateImage(o,t){const n=this.style.getImage(o);if(!n)return this.fire(new h.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const a=t instanceof HTMLImageElement||h.isImageBitmap(t)?h.exported.getImageData(t):t,{width:c,height:p,data:m}=a;if(c===void 0||p===void 0)return this.fire(new h.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(c!==n.data.width||p!==n.data.height)return this.fire(new h.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||h.isImageBitmap(t));n.data.replace(m,y),this.style.updateImage(o,n)}getImage(o){return this.style.getImage(o)}hasImage(o){return o?!!this.style.getImage(o):(this.fire(new h.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(o){this.style.removeImage(o)}loadImage(o,t){Qt.getImage(this._requestManager.transformRequest(o,nt.Image),t)}listImages(){return this.style.listImages()}addLayer(o,t){return this._lazyInitEmptyStyle(),this.style.addLayer(o,t),this._update(!0)}moveLayer(o,t){return this.style.moveLayer(o,t),this._update(!0)}removeLayer(o){return this.style.removeLayer(o),this._update(!0)}getLayer(o){return this.style.getLayer(o)}setLayerZoomRange(o,t,n){return this.style.setLayerZoomRange(o,t,n),this._update(!0)}setFilter(o,t,n={}){return this.style.setFilter(o,t,n),this._update(!0)}getFilter(o){return this.style.getFilter(o)}setPaintProperty(o,t,n,a={}){return this.style.setPaintProperty(o,t,n,a),this._update(!0)}getPaintProperty(o,t){return this.style.getPaintProperty(o,t)}setLayoutProperty(o,t,n,a={}){return this.style.setLayoutProperty(o,t,n,a),this._update(!0)}getLayoutProperty(o,t){return this.style.getLayoutProperty(o,t)}setGlyphs(o,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(o,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(o,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(o,t,n,a=>{a||this._update(!0)}),this}removeSprite(o){return this._lazyInitEmptyStyle(),this.style.removeSprite(o),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(o,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(o,t,n=>{n||this._update(!0)}),this}setLight(o,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(o,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(o,t){return this.style.setFeatureState(o,t),this._update()}removeFeatureState(o,t){return this.style.removeFeatureState(o,t),this._update()}getFeatureState(o){return this.style.getFeatureState(o)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let o=0,t=0;return this._container&&(o=this._container.clientWidth||400,t=this._container.clientHeight||300),[o,t]}_setupContainer(){const o=this._container;o.classList.add("maplibregl-map");const t=this._canvasContainer=Y.create("div","maplibregl-canvas-container",o);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=Y.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const a=this._controlContainer=Y.create("div","maplibregl-control-container",o),c=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{c[p]=Y.create("div",`maplibregl-ctrl-${p} `,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_cooperativeGesturesOnWheel(o){this._onCooperativeGesture(o,o[this._metaKey],1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=Y.create("div","maplibregl-cooperative-gesture-screen",this._container);let o=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(o=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
    ${o}
    ${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
    - `,this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){Y.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(o,t,n){this._canvas.width=n*o,this._canvas.height=n*t,this._canvas.style.width=`${o}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const o={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:o},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl2",o)||this._canvas.getContext("webgl",o);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new Go(n,this.transform),Qe.testSupport(n)}_contextLost(o){o.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new h.Event("webglcontextlost",{originalEvent:o}))}_contextRestored(o){this._setupPainter(),this.resize(),this._update(),this.fire(new h.Event("webglcontextrestored",{originalEvent:o}))}_onMapScroll(o){if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(o,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(o){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||o,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(o){return this._update(),this._renderTaskQueue.add(o)}_cancelRenderFrame(o){this._renderTaskQueue.remove(o)}_render(o){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(o),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const c=this.transform.zoom,p=h.exported.now();this.style.zoomHistory.update(c,p);const m=new h.EvaluationParameters(c,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=m.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new h.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,h.PerformanceUtils.mark(h.PerformanceMarkers.load),this.fire(new h.Event("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new h.Event("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,h.PerformanceUtils.mark(h.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var o;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Qt.removeThrottleControl(this._imageQueueHandle),(o=this._resizeObserver)===null||o===void 0||o.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),Y.remove(this._canvasContainer),Y.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),h.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new h.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=h.exported.frame(o=>{h.PerformanceUtils.frame(o),this._frame=null,this._render(o)}))}_onWindowOnline(){this._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(o){this._showTileBoundaries!==o&&(this._showTileBoundaries=o,this._update())}get showPadding(){return!!this._showPadding}set showPadding(o){this._showPadding!==o&&(this._showPadding=o,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(o){this._showCollisionBoxes!==o&&(this._showCollisionBoxes=o,o?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(o){this._showOverdrawInspector!==o&&(this._showOverdrawInspector=o,this._update())}get repaint(){return!!this._repaint}set repaint(o){this._repaint!==o&&(this._repaint=o,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(o){this._vertices=o,this._update()}get version(){return Zt}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(o){this.options=h.extend({},Zs,o),this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(h.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),Y.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})),Y.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(h.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=Y.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const o=this._map.getZoom(),t=o===this._map.getMaxZoom(),n=o===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const o=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=o}onAdd(o){return this._map=o,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 Ha(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){Y.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(o,t){const n=Y.create("button",o,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(o,t){const n=this._map._getUIString(`NavigationControl.${t}`);o.title=n,o.setAttribute("aria-label",n)}},GeolocateControl:class extends h.Evented{constructor(o){super(),this.options=h.extend({},Ka,o),h.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(o){return this._map=o,this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,n=!1){pr===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(a=>{pr=a.state!=="denied",t(pr)}).catch(()=>{pr=!!window.navigator.geolocation,t(pr)}):(pr=!!window.navigator.geolocation,t(pr)):t(pr)}(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(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(),Y.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ln=0,sn=!1}_isOutOfMapMaxBounds(o){const t=this._map.getMaxBounds(),n=o.coords;return t&&(n.longitudet.getEast()||n.latitudet.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}`)}}_onSuccess(o){if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new h.Event("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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&&this._watchState!=="OFF"&&this._updateMarker(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new h.Event("geolocate",o)),this._finish()}}_updateCamera(o){const t=new h.LngLat(o.coords.longitude,o.coords.latitude),n=o.coords.accuracy,a=this._map.getBearing(),c=h.extend({bearing:a},this.options.fitBoundsOptions),p=si.fromLngLat(t,n);this._map.fitBounds(p,c,{geolocateSource:!0})}_updateMarker(o){if(o){const t=new h.LngLat(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=o.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const o=this._map.getBounds(),t=o.getSouthEast(),n=o.getNorthEast(),a=t.distanceTo(n),c=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${c}px`,this._circleElement.style.height=`${c}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(o){if(this._map){if(this.options.trackUserLocation)if(o.code===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._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&sn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new h.Event("error",o)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(o){if(this._map){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Y.create("button","maplibregl-ctrl-geolocate",this._container),Y.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){h.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");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=Y.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new os(this._dotElement),this._circleElement=Y.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new os({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new h.Event("trackuserlocationend")))})}}trigger(){if(!this._setup)return h.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new h.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ln--,sn=!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 h.Event("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 h.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),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(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let o;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ln++,Ln>1?(o={maximumAge:6e5,timeout:0},sn=!0):(o=this.options.positionOptions,sn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,o)}}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)}},AttributionControl:$e,LogoControl:as,ScaleControl:class{constructor(o){this.options=h.extend({},Ya,o),h.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Ws(this._map,this._container,this.options)}onAdd(o){return this._map=o,this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-scale",o.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){Y.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(o){this.options.unit=o,Ws(this._map,this._container,this.options)}},FullscreenControl:class extends h.Evented{constructor(o={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,o&&o.container&&(o.container instanceof HTMLElement?this._container=o.container:h.warnOnce("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(o){return this._map=o,this._container||(this._container=this._map.getContainer()),this._controlContainer=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){Y.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const o=this._fullscreenButton=Y.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);Y.create("span","maplibregl-ctrl-icon",o).setAttribute("aria-hidden","true"),o.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const o=this._getTitle();this._fullscreenButton.setAttribute("aria-label",o),this._fullscreenButton.title=o}_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 h.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new h.Event("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},TerrainControl:class{constructor(o){this.options=o,h.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(o){return this._map=o,this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=Y.create("button","maplibregl-ctrl-terrain",this._container),Y.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(){Y.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),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.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends h.Evented{constructor(o){super(),this.options=h.extend(Object.create(Hs),o),h.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(o){return this._map&&this.remove(),this._map=o,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 h.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&Y.remove(this._content),this._container&&(Y.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new h.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=h.LngLat.convert(o),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(o){return this.setDOMContent(document.createTextNode(o))}setHTML(o){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=o;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(o){return this.options.maxWidth=o,this._update(),this}setDOMContent(o){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=Y.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(o),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(o){this._container&&this._container.classList.add(o)}removeClassName(o){this._container&&this._container.classList.remove(o)}setOffset(o){return this.options.offset=o,this._update(),this}toggleClassName(o){if(this._container)return this._container.classList.toggle(o)}_createCloseButton(){this.options.closeButton&&(this._closeButton=Y.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(o){this._update(o.point)}_onMouseMove(o){this._update(o.point)}_onDrag(o){this._update(o.point)}_update(o){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=Y.create("div","maplibregl-popup",this._map.getContainer()),this._tip=Y.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(p=>this._container.classList.add(p)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Gs(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!o))return;const t=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);let n=this.options.anchor;const a=Ks(this.options.offset);if(!n){const p=this._container.offsetWidth,m=this._container.offsetHeight;let y;y=t.y+a.bottom.ythis._map.transform.height-m?["bottom"]:[],t.x

    this._map.transform.width-p/2&&y.push("right"),n=y.length===0?"bottom":y.join("-")}const c=t.add(a[n]).round();Y.setTransform(this._container,`${nn[n]} translate(${c.x}px,${c.y}px)`),Xs(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const o=this._container.querySelector(Ja);o&&o.focus()}_onClose(){this.remove()}},Marker:os,Style:li,LngLat:h.LngLat,LngLatBounds:si,Point:h.Point,MercatorCoordinate:h.MercatorCoordinate,Evented:h.Evented,AJAXError:h.AJAXError,config:h.config,CanvasSource:le,GeoJSONSource:xr,ImageSource:ji,RasterDEMTileSource:Lr,RasterTileSource:Hr,VectorTileSource:yn,VideoSource:xn,prewarm:function(){bn().acquire(Jr)},clearPrewarmedResources:function(){const o=hi;o&&(o.isPreloaded()&&o.numActive()===1?(o.release(Jr),hi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return Ys},get workerCount(){return be.workerCount},set workerCount(o){be.workerCount=o},get maxParallelImageRequests(){return h.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(o){h.config.MAX_PARALLEL_IMAGE_REQUESTS=o},get workerUrl(){return h.config.WORKER_URL},set workerUrl(o){h.config.WORKER_URL=o},addProtocol(o,t){h.config.REGISTERED_PROTOCOLS[o]=t},removeProtocol(o){delete h.config.REGISTERED_PROTOCOLS[o]}};return js.extend(Js,{isSafari:h.isSafari,getPerformanceMetrics:h.PerformanceUtils.getPerformanceMetrics}),Js});var Te=se;return Te})})(ed);var Rm=ed.exports;function Mf(I){let C,B,G,se,oe,Te,h;return{c(){C=Cl("div"),B=Cl("label"),G=rh(I[0]),se=of(),oe=Cl("input"),ps(B,"class","govuk-label"),ps(B,"for","file-upload"),oe.disabled=I[1],ps(oe,"class","govuk-file-upload"),ps(oe,"id","file-upload"),ps(oe,"name","file-upload"),ps(oe,"type","file"),ps(C,"class","govuk-form-group")},m(_e,Y){af(_e,C,Y),bo(C,B),bo(B,G),bo(C,se),bo(C,oe),I[5](oe),Te||(h=lf(oe,"change",I[3]),Te=!0)},p(_e,[Y]){Y&1&&hf(G,_e[0]),Y&2&&(oe.disabled=_e[1])},i:Vn,o:Vn,d(_e){_e&&ih(C),I[5](null),Te=!1,h()}}}function Cf(I,C,B){let{label:G}=C,{loadFile:se}=C,{disabled:oe=!1}=C,Te;function h(Y){let Qe=new FileReader;Qe.onload=_t=>{se(_t.target.result)};let ye=Te.files;Qe.readAsText(ye[0])}function _e(Y){Kc[Y?"unshift":"push"](()=>{Te=Y,B(2,Te)})}return I.$$set=Y=>{"label"in Y&&B(0,G=Y.label),"loadFile"in Y&&B(4,se=Y.loadFile),"disabled"in Y&&B(1,oe=Y.disabled)},[G,oe,Te,h,se,_e]}class Fm extends If{constructor(C){super(),Sf(this,C,Cf,Mf,Qp,{label:0,loadFile:4,disabled:1})}}var Ci=63710088e-1,nh={centimeters:Ci*100,centimetres:Ci*100,degrees:Ci/111325,feet:Ci*3.28084,inches:Ci*39.37,kilometers:Ci/1e3,kilometres:Ci/1e3,meters:Ci,metres:Ci,miles:Ci/1609.344,millimeters:Ci*1e3,millimetres:Ci*1e3,nauticalmiles:Ci/1852,radians:1,yards:Ci*1.0936},zf={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Ci,yards:1.0936133},Qc={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Zr(I,C,B){B===void 0&&(B={});var G={type:"Feature"};return(B.id===0||B.id)&&(G.id=B.id),B.bbox&&(G.bbox=B.bbox),G.properties=C||{},G.geometry=I,G}function kf(I,C,B){switch(I){case"Point":return un(C).geometry;case"LineString":return pn(C).geometry;case"Polygon":return sh(C).geometry;case"MultiPoint":return rd(C).geometry;case"MultiLineString":return id(C).geometry;case"MultiPolygon":return nd(C).geometry;default:throw new Error(I+" is invalid")}}function un(I,C,B){if(B===void 0&&(B={}),!I)throw new Error("coordinates is required");if(!Array.isArray(I))throw new Error("coordinates must be an Array");if(I.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Bl(I[0])||!Bl(I[1]))throw new Error("coordinates must contain numbers");var G={type:"Point",coordinates:I};return Zr(G,C,B)}function Df(I,C,B){return B===void 0&&(B={}),Fl(I.map(function(G){return un(G,C)}),B)}function sh(I,C,B){B===void 0&&(B={});for(var G=0,se=I;G=0))throw new Error("precision must be a positive number");var B=Math.pow(10,C||0);return Math.round(I*B)/B}function sd(I,C){C===void 0&&(C="kilometers");var B=nh[C];if(!B)throw new Error(C+" units is invalid");return I*B}function ah(I,C){C===void 0&&(C="kilometers");var B=nh[C];if(!B)throw new Error(C+" units is invalid");return I/B}function Of(I,C){return ad(ah(I,C))}function Uf(I){var C=I%360;return C<0&&(C+=360),C}function ad(I){var C=I%(2*Math.PI);return C*180/Math.PI}function Vf(I){var C=I%360;return C*Math.PI/180}function Nf(I,C,B){if(C===void 0&&(C="kilometers"),B===void 0&&(B="kilometers"),!(I>=0))throw new Error("length must be a positive number");return sd(ah(I,C),B)}function $f(I,C,B){if(C===void 0&&(C="meters"),B===void 0&&(B="kilometers"),!(I>=0))throw new Error("area must be a positive number");var G=Qc[C];if(!G)throw new Error("invalid original units");var se=Qc[B];if(!se)throw new Error("invalid final units");return I/G*se}function Bl(I){return!isNaN(I)&&I!==null&&!Array.isArray(I)}function oh(I){return!!I&&I.constructor===Object}function qf(I){if(!I)throw new Error("bbox is required");if(!Array.isArray(I))throw new Error("bbox must be an Array");if(I.length!==4&&I.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");I.forEach(function(C){if(!Bl(C))throw new Error("bbox must only contain numbers")})}function jf(I){if(!I)throw new Error("id is required");if(["string","number"].indexOf(typeof I)===-1)throw new Error("id must be a number or a string")}const Om=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Qc,bearingToAzimuth:Uf,convertArea:$f,convertLength:Nf,degreesToRadians:Vf,earthRadius:Ci,factors:nh,feature:Zr,featureCollection:Fl,geometry:kf,geometryCollection:Rf,isNumber:Bl,isObject:oh,lengthToDegrees:Of,lengthToRadians:ah,lineString:pn,lineStrings:Bf,multiLineString:id,multiPoint:rd,multiPolygon:nd,point:un,points:Df,polygon:sh,polygons:Lf,radiansToDegrees:ad,radiansToLength:sd,round:Ff,unitsFactors:zf,validateBBox:qf,validateId:jf},Symbol.toStringTag,{value:"Module"}));function ma(I,C,B){if(I!==null)for(var G,se,oe,Te,h,_e,Y,Qe=0,ye=0,_t,Et=I.type,it=Et==="FeatureCollection",At=Et==="Feature",zt=it?I.features.length:1,nt=0;nt_e||it>Y||At>Qe){h=ye,_e=G,Y=it,Qe=At,oe=0;return}var zt=pn([h,ye],B.properties);if(C(zt,G,se,At,oe)===!1)return!1;oe++,h=ye})===!1)return!1}}})}function Yf(I,C,B){var G=B,se=!1;return cd(I,function(oe,Te,h,_e,Y){se===!1&&B===void 0?G=oe:G=C(G,oe,Te,h,_e,Y),se=!0}),G}function hd(I,C){if(!I)throw new Error("geojson is required");Ol(I,function(B,G,se){if(B.geometry!==null){var oe=B.geometry.type,Te=B.geometry.coordinates;switch(oe){case"LineString":if(C(B,G,se,0,0)===!1)return!1;break;case"Polygon":for(var h=0;hB[0]&&(C[0]=B[0]),C[1]>B[1]&&(C[1]=B[1]),C[2]=0;se--){let oe=Zu[se];if(oe==C.id){G=!0;break}I.getLayer(oe)&&(B=oe)}if(!G)throw new Error(`Layer ID ${C.id} not defined in layerZorder`);I.addLayer(C,B)}function Zm(I,C){hh(I,{id:C.id,source:C.source,filter:C.filter??ch,type:"fill",paint:{"fill-color":C.color,"fill-opacity":C.opacity}})}function Gm(I,C){hh(I,{id:C.id,source:C.source,filter:C.filter??ch,type:"circle",paint:{"circle-radius":C.radius,"circle-color":C.color??ju,"circle-opacity":C.opacity??ud,"circle-stroke-color":C.strokeColor??ju,"circle-stroke-width":C.strokeWidth??0}})}function Xm(I,C){hh(I,{id:C.id,source:C.source,filter:C.filter??ch,type:"line",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":C.color,"line-width":C.width,"line-opacity":C.opacity??ud}})}function Wm(){return{type:"FeatureCollection",features:[]}}function Hm(I){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:tm(I)}}}function tm(I){return[Math.round(I[0]*1e7)/1e7,Math.round(I[1]*1e7)/1e7]}function Km(I,C,B){let G=["case"];for(let[se,oe]of Object.entries(C))G.push(["==",["get",I],se]),G.push(oe);return G.push(B),G}function Ym(I){return Rl(I)}const Zu=["interventions-polygons","interventions-polygon-outlines","hover-polygons","hover-lines","interventions-lines","interventions-lines-endpoints","hover-points","interventions-points","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices","draw-split-route","draw-street-view","speed-limits","lane-polygons-layer","intersection-polygons-layer","lane-markings-layer","intersection-markings-layer","route-points","route-lines","route-polygons","road_label","boundary"];export{Pf as $,vm as A,nd as B,sh as C,sm as D,Im as E,Fm as F,jm as G,Zm as H,Xm as I,Gm as J,Wm as K,Nm as L,$m as M,qm as N,pm as O,Vn as P,Tm as Q,Hm as R,If as S,Vf as T,ad as U,sd as V,ah as W,un as X,Ol as Y,Fl as Z,pn as _,km as a,Bm as a0,Om as a1,Um as a2,Vm as a3,Lm as a4,Zr as a5,ld as a6,tm as a7,ym as a8,Pm as a9,Mm as aa,nm as ab,Yf as ac,ma as ad,Rl as ae,Xf as af,rm as ag,mm as ah,um as ai,Em as aj,gm as ak,zm as al,hh as am,Km as an,dm as ao,bm as ap,am as aq,lm as ar,cm as as,om as at,fm as au,hm as av,Sm as aw,Kc as b,of as c,Dm as d,Cl as e,ps as f,_m as g,Ll as h,Sf as i,af as j,bo as k,xm as l,wf as m,lf as n,Am as o,vf as p,Cm as q,ih as r,Qp as s,rh as t,Tf as u,fa as v,wm as w,hf as x,Rm as y,Ym as z}; + `,this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){Y.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(o,t,n){this._canvas.width=n*o,this._canvas.height=n*t,this._canvas.style.width=`${o}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const o={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",a=>{t={requestedAttributes:o},a&&(t.statusMessage=a.statusMessage,t.type=a.type)},{once:!0});const n=this._canvas.getContext("webgl2",o)||this._canvas.getContext("webgl",o);if(!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new Go(n,this.transform),Qe.testSupport(n)}_contextLost(o){o.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new h.Event("webglcontextlost",{originalEvent:o}))}_contextRestored(o){this._setupPainter(),this.resize(),this._update(),this.fire(new h.Event("webglcontextrestored",{originalEvent:o}))}_onMapScroll(o){if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(o,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(o){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||o,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(o){return this._update(),this._renderTaskQueue.add(o)}_cancelRenderFrame(o){this._renderTaskQueue.remove(o)}_render(o){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(o),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const c=this.transform.zoom,p=h.exported.now();this.style.zoomHistory.update(c,p);const m=new h.EvaluationParameters(c,{now:p,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),y=m.crossFadingFactor();y===1&&y===this._crossFadingFactor||(n=!0,this._crossFadingFactor=y),this.style.update(m)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding}),this.fire(new h.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,h.PerformanceUtils.mark(h.PerformanceMarkers.load),this.fire(new h.Event("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const a=this._sourcesDirty||this._styleDirty||this._placementDirty;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new h.Event("idle")),!this._loaded||this._fullyLoaded||a||(this._fullyLoaded=!0,h.PerformanceUtils.mark(h.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var o;this._hash&&this._hash.remove();for(const n of this._controls)n.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Qt.removeThrottleControl(this._imageQueueHandle),(o=this._resizeObserver)===null||o===void 0||o.disconnect();const t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),Y.remove(this._canvasContainer),Y.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),h.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new h.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=h.exported.frame(o=>{h.PerformanceUtils.frame(o),this._frame=null,this._render(o)}))}_onWindowOnline(){this._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(o){this._showTileBoundaries!==o&&(this._showTileBoundaries=o,this._update())}get showPadding(){return!!this._showPadding}set showPadding(o){this._showPadding!==o&&(this._showPadding=o,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(o){this._showCollisionBoxes!==o&&(this._showCollisionBoxes=o,o?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(o){this._showOverdrawInspector!==o&&(this._showOverdrawInspector=o,this._update())}get repaint(){return!!this._repaint}set repaint(o){this._repaint!==o&&(this._repaint=o,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(o){this._vertices=o,this._update()}get version(){return Zt}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(o){this.options=h.extend({},Zs,o),this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(h.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),Y.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})),Y.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(h.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=Y.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const o=this._map.getZoom(),t=o===this._map.getMaxZoom(),n=o===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const o=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=o}onAdd(o){return this._map=o,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 Ha(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){Y.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(o,t){const n=Y.create("button",o,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(o,t){const n=this._map._getUIString(`NavigationControl.${t}`);o.title=n,o.setAttribute("aria-label",n)}},GeolocateControl:class extends h.Evented{constructor(o){super(),this.options=h.extend({},Ka,o),h.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(o){return this._map=o,this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,n=!1){pr===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(a=>{pr=a.state!=="denied",t(pr)}).catch(()=>{pr=!!window.navigator.geolocation,t(pr)}):(pr=!!window.navigator.geolocation,t(pr)):t(pr)}(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(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(),Y.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ln=0,sn=!1}_isOutOfMapMaxBounds(o){const t=this._map.getMaxBounds(),n=o.coords;return t&&(n.longitudet.getEast()||n.latitudet.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}`)}}_onSuccess(o){if(this._map){if(this._isOutOfMapMaxBounds(o))return this._setErrorState(),this.fire(new h.Event("outofmaxbounds",o)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=o,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&&this._watchState!=="OFF"&&this._updateMarker(o),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(o),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new h.Event("geolocate",o)),this._finish()}}_updateCamera(o){const t=new h.LngLat(o.coords.longitude,o.coords.latitude),n=o.coords.accuracy,a=this._map.getBearing(),c=h.extend({bearing:a},this.options.fitBoundsOptions),p=si.fromLngLat(t,n);this._map.fitBounds(p,c,{geolocateSource:!0})}_updateMarker(o){if(o){const t=new h.LngLat(o.coords.longitude,o.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=o.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const o=this._map.getBounds(),t=o.getSouthEast(),n=o.getNorthEast(),a=t.distanceTo(n),c=Math.ceil(this._accuracy/(a/this._map._container.clientHeight)*2);this._circleElement.style.width=`${c}px`,this._circleElement.style.height=`${c}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(o){if(this._map){if(this.options.trackUserLocation)if(o.code===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._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(o.code===3&&sn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new h.Event("error",o)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(o){if(this._map){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Y.create("button","maplibregl-ctrl-geolocate",this._container),Y.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",o===!1){h.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");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=Y.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ls(this._dotElement),this._circleElement=Y.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ls({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new h.Event("trackuserlocationend")))})}}trigger(){if(!this._setup)return h.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new h.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ln--,sn=!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 h.Event("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 h.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),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(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let o;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ln++,Ln>1?(o={maximumAge:6e5,timeout:0},sn=!0):(o=this.options.positionOptions,sn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,o)}}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)}},AttributionControl:$e,LogoControl:os,ScaleControl:class{constructor(o){this.options=h.extend({},Ya,o),h.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Ws(this._map,this._container,this.options)}onAdd(o){return this._map=o,this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-scale",o.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){Y.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(o){this.options.unit=o,Ws(this._map,this._container,this.options)}},FullscreenControl:class extends h.Evented{constructor(o={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,o&&o.container&&(o.container instanceof HTMLElement?this._container=o.container:h.warnOnce("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(o){return this._map=o,this._container||(this._container=this._map.getContainer()),this._controlContainer=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){Y.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const o=this._fullscreenButton=Y.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);Y.create("span","maplibregl-ctrl-icon",o).setAttribute("aria-hidden","true"),o.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const o=this._getTitle();this._fullscreenButton.setAttribute("aria-label",o),this._fullscreenButton.title=o}_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 h.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new h.Event("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_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()}},TerrainControl:class{constructor(o){this.options=o,h.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(o){return this._map=o,this._container=Y.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=Y.create("button","maplibregl-ctrl-terrain",this._container),Y.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(){Y.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),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.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends h.Evented{constructor(o){super(),this.options=h.extend(Object.create(Hs),o),h.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(o){return this._map&&this.remove(),this._map=o,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 h.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&Y.remove(this._content),this._container&&(Y.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new h.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(o){return this._lngLat=h.LngLat.convert(o),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(o){return this.setDOMContent(document.createTextNode(o))}setHTML(o){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=o;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(o){return this.options.maxWidth=o,this._update(),this}setDOMContent(o){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=Y.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(o),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(o){this._container&&this._container.classList.add(o)}removeClassName(o){this._container&&this._container.classList.remove(o)}setOffset(o){return this.options.offset=o,this._update(),this}toggleClassName(o){if(this._container)return this._container.classList.toggle(o)}_createCloseButton(){this.options.closeButton&&(this._closeButton=Y.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(o){this._update(o.point)}_onMouseMove(o){this._update(o.point)}_onDrag(o){this._update(o.point)}_update(o){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=Y.create("div","maplibregl-popup",this._map.getContainer()),this._tip=Y.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(p=>this._container.classList.add(p)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Gs(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!o))return;const t=this._pos=this._trackPointer&&o?o:this._map.project(this._lngLat);let n=this.options.anchor;const a=Ks(this.options.offset);if(!n){const p=this._container.offsetWidth,m=this._container.offsetHeight;let y;y=t.y+a.bottom.ythis._map.transform.height-m?["bottom"]:[],t.x

    this._map.transform.width-p/2&&y.push("right"),n=y.length===0?"bottom":y.join("-")}const c=t.add(a[n]).round();Y.setTransform(this._container,`${nn[n]} translate(${c.x}px,${c.y}px)`),Xs(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const o=this._container.querySelector(Ja);o&&o.focus()}_onClose(){this.remove()}},Marker:ls,Style:li,LngLat:h.LngLat,LngLatBounds:si,Point:h.Point,MercatorCoordinate:h.MercatorCoordinate,Evented:h.Evented,AJAXError:h.AJAXError,config:h.config,CanvasSource:le,GeoJSONSource:xr,ImageSource:ji,RasterDEMTileSource:Lr,RasterTileSource:Hr,VectorTileSource:yn,VideoSource:xn,prewarm:function(){bn().acquire(Jr)},clearPrewarmedResources:function(){const o=hi;o&&(o.isPreloaded()&&o.numActive()===1?(o.release(Jr),hi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return Ys},get workerCount(){return be.workerCount},set workerCount(o){be.workerCount=o},get maxParallelImageRequests(){return h.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(o){h.config.MAX_PARALLEL_IMAGE_REQUESTS=o},get workerUrl(){return h.config.WORKER_URL},set workerUrl(o){h.config.WORKER_URL=o},addProtocol(o,t){h.config.REGISTERED_PROTOCOLS[o]=t},removeProtocol(o){delete h.config.REGISTERED_PROTOCOLS[o]}};return js.extend(Js,{isSafari:h.isSafari,getPerformanceMetrics:h.PerformanceUtils.getPerformanceMetrics}),Js});var Te=se;return Te})})(ed);var Vm=ed.exports;function Cf(I){let M,L,j,se,oe,Te,h;return{c(){M=Cl("div"),L=Cl("label"),j=rh(I[0]),se=of(),oe=Cl("input"),Vn(L,"class","govuk-label"),Vn(L,"for","file-upload"),oe.disabled=I[1],Vn(oe,"class","govuk-file-upload"),Vn(oe,"id","file-upload"),Vn(oe,"name","file-upload"),Vn(oe,"type","file"),Vn(M,"class","govuk-form-group")},m(_e,Y){af(_e,M,Y),bo(M,L),bo(L,j),bo(M,se),bo(M,oe),I[5](oe),Te||(h=lf(oe,"change",I[3]),Te=!0)},p(_e,[Y]){Y&1&&uf(j,_e[0]),Y&2&&(oe.disabled=_e[1])},i:Nn,o:Nn,d(_e){_e&&ih(M),I[5](null),Te=!1,h()}}}function kf(I,M,L){let{label:j}=M,{loadFile:se}=M,{disabled:oe=!1}=M,Te;function h(Y){let Qe=new FileReader;Qe.onload=_t=>{se(_t.target.result)};let ye=Te.files;Qe.readAsText(ye[0])}function _e(Y){Kc[Y?"unshift":"push"](()=>{Te=Y,L(2,Te)})}return I.$$set=Y=>{"label"in Y&&L(0,j=Y.label),"loadFile"in Y&&L(4,se=Y.loadFile),"disabled"in Y&&L(1,oe=Y.disabled)},[j,oe,Te,h,se,_e]}class Nm extends Af{constructor(M){super(),If(this,M,kf,Cf,Qp,{label:0,loadFile:4,disabled:1})}}var Ci=63710088e-1,nh={centimeters:Ci*100,centimetres:Ci*100,degrees:Ci/111325,feet:Ci*3.28084,inches:Ci*39.37,kilometers:Ci/1e3,kilometres:Ci/1e3,meters:Ci,metres:Ci,miles:Ci/1609.344,millimeters:Ci*1e3,millimetres:Ci*1e3,nauticalmiles:Ci/1852,radians:1,yards:Ci*1.0936},zf={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Ci,yards:1.0936133},Qc={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Zr(I,M,L){L===void 0&&(L={});var j={type:"Feature"};return(L.id===0||L.id)&&(j.id=L.id),L.bbox&&(j.bbox=L.bbox),j.properties=M||{},j.geometry=I,j}function Df(I,M,L){switch(I){case"Point":return un(M).geometry;case"LineString":return pn(M).geometry;case"Polygon":return sh(M).geometry;case"MultiPoint":return rd(M).geometry;case"MultiLineString":return id(M).geometry;case"MultiPolygon":return nd(M).geometry;default:throw new Error(I+" is invalid")}}function un(I,M,L){if(L===void 0&&(L={}),!I)throw new Error("coordinates is required");if(!Array.isArray(I))throw new Error("coordinates must be an Array");if(I.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Bl(I[0])||!Bl(I[1]))throw new Error("coordinates must contain numbers");var j={type:"Point",coordinates:I};return Zr(j,M,L)}function Lf(I,M,L){return L===void 0&&(L={}),Fl(I.map(function(j){return un(j,M)}),L)}function sh(I,M,L){L===void 0&&(L={});for(var j=0,se=I;j=0))throw new Error("precision must be a positive number");var L=Math.pow(10,M||0);return Math.round(I*L)/L}function sd(I,M){M===void 0&&(M="kilometers");var L=nh[M];if(!L)throw new Error(M+" units is invalid");return I*L}function ah(I,M){M===void 0&&(M="kilometers");var L=nh[M];if(!L)throw new Error(M+" units is invalid");return I/L}function Uf(I,M){return ad(ah(I,M))}function Vf(I){var M=I%360;return M<0&&(M+=360),M}function ad(I){var M=I%(2*Math.PI);return M*180/Math.PI}function Nf(I){var M=I%360;return M*Math.PI/180}function $f(I,M,L){if(M===void 0&&(M="kilometers"),L===void 0&&(L="kilometers"),!(I>=0))throw new Error("length must be a positive number");return sd(ah(I,M),L)}function qf(I,M,L){if(M===void 0&&(M="meters"),L===void 0&&(L="kilometers"),!(I>=0))throw new Error("area must be a positive number");var j=Qc[M];if(!j)throw new Error("invalid original units");var se=Qc[L];if(!se)throw new Error("invalid final units");return I/j*se}function Bl(I){return!isNaN(I)&&I!==null&&!Array.isArray(I)}function oh(I){return!!I&&I.constructor===Object}function jf(I){if(!I)throw new Error("bbox is required");if(!Array.isArray(I))throw new Error("bbox must be an Array");if(I.length!==4&&I.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");I.forEach(function(M){if(!Bl(M))throw new Error("bbox must only contain numbers")})}function Zf(I){if(!I)throw new Error("id is required");if(["string","number"].indexOf(typeof I)===-1)throw new Error("id must be a number or a string")}const $m=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:Qc,bearingToAzimuth:Vf,convertArea:qf,convertLength:$f,degreesToRadians:Nf,earthRadius:Ci,factors:nh,feature:Zr,featureCollection:Fl,geometry:Df,geometryCollection:Ff,isNumber:Bl,isObject:oh,lengthToDegrees:Uf,lengthToRadians:ah,lineString:pn,lineStrings:Rf,multiLineString:id,multiPoint:rd,multiPolygon:nd,point:un,points:Lf,polygon:sh,polygons:Bf,radiansToDegrees:ad,radiansToLength:sd,round:Of,unitsFactors:zf,validateBBox:jf,validateId:Zf},Symbol.toStringTag,{value:"Module"}));function ma(I,M,L){if(I!==null)for(var j,se,oe,Te,h,_e,Y,Qe=0,ye=0,_t,Et=I.type,it=Et==="FeatureCollection",At=Et==="Feature",kt=it?I.features.length:1,nt=0;nt_e||it>Y||At>Qe){h=ye,_e=j,Y=it,Qe=At,oe=0;return}var kt=pn([h,ye],L.properties);if(M(kt,j,se,At,oe)===!1)return!1;oe++,h=ye})===!1)return!1}}})}function Jf(I,M,L){var j=L,se=!1;return cd(I,function(oe,Te,h,_e,Y){se===!1&&L===void 0?j=oe:j=M(j,oe,Te,h,_e,Y),se=!0}),j}function hd(I,M){if(!I)throw new Error("geojson is required");Ol(I,function(L,j,se){if(L.geometry!==null){var oe=L.geometry.type,Te=L.geometry.coordinates;switch(oe){case"LineString":if(M(L,j,se,0,0)===!1)return!1;break;case"Polygon":for(var h=0;hL[0]&&(M[0]=L[0]),M[1]>L[1]&&(M[1]=L[1]),M[2]=0;se--){let oe=Zu[se];if(oe==M.id){j=!0;break}I.getLayer(oe)&&(L=oe)}if(!j)throw new Error(`Layer ID ${M.id} not defined in layerZorder`);I.addLayer(M,L)}function Hm(I,M){hh(I,{id:M.id,source:M.source,filter:M.filter??ch,type:"fill",paint:{"fill-color":M.color,"fill-opacity":M.opacity}})}function Km(I,M){hh(I,{id:M.id,source:M.source,filter:M.filter??ch,type:"circle",paint:{"circle-radius":M.radius,"circle-color":M.color??ju,"circle-opacity":M.opacity??ud,"circle-stroke-color":M.strokeColor??ju,"circle-stroke-width":M.strokeWidth??0}})}function Ym(I,M){hh(I,{id:M.id,source:M.source,filter:M.filter??ch,type:"line",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":M.color,"line-width":M.width,"line-opacity":M.opacity??ud}})}function Jm(){return{type:"FeatureCollection",features:[]}}function Qm(I){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:im(I)}}}function im(I){return[Math.round(I[0]*1e7)/1e7,Math.round(I[1]*1e7)/1e7]}function eg(I,M,L){let j=["case"];for(let[se,oe]of Object.entries(M))j.push(["==",["get",I],se]),j.push(oe);return j.push(L),j}function tg(I){return Rl(I)}const Zu=["interventions-polygons","interventions-polygon-outlines","hover-polygons","hover-lines","interventions-lines","interventions-lines-endpoints","hover-points","interventions-points","edit-polygon-fill","edit-polygon-lines","edit-polygon-vertices","draw-split-route","draw-street-view","speed-limits","lane-polygons-layer","intersection-polygons-layer","lane-markings-layer","intersection-markings-layer","route-points","route-lines","route-polygons","road_label","boundary"];export{Nf as $,Ef as A,Sm as B,vm as C,mm as D,Ll as E,Nm as F,wm as G,fa as H,Vm as I,tg as J,Tm as K,nd as L,sh as M,am as N,Mm as O,Wm as P,Hm as Q,Ym as R,Af as S,Km as T,Jm as U,Zm as V,Gm as W,Xm as X,Nn as Y,Im as Z,Qm as _,Jp as a,ad as a0,sd as a1,ah as a2,un as a3,Ol as a4,Fl as a5,pn as a6,Mf as a7,Um as a8,$m as a9,Pm as aA,qm as aa,jm as ab,Om as ac,Zr as ad,ld as ae,im as af,bm as ag,zm as ah,Dm as ai,sm as aj,Jf as ak,ma as al,Rl as am,Wf as an,nm as ao,ym as ap,pm as aq,Am as ar,xm as as,Bm as at,hh as au,eg as av,fm as aw,Em as ax,gm as ay,dm as az,_m as b,om as c,af as d,Cl as e,lm as f,hm as g,Lm as h,If as i,ih as j,um as k,lf as l,Cm as m,rh as n,of as o,Vn as p,bo as q,uf as r,Qp as s,bf as t,cm as u,Kc as v,Rm as w,Fm as x,Tf as y,km as z}; diff --git a/govuk_step2/assets/nested-86957ba8.js b/govuk_step2/assets/nested-db97d8ec.js similarity index 99% rename from govuk_step2/assets/nested-86957ba8.js rename to govuk_step2/assets/nested-db97d8ec.js index 45cd22247..8ecbc98a8 100644 --- a/govuk_step2/assets/nested-86957ba8.js +++ b/govuk_step2/assets/nested-db97d8ec.js @@ -1,4 +1,4 @@ -var ao=Object.defineProperty;var uo=(r,e,t)=>e in r?ao(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Y=(r,e,t)=>(uo(r,typeof e!="symbol"?e+"":e,t),t);import{B as fo,C as co,S as Z,i as Q,s as ee,D as z,E as po,z as di,G as lt,H as Zn,I as Ft,J as _n,K as tt,L as Qn,M as er,N as tr,O as _e,j as w,P as U,r as k,Q as mn,e as $,R as Gt,d as F,c as A,f as R,m as P,n as G,p as E,q as C,u as B,k as M,T as Pe,U as On,V as ho,W as go,X as ht,Y as nr,Z as Qe,_ as gt,$ as _o,a0 as rr,a1 as mo,a2 as bo,a3 as yo,a4 as vo,a5 as fr,a6 as tn,a7 as Yt,a8 as Te,v as Ie,t as ie,a9 as de,aa as he,ab as it,w as Nt,ac as wo,ad as ko,ae as So,af as Eo,ag as Rn,x as Oe,ah as jt,g as fe,b as le,a as ve,o as we,ai as nn,A as hi,h as bn,l as rn,aj as Mo,F as $o,ak as gi,al as on,am as Co,an as yn,ao as cr,ap as pr,aq as Lo,ar as To,as as Ao,at as xo}from"./maplibre_helpers-ba9572ec.js";import{M as _i,A as Oo,a as Ro}from"./About-38986094.js";import{m as Ue,g as ce,s as sn,a as Ye,f as Re,i as Dt,c as Jt,l as In,b as mi,d as Ce,o as ln,C as _t,u as Lt,n as vn,e as De,M as Io,r as mt,h as an,j as Fo,k as Po,p as dr,L as Bo,Z as No,q as jo,t as Do,I as Ho,B as Uo,v as qo}from"./ZoomOutMap-bce6f057.js";/** +var ao=Object.defineProperty;var uo=(r,e,t)=>e in r?ao(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Y=(r,e,t)=>(uo(r,typeof e!="symbol"?e+"":e,t),t);import{L as fo,M as co,S as Z,i as Q,s as ee,N as z,O as po,J as di,P as lt,Q as Zn,R as Ft,T as _n,U as tt,V as Qn,W as er,X as tr,D as _e,d as w,Y as U,j as k,Z as mn,e as $,_ as Gt,x as F,o as A,p as R,y as P,l as G,t as E,h as C,A as B,q as M,$ as Pe,a0 as On,a1 as ho,a2 as go,a3 as ht,a4 as nr,a5 as Qe,a6 as gt,a7 as _o,a8 as rr,a9 as mo,aa as bo,ab as yo,ac as vo,ad as fr,ae as tn,af as Yt,ag as Te,H as Ie,n as ie,ah as de,ai as he,aj as it,B as Nt,ak as wo,al as ko,am as So,an as Eo,ao as Rn,r as Oe,ap as jt,C as fe,v as le,w as ve,z as we,aq as nn,K as hi,E as bn,G as rn,ar as Mo,F as $o,as as gi,at as on,au as Co,av as yn,aw as cr,ax as pr,c as Lo,u as To,g as Ao,f as xo}from"./maplibre_helpers-1770e886.js";import{M as _i,A as Oo,a as Ro}from"./About-0a746f16.js";import{m as Ue,g as ce,s as sn,a as Ye,f as Re,i as Dt,c as Jt,l as In,b as mi,d as Ce,o as ln,C as _t,u as Lt,n as vn,e as De,M as Io,r as mt,h as an,j as Fo,k as Po,p as dr,L as Bo,Z as No,q as jo,t as Do,I as Ho,B as Uo,v as qo}from"./ZoomOutMap-586e4465.js";/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 diff --git a/govuk_step2/assets/nested2-57d7e430.js b/govuk_step2/assets/nested2-57d7e430.js deleted file mode 100644 index dd55e30da..000000000 --- a/govuk_step2/assets/nested2-57d7e430.js +++ /dev/null @@ -1,3 +0,0 @@ -import{S as Ce,i as Ne,s as Oe,d as I,m as M,p as v,q as C,u as J,D as pe,w as je,Q as Be,F as Fe,e as h,c as w,t as b,f as Q,j as q,k as s,g as _e,n as V,x as T,a9 as ye,aa as ke,r as A,ai as Le,v as ve,z as he,O as ze,P as Ie}from"./maplibre_helpers-ba9572ec.js";import{L as Me,g as ee,Z as Je,e as de,t as De,I as Ge,B as Te,v as qe,M as Ae,m as Ee,C as Pe}from"./ZoomOutMap-bce6f057.js";import{i as Ze}from"./main-cc41765e.js";function ge(l,e,n){const r=l.slice();return r[17]=e[n],r}function $e(l){let e,n;return e=new Pe({props:{label:`${l[17].scheme_reference}: ${l[17].num_features} features`,$$slots:{default:[He]},$$scope:{ctx:l}}}),{c(){I(e.$$.fragment)},m(r,t){M(e,r,t),n=!0},p(r,t){const o={};t&1&&(o.label=`${r[17].scheme_reference}: ${r[17].num_features} features`),t&1048577&&(o.$$scope={dirty:t,ctx:r}),e.$set(o)},i(r){n||(v(e.$$.fragment,r),n=!0)},o(r){C(e.$$.fragment,r),n=!1},d(r){J(e,r)}}}function He(l){let e,n,r,t=l[17].authority_or_region+"",o,c,g,m,a=l[17].capital_scheme_id+"",d,E,F,D,S=l[17].funding_programme+"",N,P,G,B,O,i,f,y,_,U;function R(){return l[12](l[17])}function K(){return l[13](l[17])}return{c(){e=h("ul"),n=h("li"),r=b("Authority or region: "),o=b(t),c=w(),g=h("li"),m=b("Capital scheme ID: "),d=b(a),E=w(),F=h("li"),D=b("Funding programme: "),N=b(S),P=w(),G=h("li"),B=h("button"),B.textContent="Show on map",O=w(),i=h("li"),f=h("button"),f.textContent="Edit scheme",y=w(),Q(B,"type","button"),Q(f,"type","button")},m(L,j){q(L,e,j),s(e,n),s(n,r),s(n,o),s(e,c),s(e,g),s(g,m),s(g,d),s(e,E),s(e,F),s(F,D),s(F,N),s(e,P),s(e,G),s(G,B),s(e,O),s(e,i),s(i,f),q(L,y,j),_||(U=[V(B,"click",R),V(f,"click",K)],_=!0)},p(L,j){l=L,j&1&&t!==(t=l[17].authority_or_region+"")&&T(o,t),j&1&&a!==(a=l[17].capital_scheme_id+"")&&T(d,a),j&1&&S!==(S=l[17].funding_programme+"")&&T(N,S)},d(L){L&&(A(e),A(y)),_=!1,ve(U)}}}function be(l){let e=l[2].has(l[17].scheme_reference),n,r,t=e&&$e(l);return{c(){t&&t.c(),n=ze()},m(o,c){t&&t.m(o,c),q(o,n,c),r=!0},p(o,c){c&5&&(e=o[2].has(o[17].scheme_reference)),e?t?(t.p(o,c),c&5&&v(t,1)):(t=$e(o),t.c(),v(t,1),t.m(n.parentNode,n)):t&&(ye(),C(t,1,1,()=>{t=null}),ke())},i(o){r||(v(t),r=!0)},o(o){C(t),r=!1},d(o){o&&A(n),t&&t.d(o)}}}function Qe(l){let e,n,r,t,o,c,g,m,a,d,E,F,D,S,N,P,G,B,O,i,f,y,_,U,R=l[2].size+"",K,L,j=l[3].route+"",te,oe,W=l[3].area+"",re,ae,X=l[3].crossing+"",ne,ie,Y=l[3].other+"",le,ue,fe,x,z,se,ce;c=new Je({props:{boundaryGeojson:l[4]}}),m=new Fe({props:{label:"Load from GeoJSON",loadFile:l[6]}});let Z=de(l[0]),p=[];for(let u=0;uC(p[u],1,1,()=>{p[u]=null});return{c(){e=h("div"),n=h("button"),n.textContent="Home",r=w(),t=h("h1"),o=b(`Browse schemes - `),I(c.$$.fragment),g=w(),I(m.$$.fragment),a=w(),d=h("br"),E=w(),F=h("br"),D=w(),S=h("div"),N=h("label"),P=b("Filter by any field: "),G=h("br"),B=w(),O=h("input"),i=w(),f=h("button"),f.textContent="Clear",y=w(),_=h("p"),U=b("Showing "),K=b(R),L=b(" schemes ("),te=b(j),oe=b(" routes, "),re=b(W),ae=b(` areas, - `),ne=b(X),ie=b(" crossings, "),le=b(Y),ue=b(" other)"),fe=w(),x=h("ul");for(let u=0;u${n}${r}`;return e+="",e}function We(l,e,n){let r,t;pe(l,ee,i=>n(4,r=i)),pe(l,Ee,i=>n(14,t=i)),je(()=>{Ze()});let c=new URLSearchParams(window.location.search).get("style")||"streets",g=[],m="",a=new Set,d={area:0,route:0,crossing:0,other:0};Be(()=>{ee.set(null)});function E(i){try{let f=JSON.parse(i);ee.set(f),F(f),t==null||t.fitBounds(he(f),{padding:20,animate:!1})}catch(f){window.alert(`Couldn't load schemes from a file: ${f}`)}}function F(i){let f={};for(let[y,_]of Object.entries(i.schemes))f[y]={scheme_reference:y,num_features:0,..._};for(let y of i.features)f[y.properties.scheme_reference].num_features++;n(0,g=Object.values(f))}function D(i){let f={type:"FeatureCollection",features:r.features.filter(y=>y.properties.scheme_reference==i.scheme_reference)};t==null||t.fitBounds(he(f),{padding:20,animate:!1})}function S(i){let f={type:"FeatureCollection",features:r.features.filter(_=>_.properties.scheme_reference==i.scheme_reference)},y=i.authority_or_region;window.localStorage.setItem(y,JSON.stringify(f)),window.open(`scheme.html?authority=${i.authority_or_region}`,"_blank")}const N=()=>window.open("index.html");function P(){m=this.value,n(1,m)}const G=()=>n(1,m=""),B=i=>D(i),O=i=>S(i);return l.$$.update=()=>{if(l.$$.dirty&31){if(a.clear(),m){let i=m.toLowerCase();for(let f of r.features)JSON.stringify(f.properties).toLowerCase().includes(i)&&a.add(f.properties.scheme_reference)}else for(let i of g)a.add(i.scheme_reference);ee.update(i=>{if(!i)return null;for(let f of i.features)a.has(f.properties.scheme_reference)?delete f.properties.hide_while_editing:f.properties.hide_while_editing=!0;return i}),n(3,d={area:0,route:0,crossing:0,other:0});for(let i of r==null?void 0:r.features)a.has(i.properties.scheme_reference)&&n(3,d[i.properties.intervention_type]++,d);n(2,a),n(1,m),n(4,r),n(0,g),n(3,d)}},[g,m,a,d,r,c,E,D,S,N,P,G,B,O]}class Xe extends Ce{constructor(e){super(),Ne(this,e,We,Ke,Oe,{})}}document.body.className=document.body.className?document.body.className+" js-enabled":"js-enabled";new Xe({target:document.getElementById("app")}); diff --git a/govuk_step2/assets/nested2-fbb2cc9d.js b/govuk_step2/assets/nested2-fbb2cc9d.js new file mode 100644 index 000000000..cb425a1a9 --- /dev/null +++ b/govuk_step2/assets/nested2-fbb2cc9d.js @@ -0,0 +1,3 @@ +import{S as Ce,i as Ne,s as Be,x as z,y as J,t as v,h as C,A as M,N as pe,B as je,Z as Fe,F as Le,e as h,o as w,n as b,p as R,d as G,q as s,C as _e,l as Q,r as D,ah as ye,ai as ke,j as T,aq as Oe,H as ve,J as he,D as Ie,Y as ze}from"./maplibre_helpers-1770e886.js";import{L as Je,g as ee,Z as Me,e as de,t as qe,I as Ae,B as De,v as Ge,M as Te,m as Ze,C as Ee}from"./ZoomOutMap-586e4465.js";import{i as He}from"./all-4fc69598.js";function ge(n,e,l){const r=n.slice();return r[17]=e[l],r}function $e(n){let e,l;return e=new Ee({props:{label:`${n[17].scheme_reference}: ${n[17].num_features} features`,$$slots:{default:[Pe]},$$scope:{ctx:n}}}),{c(){z(e.$$.fragment)},m(r,t){J(e,r,t),l=!0},p(r,t){const o={};t&1&&(o.label=`${r[17].scheme_reference}: ${r[17].num_features} features`),t&1048577&&(o.$$scope={dirty:t,ctx:r}),e.$set(o)},i(r){l||(v(e.$$.fragment,r),l=!0)},o(r){C(e.$$.fragment,r),l=!1},d(r){M(e,r)}}}function Pe(n){let e,l,r,t=n[17].authority_or_region+"",o,c,g,m,a=n[17].capital_scheme_id+"",d,Z,L,q,S=n[17].funding_programme+"",N,E,A,F,B,i,f,y,_,Y;function U(){return n[12](n[17])}function K(){return n[13](n[17])}return{c(){e=h("ul"),l=h("li"),r=b("Authority or region: "),o=b(t),c=w(),g=h("li"),m=b("Capital scheme ID: "),d=b(a),Z=w(),L=h("li"),q=b("Funding programme: "),N=b(S),E=w(),A=h("li"),F=h("button"),F.textContent="Show on map",B=w(),i=h("li"),f=h("button"),f.textContent="Edit scheme",y=w(),R(F,"type","button"),R(f,"type","button")},m(O,j){G(O,e,j),s(e,l),s(l,r),s(l,o),s(e,c),s(e,g),s(g,m),s(g,d),s(e,Z),s(e,L),s(L,q),s(L,N),s(e,E),s(e,A),s(A,F),s(e,B),s(e,i),s(i,f),G(O,y,j),_||(Y=[Q(F,"click",U),Q(f,"click",K)],_=!0)},p(O,j){n=O,j&1&&t!==(t=n[17].authority_or_region+"")&&D(o,t),j&1&&a!==(a=n[17].capital_scheme_id+"")&&D(d,a),j&1&&S!==(S=n[17].funding_programme+"")&&D(N,S)},d(O){O&&(T(e),T(y)),_=!1,ve(Y)}}}function be(n){let e=n[2].has(n[17].scheme_reference),l,r,t=e&&$e(n);return{c(){t&&t.c(),l=Ie()},m(o,c){t&&t.m(o,c),G(o,l,c),r=!0},p(o,c){c&5&&(e=o[2].has(o[17].scheme_reference)),e?t?(t.p(o,c),c&5&&v(t,1)):(t=$e(o),t.c(),v(t,1),t.m(l.parentNode,l)):t&&(ye(),C(t,1,1,()=>{t=null}),ke())},i(o){r||(v(t),r=!0)},o(o){C(t),r=!1},d(o){o&&T(l),t&&t.d(o)}}}function Re(n){let e,l,r,t,o,c,g,m,a,d,Z,L,q,S,N,E,A,F,B,i,f,y,_,Y,U=n[2].size+"",K,O,j=n[3].route+"",te,oe,V=n[3].area+"",re,ae,W=n[3].crossing+"",le,ie,X=n[3].other+"",ne,ue,fe,x,I,se,ce;c=new Me({props:{boundaryGeojson:n[4]}}),m=new Le({props:{label:"Load from GeoJSON",loadFile:n[6]}});let H=de(n[0]),p=[];for(let u=0;uC(p[u],1,1,()=>{p[u]=null});return{c(){e=h("div"),l=h("button"),l.textContent="Home",r=w(),t=h("h1"),o=b(`Browse schemes + `),z(c.$$.fragment),g=w(),z(m.$$.fragment),a=w(),d=h("br"),Z=w(),L=h("br"),q=w(),S=h("div"),N=h("label"),E=b("Filter by any field: "),A=h("br"),F=w(),B=h("input"),i=w(),f=h("button"),f.textContent="Clear",y=w(),_=h("p"),Y=b("Showing "),K=b(U),O=b(" schemes ("),te=b(j),oe=b(" routes, "),re=b(V),ae=b(` areas, + `),le=b(W),ie=b(" crossings, "),ne=b(X),ue=b(" other)"),fe=w(),x=h("ul");for(let u=0;u${l}${r}`;return e+="",e}function Ve(n,e,l){let r,t;pe(n,ee,i=>l(4,r=i)),pe(n,Ze,i=>l(14,t=i)),je(()=>{He()});let c=new URLSearchParams(window.location.search).get("style")||"streets",g=[],m="",a=new Set,d={area:0,route:0,crossing:0,other:0};Fe(()=>{ee.set(null)});function Z(i){try{let f=JSON.parse(i);ee.set(f),L(f),t==null||t.fitBounds(he(f),{padding:20,animate:!1})}catch(f){window.alert(`Couldn't load schemes from a file: ${f}`)}}function L(i){let f={};for(let[y,_]of Object.entries(i.schemes))f[y]={scheme_reference:y,num_features:0,..._};for(let y of i.features)f[y.properties.scheme_reference].num_features++;l(0,g=Object.values(f))}function q(i){let f={type:"FeatureCollection",features:r.features.filter(y=>y.properties.scheme_reference==i.scheme_reference)};t==null||t.fitBounds(he(f),{padding:20,animate:!1})}function S(i){let f={type:"FeatureCollection",features:r.features.filter(_=>_.properties.scheme_reference==i.scheme_reference)},y=i.authority_or_region;window.localStorage.setItem(y,JSON.stringify(f)),window.open(`scheme.html?authority=${i.authority_or_region}`,"_blank")}const N=()=>window.open("index.html");function E(){m=this.value,l(1,m)}const A=()=>l(1,m=""),F=i=>q(i),B=i=>S(i);return n.$$.update=()=>{if(n.$$.dirty&31){if(a.clear(),m){let i=m.toLowerCase();for(let f of r.features)JSON.stringify(f.properties).toLowerCase().includes(i)&&a.add(f.properties.scheme_reference)}else for(let i of g)a.add(i.scheme_reference);ee.update(i=>{if(!i)return null;for(let f of i.features)a.has(f.properties.scheme_reference)?delete f.properties.hide_while_editing:f.properties.hide_while_editing=!0;return i}),l(3,d={area:0,route:0,crossing:0,other:0});for(let i of r==null?void 0:r.features)a.has(i.properties.scheme_reference)&&l(3,d[i.properties.intervention_type]++,d);l(2,a),l(1,m),l(4,r),l(0,g),l(3,d)}},[g,m,a,d,r,c,Z,q,S,N,E,A,F,B]}class We extends Ce{constructor(e){super(),Ne(this,e,Ve,Ke,Be,{})}}document.body.className=document.body.className?document.body.className+" js-enabled":"js-enabled";new We({target:document.getElementById("app")}); diff --git a/govuk_step2/browse.html b/govuk_step2/browse.html index b3775a98f..b6b73ef78 100644 --- a/govuk_step2/browse.html +++ b/govuk_step2/browse.html @@ -7,13 +7,13 @@ content="initial-scale=1,maximum-scale=1,user-scalable=no" /> ATIP v2 scheme browser - - - - + + + + - +

    diff --git a/govuk_step2/index.html b/govuk_step2/index.html index 0b044167e..e3b49d94c 100644 --- a/govuk_step2/index.html +++ b/govuk_step2/index.html @@ -7,13 +7,13 @@ content="initial-scale=1,maximum-scale=1,user-scalable=no" /> Active Travel Infrastructure Platform v2 - - - - + + + + - - + + diff --git a/govuk_step2/scheme.html b/govuk_step2/scheme.html index b1c197c1e..44babba16 100644 --- a/govuk_step2/scheme.html +++ b/govuk_step2/scheme.html @@ -7,12 +7,12 @@ content="initial-scale=1,maximum-scale=1,user-scalable=no" /> ATIP v2 Scheme Entry - - - - + + + + - +