diff --git a/govuk_step2/assets/About-1c252dce.js b/govuk_step2/assets/About-75317461.js similarity index 61% rename from govuk_step2/assets/About-1c252dce.js rename to govuk_step2/assets/About-75317461.js index b719fcfc1..9798bfd67 100644 --- a/govuk_step2/assets/About-1c252dce.js +++ b/govuk_step2/assets/About-75317461.js @@ -1,15 +1,15 @@ -import{S as K,i as N,s as Q,c as Ce,e as _,r as j,d as k,u as Ae,g as Ie,f as Me,t as m,j as d,k as b,p as c,q as E,ai as we,aA as X,v as a,l as ve,aD as Te,w as Ee,aj as je,ak as Pe,B as Se,C as We,G as C,H as A,J as I,D as De,E as Ge,I as Le}from"./maplibre_helpers-e26a4314.js";const st="/atip/govuk_step2/assets/authorities-80e824dc.geojson";function Re(l){let e,t;const n=l[2].default,s=Ce(n,l,l[1],null);return{c(){e=_("a"),s&&s.c(),j(e,"href",l[0]),j(e,"target","_blank"),j(e,"rel","noreferrer")},m(o,i){k(o,e,i),s&&s.m(e,null),t=!0},p(o,[i]){s&&s.p&&(!t||i&2)&&Ae(s,n,o,o[1],t?Me(n,o[1],i,null):Ie(o[1]),null),(!t||i&1)&&j(e,"href",o[0])},i(o){t||(m(s,o),t=!0)},o(o){d(s,o),t=!1},d(o){o&&b(e),s&&s.d(o)}}}function Ue(l,e,t){let{$$slots:n={},$$scope:s}=e,{href:o}=e;return l.$$set=i=>{"href"in i&&t(0,o=i.href),"$$scope"in i&&t(1,s=i.$$scope)},[o,s,n]}class T extends K{constructor(e){super(),N(this,e,Ue,Re,Q,{href:0})}}function Be(l){let e,t;return e=new We({props:{$$slots:{default:[qe]},$$scope:{ctx:l}}}),e.$on("click",l[5]),{c(){C(e.$$.fragment)},m(n,s){A(e,n,s),t=!0},p(n,s){const o={};s&128&&(o.$$scope={dirty:s,ctx:n}),e.$set(o)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){I(e,n)}}}function qe(l){let e;return{c(){e=c("X")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function He(l){let e,t,n,s,o,i,g,$,w,P,f=l[2]&&Be(l);const M=l[4].default,h=Ce(M,l,l[7],null);return{c(){e=_("div"),t=_("div"),n=_("div"),s=_("h1"),o=c(l[1]),i=E(),f&&f.c(),g=E(),h&&h.c(),j(s,"class","govuk-heading-l"),we(n,"display","flex"),we(n,"justify-content","space-between"),j(t,"class","content centered-fullscreen svelte-stcgp5"),j(e,"class","background svelte-stcgp5"),X(e,"open",l[0]),X(e,"closed",!l[0])},m(u,B){k(u,e,B),a(e,t),a(t,n),a(n,s),a(s,o),a(n,i),f&&f.m(n,null),a(t,g),h&&h.m(t,null),$=!0,w||(P=[ve(t,"click",Te(Je)),ve(e,"click",l[6])],w=!0)},p(u,[B]){(!$||B&2)&&Ee(o,u[1]),u[2]?f?(f.p(u,B),B&4&&m(f,1)):(f=Be(u),f.c(),m(f,1),f.m(n,null)):f&&(je(),d(f,1,1,()=>{f=null}),Pe()),h&&h.p&&(!$||B&128)&&Ae(h,M,u,u[7],$?Me(M,u[7],B,null):Ie(u[7]),null),(!$||B&1)&&X(e,"open",u[0]),(!$||B&1)&&X(e,"closed",!u[0])},i(u){$||(m(f),m(h,u),$=!0)},o(u){d(f),d(h,u),$=!1},d(u){u&&b(e),f&&f.d(),h&&h.d(u),w=!1,Se(P)}}}const Je=()=>null;function Xe(l,e,t){let{$$slots:n={},$$scope:s}=e,{title:o}=e,{open:i=!1}=e,{displayEscapeButton:g=!0}=e,{canCloseByClickingBackground:$=!0}=e;const w=()=>t(0,i=!1),P=()=>{$&&t(0,i=!1)};return l.$$set=f=>{"title"in f&&t(1,o=f.title),"open"in f&&t(0,i=f.open),"displayEscapeButton"in f&&t(2,g=f.displayEscapeButton),"canCloseByClickingBackground"in f&&t(3,$=f.canCloseByClickingBackground),"$$scope"in f&&t(7,s=f.$$scope)},[i,o,g,$,n,w,P,s]}class ze extends K{constructor(e){super(),N(this,e,Xe,He,Q,{title:1,open:0,displayEscapeButton:2,canCloseByClickingBackground:3})}}function Oe(l){let e;return{c(){e=c("open source project")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Fe(l){let e;return{c(){e=c("Dustin Carlino")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Ke(l){let e;return{c(){e=c("Madison Wang")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Ne(l){let e;return{c(){e=c("Ben Ritter")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Qe(l){let e;return{c(){e=c("OpenStreetMap")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Ve(l){let e;return{c(){e=c("MapLibre")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Ye(l){let e;return{c(){e=c("GeoRust")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Ze(l){let e;return{c(){e=c("osm2streets")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function xe(l){let e;return{c(){e=c("Material icons")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function ye(l){let e;return{c(){e=c("start an issue on Github")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function et(l){let e,t,n,s,o,i,g,$,w,P,f,M,h,u,B,S,V,z,Y,v,Z,W,x,D,y,G,ee,L,te,R,ne,le,U,se,q,ae,H,oe,re,ie,fe,O,ue,F,J;return s=new T({props:{href:"https://github.com/acteng/atip",$$slots:{default:[Oe]},$$scope:{ctx:l}}}),w=new T({props:{href:"https://www.turing.ac.uk/people/researchers/dustin-carlino",$$slots:{default:[Fe]},$$scope:{ctx:l}}}),u=new T({props:{href:"https://www.linkedin.com/in/madison-wang-841977bb/",$$slots:{default:[Ke]},$$scope:{ctx:l}}}),S=new T({props:{href:"https://github.com/BudgieInWA",$$slots:{default:[Ne]},$$scope:{ctx:l}}}),W=new T({props:{href:"https://www.openstreetmap.org/about",$$slots:{default:[Qe]},$$scope:{ctx:l}}}),D=new T({props:{href:"https://maplibre.org/",$$slots:{default:[Ve]},$$scope:{ctx:l}}}),G=new T({props:{href:"https://georust.org/",$$slots:{default:[Ye]},$$scope:{ctx:l}}}),L=new T({props:{href:"https://github.com/a-b-street/osm2streets",$$slots:{default:[Ze]},$$scope:{ctx:l}}}),R=new T({props:{href:"https://material.io/resources/icons/",$$slots:{default:[xe]},$$scope:{ctx:l}}}),q=new T({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 +import{S as F,i as N,s as Q,c as Ce,e as _,r as j,d as k,u as Ae,g as Ie,f as Me,t as m,j as d,k as b,p as c,q as E,aj as we,aB as X,v as a,l as ve,aE as Te,w as Ee,ak as je,al as Pe,B as Se,C as We,H as C,I as A,K as I,D as Le,E as Re,J as Ue}from"./maplibre_helpers-5d84afaa.js";const st="/atip/govuk_step2/assets/authorities-80e824dc.geojson";function qe(l){let e,t;const n=l[2].default,s=Ce(n,l,l[1],null);return{c(){e=_("a"),s&&s.c(),j(e,"href",l[0]),j(e,"target","_blank"),j(e,"rel","noreferrer")},m(o,i){k(o,e,i),s&&s.m(e,null),t=!0},p(o,[i]){s&&s.p&&(!t||i&2)&&Ae(s,n,o,o[1],t?Me(n,o[1],i,null):Ie(o[1]),null),(!t||i&1)&&j(e,"href",o[0])},i(o){t||(m(s,o),t=!0)},o(o){d(s,o),t=!1},d(o){o&&b(e),s&&s.d(o)}}}function De(l,e,t){let{$$slots:n={},$$scope:s}=e,{href:o}=e;return l.$$set=i=>{"href"in i&&t(0,o=i.href),"$$scope"in i&&t(1,s=i.$$scope)},[o,s,n]}class T extends F{constructor(e){super(),N(this,e,De,qe,Q,{href:0})}}function Be(l){let e,t;return e=new We({props:{$$slots:{default:[Ge]},$$scope:{ctx:l}}}),e.$on("click",l[5]),{c(){C(e.$$.fragment)},m(n,s){A(e,n,s),t=!0},p(n,s){const o={};s&128&&(o.$$scope={dirty:s,ctx:n}),e.$set(o)},i(n){t||(m(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){I(e,n)}}}function Ge(l){let e;return{c(){e=c("X")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function He(l){let e,t,n,s,o,i,g,$,w,P,f=l[2]&&Be(l);const M=l[4].default,h=Ce(M,l,l[7],null);return{c(){e=_("div"),t=_("div"),n=_("div"),s=_("h1"),o=c(l[1]),i=E(),f&&f.c(),g=E(),h&&h.c(),j(s,"class","govuk-heading-l"),we(n,"display","flex"),we(n,"justify-content","space-between"),j(t,"class","content centered-fullscreen svelte-stcgp5"),j(e,"class","background svelte-stcgp5"),X(e,"open",l[0]),X(e,"closed",!l[0])},m(u,B){k(u,e,B),a(e,t),a(t,n),a(n,s),a(s,o),a(n,i),f&&f.m(n,null),a(t,g),h&&h.m(t,null),$=!0,w||(P=[ve(t,"click",Te(Je)),ve(e,"click",l[6])],w=!0)},p(u,[B]){(!$||B&2)&&Ee(o,u[1]),u[2]?f?(f.p(u,B),B&4&&m(f,1)):(f=Be(u),f.c(),m(f,1),f.m(n,null)):f&&(je(),d(f,1,1,()=>{f=null}),Pe()),h&&h.p&&(!$||B&128)&&Ae(h,M,u,u[7],$?Me(M,u[7],B,null):Ie(u[7]),null),(!$||B&1)&&X(e,"open",u[0]),(!$||B&1)&&X(e,"closed",!u[0])},i(u){$||(m(f),m(h,u),$=!0)},o(u){d(f),d(h,u),$=!1},d(u){u&&b(e),f&&f.d(),h&&h.d(u),w=!1,Se(P)}}}const Je=()=>null;function Xe(l,e,t){let{$$slots:n={},$$scope:s}=e,{title:o}=e,{open:i=!1}=e,{displayEscapeButton:g=!0}=e,{canCloseByClickingBackground:$=!0}=e;const w=()=>t(0,i=!1),P=()=>{$&&t(0,i=!1)};return l.$$set=f=>{"title"in f&&t(1,o=f.title),"open"in f&&t(0,i=f.open),"displayEscapeButton"in f&&t(2,g=f.displayEscapeButton),"canCloseByClickingBackground"in f&&t(3,$=f.canCloseByClickingBackground),"$$scope"in f&&t(7,s=f.$$scope)},[i,o,g,$,n,w,P,s]}class ze extends F{constructor(e){super(),N(this,e,Xe,He,Q,{title:1,open:0,displayEscapeButton:2,canCloseByClickingBackground:3})}}function Ke(l){let e;return{c(){e=c("open source project")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Oe(l){let e;return{c(){e=c("Dustin Carlino")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Fe(l){let e;return{c(){e=c("Madison Wang")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Ne(l){let e;return{c(){e=c("Ben Ritter")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Qe(l){let e;return{c(){e=c("OpenStreetMap")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Ve(l){let e;return{c(){e=c("MapLibre")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Ye(l){let e;return{c(){e=c("GeoRust")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function Ze(l){let e;return{c(){e=c("osm2streets")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function xe(l){let e;return{c(){e=c("Material icons")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function ye(l){let e;return{c(){e=c("start an issue on Github")},m(t,n){k(t,e,n)},d(t){t&&b(e)}}}function et(l){let e,t,n,s,o,i,g,$,w,P,f,M,h,u,B,S,V,z,Y,v,Z,W,x,L,y,R,ee,U,te,q,ne,le,D,se,G,ae,H,oe,re,ie,fe,K,ue,O,J;return s=new T({props:{href:"https://github.com/acteng/atip",$$slots:{default:[Ke]},$$scope:{ctx:l}}}),w=new T({props:{href:"https://www.turing.ac.uk/people/researchers/dustin-carlino",$$slots:{default:[Oe]},$$scope:{ctx:l}}}),u=new T({props:{href:"https://www.linkedin.com/in/madison-wang-841977bb/",$$slots:{default:[Fe]},$$scope:{ctx:l}}}),S=new T({props:{href:"https://github.com/BudgieInWA",$$slots:{default:[Ne]},$$scope:{ctx:l}}}),W=new T({props:{href:"https://www.openstreetmap.org/about",$$slots:{default:[Qe]},$$scope:{ctx:l}}}),L=new T({props:{href:"https://maplibre.org/",$$slots:{default:[Ve]},$$scope:{ctx:l}}}),R=new T({props:{href:"https://georust.org/",$$slots:{default:[Ye]},$$scope:{ctx:l}}}),U=new T({props:{href:"https://github.com/a-b-street/osm2streets",$$slots:{default:[Ze]},$$scope:{ctx:l}}}),q=new T({props:{href:"https://material.io/resources/icons/",$$slots:{default:[xe]},$$scope:{ctx:l}}}),G=new T({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 `),C(s.$$.fragment),o=c(" supported by Active Travel England and developed by:"),i=E(),g=_("ul"),$=_("li"),C(w.$$.fragment),P=c(": lead developer, from The Alan Turing Institute"),f=E(),M=_("li"),h=c(`With UX help from `),C(u.$$.fragment),B=c(` and CSS help from `),C(S.$$.fragment),V=E(),z=_("li"),z.textContent=`With great thanks to ATIP's various users for feedback, testing, and ideas`,Y=E(),v=_("p"),Z=c(`ATIP builds on `),C(W.$$.fragment),x=c(` contributors, - `),C(D.$$.fragment),y=c(`, - `),C(G.$$.fragment),ee=c(`, - `),C(L.$$.fragment),te=c(`, - `),C(R.$$.fragment),ne=c(", and other open source projects."),le=E(),U=_("p"),se=c("We want your feedback about ATIP! Please "),C(q.$$.fragment),ae=c(` + `),C(L.$$.fragment),y=c(`, + `),C(R.$$.fragment),ee=c(`, + `),C(U.$$.fragment),te=c(`, + `),C(q.$$.fragment),ne=c(", and other open source projects."),le=E(),D=_("p"),se=c("We want your feedback about ATIP! Please "),C(G.$$.fragment),ae=c(` or email - `),H=_("a"),H.textContent="dcarlino@turing.ac.uk",oe=c("."),re=E(),ie=_("hr"),fe=E(),O=_("h2"),O.textContent="Recent changes",ue=E(),F=_("ul"),F.innerHTML=`
  • v2 launched on 2 June 2023. Changes: a complete UI rewrite, new draw + `),H=_("a"),H.textContent="dcarlino@turing.ac.uk",oe=c("."),re=E(),ie=_("hr"),fe=E(),K=_("h2"),K.textContent="Recent changes",ue=E(),O=_("ul"),O.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
  • `,j(H,"href","mailto: dcarlino@turing.ac.uk"),j(e,"class","govuk-prose")},m(r,p){k(r,e,p),a(e,t),a(t,n),A(s,t,null),a(t,o),a(e,i),a(e,g),a(g,$),A(w,$,null),a($,P),a(g,f),a(g,M),a(M,h),A(u,M,null),a(M,B),A(S,M,null),a(g,V),a(g,z),a(e,Y),a(e,v),a(v,Z),A(W,v,null),a(v,x),A(D,v,null),a(v,y),A(G,v,null),a(v,ee),A(L,v,null),a(v,te),A(R,v,null),a(v,ne),a(e,le),a(e,U),a(U,se),A(q,U,null),a(U,ae),a(U,H),a(U,oe),a(e,re),a(e,ie),a(e,fe),a(e,O),a(e,ue),a(e,F),J=!0},p(r,p){const ce={};p&4&&(ce.$$scope={dirty:p,ctx:r}),s.$set(ce);const $e={};p&4&&($e.$$scope={dirty:p,ctx:r}),w.$set($e);const pe={};p&4&&(pe.$$scope={dirty:p,ctx:r}),u.$set(pe);const ge={};p&4&&(ge.$$scope={dirty:p,ctx:r}),S.$set(ge);const _e={};p&4&&(_e.$$scope={dirty:p,ctx:r}),W.$set(_e);const me={};p&4&&(me.$$scope={dirty:p,ctx:r}),D.$set(me);const de={};p&4&&(de.$$scope={dirty:p,ctx:r}),G.$set(de);const he={};p&4&&(he.$$scope={dirty:p,ctx:r}),L.$set(he);const ke={};p&4&&(ke.$$scope={dirty:p,ctx:r}),R.$set(ke);const be={};p&4&&(be.$$scope={dirty:p,ctx:r}),q.$set(be)},i(r){J||(m(s.$$.fragment,r),m(w.$$.fragment,r),m(u.$$.fragment,r),m(S.$$.fragment,r),m(W.$$.fragment,r),m(D.$$.fragment,r),m(G.$$.fragment,r),m(L.$$.fragment,r),m(R.$$.fragment,r),m(q.$$.fragment,r),J=!0)},o(r){d(s.$$.fragment,r),d(w.$$.fragment,r),d(u.$$.fragment,r),d(S.$$.fragment,r),d(W.$$.fragment,r),d(D.$$.fragment,r),d(G.$$.fragment,r),d(L.$$.fragment,r),d(R.$$.fragment,r),d(q.$$.fragment,r),J=!1},d(r){r&&b(e),I(s),I(w),I(u),I(S),I(W),I(D),I(G),I(L),I(R),I(q)}}}function tt(l){let e,t,n;function s(i){l[1](i)}let o={title:"About the Active Travel Infrastructure Platform",$$slots:{default:[et]},$$scope:{ctx:l}};return l[0]!==void 0&&(o.open=l[0]),e=new ze({props:o}),De.push(()=>Ge(e,"open",s)),{c(){C(e.$$.fragment)},m(i,g){A(e,i,g),n=!0},p(i,[g]){const $={};g&4&&($.$$scope={dirty:g,ctx:i}),!t&&g&1&&(t=!0,$.open=i[0],Le(()=>t=!1)),e.$set($)},i(i){n||(m(e.$$.fragment,i),n=!0)},o(i){d(e.$$.fragment,i),n=!1},d(i){I(e,i)}}}function nt(l,e,t){let{open:n}=e;function s(o){n=o,t(0,n)}return l.$$set=o=>{"open"in o&&t(0,n=o.open)},[n,s]}class at extends K{constructor(e){super(),N(this,e,nt,tt,Q,{open:0})}}export{at as A,ze as M,st as a}; + speed limit layer, lane visualization layer
  • v1 launched in March 2023
  • `,j(H,"href","mailto: dcarlino@turing.ac.uk"),j(e,"class","govuk-prose")},m(r,p){k(r,e,p),a(e,t),a(t,n),A(s,t,null),a(t,o),a(e,i),a(e,g),a(g,$),A(w,$,null),a($,P),a(g,f),a(g,M),a(M,h),A(u,M,null),a(M,B),A(S,M,null),a(g,V),a(g,z),a(e,Y),a(e,v),a(v,Z),A(W,v,null),a(v,x),A(L,v,null),a(v,y),A(R,v,null),a(v,ee),A(U,v,null),a(v,te),A(q,v,null),a(v,ne),a(e,le),a(e,D),a(D,se),A(G,D,null),a(D,ae),a(D,H),a(D,oe),a(e,re),a(e,ie),a(e,fe),a(e,K),a(e,ue),a(e,O),J=!0},p(r,p){const ce={};p&4&&(ce.$$scope={dirty:p,ctx:r}),s.$set(ce);const $e={};p&4&&($e.$$scope={dirty:p,ctx:r}),w.$set($e);const pe={};p&4&&(pe.$$scope={dirty:p,ctx:r}),u.$set(pe);const ge={};p&4&&(ge.$$scope={dirty:p,ctx:r}),S.$set(ge);const _e={};p&4&&(_e.$$scope={dirty:p,ctx:r}),W.$set(_e);const me={};p&4&&(me.$$scope={dirty:p,ctx:r}),L.$set(me);const de={};p&4&&(de.$$scope={dirty:p,ctx:r}),R.$set(de);const he={};p&4&&(he.$$scope={dirty:p,ctx:r}),U.$set(he);const ke={};p&4&&(ke.$$scope={dirty:p,ctx:r}),q.$set(ke);const be={};p&4&&(be.$$scope={dirty:p,ctx:r}),G.$set(be)},i(r){J||(m(s.$$.fragment,r),m(w.$$.fragment,r),m(u.$$.fragment,r),m(S.$$.fragment,r),m(W.$$.fragment,r),m(L.$$.fragment,r),m(R.$$.fragment,r),m(U.$$.fragment,r),m(q.$$.fragment,r),m(G.$$.fragment,r),J=!0)},o(r){d(s.$$.fragment,r),d(w.$$.fragment,r),d(u.$$.fragment,r),d(S.$$.fragment,r),d(W.$$.fragment,r),d(L.$$.fragment,r),d(R.$$.fragment,r),d(U.$$.fragment,r),d(q.$$.fragment,r),d(G.$$.fragment,r),J=!1},d(r){r&&b(e),I(s),I(w),I(u),I(S),I(W),I(L),I(R),I(U),I(q),I(G)}}}function tt(l){let e,t,n;function s(i){l[1](i)}let o={title:"About the Active Travel Infrastructure Platform",$$slots:{default:[et]},$$scope:{ctx:l}};return l[0]!==void 0&&(o.open=l[0]),e=new ze({props:o}),Le.push(()=>Re(e,"open",s)),{c(){C(e.$$.fragment)},m(i,g){A(e,i,g),n=!0},p(i,[g]){const $={};g&4&&($.$$scope={dirty:g,ctx:i}),!t&&g&1&&(t=!0,$.open=i[0],Ue(()=>t=!1)),e.$set($)},i(i){n||(m(e.$$.fragment,i),n=!0)},o(i){d(e.$$.fragment,i),n=!1},d(i){I(e,i)}}}function nt(l,e,t){let{open:n}=e;function s(o){n=o,t(0,n)}return l.$$set=o=>{"open"in o&&t(0,n=o.open)},[n,s]}class at extends F{constructor(e){super(),N(this,e,nt,tt,Q,{open:0})}}export{at as A,ze as M,st as a}; diff --git a/govuk_step2/assets/FormElement-11aad004.js b/govuk_step2/assets/FormElement-11aad004.js deleted file mode 100644 index c4ff13211..000000000 --- a/govuk_step2/assets/FormElement-11aad004.js +++ /dev/null @@ -1 +0,0 @@ -import{S as J,i as Q,s as Z,c as tt,e as G,p as et,q as nt,r as F,d as it,v as W,w as rt,u as ot,g as st,f as at,t as lt,j as ut,k as ct}from"./maplibre_helpers-e26a4314.js";function w(t,e){if(window.NodeList.prototype.forEach)return t.forEach(e);for(var n=0;n1&&o.shift();var l=o.join(".");n[l]=t[r]}}return n}(function(t){var e="defineProperty"in Object&&function(){try{var n={};return Object.defineProperty(n,"test",{value:42}),!0}catch{return!1}}();e||function(n){var r=Object.prototype.hasOwnProperty("__defineGetter__"),o="Getters & setters cannot be defined on this javascript engine",l="A property cannot both have accessors and be writable or have a value";Object.defineProperty=function(i,u,a){if(n&&(i===window||i===document||i===Element.prototype||i instanceof Element))return n(i,u,a);if(i===null||!(i instanceof Object||typeof i=="object"))throw new TypeError("Object.defineProperty called on non-object");if(!(a instanceof Object))throw new TypeError("Property description must be an object");var c=String(u),h="value"in a||"writable"in a,p="get"in a&&typeof a.get,m="set"in a&&typeof a.set;if(p){if(p!=="function")throw new TypeError("Getter must be a function");if(!r)throw new TypeError(o);if(h)throw new TypeError(l);Object.__defineGetter__.call(i,c,a.get)}else i[c]=a.value;if(m){if(m!=="function")throw new TypeError("Setter must be a function");if(!r)throw new TypeError(o);if(h)throw new TypeError(l);Object.__defineSetter__.call(i,c,a.set)}return"value"in a&&(i[c]=a.value),i}}(Object.defineProperty)}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});(function(t){var e="Document"in this;e||typeof WorkerGlobalScope>"u"&&typeof importScripts!="function"&&(this.HTMLDocument?this.Document=this.HTMLDocument:(this.Document=this.HTMLDocument=document.constructor=new Function("return function Document() {}")(),this.Document.prototype=document))}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});(function(t){var e="Element"in this&&"HTMLElement"in this;e||function(){if(window.Element&&!window.HTMLElement){window.HTMLElement=window.Element;return}window.Element=window.HTMLElement=new Function("return function Element() {}")();var n=document.appendChild(document.createElement("body")),r=n.appendChild(document.createElement("iframe")),o=r.contentWindow.document,l=Element.prototype=o.appendChild(o.createElement("*")),s={},i=function(m,d){var E=m.childNodes||[],b=-1,f,g,v;if(m.nodeType===1&&m.constructor!==Element){m.constructor=Element;for(f in s)g=s[f],m[f]=g}for(;v=d&&E[++b];)i(v,d);return m},u=document.getElementsByTagName("*"),a=document.createElement,c,h=100;l.attachEvent("onpropertychange",function(m){for(var d=m.propertyName,E=!s.hasOwnProperty(d),b=l[d],f=s[d],g=-1,v;v=u[++g];)v.nodeType===1&&(E||v[d]===f)&&(v[d]=b);s[d]=b}),l.constructor=Element,l.hasAttribute||(l.hasAttribute=function(d){return this.getAttribute(d)!==null});function p(){return h--||clearTimeout(c),document.body&&!document.body.prototype&&/(complete|interactive)/.test(document.readyState)?(i(document,!0),c&&document.body.prototype&&clearTimeout(c),!!document.body.prototype):!1}p()||(document.onreadystatechange=p,c=setInterval(p,25)),document.createElement=function(d){var E=a(String(d).toLowerCase());return i(E)},document.removeChild(n)}()}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});(function(t){var e=function(){if(!document.documentElement.dataset)return!1;var n=document.createElement("div");return n.setAttribute("data-a-b","c"),n.dataset&&n.dataset.aB=="c"}();e||Object.defineProperty(Element.prototype,"dataset",{get:function(){for(var n=this,r=this.attributes,o={},l=0;l0&&isFinite(Number(e))?Number(e):t}function I(t){var e={};for(var n in t)e[n]=ht(t[n]);return e}function C(t,e){this.translations=t||{},this.locale=e&&e.locale||document.documentElement.lang||"en"}C.prototype.t=function(t,e){if(!t)throw new Error("i18n: lookup key missing");e&&typeof e.count=="number"&&(t=t+"."+this.getPluralSuffix(t,e.count));var n=this.translations[t];if(typeof n=="string")if(n.match(/%{(.\S+)}/)){if(!e)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,e)}else return n;else return t};C.prototype.replacePlaceholders=function(t,e){var n;return this.hasIntlNumberFormatSupport()&&(n=new Intl.NumberFormat(this.locale)),t.replace(/%{(.\S+)}/g,function(r,o){if(Object.prototype.hasOwnProperty.call(e,o)){var l=e[o];return l===!1||typeof l!="number"&&typeof l!="string"?"":typeof l=="number"?n?n.format(l):l.toString():l}else throw new Error("i18n: no data found to replace "+r+" placeholder in string")})};C.prototype.hasIntlPluralRulesSupport=function(){return!!(window.Intl&&"PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)};C.prototype.hasIntlNumberFormatSupport=function(){return!!(window.Intl&&"NumberFormat"in window.Intl&&Intl.NumberFormat.supportedLocalesOf(this.locale).length)};C.prototype.getPluralSuffix=function(t,e){if(e=Number(e),!isFinite(e))return"other";var n;if(this.hasIntlPluralRulesSupport()?n=new Intl.PluralRules(this.locale).select(e):n=this.selectPluralFormUsingFallbackRules(e),t+"."+n in this.translations)return n;if(t+".other"in this.translations)return console&&"warn"in console&&console.warn('i18n: Missing plural form ".'+n+'" for "'+this.locale+'" locale. Falling back to ".other".'),"other";throw new Error('i18n: Plural form ".other" is required for "'+this.locale+'" locale')};C.prototype.selectPluralFormUsingFallbackRules=function(t){t=Math.abs(Math.floor(t));var e=this.getPluralRulesForLocale();return e?C.pluralRules[e](t):"other"};C.prototype.getPluralRulesForLocale=function(){var t=this.locale,e=t.split("-")[0];for(var n in C.pluralRulesMap)if(Object.prototype.hasOwnProperty.call(C.pluralRulesMap,n)){for(var r=C.pluralRulesMap[n],o=0;o=3&&t%100<=10?"few":t%100>=11&&t%100<=99?"many":"other"},chinese:function(){return"other"},french:function(t){return t===0||t===1?"one":"other"},german:function(t){return t===1?"one":"other"},irish:function(t){return t===1?"one":t===2?"two":t>=3&&t<=6?"few":t>=7&&t<=10?"many":"other"},russian:function(t){var e=t%100,n=e%10;return n===1&&e!==11?"one":n>=2&&n<=4&&!(e>=12&&e<=14)?"few":n===0||n>=5&&n<=9||e>=11&&e<=14?"many":"other"},scottish:function(t){return t===1||t===11?"one":t===2||t===12?"two":t>=3&&t<=10||t>=13&&t<=19?"few":"other"},spanish:function(t){return t===1?"one":t%1e6===0&&t!==0?"many":"other"},welsh:function(t){return t===0?"zero":t===1?"one":t===2?"two":t===3?"few":t===6?"many":"other"}};(function(t){var e="DOMTokenList"in this&&function(n){return"classList"in n?!n.classList.toggle("x",!1)&&!n.className:!0}(document.createElement("x"));e||function(n){var r="DOMTokenList"in n&&n.DOMTokenList;(!r||document.createElementNS&&document.createElementNS("http://www.w3.org/2000/svg","svg")&&!(document.createElementNS("http://www.w3.org/2000/svg","svg").classList instanceof DOMTokenList))&&(n.DOMTokenList=function(){var o=!0,l=function(i,u,a,c){Object.defineProperty?Object.defineProperty(i,u,{configurable:o===!1?!0:!!c,get:a}):i.__defineGetter__(u,a)};try{l({},"support")}catch{o=!1}var s=function(i,u){var a=this,c=[],h={},p=0,m=0,d=function(f){l(a,f,function(){return b(),c[f]},!1)},E=function(){if(p>=m)for(;m>>0,typeof i[u]=="object"?i[u].baseVal=c.join(" "):i[u]=c.join(" "),E())},a.remove=function(){b.apply(a,f=arguments);for(var f,g={},v=0,T=[];v>>0,typeof i[u]=="object"?i[u].baseVal=c.join(" "):i[u]=c.join(" "),E()},a.toggle=function(f,g){return b.apply(a,[f]),t!==g?g?(a.add(f),!0):(a.remove(f),!1):h[f]?(a.remove(f),!1):(a.add(f),!0)},a};return s}()),function(){var o=document.createElement("span");"classList"in o&&(o.classList.toggle("x",!1),o.classList.contains("x")&&(o.classList.constructor.prototype.toggle=function(s){var i=arguments[1];if(i===t){var u=!this.contains(s);return this[u?"add":"remove"](s),u}return i=!!i,this[i?"add":"remove"](s),i}))}(),function(){var o=document.createElement("span");if("classList"in o&&(o.classList.add("a","b"),!o.classList.contains("b"))){var l=o.classList.constructor.prototype.add;o.classList.constructor.prototype.add=function(){for(var s=arguments,i=arguments.length,u=0;u"u"&&typeof importScripts!="function"&&function(n){n.constructor?n.Window=n.constructor:(n.Window=n.constructor=new Function("return function Window() {}")()).prototype=this}(this)}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});(function(t){var e=function(n){if(!("Event"in n))return!1;if(typeof n.Event=="function")return!0;try{return new Event("click"),!0}catch{return!1}}(this);e||function(){var n={click:1,dblclick:1,keyup:1,keypress:1,keydown:1,mousedown:1,mouseup:1,mousemove:1,mouseover:1,mouseenter:1,mouseleave:1,mouseout:1,storage:1,storagecommit:1,textinput:1};if(typeof document>"u"||typeof window>"u")return;function r(l,s){for(var i=-1,u=l.length;++i=this.lastInputTimestamp)&&this.updateIfValueChanged()}.bind(this),1e3)};L.prototype.handleBlur=function(){clearInterval(this.valueChecker)};L.prototype.updateIfValueChanged=function(){this.$textarea.value!==this.lastInputValue&&(this.lastInputValue=this.$textarea.value,this.updateCountMessage())};L.prototype.updateCountMessage=function(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()};L.prototype.updateVisibleCountMessage=function(){var t=this.$textarea,e=this.$visibleCountMessage,n=this.maxLength-this.count(t.value);this.isOverThreshold()?e.classList.remove("govuk-character-count__message--disabled"):e.classList.add("govuk-character-count__message--disabled"),n<0?(t.classList.add("govuk-textarea--error"),e.classList.remove("govuk-hint"),e.classList.add("govuk-error-message")):(t.classList.remove("govuk-textarea--error"),e.classList.remove("govuk-error-message"),e.classList.add("govuk-hint")),e.innerText=this.getCountMessage()};L.prototype.updateScreenReaderCountMessage=function(){var t=this.$screenReaderCountMessage;this.isOverThreshold()?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden","true"),t.innerText=this.getCountMessage()};L.prototype.count=function(t){if("maxwords"in this.config&&this.config.maxwords){var e=t.match(/\S+/g)||[];return e.length}else return t.length};L.prototype.getCountMessage=function(){var t=this.maxLength-this.count(this.$textarea.value),e="maxwords"in this.config&&this.config.maxwords?"words":"characters";return this.formatCountMessage(t,e)};L.prototype.formatCountMessage=function(t,e){if(t===0)return this.i18n.t(e+"AtLimit");var n=t<0?"OverLimit":"UnderLimit";return this.i18n.t(e+n,{count:Math.abs(t)})};L.prototype.isOverThreshold=function(){if(!this.config.threshold)return!0;var t=this.$textarea,e=this.count(t.value),n=this.maxLength,r=n*this.config.threshold/100;return r<=e};function A(t){if(!(t instanceof HTMLElement))return this;var e=t.querySelectorAll('input[type="checkbox"]');if(!e.length)return this;this.$module=t,this.$inputs=e}A.prototype.init=function(){if(!(!this.$module||!this.$inputs)){var t=this.$module,e=this.$inputs;w(e,function(n){var r=n.getAttribute("data-aria-controls");!r||!document.getElementById(r)||(n.setAttribute("aria-controls",r),n.removeAttribute("data-aria-controls"))}),window.addEventListener("onpageshow"in window?"pageshow":"DOMContentLoaded",this.syncAllConditionalReveals.bind(this)),this.syncAllConditionalReveals(),t.addEventListener("click",this.handleClick.bind(this))}};A.prototype.syncAllConditionalReveals=function(){w(this.$inputs,this.syncConditionalRevealWithInputState.bind(this))};A.prototype.syncConditionalRevealWithInputState=function(t){var e=t.getAttribute("aria-controls");if(e){var n=document.getElementById(e);if(n&&n.classList.contains("govuk-checkboxes__conditional")){var r=t.checked;t.setAttribute("aria-expanded",r.toString()),n.classList.toggle("govuk-checkboxes__conditional--hidden",!r)}}};A.prototype.unCheckAllInputsExcept=function(t){var e=this,n=document.querySelectorAll('input[type="checkbox"][name="'+t.name+'"]');w(n,function(r){var o=t.form===r.form;o&&r!==t&&(r.checked=!1,e.syncConditionalRevealWithInputState(r))})};A.prototype.unCheckExclusiveInputs=function(t){var e=this,n=document.querySelectorAll('input[data-behaviour="exclusive"][type="checkbox"][name="'+t.name+'"]');w(n,function(r){var o=t.form===r.form;o&&(r.checked=!1,e.syncConditionalRevealWithInputState(r))})};A.prototype.handleClick=function(t){var e=t.target;if(!(!(e instanceof HTMLInputElement)||e.type!=="checkbox")){var n=e.getAttribute("aria-controls");if(n&&this.syncConditionalRevealWithInputState(e),!!e.checked){var r=e.getAttribute("data-behaviour")==="exclusive";r?this.unCheckAllInputsExcept(e):this.unCheckExclusiveInputs(e)}}};var yt=13,Y=32;function O(t){if(!(t instanceof HTMLElement))return this;this.$module=t,this.$summary=null,this.$content=null}O.prototype.init=function(){if(this.$module){var t="HTMLDetailsElement"in window&&this.$module instanceof HTMLDetailsElement;t||this.polyfillDetails()}};O.prototype.polyfillDetails=function(){var t=this.$module,e=this.$summary=t.getElementsByTagName("summary").item(0),n=this.$content=t.getElementsByTagName("div").item(0);!e||!n||(n.id||(n.id="details-content-"+dt()),t.setAttribute("role","group"),e.setAttribute("role","button"),e.setAttribute("aria-controls",n.id),e.tabIndex=0,this.$module.hasAttribute("open")?e.setAttribute("aria-expanded","true"):(e.setAttribute("aria-expanded","false"),n.style.display="none"),this.polyfillHandleInputs(this.polyfillSetAttributes.bind(this)))};O.prototype.polyfillSetAttributes=function(){return this.$module.hasAttribute("open")?(this.$module.removeAttribute("open"),this.$summary.setAttribute("aria-expanded","false"),this.$content.style.display="none"):(this.$module.setAttribute("open","open"),this.$summary.setAttribute("aria-expanded","true"),this.$content.style.display=""),!0};O.prototype.polyfillHandleInputs=function(t){this.$summary.addEventListener("keypress",function(e){var n=e.target;(e.keyCode===yt||e.keyCode===Y)&&n instanceof HTMLElement&&n.nodeName.toLowerCase()==="summary"&&(e.preventDefault(),n.click?n.click():t(e))}),this.$summary.addEventListener("keyup",function(e){var n=e.target;e.keyCode===Y&&n instanceof HTMLElement&&n.nodeName.toLowerCase()==="summary"&&e.preventDefault()}),this.$summary.addEventListener("click",t)};function x(t,e){if(!(t instanceof HTMLElement))return this;this.$module=t;var n={disableAutoFocus:!1};this.config=$(n,e||{},I(t.dataset))}x.prototype.init=function(){if(this.$module){var t=this.$module;this.setFocus(),t.addEventListener("click",this.handleClick.bind(this))}};x.prototype.setFocus=function(){var t=this.$module;this.config.disableAutoFocus||(t.setAttribute("tabindex","-1"),t.addEventListener("blur",function(){t.removeAttribute("tabindex")}),t.focus())};x.prototype.handleClick=function(t){var e=t.target;this.focusTarget(e)&&t.preventDefault()};x.prototype.focusTarget=function(t){if(!(t instanceof HTMLAnchorElement))return!1;var e=this.getFragmentFromUrl(t.href);if(!e)return!1;var n=document.getElementById(e);if(!n)return!1;var r=this.getAssociatedLegendOrLabel(n);return r?(r.scrollIntoView(),n.focus({preventScroll:!0}),!0):!1};x.prototype.getFragmentFromUrl=function(t){if(t.indexOf("#")!==-1)return t.split("#").pop()};x.prototype.getAssociatedLegendOrLabel=function(t){var e=t.closest("fieldset");if(e){var n=e.getElementsByTagName("legend");if(n.length){var r=n[0];if(t instanceof HTMLInputElement&&(t.type==="checkbox"||t.type==="radio"))return r;var o=r.getBoundingClientRect().top,l=t.getBoundingClientRect();if(l.height&&window.innerHeight){var s=l.top+l.height;if(s-o0?this.$indicatorContainer.classList.add("govuk-exit-this-page__indicator--visible"):this.$indicatorContainer.classList.remove("govuk-exit-this-page__indicator--visible");var t=this.$indicatorContainer.querySelectorAll(".govuk-exit-this-page__indicator-light");w(t,function(e,n){e.classList.toggle("govuk-exit-this-page__indicator-light--on",n=3?(this.keypressCounter=0,this.keypressTimeoutId!==null&&(clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null),this.exitPage()):this.keypressCounter===1?this.$updateSpan.innerText=this.i18n.t("pressTwoMoreTimes"):this.$updateSpan.innerText=this.i18n.t("pressOneMoreTime"),this.setKeypressTimer()):this.keypressTimeoutId!==null&&this.resetKeypressTimer(),this.lastKeyWasModified=t.shiftKey};k.prototype.setKeypressTimer=function(){clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=setTimeout(this.resetKeypressTimer.bind(this),this.timeoutTime)};k.prototype.resetKeypressTimer=function(){clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null,this.keypressCounter=0,this.$updateSpan.innerText=this.i18n.t("timedOut"),this.timeoutMessageId=setTimeout(function(){this.$updateSpan.innerText=""}.bind(this),this.timeoutTime),this.updateIndicator()};k.prototype.resetPage=function(){document.body.classList.remove("govuk-exit-this-page-hide-content"),this.$overlay&&(this.$overlay.remove(),this.$overlay=null),this.$updateSpan.setAttribute("role","status"),this.$updateSpan.innerText="",this.updateIndicator(),this.keypressTimeoutId&&clearTimeout(this.keypressTimeoutId),this.timeoutMessageId&&clearTimeout(this.timeoutMessageId)};k.prototype.init=function(){this.buildIndicator(),this.initUpdateSpan(),this.initButtonClickHandler(),"govukFrontendExitThisPageKeypress"in document.body.dataset||(document.addEventListener("keyup",this.handleKeypress.bind(this),!0),document.body.dataset.govukFrontendExitThisPageKeypress="true"),window.addEventListener("onpageshow"in window?"pageshow":"DOMContentLoaded",this.resetPage.bind(this))};function q(t){if(!(t instanceof HTMLElement))return this;this.$module=t,this.$menuButton=t.querySelector(".govuk-js-header-toggle"),this.$menu=this.$menuButton&&t.querySelector("#"+this.$menuButton.getAttribute("aria-controls")),this.menuIsOpen=!1,this.mql=null}q.prototype.init=function(){!this.$module||!this.$menuButton||!this.$menu||("matchMedia"in window?(this.mql=window.matchMedia("(min-width: 48.0625em)"),"addEventListener"in this.mql?this.mql.addEventListener("change",this.syncState.bind(this)):this.mql.addListener(this.syncState.bind(this)),this.syncState(),this.$menuButton.addEventListener("click",this.handleMenuButtonClick.bind(this))):this.$menuButton.setAttribute("hidden",""))};q.prototype.syncState=function(){this.mql.matches?(this.$menu.removeAttribute("hidden"),this.$menuButton.setAttribute("hidden","")):(this.$menuButton.removeAttribute("hidden"),this.$menuButton.setAttribute("aria-expanded",this.menuIsOpen.toString()),this.menuIsOpen?this.$menu.removeAttribute("hidden"):this.$menu.setAttribute("hidden",""))};q.prototype.handleMenuButtonClick=function(){this.menuIsOpen=!this.menuIsOpen,this.syncState()};function V(t,e){if(!(t instanceof HTMLElement))return this;this.$module=t;var n={disableAutoFocus:!1};this.config=$(n,e||{},I(t.dataset))}V.prototype.init=function(){this.$module&&this.setFocus()};V.prototype.setFocus=function(){var t=this.$module;this.config.disableAutoFocus||t.getAttribute("role")==="alert"&&(t.getAttribute("tabindex")||(t.setAttribute("tabindex","-1"),t.addEventListener("blur",function(){t.removeAttribute("tabindex")})),t.focus())};function j(t){if(!(t instanceof HTMLElement))return this;var e=t.querySelectorAll('input[type="radio"]');if(!e.length)return this;this.$module=t,this.$inputs=e}j.prototype.init=function(){if(!(!this.$module||!this.$inputs)){var t=this.$module,e=this.$inputs;w(e,function(n){var r=n.getAttribute("data-aria-controls");!r||!document.getElementById(r)||(n.setAttribute("aria-controls",r),n.removeAttribute("data-aria-controls"))}),window.addEventListener("onpageshow"in window?"pageshow":"DOMContentLoaded",this.syncAllConditionalReveals.bind(this)),this.syncAllConditionalReveals(),t.addEventListener("click",this.handleClick.bind(this))}};j.prototype.syncAllConditionalReveals=function(){w(this.$inputs,this.syncConditionalRevealWithInputState.bind(this))};j.prototype.syncConditionalRevealWithInputState=function(t){var e=t.getAttribute("aria-controls");if(e){var n=document.getElementById(e);if(n&&n.classList.contains("govuk-radios__conditional")){var r=t.checked;t.setAttribute("aria-expanded",r.toString()),n.classList.toggle("govuk-radios__conditional--hidden",!r)}}};j.prototype.handleClick=function(t){var e=this,n=t.target;if(!(!(n instanceof HTMLInputElement)||n.type!=="radio")){var r=document.querySelectorAll('input[type="radio"][aria-controls]'),o=n.form,l=n.name;w(r,function(s){var i=s.form===o,u=s.name===l;u&&i&&e.syncConditionalRevealWithInputState(s)})}};function M(t){if(!(t instanceof HTMLAnchorElement))return this;this.$module=t,this.$linkedElement=null,this.linkedElementListener=!1}M.prototype.init=function(){if(this.$module){var t=this.getLinkedElement();t&&(this.$linkedElement=t,this.$module.addEventListener("click",this.focusLinkedElement.bind(this)))}};M.prototype.getLinkedElement=function(){var t=this.getFragmentFromUrl();return t?document.getElementById(t):null};M.prototype.focusLinkedElement=function(){var t=this.$linkedElement;t.getAttribute("tabindex")||(t.setAttribute("tabindex","-1"),t.classList.add("govuk-skip-link-focused-element"),this.linkedElementListener||(this.$linkedElement.addEventListener("blur",this.removeFocusProperties.bind(this)),this.linkedElementListener=!0)),t.focus()};M.prototype.removeFocusProperties=function(){this.$linkedElement.removeAttribute("tabindex"),this.$linkedElement.classList.remove("govuk-skip-link-focused-element")};M.prototype.getFragmentFromUrl=function(){if(this.$module.hash)return this.$module.hash.split("#").pop()};(function(t){var e="document"in this&&"nextElementSibling"in document.documentElement;e||Object.defineProperty(Element.prototype,"nextElementSibling",{get:function(){for(var n=this.nextSibling;n&&n.nodeType!==1;)n=n.nextSibling;return n}})}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});(function(t){var e="document"in this&&"previousElementSibling"in document.documentElement;e||Object.defineProperty(Element.prototype,"previousElementSibling",{get:function(){for(var n=this.previousSibling;n&&n.nodeType!==1;)n=n.previousSibling;return n}})}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});function y(t){if(!(t instanceof HTMLElement))return this;var e=t.querySelectorAll("a.govuk-tabs__tab");if(!e.length)return this;this.$module=t,this.$tabs=e,this.keys={left:37,right:39,up:38,down:40},this.jsHiddenClass="govuk-tabs__panel--hidden",this.boundTabClick=this.onTabClick.bind(this),this.boundTabKeydown=this.onTabKeydown.bind(this),this.boundOnHashChange=this.onHashChange.bind(this),this.changingHash=!1}y.prototype.init=function(){!this.$module||!this.$tabs||(typeof window.matchMedia=="function"?this.setupResponsiveChecks():this.setup())};y.prototype.setupResponsiveChecks=function(){this.mql=window.matchMedia("(min-width: 40.0625em)"),this.mql.addListener(this.checkMode.bind(this)),this.checkMode()};y.prototype.checkMode=function(){this.mql.matches?this.setup():this.teardown()};y.prototype.setup=function(){var t=this,e=this.$module,n=this.$tabs,r=e.querySelector(".govuk-tabs__list"),o=e.querySelectorAll(".govuk-tabs__list-item");if(!(!n||!r||!o)){r.setAttribute("role","tablist"),w(o,function(s){s.setAttribute("role","presentation")}),w(n,function(s){t.setAttributes(s),s.addEventListener("click",t.boundTabClick,!0),s.addEventListener("keydown",t.boundTabKeydown,!0),t.hideTab(s)});var l=this.getTab(window.location.hash)||this.$tabs[0];l&&(this.showTab(l),window.addEventListener("hashchange",this.boundOnHashChange,!0))}};y.prototype.teardown=function(){var t=this,e=this.$module,n=this.$tabs,r=e.querySelector(".govuk-tabs__list"),o=e.querySelectorAll("a.govuk-tabs__list-item");!n||!r||!o||(r.removeAttribute("role"),w(o,function(l){l.removeAttribute("role")}),w(n,function(l){l.removeEventListener("click",t.boundTabClick,!0),l.removeEventListener("keydown",t.boundTabKeydown,!0),t.unsetAttributes(l)}),window.removeEventListener("hashchange",this.boundOnHashChange,!0))};y.prototype.onHashChange=function(){var t=window.location.hash,e=this.getTab(t);if(e){if(this.changingHash){this.changingHash=!1;return}var n=this.getCurrentTab();n&&(this.hideTab(n),this.showTab(e),e.focus())}};y.prototype.hideTab=function(t){this.unhighlightTab(t),this.hidePanel(t)};y.prototype.showTab=function(t){this.highlightTab(t),this.showPanel(t)};y.prototype.getTab=function(t){return this.$module.querySelector('a.govuk-tabs__tab[href="'+t+'"]')};y.prototype.setAttributes=function(t){var e=this.getHref(t).slice(1);t.setAttribute("id","tab_"+e),t.setAttribute("role","tab"),t.setAttribute("aria-controls",e),t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");var n=this.getPanel(t);n&&(n.setAttribute("role","tabpanel"),n.setAttribute("aria-labelledby",t.id),n.classList.add(this.jsHiddenClass))};y.prototype.unsetAttributes=function(t){t.removeAttribute("id"),t.removeAttribute("role"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-selected"),t.removeAttribute("tabindex");var e=this.getPanel(t);e&&(e.removeAttribute("role"),e.removeAttribute("aria-labelledby"),e.classList.remove(this.jsHiddenClass))};y.prototype.onTabClick=function(t){var e=this.getCurrentTab(),n=t.currentTarget;!e||!(n instanceof HTMLAnchorElement)||(t.preventDefault(),this.hideTab(e),this.showTab(n),this.createHistoryEntry(n))};y.prototype.createHistoryEntry=function(t){var e=this.getPanel(t);if(e){var n=e.id;e.id="",this.changingHash=!0,window.location.hash=this.getHref(t).slice(1),e.id=n}};y.prototype.onTabKeydown=function(t){switch(t.keyCode){case this.keys.left:case this.keys.up:this.activatePreviousTab(),t.preventDefault();break;case this.keys.right:case this.keys.down:this.activateNextTab(),t.preventDefault();break}};y.prototype.activateNextTab=function(){var t=this.getCurrentTab();if(!(!t||!t.parentElement)){var e=t.parentElement.nextElementSibling;if(e){var n=e.querySelector("a.govuk-tabs__tab");n&&(this.hideTab(t),this.showTab(n),n.focus(),this.createHistoryEntry(n))}}};y.prototype.activatePreviousTab=function(){var t=this.getCurrentTab();if(!(!t||!t.parentElement)){var e=t.parentElement.previousElementSibling;if(e){var n=e.querySelector("a.govuk-tabs__tab");n&&(this.hideTab(t),this.showTab(n),n.focus(),this.createHistoryEntry(n))}}};y.prototype.getPanel=function(t){return this.$module.querySelector(this.getHref(t))};y.prototype.showPanel=function(t){var e=this.getPanel(t);e&&e.classList.remove(this.jsHiddenClass)};y.prototype.hidePanel=function(t){var e=this.getPanel(t);e&&e.classList.add(this.jsHiddenClass)};y.prototype.unhighlightTab=function(t){t.parentElement&&(t.setAttribute("aria-selected","false"),t.parentElement.classList.remove("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","-1"))};y.prototype.highlightTab=function(t){t.parentElement&&(t.setAttribute("aria-selected","true"),t.parentElement.classList.add("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","0"))};y.prototype.getCurrentTab=function(){return this.$module.querySelector(".govuk-tabs__list-item--selected a.govuk-tabs__tab")};y.prototype.getHref=function(t){var e=t.getAttribute("href"),n=e.slice(e.indexOf("#"),e.length);return n};function St(t){t=typeof t<"u"?t:{};var e=t.scope instanceof HTMLElement?t.scope:document,n=e.querySelectorAll('[data-module="govuk-accordion"]');w(n,function(d){new S(d,t.accordion).init()});var r=e.querySelectorAll('[data-module="govuk-button"]');w(r,function(d){new B(d,t.button).init()});var o=e.querySelectorAll('[data-module="govuk-character-count"]');w(o,function(d){new L(d,t.characterCount).init()});var l=e.querySelectorAll('[data-module="govuk-checkboxes"]');w(l,function(d){new A(d).init()});var s=e.querySelectorAll('[data-module="govuk-details"]');w(s,function(d){new O(d).init()});var i=e.querySelector('[data-module="govuk-error-summary"]');i&&new x(i,t.errorSummary).init();var u=e.querySelectorAll('[data-module="govuk-exit-this-page"]');w(u,function(d){new k(d,t.exitThisPage).init()});var a=e.querySelector('[data-module="govuk-header"]');a&&new q(a).init();var c=e.querySelectorAll('[data-module="govuk-notification-banner"]');w(c,function(d){new V(d,t.notificationBanner).init()});var h=e.querySelectorAll('[data-module="govuk-radios"]');w(h,function(d){new j(d).init()});var p=e.querySelector('[data-module="govuk-skip-link"]');p&&new M(p).init();var m=e.querySelectorAll('[data-module="govuk-tabs"]');w(m,function(d){new y(d).init()})}function Et(t){let e,n,r,o,l;const s=t[3].default,i=tt(s,t,t[2],null);return{c(){e=G("div"),n=G("label"),r=et(t[0]),o=nt(),i&&i.c(),F(n,"class","govuk-label"),F(n,"for",t[1]),F(e,"class","govuk-form-group")},m(u,a){it(u,e,a),W(e,n),W(n,r),W(e,o),i&&i.m(e,null),l=!0},p(u,[a]){(!l||a&1)&&rt(r,u[0]),(!l||a&2)&&F(n,"for",u[1]),i&&i.p&&(!l||a&4)&&ot(i,s,u,u[2],l?at(s,u[2],a,null):st(u[2]),null)},i(u){l||(lt(i,u),l=!0)},o(u){ut(i,u),l=!1},d(u){u&&ct(e),i&&i.d(u)}}}function Tt(t,e,n){let{$$slots:r={},$$scope:o}=e,{label:l}=e,{id:s}=e;return t.$$set=i=>{"label"in i&&n(0,l=i.label),"id"in i&&n(1,s=i.id),"$$scope"in i&&n(2,o=i.$$scope)},[l,s,o,r]}class Lt extends J{constructor(e){super(),Q(this,e,Tt,Et,Z,{label:0,id:1})}}export{Lt as F,St as i}; diff --git a/govuk_step2/assets/ZoomOutMap-e4c4885e.js b/govuk_step2/assets/ZoomOutMap-3b70466a.js similarity index 71% rename from govuk_step2/assets/ZoomOutMap-e4c4885e.js rename to govuk_step2/assets/ZoomOutMap-3b70466a.js index 613bcbacc..47384d2da 100644 --- a/govuk_step2/assets/ZoomOutMap-e4c4885e.js +++ b/govuk_step2/assets/ZoomOutMap-3b70466a.js @@ -1,2 +1,2 @@ -import{S as j,i as E,s as B,e as d,p as C,A as N,as as oe,r as _,d as b,v as p,at as A,l as Z,x as O,k as v,B as ae,ar as ie,W as re,c as R,q as $,aE as H,u as q,g as F,f as G,t as I,j as D,P as J,R as ce,V as U,U as K,T as ue,Z as fe,Y as de,X,w as pe,L as z,$ as ee,G as te,H as se,J as ne,ai as M,aj as me,ak as _e,aF as ge,K as be,D as ve,C as ye,aq as he,M as we}from"./maplibre_helpers-e26a4314.js";function ke(n){let e,l,t,s,o,a,c;return{c(){e=d("div"),l=C(`Basemap: - `),t=d("select"),s=d("option"),s.textContent="Streets",o=d("option"),o.textContent="Satellite",s.__value="streets",N(s,s.__value),o.__value="hybrid",N(o,o.__value),n[0]===void 0&&oe(()=>n[2].call(t)),_(e,"class","svelte-1tbnm6i")},m(f,i){b(f,e,i),p(e,l),p(e,t),p(t,s),p(t,o),A(t,n[0],!0),a||(c=[Z(t,"change",n[2]),Z(t,"change",n[1])],a=!0)},p(f,[i]){i&1&&A(t,f[0])},i:O,o:O,d(f){f&&v(e),a=!1,ae(c)}}}function Se(n,e,l){let{style:t}=e;function s(){let a=new URLSearchParams(window.location.search);a.set("style",t);let c=`${window.location.pathname}?${a.toString()}${window.location.hash}`;window.location.href=c}function o(){t=ie(this),l(0,t)}return n.$$set=a=>{"style"in a&&l(0,t=a.style)},[t,s,o]}class xe extends j{constructor(e){super(),E(this,e,Se,ke,B,{style:0})}}const T=[];function L(n,e=O){let l;const t=new Set;function s(c){if(B(n,c)&&(n=c,l)){const f=!T.length;for(const i of t)i[1](),T.push(i,n);if(f){for(let i=0;i{t.delete(i),t.size===0&&l&&(l(),l=null)}}return{set:s,update:o,subscribe:a}}function Ce(n){return n=="google"||n=="bing"}function et(n){return{v1:"Scheme Design",v2:"Experimental Scheme Design",planning:"Development Planning",criticals:"Critical Issues",atf4:"ATF4 Scheme"}[n]}const V=L(null),tt=L(null),le=L(re()),Le=L(null),$e=L(null),Ie=L(null),Be=L(null),Me=L(Oe());Me.subscribe(n=>window.localStorage.setItem("userSettings",JSON.stringify(n)));const st=L("edit-attribute"),nt=L(!1);function lt(n){let e=new Set;for(let t of n.features)e.add(t.id);let l=e.size+1;for(;e.has(l);)l++;return l}function ot(n){console.log(`Deleting intervention ${n}`),le.update(e=>(e.features=e.features.filter(l=>l.id!=n),e)),Le.set(null),$e.set(null),Ie.set(null),Be.set(null)}function Oe(){let n={streetViewImagery:"google",avoidDoublingBack:!1};try{let e=JSON.parse(window.localStorage.getItem("userSettings")||"{}");Ce(e.streetViewImagery)&&(n.streetViewImagery=e.streetViewImagery),typeof e.avoidDoublingBack=="boolean"&&(n.avoidDoublingBack=e.avoidDoublingBack)}catch(e){console.log(`Couldn't parse userSettings from local storage: ${e}`)}return n}const De=n=>({}),Y=n=>({}),je=n=>({}),Q=n=>({});function Ee(n){let e,l,t,s,o,a,c,f,i,r,y;const h=n[3].sidebar,m=R(h,n,n[2],Q),S=n[3].main,w=R(S,n,n[2],Y);return{c(){e=d("div"),l=d("aside"),t=d("div"),m&&m.c(),s=$(),o=d("button"),o.textContent="→",c=$(),f=d("main"),w&&w.c(),_(t,"class","sidebar-content content-container svelte-ect12w"),_(o,"type","button"),_(o,"class","sidebar-toggle rounded-rect svelte-ect12w"),_(l,"class",a=H(n[0]?"":"collapsed")+" svelte-ect12w"),_(f,"class","svelte-ect12w"),_(e,"class","overall-layout svelte-ect12w")},m(u,g){b(u,e,g),p(e,l),p(l,t),m&&m.m(t,null),p(l,s),p(l,o),p(e,c),p(e,f),w&&w.m(f,null),i=!0,r||(y=Z(o,"click",n[1]),r=!0)},p(u,[g]){m&&m.p&&(!i||g&4)&&q(m,h,u,u[2],i?G(h,u[2],g,je):F(u[2]),Q),(!i||g&1&&a!==(a=H(u[0]?"":"collapsed")+" svelte-ect12w"))&&_(l,"class",a),w&&w.p&&(!i||g&4)&&q(w,S,u,u[2],i?G(S,u[2],g,De):F(u[2]),Y)},i(u){i||(I(m,u),I(w,u),i=!0)},o(u){D(m,u),D(w,u),i=!1},d(u){u&&v(e),m&&m.d(u),w&&w.d(u),r=!1,y()}}}function Pe(n,e,l){let{$$slots:t={},$$scope:s}=e,o=!0;function a(){l(0,o=!o)}return n.$$set=c=>{"$$scope"in c&&l(2,s=c.$$scope)},[o,a,s,t]}class at extends j{constructor(e){super(),E(this,e,Pe,Ee,B,{})}}const k={area:"#D94324",route:"#555F5E",crossing:"#4daf4a",other:"#984ea3",preapp:"#e41a1c",outline:"#377eb8","reserved matters":"#4daf4a","local plan":"#984ea3",hovering:"black",lineEndpointColor:"black"},Te=10,W=10;let P="interventions";function ze(n,e,l){let t,s;J(n,V,r=>l(1,t=r)),J(n,le,r=>l(2,s=r));let{schema:o}=e;ce(t,P,s);const a=["match",["get","intervention_type"],"area",k.area,"route",k.route,"crossing",k.crossing,"other",k.other,"white"],c=["match",["get","reference_type",["get","planning"]],"preapp",k.preapp,"outline",k.outline,"reserved matters",k["reserved matters"],"local plan",k["local plan"],"white"],f=["!=","hide_while_editing",!0];return U(t,{id:"interventions-points",source:P,filter:["all",fe,f,["!=","endpoint",!0]],color:a,radius:Te}),K(t,{id:"interventions-lines",source:P,filter:["all",de,f],color:a,width:W}),U(t,{id:"interventions-lines-endpoints",source:P,filter:["==","endpoint",!0],radius:.5*W,opacity:0,strokeColor:k.lineEndpointColor,strokeWidth:2}),ue(t,{id:"interventions-polygons",source:P,filter:["all",X,f],color:o=="planning"?c:a,opacity:.2}),K(t,{id:"interventions-polygon-outlines",source:P,filter:["all",X,f],color:o=="planning"?c:a,opacity:.5,width:.7*W}),n.$$set=r=>{"schema"in r&&l(0,o=r.schema)},n.$$.update=()=>{if(n.$$.dirty&6){let r=JSON.parse(JSON.stringify(s)),y=[];for(let h of r.features)if(h.geometry.type=="LineString"&&!h.properties.hide_while_editing)for(let m of[h.geometry.coordinates[0],h.geometry.coordinates[h.geometry.coordinates.length-1]])y.push({type:"Feature",properties:{endpoint:!0},geometry:{type:"Point",coordinates:m}});r.features=r.features.concat(y),t.getSource(P).setData(r)}},[o,t,s]}class it extends j{constructor(e){super(),E(this,e,ze,null,B,{schema:0})}}function Re(n){let e,l,t,s,o,a,c;const f=n[3].default,i=R(f,n,n[2],null);return{c(){e=d("details"),l=d("summary"),t=d("span"),s=C(n[0]),o=$(),a=d("div"),i&&i.c(),_(t,"class","govuk-details__summary-text"),_(l,"class","govuk-details__summary"),_(a,"class","govuk-details__text"),e.open=n[1],_(e,"class","govuk-details"),_(e,"data-module","govuk-details")},m(r,y){b(r,e,y),p(e,l),p(l,t),p(t,s),p(e,o),p(e,a),i&&i.m(a,null),c=!0},p(r,[y]){(!c||y&1)&&pe(s,r[0]),i&&i.p&&(!c||y&4)&&q(i,f,r,r[2],c?G(f,r[2],y,null):F(r[2]),null),(!c||y&2)&&(e.open=r[1])},i(r){c||(I(i,r),c=!0)},o(r){D(i,r),c=!1},d(r){r&&v(e),i&&i.d(r)}}}function qe(n,e,l){let{$$slots:t={},$$scope:s}=e,{label:o}=e,{open:a=!1}=e;return n.$$set=c=>{"label"in c&&l(0,o=c.label),"open"in c&&l(1,a=c.open),"$$scope"in c&&l(2,s=c.$$scope)},[o,a,s,t]}class Fe extends j{constructor(e){super(),E(this,e,qe,Re,B,{label:0,open:1})}}function Ge(n,e,l){let t;J(n,V,i=>l(2,t=i));let{layers:s}=e,{contents:o}=e,a=new z.Popup({closeButton:!1,closeOnClick:!1,maxWidth:"none"});t.on("mousemove",c),t.on("mouseout",f),ee(()=>{t.off("mousemove",c),t.off("mouseout",f),a.remove()});function c(i){if(!s.every(y=>t.getLayer(y))){a.remove();return}let r=t.queryRenderedFeatures(i.point,{layers:s});r.length>0?a.setLngLat(i.lngLat).setHTML(o(r[0].properties)).addTo(t):a.remove()}function f(){a.remove()}return n.$$set=i=>{"layers"in i&&l(0,s=i.layers),"contents"in i&&l(1,o=i.contents)},[s,o]}class rt extends j{constructor(e){super(),E(this,e,Ge,null,B,{layers:0,contents:1})}}function Je(n){let e,l,t,s,o,a,c,f,i,r,y,h,m,S,w;return{c(){e=d("li"),l=d("span"),t=C("Areas"),s=$(),o=d("li"),a=d("span"),c=C("Routes"),f=$(),i=d("li"),r=d("span"),y=C("Crossings"),h=$(),m=d("li"),S=d("span"),w=C("Other"),_(l,"class","svelte-l42ea0"),M(l,"background",k.area),_(a,"class","svelte-l42ea0"),M(a,"background",k.route),_(r,"class","svelte-l42ea0"),M(r,"background",k.crossing),_(S,"class","svelte-l42ea0"),M(S,"background",k.other)},m(u,g){b(u,e,g),p(e,l),p(e,t),b(u,s,g),b(u,o,g),p(o,a),p(o,c),b(u,f,g),b(u,i,g),p(i,r),p(i,y),b(u,h,g),b(u,m,g),p(m,S),p(m,w)},p:O,d(u){u&&(v(e),v(s),v(o),v(f),v(i),v(h),v(m))}}}function Ve(n){let e,l,t,s,o,a,c,f,i,r,y,h,m,S,w;return{c(){e=d("li"),l=d("span"),t=C("Preapp"),s=$(),o=d("li"),a=d("span"),c=C("Outline"),f=$(),i=d("li"),r=d("span"),y=C("Reserved matters"),h=$(),m=d("li"),S=d("span"),w=C("Local plan"),_(l,"class","svelte-l42ea0"),M(l,"background",k.preapp),_(a,"class","svelte-l42ea0"),M(a,"background",k.outline),_(r,"class","svelte-l42ea0"),M(r,"background",k["reserved matters"]),_(S,"class","svelte-l42ea0"),M(S,"background",k["local plan"])},m(u,g){b(u,e,g),p(e,l),p(e,t),b(u,s,g),b(u,o,g),p(o,a),p(o,c),b(u,f,g),b(u,i,g),p(i,r),p(i,y),b(u,h,g),b(u,m,g),p(m,S),p(m,w)},p:O,d(u){u&&(v(e),v(s),v(o),v(f),v(i),v(h),v(m))}}}function We(n){let e;function l(o,a){return o[0]=="planning"?Ve:Je}let t=l(n),s=t(n);return{c(){e=d("ul"),s.c()},m(o,a){b(o,e,a),s.m(e,null)},p(o,a){t===(t=l(o))&&s?s.p(o,a):(s.d(1),s=t(o),s&&(s.c(),s.m(e,null)))},d(o){o&&v(e),s.d()}}}function Ze(n){let e,l,t;return l=new Fe({props:{label:"Objects",open:!0,$$slots:{default:[We]},$$scope:{ctx:n}}}),{c(){e=d("div"),te(l.$$.fragment),_(e,"class","svelte-l42ea0")},m(s,o){b(s,e,o),se(l,e,null),t=!0},p(s,[o]){const a={};o&3&&(a.$$scope={dirty:o,ctx:s}),l.$set(a)},i(s){t||(I(l.$$.fragment,s),t=!0)},o(s){D(l.$$.fragment,s),t=!1},d(s){s&&v(e),ne(l)}}}function Ne(n,e,l){let{schema:t}=e;return n.$$set=s=>{"schema"in s&&l(0,t=s.schema)},[t]}class ct extends j{constructor(e){super(),E(this,e,Ne,Ze,B,{schema:0})}}function x(n){let e;const l=n[4].default,t=R(l,n,n[3],null);return{c(){t&&t.c()},m(s,o){t&&t.m(s,o),e=!0},p(s,o){t&&t.p&&(!e||o&8)&&q(t,l,s,s[3],e?G(l,s[3],o,null):F(s[3]),null)},i(s){e||(I(t,s),e=!0)},o(s){D(t,s),e=!1},d(s){t&&t.d(s)}}}function Ae(n){let e,l,t=n[1]&&x(n);return{c(){e=d("div"),t&&t.c(),_(e,"class","map svelte-12dpf1u")},m(s,o){b(s,e,o),t&&t.m(e,null),n[5](e),l=!0},p(s,[o]){s[1]?t?(t.p(s,o),o&2&&I(t,1)):(t=x(s),t.c(),I(t,1),t.m(e,null)):t&&(me(),D(t,1,1,()=>{t=null}),_e())},i(s){l||(I(t),l=!0)},o(s){D(t),l=!1},d(s){s&&v(e),t&&t.d(),n[5](null)}}}function He(n,e,l){let{$$slots:t={},$$scope:s}=e,{style:o}=e,a,c,f=!1;ge("setCamera",!window.location.hash),be(()=>{a=new z.Map({container:c,style:`https://api.maptiler.com/maps/${o}/style.json?key=MZEJTanw3WpxRvt7qDfo`,hash:!0}),a.addControl(new z.ScaleControl({})),a.addControl(new z.NavigationControl({visualizePitch:!0}),"bottom-right"),a.on("load",()=>{l(1,f=!0),V.set(a)}),new ResizeObserver(()=>{a.resize()}).observe(c)}),ee(()=>{a.remove()});function i(r){ve[r?"unshift":"push"](()=>{c=r,l(0,c)})}return n.$$set=r=>{"style"in r&&l(2,o=r.style),"$$scope"in r&&l(3,s=r.$$scope)},[c,f,o,s,t,i]}class ut extends j{constructor(e){super(),E(this,e,He,Ae,B,{style:2})}}const Ue="/atip/govuk_step2/assets/zoom_out_map-b2e1091a.svg";function Ke(n){let e,l;return{c(){e=d("img"),he(e.src,l=Ue)||_(e,"src",l),_(e,"alt","Zoom to show entire boundary")},m(t,s){b(t,e,s)},p:O,d(t){t&&v(e)}}}function Xe(n){let e,l;return e=new ye({props:{title:"Zoom to show entire boundary",$$slots:{default:[Ke]},$$scope:{ctx:n}}}),e.$on("click",n[0]),{c(){te(e.$$.fragment)},m(t,s){se(e,t,s),l=!0},p(t,[s]){const o={};s&8&&(o.$$scope={dirty:s,ctx:t}),e.$set(o)},i(t){l||(I(e.$$.fragment,t),l=!0)},o(t){D(e.$$.fragment,t),l=!1},d(t){ne(e,t)}}}function Ye(n,e,l){let t;J(n,V,a=>l(2,t=a));let{boundaryGeojson:s}=e;function o(){t.fitBounds(we(s),{padding:20,animate:!0,duration:500})}return n.$$set=a=>{"boundaryGeojson"in a&&l(1,s=a.boundaryGeojson)},[o,s]}class ft extends j{constructor(e){super(),E(this,e,Ye,Xe,B,{boundaryGeojson:1})}}export{xe as B,Fe as C,it as I,at as L,rt as M,ft as Z,$e as a,Te as b,k as c,st as d,ot as e,Le as f,le as g,et as h,nt as i,ut as j,ct as k,W as l,V as m,lt as n,Be as o,tt as r,Ie as s,Me as u}; +import{S as j,i as T,s as B,e as d,p as C,A as J,at as oe,r as _,d as b,v as p,au as A,l as Z,x as O,k as v,B as ae,as as ie,X as re,c as R,q as $,aF as H,u as q,g as F,f as G,t as I,j as D,Q as N,T as ce,W as U,V as K,U as ue,_ as fe,Z as de,Y as Q,w as pe,M as P,a0 as ee,H as te,I as se,K as ne,aj as M,ak as me,al as _e,aG as ge,L as be,D as ve,C as ye,ar as he,N as we}from"./maplibre_helpers-5d84afaa.js";function ke(n){let e,l,t,s,o,a,c;return{c(){e=d("div"),l=C(`Basemap: + `),t=d("select"),s=d("option"),s.textContent="Streets",o=d("option"),o.textContent="Satellite",s.__value="streets",J(s,s.__value),o.__value="hybrid",J(o,o.__value),n[0]===void 0&&oe(()=>n[2].call(t)),_(e,"class","svelte-1tbnm6i")},m(f,i){b(f,e,i),p(e,l),p(e,t),p(t,s),p(t,o),A(t,n[0],!0),a||(c=[Z(t,"change",n[2]),Z(t,"change",n[1])],a=!0)},p(f,[i]){i&1&&A(t,f[0])},i:O,o:O,d(f){f&&v(e),a=!1,ae(c)}}}function Se(n,e,l){let{style:t}=e;function s(){let a=new URLSearchParams(window.location.search);a.set("style",t);let c=`${window.location.pathname}?${a.toString()}${window.location.hash}`;window.location.href=c}function o(){t=ie(this),l(0,t)}return n.$$set=a=>{"style"in a&&l(0,t=a.style)},[t,s,o]}class xe extends j{constructor(e){super(),T(this,e,Se,ke,B,{style:0})}}const E=[];function L(n,e=O){let l;const t=new Set;function s(c){if(B(n,c)&&(n=c,l)){const f=!E.length;for(const i of t)i[1](),E.push(i,n);if(f){for(let i=0;i{t.delete(i),t.size===0&&l&&(l(),l=null)}}return{set:s,update:o,subscribe:a}}function Ce(n){return n=="google"||n=="bing"}function et(n){return{v1:"Scheme Design",v2:"Experimental Scheme Design",planning:"Development Planning",criticals:"Critical Issues",atf4:"ATF4 Scheme"}[n]}const V=L(null),tt=L(null),le=L(re()),Le=L(null),$e=L(null),Ie=L(null),Be=L(null),Me=L(Oe());Me.subscribe(n=>window.localStorage.setItem("userSettings",JSON.stringify(n)));const st=L("edit-attribute"),nt=L(!1);function lt(n){let e=new Set;for(let t of n.features)e.add(t.id);let l=e.size+1;for(;e.has(l);)l++;return l}function ot(n){console.log(`Deleting intervention ${n}`),le.update(e=>(e.features=e.features.filter(l=>l.id!=n),e)),Le.set(null),$e.set(null),Ie.set(null),Be.set(null)}function Oe(){let n={streetViewImagery:"google",avoidDoublingBack:!1};try{let e=JSON.parse(window.localStorage.getItem("userSettings")||"{}");Ce(e.streetViewImagery)&&(n.streetViewImagery=e.streetViewImagery),typeof e.avoidDoublingBack=="boolean"&&(n.avoidDoublingBack=e.avoidDoublingBack)}catch(e){console.log(`Couldn't parse userSettings from local storage: ${e}`)}return n}const De=n=>({}),X=n=>({}),je=n=>({}),Y=n=>({});function Te(n){let e,l,t,s,o,a,c,f,i,r,y;const h=n[3].sidebar,m=R(h,n,n[2],Y),S=n[3].main,w=R(S,n,n[2],X);return{c(){e=d("div"),l=d("aside"),t=d("div"),m&&m.c(),s=$(),o=d("button"),o.textContent="→",c=$(),f=d("main"),w&&w.c(),_(t,"class","sidebar-content content-container svelte-ect12w"),_(o,"type","button"),_(o,"class","sidebar-toggle rounded-rect svelte-ect12w"),_(l,"class",a=H(n[0]?"":"collapsed")+" svelte-ect12w"),_(f,"class","svelte-ect12w"),_(e,"class","overall-layout svelte-ect12w")},m(u,g){b(u,e,g),p(e,l),p(l,t),m&&m.m(t,null),p(l,s),p(l,o),p(e,c),p(e,f),w&&w.m(f,null),i=!0,r||(y=Z(o,"click",n[1]),r=!0)},p(u,[g]){m&&m.p&&(!i||g&4)&&q(m,h,u,u[2],i?G(h,u[2],g,je):F(u[2]),Y),(!i||g&1&&a!==(a=H(u[0]?"":"collapsed")+" svelte-ect12w"))&&_(l,"class",a),w&&w.p&&(!i||g&4)&&q(w,S,u,u[2],i?G(S,u[2],g,De):F(u[2]),X)},i(u){i||(I(m,u),I(w,u),i=!0)},o(u){D(m,u),D(w,u),i=!1},d(u){u&&v(e),m&&m.d(u),w&&w.d(u),r=!1,y()}}}function ze(n,e,l){let{$$slots:t={},$$scope:s}=e,o=!0;function a(){l(0,o=!o)}return n.$$set=c=>{"$$scope"in c&&l(2,s=c.$$scope)},[o,a,s,t]}class at extends j{constructor(e){super(),T(this,e,ze,Te,B,{})}}const k={area:"#D94324",route:"#555F5E",crossing:"#4daf4a",other:"#984ea3",preapp:"#e41a1c",outline:"#377eb8","reserved matters":"#4daf4a","local plan":"#984ea3",hovering:"black",lineEndpointColor:"black"},Ee=10,W=10;let z="interventions";function Pe(n,e,l){let t,s;N(n,V,r=>l(1,t=r)),N(n,le,r=>l(2,s=r));let{schema:o}=e;ce(t,z,s);const a=["match",["get","intervention_type"],"area",k.area,"route",k.route,"crossing",k.crossing,"other",k.other,"white"],c=["match",["get","reference_type",["get","planning"]],"preapp",k.preapp,"outline",k.outline,"reserved matters",k["reserved matters"],"local plan",k["local plan"],"white"],f=["!=","hide_while_editing",!0];return U(t,{id:"interventions-points",source:z,filter:["all",fe,f,["!=","endpoint",!0]],color:a,radius:Ee}),K(t,{id:"interventions-lines",source:z,filter:["all",de,f],color:a,width:W}),U(t,{id:"interventions-lines-endpoints",source:z,filter:["==","endpoint",!0],radius:.5*W,opacity:0,strokeColor:k.lineEndpointColor,strokeWidth:2}),ue(t,{id:"interventions-polygons",source:z,filter:["all",Q,f],color:o=="planning"?c:a,opacity:.2}),K(t,{id:"interventions-polygon-outlines",source:z,filter:["all",Q,f],color:o=="planning"?c:a,opacity:.5,width:.7*W}),n.$$set=r=>{"schema"in r&&l(0,o=r.schema)},n.$$.update=()=>{if(n.$$.dirty&6){let r=JSON.parse(JSON.stringify(s)),y=[];for(let h of r.features)if(h.geometry.type=="LineString"&&!h.properties.hide_while_editing)for(let m of[h.geometry.coordinates[0],h.geometry.coordinates[h.geometry.coordinates.length-1]])y.push({type:"Feature",properties:{endpoint:!0},geometry:{type:"Point",coordinates:m}});r.features=r.features.concat(y),t.getSource(z).setData(r)}},[o,t,s]}class it extends j{constructor(e){super(),T(this,e,Pe,null,B,{schema:0})}}function Re(n){let e,l,t,s,o,a,c;const f=n[3].default,i=R(f,n,n[2],null);return{c(){e=d("details"),l=d("summary"),t=d("span"),s=C(n[0]),o=$(),a=d("div"),i&&i.c(),_(t,"class","govuk-details__summary-text"),_(l,"class","govuk-details__summary"),_(a,"class","govuk-details__text"),e.open=n[1],_(e,"class","govuk-details"),_(e,"data-module","govuk-details")},m(r,y){b(r,e,y),p(e,l),p(l,t),p(t,s),p(e,o),p(e,a),i&&i.m(a,null),c=!0},p(r,[y]){(!c||y&1)&&pe(s,r[0]),i&&i.p&&(!c||y&4)&&q(i,f,r,r[2],c?G(f,r[2],y,null):F(r[2]),null),(!c||y&2)&&(e.open=r[1])},i(r){c||(I(i,r),c=!0)},o(r){D(i,r),c=!1},d(r){r&&v(e),i&&i.d(r)}}}function qe(n,e,l){let{$$slots:t={},$$scope:s}=e,{label:o}=e,{open:a=!1}=e;return n.$$set=c=>{"label"in c&&l(0,o=c.label),"open"in c&&l(1,a=c.open),"$$scope"in c&&l(2,s=c.$$scope)},[o,a,s,t]}class Fe extends j{constructor(e){super(),T(this,e,qe,Re,B,{label:0,open:1})}}function Ge(n,e,l){let t;N(n,V,i=>l(2,t=i));let{layers:s}=e,{contents:o}=e,a=new P.Popup({closeButton:!1,closeOnClick:!1,maxWidth:"none"});t.on("mousemove",c),t.on("mouseout",f),ee(()=>{t.off("mousemove",c),t.off("mouseout",f),a.remove()});function c(i){if(!s.every(y=>t.getLayer(y))){a.remove();return}let r=t.queryRenderedFeatures(i.point,{layers:s});r.length>0?a.setLngLat(i.lngLat).setHTML(o(r[0].properties)).addTo(t):a.remove()}function f(){a.remove()}return n.$$set=i=>{"layers"in i&&l(0,s=i.layers),"contents"in i&&l(1,o=i.contents)},[s,o]}class rt extends j{constructor(e){super(),T(this,e,Ge,null,B,{layers:0,contents:1})}}function Ne(n){let e,l,t,s,o,a,c,f,i,r,y,h,m,S,w;return{c(){e=d("li"),l=d("span"),t=C("Areas"),s=$(),o=d("li"),a=d("span"),c=C("Routes"),f=$(),i=d("li"),r=d("span"),y=C("Crossings"),h=$(),m=d("li"),S=d("span"),w=C("Other"),_(l,"class","svelte-l42ea0"),M(l,"background",k.area),_(a,"class","svelte-l42ea0"),M(a,"background",k.route),_(r,"class","svelte-l42ea0"),M(r,"background",k.crossing),_(S,"class","svelte-l42ea0"),M(S,"background",k.other)},m(u,g){b(u,e,g),p(e,l),p(e,t),b(u,s,g),b(u,o,g),p(o,a),p(o,c),b(u,f,g),b(u,i,g),p(i,r),p(i,y),b(u,h,g),b(u,m,g),p(m,S),p(m,w)},p:O,d(u){u&&(v(e),v(s),v(o),v(f),v(i),v(h),v(m))}}}function Ve(n){let e,l,t,s,o,a,c,f,i,r,y,h,m,S,w;return{c(){e=d("li"),l=d("span"),t=C("Preapp"),s=$(),o=d("li"),a=d("span"),c=C("Outline"),f=$(),i=d("li"),r=d("span"),y=C("Reserved matters"),h=$(),m=d("li"),S=d("span"),w=C("Local plan"),_(l,"class","svelte-l42ea0"),M(l,"background",k.preapp),_(a,"class","svelte-l42ea0"),M(a,"background",k.outline),_(r,"class","svelte-l42ea0"),M(r,"background",k["reserved matters"]),_(S,"class","svelte-l42ea0"),M(S,"background",k["local plan"])},m(u,g){b(u,e,g),p(e,l),p(e,t),b(u,s,g),b(u,o,g),p(o,a),p(o,c),b(u,f,g),b(u,i,g),p(i,r),p(i,y),b(u,h,g),b(u,m,g),p(m,S),p(m,w)},p:O,d(u){u&&(v(e),v(s),v(o),v(f),v(i),v(h),v(m))}}}function We(n){let e;function l(o,a){return o[0]=="planning"?Ve:Ne}let t=l(n),s=t(n);return{c(){e=d("ul"),s.c()},m(o,a){b(o,e,a),s.m(e,null)},p(o,a){t===(t=l(o))&&s?s.p(o,a):(s.d(1),s=t(o),s&&(s.c(),s.m(e,null)))},d(o){o&&v(e),s.d()}}}function Ze(n){let e,l,t;return l=new Fe({props:{label:"Objects",open:!0,$$slots:{default:[We]},$$scope:{ctx:n}}}),{c(){e=d("div"),te(l.$$.fragment),_(e,"class","svelte-l42ea0")},m(s,o){b(s,e,o),se(l,e,null),t=!0},p(s,[o]){const a={};o&3&&(a.$$scope={dirty:o,ctx:s}),l.$set(a)},i(s){t||(I(l.$$.fragment,s),t=!0)},o(s){D(l.$$.fragment,s),t=!1},d(s){s&&v(e),ne(l)}}}function Je(n,e,l){let{schema:t}=e;return n.$$set=s=>{"schema"in s&&l(0,t=s.schema)},[t]}class ct extends j{constructor(e){super(),T(this,e,Je,Ze,B,{schema:0})}}function x(n){let e;const l=n[4].default,t=R(l,n,n[3],null);return{c(){t&&t.c()},m(s,o){t&&t.m(s,o),e=!0},p(s,o){t&&t.p&&(!e||o&8)&&q(t,l,s,s[3],e?G(l,s[3],o,null):F(s[3]),null)},i(s){e||(I(t,s),e=!0)},o(s){D(t,s),e=!1},d(s){t&&t.d(s)}}}function Ae(n){let e,l,t=n[1]&&x(n);return{c(){e=d("div"),t&&t.c(),_(e,"class","map svelte-12dpf1u")},m(s,o){b(s,e,o),t&&t.m(e,null),n[5](e),l=!0},p(s,[o]){s[1]?t?(t.p(s,o),o&2&&I(t,1)):(t=x(s),t.c(),I(t,1),t.m(e,null)):t&&(me(),D(t,1,1,()=>{t=null}),_e())},i(s){l||(I(t),l=!0)},o(s){D(t),l=!1},d(s){s&&v(e),t&&t.d(),n[5](null)}}}function He(n,e,l){let{$$slots:t={},$$scope:s}=e,{style:o}=e,a,c,f=!1;ge("setCamera",!window.location.hash),be(()=>{a=new P.Map({container:c,style:`https://api.maptiler.com/maps/${o}/style.json?key=MZEJTanw3WpxRvt7qDfo`,hash:!0}),a.addControl(new P.ScaleControl({})),a.addControl(new P.NavigationControl({visualizePitch:!0}),"bottom-right"),a.on("load",()=>{l(1,f=!0),V.set(a)}),new ResizeObserver(()=>{a.resize()}).observe(c)}),ee(()=>{a.remove()});function i(r){ve[r?"unshift":"push"](()=>{c=r,l(0,c)})}return n.$$set=r=>{"style"in r&&l(2,o=r.style),"$$scope"in r&&l(3,s=r.$$scope)},[c,f,o,s,t,i]}class ut extends j{constructor(e){super(),T(this,e,He,Ae,B,{style:2})}}const Ue="/atip/govuk_step2/assets/zoom_out_map-b2e1091a.svg";function Ke(n){let e,l;return{c(){e=d("img"),he(e.src,l=Ue)||_(e,"src",l),_(e,"alt","Zoom to show entire boundary")},m(t,s){b(t,e,s)},p:O,d(t){t&&v(e)}}}function Qe(n){let e,l;return e=new ye({props:{title:"Zoom to show entire boundary",$$slots:{default:[Ke]},$$scope:{ctx:n}}}),e.$on("click",n[0]),{c(){te(e.$$.fragment)},m(t,s){se(e,t,s),l=!0},p(t,[s]){const o={};s&8&&(o.$$scope={dirty:s,ctx:t}),e.$set(o)},i(t){l||(I(e.$$.fragment,t),l=!0)},o(t){D(e.$$.fragment,t),l=!1},d(t){ne(e,t)}}}function Xe(n,e,l){let t;N(n,V,a=>l(2,t=a));let{boundaryGeojson:s}=e;function o(){t.fitBounds(we(s),{padding:20,animate:!0,duration:500})}return n.$$set=a=>{"boundaryGeojson"in a&&l(1,s=a.boundaryGeojson)},[o,s]}class ft extends j{constructor(e){super(),T(this,e,Xe,Qe,B,{boundaryGeojson:1})}}export{xe as B,Fe as C,it as I,at as L,rt as M,ft as Z,$e as a,Ee as b,k as c,st as d,ot as e,Le as f,le as g,et as h,nt as i,ut as j,ct as k,W as l,V as m,lt as n,Be as o,tt as r,Ie as s,Me as u}; diff --git a/govuk_step2/assets/FormElement-148b0136.css b/govuk_step2/assets/all-148b0136.css similarity index 100% rename from govuk_step2/assets/FormElement-148b0136.css rename to govuk_step2/assets/all-148b0136.css diff --git a/govuk_step2/assets/all-4fc69598.js b/govuk_step2/assets/all-4fc69598.js new file mode 100644 index 000000000..7db1c9507 --- /dev/null +++ b/govuk_step2/assets/all-4fc69598.js @@ -0,0 +1 @@ +function w(t,e){if(window.NodeList.prototype.forEach)return t.forEach(e);for(var n=0;n1&&o.shift();var l=o.join(".");n[l]=t[r]}}return n}(function(t){var e="defineProperty"in Object&&function(){try{var n={};return Object.defineProperty(n,"test",{value:42}),!0}catch{return!1}}();e||function(n){var r=Object.prototype.hasOwnProperty("__defineGetter__"),o="Getters & setters cannot be defined on this javascript engine",l="A property cannot both have accessors and be writable or have a value";Object.defineProperty=function(i,u,a){if(n&&(i===window||i===document||i===Element.prototype||i instanceof Element))return n(i,u,a);if(i===null||!(i instanceof Object||typeof i=="object"))throw new TypeError("Object.defineProperty called on non-object");if(!(a instanceof Object))throw new TypeError("Property description must be an object");var c=String(u),h="value"in a||"writable"in a,p="get"in a&&typeof a.get,m="set"in a&&typeof a.set;if(p){if(p!=="function")throw new TypeError("Getter must be a function");if(!r)throw new TypeError(o);if(h)throw new TypeError(l);Object.__defineGetter__.call(i,c,a.get)}else i[c]=a.value;if(m){if(m!=="function")throw new TypeError("Setter must be a function");if(!r)throw new TypeError(o);if(h)throw new TypeError(l);Object.__defineSetter__.call(i,c,a.set)}return"value"in a&&(i[c]=a.value),i}}(Object.defineProperty)}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});(function(t){var e="Document"in this;e||typeof WorkerGlobalScope>"u"&&typeof importScripts!="function"&&(this.HTMLDocument?this.Document=this.HTMLDocument:(this.Document=this.HTMLDocument=document.constructor=new Function("return function Document() {}")(),this.Document.prototype=document))}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});(function(t){var e="Element"in this&&"HTMLElement"in this;e||function(){if(window.Element&&!window.HTMLElement){window.HTMLElement=window.Element;return}window.Element=window.HTMLElement=new Function("return function Element() {}")();var n=document.appendChild(document.createElement("body")),r=n.appendChild(document.createElement("iframe")),o=r.contentWindow.document,l=Element.prototype=o.appendChild(o.createElement("*")),s={},i=function(m,d){var E=m.childNodes||[],y=-1,f,g,v;if(m.nodeType===1&&m.constructor!==Element){m.constructor=Element;for(f in s)g=s[f],m[f]=g}for(;v=d&&E[++y];)i(v,d);return m},u=document.getElementsByTagName("*"),a=document.createElement,c,h=100;l.attachEvent("onpropertychange",function(m){for(var d=m.propertyName,E=!s.hasOwnProperty(d),y=l[d],f=s[d],g=-1,v;v=u[++g];)v.nodeType===1&&(E||v[d]===f)&&(v[d]=y);s[d]=y}),l.constructor=Element,l.hasAttribute||(l.hasAttribute=function(d){return this.getAttribute(d)!==null});function p(){return h--||clearTimeout(c),document.body&&!document.body.prototype&&/(complete|interactive)/.test(document.readyState)?(i(document,!0),c&&document.body.prototype&&clearTimeout(c),!!document.body.prototype):!1}p()||(document.onreadystatechange=p,c=setInterval(p,25)),document.createElement=function(d){var E=a(String(d).toLowerCase());return i(E)},document.removeChild(n)}()}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});(function(t){var e=function(){if(!document.documentElement.dataset)return!1;var n=document.createElement("div");return n.setAttribute("data-a-b","c"),n.dataset&&n.dataset.aB=="c"}();e||Object.defineProperty(Element.prototype,"dataset",{get:function(){for(var n=this,r=this.attributes,o={},l=0;l0&&isFinite(Number(e))?Number(e):t}function I(t){var e={};for(var n in t)e[n]=z(t[n]);return e}function C(t,e){this.translations=t||{},this.locale=e&&e.locale||document.documentElement.lang||"en"}C.prototype.t=function(t,e){if(!t)throw new Error("i18n: lookup key missing");e&&typeof e.count=="number"&&(t=t+"."+this.getPluralSuffix(t,e.count));var n=this.translations[t];if(typeof n=="string")if(n.match(/%{(.\S+)}/)){if(!e)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,e)}else return n;else return t};C.prototype.replacePlaceholders=function(t,e){var n;return this.hasIntlNumberFormatSupport()&&(n=new Intl.NumberFormat(this.locale)),t.replace(/%{(.\S+)}/g,function(r,o){if(Object.prototype.hasOwnProperty.call(e,o)){var l=e[o];return l===!1||typeof l!="number"&&typeof l!="string"?"":typeof l=="number"?n?n.format(l):l.toString():l}else throw new Error("i18n: no data found to replace "+r+" placeholder in string")})};C.prototype.hasIntlPluralRulesSupport=function(){return!!(window.Intl&&"PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)};C.prototype.hasIntlNumberFormatSupport=function(){return!!(window.Intl&&"NumberFormat"in window.Intl&&Intl.NumberFormat.supportedLocalesOf(this.locale).length)};C.prototype.getPluralSuffix=function(t,e){if(e=Number(e),!isFinite(e))return"other";var n;if(this.hasIntlPluralRulesSupport()?n=new Intl.PluralRules(this.locale).select(e):n=this.selectPluralFormUsingFallbackRules(e),t+"."+n in this.translations)return n;if(t+".other"in this.translations)return console&&"warn"in console&&console.warn('i18n: Missing plural form ".'+n+'" for "'+this.locale+'" locale. Falling back to ".other".'),"other";throw new Error('i18n: Plural form ".other" is required for "'+this.locale+'" locale')};C.prototype.selectPluralFormUsingFallbackRules=function(t){t=Math.abs(Math.floor(t));var e=this.getPluralRulesForLocale();return e?C.pluralRules[e](t):"other"};C.prototype.getPluralRulesForLocale=function(){var t=this.locale,e=t.split("-")[0];for(var n in C.pluralRulesMap)if(Object.prototype.hasOwnProperty.call(C.pluralRulesMap,n)){for(var r=C.pluralRulesMap[n],o=0;o=3&&t%100<=10?"few":t%100>=11&&t%100<=99?"many":"other"},chinese:function(){return"other"},french:function(t){return t===0||t===1?"one":"other"},german:function(t){return t===1?"one":"other"},irish:function(t){return t===1?"one":t===2?"two":t>=3&&t<=6?"few":t>=7&&t<=10?"many":"other"},russian:function(t){var e=t%100,n=e%10;return n===1&&e!==11?"one":n>=2&&n<=4&&!(e>=12&&e<=14)?"few":n===0||n>=5&&n<=9||e>=11&&e<=14?"many":"other"},scottish:function(t){return t===1||t===11?"one":t===2||t===12?"two":t>=3&&t<=10||t>=13&&t<=19?"few":"other"},spanish:function(t){return t===1?"one":t%1e6===0&&t!==0?"many":"other"},welsh:function(t){return t===0?"zero":t===1?"one":t===2?"two":t===3?"few":t===6?"many":"other"}};(function(t){var e="DOMTokenList"in this&&function(n){return"classList"in n?!n.classList.toggle("x",!1)&&!n.className:!0}(document.createElement("x"));e||function(n){var r="DOMTokenList"in n&&n.DOMTokenList;(!r||document.createElementNS&&document.createElementNS("http://www.w3.org/2000/svg","svg")&&!(document.createElementNS("http://www.w3.org/2000/svg","svg").classList instanceof DOMTokenList))&&(n.DOMTokenList=function(){var o=!0,l=function(i,u,a,c){Object.defineProperty?Object.defineProperty(i,u,{configurable:o===!1?!0:!!c,get:a}):i.__defineGetter__(u,a)};try{l({},"support")}catch{o=!1}var s=function(i,u){var a=this,c=[],h={},p=0,m=0,d=function(f){l(a,f,function(){return y(),c[f]},!1)},E=function(){if(p>=m)for(;m>>0,typeof i[u]=="object"?i[u].baseVal=c.join(" "):i[u]=c.join(" "),E())},a.remove=function(){y.apply(a,f=arguments);for(var f,g={},v=0,T=[];v>>0,typeof i[u]=="object"?i[u].baseVal=c.join(" "):i[u]=c.join(" "),E()},a.toggle=function(f,g){return y.apply(a,[f]),t!==g?g?(a.add(f),!0):(a.remove(f),!1):h[f]?(a.remove(f),!1):(a.add(f),!0)},a};return s}()),function(){var o=document.createElement("span");"classList"in o&&(o.classList.toggle("x",!1),o.classList.contains("x")&&(o.classList.constructor.prototype.toggle=function(s){var i=arguments[1];if(i===t){var u=!this.contains(s);return this[u?"add":"remove"](s),u}return i=!!i,this[i?"add":"remove"](s),i}))}(),function(){var o=document.createElement("span");if("classList"in o&&(o.classList.add("a","b"),!o.classList.contains("b"))){var l=o.classList.constructor.prototype.add;o.classList.constructor.prototype.add=function(){for(var s=arguments,i=arguments.length,u=0;u"u"&&typeof importScripts!="function"&&function(n){n.constructor?n.Window=n.constructor:(n.Window=n.constructor=new Function("return function Window() {}")()).prototype=this}(this)}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});(function(t){var e=function(n){if(!("Event"in n))return!1;if(typeof n.Event=="function")return!0;try{return new Event("click"),!0}catch{return!1}}(this);e||function(){var n={click:1,dblclick:1,keyup:1,keypress:1,keydown:1,mousedown:1,mouseup:1,mousemove:1,mouseover:1,mouseenter:1,mouseleave:1,mouseout:1,storage:1,storagecommit:1,textinput:1};if(typeof document>"u"||typeof window>"u")return;function r(l,s){for(var i=-1,u=l.length;++i=this.lastInputTimestamp)&&this.updateIfValueChanged()}.bind(this),1e3)};L.prototype.handleBlur=function(){clearInterval(this.valueChecker)};L.prototype.updateIfValueChanged=function(){this.$textarea.value!==this.lastInputValue&&(this.lastInputValue=this.$textarea.value,this.updateCountMessage())};L.prototype.updateCountMessage=function(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()};L.prototype.updateVisibleCountMessage=function(){var t=this.$textarea,e=this.$visibleCountMessage,n=this.maxLength-this.count(t.value);this.isOverThreshold()?e.classList.remove("govuk-character-count__message--disabled"):e.classList.add("govuk-character-count__message--disabled"),n<0?(t.classList.add("govuk-textarea--error"),e.classList.remove("govuk-hint"),e.classList.add("govuk-error-message")):(t.classList.remove("govuk-textarea--error"),e.classList.remove("govuk-error-message"),e.classList.add("govuk-hint")),e.innerText=this.getCountMessage()};L.prototype.updateScreenReaderCountMessage=function(){var t=this.$screenReaderCountMessage;this.isOverThreshold()?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden","true"),t.innerText=this.getCountMessage()};L.prototype.count=function(t){if("maxwords"in this.config&&this.config.maxwords){var e=t.match(/\S+/g)||[];return e.length}else return t.length};L.prototype.getCountMessage=function(){var t=this.maxLength-this.count(this.$textarea.value),e="maxwords"in this.config&&this.config.maxwords?"words":"characters";return this.formatCountMessage(t,e)};L.prototype.formatCountMessage=function(t,e){if(t===0)return this.i18n.t(e+"AtLimit");var n=t<0?"OverLimit":"UnderLimit";return this.i18n.t(e+n,{count:Math.abs(t)})};L.prototype.isOverThreshold=function(){if(!this.config.threshold)return!0;var t=this.$textarea,e=this.count(t.value),n=this.maxLength,r=n*this.config.threshold/100;return r<=e};function k(t){if(!(t instanceof HTMLElement))return this;var e=t.querySelectorAll('input[type="checkbox"]');if(!e.length)return this;this.$module=t,this.$inputs=e}k.prototype.init=function(){if(!(!this.$module||!this.$inputs)){var t=this.$module,e=this.$inputs;w(e,function(n){var r=n.getAttribute("data-aria-controls");!r||!document.getElementById(r)||(n.setAttribute("aria-controls",r),n.removeAttribute("data-aria-controls"))}),window.addEventListener("onpageshow"in window?"pageshow":"DOMContentLoaded",this.syncAllConditionalReveals.bind(this)),this.syncAllConditionalReveals(),t.addEventListener("click",this.handleClick.bind(this))}};k.prototype.syncAllConditionalReveals=function(){w(this.$inputs,this.syncConditionalRevealWithInputState.bind(this))};k.prototype.syncConditionalRevealWithInputState=function(t){var e=t.getAttribute("aria-controls");if(e){var n=document.getElementById(e);if(n&&n.classList.contains("govuk-checkboxes__conditional")){var r=t.checked;t.setAttribute("aria-expanded",r.toString()),n.classList.toggle("govuk-checkboxes__conditional--hidden",!r)}}};k.prototype.unCheckAllInputsExcept=function(t){var e=this,n=document.querySelectorAll('input[type="checkbox"][name="'+t.name+'"]');w(n,function(r){var o=t.form===r.form;o&&r!==t&&(r.checked=!1,e.syncConditionalRevealWithInputState(r))})};k.prototype.unCheckExclusiveInputs=function(t){var e=this,n=document.querySelectorAll('input[data-behaviour="exclusive"][type="checkbox"][name="'+t.name+'"]');w(n,function(r){var o=t.form===r.form;o&&(r.checked=!1,e.syncConditionalRevealWithInputState(r))})};k.prototype.handleClick=function(t){var e=t.target;if(!(!(e instanceof HTMLInputElement)||e.type!=="checkbox")){var n=e.getAttribute("aria-controls");if(n&&this.syncConditionalRevealWithInputState(e),!!e.checked){var r=e.getAttribute("data-behaviour")==="exclusive";r?this.unCheckAllInputsExcept(e):this.unCheckExclusiveInputs(e)}}};var nt=13,V=32;function O(t){if(!(t instanceof HTMLElement))return this;this.$module=t,this.$summary=null,this.$content=null}O.prototype.init=function(){if(this.$module){var t="HTMLDetailsElement"in window&&this.$module instanceof HTMLDetailsElement;t||this.polyfillDetails()}};O.prototype.polyfillDetails=function(){var t=this.$module,e=this.$summary=t.getElementsByTagName("summary").item(0),n=this.$content=t.getElementsByTagName("div").item(0);!e||!n||(n.id||(n.id="details-content-"+Y()),t.setAttribute("role","group"),e.setAttribute("role","button"),e.setAttribute("aria-controls",n.id),e.tabIndex=0,this.$module.hasAttribute("open")?e.setAttribute("aria-expanded","true"):(e.setAttribute("aria-expanded","false"),n.style.display="none"),this.polyfillHandleInputs(this.polyfillSetAttributes.bind(this)))};O.prototype.polyfillSetAttributes=function(){return this.$module.hasAttribute("open")?(this.$module.removeAttribute("open"),this.$summary.setAttribute("aria-expanded","false"),this.$content.style.display="none"):(this.$module.setAttribute("open","open"),this.$summary.setAttribute("aria-expanded","true"),this.$content.style.display=""),!0};O.prototype.polyfillHandleInputs=function(t){this.$summary.addEventListener("keypress",function(e){var n=e.target;(e.keyCode===nt||e.keyCode===V)&&n instanceof HTMLElement&&n.nodeName.toLowerCase()==="summary"&&(e.preventDefault(),n.click?n.click():t(e))}),this.$summary.addEventListener("keyup",function(e){var n=e.target;e.keyCode===V&&n instanceof HTMLElement&&n.nodeName.toLowerCase()==="summary"&&e.preventDefault()}),this.$summary.addEventListener("click",t)};function A(t,e){if(!(t instanceof HTMLElement))return this;this.$module=t;var n={disableAutoFocus:!1};this.config=_(n,e||{},I(t.dataset))}A.prototype.init=function(){if(this.$module){var t=this.$module;this.setFocus(),t.addEventListener("click",this.handleClick.bind(this))}};A.prototype.setFocus=function(){var t=this.$module;this.config.disableAutoFocus||(t.setAttribute("tabindex","-1"),t.addEventListener("blur",function(){t.removeAttribute("tabindex")}),t.focus())};A.prototype.handleClick=function(t){var e=t.target;this.focusTarget(e)&&t.preventDefault()};A.prototype.focusTarget=function(t){if(!(t instanceof HTMLAnchorElement))return!1;var e=this.getFragmentFromUrl(t.href);if(!e)return!1;var n=document.getElementById(e);if(!n)return!1;var r=this.getAssociatedLegendOrLabel(n);return r?(r.scrollIntoView(),n.focus({preventScroll:!0}),!0):!1};A.prototype.getFragmentFromUrl=function(t){if(t.indexOf("#")!==-1)return t.split("#").pop()};A.prototype.getAssociatedLegendOrLabel=function(t){var e=t.closest("fieldset");if(e){var n=e.getElementsByTagName("legend");if(n.length){var r=n[0];if(t instanceof HTMLInputElement&&(t.type==="checkbox"||t.type==="radio"))return r;var o=r.getBoundingClientRect().top,l=t.getBoundingClientRect();if(l.height&&window.innerHeight){var s=l.top+l.height;if(s-o0?this.$indicatorContainer.classList.add("govuk-exit-this-page__indicator--visible"):this.$indicatorContainer.classList.remove("govuk-exit-this-page__indicator--visible");var t=this.$indicatorContainer.querySelectorAll(".govuk-exit-this-page__indicator-light");w(t,function(e,n){e.classList.toggle("govuk-exit-this-page__indicator-light--on",n=3?(this.keypressCounter=0,this.keypressTimeoutId!==null&&(clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null),this.exitPage()):this.keypressCounter===1?this.$updateSpan.innerText=this.i18n.t("pressTwoMoreTimes"):this.$updateSpan.innerText=this.i18n.t("pressOneMoreTime"),this.setKeypressTimer()):this.keypressTimeoutId!==null&&this.resetKeypressTimer(),this.lastKeyWasModified=t.shiftKey};x.prototype.setKeypressTimer=function(){clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=setTimeout(this.resetKeypressTimer.bind(this),this.timeoutTime)};x.prototype.resetKeypressTimer=function(){clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null,this.keypressCounter=0,this.$updateSpan.innerText=this.i18n.t("timedOut"),this.timeoutMessageId=setTimeout(function(){this.$updateSpan.innerText=""}.bind(this),this.timeoutTime),this.updateIndicator()};x.prototype.resetPage=function(){document.body.classList.remove("govuk-exit-this-page-hide-content"),this.$overlay&&(this.$overlay.remove(),this.$overlay=null),this.$updateSpan.setAttribute("role","status"),this.$updateSpan.innerText="",this.updateIndicator(),this.keypressTimeoutId&&clearTimeout(this.keypressTimeoutId),this.timeoutMessageId&&clearTimeout(this.timeoutMessageId)};x.prototype.init=function(){this.buildIndicator(),this.initUpdateSpan(),this.initButtonClickHandler(),"govukFrontendExitThisPageKeypress"in document.body.dataset||(document.addEventListener("keyup",this.handleKeypress.bind(this),!0),document.body.dataset.govukFrontendExitThisPageKeypress="true"),window.addEventListener("onpageshow"in window?"pageshow":"DOMContentLoaded",this.resetPage.bind(this))};function F(t){if(!(t instanceof HTMLElement))return this;this.$module=t,this.$menuButton=t.querySelector(".govuk-js-header-toggle"),this.$menu=this.$menuButton&&t.querySelector("#"+this.$menuButton.getAttribute("aria-controls")),this.menuIsOpen=!1,this.mql=null}F.prototype.init=function(){!this.$module||!this.$menuButton||!this.$menu||("matchMedia"in window?(this.mql=window.matchMedia("(min-width: 48.0625em)"),"addEventListener"in this.mql?this.mql.addEventListener("change",this.syncState.bind(this)):this.mql.addListener(this.syncState.bind(this)),this.syncState(),this.$menuButton.addEventListener("click",this.handleMenuButtonClick.bind(this))):this.$menuButton.setAttribute("hidden",""))};F.prototype.syncState=function(){this.mql.matches?(this.$menu.removeAttribute("hidden"),this.$menuButton.setAttribute("hidden","")):(this.$menuButton.removeAttribute("hidden"),this.$menuButton.setAttribute("aria-expanded",this.menuIsOpen.toString()),this.menuIsOpen?this.$menu.removeAttribute("hidden"):this.$menu.setAttribute("hidden",""))};F.prototype.handleMenuButtonClick=function(){this.menuIsOpen=!this.menuIsOpen,this.syncState()};function W(t,e){if(!(t instanceof HTMLElement))return this;this.$module=t;var n={disableAutoFocus:!1};this.config=_(n,e||{},I(t.dataset))}W.prototype.init=function(){this.$module&&this.setFocus()};W.prototype.setFocus=function(){var t=this.$module;this.config.disableAutoFocus||t.getAttribute("role")==="alert"&&(t.getAttribute("tabindex")||(t.setAttribute("tabindex","-1"),t.addEventListener("blur",function(){t.removeAttribute("tabindex")})),t.focus())};function j(t){if(!(t instanceof HTMLElement))return this;var e=t.querySelectorAll('input[type="radio"]');if(!e.length)return this;this.$module=t,this.$inputs=e}j.prototype.init=function(){if(!(!this.$module||!this.$inputs)){var t=this.$module,e=this.$inputs;w(e,function(n){var r=n.getAttribute("data-aria-controls");!r||!document.getElementById(r)||(n.setAttribute("aria-controls",r),n.removeAttribute("data-aria-controls"))}),window.addEventListener("onpageshow"in window?"pageshow":"DOMContentLoaded",this.syncAllConditionalReveals.bind(this)),this.syncAllConditionalReveals(),t.addEventListener("click",this.handleClick.bind(this))}};j.prototype.syncAllConditionalReveals=function(){w(this.$inputs,this.syncConditionalRevealWithInputState.bind(this))};j.prototype.syncConditionalRevealWithInputState=function(t){var e=t.getAttribute("aria-controls");if(e){var n=document.getElementById(e);if(n&&n.classList.contains("govuk-radios__conditional")){var r=t.checked;t.setAttribute("aria-expanded",r.toString()),n.classList.toggle("govuk-radios__conditional--hidden",!r)}}};j.prototype.handleClick=function(t){var e=this,n=t.target;if(!(!(n instanceof HTMLInputElement)||n.type!=="radio")){var r=document.querySelectorAll('input[type="radio"][aria-controls]'),o=n.form,l=n.name;w(r,function(s){var i=s.form===o,u=s.name===l;u&&i&&e.syncConditionalRevealWithInputState(s)})}};function M(t){if(!(t instanceof HTMLAnchorElement))return this;this.$module=t,this.$linkedElement=null,this.linkedElementListener=!1}M.prototype.init=function(){if(this.$module){var t=this.getLinkedElement();t&&(this.$linkedElement=t,this.$module.addEventListener("click",this.focusLinkedElement.bind(this)))}};M.prototype.getLinkedElement=function(){var t=this.getFragmentFromUrl();return t?document.getElementById(t):null};M.prototype.focusLinkedElement=function(){var t=this.$linkedElement;t.getAttribute("tabindex")||(t.setAttribute("tabindex","-1"),t.classList.add("govuk-skip-link-focused-element"),this.linkedElementListener||(this.$linkedElement.addEventListener("blur",this.removeFocusProperties.bind(this)),this.linkedElementListener=!0)),t.focus()};M.prototype.removeFocusProperties=function(){this.$linkedElement.removeAttribute("tabindex"),this.$linkedElement.classList.remove("govuk-skip-link-focused-element")};M.prototype.getFragmentFromUrl=function(){if(this.$module.hash)return this.$module.hash.split("#").pop()};(function(t){var e="document"in this&&"nextElementSibling"in document.documentElement;e||Object.defineProperty(Element.prototype,"nextElementSibling",{get:function(){for(var n=this.nextSibling;n&&n.nodeType!==1;)n=n.nextSibling;return n}})}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});(function(t){var e="document"in this&&"previousElementSibling"in document.documentElement;e||Object.defineProperty(Element.prototype,"previousElementSibling",{get:function(){for(var n=this.previousSibling;n&&n.nodeType!==1;)n=n.previousSibling;return n}})}).call(typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||{});function b(t){if(!(t instanceof HTMLElement))return this;var e=t.querySelectorAll("a.govuk-tabs__tab");if(!e.length)return this;this.$module=t,this.$tabs=e,this.keys={left:37,right:39,up:38,down:40},this.jsHiddenClass="govuk-tabs__panel--hidden",this.boundTabClick=this.onTabClick.bind(this),this.boundTabKeydown=this.onTabKeydown.bind(this),this.boundOnHashChange=this.onHashChange.bind(this),this.changingHash=!1}b.prototype.init=function(){!this.$module||!this.$tabs||(typeof window.matchMedia=="function"?this.setupResponsiveChecks():this.setup())};b.prototype.setupResponsiveChecks=function(){this.mql=window.matchMedia("(min-width: 40.0625em)"),this.mql.addListener(this.checkMode.bind(this)),this.checkMode()};b.prototype.checkMode=function(){this.mql.matches?this.setup():this.teardown()};b.prototype.setup=function(){var t=this,e=this.$module,n=this.$tabs,r=e.querySelector(".govuk-tabs__list"),o=e.querySelectorAll(".govuk-tabs__list-item");if(!(!n||!r||!o)){r.setAttribute("role","tablist"),w(o,function(s){s.setAttribute("role","presentation")}),w(n,function(s){t.setAttributes(s),s.addEventListener("click",t.boundTabClick,!0),s.addEventListener("keydown",t.boundTabKeydown,!0),t.hideTab(s)});var l=this.getTab(window.location.hash)||this.$tabs[0];l&&(this.showTab(l),window.addEventListener("hashchange",this.boundOnHashChange,!0))}};b.prototype.teardown=function(){var t=this,e=this.$module,n=this.$tabs,r=e.querySelector(".govuk-tabs__list"),o=e.querySelectorAll("a.govuk-tabs__list-item");!n||!r||!o||(r.removeAttribute("role"),w(o,function(l){l.removeAttribute("role")}),w(n,function(l){l.removeEventListener("click",t.boundTabClick,!0),l.removeEventListener("keydown",t.boundTabKeydown,!0),t.unsetAttributes(l)}),window.removeEventListener("hashchange",this.boundOnHashChange,!0))};b.prototype.onHashChange=function(){var t=window.location.hash,e=this.getTab(t);if(e){if(this.changingHash){this.changingHash=!1;return}var n=this.getCurrentTab();n&&(this.hideTab(n),this.showTab(e),e.focus())}};b.prototype.hideTab=function(t){this.unhighlightTab(t),this.hidePanel(t)};b.prototype.showTab=function(t){this.highlightTab(t),this.showPanel(t)};b.prototype.getTab=function(t){return this.$module.querySelector('a.govuk-tabs__tab[href="'+t+'"]')};b.prototype.setAttributes=function(t){var e=this.getHref(t).slice(1);t.setAttribute("id","tab_"+e),t.setAttribute("role","tab"),t.setAttribute("aria-controls",e),t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");var n=this.getPanel(t);n&&(n.setAttribute("role","tabpanel"),n.setAttribute("aria-labelledby",t.id),n.classList.add(this.jsHiddenClass))};b.prototype.unsetAttributes=function(t){t.removeAttribute("id"),t.removeAttribute("role"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-selected"),t.removeAttribute("tabindex");var e=this.getPanel(t);e&&(e.removeAttribute("role"),e.removeAttribute("aria-labelledby"),e.classList.remove(this.jsHiddenClass))};b.prototype.onTabClick=function(t){var e=this.getCurrentTab(),n=t.currentTarget;!e||!(n instanceof HTMLAnchorElement)||(t.preventDefault(),this.hideTab(e),this.showTab(n),this.createHistoryEntry(n))};b.prototype.createHistoryEntry=function(t){var e=this.getPanel(t);if(e){var n=e.id;e.id="",this.changingHash=!0,window.location.hash=this.getHref(t).slice(1),e.id=n}};b.prototype.onTabKeydown=function(t){switch(t.keyCode){case this.keys.left:case this.keys.up:this.activatePreviousTab(),t.preventDefault();break;case this.keys.right:case this.keys.down:this.activateNextTab(),t.preventDefault();break}};b.prototype.activateNextTab=function(){var t=this.getCurrentTab();if(!(!t||!t.parentElement)){var e=t.parentElement.nextElementSibling;if(e){var n=e.querySelector("a.govuk-tabs__tab");n&&(this.hideTab(t),this.showTab(n),n.focus(),this.createHistoryEntry(n))}}};b.prototype.activatePreviousTab=function(){var t=this.getCurrentTab();if(!(!t||!t.parentElement)){var e=t.parentElement.previousElementSibling;if(e){var n=e.querySelector("a.govuk-tabs__tab");n&&(this.hideTab(t),this.showTab(n),n.focus(),this.createHistoryEntry(n))}}};b.prototype.getPanel=function(t){return this.$module.querySelector(this.getHref(t))};b.prototype.showPanel=function(t){var e=this.getPanel(t);e&&e.classList.remove(this.jsHiddenClass)};b.prototype.hidePanel=function(t){var e=this.getPanel(t);e&&e.classList.add(this.jsHiddenClass)};b.prototype.unhighlightTab=function(t){t.parentElement&&(t.setAttribute("aria-selected","false"),t.parentElement.classList.remove("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","-1"))};b.prototype.highlightTab=function(t){t.parentElement&&(t.setAttribute("aria-selected","true"),t.parentElement.classList.add("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","0"))};b.prototype.getCurrentTab=function(){return this.$module.querySelector(".govuk-tabs__list-item--selected a.govuk-tabs__tab")};b.prototype.getHref=function(t){var e=t.getAttribute("href"),n=e.slice(e.indexOf("#"),e.length);return n};function rt(t){t=typeof t<"u"?t:{};var e=t.scope instanceof HTMLElement?t.scope:document,n=e.querySelectorAll('[data-module="govuk-accordion"]');w(n,function(d){new S(d,t.accordion).init()});var r=e.querySelectorAll('[data-module="govuk-button"]');w(r,function(d){new B(d,t.button).init()});var o=e.querySelectorAll('[data-module="govuk-character-count"]');w(o,function(d){new L(d,t.characterCount).init()});var l=e.querySelectorAll('[data-module="govuk-checkboxes"]');w(l,function(d){new k(d).init()});var s=e.querySelectorAll('[data-module="govuk-details"]');w(s,function(d){new O(d).init()});var i=e.querySelector('[data-module="govuk-error-summary"]');i&&new A(i,t.errorSummary).init();var u=e.querySelectorAll('[data-module="govuk-exit-this-page"]');w(u,function(d){new x(d,t.exitThisPage).init()});var a=e.querySelector('[data-module="govuk-header"]');a&&new F(a).init();var c=e.querySelectorAll('[data-module="govuk-notification-banner"]');w(c,function(d){new W(d,t.notificationBanner).init()});var h=e.querySelectorAll('[data-module="govuk-radios"]');w(h,function(d){new j(d).init()});var p=e.querySelector('[data-module="govuk-skip-link"]');p&&new M(p).init();var m=e.querySelectorAll('[data-module="govuk-tabs"]');w(m,function(d){new b(d).init()})}export{rt as i}; diff --git a/govuk_step2/assets/main-b3b86e38.js b/govuk_step2/assets/main-b3b86e38.js new file mode 100644 index 000000000..e9187bdd8 --- /dev/null +++ b/govuk_step2/assets/main-b3b86e38.js @@ -0,0 +1 @@ +import{S as K,i as Z,s as Q,c as me,a as W,e as p,b as ae,d as I,l as H,u as ge,g as ve,f as be,h as ke,t as C,j as L,k as T,m as oe,n as _e,o as se,p as q,q as w,r as h,v as _,w as X,x as ie,y as ye,z as we,A as R,B as $e,C as Ae,F as Se,D as z,E as ue,G as Be,H as D,I as J,J as re,K as O,L as Ee,M as Fe,N as Ie}from"./maplibre_helpers-5d84afaa.js";import{i as Te}from"./all-4fc69598.js";import{A as Ne,a as je}from"./About-75317461.js";function Ce(l){let t,e,o,u;const f=l[2].default,a=me(f,l,l[1],null);let i=[{type:"button"},{class:"govuk-button"},{"data-module":"govuk-button"},l[0]],s={};for(let n=0;n{e(0,t=W(W({},t),oe(a))),"$$scope"in a&&e(1,u=a.$$scope)},t=oe(t),[t,u,o,f]}class De extends K{constructor(t){super(),Z(this,t,Le,Ce,Q,{})}}function fe(l,t,e){const o=l.slice();return o[7]=t[e][0],o[8]=t[e][1],o}function de(l){let t,e,o,u,f=!1,a,i,s=l[8]+"",n,d,c,B,v,j;return B=we(l[6][0]),{c(){t=p("div"),e=p("input"),a=w(),i=p("label"),n=q(s),c=w(),h(e,"class","govuk-radios__input"),h(e,"id",o=l[2]+l[7]),h(e,"type","radio"),e.__value=u=l[7],R(e,e.__value),h(i,"class","govuk-label govuk-radios__label"),h(i,"for",d=l[2]+l[7]),h(t,"class","govuk-radios__item"),B.p(e)},m(m,$){I(m,t,$),_(t,e),e.checked=e.__value===l[0],_(t,a),_(t,i),_(i,n),_(t,c),v||(j=[H(e,"change",l[5]),H(e,"change",l[4])],v=!0)},p(m,$){$&12&&o!==(o=m[2]+m[7])&&h(e,"id",o),$&8&&u!==(u=m[7])&&(e.__value=u,R(e,e.__value),f=!0),(f||$&9)&&(e.checked=e.__value===m[0]),$&8&&s!==(s=m[8]+"")&&X(n,s),$&12&&d!==(d=m[2]+m[7])&&h(i,"for",d)},d(m){m&&T(t),B.r(),v=!1,$e(j)}}}function Je(l){let t,e,o,u,f,a,i=se(l[3]),s=[];for(let n=0;n{"legend"in d&&e(1,o=d.legend),"id"in d&&e(2,u=d.id),"choices"in d&&e(3,f=d.choices),"value"in d&&e(0,a=d.value)},[a,o,u,f,s,n,i]}class Me extends K{constructor(t){super(),Z(this,t,Oe,Je,Q,{legend:1,id:2,choices:3,value:0})}}function qe(l){let t;return{c(){t=q("About")},m(e,o){I(e,t,o)},d(e){e&&T(t)}}}function Ge(l){let t,e,o,u,f;return{c(){t=p("input"),e=w(),o=p("datalist"),h(t,"class","govuk-input govuk-input--width-20"),h(t,"id","inputValue"),h(t,"data-testid","transport-authority"),h(t,"list","authorities-list"),h(o,"id","authorities-list")},m(a,i){I(a,t,i),R(t,l[0]),I(a,e,i),I(a,o,i),l[11](o),u||(f=H(t,"input",l[10]),u=!0)},p(a,i){i&1&&t.value!==a[0]&&R(t,a[0])},d(a){a&&(T(t),T(e),T(o)),l[11](null),u=!1,f()}}}function Pe(l){let t;return{c(){t=q("Start")},m(e,o){I(e,t,o)},d(e){e&&T(t)}}}function ce(l){let t,e;return{c(){t=p("i"),e=q(l[4])},m(o,u){I(o,t,u),_(t,e)},p(o,u){u&16&&X(e,o[4])},d(o){o&&T(t)}}}function Ve(l){let t,e,o,u,f,a,i,s,n,d,c,B,v,j,m,$,G,P,g,b,E,A,F,S,N;f=new Ae({props:{$$slots:{default:[qe]},$$scope:{ctx:l}}}),f.$on("click",l[9]),i=new Se({props:{label:"Select Transport Authority or Local Authority District",id:"inputValue",$$slots:{default:[Ge]},$$scope:{ctx:l}}}),n=new De({props:{disabled:!l[5],$$slots:{default:[Pe]},$$scope:{ctx:l}}}),n.$on("click",l[8]);function he(r){l[12](r)}let Y={legend:"Or pick from the map",id:"showBoundaries",choices:[["TA","Transport Authorities"],["LAD","Local Authority Districts"]]};l[3]!==void 0&&(Y.value=l[3]),v=new Me({props:Y}),z.push(()=>ue(v,"value",he)),v.$on("change",l[6]);let k=l[4]&&ce(l);g=new Be({props:{label:"Or upload an ATIP GeoJSON file",loadFile:l[7],id:"load-geojson"}});function pe(r){l[13](r)}let x={};return l[1]!==void 0&&(x.open=l[1]),F=new Ne({props:x}),z.push(()=>ue(F,"open",pe)),{c(){t=p("div"),e=p("div"),o=p("h1"),o.textContent="Welcome to ATIP v2",u=w(),D(f.$$.fragment),a=w(),D(i.$$.fragment),s=w(),D(n.$$.fragment),d=w(),c=p("hr"),B=w(),D(v.$$.fragment),m=w(),k&&k.c(),$=w(),G=p("hr"),P=w(),D(g.$$.fragment),b=w(),E=p("div"),E.innerHTML='
    ',A=w(),D(F.$$.fragment),h(o,"class","govuk-heading-l"),h(e,"class","govuk-grid-column-one-half left svelte-lyn11h"),h(E,"class","govuk-grid-column-one-half"),h(t,"class","govuk-grid-row")},m(r,y){I(r,t,y),_(t,e),_(e,o),_(e,u),J(f,e,null),_(e,a),J(i,e,null),_(e,s),J(n,e,null),_(e,d),_(e,c),_(e,B),J(v,e,null),_(e,m),k&&k.m(e,null),_(e,$),_(e,G),_(e,P),J(g,e,null),_(t,b),_(t,E),I(r,A,y),J(F,r,y),N=!0},p(r,[y]){const ee={};y&65536&&(ee.$$scope={dirty:y,ctx:r}),f.$set(ee);const te={};y&65541&&(te.$$scope={dirty:y,ctx:r}),i.$set(te);const U={};y&32&&(U.disabled=!r[5]),y&65536&&(U.$$scope={dirty:y,ctx:r}),n.$set(U);const le={};!j&&y&8&&(j=!0,le.value=r[3],re(()=>j=!1)),v.$set(le),r[4]?k?k.p(r,y):(k=ce(r),k.c(),k.m(e,$)):k&&(k.d(1),k=null);const ne={};!S&&y&2&&(S=!0,ne.open=r[1],re(()=>S=!1)),F.$set(ne)},i(r){N||(C(f.$$.fragment,r),C(i.$$.fragment,r),C(n.$$.fragment,r),C(v.$$.fragment,r),C(g.$$.fragment,r),C(F.$$.fragment,r),N=!0)},o(r){L(f.$$.fragment,r),L(i.$$.fragment,r),L(n.$$.fragment,r),L(v.$$.fragment,r),L(g.$$.fragment,r),L(F.$$.fragment,r),N=!1},d(r){r&&(T(t),T(A)),O(f),O(i),O(n),O(v),k&&k.d(),O(g),O(F,r)}}}let V="boundary",M="boundary-layer";function He(l){if(l.features.length>0){let t=l.features[0].properties;for(let e of["planning","v2","criticals"])if(t&&e in t)return e}return"v1"}function Re(l,t,e){let o,u=!1,f,a,i=new Set,s=null,n="TA";function d(){s==null||s.setFilter(M,["==",["get","level"],n])}let c=null;Ee(async()=>{Te();const b=await(await fetch(je)).text(),E=JSON.parse(b);for(let S of E.features){let N=document.createElement("option");N.value=S.properties.name,a.appendChild(N),i.add(S.properties.name)}s=new Fe.Map({container:"map",style:"https://api.maptiler.com/maps/streets/style.json?key=MZEJTanw3WpxRvt7qDfo"});let A=null;function F(){A!==null&&s.setFeatureState({source:V,id:A},{hover:!1})}s.on("load",function(){s.fitBounds(Ie(E),{padding:20,animate:!1}),s.addSource(V,{type:"geojson",data:E,generateId:!0}),s.addLayer({id:M,source:V,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]}}),s.on("mousemove",M,S=>{S.features.length>0&&(F(),A=S.features[0].id,e(4,c=S.features[0].properties.name),s.setFeatureState({source:V,id:A},{hover:!0}))}),s.on("mouseleave",M,()=>{F(),A=null,e(4,c=null)}),s.on("click",M,function(S){let N=S.features[0].properties.name;window.location.href=`scheme.html?authority=${N}`})})});function B(g){try{let b=JSON.parse(g);if(!b.authority)throw new Error("File doesn't have an authority set; is it an ATIP file?");if(!i.has(b.authority))throw new Error(`Unknown authority ${b.authority}`);let E=b.authority,A=He(b);A!="v1"&&(E+=`_${A}`),window.localStorage.setItem(E,JSON.stringify(b)),window.location.href=`scheme.html?authority=${b.authority}&schema=${A}`}catch(b){window.alert(`Couldn't load scheme from a file: ${b}`)}}function v(){window.location.href=`scheme.html?authority=${f}`}const j=()=>e(1,u=!u);function m(){f=this.value,e(0,f)}function $(g){z[g?"unshift":"push"](()=>{a=g,e(2,a)})}function G(g){n=g,e(3,n)}function P(g){u=g,e(1,u)}return l.$$.update=()=>{l.$$.dirty&1&&e(5,o=i.has(f))},[f,u,a,n,c,o,d,B,v,j,m,$,G,P]}class Ue extends K{constructor(t){super(),Z(this,t,Re,Ve,Q,{})}}document.body.className=document.body.className?document.body.className+" js-enabled":"js-enabled";new Ue({target:document.getElementById("app")}); diff --git a/govuk_step2/assets/main-ee05c33e.js b/govuk_step2/assets/main-ee05c33e.js deleted file mode 100644 index ed951c79a..000000000 --- a/govuk_step2/assets/main-ee05c33e.js +++ /dev/null @@ -1 +0,0 @@ -import{S as K,i as Z,s as Q,c as me,a as W,e as p,b as ae,d as I,l as H,u as ge,g as ve,f as be,h as ke,t as N,j,k as T,m as oe,n as _e,o as se,p as q,q as w,r as h,v as _,w as X,x as ie,y as ye,z as we,A as R,B as $e,C as Ae,D as z,E as ue,F as Se,G as D,H as J,I as re,J as O,K as Fe,L as Be,M as Ee}from"./maplibre_helpers-e26a4314.js";import{F as Ie,i as Te}from"./FormElement-11aad004.js";import{A as Ce,a as Le}from"./About-1c252dce.js";function Ne(l){let t,e,o,u;const f=l[2].default,a=me(f,l,l[1],null);let i=[{type:"button"},{class:"govuk-button"},{"data-module":"govuk-button"},l[0]],s={};for(let n=0;n{e(0,t=W(W({},t),oe(a))),"$$scope"in a&&e(1,u=a.$$scope)},t=oe(t),[t,u,o,f]}class De extends K{constructor(t){super(),Z(this,t,je,Ne,Q,{})}}function fe(l,t,e){const o=l.slice();return o[7]=t[e][0],o[8]=t[e][1],o}function de(l){let t,e,o,u,f=!1,a,i,s=l[8]+"",n,d,c,F,v,L;return F=we(l[6][0]),{c(){t=p("div"),e=p("input"),a=w(),i=p("label"),n=q(s),c=w(),h(e,"class","govuk-radios__input"),h(e,"id",o=l[2]+l[7]),h(e,"type","radio"),e.__value=u=l[7],R(e,e.__value),h(i,"class","govuk-label govuk-radios__label"),h(i,"for",d=l[2]+l[7]),h(t,"class","govuk-radios__item"),F.p(e)},m(m,$){I(m,t,$),_(t,e),e.checked=e.__value===l[0],_(t,a),_(t,i),_(i,n),_(t,c),v||(L=[H(e,"change",l[5]),H(e,"change",l[4])],v=!0)},p(m,$){$&12&&o!==(o=m[2]+m[7])&&h(e,"id",o),$&8&&u!==(u=m[7])&&(e.__value=u,R(e,e.__value),f=!0),(f||$&9)&&(e.checked=e.__value===m[0]),$&8&&s!==(s=m[8]+"")&&X(n,s),$&12&&d!==(d=m[2]+m[7])&&h(i,"for",d)},d(m){m&&T(t),F.r(),v=!1,$e(L)}}}function Je(l){let t,e,o,u,f,a,i=se(l[3]),s=[];for(let n=0;n{"legend"in d&&e(1,o=d.legend),"id"in d&&e(2,u=d.id),"choices"in d&&e(3,f=d.choices),"value"in d&&e(0,a=d.value)},[a,o,u,f,s,n,i]}class Me extends K{constructor(t){super(),Z(this,t,Oe,Je,Q,{legend:1,id:2,choices:3,value:0})}}function qe(l){let t;return{c(){t=q("About")},m(e,o){I(e,t,o)},d(e){e&&T(t)}}}function Ge(l){let t,e,o,u,f;return{c(){t=p("input"),e=w(),o=p("datalist"),h(t,"class","govuk-input govuk-input--width-20"),h(t,"id","inputValue"),h(t,"data-testid","transport-authority"),h(t,"list","authorities-list"),h(o,"id","authorities-list")},m(a,i){I(a,t,i),R(t,l[0]),I(a,e,i),I(a,o,i),l[11](o),u||(f=H(t,"input",l[10]),u=!0)},p(a,i){i&1&&t.value!==a[0]&&R(t,a[0])},d(a){a&&(T(t),T(e),T(o)),l[11](null),u=!1,f()}}}function Pe(l){let t;return{c(){t=q("Start")},m(e,o){I(e,t,o)},d(e){e&&T(t)}}}function ce(l){let t,e;return{c(){t=p("i"),e=q(l[4])},m(o,u){I(o,t,u),_(t,e)},p(o,u){u&16&&X(e,o[4])},d(o){o&&T(t)}}}function Ve(l){let t,e,o,u,f,a,i,s,n,d,c,F,v,L,m,$,G,P,g,b,B,A,E,S,C;f=new Ae({props:{$$slots:{default:[qe]},$$scope:{ctx:l}}}),f.$on("click",l[9]),i=new Ie({props:{label:"Select Transport Authority or Local Authority District",id:"inputValue",$$slots:{default:[Ge]},$$scope:{ctx:l}}}),n=new De({props:{disabled:!l[5],$$slots:{default:[Pe]},$$scope:{ctx:l}}}),n.$on("click",l[8]);function he(r){l[12](r)}let Y={legend:"Or pick from the map",id:"showBoundaries",choices:[["TA","Transport Authorities"],["LAD","Local Authority Districts"]]};l[3]!==void 0&&(Y.value=l[3]),v=new Me({props:Y}),z.push(()=>ue(v,"value",he)),v.$on("change",l[6]);let k=l[4]&&ce(l);g=new Se({props:{label:"Or upload an ATIP GeoJSON file",loadFile:l[7]}});function pe(r){l[13](r)}let x={};return l[1]!==void 0&&(x.open=l[1]),E=new Ce({props:x}),z.push(()=>ue(E,"open",pe)),{c(){t=p("div"),e=p("div"),o=p("h1"),o.textContent="Welcome to ATIP v2",u=w(),D(f.$$.fragment),a=w(),D(i.$$.fragment),s=w(),D(n.$$.fragment),d=w(),c=p("hr"),F=w(),D(v.$$.fragment),m=w(),k&&k.c(),$=w(),G=p("hr"),P=w(),D(g.$$.fragment),b=w(),B=p("div"),B.innerHTML='
    ',A=w(),D(E.$$.fragment),h(o,"class","govuk-heading-l"),h(e,"class","govuk-grid-column-one-half left svelte-lyn11h"),h(B,"class","govuk-grid-column-one-half"),h(t,"class","govuk-grid-row")},m(r,y){I(r,t,y),_(t,e),_(e,o),_(e,u),J(f,e,null),_(e,a),J(i,e,null),_(e,s),J(n,e,null),_(e,d),_(e,c),_(e,F),J(v,e,null),_(e,m),k&&k.m(e,null),_(e,$),_(e,G),_(e,P),J(g,e,null),_(t,b),_(t,B),I(r,A,y),J(E,r,y),C=!0},p(r,[y]){const ee={};y&65536&&(ee.$$scope={dirty:y,ctx:r}),f.$set(ee);const te={};y&65541&&(te.$$scope={dirty:y,ctx:r}),i.$set(te);const U={};y&32&&(U.disabled=!r[5]),y&65536&&(U.$$scope={dirty:y,ctx:r}),n.$set(U);const le={};!L&&y&8&&(L=!0,le.value=r[3],re(()=>L=!1)),v.$set(le),r[4]?k?k.p(r,y):(k=ce(r),k.c(),k.m(e,$)):k&&(k.d(1),k=null);const ne={};!S&&y&2&&(S=!0,ne.open=r[1],re(()=>S=!1)),E.$set(ne)},i(r){C||(N(f.$$.fragment,r),N(i.$$.fragment,r),N(n.$$.fragment,r),N(v.$$.fragment,r),N(g.$$.fragment,r),N(E.$$.fragment,r),C=!0)},o(r){j(f.$$.fragment,r),j(i.$$.fragment,r),j(n.$$.fragment,r),j(v.$$.fragment,r),j(g.$$.fragment,r),j(E.$$.fragment,r),C=!1},d(r){r&&(T(t),T(A)),O(f),O(i),O(n),O(v),k&&k.d(),O(g),O(E,r)}}}let V="boundary",M="boundary-layer";function He(l){if(l.features.length>0){let t=l.features[0].properties;for(let e of["planning","v2","criticals"])if(t&&e in t)return e}return"v1"}function Re(l,t,e){let o,u=!1,f,a,i=new Set,s=null,n="TA";function d(){s==null||s.setFilter(M,["==",["get","level"],n])}let c=null;Fe(async()=>{Te();const b=await(await fetch(Le)).text(),B=JSON.parse(b);for(let S of B.features){let C=document.createElement("option");C.value=S.properties.name,a.appendChild(C),i.add(S.properties.name)}s=new Be.Map({container:"map",style:"https://api.maptiler.com/maps/streets/style.json?key=MZEJTanw3WpxRvt7qDfo"});let A=null;function E(){A!==null&&s.setFeatureState({source:V,id:A},{hover:!1})}s.on("load",function(){s.fitBounds(Ee(B),{padding:20,animate:!1}),s.addSource(V,{type:"geojson",data:B,generateId:!0}),s.addLayer({id:M,source:V,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]}}),s.on("mousemove",M,S=>{S.features.length>0&&(E(),A=S.features[0].id,e(4,c=S.features[0].properties.name),s.setFeatureState({source:V,id:A},{hover:!0}))}),s.on("mouseleave",M,()=>{E(),A=null,e(4,c=null)}),s.on("click",M,function(S){let C=S.features[0].properties.name;window.location.href=`scheme.html?authority=${C}`})})});function F(g){try{let b=JSON.parse(g);if(!b.authority)throw new Error("File doesn't have an authority set; is it an ATIP file?");if(!i.has(b.authority))throw new Error(`Unknown authority ${b.authority}`);let B=b.authority,A=He(b);A!="v1"&&(B+=`_${A}`),window.localStorage.setItem(B,JSON.stringify(b)),window.location.href=`scheme.html?authority=${b.authority}&schema=${A}`}catch(b){window.alert(`Couldn't load scheme from a file: ${b}`)}}function v(){window.location.href=`scheme.html?authority=${f}`}const L=()=>e(1,u=!u);function m(){f=this.value,e(0,f)}function $(g){z[g?"unshift":"push"](()=>{a=g,e(2,a)})}function G(g){n=g,e(3,n)}function P(g){u=g,e(1,u)}return l.$$.update=()=>{l.$$.dirty&1&&e(5,o=i.has(f))},[f,u,a,n,c,o,d,F,v,L,m,$,G,P]}class Ue extends K{constructor(t){super(),Z(this,t,Re,Ve,Q,{})}}document.body.className=document.body.className?document.body.className+" js-enabled":"js-enabled";new Ue({target:document.getElementById("app")}); diff --git a/govuk_step2/assets/maplibre_helpers-e26a4314.js b/govuk_step2/assets/maplibre_helpers-5d84afaa.js similarity index 75% rename from govuk_step2/assets/maplibre_helpers-e26a4314.js rename to govuk_step2/assets/maplibre_helpers-5d84afaa.js index 5b2081bb1..485cb4446 100644 --- a/govuk_step2/assets/maplibre_helpers-e26a4314.js +++ b/govuk_step2/assets/maplibre_helpers-5d84afaa.js @@ -1,8 +1,8 @@ -var af=Object.defineProperty;var of=(S,A,D)=>A in S?af(S,A,{enumerable:!0,configurable:!0,writable:!0,value:D}):S[A]=D;var Hc=(S,A,D)=>(of(S,typeof A!="symbol"?A+"":A,D),D);(function(){const A=document.createElement("link").relList;if(A&&A.supports&&A.supports("modulepreload"))return;for(const ne of document.querySelectorAll('link[rel="modulepreload"]'))j(ne);new MutationObserver(ne=>{for(const ae of ne)if(ae.type==="childList")for(const de of ae.addedNodes)de.tagName==="LINK"&&de.rel==="modulepreload"&&j(de)}).observe(document,{childList:!0,subtree:!0});function D(ne){const ae={};return ne.integrity&&(ae.integrity=ne.integrity),ne.referrerPolicy&&(ae.referrerPolicy=ne.referrerPolicy),ne.crossOrigin==="use-credentials"?ae.credentials="include":ne.crossOrigin==="anonymous"?ae.credentials="omit":ae.credentials="same-origin",ae}function j(ne){if(ne.ep)return;ne.ep=!0;const ae=D(ne);fetch(ne.href,ae)}})();function Nn(){}const lf=S=>S;function zl(S,A){for(const D in A)S[D]=A[D];return S}function Ku(S){return S()}function ju(){return Object.create(null)}function fs(S){S.forEach(Ku)}function ih(S){return typeof S=="function"}function Yu(S,A){return S!=S?A==A:S!==A||S&&typeof S=="object"||typeof S=="function"}let Cl;function mm(S,A){return Cl||(Cl=document.createElement("a")),Cl.href=A,S===Cl.href}function cf(S){return Object.keys(S).length===0}function Ju(S,...A){if(S==null){for(const j of A)j(void 0);return Nn}const D=S.subscribe(...A);return D.unsubscribe?()=>D.unsubscribe():D}function gm(S){let A;return Ju(S,D=>A=D)(),A}function _m(S,A,D){S.$$.on_destroy.push(Ju(A,D))}function hf(S,A,D,j){if(S){const ne=Qu(S,A,D,j);return S[0](ne)}}function Qu(S,A,D,j){return S[1]&&j?zl(D.ctx.slice(),S[1](j(A))):D.ctx}function uf(S,A,D,j){if(S[2]&&j){const ne=S[2](j(D));if(A.dirty===void 0)return ne;if(typeof ne=="object"){const ae=[],de=Math.max(A.dirty.length,ne.length);for(let h=0;h32){const A=[],D=S.ctx.length/32;for(let j=0;jwindow.performance.now():()=>Date.now(),rh=ed?S=>requestAnimationFrame(S):Nn;const pa=new Set;function td(S){pa.forEach(A=>{A.c(S)||(pa.delete(A),A.f())}),pa.size!==0&&rh(td)}function mf(S){let A;return pa.size===0&&rh(td),{promise:new Promise(D=>{pa.add(A={c:S,f:D})}),abort(){pa.delete(A)}}}function bo(S,A){S.appendChild(A)}function id(S){if(!S)return document;const A=S.getRootNode?S.getRootNode():S.ownerDocument;return A&&A.host?A:S.ownerDocument}function gf(S){const A=wo("style");return A.textContent="/* empty */",_f(id(S),A),A.sheet}function _f(S,A){return bo(S.head||S,A),A.sheet}function rd(S,A,D){S.insertBefore(A,D||null)}function Ol(S){S.parentNode&&S.parentNode.removeChild(S)}function xm(S,A){for(let D=0;DS.removeEventListener(A,D,j)}function wm(S){return function(A){return A.stopPropagation(),S.call(this,A)}}function Vn(S,A,D){D==null?S.removeAttribute(A):S.getAttribute(A)!==D&&S.setAttribute(A,D)}const xf=["width","height"];function Gu(S,A){const D=Object.getOwnPropertyDescriptors(S.__proto__);for(const j in A)A[j]==null?S.removeAttribute(j):j==="style"?S.style.cssText=A[j]:j==="__value"?S.value=S[j]=A[j]:D[j]&&D[j].set&&xf.indexOf(j)===-1?S[j]=A[j]:Vn(S,j,A[j])}function Tm(S){let A;return{p(...D){A=D,A.forEach(j=>S.push(j))},r(){A.forEach(D=>S.splice(S.indexOf(D),1))}}}function Em(S){return S===""?null:+S}function vf(S){return Array.from(S.childNodes)}function bf(S,A){A=""+A,S.data!==A&&(S.data=A)}function Sm(S,A){S.value=A??""}function Im(S,A,D,j){D==null?S.style.removeProperty(A):S.style.setProperty(A,D,j?"important":"")}function Am(S,A,D){for(let j=0;j>>0}function Tf(S,A){const D={stylesheet:gf(A),rules:{}};return Dl.set(S,D),D}function Xu(S,A,D,j,ne,ae,de,h=0){const ue=16.666/j;let X=`{ -`;for(let bt=0;bt<=1;bt+=ue){const et=A+(D-A)*ae(bt);X+=bt*100+`%{${de(et,1-et)}} -`}const Ge=X+`100% {${de(D,1-D)}} -}`,xe=`__svelte_${wf(Ge)}_${h}`,nt=id(S),{stylesheet:ot,rules:We}=Dl.get(nt)||Tf(nt,S);We[xe]||(We[xe]=!0,ot.insertRule(`@keyframes ${xe} ${Ge}`,ot.cssRules.length));const xt=S.style.animation||"";return S.style.animation=`${xt?`${xt}, `:""}${xe} ${j}ms linear ${ne}ms 1 both`,Ll+=1,xe}function Ef(S,A){const D=(S.style.animation||"").split(", "),j=D.filter(A?ae=>ae.indexOf(A)<0:ae=>ae.indexOf("__svelte")===-1),ne=D.length-j.length;ne&&(S.style.animation=j.join(", "),Ll-=ne,Ll||Sf())}function Sf(){rh(()=>{Ll||(Dl.forEach(S=>{const{ownerNode:A}=S.stylesheet;A&&Ol(A)}),Dl.clear())})}let Eo;function To(S){Eo=S}function So(){if(!Eo)throw new Error("Function called outside component initialization");return Eo}function Cm(S){So().$$.on_mount.push(S)}function km(S){So().$$.on_destroy.push(S)}function zm(){const S=So();return(A,D,{cancelable:j=!1}={})=>{const ne=S.$$.callbacks[A];if(ne){const ae=sd(A,D,{cancelable:j});return ne.slice().forEach(de=>{de.call(S,ae)}),!ae.defaultPrevented}return!0}}function Dm(S,A){return So().$$.context.set(S,A),A}function Lm(S){return So().$$.context.get(S)}function If(S,A){const D=S.$$.callbacks[A.type];D&&D.slice().forEach(j=>j.call(this,A))}const da=[],Jc=[];let fa=[];const Qc=[],Af=Promise.resolve();let eh=!1;function Pf(){eh||(eh=!0,Af.then(ad))}function Bl(S){fa.push(S)}function Bm(S){Qc.push(S)}const Kc=new Set;let ua=0;function ad(){if(ua!==0)return;const S=Eo;do{try{for(;uaS.indexOf(j)===-1?A.push(j):D.push(j)),D.forEach(j=>j()),fa=A}let vo;function kf(){return vo||(vo=Promise.resolve(),vo.then(()=>{vo=null})),vo}function Yc(S,A,D){S.dispatchEvent(sd(`${A?"intro":"outro"}${D}`))}const kl=new Set;let pn;function Rm(){pn={r:0,c:[],p:pn}}function Fm(){pn.r||fs(pn.c),pn=pn.p}function sh(S,A){S&&S.i&&(kl.delete(S),S.i(A))}function od(S,A,D,j){if(S&&S.o){if(kl.has(S))return;kl.add(S),pn.c.push(()=>{kl.delete(S),j&&(D&&S.d(1),j())}),S.o(A)}else j&&j()}const zf={duration:0};function Om(S,A,D,j){let ae=A(S,D,{direction:"both"}),de=j?0:1,h=null,ue=null,X=null,Ge;function xe(){X&&Ef(S,X)}function nt(We,xt){const bt=We.b-de;return xt*=Math.abs(bt),{a:de,b:We.b,d:bt,duration:xt,start:We.start,end:We.start+xt,group:We.group}}function ot(We){const{delay:xt=0,duration:bt=300,easing:et=lf,tick:Bt=Nn,css:pt}=ae||zf,ri={start:ff()+xt,b:We};We||(ri.group=pn,pn.r+=1),"inert"in S&&(We?Ge!==void 0&&(S.inert=Ge):(Ge=S.inert,S.inert=!0)),h||ue?ue=ri:(pt&&(xe(),X=Xu(S,de,We,bt,xt,et,pt)),We&&Bt(0,1),h=nt(ri,bt),Bl(()=>Yc(S,We,"start")),mf(Rt=>{if(ue&&Rt>ue.start&&(h=nt(ue,bt),ue=null,Yc(S,h.b,"start"),pt&&(xe(),X=Xu(S,de,h.b,h.duration,0,et,ae.css))),h){if(Rt>=h.end)Bt(de=h.b,1-de),Yc(S,h.b,"end"),ue||(h.b?xe():--h.group.r||fs(h.group.c)),h=null;else if(Rt>=h.start){const Ai=Rt-h.start;de=h.a+h.d*et(Ai/h.duration),Bt(de,1-de)}}return!!(h||ue)}))}return{run(We){ih(ae)?kf().then(()=>{ae=ae({direction:We?"in":"out"}),ot(We)}):ot(We)},end(){xe(),h=ue=null}}}function Um(S){return(S==null?void 0:S.length)!==void 0?S:Array.from(S)}function Vm(S,A){od(S,1,1,()=>{A.delete(S.key)})}function Nm(S,A,D,j,ne,ae,de,h,ue,X,Ge,xe){let nt=S.length,ot=ae.length,We=nt;const xt={};for(;We--;)xt[S[We].key]=We;const bt=[],et=new Map,Bt=new Map,pt=[];for(We=ot;We--;){const Mt=xe(ne,ae,We),Ct=D(Mt);let ni=de.get(Ct);ni?j&&pt.push(()=>ni.p(Mt,A)):(ni=X(Ct,Mt),ni.c()),et.set(Ct,bt[We]=ni),Ct in xt&&Bt.set(Ct,Math.abs(We-xt[Ct]))}const ri=new Set,Rt=new Set;function Ai(Mt){sh(Mt,1),Mt.m(h,Ge),de.set(Mt.key,Mt),Ge=Mt.first,ot--}for(;nt&&ot;){const Mt=bt[ot-1],Ct=S[nt-1],ni=Mt.key,Vt=Ct.key;Mt===Ct?(Ge=Mt.first,nt--,ot--):et.has(Vt)?!de.has(ni)||ri.has(ni)?Ai(Mt):Rt.has(Vt)?nt--:Bt.get(ni)>Bt.get(Vt)?(Rt.add(ni),Ai(Mt)):(ri.add(Vt),nt--):(ue(Ct,de),nt--)}for(;nt--;){const Mt=S[nt];et.has(Mt.key)||ue(Mt,de)}for(;ot;)Ai(bt[ot-1]);return fs(pt),bt}function Df(S,A){const D={},j={},ne={$$scope:1};let ae=S.length;for(;ae--;){const de=S[ae],h=A[ae];if(h){for(const ue in de)ue in h||(j[ue]=1);for(const ue in h)ne[ue]||(D[ue]=h[ue],ne[ue]=1);S[ae]=h}else for(const ue in de)ne[ue]=1}for(const de in j)de in D||(D[de]=void 0);return D}function $m(S,A,D){const j=S.$$.props[A];j!==void 0&&(S.$$.bound[j]=D,D(S.$$.ctx[j]))}function qm(S){S&&S.c()}function Lf(S,A,D){const{fragment:j,after_update:ne}=S.$$;j&&j.m(A,D),Bl(()=>{const ae=S.$$.on_mount.map(Ku).filter(ih);S.$$.on_destroy?S.$$.on_destroy.push(...ae):fs(ae),S.$$.on_mount=[]}),ne.forEach(Bl)}function Bf(S,A){const D=S.$$;D.fragment!==null&&(Cf(D.after_update),fs(D.on_destroy),D.fragment&&D.fragment.d(A),D.on_destroy=D.fragment=null,D.ctx=[])}function Rf(S,A){S.$$.dirty[0]===-1&&(da.push(S),Pf(),S.$$.dirty.fill(0)),S.$$.dirty[A/31|0]|=1<{const We=ot.length?ot[0]:nt;return X.ctx&&ne(X.ctx[xe],X.ctx[xe]=We)&&(!X.skip_bound&&X.bound[xe]&&X.bound[xe](We),Ge&&Rf(S,xe)),nt}):[],X.update(),Ge=!0,fs(X.before_update),X.fragment=j?j(X.ctx):!1,A.target){if(A.hydrate){const xe=vf(A.target);X.fragment&&X.fragment.l(xe),xe.forEach(Ol)}else X.fragment&&X.fragment.c();A.intro&&sh(S.$$.fragment),Lf(S,A.target,A.anchor),ad()}To(ue)}class cd{constructor(){Hc(this,"$$");Hc(this,"$$set")}$destroy(){Bf(this,1),this.$destroy=Nn}$on(A,D){if(!ih(D))return Nn;const j=this.$$.callbacks[A]||(this.$$.callbacks[A]=[]);return j.push(D),()=>{const ne=j.indexOf(D);ne!==-1&&j.splice(ne,1)}}$set(A){this.$$set&&!cf(A)&&(this.$$.skip_bound=!0,this.$$set(A),this.$$.skip_bound=!1)}}const Ff="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ff);var Of=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jm(S){return S&&S.__esModule&&Object.prototype.hasOwnProperty.call(S,"default")?S.default:S}function Zm(S){if(S.__esModule)return S;var A=S.default;if(typeof A=="function"){var D=function j(){if(this instanceof j){var ne=[null];ne.push.apply(ne,arguments);var ae=Function.bind.apply(A,ne);return new ae}return A.apply(this,arguments)};D.prototype=A.prototype}else D={};return Object.defineProperty(D,"__esModule",{value:!0}),Object.keys(S).forEach(function(j){var ne=Object.getOwnPropertyDescriptor(S,j);Object.defineProperty(D,j,ne.get?ne:{enumerable:!0,get:function(){return S[j]}})}),D}var hd={exports:{}};(function(S,A){(function(D,j){S.exports=j()})(Of,function(){var D,j,ne;function ae(h,ue){if(!D)D=ue;else if(!j)j=ue;else{var X="var sharedChunk = {}; ("+D+")(sharedChunk); ("+j+")(sharedChunk);",Ge={};D(Ge),ne=ue(Ge),typeof window<"u"&&(ne.workerUrl=window.URL.createObjectURL(new Blob([X],{type:"text/javascript"})))}}ae(["exports"],function(h){function ue(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var X=Ge;function Ge(i,e){this.x=i,this.y=e}Ge.prototype={clone:function(){return new Ge(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}},Ge.convert=function(i){return i instanceof Ge?i:Array.isArray(i)?new Ge(i[0],i[1]):i};var xe=ue(X),nt=ot;function ot(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}ot.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 We=ue(nt);function xt(i,e,r,s){const l=new We(i,e,r,s);return function(u){return l.solve(u)}}const bt=xt(.25,.1,.25,1);function et(i,e,r){return Math.min(r,Math.max(e,i))}function Bt(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function pt(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let ri=1;function Rt(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Ai(i,e,r){const s={};for(const l in i)s[l]=e.call(r||this,i[l],l,i);return s}function Mt(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 Ct(i){return Array.isArray(i)?i.map(Ct):typeof i=="object"&&i?Ai(i,Ct):i}const ni={};function Vt(i){ni[i]||(typeof console<"u"&&console.warn(i),ni[i]=!0)}function yt(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&&(Hr==null&&(Hr=matchMedia("(prefers-reduced-motion: reduce)")),Hr.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 Br 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 bi=Zi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Gi=i=>$n.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function hi(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:bi(),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 Br(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(Zi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Zi())return(Gi(i.url)||hi)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(bi())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return hi(i,e);if(Zi()&&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 Br(u.status,u.statusText,s.url,d))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},yn=function(i,e){return _n(pt(i,{type:"arrayBuffer"}),e)};function Kr(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 Rr(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function br(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class wr{constructor(e,r={}){pt(this,r),this.type=e}}class Xi extends wr{constructor(e,r={}){super("error",pt({error:e},r))}}class xn{on(e,r){return this._listeners=this._listeners||{},Rr(e,r,this._listeners),this}off(e,r){return br(e,r,this._listeners),br(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Rr(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new wr(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)br(s,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(pt(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof Xi&&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 Fr=["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 Fr.forEach(s=>{s in e&&(r[s]=e[s])}),r}function wt(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=[Or,be,Qe,Ye,Pi,Er,Qt,ui(He),er,Sr];function cr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!cr(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(!cr(r,e))return null}}return`Expected ${St(i)} but found ${St(e)} instead.`}function V(i,e){return e.some(r=>r.kind===i.kind)}function I(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 M(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const L=.96422,q=.82521,Z=4/29,J=6/29,H=3*J*J,G=J*J*J,ee=Math.PI/180,he=180/Math.PI;function fe(i){return(i%=360)<0&&(i+=360),i}function pe([i,e,r,s]){let l,u;const d=Xe((.2225045*(i=Ne(i))+.7168786*(e=Ne(e))+.0606169*(r=Ne(r)))/1);i===e&&e===r?l=u=d:(l=Xe((.4360747*i+.3850649*e+.1430804*r)/L),u=Xe((.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 Xe(i){return i>G?Math.pow(i,1/3):i/H+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=L*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:H*(i-Z)}function at(i){return parseInt(i.padEnd(2,i),16)/255}function tt(i,e){return ct(e?i/100:i,0,1)}function ct(i,e,r){return Math.min(Math.max(e,i),r)}function Tt(i){return!i.some(Number.isNaN)}const Xt={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=Xt[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[at(s.slice(f,f+=d)),at(s.slice(f,f+=d)),at(s.slice(f,f+=d)),at(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,P,C,z,U,F,Y,Q]=d,W=[b||" ",C||" ",F].join("");if(W===" "||W===" /"||W===",,"||W===",,,"){const ie=[v,P,U].join(""),se=ie==="%%%"?100:ie===""?255:0;if(se){const ce=[ct(+g/se,0,1),ct(+E/se,0,1),ct(+z/se,0,1),Y?tt(+Y,Q):1];if(Tt(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,P,C,z]=u,U=[g||" ",b||" ",P].join("");if(U===" "||U===" /"||U===",,"||U===",,,"){const F=[+f,ct(+v,0,100),ct(+E,0,100),C?tt(+C,z):1];if(Tt(F))return function([Y,Q,W,ie]){function se(ce){const ze=(ce+Y/30)%12,Be=Q*Math.min(W,1-W);return W-Be*Math.max(-1,Math.min(ze-3,9-ze,1))}return Y=fe(Y),Q/=100,W/=100,[se(0),se(8),se(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]=pe(e),d=Math.sqrt(s*s+l*l);return[Math.round(1e4*d)?fe(Math.atan2(l,s)*he):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",pe(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 Lt{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 Ur{constructor(e,r,s,l,u){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class di{constructor(e){this.sections=e}static fromString(e){return new di([new Ur(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 di?e:di.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Li{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Li)return e;if(typeof e=="number")return new Li([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 Li(e)}}toString(){return JSON.stringify(this.values)}}class Wi{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Wi({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 gs(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof je||i instanceof Lt||i instanceof di||i instanceof Li||i instanceof Wi)return!0;if(Array.isArray(i)){for(const e of i)if(!gs(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!gs(i[e]))return!1;return!0}return!1}function Wt(i){if(i===null)return Or;if(typeof i=="string")return Qe;if(typeof i=="boolean")return Ye;if(typeof i=="number")return be;if(i instanceof je)return Pi;if(i instanceof Lt)return Tr;if(i instanceof di)return Er;if(i instanceof Li)return er;if(i instanceof Wi)return Sr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=Wt(s);if(r){if(r===l)continue;r=He;break}r=l}return ui(r||He,e)}return Qt}function Gn(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof je||i instanceof di||i instanceof Li||i instanceof Wi?i.toString():JSON.stringify(i)}class Vr{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(!gs(e[1]))return r.error("invalid value");const s=e[1];let l=Wt(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 Vr(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Nt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const _s={string:Qe,number:be,boolean:Ye,object:Qt};class tr{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 _s)||v==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);f=_s[v],l++}else f=He;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=ui(f,g)}else{if(!_s[u])throw new Error(`Types doesn't contain name = ${u}`);s=_s[u]}const d=[];for(;le.outputDefined())}}const Io={"to-boolean":Ye,"to-color":Pi,"to-number":be,"to-string":Qe};class pi{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(!Io[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=Io[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 Nt(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=Li.parse(r);if(l)return l}throw new Nt(`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 Nt(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?di.fromString(Gn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Wi.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 ys{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 Nr{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 tr(u,[l]):d==="coerce"?new pi(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 Vr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new ys;try{d=new Vr(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 Nr(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 fi(s,e))}checkSubtype(e,r){const s=cr(e,r);return s&&this.error(s),s}}class mt{constructor(e,r,s){this.type=Tr,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,Ye);if(!l)return null;const u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Ye);if(!u)return null;let d=null;return s.locale&&(d=r.parse(s.locale,1,Qe),!d)?null:new mt(l,u,d)}evaluate(e){return new Lt(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 $r=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 xs(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Ao(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*$r),Math.round(s*l*$r)]}function Po(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 Mo(i,e){for(let r=0;r0&&f<0||d<0&&f>0}function Nl(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 ko(i,e,r,s){const l=Math.pow(2,s.z)*$r,u=[s.x*$r,s.y*$r],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)*$r,u=[s.x*$r,s.y*$r],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 Ir{constructor(e,r){this.type=Ye,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(gs(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 Nr(r.registry,bs,r.path,null,r.scope);const E=[];let P=!1;for(let C=1;C{return P=E,Array.isArray(P)?`(${P.map(St).join(", ")})`:`(${St(P.type)}...)`;var P}).join(" | "),b=[];for(let E=1;E{r=e?r&&bs(s):r&&s instanceof Vr}),!!r&&Wn(i)&&ws(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Wn(i){if(i instanceof Hi&&(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 Ir)return!1;let e=!0;return i.eachChild(r=>{e&&!Wn(r)&&(e=!1)}),e}function Tn(i){if(i instanceof Hi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!Tn(r)&&(e=!1)}),e}function ws(i,e){if(i instanceof Hi&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(s=>{r&&!ws(s,e)&&(r=!1)}),r}function Ts(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 Nt("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,be);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[Ts(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 Es(i,e,r){return i.map((s,l)=>Sn(s,e[l],r))}const Bi={number:Sn,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[l,u,d,f]=Es(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 P,C;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?P=NaN:(P=g,d!==1&&d!==0||(C=v)):(P=l,b!==1&&b!==0||(C=u));else{let Q=g-l;g>l&&Q>180?Q-=360:g180&&(Q+=360),P=l+r*Q}const[z,U,F,Y]=function([Q,W,ie,se]){return Q=isNaN(Q)?0:Q*ee,Le([ie,Math.cos(Q)*W,Math.sin(Q)*W,se])}([P,C??Sn(u,v,r),Sn(d,b,r),Sn(f,E,r)]);return new je(z,U,F,Y,!1)}case"lab":{const[l,u,d,f]=Le(Es(i.lab,e.lab,r));return new je(l,u,d,f,!1)}}},array:Es,padding:function(i,e,r){return new Li(Es(i.values,e.values,r))}};class Ri{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 We(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,be),!u)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Pi: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.',P);const z=r.parse(E,C,g);if(!z)return null;g=g||z.type,f.push([b,z])}return M(g,be)||M(g,Pi)||M(g,er)||M(g,ui(be))?new Ri(g,s,l,u,f):r.error(`Type ${St(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=Ts(r,l),f=Ri.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 Bi[this.type.kind](g,v,f);case"interpolate-hcl":return Bi.color(g,v,f,"hcl");case"interpolate-lab":return Bi.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 Ss{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=>cr(l,f.type));return new Ss(d?He: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 Wi&&!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 Is{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 Nt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Nt(`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=Ye,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,He),l=r.parse(e[2],2,He);return s&&l?V(s.type,[Ye,Qe,be,Or,He])?new Hn(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!I(r,["boolean","string","number","null"]))throw new Nt(`Expected first argument to be of type boolean, string, number or null, but found ${St(Wt(r))} instead.`);if(!I(s,["string","array"]))throw new Nt(`Expected second argument to be of type array or string, but found ${St(Wt(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class en{constructor(e,r,s){this.type=be,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,He),l=r.parse(e[2],2,He);if(!s||!l)return null;if(!V(s.type,[Ye,Qe,be,Or,He]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,be);return u?new en(s,l,u):null}return new en(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!I(r,["boolean","string","number","null"]))throw new Nt(`Expected first argument to be of type boolean, string, number or null, but found ${St(Wt(r))} instead.`);if(!I(s,["string","array"]))throw new Nt(`Expected second argument to be of type array or string, but found ${St(Wt(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 ht{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 P.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return P.error("Numeric branch labels must be integer values.");if(s){if(P.checkSubtype(s,Wt(z)))return null}else s=Wt(z);if(u[String(z)]!==void 0)return P.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,He);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 ht(s,l,f,u,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(Wt(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 As{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,He),l=r.parse(e[2],2,be);if(!s||!l)return null;if(!V(s.type,[ui(He),Qe,He]))return r.error(`Expected first argument to be of type array or string, but found ${St(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,be);return u?new As(s.type,s,l,u):null}return new As(s.type,s,l)}evaluate(e){const r=this.input.evaluate(e),s=this.beginIndex.evaluate(e);if(!I(r,["string","array"]))throw new Nt(`Expected first argument to be of type array or string, but found ${St(Wt(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 Do(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 Lo(i,e,r,s){return s.compare(e,r)===0}function In(i,e,r){const s=i!=="=="&&i!=="!=";return class ud{constructor(u,d,f){this.type=Ye,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,He);if(!g)return null;if(!Do(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${St(g.type)}'.`);let v=d.parse(u[2],2,He);if(!v)return null;if(!Do(f,v.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${St(v.type)}'.`);if(g.type.kind!==v.type.kind&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error(`Cannot compare types '${St(g.type)}' and '${St(v.type)}'.`);s&&(g.type.kind==="value"&&v.type.kind!=="value"?g=new tr(v.type,[g]):g.type.kind!=="value"&&v.type.kind==="value"&&(v=new tr(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,Tr),!b)return null}return new ud(g,v,b)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=Wt(d),v=Wt(f);if(g.kind!==v.kind||g.kind!=="string"&&g.kind!=="number")throw new Nt(`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=Wt(d),v=Wt(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 ql=In("==",function(i,e,r){return e===r},Lo),jl=In("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!Lo(0,e,r,s)}),Zl=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}),Xl=In("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),Wl=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=Qe,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,be);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,Qe),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,Qe),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,be),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,be),!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 Ps{constructor(e){this.type=Er,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,be),!g))return null;let v=null;if(f["text-font"]&&(v=r.parse(f["text-font"],1,ui(Qe)),!v))return null;let b=null;if(f["text-color"]&&(b=r.parse(f["text-color"],1,Pi),!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,He);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 Ps(l)}evaluate(e){return new di(this.sections.map(r=>{const s=r.content.evaluate(e);return Wt(s)===Sr?new Ur("",s,null,null,null):new Ur(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=Sr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Qe);return s?new Aa(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=Wi.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=be,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 ${St(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 Nt(`Expected value to be of type string or array, but found ${St(Wt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const An={"==":ql,"!=":jl,">":Gl,"<":Zl,">=":Wl,"<=":Xl,array:tr,at:Ea,boolean:tr,case:Sa,coalesce:Ss,collator:mt,format:Ps,image:Aa,in:Hn,"index-of":en,interpolate:Ri,"interpolate-hcl":Ri,"interpolate-lab":Ri,length:Pa,let:Is,literal:Vr,match:ht,number:tr,"number-format":Ia,object:tr,slice:As,step:En,string:tr,"to-boolean":pi,"to-color":pi,"to-number":pi,"to-string":pi,var:vs,within:Ir};function Bo(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 Nt(d);return new je(e/255,r/255,s/255,u,!1)}function Ro(i,e){return i in e}function Ma(i,e){const r=e[i];return r===void 0?null:r}function tn(i){return{type:i}}function Fo(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 Oo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Ca(i){return!!i.expression&&i.expression.interpolated}function _t(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Ms(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Hl(i){return i}function Uo(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:Li.parse;(i=lr({},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=Vo;else if(u==="interval")f=ka;else if(u==="categorical"){f=Kl,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=Yl}if(s){const b={},E=[];for(let z=0;zz[0]),evaluate:({zoom:z},U)=>Vo({stops:P,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:Ri.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 P=E&&E.properties?E.properties[i.property]:void 0;return P===void 0?Kn(i.default,e.default):f(i,e,P,g,v)}}}function Kn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Kl(i,e,r,s,l){return Kn(typeof r===l?s[r]:void 0,i.default,e.default)}function ka(i,e,r){if(_t(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=Ts(i.stops.map(u=>u[0]),r);return i.stops[l][1]}function Vo(i,e,r){const s=i.base!==void 0?i.base:1;if(_t(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=Ts(i.stops.map(b=>b[0]),r),d=function(b,E,P,C){const z=C-P,U=b-P;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=Bi[e.type]||Hl;return typeof f.evaluate=="function"?{evaluate(...b){const E=f.evaluate.apply(void 0,b),P=g.evaluate.apply(void 0,b);if(E!==void 0&&P!==void 0)return v(E,P,d,i.colorSpace)}}:v(f,g,d,i.colorSpace)}function Yl(i,e,r){switch(e.type){case"color":r=je.parse(r);break;case"formatted":r=di.fromString(r.toString());break;case"resolvedImage":r=Wi.fromString(r.toString());break;case"padding":r=Li.parse(r);break;default:_t(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Kn(r,i.default,e.default)}Hi.register(An,{error:[{kind:"error"},[Qe],(i,[e])=>{throw new Nt(e.evaluate(i))}],typeof:[Qe,[He],(i,[e])=>St(Wt(e.evaluate(i)))],"to-rgba":[ui(be,4),[Pi],(i,[e])=>{const[r,s,l,u]=e.evaluate(i).rgb;return[255*r,255*s,255*l,u]}],rgb:[Pi,[be,be,be],Bo],rgba:[Pi,[be,be,be,be],Bo],has:{type:Ye,overloads:[[[Qe],(i,[e])=>Ro(e.evaluate(i),i.properties())],[[Qe,Qt],(i,[e,r])=>Ro(e.evaluate(i),r.evaluate(i))]]},get:{type:He,overloads:[[[Qe],(i,[e])=>Ma(e.evaluate(i),i.properties())],[[Qe,Qt],(i,[e,r])=>Ma(e.evaluate(i),r.evaluate(i))]]},"feature-state":[He,[Qe],(i,[e])=>Ma(e.evaluate(i),i.featureState||{})],properties:[Qt,[],i=>i.properties()],"geometry-type":[Qe,[],i=>i.geometryType()],id:[He,[],i=>i.id()],zoom:[be,[],i=>i.globals.zoom],"heatmap-density":[be,[],i=>i.globals.heatmapDensity||0],"line-progress":[be,[],i=>i.globals.lineProgress||0],accumulated:[He,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[be,tn(be),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[be,tn(be),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:be,overloads:[[[be,be],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[be],(i,[e])=>-e.evaluate(i)]]},"/":[be,[be,be],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[be,[be,be],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[be,[],()=>Math.LN2],pi:[be,[],()=>Math.PI],e:[be,[],()=>Math.E],"^":[be,[be,be],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[be,[be],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[be,[be],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[be,[be],(i,[e])=>Math.log(e.evaluate(i))],log2:[be,[be],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[be,[be],(i,[e])=>Math.sin(e.evaluate(i))],cos:[be,[be],(i,[e])=>Math.cos(e.evaluate(i))],tan:[be,[be],(i,[e])=>Math.tan(e.evaluate(i))],asin:[be,[be],(i,[e])=>Math.asin(e.evaluate(i))],acos:[be,[be],(i,[e])=>Math.acos(e.evaluate(i))],atan:[be,[be],(i,[e])=>Math.atan(e.evaluate(i))],min:[be,tn(be),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[be,tn(be),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[be,[be],(i,[e])=>Math.abs(e.evaluate(i))],round:[be,[be],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[be,[be],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[be,[be],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[Qe,He],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[He],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[Qe],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[Qe,He],(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":[Ye,[Qe,He],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Ye,[He],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Ye,[Qe,He],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Ye,[He],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Ye,[Qe,He],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Ye,[He],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Ye,[He],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[ui(Qe)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[ui(He)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[Qe,ui(He)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[Qe,ui(He)],(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:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[tn(Ye),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[tn(Ye),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ye,[Ye],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ye,[Qe],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Qe,[Qe],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Qe,[Qe],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Qe,tn(He),(i,e)=>e.map(r=>Gn(r.evaluate(i))).join("")],"resolved-locale":[Qe,[Tr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class za{constructor(e,r){var s;this.expression=e,this._warningHistory={},this._evaluator=new ys,this._defaultValue=r?(s=r).type==="color"&&Ms(s.default)?new je(0,0,0,0):s.type==="color"?je.parse(s.default)||null:s.type==="padding"?Li.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 Nt(`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 Cs(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in An}function Dt(i,e){const r=new Nr(An,bs,[],e?function(l){const u={color:Pi,string:Qe,number:be,enum:Qe,boolean:Ye,formatted:Er,padding:er,resolvedImage:Sr};return l.type==="array"?ui(u[l.value]||He,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?Fo(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 st{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?Ri.interpolationFactor(this.interpolationType,e,r,s):0}}function ks(i,e){const r=Dt(i,e);if(r.result==="error")return r;const s=r.value.expression,l=Wn(s);if(!l&&!Mn(e))return Pn([new fi("","data expressions not supported")]);const u=ws(s,["zoom"]);if(!u&&!Oo(e))return Pn([new fi("","zoom expressions not supported")]);const d=Et(s);return d||u?d instanceof fi?Pn([d]):d instanceof Ri&&!Ca(e)?Pn([new fi("",'"interpolate" expressions cannot be used with this property')]):Fo(d?new st(l?"camera":"composite",r.value,d.labels,d instanceof Ri?d.interpolation:void 0):new Da(l?"constant":"source",r.value)):Pn([new fi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class It{constructor(e,r){this._parameters=e,this._specification=r,lr(this,Uo(this._parameters,this._specification))}static deserialize(e){return new It(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Et(i){let e=null;if(i instanceof Is)e=Et(i.result);else if(i instanceof Ss){for(const r of i.args)if(e=Et(r),e)break}else(i instanceof En||i instanceof Ri)&&i.input instanceof Hi&&i.input.name==="zoom"&&(e=i);return e instanceof fi||i.eachChild(r=>{const s=Et(r);s instanceof fi?e=s:!e&&s?e=new fi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new fi("",'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 No={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=Dt(i,No);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:$o(i)}}function Jl(i,e){return ie?1:0}function $o(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?Ds(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(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 Ds(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(Jl)]]:["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 we(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function Zo(i){const e=i.valueSpec,r=$t(i.value.type);let s,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,v=_t(i.value.stops)==="array"&&_t(i.value.stops[0])==="array"&&_t(i.value.stops[0][0])==="object",b=Ki({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 we(C.key,C.value,'identity function may not have a "stops" property')];let z=[];const U=C.value;return z=z.concat(jo({key:C.key,value:U,valueSpec:C.valueSpec,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,arrayElementValidator:E})),_t(U)==="array"&&U.length===0&&z.push(new we(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 we(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||b.push(new we(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Ca(i.valueSpec)&&b.push(new we(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Mn(i.valueSpec)?b.push(new we(i.key,i.value,"property functions not supported")):f&&!Oo(i.valueSpec)&&b.push(new we(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!v||i.value.property!==void 0||b.push(new we(i.key,i.value,'"property" property is required')),b;function E(C){let z=[];const U=C.value,F=C.key;if(_t(U)!=="array")return[new we(F,U,`array expected, ${_t(U)} found`)];if(U.length!==2)return[new we(F,U,`array length 2 expected, length ${U.length} found`)];if(v){if(_t(U[0])!=="object")return[new we(F,U,`object expected, ${_t(U[0])} found`)];if(U[0].zoom===void 0)return[new we(F,U,"object stop key must have zoom")];if(U[0].value===void 0)return[new we(F,U,"object stop key must have value")];if(u&&u>$t(U[0].zoom))return[new we(F,U[0].zoom,"stop zoom values must appear in ascending order")];$t(U[0].zoom)!==u&&(u=$t(U[0].zoom),l=void 0,d={}),z=z.concat(Ki({key:`${F}[0]`,value:U[0],valueSpec:{zoom:{}},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,objectElementValidators:{zoom:Fa,value:P}}))}else z=z.concat(P({key:`${F}[0]`,value:U[0],valueSpec:{},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec},U));return Cs(rn(U[1]))?z.concat([new we(`${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 P(C,z){const U=_t(C.value),F=$t(C.value),Y=C.value!==null?C.value:z;if(s){if(U!==s)return[new we(C.key,Y,`${U} stop domain type must match previous stop domain type ${s}`)]}else s=U;if(U!=="number"&&U!=="string"&&U!=="boolean")return[new we(C.key,Y,"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 we(C.key,Y,Q)]}return r!=="categorical"||U!=="number"||isFinite(F)&&Math.floor(F)===F?r!=="categorical"&&U==="number"&&l!==void 0&&Fnew we(`${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 we(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 we(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Tn(r))return[new we(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!ws(r,["zoom","feature-state"]))return[new we(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Wn(r))return[new we(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($t(r))===-1&&l.push(new we(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf($t(r))===-1&&l.push(new we(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function kn(i){return Cn(rn(i.value))?nn(lr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Go(i)}function Go(i){const e=i.value,r=i.key;if(_t(e)!=="array")return[new we(r,e,`array expected, ${_t(e)} found`)];const s=i.styleSpec;let l,u=[];if(e.length<1)return[new we(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})),$t(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&$t(e[1])==="$type"&&u.push(new we(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new we(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=_t(e[1]),l!=="string"&&u.push(new we(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;d{v in r&&e.push(new we(s,r[v],`"${v}" is prohibited for ref layers`))}),l.layers.forEach(v=>{$t(v.id)===f&&(g=v)}),g?g.ref?e.push(new we(s,r.ref,"ref cannot reference another ref layer")):d=$t(g.type):e.push(new we(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&&$t(g.type);g?v==="vector"&&d==="raster"?e.push(new we(s,r.source,`layer "${r.id}" requires a raster source`)):v==="raster"&&d!=="raster"?e.push(new we(s,r.source,`layer "${r.id}" requires a vector source`)):v!=="vector"||r["source-layer"]?v==="raster-dem"&&d!=="hillshade"?e.push(new we(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 we(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new we(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new we(s,r.source,`source "${r.source}" not found`))}else e.push(new we(s,r,'missing required property "source"'));return e=e.concat(Ki({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=>Ki({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Xo(lr({layerType:d},v))}}),paint:g=>Ki({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Ua(lr({layerType:d},v))}})}})),e}function hr(i){const e=i.value,r=i.key,s=_t(e);return s!=="string"?[new we(r,e,`string expected, ${s} found`)]:[]}const Bs={promoteId:function({key:i,value:e}){if(_t(e)==="string")return hr({key:i,value:e});{const r=[];for(const s in e)r.push(...hr({key:`${i}.${s}`,value:e[s]}));return r}}};function Rs(i){const e=i.value,r=i.key,s=i.styleSpec,l=i.style,u=i.validateSpec;if(!e.type)return[new we(r,e,'"type" is required')];const d=$t(e.type);let f;switch(d){case"vector":case"raster":case"raster-dem":return f=Ki({key:r,value:e,valueSpec:s[`source_${d.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:Bs,validateSpec:u}),f;case"geojson":if(f=Ki({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s,validateSpec:u,objectElementValidators:Bs}),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(...nn({key:`${r}.${g}.map`,value:b,validateSpec:u,expressionContext:"cluster-map"})),f.push(...nn({key:`${r}.${g}.reduce`,value:E,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return Ki({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:u,styleSpec:s});case"image":return Ki({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:u,styleSpec:s});case"canvas":return[new we(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 Wo(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let u=[];const d=_t(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new we("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 we(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=_t(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new we("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 we(f,e[f],`unknown property "${f}"`)]);return u}function Ho(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 we(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 we(s,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),e=e.concat(Ki({key:`${s}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return hr({key:s,value:r})}const Ko={"*":()=>[],array:jo,boolean:function(i){const e=i.value,r=i.key,s=_t(e);return s!=="boolean"?[new we(r,e,`boolean expected, ${s} found`)]:[]},number:Fa,color:function(i){const e=i.key,r=i.value,s=_t(r);return s!=="string"?[new we(e,r,`color expected, ${s} found`)]:je.parse(String(r))?[]:[new we(e,r,`color expected, "${r}" found`)]},constants:qo,enum:Qn,filter:kn,function:Zo,layer:Ls,object:Ki,source:Rs,light:Wo,terrain:es,string:hr,formatted:function(i){return hr(i).length===0?[]:nn(i)},resolvedImage:function(i){return hr(i).length===0?[]:nn(i)},padding:function(i){const e=i.key,r=i.value;if(_t(r)==="array"){if(r.length<1||r.length>4)return[new we(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(qo({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:ts}))),is(r)}function Yi(i){return function(e){return i({...e,validateSpec:ts})}}function is(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Ht(i){return function(...e){return is(i.apply(this,e))}}ur.source=Ht(Yi(Rs)),ur.sprite=Ht(Yi(Ho)),ur.glyphs=Ht(Yi(Yo)),ur.light=Ht(Yi(Wo)),ur.terrain=Ht(Yi(es)),ur.layer=Ht(Yi(Ls)),ur.filter=Ht(Yi(kn)),ur.paintProperty=Ht(Yi(Ua)),ur.layoutProperty=Ht(Yi(Xo));const qr=ur,ec=qr.light,tc=qr.paintProperty,ic=qr.layoutProperty;function zn(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new Xi(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),P=this._convertToCellCoord(l);for(let C=v;C<=E;C++)for(let z=b;z<=P;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]=dr[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 Ar(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||Fs(i)||Wr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Ar);if(typeof i=="object"){const e=i.$name||"Object";if(!dr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=dr[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]=dr[e].shallow.indexOf(l)>=0?u:Ar(u)}return s}throw new Error("can't deserialize object of type "+typeof i)}class Jo{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 Os(i){for(const e of i)if(Us(e.charCodeAt(0)))return!0;return!1}function Va(i){for(const e of i)if(!Qo(e.charCodeAt(0)))return!1;return!0}function Qo(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 Us(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 el(i){return!(Us(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 Vs(i){return i>=1424&&i<=2303||Ae["Arabic Presentation Forms-A"](i)||Ae["Arabic Presentation Forms-B"](i)}function Ns(i,e){return!(!e&&Vs(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Ae.Khmer(i))}function tl(i){for(const e of i)if(Vs(e.charCodeAt(0)))return!0;return!1}const Na="deferred",$s="loading",$a="loaded";let ss=null,Mi="unavailable",jr=null;const il=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Mi="error"),ss&&ss(i)};function qa(){qs.fire(new wr("pluginStateChange",{pluginStatus:Mi,pluginURL:jr}))}const qs=new xn,ja=function(){return Mi},rl=function(){if(Mi!==Na||!jr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Mi=$s,qa(),jr&&yn({url:jr},i=>{i?il(i):(Mi=$a,qa())})},Ji={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Mi===$a||Ji.applyArabicShaping!=null,isLoading:()=>Mi===$s,setState(i){if(!Zi())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Mi=i.pluginStatus,jr=i.pluginURL},isParsed(){if(!Zi())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Ji.applyArabicShaping!=null&&Ji.processBidirectionalText!=null&&Ji.processStyledBidirectionalText!=null},getPluginURL(){if(!Zi())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return jr}};class kt{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 Jo,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!Ns(l.charCodeAt(0),s))return!1;return!0}(e,Ji.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 js{constructor(e,r){this.property=e,this.value=r,this.expression=function(s,l){if(Ms(s))return new It(s,l);if(Cs(s)){const u=ks(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=Li.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 js(e,void 0)}transitioned(e,r){return new as(this.property,this.value,r,pt({},e.transition,this.transition),e.now)}untransitioned(){return new as(this.property,this.value,null,{},0)}}class nl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ct(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 js(this._values[e].property,r===null?void 0:Ct(r))}getTransition(e){return Ct(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=Ct(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 sl(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 sl(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 sl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,s){const l=new Zs(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 Ct(this._values[e].value)}setValue(e,r){this._values[e]=new js(this._values[e].property,r===null?void 0:Ct(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 Zs(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,r,s);return l}}class pr{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 Zs{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=Bi[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 pr(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 pr(this,{kind:"constant",value:void 0},e.parameters);const l=Bi[this.specification.type];if(l){const u=l(e.value.value,r.value.value,s);return new pr(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 pr(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 pr(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 pr(this,{kind:"constant",value:u},r)}return new pr(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 kt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new kt(Math.floor(r.zoom),r)),e.expression.evaluate(new kt(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 Ci{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 js(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 al="-transition";class fr 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 nl(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 Zs(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(ic,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(al)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(tc,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(al))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),Mt(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(qr,{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 pr&&Mn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const rc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Pr{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 Ft{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 Kt(i,e=1){let r=0,s=0;return{members:i.map(l=>{const u=rc[l.type].BYTES_PER_ELEMENT,d=r=ol(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:ol(r,Math.max(s,e)),alignment:e}}function ol(i,e){return Math.ceil(i/e)*e}class Dn extends Ft{_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 Gs extends Ft{_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}}Gs.prototype.bytesPerElement=6,De("StructArrayLayout3i6",Gs);class Ha extends Ft{_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 mr extends Ft{_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}}mr.prototype.bytesPerElement=12,De("StructArrayLayout2i4i12",mr);class Xs extends Ft{_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}}Xs.prototype.bytesPerElement=8,De("StructArrayLayout2i4ub8",Xs);class sn extends Ft{_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}}sn.prototype.bytesPerElement=8,De("StructArrayLayout2f8",sn);class Ws extends Ft{_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 P=10*e;return this.uint16[P+0]=r,this.uint16[P+1]=s,this.uint16[P+2]=l,this.uint16[P+3]=u,this.uint16[P+4]=d,this.uint16[P+5]=f,this.uint16[P+6]=g,this.uint16[P+7]=v,this.uint16[P+8]=b,this.uint16[P+9]=E,e}}Ws.prototype.bytesPerElement=20,De("StructArrayLayout10ui20",Ws);class ls extends Ft{_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,P){const C=this.length;return this.resize(C+1),this.emplace(C,e,r,s,l,u,d,f,g,v,b,E,P)}emplace(e,r,s,l,u,d,f,g,v,b,E,P,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]=P,this.int16[z+11]=C,e}}ls.prototype.bytesPerElement=24,De("StructArrayLayout4i4ui4i24",ls);class Ka extends Ft{_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 Ft{_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 an extends Ft{_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,P=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[P+3]=g,this.uint16[E+8]=v,this.uint16[E+9]=b,e}}an.prototype.bytesPerElement=20,De("StructArrayLayout6i1ul2ui20",an);class Ya extends Ft{_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 Hs extends Ft{_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}}Hs.prototype.bytesPerElement=16,De("StructArrayLayout2f1f2i16",Hs);class on extends Ft{_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}}on.prototype.bytesPerElement=12,De("StructArrayLayout2ub2f12",on);class Ks extends Ft{_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}}Ks.prototype.bytesPerElement=6,De("StructArrayLayout3ui6",Ks);class Ja extends Ft{_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,P,C,z,U,F,Y){const Q=this.length;return this.resize(Q+1),this.emplace(Q,e,r,s,l,u,d,f,g,v,b,E,P,C,z,U,F,Y)}emplace(e,r,s,l,u,d,f,g,v,b,E,P,C,z,U,F,Y,Q){const W=24*e,ie=12*e,se=48*e;return this.int16[W+0]=r,this.int16[W+1]=s,this.uint16[W+2]=l,this.uint16[W+3]=u,this.uint32[ie+2]=d,this.uint32[ie+3]=f,this.uint32[ie+4]=g,this.uint16[W+10]=v,this.uint16[W+11]=b,this.uint16[W+12]=E,this.float32[ie+7]=P,this.float32[ie+8]=C,this.uint8[se+36]=z,this.uint8[se+37]=U,this.uint8[se+38]=F,this.uint32[ie+10]=Y,this.int16[W+22]=Q,e}}Ja.prototype.bytesPerElement=48,De("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ja);class Ys extends Ft{_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,P,C,z,U,F,Y,Q,W,ie,se,ce,ze,Be,Pe,Se,Te,Me){const Ie=this.length;return this.resize(Ie+1),this.emplace(Ie,e,r,s,l,u,d,f,g,v,b,E,P,C,z,U,F,Y,Q,W,ie,se,ce,ze,Be,Pe,Se,Te,Me)}emplace(e,r,s,l,u,d,f,g,v,b,E,P,C,z,U,F,Y,Q,W,ie,se,ce,ze,Be,Pe,Se,Te,Me,Ie){const ye=34*e,Ve=17*e;return this.int16[ye+0]=r,this.int16[ye+1]=s,this.int16[ye+2]=l,this.int16[ye+3]=u,this.int16[ye+4]=d,this.int16[ye+5]=f,this.int16[ye+6]=g,this.int16[ye+7]=v,this.uint16[ye+8]=b,this.uint16[ye+9]=E,this.uint16[ye+10]=P,this.uint16[ye+11]=C,this.uint16[ye+12]=z,this.uint16[ye+13]=U,this.uint16[ye+14]=F,this.uint16[ye+15]=Y,this.uint16[ye+16]=Q,this.uint16[ye+17]=W,this.uint16[ye+18]=ie,this.uint16[ye+19]=se,this.uint16[ye+20]=ce,this.uint16[ye+21]=ze,this.uint16[ye+22]=Be,this.uint32[Ve+12]=Pe,this.float32[Ve+13]=Se,this.float32[Ve+14]=Te,this.float32[Ve+15]=Me,this.float32[Ve+16]=Ie,e}}Ys.prototype.bytesPerElement=68,De("StructArrayLayout8i15ui1ul4f68",Ys);class Js extends Ft{_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}}Js.prototype.bytesPerElement=4,De("StructArrayLayout1f4",Js);class Qs extends Ft{_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}}Qs.prototype.bytesPerElement=8,De("StructArrayLayout1ul2ui8",Qs);class o extends Ft{_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 Ft{_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 Ft{_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 Pr{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 xe(this.anchorPointX,this.anchorPointY)}}a.prototype.size=20;class c extends an{get(e){return new a(this,e)}}De("CollisionBoxArray",c);class p extends Pr{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 Pr{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 Ys{get(e){return new y(this,e)}}De("SymbolInstanceArray",_);class x extends Js{getoffsetX(e){return this.float32[1*e+0]}}De("GlyphOffsetArray",x);class T extends Gs{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 Pr{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 Qs{get(e){return new w(this,e)}}De("FeatureIndexArray",k);class O extends Dn{}class B extends Dn{}class R extends Dn{}class $ extends mr{}class K extends Xs{}class re extends sn{}class N extends Ws{}class te extends ls{}class oe extends Ka{}class me extends Ln{}class _e extends Ya{}class ve extends on{}class ge extends Ks{}class Ce extends o{}const Ue=Kt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ke}=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&&Vt(`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=et(Math.floor(i),0,255))+et(Math.floor(e),0,255)}Ee.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,De("SegmentVector",Ee);const ke=Kt([{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 ut={exports:{}},qt={exports:{}};qt.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 dt=qt.exports,Je={exports:{}};Je.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 Ot=dt,wi=Je.exports;ut.exports=Ot,ut.exports.murmur3=Ot,ut.exports.murmur2=wi;var jt=ue(ut.exports);class si{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Fi(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=Fi(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 ir(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new si;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Fi(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:jt(String(i))}function ir(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;rr(i,u,d),rr(e,3*u,3*d),rr(e,3*u+1,3*d+1),rr(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 mi(e,r):new gr(e,r)}}class oi{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 gr(e,r)}}class gt{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 kt(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=ft(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 kt(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new kt(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=ft(s),d=ft(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 gt||s instanceof ti)for(let l=0;l!0){this.programConfigurations={};for(const l of e)this.programConfigurations[l.id]=new ea(l,r,s);this.needsUpload=!1,this._featureMap=new si,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 nc(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 ll(i,e,r){const s={color:{source:sn,composite:n},number:{source:Js,composite:sn}},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",ei),De("CrossFadedConstantBinder",oi),De("SourceExpressionBinder",gt),De("CrossFadedCompositeBinder",Oi),De("CompositeExpressionBinder",ti),De("ProgramConfiguration",ea,{omit:["_buffers"]}),De("ProgramConfigurationSet",Mr);var At=8192;const Qa=Math.pow(2,14)-1,hs=-Qa-1;function Cr(i){const e=At/i.extent,r=i.loadGeometry();for(let s=0;sd.x+1||gd.y+1)&&Vt("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?Cr(i):[]}}function cl(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class sc{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 ge,this.segments=new Ee,this.programConfigurations=new Mr(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 P=this.layers[0]._featureFilter.needGeometry,C=us(g,P);if(!this.layers[0]._featureFilter.filter(new kt(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:P?C.geometry:Cr(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,P=e[b].feature;this.addFeature(g,v,b,s),r.featureIndex.insert(P,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,Ke),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>=At||g<0||g>=At)continue;const v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),b=v.vertexLength;cl(this.layoutVertexArray,f,g,-1,-1),cl(this.layoutVertexArray,f,g,1,-1),cl(this.layoutVertexArray,f,g,1,1),cl(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 ph(i,e){for(let r=0;r1){if(ac(i,e))return!0;for(let s=0;s1?r:r.sub(e)._mult(l)._add(e))}function gh(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 ta(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 Sd(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=yt(i,e,r[0]);return u!==yt(i,e,r[1])||u!==yt(i,e,r[2])||u!==yt(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 hl(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function ul(i,e,r,s,l){if(!e[0]&&!e[1])return i;const u=xe.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(P,C,r,s,l,v,0),C}function Ih(i,e,r,s,l){var u,d;if(l===fc(i,e,r,s)>0)for(u=e;u=e;u-=s)d=Mh(u,i[u],i[u+1],d);return d&&fl(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||!fl(s,s.next)&&Zt(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,P,C){var z=b;do z.z===0&&(z.z=dc(z.x,z.y,E,P,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,Y,Q,W,ie,se,ce,ze,Be=1;do{for(Y=U,U=null,ie=null,se=0;Y;){for(se++,Q=Y,ce=0,F=0;F0||ze>0&&Q;)ce!==0&&(ze===0||!Q||Y.z<=Q.z)?(W=Y,Y=Y.nextZ,ce--):(W=Q,Q=Q.nextZ,ze--),ie?ie.nextZ=W:U=W,W.prevZ=ie,ie=W;Y=Q}ie.nextZ=null,Be*=2}while(se>1)}(z)}(i,s,l,u);for(var f,g,v=i;i.prev!==i.next;)if(f=i.prev,g=i.next,u?Dd(i,s,l,u):zd(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=Ld(ds(i),e,r),e,r,s,l,u,2):d===2&&Bd(i,e,r,s,l,u):ro(ds(i),e,r,s,l,u,1);break}}}function zd(i){var e=i.prev,r=i,s=i.next;if(Zt(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<=P&&z.y>=E&&z.y<=C&&ra(l,f,u,g,d,v,z.x,z.y)&&Zt(z.prev,z,z.next)>=0)return!1;z=z.next}return!0}function Dd(i,e,r,s){var l=i.prev,u=i,d=i.next;if(Zt(l,u,d)>=0)return!1;for(var f=l.x,g=u.x,v=d.x,b=l.y,E=u.y,P=d.y,C=fg?f>v?f:v:g>v?g:v,F=b>E?b>P?b:P:E>P?E:P,Y=dc(C,z,e,r,s),Q=dc(U,F,e,r,s),W=i.prevZ,ie=i.nextZ;W&&W.z>=Y&&ie&&ie.z<=Q;){if(W.x>=C&&W.x<=U&&W.y>=z&&W.y<=F&&W!==l&&W!==d&&ra(f,b,g,E,v,P,W.x,W.y)&&Zt(W.prev,W,W.next)>=0||(W=W.prevZ,ie.x>=C&&ie.x<=U&&ie.y>=z&&ie.y<=F&&ie!==l&&ie!==d&&ra(f,b,g,E,v,P,ie.x,ie.y)&&Zt(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;W&&W.z>=Y;){if(W.x>=C&&W.x<=U&&W.y>=z&&W.y<=F&&W!==l&&W!==d&&ra(f,b,g,E,v,P,W.x,W.y)&&Zt(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;ie&&ie.z<=Q;){if(ie.x>=C&&ie.x<=U&&ie.y>=z&&ie.y<=F&&ie!==l&&ie!==d&&ra(f,b,g,E,v,P,ie.x,ie.y)&&Zt(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function Ld(i,e,r){var s=i;do{var l=s.prev,u=s.next.next;!fl(l,u)&&Ah(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 Bd(i,e,r,s,l,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&Vd(d,f)){var g=Ph(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 Rd(i,e){return i.x-e.x}function Fd(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&&ra(vd.x||f.x===d.x&&Od(d,f)))&&(d=f,F=P)),f=f.next;while(f!==C);return d}(i,e);if(!r)return e;var s=Ph(r,i);return ds(s,s.next),ds(r,r.next)}function Od(i,e){return Zt(i.prev,i,e.prev)<0&&Zt(e.next,i,i.next)<0}function dc(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 Ud(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 Vd(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&&Ah(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)&&(Zt(i.prev,i,e.prev)||Zt(i,e.prev,e))||fl(i,e)&&Zt(i.prev,i,i.next)>0&&Zt(e.prev,e,e.next)>0)}function Zt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function fl(i,e){return i.x===e.x&&i.y===e.y}function Ah(i,e,r,s){var l=gl(Zt(i,e,r)),u=gl(Zt(i,e,s)),d=gl(Zt(r,s,i)),f=gl(Zt(r,s,e));return l!==u&&d!==f||!(l!==0||!ml(i,r,e))||!(u!==0||!ml(i,s,e))||!(d!==0||!ml(r,i,s))||!(f!==0||!ml(r,e,s))}function ml(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 gl(i){return i>0?1:i<0?-1:0}function no(i,e){return Zt(i.prev,i,i.next)<0?Zt(i,e,i.next)>=0&&Zt(i,i.prev,e)>=0:Zt(i,e,i.prev)<0||Zt(i,i.next,e)<0}function Ph(i,e){var r=new pc(i.i,i.x,i.y),s=new pc(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 Mh(i,e,r,s){var l=new pc(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 pc(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 fc(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 Ch=ue(uc.exports);function Nd(i,e,r,s,l){kh(i,e,r||0,s||i.length-1,l||$d)}function kh(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);kh(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,P=s;for(ao(i,r,e),l(i[s],b)>0&&ao(i,r,s);E0;)P--}l(i[r],b)===0?ao(i,r,P):ao(i,++P,s),P<=e&&(r=P+1),e<=P&&(s=P-1)}}function ao(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function $d(i,e){return ie?1:0}function mc(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 ge,this.indexArray2=new Ce,this.programConfigurations=new Mr(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=gc("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,P=us(f,E);if(!this.layers[0]._featureFilter.filter(new kt(this.zoom),P,s))continue;const C=u?l.evaluate(P,{},s,r.availableImages):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:b,index:v,geometry:E?P.geometry:Cr(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=_c("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,kd),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 mc(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 Wd(u,d));else{if(s!==7)throw new Error("unknown command "+s);e&&e.push(e[0].clone())}}return e&&f.push(e),f},na.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]},na.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=na.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))}Rh.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 Yd(this._pbf,e,this.extent,this._keys,this._values)};var Qd=Bh;function ep(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(ep,{},e)},Bn.VectorTileFeature=Lh,Bn.VectorTileLayer=Bh;const tp=Bn.VectorTileFeature.types,xc=Math.pow(2,13);function oo(i,e,r,s,l,u,d,f){i.emplaceBack(e,r,2*Math.floor(s*xc)+d,l*xc*2,u*xc*2,Math.round(f))}class vc{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 ge,this.programConfigurations=new Mr(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=gc("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 kt(this.zoom),v,s))continue;const b={id:u,sourceLayerIndex:f,index:d,geometry:g?v.geometry:Cr(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(_c("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,Xd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Gd.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 mc(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||rp(z))continue;let U=0;for(let F=0;F=1){const Q=z[F-1];if(!ip(Y,Q)){v.vertexLength+4>Ee.MAX_VERTEX_ARRAY_LENGTH&&(v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const W=Y.sub(Q)._perp()._unit(),ie=Q.dist(Y);U+ie>32768&&(U=0),oo(this.layoutVertexArray,Y.x,Y.y,W.x,W.y,0,0,U),oo(this.layoutVertexArray,Y.x,Y.y,W.x,W.y,0,1,U),d.x+=2*Y.x,d.y+=2*Y.y,d.vertexCount+=2,U+=ie,oo(this.layoutVertexArray,Q.x,Q.y,W.x,W.y,0,0,U),oo(this.layoutVertexArray,Q.x,Q.y,W.x,W.y,0,1,U),d.x+=2*Q.x,d.y+=2*Q.y,d.vertexCount+=2;const se=v.vertexLength;this.indexArray.emplaceBack(se,se+2,se+1),this.indexArray.emplaceBack(se+1,se+2,se+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)),tp[e.type]!=="Polygon")continue;const b=[],E=[],P=v.vertexLength;for(const z of f)if(z.length!==0){z!==f[0]&&E.push(b.length/2);for(let U=0;UAt)||i.y===e.y&&(i.y<0||i.y>At)}function rp(i){return i.every(e=>e.x<0)||i.every(e=>e.x>At)||i.every(e=>e.y<0)||i.every(e=>e.y>At)}let Fh;De("FillExtrusionBucket",vc,{omit:["layers","features"]});var np={get paint(){return Fh=Fh||new Ci({"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 Oh(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 K,this.layoutVertexArray2=new re,this.indexArray=new ge,this.programConfigurations=new Mr(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=gc("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,P=us(f,E);if(!this.layers[0]._featureFilter.filter(new kt(this.zoom),P,s))continue;const C=u?l.evaluate(P,{},s):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:b,index:v,geometry:E?P.geometry:Cr(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=_c("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,lp)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ap),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 Y=0;Y=2&&e[g-1].equals(e[g-2]);)g--;let v=0;for(;v0;if(ze&&Y>v){const Te=P.dist(C);if(Te>2*b){const Me=P.sub(P.sub(C)._mult(b/Te)._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"&&(seu&&(Se="bevel"),Se==="bevel"&&(se>2&&(Se="flipbevel"),se100)Q=F.mult(-1);else{const Te=se*U.add(F).mag()/U.sub(F).mag();Q._perp()._mult(Te*(Be?-1:1))}this.addCurrentVertex(P,Q,0,0,E),this.addCurrentVertex(P,Q.mult(-1),0,0,E)}else if(Se==="bevel"||Se==="fakeround"){const Te=-Math.sqrt(se*se-1),Me=Be?Te:0,Ie=Be?0:Te;if(C&&this.addCurrentVertex(P,U,Me,Ie,E),Se==="fakeround"){const ye=Math.round(180*ce/Math.PI/20);for(let Ve=1;Ve2*b){const Me=P.add(z.sub(P)._mult(b/Te)._round());this.updateDistance(P,Me),this.addCurrentVertex(Me,F,0,0,E),P=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>Uh/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*(Uh-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 Vh,Nh;De("LineBucket",bc,{omit:["layers","patternFeatures"]});var $h={get paint(){return Nh=Nh||new Ci({"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 Vh=Vh||new Ci({"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 up extends $e{possiblyEvaluate(e,r){return r=new kt(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=pt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let _l;function qh(i,e){return e>0?e+2*i:i}const dp=Kt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),pp=Kt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Kt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const fp=Kt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Kt([{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 jh=Kt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),mp=Kt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function gp(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()),Ji.applyArabicShaping&&(l=Ji.applyArabicShaping(l)),l}(s.text,e,r)}),i}Kt([{name:"triangle",components:3,type:"Uint16"}]),Kt([{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"}]),Kt([{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"}]),Kt([{type:"Float32",name:"offsetX"}]),Kt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const co={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var li=24,Zh=vt,Gh=function(i,e,r,s,l){var u,d,f=8*l-s-1,g=(1<>1,b=-7,E=r?l-1:0,P=r?-1:1,C=i[e+E];for(E+=P,u=C&(1<<-b)-1,C>>=-b,b+=f;b>0;u=256*u+i[e+E],E+=P,b-=8);for(d=u&(1<<-b)-1,u>>=-b,b+=s;b>0;d=256*d+i[e+E],E+=P,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)},Xh=function(i,e,r,s,l,u){var d,f,g,v=8*u-l-1,b=(1<>1,P=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?P/g:P*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 vt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}vt.Varint=0,vt.Fixed64=1,vt.Bytes=2,vt.Fixed32=5;var wc=4294967296,Wh=1/wc,Hh=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function ln(i){return i.type===vt.Bytes?i.readVarint()+i.pos:i.pos+1}function sa(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Kh(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 _p(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function Yh(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}vt.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=yl(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Yh(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=yl(this.buf,this.pos)+yl(this.buf,this.pos+4)*wc;return this.pos+=8,i},readSFixed64:function(){var i=yl(this.buf,this.pos)+Yh(this.buf,this.pos+4)*wc;return this.pos+=8,i},readFloat:function(){var i=Gh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Gh(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 sa(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&&Hh?function(r,s,l){return Hh.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+P>l)break;P===1?b<128&&(E=b):P===2?(192&(f=r[d+1]))==128&&(E=(31&b)<<6|63&f)<=127&&(E=null):P===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)):P===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,P=1):E>65535&&(E-=65536,u+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),u+=String.fromCharCode(E),d+=P}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!==vt.Bytes)return i.push(this.readVarint(e));var r=ln(this);for(i=i||[];this.pos127;);else if(e===vt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===vt.Fixed32)this.pos+=4;else{if(e!==vt.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&&Kh(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Xh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Xh(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&&Kh(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,vt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,_p,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,yp,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,bp,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,xp,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,vp,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,wp,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Tp,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Ep,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Sp,e)},writeBytesField:function(i,e){this.writeTag(i,vt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,vt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,vt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,vt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,vt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,vt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,vt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,vt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,vt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,vt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var Tc=ue(Zh);const Ec=3;function Ip(i,e,r){i===1&&r.readMessage(Ap,e)}function Ap(i,e,r){if(i===3){const{id:s,bitmap:l,width:u,height:d,left:f,top:g,advance:v}=r.readMessage(Pp,{});e.push({id:s,bitmap:new io({width:u+2*Ec,height:d+2*Ec},l),metrics:{width:u,height:d,left:f,top:g,advance:v}})}}function Pp(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 Jh=Ec;function Qh(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&&vl[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 oa;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 xl(i,e,r,s,l,u,d,f,g,v,b,E,P,C,z,U){const F=oa.fromFeature(i,l);let Y;E===h.WritingMode.vertical&&F.verticalizePunctuation();const{processBidirectionalText:Q,processStyledBidirectionalText:W}=Ji;if(Q&&F.sections.length===1){Y=[];const ce=Q(F.toString(),Ic(F,v,u,e,s,C,z));for(const ze of ce){const Be=new oa;Be.text=ze,Be.sections=F.sections;for(let Pe=0;Pe0&&hn>$i&&($i=hn)}else{const or=Be[rt.fontStack],qi=or&&or[vi];if(qi&&qi.rect)kr=qi.rect,_r=qi.metrics;else{const hn=ze[rt.fontStack],_o=hn&&hn[vi];if(!_o)continue;_r=_o.metrics}Ii=(yi-rt.scale)*li}yr?(ce.verticalizable=!0,Ni.push({glyph:vi,imageName:zr,x:Pt,y:zt+Ii,vertical:yr,scale:rt.scale,fontStack:rt.fontStack,sectionIndex:Qi,metrics:_r,rect:kr}),Pt+=cn*rt.scale+Ve):(Ni.push({glyph:vi,imageName:zr,x:Pt,y:zt+Ii,vertical:yr,scale:rt.scale,fontStack:rt.fontStack,sectionIndex:Qi,metrics:_r,rect:kr}),Pt+=_r.advance*rt.scale+Ve)}Ni.length!==0&&(ii=Math.max(Pt-Ve,ii),kp(Ni,0,Ni.length-1,gi,$i)),Pt=0;const Ut=Te*yi+$i;zi.lineOffset=Math.max($i,Si),zt+=Ut,ar=Math.max(Ut,ar),++Yt}var ci;const _i=zt-ho,{horizontalAlign:Ei,verticalAlign:Vi}=Ac(Me);(function(Jt,yi,Si,zi,Ni,$i,Ut,xi,rt){const Qi=(yi-Si)*Ni;let vi=0;vi=$i!==Ut?-xi*zi-ho:(-zi*rt+.5)*Ut;for(const Ii of Jt)for(const _r of Ii.positionedGlyphs)_r.x+=Qi,_r.y+=vi})(ce.positionedLines,gi,Ei,Vi,ii,ar,Te,_i,Se.length),ce.top+=-Vi*_i,ce.bottom=ce.top+_i,ce.left+=-Ei*ii,ce.right=ce.left+ii}(se,e,r,s,Y,d,f,g,E,v,P,U),!function(ce){for(const ze of ce)if(ze.positionedGlyphs.length!==0)return!1;return!0}(ie)&&se}const vl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Mp={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 tu(i,e,r,s,l,u){if(e.imageName){const d=s[e.imageName];return d?d.displaySize[0]*e.scale*li/u+l:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+l:0}}function iu(i,e,r,s){const l=Math.pow(i-e,2);return s?i=0;let b=0;for(let P=0;Pd.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=lc([]),this.placementViewportMatrix=lc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=au(this.zoom,r["text-size"]),this.iconSizeData=au(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=Pc(s,"text-overlap","text-allow-overlap")!=="never"||Pc(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 Cc(new Mr(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Cc(new Mr(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 P=r.iconDependencies,C=r.glyphDependencies,z=r.availableImages,U=new kt(this.zoom);for(const{feature:F,id:Y,index:Q,sourceLayerIndex:W}of e){const ie=l._featureFilter.needGeometry,se=us(F,ie);if(!l._featureFilter.filter(U,se,s))continue;let ce,ze;if(ie||(se.geometry=Cr(F)),v){const Pe=l.getValueAndResolveTokens("text-field",se,s,z),Se=di.factory(Pe);Bp(Se)&&(this.hasRTLText=!0),(!this.hasRTLText||ja()==="unavailable"||this.hasRTLText&&Ji.isParsed())&&(ce=gp(Se,l,se))}if(b){const Pe=l.getValueAndResolveTokens("icon-image",se,s,z);ze=Pe instanceof Wi?Pe:Wi.fromString(Pe)}if(!ce&&!ze)continue;const Be=this.sortFeaturesByKey?E.evaluate(se,{},s):void 0;if(this.features.push({id:Y,text:ce,icon:ze,index:Q,sourceLayerIndex:W,geometry:se.geometry,properties:F.properties,type:Dp[F.type],sortKey:Be}),ze&&(P[ze.name]=!0),ce){const Pe=d.evaluate(se,{},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 Te of ce.sections)if(Te.image)P[Te.image.name]=!0;else{const Me=Os(ce.toString()),Ie=Te.fontStack||Pe,ye=C[Ie]=C[Ie]||{};this.calculateGlyphDependencies(Te.text,ye,Se,this.allowVerticalPlacement,Me)}}}u.get("symbol-placement")==="line"&&(this.features=function(F){const Y={},Q={},W=[];let ie=0;function se(Pe){W.push(F[Pe]),ie++}function ce(Pe,Se,Te){const Me=Q[Pe];return delete Q[Pe],Q[Se]=Me,W[Me].geometry[0].pop(),W[Me].geometry[0]=W[Me].geometry[0].concat(Te[0]),Me}function ze(Pe,Se,Te){const Me=Y[Se];return delete Y[Se],Y[Pe]=Me,W[Me].geometry[0].shift(),W[Me].geometry[0]=Te[0].concat(W[Me].geometry[0]),Me}function Be(Pe,Se,Te){const Me=Te?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,Y)=>F.sortKey-Y.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 ou,lu;De("SymbolBucket",la,{omit:["layers","collisionBoxArray","features","compareText"]}),la.MAX_GLYPHS=65535,la.addDynamicAttributes=Mc;var zc={get paint(){return lu=lu||new Ci({"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:Pi,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 ou=ou||new Ci({"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 cu{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:Or,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",cu,{omit:["defaultValue"]});class wl extends fr{constructor(e){super(e,zc)}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()||Cs(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 la(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of zc.paint.overridableProperties){if(!wl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new cu(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 st("composite",l,r.value.zoomStops),this.paint._values[e]=new pr(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&wl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=zc.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 di)d(s.value.value.sections);else if(s.value.kind==="source"){const f=v=>{u||(v instanceof Vr&&Wt(v.value)===Er?d(v.value.sections):v instanceof Ps?d(v.sections):v.eachChild(f))},g=s.value;g._styleExpression&&f(g._styleExpression.expression)}return u}}let hu;var Rp={get paint(){return hu=hu||new Ci({"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 uu;var Fp={get paint(){return uu=uu||new Ci({"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 Op extends fr{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 Up={circle:class extends fr{constructor(i){super(i,Id)}createBucket(i){return new sc(i)}queryRadius(i){const e=i;return eo("circle-radius",this,e)+eo("circle-stroke-width",this,e)+hl(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=ul(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=>vh(U,z))}(g,f),P=b?v*d:v;for(const C of s)for(const z of C){const U=b?z:vh(z,f);let F=P;const Y=dl([],[z.x,z.y,0,1],f);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?F*=Y[3]/u.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(F*=u.cameraToCenterDistance/Y[3]),wd(E,U,F))return!0}return!1}},heatmap:class extends fr{createBucket(i){return new bh(i)}constructor(i){super(i,Pd),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Eh({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 fr{constructor(i){super(i,Md)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends fr{constructor(i){super(i,jd)}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 yc(i)}queryRadius(){return hl(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d){return fh(ul(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,d),s)}isTileClipped(){return!0}},"fill-extrusion":class extends fr{constructor(i){super(i,np)}createBucket(i){return new vc(i)}queryRadius(){return hl(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=ul(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 Y=[];for(const Q of C){const W=[Q.x,Q.y,0,1];dl(W,W,z),Y.push(new xe(W[0]/W[3],W[1]/W[3]))}return Y}(g,f),P=function(C,z,U,F){const Y=[],Q=[],W=F[8]*z,ie=F[9]*z,se=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 Te of C){const Me=[],Ie=[];for(const ye of Te){const Ve=ye.x,Re=ye.y,it=F[0]*Ve+F[4]*Re+F[12],Pt=F[1]*Ve+F[5]*Re+F[13],zt=F[2]*Ve+F[6]*Re+F[14],ii=F[3]*Ve+F[7]*Re+F[15],ar=zt+se,gi=ii+ce,Yt=it+ze,ci=Pt+Be,_i=zt+Pe,Ei=ii+Se,Vi=new xe((it+W)/gi,(Pt+ie)/gi);Vi.z=ar/gi,Me.push(Vi);const Jt=new xe(Yt/Ei,ci/Ei);Jt.z=_i/Ei,Ie.push(Jt)}Y.push(Me),Q.push(Ie)}return[Y,Q]}(s,b,v,f);return function(C,z,U){let F=1/0;fh(U,z)&&(F=Oh(U,z[0]));for(let Y=0;Y=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 Dc=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(Bt(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 Dc*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 du=2*Math.PI*Dc;function pu(i){return du*Math.cos(i*Math.PI/180)}function fu(i){return(180+i)/360}function mu(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function gu(i,e){return i/pu(e)}function Lc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class Tl{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 Tl(fu(s.lng),mu(s.lat),gu(r,s.lat))}toLngLat(){return new On(360*this.x-180,Lc(this.y))}toAltitude(){return this.z*pu(Lc(this.y))}meterInMercatorCoordinateUnits(){return 1/du*(e=Lc(this.y),1/Math.cos(e*Math.PI/180));var e}}function _u(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 Bc{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=_u(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),v=_u(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,P,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 xe((e.x*r-this.x)*At,(e.y*r-this.y)*At)}toString(){return`${this.z}/${this.x}/${this.y}`}}class yu{constructor(e,r){this.wrap=e,this.canonical=r,this.key=fo(e,r.z,r.z,r.x,r.y)}}class sr{constructor(e,r,s,l,u){if(e= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Bc(s,+l,+u),this.key=fo(r,e,s,l,u)}clone(){return new sr(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 sr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sr(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 sr(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 sr(r,this.wrap,r,s,l),new sr(r,this.wrap,r,s+1,l),new sr(r,this.wrap,r,s,l+1),new sr(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 nr({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 bu{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 wu{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(At,16,0),this.grid3D=new rs(At,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 Tc(this.rawTileData)).layers,this.sourceLayerCoder=new vu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const u=e.params||{},d=At/e.tileSize/e.scale,f=La(u.filter),g=e.queryGeometry,v=e.queryPadding*d,b=Eu(g),E=this.grid.query(b.minX-v,b.minY-v,b.maxX+v,b.maxY+v),P=Eu(e.cameraQueryGeometry),C=this.grid3D.query(P.minX-v,P.minY-v,P.maxX+v,P.maxY+v,(F,Y,Q,W)=>function(ie,se,ce,ze,Be){for(const Se of ie)if(se<=Se.x&&ce<=Se.y&&ze>=Se.x&&Be>=Se.y)return!0;const Pe=[new xe(se,ce),new xe(se,Be),new xe(ze,Be),new xe(ze,ce)];if(ie.length>2){for(const Se of Pe)if(ta(ie,Se))return!0}for(let Se=0;Se(W||(W=Cr(ie)),se.queryIntersectsFeature(g,ie,ce,W,this.z,e.transform,d,e.pixelPosMatrix)))}return z}loadMatchingFeature(e,r,s,l,u,d,f,g,v,b,E){const P=this.bucketLayerIDs[r];if(d&&!function(F,Y){for(let Q=0;Q=0)return!0;return!1}(d,P))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 kt(this.tileID.overscaledZ),F,this.tileID.canonical))return}else if(!u.filter(new kt(this.tileID.overscaledZ),z))return;const U=this.getId(z,C);for(let F=0;F{const f=e instanceof Zs?e.get(d):null;return f&&f.evaluate?f.evaluate(r,s,l):f})}function Eu(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 Np(i,e){return e-i}function Su(i,e,r,s,l){const u=[];for(let d=0;d=s&&E.x>=s||(b.x>=s?b=new xe(s,b.y+(s-b.x)/(E.x-b.x)*(E.y-b.y))._round():E.x>=s&&(E=new xe(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 xe(b.x+(l-b.y)/(E.y-b.y)*(E.x-b.x),l)._round():E.y>=l&&(E=new xe(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",wu,{omit:["rawTileData","sourceLayerCoder"]});class Un extends xe{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 Iu(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 Au(i){let e=0;for(let r=0;rv){const z=(v-g)/C,U=Bi.number(E.x,P.x,z),F=Bi.number(E.y,P.y,z),Y=new Un(U,F,P.angleTo(E),b);return Y._round(),!d||Iu(i,Y,f,d,e)?Y:void 0}g+=C}}function qp(i,e,r,s,l,u,d,f,g){const v=Pu(s,u,d),b=Mu(s,l),E=b*d,P=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-E=0&&ie=0&&se=0&&P+v<=b){const ce=new Un(ie,se,Q,z);ce._round(),s&&!Iu(i,ce,u,s,l)||C.push(ce)}}E+=Y}return f||C.length||d||(C=Cu(i,E/2,r,s,l,u,d,!0,g)),C}De("Anchor",Un);const ca=Ui;function ku(i,e,r,s){const l=[],u=i.image,d=u.pixelRatio,f=u.paddedRect.w-2*ca,g=u.paddedRect.h-2*ca,v=i.right-i.left,b=i.bottom-i.top,E=u.stretchX||[[0,f]],P=u.stretchY||[[0,g]],C=(Te,Me)=>Te+Me[1]-Me[0],z=E.reduce(C,0),U=P.reduce(C,0),F=f-z,Y=g-U;let Q=0,W=z,ie=0,se=U,ce=0,ze=F,Be=0,Pe=Y;if(u.content&&s){const Te=u.content;Q=El(E,0,Te[0]),ie=El(P,0,Te[1]),W=El(E,Te[0],Te[2]),se=El(P,Te[1],Te[3]),ce=Te[0]-Q,Be=Te[1]-ie,ze=Te[2]-Te[0]-W,Pe=Te[3]-Te[1]-se}const Se=(Te,Me,Ie,ye)=>{const Ve=Sl(Te.stretch-Q,W,v,i.left),Re=Il(Te.fixed-ce,ze,Te.stretch,z),it=Sl(Me.stretch-ie,se,b,i.top),Pt=Il(Me.fixed-Be,Pe,Me.stretch,U),zt=Sl(Ie.stretch-Q,W,v,i.left),ii=Il(Ie.fixed-ce,ze,Ie.stretch,z),ar=Sl(ye.stretch-ie,se,b,i.top),gi=Il(ye.fixed-Be,Pe,ye.stretch,U),Yt=new xe(Ve,it),ci=new xe(zt,it),_i=new xe(zt,ar),Ei=new xe(Ve,ar),Vi=new xe(Re/d,Pt/d),Jt=new xe(ii/d,gi/d),yi=e*Math.PI/180;if(yi){const Ni=Math.sin(yi),$i=Math.cos(yi),Ut=[$i,-Ni,Ni,$i];Yt._matMult(Ut),ci._matMult(Ut),Ei._matMult(Ut),_i._matMult(Ut)}const Si=Te.stretch+Te.fixed,zi=Me.stretch+Me.fixed;return{tl:Yt,tr:ci,bl:Ei,br:_i,tex:{x:u.paddedRect.x+ca+Si,y:u.paddedRect.y+ca+zi,w:Ie.stretch+Ie.fixed-Si,h:ye.stretch+ye.fixed-zi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Vi,pixelOffsetBR:Jt,minFontScaleX:ze/d/v,minFontScaleY:Pe/d/b,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){const Te=zu(E,F,z),Me=zu(P,Y,U);for(let Ie=0;Ie0&&(z=Math.max(10,z),this.circleDiameter=z)}else{let E=d.top*f-g[0],P=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,P+=U[3]*f),b){const F=new xe(C,E),Y=new xe(z,E),Q=new xe(C,P),W=new xe(z,P),ie=b*Math.PI/180;F._rotate(ie),Y._rotate(ie),Q._rotate(ie),W._rotate(ie),C=Math.min(F.x,Y.x,Q.x,W.x),z=Math.max(F.x,Y.x,Q.x,W.x),E=Math.min(F.y,Y.y,Q.y,W.y),P=Math.max(F.y,Y.y,Q.y,W.y)}e.emplaceBack(r.x,r.y,C,E,z,P,s,l,u)}this.boxEndIndex=e.length}}class jp{constructor(e=[],r=Zp){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 Zp(i,e){return ie?1:0}function Gp(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 jp([],Xp);if(g===0)return new xe(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,P)),C.max-E.d<=e||(v=C.h/2,b.push(new ha(C.p.x-v,C.p.y-v,v,i)),b.push(new ha(C.p.x+v,C.p.y-v,v,i)),b.push(new ha(C.p.x-v,C.p.y+v,v,i)),b.push(new ha(C.p.x+v,C.p.y+v,v,i)),P+=4)}return r&&(console.log(`num probes: ${P}`),console.log(`best distance: ${E.d}`)),E.p}function Xp(i,e){return e.max-i.max}function ha(i,e,r,s){this.p=new xe(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,mh(l,C,z))}}return(d?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}const Rc=Number.POSITIVE_INFINITY;function Du(i,e){return e[1]!==Rc?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 Fc(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 Wp(i,e,r,s,l,u,d,f,g,v,b){let E=u.textMaxSize.evaluate(e,{});E===void 0&&(E=d);const P=i.layers[0].layout,C=P.get("icon-offset").evaluate(e,{},b),z=Bu(r.horizontal),U=d/24,F=i.tilePixelRatio*U,Y=i.tilePixelRatio*E/24,Q=i.tilePixelRatio*f,W=i.tilePixelRatio*P.get("symbol-spacing"),ie=P.get("text-padding")*i.tilePixelRatio,se=function(ye,Ve,Re,it=1){const Pt=ye.get("icon-padding").evaluate(Ve,{},Re),zt=Pt&&Pt.values;return[zt[0]*it,zt[1]*it,zt[2]*it,zt[3]*it]}(P,e,b,i.tilePixelRatio),ce=P.get("text-max-angle")/180*Math.PI,ze=P.get("text-rotation-alignment")!=="viewport"&&P.get("symbol-placement")!=="point",Be=P.get("icon-rotation-alignment")==="map"&&P.get("symbol-placement")!=="point",Pe=P.get("symbol-placement"),Se=W/2,Te=P.get("icon-text-fit");let Me;s&&Te!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Me=su(s,r.vertical,Te,P.get("icon-text-fit-padding"),C,U)),z&&(s=su(s,z,Te,P.get("icon-text-fit-padding"),C,U)));const Ie=(ye,Ve)=>{Ve.x<0||Ve.x>=At||Ve.y<0||Ve.y>=At||function(Re,it,Pt,zt,ii,ar,gi,Yt,ci,_i,Ei,Vi,Jt,yi,Si,zi,Ni,$i,Ut,xi,rt,Qi,vi,Ii,_r){const kr=Re.addToLineVertexArray(it,Pt);let zr,cn,yr,or,qi=0,hn=0,_o=0,Uu=0,Zc=-1,Gc=-1;const un={};let Vu=jt(""),Xc=0,Wc=0;if(Yt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Xc,Wc]=Yt.layout.get("text-offset").evaluate(rt,{},Ii).map(ji=>ji*li):(Xc=Yt.layout.get("text-radial-offset").evaluate(rt,{},Ii)*li,Wc=Rc),Re.allowVerticalPlacement&&zt.vertical){const ji=Yt.layout.get("text-rotate").evaluate(rt,{},Ii)+90;yr=new Al(ci,it,_i,Ei,Vi,zt.vertical,Jt,yi,Si,ji),gi&&(or=new Al(ci,it,_i,Ei,Vi,gi,Ni,$i,Si,ji))}if(ii){const ji=Yt.layout.get("icon-rotate").evaluate(rt,{}),Gr=Yt.layout.get("icon-text-fit")!=="none",yo=ku(ii,ji,vi,Gr),xo=gi?ku(gi,ji,vi,Gr):void 0;cn=new Al(ci,it,_i,Ei,Vi,ii,Ni,$i,!1,ji),qi=4*yo.length;const qu=Re.iconSizeData;let ps=null;qu.kind==="source"?(ps=[Zr*Yt.layout.get("icon-size").evaluate(rt,{})],ps[0]>Fn&&Vt(`${Re.layerIds[0]}: Value for "icon-size" is >= ${po}. Reduce your "icon-size".`)):qu.kind==="composite"&&(ps=[Zr*Qi.compositeIconSizes[0].evaluate(rt,{},Ii),Zr*Qi.compositeIconSizes[1].evaluate(rt,{},Ii)],(ps[0]>Fn||ps[1]>Fn)&&Vt(`${Re.layerIds[0]}: Value for "icon-size" is >= ${po}. Reduce your "icon-size".`)),Re.addSymbols(Re.icon,yo,ps,xi,Ut,rt,h.WritingMode.none,it,kr.lineStartIndex,kr.lineLength,-1,Ii),Zc=Re.icon.placedSymbolArray.length-1,xo&&(hn=4*xo.length,Re.addSymbols(Re.icon,xo,ps,xi,Ut,rt,h.WritingMode.vertical,it,kr.lineStartIndex,kr.lineLength,-1,Ii),Gc=Re.icon.placedSymbolArray.length-1)}const Nu=Object.keys(zt.horizontal);for(const ji of Nu){const Gr=zt.horizontal[ji];if(!zr){Vu=jt(Gr.text);const xo=Yt.layout.get("text-rotate").evaluate(rt,{},Ii);zr=new Al(ci,it,_i,Ei,Vi,Gr,Jt,yi,Si,xo)}const yo=Gr.positionedLines.length===1;if(_o+=Lu(Re,it,Gr,ar,Yt,Si,rt,zi,kr,zt.vertical?h.WritingMode.horizontal:h.WritingMode.horizontalOnly,yo?Nu:[ji],un,Zc,Qi,Ii),yo)break}zt.vertical&&(Uu+=Lu(Re,it,zt.vertical,ar,Yt,Si,rt,zi,kr,h.WritingMode.vertical,["vertical"],un,Gc,Qi,Ii));const Yp=zr?zr.boxStartIndex:Re.collisionBoxArray.length,Jp=zr?zr.boxEndIndex:Re.collisionBoxArray.length,Qp=yr?yr.boxStartIndex:Re.collisionBoxArray.length,ef=yr?yr.boxEndIndex:Re.collisionBoxArray.length,tf=cn?cn.boxStartIndex:Re.collisionBoxArray.length,rf=cn?cn.boxEndIndex:Re.collisionBoxArray.length,nf=or?or.boxStartIndex:Re.collisionBoxArray.length,sf=or?or.boxEndIndex:Re.collisionBoxArray.length;let Dr=-1;const Ml=(ji,Gr)=>ji&&ji.circleDiameter?Math.max(ji.circleDiameter,Gr):Gr;Dr=Ml(zr,Dr),Dr=Ml(yr,Dr),Dr=Ml(cn,Dr),Dr=Ml(or,Dr);const $u=Dr>-1?1:0;$u&&(Dr*=_r/li),Re.glyphOffsetArray.length>=la.MAX_GLYPHS&&Vt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),rt.sortKey!==void 0&&Re.addToSortKeyRanges(Re.symbolInstances.length,rt.sortKey),Re.symbolInstances.emplaceBack(it.x,it.y,un.right>=0?un.right:-1,un.center>=0?un.center:-1,un.left>=0?un.left:-1,un.vertical||-1,Zc,Gc,Vu,Yp,Jp,Qp,ef,tf,rf,nf,sf,_i,_o,Uu,qi,hn,$u,0,Jt,Xc,Wc,Dr)}(i,Ve,ye,r,s,l,Me,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,F,[ie,ie,ie,ie],ze,g,Q,se,Be,C,e,u,v,b,d)};if(Pe==="line")for(const ye of Su(e.geometry,0,0,At,At)){const Ve=qp(ye,W,ce,r.vertical||z,s,24,Y,i.overscaling,At);for(const Re of Ve)z&&Hp(i,z.text,Se,Re)||Ie(ye,Re)}else if(Pe==="line-center"){for(const ye of e.geometry)if(ye.length>1){const Ve=$p(ye,ce,r.vertical||z,s,24,Y);Ve&&Ie(ye,Ve)}}else if(e.type==="Polygon")for(const ye of mc(e.geometry,0)){const Ve=Gp(ye,16);Ie(ye[0],new Un(Ve.x,Ve.y,0))}else if(e.type==="LineString")for(const ye of e.geometry)Ie(ye,new Un(ye[0].x,ye[0].y,0));else if(e.type==="Point")for(const ye of e.geometry)for(const Ve of ye)Ie([Ve],new Un(Ve.x,Ve.y,0))}function Lu(i,e,r,s,l,u,d,f,g,v,b,E,P,C,z){const U=function(Q,W,ie,se,ce,ze,Be,Pe){const Se=se.layout.get("text-rotate").evaluate(ze,{})*Math.PI/180,Te=[];for(const Me of W.positionedLines)for(const Ie of Me.positionedGlyphs){if(!Ie.rect)continue;const ye=Ie.rect||{};let Ve=Jh+1,Re=!0,it=1,Pt=0;const zt=(ce||Pe)&&Ie.vertical,ii=Ie.metrics.advance*Ie.scale/2;if(Pe&&W.verticalizable&&(Pt=Me.lineOffset/2-(Ie.imageName?-(li-Ie.metrics.width*Ie.scale)/2:(Ie.scale-1)*li)),Ie.imageName){const Ut=Be[Ie.imageName];Re=Ut.sdf,it=Ut.pixelRatio,Ve=Ui/it}const ar=ce?[Ie.x+ii,Ie.y]:[0,0];let gi=ce?[0,0]:[Ie.x+ii+ie[0],Ie.y+ie[1]-Pt],Yt=[0,0];zt&&(Yt=gi,gi=[0,0]);const ci=(Ie.metrics.left-Ve)*Ie.scale-ii+gi[0],_i=(-Ie.metrics.top-Ve)*Ie.scale+gi[1],Ei=ci+ye.w*Ie.scale/it,Vi=_i+ye.h*Ie.scale/it,Jt=new xe(ci,_i),yi=new xe(Ei,_i),Si=new xe(ci,Vi),zi=new xe(Ei,Vi);if(zt){const Ut=new xe(-ii,ii-ho),xi=-Math.PI/2,rt=li/2-ii,Qi=new xe(5-ho-rt,-(Ie.imageName?rt:0)),vi=new xe(...Yt);Jt._rotateAround(xi,Ut)._add(Qi)._add(vi),yi._rotateAround(xi,Ut)._add(Qi)._add(vi),Si._rotateAround(xi,Ut)._add(Qi)._add(vi),zi._rotateAround(xi,Ut)._add(Qi)._add(vi)}if(Se){const Ut=Math.sin(Se),xi=Math.cos(Se),rt=[xi,-Ut,Ut,xi];Jt._matMult(rt),yi._matMult(rt),Si._matMult(rt),zi._matMult(rt)}const Ni=new xe(0,0),$i=new xe(0,0);Te.push({tl:Jt,tr:yi,bl:Si,br:zi,tex:ye,writingMode:W.writingMode,glyphOffset:ar,sectionIndex:Ie.sectionIndex,isSDF:Re,pixelOffsetTL:Ni,pixelOffsetBR:$i,minFontScaleX:0,minFontScaleY:0})}return Te}(0,r,f,l,u,d,s,i.allowVerticalPlacement),F=i.textSizeData;let Y=null;F.kind==="source"?(Y=[Zr*l.layout.get("text-size").evaluate(d,{})],Y[0]>Fn&&Vt(`${i.layerIds[0]}: Value for "text-size" is >= ${po}. Reduce your "text-size".`)):F.kind==="composite"&&(Y=[Zr*C.compositeTextSizes[0].evaluate(d,{},z),Zr*C.compositeTextSizes[1].evaluate(d,{},z)],(Y[0]>Fn||Y[1]>Fn)&&Vt(`${i.layerIds[0]}: Value for "text-size" is >= ${po}. Reduce your "text-size".`)),i.addSymbols(i.text,U,Y,f,u,d,v,e,g.lineStartIndex,g.lineLength,P,z);for(const Q of b)E[Q]=i.text.placedSymbolArray.length-1;return 4*U.length}function Bu(i){for(const e in i)return i[e];return null}function Hp(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=Ru[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 Oc(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=Ru.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 Uc(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,P=g.pop()||0;if(E-P<=f){for(let F=P;F<=E;F++){const Y=d[2*F],Q=d[2*F+1];Y>=e&&Y<=s&&Q>=r&&Q<=l&&v.push(u[F])}continue}const C=P+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(P),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,P=f.pop()||0;if(E-P<=d){for(let F=P;F<=E;F++)Ou(u[2*F],u[2*F+1],e,r)<=v&&g.push(l[F]);continue}const C=P+E>>1,z=u[2*C],U=u[2*C+1];Ou(z,U,e,r)<=v&&g.push(l[C]),(b===0?e-s<=z:r-s<=U)&&(f.push(P),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 Uc(i,e,r,s,l,u){if(l-s<=r)return;const d=s+l>>1;Fu(i,e,d,s,l,u),Uc(i,e,r,s,d-1,1-u),Uc(i,e,r,d+1,l,1-u)}function Fu(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),P=.5*Math.exp(2*E/3),C=.5*Math.sqrt(E*P*(v-P)/v)*(b-v/2<0?-1:1);Fu(i,e,r,Math.max(s,Math.floor(r-b*P/v+C)),Math.min(l,Math.floor(r+(v-b)*P/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){Vc(i,r,s),Vc(e,2*r,2*s),Vc(e,2*r+1,2*s+1)}function Vc(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function Ou(i,e,r,s){const l=i-r,u=e-s;return l*l+u*u}var Nc;h.PerformanceMarkers=void 0,(Nc=h.PerformanceMarkers||(h.PerformanceMarkers={})).create="create",Nc.load="load",Nc.fullLoad="fullLoad";let Pl=null,go=[];const $c=1e3/60,qc="loadTime",jc="fullLoadTime",Kp={mark(i){performance.mark(i)},frame(i){const e=i;Pl!=null&&go.push(e-Pl),Pl=e},clearMetrics(){Pl=null,go=[],performance.clearMeasures(qc),performance.clearMeasures(jc);for(const i in h.PerformanceMarkers)performance.clearMarks(h.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure(qc,h.PerformanceMarkers.create,h.PerformanceMarkers.load),performance.measure(jc,h.PerformanceMarkers.create,h.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName(qc)[0].duration,e=performance.getEntriesByName(jc)[0].duration,r=go.length,s=1/(go.reduce((u,d)=>u+d,0)/r/1e3),l=go.filter(u=>u>$c).reduce((u,d)=>u+(d-$c)/$c,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};h.AJAXError=Br,h.ARRAY_TYPE=ia,h.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},Rt(["receive","process"],this),this.invoker=new Vp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Zi()?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=Lr(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 Zi()||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(Ar(e.error)):r(null,Ar(e.data)))}else{let r=!1;const s=Lr(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=Ar(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=Bc,h.CollisionBoxArray=c,h.CollisionCircleLayoutArray=class extends Hs{},h.Color=je,h.DEMData=xu,h.DataConstantProperty=Fe,h.DictionaryCoder=vu,h.EXTENT=At,h.ErrorEvent=Xi,h.EvaluationParameters=kt,h.Event=wr,h.Evented=xn,h.FeatureIndex=wu,h.FillBucket=yc,h.FillExtrusionBucket=vc,h.GeoJSONFeature=bu,h.ImageAtlas=eu,h.ImagePosition=Sc,h.KDBush=Oc,h.LineBucket=bc,h.LineStripIndexArray=class extends t{},h.LngLat=On,h.MercatorCoordinate=Tl,h.ONE_EM=li,h.OverscaledTileID=sr,h.PerformanceUtils=Kp,h.Point=xe,h.Pos3dArray=class extends Gs{},h.PosArray=O,h.Properties=Ci,h.Protobuf=Tc,h.QuadTriangleArray=class extends Ks{},h.RGBAImage=nr,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=la,h.Transitionable=nl,h.TriangleIndexArray=ge,h.Uniform1f=gr,h.Uniform1i=class extends Ti{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 Ti{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 Ti{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=mi,h.UniformMatrix4f=class extends Ti{constructor(i,e){super(i,e),this.current=ai}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=yu,h.ValidationError=we,h.ZoomHistory=Jo,h.addDynamicAttributes=Mc,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=vr})},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):vr},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=xt,h.bindAll=Rt,h.clamp=et,h.clipLine=Su,h.clone=function(i){var e=new ia(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=Ct,h.collisionCircleLayout=mp,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 ia(16);return ia!=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=Dt,h.createFilter=La,h.createLayout=Kt,h.createStyleLayer=function(i){return i.type==="custom"?new Op(i):new Up[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:lt.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(Qr,{}),P=f.reduce(Qr,{}),C=v.slice(),z=Object.create(null);let U,F,Y,Q,W,ie,se;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 Tc(i).readFields(Ip,[])},h.pbf=Zh,h.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=At/(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 kt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new kt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new kt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:v}=i.bucket.textSizeData;s.compositeTextSizes=[r["text-size"].possiblyEvaluate(new kt(g),i.canonical),r["text-size"].possiblyEvaluate(new kt(v),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:v}=i.bucket.iconSizeData;s.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new kt(g),i.canonical),r["icon-size"].possiblyEvaluate(new kt(v),i.canonical)]}const l=e.get("text-line-height")*li,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),P=s.layoutIconSize.evaluate(g,{},i.canonical),C={horizontal:{},vertical:void 0},z=g.text;let U,F=[0,0];if(z){const W=z.toString(),ie=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*li,se=Va(W)?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?Du(ce,[Me*li,Rc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Ie=>Ie*li)}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)*li:0,Te=()=>{i.bucket.allowVerticalPlacement&&Os(W)&&(C.vertical=xl(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,Se,l,ce,"left",se,F,h.WritingMode.vertical,!0,Pe,E,b))};if(!u&&ze){const Me=Be==="auto"?ze.map(ye=>Fc(ye)):[Be];let Ie=!1;for(let ye=0;yethis._layers[fe.id]),J=Z[0];if(J.visibility==="none")continue;const H=J.source||"";let G=this.familiesBySource[H];G||(G=this.familiesBySource[H]={});const ee=J.sourceLayer||"_geojsonTileLayer";let he=G[ee];he||(he=G[ee]=[]),he.push(Z)}}}class X{constructor(I){const M={},L=[];for(const H in I){const G=I[H],ee=M[H]={};for(const he in G){const fe=G[+he];if(!fe||fe.bitmap.width===0||fe.bitmap.height===0)continue;const pe={x:0,y:0,w:fe.bitmap.width+2,h:fe.bitmap.height+2};L.push(pe),ee[he]={rect:pe,metrics:fe.metrics}}}const{w:q,h:Z}=h.potpack(L),J=new h.AlphaImage({width:q||1,height:Z||1});for(const H in I){const G=I[H];for(const ee in G){const he=G[+ee];if(!he||he.bitmap.width===0||he.bitmap.height===0)continue;const fe=M[H][ee].rect;h.AlphaImage.copy(he.bitmap,J,{x:0,y:0},{x:fe.x+1,y:fe.y+1},he.bitmap)}}this.image=J,this.positions=M}}h.register("GlyphAtlas",X);class Ge{constructor(I){this.tileID=new h.OverscaledTileID(I.tileID.overscaledZ,I.tileID.wrap,I.tileID.canonical.z,I.tileID.canonical.x,I.tileID.canonical.y),this.uid=I.uid,this.zoom=I.zoom,this.pixelRatio=I.pixelRatio,this.tileSize=I.tileSize,this.source=I.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=I.showCollisionBoxes,this.collectResourceTiming=!!I.collectResourceTiming,this.returnDependencies=!!I.returnDependencies,this.promoteId=I.promoteId}parse(I,M,L,q,Z){this.status="parsing",this.data=I,this.collisionBoxArray=new h.CollisionBoxArray;const J=new h.DictionaryCoder(Object.keys(I.layers).sort()),H=new h.FeatureIndex(this.tileID,this.promoteId);H.bucketLayerIDs=[];const G={},ee={featureIndex:H,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:L},he=M.familiesBySource[this.source];for(const tt in he){const ct=I.layers[tt];if(!ct)continue;ct.version===1&&h.warnOnce(`Vector tile source "${this.source}" layer "${tt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Tt=J.encode(tt),Xt=[];for(let je=0;je=Lt.maxzoom||Lt.visibility!=="none"&&(xe(je,this.zoom,L),(G[Lt.id]=Lt.createBucket({index:H.bucketLayerIDs.length,layers:je,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Tt,sourceID:this.source})).populate(Xt,ee,this.tileID.canonical),H.bucketLayerIDs.push(je.map(Ur=>Ur.id)))}}let fe,pe,Ne,Xe;const Le=h.mapObject(ee.glyphDependencies,tt=>Object.keys(tt).map(Number));Object.keys(Le).length?q.send("getGlyphs",{uid:this.uid,stacks:Le,source:this.source,tileID:this.tileID,type:"glyphs"},(tt,ct)=>{fe||(fe=tt,pe=ct,at.call(this))}):pe={};const Oe=Object.keys(ee.iconDependencies);Oe.length?q.send("getImages",{icons:Oe,source:this.source,tileID:this.tileID,type:"icons"},(tt,ct)=>{fe||(fe=tt,Ne=ct,at.call(this))}):Ne={};const Ze=Object.keys(ee.patternDependencies);function at(){if(fe)return Z(fe);if(pe&&Ne&&Xe){const tt=new X(pe),ct=new h.ImageAtlas(Ne,Xe);for(const Tt in G){const Xt=G[Tt];Xt instanceof h.SymbolBucket?(xe(Xt.layers,this.zoom,L),h.performSymbolLayout({bucket:Xt,glyphMap:pe,glyphPositions:tt.positions,imageMap:Ne,imagePositions:ct.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Xt.hasPattern&&(Xt instanceof h.LineBucket||Xt instanceof h.FillBucket||Xt instanceof h.FillExtrusionBucket)&&(xe(Xt.layers,this.zoom,L),Xt.addFeatures(ee,this.tileID.canonical,ct.patternPositions))}this.status="done",Z(null,{buckets:Object.values(G).filter(Tt=>!Tt.isEmpty()),featureIndex:H,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:tt.image,imageAtlas:ct,glyphMap:this.returnDependencies?pe:null,iconMap:this.returnDependencies?Ne:null,glyphPositions:this.returnDependencies?tt.positions:null})}}Ze.length?q.send("getImages",{icons:Ze,source:this.source,tileID:this.tileID,type:"patterns"},(tt,ct)=>{fe||(fe=tt,Xe=ct,at.call(this))}):Xe={},at.call(this)}}function xe(V,I,M){const L=new h.EvaluationParameters(I);for(const q of V)q.recalculate(L,M)}function nt(V,I){const M=h.getArrayBuffer(V.request,(L,q,Z,J)=>{L?I(L):q&&I(null,{vectorTile:new h.vectorTile.VectorTile(new h.Protobuf(q)),rawData:q,cacheControl:Z,expires:J})});return()=>{M.cancel(),I()}}class ot{constructor(I,M,L,q){this.actor=I,this.layerIndex=M,this.availableImages=L,this.loadVectorData=q||nt,this.loading={},this.loaded={}}loadTile(I,M){const L=I.uid;this.loading||(this.loading={});const q=!!(I&&I.request&&I.request.collectResourceTiming)&&new h.RequestPerformance(I.request),Z=this.loading[L]=new Ge(I);Z.abort=this.loadVectorData(I,(J,H)=>{if(delete this.loading[L],J||!H)return Z.status="done",this.loaded[L]=Z,M(J);const G=H.rawData,ee={};H.expires&&(ee.expires=H.expires),H.cacheControl&&(ee.cacheControl=H.cacheControl);const he={};if(q){const fe=q.finish();fe&&(he.resourceTiming=JSON.parse(JSON.stringify(fe)))}Z.vectorTile=H.vectorTile,Z.parse(H.vectorTile,this.layerIndex,this.availableImages,this.actor,(fe,pe)=>{if(fe||!pe)return M(fe);M(null,h.extend({rawTileData:G.slice(0)},pe,ee,he))}),this.loaded=this.loaded||{},this.loaded[L]=Z})}reloadTile(I,M){const L=this.loaded,q=I.uid,Z=this;if(L&&L[q]){const J=L[q];J.showCollisionBoxes=I.showCollisionBoxes;const H=(G,ee)=>{const he=J.reloadCallback;he&&(delete J.reloadCallback,J.parse(J.vectorTile,Z.layerIndex,this.availableImages,Z.actor,he)),M(G,ee)};J.status==="parsing"?J.reloadCallback=H:J.status==="done"&&(J.vectorTile?J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor,H):H())}}abortTile(I,M){const L=this.loading,q=I.uid;L&&L[q]&&L[q].abort&&(L[q].abort(),delete L[q]),M()}removeTile(I,M){const L=this.loaded,q=I.uid;L&&L[q]&&delete L[q],M()}}class We{constructor(){this.loaded={}}loadTile(I,M){const{uid:L,encoding:q,rawImageData:Z}=I,J=h.isImageBitmap(Z)?this.getImageData(Z):Z,H=new h.DEMData(L,J,q);this.loaded=this.loaded||{},this.loaded[L]=H,M(null,H)}getImageData(I){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(I.width,I.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=I.width,this.offscreenCanvas.height=I.height,this.offscreenCanvasContext.drawImage(I,0,0,I.width,I.height);const M=this.offscreenCanvasContext.getImageData(-1,-1,I.width+2,I.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new h.RGBAImage({width:M.width,height:M.height},M.data)}removeTile(I){const M=this.loaded,L=I.uid;M&&M[L]&&delete M[L]}}function xt(V,I){if(V.length!==0){bt(V[0],I);for(var M=1;M=Math.abs(H)?M-G+H:H-G+M,M=G}M+L>=0!=!!I&&V.reverse()}var et=h.getDefaultExportFromCjs(function V(I,M){var L,q=I&&I.type;if(q==="FeatureCollection")for(L=0;L>31}function vr(V,I){for(var M=V.loadGeometry(),L=V.type,q=0,Z=0,J=M.length,H=0;HV},$n=Math.fround||(Br=new Float32Array(1),V=>(Br[0]=+V,Br[0]));var Br;const bi=3,Gi=5,hi=6;class _n{constructor(I){this.options=Object.assign(Object.create(gn),I),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(I){const{log:M,minZoom:L,maxZoom:q}=this.options;M&&console.time("total time");const Z=`prepare ${I.length} points`;M&&console.time(Z),this.points=I;const J=[];for(let G=0;G=L;G--){const ee=+Date.now();H=this.trees[G]=this._createTree(this._cluster(H,G)),M&&console.log("z%d: %d clusters in %dms",G,H.numItems,+Date.now()-ee)}return M&&console.timeEnd("total time"),this}getClusters(I,M){let L=((I[0]+180)%360+360)%360-180;const q=Math.max(-90,Math.min(90,I[1]));let Z=I[2]===180?180:((I[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)L=-180,Z=180;else if(L>Z){const fe=this.getClusters([L,q,180,J],M),pe=this.getClusters([-180,q,Z,J],M);return fe.concat(pe)}const H=this.trees[this._limitZoom(M)],G=H.range(Rr(L),br(J),Rr(Z),br(q)),ee=H.data,he=[];for(const fe of G){const pe=this.stride*fe;he.push(ee[pe+Gi]>1?yn(ee,pe,this.clusterProps):this.points[ee[pe+bi]])}return he}getChildren(I){const M=this._getOriginId(I),L=this._getOriginZoom(I),q="No cluster with the specified id.",Z=this.trees[L];if(!Z)throw new Error(q);const J=Z.data;if(M*this.stride>=J.length)throw new Error(q);const H=this.options.radius/(this.options.extent*Math.pow(2,L-1)),G=Z.within(J[M*this.stride],J[M*this.stride+1],H),ee=[];for(const he of G){const fe=he*this.stride;J[fe+4]===I&&ee.push(J[fe+Gi]>1?yn(J,fe,this.clusterProps):this.points[J[fe+bi]])}if(ee.length===0)throw new Error(q);return ee}getLeaves(I,M,L){const q=[];return this._appendLeaves(q,I,M=M||10,L=L||0,0),q}getTile(I,M,L){const q=this.trees[this._limitZoom(I)],Z=Math.pow(2,I),{extent:J,radius:H}=this.options,G=H/J,ee=(L-G)/Z,he=(L+1+G)/Z,fe={features:[]};return this._addTileFeatures(q.range((M-G)/Z,ee,(M+1+G)/Z,he),q.data,M,L,Z,fe),M===0&&this._addTileFeatures(q.range(1-G/Z,ee,1,he),q.data,Z,L,Z,fe),M===Z-1&&this._addTileFeatures(q.range(0,ee,G/Z,he),q.data,-1,L,Z,fe),fe.features.length?fe:null}getClusterExpansionZoom(I){let M=this._getOriginZoom(I)-1;for(;M<=this.options.maxZoom;){const L=this.getChildren(I);if(M++,L.length!==1)break;I=L[0].properties.cluster_id}return M}_appendLeaves(I,M,L,q,Z){const J=this.getChildren(M);for(const H of J){const G=H.properties;if(G&&G.cluster?Z+G.point_count<=q?Z+=G.point_count:Z=this._appendLeaves(I,G.cluster_id,L,q,Z):Z1;let he,fe,pe;if(ee)he=Kr(M,G,this.clusterProps),fe=M[G],pe=M[G+1];else{const Le=this.points[M[G+bi]];he=Le.properties;const[Oe,Ze]=Le.geometry.coordinates;fe=Rr(Oe),pe=br(Ze)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(fe*Z-L)),Math.round(this.options.extent*(pe*Z-q))]],tags:he};let Xe;Xe=ee||this.options.generateId?M[G+bi]:this.points[M[G+bi]].id,Xe!==void 0&&(Ne.id=Xe),J.features.push(Ne)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(Math.floor(+I),this.options.maxZoom+1))}_cluster(I,M){const{radius:L,extent:q,reduce:Z,minPoints:J}=this.options,H=L/(q*Math.pow(2,M)),G=I.data,ee=[],he=this.stride;for(let fe=0;feM&&(Oe+=G[at+Gi])}if(Oe>Le&&Oe>=J){let Ze,at=pe*Le,tt=Ne*Le,ct=-1;const Tt=((fe/he|0)<<5)+(M+1)+this.points.length;for(const Xt of Xe){const je=Xt*he;if(G[je+2]<=M)continue;G[je+2]=M;const Lt=G[je+Gi];at+=G[je]*Lt,tt+=G[je+1]*Lt,G[je+4]=Tt,Z&&(Ze||(Ze=this._map(G,fe,!0),ct=this.clusterProps.length,this.clusterProps.push(Ze)),Z(Ze,this._map(G,je)))}G[fe+4]=Tt,ee.push(at/Oe,tt/Oe,1/0,Tt,-1,Oe),Z&&ee.push(ct)}else{for(let Ze=0;Ze1)for(const Ze of Xe){const at=Ze*he;if(!(G[at+2]<=M)){G[at+2]=M;for(let tt=0;tt>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,M,L){if(I[M+Gi]>1){const J=this.clusterProps[I[M+hi]];return L?Object.assign({},J):J}const q=this.points[I[M+bi]].properties,Z=this.options.map(q);return L&&Z===q?Object.assign({},Z):Z}}function yn(V,I,M){return{type:"Feature",id:V[I+bi],properties:Kr(V,I,M),geometry:{type:"Point",coordinates:[(L=V[I],360*(L-.5)),wr(V[I+1])]}};var L}function Kr(V,I,M){const L=V[I+Gi],q=L>=1e4?`${Math.round(L/1e3)}k`:L>=1e3?Math.round(L/100)/10+"k":L,Z=V[I+hi],J=Z===-1?{}:Object.assign({},M[Z]);return Object.assign(J,{cluster:!0,cluster_id:V[I+bi],point_count:L,point_count_abbreviated:q})}function Rr(V){return V/360+.5}function br(V){const I=Math.sin(V*Math.PI/180),M=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return M<0?0:M>1?1:M}function wr(V){const I=(180-360*V)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function Xi(V,I,M,L){for(var q,Z=L,J=M-I>>1,H=M-I,G=V[I],ee=V[I+1],he=V[M],fe=V[M+1],pe=I+3;peZ)q=pe,Z=Ne;else if(Ne===Z){var Xe=Math.abs(pe-J);XeL&&(q-I>3&&Xi(V,I,q,L),V[q+2]=Z,M-q>3&&Xi(V,q,M,L))}function xn(V,I,M,L,q,Z){var J=q-M,H=Z-L;if(J!==0||H!==0){var G=((V-M)*J+(I-L)*H)/(J*J+H*H);G>1?(M=q,L=Z):G>0&&(M+=J*G,L+=H*G)}return(J=V-M)*J+(H=I-L)*H}function le(V,I,M,L){var q={id:V===void 0?null:V,type:I,geometry:M,tags:L,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Z){var J=Z.geometry,H=Z.type;if(H==="Point"||H==="MultiPoint"||H==="LineString")Fr(Z,J);else if(H==="Polygon"||H==="MultiLineString")for(var G=0;G0&&(J+=L?(q*ee-G*Z)/2:Math.sqrt(Math.pow(G-q,2)+Math.pow(ee-Z,2))),q=G,Z=ee}var he=I.length-3;I[2]=1,Xi(I,0,he,M),I[he+2]=1,I.size=Math.abs(J),I.start=0,I.end=I.size}function Yr(V,I,M,L){for(var q=0;q1?1:M}function Gt(V,I,M,L,q,Z,J,H){if(L/=I,Z>=(M/=I)&&J=L)return null;for(var G=[],ee=0;ee=M&&Xe=L)){var Le=[];if(pe==="Point"||pe==="MultiPoint")Jr(fe,Le,M,L,q);else if(pe==="LineString")vn(fe,Le,M,L,q,!1,H.lineMetrics);else if(pe==="MultiLineString")we(fe,Le,M,L,q,!1);else if(pe==="Polygon")we(fe,Le,M,L,q,!0);else if(pe==="MultiPolygon")for(var Oe=0;Oe=M&&J<=L&&(I.push(V[Z]),I.push(V[Z+1]),I.push(V[Z+2]))}}function vn(V,I,M,L,q,Z,J){for(var H,G,ee=Qr(V),he=q===0?fi:bn,fe=V.start,pe=0;peM&&(G=he(ee,Ne,Xe,Oe,Ze,M),J&&(ee.start=fe+H*G)):at>L?tt=M&&(G=he(ee,Ne,Xe,Oe,Ze,M),ct=!0),tt>L&&at<=L&&(G=he(ee,Ne,Xe,Oe,Ze,L),ct=!0),!Z&&ct&&(J&&(ee.end=fe+H*G),I.push(ee),ee=Qr(V)),J&&(fe+=H)}var Tt=V.length-3;Ne=V[Tt],Xe=V[Tt+1],Le=V[Tt+2],(at=q===0?Ne:Xe)>=M&&at<=L&&lr(ee,Ne,Xe,Le),Tt=ee.length-3,Z&&Tt>=3&&(ee[Tt]!==ee[0]||ee[Tt+1]!==ee[1])&&lr(ee,ee[0],ee[1],ee[2]),ee.length&&I.push(ee)}function Qr(V){var I=[];return I.size=V.size,I.start=V.start,I.end=V.end,I}function we(V,I,M,L,q,Z){for(var J=0;JJ.maxX&&(J.maxX=he),fe>J.maxY&&(J.maxY=fe)}return J}function Qt(V,I,M,L){var q=I.geometry,Z=I.type,J=[];if(Z==="Point"||Z==="MultiPoint")for(var H=0;H0&&I.size<(q?J:L))M.numPoints+=I.length/3;else{for(var H=[],G=0;GJ)&&(M.numSimplified++,H.push(I[G]),H.push(I[G+1])),M.numPoints++;q&&function(ee,he){for(var fe=0,pe=0,Ne=ee.length,Xe=Ne-2;pe0===he)for(pe=0,Ne=ee.length;pe24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");var L=function(q,Z){var J=[];if(q.type==="FeatureCollection")for(var H=0;H1&&console.time("creation"),pe=this.tiles[fe]=Pi(V,I,M,L,G),this.tileCoords.push({z:I,x:M,y:L}),ee)){ee>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,M,L,pe.numFeatures,pe.numPoints,pe.numSimplified),console.timeEnd("creation"));var Ne="z"+I;this.stats[Ne]=(this.stats[Ne]||0)+1,this.total++}if(pe.source=V,q){if(I===G.maxZoom||I===q)continue;var Xe=1<1&&console.time("clipping");var Le,Oe,Ze,at,tt,ct,Tt=.5*G.buffer/G.extent,Xt=.5-Tt,je=.5+Tt,Lt=1+Tt;Le=Oe=Ze=at=null,tt=Gt(V,he,M-Tt,M+je,0,pe.minX,pe.maxX,G),ct=Gt(V,he,M+Xt,M+Lt,0,pe.minX,pe.maxX,G),V=null,tt&&(Le=Gt(tt,he,L-Tt,L+je,1,pe.minY,pe.maxY,G),Oe=Gt(tt,he,L+Xt,L+Lt,1,pe.minY,pe.maxY,G),tt=null),ct&&(Ze=Gt(ct,he,L-Tt,L+je,1,pe.minY,pe.maxY,G),at=Gt(ct,he,L+Xt,L+Lt,1,pe.minY,pe.maxY,G),ct=null),ee>1&&console.timeEnd("clipping"),H.push(Le||[],I+1,2*M,2*L),H.push(Oe||[],I+1,2*M,2*L+1),H.push(Ze||[],I+1,2*M+1,2*L),H.push(at||[],I+1,2*M+1,2*L+1)}}},Tr.prototype.getTile=function(V,I,M){var L=this.options,q=L.extent,Z=L.debug;if(V<0||V>24)return null;var J=1<1&&console.log("drilling down to z%d-%d-%d",V,I,M);for(var G,ee=V,he=I,fe=M;!G&&ee>0;)ee--,he=Math.floor(he/2),fe=Math.floor(fe/2),G=this.tiles[Er(ee,he,fe)];return G&&G.source?(Z>1&&console.log("found parent tile z%d-%d-%d",ee,he,fe),Z>1&&console.time("drilling down"),this.splitTile(G.source,ee,he,fe,V,I,M),Z>1&&console.timeEnd("drilling down"),this.tiles[H]?Qe(this.tiles[H],q):null):null};class Zn extends ot{constructor(I,M,L,q){super(I,M,L,St),this._dataUpdateable=new Map,this.loadGeoJSON=(Z,J)=>{const{promoteId:H}=Z;if(Z.request)return h.getJSON(Z.request,(G,ee,he,fe)=>{this._dataUpdateable=Sr(ee,H)?ui(ee,H):void 0,J(G,ee,he,fe)});if(typeof Z.data=="string")try{const G=JSON.parse(Z.data);this._dataUpdateable=Sr(G,H)?ui(G,H):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 fe,pe,Ne,Xe;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=er(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&&(((fe=Le.removeProperties)===null||fe===void 0?void 0:fe.length)>0||((pe=Le.addOrUpdateProperties)===null||pe===void 0?void 0:pe.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 at of Le.removeProperties)Object.prototype.hasOwnProperty.call(Oe.properties,at)&&delete Oe.properties[at];if(((Xe=Le.addOrUpdateProperties)===null||Xe===void 0?void 0:Xe.length)>0)for(const{key:at,value:tt}of Le.addOrUpdateProperties)Oe.properties[at]=tt}}(this._dataUpdateable,Z.dataDiff,H),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(I,M){var L;(L=this._pendingRequest)===null||L===void 0||L.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const q=!!(I&&I.request&&I.request.collectResourceTiming)&&new h.RequestPerformance(I.request);this._pendingCallback=M,this._pendingRequest=this.loadGeoJSON(I,(Z,J)=>{if(delete this._pendingCallback,delete this._pendingRequest,Z||!J)return M(Z);if(typeof J!="object")return M(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`));{et(J,!0);try{if(I.filter){const G=h.createExpression(I.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=I.cluster?new _n(function({superclusterOptions:G,clusterProperties:ee}){if(!ee||!G)return G;const he={},fe={},pe={accumulated:null,zoom:0},Ne={properties:null},Xe=Object.keys(ee);for(const Le of Xe){const[Oe,Ze]=ee[Le],at=h.createExpression(Ze),tt=h.createExpression(typeof Oe=="string"?[Oe,["accumulated"],["get",Le]]:Oe);he[Le]=at.value,fe[Le]=tt.value}return G.map=Le=>{Ne.properties=Le;const Oe={};for(const Ze of Xe)Oe[Ze]=he[Ze].evaluate(pe,Ne);return Oe},G.reduce=(Le,Oe)=>{Ne.properties=Oe;for(const Ze of Xe)pe.accumulated=Le[Ze],Le[Ze]=fe[Ze].evaluate(pe,Ne)},G}(I)).load(J.features):function(G,ee){return new Tr(G,ee)}(J,I.geojsonVtOptions)}catch(G){return M(G)}this.loaded={};const H={};if(q){const G=q.finish();G&&(H.resourceTiming={},H.resourceTiming[I.source]=JSON.parse(JSON.stringify(G)))}M(null,H)}})}reloadTile(I,M){const L=this.loaded;return L&&L[I.uid]?super.reloadTile(I,M):this.loadTile(I,M)}removeSource(I,M){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),M()}getClusterExpansionZoom(I,M){try{M(null,this._geoJSONIndex.getClusterExpansionZoom(I.clusterId))}catch(L){M(L)}}getClusterChildren(I,M){try{M(null,this._geoJSONIndex.getChildren(I.clusterId))}catch(L){M(L)}}getClusterLeaves(I,M){try{M(null,this._geoJSONIndex.getLeaves(I.clusterId,I.limit,I.offset))}catch(L){M(L)}}}class cr{constructor(I){this.self=I,this.actor=new h.Actor(I,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:ot,geojson:Zn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(M,L)=>{if(this.workerSourceTypes[M])throw new Error(`Worker source with name "${M}" already registered.`);this.workerSourceTypes[M]=L},this.self.registerRTLTextPlugin=M=>{if(h.plugin.isParsed())throw new Error("RTL text plugin already registered.");h.plugin.applyArabicShaping=M.applyArabicShaping,h.plugin.processBidirectionalText=M.processBidirectionalText,h.plugin.processStyledBidirectionalText=M.processStyledBidirectionalText}}setReferrer(I,M){this.referrer=M}setImages(I,M,L){this.availableImages[I]=M;for(const q in this.workerSources[I]){const Z=this.workerSources[I][q];for(const J in Z)Z[J].availableImages=M}L()}setLayers(I,M,L){this.getLayerIndex(I).replace(M),L()}updateLayers(I,M,L){this.getLayerIndex(I).update(M.layers,M.removedIds),L()}loadTile(I,M,L){this.getWorkerSource(I,M.type,M.source).loadTile(M,L)}loadDEMTile(I,M,L){this.getDEMWorkerSource(I,M.source).loadTile(M,L)}reloadTile(I,M,L){this.getWorkerSource(I,M.type,M.source).reloadTile(M,L)}abortTile(I,M,L){this.getWorkerSource(I,M.type,M.source).abortTile(M,L)}removeTile(I,M,L){this.getWorkerSource(I,M.type,M.source).removeTile(M,L)}removeDEMTile(I,M){this.getDEMWorkerSource(I,M.source).removeTile(M)}removeSource(I,M,L){if(!this.workerSources[I]||!this.workerSources[I][M.type]||!this.workerSources[I][M.type][M.source])return;const q=this.workerSources[I][M.type][M.source];delete this.workerSources[I][M.type][M.source],q.removeSource!==void 0?q.removeSource(M,L):L()}loadWorkerSource(I,M,L){try{this.self.importScripts(M.url),L()}catch(q){L(q.toString())}}syncRTLPluginState(I,M,L){try{h.plugin.setState(M);const q=h.plugin.getPluginURL();if(h.plugin.isLoaded()&&!h.plugin.isParsed()&&q!=null){this.self.importScripts(q);const Z=h.plugin.isParsed();L(Z?void 0:new Error(`RTL Text Plugin failed to import scripts from ${q}`),Z)}}catch(q){L(q.toString())}}getAvailableImages(I){let M=this.availableImages[I];return M||(M=[]),M}getLayerIndex(I){let M=this.layerIndexes[I];return M||(M=this.layerIndexes[I]=new ue),M}getWorkerSource(I,M,L){if(this.workerSources[I]||(this.workerSources[I]={}),this.workerSources[I][M]||(this.workerSources[I][M]={}),!this.workerSources[I][M][L]){const q={send:(Z,J,H)=>{this.actor.send(Z,J,H,I)}};this.workerSources[I][M][L]=new this.workerSourceTypes[M](q,this.getLayerIndex(I),this.getAvailableImages(I))}return this.workerSources[I][M][L]}getDEMWorkerSource(I,M){return this.demWorkerSources[I]||(this.demWorkerSources[I]={}),this.demWorkerSources[I][M]||(this.demWorkerSources[I][M]=new We),this.demWorkerSources[I][M]}}return h.isWorker()&&(self.worker=new cr(self)),cr}),ae(["./shared"],function(h){var ue="3.1.0";class X{static testProp(t){if(!X.docStyle)return t[0];for(let n=0;n{window.removeEventListener("click",X.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)=>{Ge.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=""}}}}(bt||(bt={})),bt.resetRequestQueue();var et,Bt=bt;(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"})(et||(et={}));class pt{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(ri);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 ri=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Rt(o){var t=new h.ARRAY_TYPE(3);return t[0]=o[0],t[1]=o[1],t[2]=o[2],t}var Ai,Mt=function(o,t,n){return o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],o};Ai=new h.ARRAY_TYPE(3),h.ARRAY_TYPE!=Float32Array&&(Ai[0]=0,Ai[1]=0,Ai[2]=0);var Ct=function(o){var t=o[0],n=o[1];return t*t+n*n};function ni(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 Vt(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:K,content:re}=_[x];p[m][x]={data:null,pixelRatio:R,sdf:B,stretchX:$,stretchY:K,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 yt{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 Zi 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]=xr}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]=[],vr.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 vr.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}}}}vr.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}`),et.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)}})},vr.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:K}=this;B.clearRect(R,R,y,_),B.fillText(o,R,R+m);const re=B.getImageData(R,R,y,_);K.fill(xr,0,w),$.fill(0,0,w);for(let N=0;N<_;N++)for(let te=0;te0?_e*_e:0,$[me]=_e<0?_e*_e:0}}Lr(K,0,0,x,T,x,this.f,this.v,this.z),Lr($,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 Gi(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,et.Source),a):h.exported.frame(()=>a(null,o))}bi.Actor=h.Actor;class hi{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 hi))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(hi.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 hi?t:t&&new hi(t)}static fromLngLat(t,n=0){const a=360*n/40075017,c=a/Math.cos(Math.PI/180*t.lat);return new hi(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=hi.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,et.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 Kr 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=Gi(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=Bt.getImage(this.map._requestManager.transformRequest(a,et.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 yt(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 Rr extends Kr{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=Bt.getImage(this.map._requestManager.transformRequest(a,et.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 wr=h.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Xi 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=Bt.getImage(this.map._requestManager.transformRequest(this.url,et.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,wr.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new yt(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 Xi{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,et.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,wr.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 yt(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 Xi{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,wr.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 yt(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 Fr={vector:yn,raster:Kr,"raster-dem":Rr,geojson:br,video:xn,image:Xi,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 wt(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(lt);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,K=O[$]=O[$]||{};for(const re in R){const N=R[re],te=K[re]=K[re]||{},oe=k[re]=k[re]||[];for(const me of N)te[me.featureIndex]||(te[me.featureIndex]=!0,oe.push(me))}}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 lt(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 Yr{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 yt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new yt(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 ms{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 Gt 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 Fr[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 ms,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(Jr).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(Jr).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-Gt.maxOverzooming,this._source.minzoom),m=Math.max(c+Gt.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 K=this.findLoadedParent(R,p);K&&(this._addTile(K.tileID),T[K.tileID.key]=K.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 K=R[$].children(this._source.maxzoom);this._tiles[K[0].key]&&this._tiles[K[1].key]&&this._tiles[K[2].key]&&this._tiles[K[3].key]&&(B[K[0].key]=_[K[0].key]=K[0],B[K[1].key]=_[K[1].key]=K[1],B[K[2].key]=_[K[2].key]=K[2],B[K[3].key]=_[K[3].key]=K[3],delete R[$])}for(const $ in R){const K=this.findLoadedParent(R[$],this._source.minzoom);if(K){B[K.tileID.key]=_[K.tileID.key]=K.tileID;for(const re in B)B[re].isChildOf(K.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-Gt.maxOverzooming,this._source.minzoom),m=Math.max(n+Gt.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 Yr(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(me=>$.getTilePoint(me)),oe=_.map(me=>$.getTilePoint(me));c.push({tile:R,tileID:$,queryGeometry:te,cameraQueryGeometry:oe,scale:K})}}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 Jr(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"}Gt.maxOverzooming=10,Gt.maxUnderzooming=3;const Qr="mapboxgl_preloaded_worker_pool";class we{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Qr]}numActive(){return Object.keys(this.active).length}}const lr=Math.floor(h.exported.hardwareConcurrency/2);let fi;function bn(){return fi||(fi=new we),fi}we.workerCount=h.isSafari(globalThis)?Math.max(Math.min(lr,3),1):1;class Or{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 be(o,t){let n=!0;return o==="always"||o!=="never"&&t!=="never"||(n=!1),n}class Qe{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,K=this.boxKeys[R];if(t<=B[$+2]&&n<=B[$+3]&&a>=B[$+0]&&c>=B[$+1]&&(!_||_(K))&&(!T||!be(w,K.overlapMode))&&(m.push({key:K,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,K=this.circleKeys[R];if(this._circleAndRectCollide(B[$],B[$+1],B[$+2],t,n,a,c)&&(!_||_(K))&&(!T||!be(w,K.overlapMode))){const re=B[$],N=B[$+1],te=B[$+2];if(m.push({key:K,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,K=this.boxKeys[R];if(this._circleAndRectCollide(x.x,x.y,x.radius,B[$+0],B[$+1],B[$+2],B[$+3])&&(!_||_(K))&&!be(w,K.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,K=this.circleKeys[R];if(this._circlesCollide(B[$],B[$+1],B[$+2],x.x,x.y,x.radius)&&(!_||_(K))&&!be(w,K.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 Ye(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 Pi(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 Qt(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 He(o,t){return .5+o/t*.5}function Tr(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 Er(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 K=!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 ui(o,t,n,a,c,p,m,y,_,x,T,w,k,O,B,R){const $=t/24,K=o.lineOffsetX*$,re=o.lineOffsetY*$;let N;if(o.numGlyphs>1){const te=o.glyphStartIndex+o.numGlyphs,oe=o.lineStartIndex,me=o.lineStartIndex+o.lineLength,_e=er($,y,K,re,n,T,w,o,_,p,k,B,R);if(!_e)return{notEnoughRoom:!0};const ve=Qt(_e.first.point,m,R).point,ge=Qt(_e.last.point,m,R).point;if(a&&!n){const Ce=Sr(o.writingMode,ve,ge,O);if(Ce)return Ce}N=[_e.first];for(let Ce=o.glyphStartIndex+1;Ce0?ve.point:St(w,_e,oe,1,c,R),Ce=Sr(o.writingMode,oe,ge,O);if(Ce)return Ce}const te=I($*y.getoffsetX(o.glyphStartIndex),K,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 St(o,t,n,a,c,p){const m=Qt(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=Qt(w,c,y);if(k.signedDistanceFromCamera>0)return n.projections[o]=k.point,k.point;const O=o-x;return St(m===0?p:new h.Point(a.getx(O),a.gety(O)),w,_,T-m+1,c,y)}function cr(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=cr(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 I(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 K,re,N=R>0?y+m:y+m+1,te=c,oe=c,me=0,_e=0;const ve=Math.abs(B),ge=[];let Ce;for(;me+_e<=ve;){if(N+=R,N=_)return null;me+=_e,oe=te,re=K;const Ee={projectionCache:w,lineVertexArray:x,labelPlaneMatrix:T,tileAnchorPoint:p,distanceFromAnchor:me,getElevation:O,previousVertex:oe,direction:R,absOffsetX:ve};if(te=Zn(N,Ee),n===0)ge.push(oe),Ce=te.sub(oe);else{let qe;const ke=te.sub(oe);qe=ke.mag()===0?cr(Zn(N+R,Ee).sub(te),n,R):cr(ke,n,R),re||(re=oe.add(qe)),K=V(N,qe,te,y,_,re,n,Ee),ge.push(re),Ce=K.sub(re)}_e=Ce.mag()}const Ue=Ce._mult((ve-me)/_e)._add(re||oe),Ke=$+Math.atan2(te.y-oe.y,te.x-oe.x);return ge.push(Ue),{point:Ue,angle:k?Ke:0,path:ge}}const M=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function L(o,t){for(let n=0;n=1;dt--)ke.push(Ee.path[dt]);for(let dt=1;dtQt(Je,_,B));ke=dt.some(Je=>Je.signedDistanceFromCamera<=0)?[]:dt.map(Je=>Je.point)}let qt=[];if(ke.length>0){const dt=ke[0].clone(),Je=ke[0].clone();for(let Ot=1;Ot=Ce.x&&Je.x<=Ue.x&&dt.y>=Ce.y&&Je.y<=Ue.y?[ke]:Je.xUe.x||Je.yUe.y?[]:h.clipLine([ke],Ce.x,Ce.y,Ue.x,Ue.y)}for(const dt of qt){Ke.reset(dt,.25*ge);let Je=0;Je=Ke.length<=.5*ge?1:Math.ceil(Ke.paddedLength/ut)+1;for(let Ot=0;Ot=this.screenRightBoundary||cthis.screenBottomBoundary}isInsideGrid(t,n,a,c){return a>=0&&t=0&&na.collisionGroupID===n}}return this.collisionGroups[t]}}function Xe(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=H(a,1,this.transform.zoom),R=Ye(w,k,O,this.transform,B);let $=null;if(k){const re=Pi(w,k,O,this.transform,B);$=h.multiply([],this.transform.labelPlaneMatrix,re)}this.retainedQueryData[p.bucketInstanceId]=new pe(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,a.tileID);const K={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:oe}=re;t.push({sortKey:N,symbolInstanceStart:te,symbolInstanceEnd:oe,parameters:K})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:p.symbolInstances.length,parameters:K})}attemptAnchorPlacement(t,n,a,c,p,m,y,_,x,T,w,k,O,B,R,$){const K=[k.textOffset0,k.textOffset1],re=Xe(t,a,c,K,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:K,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"),K=$==="always",re=h.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),N=re==="always",te=p.get("text-rotation-alignment")==="map",oe=p.get("text-pitch-alignment")==="map",me=p.get("icon-text-fit")!=="none",_e=p.get("symbol-z-order")==="viewport-y",ve=K&&(N||!c.hasIconData()||R),ge=N&&(K||!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,Ke=(Ee,qe)=>{if(n[Ee.crossTileID])return;if(T)return void(this.placements[Ee.crossTileID]=new he(!1,!1,!1));let ke=!1,ut=!1,qt=!0,dt=null,Je={box:null,offscreen:null},Ot={box:null,offscreen:null},wi=null,jt=null,si=null,Fi=0,ir=0,rr=0;qe.textFeatureIndex?Fi=qe.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(Fi=Ee.featureIndex),qe.verticalTextFeatureIndex&&(ir=qe.verticalTextFeatureIndex);const Ti=qe.textBox;if(Ti){const mi=ft=>{let ei=h.WritingMode.horizontal;if(c.allowVerticalPlacement&&!ft&&this.prevPlacement){const oi=this.prevPlacement.placedOrientations[Ee.crossTileID];oi&&(this.placedOrientations[Ee.crossTileID]=oi,ei=oi,this.markUsedOrientation(c,ei,Ee))}return ei},ai=(ft,ei)=>{if(c.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&qe.verticalTextBox){for(const oi of c.writingModes)if(oi===h.WritingMode.vertical?(Je=ei(),Ot=Je):Je=ft(),Je&&Je.box&&Je.box.length)break}else Je=ft()};if(p.get("text-variable-anchor")){let ft=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ee.crossTileID]){const gt=this.prevPlacement.variableOffsets[Ee.crossTileID];ft.indexOf(gt.anchor)>0&&(ft=ft.filter(ti=>ti!==gt.anchor),ft.unshift(gt.anchor))}const ei=(gt,ti,Oi)=>{const ea=gt.x2-gt.x1,Mr=gt.y2-gt.y1,nc=Ee.textBoxScale,ll=me&&re==="never"?ti:null;let At={box:[],offscreen:!1};const Qa=$!=="never"?2*ft.length:ft.length;for(let hs=0;hs=ft.length?$:"never",Ee,c,Oi,ll,Ue);if(Cr&&(At=Cr.placedGlyphBoxes,At&&At.box&&At.box.length)){ke=!0,dt=Cr.shift;break}}return At};ai(()=>ei(Ti,qe.iconBox,h.WritingMode.horizontal),()=>{const gt=qe.verticalTextBox;return c.allowVerticalPlacement&&!(Je&&Je.box&&Je.box.length)&&Ee.numVerticalGlyphVertices>0&>?ei(gt,qe.verticalIconBox,h.WritingMode.vertical):{box:null,offscreen:null}}),Je&&(ke=Je.box,qt=Je.offscreen);const oi=mi(Je&&Je.box);if(!ke&&this.prevPlacement){const gt=this.prevPlacement.variableOffsets[Ee.crossTileID];gt&&(this.variableOffsets[Ee.crossTileID]=gt,this.markUsedJustification(c,gt.anchor,Ee,oi))}}else{const ft=(ei,oi)=>{const gt=this.collisionIndex.placeCollisionBox(ei,$,x,m,O.predicate,Ue);return gt&>.box&>.box.length&&(this.markUsedOrientation(c,oi,Ee),this.placedOrientations[Ee.crossTileID]=oi),gt};ai(()=>ft(Ti,h.WritingMode.horizontal),()=>{const ei=qe.verticalTextBox;return c.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&ei?ft(ei,h.WritingMode.vertical):{box:null,offscreen:null}}),mi(Je&&Je.box&&Je.box.length)}}if(wi=Je,ke=wi&&wi.box&&wi.box.length>0,qt=wi&&wi.offscreen,Ee.useRuntimeCollisionCircles){const mi=c.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),ai=h.evaluateSizeForFeature(c.textSizeData,k,mi),ft=p.get("text-padding");jt=this.collisionIndex.placeCollisionCircles($,mi,c.lineVertexArray,c.glyphOffsetArray,ai,m,y,_,a,oe,O.predicate,Ee.collisionCircleDiameter,ft,Ue),jt.circles.length&&jt.collisionDetected&&!a&&h.warnOnce("Collisions detected, but collision boxes are not shown"),ke=K||jt.circles.length>0&&!jt.collisionDetected,qt=qt&&jt.offscreen}if(qe.iconFeatureIndex&&(rr=qe.iconFeatureIndex),qe.iconBox){const mi=ai=>{const ft=me&&dt?Le(ai,dt.x,dt.y,te,oe,this.transform.angle):ai;return this.collisionIndex.placeCollisionBox(ft,re,x,m,O.predicate,Ue)};Ot&&Ot.box&&Ot.box.length&&qe.verticalIconBox?(si=mi(qe.verticalIconBox),ut=si.box.length>0):(si=mi(qe.iconBox),ut=si.box.length>0),qt=qt&&si.offscreen}const gr=B||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,cs=R||Ee.numIconVertices===0;if(gr||cs?cs?gr||(ut=ut&&ke):ke=ut&&ke:ut=ke=ut&&ke,ke&&wi&&wi.box&&this.collisionIndex.insertCollisionBox(wi.box,$,p.get("text-ignore-placement"),c.bucketInstanceId,Ot&&Ot.box&&ir?ir:Fi,O.ID),ut&&si&&this.collisionIndex.insertCollisionBox(si.box,re,p.get("icon-ignore-placement"),c.bucketInstanceId,rr,O.ID),jt&&(ke&&this.collisionIndex.insertCollisionCircles(jt.circles,$,p.get("text-ignore-placement"),c.bucketInstanceId,Fi,O.ID),a)){const mi=c.bucketInstanceId;let ai=this.collisionCircleArrays[mi];ai===void 0&&(ai=this.collisionCircleArrays[mi]=new fe);for(let ft=0;ft=0;--qe){const ke=Ee[qe];Ke(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 K=0;K0,oe=this.placedOrientations[R.crossTileID],me=oe===h.WritingMode.vertical,_e=oe===h.WritingMode.horizontal||oe===h.WritingMode.horizontalOnly;if($>0||K>0){const ve=Ur(N.text);O(t.text,$,me?di:ve),O(t.text,K,_e?di:ve);const ge=N.text.isHidden();[R.rightJustifiedTextSymbolIndex,R.centerJustifiedTextSymbolIndex,R.leftJustifiedTextSymbolIndex].forEach(Ke=>{Ke>=0&&(t.text.placedSymbolArray.get(Ke).hidden=ge||me?1:0)}),R.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(R.verticalPlacedTextSymbolIndex).hidden=ge||_e?1:0);const Ce=this.variableOffsets[R.crossTileID];Ce&&this.markUsedJustification(t,Ce.anchor,R,oe);const Ue=this.placedOrientations[R.crossTileID];Ue&&(this.markUsedJustification(t,"left",R,Ue),this.markUsedOrientation(t,Ue,R))}if(te){const ve=Ur(N.icon),ge=!(w&&R.verticalPlacedIconSymbolIndex&&me);R.placedIconSymbolIndex>=0&&(O(t.icon,R.numIconVertices,ge?ve:di),t.icon.placedSymbolArray.get(R.placedIconSymbolIndex).hidden=N.icon.isHidden()),R.verticalPlacedIconSymbolIndex>=0&&(O(t.icon,R.numVerticalIconVertices,ge?di:ve),t.icon.placedSymbolArray.get(R.verticalPlacedIconSymbolIndex).hidden=N.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ve=t.collisionArrays[B];if(ve){let ge=new h.Point(0,0);if(ve.textBox||ve.verticalTextBox){let Ue=!0;if(_){const Ke=this.variableOffsets[re];Ke?(ge=Xe(Ke.anchor,Ke.width,Ke.height,Ke.textOffset,Ke.textBoxScale),x&&ge._rotate(T?this.transform.angle:-this.transform.angle)):Ue=!1}ve.textBox&&Ze(t.textCollisionBox.collisionVertexArray,N.text.placed,!Ue||me,ge.x,ge.y),ve.verticalTextBox&&Ze(t.textCollisionBox.collisionVertexArray,N.text.placed,!Ue||_e,ge.x,ge.y)}const Ce=!!(!_e&&ve.verticalIconBox);ve.iconBox&&Ze(t.iconCollisionBox.collisionVertexArray,N.icon.placed,Ce,w?ge.x:0,w?ge.y:0),ve.verticalIconBox&&Ze(t.iconCollisionBox.collisionVertexArray,N.icon.placed,!Ce,w?ge.x:0,w?ge.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 at=Math.pow(2,25),tt=Math.pow(2,24),ct=Math.pow(2,17),Tt=Math.pow(2,16),Xt=Math.pow(2,9),je=Math.pow(2,8),Lt=Math.pow(2,1);function Ur(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*at+t*tt+n*ct+t*Tt+n*Xt+t*je+n*Lt+t}const di=0;class Li{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 Li(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 gs{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 Wt{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 Nt=(o,t)=>h.emitValidationErrors(o,t&&t.filter(n=>n.identifier!=="source.canvas")),_s=h.pick(h.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),tr=h.pick(h.operations,["setCenter","setZoom","setBearing","setPitch"]),Io=h.emptyStyle();class pi extends h.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new bi(bn(),this,t._getMapId()),this.imageManager=new Zi,this.imageManager.setEventedParent(this),this.glyphManager=new vr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Br(256,512),this.crossTileSymbolIndex=new Vr,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=pi.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,et.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(Io,{validate:!1})}_load(t,n,a){const c=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!Nt(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 _=ni(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"),et.SpriteJSON),K=`${B}_${$.url}`;w[K]=h.getJSON($,(te,oe)=>{delete w[K],k[B]=oe,Vt(y,k,O,te,x)});const re=p.transformRequest(p.normalizeSpriteURL(R,T,".png"),et.SpriteImage),N=`${B}_${re.url}`;w[N]=Bt.getImage(re,(te,oe)=>{delete w[N],O[B]=oe,Vt(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,Nt(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 tr));if(c.length===0)return!1;const p=c.filter(m=>!(m.command in _s));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 Gt(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(Nt(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 ve=K.featureSortOrder;if(ve){const ge=ve.indexOf(me.featureIndex);return ve.indexOf(_e.featureIndex)-ge}return _e.featureIndex-me.featureIndex});for(const me of oe)te.push(me)}}for(const K in B)B[K].forEach(re=>{const N=re.feature,te=x[y[K].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 Wi(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=[...ni(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=ni(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 ni(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)))}}pi.getSourceType=function(o){return Fr[o]},pi.setSourceType=function(o,t){Fr[o]=t},pi.registerForPluginStateChange=h.registerForPluginStateChange;var _a=h.createLayout([{name:"a_pos",type:"Int16",components:2}]),ys="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 Nr={prelude:mt(`#ifdef GL_ES +var df=Object.defineProperty;var pf=(E,A,D)=>A in E?df(E,A,{enumerable:!0,configurable:!0,writable:!0,value:D}):E[A]=D;var Yc=(E,A,D)=>(pf(E,typeof A!="symbol"?A+"":A,D),D);(function(){const A=document.createElement("link").relList;if(A&&A.supports&&A.supports("modulepreload"))return;for(const te of document.querySelectorAll('link[rel="modulepreload"]'))N(te);new MutationObserver(te=>{for(const ie of te)if(ie.type==="childList")for(const de of ie.addedNodes)de.tagName==="LINK"&&de.rel==="modulepreload"&&N(de)}).observe(document,{childList:!0,subtree:!0});function D(te){const ie={};return te.integrity&&(ie.integrity=te.integrity),te.referrerPolicy&&(ie.referrerPolicy=te.referrerPolicy),te.crossOrigin==="use-credentials"?ie.credentials="include":te.crossOrigin==="anonymous"?ie.credentials="omit":ie.credentials="same-origin",ie}function N(te){if(te.ep)return;te.ep=!0;const ie=D(te);fetch(te.href,ie)}})();function fa(){}const ff=E=>E;function Ll(E,A){for(const D in A)E[D]=A[D];return E}function td(E){return E()}function Hu(){return Object.create(null)}function ps(E){E.forEach(td)}function nh(E){return typeof E=="function"}function sh(E,A){return E!=E?A==A:E!==A||E&&typeof E=="object"||typeof E=="function"}let kl;function vm(E,A){return kl||(kl=document.createElement("a")),kl.href=A,E===kl.href}function mf(E){return Object.keys(E).length===0}function id(E,...A){if(E==null){for(const N of A)N(void 0);return fa}const D=E.subscribe(...A);return D.unsubscribe?()=>D.unsubscribe():D}function bm(E){let A;return id(E,D=>A=D)(),A}function wm(E,A,D){E.$$.on_destroy.push(id(A,D))}function rd(E,A,D,N){if(E){const te=nd(E,A,D,N);return E[0](te)}}function nd(E,A,D,N){return E[1]&&N?Ll(D.ctx.slice(),E[1](N(A))):D.ctx}function sd(E,A,D,N){if(E[2]&&N){const te=E[2](N(D));if(A.dirty===void 0)return te;if(typeof te=="object"){const ie=[],de=Math.max(A.dirty.length,te.length);for(let h=0;h32){const A=[],D=E.ctx.length/32;for(let N=0;Nwindow.performance.now():()=>Date.now(),ah=ld?E=>requestAnimationFrame(E):fa;const da=new Set;function cd(E){da.forEach(A=>{A.c(E)||(da.delete(A),A.f())}),da.size!==0&&ah(cd)}function _f(E){let A;return da.size===0&&ah(cd),{promise:new Promise(D=>{da.add(A={c:E,f:D})}),abort(){da.delete(A)}}}function zl(E,A){E.appendChild(A)}function hd(E){if(!E)return document;const A=E.getRootNode?E.getRootNode():E.ownerDocument;return A&&A.host?A:E.ownerDocument}function yf(E){const A=wo("style");return A.textContent="/* empty */",xf(hd(E),A),A.sheet}function xf(E,A){return zl(E.head||E,A),A.sheet}function oh(E,A,D){E.insertBefore(A,D||null)}function Eo(E){E.parentNode&&E.parentNode.removeChild(E)}function Em(E,A){for(let D=0;DE.removeEventListener(A,D,N)}function Am(E){return function(A){return A.stopPropagation(),E.call(this,A)}}function pn(E,A,D){D==null?E.removeAttribute(A):E.getAttribute(A)!==D&&E.setAttribute(A,D)}const bf=["width","height"];function Yu(E,A){const D=Object.getOwnPropertyDescriptors(E.__proto__);for(const N in A)A[N]==null?E.removeAttribute(N):N==="style"?E.style.cssText=A[N]:N==="__value"?E.value=E[N]=A[N]:D[N]&&D[N].set&&bf.indexOf(N)===-1?E[N]=A[N]:pn(E,N,A[N])}function Pm(E){let A;return{p(...D){A=D,A.forEach(N=>E.push(N))},r(){A.forEach(D=>E.splice(E.indexOf(D),1))}}}function Mm(E){return E===""?null:+E}function wf(E){return Array.from(E.childNodes)}function Tf(E,A){A=""+A,E.data!==A&&(E.data=A)}function Cm(E,A){E.value=A??""}function km(E,A,D,N){D==null?E.style.removeProperty(A):E.style.setProperty(A,D,N?"important":"")}function zm(E,A,D){for(let N=0;N>>0}function Sf(E,A){const D={stylesheet:yf(A),rules:{}};return Bl.set(E,D),D}function Ju(E,A,D,N,te,ie,de,h=0){const ce=16.666/N;let Y=`{ +`;for(let bt=0;bt<=1;bt+=ce){const et=A+(D-A)*ie(bt);Y+=bt*100+`%{${de(et,1-et)}} +`}const Ne=Y+`100% {${de(D,1-D)}} +}`,xe=`__svelte_${Ef(Ne)}_${h}`,nt=hd(E),{stylesheet:ot,rules:We}=Bl.get(nt)||Sf(nt,E);We[xe]||(We[xe]=!0,ot.insertRule(`@keyframes ${xe} ${Ne}`,ot.cssRules.length));const xt=E.style.animation||"";return E.style.animation=`${xt?`${xt}, `:""}${xe} ${N}ms linear ${te}ms 1 both`,Rl+=1,xe}function If(E,A){const D=(E.style.animation||"").split(", "),N=D.filter(A?ie=>ie.indexOf(A)<0:ie=>ie.indexOf("__svelte")===-1),te=D.length-N.length;te&&(E.style.animation=N.join(", "),Rl-=te,Rl||Af())}function Af(){ah(()=>{Rl||(Bl.forEach(E=>{const{ownerNode:A}=E.stylesheet;A&&Eo(A)}),Bl.clear())})}let To;function bo(E){To=E}function So(){if(!To)throw new Error("Function called outside component initialization");return To}function Bm(E){So().$$.on_mount.push(E)}function Rm(E){So().$$.on_destroy.push(E)}function Fm(){const E=So();return(A,D,{cancelable:N=!1}={})=>{const te=E.$$.callbacks[A];if(te){const ie=dd(A,D,{cancelable:N});return te.slice().forEach(de=>{de.call(E,ie)}),!ie.defaultPrevented}return!0}}function Om(E,A){return So().$$.context.set(E,A),A}function Um(E){return So().$$.context.get(E)}function Pf(E,A){const D=E.$$.callbacks[A.type];D&&D.slice().forEach(N=>N.call(this,A))}const ua=[],eh=[];let pa=[];const th=[],Mf=Promise.resolve();let ih=!1;function Cf(){ih||(ih=!0,Mf.then(pd))}function Fl(E){pa.push(E)}function Vm(E){th.push(E)}const Jc=new Set;let ha=0;function pd(){if(ha!==0)return;const E=To;do{try{for(;haE.indexOf(N)===-1?A.push(N):D.push(N)),D.forEach(N=>N()),pa=A}let vo;function Df(){return vo||(vo=Promise.resolve(),vo.then(()=>{vo=null})),vo}function Qc(E,A,D){E.dispatchEvent(dd(`${A?"intro":"outro"}${D}`))}const Dl=new Set;let fn;function Nm(){fn={r:0,c:[],p:fn}}function $m(){fn.r||ps(fn.c),fn=fn.p}function Io(E,A){E&&E.i&&(Dl.delete(E),E.i(A))}function Vl(E,A,D,N){if(E&&E.o){if(Dl.has(E))return;Dl.add(E),fn.c.push(()=>{Dl.delete(E),N&&(D&&E.d(1),N())}),E.o(A)}else N&&N()}const Lf={duration:0};function qm(E,A,D,N){let ie=A(E,D,{direction:"both"}),de=N?0:1,h=null,ce=null,Y=null,Ne;function xe(){Y&&If(E,Y)}function nt(We,xt){const bt=We.b-de;return xt*=Math.abs(bt),{a:de,b:We.b,d:bt,duration:xt,start:We.start,end:We.start+xt,group:We.group}}function ot(We){const{delay:xt=0,duration:bt=300,easing:et=ff,tick:Bt=fa,css:pt}=ie||Lf,ri={start:gf()+xt,b:We};We||(ri.group=fn,fn.r+=1),"inert"in E&&(We?Ne!==void 0&&(E.inert=Ne):(Ne=E.inert,E.inert=!0)),h||ce?ce=ri:(pt&&(xe(),Y=Ju(E,de,We,bt,xt,et,pt)),We&&Bt(0,1),h=nt(ri,bt),Fl(()=>Qc(E,We,"start")),_f(Rt=>{if(ce&&Rt>ce.start&&(h=nt(ce,bt),ce=null,Qc(E,h.b,"start"),pt&&(xe(),Y=Ju(E,de,h.b,h.duration,0,et,ie.css))),h){if(Rt>=h.end)Bt(de=h.b,1-de),Qc(E,h.b,"end"),ce||(h.b?xe():--h.group.r||ps(h.group.c)),h=null;else if(Rt>=h.start){const Ai=Rt-h.start;de=h.a+h.d*et(Ai/h.duration),Bt(de,1-de)}}return!!(h||ce)}))}return{run(We){nh(ie)?Df().then(()=>{ie=ie({direction:We?"in":"out"}),ot(We)}):ot(We)},end(){xe(),h=ce=null}}}function jm(E){return(E==null?void 0:E.length)!==void 0?E:Array.from(E)}function Zm(E,A){Vl(E,1,1,()=>{A.delete(E.key)})}function Gm(E,A,D,N,te,ie,de,h,ce,Y,Ne,xe){let nt=E.length,ot=ie.length,We=nt;const xt={};for(;We--;)xt[E[We].key]=We;const bt=[],et=new Map,Bt=new Map,pt=[];for(We=ot;We--;){const Mt=xe(te,ie,We),Ct=D(Mt);let ni=de.get(Ct);ni?N&&pt.push(()=>ni.p(Mt,A)):(ni=Y(Ct,Mt),ni.c()),et.set(Ct,bt[We]=ni),Ct in xt&&Bt.set(Ct,Math.abs(We-xt[Ct]))}const ri=new Set,Rt=new Set;function Ai(Mt){Io(Mt,1),Mt.m(h,Ne),de.set(Mt.key,Mt),Ne=Mt.first,ot--}for(;nt&&ot;){const Mt=bt[ot-1],Ct=E[nt-1],ni=Mt.key,Vt=Ct.key;Mt===Ct?(Ne=Mt.first,nt--,ot--):et.has(Vt)?!de.has(ni)||ri.has(ni)?Ai(Mt):Rt.has(Vt)?nt--:Bt.get(ni)>Bt.get(Vt)?(Rt.add(ni),Ai(Mt)):(ri.add(Vt),nt--):(ce(Ct,de),nt--)}for(;nt--;){const Mt=E[nt];et.has(Mt.key)||ce(Mt,de)}for(;ot;)Ai(bt[ot-1]);return ps(pt),bt}function Bf(E,A){const D={},N={},te={$$scope:1};let ie=E.length;for(;ie--;){const de=E[ie],h=A[ie];if(h){for(const ce in de)ce in h||(N[ce]=1);for(const ce in h)te[ce]||(D[ce]=h[ce],te[ce]=1);E[ie]=h}else for(const ce in de)te[ce]=1}for(const de in N)de in D||(D[de]=void 0);return D}function Xm(E,A,D){const N=E.$$.props[A];N!==void 0&&(E.$$.bound[N]=D,D(E.$$.ctx[N]))}function Rf(E){E&&E.c()}function fd(E,A,D){const{fragment:N,after_update:te}=E.$$;N&&N.m(A,D),Fl(()=>{const ie=E.$$.on_mount.map(td).filter(nh);E.$$.on_destroy?E.$$.on_destroy.push(...ie):ps(ie),E.$$.on_mount=[]}),te.forEach(Fl)}function md(E,A){const D=E.$$;D.fragment!==null&&(zf(D.after_update),ps(D.on_destroy),D.fragment&&D.fragment.d(A),D.on_destroy=D.fragment=null,D.ctx=[])}function Ff(E,A){E.$$.dirty[0]===-1&&(ua.push(E),Cf(),E.$$.dirty.fill(0)),E.$$.dirty[A/31|0]|=1<{const We=ot.length?ot[0]:nt;return Y.ctx&&te(Y.ctx[xe],Y.ctx[xe]=We)&&(!Y.skip_bound&&Y.bound[xe]&&Y.bound[xe](We),Ne&&Ff(E,xe)),nt}):[],Y.update(),Ne=!0,ps(Y.before_update),Y.fragment=N?N(Y.ctx):!1,A.target){if(A.hydrate){const xe=wf(A.target);Y.fragment&&Y.fragment.l(xe),xe.forEach(Eo)}else Y.fragment&&Y.fragment.c();A.intro&&Io(E.$$.fragment),fd(E,A.target,A.anchor),pd()}bo(ce)}class hh{constructor(){Yc(this,"$$");Yc(this,"$$set")}$destroy(){md(this,1),this.$destroy=fa}$on(A,D){if(!nh(D))return fa;const N=this.$$.callbacks[A]||(this.$$.callbacks[A]=[]);return N.push(D),()=>{const te=N.indexOf(D);te!==-1&&N.splice(te,1)}}$set(A){this.$$set&&!mf(A)&&(this.$$.skip_bound=!0,this.$$set(A),this.$$.skip_bound=!1)}}const Of="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Of);var Uf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wm(E){return E&&E.__esModule&&Object.prototype.hasOwnProperty.call(E,"default")?E.default:E}function Hm(E){if(E.__esModule)return E;var A=E.default;if(typeof A=="function"){var D=function N(){if(this instanceof N){var te=[null];te.push.apply(te,arguments);var ie=Function.bind.apply(A,te);return new ie}return A.apply(this,arguments)};D.prototype=A.prototype}else D={};return Object.defineProperty(D,"__esModule",{value:!0}),Object.keys(E).forEach(function(N){var te=Object.getOwnPropertyDescriptor(E,N);Object.defineProperty(D,N,te.get?te:{enumerable:!0,get:function(){return E[N]}})}),D}var gd={exports:{}};(function(E,A){(function(D,N){E.exports=N()})(Uf,function(){var D,N,te;function ie(h,ce){if(!D)D=ce;else if(!N)N=ce;else{var Y="var sharedChunk = {}; ("+D+")(sharedChunk); ("+N+")(sharedChunk);",Ne={};D(Ne),te=ce(Ne),typeof window<"u"&&(te.workerUrl=window.URL.createObjectURL(new Blob([Y],{type:"text/javascript"})))}}ie(["exports"],function(h){function ce(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Y=Ne;function Ne(i,e){this.x=i,this.y=e}Ne.prototype={clone:function(){return new Ne(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}},Ne.convert=function(i){return i instanceof Ne?i:Array.isArray(i)?new Ne(i[0],i[1]):i};var xe=ce(Y),nt=ot;function ot(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}ot.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 We=ce(nt);function xt(i,e,r,s){const l=new We(i,e,r,s);return function(u){return l.solve(u)}}const bt=xt(.25,.1,.25,1);function et(i,e,r){return Math.min(r,Math.max(e,i))}function Bt(i,e,r){const s=r-e,l=((i-e)%s+s)%s+e;return l===e?r:l}function pt(i,...e){for(const r of e)for(const s in r)i[s]=r[s];return i}let ri=1;function Rt(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Ai(i,e,r){const s={};for(const l in i)s[l]=e.call(r||this,i[l],l,i);return s}function Mt(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 Ct(i){return Array.isArray(i)?i.map(Ct):typeof i=="object"&&i?Ai(i,Ct):i}const ni={};function Vt(i){ni[i]||(typeof console<"u"&&console.warn(i),ni[i]=!0)}function yt(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=>(gn||(gn=document.createElement("a")),gn.href=i,gn.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Hr==null&&(Hr=matchMedia("(prefers-reduced-motion: reduce)")),Hr.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 Br 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 bi=Zi()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Gi=i=>Nn.REGISTERED_PROTOCOLS[i.substring(0,i.indexOf("://"))];function hi(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:bi(),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 Br(d.status,d.statusText,i.url,f)))).catch(d=>{d.code!==20&&e(new Error(d.message))}),{cancel:()=>{u=!0,l||r.abort()}}}const yn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(Zi()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!Zi())return(Gi(i.url)||hi)(i,e)}if(!(/^file:/.test(r=i.url)||/^file:/.test(bi())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return hi(i,e);if(Zi()&&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 Br(u.status,u.statusText,s.url,d))}},u.send(s.body),{cancel:()=>u.abort()}}(i,e)},xn=function(i,e){return yn(pt(i,{type:"arrayBuffer"}),e)};function Kr(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 Rr(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function br(i,e,r){if(r&&r[i]){const s=r[i].indexOf(e);s!==-1&&r[i].splice(s,1)}}class wr{constructor(e,r={}){pt(this,r),this.type=e}}class Xi extends wr{constructor(e,r={}){super("error",pt({error:e},r))}}class vn{on(e,r){return this._listeners=this._listeners||{},Rr(e,r,this._listeners),this}off(e,r){return br(e,r,this._listeners),br(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},Rr(e,r,this._oneTimeListeners),this):new Promise(s=>this.once(e,s))}fire(e,r){typeof e=="string"&&(e=new wr(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)br(s,f,this._oneTimeListeners),f.call(this,e);const d=this._eventedParent;d&&(pt(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(e))}else e instanceof Xi&&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 Fr=["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 Fr.forEach(s=>{s in e&&(r[s]=e[s])}),r}function wt(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=[Or,be,Qe,Ye,Pi,Er,Qt,ui(He),er,Sr];function cr(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!cr(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(!cr(r,e))return null}}return`Expected ${St(i)} but found ${St(e)} instead.`}function V(i,e){return e.some(r=>r.kind===i.kind)}function I(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 M(i,e){return i.kind==="array"&&e.kind==="array"?i.itemType.kind===e.itemType.kind&&typeof i.N=="number":i.kind===e.kind}const L=.96422,j=.82521,Z=4/29,J=6/29,W=3*J*J,G=J*J*J,ee=Math.PI/180,ue=180/Math.PI;function fe(i){return(i%=360)<0&&(i+=360),i}function pe([i,e,r,s]){let l,u;const d=Xe((.2225045*(i=$e(i))+.7168786*(e=$e(e))+.0606169*(r=$e(r)))/1);i===e&&e===r?l=u=d:(l=Xe((.4360747*i+.3850649*e+.1430804*r)/L),u=Xe((.0139322*i+.0971045*e+.7141733*r)/j));const f=116*d-16;return[f<0?0:f,500*(l-d),200*(d-u),s]}function $e(i){return i<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Xe(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*Ge(l),u=L*Ge(u),d=j*Ge(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 Ge(i){return i>J?i*i*i:W*(i-Z)}function at(i){return parseInt(i.padEnd(2,i),16)/255}function tt(i,e){return ct(e?i/100:i,0,1)}function ct(i,e,r){return Math.min(Math.max(e,i),r)}function Tt(i){return!i.some(Number.isNaN)}const Xt={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 Ze{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 Ze)return e;if(typeof e!="string")return;const r=function(s){if((s=s.toLowerCase())==="transparent")return[0,0,0,0];const l=Xt[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[at(s.slice(f,f+=d)),at(s.slice(f,f+=d)),at(s.slice(f,f+=d)),at(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,S,P,C,z,U,F,K,Q]=d,X=[b||" ",C||" ",F].join("");if(X===" "||X===" /"||X===",,"||X===",,,"){const ne=[v,P,U].join(""),ae=ne==="%%%"?100:ne===""?255:0;if(ae){const he=[ct(+g/ae,0,1),ct(+S/ae,0,1),ct(+z/ae,0,1),K?tt(+K,Q):1];if(Tt(he))return he}}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,S,P,C,z]=u,U=[g||" ",b||" ",P].join("");if(U===" "||U===" /"||U===",,"||U===",,,"){const F=[+f,ct(+v,0,100),ct(+S,0,100),C?tt(+C,z):1];if(Tt(F))return function([K,Q,X,ne]){function ae(he){const ze=(he+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=fe(K),Q/=100,X/=100,[ae(0),ae(8),ae(4),ne]}(F)}}}(e);return r?new Ze(...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]=pe(e),d=Math.sqrt(s*s+l*l);return[Math.round(1e4*d)?fe(Math.atan2(l,s)*ue):NaN,d,r,u]}(this.rgb))}get lab(){return this.overwriteGetter("lab",pe(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})`}}Ze.black=new Ze(0,0,0,1),Ze.white=new Ze(1,1,1,1),Ze.transparent=new Ze(0,0,0,0),Ze.red=new Ze(1,0,0,1);class Lt{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 Ur{constructor(e,r,s,l,u){this.text=e,this.image=r,this.scale=s,this.fontStack=l,this.textColor=u}}class di{constructor(e){this.sections=e}static fromString(e){return new di([new Ur(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 di?e:di.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Li{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Li)return e;if(typeof e=="number")return new Li([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 Li(e)}}toString(){return JSON.stringify(this.values)}}class Wi{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Wi({name:e,available:!1}):null}}function Tn(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 Ze||i instanceof Lt||i instanceof di||i instanceof Li||i instanceof Wi)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 Wt(i){if(i===null)return Or;if(typeof i=="string")return Qe;if(typeof i=="boolean")return Ye;if(typeof i=="number")return be;if(i instanceof Ze)return Pi;if(i instanceof Lt)return Tr;if(i instanceof di)return Er;if(i instanceof Li)return er;if(i instanceof Wi)return Sr;if(Array.isArray(i)){const e=i.length;let r;for(const s of i){const l=Wt(s);if(r){if(r===l)continue;r=He;break}r=l}return ui(r||He,e)}return Qt}function Zn(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof Ze||i instanceof di||i instanceof Li||i instanceof Wi?i.toString():JSON.stringify(i)}class Vr{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=Wt(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 Vr(l,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Nt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const gs={string:Qe,number:be,boolean:Ye,object:Qt};class tr{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=He;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=ui(f,g)}else{if(!gs[u])throw new Error(`Types doesn't contain name = ${u}`);s=gs[u]}const d=[];for(;le.outputDefined())}}const Ao={"to-boolean":Ye,"to-color":Pi,"to-number":be,"to-string":Qe};class pi{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(!Ao[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=Ao[s],u=[];for(let d=1;d4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Tn(r[0],r[1],r[2],r[3]),!s))return new Ze(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Nt(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=Li.parse(r);if(l)return l}throw new Nt(`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 Nt(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?di.fromString(Zn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Wi.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]=Ze.parse(e)),r}}class Nr{constructor(e,r,s=[],l,u=new wn,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 tr(u,[l]):d==="coerce"?new pi(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 Vr)&&d.type.kind!=="resolvedImage"&&this._isConstant(d)){const f=new _s;try{d=new Vr(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 Nr(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 fi(s,e))}checkSubtype(e,r){const s=cr(e,r);return s&&this.error(s),s}}class mt{constructor(e,r,s){this.type=Tr,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,Ye);if(!l)return null;const u=r.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Ye);if(!u)return null;let d=null;return s.locale&&(d=r.parse(s.locale,1,Qe),!d)?null:new mt(l,u,d)}evaluate(e){return new Lt(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 $r=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 Po(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*$r),Math.round(s*l*$r)]}function Mo(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 Co(i,e){for(let r=0;r0&&f<0||d<0&&f>0}function ql(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 zo(i,e,r,s){const l=Math.pow(2,s.z)*$r,u=[s.x*$r,s.y*$r],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 Do(i,e,r,s){const l=Math.pow(2,s.z)*$r,u=[s.x*$r,s.y*$r],d=[];for(const g of i){const v=[];for(const b of g){const S=[b.x+u[0],b.y+u[1]];Gn(e,S),v.push(S)}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 Ir{constructor(e,r){this.type=Ye,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 Nr(r.registry,vs,r.path,null,r.scope);const S=[];let P=!1;for(let C=1;C{return P=S,Array.isArray(P)?`(${P.map(St).join(", ")})`:`(${St(P.type)}...)`;var P}).join(" | "),b=[];for(let S=1;S{r=e?r&&vs(s):r&&s instanceof Vr}),!!r&&Xn(i)&&bs(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Xn(i){if(i instanceof Hi&&(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 Ir)return!1;let e=!0;return i.eachChild(r=>{e&&!Xn(r)&&(e=!1)}),e}function En(i){if(i instanceof Hi&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!En(r)&&(e=!1)}),e}function bs(i,e){if(i instanceof Hi&&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 Nt("Input is not a number.");d=f-1}return 0}class Sn{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,be);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 S=r.parse(g,b,u);if(!S)return null;u=u||S.type,l.push([f,S])}return new Sn(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 In(i,e,r){return i+r*(e-i)}function Ts(i,e,r){return i.map((s,l)=>In(s,e[l],r))}const Bi={number:In,color:function(i,e,r,s="rgb"){switch(s){case"rgb":{const[l,u,d,f]=Ts(i.rgb,e.rgb,r);return new Ze(l,u,d,f,!1)}case"hcl":{const[l,u,d,f]=i.hcl,[g,v,b,S]=e.hcl;let P,C;if(isNaN(l)||isNaN(g))isNaN(l)?isNaN(g)?P=NaN:(P=g,d!==1&&d!==0||(C=v)):(P=l,b!==1&&b!==0||(C=u));else{let Q=g-l;g>l&&Q>180?Q-=360:g180&&(Q+=360),P=l+r*Q}const[z,U,F,K]=function([Q,X,ne,ae]){return Q=isNaN(Q)?0:Q*ee,Le([ne,Math.cos(Q)*X,Math.sin(Q)*X,ae])}([P,C??In(u,v,r),In(d,b,r),In(f,S,r)]);return new Ze(z,U,F,K,!1)}case"lab":{const[l,u,d,f]=Le(Ts(i.lab,e.lab,r));return new Ze(l,u,d,f,!1)}}},array:Ts,padding:function(i,e,r){return new Li(Ts(i.values,e.values,r))}};class Ri{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 We(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,be),!u)return null;const f=[];let g=null;s==="interpolate-hcl"||s==="interpolate-lab"?g=Pi: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.',P);const z=r.parse(S,C,g);if(!z)return null;g=g||z.type,f.push([b,z])}return M(g,be)||M(g,Pi)||M(g,er)||M(g,ui(be))?new Ri(g,s,l,u,f):r.error(`Type ${St(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=Ri.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 Bi[this.type.kind](g,v,f);case"interpolate-hcl":return Bi.color(g,v,f,"hcl");case"interpolate-lab":return Bi.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=>cr(l,f.type));return new Es(d?He: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 Wi&&!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 Nt(`Array index out of bounds: ${r} > ${s.length-1}.`);if(r!==Math.floor(r))throw new Nt(`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=Ye,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,He),l=r.parse(e[2],2,He);return s&&l?V(s.type,[Ye,Qe,be,Or,He])?new Wn(s,l):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(s.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!I(r,["boolean","string","number","null"]))throw new Nt(`Expected first argument to be of type boolean, string, number or null, but found ${St(Wt(r))} instead.`);if(!I(s,["string","array"]))throw new Nt(`Expected second argument to be of type array or string, but found ${St(Wt(s))} instead.`);return s.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class en{constructor(e,r,s){this.type=be,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,He),l=r.parse(e[2],2,He);if(!s||!l)return null;if(!V(s.type,[Ye,Qe,be,Or,He]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${St(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,be);return u?new en(s,l,u):null}return new en(s,l)}evaluate(e){const r=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!I(r,["boolean","string","number","null"]))throw new Nt(`Expected first argument to be of type boolean, string, number or null, but found ${St(Wt(r))} instead.`);if(!I(s,["string","array"]))throw new Nt(`Expected second argument to be of type array or string, but found ${St(Wt(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 ht{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 P.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof z=="number"&&Math.floor(z)!==z)return P.error("Numeric branch labels must be integer values.");if(s){if(P.checkSubtype(s,Wt(z)))return null}else s=Wt(z);if(u[String(z)]!==void 0)return P.error("Branch labels must be unique.");u[String(z)]=d.length}const C=r.parse(S,v,l);if(!C)return null;l=l||C.type,d.push(C)}const f=r.parse(e[1],1,He);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 ht(s,l,f,u,d,g):null}evaluate(e){const r=this.input.evaluate(e);return(Wt(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,He),l=r.parse(e[2],2,be);if(!s||!l)return null;if(!V(s.type,[ui(He),Qe,He]))return r.error(`Expected first argument to be of type array or string, but found ${St(s.type)} instead`);if(e.length===4){const u=r.parse(e[3],3,be);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(!I(r,["string","array"]))throw new Nt(`Expected first argument to be of type array or string, but found ${St(Wt(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 Lo(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 Bo(i,e,r,s){return s.compare(e,r)===0}function An(i,e,r){const s=i!=="=="&&i!=="!=";return class _d{constructor(u,d,f){this.type=Ye,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,He);if(!g)return null;if(!Lo(f,g.type))return d.concat(1).error(`"${f}" comparisons are not supported for type '${St(g.type)}'.`);let v=d.parse(u[2],2,He);if(!v)return null;if(!Lo(f,v.type))return d.concat(2).error(`"${f}" comparisons are not supported for type '${St(v.type)}'.`);if(g.type.kind!==v.type.kind&&g.type.kind!=="value"&&v.type.kind!=="value")return d.error(`Cannot compare types '${St(g.type)}' and '${St(v.type)}'.`);s&&(g.type.kind==="value"&&v.type.kind!=="value"?g=new tr(v.type,[g]):g.type.kind!=="value"&&v.type.kind==="value"&&(v=new tr(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,Tr),!b)return null}return new _d(g,v,b)}evaluate(u){const d=this.lhs.evaluate(u),f=this.rhs.evaluate(u);if(s&&this.hasUntypedArgument){const g=Wt(d),v=Wt(f);if(g.kind!==v.kind||g.kind!=="string"&&g.kind!=="number")throw new Nt(`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=Wt(d),v=Wt(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 Zl=An("==",function(i,e,r){return e===r},Bo),Gl=An("!=",function(i,e,r){return e!==r},function(i,e,r,s){return!Bo(0,e,r,s)}),Xl=An("<",function(i,e,r){return e",function(i,e,r){return e>r},function(i,e,r,s){return s.compare(e,r)>0}),Hl=An("<=",function(i,e,r){return e<=r},function(i,e,r,s){return s.compare(e,r)<=0}),Kl=An(">=",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=Qe,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,be);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,Qe),!u))return null;let d=null;if(l.currency&&(d=r.parse(l.currency,1,Qe),!d))return null;let f=null;if(l["min-fraction-digits"]&&(f=r.parse(l["min-fraction-digits"],1,be),!f))return null;let g=null;return l["max-fraction-digits"]&&(g=r.parse(l["max-fraction-digits"],1,be),!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=Er,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,be),!g))return null;let v=null;if(f["text-font"]&&(v=r.parse(f["text-font"],1,ui(Qe)),!v))return null;let b=null;if(f["text-color"]&&(b=r.parse(f["text-color"],1,Pi),!b))return null;const S=l[l.length-1];S.scale=g,S.font=v,S.textColor=b}else{const g=r.parse(e[d],1,He);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 di(this.sections.map(r=>{const s=r.content.evaluate(e);return Wt(s)===Sr?new Ur("",s,null,null,null):new Ur(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=Sr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const s=r.parse(e[1],1,Qe);return s?new Aa(s):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),s=Wi.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=be,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 ${St(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 Nt(`Expected value to be of type string or array, but found ${St(Wt(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Pn={"==":Zl,"!=":Gl,">":Wl,"<":Xl,">=":Kl,"<=":Hl,array:tr,at:Ea,boolean:tr,case:Sa,coalesce:Es,collator:mt,format:As,image:Aa,in:Wn,"index-of":en,interpolate:Ri,"interpolate-hcl":Ri,"interpolate-lab":Ri,length:Pa,let:Ss,literal:Vr,match:ht,number:tr,"number-format":Ia,object:tr,slice:Is,step:Sn,string:tr,"to-boolean":pi,"to-color":pi,"to-number":pi,"to-string":pi,var:xs,within:Ir};function Ro(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=Tn(e,r,s,u);if(d)throw new Nt(d);return new Ze(e/255,r/255,s/255,u,!1)}function Fo(i,e){return i in e}function Ma(i,e){const r=e[i];return r===void 0?null:r}function tn(i){return{type:i}}function Oo(i){return{result:"success",value:i}}function Mn(i){return{result:"error",value:i}}function Cn(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Uo(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Ca(i){return!!i.expression&&i.expression.interpolated}function _t(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 Yl(i){return i}function Vo(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?Ze.parse:Li.parse;(i=lr({},i)).stops&&(i.stops=i.stops.map(S=>[S[0],b(S[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=No;else if(u==="interval")f=ka;else if(u==="categorical"){f=Jl,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=Ql}if(s){const b={},S=[];for(let z=0;zz[0]),evaluate:({zoom:z},U)=>No({stops:P,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:Ri.interpolationFactor.bind(void 0,b),zoomStops:i.stops.map(S=>S[0]),evaluate:({zoom:S})=>f(i,e,S,g,v)}}return{kind:"source",evaluate(b,S){const P=S&&S.properties?S.properties[i.property]:void 0;return P===void 0?Hn(i.default,e.default):f(i,e,P,g,v)}}}function Hn(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Jl(i,e,r,s,l){return Hn(typeof r===l?s[r]:void 0,i.default,e.default)}function ka(i,e,r){if(_t(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 No(i,e,r){const s=i.base!==void 0?i.base:1;if(_t(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,S,P,C){const z=C-P,U=b-P;return z===0?0:S===1?U/z:(Math.pow(S,U)-1)/(Math.pow(S,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=Bi[e.type]||Yl;return typeof f.evaluate=="function"?{evaluate(...b){const S=f.evaluate.apply(void 0,b),P=g.evaluate.apply(void 0,b);if(S!==void 0&&P!==void 0)return v(S,P,d,i.colorSpace)}}:v(f,g,d,i.colorSpace)}function Ql(i,e,r){switch(e.type){case"color":r=Ze.parse(r);break;case"formatted":r=di.fromString(r.toString());break;case"resolvedImage":r=Wi.fromString(r.toString());break;case"padding":r=Li.parse(r);break;default:_t(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return Hn(r,i.default,e.default)}Hi.register(Pn,{error:[{kind:"error"},[Qe],(i,[e])=>{throw new Nt(e.evaluate(i))}],typeof:[Qe,[He],(i,[e])=>St(Wt(e.evaluate(i)))],"to-rgba":[ui(be,4),[Pi],(i,[e])=>{const[r,s,l,u]=e.evaluate(i).rgb;return[255*r,255*s,255*l,u]}],rgb:[Pi,[be,be,be],Ro],rgba:[Pi,[be,be,be,be],Ro],has:{type:Ye,overloads:[[[Qe],(i,[e])=>Fo(e.evaluate(i),i.properties())],[[Qe,Qt],(i,[e,r])=>Fo(e.evaluate(i),r.evaluate(i))]]},get:{type:He,overloads:[[[Qe],(i,[e])=>Ma(e.evaluate(i),i.properties())],[[Qe,Qt],(i,[e,r])=>Ma(e.evaluate(i),r.evaluate(i))]]},"feature-state":[He,[Qe],(i,[e])=>Ma(e.evaluate(i),i.featureState||{})],properties:[Qt,[],i=>i.properties()],"geometry-type":[Qe,[],i=>i.geometryType()],id:[He,[],i=>i.id()],zoom:[be,[],i=>i.globals.zoom],"heatmap-density":[be,[],i=>i.globals.heatmapDensity||0],"line-progress":[be,[],i=>i.globals.lineProgress||0],accumulated:[He,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[be,tn(be),(i,e)=>{let r=0;for(const s of e)r+=s.evaluate(i);return r}],"*":[be,tn(be),(i,e)=>{let r=1;for(const s of e)r*=s.evaluate(i);return r}],"-":{type:be,overloads:[[[be,be],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[be],(i,[e])=>-e.evaluate(i)]]},"/":[be,[be,be],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[be,[be,be],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[be,[],()=>Math.LN2],pi:[be,[],()=>Math.PI],e:[be,[],()=>Math.E],"^":[be,[be,be],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[be,[be],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[be,[be],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[be,[be],(i,[e])=>Math.log(e.evaluate(i))],log2:[be,[be],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[be,[be],(i,[e])=>Math.sin(e.evaluate(i))],cos:[be,[be],(i,[e])=>Math.cos(e.evaluate(i))],tan:[be,[be],(i,[e])=>Math.tan(e.evaluate(i))],asin:[be,[be],(i,[e])=>Math.asin(e.evaluate(i))],acos:[be,[be],(i,[e])=>Math.acos(e.evaluate(i))],atan:[be,[be],(i,[e])=>Math.atan(e.evaluate(i))],min:[be,tn(be),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[be,tn(be),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[be,[be],(i,[e])=>Math.abs(e.evaluate(i))],round:[be,[be],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[be,[be],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[be,[be],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[Qe,He],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[He],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[Qe],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[Qe,He],(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":[Ye,[Qe,He],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>l}],"filter-id->":[Ye,[He],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>s}],"filter-<=":[Ye,[Qe,He],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s<=l}],"filter-id-<=":[Ye,[He],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r<=s}],"filter->=":[Ye,[Qe,He],(i,[e,r])=>{const s=i.properties()[e.value],l=r.value;return typeof s==typeof l&&s>=l}],"filter-id->=":[Ye,[He],(i,[e])=>{const r=i.id(),s=e.value;return typeof r==typeof s&&r>=s}],"filter-has":[Ye,[He],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[ui(Qe)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[ui(He)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[Qe,ui(He)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[Qe,ui(He)],(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:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[tn(Ye),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[tn(Ye),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ye,[Ye],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ye,[Qe],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[Qe,[Qe],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[Qe,[Qe],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[Qe,tn(He),(i,e)=>e.map(r=>Zn(r.evaluate(i))).join("")],"resolved-locale":[Qe,[Tr],(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 Ze(0,0,0,0):s.type==="color"?Ze.parse(s.default)||null:s.type==="padding"?Li.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 Nt(`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 Pn}function Dt(i,e){const r=new Nr(Pn,vs,[],e?function(l){const u={color:Pi,string:Qe,number:be,enum:Qe,boolean:Ye,formatted:Er,padding:er,resolvedImage:Sr};return l.type==="array"?ui(u[l.value]||He,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?Oo(new za(s,e)):Mn(r.errors)}class Da{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!En(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 st{constructor(e,r,s,l){this.kind=e,this.zoomStops=s,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!En(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?Ri.interpolationFactor(this.interpolationType,e,r,s):0}}function Cs(i,e){const r=Dt(i,e);if(r.result==="error")return r;const s=r.value.expression,l=Xn(s);if(!l&&!Cn(e))return Mn([new fi("","data expressions not supported")]);const u=bs(s,["zoom"]);if(!u&&!Uo(e))return Mn([new fi("","zoom expressions not supported")]);const d=Et(s);return d||u?d instanceof fi?Mn([d]):d instanceof Ri&&!Ca(e)?Mn([new fi("",'"interpolate" expressions cannot be used with this property')]):Oo(d?new st(l?"camera":"composite",r.value,d.labels,d instanceof Ri?d.interpolation:void 0):new Da(l?"constant":"source",r.value)):Mn([new fi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class It{constructor(e,r){this._parameters=e,this._specification=r,lr(this,Vo(this._parameters,this._specification))}static deserialize(e){return new It(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Et(i){let e=null;if(i instanceof Ss)e=Et(i.result);else if(i instanceof Es){for(const r of i.args)if(e=Et(r),e)break}else(i instanceof Sn||i instanceof Ri)&&i.input instanceof Hi&&i.input.name==="zoom"&&(e=i);return e instanceof fi||i.eachChild(r=>{const s=Et(r);s instanceof fi?e=s:!e&&s?e=new fi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new fi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function kn(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(!kn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const $o={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};kn(i)||(i=ks(i));const e=Dt(i,$o);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:qo(i)}}function ec(i,e){return ie?1:0}function qo(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(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 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(ec)]]:["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 we(e,r,`${r} is greater than the maximum value ${s.maximum}`)]:[]}function Go(i){const e=i.valueSpec,r=$t(i.value.type);let s,l,u,d={};const f=r!=="categorical"&&i.value.property===void 0,g=!f,v=_t(i.value.stops)==="array"&&_t(i.value.stops[0])==="array"&&_t(i.value.stops[0][0])==="object",b=Ki({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 we(C.key,C.value,'identity function may not have a "stops" property')];let z=[];const U=C.value;return z=z.concat(Zo({key:C.key,value:U,valueSpec:C.valueSpec,validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,arrayElementValidator:S})),_t(U)==="array"&&U.length===0&&z.push(new we(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 we(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||b.push(new we(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!Ca(i.valueSpec)&&b.push(new we(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Cn(i.valueSpec)?b.push(new we(i.key,i.value,"property functions not supported")):f&&!Uo(i.valueSpec)&&b.push(new we(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!v||i.value.property!==void 0||b.push(new we(i.key,i.value,'"property" property is required')),b;function S(C){let z=[];const U=C.value,F=C.key;if(_t(U)!=="array")return[new we(F,U,`array expected, ${_t(U)} found`)];if(U.length!==2)return[new we(F,U,`array length 2 expected, length ${U.length} found`)];if(v){if(_t(U[0])!=="object")return[new we(F,U,`object expected, ${_t(U[0])} found`)];if(U[0].zoom===void 0)return[new we(F,U,"object stop key must have zoom")];if(U[0].value===void 0)return[new we(F,U,"object stop key must have value")];if(u&&u>$t(U[0].zoom))return[new we(F,U[0].zoom,"stop zoom values must appear in ascending order")];$t(U[0].zoom)!==u&&(u=$t(U[0].zoom),l=void 0,d={}),z=z.concat(Ki({key:`${F}[0]`,value:U[0],valueSpec:{zoom:{}},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec,objectElementValidators:{zoom:Fa,value:P}}))}else z=z.concat(P({key:`${F}[0]`,value:U[0],valueSpec:{},validateSpec:C.validateSpec,style:C.style,styleSpec:C.styleSpec},U));return Ms(rn(U[1]))?z.concat([new we(`${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 P(C,z){const U=_t(C.value),F=$t(C.value),K=C.value!==null?C.value:z;if(s){if(U!==s)return[new we(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 we(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 Cn(e)&&r===void 0&&(Q+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new we(C.key,K,Q)]}return r!=="categorical"||U!=="number"||isFinite(F)&&Math.floor(F)===F?r!=="categorical"&&U==="number"&&l!==void 0&&Fnew we(`${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 we(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"&&!En(r))return[new we(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!En(r))return[new we(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 we(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!Xn(r))return[new we(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($t(r))===-1&&l.push(new we(e,r,`expected one of [${s.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(s.values).indexOf($t(r))===-1&&l.push(new we(e,r,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(r)} found`)),l}function zn(i){return kn(rn(i.value))?nn(lr({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Xo(i)}function Xo(i){const e=i.value,r=i.key;if(_t(e)!=="array")return[new we(r,e,`array expected, ${_t(e)} found`)];const s=i.styleSpec;let l,u=[];if(e.length<1)return[new we(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})),$t(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&$t(e[1])==="$type"&&u.push(new we(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&u.push(new we(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(l=_t(e[1]),l!=="string"&&u.push(new we(`${r}[1]`,e[1],`string expected, ${l} found`)));for(let d=2;d{v in r&&e.push(new we(s,r[v],`"${v}" is prohibited for ref layers`))}),l.layers.forEach(v=>{$t(v.id)===f&&(g=v)}),g?g.ref?e.push(new we(s,r.ref,"ref cannot reference another ref layer")):d=$t(g.type):e.push(new we(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&&$t(g.type);g?v==="vector"&&d==="raster"?e.push(new we(s,r.source,`layer "${r.id}" requires a raster source`)):v==="raster"&&d!=="raster"?e.push(new we(s,r.source,`layer "${r.id}" requires a vector source`)):v!=="vector"||r["source-layer"]?v==="raster-dem"&&d!=="hillshade"?e.push(new we(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 we(s,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new we(s,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new we(s,r.source,`source "${r.source}" not found`))}else e.push(new we(s,r,'missing required property "source"'));return e=e.concat(Ki({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=>Ki({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Wo(lr({layerType:d},v))}}),paint:g=>Ki({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,validateSpec:g.validateSpec,objectElementValidators:{"*":v=>Ua(lr({layerType:d},v))}})}})),e}function hr(i){const e=i.value,r=i.key,s=_t(e);return s!=="string"?[new we(r,e,`string expected, ${s} found`)]:[]}const Ls={promoteId:function({key:i,value:e}){if(_t(e)==="string")return hr({key:i,value:e});{const r=[];for(const s in e)r.push(...hr({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 we(r,e,'"type" is required')];const d=$t(e.type);let f;switch(d){case"vector":case"raster":case"raster-dem":return f=Ki({key:r,value:e,valueSpec:s[`source_${d.replace("-","_")}`],style:i.style,styleSpec:s,objectElementValidators:Ls,validateSpec:u}),f;case"geojson":if(f=Ki({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],S=typeof v=="string"?[v,["accumulated"],["get",g]]:v;f.push(...nn({key:`${r}.${g}.map`,value:b,validateSpec:u,expressionContext:"cluster-map"})),f.push(...nn({key:`${r}.${g}.reduce`,value:S,validateSpec:u,expressionContext:"cluster-reduce"}))}return f;case"video":return Ki({key:r,value:e,valueSpec:s.source_video,style:l,validateSpec:u,styleSpec:s});case"image":return Ki({key:r,value:e,valueSpec:s.source_image,style:l,validateSpec:u,styleSpec:s});case"canvas":return[new we(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 Ho(i){const e=i.value,r=i.styleSpec,s=r.light,l=i.style;let u=[];const d=_t(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new we("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 we(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=_t(e);if(e===void 0)return u;if(d!=="object")return u=u.concat([new we("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 we(f,e[f],`unknown property "${f}"`)]);return u}function Ko(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 we(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 we(s,r,`all the sprites' URLs must be unique, but ${r[d].url} is duplicated`)),u.push(r[d].url),e=e.concat(Ki({key:`${s}[${d}]`,value:r[d],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:i.validateSpec}));return e}return hr({key:s,value:r})}const Yo={"*":()=>[],array:Zo,boolean:function(i){const e=i.value,r=i.key,s=_t(e);return s!=="boolean"?[new we(r,e,`boolean expected, ${s} found`)]:[]},number:Fa,color:function(i){const e=i.key,r=i.value,s=_t(r);return s!=="string"?[new we(e,r,`color expected, ${s} found`)]:Ze.parse(String(r))?[]:[new we(e,r,`color expected, "${r}" found`)]},constants:jo,enum:Jn,filter:zn,function:Go,layer:Ds,object:Ki,source:Bs,light:Ho,terrain:Qn,string:hr,formatted:function(i){return hr(i).length===0?[]:nn(i)},resolvedImage:function(i){return hr(i).length===0?[]:nn(i)},padding:function(i){const e=i.key,r=i.value;if(_t(r)==="array"){if(r.length<1||r.length>4)return[new we(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(jo({key:"constants",value:i.constants,style:i,styleSpec:e,validateSpec:es}))),ts(r)}function Yi(i){return function(e){return i({...e,validateSpec:es})}}function ts(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function Ht(i){return function(...e){return ts(i.apply(this,e))}}ur.source=Ht(Yi(Bs)),ur.sprite=Ht(Yi(Ko)),ur.glyphs=Ht(Yi(Jo)),ur.light=Ht(Yi(Ho)),ur.terrain=Ht(Yi(Qn)),ur.layer=Ht(Yi(Ds)),ur.filter=Ht(Yi(zn)),ur.paintProperty=Ht(Yi(Ua)),ur.layoutProperty=Ht(Yi(Wo));const qr=ur,ic=qr.light,rc=qr.paintProperty,nc=qr.layoutProperty;function Dn(i,e){let r=!1;if(e&&e.length)for(const s of e)i.fire(new Xi(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=S[z+0]&&l>=S[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),S=this._convertToCellCoord(s),P=this._convertToCellCoord(l);for(let C=v;C<=S;C++)for(let z=b;z<=P;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]=dr[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 Ar(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)||Wr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Ar);if(typeof i=="object"){const e=i.$name||"Object";if(!dr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=dr[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]=dr[e].shallow.indexOf(l)>=0?u:Ar(u)}return s}throw new Error("can't deserialize object of type "+typeof i)}class Qo{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(!el(e.charCodeAt(0)))return!1;return!0}function el(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 tl(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 il(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,Mi="unavailable",jr=null;const rl=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Mi="error"),ns&&ns(i)};function qa(){$s.fire(new wr("pluginStateChange",{pluginStatus:Mi,pluginURL:jr}))}const $s=new vn,ja=function(){return Mi},nl=function(){if(Mi!==Na||!jr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Mi=Ns,qa(),jr&&xn({url:jr},i=>{i?rl(i):(Mi=$a,qa())})},Ji={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Mi===$a||Ji.applyArabicShaping!=null,isLoading:()=>Mi===Ns,setState(i){if(!Zi())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Mi=i.pluginStatus,jr=i.pluginURL},isParsed(){if(!Zi())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Ji.applyArabicShaping!=null&&Ji.processBidirectionalText!=null&&Ji.processStyledBidirectionalText!=null},getPluginURL(){if(!Zi())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return jr}};class kt{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 Qo,this.transition={})}isSupportedScript(e){return function(r,s){for(const l of r)if(!Vs(l.charCodeAt(0),s))return!1;return!0}(e,Ji.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 It(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=Ze.parse(s):l.type!=="padding"||typeof s!="number"&&!Array.isArray(s)||(u=Li.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,pt({},e.transition,this.transition),e.now)}untransitioned(){return new ss(this.property,this.value,null,{},0)}}class sl{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ct(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:Ct(r))}getTransition(e){return Ct(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=Ct(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 al(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 al(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 al{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 Ct(this._values[e].value)}setValue(e,r){this._values[e]=new qs(this._values[e].property,r===null?void 0:Ct(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 pr{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=Bi[this.specification.type];return l?l(e,r,s):e}}class qe{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,s,l){return new pr(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 pr(this,{kind:"constant",value:void 0},e.parameters);const l=Bi[this.specification.type];if(l){const u=l(e.value.value,r.value.value,s);return new pr(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 qe{possiblyEvaluate(e,r,s,l){if(e.value===void 0)return new pr(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 pr(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 pr(this,{kind:"constant",value:u},r)}return new pr(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 kt(Math.floor(r.zoom-1),r)),e.expression.evaluate(new kt(Math.floor(r.zoom),r)),e.expression.evaluate(new kt(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 Ci{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",qe),De("DataConstantProperty",Fe),De("CrossFadedDataDrivenProperty",as),De("CrossFadedProperty",Xa),De("ColorRampProperty",Wa);const ol="-transition";class fr extends vn{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 sl(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(nc,`layers.${this.id}.layout.${e}`,e,r,s)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(ol)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,s={}){if(r!=null&&this._validate(rc,`layers.${this.id}.paint.${e}`,e,r,s))return!1;if(e.endsWith(ol))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),Mt(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)&&Dn(this,e.call(qr,{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 pr&&Cn(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const sc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Pr{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 Ft{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 Kt(i,e=1){let r=0,s=0;return{members:i.map(l=>{const u=sc[l.type].BYTES_PER_ELEMENT,d=r=ll(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:ll(r,Math.max(s,e)),alignment:e}}function ll(i,e){return Math.ceil(i/e)*e}class Ln extends Ft{_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}}Ln.prototype.bytesPerElement=4,De("StructArrayLayout2i4",Ln);class Zs extends Ft{_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 Ft{_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 mr extends Ft{_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}}mr.prototype.bytesPerElement=12,De("StructArrayLayout2i4i12",mr);class Gs extends Ft{_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 sn extends Ft{_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}}sn.prototype.bytesPerElement=8,De("StructArrayLayout2f8",sn);class Xs extends Ft{_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 S=this.length;return this.resize(S+1),this.emplace(S,e,r,s,l,u,d,f,g,v,b)}emplace(e,r,s,l,u,d,f,g,v,b,S){const P=10*e;return this.uint16[P+0]=r,this.uint16[P+1]=s,this.uint16[P+2]=l,this.uint16[P+3]=u,this.uint16[P+4]=d,this.uint16[P+5]=f,this.uint16[P+6]=g,this.uint16[P+7]=v,this.uint16[P+8]=b,this.uint16[P+9]=S,e}}Xs.prototype.bytesPerElement=20,De("StructArrayLayout10ui20",Xs);class os extends Ft{_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,S,P){const C=this.length;return this.resize(C+1),this.emplace(C,e,r,s,l,u,d,f,g,v,b,S,P)}emplace(e,r,s,l,u,d,f,g,v,b,S,P,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]=S,this.int16[z+10]=P,this.int16[z+11]=C,e}}os.prototype.bytesPerElement=24,De("StructArrayLayout4i4ui4i24",os);class Ka extends Ft{_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 Bn extends Ft{_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}}Bn.prototype.bytesPerElement=4,De("StructArrayLayout1ul4",Bn);class an extends Ft{_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 S=10*e,P=5*e;return this.int16[S+0]=r,this.int16[S+1]=s,this.int16[S+2]=l,this.int16[S+3]=u,this.int16[S+4]=d,this.int16[S+5]=f,this.uint32[P+3]=g,this.uint16[S+8]=v,this.uint16[S+9]=b,e}}an.prototype.bytesPerElement=20,De("StructArrayLayout6i1ul2ui20",an);class Ya extends Ft{_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 Ft{_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 on extends Ft{_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}}on.prototype.bytesPerElement=12,De("StructArrayLayout2ub2f12",on);class Hs extends Ft{_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 Ft{_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,S,P,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,S,P,C,z,U,F,K)}emplace(e,r,s,l,u,d,f,g,v,b,S,P,C,z,U,F,K,Q){const X=24*e,ne=12*e,ae=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[ne+2]=d,this.uint32[ne+3]=f,this.uint32[ne+4]=g,this.uint16[X+10]=v,this.uint16[X+11]=b,this.uint16[X+12]=S,this.float32[ne+7]=P,this.float32[ne+8]=C,this.uint8[ae+36]=z,this.uint8[ae+37]=U,this.uint8[ae+38]=F,this.uint32[ne+10]=K,this.int16[X+22]=Q,e}}Ja.prototype.bytesPerElement=48,De("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ja);class Ks extends Ft{_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,S,P,C,z,U,F,K,Q,X,ne,ae,he,ze,Be,Pe,Se,Te,Me){const Ie=this.length;return this.resize(Ie+1),this.emplace(Ie,e,r,s,l,u,d,f,g,v,b,S,P,C,z,U,F,K,Q,X,ne,ae,he,ze,Be,Pe,Se,Te,Me)}emplace(e,r,s,l,u,d,f,g,v,b,S,P,C,z,U,F,K,Q,X,ne,ae,he,ze,Be,Pe,Se,Te,Me,Ie){const ye=34*e,Ve=17*e;return this.int16[ye+0]=r,this.int16[ye+1]=s,this.int16[ye+2]=l,this.int16[ye+3]=u,this.int16[ye+4]=d,this.int16[ye+5]=f,this.int16[ye+6]=g,this.int16[ye+7]=v,this.uint16[ye+8]=b,this.uint16[ye+9]=S,this.uint16[ye+10]=P,this.uint16[ye+11]=C,this.uint16[ye+12]=z,this.uint16[ye+13]=U,this.uint16[ye+14]=F,this.uint16[ye+15]=K,this.uint16[ye+16]=Q,this.uint16[ye+17]=X,this.uint16[ye+18]=ne,this.uint16[ye+19]=ae,this.uint16[ye+20]=he,this.uint16[ye+21]=ze,this.uint16[ye+22]=Be,this.uint32[Ve+12]=Pe,this.float32[Ve+13]=Se,this.float32[Ve+14]=Te,this.float32[Ve+15]=Me,this.float32[Ve+16]=Ie,e}}Ks.prototype.bytesPerElement=68,De("StructArrayLayout8i15ui1ul4f68",Ks);class Ys extends Ft{_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 Ft{_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 Ft{_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 Ft{_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 Ft{_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 Pr{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 xe(this.anchorPointX,this.anchorPointY)}}a.prototype.size=20;class c extends an{get(e){return new a(this,e)}}De("CollisionBoxArray",c);class p extends Pr{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 Pr{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 Pr{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 Ln{}class B extends Ln{}class R extends Ln{}class q extends mr{}class H extends Gs{}class se extends sn{}class $ extends Xs{}class re extends os{}class oe extends Ka{}class me extends Bn{}class _e extends Ya{}class ve extends on{}class ge extends Hs{}class Ce extends o{}const Ue=Kt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ke}=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&&Vt(`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 je(i,e){return 256*(i=et(Math.floor(i),0,255))+et(Math.floor(e),0,255)}Ee.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,De("SegmentVector",Ee);const ke=Kt([{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 ut={exports:{}},qt={exports:{}};qt.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 dt=qt.exports,Je={exports:{}};Je.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 Ot=dt,wi=Je.exports;ut.exports=Ot,ut.exports.murmur3=Ot,ut.exports.murmur2=wi;var jt=ce(ut.exports);class si{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,s,l){this.ids.push(Fi(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=Fi(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 ir(s,l,0,s.length-1),r&&r.push(s.buffer,l.buffer),{ids:s,positions:l}}static deserialize(e){const r=new si;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Fi(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:jt(String(i))}function ir(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;rr(i,u,d),rr(e,3*u,3*d),rr(e,3*u+1,3*d+1),rr(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 mi(e,r):new gr(e,r)}}class oi{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 gr(e,r)}}class gt{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 kt(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=ft(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 kt(this.zoom),r,{},l,[],u),f=this.expression.evaluate(new kt(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=ft(s),d=ft(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 gt||s instanceof ti)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 si,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 ac(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 cl(i,e,r){const s={color:{source:sn,composite:n},number:{source:Ys,composite:sn}},l=function(u){return{"line-pattern":{source:$,composite:$},"fill-pattern":{source:$,composite:$},"fill-extrusion-pattern":{source:$,composite:$}}[u]}(i);return l&&l[r]||s[e][r]}De("ConstantBinder",ei),De("CrossFadedConstantBinder",oi),De("SourceExpressionBinder",gt),De("CrossFadedCompositeBinder",Oi),De("CompositeExpressionBinder",ti),De("ProgramConfiguration",Qs,{omit:["_buffers"]}),De("ProgramConfigurationSet",Mr);var At=8192;const Qa=Math.pow(2,14)-1,cs=-Qa-1;function Cr(i){const e=At/i.extent,r=i.loadGeometry();for(let s=0;sd.x+1||gd.y+1)&&Vt("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?Cr(i):[]}}function hl(i,e,r,s,l){i.emplaceBack(2*e+(s+1)/2,2*r+(l+1)/2)}class oc{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 ge,this.segments=new Ee,this.programConfigurations=new Mr(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:S}of e){const P=this.layers[0]._featureFilter.needGeometry,C=hs(g,P);if(!this.layers[0]._featureFilter.filter(new kt(this.zoom),C,s))continue;const z=f?d.evaluate(C,{},s):void 0,U={id:v,properties:g.properties,type:g.type,sourceLayerIndex:S,index:b,geometry:P?C.geometry:Cr(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:S}=g,P=e[b].feature;this.addFeature(g,v,b,s),r.featureIndex.insert(P,v,b,S,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,Ke),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>=At||g<0||g>=At)continue;const v=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),b=v.vertexLength;hl(this.layoutVertexArray,f,g,-1,-1),hl(this.layoutVertexArray,f,g,1,-1),hl(this.layoutVertexArray,f,g,1,1),hl(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 yh(i,e){for(let r=0;r1){if(lc(i,e))return!0;for(let s=0;s1?r:r.sub(e)._mult(l)._add(e))}function bh(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 kd(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=yt(i,e,r[0]);return u!==yt(i,e,r[1])||u!==yt(i,e,r[2])||u!==yt(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 ul(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function dl(i,e,r,s,l){if(!e[0]&&!e[1])return i;const u=xe.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(P,C,r,s,l,v,0),C}function kh(i,e,r,s,l){var u,d;if(l===gc(i,e,r,s)>0)for(u=e;u=e;u-=s)d=Lh(u,i[u],i[u+1],d);return d&&ml(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||!ml(s,s.next)&&Zt(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,S,P,C){var z=b;do z.z===0&&(z.z=fc(z.x,z.y,S,P,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,ne,ae,he,ze,Be=1;do{for(K=U,U=null,ne=null,ae=0;K;){for(ae++,Q=K,he=0,F=0;F0||ze>0&&Q;)he!==0&&(ze===0||!Q||K.z<=Q.z)?(X=K,K=K.nextZ,he--):(X=Q,Q=Q.nextZ,ze--),ne?ne.nextZ=X:U=X,X.prevZ=ne,ne=X;K=Q}ne.nextZ=null,Be*=2}while(ae>1)}(z)}(i,s,l,u);for(var f,g,v=i;i.prev!==i.next;)if(f=i.prev,g=i.next,u?Ud(i,s,l,u):Od(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=Vd(us(i),e,r),e,r,s,l,u,2):d===2&&Nd(i,e,r,s,l,u):ro(us(i),e,r,s,l,u,1);break}}}function Od(i){var e=i.prev,r=i,s=i.next;if(Zt(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<=P&&z.y>=S&&z.y<=C&&ia(l,f,u,g,d,v,z.x,z.y)&&Zt(z.prev,z,z.next)>=0)return!1;z=z.next}return!0}function Ud(i,e,r,s){var l=i.prev,u=i,d=i.next;if(Zt(l,u,d)>=0)return!1;for(var f=l.x,g=u.x,v=d.x,b=l.y,S=u.y,P=d.y,C=fg?f>v?f:v:g>v?g:v,F=b>S?b>P?b:P:S>P?S:P,K=fc(C,z,e,r,s),Q=fc(U,F,e,r,s),X=i.prevZ,ne=i.nextZ;X&&X.z>=K&&ne&&ne.z<=Q;){if(X.x>=C&&X.x<=U&&X.y>=z&&X.y<=F&&X!==l&&X!==d&&ia(f,b,g,S,v,P,X.x,X.y)&&Zt(X.prev,X,X.next)>=0||(X=X.prevZ,ne.x>=C&&ne.x<=U&&ne.y>=z&&ne.y<=F&&ne!==l&&ne!==d&&ia(f,b,g,S,v,P,ne.x,ne.y)&&Zt(ne.prev,ne,ne.next)>=0))return!1;ne=ne.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,S,v,P,X.x,X.y)&&Zt(X.prev,X,X.next)>=0)return!1;X=X.prevZ}for(;ne&&ne.z<=Q;){if(ne.x>=C&&ne.x<=U&&ne.y>=z&&ne.y<=F&&ne!==l&&ne!==d&&ia(f,b,g,S,v,P,ne.x,ne.y)&&Zt(ne.prev,ne,ne.next)>=0)return!1;ne=ne.nextZ}return!0}function Vd(i,e,r){var s=i;do{var l=s.prev,u=s.next.next;!ml(l,u)&&zh(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 Nd(i,e,r,s,l,u){var d=i;do{for(var f=d.next.next;f!==d.prev;){if(d.i!==f.i&&Gd(d,f)){var g=Dh(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 $d(i,e){return i.x-e.x}function qd(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 S=f.x+(v-f.y)*(f.next.x-f.x)/(f.next.y-f.y);if(S<=g&&S>b&&(b=S,d=f.x=f.x&&f.x>=z&&g!==f.x&&ia(vd.x||f.x===d.x&&jd(d,f)))&&(d=f,F=P)),f=f.next;while(f!==C);return d}(i,e);if(!r)return e;var s=Dh(r,i);return us(s,s.next),us(r,r.next)}function jd(i,e){return Zt(i.prev,i,e.prev)<0&&Zt(e.next,i,i.next)<0}function fc(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 Zd(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 Gd(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&&zh(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)&&(Zt(i.prev,i,e.prev)||Zt(i,e.prev,e))||ml(i,e)&&Zt(i.prev,i,i.next)>0&&Zt(e.prev,e,e.next)>0)}function Zt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function ml(i,e){return i.x===e.x&&i.y===e.y}function zh(i,e,r,s){var l=_l(Zt(i,e,r)),u=_l(Zt(i,e,s)),d=_l(Zt(r,s,i)),f=_l(Zt(r,s,e));return l!==u&&d!==f||!(l!==0||!gl(i,r,e))||!(u!==0||!gl(i,s,e))||!(d!==0||!gl(r,i,s))||!(f!==0||!gl(r,e,s))}function gl(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 _l(i){return i>0?1:i<0?-1:0}function no(i,e){return Zt(i.prev,i,i.next)<0?Zt(i,e,i.next)>=0&&Zt(i,i.prev,e)>=0:Zt(i,e,i.prev)<0||Zt(i,i.next,e)<0}function Dh(i,e){var r=new mc(i.i,i.x,i.y),s=new mc(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 Lh(i,e,r,s){var l=new mc(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 mc(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 gc(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 Bh=ce(pc.exports);function Xd(i,e,r,s,l){Rh(i,e,r||0,s||i.length-1,l||Wd)}function Rh(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);Rh(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],S=r,P=s;for(ao(i,r,e),l(i[s],b)>0&&ao(i,r,s);S0;)P--}l(i[r],b)===0?ao(i,r,P):ao(i,++P,s),P<=e&&(r=P+1),e<=P&&(s=P-1)}}function ao(i,e,r){var s=i[e];i[e]=i[r],i[r]=s}function Wd(i,e){return ie?1:0}function _c(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 ge,this.indexArray2=new Ce,this.programConfigurations=new Mr(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=yc("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 S=this.layers[0]._featureFilter.needGeometry,P=hs(f,S);if(!this.layers[0]._featureFilter.filter(new kt(this.zoom),P,s))continue;const C=u?l.evaluate(P,{},s,r.availableImages):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:b,index:v,geometry:S?P.geometry:Cr(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 S=xc("fill",this.layers,f,this.zoom,r);this.patternFeatures.push(S)}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,Fd),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 _c(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=[],S=[];for(const C of d){if(C.length===0)continue;C!==d[0]&&S.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 ep(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))}Nh.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 rp(this._pbf,e,this.extent,this._keys,this._values)};var sp=Vh;function ap(i,e,r){if(i===3){var s=new sp(r,r.readVarint()+r.pos);s.length&&(e[s.name]=s)}}Rn.VectorTile=function(i,e){this.layers=i.readFields(ap,{},e)},Rn.VectorTileFeature=Uh,Rn.VectorTileLayer=Vh;const op=Rn.VectorTileFeature.types,bc=Math.pow(2,13);function oo(i,e,r,s,l,u,d,f){i.emplaceBack(e,r,2*Math.floor(s*bc)+d,l*bc*2,u*bc*2,Math.round(f))}class wc{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 q,this.centroidVertexArray=new O,this.indexArray=new ge,this.programConfigurations=new Mr(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=yc("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 kt(this.zoom),v,s))continue;const b={id:u,sourceLayerIndex:f,index:d,geometry:g?v.geometry:Cr(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(xc("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,Qd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Jd.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 _c(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||cp(z))continue;let U=0;for(let F=0;F=1){const Q=z[F-1];if(!lp(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(),ne=Q.dist(K);U+ne>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+=ne,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 ae=v.vertexLength;this.indexArray.emplaceBack(ae,ae+2,ae+1),this.indexArray.emplaceBack(ae+1,ae+2,ae+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)),op[e.type]!=="Polygon")continue;const b=[],S=[],P=v.vertexLength;for(const z of f)if(z.length!==0){z!==f[0]&&S.push(b.length/2);for(let U=0;UAt)||i.y===e.y&&(i.y<0||i.y>At)}function cp(i){return i.every(e=>e.x<0)||i.every(e=>e.x>At)||i.every(e=>e.y<0)||i.every(e=>e.y>At)}let $h;De("FillExtrusionBucket",wc,{omit:["layers","features"]});var hp={get paint(){return $h=$h||new Ci({"fill-extrusion-opacity":new Fe(le["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new qe(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 qe(le["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new qe(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 qh(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 se,this.indexArray=new ge,this.programConfigurations=new Mr(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=yc("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 S=this.layers[0]._featureFilter.needGeometry,P=hs(f,S);if(!this.layers[0]._featureFilter.filter(new kt(this.zoom),P,s))continue;const C=u?l.evaluate(P,{},s):void 0,z={id:g,properties:f.properties,type:f.type,sourceLayerIndex:b,index:v,geometry:S?P.geometry:Cr(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 S=xc("line",this.layers,f,this.zoom,r);this.patternFeatures.push(S)}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,fp)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dp),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 S of r)this.addLine(S,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 Te=P.dist(C);if(Te>2*b){const Me=P.sub(P.sub(C)._mult(b/Te)._round());this.updateDistance(C,Me),this.addCurrentVertex(Me,U,0,0,S),C=Me}}const Pe=C&&z;let Se=Pe?s:f?"butt":l;if(Pe&&Se==="round"&&(aeu&&(Se="bevel"),Se==="bevel"&&(ae>2&&(Se="flipbevel"),ae100)Q=F.mult(-1);else{const Te=ae*U.add(F).mag()/U.sub(F).mag();Q._perp()._mult(Te*(Be?-1:1))}this.addCurrentVertex(P,Q,0,0,S),this.addCurrentVertex(P,Q.mult(-1),0,0,S)}else if(Se==="bevel"||Se==="fakeround"){const Te=-Math.sqrt(ae*ae-1),Me=Be?Te:0,Ie=Be?0:Te;if(C&&this.addCurrentVertex(P,U,Me,Ie,S),Se==="fakeround"){const ye=Math.round(180*he/Math.PI/20);for(let Ve=1;Ve2*b){const Me=P.add(z.sub(P)._mult(b/Te)._round());this.updateDistance(P,Me),this.addCurrentVertex(Me,F,0,0,S),P=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>jh/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*(jh-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 Zh,Gh;De("LineBucket",Tc,{omit:["layers","patternFeatures"]});var Xh={get paint(){return Gh=Gh||new Ci({"line-opacity":new qe(le.paint_line["line-opacity"]),"line-color":new qe(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 qe(le.paint_line["line-width"]),"line-gap-width":new qe(le.paint_line["line-gap-width"]),"line-offset":new qe(le.paint_line["line-offset"]),"line-blur":new qe(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 Zh=Zh||new Ci({"line-cap":new Fe(le.layout_line["line-cap"]),"line-join":new qe(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 qe(le.layout_line["line-sort-key"])})}};class _p extends qe{possiblyEvaluate(e,r){return r=new kt(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=pt({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,s,l)}}let yl;function Wh(i,e){return e>0?e+2*i:i}const yp=Kt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),xp=Kt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Kt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const vp=Kt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Kt([{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 Hh=Kt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),bp=Kt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function wp(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()),Ji.applyArabicShaping&&(l=Ji.applyArabicShaping(l)),l}(s.text,e,r)}),i}Kt([{name:"triangle",components:3,type:"Uint16"}]),Kt([{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"}]),Kt([{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"}]),Kt([{type:"Float32",name:"offsetX"}]),Kt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const co={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var li=24,Kh=vt,Yh=function(i,e,r,s,l){var u,d,f=8*l-s-1,g=(1<>1,b=-7,S=r?l-1:0,P=r?-1:1,C=i[e+S];for(S+=P,u=C&(1<<-b)-1,C>>=-b,b+=f;b>0;u=256*u+i[e+S],S+=P,b-=8);for(d=u&(1<<-b)-1,u>>=-b,b+=s;b>0;d=256*d+i[e+S],S+=P,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)},Jh=function(i,e,r,s,l,u){var d,f,g,v=8*u-l-1,b=(1<>1,P=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+S>=1?P/g:P*Math.pow(2,1-S))*g>=2&&(d++,g/=2),d+S>=b?(f=0,d=b):d+S>=1?(f=(e*g-1)*Math.pow(2,l),d+=S):(f=e*Math.pow(2,S-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 vt(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}vt.Varint=0,vt.Fixed64=1,vt.Bytes=2,vt.Fixed32=5;var Ec=4294967296,Qh=1/Ec,eu=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function ln(i){return i.type===vt.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 tu(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 Tp(i,e){for(var r=0;r>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function iu(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}vt.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=xl(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=iu(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=xl(this.buf,this.pos)+xl(this.buf,this.pos+4)*Ec;return this.pos+=8,i},readSFixed64:function(){var i=xl(this.buf,this.pos)+iu(this.buf,this.pos+4)*Ec;return this.pos+=8,i},readFloat:function(){var i=Yh(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Yh(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&&eu?function(r,s,l){return eu.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+P>l)break;P===1?b<128&&(S=b):P===2?(192&(f=r[d+1]))==128&&(S=(31&b)<<6|63&f)<=127&&(S=null):P===3?(g=r[d+2],(192&(f=r[d+1]))==128&&(192&g)==128&&((S=(15&b)<<12|(63&f)<<6|63&g)<=2047||S>=55296&&S<=57343)&&(S=null)):P===4&&(g=r[d+2],v=r[d+3],(192&(f=r[d+1]))==128&&(192&g)==128&&(192&v)==128&&((S=(15&b)<<18|(63&f)<<12|(63&g)<<6|63&v)<=65535||S>=1114112)&&(S=null)),S===null?(S=65533,P=1):S>65535&&(S-=65536,u+=String.fromCharCode(S>>>10&1023|55296),S=56320|1023&S),u+=String.fromCharCode(S),d+=P}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!==vt.Bytes)return i.push(this.readVarint(e));var r=ln(this);for(i=i||[];this.pos127;);else if(e===vt.Bytes)this.pos=this.readVarint()+this.pos;else if(e===vt.Fixed32)this.pos+=4;else{if(e!==vt.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&&tu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),Jh(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Jh(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&&tu(r,s,this),this.pos=r-1,this.writeVarint(s),this.pos+=s},writeMessage:function(i,e,r){this.writeTag(i,vt.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Tp,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Ep,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Ap,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Sp,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Ip,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Pp,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Mp,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,Cp,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,kp,e)},writeBytesField:function(i,e){this.writeTag(i,vt.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,vt.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,vt.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,vt.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,vt.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,vt.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,vt.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,vt.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,vt.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,vt.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};var Sc=ce(Kh);const Ic=3;function zp(i,e,r){i===1&&r.readMessage(Dp,e)}function Dp(i,e,r){if(i===3){const{id:s,bitmap:l,width:u,height:d,left:f,top:g,advance:v}=r.readMessage(Lp,{});e.push({id:s,bitmap:new io({width:u+2*Ic,height:d+2*Ic},l),metrics:{width:u,height:d,left:f,top:g,advance:v}})}}function Lp(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 ru=Ic;function nu(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&&bl[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 vl(i,e,r,s,l,u,d,f,g,v,b,S,P,C,z,U){const F=aa.fromFeature(i,l);let K;S===h.WritingMode.vertical&&F.verticalizePunctuation();const{processBidirectionalText:Q,processStyledBidirectionalText:X}=Ji;if(Q&&F.sections.length===1){K=[];const he=Q(F.toString(),Pc(F,v,u,e,s,C,z));for(const ze of he){const Be=new aa;Be.text=ze,Be.sections=F.sections;for(let Pe=0;Pe0&&hn>$i&&($i=hn)}else{const or=Be[rt.fontStack],qi=or&&or[vi];if(qi&&qi.rect)kr=qi.rect,_r=qi.metrics;else{const hn=ze[rt.fontStack],_o=hn&&hn[vi];if(!_o)continue;_r=_o.metrics}Ii=(yi-rt.scale)*li}yr?(he.verticalizable=!0,Ni.push({glyph:vi,imageName:zr,x:Pt,y:zt+Ii,vertical:yr,scale:rt.scale,fontStack:rt.fontStack,sectionIndex:Qi,metrics:_r,rect:kr}),Pt+=cn*rt.scale+Ve):(Ni.push({glyph:vi,imageName:zr,x:Pt,y:zt+Ii,vertical:yr,scale:rt.scale,fontStack:rt.fontStack,sectionIndex:Qi,metrics:_r,rect:kr}),Pt+=_r.advance*rt.scale+Ve)}Ni.length!==0&&(ii=Math.max(Pt-Ve,ii),Fp(Ni,0,Ni.length-1,gi,$i)),Pt=0;const Ut=Te*yi+$i;zi.lineOffset=Math.max($i,Si),zt+=Ut,ar=Math.max(Ut,ar),++Yt}var ci;const _i=zt-ho,{horizontalAlign:Ei,verticalAlign:Vi}=Mc(Me);(function(Jt,yi,Si,zi,Ni,$i,Ut,xi,rt){const Qi=(yi-Si)*Ni;let vi=0;vi=$i!==Ut?-xi*zi-ho:(-zi*rt+.5)*Ut;for(const Ii of Jt)for(const _r of Ii.positionedGlyphs)_r.x+=Qi,_r.y+=vi})(he.positionedLines,gi,Ei,Vi,ii,ar,Te,_i,Se.length),he.top+=-Vi*_i,he.bottom=he.top+_i,he.left+=-Ei*ii,he.right=he.left+ii}(ae,e,r,s,K,d,f,g,S,v,P,U),!function(he){for(const ze of he)if(ze.positionedGlyphs.length!==0)return!1;return!0}(ne)&&ae}const bl={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Bp={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 au(i,e,r,s,l,u){if(e.imageName){const d=s[e.imageName];return d?d.displaySize[0]*e.scale*li/u+l:0}{const d=r[e.fontStack],f=d&&d[i];return f?f.metrics.advance*e.scale+l:0}}function ou(i,e,r,s){const l=Math.pow(i-e,2);return s?i=0;let b=0;for(let P=0;Pd.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=hc([]),this.placementViewportMatrix=hc([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=uu(this.zoom,r["text-size"]),this.iconSizeData=uu(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=Cc(s,"text-overlap","text-allow-overlap")!=="never"||Cc(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 zc(new Mr(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new zc(new Mr(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,S=u.get("symbol-sort-key");if(this.features=[],!v&&!b)return;const P=r.iconDependencies,C=r.glyphDependencies,z=r.availableImages,U=new kt(this.zoom);for(const{feature:F,id:K,index:Q,sourceLayerIndex:X}of e){const ne=l._featureFilter.needGeometry,ae=hs(F,ne);if(!l._featureFilter.filter(U,ae,s))continue;let he,ze;if(ne||(ae.geometry=Cr(F)),v){const Pe=l.getValueAndResolveTokens("text-field",ae,s,z),Se=di.factory(Pe);Np(Se)&&(this.hasRTLText=!0),(!this.hasRTLText||ja()==="unavailable"||this.hasRTLText&&Ji.isParsed())&&(he=wp(Se,l,ae))}if(b){const Pe=l.getValueAndResolveTokens("icon-image",ae,s,z);ze=Pe instanceof Wi?Pe:Wi.fromString(Pe)}if(!he&&!ze)continue;const Be=this.sortFeaturesByKey?S.evaluate(ae,{},s):void 0;if(this.features.push({id:K,text:he,icon:ze,index:Q,sourceLayerIndex:X,geometry:ae.geometry,properties:F.properties,type:Up[F.type],sortKey:Be}),ze&&(P[ze.name]=!0),he){const Pe=d.evaluate(ae,{},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 Te of he.sections)if(Te.image)P[Te.image.name]=!0;else{const Me=Fs(he.toString()),Ie=Te.fontStack||Pe,ye=C[Ie]=C[Ie]||{};this.calculateGlyphDependencies(Te.text,ye,Se,this.allowVerticalPlacement,Me)}}}u.get("symbol-placement")==="line"&&(this.features=function(F){const K={},Q={},X=[];let ne=0;function ae(Pe){X.push(F[Pe]),ne++}function he(Pe,Se,Te){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(Te[0]),Me}function ze(Pe,Se,Te){const Me=K[Se];return delete K[Se],K[Pe]=Me,X[Me].geometry[0].shift(),X[Me].geometry[0]=Te[0].concat(X[Me].geometry[0]),Me}function Be(Pe,Se,Te){const Me=Te?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 du,pu;De("SymbolBucket",oa,{omit:["layers","collisionBoxArray","features","compareText"]}),oa.MAX_GLYPHS=65535,oa.addDynamicAttributes=kc;var Lc={get paint(){return pu=pu||new Ci({"icon-opacity":new qe(le.paint_symbol["icon-opacity"]),"icon-color":new qe(le.paint_symbol["icon-color"]),"icon-halo-color":new qe(le.paint_symbol["icon-halo-color"]),"icon-halo-width":new qe(le.paint_symbol["icon-halo-width"]),"icon-halo-blur":new qe(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 qe(le.paint_symbol["text-opacity"]),"text-color":new qe(le.paint_symbol["text-color"],{runtimeType:Pi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new qe(le.paint_symbol["text-halo-color"]),"text-halo-width":new qe(le.paint_symbol["text-halo-width"]),"text-halo-blur":new qe(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 du=du||new Ci({"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 qe(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 qe(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 qe(le.layout_symbol["icon-image"]),"icon-rotate":new qe(le.layout_symbol["icon-rotate"]),"icon-padding":new qe(le.layout_symbol["icon-padding"]),"icon-keep-upright":new Fe(le.layout_symbol["icon-keep-upright"]),"icon-offset":new qe(le.layout_symbol["icon-offset"]),"icon-anchor":new qe(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 qe(le.layout_symbol["text-field"]),"text-font":new qe(le.layout_symbol["text-font"]),"text-size":new qe(le.layout_symbol["text-size"]),"text-max-width":new qe(le.layout_symbol["text-max-width"]),"text-line-height":new Fe(le.layout_symbol["text-line-height"]),"text-letter-spacing":new qe(le.layout_symbol["text-letter-spacing"]),"text-justify":new qe(le.layout_symbol["text-justify"]),"text-radial-offset":new qe(le.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Fe(le.layout_symbol["text-variable-anchor"]),"text-anchor":new qe(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 qe(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 qe(le.layout_symbol["text-transform"]),"text-offset":new qe(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 fu{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:Or,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",fu,{omit:["defaultValue"]});class Tl extends fr{constructor(e){super(e,Lc)}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 Lc.paint.overridableProperties){if(!Tl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),s=new fu(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 st("composite",l,r.value.zoomStops),this.paint._values[e]=new pr(r.property,u,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,s){return!(!this.layout||r.isDataDriven()||s.isDataDriven())&&Tl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const s=e.get("text-field"),l=Lc.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 di)d(s.value.value.sections);else if(s.value.kind==="source"){const f=v=>{u||(v instanceof Vr&&Wt(v.value)===Er?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 mu;var $p={get paint(){return mu=mu||new Ci({"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 gu;var qp={get paint(){return gu=gu||new Ci({"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 jp extends fr{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 Zp={circle:class extends fr{constructor(i){super(i,zd)}createBucket(i){return new oc(i)}queryRadius(i){const e=i;return eo("circle-radius",this,e)+eo("circle-stroke-width",this,e)+ul(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=dl(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",S=b?g:function(C,z){return C.map(U=>Sh(U,z))}(g,f),P=b?v*d:v;for(const C of s)for(const z of C){const U=b?z:Sh(z,f);let F=P;const K=pl([],[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]),Pd(S,U,F))return!0}return!1}},heatmap:class extends fr{createBucket(i){return new Ih(i)}constructor(i){super(i,Ld),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Mh({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 fr{constructor(i){super(i,Bd)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends fr{constructor(i){super(i,Kd)}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 vc(i)}queryRadius(){return ul(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,s,l,u,d){return xh(dl(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),u.angle,d),s)}isTileClipped(){return!0}},"fill-extrusion":class extends fr{constructor(i){super(i,hp)}createBucket(i){return new wc(i)}queryRadius(){return ul(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,s,l,u,d,f){const g=dl(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),S=function(C,z,U,F){const K=[];for(const Q of C){const X=[Q.x,Q.y,0,1];pl(X,X,z),K.push(new xe(X[0]/X[3],X[1]/X[3]))}return K}(g,f),P=function(C,z,U,F){const K=[],Q=[],X=F[8]*z,ne=F[9]*z,ae=F[10]*z,he=F[11]*z,ze=F[8]*U,Be=F[9]*U,Pe=F[10]*U,Se=F[11]*U;for(const Te of C){const Me=[],Ie=[];for(const ye of Te){const Ve=ye.x,Re=ye.y,it=F[0]*Ve+F[4]*Re+F[12],Pt=F[1]*Ve+F[5]*Re+F[13],zt=F[2]*Ve+F[6]*Re+F[14],ii=F[3]*Ve+F[7]*Re+F[15],ar=zt+ae,gi=ii+he,Yt=it+ze,ci=Pt+Be,_i=zt+Pe,Ei=ii+Se,Vi=new xe((it+X)/gi,(Pt+ne)/gi);Vi.z=ar/gi,Me.push(Vi);const Jt=new xe(Yt/Ei,ci/Ei);Jt.z=_i/Ei,Ie.push(Jt)}K.push(Me),Q.push(Ie)}return[K,Q]}(s,b,v,f);return function(C,z,U){let F=1/0;xh(U,z)&&(F=qh(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 Bc=63710088e-1;class Un{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 Un(Bt(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 Bc*Math.acos(Math.min(u,1))}static convert(e){if(e instanceof Un)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Un(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Un(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 _u=2*Math.PI*Bc;function yu(i){return _u*Math.cos(i*Math.PI/180)}function xu(i){return(180+i)/360}function vu(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function bu(i,e){return i/yu(e)}function Rc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class El{constructor(e,r,s=0){this.x=+e,this.y=+r,this.z=+s}static fromLngLat(e,r=0){const s=Un.convert(e);return new El(xu(s.lng),vu(s.lat),bu(r,s.lat))}toLngLat(){return new Un(360*this.x-180,Rc(this.y))}toAltitude(){return this.z*yu(Rc(this.y))}meterInMercatorCoordinateUnits(){return 1/_u*(e=Rc(this.y),1/Math.cos(e*Math.PI/180));var e}}function wu(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 Fc{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=wu(256*(u=this.x),256*(d=Math.pow(2,f)-d-1),f),v=wu(256*(u+1),256*(d+1),f),g[0]+","+g[1]+","+v[0]+","+v[1]);var u,d,f,g,v;const b=function(S,P,C){let z,U="";for(let F=S;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 xe((e.x*r-this.x)*At,(e.y*r-this.y)*At)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Tu{constructor(e,r){this.wrap=e,this.canonical=r,this.key=fo(e,r.z,r.z,r.x,r.y)}}class sr{constructor(e,r,s,l,u){if(e= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=r,this.canonical=new Fc(s,+l,+u),this.key=fo(r,e,s,l,u)}clone(){return new sr(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 sr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new sr(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 sr(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 sr(r,this.wrap,r,s,l),new sr(r,this.wrap,r,s+1,l),new sr(r,this.wrap,r,s,l+1),new sr(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 nr({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 Iu{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 Au{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(At,16,0),this.grid3D=new is(At,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&&S[3]>=0&&g.insert(f,S[0],S[1],S[2],S[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Rn.VectorTile(new Sc(this.rawTileData)).layers,this.sourceLayerCoder=new Su(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,s,l){this.loadVTLayers();const u=e.params||{},d=At/e.tileSize/e.scale,f=La(u.filter),g=e.queryGeometry,v=e.queryPadding*d,b=Mu(g),S=this.grid.query(b.minX-v,b.minY-v,b.maxX+v,b.maxY+v),P=Mu(e.cameraQueryGeometry),C=this.grid3D.query(P.minX-v,P.minY-v,P.maxX+v,P.maxY+v,(F,K,Q,X)=>function(ne,ae,he,ze,Be){for(const Se of ne)if(ae<=Se.x&&he<=Se.y&&ze>=Se.x&&Be>=Se.y)return!0;const Pe=[new xe(ae,he),new xe(ae,Be),new xe(ze,Be),new xe(ze,he)];if(ne.length>2){for(const Se of Pe)if(ea(ne,Se))return!0}for(let Se=0;Se(X||(X=Cr(ne)),ae.queryIntersectsFeature(g,ne,he,X,this.z,e.transform,d,e.pixelPosMatrix)))}return z}loadMatchingFeature(e,r,s,l,u,d,f,g,v,b,S){const P=this.bucketLayerIDs[r];if(d&&!function(F,K){for(let Q=0;Q=0)return!0;return!1}(d,P))return;const C=this.sourceLayerCoder.decode(s),z=this.vtLayers[C].feature(l);if(u.needGeometry){const F=hs(z,!0);if(!u.filter(new kt(this.tileID.overscaledZ),F,this.tileID.canonical))return}else if(!u.filter(new kt(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 Mu(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 Xp(i,e){return e-i}function Cu(i,e,r,s,l){const u=[];for(let d=0;d=s&&S.x>=s||(b.x>=s?b=new xe(s,b.y+(s-b.x)/(S.x-b.x)*(S.y-b.y))._round():S.x>=s&&(S=new xe(s,b.y+(s-b.x)/(S.x-b.x)*(S.y-b.y))._round()),b.y>=l&&S.y>=l||(b.y>=l?b=new xe(b.x+(l-b.y)/(S.y-b.y)*(S.x-b.x),l)._round():S.y>=l&&(S=new xe(b.x+(l-b.y)/(S.y-b.y)*(S.x-b.x),l)._round()),g&&b.equals(g[g.length-1])||(g=[b],u.push(g)),g.push(S)))))}}return u}De("FeatureIndex",Au,{omit:["rawTileData","sourceLayerCoder"]});class Vn extends xe{constructor(e,r,s,l){super(e,r),this.angle=s,l!==void 0&&(this.segment=l)}clone(){return new Vn(this.x,this.y,this.angle,this.segment)}}function ku(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(S)}return!0}function zu(i){let e=0;for(let r=0;rv){const z=(v-g)/C,U=Bi.number(S.x,P.x,z),F=Bi.number(S.y,P.y,z),K=new Vn(U,F,P.angleTo(S),b);return K._round(),!d||ku(i,K,f,d,e)?K:void 0}g+=C}}function Hp(i,e,r,s,l,u,d,f,g){const v=Du(s,u,d),b=Lu(s,l),S=b*d,P=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-S=0&&ne=0&&ae=0&&P+v<=b){const he=new Vn(ne,ae,Q,z);he._round(),s&&!ku(i,he,u,s,l)||C.push(he)}}S+=K}return f||C.length||d||(C=Bu(i,S/2,r,s,l,u,d,!0,g)),C}De("Anchor",Vn);const la=Ui;function Ru(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,S=u.stretchX||[[0,f]],P=u.stretchY||[[0,g]],C=(Te,Me)=>Te+Me[1]-Me[0],z=S.reduce(C,0),U=P.reduce(C,0),F=f-z,K=g-U;let Q=0,X=z,ne=0,ae=U,he=0,ze=F,Be=0,Pe=K;if(u.content&&s){const Te=u.content;Q=Sl(S,0,Te[0]),ne=Sl(P,0,Te[1]),X=Sl(S,Te[0],Te[2]),ae=Sl(P,Te[1],Te[3]),he=Te[0]-Q,Be=Te[1]-ne,ze=Te[2]-Te[0]-X,Pe=Te[3]-Te[1]-ae}const Se=(Te,Me,Ie,ye)=>{const Ve=Il(Te.stretch-Q,X,v,i.left),Re=Al(Te.fixed-he,ze,Te.stretch,z),it=Il(Me.stretch-ne,ae,b,i.top),Pt=Al(Me.fixed-Be,Pe,Me.stretch,U),zt=Il(Ie.stretch-Q,X,v,i.left),ii=Al(Ie.fixed-he,ze,Ie.stretch,z),ar=Il(ye.stretch-ne,ae,b,i.top),gi=Al(ye.fixed-Be,Pe,ye.stretch,U),Yt=new xe(Ve,it),ci=new xe(zt,it),_i=new xe(zt,ar),Ei=new xe(Ve,ar),Vi=new xe(Re/d,Pt/d),Jt=new xe(ii/d,gi/d),yi=e*Math.PI/180;if(yi){const Ni=Math.sin(yi),$i=Math.cos(yi),Ut=[$i,-Ni,Ni,$i];Yt._matMult(Ut),ci._matMult(Ut),Ei._matMult(Ut),_i._matMult(Ut)}const Si=Te.stretch+Te.fixed,zi=Me.stretch+Me.fixed;return{tl:Yt,tr:ci,bl:Ei,br:_i,tex:{x:u.paddedRect.x+la+Si,y:u.paddedRect.y+la+zi,w:Ie.stretch+Ie.fixed-Si,h:ye.stretch+ye.fixed-zi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Vi,pixelOffsetBR:Jt,minFontScaleX:ze/d/v,minFontScaleY:Pe/d/b,isSDF:r}};if(s&&(u.stretchX||u.stretchY)){const Te=Fu(S,F,z),Me=Fu(P,K,U);for(let Ie=0;Ie0&&(z=Math.max(10,z),this.circleDiameter=z)}else{let S=d.top*f-g[0],P=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,S-=U[1]*f,z+=U[2]*f,P+=U[3]*f),b){const F=new xe(C,S),K=new xe(z,S),Q=new xe(C,P),X=new xe(z,P),ne=b*Math.PI/180;F._rotate(ne),K._rotate(ne),Q._rotate(ne),X._rotate(ne),C=Math.min(F.x,K.x,Q.x,X.x),z=Math.max(F.x,K.x,Q.x,X.x),S=Math.min(F.y,K.y,Q.y,X.y),P=Math.max(F.y,K.y,Q.y,X.y)}e.emplaceBack(r.x,r.y,C,S,z,P,s,l,u)}this.boxEndIndex=e.length}}class Kp{constructor(e=[],r=Yp){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 Yp(i,e){return ie?1:0}function Jp(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 Kp([],Qp);if(g===0)return new xe(s,l);for(let C=s;CS.d||!S.d)&&(S=C,r&&console.log("found best %d after %d probes",Math.round(1e4*C.d)/1e4,P)),C.max-S.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)),P+=4)}return r&&(console.log(`num probes: ${P}`),console.log(`best distance: ${S.d}`)),S.p}function Qp(i,e){return e.max-i.max}function ca(i,e,r,s){this.p=new xe(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,vh(l,C,z))}}return(d?1:-1)*Math.sqrt(f)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}const Oc=Number.POSITIVE_INFINITY;function Ou(i,e){return e[1]!==Oc?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 Uc(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 ef(i,e,r,s,l,u,d,f,g,v,b){let S=u.textMaxSize.evaluate(e,{});S===void 0&&(S=d);const P=i.layers[0].layout,C=P.get("icon-offset").evaluate(e,{},b),z=Vu(r.horizontal),U=d/24,F=i.tilePixelRatio*U,K=i.tilePixelRatio*S/24,Q=i.tilePixelRatio*f,X=i.tilePixelRatio*P.get("symbol-spacing"),ne=P.get("text-padding")*i.tilePixelRatio,ae=function(ye,Ve,Re,it=1){const Pt=ye.get("icon-padding").evaluate(Ve,{},Re),zt=Pt&&Pt.values;return[zt[0]*it,zt[1]*it,zt[2]*it,zt[3]*it]}(P,e,b,i.tilePixelRatio),he=P.get("text-max-angle")/180*Math.PI,ze=P.get("text-rotation-alignment")!=="viewport"&&P.get("symbol-placement")!=="point",Be=P.get("icon-rotation-alignment")==="map"&&P.get("symbol-placement")!=="point",Pe=P.get("symbol-placement"),Se=X/2,Te=P.get("icon-text-fit");let Me;s&&Te!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(Me=hu(s,r.vertical,Te,P.get("icon-text-fit-padding"),C,U)),z&&(s=hu(s,z,Te,P.get("icon-text-fit-padding"),C,U)));const Ie=(ye,Ve)=>{Ve.x<0||Ve.x>=At||Ve.y<0||Ve.y>=At||function(Re,it,Pt,zt,ii,ar,gi,Yt,ci,_i,Ei,Vi,Jt,yi,Si,zi,Ni,$i,Ut,xi,rt,Qi,vi,Ii,_r){const kr=Re.addToLineVertexArray(it,Pt);let zr,cn,yr,or,qi=0,hn=0,_o=0,ju=0,Xc=-1,Wc=-1;const un={};let Zu=jt(""),Hc=0,Kc=0;if(Yt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Hc,Kc]=Yt.layout.get("text-offset").evaluate(rt,{},Ii).map(ji=>ji*li):(Hc=Yt.layout.get("text-radial-offset").evaluate(rt,{},Ii)*li,Kc=Oc),Re.allowVerticalPlacement&&zt.vertical){const ji=Yt.layout.get("text-rotate").evaluate(rt,{},Ii)+90;yr=new Pl(ci,it,_i,Ei,Vi,zt.vertical,Jt,yi,Si,ji),gi&&(or=new Pl(ci,it,_i,Ei,Vi,gi,Ni,$i,Si,ji))}if(ii){const ji=Yt.layout.get("icon-rotate").evaluate(rt,{}),Gr=Yt.layout.get("icon-text-fit")!=="none",yo=Ru(ii,ji,vi,Gr),xo=gi?Ru(gi,ji,vi,Gr):void 0;cn=new Pl(ci,it,_i,Ei,Vi,ii,Ni,$i,!1,ji),qi=4*yo.length;const Wu=Re.iconSizeData;let ds=null;Wu.kind==="source"?(ds=[Zr*Yt.layout.get("icon-size").evaluate(rt,{})],ds[0]>On&&Vt(`${Re.layerIds[0]}: Value for "icon-size" is >= ${po}. Reduce your "icon-size".`)):Wu.kind==="composite"&&(ds=[Zr*Qi.compositeIconSizes[0].evaluate(rt,{},Ii),Zr*Qi.compositeIconSizes[1].evaluate(rt,{},Ii)],(ds[0]>On||ds[1]>On)&&Vt(`${Re.layerIds[0]}: Value for "icon-size" is >= ${po}. Reduce your "icon-size".`)),Re.addSymbols(Re.icon,yo,ds,xi,Ut,rt,h.WritingMode.none,it,kr.lineStartIndex,kr.lineLength,-1,Ii),Xc=Re.icon.placedSymbolArray.length-1,xo&&(hn=4*xo.length,Re.addSymbols(Re.icon,xo,ds,xi,Ut,rt,h.WritingMode.vertical,it,kr.lineStartIndex,kr.lineLength,-1,Ii),Wc=Re.icon.placedSymbolArray.length-1)}const Gu=Object.keys(zt.horizontal);for(const ji of Gu){const Gr=zt.horizontal[ji];if(!zr){Zu=jt(Gr.text);const xo=Yt.layout.get("text-rotate").evaluate(rt,{},Ii);zr=new Pl(ci,it,_i,Ei,Vi,Gr,Jt,yi,Si,xo)}const yo=Gr.positionedLines.length===1;if(_o+=Uu(Re,it,Gr,ar,Yt,Si,rt,zi,kr,zt.vertical?h.WritingMode.horizontal:h.WritingMode.horizontalOnly,yo?Gu:[ji],un,Xc,Qi,Ii),yo)break}zt.vertical&&(ju+=Uu(Re,it,zt.vertical,ar,Yt,Si,rt,zi,kr,h.WritingMode.vertical,["vertical"],un,Wc,Qi,Ii));const nf=zr?zr.boxStartIndex:Re.collisionBoxArray.length,sf=zr?zr.boxEndIndex:Re.collisionBoxArray.length,af=yr?yr.boxStartIndex:Re.collisionBoxArray.length,of=yr?yr.boxEndIndex:Re.collisionBoxArray.length,lf=cn?cn.boxStartIndex:Re.collisionBoxArray.length,cf=cn?cn.boxEndIndex:Re.collisionBoxArray.length,hf=or?or.boxStartIndex:Re.collisionBoxArray.length,uf=or?or.boxEndIndex:Re.collisionBoxArray.length;let Dr=-1;const Cl=(ji,Gr)=>ji&&ji.circleDiameter?Math.max(ji.circleDiameter,Gr):Gr;Dr=Cl(zr,Dr),Dr=Cl(yr,Dr),Dr=Cl(cn,Dr),Dr=Cl(or,Dr);const Xu=Dr>-1?1:0;Xu&&(Dr*=_r/li),Re.glyphOffsetArray.length>=oa.MAX_GLYPHS&&Vt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),rt.sortKey!==void 0&&Re.addToSortKeyRanges(Re.symbolInstances.length,rt.sortKey),Re.symbolInstances.emplaceBack(it.x,it.y,un.right>=0?un.right:-1,un.center>=0?un.center:-1,un.left>=0?un.left:-1,un.vertical||-1,Xc,Wc,Zu,nf,sf,af,of,lf,cf,hf,uf,_i,_o,ju,qi,hn,Xu,0,Jt,Hc,Kc,Dr)}(i,Ve,ye,r,s,l,Me,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,F,[ne,ne,ne,ne],ze,g,Q,ae,Be,C,e,u,v,b,d)};if(Pe==="line")for(const ye of Cu(e.geometry,0,0,At,At)){const Ve=Hp(ye,X,he,r.vertical||z,s,24,K,i.overscaling,At);for(const Re of Ve)z&&tf(i,z.text,Se,Re)||Ie(ye,Re)}else if(Pe==="line-center"){for(const ye of e.geometry)if(ye.length>1){const Ve=Wp(ye,he,r.vertical||z,s,24,K);Ve&&Ie(ye,Ve)}}else if(e.type==="Polygon")for(const ye of _c(e.geometry,0)){const Ve=Jp(ye,16);Ie(ye[0],new Vn(Ve.x,Ve.y,0))}else if(e.type==="LineString")for(const ye of e.geometry)Ie(ye,new Vn(ye[0].x,ye[0].y,0));else if(e.type==="Point")for(const ye of e.geometry)for(const Ve of ye)Ie([Ve],new Vn(Ve.x,Ve.y,0))}function Uu(i,e,r,s,l,u,d,f,g,v,b,S,P,C,z){const U=function(Q,X,ne,ae,he,ze,Be,Pe){const Se=ae.layout.get("text-rotate").evaluate(ze,{})*Math.PI/180,Te=[];for(const Me of X.positionedLines)for(const Ie of Me.positionedGlyphs){if(!Ie.rect)continue;const ye=Ie.rect||{};let Ve=ru+1,Re=!0,it=1,Pt=0;const zt=(he||Pe)&&Ie.vertical,ii=Ie.metrics.advance*Ie.scale/2;if(Pe&&X.verticalizable&&(Pt=Me.lineOffset/2-(Ie.imageName?-(li-Ie.metrics.width*Ie.scale)/2:(Ie.scale-1)*li)),Ie.imageName){const Ut=Be[Ie.imageName];Re=Ut.sdf,it=Ut.pixelRatio,Ve=Ui/it}const ar=he?[Ie.x+ii,Ie.y]:[0,0];let gi=he?[0,0]:[Ie.x+ii+ne[0],Ie.y+ne[1]-Pt],Yt=[0,0];zt&&(Yt=gi,gi=[0,0]);const ci=(Ie.metrics.left-Ve)*Ie.scale-ii+gi[0],_i=(-Ie.metrics.top-Ve)*Ie.scale+gi[1],Ei=ci+ye.w*Ie.scale/it,Vi=_i+ye.h*Ie.scale/it,Jt=new xe(ci,_i),yi=new xe(Ei,_i),Si=new xe(ci,Vi),zi=new xe(Ei,Vi);if(zt){const Ut=new xe(-ii,ii-ho),xi=-Math.PI/2,rt=li/2-ii,Qi=new xe(5-ho-rt,-(Ie.imageName?rt:0)),vi=new xe(...Yt);Jt._rotateAround(xi,Ut)._add(Qi)._add(vi),yi._rotateAround(xi,Ut)._add(Qi)._add(vi),Si._rotateAround(xi,Ut)._add(Qi)._add(vi),zi._rotateAround(xi,Ut)._add(Qi)._add(vi)}if(Se){const Ut=Math.sin(Se),xi=Math.cos(Se),rt=[xi,-Ut,Ut,xi];Jt._matMult(rt),yi._matMult(rt),Si._matMult(rt),zi._matMult(rt)}const Ni=new xe(0,0),$i=new xe(0,0);Te.push({tl:Jt,tr:yi,bl:Si,br:zi,tex:ye,writingMode:X.writingMode,glyphOffset:ar,sectionIndex:Ie.sectionIndex,isSDF:Re,pixelOffsetTL:Ni,pixelOffsetBR:$i,minFontScaleX:0,minFontScaleY:0})}return Te}(0,r,f,l,u,d,s,i.allowVerticalPlacement),F=i.textSizeData;let K=null;F.kind==="source"?(K=[Zr*l.layout.get("text-size").evaluate(d,{})],K[0]>On&&Vt(`${i.layerIds[0]}: Value for "text-size" is >= ${po}. Reduce your "text-size".`)):F.kind==="composite"&&(K=[Zr*C.compositeTextSizes[0].evaluate(d,{},z),Zr*C.compositeTextSizes[1].evaluate(d,{},z)],(K[0]>On||K[1]>On)&&Vt(`${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,P,z);for(const Q of b)S[Q]=i.text.placedSymbolArray.length-1;return 4*U.length}function Vu(i){for(const e in i)return i[e];return null}function tf(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=Nu[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 Vc(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=Nu.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 Nc(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,S=g.pop()||0,P=g.pop()||0;if(S-P<=f){for(let F=P;F<=S;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=P+S>>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(P),g.push(C-1),g.push(1-b)),(b===0?s>=z:l>=U)&&(g.push(C+1),g.push(S),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,S=f.pop()||0,P=f.pop()||0;if(S-P<=d){for(let F=P;F<=S;F++)qu(u[2*F],u[2*F+1],e,r)<=v&&g.push(l[F]);continue}const C=P+S>>1,z=u[2*C],U=u[2*C+1];qu(z,U,e,r)<=v&&g.push(l[C]),(b===0?e-s<=z:r-s<=U)&&(f.push(P),f.push(C-1),f.push(1-b)),(b===0?e+s>=z:r+s>=U)&&(f.push(C+1),f.push(S),f.push(1-b))}return g}}function Nc(i,e,r,s,l,u){if(l-s<=r)return;const d=s+l>>1;$u(i,e,d,s,l,u),Nc(i,e,r,s,d-1,1-u),Nc(i,e,r,d+1,l,1-u)}function $u(i,e,r,s,l,u){for(;l>s;){if(l-s>600){const v=l-s+1,b=r-s+1,S=Math.log(v),P=.5*Math.exp(2*S/3),C=.5*Math.sqrt(S*P*(v-P)/v)*(b-v/2<0?-1:1);$u(i,e,r,Math.max(s,Math.floor(r-b*P/v+C)),Math.min(l,Math.floor(r+(v-b)*P/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){$c(i,r,s),$c(e,2*r,2*s),$c(e,2*r+1,2*s+1)}function $c(i,e,r){const s=i[e];i[e]=i[r],i[r]=s}function qu(i,e,r,s){const l=i-r,u=e-s;return l*l+u*u}var qc;h.PerformanceMarkers=void 0,(qc=h.PerformanceMarkers||(h.PerformanceMarkers={})).create="create",qc.load="load",qc.fullLoad="fullLoad";let Ml=null,go=[];const jc=1e3/60,Zc="loadTime",Gc="fullLoadTime",rf={mark(i){performance.mark(i)},frame(i){const e=i;Ml!=null&&go.push(e-Ml),Ml=e},clearMetrics(){Ml=null,go=[],performance.clearMeasures(Zc),performance.clearMeasures(Gc);for(const i in h.PerformanceMarkers)performance.clearMarks(h.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure(Zc,h.PerformanceMarkers.create,h.PerformanceMarkers.load),performance.measure(Gc,h.PerformanceMarkers.create,h.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName(Zc)[0].duration,e=performance.getEntriesByName(Gc)[0].duration,r=go.length,s=1/(go.reduce((u,d)=>u+d,0)/r/1e3),l=go.filter(u=>u>jc).reduce((u,d)=>u+(d-jc)/jc,0);return{loadTime:i,fullLoadTime:e,fps:s,percentDroppedFrames:l/(r+l)*100,totalFrames:r}}};h.AJAXError=Br,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={},Rt(["receive","process"],this),this.invoker=new Gp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Zi()?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=Lr(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 Zi()||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(Ar(e.error)):r(null,Ar(e.data)))}else{let r=!1;const s=Lr(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=Ar(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=Fc,h.CollisionBoxArray=c,h.CollisionCircleLayoutArray=class extends Ws{},h.Color=Ze,h.DEMData=Eu,h.DataConstantProperty=Fe,h.DictionaryCoder=Su,h.EXTENT=At,h.ErrorEvent=Xi,h.EvaluationParameters=kt,h.Event=wr,h.Evented=vn,h.FeatureIndex=Au,h.FillBucket=vc,h.FillExtrusionBucket=wc,h.GeoJSONFeature=Iu,h.ImageAtlas=su,h.ImagePosition=Ac,h.KDBush=Vc,h.LineBucket=Tc,h.LineStripIndexArray=class extends t{},h.LngLat=Un,h.MercatorCoordinate=El,h.ONE_EM=li,h.OverscaledTileID=sr,h.PerformanceUtils=rf,h.Point=xe,h.Pos3dArray=class extends Zs{},h.PosArray=O,h.Properties=Ci,h.Protobuf=Sc,h.QuadTriangleArray=class extends Hs{},h.RGBAImage=nr,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=sl,h.TriangleIndexArray=ge,h.Uniform1f=gr,h.Uniform1i=class extends Ti{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 Ti{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 Ti{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=mi,h.UniformMatrix4f=class extends Ti{constructor(i,e){super(i,e),this.current=ai}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=Tu,h.ValidationError=we,h.ZoomHistory=Qo,h.addDynamicAttributes=kc,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=vr})},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):vr},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=xt,h.bindAll=Rt,h.clamp=et,h.clipLine=Cu,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=Ct,h.collisionCircleLayout=bp,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=Dt,h.createFilter=La,h.createLayout=Kt,h.createStyleLayer=function(i){return i.type==="custom"?new jp(i):new Zp[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:lt.removeLayer,args:[d.id]}):u.push(d)}),r=r.concat(l),function(d,f,g){f=f||[];const v=(d=d||[]).map(bn),b=f.map(bn),S=d.reduce(Qr,{}),P=f.reduce(Qr,{}),C=v.slice(),z=Object.create(null);let U,F,K,Q,X,ne,ae;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 Sc(i).readFields(zp,[])},h.pbf=Kh,h.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=At/(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 kt(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new kt(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new kt(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:v}=i.bucket.textSizeData;s.compositeTextSizes=[r["text-size"].possiblyEvaluate(new kt(g),i.canonical),r["text-size"].possiblyEvaluate(new kt(v),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:v}=i.bucket.iconSizeData;s.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new kt(g),i.canonical),r["icon-size"].possiblyEvaluate(new kt(v),i.canonical)]}const l=e.get("text-line-height")*li,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),S=s.layoutTextSize.evaluate(g,{},i.canonical),P=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(),ne=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*li,ae=Va(X)?ne:0,he=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?Ou(he,[Me*li,Oc]):e.get("text-offset").evaluate(g,{},i.canonical).map(Ie=>Ie*li)}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)*li:0,Te=()=>{i.bucket.allowVerticalPlacement&&Fs(X)&&(C.vertical=vl(z,i.glyphMap,i.glyphPositions,i.imagePositions,v,Se,l,he,"left",ae,F,h.WritingMode.vertical,!0,Pe,S,b))};if(!u&&ze){const Me=Be==="auto"?ze.map(ye=>Uc(ye)):[Be];let Ie=!1;for(let ye=0;yethis._layers[fe.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 ue=G[ee];ue||(ue=G[ee]=[]),ue.push(Z)}}}class Y{constructor(I){const M={},L=[];for(const W in I){const G=I[W],ee=M[W]={};for(const ue in G){const fe=G[+ue];if(!fe||fe.bitmap.width===0||fe.bitmap.height===0)continue;const pe={x:0,y:0,w:fe.bitmap.width+2,h:fe.bitmap.height+2};L.push(pe),ee[ue]={rect:pe,metrics:fe.metrics}}}const{w:j,h:Z}=h.potpack(L),J=new h.AlphaImage({width:j||1,height:Z||1});for(const W in I){const G=I[W];for(const ee in G){const ue=G[+ee];if(!ue||ue.bitmap.width===0||ue.bitmap.height===0)continue;const fe=M[W][ee].rect;h.AlphaImage.copy(ue.bitmap,J,{x:0,y:0},{x:fe.x+1,y:fe.y+1},ue.bitmap)}}this.image=J,this.positions=M}}h.register("GlyphAtlas",Y);class Ne{constructor(I){this.tileID=new h.OverscaledTileID(I.tileID.overscaledZ,I.tileID.wrap,I.tileID.canonical.z,I.tileID.canonical.x,I.tileID.canonical.y),this.uid=I.uid,this.zoom=I.zoom,this.pixelRatio=I.pixelRatio,this.tileSize=I.tileSize,this.source=I.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=I.showCollisionBoxes,this.collectResourceTiming=!!I.collectResourceTiming,this.returnDependencies=!!I.returnDependencies,this.promoteId=I.promoteId}parse(I,M,L,j,Z){this.status="parsing",this.data=I,this.collisionBoxArray=new h.CollisionBoxArray;const J=new h.DictionaryCoder(Object.keys(I.layers).sort()),W=new h.FeatureIndex(this.tileID,this.promoteId);W.bucketLayerIDs=[];const G={},ee={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:L},ue=M.familiesBySource[this.source];for(const tt in ue){const ct=I.layers[tt];if(!ct)continue;ct.version===1&&h.warnOnce(`Vector tile source "${this.source}" layer "${tt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Tt=J.encode(tt),Xt=[];for(let Ze=0;Ze=Lt.maxzoom||Lt.visibility!=="none"&&(xe(Ze,this.zoom,L),(G[Lt.id]=Lt.createBucket({index:W.bucketLayerIDs.length,layers:Ze,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Tt,sourceID:this.source})).populate(Xt,ee,this.tileID.canonical),W.bucketLayerIDs.push(Ze.map(Ur=>Ur.id)))}}let fe,pe,$e,Xe;const Le=h.mapObject(ee.glyphDependencies,tt=>Object.keys(tt).map(Number));Object.keys(Le).length?j.send("getGlyphs",{uid:this.uid,stacks:Le,source:this.source,tileID:this.tileID,type:"glyphs"},(tt,ct)=>{fe||(fe=tt,pe=ct,at.call(this))}):pe={};const Oe=Object.keys(ee.iconDependencies);Oe.length?j.send("getImages",{icons:Oe,source:this.source,tileID:this.tileID,type:"icons"},(tt,ct)=>{fe||(fe=tt,$e=ct,at.call(this))}):$e={};const Ge=Object.keys(ee.patternDependencies);function at(){if(fe)return Z(fe);if(pe&&$e&&Xe){const tt=new Y(pe),ct=new h.ImageAtlas($e,Xe);for(const Tt in G){const Xt=G[Tt];Xt instanceof h.SymbolBucket?(xe(Xt.layers,this.zoom,L),h.performSymbolLayout({bucket:Xt,glyphMap:pe,glyphPositions:tt.positions,imageMap:$e,imagePositions:ct.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Xt.hasPattern&&(Xt instanceof h.LineBucket||Xt instanceof h.FillBucket||Xt instanceof h.FillExtrusionBucket)&&(xe(Xt.layers,this.zoom,L),Xt.addFeatures(ee,this.tileID.canonical,ct.patternPositions))}this.status="done",Z(null,{buckets:Object.values(G).filter(Tt=>!Tt.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:tt.image,imageAtlas:ct,glyphMap:this.returnDependencies?pe:null,iconMap:this.returnDependencies?$e:null,glyphPositions:this.returnDependencies?tt.positions:null})}}Ge.length?j.send("getImages",{icons:Ge,source:this.source,tileID:this.tileID,type:"patterns"},(tt,ct)=>{fe||(fe=tt,Xe=ct,at.call(this))}):Xe={},at.call(this)}}function xe(V,I,M){const L=new h.EvaluationParameters(I);for(const j of V)j.recalculate(L,M)}function nt(V,I){const M=h.getArrayBuffer(V.request,(L,j,Z,J)=>{L?I(L):j&&I(null,{vectorTile:new h.vectorTile.VectorTile(new h.Protobuf(j)),rawData:j,cacheControl:Z,expires:J})});return()=>{M.cancel(),I()}}class ot{constructor(I,M,L,j){this.actor=I,this.layerIndex=M,this.availableImages=L,this.loadVectorData=j||nt,this.loading={},this.loaded={}}loadTile(I,M){const L=I.uid;this.loading||(this.loading={});const j=!!(I&&I.request&&I.request.collectResourceTiming)&&new h.RequestPerformance(I.request),Z=this.loading[L]=new Ne(I);Z.abort=this.loadVectorData(I,(J,W)=>{if(delete this.loading[L],J||!W)return Z.status="done",this.loaded[L]=Z,M(J);const G=W.rawData,ee={};W.expires&&(ee.expires=W.expires),W.cacheControl&&(ee.cacheControl=W.cacheControl);const ue={};if(j){const fe=j.finish();fe&&(ue.resourceTiming=JSON.parse(JSON.stringify(fe)))}Z.vectorTile=W.vectorTile,Z.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,(fe,pe)=>{if(fe||!pe)return M(fe);M(null,h.extend({rawTileData:G.slice(0)},pe,ee,ue))}),this.loaded=this.loaded||{},this.loaded[L]=Z})}reloadTile(I,M){const L=this.loaded,j=I.uid,Z=this;if(L&&L[j]){const J=L[j];J.showCollisionBoxes=I.showCollisionBoxes;const W=(G,ee)=>{const ue=J.reloadCallback;ue&&(delete J.reloadCallback,J.parse(J.vectorTile,Z.layerIndex,this.availableImages,Z.actor,ue)),M(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(I,M){const L=this.loading,j=I.uid;L&&L[j]&&L[j].abort&&(L[j].abort(),delete L[j]),M()}removeTile(I,M){const L=this.loaded,j=I.uid;L&&L[j]&&delete L[j],M()}}class We{constructor(){this.loaded={}}loadTile(I,M){const{uid:L,encoding:j,rawImageData:Z}=I,J=h.isImageBitmap(Z)?this.getImageData(Z):Z,W=new h.DEMData(L,J,j);this.loaded=this.loaded||{},this.loaded[L]=W,M(null,W)}getImageData(I){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(I.width,I.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=I.width,this.offscreenCanvas.height=I.height,this.offscreenCanvasContext.drawImage(I,0,0,I.width,I.height);const M=this.offscreenCanvasContext.getImageData(-1,-1,I.width+2,I.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new h.RGBAImage({width:M.width,height:M.height},M.data)}removeTile(I){const M=this.loaded,L=I.uid;M&&M[L]&&delete M[L]}}function xt(V,I){if(V.length!==0){bt(V[0],I);for(var M=1;M=Math.abs(W)?M-G+W:W-G+M,M=G}M+L>=0!=!!I&&V.reverse()}var et=h.getDefaultExportFromCjs(function V(I,M){var L,j=I&&I.type;if(j==="FeatureCollection")for(L=0;L>31}function vr(V,I){for(var M=V.loadGeometry(),L=V.type,j=0,Z=0,J=M.length,W=0;WV},Nn=Math.fround||(Br=new Float32Array(1),V=>(Br[0]=+V,Br[0]));var Br;const bi=3,Gi=5,hi=6;class yn{constructor(I){this.options=Object.assign(Object.create(_n),I),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(I){const{log:M,minZoom:L,maxZoom:j}=this.options;M&&console.time("total time");const Z=`prepare ${I.length} points`;M&&console.time(Z),this.points=I;const J=[];for(let G=0;G=L;G--){const ee=+Date.now();W=this.trees[G]=this._createTree(this._cluster(W,G)),M&&console.log("z%d: %d clusters in %dms",G,W.numItems,+Date.now()-ee)}return M&&console.timeEnd("total time"),this}getClusters(I,M){let L=((I[0]+180)%360+360)%360-180;const j=Math.max(-90,Math.min(90,I[1]));let Z=I[2]===180?180:((I[2]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,I[3]));if(I[2]-I[0]>=360)L=-180,Z=180;else if(L>Z){const fe=this.getClusters([L,j,180,J],M),pe=this.getClusters([-180,j,Z,J],M);return fe.concat(pe)}const W=this.trees[this._limitZoom(M)],G=W.range(Rr(L),br(J),Rr(Z),br(j)),ee=W.data,ue=[];for(const fe of G){const pe=this.stride*fe;ue.push(ee[pe+Gi]>1?xn(ee,pe,this.clusterProps):this.points[ee[pe+bi]])}return ue}getChildren(I){const M=this._getOriginId(I),L=this._getOriginZoom(I),j="No cluster with the specified id.",Z=this.trees[L];if(!Z)throw new Error(j);const J=Z.data;if(M*this.stride>=J.length)throw new Error(j);const W=this.options.radius/(this.options.extent*Math.pow(2,L-1)),G=Z.within(J[M*this.stride],J[M*this.stride+1],W),ee=[];for(const ue of G){const fe=ue*this.stride;J[fe+4]===I&&ee.push(J[fe+Gi]>1?xn(J,fe,this.clusterProps):this.points[J[fe+bi]])}if(ee.length===0)throw new Error(j);return ee}getLeaves(I,M,L){const j=[];return this._appendLeaves(j,I,M=M||10,L=L||0,0),j}getTile(I,M,L){const j=this.trees[this._limitZoom(I)],Z=Math.pow(2,I),{extent:J,radius:W}=this.options,G=W/J,ee=(L-G)/Z,ue=(L+1+G)/Z,fe={features:[]};return this._addTileFeatures(j.range((M-G)/Z,ee,(M+1+G)/Z,ue),j.data,M,L,Z,fe),M===0&&this._addTileFeatures(j.range(1-G/Z,ee,1,ue),j.data,Z,L,Z,fe),M===Z-1&&this._addTileFeatures(j.range(0,ee,G/Z,ue),j.data,-1,L,Z,fe),fe.features.length?fe:null}getClusterExpansionZoom(I){let M=this._getOriginZoom(I)-1;for(;M<=this.options.maxZoom;){const L=this.getChildren(I);if(M++,L.length!==1)break;I=L[0].properties.cluster_id}return M}_appendLeaves(I,M,L,j,Z){const J=this.getChildren(M);for(const W of J){const G=W.properties;if(G&&G.cluster?Z+G.point_count<=j?Z+=G.point_count:Z=this._appendLeaves(I,G.cluster_id,L,j,Z):Z1;let ue,fe,pe;if(ee)ue=Kr(M,G,this.clusterProps),fe=M[G],pe=M[G+1];else{const Le=this.points[M[G+bi]];ue=Le.properties;const[Oe,Ge]=Le.geometry.coordinates;fe=Rr(Oe),pe=br(Ge)}const $e={type:1,geometry:[[Math.round(this.options.extent*(fe*Z-L)),Math.round(this.options.extent*(pe*Z-j))]],tags:ue};let Xe;Xe=ee||this.options.generateId?M[G+bi]:this.points[M[G+bi]].id,Xe!==void 0&&($e.id=Xe),J.features.push($e)}}_limitZoom(I){return Math.max(this.options.minZoom,Math.min(Math.floor(+I),this.options.maxZoom+1))}_cluster(I,M){const{radius:L,extent:j,reduce:Z,minPoints:J}=this.options,W=L/(j*Math.pow(2,M)),G=I.data,ee=[],ue=this.stride;for(let fe=0;feM&&(Oe+=G[at+Gi])}if(Oe>Le&&Oe>=J){let Ge,at=pe*Le,tt=$e*Le,ct=-1;const Tt=((fe/ue|0)<<5)+(M+1)+this.points.length;for(const Xt of Xe){const Ze=Xt*ue;if(G[Ze+2]<=M)continue;G[Ze+2]=M;const Lt=G[Ze+Gi];at+=G[Ze]*Lt,tt+=G[Ze+1]*Lt,G[Ze+4]=Tt,Z&&(Ge||(Ge=this._map(G,fe,!0),ct=this.clusterProps.length,this.clusterProps.push(Ge)),Z(Ge,this._map(G,Ze)))}G[fe+4]=Tt,ee.push(at/Oe,tt/Oe,1/0,Tt,-1,Oe),Z&&ee.push(ct)}else{for(let Ge=0;Ge1)for(const Ge of Xe){const at=Ge*ue;if(!(G[at+2]<=M)){G[at+2]=M;for(let tt=0;tt>5}_getOriginZoom(I){return(I-this.points.length)%32}_map(I,M,L){if(I[M+Gi]>1){const J=this.clusterProps[I[M+hi]];return L?Object.assign({},J):J}const j=this.points[I[M+bi]].properties,Z=this.options.map(j);return L&&Z===j?Object.assign({},Z):Z}}function xn(V,I,M){return{type:"Feature",id:V[I+bi],properties:Kr(V,I,M),geometry:{type:"Point",coordinates:[(L=V[I],360*(L-.5)),wr(V[I+1])]}};var L}function Kr(V,I,M){const L=V[I+Gi],j=L>=1e4?`${Math.round(L/1e3)}k`:L>=1e3?Math.round(L/100)/10+"k":L,Z=V[I+hi],J=Z===-1?{}:Object.assign({},M[Z]);return Object.assign(J,{cluster:!0,cluster_id:V[I+bi],point_count:L,point_count_abbreviated:j})}function Rr(V){return V/360+.5}function br(V){const I=Math.sin(V*Math.PI/180),M=.5-.25*Math.log((1+I)/(1-I))/Math.PI;return M<0?0:M>1?1:M}function wr(V){const I=(180-360*V)*Math.PI/180;return 360*Math.atan(Math.exp(I))/Math.PI-90}function Xi(V,I,M,L){for(var j,Z=L,J=M-I>>1,W=M-I,G=V[I],ee=V[I+1],ue=V[M],fe=V[M+1],pe=I+3;peZ)j=pe,Z=$e;else if($e===Z){var Xe=Math.abs(pe-J);XeL&&(j-I>3&&Xi(V,I,j,L),V[j+2]=Z,M-j>3&&Xi(V,j,M,L))}function vn(V,I,M,L,j,Z){var J=j-M,W=Z-L;if(J!==0||W!==0){var G=((V-M)*J+(I-L)*W)/(J*J+W*W);G>1?(M=j,L=Z):G>0&&(M+=J*G,L+=W*G)}return(J=V-M)*J+(W=I-L)*W}function le(V,I,M,L){var j={id:V===void 0?null:V,type:I,geometry:M,tags:L,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")Fr(Z,J);else if(W==="Polygon"||W==="MultiLineString")for(var G=0;G0&&(J+=L?(j*ee-G*Z)/2:Math.sqrt(Math.pow(G-j,2)+Math.pow(ee-Z,2))),j=G,Z=ee}var ue=I.length-3;I[2]=1,Xi(I,0,ue,M),I[ue+2]=1,I.size=Math.abs(J),I.start=0,I.end=I.size}function Yr(V,I,M,L){for(var j=0;j1?1:M}function Gt(V,I,M,L,j,Z,J,W){if(L/=I,Z>=(M/=I)&&J=L)return null;for(var G=[],ee=0;ee=M&&Xe=L)){var Le=[];if(pe==="Point"||pe==="MultiPoint")Jr(fe,Le,M,L,j);else if(pe==="LineString")bn(fe,Le,M,L,j,!1,W.lineMetrics);else if(pe==="MultiLineString")we(fe,Le,M,L,j,!1);else if(pe==="Polygon")we(fe,Le,M,L,j,!0);else if(pe==="MultiPolygon")for(var Oe=0;Oe=M&&J<=L&&(I.push(V[Z]),I.push(V[Z+1]),I.push(V[Z+2]))}}function bn(V,I,M,L,j,Z,J){for(var W,G,ee=Qr(V),ue=j===0?fi:wn,fe=V.start,pe=0;peM&&(G=ue(ee,$e,Xe,Oe,Ge,M),J&&(ee.start=fe+W*G)):at>L?tt=M&&(G=ue(ee,$e,Xe,Oe,Ge,M),ct=!0),tt>L&&at<=L&&(G=ue(ee,$e,Xe,Oe,Ge,L),ct=!0),!Z&&ct&&(J&&(ee.end=fe+W*G),I.push(ee),ee=Qr(V)),J&&(fe+=W)}var Tt=V.length-3;$e=V[Tt],Xe=V[Tt+1],Le=V[Tt+2],(at=j===0?$e:Xe)>=M&&at<=L&&lr(ee,$e,Xe,Le),Tt=ee.length-3,Z&&Tt>=3&&(ee[Tt]!==ee[0]||ee[Tt+1]!==ee[1])&&lr(ee,ee[0],ee[1],ee[2]),ee.length&&I.push(ee)}function Qr(V){var I=[];return I.size=V.size,I.start=V.start,I.end=V.end,I}function we(V,I,M,L,j,Z){for(var J=0;JJ.maxX&&(J.maxX=ue),fe>J.maxY&&(J.maxY=fe)}return J}function Qt(V,I,M,L){var j=I.geometry,Z=I.type,J=[];if(Z==="Point"||Z==="MultiPoint")for(var W=0;W0&&I.size<(j?J:L))M.numPoints+=I.length/3;else{for(var W=[],G=0;GJ)&&(M.numSimplified++,W.push(I[G]),W.push(I[G+1])),M.numPoints++;j&&function(ee,ue){for(var fe=0,pe=0,$e=ee.length,Xe=$e-2;pe<$e;Xe=pe,pe+=2)fe+=(ee[pe]-ee[Xe])*(ee[pe+1]+ee[Xe+1]);if(fe>0===ue)for(pe=0,$e=ee.length;pe<$e/2;pe+=2){var Le=ee[pe],Oe=ee[pe+1];ee[pe]=ee[$e-2-pe],ee[pe+1]=ee[$e-1-pe],ee[$e-2-pe]=Le,ee[$e-1-pe]=Oe}}(W,Z),V.push(W)}}function Tr(V,I){var M=(I=this.options=function(j,Z){for(var J in Z)j[J]=Z[J];return j}(Object.create(this.options),I)).debug;if(M&&console.time("preprocess data"),I.maxZoom<0||I.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(I.promoteId&&I.generateId)throw new Error("promoteId and generateId cannot be used together.");var L=function(j,Z){var J=[];if(j.type==="FeatureCollection")for(var W=0;W1&&console.time("creation"),pe=this.tiles[fe]=Pi(V,I,M,L,G),this.tileCoords.push({z:I,x:M,y:L}),ee)){ee>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",I,M,L,pe.numFeatures,pe.numPoints,pe.numSimplified),console.timeEnd("creation"));var $e="z"+I;this.stats[$e]=(this.stats[$e]||0)+1,this.total++}if(pe.source=V,j){if(I===G.maxZoom||I===j)continue;var Xe=1<1&&console.time("clipping");var Le,Oe,Ge,at,tt,ct,Tt=.5*G.buffer/G.extent,Xt=.5-Tt,Ze=.5+Tt,Lt=1+Tt;Le=Oe=Ge=at=null,tt=Gt(V,ue,M-Tt,M+Ze,0,pe.minX,pe.maxX,G),ct=Gt(V,ue,M+Xt,M+Lt,0,pe.minX,pe.maxX,G),V=null,tt&&(Le=Gt(tt,ue,L-Tt,L+Ze,1,pe.minY,pe.maxY,G),Oe=Gt(tt,ue,L+Xt,L+Lt,1,pe.minY,pe.maxY,G),tt=null),ct&&(Ge=Gt(ct,ue,L-Tt,L+Ze,1,pe.minY,pe.maxY,G),at=Gt(ct,ue,L+Xt,L+Lt,1,pe.minY,pe.maxY,G),ct=null),ee>1&&console.timeEnd("clipping"),W.push(Le||[],I+1,2*M,2*L),W.push(Oe||[],I+1,2*M,2*L+1),W.push(Ge||[],I+1,2*M+1,2*L),W.push(at||[],I+1,2*M+1,2*L+1)}}},Tr.prototype.getTile=function(V,I,M){var L=this.options,j=L.extent,Z=L.debug;if(V<0||V>24)return null;var J=1<1&&console.log("drilling down to z%d-%d-%d",V,I,M);for(var G,ee=V,ue=I,fe=M;!G&&ee>0;)ee--,ue=Math.floor(ue/2),fe=Math.floor(fe/2),G=this.tiles[Er(ee,ue,fe)];return G&&G.source?(Z>1&&console.log("found parent tile z%d-%d-%d",ee,ue,fe),Z>1&&console.time("drilling down"),this.splitTile(G.source,ee,ue,fe,V,I,M),Z>1&&console.timeEnd("drilling down"),this.tiles[W]?Qe(this.tiles[W],j):null):null};class jn extends ot{constructor(I,M,L,j){super(I,M,L,St),this._dataUpdateable=new Map,this.loadGeoJSON=(Z,J)=>{const{promoteId:W}=Z;if(Z.request)return h.getJSON(Z.request,(G,ee,ue,fe)=>{this._dataUpdateable=Sr(ee,W)?ui(ee,W):void 0,J(G,ee,ue,fe)});if(typeof Z.data=="string")try{const G=JSON.parse(Z.data);this._dataUpdateable=Sr(G,W)?ui(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,ue){var fe,pe,$e,Xe;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=er(Le,ue);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 Ge=!Le.removeAllProperties&&(((fe=Le.removeProperties)===null||fe===void 0?void 0:fe.length)>0||((pe=Le.addOrUpdateProperties)===null||pe===void 0?void 0:pe.length)>0);if((Le.newGeometry||Le.removeAllProperties||Ge)&&(Oe={...Oe},G.set(Le.id,Oe),Ge&&(Oe.properties={...Oe.properties})),Le.newGeometry&&(Oe.geometry=Le.newGeometry),Le.removeAllProperties)Oe.properties={};else if((($e=Le.removeProperties)===null||$e===void 0?void 0:$e.length)>0)for(const at of Le.removeProperties)Object.prototype.hasOwnProperty.call(Oe.properties,at)&&delete Oe.properties[at];if(((Xe=Le.addOrUpdateProperties)===null||Xe===void 0?void 0:Xe.length)>0)for(const{key:at,value:tt}of Le.addOrUpdateProperties)Oe.properties[at]=tt}}(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:()=>{}}},j&&(this.loadGeoJSON=j)}loadData(I,M){var L;(L=this._pendingRequest)===null||L===void 0||L.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const j=!!(I&&I.request&&I.request.collectResourceTiming)&&new h.RequestPerformance(I.request);this._pendingCallback=M,this._pendingRequest=this.loadGeoJSON(I,(Z,J)=>{if(delete this._pendingCallback,delete this._pendingRequest,Z||!J)return M(Z);if(typeof J!="object")return M(new Error(`Input data given to '${I.source}' is not a valid GeoJSON object.`));{et(J,!0);try{if(I.filter){const G=h.createExpression(I.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(G.result==="error")throw new Error(G.value.map(ue=>`${ue.key}: ${ue.message}`).join(", "));J={type:"FeatureCollection",features:J.features.filter(ue=>G.value.evaluate({zoom:0},ue))}}this._geoJSONIndex=I.cluster?new yn(function({superclusterOptions:G,clusterProperties:ee}){if(!ee||!G)return G;const ue={},fe={},pe={accumulated:null,zoom:0},$e={properties:null},Xe=Object.keys(ee);for(const Le of Xe){const[Oe,Ge]=ee[Le],at=h.createExpression(Ge),tt=h.createExpression(typeof Oe=="string"?[Oe,["accumulated"],["get",Le]]:Oe);ue[Le]=at.value,fe[Le]=tt.value}return G.map=Le=>{$e.properties=Le;const Oe={};for(const Ge of Xe)Oe[Ge]=ue[Ge].evaluate(pe,$e);return Oe},G.reduce=(Le,Oe)=>{$e.properties=Oe;for(const Ge of Xe)pe.accumulated=Le[Ge],Le[Ge]=fe[Ge].evaluate(pe,$e)},G}(I)).load(J.features):function(G,ee){return new Tr(G,ee)}(J,I.geojsonVtOptions)}catch(G){return M(G)}this.loaded={};const W={};if(j){const G=j.finish();G&&(W.resourceTiming={},W.resourceTiming[I.source]=JSON.parse(JSON.stringify(G)))}M(null,W)}})}reloadTile(I,M){const L=this.loaded;return L&&L[I.uid]?super.reloadTile(I,M):this.loadTile(I,M)}removeSource(I,M){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),M()}getClusterExpansionZoom(I,M){try{M(null,this._geoJSONIndex.getClusterExpansionZoom(I.clusterId))}catch(L){M(L)}}getClusterChildren(I,M){try{M(null,this._geoJSONIndex.getChildren(I.clusterId))}catch(L){M(L)}}getClusterLeaves(I,M){try{M(null,this._geoJSONIndex.getLeaves(I.clusterId,I.limit,I.offset))}catch(L){M(L)}}}class cr{constructor(I){this.self=I,this.actor=new h.Actor(I,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:ot,geojson:jn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(M,L)=>{if(this.workerSourceTypes[M])throw new Error(`Worker source with name "${M}" already registered.`);this.workerSourceTypes[M]=L},this.self.registerRTLTextPlugin=M=>{if(h.plugin.isParsed())throw new Error("RTL text plugin already registered.");h.plugin.applyArabicShaping=M.applyArabicShaping,h.plugin.processBidirectionalText=M.processBidirectionalText,h.plugin.processStyledBidirectionalText=M.processStyledBidirectionalText}}setReferrer(I,M){this.referrer=M}setImages(I,M,L){this.availableImages[I]=M;for(const j in this.workerSources[I]){const Z=this.workerSources[I][j];for(const J in Z)Z[J].availableImages=M}L()}setLayers(I,M,L){this.getLayerIndex(I).replace(M),L()}updateLayers(I,M,L){this.getLayerIndex(I).update(M.layers,M.removedIds),L()}loadTile(I,M,L){this.getWorkerSource(I,M.type,M.source).loadTile(M,L)}loadDEMTile(I,M,L){this.getDEMWorkerSource(I,M.source).loadTile(M,L)}reloadTile(I,M,L){this.getWorkerSource(I,M.type,M.source).reloadTile(M,L)}abortTile(I,M,L){this.getWorkerSource(I,M.type,M.source).abortTile(M,L)}removeTile(I,M,L){this.getWorkerSource(I,M.type,M.source).removeTile(M,L)}removeDEMTile(I,M){this.getDEMWorkerSource(I,M.source).removeTile(M)}removeSource(I,M,L){if(!this.workerSources[I]||!this.workerSources[I][M.type]||!this.workerSources[I][M.type][M.source])return;const j=this.workerSources[I][M.type][M.source];delete this.workerSources[I][M.type][M.source],j.removeSource!==void 0?j.removeSource(M,L):L()}loadWorkerSource(I,M,L){try{this.self.importScripts(M.url),L()}catch(j){L(j.toString())}}syncRTLPluginState(I,M,L){try{h.plugin.setState(M);const j=h.plugin.getPluginURL();if(h.plugin.isLoaded()&&!h.plugin.isParsed()&&j!=null){this.self.importScripts(j);const Z=h.plugin.isParsed();L(Z?void 0:new Error(`RTL Text Plugin failed to import scripts from ${j}`),Z)}}catch(j){L(j.toString())}}getAvailableImages(I){let M=this.availableImages[I];return M||(M=[]),M}getLayerIndex(I){let M=this.layerIndexes[I];return M||(M=this.layerIndexes[I]=new ce),M}getWorkerSource(I,M,L){if(this.workerSources[I]||(this.workerSources[I]={}),this.workerSources[I][M]||(this.workerSources[I][M]={}),!this.workerSources[I][M][L]){const j={send:(Z,J,W)=>{this.actor.send(Z,J,W,I)}};this.workerSources[I][M][L]=new this.workerSourceTypes[M](j,this.getLayerIndex(I),this.getAvailableImages(I))}return this.workerSources[I][M][L]}getDEMWorkerSource(I,M){return this.demWorkerSources[I]||(this.demWorkerSources[I]={}),this.demWorkerSources[I][M]||(this.demWorkerSources[I][M]=new We),this.demWorkerSources[I][M]}}return h.isWorker()&&(self.worker=new cr(self)),cr}),ie(["./shared"],function(h){var ce="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)=>{Ne.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,q)=>{m(x,k,O,B,R,q)})},m=(x,T,w,k,O,B)=>{w?T(w):k instanceof HTMLImageElement||k instanceof ImageBitmap?T(null,k):k&&((R,q)=>{typeof createImageBitmap=="function"?h.arrayBufferToImageBitmap(R,q):h.arrayBufferToImage(R,q)})(k,(R,q)=>{R!=null?T(R):q!=null&&T(null,q,{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=""}}}}(bt||(bt={})),bt.resetRequestQueue();var et,Bt=bt;(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"})(et||(et={}));class pt{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(ri);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 ri=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Rt(o){var t=new h.ARRAY_TYPE(3);return t[0]=o[0],t[1]=o[1],t[2]=o[2],t}var Ai,Mt=function(o,t,n){return o[0]=t[0]-n[0],o[1]=t[1]-n[1],o[2]=t[2]-n[2],o};Ai=new h.ARRAY_TYPE(3),h.ARRAY_TYPE!=Float32Array&&(Ai[0]=0,Ai[1]=0,Ai[2]=0);var Ct=function(o){var t=o[0],n=o[1];return t*t+n*n};function ni(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 Vt(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:q,stretchY:H,content:se}=_[x];p[m][x]={data:null,pixelRatio:R,sdf:B,stretchX:q,stretchY:H,content:se,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 yt{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 Zi 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]=xr}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]=[],vr.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 vr.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}}}}vr.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}`),et.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)}})},vr.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:q,gridOuter:H}=this;B.clearRect(R,R,y,_),B.fillText(o,R,R+m);const se=B.getImageData(R,R,y,_);H.fill(xr,0,w),q.fill(0,0,w);for(let $=0;$<_;$++)for(let re=0;re0?_e*_e:0,q[me]=_e<0?_e*_e:0}}Lr(H,0,0,x,T,x,this.f,this.v,this.z),Lr(q,R,R,y,_,x,this.f,this.v,this.z);for(let $=0;$1&&(_=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 Gi(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,et.Source),a):h.exported.frame(()=>a(null,o))}bi.Actor=h.Actor;class hi{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 hi))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(hi.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 hi?t:t&&new hi(t)}static fromLngLat(t,n=0){const a=360*n/40075017,c=a/Math.cos(Math.PI/180*t.lat);return new hi(new h.LngLat(t.lng-c,t.lat-a),new h.LngLat(t.lng+c,t.lat+a))}}class yn{constructor(t,n,a){this.bounds=hi.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 yn(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,et.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 Kr 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=Gi(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 yn(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=Bt.getImage(this.map._requestManager.transformRequest(a,et.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 yt(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 Rr extends Kr{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=Bt.getImage(this.map._requestManager.transformRequest(a,et.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)&&(_n==null&&(_n=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),_n)?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 wr=h.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Xi 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=Bt.getImage(this.map._requestManager.transformRequest(this.url,et.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,wr.members)),this.boundsSegments||(this.boundsSegments=h.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new yt(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 vn extends Xi{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,et.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,wr.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 yt(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 Xi{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,wr.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 yt(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 Fr={vector:xn,raster:Kr,"raster-dem":Rr,geojson:br,video:vn,image:Xi,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 wt(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(lt);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 k={},O={};for(const B of w){const R=B.queryResults,q=B.wrappedTileID,H=O[q]=O[q]||{};for(const se in R){const $=R[se],re=H[se]=H[se]||{},oe=k[se]=k[se]||[];for(const me of $)re[me.featureIndex]||(re[me.featureIndex]=!0,oe.push(me))}}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 lt(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 Yr{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 yt(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new yt(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 Gt 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 Fr[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(Jr).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(Jr).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-Gt.maxOverzooming,this._source.minzoom),m=Math.max(c+Gt.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(bn(this._source.type)){const T={},w={},k=Object.keys(_),O=h.exported.now();for(const B of k){const R=_[B],q=this._tiles[B];if(!q||q.fadeEndTime!==0&&q.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 q of a)this._tiles[q.key].hasData()?B[q.key]=q:R[q.key]=q;for(const q in R){const H=R[q].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[q])}for(const q in R){const H=this.findLoadedParent(R[q],this._source.minzoom);if(H){B[H.tileID.key]=_[H.tileID.key]=H.tileID;for(const se in B)B[se].isChildOf(H.tileID)&&delete B[se]}}for(const q in this._tiles)B[q]||(this._coveredTiles[q]=!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-Gt.maxOverzooming,this._source.minzoom),m=Math.max(n+Gt.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 Yr(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&&$[1].y+se>=0){const re=y.map(me=>q.getTilePoint(me)),oe=_.map(me=>q.getTilePoint(me));c.push({tile:R,tileID:q,queryGeometry:re,cameraQueryGeometry:oe,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(bn(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 Jr(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 bn(o){return o==="raster"||o==="image"||o==="video"}Gt.maxOverzooming=10,Gt.maxUnderzooming=3;const Qr="mapboxgl_preloaded_worker_pool";class we{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Qr]}numActive(){return Object.keys(this.active).length}}const lr=Math.floor(h.exported.hardwareConcurrency/2);let fi;function wn(){return fi||(fi=new we),fi}we.workerCount=h.isSafari(globalThis)?Math.max(Math.min(lr,3),1):1;class Or{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 be(o,t){let n=!0;return o==="always"||o!=="never"&&t!=="never"||(n=!1),n}class Qe{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 q=4*R,H=this.boxKeys[R];if(t<=B[q+2]&&n<=B[q+3]&&a>=B[q+0]&&c>=B[q+1]&&(!_||_(H))&&(!T||!be(w,H.overlapMode))&&(m.push({key:H,x1:B[q],y1:B[q+1],x2:B[q+2],y2:B[q+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 q=3*R,H=this.circleKeys[R];if(this._circleAndRectCollide(B[q],B[q+1],B[q+2],t,n,a,c)&&(!_||_(H))&&(!T||!be(w,H.overlapMode))){const se=B[q],$=B[q+1],re=B[q+2];if(m.push({key:H,x1:se-re,y1:$-re,x2:se+re,y2:$+re}),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 q=4*R,H=this.boxKeys[R];if(this._circleAndRectCollide(x.x,x.y,x.radius,B[q+0],B[q+1],B[q+2],B[q+3])&&(!_||_(H))&&!be(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 q=3*R,H=this.circleKeys[R];if(this._circlesCollide(B[q],B[q+1],B[q+2],x.x,x.y,x.radius)&&(!_||_(H))&&!be(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 Ye(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 Pi(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 Qt(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],j(a,a,t));const c=a[3];return{point:new h.Point(a[0]/c,a[1]/c),signedDistanceFromCamera:c}}function He(o,t){return .5+o/t*.5}function Tr(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 Er(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,q=n.transform.width/n.transform.height;let H=!1;for(let se=0;seMath.abs(n.x-t.x)*a?{useVertical:!0}:(o===h.WritingMode.vertical?t.yn.x)?{needsFlipping:!0}:null}function ui(o,t,n,a,c,p,m,y,_,x,T,w,k,O,B,R){const q=t/24,H=o.lineOffsetX*q,se=o.lineOffsetY*q;let $;if(o.numGlyphs>1){const re=o.glyphStartIndex+o.numGlyphs,oe=o.lineStartIndex,me=o.lineStartIndex+o.lineLength,_e=er(q,y,H,se,n,T,w,o,_,p,k,B,R);if(!_e)return{notEnoughRoom:!0};const ve=Qt(_e.first.point,m,R).point,ge=Qt(_e.last.point,m,R).point;if(a&&!n){const Ce=Sr(o.writingMode,ve,ge,O);if(Ce)return Ce}$=[_e.first];for(let Ce=o.glyphStartIndex+1;Ce0?ve.point:St(w,_e,oe,1,c,R),Ce=Sr(o.writingMode,oe,ge,O);if(Ce)return Ce}const re=I(q*y.getoffsetX(o.glyphStartIndex),H,se,n,T,w,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,_,p,k,B,R);if(!re)return{notEnoughRoom:!0};$=[re]}for(const re of $)h.addDynamicAttributes(x,re.point,re.angle);return{}}function St(o,t,n,a,c,p){const m=Qt(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)),k=Qt(w,c,y);if(k.signedDistanceFromCamera>0)return n.projections[o]=k.point,k.point;const O=o-x;return St(m===0?p:new h.Point(a.getx(O),a.gety(O)),w,_,T-m+1,c,y)}function cr(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),k=cr(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 I(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,q=0;a&&(R*=-1,q=Math.PI),R<0&&(q+=Math.PI);let H,se,$=R>0?y+m:y+m+1,re=c,oe=c,me=0,_e=0;const ve=Math.abs(B),ge=[];let Ce;for(;me+_e<=ve;){if($+=R,$=_)return null;me+=_e,oe=re,se=H;const Ee={projectionCache:w,lineVertexArray:x,labelPlaneMatrix:T,tileAnchorPoint:p,distanceFromAnchor:me,getElevation:O,previousVertex:oe,direction:R,absOffsetX:ve};if(re=jn($,Ee),n===0)ge.push(oe),Ce=re.sub(oe);else{let je;const ke=re.sub(oe);je=ke.mag()===0?cr(jn($+R,Ee).sub(re),n,R):cr(ke,n,R),se||(se=oe.add(je)),H=V($,je,re,y,_,se,n,Ee),ge.push(se),Ce=H.sub(se)}_e=Ce.mag()}const Ue=Ce._mult((ve-me)/_e)._add(se||oe),Ke=q+Math.atan2(re.y-oe.y,re.x-oe.x);return ge.push(Ue),{point:Ue,angle:k?Ke:0,path:ge}}const M=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function L(o,t){for(let n=0;n=1;dt--)ke.push(Ee.path[dt]);for(let dt=1;dtQt(Je,_,B));ke=dt.some(Je=>Je.signedDistanceFromCamera<=0)?[]:dt.map(Je=>Je.point)}let qt=[];if(ke.length>0){const dt=ke[0].clone(),Je=ke[0].clone();for(let Ot=1;Ot=Ce.x&&Je.x<=Ue.x&&dt.y>=Ce.y&&Je.y<=Ue.y?[ke]:Je.xUe.x||Je.yUe.y?[]:h.clipLine([ke],Ce.x,Ce.y,Ue.x,Ue.y)}for(const dt of qt){Ke.reset(dt,.25*ge);let Je=0;Je=Ke.length<=.5*ge?1:Math.ceil(Ke.paddedLength/ut)+1;for(let Ot=0;Ot=this.screenRightBoundary||cthis.screenBottomBoundary}isInsideGrid(t,n,a,c){return a>=0&&t=0&&na.collisionGroupID===n}}return this.collisionGroups[t]}}function Xe(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 $e(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=Ye(w,k,O,this.transform,B);let q=null;if(k){const se=Pi(w,k,O,this.transform,B);q=h.multiply([],this.transform.labelPlaneMatrix,se)}this.retainedQueryData[p.bucketInstanceId]=new pe(p.bucketInstanceId,m,p.sourceLayerIndex,p.index,a.tileID);const H={bucket:p,layout:_,posMatrix:w,textLabelPlaneMatrix:R,labelToScreenMatrix:q,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 se of p.sortKeyRanges){const{sortKey:$,symbolInstanceStart:re,symbolInstanceEnd:oe}=se;t.push({sortKey:$,symbolInstanceStart:re,symbolInstanceEnd:oe,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,q){const H=[k.textOffset0,k.textOffset1],se=Xe(t,a,c,H,p),$=this.collisionIndex.placeCollisionBox(Le(n,se.x,se.y,m,y,this.transform.angle),w,_,x,T.predicate,q);if((!R||this.collisionIndex.placeCollisionBox(Le(R,se.x,se.y,m,y,this.transform.angle),w,_,x,T.predicate,q).box.length!==0)&&$.box.length>0){let re;if(this.prevPlacement&&this.prevPlacement.variableOffsets[k.crossTileID]&&this.prevPlacement.placements[k.crossTileID]&&this.prevPlacement.placements[k.crossTileID].text&&(re=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:re},this.markUsedJustification(O,t,k,B),O.allowVerticalPlacement&&(this.markUsedOrientation(O,B,k),this.placedOrientations[k.crossTileID]=B),{shift:se,placedGlyphBoxes:$}}}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"),q=h.getOverlapMode(p,"text-overlap","text-allow-overlap"),H=q==="always",se=h.getOverlapMode(p,"icon-overlap","icon-allow-overlap"),$=se==="always",re=p.get("text-rotation-alignment")==="map",oe=p.get("text-pitch-alignment")==="map",me=p.get("icon-text-fit")!=="none",_e=p.get("symbol-z-order")==="viewport-y",ve=H&&($||!c.hasIconData()||R),ge=$&&(H||!c.hasTextData()||B);!c.collisionArrays&&w&&c.deserializeCollisionBoxes(w);const Ce=this.retainedQueryData[c.bucketInstanceId].tileID,Ue=this.terrain?(Ee,je)=>this.terrain.getElevation(Ce,Ee,je):null,Ke=(Ee,je)=>{if(n[Ee.crossTileID])return;if(T)return void(this.placements[Ee.crossTileID]=new ue(!1,!1,!1));let ke=!1,ut=!1,qt=!0,dt=null,Je={box:null,offscreen:null},Ot={box:null,offscreen:null},wi=null,jt=null,si=null,Fi=0,ir=0,rr=0;je.textFeatureIndex?Fi=je.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(Fi=Ee.featureIndex),je.verticalTextFeatureIndex&&(ir=je.verticalTextFeatureIndex);const Ti=je.textBox;if(Ti){const mi=ft=>{let ei=h.WritingMode.horizontal;if(c.allowVerticalPlacement&&!ft&&this.prevPlacement){const oi=this.prevPlacement.placedOrientations[Ee.crossTileID];oi&&(this.placedOrientations[Ee.crossTileID]=oi,ei=oi,this.markUsedOrientation(c,ei,Ee))}return ei},ai=(ft,ei)=>{if(c.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&je.verticalTextBox){for(const oi of c.writingModes)if(oi===h.WritingMode.vertical?(Je=ei(),Ot=Je):Je=ft(),Je&&Je.box&&Je.box.length)break}else Je=ft()};if(p.get("text-variable-anchor")){let ft=p.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ee.crossTileID]){const gt=this.prevPlacement.variableOffsets[Ee.crossTileID];ft.indexOf(gt.anchor)>0&&(ft=ft.filter(ti=>ti!==gt.anchor),ft.unshift(gt.anchor))}const ei=(gt,ti,Oi)=>{const Qs=gt.x2-gt.x1,Mr=gt.y2-gt.y1,ac=Ee.textBoxScale,cl=me&&se==="never"?ti:null;let At={box:[],offscreen:!1};const Qa=q!=="never"?2*ft.length:ft.length;for(let cs=0;cs=ft.length?q:"never",Ee,c,Oi,cl,Ue);if(Cr&&(At=Cr.placedGlyphBoxes,At&&At.box&&At.box.length)){ke=!0,dt=Cr.shift;break}}return At};ai(()=>ei(Ti,je.iconBox,h.WritingMode.horizontal),()=>{const gt=je.verticalTextBox;return c.allowVerticalPlacement&&!(Je&&Je.box&&Je.box.length)&&Ee.numVerticalGlyphVertices>0&>?ei(gt,je.verticalIconBox,h.WritingMode.vertical):{box:null,offscreen:null}}),Je&&(ke=Je.box,qt=Je.offscreen);const oi=mi(Je&&Je.box);if(!ke&&this.prevPlacement){const gt=this.prevPlacement.variableOffsets[Ee.crossTileID];gt&&(this.variableOffsets[Ee.crossTileID]=gt,this.markUsedJustification(c,gt.anchor,Ee,oi))}}else{const ft=(ei,oi)=>{const gt=this.collisionIndex.placeCollisionBox(ei,q,x,m,O.predicate,Ue);return gt&>.box&>.box.length&&(this.markUsedOrientation(c,oi,Ee),this.placedOrientations[Ee.crossTileID]=oi),gt};ai(()=>ft(Ti,h.WritingMode.horizontal),()=>{const ei=je.verticalTextBox;return c.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&ei?ft(ei,h.WritingMode.vertical):{box:null,offscreen:null}}),mi(Je&&Je.box&&Je.box.length)}}if(wi=Je,ke=wi&&wi.box&&wi.box.length>0,qt=wi&&wi.offscreen,Ee.useRuntimeCollisionCircles){const mi=c.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),ai=h.evaluateSizeForFeature(c.textSizeData,k,mi),ft=p.get("text-padding");jt=this.collisionIndex.placeCollisionCircles(q,mi,c.lineVertexArray,c.glyphOffsetArray,ai,m,y,_,a,oe,O.predicate,Ee.collisionCircleDiameter,ft,Ue),jt.circles.length&&jt.collisionDetected&&!a&&h.warnOnce("Collisions detected, but collision boxes are not shown"),ke=H||jt.circles.length>0&&!jt.collisionDetected,qt=qt&&jt.offscreen}if(je.iconFeatureIndex&&(rr=je.iconFeatureIndex),je.iconBox){const mi=ai=>{const ft=me&&dt?Le(ai,dt.x,dt.y,re,oe,this.transform.angle):ai;return this.collisionIndex.placeCollisionBox(ft,se,x,m,O.predicate,Ue)};Ot&&Ot.box&&Ot.box.length&&je.verticalIconBox?(si=mi(je.verticalIconBox),ut=si.box.length>0):(si=mi(je.iconBox),ut=si.box.length>0),qt=qt&&si.offscreen}const gr=B||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,ls=R||Ee.numIconVertices===0;if(gr||ls?ls?gr||(ut=ut&&ke):ke=ut&&ke:ut=ke=ut&&ke,ke&&wi&&wi.box&&this.collisionIndex.insertCollisionBox(wi.box,q,p.get("text-ignore-placement"),c.bucketInstanceId,Ot&&Ot.box&&ir?ir:Fi,O.ID),ut&&si&&this.collisionIndex.insertCollisionBox(si.box,se,p.get("icon-ignore-placement"),c.bucketInstanceId,rr,O.ID),jt&&(ke&&this.collisionIndex.insertCollisionCircles(jt.circles,q,p.get("text-ignore-placement"),c.bucketInstanceId,Fi,O.ID),a)){const mi=c.bucketInstanceId;let ai=this.collisionCircleArrays[mi];ai===void 0&&(ai=this.collisionCircleArrays[mi]=new fe);for(let ft=0;ft=0;--je){const ke=Ee[je];Ke(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,q)=>{for(let H=0;H0,oe=this.placedOrientations[R.crossTileID],me=oe===h.WritingMode.vertical,_e=oe===h.WritingMode.horizontal||oe===h.WritingMode.horizontalOnly;if(q>0||H>0){const ve=Ur($.text);O(t.text,q,me?di:ve),O(t.text,H,_e?di:ve);const ge=$.text.isHidden();[R.rightJustifiedTextSymbolIndex,R.centerJustifiedTextSymbolIndex,R.leftJustifiedTextSymbolIndex].forEach(Ke=>{Ke>=0&&(t.text.placedSymbolArray.get(Ke).hidden=ge||me?1:0)}),R.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(R.verticalPlacedTextSymbolIndex).hidden=ge||_e?1:0);const Ce=this.variableOffsets[R.crossTileID];Ce&&this.markUsedJustification(t,Ce.anchor,R,oe);const Ue=this.placedOrientations[R.crossTileID];Ue&&(this.markUsedJustification(t,"left",R,Ue),this.markUsedOrientation(t,Ue,R))}if(re){const ve=Ur($.icon),ge=!(w&&R.verticalPlacedIconSymbolIndex&&me);R.placedIconSymbolIndex>=0&&(O(t.icon,R.numIconVertices,ge?ve:di),t.icon.placedSymbolArray.get(R.placedIconSymbolIndex).hidden=$.icon.isHidden()),R.verticalPlacedIconSymbolIndex>=0&&(O(t.icon,R.numVerticalIconVertices,ge?di:ve),t.icon.placedSymbolArray.get(R.verticalPlacedIconSymbolIndex).hidden=$.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ve=t.collisionArrays[B];if(ve){let ge=new h.Point(0,0);if(ve.textBox||ve.verticalTextBox){let Ue=!0;if(_){const Ke=this.variableOffsets[se];Ke?(ge=Xe(Ke.anchor,Ke.width,Ke.height,Ke.textOffset,Ke.textBoxScale),x&&ge._rotate(T?this.transform.angle:-this.transform.angle)):Ue=!1}ve.textBox&&Ge(t.textCollisionBox.collisionVertexArray,$.text.placed,!Ue||me,ge.x,ge.y),ve.verticalTextBox&&Ge(t.textCollisionBox.collisionVertexArray,$.text.placed,!Ue||_e,ge.x,ge.y)}const Ce=!!(!_e&&ve.verticalIconBox);ve.iconBox&&Ge(t.iconCollisionBox.collisionVertexArray,$.icon.placed,Ce,w?ge.x:0,w?ge.y:0),ve.verticalIconBox&&Ge(t.iconCollisionBox.collisionVertexArray,$.icon.placed,!Ce,w?ge.x:0,w?ge.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 Ge(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 at=Math.pow(2,25),tt=Math.pow(2,24),ct=Math.pow(2,17),Tt=Math.pow(2,16),Xt=Math.pow(2,9),Ze=Math.pow(2,8),Lt=Math.pow(2,1);function Ur(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*at+t*tt+n*ct+t*Tt+n*Xt+t*Ze+n*Lt+t}const di=0;class Li{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 Li(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 Tn=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*Tn),y:Math.floor(_.anchorY*Tn)})),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=Tn/Math.pow(2,_-p),T=(y*h.EXTENT+t.anchorY)*x,w=c*h.EXTENT*Tn;return{x:Math.floor((m*h.EXTENT+t.anchorX)*x-a*h.EXTENT*Tn),y:Math.floor(T-w)}}findMatches(t,n,a){const c=this.tileID.canonical.zt)}}class Wt{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 Nt=(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"]),tr=h.pick(h.operations,["setCenter","setZoom","setBearing","setPitch"]),Ao=h.emptyStyle();class pi extends h.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new bi(wn(),this,t._getMapId()),this.imageManager=new Zi,this.imageManager.setEventedParent(this),this.glyphManager=new vr(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new Br(256,512),this.crossTileSymbolIndex=new Vr,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=pi.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,et.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(Ao,{validate:!1})}_load(t,n,a){const c=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!Nt(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 _=ni(c),x=_.length,T=m>1?"@2x":"",w={},k={},O={};for(const{id:B,url:R}of _){const q=p.transformRequest(p.normalizeSpriteURL(R,T,".json"),et.SpriteJSON),H=`${B}_${q.url}`;w[H]=h.getJSON(q,(re,oe)=>{delete w[H],k[B]=oe,Vt(y,k,O,re,x)});const se=p.transformRequest(p.normalizeSpriteURL(R,T,".png"),et.SpriteImage),$=`${B}_${se.url}`;w[$]=Bt.getImage(se,(re,oe)=>{delete w[$],O[B]=oe,Vt(y,k,O,re,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,Nt(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 tr));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 Gt(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(Nt(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 ve=H.featureSortOrder;if(ve){const ge=ve.indexOf(me.featureIndex);return ve.indexOf(_e.featureIndex)-ge}return _e.featureIndex-me.featureIndex});for(const me of oe)re.push(me)}}for(const H in B)B[H].forEach(se=>{const $=se.feature,re=x[y[H].source].getFeatureState($.layer["source-layer"],$.id);$.source=$.layer.source,$.layer["source-layer"]&&($.sourceLayer=$.layer["source-layer"]),$.state=re});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 Wi(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=[...ni(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=ni(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 ni(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)))}}pi.getSourceType=function(o){return Fr[o]},pi.setSourceType=function(o,t){Fr[o]=t},pi.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 Nr={prelude:mt(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -526,7 +526,7 @@ 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:mt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",ys),terrainDepth:mt("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);}",ys),terrainCoords:mt("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);}",ys)};function mt(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"?` +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:mt("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",_s),terrainDepth:mt("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:mt("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 mt(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 @@ -575,9 +575,9 @@ uniform ${T} ${w} u_${k}; #else ${T} ${w} ${k} = u_${k}; #endif -`}),staticAttributes:a,staticUniforms:m}}class $r{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(_e,ve.u_depth),u_terrain:new h.Uniform1i(_e,ve.u_terrain),u_terrain_dim:new h.Uniform1f(_e,ve.u_terrain_dim),u_terrain_matrix:new h.UniformMatrix4f(_e,ve.u_terrain_matrix),u_terrain_unpack:new h.Uniform4f(_e,ve.u_terrain_unpack),u_terrain_exaggeration:new h.Uniform1f(_e,ve.u_terrain_exaggeration)}))(t,me),this.binderUniforms=c?c.getUniforms(t,me):[]}draw(t,n,a,c,p,m,y,_,x,T,w,k,O,B,R,$,K,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 oe in this.terrainUniforms)this.terrainUniforms[oe].set(_[oe])}for(const oe in this.fixedUniforms)this.fixedUniforms[oe].set(y[oe]);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 oe of k.get()){const me=oe.vaos||(oe.vaos={});(me[x]||(me[x]=new $r)).bind(t,this,T,R?R.getPaintVertexBuffers():[],w,oe.vertexOffset,$,K,re),N.drawElements(n,oe.primitiveLength*te,N.UNSIGNED_SHORT,oe.primitiveOffset*te*2)}}}function Ao(o,t,n){const a=1/H(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 Po=(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(Po(o,t,n,a),Ao(p,t,m),{u_height_factor:-Math.pow(2,c.overscaledZ)/m.tileSize/8}),Mo=o=>({u_matrix:o}),xa=(o,t,n,a)=>h.extend(Mo(o),Ao(n,t,a)),Nl=(o,t)=>({u_matrix:o,u_world:t}),Co=(o,t,n,a,c)=>h.extend(xa(o,t,n,a),{u_world:c}),$l=(o,t,n,a)=>{const c=o.transform;let p,m;if(a.paint.get("circle-pitch-alignment")==="map"){const y=H(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=H(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}),ko=(o,t,n,a)=>({u_matrix:o,u_extrude_scale:H(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 Ir=(o,t,n,a)=>{const c=o.transform;return{u_matrix:Tn(o,t,n,a),u_ratio:1/H(t,1,c.zoom),u_device_pixel_ratio:o.pixelRatio,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]]}},vs=(o,t,n,a,c)=>h.extend(Ir(o,t,n,c),{u_image:0,u_image_height:a}),Hi=(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/H(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]]}},bs=(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(Ir(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/H(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 ws=(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:Ts(c.paint.get("raster-hue-rotate"))};var p,m};function Ts(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})},Es=(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}),Bi=(o,t,n)=>({u_matrix:o,u_opacity:t,u_color:n}),Ri=(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),K=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/H(x,1,_.transform.tileZoom),u_pixel_coord_upper:[$>>16,K>>16],u_pixel_coord_lower:[65535&$,65535&K]}}(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 Ss{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 Is={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=_e;h.mul(Ce,me.placementInvProjMatrix,o.transform.glCoordMatrix),h.mul(Ce,Ce,me.placementViewportMatrix),T.push({circleArray:ge,circleOffset:k,transform:Ue,invTransform:Ce,coord:te}),w+=ge.length/4,k=w}ve&&x.draw(y,_.LINES,st.disabled,It.disabled,o.colorModeForRenderPass(),Et.disabled,va(_e,o.transform,oe),o.style.map.terrain&&o.style.map.terrain.getTerrainData(te),n.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,null,o.transform.zoom,null,null,ve.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:Ke,angle:Ee})}else L($.numGlyphs,k)}if(x){O.clear();const R=o.icon.placedSymbolArray;for(let $=0;$o.style.map.terrain.getElevation(ve,ea,Mr):null,Oi=n.layout.get("text-rotation-alignment")==="map";Er(Ce,ve.posMatrix,o,c,rr,Ti,$,x,Oi,ti)}const mi=o.translatePosMatrix(ve.posMatrix,ge,p,m),ai=K||c&&me||cs?La:rr,ft=o.translatePosMatrix(Ti,ge,p,m,!0),ei=Ee&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let oi;oi=Ee?Ce.iconsInText?Es(qe.kind,qt,re,$,o,mi,ai,ft,Je,si):Sn(qe.kind,qt,re,$,o,mi,ai,ft,c,Je,!0):En(qe.kind,qt,re,$,o,mi,ai,ft,c,Je);const gt={program:ut,buffers:Ue,uniformValues:oi,atlasTexture:Ot,atlasTextureIcon:Fi,atlasInterpolation:wi,atlasInterpolationIcon:jt,isSDF:Ee,hasHalo:ei};if(N&&Ce.canOverlap){te=!0;const ti=Ue.segments.get();for(const Oi of ti)_e.push({segments:new h.SegmentVector([Oi]),sortKey:Oi.sortKey,state:gt,terrainData:dt})}else _e.push({segments:Ue.segments,sortKey:0,state:gt,terrainData:dt})}te&&_e.sort((ve,ge)=>ve.sortKey-ge.sortKey);for(const ve of _e){const ge=ve.state;if(k.activeTexture.set(O.TEXTURE0),ge.atlasTexture.bind(ge.atlasInterpolation,O.CLAMP_TO_EDGE),ge.atlasTextureIcon&&(k.activeTexture.set(O.TEXTURE1),ge.atlasTextureIcon&&ge.atlasTextureIcon.bind(ge.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),ge.isSDF){const Ce=ge.uniformValues;ge.hasHalo&&(Ce.u_is_halo=1,Ba(ge.buffers,ve.segments,n,o,ge.program,oe,T,w,Ce,ve.terrainData)),Ce.u_is_halo=0}Ba(ge.buffers,ve.segments,n,o,ge.program,oe,T,w,ge.uniformValues,ve.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,Et.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 K=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 oe=te.programConfigurations.get(n.id),me=o.useProgram(O,oe),_e=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),oe.updatePaintBuffers(w)),Ra(oe,_,K,N,n);const ve=_e?re:null,ge=o.translatePosMatrix(ve?ve.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?Co(ge,o,w,N,Ce):Nl(ge,Ce)}else R=te.indexBuffer,$=te.segments,B=T?xa(ge,o,w,N):Mo(ge);me.draw(o.context,k,c,o.stencilModeForClipping(re),p,Et.disabled,B,_e,n.id,te.layoutVertexBuffer,R,$,n.paint,o.transform.zoom,oe)}}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),K=$.getBucket(n);if(!K)continue;const re=o.style.map.terrain&&o.style.map.terrain.getTerrainData(R),N=K.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 oe=o.translatePosMatrix(R.posMatrix,$,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),me=n.paint.get("fill-extrusion-vertical-gradient"),_e=w?ya(oe,o,me,O,R,k,$):Po(oe,o,me,O);te.draw(y,y.gl.TRIANGLES,c,p,m,Et.backCCW,_e,re,n.id,K.layoutVertexBuffer,K.indexBuffer,K.segments,n.paint,o.transform.zoom,N,o.style.map.terrain&&K.centroidVertexBuffer)}}function Ql(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,Et.disabled,((k,O,B,R)=>{const $=B.paint.get("hillshade-shadow-color"),K=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:zo(0,O.tileID),u_light:[B.paint.get("hillshade-exaggeration"),N],u_shadow:$,u_highlight:K,u_accent:re}})(o,n,a,w?t:null),w,a.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}function qo(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 yt(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 yt(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,Et.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 $t(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 rn=new h.Color(1,0,0,1),Ki=new h.Color(0,1,0,1),jo=new h.Color(0,0,1,1),Fa=new h.Color(1,0,1,1),Zo=new h.Color(0,1,1,1);function nn(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 Go(o,t,n){const a=o.context,c=a.gl,p=n.posMatrix,m=o.useProgram("debug"),y=st.disabled,_=It.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(K,re){K.initDebugOverlayCanvas();const N=K.debugOverlayCanvas,te=K.context.gl,oe=K.debugOverlayCanvas.getContext("2d");oe.clearRect(0,0,N.width,N.height),oe.shadowColor="white",oe.shadowBlur=2,oe.lineWidth=1.5,oe.strokeStyle="white",oe.textBaseline="top",oe.font="bold 36px Open Sans, sans-serif",oe.fillText(re,5,5),oe.strokeText(re,5,5),K.debugOverlayTexture.update(N),K.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(o,`${$} ${O}kB`),m.draw(a,c.TRIANGLES,y,_,Dt.alphaBlended,Et.disabled,ba(p,h.Color.transparent,R),null,T,o.debugBuffer,o.quadTriangleIndexBuffer,o.debugSegments),m.draw(a,c.LINE_STRIP,y,_,x,Et.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 st(c.LEQUAL,st.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,It.disabled,p,Et.backCCW,k,w,"terrain",_.vertexBuffer,_.indexBuffer,_.segments)}}const Ua={symbol:function(o,t,n,a,c){if(o.renderPass!=="translucent")return;const p=It.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 K of y){const re=T.getTile(K),N=re.getBucket(x);if(!N||!N.text||!N.text.segments.get().length)continue;const te=h.evaluateSizeForZoom(N.textSizeData,B.zoom),oe=H(re,1,_.transform.zoom),me=Ye(K.posMatrix,$,R,_.transform,oe),_e=x.layout.get("icon-text-fit")!=="none"&&N.hasIconData();if(te){const ve=Math.pow(2,B.zoom-re.tileID.overscaledZ);$o(N,R,$,O,B,me,K.posMatrix,ve,te,_e,_.style.map.terrain?(ge,Ce)=>_.style.map.terrain.getElevation(K,ge,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&&Ds(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&&Ds(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&&(No(o,t,n,a,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),No(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,st.ReadOnly),w=It.disabled,k=o.colorModeForRenderPass(),O=[];for(let B=0;BB.sortKey-R.sortKey);for(const B of O){const{programConfiguration:R,program:$,layoutVertexBuffer:K,indexBuffer:re,uniformValues:N,terrainData:te}=B.state;$.draw(_,x.TRIANGLES,T,w,k,Et.disabled,N,te,n.id,K,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=It.disabled,y=new Dt([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,$,K){var re,N;const te=B.gl,oe=(re=B.HALF_FLOAT)!==null&&re!==void 0?re:te.UNSIGNED_BYTE,me=(N=B.RGBA16F)!==null&&N!==void 0?N:te.RGBA;te.texImage2D(te.TEXTURE_2D,0,me,R.width/4,R.height/4,0,te.RGBA,oe,null),K.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,st.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 K of a){const re=t.getTile(K);if(T&&!re.patternsLoaded())continue;const N=re.getBucket(n);if(!N)continue;const te=N.programConfigurations.get(n.id),oe=o.context.program.get(),me=o.useProgram(O,te),_e=$||me.program!==oe,ve=o.style.map.terrain&&o.style.map.terrain.getTerrainData(K),ge=x.constantOr(null);if(ge&&re.imageAtlas){const Ke=re.imageAtlas,Ee=Ke.patternPositions[ge.to.toString()],qe=Ke.patternPositions[ge.from.toString()];Ee&&qe&&te.setConstantPatternPositions(Ee,qe)}const Ce=ve?K:null,Ue=T?Hi(o,re,n,k,Ce):_?bs(o,re,n,_,k,Ce):w?vs(o,re,n,N.lineClipsArray.length,Ce):Ir(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(_&&(_e||o.lineAtlas.dirty))B.activeTexture.set(R.TEXTURE0),o.lineAtlas.bind(B);else if(w){const Ke=N.gradients[n.id];let Ee=Ke.texture;if(n.gradientVersion!==Ke.version){let qe=256;if(n.stepInterpolant){const ke=t.getSource().maxzoom,ut=K.canonical.z===ke?Math.ceil(1<256&&this.clearStencil(),a.setColorMode(Dt.disabled),a.setDepthMode(st.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,st.disabled,new It({func:c.ALWAYS,mask:0},y,255,c.KEEP,c.KEEP,c.REPLACE),Dt.disabled,Et.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 It({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new It({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;nn(_,_.transform.height-(x.top||0),3,rn),nn(_,x.bottom||0,3,Ki),Qn(_,x.left||0,3,jo),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,Zo)}(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]:H(n,a[0],this.transform.zoom),p?a[1]:H(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 xs(this.context,t,Nr[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 yt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Ls{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],K=B*B+R*R+$*$;return K>0&&(K=1/Math.sqrt(K)),k[0]=O[0]*K,k[1]=O[1]*K,k[2]=O[2]*K,k}([],function(k,O,B){var R=O[0],$=O[1],K=O[2],re=B[0],N=B[1],te=B[2];return k[0]=$*te-K*N,k[1]=K*re-R*te,k[2]=R*N-$*re,k}([],Mt([],p[y[0]],p[y[1]]),Mt([],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 Ls(p,m)}}class hr{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=Rt(this.min),c=Rt(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 Bs{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 Bs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Rs{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 Bs,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new Rs(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=Ls.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 hr([N*_,0,0],[(N+1)*_,_,0]),zoom:0,x:0,y:0,wrap:N,fullyVisible:!1}),R=[],$=[],K=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,oe=N.y;let me=N.fullyVisible;if(!me){const Ue=N.aabb.intersects(w);if(Ue===0)continue;me=Ue===2}const _e=t.terrain?x:T,ve=N.aabb.distanceX(_e),ge=N.aabb.distanceY(_e),Ce=Math.max(Math.abs(ve),Math.abs(ge));if(N.zoom===K||Ce>O+(1<=k){const Ue=K-N.zoom,Ke=x[0]-.5-(te<>1),qe=N.zoom+1;let ke=N.aabb.quadrant(Ue);if(t.terrain){const ut=new h.OverscaledTileID(qe,N.wrap,qe,Ke,Ee),qt=t.terrain.getMinMaxElevation(ut),dt=(n=qt.minElevation)!==null&&n!==void 0?n:this.elevation,Je=(a=qt.maxElevation)!==null&&a!==void 0?a:this.elevation;ke=new hr([ke.min[0],ke.min[1],dt],[ke.max[0],ke.max[1],Je])}R.push({aabb:ke,zoom:qe,x:Ke,y:Ee,wrap:N.wrap,fullyVisible:me})}}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,K=Math.cos(this.angle),re=Math.sin(this.angle),N=n-Math.round(n)+K*R+re*$,te=a-Math.round(a)+K*$+re*R,oe=new Float64Array(c);if(h.translate(oe,oe,[N>.5?N-1:N,te>.5?te-1:te,0]),this.alignedProjMatrix=oe,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 Wo{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)},Ho=h.extend({deceleration:2500,maxSpeed:1400},es),Ko=h.extend({deceleration:20,maxSpeed:1400},es),ts=h.extend({deceleration:1e3,maxSpeed:360},es),Yo=h.extend({deceleration:1e3,maxSpeed:90},es);class ur{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({},Ho,t||{}));c.offset=n.pan.mult(p.amount/n.pan.mag()),c.center=this._map.transform.center,Yi(c,p)}if(n.zoom){const p=is(n.zoom,a,Ko);c.zoom=this._map.transform.zoom+p.amount,Yi(c,p)}if(n.bearing){const p=is(n.bearing,a,ts);c.bearing=this._map.transform.bearing+h.clamp(p.amount,-179,179),Yi(c,p)}if(n.pitch){const p=is(n.pitch,a,Yo);c.pitch=this._map.transform.pitch+p.amount,Yi(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 Yi(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 ec extends h.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class tc{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new ec(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ht(t.type,this._map,t))}mouseup(t){this._map.fire(new Ht(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ht(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ht(t.type,this._map,t))}mouseover(t){this._map.fire(new Ht(t.type,this._map,t))}mouseout(t){this._map.fire(new Ht(t.type,this._map,t))}touchstart(t){return this._firePreventable(new qr(t.type,this._map,t))}touchmove(t){this._map.fire(new qr(t.type,this._map,t))}touchend(t){this._map.fire(new qr(t.type,this._map,t))}touchcancel(t){this._map.fire(new qr(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ic{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ht(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ht("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ht(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&&(X.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&&(X.remove(this._box),this._box=null),X.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new h.Event(t,{originalEvent:n}))}}function dr(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=dr(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const c=dr(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 Fs{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 Fs({numTouches:1,numTaps:2}),this._zoomOut=new Fs({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 Ar{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()}},Qo=({enable:o,clickTolerance:t,bearingDegreesPerPixelMoved:n=.8})=>{const a=new Ae({checkCorrectEvent:c=>X.mouseButton(c)===0&&c.ctrlKey||X.mouseButton(c)===2});return new Ar({clickTolerance:t,move:(c,p)=>({bearingDelta:(p.x-c.x)*n}),moveStateManager:a,enable:o,assignEvents:Va})},Us=({enable:o,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5})=>{const a=new Ae({checkCorrectEvent:c=>X.mouseButton(c)===0&&c.ctrlKey||X.mouseButton(c)===2});return new Ar({clickTolerance:t,move:(c,p)=>({pitchDelta:(p.y-c.y)*n}),moveStateManager:a,enable:o,assignEvents:Va})};class el{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=dr(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 Mi extends Vs{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 jr={panStep:100,bearingStep:15,pitchStep:10};class il{constructor(t){this._tr=new zn(t);const n=jr;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 qs=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%qs==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=X.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)>qs?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 rl{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 Ji{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 kt{constructor(){this._tap=new Fs({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 js{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 nl{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 sl extends h.Event{}function Ga(o){return o.panDelta&&o.panDelta.mag()||o.zoomDelta||o.bearingDelta||o.pitchDelta}class pr{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ur(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)X.addEventListener(c,p,c===document?this.handleWindowEvent:this.handleEvent,m)}destroy(){for(const[t,n,a]of this._listeners)X.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new tc(n,t));const c=n.boxZoom=new rs(n,t);this._add("boxZoom",c);const p=new ns(n),m=new Ji(n);n.doubleClickZoom=new rl(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new kt;this._add("tapDragZoom",y);const _=n.touchPitch=new Mi(n);this._add("touchPitch",_);const x=Qo(t),T=Us(t);n.dragRotate=new Za(t,x,T),this._add("mouseRotate",x,["mousePitch"]),this._add("mousePitch",T,["mouseRotate"]);const w=(({enable:K,clickTolerance:re})=>{const N=new Ae({checkCorrectEvent:te=>X.mouseButton(te)===0&&!te.ctrlKey});return new Ar({clickTolerance:re,move:(te,oe)=>({around:oe,panDelta:oe.sub(te)}),activateOnStart:!0,moveStateManager:N,enable:K,assignEvents:Va})})(t),k=new el(t,n);n.dragPan=new js(a,w,k),this._add("mousePan",w),this._add("touchPan",k,["touchZoom","touchRotate"]);const O=new $a,B=new Na;n.touchZoomRotate=new nl(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 il(n);this._add("keyboard",$),this._add("blockableMapEvent",new ic(n));for(const K of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[K]&&n[K].enable(t[K])}_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=_?X.touchPos(this._el,_):X.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 sl("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Zs={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,_,me)),this._rotating&&(a.bearing=h.interpolate.number(p,x,me)),this._pitching&&(a.pitch=h.interpolate.number(m,T,me)),this._padding&&(a.interpolatePadding(y,w,me),O=a.centerPoint.add(k)),this.terrain&&!t.freezeElevation&&this._updateElevation(me),N)a.setLocationAtPoint(N,te);else{const _e=a.zoomScale(a.zoom-c),ve=_>c?Math.min(2,re):Math.max(.5,re),ge=Math.pow(ve,1-me),Ce=a.unproject($.add(K.mult(me*ge)).mult(_e));a.setLocationAtPoint(a.renderWorldCopies?Ce.wrap():Ce,O)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},me=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,me)},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 K=a.project(R),re=a.project($).sub(K);let N=t.curve;const te=Math.max(a.width,a.height),oe=te/k,me=re.mag();if("minZoom"in t){const ke=h.clamp(Math.min(t.minZoom,c,_),a.minZoom,a.maxZoom),ut=te/a.zoomScale(ke-c);N=Math.sqrt(ut/me*2)}const _e=N*N;function ve(ke){const ut=(oe*oe-te*te+(ke?-1:1)*_e*_e*me*me)/(2*(ke?oe:te)*_e*me);return Math.log(Math.sqrt(ut*ut+1)-ut)}function ge(ke){return(Math.exp(ke)-Math.exp(-ke))/2}function Ce(ke){return(Math.exp(ke)+Math.exp(-ke))/2}const Ue=ve(0);let Ke=function(ke){return Ce(Ue)/Ce(Ue+N*ke)},Ee=function(ke){return te*((Ce(Ue)*(ge(ut=Ue+N*ke)/Ce(ut))-ge(Ue))/_e)/me;var ut},qe=(ve(1)-Ue)/N;if(Math.abs(me)<1e-6||!isFinite(qe)){if(Math.abs(te-oe)<1e-6)return this.easeTo(t,n);const ke=oet.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 ut=ke*qe,qt=1/Ke(ut);a.zoom=ke===1?_:c+a.scaleZoom(qt),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 dt=ke===1?$:a.unproject(K.add(re.mult(Ee(ut))).mult(qt));a.setLocationAtPoint(a.renderWorldCopies?dt.wrap():dt,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=X.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=X.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=X.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(){X.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=X.create("div","maplibregl-ctrl");const n=X.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(){X.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 Ci=h.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class al 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 Yr(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 fr{constructor(t,n,a){this.painter=t,this.sourceCache=new al(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 yt(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 Pr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Ft{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new rc(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(Pr[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(Pr[n]&&(this._prevType&&Pr[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!c))return!0;if(Pr[this._prevType]||Pr[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},Gs={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=Qo({clickTolerance:c,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:y,bearingDegreesPerPixelMoved:_=.8})=>{const x=new Os;return new Ar({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=Us({clickTolerance:p,enable:!0}),this.touchPitch=(({enable:m,clickTolerance:y,pitchDegreesPerPixelMoved:_=-.5})=>{const x=new Os;return new Ar({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),X.addEventListener(n,"mousedown",this.mousedown),X.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),X.addEventListener(n,"touchcancel",this.reset)}startMouse(t,n){this.mouseRotate.dragStart(t,n),this.mousePitch&&this.mousePitch.dragStart(t,n),X.disableDrag()}startTouch(t,n){this.touchRotate.dragStart(t,n),this.touchPitch&&this.touchPitch.dragStart(t,n),X.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;X.removeEventListener(t,"mousedown",this.mousedown),X.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),X.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),X.removeEventListener(window,"touchend",this.touchend),X.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){X.enableDrag(),X.removeEventListener(window,"mousemove",this.mousemove),X.removeEventListener(window,"mouseup",this.mouseup),X.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),X.removeEventListener(window,"touchend",this.touchend)}mousedown(t){this.startMouse(h.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),X.mousePos(this.element,t)),X.addEventListener(window,"mousemove",this.mousemove),X.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.moveMouse(t,X.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=X.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),X.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),X.addEventListener(window,"touchend",this.touchend))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=X.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 sn={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 Ws(o,t,n){const a=o.classList;for(const c in sn)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=X.create("div"),this._element.setAttribute("aria-label","Map marker");const a=X.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=X.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=X.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill-rule","nonzero");const _=X.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=X.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=X.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const w=X.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=X.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"opacity","0.25"),k.setAttributeNS(null,"fill","#000000");const O=X.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=X.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const R=X.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(8.0, 8.0)");const $=X.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 K=X.createNS("http://www.w3.org/2000/svg","circle");K.setAttributeNS(null,"fill","#FFFFFF"),K.setAttributeNS(null,"cx","5.5"),K.setAttributeNS(null,"cy","5.5"),K.setAttributeNS(null,"r","5.4999962"),R.appendChild($),R.appendChild(K),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()}),Ws(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),X.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=Xs(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()),X.setTransform(this._element,`${sn[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,an=!1;const Ya={maxWidth:100,unit:"metric"};function Hs(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?on(t,a,_/5280,o._getUIString("ScaleControl.Miles")):on(t,a,_,o._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?on(t,a,y/1852,o._getUIString("ScaleControl.NauticalMiles")):y>=1e3?on(t,a,y/1e3,o._getUIString("ScaleControl.Kilometers")):on(t,a,y,o._getUIString("ScaleControl.Meters"))}function on(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 Ks={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 Ys(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 Ys(new h.Point(0,0))}const Js=ue,Qs={setRTLTextPlugin:h.setRTLTextPlugin,getRTLTextPluginStatus:h.getRTLTextPluginStatus,Map:class extends Fe{constructor(o){var t;if(h.PerformanceUtils.mark(h.PerformanceMarkers.create),(o=h.extend({},ol,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 Rs(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=Bt.addThrottleControl(()=>this.isMoving()),this._requestManager=new pt(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 pr(this,o),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=o.hash&&new Wo(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(hi.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 Ht(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 Ht(o,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new Ht(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 pi(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 pi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(o,t){if(typeof o=="string"){const n=this._requestManager.transformRequest(o,et.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 fr(this.painter,t,o),this.painter.renderToTexture=new Ft(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){Bt.getImage(this._requestManager.transformRequest(o,et.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=X.create("div","maplibregl-canvas-container",o);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=X.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=X.create("div","maplibregl-control-container",o),c=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(p=>{c[p]=X.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=X.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=` +`}),staticAttributes:a,staticUniforms:m}}class $r{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(_e,ve.u_depth),u_terrain:new h.Uniform1i(_e,ve.u_terrain),u_terrain_dim:new h.Uniform1f(_e,ve.u_terrain_dim),u_terrain_matrix:new h.UniformMatrix4f(_e,ve.u_terrain_matrix),u_terrain_unpack:new h.Uniform4f(_e,ve.u_terrain_unpack),u_terrain_exaggeration:new h.Uniform1f(_e,ve.u_terrain_exaggeration)}))(t,me),this.binderUniforms=c?c.getUniforms(t,me):[]}draw(t,n,a,c,p,m,y,_,x,T,w,k,O,B,R,q,H,se){const $=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($.TEXTURE2),$.bindTexture($.TEXTURE_2D,_.depthTexture),t.activeTexture.set($.TEXTURE3),$.bindTexture($.TEXTURE_2D,_.texture);for(const oe in this.terrainUniforms)this.terrainUniforms[oe].set(_[oe])}for(const oe in this.fixedUniforms)this.fixedUniforms[oe].set(y[oe]);R&&R.setUniforms(t,this.binderUniforms,O,{zoom:B});let re=0;switch(n){case $.LINES:re=2;break;case $.TRIANGLES:re=3;break;case $.LINE_STRIP:re=1}for(const oe of k.get()){const me=oe.vaos||(oe.vaos={});(me[x]||(me[x]=new $r)).bind(t,this,T,R?R.getPaintVertexBuffers():[],w,oe.vertexOffset,q,H,se),$.drawElements(n,oe.primitiveLength*re,$.UNSIGNED_SHORT,oe.primitiveOffset*re*2)}}}function Po(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 Mo=(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(Mo(o,t,n,a),Po(p,t,m),{u_height_factor:-Math.pow(2,c.overscaledZ)/m.tileSize/8}),Co=o=>({u_matrix:o}),xa=(o,t,n,a)=>h.extend(Co(o),Po(n,t,a)),ql=(o,t)=>({u_matrix:o,u_world:t}),ko=(o,t,n,a,c)=>h.extend(xa(o,t,n,a),{u_world:c}),jl=(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}),zo=(o,t,n,a)=>({u_matrix:o,u_extrude_scale:W(t,1,n),u_intensity:a});function Do(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 Ir=(o,t,n,a)=>{const c=o.transform;return{u_matrix:En(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(Ir(o,t,n,c),{u_image:0,u_image_height:a}),Hi=(o,t,n,a,c)=>{const p=o.transform,m=Xn(t,p);return{u_matrix:En(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,k=T.width*c.toScale;return h.extend(Ir(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 Xn(o,t){return 1/W(o,1,t.tileZoom)}function En(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 Sn=(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}},In=(o,t,n,a,c,p,m,y,_,x,T)=>{const w=c.transform;return h.extend(Sn(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(In(o,t,n,a,c,p,m,y,!0,_,!0),{u_texsize_icon:x,u_texture_icon:1}),Bi=(o,t,n)=>({u_matrix:o,u_opacity:t,u_color:n}),Ri=(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,q=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:[q>>16,H>>16],u_pixel_coord_lower:[65535&q,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=_e;h.mul(Ce,me.placementInvProjMatrix,o.transform.glCoordMatrix),h.mul(Ce,Ce,me.placementViewportMatrix),T.push({circleArray:ge,circleOffset:k,transform:Ue,invTransform:Ce,coord:re}),w+=ge.length/4,k=w}ve&&x.draw(y,_.LINES,st.disabled,It.disabled,o.colorModeForRenderPass(),Et.disabled,va(_e,o.transform,oe),o.style.map.terrain&&o.style.map.terrain.getTerrainData(re),n.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,null,o.transform.zoom,null,null,ve.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 $ of T)for(let re=0;re<$.circleArray.length/4;re++){const oe=4*re,me=$.circleArray[oe+0],_e=$.circleArray[oe+1],ve=$.circleArray[oe+2],ge=$.circleArray[oe+3];B.emplace(R++,me,_e,ve,ge,0),B.emplace(R++,me,_e,ve,ge,1),B.emplace(R++,me,_e,ve,ge,2),B.emplace(R++,me,_e,ve,ge,3)}(!kn||kn.length<2*w)&&(kn=function($){const re=2*$,oe=new h.QuadTriangleArray;oe.resize(re),oe._trim();for(let me=0;me=0&&(B[q.associatedIconIndex]={shiftedAnchor:Ke,angle:Ee})}else L(q.numGlyphs,k)}if(x){O.clear();const R=o.icon.placedSymbolArray;for(let q=0;qo.style.map.terrain.getElevation(ve,Qs,Mr):null,Oi=n.layout.get("text-rotation-alignment")==="map";Er(Ce,ve.posMatrix,o,c,rr,Ti,q,x,Oi,ti)}const mi=o.translatePosMatrix(ve.posMatrix,ge,p,m),ai=H||c&&me||ls?La:rr,ft=o.translatePosMatrix(Ti,ge,p,m,!0),ei=Ee&&n.paint.get(c?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let oi;oi=Ee?Ce.iconsInText?Ts(je.kind,qt,se,q,o,mi,ai,ft,Je,si):In(je.kind,qt,se,q,o,mi,ai,ft,c,Je,!0):Sn(je.kind,qt,se,q,o,mi,ai,ft,c,Je);const gt={program:ut,buffers:Ue,uniformValues:oi,atlasTexture:Ot,atlasTextureIcon:Fi,atlasInterpolation:wi,atlasInterpolationIcon:jt,isSDF:Ee,hasHalo:ei};if($&&Ce.canOverlap){re=!0;const ti=Ue.segments.get();for(const Oi of ti)_e.push({segments:new h.SegmentVector([Oi]),sortKey:Oi.sortKey,state:gt,terrainData:dt})}else _e.push({segments:Ue.segments,sortKey:0,state:gt,terrainData:dt})}re&&_e.sort((ve,ge)=>ve.sortKey-ge.sortKey);for(const ve of _e){const ge=ve.state;if(k.activeTexture.set(O.TEXTURE0),ge.atlasTexture.bind(ge.atlasInterpolation,O.CLAMP_TO_EDGE),ge.atlasTextureIcon&&(k.activeTexture.set(O.TEXTURE1),ge.atlasTextureIcon&&ge.atlasTextureIcon.bind(ge.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),ge.isSDF){const Ce=ge.uniformValues;ge.hasHalo&&(Ce.u_is_halo=1,Ba(ge.buffers,ve.segments,n,o,ge.program,oe,T,w,Ce,ve.terrainData)),Ce.u_is_halo=0}Ba(ge.buffers,ve.segments,n,o,ge.program,oe,T,w,ge.uniformValues,ve.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,Et.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 k,O,B,R,q;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 se of a){const $=t.getTile(se);if(T&&!$.patternsLoaded())continue;const re=$.getBucket(n);if(!re)continue;const oe=re.programConfigurations.get(n.id),me=o.useProgram(O,oe),_e=o.style.map.terrain&&o.style.map.terrain.getTerrainData(se);T&&(o.context.activeTexture.set(y.TEXTURE0),$.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),oe.updatePaintBuffers(w)),Ra(oe,_,H,$,n);const ve=_e?se:null,ge=o.translatePosMatrix(ve?ve.posMatrix:se.posMatrix,$,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(m){R=re.indexBuffer2,q=re.segments2;const Ce=[y.drawingBufferWidth,y.drawingBufferHeight];B=O==="fillOutlinePattern"&&T?ko(ge,o,w,$,Ce):ql(ge,Ce)}else R=re.indexBuffer,q=re.segments,B=T?xa(ge,o,w,$):Co(ge);me.draw(o.context,k,c,o.stencilModeForClipping(se),p,Et.disabled,B,_e,n.id,re.layoutVertexBuffer,R,q,n.paint,o.transform.zoom,oe)}}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),k=n.getCrossfadeParameters(),O=n.paint.get("fill-extrusion-opacity"),B=T.constantOr(null);for(const R of a){const q=t.getTile(R),H=q.getBucket(n);if(!H)continue;const se=o.style.map.terrain&&o.style.map.terrain.getTerrainData(R),$=H.programConfigurations.get(n.id),re=o.useProgram(w?"fillExtrusionPattern":"fillExtrusion",$);w&&(o.context.activeTexture.set(_.TEXTURE0),q.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),$.updatePaintBuffers(k)),Ra($,x,B,q,n);const oe=o.translatePosMatrix(R.posMatrix,q,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),me=n.paint.get("fill-extrusion-vertical-gradient"),_e=w?ya(oe,o,me,O,R,k,q):Mo(oe,o,me,O);re.draw(y,y.gl.TRIANGLES,c,p,m,Et.backCCW,_e,se,n.id,H.layoutVertexBuffer,H.indexBuffer,H.segments,n.paint,o.transform.zoom,$,o.style.map.terrain&&H.centroidVertexBuffer)}}function tc(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,Et.disabled,((k,O,B,R)=>{const q=B.paint.get("hillshade-shadow-color"),H=B.paint.get("hillshade-highlight-color"),se=B.paint.get("hillshade-accent-color");let $=B.paint.get("hillshade-illumination-direction")*(Math.PI/180);B.paint.get("hillshade-illumination-anchor")==="viewport"&&($-=k.transform.angle);const re=!k.options.moving;return{u_matrix:R?R.posMatrix:k.transform.calculatePosMatrix(O.tileID.toUnwrapped(),re),u_image:0,u_latrange:Do(0,O.tileID),u_light:[B.paint.get("hillshade-exaggeration"),$],u_shadow:q,u_highlight:H,u_accent:se}})(o,n,a,w?t:null),w,a.id,o.rasterBoundsBuffer,o.quadTriangleIndexBuffer,o.rasterBoundsSegments)}function jo(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 yt(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 yt(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,Et.disabled,((O,B)=>{const R=B.stride,q=h.create();return h.ortho(q,0,h.EXTENT,-h.EXTENT,0,0,1),h.translate(q,q,[0,-h.EXTENT,0]),{u_matrix:q,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 $t(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 rn=new h.Color(1,0,0,1),Ki=new h.Color(0,1,0,1),Zo=new h.Color(0,0,1,1),Fa=new h.Color(1,0,1,1),Go=new h.Color(0,1,1,1);function nn(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 Xo(o,t,n){const a=o.context,c=a.gl,p=n.posMatrix,m=o.useProgram("debug"),y=st.disabled,_=It.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 q=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(q+=` => ${n.overscaledZ}`),function(H,se){H.initDebugOverlayCanvas();const $=H.debugOverlayCanvas,re=H.context.gl,oe=H.debugOverlayCanvas.getContext("2d");oe.clearRect(0,0,$.width,$.height),oe.shadowColor="white",oe.shadowBlur=2,oe.lineWidth=1.5,oe.strokeStyle="white",oe.textBaseline="top",oe.font="bold 36px Open Sans, sans-serif",oe.fillText(se,5,5),oe.strokeText(se,5,5),H.debugOverlayTexture.update($),H.debugOverlayTexture.bind(re.LINEAR,re.CLAMP_TO_EDGE)}(o,`${q} ${O}kB`),m.draw(a,c.TRIANGLES,y,_,Dt.alphaBlended,Et.disabled,ba(p,h.Color.transparent,R),null,T,o.debugBuffer,o.quadTriangleIndexBuffer,o.debugSegments),m.draw(a,c.LINE_STRIP,y,_,x,Et.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 st(c.LEQUAL,st.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,It.disabled,p,Et.backCCW,k,w,"terrain",_.vertexBuffer,_.indexBuffer,_.segments)}}const Ua={symbol:function(o,t,n,a,c){if(o.renderPass!=="translucent")return;const p=It.disabled,m=o.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(y,_,x,T,w,k,O){const B=_.transform,R=w==="map",q=k==="map";for(const H of y){const se=T.getTile(H),$=se.getBucket(x);if(!$||!$.text||!$.text.segments.get().length)continue;const re=h.evaluateSizeForZoom($.textSizeData,B.zoom),oe=W(se,1,_.transform.zoom),me=Ye(H.posMatrix,q,R,_.transform,oe),_e=x.layout.get("icon-text-fit")!=="none"&&$.hasIconData();if(re){const ve=Math.pow(2,B.zoom-se.tileID.overscaledZ);qo($,R,q,O,B,me,H.posMatrix,ve,re,_e,_.style.map.terrain?(ge,Ce)=>_.style.map.terrain.getElevation(H,ge,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&&($o(o,t,n,a,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),$o(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,st.ReadOnly),w=It.disabled,k=o.colorModeForRenderPass(),O=[];for(let B=0;BB.sortKey-R.sortKey);for(const B of O){const{programConfiguration:R,program:q,layoutVertexBuffer:H,indexBuffer:se,uniformValues:$,terrainData:re}=B.state;q.draw(_,x.TRIANGLES,T,w,k,Et.disabled,$,re,n.id,H,se,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=It.disabled,y=new Dt([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,q,H){var se,$;const re=B.gl,oe=(se=B.HALF_FLOAT)!==null&&se!==void 0?se:re.UNSIGNED_BYTE,me=($=B.RGBA16F)!==null&&$!==void 0?$:re.RGBA;re.texImage2D(re.TEXTURE_2D,0,me,R.width/4,R.height/4,0,re.RGBA,oe,null),H.colorAttachment.set(q)}(_,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,st.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 q=!0;for(const H of a){const se=t.getTile(H);if(T&&!se.patternsLoaded())continue;const $=se.getBucket(n);if(!$)continue;const re=$.programConfigurations.get(n.id),oe=o.context.program.get(),me=o.useProgram(O,re),_e=q||me.program!==oe,ve=o.style.map.terrain&&o.style.map.terrain.getTerrainData(H),ge=x.constantOr(null);if(ge&&se.imageAtlas){const Ke=se.imageAtlas,Ee=Ke.patternPositions[ge.to.toString()],je=Ke.patternPositions[ge.from.toString()];Ee&&je&&re.setConstantPatternPositions(Ee,je)}const Ce=ve?H:null,Ue=T?Hi(o,se,n,k,Ce):_?vs(o,se,n,_,k,Ce):w?xs(o,se,n,$.lineClipsArray.length,Ce):Ir(o,se,n,Ce);if(T)B.activeTexture.set(R.TEXTURE0),se.imageAtlasTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),re.updatePaintBuffers(k);else if(_&&(_e||o.lineAtlas.dirty))B.activeTexture.set(R.TEXTURE0),o.lineAtlas.bind(B);else if(w){const Ke=$.gradients[n.id];let Ee=Ke.texture;if(n.gradientVersion!==Ke.version){let je=256;if(n.stepInterpolant){const ke=t.getSource().maxzoom,ut=H.canonical.z===ke?Math.ceil(1<256&&this.clearStencil(),a.setColorMode(Dt.disabled),a.setDepthMode(st.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,st.disabled,new It({func:c.ALWAYS,mask:0},y,255,c.KEEP,c.KEEP,c.REPLACE),Dt.disabled,Et.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 It({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new It({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.currentLayerq.source&&!q.isHidden(T)?[x.sourceCaches[q.source]]:[]),O=k.filter(q=>q.getSource().type==="vector"),B=k.filter(q=>q.getSource().type!=="vector"),R=q=>{(!w||w.getSource().maxzoomR(q)),w||B.forEach(q=>R(q)),w}(this.style,this.transform.zoom);_&&Ua.debug(this,_,_.getVisibleCoordinates())}this.options.showPadding&&function(_){const x=_.transform.padding;nn(_,_.transform.height-(x.top||0),3,rn),nn(_,x.bottom||0,3,Ki),Jn(_,x.left||0,3,Zo),Jn(_,_.transform.width-(x.right||0),3,Fa);const T=_.transform.centerPoint;(function(w,k,O,B){zn(w,k-1,O-10,2,20,B),zn(w,k-10,O-1,20,2,B)})(_,T.x,_.transform.height-T.y,Go)}(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,Nr[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 yt(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],q=O[2],H=B*B+R*R+q*q;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],q=O[1],H=O[2],se=B[0],$=B[1],re=B[2];return k[0]=q*re-H*$,k[1]=H*se-R*re,k[2]=R*$-q*se,k}([],Mt([],p[y[0]],p[y[1]]),Mt([],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 hr{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=Rt(this.min),c=Rt(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=$=>({aabb:new hr([$*_,0,0],[($+1)*_,_,0]),zoom:0,x:0,y:0,wrap:$,fullyVisible:!1}),R=[],q=[],H=c,se=t.reparseOverscaled?p:c;if(this._renderWorldCopies)for(let $=1;$<=3;$++)R.push(B(-$)),R.push(B($));for(R.push(B(0));R.length>0;){const $=R.pop(),re=$.x,oe=$.y;let me=$.fullyVisible;if(!me){const Ue=$.aabb.intersects(w);if(Ue===0)continue;me=Ue===2}const _e=t.terrain?x:T,ve=$.aabb.distanceX(_e),ge=$.aabb.distanceY(_e),Ce=Math.max(Math.abs(ve),Math.abs(ge));if($.zoom===H||Ce>O+(1<=k){const Ue=H-$.zoom,Ke=x[0]-.5-(re<>1),je=$.zoom+1;let ke=$.aabb.quadrant(Ue);if(t.terrain){const ut=new h.OverscaledTileID(je,$.wrap,je,Ke,Ee),qt=t.terrain.getMinMaxElevation(ut),dt=(n=qt.minElevation)!==null&&n!==void 0?n:this.elevation,Je=(a=qt.maxElevation)!==null&&a!==void 0?a:this.elevation;ke=new hr([ke.min[0],ke.min[1],dt],[ke.max[0],ke.max[1],Je])}R.push({aabb:ke,zoom:je,x:Ke,y:Ee,wrap:$.wrap,fullyVisible:me})}}return q.sort(($,re)=>$.distanceSq-re.distanceSq).map($=>$.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,q=this.height%2/2,H=Math.cos(this.angle),se=Math.sin(this.angle),$=n-Math.round(n)+H*R+se*q,re=a-Math.round(a)+H*q+se*R,oe=new Float64Array(c);if(h.translate(oe,oe,[$>.5?$-1:$,re>.5?re-1:re,0]),this.alignedProjMatrix=oe,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 Ho{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 Qn={linearity:.3,easing:h.bezier(0,0,.3,1)},Ko=h.extend({deceleration:2500,maxSpeed:1400},Qn),Yo=h.extend({deceleration:20,maxSpeed:1400},Qn),es=h.extend({deceleration:1e3,maxSpeed:360},Qn),Jo=h.extend({deceleration:1e3,maxSpeed:90},Qn);class ur{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({},Ko,t||{}));c.offset=n.pan.mult(p.amount/n.pan.mag()),c.center=this._map.transform.center,Yi(c,p)}if(n.zoom){const p=ts(n.zoom,a,Yo);c.zoom=this._map.transform.zoom+p.amount,Yi(c,p)}if(n.bearing){const p=ts(n.bearing,a,es);c.bearing=this._map.transform.bearing+h.clamp(p.amount,-179,179),Yi(c,p)}if(n.pitch){const p=ts(n.pitch,a,Jo);c.pitch=this._map.transform.pitch+p.amount,Yi(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 Yi(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 ic extends h.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class rc{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new ic(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ht(t.type,this._map,t))}mouseup(t){this._map.fire(new Ht(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new Ht(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ht(t.type,this._map,t))}mouseover(t){this._map.fire(new Ht(t.type,this._map,t))}mouseout(t){this._map.fire(new Ht(t.type,this._map,t))}touchstart(t){return this._firePreventable(new qr(t.type,this._map,t))}touchmove(t){this._map.fire(new qr(t.type,this._map,t))}touchend(t){this._map.fire(new qr(t.type,this._map,t))}touchcancel(t){this._map.fire(new qr(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nc{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ht(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ht("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ht(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Dn{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 Dn(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 dr(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=dr(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const c=dr(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 Dn(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 Ar{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()}},el=({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 Ar({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 Ar({clickTolerance:t,move:(c,p)=>({pitchDelta:(p.y-c.y)*n}),moveStateManager:a,enable:o,assignEvents:Va})};class tl{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=dr(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 Mi 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 jr={panStep:100,bearingStep:15,pitchStep:10};class rl{constructor(t){this._tr=new Dn(t);const n=jr;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 Dn(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 nl{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 Ji{constructor(t){this._tr=new Dn(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 kt{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 sl{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 al extends h.Event{}function Ga(o){return o.panDelta&&o.panDelta.mag()||o.zoomDelta||o.bearingDelta||o.pitchDelta}class pr{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ur(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 rc(n,t));const c=n.boxZoom=new is(n,t);this._add("boxZoom",c);const p=new rs(n),m=new Ji(n);n.doubleClickZoom=new nl(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new kt;this._add("tapDragZoom",y);const _=n.touchPitch=new Mi(n);this._add("touchPitch",_);const x=el(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:se})=>{const $=new Ae({checkCorrectEvent:re=>Y.mouseButton(re)===0&&!re.ctrlKey});return new Ar({clickTolerance:se,move:(re,oe)=>({around:oe,panDelta:oe.sub(re)}),activateOnStart:!0,moveStateManager:$,enable:H,assignEvents:Va})})(t),k=new tl(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 sl(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 q=n.keyboard=new rl(n);this._add("keyboard",q),this._add("blockableMapEvent",new nc(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: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=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: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=ss(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 al("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,_,me)),this._rotating&&(a.bearing=h.interpolate.number(p,x,me)),this._pitching&&(a.pitch=h.interpolate.number(m,T,me)),this._padding&&(a.interpolatePadding(y,w,me),O=a.centerPoint.add(k)),this.terrain&&!t.freezeElevation&&this._updateElevation(me),$)a.setLocationAtPoint($,re);else{const _e=a.zoomScale(a.zoom-c),ve=_>c?Math.min(2,se):Math.max(.5,se),ge=Math.pow(ve,1-me),Ce=a.unproject(q.add(H.mult(me*ge)).mult(_e));a.setLocationAtPoint(a.renderWorldCopies?Ce.wrap():Ce,O)}this._applyUpdatedTransform(a),this._fireMoveEvents(n)},me=>{this.terrain&&this._finalizeElevation(),this._afterEase(n,me)},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),q=h.LngLat.convert(t.center||R);this._normalizeCenter(q);const H=a.project(R),se=a.project(q).sub(H);let $=t.curve;const re=Math.max(a.width,a.height),oe=re/k,me=se.mag();if("minZoom"in t){const ke=h.clamp(Math.min(t.minZoom,c,_),a.minZoom,a.maxZoom),ut=re/a.zoomScale(ke-c);$=Math.sqrt(ut/me*2)}const _e=$*$;function ve(ke){const ut=(oe*oe-re*re+(ke?-1:1)*_e*_e*me*me)/(2*(ke?oe:re)*_e*me);return Math.log(Math.sqrt(ut*ut+1)-ut)}function ge(ke){return(Math.exp(ke)-Math.exp(-ke))/2}function Ce(ke){return(Math.exp(ke)+Math.exp(-ke))/2}const Ue=ve(0);let Ke=function(ke){return Ce(Ue)/Ce(Ue+$*ke)},Ee=function(ke){return re*((Ce(Ue)*(ge(ut=Ue+$*ke)/Ce(ut))-ge(Ue))/_e)/me;var ut},je=(ve(1)-Ue)/$;if(Math.abs(me)<1e-6||!isFinite(je)){if(Math.abs(re-oe)<1e-6)return this.easeTo(t,n);const ke=oet.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(q),this._ease(ke=>{const ut=ke*je,qt=1/Ke(ut);a.zoom=ke===1?_:c+a.scaleZoom(qt),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 dt=ke===1?q:a.unproject(H.add(se.mult(Ee(ut))).mult(qt));a.setLocationAtPoint(a.renderWorldCopies?dt.wrap():dt,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 qe{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 Ci=h.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class ol 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 Yr(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 fr{constructor(t,n,a){this.painter=t,this.sourceCache=new ol(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 yt(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 Pr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Ft{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new sc(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(Pr[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(Pr[n]&&(this._prevType&&Pr[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!c))return!0;if(Pr[this._prevType]||Pr[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=el({clickTolerance:c,enable:!0}),this.touchRotate=(({enable:m,clickTolerance:y,bearingDegreesPerPixelMoved:_=.8})=>{const x=new Fs;return new Ar({clickTolerance:y,move:(T,w)=>({bearingDelta:(w.x-T.x)*_}),moveStateManager:x,enable:m,assignEvents:Ln})})({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 Ar({clickTolerance:y,move:(T,w)=>({pitchDelta:(w.y-T.y)*_}),moveStateManager:x,enable:m,assignEvents:Ln})})({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 sn={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 sn)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 se of x){const $=Y.createNS("http://www.w3.org/2000/svg","ellipse");$.setAttributeNS(null,"opacity","0.04"),$.setAttributeNS(null,"cx","10.5"),$.setAttributeNS(null,"cy","5.80029008"),$.setAttributeNS(null,"rx",se.rx),$.setAttributeNS(null,"ry",se.ry),_.appendChild($)}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 q=Y.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#000000"),q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.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(q),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,`${sn[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 Bn=0,an=!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?on(t,a,_/5280,o._getUIString("ScaleControl.Miles")):on(t,a,_,o._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?on(t,a,y/1852,o._getUIString("ScaleControl.NauticalMiles")):y>=1e3?on(t,a,y/1e3,o._getUIString("ScaleControl.Kilometers")):on(t,a,y,o._getUIString("ScaleControl.Meters"))}function on(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=ce,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({},ll,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=Bt.addThrottleControl(()=>this.isMoving()),this._requestManager=new pt(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 pr(this,o),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=o.hash&&new Ho(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 qe({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(hi.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 Ht(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 Ht(o,this,m.originalEvent)))},mouseout:m=>{a&&(a=!1,n.call(this,new Ht(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 pi(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 pi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(o,t){if(typeof o=="string"){const n=this._requestManager.transformRequest(o,et.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 fr(this.painter,t,o),this.painter.renderToTexture=new Ft(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){Bt.getImage(this._requestManager.transformRequest(o,et.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(){X.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 Xo(n,this.transform),Ge.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),Bt.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),X.remove(this._canvasContainer),X.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 Kt}getCameraTargetElevation(){return this.transform.elevation}},NavigationControl:class{constructor(o){this.options=h.extend({},Gs,o),this._container=X.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})),X.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})),X.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=X.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(){X.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=X.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=X.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,n=!1){mr===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(a=>{mr=a.state!=="denied",t(mr)}).catch(()=>{mr=!!window.navigator.geolocation,t(mr)}):(mr=!!window.navigator.geolocation,t(mr)):t(mr)}(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(),X.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ln=0,an=!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=hi.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&&an)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=X.create("button","maplibregl-ctrl-geolocate",this._container),X.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=X.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ls(this._dotElement),this._circleElement=X.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--,an=!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},an=!0):(o=this.options.positionOptions,an=!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(){Hs(this._map,this._container,this.options)}onAdd(o){return this._map=o,this._container=X.create("div","maplibregl-ctrl maplibregl-ctrl-scale",o.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){X.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(o){this.options.unit=o,Hs(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=X.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){X.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const o=this._fullscreenButton=X.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);X.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=X.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=X.create("button","maplibregl-ctrl-terrain",this._container),X.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(){X.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(Ks),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&&X.remove(this._content),this._container&&(X.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=X.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=X.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=X.create("div","maplibregl-popup",this._map.getContainer()),this._tip=X.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=Xs(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=Ys(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();X.setTransform(this._container,`${sn[n]} translate(${c.x}px,${c.y}px)`),Ws(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:pi,LngLat:h.LngLat,LngLatBounds:hi,Point:h.Point,MercatorCoordinate:h.MercatorCoordinate,Evented:h.Evented,AJAXError:h.AJAXError,config:h.config,CanvasSource:le,GeoJSONSource:br,ImageSource:Xi,RasterDEMTileSource:Rr,RasterTileSource:Kr,VectorTileSource:yn,VideoSource:xn,prewarm:function(){bn().acquire(Qr)},clearPrewarmedResources:function(){const o=fi;o&&(o.isPreloaded()&&o.numActive()===1?(o.release(Qr),fi=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 Js},get workerCount(){return we.workerCount},set workerCount(o){we.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 Zs.extend(Qs,{isSafari:h.isSafari,getPerformanceMetrics:h.PerformanceUtils.getPerformanceMetrics}),Qs});var de=ne;return de})})(hd);var Gm=hd.exports;function Uf(S){let A,D,j,ne;const ae=S[2].default,de=hf(ae,S,S[1],null);let h=[{type:"button"},{class:"govuk-button govuk-button--secondary"},{"data-module":"govuk-button"},S[0]],ue={};for(let X=0;X{D(0,A=zl(zl({},A),Zu(de))),"$$scope"in de&&D(1,ne=de.$$scope)},A=Zu(A),[A,ne,j,ae]}class Xm extends cd{constructor(A){super(),ld(this,A,Vf,Uf,Yu,{})}}function Nf(S){let A,D,j,ne,ae,de,h;return{c(){A=wo("div"),D=wo("label"),j=nh(S[0]),ne=yf(),ae=wo("input"),Vn(D,"class","govuk-label"),Vn(D,"for","file-upload"),ae.disabled=S[1],Vn(ae,"class","govuk-file-upload"),Vn(ae,"id","file-upload"),Vn(ae,"name","file-upload"),Vn(ae,"type","file"),Vn(A,"class","govuk-form-group")},m(ue,X){rd(ue,A,X),bo(A,D),bo(D,j),bo(A,ne),bo(A,ae),S[5](ae),de||(h=nd(ae,"change",S[3]),de=!0)},p(ue,[X]){X&1&&bf(j,ue[0]),X&2&&(ae.disabled=ue[1])},i:Nn,o:Nn,d(ue){ue&&Ol(A),S[5](null),de=!1,h()}}}function $f(S,A,D){let{label:j}=A,{loadFile:ne}=A,{disabled:ae=!1}=A,de;function h(X){let Ge=new FileReader;Ge.onload=nt=>{ne(nt.target.result)};let xe=de.files;Ge.readAsText(xe[0])}function ue(X){Jc[X?"unshift":"push"](()=>{de=X,D(2,de)})}return S.$$set=X=>{"label"in X&&D(0,j=X.label),"loadFile"in X&&D(4,ne=X.loadFile),"disabled"in X&&D(1,ae=X.disabled)},[j,ae,de,h,ne,ue]}class Wm extends cd{constructor(A){super(),ld(this,A,$f,Nf,Yu,{label:0,loadFile:4,disabled:1})}}var Di=63710088e-1,ah={centimeters:Di*100,centimetres:Di*100,degrees:Di/111325,feet:Di*3.28084,inches:Di*39.37,kilometers:Di/1e3,kilometres:Di/1e3,meters:Di,metres:Di,miles:Di/1609.344,millimeters:Di*1e3,millimetres:Di*1e3,nauticalmiles:Di/1852,radians:1,yards:Di*1.0936},qf={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/Di,yards:1.0936133},th={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 Xr(S,A,D){D===void 0&&(D={});var j={type:"Feature"};return(D.id===0||D.id)&&(j.id=D.id),D.bbox&&(j.bbox=D.bbox),j.properties=A||{},j.geometry=S,j}function jf(S,A,D){switch(S){case"Point":return dn(A).geometry;case"LineString":return fn(A).geometry;case"Polygon":return oh(A).geometry;case"MultiPoint":return pd(A).geometry;case"MultiLineString":return dd(A).geometry;case"MultiPolygon":return fd(A).geometry;default:throw new Error(S+" is invalid")}}function dn(S,A,D){if(D===void 0&&(D={}),!S)throw new Error("coordinates is required");if(!Array.isArray(S))throw new Error("coordinates must be an Array");if(S.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Rl(S[0])||!Rl(S[1]))throw new Error("coordinates must contain numbers");var j={type:"Point",coordinates:S};return Xr(j,A,D)}function Zf(S,A,D){return D===void 0&&(D={}),Ul(S.map(function(j){return dn(j,A)}),D)}function oh(S,A,D){D===void 0&&(D={});for(var j=0,ne=S;j=0))throw new Error("precision must be a positive number");var D=Math.pow(10,A||0);return Math.round(S*D)/D}function md(S,A){A===void 0&&(A="kilometers");var D=ah[A];if(!D)throw new Error(A+" units is invalid");return S*D}function lh(S,A){A===void 0&&(A="kilometers");var D=ah[A];if(!D)throw new Error(A+" units is invalid");return S/D}function Kf(S,A){return gd(lh(S,A))}function Yf(S){var A=S%360;return A<0&&(A+=360),A}function gd(S){var A=S%(2*Math.PI);return A*180/Math.PI}function Jf(S){var A=S%360;return A*Math.PI/180}function Qf(S,A,D){if(A===void 0&&(A="kilometers"),D===void 0&&(D="kilometers"),!(S>=0))throw new Error("length must be a positive number");return md(lh(S,A),D)}function em(S,A,D){if(A===void 0&&(A="meters"),D===void 0&&(D="kilometers"),!(S>=0))throw new Error("area must be a positive number");var j=th[A];if(!j)throw new Error("invalid original units");var ne=th[D];if(!ne)throw new Error("invalid final units");return S/j*ne}function Rl(S){return!isNaN(S)&&S!==null&&!Array.isArray(S)}function ch(S){return!!S&&S.constructor===Object}function tm(S){if(!S)throw new Error("bbox is required");if(!Array.isArray(S))throw new Error("bbox must be an Array");if(S.length!==4&&S.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");S.forEach(function(A){if(!Rl(A))throw new Error("bbox must only contain numbers")})}function im(S){if(!S)throw new Error("id is required");if(["string","number"].indexOf(typeof S)===-1)throw new Error("id must be a number or a string")}const Hm=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:th,bearingToAzimuth:Yf,convertArea:em,convertLength:Qf,degreesToRadians:Jf,earthRadius:Di,factors:ah,feature:Xr,featureCollection:Ul,geometry:jf,geometryCollection:Wf,isNumber:Rl,isObject:ch,lengthToDegrees:Kf,lengthToRadians:lh,lineString:fn,lineStrings:Xf,multiLineString:dd,multiPoint:pd,multiPolygon:fd,point:dn,points:Zf,polygon:oh,polygons:Gf,radiansToDegrees:gd,radiansToLength:md,round:Hf,unitsFactors:qf,validateBBox:tm,validateId:im},Symbol.toStringTag,{value:"Module"}));function ma(S,A,D){if(S!==null)for(var j,ne,ae,de,h,ue,X,Ge=0,xe=0,nt,ot=S.type,We=ot==="FeatureCollection",xt=ot==="Feature",bt=We?S.features.length:1,et=0;etue||We>X||xt>Ge){h=xe,ue=j,X=We,Ge=xt,ae=0;return}var bt=fn([h,xe],D.properties);if(A(bt,j,ne,xt,ae)===!1)return!1;ae++,h=xe})===!1)return!1}}})}function cm(S,A,D){var j=D,ne=!1;return xd(S,function(ae,de,h,ue,X){ne===!1&&D===void 0?j=ae:j=A(j,ae,de,h,ue,X),ne=!0}),j}function vd(S,A){if(!S)throw new Error("geojson is required");Vl(S,function(D,j,ne){if(D.geometry!==null){var ae=D.geometry.type,de=D.geometry.coordinates;switch(ae){case"LineString":if(A(D,j,ne,0,0)===!1)return!1;break;case"Polygon":for(var h=0;hD[0]&&(A[0]=D[0]),A[1]>D[1]&&(A[1]=D[1]),A[2]=0;ne--){let ae=Hu[ne];if(ae==A.id){j=!0;break}S.getLayer(ae)&&(D=ae)}if(!j)throw new Error(`Layer ID ${A.id} not defined in layerZorder`);S.addLayer(A,D)}function ig(S,A){dh(S,{id:A.id,source:A.source,filter:A.filter??uh,type:"fill",paint:{"fill-color":A.color,"fill-opacity":A.opacity}})}function rg(S,A){dh(S,{id:A.id,source:A.source,filter:A.filter??uh,type:"circle",paint:{"circle-radius":A.radius,"circle-color":A.color??Wu,"circle-opacity":A.opacity??bd,"circle-stroke-color":A.strokeColor??Wu,"circle-stroke-width":A.strokeWidth??0}})}function ng(S,A){dh(S,{id:A.id,source:A.source,filter:A.filter??uh,type:"line",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":A.color,"line-width":A.width,"line-opacity":A.opacity??bd}})}function sg(){return{type:"FeatureCollection",features:[]}}function ag(S){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:pm(S)}}}function pm(S){return[Math.round(S[0]*1e7)/1e7,Math.round(S[1]*1e7)/1e7]}function og(S,A,D){let j=["case"];for(let[ne,ae]of Object.entries(A))j.push(["==",["get",S],ne]),j.push(ae);return j.push(D),j}function lg(S){return Fl(S)}const Hu=["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{km as $,Sm as A,fs as B,Xm as C,Jc as D,$m as E,Wm as F,qm as G,Lf as H,Bm as I,Bf as J,Cm as K,Gm as L,lg as M,fd as N,oh as O,_m as P,Lm as Q,tg as R,cd as S,ig as T,ng as U,rg as V,sg as W,Jm as X,Qm as Y,eg as Z,bm as _,zl as a,ag as a0,Jf as a1,gd as a2,md as a3,lh as a4,dn as a5,Vl as a6,Ul as a7,fn as a8,Of as a9,Mm as aA,Nm as aB,Vm as aC,wm as aD,ym as aE,Dm as aF,Zm as aa,Hm as ab,Km as ac,Ym as ad,jm as ae,Xr as af,yd as ag,pm as ah,Im as ai,Rm as aj,Fm as ak,gm as al,cm as am,ma as an,Fl as ao,sm as ap,mm as aq,Pm as ar,Bl as as,Am as at,zm as au,Em as av,Om as aw,dh as ax,og as ay,vm as az,Gu as b,hf as c,rd as d,wo as e,uf as f,pf as g,Df as h,ld as i,od as j,Ol as k,nd as l,Zu as m,If as n,Um as o,nh as p,yf as q,Vn as r,Yu as s,sh as t,df as u,bo as v,bf as w,Nn as x,xm as y,Tm 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 Wo(n,this.transform),Ne.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),Bt.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 Kt}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){mr===void 0||n?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(a=>{mr=a.state!=="denied",t(mr)}).catch(()=>{mr=!!window.navigator.geolocation,t(mr)}):(mr=!!window.navigator.geolocation,t(mr)):t(mr)}(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,Bn=0,an=!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=hi.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&&an)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":Bn--,an=!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"),Bn++,Bn>1?(o={maximumAge:6e5,timeout:0},an=!0):(o=this.options.positionOptions,an=!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:qe,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,`${sn[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:pi,LngLat:h.LngLat,LngLatBounds:hi,Point:h.Point,MercatorCoordinate:h.MercatorCoordinate,Evented:h.Evented,AJAXError:h.AJAXError,config:h.config,CanvasSource:le,GeoJSONSource:br,ImageSource:Xi,RasterDEMTileSource:Rr,RasterTileSource:Kr,VectorTileSource:xn,VideoSource:vn,prewarm:function(){wn().acquire(Qr)},clearPrewarmedResources:function(){const o=fi;o&&(o.isPreloaded()&&o.numActive()===1?(o.release(Qr),fi=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 we.workerCount},set workerCount(o){we.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 de=te;return de})})(gd);var Km=gd.exports;function Vf(E){let A,D,N,te,ie;const de=E[3].default,h=rd(de,E,E[2],null);return{c(){A=wo("div"),D=wo("label"),N=lh(E[0]),te=vf(),h&&h.c(),pn(D,"class","govuk-label"),pn(D,"for",E[1]),pn(A,"class","govuk-form-group")},m(ce,Y){oh(ce,A,Y),zl(A,D),zl(D,N),zl(A,te),h&&h.m(A,null),ie=!0},p(ce,[Y]){(!ie||Y&1)&&Tf(N,ce[0]),(!ie||Y&2)&&pn(D,"for",ce[1]),h&&h.p&&(!ie||Y&4)&&ad(h,de,ce,ce[2],ie?sd(de,ce[2],Y,null):od(ce[2]),null)},i(ce){ie||(Io(h,ce),ie=!0)},o(ce){Vl(h,ce),ie=!1},d(ce){ce&&Eo(A),h&&h.d(ce)}}}function Nf(E,A,D){let{$$slots:N={},$$scope:te}=A,{label:ie}=A,{id:de}=A;return E.$$set=h=>{"label"in h&&D(0,ie=h.label),"id"in h&&D(1,de=h.id),"$$scope"in h&&D(2,te=h.$$scope)},[ie,de,te,N]}class $f extends hh{constructor(A){super(),ch(this,A,Nf,Vf,sh,{label:0,id:1})}}function qf(E){let A,D,N,te;const ie=E[2].default,de=rd(ie,E,E[1],null);let h=[{type:"button"},{class:"govuk-button govuk-button--secondary"},{"data-module":"govuk-button"},E[0]],ce={};for(let Y=0;Y{D(0,A=Ll(Ll({},A),Ku(de))),"$$scope"in de&&D(1,te=de.$$scope)},A=Ku(A),[A,te,N,ie]}class Ym extends hh{constructor(A){super(),ch(this,A,jf,qf,sh,{})}}function Zf(E){let A,D,N;return{c(){A=wo("input"),A.disabled=E[2],pn(A,"class","govuk-file-upload"),pn(A,"id",E[1]),pn(A,"type","file")},m(te,ie){oh(te,A,ie),E[6](A),D||(N=ud(A,"change",E[4]),D=!0)},p(te,ie){ie&4&&(A.disabled=te[2]),ie&2&&pn(A,"id",te[1])},d(te){te&&Eo(A),E[6](null),D=!1,N()}}}function Gf(E){let A,D;return A=new $f({props:{label:E[0],id:E[1],$$slots:{default:[Zf]},$$scope:{ctx:E}}}),{c(){Rf(A.$$.fragment)},m(N,te){fd(A,N,te),D=!0},p(N,[te]){const ie={};te&1&&(ie.label=N[0]),te&2&&(ie.id=N[1]),te&142&&(ie.$$scope={dirty:te,ctx:N}),A.$set(ie)},i(N){D||(Io(A.$$.fragment,N),D=!0)},o(N){Vl(A.$$.fragment,N),D=!1},d(N){md(A,N)}}}function Xf(E,A,D){let{label:N}=A,{id:te}=A,{loadFile:ie}=A,{disabled:de=!1}=A,h;function ce(Ne){let xe=new FileReader;xe.onload=ot=>{ie(ot.target.result)};let nt=h.files;xe.readAsText(nt[0])}function Y(Ne){eh[Ne?"unshift":"push"](()=>{h=Ne,D(3,h)})}return E.$$set=Ne=>{"label"in Ne&&D(0,N=Ne.label),"id"in Ne&&D(1,te=Ne.id),"loadFile"in Ne&&D(5,ie=Ne.loadFile),"disabled"in Ne&&D(2,de=Ne.disabled)},[N,te,de,h,ce,ie,Y]}class Jm extends hh{constructor(A){super(),ch(this,A,Xf,Gf,sh,{label:0,id:1,loadFile:5,disabled:2})}}var Di=63710088e-1,uh={centimeters:Di*100,centimetres:Di*100,degrees:Di/111325,feet:Di*3.28084,inches:Di*39.37,kilometers:Di/1e3,kilometres:Di/1e3,meters:Di,metres:Di,miles:Di/1609.344,millimeters:Di*1e3,millimetres:Di*1e3,nauticalmiles:Di/1852,radians:1,yards:Di*1.0936},Wf={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/Di,yards:1.0936133},rh={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 Xr(E,A,D){D===void 0&&(D={});var N={type:"Feature"};return(D.id===0||D.id)&&(N.id=D.id),D.bbox&&(N.bbox=D.bbox),N.properties=A||{},N.geometry=E,N}function Hf(E,A,D){switch(E){case"Point":return dn(A).geometry;case"LineString":return mn(A).geometry;case"Polygon":return dh(A).geometry;case"MultiPoint":return xd(A).geometry;case"MultiLineString":return yd(A).geometry;case"MultiPolygon":return vd(A).geometry;default:throw new Error(E+" is invalid")}}function dn(E,A,D){if(D===void 0&&(D={}),!E)throw new Error("coordinates is required");if(!Array.isArray(E))throw new Error("coordinates must be an Array");if(E.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ol(E[0])||!Ol(E[1]))throw new Error("coordinates must contain numbers");var N={type:"Point",coordinates:E};return Xr(N,A,D)}function Kf(E,A,D){return D===void 0&&(D={}),Nl(E.map(function(N){return dn(N,A)}),D)}function dh(E,A,D){D===void 0&&(D={});for(var N=0,te=E;N=0))throw new Error("precision must be a positive number");var D=Math.pow(10,A||0);return Math.round(E*D)/D}function bd(E,A){A===void 0&&(A="kilometers");var D=uh[A];if(!D)throw new Error(A+" units is invalid");return E*D}function ph(E,A){A===void 0&&(A="kilometers");var D=uh[A];if(!D)throw new Error(A+" units is invalid");return E/D}function tm(E,A){return wd(ph(E,A))}function im(E){var A=E%360;return A<0&&(A+=360),A}function wd(E){var A=E%(2*Math.PI);return A*180/Math.PI}function rm(E){var A=E%360;return A*Math.PI/180}function nm(E,A,D){if(A===void 0&&(A="kilometers"),D===void 0&&(D="kilometers"),!(E>=0))throw new Error("length must be a positive number");return bd(ph(E,A),D)}function sm(E,A,D){if(A===void 0&&(A="meters"),D===void 0&&(D="kilometers"),!(E>=0))throw new Error("area must be a positive number");var N=rh[A];if(!N)throw new Error("invalid original units");var te=rh[D];if(!te)throw new Error("invalid final units");return E/N*te}function Ol(E){return!isNaN(E)&&E!==null&&!Array.isArray(E)}function fh(E){return!!E&&E.constructor===Object}function am(E){if(!E)throw new Error("bbox is required");if(!Array.isArray(E))throw new Error("bbox must be an Array");if(E.length!==4&&E.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");E.forEach(function(A){if(!Ol(A))throw new Error("bbox must only contain numbers")})}function om(E){if(!E)throw new Error("id is required");if(["string","number"].indexOf(typeof E)===-1)throw new Error("id must be a number or a string")}const Qm=Object.freeze(Object.defineProperty({__proto__:null,areaFactors:rh,bearingToAzimuth:im,convertArea:sm,convertLength:nm,degreesToRadians:rm,earthRadius:Di,factors:uh,feature:Xr,featureCollection:Nl,geometry:Hf,geometryCollection:Qf,isNumber:Ol,isObject:fh,lengthToDegrees:tm,lengthToRadians:ph,lineString:mn,lineStrings:Jf,multiLineString:yd,multiPoint:xd,multiPolygon:vd,point:dn,points:Kf,polygon:dh,polygons:Yf,radiansToDegrees:wd,radiansToLength:bd,round:em,unitsFactors:Wf,validateBBox:am,validateId:om},Symbol.toStringTag,{value:"Module"}));function ma(E,A,D){if(E!==null)for(var N,te,ie,de,h,ce,Y,Ne=0,xe=0,nt,ot=E.type,We=ot==="FeatureCollection",xt=ot==="Feature",bt=We?E.features.length:1,et=0;etce||We>Y||xt>Ne){h=xe,ce=N,Y=We,Ne=xt,ie=0;return}var bt=mn([h,xe],D.properties);if(A(bt,N,te,xt,ie)===!1)return!1;ie++,h=xe})===!1)return!1}}})}function fm(E,A,D){var N=D,te=!1;return Sd(E,function(ie,de,h,ce,Y){te===!1&&D===void 0?N=ie:N=A(N,ie,de,h,ce,Y),te=!0}),N}function Id(E,A){if(!E)throw new Error("geojson is required");$l(E,function(D,N,te){if(D.geometry!==null){var ie=D.geometry.type,de=D.geometry.coordinates;switch(ie){case"LineString":if(A(D,N,te,0,0)===!1)return!1;break;case"Polygon":for(var h=0;hD[0]&&(A[0]=D[0]),A[1]>D[1]&&(A[1]=D[1]),A[2]=0;te--){let ie=ed[te];if(ie==A.id){N=!0;break}E.getLayer(ie)&&(D=ie)}if(!N)throw new Error(`Layer ID ${A.id} not defined in layerZorder`);E.addLayer(A,D)}function ag(E,A){_h(E,{id:A.id,source:A.source,filter:A.filter??gh,type:"fill",paint:{"fill-color":A.color,"fill-opacity":A.opacity}})}function og(E,A){_h(E,{id:A.id,source:A.source,filter:A.filter??gh,type:"circle",paint:{"circle-radius":A.radius,"circle-color":A.color??Qu,"circle-opacity":A.opacity??Ad,"circle-stroke-color":A.strokeColor??Qu,"circle-stroke-width":A.strokeWidth??0}})}function lg(E,A){_h(E,{id:A.id,source:A.source,filter:A.filter??gh,type:"line",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":A.color,"line-width":A.width,"line-opacity":A.opacity??Ad}})}function cg(){return{type:"FeatureCollection",features:[]}}function hg(E){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:ym(E)}}}function ym(E){return[Math.round(E[0]*1e7)/1e7,Math.round(E[1]*1e7)/1e7]}function ug(E,A,D){let N=["case"];for(let[te,ie]of Object.entries(A))N.push(["==",["get",E],te]),N.push(ie);return N.push(D),N}function dg(E){return Ul(E)}const ed=["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{Im as $,Cm as A,ps as B,Ym as C,eh as D,Xm as E,$f as F,Jm as G,Rf as H,fd as I,Vm as J,md as K,Bm as L,Km as M,dg as N,vd as O,dh as P,wm as Q,Um as R,hh as S,sg as T,ag as U,lg as V,og as W,cg as X,ig as Y,rg as Z,ng as _,Ll as a,Rm as a0,hg as a1,rm as a2,wd as a3,bd as a4,ph as a5,dn as a6,$l as a7,Nl as a8,mn as a9,Sm as aA,Lm as aB,Gm as aC,Zm as aD,Am as aE,Tm as aF,Om as aG,Uf as aa,Hm as ab,Qm as ac,eg as ad,tg as ae,Wm as af,Xr as ag,Ed as ah,ym as ai,km as aj,Nm as ak,$m as al,bm as am,fm as an,ma as ao,Ul as ap,hm as aq,vm as ar,Dm as as,Fl as at,zm as au,Fm as av,Mm as aw,qm as ax,_h as ay,ug as az,Yu as b,rd as c,oh as d,wo as e,sd as f,od as g,Bf as h,ch as i,Vl as j,Eo as k,ud as l,Ku as m,Pf as n,jm as o,lh as p,vf as q,pn as r,sh as s,Io as t,ad as u,zl as v,Tf as w,fa as x,Em as y,Pm as z}; diff --git a/govuk_step2/assets/nested-b0dcaf1c.js b/govuk_step2/assets/nested-015caff1.js similarity index 99% rename from govuk_step2/assets/nested-b0dcaf1c.js rename to govuk_step2/assets/nested-015caff1.js index dcb287d52..8d1efff69 100644 --- a/govuk_step2/assets/nested-b0dcaf1c.js +++ b/govuk_step2/assets/nested-015caff1.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{N as fo,O as co,S as Z,i as Q,s as ee,P as z,Q as po,M as di,R as lt,T as Zn,U as Ft,V as _n,W as tt,X as Qn,Y as er,Z as tr,_ as _e,d as w,x as U,k,$ as mn,e as $,a0 as Gt,G as F,q as A,r as R,H as P,l as G,t as E,j as C,J as B,v as M,a1 as Pe,a2 as On,a3 as ho,a4 as go,a5 as ht,a6 as nr,a7 as Qe,a8 as gt,a9 as _o,aa as rr,ab as mo,ac as bo,ad as yo,ae as vo,af as fr,ag as tn,ah as Yt,ai as Te,B as Ie,p as ie,aj as de,ak as he,al as it,K as Nt,am as wo,an as ko,ao as So,ap as Eo,aq as Rn,w as Oe,z as jt,A as fe,D as le,E as ve,I as we,o as De,y as nn,ar as hi,as as bn,at as rn,au as Mo,F as $o,av as gi,aw as on,ax as Co,ay as yn,az as cr,aA as pr,c as Lo,u as To,g as Ao,f as xo,aB as Oo,aC as Ro}from"./maplibre_helpers-e26a4314.js";import{M as _i,A as Io,a as Fo}from"./About-1c252dce.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,M as Po,r as mt,e as dr,L as Bo,Z as No,h as jo,j as Do,I as Ho,B as Uo,k as qo}from"./ZoomOutMap-e4c4885e.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{O as fo,P as co,S as Z,i as Q,s as ee,Q as z,R as po,N as di,T as lt,U as Zn,V as Ft,W as _n,X as tt,Y as Qn,Z as er,_ as tr,$ as _e,d as w,x as U,k,a0 as mn,e as $,a1 as Gt,H as F,q as A,r as R,I as P,l as G,t as E,j as C,K as B,v as M,a2 as Pe,a3 as On,a4 as ho,a5 as go,a6 as ht,a7 as nr,a8 as Qe,a9 as gt,aa as _o,ab as rr,ac as mo,ad as bo,ae as yo,af as vo,ag as fr,ah as tn,ai as Yt,aj as Te,B as Ie,p as ie,ak as de,al as he,am as it,L as Nt,an as wo,ao as ko,ap as So,aq as Eo,ar as Rn,w as Oe,z as jt,A as fe,D as le,E as ve,J as we,o as De,y as nn,as as hi,at as bn,au as rn,av as Mo,G as $o,aw as gi,ax as on,ay as Co,az as yn,aA as cr,aB as pr,c as Lo,u as To,g as Ao,f as xo,aC as Oo,aD as Ro}from"./maplibre_helpers-5d84afaa.js";import{M as _i,A as Io,a as Fo}from"./About-75317461.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,M as Po,r as mt,e as dr,L as Bo,Z as No,h as jo,j as Do,I as Ho,B as Uo,k as qo}from"./ZoomOutMap-3b70466a.js";/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 @@ -31,7 +31,7 @@ ${r.stack}`:n}function pl(r,e){const t=e(r.length*1);return xt().set(r,t/1),Ke=r Bing Streetside`),f=A(),F(c.$$.fragment),R(t,"type","radio"),t.__value="google",fe(t,t.__value),R(l,"type","radio"),l.__value="bing",fe(l,l.__value),h.p(t,l)},m(b,g){w(b,e,g),M(e,t),t.checked=t.__value===r[0].streetViewImagery,M(e,n),w(b,i,g),w(b,o,g),w(b,s,g),w(b,a,g),M(a,l),l.checked=l.__value===r[0].streetViewImagery,M(a,u),w(b,f,g),P(c,b,g),d=!0,v||(_=[G(t,"change",r[6]),G(l,"change",r[8])],v=!0)},p(b,g){g&1&&(t.checked=t.__value===b[0].streetViewImagery),g&1&&(l.checked=l.__value===b[0].streetViewImagery);const p={};g&1024&&(p.$$scope={dirty:g,ctx:b}),c.$set(p)},i(b){d||(E(c.$$.fragment,b),d=!0)},o(b){C(c.$$.fragment,b),d=!1},d(b){b&&(k(e),k(i),k(o),k(s),k(a),k(f)),B(c,b),h.r(),v=!1,Ie(_)}}}function aa(r){let e;return{c(){e=$("ul"),e.innerHTML="

  • Click on the map to open a new tab with a 3rd-party imagery provider
  • Press Escape to exit this mode
  • "},m(t,n){w(t,e,n)},p:U,d(t){t&&k(e)}}}function ua(r){let e,t,n=r[1]==Ur&&Hr(r);return{c(){n&&n.c(),e=_e()},m(i,o){n&&n.m(i,o),w(i,e,o),t=!0},p(i,[o]){i[1]==Ur?n?(n.p(i,o),o&2&&E(n,1)):(n=Hr(i),n.c(),E(n,1),n.m(e.parentNode,e)):n&&(de(),C(n,1,1,()=>{n=null}),he())},i(i){t||(E(n),t=!0)},o(i){C(n),t=!1},d(i){i&&k(e),n&&n.d(i)}}}const Ur="street-view";function fa(r,e,t){let n,i,o;z(r,Lt,h=>t(0,n=h)),z(r,Ue,h=>t(9,i=h)),z(r,Ce,h=>t(1,o=h));let{eventHandler:s}=e,{changeMode:a}=e;function l(){i.getCanvas().style.cursor="zoom-in"}function u(){i.getCanvas().style.cursor="inherit"}s.mapHandlers.click=h=>{let v=h.lngLat.lng,_=h.lngLat.lat;n.streetViewImagery=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${_},${v}&cbp=11,0,0,0,0`,"_blank"):n.streetViewImagery=="bing"&&window.open(`https://www.bing.com/maps?cp=${_}~${v}&style=x`,"_blank")},s.documentHandlers.keydown=h=>{h.key=="Escape"&&(a("edit-attribute"),h.preventDefault())};const f=[[]];function c(){n.streetViewImagery=this.__value,Lt.set(n)}function d(){n.streetViewImagery=this.__value,Lt.set(n)}return r.$$set=h=>{"eventHandler"in h&&t(2,s=h.eventHandler),"changeMode"in h&&t(3,a=h.changeMode)},[n,o,s,a,l,u,c,f,d]}class ca extends Z{constructor(e){super(),Q(this,e,fa,ua,ee,{eventHandler:2,changeMode:3,start:4,stop:5})}get start(){return this.$$.ctx[4]}get stop(){return this.$$.ctx[5]}}function qr(r){let e,t,n={pointTool:r[11],polygonTool:r[12],routeTool:r[2],eventHandler:r[13]["edit-geometry"]};return e=new xl({props:n}),r[16](e),{c(){F(e.$$.fragment)},m(i,o){P(e,i,o),t=!0},p(i,o){const s={};o&4&&(s.routeTool=i[2]),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){C(e.$$.fragment,i),t=!1},d(i){r[16](null),B(e,i)}}}function Gr(r){let e,t;return e=new We({props:{thisMode:"point",label:"New point",icon:Rs,changeMode:r[14]}}),{c(){F(e.$$.fragment)},m(n,i){P(e,n,i),t=!0},p:U,i(n){t||(E(e.$$.fragment,n),t=!0)},o(n){C(e.$$.fragment,n),t=!1},d(n){B(e,n)}}}function Yr(r){let e,t,n={changeMode:r[14],routeTool:r[2],eventHandler:r[13]["snap-polygon"]};return e=new la({props:n}),r[19](e),{c(){F(e.$$.fragment)},m(i,o){P(e,i,o),t=!0},p(i,o){const s={};o&4&&(s.routeTool=i[2]),e.$set(s)},i(i){t||(E(e.$$.fragment,i),t=!0)},o(i){C(e.$$.fragment,i),t=!1},d(i){r[19](null),B(e,i)}}}function Jr(r){let e,t;return e=new We({props:{thisMode:"route",label:"New route",icon:Ps,changeMode:r[14]}}),{c(){F(e.$$.fragment)},m(n,i){P(e,n,i),t=!0},p:U,i(n){t||(E(e.$$.fragment,n),t=!0)},o(n){C(e.$$.fragment,n),t=!1},d(n){B(e,n)}}}function zr(r){let e,t;return e=new We({props:{thisMode:"split-route",label:"Split route",icon:Ci,changeMode:r[14]}}),{c(){F(e.$$.fragment)},m(n,i){P(e,n,i),t=!0},p:U,i(n){t||(E(e.$$.fragment,n),t=!0)},o(n){C(e.$$.fragment,n),t=!1},d(n){B(e,n)}}}function pa(r){let e,t,n,i,o,s,a,l,u,f,c,d,h,v,_,b,g,p,m,y,S,L,O,x,I,N,j,D,T,H,ae,ke,Ee,ue,ne,K,Le;n=new We({props:{thisMode:"edit-attribute",label:"Edit attributes",icon:xs,changeMode:r[14]}});let me={changeMode:r[14],eventHandler:r[13]["edit-attribute"]};o=new Us({props:me}),r[15](o),l=new We({props:{thisMode:"edit-geometry",label:"Edit geometry",icon:Os,changeMode:r[14]}});let ge=r[2]&&qr(r),be=r[1]!="planning"&&Gr(r),yt={changeMode:r[14],pointTool:r[11],eventHandler:r[13].point};h=new Il({props:yt}),r[17](h),b=new We({props:{thisMode:"free-polygon",label:"New polygon (freehand)",icon:Is,changeMode:r[14]}});let Ht={changeMode:r[14],polygonTool:r[12],eventHandler:r[13]["free-polygon"]};p=new Bl({props:Ht}),r[18](p),S=new We({props:{thisMode:"snap-polygon",label:"New polygon (snapped)",icon:Fs,changeMode:r[14]}});let se=r[2]&&Yr(r),re=r[1]!="planning"&&Jr(r);function X(q){r[21](q)}let oe={changeMode:r[14],url:r[0],eventHandler:r[13].route};r[2]!==void 0&&(oe.routeTool=r[2]),N=new Yl({props:oe}),r[20](N),le.push(()=>ve(N,"routeTool",X));let Me=r[1]!="planning"&&zr(r),to={changeMode:r[14],eventHandler:r[13]["split-route"]};ae=new na({props:to}),r[22](ae),ue=new We({props:{thisMode:"street-view",label:"Street View",icon:Bs,changeMode:r[14]}});let no={changeMode:r[14],eventHandler:r[13]["street-view"]};return K=new ca({props:no}),r[23](K),{c(){e=$("div"),t=$("div"),F(n.$$.fragment),i=A(),F(o.$$.fragment),s=A(),a=$("div"),F(l.$$.fragment),u=A(),ge&&ge.c(),f=A(),c=$("div"),be&&be.c(),d=A(),F(h.$$.fragment),v=A(),_=$("div"),F(b.$$.fragment),g=A(),F(p.$$.fragment),m=A(),y=$("div"),F(S.$$.fragment),L=A(),se&&se.c(),O=A(),x=$("div"),re&&re.c(),I=A(),F(N.$$.fragment),D=A(),T=$("div"),Me&&Me.c(),H=A(),F(ae.$$.fragment),ke=A(),Ee=$("div"),F(ue.$$.fragment),ne=A(),F(K.$$.fragment),R(e,"class","toolbox svelte-4s4d3o")},m(q,xe){w(q,e,xe),M(e,t),P(n,t,null),M(t,i),P(o,t,null),M(e,s),M(e,a),P(l,a,null),M(a,u),ge&&ge.m(a,null),M(e,f),M(e,c),be&&be.m(c,null),M(c,d),P(h,c,null),M(e,v),M(e,_),P(b,_,null),M(_,g),P(p,_,null),M(e,m),M(e,y),P(S,y,null),M(y,L),se&&se.m(y,null),M(e,O),M(e,x),re&&re.m(x,null),M(x,I),P(N,x,null),M(e,D),M(e,T),Me&&Me.m(T,null),M(T,H),P(ae,T,null),M(e,ke),M(e,Ee),P(ue,Ee,null),M(Ee,ne),P(K,Ee,null),Le=!0},p(q,[xe]){const ro={};o.$set(ro),q[2]?ge?(ge.p(q,xe),xe&4&&E(ge,1)):(ge=qr(q),ge.c(),E(ge,1),ge.m(a,null)):ge&&(de(),C(ge,1,1,()=>{ge=null}),he()),q[1]!="planning"?be?(be.p(q,xe),xe&2&&E(be,1)):(be=Gr(q),be.c(),E(be,1),be.m(c,d)):be&&(de(),C(be,1,1,()=>{be=null}),he());const io={};h.$set(io);const oo={};p.$set(oo),q[2]?se?(se.p(q,xe),xe&4&&E(se,1)):(se=Yr(q),se.c(),E(se,1),se.m(y,null)):se&&(de(),C(se,1,1,()=>{se=null}),he()),q[1]!="planning"?re?(re.p(q,xe),xe&2&&E(re,1)):(re=Jr(q),re.c(),E(re,1),re.m(x,I)):re&&(de(),C(re,1,1,()=>{re=null}),he());const kn={};xe&1&&(kn.url=q[0]),!j&&xe&4&&(j=!0,kn.routeTool=q[2],we(()=>j=!1)),N.$set(kn),q[1]!="planning"?Me?(Me.p(q,xe),xe&2&&E(Me,1)):(Me=zr(q),Me.c(),E(Me,1),Me.m(T,H)):Me&&(de(),C(Me,1,1,()=>{Me=null}),he());const so={};ae.$set(so);const lo={};K.$set(lo)},i(q){Le||(E(n.$$.fragment,q),E(o.$$.fragment,q),E(l.$$.fragment,q),E(ge),E(be),E(h.$$.fragment,q),E(b.$$.fragment,q),E(p.$$.fragment,q),E(S.$$.fragment,q),E(se),E(re),E(N.$$.fragment,q),E(Me),E(ae.$$.fragment,q),E(ue.$$.fragment,q),E(K.$$.fragment,q),Le=!0)},o(q){C(n.$$.fragment,q),C(o.$$.fragment,q),C(l.$$.fragment,q),C(ge),C(be),C(h.$$.fragment,q),C(b.$$.fragment,q),C(p.$$.fragment,q),C(S.$$.fragment,q),C(se),C(re),C(N.$$.fragment,q),C(Me),C(ae.$$.fragment,q),C(ue.$$.fragment,q),C(K.$$.fragment,q),Le=!1},d(q){q&&k(e),B(n),r[15](null),B(o),B(l),ge&&ge.d(),be&&be.d(),r[17](null),B(h),B(b),r[18](null),B(p),B(S),se&&se.d(),re&&re.d(),r[20](null),B(N),Me&&Me.d(),r[22](null),B(ae),B(ue),r[23](null),B(K)}}}function da(r,e,t){let n,i;z(r,Ue,T=>t(24,n=T)),z(r,Ce,T=>t(25,i=T));let{routeSnapperUrl:o}=e,{schema:s}=e,a,l=new qs(n),u=new ol(n),f,c,d,h,v,_,b,g;const p={"edit-attribute":new Je,"edit-geometry":new Je,route:new Je,point:new Je,"free-polygon":new Je,"snap-polygon":new Je,"split-route":new Je,"street-view":new Je};$r.forEach(T=>{n.on(T,H=>{p[it(Ce)].mapHandlers[T](H)})}),Cr.forEach(T=>{document.addEventListener(T,H=>{p[it(Ce)].documentHandlers[T](H)})});function m(T){let H={"edit-attribute":f,"edit-geometry":c,route:d,point:h,"free-polygon":v,"snap-polygon":_,"split-route":b,"street-view":g};const ae=i;if(ae==T){console.log(`Mode is already ${ae}, not changing`);return}console.log(`Stopping old mode ${ae}`),H[ae].stop(),Ce.set(T),console.log(`Starting new mode ${T}`),H[T].start()}mn(()=>{u==null||u.tearDown(),a==null||a.tearDown(),$r.forEach(T=>{n.off(T,H=>{p[it(Ce)].mapHandlers[T](H)})}),Cr.forEach(T=>{document.removeEventListener(T,H=>{p[it(Ce)].documentHandlers[T](H)})})});function y(T){le[T?"unshift":"push"](()=>{f=T,t(3,f)})}function S(T){le[T?"unshift":"push"](()=>{c=T,t(4,c)})}function L(T){le[T?"unshift":"push"](()=>{h=T,t(6,h)})}function O(T){le[T?"unshift":"push"](()=>{v=T,t(7,v)})}function x(T){le[T?"unshift":"push"](()=>{_=T,t(8,_)})}function I(T){le[T?"unshift":"push"](()=>{d=T,t(5,d)})}function N(T){a=T,t(2,a)}function j(T){le[T?"unshift":"push"](()=>{b=T,t(9,b)})}function D(T){le[T?"unshift":"push"](()=>{g=T,t(10,g)})}return r.$$set=T=>{"routeSnapperUrl"in T&&t(0,o=T.routeSnapperUrl),"schema"in T&&t(1,s=T.schema)},[o,s,a,f,c,d,h,v,_,b,g,l,u,p,m,y,S,L,O,x,I,N,j,D]}class ha extends Z{constructor(e){super(),Q(this,e,da,pa,ee,{routeSnapperUrl:0,schema:1})}}function Xr(r,e,t){const n=r.slice();return n[3]=e[t],n}function Wr(r,e,t){const n=r.slice();return n[6]=e[t],n}function Vr(r){let e;return{c(){e=$("td"),R(e,"class","svelte-11t6rxo"),Te(e,"background-color",r[6])},m(t,n){w(t,e,n)},p(t,n){n&1&&Te(e,"background-color",t[6])},d(t){t&&k(e)}}}function Kr(r){let e,t=r[3]+"",n;return{c(){e=$("td"),n=ie(t),R(e,"class","svelte-11t6rxo"),Te(e,"width",r[2])},m(i,o){w(i,e,o),M(e,n)},p(i,o){o&2&&t!==(t=i[3]+"")&&Oe(n,t)},d(i){i&&k(e)}}}function ga(r){let e,t,n,i,o=De(r[0]),s=[];for(let u=0;u{"colors"in s&&t(0,n=s.colors),"labels"in s&&t(1,i=s.labels)},[n,i,o]}class ma extends Z{constructor(e){super(),Q(this,e,_a,ga,ee,{colors:0,labels:1})}}const ba="/atip/govuk_step2/assets/help-d011708a.svg";function ya(r){let e,t;return{c(){e=$("img"),Rn(e.src,t=ba)||R(e,"src",t),R(e,"title",r[0]),R(e,"alt",r[0])},m(n,i){w(n,e,i)},p(n,[i]){i&1&&R(e,"title",n[0]),i&1&&R(e,"alt",n[0])},i:U,o:U,d(n){n&&k(e)}}}function va(r,e,t){let{contents:n}=e;return r.$$set=i=>{"contents"in i&&t(0,n=i.contents)},[n]}class Gi extends Z{constructor(e){super(),Q(this,e,va,ya,ee,{contents:0})}}function wa(r){let e,t,n,i,o,s,a;return t=new Gi({props:{contents:"Data comes from OpenStreetMap, and may not always be correct. Unexpected values are treated as unknown. Freehand route segments and off-road paths generally have no speed data."}}),i=new ma({props:{colors:r[0],labels:["< 20","20","30","40",">= 50"]}}),s=new Po({props:{layers:["speed-limits"],contents:Sa}}),{c(){e=ie(`(mph) `),F(t.$$.fragment),n=A(),F(i.$$.fragment),o=A(),F(s.$$.fragment)},m(l,u){w(l,e,u),P(t,l,u),w(l,n,u),P(i,l,u),w(l,o,u),P(s,l,u),a=!0},p:U,i(l){a||(E(t.$$.fragment,l),E(i.$$.fragment,l),E(s.$$.fragment,l),a=!0)},o(l){C(t.$$.fragment,l),C(i.$$.fragment,l),C(s.$$.fragment,l),a=!1},d(l){l&&(k(e),k(n),k(o)),B(t,l),B(i,l),B(s,l)}}}let ka="white",ct="speed-limits",Tn="speed-limits",kt=.8;function Sa(r){return r.speed_limit?`${Math.round(r.speed_limit)} mph`:"Unknown"}function Ea(r,e,t){let n,i,o;z(r,Ue,f=>t(2,n=f)),z(r,mt,f=>t(3,i=f)),z(r,ce,f=>t(4,o=f));let{id:s}=e,a=["#00AB4D","#8ECA4D","#F7BB00","#BB0000","#470000"];const l=["case",["<",["get","speed_limit"],20],a[0],["==",["get","speed_limit"],20],a[1],["==",["get","speed_limit"],30],a[2],["==",["get","speed_limit"],40],a[3],[">=",["get","speed_limit"],50],a[4],ka],u=["case",["<",["get","speed_limit"],20],kt,["==",["get","speed_limit"],20],kt,["==",["get","speed_limit"],30],kt,["==",["get","speed_limit"],40],kt,[">=",["get","speed_limit"],50],kt,0];return lt(n,ct,tt()),Ft(n,{id:Tn,source:ct,color:l,width:In,opacity:u}),Nt(async()=>{try{if(s){let f=o.features.find(d=>d.id==s),c=JSON.parse(await i.speedLimitForRoute(f.properties.waypoints));n.getSource(ct).setData(c)}else{let f=JSON.parse(await i.allSpeedLimits());n.getSource(ct).setData(f)}}catch(f){window.alert(`Couldn't calculate speed limits for route: ${f}`)}}),mn(()=>{n.getLayer(Tn)&&n.removeLayer(Tn),n.getSource(ct)&&n.removeSource(ct)}),r.$$set=f=>{"id"in f&&t(1,s=f.id)},[a,s]}class Yi extends Z{constructor(e){super(),Q(this,e,Ea,wa,ee,{id:1})}}function Ma(r){let e;return{c(){e=$("p"),e.textContent="Route info loading..."},m(t,n){w(t,e,n)},p:U,i:U,o:U,d(t){t&&k(e)}}}function $a(r){let e,t,n,i,o,s,a,l,u,f,c,d=r[1]=="speed limits"&&Zr();return{c(){e=$("label"),t=ie(`Show layer: `),n=$("select"),i=$("option"),i.textContent="None",o=$("option"),o.textContent="Speed limits",a=A(),d&&d.c(),l=_e(),i.__value="none",fe(i,i.__value),o.__value="speed limits",fe(o,o.__value),n.disabled=s=r[0]!=null,r[1]===void 0&&bn(()=>r[3].call(n))},m(h,v){w(h,e,v),M(e,t),M(e,n),M(n,i),M(n,o),rn(n,r[1],!0),w(h,a,v),d&&d.m(h,v),w(h,l,v),u=!0,f||(c=G(n,"change",r[3]),f=!0)},p(h,v){(!u||v&1&&s!==(s=h[0]!=null))&&(n.disabled=s),v&2&&rn(n,h[1]),h[1]=="speed limits"?d?(d.p(h,v),v&2&&E(d,1)):(d=Zr(),d.c(),E(d,1),d.m(l.parentNode,l)):d&&(de(),C(d,1,1,()=>{d=null}),he())},i(h){u||(E(d),u=!0)},o(h){C(d),u=!1},d(h){h&&(k(e),k(a),k(l)),d&&d.d(h),f=!1,c()}}}function Zr(r){let e,t;return e=new Yi({props:{id:void 0}}),{c(){F(e.$$.fragment)},m(n,i){P(e,n,i),t=!0},p:U,i(n){t||(E(e.$$.fragment,n),t=!0)},o(n){C(e.$$.fragment,n),t=!1},d(n){B(e,n)}}}function Ca(r){let e,t,n,i;const o=[$a,Ma],s=[];function a(l,u){return l[2]?0:1}return e=a(r),t=s[e]=o[e](r),{c(){t.c(),n=_e()},m(l,u){s[e].m(l,u),w(l,n,u),i=!0},p(l,[u]){let f=e;e=a(l),e===f?s[e].p(l,u):(de(),C(s[f],1,1,()=>{s[f]=null}),he(),t=s[e],t?t.p(l,u):(t=s[e]=o[e](l),t.c()),E(t,1),t.m(n.parentNode,n))},i(l){i||(E(t),i=!0)},o(l){C(t),i=!1},d(l){l&&k(n),s[e].d(l)}}}function La(r,e,t){let n,i;z(r,Re,a=>t(0,n=a)),z(r,mt,a=>t(2,i=a));let o="none";function s(){o=hi(this),t(1,o),t(0,n)}return r.$$.update=()=>{r.$$.dirty&1&&n&&t(1,o="none")},[n,o,i,s]}class Ta extends Z{constructor(e){super(),Q(this,e,La,Ca,ee,{})}}function Aa(r){let e,t,n,i,o,s,a,l,u,f;return{c(){e=$("p"),t=ie(r[4]),n=A(),i=$("button"),o=ie(r[5]),s=A(),a=$("button"),l=ie(r[6]),R(i,"type","button"),R(a,"type","button")},m(c,d){w(c,e,d),M(e,t),w(c,n,d),w(c,i,d),M(i,o),w(c,s,d),w(c,a,d),M(a,l),u||(f=[G(i,"click",r[7]),G(a,"click",r[8])],u=!0)},p(c,d){d&16&&Oe(t,c[4]),d&32&&Oe(o,c[5]),d&64&&Oe(l,c[6])},d(c){c&&(k(e),k(n),k(i),k(s),k(a)),u=!1,Ie(f)}}}function xa(r){let e,t,n,i,o,s;function a(d){r[9](d)}function l(d){r[10](d)}function u(d){r[11](d)}function f(d){r[12](d)}let c={$$slots:{default:[Aa]},$$scope:{ctx:r}};return r[3]!==void 0&&(c.title=r[3]),r[0]!==void 0&&(c.open=r[0]),r[1]!==void 0&&(c.displayEscapeButton=r[1]),r[2]!==void 0&&(c.canCloseByClickingBackground=r[2]),e=new _i({props:c}),le.push(()=>ve(e,"title",a)),le.push(()=>ve(e,"open",l)),le.push(()=>ve(e,"displayEscapeButton",u)),le.push(()=>ve(e,"canCloseByClickingBackground",f)),{c(){F(e.$$.fragment)},m(d,h){P(e,d,h),s=!0},p(d,[h]){const v={};h&16496&&(v.$$scope={dirty:h,ctx:d}),!t&&h&8&&(t=!0,v.title=d[3],we(()=>t=!1)),!n&&h&1&&(n=!0,v.open=d[0],we(()=>n=!1)),!i&&h&2&&(i=!0,v.displayEscapeButton=d[1],we(()=>i=!1)),!o&&h&4&&(o=!0,v.canCloseByClickingBackground=d[2],we(()=>o=!1)),e.$set(v)},i(d){s||(E(e.$$.fragment,d),s=!0)},o(d){C(e.$$.fragment,d),s=!1},d(d){B(e,d)}}}function Oa(r,e,t){const n=Mo();let{open:i=!1}=e,{displayEscapeButton:o=!1}=e,{canCloseByClickingBackground:s=!1}=e,{title:a}=e,{message:l}=e,{confirmButtonText:u="Confirm"}=e,{cancelButtonText:f="Cancel"}=e;function c(){n("confirmAction")}function d(){n("cancelAction")}function h(g){a=g,t(3,a)}function v(g){i=g,t(0,i)}function _(g){o=g,t(1,o)}function b(g){s=g,t(2,s)}return r.$$set=g=>{"open"in g&&t(0,i=g.open),"displayEscapeButton"in g&&t(1,o=g.displayEscapeButton),"canCloseByClickingBackground"in g&&t(2,s=g.canCloseByClickingBackground),"title"in g&&t(3,a=g.title),"message"in g&&t(4,l=g.message),"confirmButtonText"in g&&t(5,u=g.confirmButtonText),"cancelButtonText"in g&&t(6,f=g.cancelButtonText)},[i,o,s,a,l,u,f,c,d,h,v,_,b]}class Ra extends Z{constructor(e){super(),Q(this,e,Oa,xa,ee,{open:0,displayEscapeButton:1,canCloseByClickingBackground:2,title:3,message:4,confirmButtonText:5,cancelButtonText:6})}}function Qr(r){let e;return{c(){e=$("p"),e.textContent=`Finish drawing on the map and/or select "Edit attributes" to use these - options.`,R(e,"class","reminder")},m(t,n){w(t,e,n)},d(t){t&&k(e)}}}function Ia(r){let e,t,n,i,o,s,a,l,u,f,c,d,h,v,_,b,g,p=r[0].features.length+"",m,y,S,L,O,x,I,N,j,D,T,H,ae;u=new $o({props:{label:"Load from GeoJSON",disabled:r[2],loadFile:r[7]}});function ke(ne){r[13](ne)}let Ee={title:"Would you like to clear your work?",message:"This will delete all your drawn interventions."};r[1]!==void 0&&(Ee.open=r[1]),N=new Ra({props:Ee}),le.push(()=>ve(N,"open",ke)),N.$on("cancelAction",r[4]),N.$on("confirmAction",r[5]);let ue=r[2]&&Qr();return{c(){e=$("div"),t=$("label"),n=ie(`Scheme name: + options.`,R(e,"class","reminder")},m(t,n){w(t,e,n)},d(t){t&&k(e)}}}function Ia(r){let e,t,n,i,o,s,a,l,u,f,c,d,h,v,_,b,g,p=r[0].features.length+"",m,y,S,L,O,x,I,N,j,D,T,H,ae;u=new $o({props:{label:"Load from GeoJSON",id:"load-geojson",disabled:r[2],loadFile:r[7]}});function ke(ne){r[13](ne)}let Ee={title:"Would you like to clear your work?",message:"This will delete all your drawn interventions."};r[1]!==void 0&&(Ee.open=r[1]),N=new Ra({props:Ee}),le.push(()=>ve(N,"open",ke)),N.$on("cancelAction",r[4]),N.$on("confirmAction",r[5]);let ue=r[2]&&Qr();return{c(){e=$("div"),t=$("label"),n=ie(`Scheme name: `),i=$("input"),o=A(),s=$("br"),a=A(),l=$("div"),F(u.$$.fragment),f=A(),c=$("button"),d=ie("Export to GeoJSON"),h=A(),v=$("br"),_=A(),b=$("div"),g=$("span"),m=ie(p),y=ie(" objects"),S=A(),L=$("button"),O=ie("Clear all"),I=A(),F(N.$$.fragment),D=A(),ue&&ue.c(),R(i,"type","text"),R(c,"type","button"),R(c,"class","align-right svelte-wfhzcu"),c.disabled=r[2],R(L,"type","button"),R(L,"class","align-right svelte-wfhzcu"),L.disabled=x=r[0].features.length==0||r[2]},m(ne,K){w(ne,e,K),M(e,t),M(t,n),M(t,i),fe(i,r[0].scheme_name),w(ne,o,K),w(ne,s,K),w(ne,a,K),w(ne,l,K),P(u,l,null),M(l,f),M(l,c),M(c,d),w(ne,h,K),w(ne,v,K),w(ne,_,K),w(ne,b,K),M(b,g),M(g,m),M(g,y),M(b,S),M(b,L),M(L,O),M(b,I),P(N,b,null),M(b,D),ue&&ue.m(b,null),T=!0,H||(ae=[G(i,"input",r[12]),G(c,"click",r[6]),G(L,"click",r[3])],H=!0)},p(ne,[K]){K&1&&i.value!==ne[0].scheme_name&&fe(i,ne[0].scheme_name);const Le={};K&4&&(Le.disabled=ne[2]),u.$set(Le),(!T||K&4)&&(c.disabled=ne[2]),(!T||K&1)&&p!==(p=ne[0].features.length+"")&&Oe(m,p),(!T||K&5&&x!==(x=ne[0].features.length==0||ne[2]))&&(L.disabled=x);const me={};!j&&K&2&&(j=!0,me.open=ne[1],we(()=>j=!1)),N.$set(me),ne[2]?ue||(ue=Qr(),ue.c(),ue.m(b,null)):ue&&(ue.d(1),ue=null)},i(ne){T||(E(u.$$.fragment,ne),E(N.$$.fragment,ne),T=!0)},o(ne){C(u.$$.fragment,ne),C(N.$$.fragment,ne),T=!1},d(ne){ne&&(k(e),k(o),k(s),k(a),k(l),k(h),k(v),k(_),k(b)),B(u),B(N),ue&&ue.d(),H=!1,Ie(ae)}}}function Fa(r,e){var t=document.createElement("a");t.setAttribute("href","data:text/plain;charset=utf-8, "+encodeURIComponent(e)),t.setAttribute("download",r),document.body.appendChild(t),t.click(),document.body.removeChild(t)}function Pa(r,e,t){let n,i;z(r,ce,m=>t(0,n=m)),z(r,Dt,m=>t(2,i=m));let{authorityName:o}=e,{schema:s}=e,a=o;s!="v1"&&(a+=`_${s}`);let l=!1,u=!1;Nt(async()=>{let y=new URLSearchParams(window.location.search).get("geojsonUrl"),S=window.localStorage.getItem(a);if(y){console.log(`Loading GeoJSON from ${y}`);try{let O=await(await fetch(y)).text();ce.set(b(JSON.parse(O)))}catch(L){console.log(`Failed to load from URL: ${L}`)}}else if(S)try{ce.set(b(JSON.parse(S)))}catch(L){console.log(`Failed to load from local storage: ${L}`)}t(11,l=!0)});function f(){t(1,u=!0)}function c(){t(1,u=!1)}function d(){t(1,u=!1),ce.update(m=>(delete m.scheme_name,m.features=[],m)),Re.set(null),Ye.set(null),sn.set(null),ln.set(null)}function h(){const m=JSON.parse(JSON.stringify(n));for(let y of m.features)delete y.properties.hide_while_editing;return m}function v(){let m=h();var y=a;m.authority=o,m.origin="atip-v2",m.scheme_name&&(y+="_"+m.scheme_name),y+=".txt",Fa(y,JSON.stringify(m,null," "))}function _(m){try{ce.set(b(JSON.parse(m)))}catch(y){window.alert(`Couldn't load scheme from a file: ${y}`)}}function b(m){let y=1;for(let S of m.features)S.properties||(S.properties={name:"",description:"",intervention_type:"other"}),S.geometry.type=="LineString"&&!S.properties.length_meters&&(S.properties.length_meters=Qt(S,{units:"kilometers"})*1e3),S.id=y++;return m}function g(){n.scheme_name=this.value,ce.set(n)}function p(m){u=m,t(1,u)}return r.$$set=m=>{"authorityName"in m&&t(8,o=m.authorityName),"schema"in m&&t(9,s=m.schema)},r.$$.update=()=>{r.$$.dirty&3073&&l&&n&&(console.log("GJ changed, saving to local storage"),window.localStorage.setItem(a,JSON.stringify(h())))},[n,u,i,f,c,d,v,_,o,s,a,l,g,p]}class Ba extends Z{constructor(e){super(),Q(this,e,Pa,Ia,ee,{authorityName:8,schema:9})}}function Na(r){let e,t,n,i,o,s,a,l,u,f,c,d,h;return{c(){e=$("h2"),e.textContent="Drawing objects on the map",t=A(),n=$("p"),n.textContent=`Use the tools on right to sketch new objects on the map. Each tool has instructions that appear when you click on its icon.`,i=A(),o=$("p"),o.innerHTML="Modify existing objects on the map using Edit geometry and clicking something.",s=A(),a=$("h2"),a.textContent="Filling out data",l=A(),u=$("p"),u.innerHTML=`Edit attributes mode allows selecting and adding attributes to objects that appear on the left.`,f=A(),c=$("h2"),c.textContent="Saving files",d=A(),h=$("p"),h.innerHTML=`ATIP does not send any data over the network or store your data in the diff --git a/govuk_step2/assets/nested2-c9b375df.js b/govuk_step2/assets/nested2-c9b375df.js deleted file mode 100644 index a466c172a..000000000 --- a/govuk_step2/assets/nested2-c9b375df.js +++ /dev/null @@ -1,2 +0,0 @@ -import{S as he,i as ge,s as be,G as N,H as L,t as y,j as S,J as O,P as oe,K as we,$ as ye,C as X,F as ke,o as le,e as J,q as C,p as h,ai as ae,r as R,d as b,v as c,w as D,aj as _e,ak as $e,k as w,y as ve,M as fe,A as ue,l as Se,_ as Ce,x as je}from"./maplibre_helpers-e26a4314.js";import{F as Fe,i as Be}from"./FormElement-11aad004.js";import{L as Ne,g as W,Z as Le,j as Oe,I as Ie,B as Me,k as ze,M as Je,m as Te,C as Ge}from"./ZoomOutMap-e4c4885e.js";function ie(s,e,n){const t=s.slice();return t[17]=e[n],t}function Ae(s){let e;return{c(){e=h("Home")},m(n,t){b(n,e,t)},d(n){n&&w(e)}}}function Ee(s){let e;return{c(){e=h("Clear")},m(n,t){b(n,e,t)},d(n){n&&w(e)}}}function qe(s){let e,n,t,r,l,p;return t=new X({props:{$$slots:{default:[Ee]},$$scope:{ctx:s}}}),t.$on("click",s[11]),{c(){e=J("input"),n=C(),N(t.$$.fragment),R(e,"type","text"),R(e,"class","govuk-input govuk-input--width-10"),R(e,"id","filterText")},m(f,m){b(f,e,m),ue(e,s[1]),b(f,n,m),L(t,f,m),r=!0,l||(p=Se(e,"input",s[10]),l=!0)},p(f,m){m&2&&e.value!==f[1]&&ue(e,f[1]);const o={};m&1048576&&(o.$$scope={dirty:m,ctx:f}),t.$set(o)},i(f){r||(y(t.$$.fragment,f),r=!0)},o(f){S(t.$$.fragment,f),r=!1},d(f){f&&(w(e),w(n)),O(t,f),l=!1,p()}}}function ce(s){let e,n;return e=new Ge({props:{label:`${s[17].scheme_reference}: ${s[17].num_features} features`,$$slots:{default:[Pe]},$$scope:{ctx:s}}}),{c(){N(e.$$.fragment)},m(t,r){L(e,t,r),n=!0},p(t,r){const l={};r&1&&(l.label=`${t[17].scheme_reference}: ${t[17].num_features} features`),r&1048577&&(l.$$scope={dirty:r,ctx:t}),e.$set(l)},i(t){n||(y(e.$$.fragment,t),n=!0)},o(t){S(e.$$.fragment,t),n=!1},d(t){O(e,t)}}}function De(s){let e;return{c(){e=h("Show on map")},m(n,t){b(n,e,t)},d(n){n&&w(e)}}}function He(s){let e;return{c(){e=h("Edit scheme")},m(n,t){b(n,e,t)},d(n){n&&w(e)}}}function Pe(s){let e,n,t=s[17].authority_or_region+"",r,l,p,f,m=s[17].capital_scheme_id+"",o,g,T,H,j=s[17].funding_programme+"",A,k,z,F,q,I,a,i;function M(){return s[12](s[17])}F=new X({props:{$$slots:{default:[De]},$$scope:{ctx:s}}}),F.$on("click",M);function G(){return s[13](s[17])}return I=new X({props:{$$slots:{default:[He]},$$scope:{ctx:s}}}),I.$on("click",G),{c(){e=J("p"),n=h("Authority or region: "),r=h(t),l=C(),p=J("p"),f=h("Capital scheme ID: "),o=h(m),g=C(),T=J("p"),H=h("Funding programme: "),A=h(j),k=C(),z=J("div"),N(F.$$.fragment),q=C(),N(I.$$.fragment),a=C(),R(z,"class","govuk-button-group")},m(_,v){b(_,e,v),c(e,n),c(e,r),b(_,l,v),b(_,p,v),c(p,f),c(p,o),b(_,g,v),b(_,T,v),c(T,H),c(T,A),b(_,k,v),b(_,z,v),L(F,z,null),c(z,q),L(I,z,null),b(_,a,v),i=!0},p(_,v){s=_,(!i||v&1)&&t!==(t=s[17].authority_or_region+"")&&D(r,t),(!i||v&1)&&m!==(m=s[17].capital_scheme_id+"")&&D(o,m),(!i||v&1)&&j!==(j=s[17].funding_programme+"")&&D(A,j);const P={};v&1048576&&(P.$$scope={dirty:v,ctx:s}),F.$set(P);const U={};v&1048576&&(U.$$scope={dirty:v,ctx:s}),I.$set(U)},i(_){i||(y(F.$$.fragment,_),y(I.$$.fragment,_),i=!0)},o(_){S(F.$$.fragment,_),S(I.$$.fragment,_),i=!1},d(_){_&&(w(e),w(l),w(p),w(g),w(T),w(k),w(z),w(a)),O(F),O(I)}}}function me(s){let e=s[2].has(s[17].scheme_reference),n,t,r=e&&ce(s);return{c(){r&&r.c(),n=Ce()},m(l,p){r&&r.m(l,p),b(l,n,p),t=!0},p(l,p){p&5&&(e=l[2].has(l[17].scheme_reference)),e?r?(r.p(l,p),p&5&&y(r,1)):(r=ce(l),r.c(),y(r,1),r.m(n.parentNode,n)):r&&(_e(),S(r,1,1,()=>{r=null}),$e())},i(l){t||(y(r),t=!0)},o(l){S(r),t=!1},d(l){l&&w(n),r&&r.d(l)}}}function Ze(s){let e,n,t,r,l,p,f,m,o,g,T,H,j,A,k,z,F=s[2].size+"",q,I,a=s[3].route+"",i,M,G=s[3].area+"",_,v,P=s[3].crossing+"",U,x,Q=s[3].other+"",Y,ee,te,V,E;n=new X({props:{$$slots:{default:[Ae]},$$scope:{ctx:s}}}),n.$on("click",s[9]),f=new Le({props:{boundaryGeojson:s[4]}}),o=new ke({props:{label:"Load from GeoJSON",loadFile:s[6]}}),j=new Fe({props:{label:"Filter by any field",id:"filterText",$$slots:{default:[qe]},$$scope:{ctx:s}}});let Z=le(s[0]),$=[];for(let u=0;uS($[u],1,1,()=>{$[u]=null});return{c(){e=J("div"),N(n.$$.fragment),t=C(),r=J("div"),l=J("h1"),l.textContent="Browse schemes",p=C(),N(f.$$.fragment),m=C(),N(o.$$.fragment),g=C(),T=J("br"),H=C(),N(j.$$.fragment),A=C(),k=J("p"),z=h("Showing "),q=h(F),I=h(" schemes ("),i=h(a),M=h(" routes, "),_=h(G),v=h(` areas, - `),U=h(P),x=h(" crossings, "),Y=h(Q),ee=h(" other)"),te=C(),V=J("ul");for(let u=0;u<$.length;u+=1)$[u].c();ae(r,"display","flex"),ae(r,"justify-content","space-between"),R(e,"slot","sidebar"),R(e,"class","govuk-prose")},m(u,d){b(u,e,d),L(n,e,null),c(e,t),c(e,r),c(r,l),c(r,p),L(f,r,null),c(e,m),L(o,e,null),c(e,g),c(e,T),c(e,H),L(j,e,null),c(e,A),c(e,k),c(k,z),c(k,q),c(k,I),c(k,i),c(k,M),c(k,_),c(k,v),c(k,U),c(k,x),c(k,Y),c(k,ee),c(e,te),c(e,V);for(let K=0;K<$.length;K+=1)$[K]&&$[K].m(V,null);E=!0},p(u,d){const K={};d&1048576&&(K.$$scope={dirty:d,ctx:u}),n.$set(K);const ne={};d&16&&(ne.boundaryGeojson=u[4]),f.$set(ne);const re={};if(d&1048578&&(re.$$scope={dirty:d,ctx:u}),j.$set(re),(!E||d&4)&&F!==(F=u[2].size+"")&&D(q,F),(!E||d&8)&&a!==(a=u[3].route+"")&&D(i,a),(!E||d&8)&&G!==(G=u[3].area+"")&&D(_,G),(!E||d&8)&&P!==(P=u[3].crossing+"")&&D(U,P),(!E||d&8)&&Q!==(Q=u[3].other+"")&&D(Y,Q),d&389){Z=le(u[0]);let B;for(B=0;B${n}${t}`;return e+="",e}function Ve(s,e,n){let t,r;oe(s,W,a=>n(4,t=a)),oe(s,Te,a=>n(14,r=a)),we(()=>{Be()});let p=new URLSearchParams(window.location.search).get("style")||"streets",f=[],m="",o=new Set,g={area:0,route:0,crossing:0,other:0};ye(()=>{W.set(null)});function T(a){try{let i=JSON.parse(a);W.set(i),H(i),r==null||r.fitBounds(fe(i),{padding:20,animate:!1})}catch(i){window.alert(`Couldn't load schemes from a file: ${i}`)}}function H(a){let i={};for(let[M,G]of Object.entries(a.schemes))i[M]={scheme_reference:M,num_features:0,...G};for(let M of a.features)i[M.properties.scheme_reference].num_features++;n(0,f=Object.values(i))}function j(a){let i={type:"FeatureCollection",features:t.features.filter(M=>M.properties.scheme_reference==a.scheme_reference)};r==null||r.fitBounds(fe(i),{padding:20,animate:!1})}function A(a){let i={type:"FeatureCollection",features:t.features.filter(G=>G.properties.scheme_reference==a.scheme_reference)},M=a.authority_or_region;window.localStorage.setItem(M,JSON.stringify(i)),window.open(`scheme.html?authority=${a.authority_or_region}`,"_blank")}const k=()=>window.open("index.html");function z(){m=this.value,n(1,m)}const F=()=>n(1,m=""),q=a=>j(a),I=a=>A(a);return s.$$.update=()=>{if(s.$$.dirty&31){if(o.clear(),m){let a=m.toLowerCase();for(let i of t.features)JSON.stringify(i.properties).toLowerCase().includes(a)&&o.add(i.properties.scheme_reference)}else for(let a of f)o.add(a.scheme_reference);W.update(a=>{if(!a)return null;for(let i of a.features)o.has(i.properties.scheme_reference)?delete i.properties.hide_while_editing:i.properties.hide_while_editing=!0;return a}),n(3,g={area:0,route:0,crossing:0,other:0});for(let a of t==null?void 0:t.features)o.has(a.properties.scheme_reference)&&n(3,g[a.properties.intervention_type]++,g);n(2,o),n(1,m),n(4,t),n(0,f),n(3,g)}},[f,m,o,g,t,p,T,j,A,k,z,F,q,I]}class We extends he{constructor(e){super(),ge(this,e,Ve,Ue,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/assets/nested2-f397cde2.js b/govuk_step2/assets/nested2-f397cde2.js new file mode 100644 index 000000000..6f72d1502 --- /dev/null +++ b/govuk_step2/assets/nested2-f397cde2.js @@ -0,0 +1,2 @@ +import{S as he,i as ge,s as be,H as F,I as L,t as y,j as S,K as O,Q as oe,L as we,a0 as ye,C as X,G as ke,F as ve,o as le,e as T,q as C,p as h,aj as ae,r as Q,d as b,v as c,w as D,ak as $e,al as _e,k as w,y as Se,N as fe,A as ue,l as Ce,$ as je,x as Ne}from"./maplibre_helpers-5d84afaa.js";import{i as Be}from"./all-4fc69598.js";import{L as Fe,g as W,Z as Le,j as Oe,I as Ie,B as ze,k as Me,M as Te,m as Ge,C as Je}from"./ZoomOutMap-3b70466a.js";function ie(s,e,n){const t=s.slice();return t[17]=e[n],t}function Ae(s){let e;return{c(){e=h("Home")},m(n,t){b(n,e,t)},d(n){n&&w(e)}}}function Ee(s){let e;return{c(){e=h("Clear")},m(n,t){b(n,e,t)},d(n){n&&w(e)}}}function qe(s){let e,n,t,r,l,p;return t=new X({props:{$$slots:{default:[Ee]},$$scope:{ctx:s}}}),t.$on("click",s[11]),{c(){e=T("input"),n=C(),F(t.$$.fragment),Q(e,"type","text"),Q(e,"class","govuk-input govuk-input--width-10"),Q(e,"id","filterText")},m(f,m){b(f,e,m),ue(e,s[1]),b(f,n,m),L(t,f,m),r=!0,l||(p=Ce(e,"input",s[10]),l=!0)},p(f,m){m&2&&e.value!==f[1]&&ue(e,f[1]);const o={};m&1048576&&(o.$$scope={dirty:m,ctx:f}),t.$set(o)},i(f){r||(y(t.$$.fragment,f),r=!0)},o(f){S(t.$$.fragment,f),r=!1},d(f){f&&(w(e),w(n)),O(t,f),l=!1,p()}}}function ce(s){let e,n;return e=new Je({props:{label:`${s[17].scheme_reference}: ${s[17].num_features} features`,$$slots:{default:[Ze]},$$scope:{ctx:s}}}),{c(){F(e.$$.fragment)},m(t,r){L(e,t,r),n=!0},p(t,r){const l={};r&1&&(l.label=`${t[17].scheme_reference}: ${t[17].num_features} features`),r&1048577&&(l.$$scope={dirty:r,ctx:t}),e.$set(l)},i(t){n||(y(e.$$.fragment,t),n=!0)},o(t){S(e.$$.fragment,t),n=!1},d(t){O(e,t)}}}function De(s){let e;return{c(){e=h("Show on map")},m(n,t){b(n,e,t)},d(n){n&&w(e)}}}function He(s){let e;return{c(){e=h("Edit scheme")},m(n,t){b(n,e,t)},d(n){n&&w(e)}}}function Ze(s){let e,n,t=s[17].authority_or_region+"",r,l,p,f,m=s[17].capital_scheme_id+"",o,g,G,H,j=s[17].funding_programme+"",A,k,M,N,q,I,a,i;function z(){return s[12](s[17])}N=new X({props:{$$slots:{default:[De]},$$scope:{ctx:s}}}),N.$on("click",z);function J(){return s[13](s[17])}return I=new X({props:{$$slots:{default:[He]},$$scope:{ctx:s}}}),I.$on("click",J),{c(){e=T("p"),n=h("Authority or region: "),r=h(t),l=C(),p=T("p"),f=h("Capital scheme ID: "),o=h(m),g=C(),G=T("p"),H=h("Funding programme: "),A=h(j),k=C(),M=T("div"),F(N.$$.fragment),q=C(),F(I.$$.fragment),a=C(),Q(M,"class","govuk-button-group")},m($,v){b($,e,v),c(e,n),c(e,r),b($,l,v),b($,p,v),c(p,f),c(p,o),b($,g,v),b($,G,v),c(G,H),c(G,A),b($,k,v),b($,M,v),L(N,M,null),c(M,q),L(I,M,null),b($,a,v),i=!0},p($,v){s=$,(!i||v&1)&&t!==(t=s[17].authority_or_region+"")&&D(r,t),(!i||v&1)&&m!==(m=s[17].capital_scheme_id+"")&&D(o,m),(!i||v&1)&&j!==(j=s[17].funding_programme+"")&&D(A,j);const Z={};v&1048576&&(Z.$$scope={dirty:v,ctx:s}),N.$set(Z);const R={};v&1048576&&(R.$$scope={dirty:v,ctx:s}),I.$set(R)},i($){i||(y(N.$$.fragment,$),y(I.$$.fragment,$),i=!0)},o($){S(N.$$.fragment,$),S(I.$$.fragment,$),i=!1},d($){$&&(w(e),w(l),w(p),w(g),w(G),w(k),w(M),w(a)),O(N),O(I)}}}function me(s){let e=s[2].has(s[17].scheme_reference),n,t,r=e&&ce(s);return{c(){r&&r.c(),n=je()},m(l,p){r&&r.m(l,p),b(l,n,p),t=!0},p(l,p){p&5&&(e=l[2].has(l[17].scheme_reference)),e?r?(r.p(l,p),p&5&&y(r,1)):(r=ce(l),r.c(),y(r,1),r.m(n.parentNode,n)):r&&($e(),S(r,1,1,()=>{r=null}),_e())},i(l){t||(y(r),t=!0)},o(l){S(r),t=!1},d(l){l&&w(n),r&&r.d(l)}}}function Ke(s){let e,n,t,r,l,p,f,m,o,g,G,H,j,A,k,M,N=s[2].size+"",q,I,a=s[3].route+"",i,z,J=s[3].area+"",$,v,Z=s[3].crossing+"",R,x,U=s[3].other+"",Y,ee,te,V,E;n=new X({props:{$$slots:{default:[Ae]},$$scope:{ctx:s}}}),n.$on("click",s[9]),f=new Le({props:{boundaryGeojson:s[4]}}),o=new ke({props:{label:"Load from GeoJSON",id:"load-geojson",loadFile:s[6]}}),j=new ve({props:{label:"Filter by any field",id:"filterText",$$slots:{default:[qe]},$$scope:{ctx:s}}});let K=le(s[0]),_=[];for(let u=0;uS(_[u],1,1,()=>{_[u]=null});return{c(){e=T("div"),F(n.$$.fragment),t=C(),r=T("div"),l=T("h1"),l.textContent="Browse schemes",p=C(),F(f.$$.fragment),m=C(),F(o.$$.fragment),g=C(),G=T("br"),H=C(),F(j.$$.fragment),A=C(),k=T("p"),M=h("Showing "),q=h(N),I=h(" schemes ("),i=h(a),z=h(" routes, "),$=h(J),v=h(` areas, + `),R=h(Z),x=h(" crossings, "),Y=h(U),ee=h(" other)"),te=C(),V=T("ul");for(let u=0;u<_.length;u+=1)_[u].c();ae(r,"display","flex"),ae(r,"justify-content","space-between"),Q(e,"slot","sidebar"),Q(e,"class","govuk-prose")},m(u,d){b(u,e,d),L(n,e,null),c(e,t),c(e,r),c(r,l),c(r,p),L(f,r,null),c(e,m),L(o,e,null),c(e,g),c(e,G),c(e,H),L(j,e,null),c(e,A),c(e,k),c(k,M),c(k,q),c(k,I),c(k,i),c(k,z),c(k,$),c(k,v),c(k,R),c(k,x),c(k,Y),c(k,ee),c(e,te),c(e,V);for(let P=0;P<_.length;P+=1)_[P]&&_[P].m(V,null);E=!0},p(u,d){const P={};d&1048576&&(P.$$scope={dirty:d,ctx:u}),n.$set(P);const ne={};d&16&&(ne.boundaryGeojson=u[4]),f.$set(ne);const re={};if(d&1048578&&(re.$$scope={dirty:d,ctx:u}),j.$set(re),(!E||d&4)&&N!==(N=u[2].size+"")&&D(q,N),(!E||d&8)&&a!==(a=u[3].route+"")&&D(i,a),(!E||d&8)&&J!==(J=u[3].area+"")&&D($,J),(!E||d&8)&&Z!==(Z=u[3].crossing+"")&&D(R,Z),(!E||d&8)&&U!==(U=u[3].other+"")&&D(Y,U),d&389){K=le(u[0]);let B;for(B=0;B${n}${t}`;return e+="",e}function Ve(s,e,n){let t,r;oe(s,W,a=>n(4,t=a)),oe(s,Ge,a=>n(14,r=a)),we(()=>{Be()});let p=new URLSearchParams(window.location.search).get("style")||"streets",f=[],m="",o=new Set,g={area:0,route:0,crossing:0,other:0};ye(()=>{W.set(null)});function G(a){try{let i=JSON.parse(a);W.set(i),H(i),r==null||r.fitBounds(fe(i),{padding:20,animate:!1})}catch(i){window.alert(`Couldn't load schemes from a file: ${i}`)}}function H(a){let i={};for(let[z,J]of Object.entries(a.schemes))i[z]={scheme_reference:z,num_features:0,...J};for(let z of a.features)i[z.properties.scheme_reference].num_features++;n(0,f=Object.values(i))}function j(a){let i={type:"FeatureCollection",features:t.features.filter(z=>z.properties.scheme_reference==a.scheme_reference)};r==null||r.fitBounds(fe(i),{padding:20,animate:!1})}function A(a){let i={type:"FeatureCollection",features:t.features.filter(J=>J.properties.scheme_reference==a.scheme_reference)},z=a.authority_or_region;window.localStorage.setItem(z,JSON.stringify(i)),window.open(`scheme.html?authority=${a.authority_or_region}`,"_blank")}const k=()=>window.open("index.html");function M(){m=this.value,n(1,m)}const N=()=>n(1,m=""),q=a=>j(a),I=a=>A(a);return s.$$.update=()=>{if(s.$$.dirty&31){if(o.clear(),m){let a=m.toLowerCase();for(let i of t.features)JSON.stringify(i.properties).toLowerCase().includes(a)&&o.add(i.properties.scheme_reference)}else for(let a of f)o.add(a.scheme_reference);W.update(a=>{if(!a)return null;for(let i of a.features)o.has(i.properties.scheme_reference)?delete i.properties.hide_while_editing:i.properties.hide_while_editing=!0;return a}),n(3,g={area:0,route:0,crossing:0,other:0});for(let a of t==null?void 0:t.features)o.has(a.properties.scheme_reference)&&n(3,g[a.properties.intervention_type]++,g);n(2,o),n(1,m),n(4,t),n(0,f),n(3,g)}},[f,m,o,g,t,p,G,j,A,k,M,N,q,I]}class We extends he{constructor(e){super(),ge(this,e,Ve,Re,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 b97f23cac..544603d35 100644 --- a/govuk_step2/browse.html +++ b/govuk_step2/browse.html @@ -7,12 +7,12 @@ 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 fc8cec121..e6ec70fd1 100644 --- a/govuk_step2/index.html +++ b/govuk_step2/index.html @@ -7,12 +7,12 @@ 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 606aab219..7bea12d90 100644 --- a/govuk_step2/scheme.html +++ b/govuk_step2/scheme.html @@ -7,10 +7,10 @@ content="initial-scale=1,maximum-scale=1,user-scalable=no" /> ATIP v2 Scheme Entry - - - - + + + +