diff --git a/_app/immutable/chunks/paths.02c4a57e.js b/_app/immutable/chunks/paths.02c4a57e.js deleted file mode 100644 index 3fa1b36..0000000 --- a/_app/immutable/chunks/paths.02c4a57e.js +++ /dev/null @@ -1 +0,0 @@ -var s;const l=((s=globalThis.__sveltekit_1tll96k)==null?void 0:s.base)??"/key-pop-explorer";var e;const t=((e=globalThis.__sveltekit_1tll96k)==null?void 0:e.assets)??l;export{t as a,l as b}; diff --git a/_app/immutable/chunks/paths.e0228478.js b/_app/immutable/chunks/paths.e0228478.js new file mode 100644 index 0000000..caa7412 --- /dev/null +++ b/_app/immutable/chunks/paths.e0228478.js @@ -0,0 +1 @@ +var s;const a=((s=globalThis.__sveltekit_13xzsn)==null?void 0:s.base)??"/key-pop-explorer";var e;const t=((e=globalThis.__sveltekit_13xzsn)==null?void 0:e.assets)??a;export{t as a,a as b}; diff --git a/_app/immutable/chunks/singletons.4b41f6d0.js b/_app/immutable/chunks/singletons.1baaed8b.js similarity index 95% rename from _app/immutable/chunks/singletons.4b41f6d0.js rename to _app/immutable/chunks/singletons.1baaed8b.js index 9b768f6..8aa798d 100644 --- a/_app/immutable/chunks/singletons.4b41f6d0.js +++ b/_app/immutable/chunks/singletons.1baaed8b.js @@ -1 +1 @@ -import{D as d,s as k}from"./scheduler.452d2f96.js";import{a as w}from"./paths.02c4a57e.js";const u=[];function p(e,t=d){let n;const o=new Set;function r(s){if(k(e,s)&&(e=s,n)){const c=!u.length;for(const i of o)i[1](),u.push(i,e);if(c){for(let i=0;i{o.delete(i),o.size===0&&n&&(n(),n=null)}}return{set:r,update:l,subscribe:a}}const E="1697807927928",y="sveltekit:snapshot",I="sveltekit:scroll",T="sveltekit:index",_={tap:1,hover:2,viewport:3,eager:4,off:-1};function x(e){let t=e.baseURI;if(!t){const n=e.getElementsByTagName("base");t=n.length?n[0].href:e.URL}return t}function O(){return{x:pageXOffset,y:pageYOffset}}function f(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const b={..._,"":_.hover};function g(e){let t=e.assignedSlot??e.parentNode;return(t==null?void 0:t.nodeType)===11&&(t=t.host),t}function U(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=g(e)}}function L(e,t){let n;try{n=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI)}catch{}const o=e instanceof SVGAElement?e.target.baseVal:e.target,r=!n||!!o||A(n,t)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),l=(n==null?void 0:n.origin)===location.origin&&e.hasAttribute("download");return{url:n,external:r,target:o,download:l}}function N(e){let t=null,n=null,o=null,r=null,l=null,a=null,s=e;for(;s&&s!==document.documentElement;)o===null&&(o=f(s,"preload-code")),r===null&&(r=f(s,"preload-data")),t===null&&(t=f(s,"keepfocus")),n===null&&(n=f(s,"noscroll")),l===null&&(l=f(s,"reload")),a===null&&(a=f(s,"replacestate")),s=g(s);function c(i){switch(i){case"":case"true":return!0;case"off":case"false":return!1;default:return null}}return{preload_code:b[o??"off"],preload_data:b[r??"off"],keep_focus:c(t),noscroll:c(n),reload:c(l),replace_state:c(a)}}function h(e){const t=p(e);let n=!0;function o(){n=!0,t.update(a=>a)}function r(a){n=!1,t.set(a)}function l(a){let s;return t.subscribe(c=>{(s===void 0||n&&c!==s)&&a(s=c)})}return{notify:o,set:r,subscribe:l}}function v(){const{set:e,subscribe:t}=p(!1);let n;async function o(){clearTimeout(n);try{const r=await fetch(`${w}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const a=(await r.json()).version!==E;return a&&(e(!0),clearTimeout(n)),a}catch{return!1}}return{subscribe:t,check:o}}function A(e,t){return e.origin!==location.origin||!e.pathname.startsWith(t)}let m;function P(e){m=e.client}function V(e){return(...t)=>m[e](...t)}const Y={url:h({}),page:h({}),navigating:p(null),updated:v()};export{T as I,_ as P,I as S,y as a,L as b,N as c,Y as d,P as e,U as f,x as g,V as h,A as i,O as s,p as w}; +import{D as d,s as k}from"./scheduler.452d2f96.js";import{a as w}from"./paths.e0228478.js";const u=[];function p(e,t=d){let n;const o=new Set;function r(s){if(k(e,s)&&(e=s,n)){const c=!u.length;for(const i of o)i[1](),u.push(i,e);if(c){for(let i=0;i{o.delete(i),o.size===0&&n&&(n(),n=null)}}return{set:r,update:l,subscribe:a}}const E="1697815070257",y="sveltekit:snapshot",I="sveltekit:scroll",T="sveltekit:index",_={tap:1,hover:2,viewport:3,eager:4,off:-1};function x(e){let t=e.baseURI;if(!t){const n=e.getElementsByTagName("base");t=n.length?n[0].href:e.URL}return t}function O(){return{x:pageXOffset,y:pageYOffset}}function f(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const b={..._,"":_.hover};function g(e){let t=e.assignedSlot??e.parentNode;return(t==null?void 0:t.nodeType)===11&&(t=t.host),t}function U(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=g(e)}}function L(e,t){let n;try{n=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI)}catch{}const o=e instanceof SVGAElement?e.target.baseVal:e.target,r=!n||!!o||A(n,t)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),l=(n==null?void 0:n.origin)===location.origin&&e.hasAttribute("download");return{url:n,external:r,target:o,download:l}}function N(e){let t=null,n=null,o=null,r=null,l=null,a=null,s=e;for(;s&&s!==document.documentElement;)o===null&&(o=f(s,"preload-code")),r===null&&(r=f(s,"preload-data")),t===null&&(t=f(s,"keepfocus")),n===null&&(n=f(s,"noscroll")),l===null&&(l=f(s,"reload")),a===null&&(a=f(s,"replacestate")),s=g(s);function c(i){switch(i){case"":case"true":return!0;case"off":case"false":return!1;default:return null}}return{preload_code:b[o??"off"],preload_data:b[r??"off"],keep_focus:c(t),noscroll:c(n),reload:c(l),replace_state:c(a)}}function h(e){const t=p(e);let n=!0;function o(){n=!0,t.update(a=>a)}function r(a){n=!1,t.set(a)}function l(a){let s;return t.subscribe(c=>{(s===void 0||n&&c!==s)&&a(s=c)})}return{notify:o,set:r,subscribe:l}}function v(){const{set:e,subscribe:t}=p(!1);let n;async function o(){clearTimeout(n);try{const r=await fetch(`${w}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const a=(await r.json()).version!==E;return a&&(e(!0),clearTimeout(n)),a}catch{return!1}}return{subscribe:t,check:o}}function A(e,t){return e.origin!==location.origin||!e.pathname.startsWith(t)}let m;function P(e){m=e.client}function V(e){return(...t)=>m[e](...t)}const Y={url:h({}),page:h({}),navigating:p(null),updated:v()};export{T as I,_ as P,I as S,y as a,L as b,N as c,Y as d,P as e,U as f,x as g,V as h,A as i,O as s,p as w}; diff --git a/_app/immutable/chunks/stores.8e32eefa.js b/_app/immutable/chunks/stores.afd013d2.js similarity index 73% rename from _app/immutable/chunks/stores.8e32eefa.js rename to _app/immutable/chunks/stores.afd013d2.js index f7a3545..23207a8 100644 --- a/_app/immutable/chunks/stores.8e32eefa.js +++ b/_app/immutable/chunks/stores.afd013d2.js @@ -1 +1 @@ -import{d as e}from"./singletons.4b41f6d0.js";const r=()=>{const s=e;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},b={subscribe(s){return r().page.subscribe(s)}};export{b as p}; +import{d as e}from"./singletons.1baaed8b.js";const r=()=>{const s=e;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},b={subscribe(s){return r().page.subscribe(s)}};export{b as p}; diff --git a/_app/immutable/entry/app.4a550444.js b/_app/immutable/entry/app.8935f55a.js similarity index 90% rename from _app/immutable/entry/app.4a550444.js rename to _app/immutable/entry/app.8935f55a.js index 4aebc1c..298e9d6 100644 --- a/_app/immutable/entry/app.4a550444.js +++ b/_app/immutable/entry/app.8935f55a.js @@ -1 +1 @@ -import{s as A,a as B,e as h,c as U,i as w,d,b as j,o as W,f as z,g as F,h as G,j as L,k as m,l as H,m as J,n as K,t as M,p as N,q as k}from"../chunks/scheduler.452d2f96.js";import{S as Q,i as X,t as p,c as R,a as g,g as P,b as v,d as C,m as E,e as y}from"../chunks/index.bed91369.js";const Y="modulepreload",Z=function(o){return"/key-pop-explorer/"+o},D={},S=function(e,n,s){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(f=>{if(f=Z(f),f in D)return;D[f]=!0;const t=f.endsWith(".css"),r=t?'[rel="stylesheet"]':"";if(!!s)for(let a=i.length-1;a>=0;a--){const _=i[a];if(_.href===f&&(!t||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${r}`))return;const c=document.createElement("link");if(c.rel=t?"stylesheet":Y,t||(c.as="script",c.crossOrigin=""),c.href=f,document.head.appendChild(c),t)return new Promise((a,_)=>{c.addEventListener("load",a),c.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${f}`)))})})).then(()=>e()).catch(f=>{const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=f,window.dispatchEvent(t),!t.defaultPrevented)throw f})},re={};function $(o){let e,n,s;var i=o[1][0];function f(t,r){return{props:{data:t[3],form:t[2]}}}return i&&(e=k(i,f(o)),o[12](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&C(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),w(t,n,r),s=!0},p(t,r){if(r&2&&i!==(i=t[1][0])){if(e){P();const l=e;p(l.$$.fragment,1,0,()=>{y(l,1)}),R()}i?(e=k(i,f(t)),t[12](e),v(e.$$.fragment),g(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(i){const l={};r&8&&(l.data=t[3]),r&4&&(l.form=t[2]),e.$set(l)}},i(t){s||(e&&g(e.$$.fragment,t),s=!0)},o(t){e&&p(e.$$.fragment,t),s=!1},d(t){t&&d(n),o[12](null),e&&y(e,t)}}}function x(o){let e,n,s;var i=o[1][0];function f(t,r){return{props:{data:t[3],$$slots:{default:[ee]},$$scope:{ctx:t}}}}return i&&(e=k(i,f(o)),o[11](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&C(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),w(t,n,r),s=!0},p(t,r){if(r&2&&i!==(i=t[1][0])){if(e){P();const l=e;p(l.$$.fragment,1,0,()=>{y(l,1)}),R()}i?(e=k(i,f(t)),t[11](e),v(e.$$.fragment),g(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(i){const l={};r&8&&(l.data=t[3]),r&8215&&(l.$$scope={dirty:r,ctx:t}),e.$set(l)}},i(t){s||(e&&g(e.$$.fragment,t),s=!0)},o(t){e&&p(e.$$.fragment,t),s=!1},d(t){t&&d(n),o[11](null),e&&y(e,t)}}}function ee(o){let e,n,s;var i=o[1][1];function f(t,r){return{props:{data:t[4],form:t[2]}}}return i&&(e=k(i,f(o)),o[10](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&C(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),w(t,n,r),s=!0},p(t,r){if(r&2&&i!==(i=t[1][1])){if(e){P();const l=e;p(l.$$.fragment,1,0,()=>{y(l,1)}),R()}i?(e=k(i,f(t)),t[10](e),v(e.$$.fragment),g(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(i){const l={};r&16&&(l.data=t[4]),r&4&&(l.form=t[2]),e.$set(l)}},i(t){s||(e&&g(e.$$.fragment,t),s=!0)},o(t){e&&p(e.$$.fragment,t),s=!1},d(t){t&&d(n),o[10](null),e&&y(e,t)}}}function I(o){let e,n=o[6]&&O(o);return{c(){e=z("div"),n&&n.c(),this.h()},l(s){e=F(s,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=G(e);n&&n.l(i),i.forEach(d),this.h()},h(){L(e,"id","svelte-announcer"),L(e,"aria-live","assertive"),L(e,"aria-atomic","true"),m(e,"position","absolute"),m(e,"left","0"),m(e,"top","0"),m(e,"clip","rect(0 0 0 0)"),m(e,"clip-path","inset(50%)"),m(e,"overflow","hidden"),m(e,"white-space","nowrap"),m(e,"width","1px"),m(e,"height","1px")},m(s,i){w(s,e,i),n&&n.m(e,null)},p(s,i){s[6]?n?n.p(s,i):(n=O(s),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(s){s&&d(e),n&&n.d()}}}function O(o){let e;return{c(){e=H(o[7])},l(n){e=J(n,o[7])},m(n,s){w(n,e,s)},p(n,s){s&128&&K(e,n[7])},d(n){n&&d(e)}}}function te(o){let e,n,s,i,f;const t=[x,$],r=[];function l(a,_){return a[1][1]?0:1}e=l(o),n=r[e]=t[e](o);let c=o[5]&&I(o);return{c(){n.c(),s=B(),c&&c.c(),i=h()},l(a){n.l(a),s=U(a),c&&c.l(a),i=h()},m(a,_){r[e].m(a,_),w(a,s,_),c&&c.m(a,_),w(a,i,_),f=!0},p(a,[_]){let b=e;e=l(a),e===b?r[e].p(a,_):(P(),p(r[b],1,1,()=>{r[b]=null}),R(),n=r[e],n?n.p(a,_):(n=r[e]=t[e](a),n.c()),g(n,1),n.m(s.parentNode,s)),a[5]?c?c.p(a,_):(c=I(a),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null)},i(a){f||(g(n),f=!0)},o(a){p(n),f=!1},d(a){a&&(d(s),d(i)),r[e].d(a),c&&c.d(a)}}}function ne(o,e,n){let{stores:s}=e,{page:i}=e,{constructors:f}=e,{components:t=[]}=e,{form:r}=e,{data_0:l=null}=e,{data_1:c=null}=e;j(s.page.notify);let a=!1,_=!1,b=null;W(()=>{const u=s.page.subscribe(()=>{a&&(n(6,_=!0),M().then(()=>{n(7,b=document.title||"untitled page")}))});return n(5,a=!0),u});function T(u){N[u?"unshift":"push"](()=>{t[1]=u,n(0,t)})}function V(u){N[u?"unshift":"push"](()=>{t[0]=u,n(0,t)})}function q(u){N[u?"unshift":"push"](()=>{t[0]=u,n(0,t)})}return o.$$set=u=>{"stores"in u&&n(8,s=u.stores),"page"in u&&n(9,i=u.page),"constructors"in u&&n(1,f=u.constructors),"components"in u&&n(0,t=u.components),"form"in u&&n(2,r=u.form),"data_0"in u&&n(3,l=u.data_0),"data_1"in u&&n(4,c=u.data_1)},o.$$.update=()=>{o.$$.dirty&768&&s.page.set(i)},[t,f,r,l,c,a,_,b,s,i,T,V,q]}class oe extends Q{constructor(e){super(),X(this,e,ne,te,A,{stores:8,page:9,constructors:1,components:0,form:2,data_0:3,data_1:4})}}const ae=[()=>S(()=>import("../nodes/0.1771432f.js"),["_app/immutable/nodes/0.1771432f.js","_app/immutable/chunks/scheduler.452d2f96.js","_app/immutable/chunks/index.bed91369.js","_app/immutable/chunks/paths.02c4a57e.js","_app/immutable/chunks/Table.svelte_svelte_type_style_lang.9e187c59.js","_app/immutable/assets/Table.14877c48.css","_app/immutable/assets/0.f278b18f.css"]),()=>S(()=>import("../nodes/1.cfe987c8.js"),["_app/immutable/nodes/1.cfe987c8.js","_app/immutable/chunks/scheduler.452d2f96.js","_app/immutable/chunks/index.bed91369.js","_app/immutable/chunks/stores.8e32eefa.js","_app/immutable/chunks/singletons.4b41f6d0.js","_app/immutable/chunks/paths.02c4a57e.js"]),()=>S(()=>import("../nodes/2.c7403abf.js"),["_app/immutable/nodes/2.c7403abf.js","_app/immutable/chunks/Table.svelte_svelte_type_style_lang.9e187c59.js","_app/immutable/chunks/scheduler.452d2f96.js","_app/immutable/chunks/index.bed91369.js","_app/immutable/assets/Table.14877c48.css","_app/immutable/chunks/paths.02c4a57e.js","_app/immutable/chunks/stores.8e32eefa.js","_app/immutable/chunks/singletons.4b41f6d0.js","_app/immutable/assets/2.4c446ff0.css"])],le=[],fe={"/":[2]},ce={handleError:({error:o})=>{console.error(o)}};export{fe as dictionary,ce as hooks,re as matchers,ae as nodes,oe as root,le as server_loads}; +import{s as A,a as B,e as h,c as U,i as w,d,b as j,o as W,f as z,g as F,h as G,j as L,k as m,l as H,m as J,n as K,t as M,p as N,q as k}from"../chunks/scheduler.452d2f96.js";import{S as Q,i as X,t as p,c as R,a as g,g as P,b as v,d as C,m as E,e as y}from"../chunks/index.bed91369.js";const Y="modulepreload",Z=function(o){return"/key-pop-explorer/"+o},D={},S=function(e,n,s){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(f=>{if(f=Z(f),f in D)return;D[f]=!0;const t=f.endsWith(".css"),r=t?'[rel="stylesheet"]':"";if(!!s)for(let a=i.length-1;a>=0;a--){const _=i[a];if(_.href===f&&(!t||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${r}`))return;const c=document.createElement("link");if(c.rel=t?"stylesheet":Y,t||(c.as="script",c.crossOrigin=""),c.href=f,document.head.appendChild(c),t)return new Promise((a,_)=>{c.addEventListener("load",a),c.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${f}`)))})})).then(()=>e()).catch(f=>{const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=f,window.dispatchEvent(t),!t.defaultPrevented)throw f})},re={};function $(o){let e,n,s;var i=o[1][0];function f(t,r){return{props:{data:t[3],form:t[2]}}}return i&&(e=k(i,f(o)),o[12](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&C(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),w(t,n,r),s=!0},p(t,r){if(r&2&&i!==(i=t[1][0])){if(e){P();const l=e;p(l.$$.fragment,1,0,()=>{y(l,1)}),R()}i?(e=k(i,f(t)),t[12](e),v(e.$$.fragment),g(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(i){const l={};r&8&&(l.data=t[3]),r&4&&(l.form=t[2]),e.$set(l)}},i(t){s||(e&&g(e.$$.fragment,t),s=!0)},o(t){e&&p(e.$$.fragment,t),s=!1},d(t){t&&d(n),o[12](null),e&&y(e,t)}}}function x(o){let e,n,s;var i=o[1][0];function f(t,r){return{props:{data:t[3],$$slots:{default:[ee]},$$scope:{ctx:t}}}}return i&&(e=k(i,f(o)),o[11](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&C(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),w(t,n,r),s=!0},p(t,r){if(r&2&&i!==(i=t[1][0])){if(e){P();const l=e;p(l.$$.fragment,1,0,()=>{y(l,1)}),R()}i?(e=k(i,f(t)),t[11](e),v(e.$$.fragment),g(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(i){const l={};r&8&&(l.data=t[3]),r&8215&&(l.$$scope={dirty:r,ctx:t}),e.$set(l)}},i(t){s||(e&&g(e.$$.fragment,t),s=!0)},o(t){e&&p(e.$$.fragment,t),s=!1},d(t){t&&d(n),o[11](null),e&&y(e,t)}}}function ee(o){let e,n,s;var i=o[1][1];function f(t,r){return{props:{data:t[4],form:t[2]}}}return i&&(e=k(i,f(o)),o[10](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&C(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),w(t,n,r),s=!0},p(t,r){if(r&2&&i!==(i=t[1][1])){if(e){P();const l=e;p(l.$$.fragment,1,0,()=>{y(l,1)}),R()}i?(e=k(i,f(t)),t[10](e),v(e.$$.fragment),g(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else if(i){const l={};r&16&&(l.data=t[4]),r&4&&(l.form=t[2]),e.$set(l)}},i(t){s||(e&&g(e.$$.fragment,t),s=!0)},o(t){e&&p(e.$$.fragment,t),s=!1},d(t){t&&d(n),o[10](null),e&&y(e,t)}}}function I(o){let e,n=o[6]&&O(o);return{c(){e=z("div"),n&&n.c(),this.h()},l(s){e=F(s,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=G(e);n&&n.l(i),i.forEach(d),this.h()},h(){L(e,"id","svelte-announcer"),L(e,"aria-live","assertive"),L(e,"aria-atomic","true"),m(e,"position","absolute"),m(e,"left","0"),m(e,"top","0"),m(e,"clip","rect(0 0 0 0)"),m(e,"clip-path","inset(50%)"),m(e,"overflow","hidden"),m(e,"white-space","nowrap"),m(e,"width","1px"),m(e,"height","1px")},m(s,i){w(s,e,i),n&&n.m(e,null)},p(s,i){s[6]?n?n.p(s,i):(n=O(s),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(s){s&&d(e),n&&n.d()}}}function O(o){let e;return{c(){e=H(o[7])},l(n){e=J(n,o[7])},m(n,s){w(n,e,s)},p(n,s){s&128&&K(e,n[7])},d(n){n&&d(e)}}}function te(o){let e,n,s,i,f;const t=[x,$],r=[];function l(a,_){return a[1][1]?0:1}e=l(o),n=r[e]=t[e](o);let c=o[5]&&I(o);return{c(){n.c(),s=B(),c&&c.c(),i=h()},l(a){n.l(a),s=U(a),c&&c.l(a),i=h()},m(a,_){r[e].m(a,_),w(a,s,_),c&&c.m(a,_),w(a,i,_),f=!0},p(a,[_]){let b=e;e=l(a),e===b?r[e].p(a,_):(P(),p(r[b],1,1,()=>{r[b]=null}),R(),n=r[e],n?n.p(a,_):(n=r[e]=t[e](a),n.c()),g(n,1),n.m(s.parentNode,s)),a[5]?c?c.p(a,_):(c=I(a),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null)},i(a){f||(g(n),f=!0)},o(a){p(n),f=!1},d(a){a&&(d(s),d(i)),r[e].d(a),c&&c.d(a)}}}function ne(o,e,n){let{stores:s}=e,{page:i}=e,{constructors:f}=e,{components:t=[]}=e,{form:r}=e,{data_0:l=null}=e,{data_1:c=null}=e;j(s.page.notify);let a=!1,_=!1,b=null;W(()=>{const u=s.page.subscribe(()=>{a&&(n(6,_=!0),M().then(()=>{n(7,b=document.title||"untitled page")}))});return n(5,a=!0),u});function T(u){N[u?"unshift":"push"](()=>{t[1]=u,n(0,t)})}function V(u){N[u?"unshift":"push"](()=>{t[0]=u,n(0,t)})}function q(u){N[u?"unshift":"push"](()=>{t[0]=u,n(0,t)})}return o.$$set=u=>{"stores"in u&&n(8,s=u.stores),"page"in u&&n(9,i=u.page),"constructors"in u&&n(1,f=u.constructors),"components"in u&&n(0,t=u.components),"form"in u&&n(2,r=u.form),"data_0"in u&&n(3,l=u.data_0),"data_1"in u&&n(4,c=u.data_1)},o.$$.update=()=>{o.$$.dirty&768&&s.page.set(i)},[t,f,r,l,c,a,_,b,s,i,T,V,q]}class oe extends Q{constructor(e){super(),X(this,e,ne,te,A,{stores:8,page:9,constructors:1,components:0,form:2,data_0:3,data_1:4})}}const ae=[()=>S(()=>import("../nodes/0.af781a5e.js"),["_app/immutable/nodes/0.af781a5e.js","_app/immutable/chunks/scheduler.452d2f96.js","_app/immutable/chunks/index.bed91369.js","_app/immutable/chunks/paths.e0228478.js","_app/immutable/chunks/Table.svelte_svelte_type_style_lang.9e187c59.js","_app/immutable/assets/Table.14877c48.css","_app/immutable/assets/0.f278b18f.css"]),()=>S(()=>import("../nodes/1.80efe519.js"),["_app/immutable/nodes/1.80efe519.js","_app/immutable/chunks/scheduler.452d2f96.js","_app/immutable/chunks/index.bed91369.js","_app/immutable/chunks/stores.afd013d2.js","_app/immutable/chunks/singletons.1baaed8b.js","_app/immutable/chunks/paths.e0228478.js"]),()=>S(()=>import("../nodes/2.53dd7cc4.js"),["_app/immutable/nodes/2.53dd7cc4.js","_app/immutable/chunks/Table.svelte_svelte_type_style_lang.9e187c59.js","_app/immutable/chunks/scheduler.452d2f96.js","_app/immutable/chunks/index.bed91369.js","_app/immutable/assets/Table.14877c48.css","_app/immutable/chunks/paths.e0228478.js","_app/immutable/chunks/stores.afd013d2.js","_app/immutable/chunks/singletons.1baaed8b.js","_app/immutable/assets/2.4c446ff0.css"])],le=[],fe={"/":[2]},ce={handleError:({error:o})=>{console.error(o)}};export{fe as dictionary,ce as hooks,re as matchers,ae as nodes,oe as root,le as server_loads}; diff --git a/_app/immutable/entry/start.b8dbf6d4.js b/_app/immutable/entry/start.8fdc84cf.js similarity index 99% rename from _app/immutable/entry/start.b8dbf6d4.js rename to _app/immutable/entry/start.8fdc84cf.js index fe584ea..4f9c576 100644 --- a/_app/immutable/entry/start.b8dbf6d4.js +++ b/_app/immutable/entry/start.8fdc84cf.js @@ -1,3 +1,3 @@ -import{o as _e,t as we}from"../chunks/scheduler.452d2f96.js";import{S as Ge,a as Je,I as M,g as Ce,f as Me,b as ye,c as le,s as te,i as ve,d as F,P as Ve,e as Xe}from"../chunks/singletons.4b41f6d0.js";import{b as J}from"../chunks/paths.02c4a57e.js";function Ze(t,r){return t==="/"||r==="ignore"?t:r==="never"?t.endsWith("/")?t.slice(0,-1):t:r==="always"&&!t.endsWith("/")?t+"/":t}function Qe(t){return t.split("%25").map(decodeURI).join("%25")}function et(t){for(const r in t)t[r]=decodeURIComponent(t[r]);return t}const tt=["href","pathname","search","searchParams","toString","toJSON"];function nt(t,r){const f=new URL(t);for(const s of tt)Object.defineProperty(f,s,{get(){return r(),t[s]},enumerable:!0,configurable:!0});return at(f),f}function at(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const rt="/__data.json";function ot(t){return t.replace(/\/$/,"")+rt}function it(...t){let r=5381;for(const f of t)if(typeof f=="string"){let s=f.length;for(;s;)r=r*33^f.charCodeAt(--s)}else if(ArrayBuffer.isView(f)){const s=new Uint8Array(f.buffer,f.byteOffset,f.byteLength);let d=s.length;for(;d;)r=r*33^s[--d]}else throw new TypeError("value must be a string or TypedArray");return(r>>>0).toString(36)}const fe=window.fetch;window.fetch=(t,r)=>((t instanceof Request?t.method:(r==null?void 0:r.method)||"GET")!=="GET"&&ae.delete(ke(t)),fe(t,r));const ae=new Map;function st(t,r){const f=ke(t,r),s=document.querySelector(f);if(s!=null&&s.textContent){const{body:d,...u}=JSON.parse(s.textContent),E=s.getAttribute("data-ttl");return E&&ae.set(f,{body:d,init:u,ttl:1e3*Number(E)}),Promise.resolve(new Response(d,u))}return fe(t,r)}function ct(t,r,f){if(ae.size>0){const s=ke(t,f),d=ae.get(s);if(d){if(performance.now(){const d=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(s);if(d)return r.push({name:d[1],matcher:d[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const u=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(s);if(u)return r.push({name:u[1],matcher:u[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!s)return;const E=s.split(/\[(.+?)\](?!\])/);return"/"+E.map((g,m)=>{if(m%2){if(g.startsWith("x+"))return be(String.fromCharCode(parseInt(g.slice(2),16)));if(g.startsWith("u+"))return be(String.fromCharCode(...g.slice(2).split("-").map(U=>parseInt(U,16))));const h=lt.exec(g);if(!h)throw new Error(`Invalid param: ${g}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,x,j,k,N]=h;return r.push({name:k,matcher:N,optional:!!x,rest:!!j,chained:j?m===1&&E[0]==="":!1}),j?"(.*?)":x?"([^/]*)?":"([^/]+?)"}return be(g)}).join("")}).join("")}/?$`),params:r}}function ut(t){return!/^\([^)]+\)$/.test(t)}function dt(t){return t.slice(1).split("/").filter(ut)}function pt(t,r,f){const s={},d=t.slice(1),u=d.filter(l=>l!==void 0);let E=0;for(let l=0;lh).join("/"),E=0),m===void 0){g.rest&&(s[g.name]="");continue}if(!g.matcher||f[g.matcher](m)){s[g.name]=m;const h=r[l+1],x=d[l+1];h&&!h.rest&&h.optional&&x&&g.chained&&(E=0),!h&&!x&&Object.keys(s).length===u.length&&(E=0);continue}if(g.optional&&g.chained){E++;continue}return}if(!E)return s}function be(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function ht({nodes:t,server_loads:r,dictionary:f,matchers:s}){const d=new Set(r);return Object.entries(f).map(([l,[g,m,h]])=>{const{pattern:x,params:j}=ft(l),k={id:l,exec:N=>{const U=x.exec(N);if(U)return pt(U,j,s)},errors:[1,...h||[]].map(N=>t[N]),layouts:[0,...m||[]].map(E),leaf:u(g)};return k.errors.length=k.layouts.length=Math.max(k.errors.length,k.layouts.length),k});function u(l){const g=l<0;return g&&(l=~l),[g,t[l]]}function E(l){return l===void 0?l:[d.has(l),t[l]]}}function Ke(t){try{return JSON.parse(sessionStorage[t])}catch{}}function qe(t,r){const f=JSON.stringify(r);try{sessionStorage[t]=f}catch{}}const gt=-1,mt=-2,_t=-3,wt=-4,yt=-5,vt=-6;function bt(t,r){if(typeof t=="number")return d(t,!0);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const f=t,s=Array(f.length);function d(u,E=!1){if(u===gt)return;if(u===_t)return NaN;if(u===wt)return 1/0;if(u===yt)return-1/0;if(u===vt)return-0;if(E)throw new Error("Invalid input");if(u in s)return s[u];const l=f[u];if(!l||typeof l!="object")s[u]=l;else if(Array.isArray(l))if(typeof l[0]=="string"){const g=l[0],m=r==null?void 0:r[g];if(m)return s[u]=m(d(l[1]));switch(g){case"Date":s[u]=new Date(l[1]);break;case"Set":const h=new Set;s[u]=h;for(let k=1;kr!=null)}const ze=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...ze];const St=new Set([...ze]);[...St];async function kt(t){var r;for(const f in t)if(typeof((r=t[f])==null?void 0:r.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(t).map(async([s,d])=>[s,await d])));return t}class ne{constructor(r,f){this.status=r,typeof f=="string"?this.body={message:f}:f?this.body=f:this.body={message:`Error: ${r}`}}toString(){return JSON.stringify(this.body)}}class Fe{constructor(r,f){this.status=r,this.location=f}}const Rt="x-sveltekit-invalidated",At="x-sveltekit-trailing-slash",K=Ke(Ge)??{},ee=Ke(Je)??{};function Ee(t){K[t]=te()}function It(t,r){var $e;const f=ht(t),s=t.nodes[0],d=t.nodes[1];s(),d();const u=document.documentElement,E=[],l=[];let g=null;const m={before_navigate:[],on_navigate:[],after_navigate:[]};let h={branch:[],error:null,url:null},x=!1,j=!1,k=!0,N=!1,U=!1,H=!1,B=!1,V,D=($e=history.state)==null?void 0:$e[M];D||(D=Date.now(),history.replaceState({...history.state,[M]:D},"",location.href));const ue=K[D];ue&&(history.scrollRestoration="manual",scrollTo(ue.x,ue.y));let q,z,Y;async function Re(){if(Y=Y||Promise.resolve(),await Y,!Y)return;Y=null;const e=new URL(location.href),i=Z(e,!0);g=null;const n=z={},o=i&&await he(i);if(n===z&&o){if(o.type==="redirect")return re(new URL(o.location,e).href,{},[e.pathname],n);o.props.page!==void 0&&(q=o.props.page),V.$set(o.props)}}function Ae(e){l.some(i=>i==null?void 0:i.snapshot)&&(ee[e]=l.map(i=>{var n;return(n=i==null?void 0:i.snapshot)==null?void 0:n.capture()}))}function Ie(e){var i;(i=ee[e])==null||i.forEach((n,o)=>{var a,c;(c=(a=l[o])==null?void 0:a.snapshot)==null||c.restore(n)})}function Le(){Ee(D),qe(Ge,K),Ae(D),qe(Je,ee)}async function re(e,{noScroll:i=!1,replaceState:n=!1,keepFocus:o=!1,state:a={},invalidateAll:c=!1},p,v){return typeof e=="string"&&(e=new URL(e,Ce(document))),ce({url:e,scroll:i?te():null,keepfocus:o,redirect_chain:p,details:{state:a,replaceState:n},nav_token:v,accepted:()=>{c&&(B=!0)},blocked:()=>{},type:"goto"})}async function Pe(e){return g={id:e.id,promise:he(e).then(i=>(i.type==="loaded"&&i.state.error&&(g=null),i))},g.promise}async function oe(...e){const n=f.filter(o=>e.some(a=>o.exec(a))).map(o=>Promise.all([...o.layouts,o.leaf].map(a=>a==null?void 0:a[1]())));await Promise.all(n)}function Oe(e){var o;h=e.state;const i=document.querySelector("style[data-sveltekit]");i&&i.remove(),q=e.props.page,V=new t.root({target:r,props:{...e.props,stores:F,components:l},hydrate:!0}),Ie(D);const n={from:null,to:{params:h.params,route:{id:((o=h.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};m.after_navigate.forEach(a=>a(n)),j=!0}async function X({url:e,params:i,branch:n,status:o,error:a,route:c,form:p}){let v="never";for(const w of n)(w==null?void 0:w.slash)!==void 0&&(v=w.slash);e.pathname=Ze(e.pathname,v),e.search=e.search;const b={type:"loaded",state:{url:e,params:i,branch:n,error:a,route:c},props:{constructors:Et(n).map(w=>w.node.component)}};p!==void 0&&(b.props.form=p);let y={},L=!q,A=0;for(let w=0;w(v.route=!0,_[O])}),params:new Proxy(o,{get:(_,O)=>(v.params.add(O),_[O])}),data:(c==null?void 0:c.data)??null,url:nt(n,()=>{v.url=!0}),async fetch(_,O){let $;_ instanceof Request?($=_.url,O={body:_.method==="GET"||_.method==="HEAD"?void 0:await _.blob(),cache:_.cache,credentials:_.credentials,headers:_.headers,integrity:_.integrity,keepalive:_.keepalive,method:_.method,mode:_.mode,redirect:_.redirect,referrer:_.referrer,referrerPolicy:_.referrerPolicy,signal:_.signal,...O}):$=_;const C=new URL($,n);return P(C.href),C.origin===n.origin&&($=C.href.slice(n.origin.length)),j?ct($,C.href,O):st($,O)},setHeaders:()=>{},depends:P,parent(){return v.parent=!0,i()}};p=await b.universal.load.call(null,w)??null,p=p?await kt(p):null}return{node:b,loader:e,server:c,universal:(L=b.universal)!=null&&L.load?{type:"data",data:p,uses:v}:null,data:p??(c==null?void 0:c.data)??null,slash:((A=b.universal)==null?void 0:A.trailingSlash)??(c==null?void 0:c.slash)}}function Ue(e,i,n,o,a){if(B)return!0;if(!o)return!1;if(o.parent&&e||o.route&&i||o.url&&n)return!0;for(const c of o.params)if(a[c]!==h.params[c])return!0;for(const c of o.dependencies)if(E.some(p=>p(new URL(c))))return!0;return!1}function pe(e,i){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?i??null:null}async function he({id:e,invalidating:i,url:n,params:o,route:a}){if((g==null?void 0:g.id)===e)return g.promise;const{errors:c,layouts:p,leaf:v}=a,b=[...p,v];c.forEach(S=>S==null?void 0:S().catch(()=>{})),b.forEach(S=>S==null?void 0:S[1]().catch(()=>{}));let y=null;const L=h.url?e!==h.url.pathname+h.url.search:!1,A=h.route?a.id!==h.route.id:!1;let P=!1;const w=b.map((S,I)=>{var G;const R=h.branch[I],T=!!(S!=null&&S[0])&&((R==null?void 0:R.loader)!==S[1]||Ue(P,A,L,(G=R.server)==null?void 0:G.uses,o));return T&&(P=!0),T});if(w.some(Boolean)){try{y=await He(n,w)}catch(S){return ie({status:S instanceof ne?S.status:500,error:await Q(S,{url:n,params:o,route:{id:a.id}}),url:n,route:a})}if(y.type==="redirect")return y}const _=y==null?void 0:y.nodes;let O=!1;const $=b.map(async(S,I)=>{var ge;if(!S)return;const R=h.branch[I],T=_==null?void 0:_[I];if((!T||T.type==="skip")&&S[1]===(R==null?void 0:R.loader)&&!Ue(O,A,L,(ge=R.universal)==null?void 0:ge.uses,o))return R;if(O=!0,(T==null?void 0:T.type)==="error")throw T;return de({loader:S[1],url:n,params:o,route:a,parent:async()=>{var De;const Te={};for(let me=0;me{});const C=[];for(let S=0;SPromise.resolve({}),server_data_node:pe(c)}),b={node:await d(),loader:d,universal:null,server:null,data:null};return await X({url:n,params:a,branch:[v,b],status:e,error:i,route:null})}function Z(e,i){if(ve(e,J))return;const n=se(e);for(const o of f){const a=o.exec(n);if(a)return{id:e.pathname+e.search,invalidating:i,route:o,params:et(a),url:e}}}function se(e){return Qe(e.pathname.slice(J.length)||"/")}function je({url:e,type:i,intent:n,delta:o}){let a=!1;const c=Be(h,n,e,i);o!==void 0&&(c.navigation.delta=o);const p={...c.navigation,cancel:()=>{a=!0,c.reject(new Error("navigation was cancelled"))}};return U||m.before_navigate.forEach(v=>v(p)),a?null:c}async function ce({url:e,scroll:i,keepfocus:n,redirect_chain:o,details:a,type:c,delta:p,nav_token:v={},accepted:b,blocked:y}){var $,C,S;const L=Z(e,!1),A=je({url:e,type:c,delta:p,intent:L});if(!A){y();return}const P=D;b(),U=!0,j&&F.navigating.set(A.navigation),z=v;let w=L&&await he(L);if(!w){if(ve(e,J))return await W(e);w=await Ne(e,{id:null},await Q(new Error(`Not found: ${e.pathname}`),{url:e,params:{},route:{id:null}}),404)}if(e=(L==null?void 0:L.url)||e,z!==v)return A.reject(new Error("navigation was aborted")),!1;if(w.type==="redirect")if(o.length>10||o.includes(e.pathname))w=await ie({status:500,error:await Q(new Error("Redirect loop"),{url:e,params:{},route:{id:null}}),url:e,route:{id:null}});else return re(new URL(w.location,e).href,{},[...o,e.pathname],v),!1;else(($=w.props.page)==null?void 0:$.status)>=400&&await F.updated.check()&&await W(e);if(E.length=0,B=!1,N=!0,Ee(P),Ae(P),(C=w.props.page)!=null&&C.url&&w.props.page.url.pathname!==e.pathname&&(e.pathname=(S=w.props.page)==null?void 0:S.url.pathname),a){const I=a.replaceState?0:1;if(a.state[M]=D+=I,history[a.replaceState?"replaceState":"pushState"](a.state,"",e),!a.replaceState){let R=D+1;for(;ee[R]||K[R];)delete ee[R],delete K[R],R+=1}}if(g=null,j){h=w.state,w.props.page&&(w.props.page.url=e);const I=(await Promise.all(m.on_navigate.map(R=>R(A.navigation)))).filter(R=>typeof R=="function");if(I.length>0){let R=function(){m.after_navigate=m.after_navigate.filter(T=>!I.includes(T))};I.push(R),m.after_navigate.push(...I)}V.$set(w.props)}else Oe(w);const{activeElement:_}=document;if(await we(),k){const I=e.hash&&document.getElementById(decodeURIComponent(e.hash.slice(1)));i?scrollTo(i.x,i.y):I?I.scrollIntoView():scrollTo(0,0)}const O=document.activeElement!==_&&document.activeElement!==document.body;!n&&!O&&Se(),k=!0,w.props.page&&(q=w.props.page),U=!1,c==="popstate"&&Ie(D),A.fulfil(void 0),m.after_navigate.forEach(I=>I(A.navigation)),F.navigating.set(null),N=!1}async function Ne(e,i,n,o){return e.origin===location.origin&&e.pathname===location.pathname&&!x?await ie({status:o,error:n,url:e,route:i}):await W(e)}function W(e){return location.href=e.href,new Promise(()=>{})}function Ye(){let e;u.addEventListener("mousemove",c=>{const p=c.target;clearTimeout(e),e=setTimeout(()=>{o(p,2)},20)});function i(c){o(c.composedPath()[0],1)}u.addEventListener("mousedown",i),u.addEventListener("touchstart",i,{passive:!0});const n=new IntersectionObserver(c=>{for(const p of c)p.isIntersecting&&(oe(se(new URL(p.target.href))),n.unobserve(p.target))},{threshold:0});function o(c,p){const v=Me(c,u);if(!v)return;const{url:b,external:y,download:L}=ye(v,J);if(y||L)return;const A=le(v);if(!A.reload)if(p<=A.preload_data){const P=Z(b,!1);P&&Pe(P)}else p<=A.preload_code&&oe(se(b))}function a(){n.disconnect();for(const c of u.querySelectorAll("a")){const{url:p,external:v,download:b}=ye(c,J);if(v||b)continue;const y=le(c);y.reload||(y.preload_code===Ve.viewport&&n.observe(c),y.preload_code===Ve.eager&&oe(se(p)))}}m.after_navigate.push(a),a()}function Q(e,i){return e instanceof ne?e.body:t.hooks.handleError({error:e,event:i})??{message:i.route.id!=null?"Internal Error":"Not Found"}}return{after_navigate:e=>{_e(()=>(m.after_navigate.push(e),()=>{const i=m.after_navigate.indexOf(e);m.after_navigate.splice(i,1)}))},before_navigate:e=>{_e(()=>(m.before_navigate.push(e),()=>{const i=m.before_navigate.indexOf(e);m.before_navigate.splice(i,1)}))},on_navigate:e=>{_e(()=>(m.on_navigate.push(e),()=>{const i=m.on_navigate.indexOf(e);m.on_navigate.splice(i,1)}))},disable_scroll_handling:()=>{(N||!j)&&(k=!1)},goto:(e,i={})=>re(e,i,[]),invalidate:e=>{if(typeof e=="function")E.push(e);else{const{href:i}=new URL(e,location.href);E.push(n=>n.href===i)}return Re()},invalidate_all:()=>(B=!0,Re()),preload_data:async e=>{const i=new URL(e,Ce(document)),n=Z(i,!1);if(!n)throw new Error(`Attempted to preload a URL that does not belong to this app: ${i}`);await Pe(n)},preload_code:oe,apply_action:async e=>{if(e.type==="error"){const i=new URL(location.href),{branch:n,route:o}=h;if(!o)return;const a=await xe(h.branch.length,n,o.errors);if(a){const c=await X({url:i,params:h.params,branch:n.slice(0,a.idx).concat(a.node),status:e.status??500,error:e.error,route:o});h=c.state,V.$set(c.props),we().then(Se)}}else e.type==="redirect"?re(e.location,{invalidateAll:!0},[]):(V.$set({form:null,page:{...q,form:e.data,status:e.status}}),await we(),V.$set({form:e.data}),e.type==="success"&&Se())},_start_router:()=>{var i;history.scrollRestoration="manual",addEventListener("beforeunload",n=>{let o=!1;if(Le(),!U){const a=Be(h,void 0,null,"leave"),c={...a.navigation,cancel:()=>{o=!0,a.reject(new Error("navigation was cancelled"))}};m.before_navigate.forEach(p=>p(c))}o?(n.preventDefault(),n.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Le()}),(i=navigator.connection)!=null&&i.saveData||Ye(),u.addEventListener("click",n=>{var P;if(n.button||n.which!==1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.defaultPrevented)return;const o=Me(n.composedPath()[0],u);if(!o)return;const{url:a,external:c,target:p,download:v}=ye(o,J);if(!a)return;if(p==="_parent"||p==="_top"){if(window.parent!==window)return}else if(p&&p!=="_self")return;const b=le(o);if(!(o instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||v)return;if(c||b.reload){je({url:a,type:"link"})?U=!0:n.preventDefault();return}const[L,A]=a.href.split("#");if(A!==void 0&&L===location.href.split("#")[0]){if(h.url.hash===a.hash){n.preventDefault(),(P=o.ownerDocument.getElementById(A))==null||P.scrollIntoView();return}if(H=!0,Ee(D),e(a),!b.replace_state)return;H=!1,n.preventDefault()}ce({url:a,scroll:b.noscroll?te():null,keepfocus:b.keep_focus??!1,redirect_chain:[],details:{state:{},replaceState:b.replace_state??a.href===location.href},accepted:()=>n.preventDefault(),blocked:()=>n.preventDefault(),type:"link"})}),u.addEventListener("submit",n=>{if(n.defaultPrevented)return;const o=HTMLFormElement.prototype.cloneNode.call(n.target),a=n.submitter;if(((a==null?void 0:a.formMethod)||o.method)!=="get")return;const p=new URL((a==null?void 0:a.hasAttribute("formaction"))&&(a==null?void 0:a.formAction)||o.action);if(ve(p,J))return;const v=n.target,{keep_focus:b,noscroll:y,reload:L,replace_state:A}=le(v);if(L)return;n.preventDefault(),n.stopPropagation();const P=new FormData(v),w=a==null?void 0:a.getAttribute("name");w&&P.append(w,(a==null?void 0:a.getAttribute("value"))??""),p.search=new URLSearchParams(P).toString(),ce({url:p,scroll:y?te():null,keepfocus:b??!1,redirect_chain:[],details:{state:{},replaceState:A??p.href===location.href},nav_token:{},accepted:()=>{},blocked:()=>{},type:"form"})}),addEventListener("popstate",async n=>{var o;if(z={},(o=n.state)!=null&&o[M]){if(n.state[M]===D)return;const a=K[n.state[M]],c=new URL(location.href);if(h.url.href.split("#")[0]===location.href.split("#")[0]){e(c),K[D]=te(),D=n.state[M],scrollTo(a.x,a.y);return}const p=n.state[M]-D;await ce({url:c,scroll:a,keepfocus:!1,redirect_chain:[],details:null,accepted:()=>{D=n.state[M]},blocked:()=>{history.go(-p)},type:"popstate",delta:p,nav_token:z})}else if(!H){const a=new URL(location.href);e(a)}}),addEventListener("hashchange",()=>{H&&(H=!1,history.replaceState({...history.state,[M]:++D},"",location.href))});for(const n of document.querySelectorAll("link"))n.rel==="icon"&&(n.href=n.href);addEventListener("pageshow",n=>{n.persisted&&F.navigating.set(null)});function e(n){h.url=n,F.page.set({...q,url:n}),F.page.notify()}},_hydrate:async({status:e=200,error:i,node_ids:n,params:o,route:a,data:c,form:p})=>{x=!0;const v=new URL(location.href);({params:o={},route:a={id:null}}=Z(v,!1)||{});let b;try{const y=n.map(async(P,w)=>{const _=c[w];return _!=null&&_.uses&&(_.uses=We(_.uses)),de({loader:t.nodes[P],url:v,params:o,route:a,parent:async()=>{const O={};for(let $=0;$P===a.id);if(A){const P=A.layouts;for(let w=0;wd?"1":"0").join(""));const s=await fe(f.href);if(!s.ok)throw new ne(s.status,await s.json());return new Promise(async d=>{var h;const u=new Map,E=s.body.getReader(),l=new TextDecoder;function g(x){return bt(x,{Promise:j=>new Promise((k,N)=>{u.set(j,{fulfil:k,reject:N})})})}let m="";for(;;){const{done:x,value:j}=await E.read();if(x&&!m)break;for(m+=!j&&m?` +import{o as _e,t as we}from"../chunks/scheduler.452d2f96.js";import{S as Ge,a as Je,I as M,g as Ce,f as Me,b as ye,c as le,s as te,i as ve,d as F,P as Ve,e as Xe}from"../chunks/singletons.1baaed8b.js";import{b as J}from"../chunks/paths.e0228478.js";function Ze(t,r){return t==="/"||r==="ignore"?t:r==="never"?t.endsWith("/")?t.slice(0,-1):t:r==="always"&&!t.endsWith("/")?t+"/":t}function Qe(t){return t.split("%25").map(decodeURI).join("%25")}function et(t){for(const r in t)t[r]=decodeURIComponent(t[r]);return t}const tt=["href","pathname","search","searchParams","toString","toJSON"];function nt(t,r){const f=new URL(t);for(const s of tt)Object.defineProperty(f,s,{get(){return r(),t[s]},enumerable:!0,configurable:!0});return at(f),f}function at(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const rt="/__data.json";function ot(t){return t.replace(/\/$/,"")+rt}function it(...t){let r=5381;for(const f of t)if(typeof f=="string"){let s=f.length;for(;s;)r=r*33^f.charCodeAt(--s)}else if(ArrayBuffer.isView(f)){const s=new Uint8Array(f.buffer,f.byteOffset,f.byteLength);let d=s.length;for(;d;)r=r*33^s[--d]}else throw new TypeError("value must be a string or TypedArray");return(r>>>0).toString(36)}const fe=window.fetch;window.fetch=(t,r)=>((t instanceof Request?t.method:(r==null?void 0:r.method)||"GET")!=="GET"&&ae.delete(ke(t)),fe(t,r));const ae=new Map;function st(t,r){const f=ke(t,r),s=document.querySelector(f);if(s!=null&&s.textContent){const{body:d,...u}=JSON.parse(s.textContent),E=s.getAttribute("data-ttl");return E&&ae.set(f,{body:d,init:u,ttl:1e3*Number(E)}),Promise.resolve(new Response(d,u))}return fe(t,r)}function ct(t,r,f){if(ae.size>0){const s=ke(t,f),d=ae.get(s);if(d){if(performance.now(){const d=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(s);if(d)return r.push({name:d[1],matcher:d[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const u=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(s);if(u)return r.push({name:u[1],matcher:u[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!s)return;const E=s.split(/\[(.+?)\](?!\])/);return"/"+E.map((g,m)=>{if(m%2){if(g.startsWith("x+"))return be(String.fromCharCode(parseInt(g.slice(2),16)));if(g.startsWith("u+"))return be(String.fromCharCode(...g.slice(2).split("-").map(U=>parseInt(U,16))));const h=lt.exec(g);if(!h)throw new Error(`Invalid param: ${g}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,x,j,k,N]=h;return r.push({name:k,matcher:N,optional:!!x,rest:!!j,chained:j?m===1&&E[0]==="":!1}),j?"(.*?)":x?"([^/]*)?":"([^/]+?)"}return be(g)}).join("")}).join("")}/?$`),params:r}}function ut(t){return!/^\([^)]+\)$/.test(t)}function dt(t){return t.slice(1).split("/").filter(ut)}function pt(t,r,f){const s={},d=t.slice(1),u=d.filter(l=>l!==void 0);let E=0;for(let l=0;lh).join("/"),E=0),m===void 0){g.rest&&(s[g.name]="");continue}if(!g.matcher||f[g.matcher](m)){s[g.name]=m;const h=r[l+1],x=d[l+1];h&&!h.rest&&h.optional&&x&&g.chained&&(E=0),!h&&!x&&Object.keys(s).length===u.length&&(E=0);continue}if(g.optional&&g.chained){E++;continue}return}if(!E)return s}function be(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function ht({nodes:t,server_loads:r,dictionary:f,matchers:s}){const d=new Set(r);return Object.entries(f).map(([l,[g,m,h]])=>{const{pattern:x,params:j}=ft(l),k={id:l,exec:N=>{const U=x.exec(N);if(U)return pt(U,j,s)},errors:[1,...h||[]].map(N=>t[N]),layouts:[0,...m||[]].map(E),leaf:u(g)};return k.errors.length=k.layouts.length=Math.max(k.errors.length,k.layouts.length),k});function u(l){const g=l<0;return g&&(l=~l),[g,t[l]]}function E(l){return l===void 0?l:[d.has(l),t[l]]}}function Ke(t){try{return JSON.parse(sessionStorage[t])}catch{}}function qe(t,r){const f=JSON.stringify(r);try{sessionStorage[t]=f}catch{}}const gt=-1,mt=-2,_t=-3,wt=-4,yt=-5,vt=-6;function bt(t,r){if(typeof t=="number")return d(t,!0);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const f=t,s=Array(f.length);function d(u,E=!1){if(u===gt)return;if(u===_t)return NaN;if(u===wt)return 1/0;if(u===yt)return-1/0;if(u===vt)return-0;if(E)throw new Error("Invalid input");if(u in s)return s[u];const l=f[u];if(!l||typeof l!="object")s[u]=l;else if(Array.isArray(l))if(typeof l[0]=="string"){const g=l[0],m=r==null?void 0:r[g];if(m)return s[u]=m(d(l[1]));switch(g){case"Date":s[u]=new Date(l[1]);break;case"Set":const h=new Set;s[u]=h;for(let k=1;kr!=null)}const ze=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...ze];const St=new Set([...ze]);[...St];async function kt(t){var r;for(const f in t)if(typeof((r=t[f])==null?void 0:r.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(t).map(async([s,d])=>[s,await d])));return t}class ne{constructor(r,f){this.status=r,typeof f=="string"?this.body={message:f}:f?this.body=f:this.body={message:`Error: ${r}`}}toString(){return JSON.stringify(this.body)}}class Fe{constructor(r,f){this.status=r,this.location=f}}const Rt="x-sveltekit-invalidated",At="x-sveltekit-trailing-slash",K=Ke(Ge)??{},ee=Ke(Je)??{};function Ee(t){K[t]=te()}function It(t,r){var $e;const f=ht(t),s=t.nodes[0],d=t.nodes[1];s(),d();const u=document.documentElement,E=[],l=[];let g=null;const m={before_navigate:[],on_navigate:[],after_navigate:[]};let h={branch:[],error:null,url:null},x=!1,j=!1,k=!0,N=!1,U=!1,H=!1,B=!1,V,D=($e=history.state)==null?void 0:$e[M];D||(D=Date.now(),history.replaceState({...history.state,[M]:D},"",location.href));const ue=K[D];ue&&(history.scrollRestoration="manual",scrollTo(ue.x,ue.y));let q,z,Y;async function Re(){if(Y=Y||Promise.resolve(),await Y,!Y)return;Y=null;const e=new URL(location.href),i=Z(e,!0);g=null;const n=z={},o=i&&await he(i);if(n===z&&o){if(o.type==="redirect")return re(new URL(o.location,e).href,{},[e.pathname],n);o.props.page!==void 0&&(q=o.props.page),V.$set(o.props)}}function Ae(e){l.some(i=>i==null?void 0:i.snapshot)&&(ee[e]=l.map(i=>{var n;return(n=i==null?void 0:i.snapshot)==null?void 0:n.capture()}))}function Ie(e){var i;(i=ee[e])==null||i.forEach((n,o)=>{var a,c;(c=(a=l[o])==null?void 0:a.snapshot)==null||c.restore(n)})}function Le(){Ee(D),qe(Ge,K),Ae(D),qe(Je,ee)}async function re(e,{noScroll:i=!1,replaceState:n=!1,keepFocus:o=!1,state:a={},invalidateAll:c=!1},p,v){return typeof e=="string"&&(e=new URL(e,Ce(document))),ce({url:e,scroll:i?te():null,keepfocus:o,redirect_chain:p,details:{state:a,replaceState:n},nav_token:v,accepted:()=>{c&&(B=!0)},blocked:()=>{},type:"goto"})}async function Pe(e){return g={id:e.id,promise:he(e).then(i=>(i.type==="loaded"&&i.state.error&&(g=null),i))},g.promise}async function oe(...e){const n=f.filter(o=>e.some(a=>o.exec(a))).map(o=>Promise.all([...o.layouts,o.leaf].map(a=>a==null?void 0:a[1]())));await Promise.all(n)}function Oe(e){var o;h=e.state;const i=document.querySelector("style[data-sveltekit]");i&&i.remove(),q=e.props.page,V=new t.root({target:r,props:{...e.props,stores:F,components:l},hydrate:!0}),Ie(D);const n={from:null,to:{params:h.params,route:{id:((o=h.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};m.after_navigate.forEach(a=>a(n)),j=!0}async function X({url:e,params:i,branch:n,status:o,error:a,route:c,form:p}){let v="never";for(const w of n)(w==null?void 0:w.slash)!==void 0&&(v=w.slash);e.pathname=Ze(e.pathname,v),e.search=e.search;const b={type:"loaded",state:{url:e,params:i,branch:n,error:a,route:c},props:{constructors:Et(n).map(w=>w.node.component)}};p!==void 0&&(b.props.form=p);let y={},L=!q,A=0;for(let w=0;w(v.route=!0,_[O])}),params:new Proxy(o,{get:(_,O)=>(v.params.add(O),_[O])}),data:(c==null?void 0:c.data)??null,url:nt(n,()=>{v.url=!0}),async fetch(_,O){let $;_ instanceof Request?($=_.url,O={body:_.method==="GET"||_.method==="HEAD"?void 0:await _.blob(),cache:_.cache,credentials:_.credentials,headers:_.headers,integrity:_.integrity,keepalive:_.keepalive,method:_.method,mode:_.mode,redirect:_.redirect,referrer:_.referrer,referrerPolicy:_.referrerPolicy,signal:_.signal,...O}):$=_;const C=new URL($,n);return P(C.href),C.origin===n.origin&&($=C.href.slice(n.origin.length)),j?ct($,C.href,O):st($,O)},setHeaders:()=>{},depends:P,parent(){return v.parent=!0,i()}};p=await b.universal.load.call(null,w)??null,p=p?await kt(p):null}return{node:b,loader:e,server:c,universal:(L=b.universal)!=null&&L.load?{type:"data",data:p,uses:v}:null,data:p??(c==null?void 0:c.data)??null,slash:((A=b.universal)==null?void 0:A.trailingSlash)??(c==null?void 0:c.slash)}}function Ue(e,i,n,o,a){if(B)return!0;if(!o)return!1;if(o.parent&&e||o.route&&i||o.url&&n)return!0;for(const c of o.params)if(a[c]!==h.params[c])return!0;for(const c of o.dependencies)if(E.some(p=>p(new URL(c))))return!0;return!1}function pe(e,i){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?i??null:null}async function he({id:e,invalidating:i,url:n,params:o,route:a}){if((g==null?void 0:g.id)===e)return g.promise;const{errors:c,layouts:p,leaf:v}=a,b=[...p,v];c.forEach(S=>S==null?void 0:S().catch(()=>{})),b.forEach(S=>S==null?void 0:S[1]().catch(()=>{}));let y=null;const L=h.url?e!==h.url.pathname+h.url.search:!1,A=h.route?a.id!==h.route.id:!1;let P=!1;const w=b.map((S,I)=>{var G;const R=h.branch[I],T=!!(S!=null&&S[0])&&((R==null?void 0:R.loader)!==S[1]||Ue(P,A,L,(G=R.server)==null?void 0:G.uses,o));return T&&(P=!0),T});if(w.some(Boolean)){try{y=await He(n,w)}catch(S){return ie({status:S instanceof ne?S.status:500,error:await Q(S,{url:n,params:o,route:{id:a.id}}),url:n,route:a})}if(y.type==="redirect")return y}const _=y==null?void 0:y.nodes;let O=!1;const $=b.map(async(S,I)=>{var ge;if(!S)return;const R=h.branch[I],T=_==null?void 0:_[I];if((!T||T.type==="skip")&&S[1]===(R==null?void 0:R.loader)&&!Ue(O,A,L,(ge=R.universal)==null?void 0:ge.uses,o))return R;if(O=!0,(T==null?void 0:T.type)==="error")throw T;return de({loader:S[1],url:n,params:o,route:a,parent:async()=>{var De;const Te={};for(let me=0;me{});const C=[];for(let S=0;SPromise.resolve({}),server_data_node:pe(c)}),b={node:await d(),loader:d,universal:null,server:null,data:null};return await X({url:n,params:a,branch:[v,b],status:e,error:i,route:null})}function Z(e,i){if(ve(e,J))return;const n=se(e);for(const o of f){const a=o.exec(n);if(a)return{id:e.pathname+e.search,invalidating:i,route:o,params:et(a),url:e}}}function se(e){return Qe(e.pathname.slice(J.length)||"/")}function je({url:e,type:i,intent:n,delta:o}){let a=!1;const c=Be(h,n,e,i);o!==void 0&&(c.navigation.delta=o);const p={...c.navigation,cancel:()=>{a=!0,c.reject(new Error("navigation was cancelled"))}};return U||m.before_navigate.forEach(v=>v(p)),a?null:c}async function ce({url:e,scroll:i,keepfocus:n,redirect_chain:o,details:a,type:c,delta:p,nav_token:v={},accepted:b,blocked:y}){var $,C,S;const L=Z(e,!1),A=je({url:e,type:c,delta:p,intent:L});if(!A){y();return}const P=D;b(),U=!0,j&&F.navigating.set(A.navigation),z=v;let w=L&&await he(L);if(!w){if(ve(e,J))return await W(e);w=await Ne(e,{id:null},await Q(new Error(`Not found: ${e.pathname}`),{url:e,params:{},route:{id:null}}),404)}if(e=(L==null?void 0:L.url)||e,z!==v)return A.reject(new Error("navigation was aborted")),!1;if(w.type==="redirect")if(o.length>10||o.includes(e.pathname))w=await ie({status:500,error:await Q(new Error("Redirect loop"),{url:e,params:{},route:{id:null}}),url:e,route:{id:null}});else return re(new URL(w.location,e).href,{},[...o,e.pathname],v),!1;else(($=w.props.page)==null?void 0:$.status)>=400&&await F.updated.check()&&await W(e);if(E.length=0,B=!1,N=!0,Ee(P),Ae(P),(C=w.props.page)!=null&&C.url&&w.props.page.url.pathname!==e.pathname&&(e.pathname=(S=w.props.page)==null?void 0:S.url.pathname),a){const I=a.replaceState?0:1;if(a.state[M]=D+=I,history[a.replaceState?"replaceState":"pushState"](a.state,"",e),!a.replaceState){let R=D+1;for(;ee[R]||K[R];)delete ee[R],delete K[R],R+=1}}if(g=null,j){h=w.state,w.props.page&&(w.props.page.url=e);const I=(await Promise.all(m.on_navigate.map(R=>R(A.navigation)))).filter(R=>typeof R=="function");if(I.length>0){let R=function(){m.after_navigate=m.after_navigate.filter(T=>!I.includes(T))};I.push(R),m.after_navigate.push(...I)}V.$set(w.props)}else Oe(w);const{activeElement:_}=document;if(await we(),k){const I=e.hash&&document.getElementById(decodeURIComponent(e.hash.slice(1)));i?scrollTo(i.x,i.y):I?I.scrollIntoView():scrollTo(0,0)}const O=document.activeElement!==_&&document.activeElement!==document.body;!n&&!O&&Se(),k=!0,w.props.page&&(q=w.props.page),U=!1,c==="popstate"&&Ie(D),A.fulfil(void 0),m.after_navigate.forEach(I=>I(A.navigation)),F.navigating.set(null),N=!1}async function Ne(e,i,n,o){return e.origin===location.origin&&e.pathname===location.pathname&&!x?await ie({status:o,error:n,url:e,route:i}):await W(e)}function W(e){return location.href=e.href,new Promise(()=>{})}function Ye(){let e;u.addEventListener("mousemove",c=>{const p=c.target;clearTimeout(e),e=setTimeout(()=>{o(p,2)},20)});function i(c){o(c.composedPath()[0],1)}u.addEventListener("mousedown",i),u.addEventListener("touchstart",i,{passive:!0});const n=new IntersectionObserver(c=>{for(const p of c)p.isIntersecting&&(oe(se(new URL(p.target.href))),n.unobserve(p.target))},{threshold:0});function o(c,p){const v=Me(c,u);if(!v)return;const{url:b,external:y,download:L}=ye(v,J);if(y||L)return;const A=le(v);if(!A.reload)if(p<=A.preload_data){const P=Z(b,!1);P&&Pe(P)}else p<=A.preload_code&&oe(se(b))}function a(){n.disconnect();for(const c of u.querySelectorAll("a")){const{url:p,external:v,download:b}=ye(c,J);if(v||b)continue;const y=le(c);y.reload||(y.preload_code===Ve.viewport&&n.observe(c),y.preload_code===Ve.eager&&oe(se(p)))}}m.after_navigate.push(a),a()}function Q(e,i){return e instanceof ne?e.body:t.hooks.handleError({error:e,event:i})??{message:i.route.id!=null?"Internal Error":"Not Found"}}return{after_navigate:e=>{_e(()=>(m.after_navigate.push(e),()=>{const i=m.after_navigate.indexOf(e);m.after_navigate.splice(i,1)}))},before_navigate:e=>{_e(()=>(m.before_navigate.push(e),()=>{const i=m.before_navigate.indexOf(e);m.before_navigate.splice(i,1)}))},on_navigate:e=>{_e(()=>(m.on_navigate.push(e),()=>{const i=m.on_navigate.indexOf(e);m.on_navigate.splice(i,1)}))},disable_scroll_handling:()=>{(N||!j)&&(k=!1)},goto:(e,i={})=>re(e,i,[]),invalidate:e=>{if(typeof e=="function")E.push(e);else{const{href:i}=new URL(e,location.href);E.push(n=>n.href===i)}return Re()},invalidate_all:()=>(B=!0,Re()),preload_data:async e=>{const i=new URL(e,Ce(document)),n=Z(i,!1);if(!n)throw new Error(`Attempted to preload a URL that does not belong to this app: ${i}`);await Pe(n)},preload_code:oe,apply_action:async e=>{if(e.type==="error"){const i=new URL(location.href),{branch:n,route:o}=h;if(!o)return;const a=await xe(h.branch.length,n,o.errors);if(a){const c=await X({url:i,params:h.params,branch:n.slice(0,a.idx).concat(a.node),status:e.status??500,error:e.error,route:o});h=c.state,V.$set(c.props),we().then(Se)}}else e.type==="redirect"?re(e.location,{invalidateAll:!0},[]):(V.$set({form:null,page:{...q,form:e.data,status:e.status}}),await we(),V.$set({form:e.data}),e.type==="success"&&Se())},_start_router:()=>{var i;history.scrollRestoration="manual",addEventListener("beforeunload",n=>{let o=!1;if(Le(),!U){const a=Be(h,void 0,null,"leave"),c={...a.navigation,cancel:()=>{o=!0,a.reject(new Error("navigation was cancelled"))}};m.before_navigate.forEach(p=>p(c))}o?(n.preventDefault(),n.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Le()}),(i=navigator.connection)!=null&&i.saveData||Ye(),u.addEventListener("click",n=>{var P;if(n.button||n.which!==1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.defaultPrevented)return;const o=Me(n.composedPath()[0],u);if(!o)return;const{url:a,external:c,target:p,download:v}=ye(o,J);if(!a)return;if(p==="_parent"||p==="_top"){if(window.parent!==window)return}else if(p&&p!=="_self")return;const b=le(o);if(!(o instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||v)return;if(c||b.reload){je({url:a,type:"link"})?U=!0:n.preventDefault();return}const[L,A]=a.href.split("#");if(A!==void 0&&L===location.href.split("#")[0]){if(h.url.hash===a.hash){n.preventDefault(),(P=o.ownerDocument.getElementById(A))==null||P.scrollIntoView();return}if(H=!0,Ee(D),e(a),!b.replace_state)return;H=!1,n.preventDefault()}ce({url:a,scroll:b.noscroll?te():null,keepfocus:b.keep_focus??!1,redirect_chain:[],details:{state:{},replaceState:b.replace_state??a.href===location.href},accepted:()=>n.preventDefault(),blocked:()=>n.preventDefault(),type:"link"})}),u.addEventListener("submit",n=>{if(n.defaultPrevented)return;const o=HTMLFormElement.prototype.cloneNode.call(n.target),a=n.submitter;if(((a==null?void 0:a.formMethod)||o.method)!=="get")return;const p=new URL((a==null?void 0:a.hasAttribute("formaction"))&&(a==null?void 0:a.formAction)||o.action);if(ve(p,J))return;const v=n.target,{keep_focus:b,noscroll:y,reload:L,replace_state:A}=le(v);if(L)return;n.preventDefault(),n.stopPropagation();const P=new FormData(v),w=a==null?void 0:a.getAttribute("name");w&&P.append(w,(a==null?void 0:a.getAttribute("value"))??""),p.search=new URLSearchParams(P).toString(),ce({url:p,scroll:y?te():null,keepfocus:b??!1,redirect_chain:[],details:{state:{},replaceState:A??p.href===location.href},nav_token:{},accepted:()=>{},blocked:()=>{},type:"form"})}),addEventListener("popstate",async n=>{var o;if(z={},(o=n.state)!=null&&o[M]){if(n.state[M]===D)return;const a=K[n.state[M]],c=new URL(location.href);if(h.url.href.split("#")[0]===location.href.split("#")[0]){e(c),K[D]=te(),D=n.state[M],scrollTo(a.x,a.y);return}const p=n.state[M]-D;await ce({url:c,scroll:a,keepfocus:!1,redirect_chain:[],details:null,accepted:()=>{D=n.state[M]},blocked:()=>{history.go(-p)},type:"popstate",delta:p,nav_token:z})}else if(!H){const a=new URL(location.href);e(a)}}),addEventListener("hashchange",()=>{H&&(H=!1,history.replaceState({...history.state,[M]:++D},"",location.href))});for(const n of document.querySelectorAll("link"))n.rel==="icon"&&(n.href=n.href);addEventListener("pageshow",n=>{n.persisted&&F.navigating.set(null)});function e(n){h.url=n,F.page.set({...q,url:n}),F.page.notify()}},_hydrate:async({status:e=200,error:i,node_ids:n,params:o,route:a,data:c,form:p})=>{x=!0;const v=new URL(location.href);({params:o={},route:a={id:null}}=Z(v,!1)||{});let b;try{const y=n.map(async(P,w)=>{const _=c[w];return _!=null&&_.uses&&(_.uses=We(_.uses)),de({loader:t.nodes[P],url:v,params:o,route:a,parent:async()=>{const O={};for(let $=0;$P===a.id);if(A){const P=A.layouts;for(let w=0;wd?"1":"0").join(""));const s=await fe(f.href);if(!s.ok)throw new ne(s.status,await s.json());return new Promise(async d=>{var h;const u=new Map,E=s.body.getReader(),l=new TextDecoder;function g(x){return bt(x,{Promise:j=>new Promise((k,N)=>{u.set(j,{fulfil:k,reject:N})})})}let m="";for(;;){const{done:x,value:j}=await E.read();if(x&&!m)break;for(m+=!j&&m?` `:l.decode(j);;){const k=m.indexOf(` `);if(k===-1)break;const N=JSON.parse(m.slice(0,k));if(m=m.slice(k+1),N.type==="redirect")return d(N);if(N.type==="data")(h=N.nodes)==null||h.forEach(U=>{(U==null?void 0:U.type)==="data"&&(U.uses=We(U.uses),U.data=g(U.data))}),d(N);else if(N.type==="chunk"){const{id:U,data:H,error:B}=N,V=u.get(U);u.delete(U),B?V.reject(g(B)):V.fulfil(g(H))}}}})}function We(t){return{dependencies:new Set((t==null?void 0:t.dependencies)??[]),params:new Set((t==null?void 0:t.params)??[]),parent:!!(t!=null&&t.parent),route:!!(t!=null&&t.route),url:!!(t!=null&&t.url)}}function Se(){const t=document.querySelector("[autofocus]");if(t)t.focus();else{const r=document.body,f=r.getAttribute("tabindex");r.tabIndex=-1,r.focus({preventScroll:!0,focusVisible:!1}),f!==null?r.setAttribute("tabindex",f):r.removeAttribute("tabindex");const s=getSelection();if(s&&s.type!=="None"){const d=[];for(let u=0;u{if(s.rangeCount===d.length){for(let u=0;u{d=h,u=x});return E.catch(()=>{}),{navigation:{from:{params:t.params,route:{id:((g=t.route)==null?void 0:g.id)??null},url:t.url},to:f&&{params:(r==null?void 0:r.params)??null,route:{id:((m=r==null?void 0:r.route)==null?void 0:m.id)??null},url:f},willUnload:!r,type:s,complete:E},fulfil:d,reject:u}}async function Ut(t,r,f){const s=It(t,r);Xe({client:s}),f?await s._hydrate(f):s.goto(location.href,{replaceState:!0}),s._start_router()}export{Ut as start}; diff --git a/_app/immutable/nodes/0.1771432f.js b/_app/immutable/nodes/0.af781a5e.js similarity index 99% rename from _app/immutable/nodes/0.1771432f.js rename to _app/immutable/nodes/0.af781a5e.js index 2ff27e4..d4fbbcf 100644 --- a/_app/immutable/nodes/0.1771432f.js +++ b/_app/immutable/nodes/0.af781a5e.js @@ -1,3 +1,3 @@ -import{s as ma,r as Na,f,g as _,h as c,d as r,j as a,k as La,i as B,u as Da,v as Sa,w as Ha,x as Ba,y as Zl,o as Za,a as C,l as P,z as j,c as L,m as Z,A as G,B as pa,C as l,D as _a,e as va,E as Ma,n as xe,F as ke,G as Oa,H as wl,I as Ta,J as jl,K as Gl,L as Yl}from"../chunks/scheduler.452d2f96.js";import{S as ga,i as ba,a as ce,t as he,b as Ye,d as Fe,m as Ue,e as Re,g as Ol,c as Tl}from"../chunks/index.bed91369.js";import{b as Fl}from"../chunks/paths.02c4a57e.js";import{T as $l,e as fa,A as Ul,a as Rl,t as zl}from"../chunks/Table.svelte_svelte_type_style_lang.9e187c59.js";const ql=!0,Wl="always",Zt=Object.freeze(Object.defineProperty({__proto__:null,prerender:ql,trailingSlash:Wl},Symbol.toStringTag,{value:"Module"}));function Kl(s){let e,t;const n=s[1].default,o=Na(n,s,s[0],null);return{c(){e=f("main"),o&&o.c(),this.h()},l(i){e=_(i,"MAIN",{id:!0,tabindex:!0,style:!0});var d=c(e);o&&o.l(d),d.forEach(r),this.h()},h(){a(e,"id","main"),a(e,"tabindex","-1"),La(e,"display","block")},m(i,d){B(i,e,d),o&&o.m(e,null),t=!0},p(i,[d]){o&&o.p&&(!t||d&1)&&Da(o,n,i,i[0],t?Ha(n,i[0],d,null):Sa(i[0]),null)},i(i){t||(ce(o,i),t=!0)},o(i){he(o,i),t=!1},d(i){i&&r(e),o&&o.d(i)}}}function Jl(s,e,t){let{$$slots:n={},$$scope:o}=e;return s.$$set=i=>{"$$scope"in i&&t(0,o=i.$$scope)},[o,n]}class Ql extends ga{constructor(e){super(),ba(this,e,Jl,Kl,ma,{})}}const Xl=s=>({}),El=s=>({});function xl(s){let e,t,n,o=s[5]("Help")+"",i,d,u,h,p,y=s[5]("Accessibility")+"",b,m,v,g,w=s[5]("Cookies")+"",k,A,M,N,H=s[5]("Privacy")+"",D,Y,O,S,F=s[5]("Terms and conditions")+"",$,Q,W,V,U=s[5]("About ONS")+"",R,_e,K,re,ae,oe=s[5]("What we do")+"",X,z,x,te,J=s[5]("Careers")+"",I,se,ue,be,de=s[5]("Contact us")+"",Oe,fe,ve,me,ze=s[5]("News")+"",ye,pe,qe,Ve,ie=s[5]("Freedom of Information")+"",la,sa,Ae,Ie,we=s[5]("Connect with us")+"",Te,ne,ee,le,Ce,ta=s[5]("Twitter")+"",ge,E,q,T,Le=s[5]("Instagram")+"",ra,na,We,Me,ya=s[5]("Facebook")+"",oa,ea,Ne,De,wa=s[5]("LinkedIn")+"",ia,ca,Ke,Se,Je=s[5]("Consultations")+"",ha,ua,Qe,He,Ea=s[5]("Discussion forums")+"",$e,da,Pe,Ze,Be=s[5]("Email alerts")+"",Pa,Va,ka;return{c(){e=f("div"),t=f("div"),n=f("h2"),i=P(o),d=C(),u=f("ul"),h=f("li"),p=f("a"),b=P(y),m=C(),v=f("li"),g=f("a"),k=P(w),A=C(),M=f("li"),N=f("a"),D=P(H),Y=C(),O=f("li"),S=f("a"),$=P(F),Q=C(),W=f("div"),V=f("h2"),R=P(U),_e=C(),K=f("ul"),re=f("li"),ae=f("a"),X=P(oe),z=C(),x=f("li"),te=f("a"),I=P(J),se=C(),ue=f("li"),be=f("a"),Oe=P(de),fe=C(),ve=f("li"),me=f("a"),ye=P(ze),pe=C(),qe=f("li"),Ve=f("a"),la=P(ie),sa=C(),Ae=f("div"),Ie=f("h2"),Te=P(we),ne=C(),ee=f("ul"),le=f("li"),Ce=f("a"),ge=P(ta),E=C(),q=f("li"),T=f("a"),ra=P(Le),na=C(),We=f("li"),Me=f("a"),oa=P(ya),ea=C(),Ne=f("li"),De=f("a"),ia=P(wa),ca=C(),Ke=f("li"),Se=f("a"),ha=P(Je),ua=C(),Qe=f("li"),He=f("a"),$e=P(Ea),da=C(),Pe=f("li"),Ze=f("a"),Pa=P(Be),Va=C(),ka=f("hr"),this.h()},l(Xe){e=_(Xe,"DIV",{class:!0});var je=c(e);t=_(je,"DIV",{class:!0});var Aa=c(t);n=_(Aa,"H2",{class:!0});var ja=c(n);i=Z(ja,o),ja.forEach(r),d=L(Aa),u=_(Aa,"UL",{class:!0});var aa=c(u);h=_(aa,"LI",{class:!0});var Ga=c(h);p=_(Ga,"A",{href:!0,class:!0});var Ya=c(p);b=Z(Ya,y),Ya.forEach(r),Ga.forEach(r),m=L(aa),v=_(aa,"LI",{class:!0});var Fa=c(v);g=_(Fa,"A",{href:!0,class:!0});var Ua=c(g);k=Z(Ua,w),Ua.forEach(r),Fa.forEach(r),A=L(aa),M=_(aa,"LI",{class:!0});var Ra=c(M);N=_(Ra,"A",{href:!0,class:!0});var za=c(N);D=Z(za,H),za.forEach(r),Ra.forEach(r),Y=L(aa),O=_(aa,"LI",{class:!0});var qa=c(O);S=_(qa,"A",{href:!0,class:!0});var Wa=c(S);$=Z(Wa,F),Wa.forEach(r),qa.forEach(r),aa.forEach(r),Aa.forEach(r),Q=L(je),W=_(je,"DIV",{class:!0});var Ia=c(W);V=_(Ia,"H2",{class:!0});var Ka=c(V);R=Z(Ka,U),Ka.forEach(r),_e=L(Ia),K=_(Ia,"UL",{class:!0});var Ge=c(K);re=_(Ge,"LI",{class:!0});var Ja=c(re);ae=_(Ja,"A",{href:!0,class:!0});var Qa=c(ae);X=Z(Qa,oe),Qa.forEach(r),Ja.forEach(r),z=L(Ge),x=_(Ge,"LI",{class:!0});var Xa=c(x);te=_(Xa,"A",{href:!0,class:!0});var xa=c(te);I=Z(xa,J),xa.forEach(r),Xa.forEach(r),se=L(Ge),ue=_(Ge,"LI",{class:!0});var el=c(ue);be=_(el,"A",{href:!0,class:!0});var al=c(be);Oe=Z(al,de),al.forEach(r),el.forEach(r),fe=L(Ge),ve=_(Ge,"LI",{class:!0});var ll=c(ve);me=_(ll,"A",{href:!0,class:!0});var tl=c(me);ye=Z(tl,ze),tl.forEach(r),ll.forEach(r),pe=L(Ge),qe=_(Ge,"LI",{class:!0});var sl=c(qe);Ve=_(sl,"A",{href:!0,class:!0});var rl=c(Ve);la=Z(rl,ie),rl.forEach(r),sl.forEach(r),Ge.forEach(r),Ia.forEach(r),sa=L(je),Ae=_(je,"DIV",{class:!0});var Ca=c(Ae);Ie=_(Ca,"H2",{class:!0});var nl=c(Ie);Te=Z(nl,we),nl.forEach(r),ne=L(Ca),ee=_(Ca,"UL",{class:!0});var Ee=c(ee);le=_(Ee,"LI",{class:!0});var ol=c(le);Ce=_(ol,"A",{href:!0,class:!0,target:!0});var il=c(Ce);ge=Z(il,ta),il.forEach(r),ol.forEach(r),E=L(Ee),q=_(Ee,"LI",{class:!0});var cl=c(q);T=_(cl,"A",{href:!0,class:!0,target:!0});var hl=c(T);ra=Z(hl,Le),hl.forEach(r),cl.forEach(r),na=L(Ee),We=_(Ee,"LI",{class:!0});var ul=c(We);Me=_(ul,"A",{href:!0,class:!0,target:!0});var dl=c(Me);oa=Z(dl,ya),dl.forEach(r),ul.forEach(r),ea=L(Ee),Ne=_(Ee,"LI",{class:!0});var fl=c(Ne);De=_(fl,"A",{href:!0,class:!0,target:!0});var _l=c(De);ia=Z(_l,wa),_l.forEach(r),fl.forEach(r),ca=L(Ee),Ke=_(Ee,"LI",{class:!0});var vl=c(Ke);Se=_(vl,"A",{href:!0,class:!0,target:!0});var ml=c(Se);ha=Z(ml,Je),ml.forEach(r),vl.forEach(r),ua=L(Ee),Qe=_(Ee,"LI",{class:!0});var pl=c(Qe);He=_(pl,"A",{href:!0,class:!0,target:!0});var gl=c(He);$e=Z(gl,Ea),gl.forEach(r),pl.forEach(r),da=L(Ee),Pe=_(Ee,"LI",{class:!0});var bl=c(Pe);Ze=_(bl,"A",{href:!0,class:!0,target:!0});var yl=c(Ze);Pa=Z(yl,Be),yl.forEach(r),bl.forEach(r),Ee.forEach(r),Ca.forEach(r),je.forEach(r),Va=L(Xe),ka=_(Xe,"HR",{class:!0}),this.h()},h(){a(n,"class","footer-nav__heading"),a(p,"href","/help/accessibility"),a(p,"class","svelte-1eaiwge"),a(h,"class","footer-nav__item"),a(g,"href","/cookies"),a(g,"class","svelte-1eaiwge"),a(v,"class","footer-nav__item"),a(N,"href","/help/privacynotice"),a(N,"class","svelte-1eaiwge"),a(M,"class","footer-nav__item"),a(S,"href","/help/termsandconditions"),a(S,"class","svelte-1eaiwge"),a(O,"class","footer-nav__item"),a(u,"class","footer-nav__list"),a(t,"class","col col--lg-one-third col--md-one-third"),a(V,"class","footer-nav__heading"),a(ae,"href","/aboutus/whatwedo"),a(ae,"class","svelte-1eaiwge"),a(re,"class","footer-nav__item"),a(te,"href","/aboutus/careers"),a(te,"class","svelte-1eaiwge"),a(x,"class","footer-nav__item"),a(be,"href","/aboutus/contactus"),a(be,"class","svelte-1eaiwge"),a(ue,"class","footer-nav__item"),a(me,"href","/news"),a(me,"class","svelte-1eaiwge"),a(ve,"class","footer-nav__item"),a(Ve,"href","/aboutus/transparencyandgovernance/freedomofinformationfoi"),a(Ve,"class","svelte-1eaiwge"),a(qe,"class","footer-nav__item"),a(K,"class","footer-nav__list"),a(W,"class","col col--lg-one-third col--md-one-third"),a(Ie,"class","footer-nav__heading"),a(Ce,"href","https://twitter.com/ONS"),a(Ce,"class","icon--hide svelte-1eaiwge"),a(Ce,"target","_blank"),a(le,"class","footer-nav__item"),a(T,"href","https://www.instagram.com/officefornationalstatistics/"),a(T,"class","icon--hide svelte-1eaiwge"),a(T,"target","_blank"),a(q,"class","footer-nav__item"),a(Me,"href","https://www.facebook.com/ONS"),a(Me,"class","icon--hide svelte-1eaiwge"),a(Me,"target","_blank"),a(We,"class","footer-nav__item"),a(De,"href","https://www.linkedin.com/company/office-for-national-statistics"),a(De,"class","icon--hide svelte-1eaiwge"),a(De,"target","_blank"),a(Ne,"class","footer-nav__item"),a(Se,"href","https://consultations.ons.gov.uk/"),a(Se,"class","icon--hide svelte-1eaiwge"),a(Se,"target","_blank"),a(Ke,"class","footer-nav__item"),a(He,"href","https://www.statsusernet.org.uk/login"),a(He,"class","icon--hide svelte-1eaiwge"),a(He,"target","_blank"),a(Qe,"class","footer-nav__item"),a(Ze,"href","https://public.govdelivery.com/accounts/UKONS/subscribers/new"),a(Ze,"class","icon--hide svelte-1eaiwge"),a(Ze,"target","_blank"),a(Pe,"class","footer-nav__item"),a(ee,"class","footer-nav__list"),a(Ae,"class","col col--lg-one-third col--md-one-third"),a(e,"class","footer-nav col-wrap"),a(ka,"class","ons-footer__hr")},m(Xe,je){B(Xe,e,je),l(e,t),l(t,n),l(n,i),l(t,d),l(t,u),l(u,h),l(h,p),l(p,b),l(u,m),l(u,v),l(v,g),l(g,k),l(u,A),l(u,M),l(M,N),l(N,D),l(u,Y),l(u,O),l(O,S),l(S,$),l(e,Q),l(e,W),l(W,V),l(V,R),l(W,_e),l(W,K),l(K,re),l(re,ae),l(ae,X),l(K,z),l(K,x),l(x,te),l(te,I),l(K,se),l(K,ue),l(ue,be),l(be,Oe),l(K,fe),l(K,ve),l(ve,me),l(me,ye),l(K,pe),l(K,qe),l(qe,Ve),l(Ve,la),l(e,sa),l(e,Ae),l(Ae,Ie),l(Ie,Te),l(Ae,ne),l(Ae,ee),l(ee,le),l(le,Ce),l(Ce,ge),l(ee,E),l(ee,q),l(q,T),l(T,ra),l(ee,na),l(ee,We),l(We,Me),l(Me,oa),l(ee,ea),l(ee,Ne),l(Ne,De),l(De,ia),l(ee,ca),l(ee,Ke),l(Ke,Se),l(Se,ha),l(ee,ua),l(ee,Qe),l(Qe,He),l(He,$e),l(ee,da),l(ee,Pe),l(Pe,Ze),l(Ze,Pa),B(Xe,Va,je),B(Xe,ka,je)},p:_a,d(Xe){Xe&&(r(e),r(Va),r(ka))}}}function et(s){let e,t,n,o=s[5]("Accessibility")+"",i,d,u,h,p=s[5]("Cookies")+"",y,b,m,v,g=s[5]("Privacy")+"",w,k,A,M,N=s[5]("Terms and conditions")+"",H;return{c(){e=f("ul"),t=f("li"),n=f("a"),i=P(o),d=C(),u=f("li"),h=f("a"),y=P(p),b=C(),m=f("li"),v=f("a"),w=P(g),k=C(),A=f("li"),M=f("a"),H=P(N),this.h()},l(D){e=_(D,"UL",{class:!0});var Y=c(e);t=_(Y,"LI",{class:!0});var O=c(t);n=_(O,"A",{href:!0,class:!0});var S=c(n);i=Z(S,o),S.forEach(r),O.forEach(r),d=L(Y),u=_(Y,"LI",{class:!0});var F=c(u);h=_(F,"A",{href:!0,class:!0});var $=c(h);y=Z($,p),$.forEach(r),F.forEach(r),b=L(Y),m=_(Y,"LI",{class:!0});var Q=c(m);v=_(Q,"A",{href:!0,class:!0});var W=c(v);w=Z(W,g),W.forEach(r),Q.forEach(r),k=L(Y),A=_(Y,"LI",{class:!0});var V=c(A);M=_(V,"A",{href:!0,class:!0});var U=c(M);H=Z(U,N),U.forEach(r),V.forEach(r),Y.forEach(r),this.h()},h(){a(n,"href","/help/accessibility"),a(n,"class","ons-list__link svelte-1eaiwge"),a(t,"class","ons-list__item"),a(h,"href","/cookies"),a(h,"class","ons-list__link svelte-1eaiwge"),a(u,"class","ons-list__item"),a(v,"href","/help/privacynotice"),a(v,"class","ons-list__link svelte-1eaiwge"),a(m,"class","ons-list__item"),a(M,"href","/help/termsandconditions"),a(M,"class","ons-list__link svelte-1eaiwge"),a(A,"class","ons-list__item"),a(e,"class","ons-list ons-u-mt-m ons-footer--rows ons-list--bare ons-list--inline")},m(D,Y){B(D,e,Y),l(e,t),l(t,n),l(n,i),l(e,d),l(e,u),l(u,h),l(h,y),l(e,b),l(e,m),l(m,v),l(v,w),l(e,k),l(e,A),l(A,M),l(M,H)},p:_a,d(D){D&&r(e)}}}function at(s){let e,t,n,o,i=s[5]("Footer links")+"",d,u,h,p,y,b,m,v,g,w,k,A,M=s[5]("All content is available under the")+"",N,H,D,Y=s[5]("Open Government Licence v3.0")+"",O,S,F='',$,Q,W=s[5]("except where otherwise stated")+"",V,U,R,_e,K,re,ae,oe;const X=s[8].before,z=Na(X,s,s[9],El);function x(I,se){return I[0]?et:xl}let te=x(s),J=te(s);return{c(){e=f("footer"),t=f("section"),z&&z.c(),n=C(),o=f("h2"),d=P(i),u=C(),h=f("div"),p=f("div"),y=f("nav"),J.c(),b=C(),m=f("div"),v=f("div"),g=j("svg"),w=j("path"),k=C(),A=f("p"),N=P(M),H=C(),D=f("a"),O=P(Y),S=f("span"),S.innerHTML=F,Q=P(" , "),V=P(W),U=C(),R=f("div"),_e=C(),K=f("div"),re=C(),ae=f("div"),this.h()},l(I){e=_(I,"FOOTER",{class:!0});var se=c(e);t=_(se,"SECTION",{});var ue=c(t);z&&z.l(ue),n=L(ue),o=_(ue,"H2",{class:!0});var be=c(o);d=Z(be,i),be.forEach(r),u=L(ue),h=_(ue,"DIV",{class:!0});var de=c(h);p=_(de,"DIV",{class:!0});var Oe=c(p);y=_(Oe,"NAV",{"aria-label":!0});var fe=c(y);J.l(fe),fe.forEach(r),Oe.forEach(r),b=L(de),m=_(de,"DIV",{class:!0});var ve=c(m);v=_(ve,"DIV",{class:!0});var me=c(v);g=G(me,"svg",{class:!0,xmlns:!0,width:!0,height:!0,viewBox:!0,focusable:!0,"aria-hidden":!0});var ze=c(g);w=G(ze,"path",{d:!0,fill:!0}),c(w).forEach(r),ze.forEach(r),k=L(me),A=_(me,"P",{class:!0});var ye=c(A);N=Z(ye,M),H=L(ye),D=_(ye,"A",{class:!0,href:!0,target:!0});var pe=c(D);O=Z(pe,Y),S=_(pe,"SPAN",{class:!0,"data-svelte-h":!0}),pa(S)!=="svelte-15le0dr"&&(S.innerHTML=F),pe.forEach(r),Q=Z(ye," , "),V=Z(ye,W),ye.forEach(r),me.forEach(r),ve.forEach(r),de.forEach(r),ue.forEach(r),U=L(se),R=_(se,"DIV",{id:!0,class:!0}),c(R).forEach(r),_e=L(se),K=_(se,"DIV",{id:!0,class:!0}),c(K).forEach(r),re=L(se),ae=_(se,"DIV",{id:!0,class:!0}),c(ae).forEach(r),se.forEach(r),this.h()},h(){a(o,"class","visuallyhidden"),a(y,"aria-label","Footer links"),a(p,"class","wrapper"),a(w,"d",`M51.7,17.5V0l-6.2,4v19.8h13.8v-6.2H51.7z +import{s as ma,r as Na,f,g as _,h as c,d as r,j as a,k as La,i as B,u as Da,v as Sa,w as Ha,x as Ba,y as Zl,o as Za,a as C,l as P,z as j,c as L,m as Z,A as G,B as pa,C as l,D as _a,e as va,E as Ma,n as xe,F as ke,G as Oa,H as wl,I as Ta,J as jl,K as Gl,L as Yl}from"../chunks/scheduler.452d2f96.js";import{S as ga,i as ba,a as ce,t as he,b as Ye,d as Fe,m as Ue,e as Re,g as Ol,c as Tl}from"../chunks/index.bed91369.js";import{b as Fl}from"../chunks/paths.e0228478.js";import{T as $l,e as fa,A as Ul,a as Rl,t as zl}from"../chunks/Table.svelte_svelte_type_style_lang.9e187c59.js";const ql=!0,Wl="always",Zt=Object.freeze(Object.defineProperty({__proto__:null,prerender:ql,trailingSlash:Wl},Symbol.toStringTag,{value:"Module"}));function Kl(s){let e,t;const n=s[1].default,o=Na(n,s,s[0],null);return{c(){e=f("main"),o&&o.c(),this.h()},l(i){e=_(i,"MAIN",{id:!0,tabindex:!0,style:!0});var d=c(e);o&&o.l(d),d.forEach(r),this.h()},h(){a(e,"id","main"),a(e,"tabindex","-1"),La(e,"display","block")},m(i,d){B(i,e,d),o&&o.m(e,null),t=!0},p(i,[d]){o&&o.p&&(!t||d&1)&&Da(o,n,i,i[0],t?Ha(n,i[0],d,null):Sa(i[0]),null)},i(i){t||(ce(o,i),t=!0)},o(i){he(o,i),t=!1},d(i){i&&r(e),o&&o.d(i)}}}function Jl(s,e,t){let{$$slots:n={},$$scope:o}=e;return s.$$set=i=>{"$$scope"in i&&t(0,o=i.$$scope)},[o,n]}class Ql extends ga{constructor(e){super(),ba(this,e,Jl,Kl,ma,{})}}const Xl=s=>({}),El=s=>({});function xl(s){let e,t,n,o=s[5]("Help")+"",i,d,u,h,p,y=s[5]("Accessibility")+"",b,m,v,g,w=s[5]("Cookies")+"",k,A,M,N,H=s[5]("Privacy")+"",D,Y,O,S,F=s[5]("Terms and conditions")+"",$,Q,W,V,U=s[5]("About ONS")+"",R,_e,K,re,ae,oe=s[5]("What we do")+"",X,z,x,te,J=s[5]("Careers")+"",I,se,ue,be,de=s[5]("Contact us")+"",Oe,fe,ve,me,ze=s[5]("News")+"",ye,pe,qe,Ve,ie=s[5]("Freedom of Information")+"",la,sa,Ae,Ie,we=s[5]("Connect with us")+"",Te,ne,ee,le,Ce,ta=s[5]("Twitter")+"",ge,E,q,T,Le=s[5]("Instagram")+"",ra,na,We,Me,ya=s[5]("Facebook")+"",oa,ea,Ne,De,wa=s[5]("LinkedIn")+"",ia,ca,Ke,Se,Je=s[5]("Consultations")+"",ha,ua,Qe,He,Ea=s[5]("Discussion forums")+"",$e,da,Pe,Ze,Be=s[5]("Email alerts")+"",Pa,Va,ka;return{c(){e=f("div"),t=f("div"),n=f("h2"),i=P(o),d=C(),u=f("ul"),h=f("li"),p=f("a"),b=P(y),m=C(),v=f("li"),g=f("a"),k=P(w),A=C(),M=f("li"),N=f("a"),D=P(H),Y=C(),O=f("li"),S=f("a"),$=P(F),Q=C(),W=f("div"),V=f("h2"),R=P(U),_e=C(),K=f("ul"),re=f("li"),ae=f("a"),X=P(oe),z=C(),x=f("li"),te=f("a"),I=P(J),se=C(),ue=f("li"),be=f("a"),Oe=P(de),fe=C(),ve=f("li"),me=f("a"),ye=P(ze),pe=C(),qe=f("li"),Ve=f("a"),la=P(ie),sa=C(),Ae=f("div"),Ie=f("h2"),Te=P(we),ne=C(),ee=f("ul"),le=f("li"),Ce=f("a"),ge=P(ta),E=C(),q=f("li"),T=f("a"),ra=P(Le),na=C(),We=f("li"),Me=f("a"),oa=P(ya),ea=C(),Ne=f("li"),De=f("a"),ia=P(wa),ca=C(),Ke=f("li"),Se=f("a"),ha=P(Je),ua=C(),Qe=f("li"),He=f("a"),$e=P(Ea),da=C(),Pe=f("li"),Ze=f("a"),Pa=P(Be),Va=C(),ka=f("hr"),this.h()},l(Xe){e=_(Xe,"DIV",{class:!0});var je=c(e);t=_(je,"DIV",{class:!0});var Aa=c(t);n=_(Aa,"H2",{class:!0});var ja=c(n);i=Z(ja,o),ja.forEach(r),d=L(Aa),u=_(Aa,"UL",{class:!0});var aa=c(u);h=_(aa,"LI",{class:!0});var Ga=c(h);p=_(Ga,"A",{href:!0,class:!0});var Ya=c(p);b=Z(Ya,y),Ya.forEach(r),Ga.forEach(r),m=L(aa),v=_(aa,"LI",{class:!0});var Fa=c(v);g=_(Fa,"A",{href:!0,class:!0});var Ua=c(g);k=Z(Ua,w),Ua.forEach(r),Fa.forEach(r),A=L(aa),M=_(aa,"LI",{class:!0});var Ra=c(M);N=_(Ra,"A",{href:!0,class:!0});var za=c(N);D=Z(za,H),za.forEach(r),Ra.forEach(r),Y=L(aa),O=_(aa,"LI",{class:!0});var qa=c(O);S=_(qa,"A",{href:!0,class:!0});var Wa=c(S);$=Z(Wa,F),Wa.forEach(r),qa.forEach(r),aa.forEach(r),Aa.forEach(r),Q=L(je),W=_(je,"DIV",{class:!0});var Ia=c(W);V=_(Ia,"H2",{class:!0});var Ka=c(V);R=Z(Ka,U),Ka.forEach(r),_e=L(Ia),K=_(Ia,"UL",{class:!0});var Ge=c(K);re=_(Ge,"LI",{class:!0});var Ja=c(re);ae=_(Ja,"A",{href:!0,class:!0});var Qa=c(ae);X=Z(Qa,oe),Qa.forEach(r),Ja.forEach(r),z=L(Ge),x=_(Ge,"LI",{class:!0});var Xa=c(x);te=_(Xa,"A",{href:!0,class:!0});var xa=c(te);I=Z(xa,J),xa.forEach(r),Xa.forEach(r),se=L(Ge),ue=_(Ge,"LI",{class:!0});var el=c(ue);be=_(el,"A",{href:!0,class:!0});var al=c(be);Oe=Z(al,de),al.forEach(r),el.forEach(r),fe=L(Ge),ve=_(Ge,"LI",{class:!0});var ll=c(ve);me=_(ll,"A",{href:!0,class:!0});var tl=c(me);ye=Z(tl,ze),tl.forEach(r),ll.forEach(r),pe=L(Ge),qe=_(Ge,"LI",{class:!0});var sl=c(qe);Ve=_(sl,"A",{href:!0,class:!0});var rl=c(Ve);la=Z(rl,ie),rl.forEach(r),sl.forEach(r),Ge.forEach(r),Ia.forEach(r),sa=L(je),Ae=_(je,"DIV",{class:!0});var Ca=c(Ae);Ie=_(Ca,"H2",{class:!0});var nl=c(Ie);Te=Z(nl,we),nl.forEach(r),ne=L(Ca),ee=_(Ca,"UL",{class:!0});var Ee=c(ee);le=_(Ee,"LI",{class:!0});var ol=c(le);Ce=_(ol,"A",{href:!0,class:!0,target:!0});var il=c(Ce);ge=Z(il,ta),il.forEach(r),ol.forEach(r),E=L(Ee),q=_(Ee,"LI",{class:!0});var cl=c(q);T=_(cl,"A",{href:!0,class:!0,target:!0});var hl=c(T);ra=Z(hl,Le),hl.forEach(r),cl.forEach(r),na=L(Ee),We=_(Ee,"LI",{class:!0});var ul=c(We);Me=_(ul,"A",{href:!0,class:!0,target:!0});var dl=c(Me);oa=Z(dl,ya),dl.forEach(r),ul.forEach(r),ea=L(Ee),Ne=_(Ee,"LI",{class:!0});var fl=c(Ne);De=_(fl,"A",{href:!0,class:!0,target:!0});var _l=c(De);ia=Z(_l,wa),_l.forEach(r),fl.forEach(r),ca=L(Ee),Ke=_(Ee,"LI",{class:!0});var vl=c(Ke);Se=_(vl,"A",{href:!0,class:!0,target:!0});var ml=c(Se);ha=Z(ml,Je),ml.forEach(r),vl.forEach(r),ua=L(Ee),Qe=_(Ee,"LI",{class:!0});var pl=c(Qe);He=_(pl,"A",{href:!0,class:!0,target:!0});var gl=c(He);$e=Z(gl,Ea),gl.forEach(r),pl.forEach(r),da=L(Ee),Pe=_(Ee,"LI",{class:!0});var bl=c(Pe);Ze=_(bl,"A",{href:!0,class:!0,target:!0});var yl=c(Ze);Pa=Z(yl,Be),yl.forEach(r),bl.forEach(r),Ee.forEach(r),Ca.forEach(r),je.forEach(r),Va=L(Xe),ka=_(Xe,"HR",{class:!0}),this.h()},h(){a(n,"class","footer-nav__heading"),a(p,"href","/help/accessibility"),a(p,"class","svelte-1eaiwge"),a(h,"class","footer-nav__item"),a(g,"href","/cookies"),a(g,"class","svelte-1eaiwge"),a(v,"class","footer-nav__item"),a(N,"href","/help/privacynotice"),a(N,"class","svelte-1eaiwge"),a(M,"class","footer-nav__item"),a(S,"href","/help/termsandconditions"),a(S,"class","svelte-1eaiwge"),a(O,"class","footer-nav__item"),a(u,"class","footer-nav__list"),a(t,"class","col col--lg-one-third col--md-one-third"),a(V,"class","footer-nav__heading"),a(ae,"href","/aboutus/whatwedo"),a(ae,"class","svelte-1eaiwge"),a(re,"class","footer-nav__item"),a(te,"href","/aboutus/careers"),a(te,"class","svelte-1eaiwge"),a(x,"class","footer-nav__item"),a(be,"href","/aboutus/contactus"),a(be,"class","svelte-1eaiwge"),a(ue,"class","footer-nav__item"),a(me,"href","/news"),a(me,"class","svelte-1eaiwge"),a(ve,"class","footer-nav__item"),a(Ve,"href","/aboutus/transparencyandgovernance/freedomofinformationfoi"),a(Ve,"class","svelte-1eaiwge"),a(qe,"class","footer-nav__item"),a(K,"class","footer-nav__list"),a(W,"class","col col--lg-one-third col--md-one-third"),a(Ie,"class","footer-nav__heading"),a(Ce,"href","https://twitter.com/ONS"),a(Ce,"class","icon--hide svelte-1eaiwge"),a(Ce,"target","_blank"),a(le,"class","footer-nav__item"),a(T,"href","https://www.instagram.com/officefornationalstatistics/"),a(T,"class","icon--hide svelte-1eaiwge"),a(T,"target","_blank"),a(q,"class","footer-nav__item"),a(Me,"href","https://www.facebook.com/ONS"),a(Me,"class","icon--hide svelte-1eaiwge"),a(Me,"target","_blank"),a(We,"class","footer-nav__item"),a(De,"href","https://www.linkedin.com/company/office-for-national-statistics"),a(De,"class","icon--hide svelte-1eaiwge"),a(De,"target","_blank"),a(Ne,"class","footer-nav__item"),a(Se,"href","https://consultations.ons.gov.uk/"),a(Se,"class","icon--hide svelte-1eaiwge"),a(Se,"target","_blank"),a(Ke,"class","footer-nav__item"),a(He,"href","https://www.statsusernet.org.uk/login"),a(He,"class","icon--hide svelte-1eaiwge"),a(He,"target","_blank"),a(Qe,"class","footer-nav__item"),a(Ze,"href","https://public.govdelivery.com/accounts/UKONS/subscribers/new"),a(Ze,"class","icon--hide svelte-1eaiwge"),a(Ze,"target","_blank"),a(Pe,"class","footer-nav__item"),a(ee,"class","footer-nav__list"),a(Ae,"class","col col--lg-one-third col--md-one-third"),a(e,"class","footer-nav col-wrap"),a(ka,"class","ons-footer__hr")},m(Xe,je){B(Xe,e,je),l(e,t),l(t,n),l(n,i),l(t,d),l(t,u),l(u,h),l(h,p),l(p,b),l(u,m),l(u,v),l(v,g),l(g,k),l(u,A),l(u,M),l(M,N),l(N,D),l(u,Y),l(u,O),l(O,S),l(S,$),l(e,Q),l(e,W),l(W,V),l(V,R),l(W,_e),l(W,K),l(K,re),l(re,ae),l(ae,X),l(K,z),l(K,x),l(x,te),l(te,I),l(K,se),l(K,ue),l(ue,be),l(be,Oe),l(K,fe),l(K,ve),l(ve,me),l(me,ye),l(K,pe),l(K,qe),l(qe,Ve),l(Ve,la),l(e,sa),l(e,Ae),l(Ae,Ie),l(Ie,Te),l(Ae,ne),l(Ae,ee),l(ee,le),l(le,Ce),l(Ce,ge),l(ee,E),l(ee,q),l(q,T),l(T,ra),l(ee,na),l(ee,We),l(We,Me),l(Me,oa),l(ee,ea),l(ee,Ne),l(Ne,De),l(De,ia),l(ee,ca),l(ee,Ke),l(Ke,Se),l(Se,ha),l(ee,ua),l(ee,Qe),l(Qe,He),l(He,$e),l(ee,da),l(ee,Pe),l(Pe,Ze),l(Ze,Pa),B(Xe,Va,je),B(Xe,ka,je)},p:_a,d(Xe){Xe&&(r(e),r(Va),r(ka))}}}function et(s){let e,t,n,o=s[5]("Accessibility")+"",i,d,u,h,p=s[5]("Cookies")+"",y,b,m,v,g=s[5]("Privacy")+"",w,k,A,M,N=s[5]("Terms and conditions")+"",H;return{c(){e=f("ul"),t=f("li"),n=f("a"),i=P(o),d=C(),u=f("li"),h=f("a"),y=P(p),b=C(),m=f("li"),v=f("a"),w=P(g),k=C(),A=f("li"),M=f("a"),H=P(N),this.h()},l(D){e=_(D,"UL",{class:!0});var Y=c(e);t=_(Y,"LI",{class:!0});var O=c(t);n=_(O,"A",{href:!0,class:!0});var S=c(n);i=Z(S,o),S.forEach(r),O.forEach(r),d=L(Y),u=_(Y,"LI",{class:!0});var F=c(u);h=_(F,"A",{href:!0,class:!0});var $=c(h);y=Z($,p),$.forEach(r),F.forEach(r),b=L(Y),m=_(Y,"LI",{class:!0});var Q=c(m);v=_(Q,"A",{href:!0,class:!0});var W=c(v);w=Z(W,g),W.forEach(r),Q.forEach(r),k=L(Y),A=_(Y,"LI",{class:!0});var V=c(A);M=_(V,"A",{href:!0,class:!0});var U=c(M);H=Z(U,N),U.forEach(r),V.forEach(r),Y.forEach(r),this.h()},h(){a(n,"href","/help/accessibility"),a(n,"class","ons-list__link svelte-1eaiwge"),a(t,"class","ons-list__item"),a(h,"href","/cookies"),a(h,"class","ons-list__link svelte-1eaiwge"),a(u,"class","ons-list__item"),a(v,"href","/help/privacynotice"),a(v,"class","ons-list__link svelte-1eaiwge"),a(m,"class","ons-list__item"),a(M,"href","/help/termsandconditions"),a(M,"class","ons-list__link svelte-1eaiwge"),a(A,"class","ons-list__item"),a(e,"class","ons-list ons-u-mt-m ons-footer--rows ons-list--bare ons-list--inline")},m(D,Y){B(D,e,Y),l(e,t),l(t,n),l(n,i),l(e,d),l(e,u),l(u,h),l(h,y),l(e,b),l(e,m),l(m,v),l(v,w),l(e,k),l(e,A),l(A,M),l(M,H)},p:_a,d(D){D&&r(e)}}}function at(s){let e,t,n,o,i=s[5]("Footer links")+"",d,u,h,p,y,b,m,v,g,w,k,A,M=s[5]("All content is available under the")+"",N,H,D,Y=s[5]("Open Government Licence v3.0")+"",O,S,F='',$,Q,W=s[5]("except where otherwise stated")+"",V,U,R,_e,K,re,ae,oe;const X=s[8].before,z=Na(X,s,s[9],El);function x(I,se){return I[0]?et:xl}let te=x(s),J=te(s);return{c(){e=f("footer"),t=f("section"),z&&z.c(),n=C(),o=f("h2"),d=P(i),u=C(),h=f("div"),p=f("div"),y=f("nav"),J.c(),b=C(),m=f("div"),v=f("div"),g=j("svg"),w=j("path"),k=C(),A=f("p"),N=P(M),H=C(),D=f("a"),O=P(Y),S=f("span"),S.innerHTML=F,Q=P(" , "),V=P(W),U=C(),R=f("div"),_e=C(),K=f("div"),re=C(),ae=f("div"),this.h()},l(I){e=_(I,"FOOTER",{class:!0});var se=c(e);t=_(se,"SECTION",{});var ue=c(t);z&&z.l(ue),n=L(ue),o=_(ue,"H2",{class:!0});var be=c(o);d=Z(be,i),be.forEach(r),u=L(ue),h=_(ue,"DIV",{class:!0});var de=c(h);p=_(de,"DIV",{class:!0});var Oe=c(p);y=_(Oe,"NAV",{"aria-label":!0});var fe=c(y);J.l(fe),fe.forEach(r),Oe.forEach(r),b=L(de),m=_(de,"DIV",{class:!0});var ve=c(m);v=_(ve,"DIV",{class:!0});var me=c(v);g=G(me,"svg",{class:!0,xmlns:!0,width:!0,height:!0,viewBox:!0,focusable:!0,"aria-hidden":!0});var ze=c(g);w=G(ze,"path",{d:!0,fill:!0}),c(w).forEach(r),ze.forEach(r),k=L(me),A=_(me,"P",{class:!0});var ye=c(A);N=Z(ye,M),H=L(ye),D=_(ye,"A",{class:!0,href:!0,target:!0});var pe=c(D);O=Z(pe,Y),S=_(pe,"SPAN",{class:!0,"data-svelte-h":!0}),pa(S)!=="svelte-15le0dr"&&(S.innerHTML=F),pe.forEach(r),Q=Z(ye," , "),V=Z(ye,W),ye.forEach(r),me.forEach(r),ve.forEach(r),de.forEach(r),ue.forEach(r),U=L(se),R=_(se,"DIV",{id:!0,class:!0}),c(R).forEach(r),_e=L(se),K=_(se,"DIV",{id:!0,class:!0}),c(K).forEach(r),re=L(se),ae=_(se,"DIV",{id:!0,class:!0}),c(ae).forEach(r),se.forEach(r),this.h()},h(){a(o,"class","visuallyhidden"),a(y,"aria-label","Footer links"),a(p,"class","wrapper"),a(w,"d",`M51.7,17.5V0l-6.2,4v19.8h13.8v-6.2H51.7z M36.7,16.3c-1,0.9-2.4,1.4-3.8,1.4c-3.2,0-5.8-2.6-5.8-5.8s2.6-5.8,5.8-5.8c2,0,3.9,1.1,4.9,2.7L43,5.6C40.9,2.2,37.1,0,32.9,0c-4.5,0-8.4,2.5-10.4,6.1C20.4,2.5,16.5,0,12,0C5.4,0,0,5.4,0,12s5.4,12,12,12c4.5,0,8.4-2.5,10.4-6.1c2.1,3.6,6,6.1,10.4,6.1c3,0,5.8-1.1,7.9-3l2.4,2.7h0.4V13h-9.8L36.7,16.3zM12,17.8c-3.2,0-5.8-2.6-5.8-5.8S8.8,6.2,12,6.2s5.8,2.6,5.8,5.8S15.2,17.8,12,17.8`),a(w,"fill","currentColor"),a(g,"class","ons-footer__ogl-img svelte-1eaiwge"),a(g,"xmlns","http://www.w3.org/2000/svg"),a(g,"width","60px"),a(g,"height","24px"),a(g,"viewBox","0 0 60 24"),a(g,"focusable","false"),a(g,"aria-hidden","true"),a(S,"class","ons-external-link__icon"),a(D,"class","ons-external-link svelte-1eaiwge"),a(D,"href",$="http://www.nationalarchives.gov.uk/doc/open-government-licence"+(s[3]==="cy"?"-cymraeg":"")+"/version/3/"),a(D,"target","_blank"),a(A,"class","footer-license__text margin-left-sm--0"),a(v,"class","footer-license"),a(m,"class","wrapper"),a(h,"class","footer svelte-1eaiwge"),a(R,"id","viewport-sm"),a(R,"class","js-viewport-size"),a(K,"id","viewport-md"),a(K,"class","js-viewport-size"),a(ae,"id","viewport-lg"),a(ae,"class","js-viewport-size"),a(e,"class","print--hide padding-top--13")},m(I,se){B(I,e,se),l(e,t),z&&z.m(t,null),l(t,n),l(t,o),l(o,d),l(t,u),l(t,h),l(h,p),l(p,y),J.m(y,null),l(h,b),l(h,m),l(m,v),l(v,g),l(g,w),l(v,k),l(v,A),l(A,N),l(A,H),l(A,D),l(D,O),l(D,S),l(A,Q),l(A,V),l(e,U),l(e,R),l(e,_e),l(e,K),l(e,re),l(e,ae),oe=!0},p(I,se){z&&z.p&&(!oe||se&512)&&Da(z,X,I,I[9],oe?Ha(X,I[9],se,Xl):Sa(I[9]),El),te===(te=x(I))&&J?J.p(I,se):(J.d(1),J=te(I),J&&(J.c(),J.m(y,null))),(!oe||se&8&&$!==($="http://www.nationalarchives.gov.uk/doc/open-government-licence"+(I[3]==="cy"?"-cymraeg":"")+"/version/3/"))&&a(D,"href",$)},i(I){oe||(ce(z,I),oe=!0)},o(I){he(z,I),oe=!1},d(I){I&&r(e),z&&z.d(I),J.d()}}}function lt(s){let e,t;return e=new $l({props:{theme:s[1],overrides:s[2],background:"none",$$slots:{default:[at]},$$scope:{ctx:s}}}),{c(){Ye(e.$$.fragment)},l(n){Fe(e.$$.fragment,n)},m(n,o){Ue(e,n,o),t=!0},p(n,[o]){const i={};o&2&&(i.theme=n[1]),o&4&&(i.overrides=n[2]),o&521&&(i.$$scope={dirty:o,ctx:n}),e.$set(i)},i(n){t||(ce(e.$$.fragment,n),t=!0)},o(n){he(e.$$.fragment,n),t=!1},d(n){Re(e,n)}}}function tt(s,e,t){let n,{$$slots:o={},$$scope:i}=e;const d=Ba("page");Zl(s,d,k=>t(7,n=k));let{compact:u=!1}=e,{theme:h=null}=e,{themeOverrides:p=null}=e,y="en",b="",m=!1;function v(k,A){if(k){const M=(A==null?void 0:A.url)||document.location;t(3,y=M.host.startsWith("cy")?"cy":"en"),`${M.host}`,b=M.pathname}}Za(()=>t(6,m=!0));const g={"Footer links":"",Help:"Cymorth",Accessibility:"Hygyrchedd",Cookies:"Cwcis",Privacy:"Preifatrwydd","Terms and conditions":"Telerau ac amodau","About ONS":"Ynglŷn ag SYG","What we do":"Beth rydym yn ei wneud",Careers:"Gyrfaoedd","Contact us":"Cysylltu â ni",News:"Newyddion","Freedom of Information":"Rhyddid Gwybodaeth","Connect with us":"Cysylltu â ni",Consultations:"Ymgynghoriadau","Discussion forums":"Fforymau trafod","Email alerts":"Rhybuddion ebost","All content is available under the":"Mae'r holl gynnwys ar gael o dan delerau'r","Open Government Licence v3.0":"Drwydded Llywodraeth Agored v3.0","except where otherwise stated":"ac eithrio lle y nodir fel arall"},w=k=>y=="cy"&&g[k]?g[k]:k;return Za(()=>{if(!b){const k=document.location;t(3,y=k.host.startsWith("cy")?"cy":"en"),`${k.host}`,b=k.pathname}}),s.$$set=k=>{"compact"in k&&t(0,u=k.compact),"theme"in k&&t(1,h=k.theme),"themeOverrides"in k&&t(2,p=k.themeOverrides),"$$scope"in k&&t(9,i=k.$$scope)},s.$$.update=()=>{s.$$.dirty&192&&v(m,n)},[u,h,p,y,d,w,m,n,o,i]}class st extends ga{constructor(e){super(),ba(this,e,tt,lt,ma,{compact:0,theme:1,themeOverrides:2})}}function rt(s){let e,t,n,o,i,d,u,h,p,y;return{c(){e=j("svg"),t=j("title"),n=P("Office for National Statistics logo"),o=j("g"),i=j("path"),d=j("g"),u=j("path"),h=j("g"),p=j("path"),this.h()},l(b){e=G(b,"svg",{class:!0,xmlns:!0,width:!0,height:!0,viewBox:!0,"aria-labelledby":!0});var m=c(e);t=G(m,"title",{id:!0});var v=c(t);n=Z(v,"Office for National Statistics logo"),v.forEach(r),o=G(m,"g",{class:!0,fill:!0});var g=c(o);i=G(g,"path",{d:!0}),c(i).forEach(r),g.forEach(r),d=G(m,"g",{class:!0,fill:!0});var w=c(d);u=G(w,"path",{d:!0}),c(u).forEach(r),w.forEach(r),h=G(m,"g",{class:!0,fill:!0});var k=c(h);p=G(k,"path",{d:!0}),c(p).forEach(r),k.forEach(r),m.forEach(r),this.h()},h(){a(t,"id","ons-logo-stacked-en-alt"),a(i,"d","M0,70.5c1.8-3.7,3.6-7.2,5.6-10.7A127.94,127.94,0,0,1,0,42.6V70.5M10.9,0S0,0,0,13.5v7.2A128.06,128.06,0,0,0,7.9,56.2a114.75,114.75,0,0,1,22.3-26C47.8,15.1,71.5,4.7,103.7.1Z"),a(o,"class","ons-svg-logo__group ons-svg-logo__group--secondary"),a(o,"fill",Bl),a(u,"d","M115.9,7.3c-36.8,3.5-62,14-80,29.4a108.15,108.15,0,0,0-23.6,29c14.1,27.4,41.1,47.6,86,50.5h4.4s13.8.5,13.8-14.9V7.2l-.6.1M21.2,85.4a92.68,92.68,0,0,1-11-16A173,173,0,0,0,0,93.4v22.7l73.6.1c-22.9-5.5-40.1-16.4-52.4-30.8"),a(d,"class","ons-svg-logo__group ons-svg-logo__group--primary"),a(d,"fill",s[4]),a(p,"d","M161,51.9c-11.3,0-16.3-9.3-16.3-20.8s5-20.8,16.3-20.8,16.3,9.5,16.3,20.8c-.1,11.5-5.1,20.8-16.3,20.8m0-38.3c-8.3,0-11.3,9.1-11.3,17.4s2.7,17.3,11.3,17.3,11.2-9.1,11.2-17.3S169.3,13.6,161,13.6m30.2,8.9V51.2h-4.5V22.6H182V19.8h4.7V15.2c0-5.7,3.4-9.9,10-9.9a8,8,0,0,1,1.1.1V8.3h-.5c-3.2,0-6,2.1-6,6.4v5.1h6.6v2.8l-6.7-.1Zm18.9,0V51.2h-4.5V22.6h-4.7V19.8h4.7V15.2c0-5.7,3.4-9.9,10-9.9a8,8,0,0,1,1.1.1V8.3h-.5c-3.2,0-6,2.1-6,6.4v5.1h6.6v2.8l-6.7-.1Zm14-8.8a2.82,2.82,0,0,1-2.9-2.8,2.9,2.9,0,0,1,5.8,0,2.76,2.76,0,0,1-2.9,2.8m-2.3,6h4.6V51.2h-4.6Zm24.3,32.2c-7.4,0-13.2-6.4-13.2-16.5,0-10.3,5.8-16.5,13.4-16.5a12.36,12.36,0,0,1,7.7,2.2l-1.2,2.8a8.92,8.92,0,0,0-5.5-1.7c-6.4,0-9.7,5.5-9.7,13,0,7.7,3.7,13.2,9.5,13.2a9.8,9.8,0,0,0,5.6-1.7l1.2,3c-1.3,1.2-4,2.2-7.8,2.2m15.3-14.6c.6,7.4,4.7,11.1,11.1,11.1a18.36,18.36,0,0,0,8.5-1.9l1.3,3.2a22.58,22.58,0,0,1-10.2,2.1c-8.8,0-15.1-5.3-15.1-16.6,0-10.8,5.8-16.4,13.7-16.4s12.9,4.9,12.9,15.4l-22.2,3.1ZM270.5,22c-5.1,0-9.4,4-9.3,12.8l17.9-2.5C279,25,275.5,22,270.5,22m42.2.5V51.2h-4.5V22.6h-4.7V19.8h4.7V15.2c0-5.7,3.4-9.9,10-9.9a8,8,0,0,1,1.1.1V8.3h-.5c-3.2,0-6,2.1-6,6.4v5.1h6.6v2.8Zm23.2,29.4c-9.3,0-13.5-7.2-13.5-16.5s4.2-16.5,13.5-16.5,13.5,7.2,13.5,16.5-4.2,16.5-13.5,16.5m0-29.8c-6.9,0-8.8,7-8.8,13.4s2.1,13.1,8.8,13.1c6.9,0,8.9-6.6,8.9-13.1s-2-13.4-8.9-13.4m33.3.6c-2.9-.8-7.1-.6-9.1.6V51.2h-4.6V21.1c3.3-1.4,6.6-2.2,12.5-2.2h2.4c0,.1-1.2,3.8-1.2,3.8ZM171.3,114.8,153.5,87.3c-1.3-2.1-2.3-4.1-2.3-4.1h-.1s.2,2.3.2,4.8v26.8h-5.8V74.7h6.6L169,100.5a46.13,46.13,0,0,1,2.4,4.1h.1s-.2-2.3-.2-4.7V74.6h5.9v40.1l-5.9.1Zm25,.8c-9.2,0-13.6-3.7-13.6-9.7,0-8.5,8.8-10.7,19.4-11.7V92.4c0-4.3-2.9-5.6-7.2-5.6a22.34,22.34,0,0,0-8.5,1.8l-1.6-3.8a30.2,30.2,0,0,1,11.3-2.3c7,0,12.3,2.9,12.3,10.9v19.9c-2.7,1.4-6.9,2.3-12.1,2.3m5.8-18.2c-7.8.8-13,2.3-13,8.3,0,4.2,3,6.1,7.7,6.1a12.33,12.33,0,0,0,5.3-1.1Zm24.5,18.1c-6.6,0-9.1-4.3-9.1-8.5V87.5h-4.4V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2c0,2.5,1.4,4.4,4.3,4.4a5.66,5.66,0,0,0,1.8-.3v4.1a11.47,11.47,0,0,1-3.7.6M239,77.9a3.52,3.52,0,1,1,3.9-3.5,3.71,3.71,0,0,1-3.9,3.5m-3.4,5.5h6.8v31.4h-6.8Zm26.9,32.2c-9.6,0-14.4-7.1-14.4-16.5s4.8-16.6,14.4-16.6,14.3,7.2,14.3,16.6-4.7,16.5-14.3,16.5m0-28.7c-5.8,0-7.5,6.1-7.5,12.2s1.8,11.9,7.5,11.9,7.5-5.8,7.5-11.9-1.7-12.2-7.5-12.2m39.3,27.9V92.3c0-4-3.4-5.5-7.3-5.5a16,16,0,0,0-5.4.9v27.1h-6.7v-30a32.8,32.8,0,0,1,12.5-2.3c8.2,0,13.7,2.8,13.7,9.7v22.6Zm25.7.8c-9.2,0-13.6-3.7-13.6-9.7,0-8.5,8.9-10.7,19.4-11.7V92.4c0-4.3-2.9-5.6-7.2-5.6a22.34,22.34,0,0,0-8.5,1.8L316,84.8a30.2,30.2,0,0,1,11.3-2.3c7,0,12.3,2.9,12.3,10.9v19.9c-2.7,1.4-6.9,2.3-12.1,2.3m5.8-18.2c-7.8.8-13,2.3-13,8.3,0,4.2,3,6.1,7.7,6.1a12.33,12.33,0,0,0,5.3-1.1Zm13.2,17.4V69h6.7v45.8Zm38.6.8a23.94,23.94,0,0,1-10.9-2.3l1.9-4.9a17,17,0,0,0,7.7,1.9c4.7,0,8-2.7,8-6.7,0-8.8-16.7-5.4-16.7-17.9,0-6.4,5.2-11.9,13.3-11.9a20.22,20.22,0,0,1,9.7,2.3l-1.7,4.4a14.57,14.57,0,0,0-7-1.9c-4.3,0-7.2,2.6-7.2,6.4,0,8.6,17.1,4.9,17.1,18.2-.1,7.1-6,12.4-14.2,12.4m31.1-.1c-6.6,0-9.1-4.3-9.1-8.5V87.5h-4.4V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2a4.07,4.07,0,0,0,4.3,4.4,5.66,5.66,0,0,0,1.8-.3v4.1a12.06,12.06,0,0,1-3.7.6m20.9.1c-9.2,0-13.6-3.7-13.6-9.7,0-8.5,8.9-10.7,19.4-11.7V92.4c0-4.3-2.9-5.6-7.2-5.6a22.34,22.34,0,0,0-8.5,1.8l-1.6-3.8a30.2,30.2,0,0,1,11.3-2.3c7,0,12.3,2.9,12.3,10.9v19.9c-2.6,1.4-6.9,2.3-12.1,2.3m5.8-18.2c-7.8.8-13,2.3-13,8.3,0,4.2,3,6.1,7.7,6.1a12.33,12.33,0,0,0,5.3-1.1Zm24.6,18.1c-6.6,0-9.1-4.3-9.1-8.5V87.5H454V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2a4.07,4.07,0,0,0,4.3,4.4,5.66,5.66,0,0,0,1.8-.3v4.1a12.69,12.69,0,0,1-3.7.6m12.3-37.6a3.52,3.52,0,1,1,3.9-3.5,3.65,3.65,0,0,1-3.9,3.5m-3.4,5.5h6.8v31.4h-6.8Zm21.4,32.2a19.46,19.46,0,0,1-9.5-2.3l1.8-4.3a13.21,13.21,0,0,0,6.9,1.9c3.4,0,6.2-2.2,6.2-4.9,0-7.5-13.8-4-13.8-14.2,0-4.7,4.2-9.2,11-9.2a16.21,16.21,0,0,1,8.8,2.3l-1.8,3.9a10.31,10.31,0,0,0-5.7-1.8c-3.5,0-5.6,2.1-5.6,4.5,0,7,14,3.9,14,14.4,0,4.9-4.7,9.7-12.3,9.7m29.4-.1c-6.6,0-9.1-4.3-9.1-8.5V87.5h-4.4V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2c0,2.5,1.4,4.4,4.3,4.4a5.66,5.66,0,0,0,1.8-.3v4.1a12.06,12.06,0,0,1-3.7.6m12.3-37.6a3.52,3.52,0,1,1,3.9-3.5c.1,2-1.7,3.5-3.9,3.5m-3.3,5.5H543v31.4h-6.8Zm26.2,32.2c-7.7,0-13.6-6.3-13.6-16.6s6.1-16.5,13.7-16.5c3.9,0,6.6,1.1,8,2.3L569,88.6a8.61,8.61,0,0,0-4.9-1.5c-5.5,0-8.3,4.7-8.3,11.8s3.3,11.9,8.2,11.9a8.39,8.39,0,0,0,4.9-1.6l1.7,4.1c-1.5,1.2-4.2,2.3-8.2,2.3m20.6,0a19.46,19.46,0,0,1-9.5-2.3l1.8-4.3a13.21,13.21,0,0,0,6.9,1.9c3.4,0,6.2-2.2,6.2-4.9,0-7.5-13.8-4-13.8-14.2,0-4.7,4.2-9.2,11-9.2a16.85,16.85,0,0,1,8.9,2.3l-1.8,3.9A10.31,10.31,0,0,0,587,87c-3.5,0-5.6,2.1-5.6,4.5,0,7,14,3.9,14,14.4-.1,4.9-4.9,9.7-12.4,9.7"),a(h,"class","ons-svg-logo__group ons-svg-logo__group--text"),a(h,"fill",s[4]),a(e,"class",y=Ma(s[1])+" svelte-48r6qe"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width",s[2]),a(e,"height",s[3]),a(e,"viewBox","0 5 595 116"),a(e,"aria-labelledby","ons-logo-stacked-en-alt")},m(b,m){B(b,e,m),l(e,t),l(t,n),l(e,o),l(o,i),l(e,d),l(d,u),l(e,h),l(h,p)},p(b,m){m&16&&a(d,"fill",b[4]),m&16&&a(h,"fill",b[4]),m&2&&y!==(y=Ma(b[1])+" svelte-48r6qe")&&a(e,"class",y),m&4&&a(e,"width",b[2]),m&8&&a(e,"height",b[3])},d(b){b&&r(e)}}}function nt(s){let e,t,n,o,i,d,u,h,p,y,b,m,v,g,w,k,A,M,N,H,D,Y,O,S,F,$,Q,W,V,U,R,_e,K,re,ae,oe;return{c(){e=j("svg"),t=j("title"),n=P("Office for National Statistics logo"),o=j("g"),i=j("path"),d=j("g"),u=j("path"),h=j("g"),p=j("path"),y=j("path"),b=j("path"),m=j("path"),v=j("path"),g=j("path"),w=j("path"),k=j("path"),A=j("path"),M=j("path"),N=j("path"),H=j("path"),D=j("path"),Y=j("path"),O=j("path"),S=j("path"),F=j("polygon"),$=j("path"),Q=j("path"),W=j("path"),V=j("path"),U=j("path"),R=j("path"),_e=j("path"),K=j("path"),re=j("path"),ae=j("path"),this.h()},l(X){e=G(X,"svg",{class:!0,xmlns:!0,width:!0,height:!0,viewBox:!0,"aria-labelledby":!0});var z=c(e);t=G(z,"title",{id:!0});var x=c(t);n=Z(x,"Office for National Statistics logo"),x.forEach(r),o=G(z,"g",{class:!0,fill:!0});var te=c(o);i=G(te,"path",{d:!0}),c(i).forEach(r),te.forEach(r),d=G(z,"g",{class:!0,fill:!0});var J=c(d);u=G(J,"path",{d:!0}),c(u).forEach(r),J.forEach(r),h=G(z,"g",{class:!0,fill:!0});var I=c(h);p=G(I,"path",{d:!0}),c(p).forEach(r),y=G(I,"path",{d:!0}),c(y).forEach(r),b=G(I,"path",{d:!0}),c(b).forEach(r),m=G(I,"path",{d:!0}),c(m).forEach(r),v=G(I,"path",{d:!0}),c(v).forEach(r),g=G(I,"path",{d:!0}),c(g).forEach(r),w=G(I,"path",{d:!0}),c(w).forEach(r),k=G(I,"path",{d:!0}),c(k).forEach(r),A=G(I,"path",{d:!0}),c(A).forEach(r),M=G(I,"path",{d:!0}),c(M).forEach(r),N=G(I,"path",{d:!0}),c(N).forEach(r),H=G(I,"path",{d:!0}),c(H).forEach(r),D=G(I,"path",{d:!0}),c(D).forEach(r),Y=G(I,"path",{d:!0}),c(Y).forEach(r),O=G(I,"path",{d:!0}),c(O).forEach(r),S=G(I,"path",{d:!0}),c(S).forEach(r),F=G(I,"polygon",{points:!0}),c(F).forEach(r),$=G(I,"path",{d:!0}),c($).forEach(r),Q=G(I,"path",{d:!0}),c(Q).forEach(r),W=G(I,"path",{d:!0}),c(W).forEach(r),V=G(I,"path",{d:!0}),c(V).forEach(r),U=G(I,"path",{d:!0}),c(U).forEach(r),R=G(I,"path",{d:!0}),c(R).forEach(r),_e=G(I,"path",{d:!0}),c(_e).forEach(r),K=G(I,"path",{d:!0}),c(K).forEach(r),re=G(I,"path",{d:!0}),c(re).forEach(r),ae=G(I,"path",{d:!0}),c(ae).forEach(r),I.forEach(r),z.forEach(r),this.h()},h(){a(t,"id","ons-logo-en-alt"),a(i,"d","M0,34.6c.8-1.69,1.39-3,2.32-4.6A38.28,38.28,0,0,1,0,23.4V34.6M5,3S0,3,0,9.25v1A62.12,62.12,0,0,0,4.2,27a43.77,43.77,0,0,1,9.42-10.79C21.69,9.21,31.16,5.13,45.9,3Z"),a(o,"class","ons-svg-logo__group ons-svg-logo__group--secondary"),a(o,"fill",Bl),a(u,"d","M53.06,6.42C36.2,8,24.68,12.92,16.43,20.07A41.46,41.46,0,0,0,6.4,32.2C12.87,44.93,28.88,57,46.6,57H47s6.32.21,6.32-6.91V6.36a1.22,1.22,0,0,1-.26.06M9.72,42.67a44.25,44.25,0,0,1-5-7.42A80.59,80.59,0,0,0,0,46.38V56.91L31.06,57c-9.83-3-15.74-7.64-21.34-14.3"),a(d,"class","ons-svg-logo__group ons-svg-logo__group--primary"),a(d,"fill",s[4]),a(p,"d","M82,47.49c-9.07,0-13.13-7.51-13.13-16.77S72.91,14,82,14s13.1,7.61,13.1,16.77S91.1,47.54,82,47.54m0-30.91c-6.69,0-9.07,7.33-9.07,14.05s2.16,13.9,9.07,13.9,9-7.28,9-13.9-2.34-14-9-14"),a(y,"d","M106.36,23.81V46.88h-3.67V23.81H98.93V21.56h3.76V17.9c0-4.61,2.72-7.95,8.08-7.95.38,0,.86.05.86.05v2.35h-.43c-2.55,0-4.84,1.64-4.84,5.12v4.09h5.27v2.25Z"),a(b,"d","M121.53,23.81V46.88h-3.67V23.81H114.1V21.56h3.76V17.9c0-4.61,2.72-7.95,8.08-7.95.38,0,.86.05.86.05v2.35h-.43c-2.55,0-4.84,1.64-4.84,5.12v4.09h5.27v2.25Z"),a(m,"d","M132.85,16.72a2.28,2.28,0,0,1-2.33-2.23v0a2.34,2.34,0,0,1,4.67,0,2.28,2.28,0,0,1-2.3,2.26h0M131,21.56h3.71V46.88H131Z"),a(v,"d","M150.53,47.49c-6,0-10.63-5.16-10.63-13.29S144.52,21,150.66,21a9.76,9.76,0,0,1,6.17,1.74l-1,2.25a7.53,7.53,0,0,0-4.4-1.36c-5.15,0-7.78,4.46-7.78,10.48,0,6.2,3,10.62,7.65,10.62a8,8,0,0,0,4.49-1.37l1,2.45a10.21,10.21,0,0,1-6.3,1.73"),a(g,"d","M162.84,35.75c.48,6,3.76,9,8.9,9a14.66,14.66,0,0,0,6.88-1.55l1.08,2.59a18,18,0,0,1-8.22,1.73c-7.12,0-12.18-4.23-12.18-13.34,0-8.69,4.67-13.2,11-13.2s10.37,3.95,10.37,12.4Zm7.35-12.41c-4.1,0-7.56,3.2-7.52,10.29l14.39-2c0-5.87-2.81-8.32-6.87-8.32"),a(w,"d","M198.57,23.81V46.88H194.9V23.81h-3.76V21.56h3.76V17.9c0-4.61,2.72-7.95,8.08-7.95.39,0,.87.05.87.05v2.35h-.44c-2.54,0-4.84,1.64-4.84,5.12v4.09h5.28v2.25Z"),a(k,"d","M217.28,47.49c-7.47,0-10.89-5.78-10.89-13.24S209.81,21,217.28,21s10.85,5.82,10.85,13.3-3.37,13.24-10.85,13.24m0-24c-5.53,0-7.13,5.59-7.13,10.81s1.73,10.56,7.13,10.56,7.13-5.35,7.13-10.56-1.6-10.81-7.13-10.81"),a(A,"d","M244.08,23.91c-2.34-.61-5.75-.52-7.35.47v22.5H233V22.69c2.67-1.13,5.36-1.74,10.11-1.74H245Z"),a(M,"d","M277.42,47.13,263.07,25a32.2,32.2,0,0,1-1.85-3.29h-.09s.13,1.88.13,3.85V47.13h-4.71V14.8h5.31l13.61,20.82A28.76,28.76,0,0,1,277.38,39h.08s-.17-1.84-.17-3.77V14.8H282V47.13Z"),a(N,"d","M297.52,47.79c-7.43,0-10.93-3-10.93-7.81,0-6.8,7.12-8.64,15.59-9.39V29.13c0-3.47-2.37-4.51-5.83-4.51a18,18,0,0,0-6.87,1.46L288.23,23a24,24,0,0,1,9.12-1.83c5.61,0,9.93,2.3,9.93,8.78V46a22.71,22.71,0,0,1-9.76,1.83m4.66-14.67c-6.26.67-10.45,1.84-10.45,6.73,0,3.42,2.42,4.88,6.22,4.88a10.09,10.09,0,0,0,4.23-.84Z"),a(H,"d","M322,47.69c-5.31,0-7.34-3.43-7.34-6.86V25.09h-3.55V21.81h3.55V16.12l5.4-1.5v7.19H325v3.28h-5V40.55a3.26,3.26,0,0,0,3,3.52h.5a5.5,5.5,0,0,0,1.46-.23v3.33a7.69,7.69,0,0,1-3,.52"),a(D,"d","M331.91,17.43a3,3,0,0,1-3.15-2.81,3.17,3.17,0,0,1,6.31,0,3,3,0,0,1-3.16,2.81m-2.72,4.38h5.44V47.13h-5.44Z"),a(Y,"d","M350.88,47.79c-7.73,0-11.57-5.74-11.57-13.3s3.84-13.34,11.57-13.34,11.54,5.78,11.54,13.34-3.8,13.3-11.54,13.3m0-23.17c-4.66,0-6.05,4.89-6.05,9.82s1.47,9.63,6.05,9.63,6.05-4.7,6.05-9.63-1.38-9.82-6.05-9.82"),a(O,"d","M382.52,47.13V29c0-3.24-2.77-4.47-5.88-4.47a12.3,12.3,0,0,0-4.37.76v21.8h-5.39V23a26.81,26.81,0,0,1,10.06-1.83c6.61,0,11,2.25,11,7.8V47.13Z"),a(S,"d","M403.18,47.79c-7.43,0-10.94-3-10.94-7.81,0-6.8,7.13-8.64,15.6-9.39V29.13c0-3.47-2.37-4.51-5.83-4.51a18,18,0,0,0-6.87,1.46L393.89,23A24,24,0,0,1,403,21.15c5.62,0,9.94,2.3,9.94,8.78V46a22.71,22.71,0,0,1-9.76,1.83m4.66-14.67c-6.27.67-10.46,1.84-10.46,6.73,0,3.42,2.43,4.88,6.23,4.88a10.09,10.09,0,0,0,4.23-.84Z"),a(F,"points","418.52 47.13 418.52 34.91 418.52 10.25 423.92 10.25 423.92 22.76 423.92 47.13 418.52 47.13"),a($,"d","M445.39,47.79A19.11,19.11,0,0,1,436.58,46l1.51-4a13.48,13.48,0,0,0,6.22,1.55c3.76,0,6.44-2.21,6.44-5.41,0-7.09-13.44-4.36-13.44-14.42,0-5.13,4.15-9.59,10.72-9.59A15.82,15.82,0,0,1,455.8,16l-1.38,3.52a11.93,11.93,0,0,0-5.66-1.5c-3.5,0-5.79,2.11-5.79,5.12,0,7,13.74,3.94,13.74,14.65,0,5.74-4.71,10-11.32,10"),a(Q,"d","M470.41,47.69c-5.31,0-7.34-3.43-7.34-6.86V25.09h-3.54V21.81h3.54V16.12l5.4-1.5v7.19h4.92v3.28h-4.92V40.55a3.27,3.27,0,0,0,3,3.52h.48a5.12,5.12,0,0,0,1.46-.23v3.33a7.69,7.69,0,0,1-3,.52"),a(W,"d","M487.27,47.79c-7.44,0-10.93-3-10.93-7.81,0-6.8,7.13-8.64,15.6-9.39V29.13c0-3.47-2.38-4.51-5.84-4.51a18,18,0,0,0-6.87,1.46L478,23a23.94,23.94,0,0,1,9.11-1.83c5.62,0,9.94,2.3,9.94,8.78V46a22.71,22.71,0,0,1-9.76,1.83M492,33.16c-6.27.67-10.46,1.84-10.46,6.73,0,3.42,2.42,4.88,6.22,4.88a10,10,0,0,0,4.24-.84Z"),a(V,"d","M511.73,47.69c-5.32,0-7.35-3.43-7.35-6.86V25.09h-3.54V21.81h3.54V16.12l5.4-1.5v7.19h4.92v3.28h-4.92V40.55a3.26,3.26,0,0,0,3,3.52h.5a5.5,5.5,0,0,0,1.46-.23v3.33a7.69,7.69,0,0,1-3,.52"),a(U,"d","M521.66,17.43a3,3,0,0,1-3.15-2.81,3.17,3.17,0,0,1,6.31,0,3,3,0,0,1-3.16,2.81m-2.72,4.38h5.45V47.13h-5.45Z"),a(R,"d","M536.19,47.79A15.9,15.9,0,0,1,528.54,46L530,42.48a10.53,10.53,0,0,0,5.52,1.5c2.77,0,5-1.78,5-3.94,0-6-11.1-3.2-11.1-11.47,0-3.76,3.37-7.42,8.86-7.42A13.56,13.56,0,0,1,545.34,23l-1.42,3.14a8.47,8.47,0,0,0-4.62-1.45c-2.81,0-4.54,1.69-4.54,3.62,0,5.64,11.32,3.14,11.32,11.6,0,4-3.85,7.9-9.89,7.9"),a(_e,"d","M559.83,47.69c-5.31,0-7.35-3.43-7.35-6.86V25.09h-3.54V21.81h3.54V16.12l5.4-1.5v7.19h4.93v3.28h-4.93V40.55a3.27,3.27,0,0,0,3,3.52h.48a5.64,5.64,0,0,0,1.47-.23v3.33a7.72,7.72,0,0,1-3,.52"),a(K,"d","M569.77,17.43a3,3,0,0,1-3.15-2.81,3.17,3.17,0,0,1,6.31,0,3,3,0,0,1-3.16,2.81m-2.72,4.38h5.44V47.13h-5.44Z"),a(re,"d","M588.14,47.79c-6.23,0-11-5.08-11-13.35s4.88-13.29,11-13.29A10.51,10.51,0,0,1,594.66,23l-1.21,3a6.87,6.87,0,0,0-4-1.22c-4.4,0-6.69,3.81-6.69,9.49s2.63,9.59,6.61,9.59a6.74,6.74,0,0,0,4-1.28L594.7,46c-1.12.94-3.33,1.84-6.56,1.84"),a(ae,"d","M605.1,47.79A15.9,15.9,0,0,1,597.45,46l1.42-3.47A10.54,10.54,0,0,0,604.4,44c2.77,0,5-1.78,5-3.94,0-6-11.1-3.2-11.1-11.47,0-3.76,3.37-7.42,8.85-7.42a13.49,13.49,0,0,1,7.1,1.83l-1.42,3.14a8.42,8.42,0,0,0-4.63-1.45c-2.8,0-4.53,1.69-4.53,3.62,0,5.64,11.32,3.14,11.32,11.6,0,4-3.85,7.9-9.89,7.9"),a(h,"class","ons-svg-logo__group ons-svg-logo__group--text"),a(h,"fill",s[4]),a(e,"class",oe=Ma(s[1])+" svelte-48r6qe"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"width",s[2]),a(e,"height",s[3]),a(e,"viewBox","33 2 552 60"),a(e,"aria-labelledby","ons-logo-en-alt")},m(X,z){B(X,e,z),l(e,t),l(t,n),l(e,o),l(o,i),l(e,d),l(d,u),l(e,h),l(h,p),l(h,y),l(h,b),l(h,m),l(h,v),l(h,g),l(h,w),l(h,k),l(h,A),l(h,M),l(h,N),l(h,H),l(h,D),l(h,Y),l(h,O),l(h,S),l(h,F),l(h,$),l(h,Q),l(h,W),l(h,V),l(h,U),l(h,R),l(h,_e),l(h,K),l(h,re),l(h,ae)},p(X,z){z&16&&a(d,"fill",X[4]),z&16&&a(h,"fill",X[4]),z&2&&oe!==(oe=Ma(X[1])+" svelte-48r6qe")&&a(e,"class",oe),z&4&&a(e,"width",X[2]),z&8&&a(e,"height",X[3])},d(X){X&&r(e)}}}function ot(s){let e;function t(i,d){return i[0]?rt:nt}let n=t(s),o=n(s);return{c(){o.c(),e=va()},l(i){o.l(i),e=va()},m(i,d){o.m(i,d),B(i,e,d)},p(i,[d]){n===(n=t(i))&&o?o.p(i,d):(o.d(1),o=n(i),o&&(o.c(),o.m(e.parentNode,e)))},i:_a,o:_a,d(i){i&&r(e),o.d(i)}}}const Bl="#a8bd3a";function it(s,e,t){let n;const o=Ba("theme");let{compact:i=!1}=e,{className:d="ons-svg-logo"}=e,{width:u="auto"}=e,{height:h="auto"}=e;return s.$$set=p=>{"compact"in p&&t(0,i=p.compact),"className"in p&&t(1,d=p.className),"width"in p&&t(2,u=p.width),"height"in p&&t(3,h=p.height)},t(4,n=o==="dark"?"white":"#003c57"),[i,d,u,h,n]}class $a extends ga{constructor(e){super(),ba(this,e,it,ot,ma,{compact:0,className:1,width:2,height:3})}}function kl(s,e,t){const n=s.slice();return n[26]=e[t],n[28]=t,n}function Vl(s,e,t){const n=s.slice();return n[29]=e[t],n}function Al(s,e,t){const n=s.slice();return n[26]=e[t],n}const ct=s=>({}),Il=s=>({});function Cl(s){let e,t,n=s[13]("Skip to main content")+"",o,i,d,u,h,p,y,b,m,v;const g=s[17].before,w=Na(g,s,s[23],Il),k=[ut,ht],A=[];function M(H,D){return H[0]?0:1}y=M(s),b=A[y]=k[y](s);let N=s[1]&&Dl(s);return{c(){e=f("header"),t=f("a"),o=P(n),i=C(),d=f("div"),u=P(s[8]),h=C(),w&&w.c(),p=C(),b.c(),m=C(),N&&N.c(),this.h()},l(H){e=_(H,"HEADER",{class:!0,role:!0});var D=c(e);t=_(D,"A",{class:!0,href:!0,tabindex:!0});var Y=c(t);o=Z(Y,n),Y.forEach(r),i=L(D),d=_(D,"DIV",{id:!0,class:!0});var O=c(d);u=Z(O,s[8]),O.forEach(r),h=L(D),w&&w.l(D),p=L(D),b.l(D),m=L(D),N&&N.l(D),D.forEach(r),this.h()},h(){a(t,"class","skiplink"),a(t,"href","#main"),a(t,"tabindex","0"),a(d,"id","pagePath"),a(d,"class","hide"),a(e,"class","ons-header"),a(e,"role","banner")},m(H,D){B(H,e,D),l(e,t),l(t,o),l(e,i),l(e,d),l(d,u),l(e,h),w&&w.m(e,null),l(e,p),A[y].m(e,null),l(e,m),N&&N.m(e,null),v=!0},p(H,D){(!v||D[0]&256)&&xe(u,H[8]),w&&w.p&&(!v||D[0]&8388608)&&Da(w,g,H,H[23],v?Ha(g,H[23],D,ct):Sa(H[23]),Il);let Y=y;y=M(H),y===Y?A[y].p(H,D):(Ol(),he(A[Y],1,1,()=>{A[Y]=null}),Tl(),b=A[y],b?b.p(H,D):(b=A[y]=k[y](H),b.c()),ce(b,1),b.m(e,m)),H[1]?N?N.p(H,D):(N=Dl(H),N.c(),N.m(e,null)):N&&(N.d(1),N=null)},i(H){v||(ce(w,H),ce(b),v=!0)},o(H){he(w,H),he(b),v=!1},d(H){H&&r(e),w&&w.d(H),A[y].d(),N&&N.d()}}}function ht(s){let e,t,n,o,i,d,u,h,p,y,b,m,v,g,w,k,A,M,N,H=s[13]("Menu")+"",D,Y,O,S,F,$=(s[10]?s[13]("Hide search"):s[13]("Search"))+"",Q,W,V,U,R,_e=s[13]("Home")+"",K,re,ae,oe,X,z,x,te,J,I,se=s[13]("Search for a keyword(s) or time series ID")+"",ue,be,de,Oe,fe,ve,me=s[13]("Search")+"",ze,ye,pe,qe=``,Ve,ie,la,sa;i=new $a({props:{className:"logo",height:39,compact:!0}});function Ae(E,q){return E[5]=="en"?ft:dt}let Ie=Ae(s),we=Ie(s),Te=fa(s[11].filter(Sl)),ne=[];for(let E=0;E{n=null}),Tl())},i(o){t||(ce(n),t=!0)},o(o){he(n),t=!1},d(o){o&&r(e),n&&n.d(o)}}}function bt(s){let e,t;return e=new $l({props:{theme:s[3],overrides:s[4],$$slots:{default:[gt]},$$scope:{ctx:s}}}),{c(){Ye(e.$$.fragment)},l(n){Fe(e.$$.fragment,n)},m(n,o){Ue(e,n,o),t=!0},p(n,o){const i={};o[0]&8&&(i.theme=n[3]),o[0]&16&&(i.overrides=n[4]),o[0]&8392679&&(i.$$scope={dirty:o,ctx:n}),e.$set(i)},i(n){t||(ce(e.$$.fragment,n),t=!0)},o(n){he(e.$$.fragment,n),t=!1},d(n){Re(e,n)}}}const Sl=s=>s.secondary,Hl=s=>s.children,Pl=s=>!s.children;function yt(s,e,t){let n,{$$slots:o={},$$scope:i}=e;const d=Ba("page");Zl(s,d,V=>t(16,n=V));let{compact:u=!1}=e,{title:h=""}=e,{titleHref:p=""}=e,{theme:y=null}=e,{themeOverrides:b=null}=e,m="en",v="//www.ons.gov.uk",g="//cy.ons.gov.uk",w="",k=!1;function A(V,U){if(V){const R=(U==null?void 0:U.url)||document.location;t(5,m=R.host.startsWith("cy")?"cy":"en"),t(6,v=`//${R.host}`),t(7,g=m==="en"?`//cy.${R.host.replace("www.","")}`:`//www.${R.host.replace("cy.","")}`),t(8,w=R.pathname)}}Za(()=>t(15,k=!0));let M=!1,N=!1,H=[{label_en:"Business, industry and trade",label_cy:"Busnes, diwydiant a masnach",url:"/businessindustryandtrade",expanded:!1,children:[{label_en:"Business",label_cy:"Busnes",url:"/businessindustryandtrade/business"},{label_en:"Changes to business",label_cy:"Newidiadau i fusnesau",url:"/businessindustryandtrade/changestobusiness"},{label_en:"Construction industry",label_cy:"Diwydiant adeiladu",url:"/businessindustryandtrade/constructionindustry"},{label_en:"IT and internet industry",label_cy:"Y diwydiant TG a'r rhyngrwyd",url:"/businessindustryandtrade"},{label_en:"International trade",label_cy:"Masnach ryngwladol",url:"/businessindustryandtrade/itandinternetindustry"},{label_en:"Manufacturing and production industry",label_cy:"Y diwydiant gweithgynhyrchu a chynhyrchu",url:"/businessindustryandtrade/manufacturingandproductionindustry"},{label_en:"Retail industry",label_cy:"Y diwydiant manwerthu",url:"/businessindustryandtrade/retailindustry"},{label_en:"Tourism industry",label_cy:"Y diwydiant twristiaeth",url:"/businessindustryandtrade/tourismindustry"}]},{label_en:"Economy",label_cy:"Yr economi",url:"/economy",expanded:!1,children:[{label_en:"Economic output and productivity",label_cy:"Allgynnyrch economaidd a chynhyrchiant",url:"/economy/economicoutputandproductivity"},{label_en:"Environmental accounts",label_cy:"Cyfrifon amgylcheddol",url:"/economy/environmentalaccounts"},{label_en:"Government, public sector and taxes",label_cy:"Llywodraeth, y sector cyhoeddus a threthi",url:"/economy/governmentpublicsectorandtaxes"},{label_en:"Gross Domestic Product (GDP)",label_cy:"Cynnyrch Domestig Gros (CDG)",url:"/economy/grossdomesticproductgdp"},{label_en:"Gross Value Added (GVA)",label_cy:"Gwerth Ychwanegol Gros",url:"/economy/grossvalueaddedgva"},{label_en:"Inflation and price indices",label_cy:"Mynegeion chwyddiant a phrisiau",url:"/economy/inflationandpriceindices"},{label_en:"Investments, pensions and trusts",label_cy:"Buddsoddiadau, pensiynau ac ymddiriedolaethau",url:"/economy/investmentspensionsandtrusts"},{label_en:"National accounts",label_cy:"Cyfrifon gwladol",url:"/economy/nationalaccounts"},{label_en:"Regional accounts",label_cy:"Cyfrifon rhanbarthol",url:"/economy/regionalaccounts"}]},{label_en:"Employment and labour market",label_cy:"Cyflogaeth a'r farchnad lafur",url:"/employmentandlabourmarket",expanded:!1,children:[{label_en:"People in work",label_cy:"Pobl mewn gwaith",url:"/employmentandlabourmarket/peopleinwork"},{label_en:"People not in work",label_cy:"Pobl nad ydynt mewn gwaith",url:"/employmentandlabourmarket/peoplenotinwork"}]},{label_en:"People, population and community",label_cy:"Pobl, y boblogaeth a chymunedau",url:"/peoplepopulationandcommunity",expanded:!1,children:[{label_en:"Births, deaths and marriages",label_cy:"Genedigaethau, marwolaethau a phriodasau",url:"/peoplepopulationandcommunity/birthsdeathsandmarriages"},{label_en:"Crime and justice",label_cy:"Troseddu a chyfiawnder",url:"/peoplepopulationandcommunity/crimeandjustice"},{label_en:"Cultural identity",label_cy:"Hunaniaeth ddiwylliannol",url:"/peoplepopulationandcommunity/culturalidentity"},{label_en:"Education and childcare",label_cy:"Addysg a gofal plant",url:"/peoplepopulationandcommunity/educationandchildcare"},{label_en:"Elections",label_cy:"Etholiadau",url:"/peoplepopulationandcommunity/elections"},{label_en:"Health and social care",label_cy:"Iechyd a gofal cymdeithasol",url:"/peoplepopulationandcommunity/healthandsocialcare"},{label_en:"Household characteristics",label_cy:"Nodweddion aelwydydd",url:"/peoplepopulationandcommunity/householdcharacteristics"},{label_en:"Housing",label_cy:"Tai",url:"/peoplepopulationandcommunity/housing"},{label_en:"Leisure and tourism",label_cy:"Hamdden a thwristiaeth",url:"/peoplepopulationandcommunity/leisureandtourism"},{label_en:"Personal and household finances",label_cy:"Cyllid personol a chyllid aelwydydd",url:"/peoplepopulationandcommunity/personalandhouseholdfinances"},{label_en:"Population and migration",label_cy:"Poblogaeth ac ymfudo",url:"/peoplepopulationandcommunity/populationandmigration"},{label_en:"Well-being",label_cy:"Lles",url:"/peoplepopulationandcommunity/wellbeing"}]},{label_en:"Taking part in a survey?",label_cy:"Cymryd rhan mewn arolwg?",url:"/surveys"},{label_en:"Release calendar",label_cy:"Calendar datganiadau",url:"/releasecalendar",secondary:!0},{label_en:"Methodology",label_cy:"Methodoleg",url:"/methodology",secondary:!0},{label_en:"Media",label_cy:"Media",url:"/news",secondary:!0},{label_en:"About",label_cy:"Amdanom ni",url:"/aboutus",secondary:!0},{label_en:"Blog",label_cy:"Blog",url:"https://blog.ons.gov.uk/",secondary:!0}];const D={Home:"Hafan",Search:"Chwilio",Menu:"Dewislen","Hide search":"Cuddio","Office for National Statistics logo - Homepage":"Logo Swyddfa Ystadegau Gwladol - Hafan","Search for a keyword(s) or time series ID":"Chwilio am allweddair neu ID cyfres amser"},Y=V=>m=="cy"&&D[V]?D[V]:V;function O(V,U){window.matchMedia("(max-width:767px)").matches&&(V.preventDefault(),t(11,H[U].expanded=!H[U].expanded,H))}const S=()=>{t(9,M=!M),t(10,N=!1)},F=()=>{t(10,N=!N),t(9,M=!1)},$=(V,U)=>V["label_"+m].localeCompare(U["label_"+m]),Q=(V,U)=>O(U,V),W=(V,U)=>V["label_"+m].localeCompare(U["label_"+m]);return s.$$set=V=>{"compact"in V&&t(0,u=V.compact),"title"in V&&t(1,h=V.title),"titleHref"in V&&t(2,p=V.titleHref),"theme"in V&&t(3,y=V.theme),"themeOverrides"in V&&t(4,b=V.themeOverrides),"$$scope"in V&&t(23,i=V.$$scope)},s.$$.update=()=>{s.$$.dirty[0]&98304&&A(k,n)},[u,h,p,y,b,m,v,g,w,M,N,H,d,Y,O,k,n,o,S,F,$,Q,W,i]}class wt extends ga{constructor(e){super(),ba(this,e,yt,bt,ma,{compact:0,title:1,titleHref:2,theme:3,themeOverrides:4},null,[-1,-1])}}function Et(s){let e,t,n,o;return{c(){e=P("This is a new service – your "),t=f("a"),n=P("feedback"),o=P(" will help us improve it."),this.h()},l(i){e=Z(i,"This is a new service – your "),t=_(i,"A",{href:!0});var d=c(t);n=Z(d,"feedback"),d.forEach(r),o=Z(i," will help us improve it."),this.h()},h(){a(t,"href",s[1])},m(i,d){B(i,e,d),B(i,t,d),l(t,n),B(i,o,d)},p(i,d){d&2&&a(t,"href",i[1])},d(i){i&&(r(e),r(t),r(o))}}}function kt(s){let e,t,n,o;return{c(){e=P("This is a prototype – your "),t=f("a"),n=P("feedback"),o=P(" will help us improve it."),this.h()},l(i){e=Z(i,"This is a prototype – your "),t=_(i,"A",{href:!0});var d=c(t);n=Z(d,"feedback"),d.forEach(r),o=Z(i," will help us improve it."),this.h()},h(){a(t,"href",s[1])},m(i,d){B(i,e,d),B(i,t,d),l(t,n),B(i,o,d)},p(i,d){d&2&&a(t,"href",i[1])},d(i){i&&(r(e),r(t),r(o))}}}function Vt(s){let e,t,n,o,i,d,u,h,p,y;function b(g,w){return w&1&&(y=null),y==null&&(y=g[0].toLowerCase()==="prototype"),y?kt:Et}let m=b(s,-1),v=m(s);return{c(){e=f("div"),t=f("div"),n=f("div"),o=f("div"),i=f("strong"),d=P(s[0]),u=C(),h=f("div"),p=f("span"),v.c(),this.h()},l(g){e=_(g,"DIV",{class:!0});var w=c(e);t=_(w,"DIV",{class:!0});var k=c(t);n=_(k,"DIV",{class:!0});var A=c(n);o=_(A,"DIV",{class:!0});var M=c(o);i=_(M,"STRONG",{class:!0});var N=c(i);d=Z(N,s[0]),N.forEach(r),M.forEach(r),u=L(A),h=_(A,"DIV",{class:!0});var H=c(h);p=_(H,"SPAN",{class:!0});var D=c(p);v.l(D),D.forEach(r),H.forEach(r),A.forEach(r),k.forEach(r),w.forEach(r),this.h()},h(){a(i,"class","ons-phase-banner__badge svelte-x2c8o"),a(o,"class","ons-grid__col ons-col-auto ons-u-flex-no-grow ons-u-flex-no-shrink"),a(p,"class","ons-u-fs-s ons-u-m-no"),a(h,"class","ons-col-auto ons-grid--flex ons-grid--no-wrap@l ons-grid--vertical-center"),a(n,"class","ons-grid ons-grid--flex ons-grid--gutterless ons-grid--no-wrap"),a(t,"class","ons-container"),a(e,"class","ons-phase-banner svelte-x2c8o")},m(g,w){B(g,e,w),l(e,t),l(t,n),l(n,o),l(o,i),l(i,d),l(n,u),l(n,h),l(h,p),v.m(p,null)},p(g,[w]){w&1&&xe(d,g[0]),m===(m=b(g,w))&&v?v.p(g,w):(v.d(1),v=m(g),v&&(v.c(),v.m(p,null)))},i:_a,o:_a,d(g){g&&r(e),v.d()}}}function At(s,e,t){let{phase:n="Beta"}=e,{href:o="/feedback"}=e;return s.$$set=i=>{"phase"in i&&t(0,n=i.phase),"href"in i&&t(1,o=i.href)},[n,o]}class It extends ga{constructor(e){super(),ba(this,e,At,Vt,ma,{phase:0,href:1})}}function Ct(s){let e;const t=s[0].default,n=Na(t,s,s[1],null);return{c(){n&&n.c()},l(o){n&&n.l(o)},m(o,i){n&&n.m(o,i),e=!0},p(o,i){n&&n.p&&(!e||i&2)&&Da(n,t,o,o[1],e?Ha(t,o[1],i,null):Sa(o[1]),null)},i(o){e||(ce(n,o),e=!0)},o(o){he(n,o),e=!1},d(o){n&&n.d(o)}}}function Lt(s){let e,t,n,o,i,d,u,h,p,y,b,m;return n=new Ul({props:{analyticsProps:Rl}}),i=new It({props:{phase:"prototype"}}),u=new wt({}),p=new Ql({props:{$$slots:{default:[Ct]},$$scope:{ctx:s}}}),b=new st({props:{theme:"dark"}}),{c(){e=f("link"),t=C(),Ye(n.$$.fragment),o=C(),Ye(i.$$.fragment),d=C(),Ye(u.$$.fragment),h=C(),Ye(p.$$.fragment),y=C(),Ye(b.$$.fragment),this.h()},l(v){const g=Gl("svelte-o15d4p",document.head);e=_(g,"LINK",{rel:!0,href:!0}),g.forEach(r),t=L(v),Fe(n.$$.fragment,v),o=L(v),Fe(i.$$.fragment,v),d=L(v),Fe(u.$$.fragment,v),h=L(v),Fe(p.$$.fragment,v),y=L(v),Fe(b.$$.fragment,v),this.h()},h(){a(e,"rel","icon"),a(e,"href",Fl+"/favicon.ico")},m(v,g){l(document.head,e),B(v,t,g),Ue(n,v,g),B(v,o,g),Ue(i,v,g),B(v,d,g),Ue(u,v,g),B(v,h,g),Ue(p,v,g),B(v,y,g),Ue(b,v,g),m=!0},p(v,[g]){const w={};g&2&&(w.$$scope={dirty:g,ctx:v}),p.$set(w)},i(v){m||(ce(n.$$.fragment,v),ce(i.$$.fragment,v),ce(u.$$.fragment,v),ce(p.$$.fragment,v),ce(b.$$.fragment,v),m=!0)},o(v){he(n.$$.fragment,v),he(i.$$.fragment,v),he(u.$$.fragment,v),he(p.$$.fragment,v),he(b.$$.fragment,v),m=!1},d(v){v&&(r(t),r(o),r(d),r(h),r(y)),r(e),Re(n,v),Re(i,v),Re(u,v),Re(p,v),Re(b,v)}}}let Mt="light";function Nt(s,e,t){let{$$slots:n={},$$scope:o}=e;return Yl("theme",zl[Mt]),s.$$set=i=>{"$$scope"in i&&t(1,o=i.$$scope)},[n,o]}class Ot extends ga{constructor(e){super(),ba(this,e,Nt,Lt,ma,{})}}export{Ot as component,Zt as universal}; diff --git a/_app/immutable/nodes/1.cfe987c8.js b/_app/immutable/nodes/1.80efe519.js similarity index 92% rename from _app/immutable/nodes/1.cfe987c8.js rename to _app/immutable/nodes/1.80efe519.js index ea79f94..d7e4304 100644 --- a/_app/immutable/nodes/1.cfe987c8.js +++ b/_app/immutable/nodes/1.80efe519.js @@ -1 +1 @@ -import{s as x,f as u,l as h,a as y,g as d,h as v,m as g,d as m,c as C,i as _,C as E,n as $,D as b,y as S}from"../chunks/scheduler.452d2f96.js";import{S as q,i as D}from"../chunks/index.bed91369.js";import{p as H}from"../chunks/stores.8e32eefa.js";function P(i){var f;let a,s=i[0].status+"",r,o,n,p=((f=i[0].error)==null?void 0:f.message)+"",c;return{c(){a=u("h1"),r=h(s),o=y(),n=u("p"),c=h(p)},l(e){a=d(e,"H1",{});var t=v(a);r=g(t,s),t.forEach(m),o=C(e),n=d(e,"P",{});var l=v(n);c=g(l,p),l.forEach(m)},m(e,t){_(e,a,t),E(a,r),_(e,o,t),_(e,n,t),E(n,c)},p(e,[t]){var l;t&1&&s!==(s=e[0].status+"")&&$(r,s),t&1&&p!==(p=((l=e[0].error)==null?void 0:l.message)+"")&&$(c,p)},i:b,o:b,d(e){e&&(m(a),m(o),m(n))}}}function j(i,a,s){let r;return S(i,H,o=>s(0,r=o)),[r]}class A extends q{constructor(a){super(),D(this,a,j,P,x,{})}}export{A as component}; +import{s as x,f as u,l as h,a as y,g as d,h as v,m as g,d as m,c as C,i as _,C as E,n as $,D as b,y as S}from"../chunks/scheduler.452d2f96.js";import{S as q,i as D}from"../chunks/index.bed91369.js";import{p as H}from"../chunks/stores.afd013d2.js";function P(i){var f;let a,s=i[0].status+"",r,o,n,p=((f=i[0].error)==null?void 0:f.message)+"",c;return{c(){a=u("h1"),r=h(s),o=y(),n=u("p"),c=h(p)},l(e){a=d(e,"H1",{});var t=v(a);r=g(t,s),t.forEach(m),o=C(e),n=d(e,"P",{});var l=v(n);c=g(l,p),l.forEach(m)},m(e,t){_(e,a,t),E(a,r),_(e,o,t),_(e,n,t),E(n,c)},p(e,[t]){var l;t&1&&s!==(s=e[0].status+"")&&$(r,s),t&1&&p!==(p=((l=e[0].error)==null?void 0:l.message)+"")&&$(c,p)},i:b,o:b,d(e){e&&(m(a),m(o),m(n))}}}function j(i,a,s){let r;return S(i,H,o=>s(0,r=o)),[r]}class A extends q{constructor(a){super(),D(this,a,j,P,x,{})}}export{A as component}; diff --git a/_app/immutable/nodes/2.c7403abf.js b/_app/immutable/nodes/2.53dd7cc4.js similarity index 54% rename from _app/immutable/nodes/2.c7403abf.js rename to _app/immutable/nodes/2.53dd7cc4.js index bb84c3d..e4eedf9 100644 --- a/_app/immutable/nodes/2.c7403abf.js +++ b/_app/immutable/nodes/2.53dd7cc4.js @@ -1,10 +1,10 @@ -import{T as $_,e as Ni,c as B1,b as j_,m as cm,l as mc,d as Wo,f as Ko,p as um,g as Cc,h as O1,i as F1,j as N1,t as U1,k as vf,v as V1,n as $1}from"../chunks/Table.svelte_svelte_type_style_lang.9e187c59.js";import{b as Xo}from"../chunks/paths.02c4a57e.js";import{s as Ui,e as ri,i as Fe,d as Q,r as Ir,f as je,a as gt,g as qe,h as Ye,c as _t,j as me,F as Zt,C as De,u as Ar,v as Pr,w as zr,I as Zr,z as ya,A as va,l as Ut,m as Vt,n as Ci,M as q_,N as Z_,L as Ka,k as At,O as Yu,P as Qu,E as Sc,x as Xa,y as eh,Q as hm,B as Cr,o as th,D as wi,R as $f,G as Ms,S as G_,T as W_,J as j1,p as Ja,U as Yo,K as H_,V as ih,q as fm}from"../chunks/scheduler.452d2f96.js";import{S as qi,i as Zi,g as Vi,t as tt,c as $i,a as Ge,b as ei,d as si,m as ti,e as ii,f as Qo}from"../chunks/index.bed91369.js";import{p as q1}from"../chunks/stores.8e32eefa.js";import{w as K_,h as X_}from"../chunks/singletons.4b41f6d0.js";const J_=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function Z1(l){let i,a;return i=new $_({props:{id:l[0],cls:l[1],theme:l[6],background:l[8],overrides:l[7],$$slots:{default:[W1]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.id=o[0]),u&2&&(f.cls=o[1]),u&64&&(f.theme=o[6]),u&256&&(f.background=o[8]),u&128&&(f.overrides=o[7]),u&5692&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function G1(l){let i,a;return i=new $_({props:{id:l[0],cls:l[1],theme:l[6],background:l[8],overrides:l[7],$$slots:{default:[H1]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.id=o[0]),u&2&&(f.cls=o[1]),u&64&&(f.theme=o[6]),u&256&&(f.background=o[8]),u&128&&(f.overrides=o[7]),u&5692&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function dm(l){let i;return{c(){i=je("div"),this.h()},l(a){i=qe(a,"DIV",{class:!0}),Ye(i).forEach(Q),this.h()},h(){me(i,"class","ons-spacer")},m(a,o){Fe(a,i,o)},d(a){a&&Q(i)}}}function pm(l){let i;return{c(){i=je("div"),this.h()},l(a){i=qe(a,"DIV",{class:!0}),Ye(i).forEach(Q),this.h()},h(){me(i,"class","ons-spacer")},m(a,o){Fe(a,i,o)},d(a){a&&Q(i)}}}function W1(l){let i,a,o,u,f,p=l[4]&&dm();const n=l[11].default,_=Ir(n,l,l[12],null);let v=l[5]&&pm();return{c(){i=je("div"),p&&p.c(),a=gt(),_&&_.c(),o=gt(),v&&v.c(),this.h()},l(S){i=qe(S,"DIV",{id:!0,class:!0});var T=Ye(i);p&&p.l(T),a=_t(T),_&&_.l(T),o=_t(T),v&&v.l(T),T.forEach(Q),this.h()},h(){me(i,"id",l[10]),me(i,"class",u="ons-page__container ons-container "+l[9]+" svelte-18rmgoy"),Zt(i,"ons-page__container--wider",l[2]==="wider"),Zt(i,"ons-page__container--full",l[2]==="full"),Zt(i,"ons-page__container--tall-height",l[3]==="tall"),Zt(i,"ons-page__container--full-height",l[3]==="full")},m(S,T){Fe(S,i,T),p&&p.m(i,null),De(i,a),_&&_.m(i,null),De(i,o),v&&v.m(i,null),f=!0},p(S,T){S[4]?p||(p=dm(),p.c(),p.m(i,a)):p&&(p.d(1),p=null),_&&_.p&&(!f||T&4096)&&Ar(_,n,S,S[12],f?zr(n,S[12],T,null):Pr(S[12]),null),S[5]?v||(v=pm(),v.c(),v.m(i,null)):v&&(v.d(1),v=null),(!f||T&1024)&&me(i,"id",S[10]),(!f||T&512&&u!==(u="ons-page__container ons-container "+S[9]+" svelte-18rmgoy"))&&me(i,"class",u),(!f||T&516)&&Zt(i,"ons-page__container--wider",S[2]==="wider"),(!f||T&516)&&Zt(i,"ons-page__container--full",S[2]==="full"),(!f||T&520)&&Zt(i,"ons-page__container--tall-height",S[3]==="tall"),(!f||T&520)&&Zt(i,"ons-page__container--full-height",S[3]==="full")},i(S){f||(Ge(_,S),f=!0)},o(S){tt(_,S),f=!1},d(S){S&&Q(i),p&&p.d(),_&&_.d(S),v&&v.d()}}}function mm(l){let i;return{c(){i=je("div"),this.h()},l(a){i=qe(a,"DIV",{class:!0}),Ye(i).forEach(Q),this.h()},h(){me(i,"class","ons-spacer")},m(a,o){Fe(a,i,o)},d(a){a&&Q(i)}}}function gm(l){let i;return{c(){i=je("div"),this.h()},l(a){i=qe(a,"DIV",{class:!0}),Ye(i).forEach(Q),this.h()},h(){me(i,"class","ons-spacer")},m(a,o){Fe(a,i,o)},d(a){a&&Q(i)}}}function H1(l){let i,a,o,u,f,p,n=l[4]&&mm();const _=l[11].default,v=Ir(_,l,l[12],null);let S=l[5]&&gm();return{c(){i=je("div"),n&&n.c(),a=gt(),o=je("div"),v&&v.c(),u=gt(),S&&S.c(),this.h()},l(T){i=qe(T,"DIV",{id:!0,class:!0});var I=Ye(i);n&&n.l(I),a=_t(I),o=qe(I,"DIV",{class:!0});var z=Ye(o);v&&v.l(z),z.forEach(Q),u=_t(I),S&&S.l(I),I.forEach(Q),this.h()},h(){me(o,"class","svelte-18rmgoy"),Zt(o,"ons-page__container--narrow",l[2]==="narrow"),Zt(o,"ons-page__container--medium",l[2]==="medium"),me(i,"id",l[10]),me(i,"class",f="ons-page__container ons-container "+l[9]+" svelte-18rmgoy"),Zt(i,"ons-page__container--tall-height",l[3]==="tall"),Zt(i,"ons-page__container--full-height",l[3]==="full")},m(T,I){Fe(T,i,I),n&&n.m(i,null),De(i,a),De(i,o),v&&v.m(o,null),De(i,u),S&&S.m(i,null),p=!0},p(T,I){T[4]?n||(n=mm(),n.c(),n.m(i,a)):n&&(n.d(1),n=null),v&&v.p&&(!p||I&4096)&&Ar(v,_,T,T[12],p?zr(_,T[12],I,null):Pr(T[12]),null),(!p||I&4)&&Zt(o,"ons-page__container--narrow",T[2]==="narrow"),(!p||I&4)&&Zt(o,"ons-page__container--medium",T[2]==="medium"),T[5]?S||(S=gm(),S.c(),S.m(i,null)):S&&(S.d(1),S=null),(!p||I&1024)&&me(i,"id",T[10]),(!p||I&512&&f!==(f="ons-page__container ons-container "+T[9]+" svelte-18rmgoy"))&&me(i,"class",f),(!p||I&520)&&Zt(i,"ons-page__container--tall-height",T[3]==="tall"),(!p||I&520)&&Zt(i,"ons-page__container--full-height",T[3]==="full")},i(T){p||(Ge(v,T),p=!0)},o(T){tt(v,T),p=!1},d(T){T&&Q(i),n&&n.d(),v&&v.d(T),S&&S.d()}}}function K1(l){let i,a,o,u,f;const p=[G1,Z1],n=[];function _(v,S){return S&4&&(i=null),i==null&&(i=!!["narrow","medium"].includes(v[2])),i?0:1}return a=_(l,-1),o=n[a]=p[a](l),{c(){o.c(),u=ri()},l(v){o.l(v),u=ri()},m(v,S){n[a].m(v,S),Fe(v,u,S),f=!0},p(v,[S]){let T=a;a=_(v,S),a===T?n[a].p(v,S):(Vi(),tt(n[T],1,1,()=>{n[T]=null}),$i(),o=n[a],o?o.p(v,S):(o=n[a]=p[a](v),o.c()),Ge(o,1),o.m(u.parentNode,u))},i(v){f||(Ge(o),f=!0)},o(v){tt(o),f=!1},d(v){v&&Q(u),n[a].d(v)}}}function X1(l,i,a){let o,u,{$$slots:f={},$$scope:p}=i,{id:n=null}=i,{cls:_=null}=i,{width:v="wide"}=i,{height:S="auto"}=i,{marginTop:T=!1}=i,{marginBottom:I=!1}=i,{theme:z=null}=i,{themeOverrides:M=null}=i,{background:C=null}=i;return l.$$set=R=>{"id"in R&&a(0,n=R.id),"cls"in R&&a(1,_=R.cls),"width"in R&&a(2,v=R.width),"height"in R&&a(3,S=R.height),"marginTop"in R&&a(4,T=R.marginTop),"marginBottom"in R&&a(5,I=R.marginBottom),"theme"in R&&a(6,z=R.theme),"themeOverrides"in R&&a(7,M=R.themeOverrides),"background"in R&&a(8,C=R.background),"$$scope"in R&&a(12,p=R.$$scope)},l.$$.update=()=>{l.$$.dirty&321&&a(10,o=n&&!(z||C)?n:null),l.$$.dirty&322&&a(9,u=_&&!(z||C)?_:"")},[n,_,v,S,T,I,z,M,C,u,o,f,p]}class rl extends qi{constructor(i){super(),Zi(this,i,X1,K1,Ui,{id:0,cls:1,width:2,height:3,marginTop:4,marginBottom:5,theme:6,themeOverrides:7,background:8})}}var Ho=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function rh(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}function _m(l,i,a){const o=l.slice();return o[5]=i[a],o}function J1(l){let i=l[5].label+"",a;return{c(){a=Ut(i)},l(o){a=Vt(o,i)},m(o,u){Fe(o,a,u)},p(o,u){u&1&&i!==(i=o[5].label+"")&&Ci(a,i)},d(o){o&&Q(a)}}}function Y1(l){let i,a=l[5].label+"",o,u;return{c(){i=je("a"),o=Ut(a),this.h()},l(f){i=qe(f,"A",{class:!0,href:!0});var p=Ye(i);o=Vt(p,a),p.forEach(Q),this.h()},h(){me(i,"class","ons-breadcrumb__link"),me(i,"href",u=l[5].href)},m(f,p){Fe(f,i,p),De(i,o)},p(f,p){p&1&&a!==(a=f[5].label+"")&&Ci(o,a),p&1&&u!==(u=f[5].href)&&me(i,"href",u)},d(f){f&&Q(i)}}}function ym(l){let i,a,o,u,f;function p(v,S){return v[5].href?Y1:J1}let n=p(l),_=n(l);return{c(){i=je("li"),_.c(),a=gt(),o=ya("svg"),u=ya("path"),f=gt(),this.h()},l(v){i=qe(v,"LI",{class:!0});var S=Ye(i);_.l(S),a=_t(S),o=va(S,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0});var T=Ye(o);u=va(T,"path",{d:!0,transform:!0}),Ye(u).forEach(Q),T.forEach(Q),f=_t(S),S.forEach(Q),this.h()},h(){me(u,"d","M5.74,14.28l-.57-.56a.5.5,0,0,1,0-.71h0l5-5-5-5a.5.5,0,0,1,0-.71h0l.57-.56a.5.5,0,0,1,.71,0h0l5.93,5.93a.5.5,0,0,1,0,.7L6.45,14.28a.5.5,0,0,1-.71,0Z"),me(u,"transform","translate(-5.02 -1.59)"),me(o,"class","ons-svg-icon svelte-w4p0hu"),me(o,"viewBox","0 0 8 13"),me(o,"xmlns","http://www.w3.org/2000/svg"),me(o,"focusable","false"),me(i,"class","ons-breadcrumb__item ons-u-p-no")},m(v,S){Fe(v,i,S),_.m(i,null),De(i,a),De(i,o),De(o,u),De(i,f)},p(v,S){n===(n=p(v))&&_?_.p(v,S):(_.d(1),_=n(v),_&&(_.c(),_.m(i,a)))},d(v){v&&Q(i),_.d()}}}function Q1(l){let i,a,o=Ni(l[0]),u=[];for(let f=0;f{"links"in _&&a(0,o=_.links),"width"in _&&a(1,u=_.width),"theme"in _&&a(2,f=_.theme),"themeOverrides"in _&&a(3,p=_.themeOverrides),"background"in _&&a(4,n=_.background)},[o,u,f,p,n]}class iv extends qi{constructor(i){super(),Zi(this,i,tv,ev,Ui,{links:0,width:1,theme:2,themeOverrides:3,background:4})}}function vm(l){let i,a;return{c(){i=je("h2"),a=Ut(l[3]),this.h()},l(o){i=qe(o,"H2",{class:!0});var u=Ye(i);a=Vt(u,l[3]),u.forEach(Q),this.h()},h(){me(i,"class","section-title"),Zt(i,"ons-u-vh",l[4])},m(o,u){Fe(o,i,u),De(i,a)},p(o,u){u&8&&Ci(a,o[3]),u&16&&Zt(i,"ons-u-vh",o[4])},d(o){o&&Q(i)}}}function rv(l){let i,a,o,u=l[3]&&vm(l);const f=l[18].default,p=Ir(f,l,l[20],null);return{c(){u&&u.c(),i=gt(),a=je("div"),p&&p.c(),this.h()},l(n){u&&u.l(n),i=_t(n),a=qe(n,"DIV",{class:!0});var _=Ye(a);p&&p.l(_),_.forEach(Q),this.h()},h(){me(a,"class","grid "+l[12]+" svelte-1og4gya"),At(a,"grid-gap",l[14]),At(a,"min-height",l[13])},m(n,_){u&&u.m(n,_),Fe(n,i,_),Fe(n,a,_),p&&p.m(a,null),o=!0},p(n,_){n[3]?u?u.p(n,_):(u=vm(n),u.c(),u.m(i.parentNode,i)):u&&(u.d(1),u=null),p&&p.p&&(!o||_&1048576)&&Ar(p,f,n,n[20],o?zr(f,n[20],_,null):Pr(n[20]),null)},i(n){o||(Ge(p,n),o=!0)},o(n){tt(p,n),o=!1},d(n){n&&(Q(i),Q(a)),u&&u.d(n),p&&p.d(n)}}}function bm(l){let i,a,o;return a=new rl({props:{cls:l[1],theme:l[5],themeOverrides:l[6],width:"narrow",marginBottom:l[8],$$slots:{default:[nv]},$$scope:{ctx:l}}}),{c(){i=je("figcaption"),ei(a.$$.fragment),this.h()},l(u){i=qe(u,"FIGCAPTION",{class:!0});var f=Ye(i);si(a.$$.fragment,f),f.forEach(Q),this.h()},h(){me(i,"class","svelte-1og4gya")},m(u,f){Fe(u,i,f),ti(a,i,null),o=!0},p(u,f){const p={};f&2&&(p.cls=u[1]),f&32&&(p.theme=u[5]),f&64&&(p.themeOverrides=u[6]),f&256&&(p.marginBottom=u[8]),f&1049088&&(p.$$scope={dirty:f,ctx:u}),a.$set(p)},i(u){o||(Ge(a.$$.fragment,u),o=!0)},o(u){tt(a.$$.fragment,u),o=!1},d(u){u&&Q(i),ii(a)}}}function nv(l){let i,a;return{c(){i=je("span"),a=new Yu(!1),this.h()},l(o){i=qe(o,"SPAN",{class:!0});var u=Ye(i);a=Qu(u,!1),u.forEach(Q),this.h()},h(){a.a=null,me(i,"class","ons-figure__caption")},m(o,u){Fe(o,i,u),a.m(l[9],i)},p(o,u){u&512&&a.p(o[9])},d(o){o&&Q(i)}}}function sv(l){let i,a,o,u,f;a=new rl({props:{id:l[0],cls:l[1],theme:l[5],themeOverrides:l[6],width:l[2],height:["tall","full"].includes(l[10])?l[10]:"auto",marginTop:l[7],marginBottom:l[9]?!1:l[8],$$slots:{default:[rv]},$$scope:{ctx:l}}});let p=l[9]&&bm(l);return{c(){i=je("figure"),ei(a.$$.fragment),o=gt(),p&&p.c(),this.h()},l(n){i=qe(n,"FIGURE",{"aria-label":!0,class:!0});var _=Ye(i);si(a.$$.fragment,_),o=_t(_),p&&p.l(_),_.forEach(Q),this.h()},h(){me(i,"aria-label",l[9]),me(i,"class","svelte-1og4gya"),q_(()=>l[19].call(i))},m(n,_){Fe(n,i,_),ti(a,i,null),De(i,o),p&&p.m(i,null),u=Z_(i,l[19].bind(i)),f=!0},p(n,[_]){const v={};_&1&&(v.id=n[0]),_&2&&(v.cls=n[1]),_&32&&(v.theme=n[5]),_&64&&(v.themeOverrides=n[6]),_&4&&(v.width=n[2]),_&1024&&(v.height=["tall","full"].includes(n[10])?n[10]:"auto"),_&128&&(v.marginTop=n[7]),_&768&&(v.marginBottom=n[9]?!1:n[8]),_&1048600&&(v.$$scope={dirty:_,ctx:n}),a.$set(v),n[9]?p?(p.p(n,_),_&512&&Ge(p,1)):(p=bm(n),p.c(),Ge(p,1),p.m(i,null)):p&&(Vi(),tt(p,1,1,()=>{p=null}),$i()),(!f||_&512)&&me(i,"aria-label",n[9])},i(n){f||(Ge(a.$$.fragment,n),Ge(p),f=!0)},o(n){tt(a.$$.fragment,n),tt(p),f=!1},d(n){n&&Q(i),ii(a),p&&p.d(),u()}}}function av(l,i,a){let o,{$$slots:u={},$$scope:f}=i,{id:p=null}=i,{cls:n=null}=i,{width:_="medium"}=i,{title:v=""}=i,{hideTitle:S=!1}=i,{theme:T=null}=i,{themeOverrides:I=null}=i,{marginTop:z=!1}=i,{marginBottom:M=!0}=i,{colwidth:C="medium"}=i,{caption:R=""}=i,{height:D=200}=i,{gap:F=12}=i,j=!C||C==="full"?"":`grid-${C}`,ee=D==="full"?"100vh":Number.isNaN(D)?D:D+"px",oe=Number.isNaN(F)?F:F+"px";const se={narrow:{w:180,c:4},medium:{w:280,c:3},wide:{w:400,c:2},full:{w:"100%",c:1}};let ne;const re=K_(se[C].c);Ka("cols",re);function ve(){ne=this.clientWidth,a(11,ne)}return l.$$set=ze=>{"id"in ze&&a(0,p=ze.id),"cls"in ze&&a(1,n=ze.cls),"width"in ze&&a(2,_=ze.width),"title"in ze&&a(3,v=ze.title),"hideTitle"in ze&&a(4,S=ze.hideTitle),"theme"in ze&&a(5,T=ze.theme),"themeOverrides"in ze&&a(6,I=ze.themeOverrides),"marginTop"in ze&&a(7,z=ze.marginTop),"marginBottom"in ze&&a(8,M=ze.marginBottom),"colwidth"in ze&&a(15,C=ze.colwidth),"caption"in ze&&a(9,R=ze.caption),"height"in ze&&a(10,D=ze.height),"gap"in ze&&a(16,F=ze.gap),"$$scope"in ze&&a(20,f=ze.$$scope)},l.$$.update=()=>{l.$$.dirty&100352&&a(17,o=C=="full"?1:ne?Math.floor((ne+F)/(se[C].w+F)):se[C].c),l.$$.dirty&131072&&re.set(o)},[p,n,_,v,S,T,I,z,M,R,D,ne,j,ee,oe,C,F,o,u,ve,f]}class ov extends qi{constructor(i){super(),Zi(this,i,av,sv,Ui,{id:0,cls:1,width:2,title:3,hideTitle:4,theme:5,themeOverrides:6,marginTop:7,marginBottom:8,colwidth:15,caption:9,height:10,gap:16})}}function lv(l){let i;const a=l[13].default,o=Ir(a,l,l[14],null);return{c(){o&&o.c()},l(u){o&&o.l(u)},m(u,f){o&&o.m(u,f),i=!0},p(u,f){o&&o.p&&(!i||f&16384)&&Ar(o,a,u,u[14],i?zr(a,u[14],f,null):Pr(u[14]),null)},i(u){i||(Ge(o,u),i=!0)},o(u){tt(o,u),i=!1},d(u){o&&o.d(u)}}}function cv(l){let i,a;return i=new ov({props:{id:l[0],cls:l[1],width:l[2],height:l[10],title:l[3],hideTitle:l[4],theme:l[5],themeOverrides:l[6],marginTop:l[7],marginBottom:l[8],colwidth:l[9],gap:l[11],$$slots:{default:[lv]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,[u]){const f={};u&1&&(f.id=o[0]),u&2&&(f.cls=o[1]),u&4&&(f.width=o[2]),u&1024&&(f.height=o[10]),u&8&&(f.title=o[3]),u&16&&(f.hideTitle=o[4]),u&32&&(f.theme=o[5]),u&64&&(f.themeOverrides=o[6]),u&128&&(f.marginTop=o[7]),u&256&&(f.marginBottom=o[8]),u&512&&(f.colwidth=o[9]),u&2048&&(f.gap=o[11]),u&16384&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function uv(l,i,a){let{$$slots:o={},$$scope:u}=i,{id:f=null}=i,{cls:p="ons-cards"}=i,{width:n="wide"}=i,{title:_=""}=i,{hideTitle:v=!1}=i,{theme:S=null}=i,{themeOverrides:T=null}=i,{marginTop:I=!1}=i,{marginBottom:z=!0}=i,{colwidth:M="medium"}=i,{height:C=200}=i,{noBackground:R=!1}=i,{gap:D=R?36:16}=i;return Ka("noBackground",R),l.$$set=F=>{"id"in F&&a(0,f=F.id),"cls"in F&&a(1,p=F.cls),"width"in F&&a(2,n=F.width),"title"in F&&a(3,_=F.title),"hideTitle"in F&&a(4,v=F.hideTitle),"theme"in F&&a(5,S=F.theme),"themeOverrides"in F&&a(6,T=F.themeOverrides),"marginTop"in F&&a(7,I=F.marginTop),"marginBottom"in F&&a(8,z=F.marginBottom),"colwidth"in F&&a(9,M=F.colwidth),"height"in F&&a(10,C=F.height),"noBackground"in F&&a(12,R=F.noBackground),"gap"in F&&a(11,D=F.gap),"$$scope"in F&&a(14,u=F.$$scope)},[f,p,n,_,v,S,T,I,z,M,C,D,R,o,u]}class jf extends qi{constructor(i){super(),Zi(this,i,uv,cv,Ui,{id:0,cls:1,width:2,title:3,hideTitle:4,theme:5,themeOverrides:6,marginTop:7,marginBottom:8,colwidth:9,height:10,noBackground:12,gap:11})}}const wm=()=>Math.random().toString(16).slice(2,8),Pf=(l,i=!1)=>typeof l=="string"?l.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").concat(i?`-${wm()}`:""):wm(),hv=l=>{if(!l)return!1;const i=new Date(l);return!isNaN(i)},xm=(l,i="en-GB",a={year:"numeric",month:"long",day:"2-digit"})=>new Date(l).toLocaleDateString(i,a);function fv(l){let i,a;return{c(){i=je("h3"),a=Ut(l[0]),this.h()},l(o){i=qe(o,"H3",{class:!0});var u=Ye(i);a=Vt(u,l[0]),u.forEach(Q),this.h()},h(){me(i,"class","ons-card__title ons-u-fs-m"),Zt(i,"ons-u-vh",l[2]),At(i,"padding",l[8]?"":"8px 16px 0"),At(i,"margin-bottom","5px")},m(o,u){Fe(o,i,u),De(i,a)},p(o,u){u&1&&Ci(a,o[0]),u&4&&Zt(i,"ons-u-vh",o[2]),u&256&&At(i,"padding",o[8]?"":"8px 16px 0")},d(o){o&&Q(i)}}}function dv(l){let i,a,o,u,f=l[3]&&Sm(l);return{c(){i=je("a"),f&&f.c(),a=gt(),o=je("h3"),u=Ut(l[0]),this.h()},l(p){i=qe(p,"A",{href:!0,class:!0});var n=Ye(i);f&&f.l(n),a=_t(n),o=qe(n,"H3",{class:!0});var _=Ye(o);u=Vt(_,l[0]),_.forEach(Q),n.forEach(Q),this.h()},h(){me(o,"class","ons-card__title ons-u-fs-m"),At(o,"padding",!l[8]&&!l[3]?"12px 16px 0":l[8]?"":"0 16px"),me(i,"href",l[5]),me(i,"class","ons-card__link ons-u-db"),Zt(i,"ons-u-vh",l[2])},m(p,n){Fe(p,i,n),f&&f.m(i,null),De(i,a),De(i,o),De(o,u)},p(p,n){p[3]?f?f.p(p,n):(f=Sm(p),f.c(),f.m(i,a)):f&&(f.d(1),f=null),n&1&&Ci(u,p[0]),n&264&&At(o,"padding",!p[8]&&!p[3]?"12px 16px 0":p[8]?"":"0 16px"),n&32&&me(i,"href",p[5]),n&4&&Zt(i,"ons-u-vh",p[2])},d(p){p&&Q(i),f&&f.d()}}}function Sm(l){let i,a;return{c(){i=je("img"),this.h()},l(o){i=qe(o,"IMG",{class:!0,src:!0,alt:!0,loading:!0}),this.h()},h(){me(i,"class","ons-card__image ons-u-mb-s svelte-1s3ctdj"),hm(i.src,a=l[3])||me(i,"src",a),me(i,"alt",l[4]),me(i,"loading","lazy"),At(i,"width","100%")},m(o,u){Fe(o,i,u)},p(o,u){u&8&&!hm(i.src,a=o[3])&&me(i,"src",a),u&16&&me(i,"alt",o[4])},d(o){o&&Q(i)}}}function pv(l){let i,a,o,u,f,p,n,_=`span ${l[9]&&l[10]<3?l[10]:l[6]==1?1:l[6]>l[10]?l[10]:l[6]}`,v;function S(C,R){if(C[5]&&C[0])return dv;if(C[0])return fv}let T=S(l),I=T&&T(l);const z=l[13].default,M=Ir(z,l,l[12],null);return{c(){i=je("div"),a=je("div"),I&&I.c(),o=gt(),u=je("div"),M&&M.c(),this.h()},l(C){i=qe(C,"DIV",{class:!0});var R=Ye(i);a=qe(R,"DIV",{id:!0,class:!0,"aria-describedby":!0});var D=Ye(a);I&&I.l(D),o=_t(D),u=qe(D,"DIV",{id:!0,class:!0});var F=Ye(u);M&&M.l(F),F.forEach(Q),D.forEach(Q),R.forEach(Q),this.h()},h(){me(u,"id",f=l[1]+"_text"),me(u,"class","svelte-1s3ctdj"),Zt(u,"tile__body",!l[8]),me(a,"id",l[1]),me(a,"class","ons-card"),me(a,"aria-describedby",p=l[1]+"_text"),me(i,"class",n=Sc(l[8]?"":"tile tile__content")+" svelte-1s3ctdj"),At(i,"grid-column",_),At(i,"grid-column-end",l[9]?l[10]+1:null),At(i,"grid-row",l[7]>1?`span ${l[7]}`:null)},m(C,R){Fe(C,i,R),De(i,a),I&&I.m(a,null),De(a,o),De(a,u),M&&M.m(u,null),v=!0},p(C,[R]){T===(T=S(C))&&I?I.p(C,R):(I&&I.d(1),I=T&&T(C),I&&(I.c(),I.m(a,o))),M&&M.p&&(!v||R&4096)&&Ar(M,z,C,C[12],v?zr(z,C[12],R,null):Pr(C[12]),null),(!v||R&2&&f!==(f=C[1]+"_text"))&&me(u,"id",f),(!v||R&256)&&Zt(u,"tile__body",!C[8]),(!v||R&2)&&me(a,"id",C[1]),(!v||R&2&&p!==(p=C[1]+"_text"))&&me(a,"aria-describedby",p),(!v||R&256&&n!==(n=Sc(C[8]?"":"tile tile__content")+" svelte-1s3ctdj"))&&me(i,"class",n),R&1600&&_!==(_=`span ${C[9]&&C[10]<3?C[10]:C[6]==1?1:C[6]>C[10]?C[10]:C[6]}`)&&At(i,"grid-column",_),R&1536&&At(i,"grid-column-end",C[9]?C[10]+1:null),R&128&&At(i,"grid-row",C[7]>1?`span ${C[7]}`:null)},i(C){v||(Ge(M,C),v=!0)},o(C){tt(M,C),v=!1},d(C){C&&Q(i),I&&I.d(),M&&M.d(C)}}}function mv(l,i,a){let o,{$$slots:u={},$$scope:f}=i,{title:p=null}=i,{id:n=Pf(p)}=i,{hideTitle:_=!1}=i,{image:v=null}=i,{imageAlt:S=null}=i,{href:T=null}=i,{colspan:I=1}=i,{rowspan:z=1}=i,{noBackground:M=Xa("noBackground")||!1}=i,{grow:C=!1}=i;const R=Xa("cols");return eh(l,R,D=>a(10,o=D)),l.$$set=D=>{"title"in D&&a(0,p=D.title),"id"in D&&a(1,n=D.id),"hideTitle"in D&&a(2,_=D.hideTitle),"image"in D&&a(3,v=D.image),"imageAlt"in D&&a(4,S=D.imageAlt),"href"in D&&a(5,T=D.href),"colspan"in D&&a(6,I=D.colspan),"rowspan"in D&&a(7,z=D.rowspan),"noBackground"in D&&a(8,M=D.noBackground),"grow"in D&&a(9,C=D.grow),"$$scope"in D&&a(12,f=D.$$scope)},[p,n,_,v,S,T,I,z,M,C,o,R,f,u]}class Ps extends qi{constructor(i){super(),Zi(this,i,mv,pv,Ui,{title:0,id:1,hideTitle:2,image:3,imageAlt:4,href:5,colspan:6,rowspan:7,noBackground:8,grow:9})}}function Em(l){let i,a="!";return{c(){i=je("div"),i.textContent=a,this.h()},l(o){i=qe(o,"DIV",{class:!0,"aria-hidden":!0,"data-svelte-h":!0}),Cr(i)!=="svelte-z0ta1j"&&(i.textContent=a),this.h()},h(){me(i,"class","ons-panel__icon"),me(i,"aria-hidden","true")},m(o,u){Fe(o,i,u)},d(o){o&&Q(i)}}}function km(l){let i,a,o;return{c(){i=je("p"),a=je("strong"),o=Ut(l[0])},l(u){i=qe(u,"P",{});var f=Ye(i);a=qe(f,"STRONG",{});var p=Ye(a);o=Vt(p,l[0]),p.forEach(Q),f.forEach(Q)},m(u,f){Fe(u,i,f),De(i,a),De(a,o)},p(u,f){f&1&&Ci(o,u[0])},d(u){u&&Q(i)}}}function gv(l){let i,a,o,u,f=l[1]==="warning"?"Warning:":"Important information:",p,n,_,v,S,T,I,z=l[2]&&Em(),M=l[0]&&km(l);const C=l[5].default,R=Ir(C,l,l[4],null);return{c(){i=je("div"),a=je("div"),z&&z.c(),o=gt(),u=je("span"),p=Ut(f),n=gt(),_=je("div"),v=je("div"),M&&M.c(),S=gt(),R&&R.c(),this.h()},l(D){i=qe(D,"DIV",{class:!0,style:!0});var F=Ye(i);a=qe(F,"DIV",{class:!0});var j=Ye(a);z&&z.l(j),o=_t(j),u=qe(j,"SPAN",{class:!0});var ee=Ye(u);p=Vt(ee,f),ee.forEach(Q),n=_t(j),_=qe(j,"DIV",{class:!0});var oe=Ye(_);v=qe(oe,"DIV",{class:!0});var se=Ye(v);M&&M.l(se),S=_t(se),R&&R.l(se),se.forEach(Q),oe.forEach(Q),j.forEach(Q),F.forEach(Q),this.h()},h(){me(u,"class","ons-panel__assistive-text ons-u-vh"),me(v,"class","default-line-height"),Zt(v,"ons-u-fs-r",l[1]!=="warning"),me(_,"class","ons-panel__body"),me(a,"class","ons-u-bg--tr"),Zt(a,"ons-panel--warn",l[2]&&l[1]!=="warning"),me(i,"class",T="ons-panel "+(l[1]==="warning"?"ons-panel--warn":"ons-panel--info")+" ons-panel--no-title svelte-1l6efpg"),me(i,"style",l[3])},m(D,F){Fe(D,i,F),De(i,a),z&&z.m(a,null),De(a,o),De(a,u),De(u,p),De(a,n),De(a,_),De(_,v),M&&M.m(v,null),De(v,S),R&&R.m(v,null),I=!0},p(D,[F]){D[2]?z||(z=Em(),z.c(),z.m(a,o)):z&&(z.d(1),z=null),(!I||F&2)&&f!==(f=D[1]==="warning"?"Warning:":"Important information:")&&Ci(p,f),D[0]?M?M.p(D,F):(M=km(D),M.c(),M.m(v,S)):M&&(M.d(1),M=null),R&&R.p&&(!I||F&16)&&Ar(R,C,D,D[4],I?zr(C,D[4],F,null):Pr(D[4]),null),(!I||F&2)&&Zt(v,"ons-u-fs-r",D[1]!=="warning"),(!I||F&6)&&Zt(a,"ons-panel--warn",D[2]&&D[1]!=="warning"),(!I||F&2&&T!==(T="ons-panel "+(D[1]==="warning"?"ons-panel--warn":"ons-panel--info")+" ons-panel--no-title svelte-1l6efpg"))&&me(i,"class",T),(!I||F&8)&&me(i,"style",D[3])},i(D){I||(Ge(R,D),I=!0)},o(D){tt(R,D),I=!1},d(D){D&&Q(i),z&&z.d(),M&&M.d(),R&&R.d(D)}}}function _v(l,i,a){let o,{$$slots:u={},$$scope:f}=i,{title:p=null}=i,{mode:n="info"}=i,{important:_=n==="warning"}=i;return l.$$set=v=>{"title"in v&&a(0,p=v.title),"mode"in v&&a(1,n=v.mode),"important"in v&&a(2,_=v.important),"$$scope"in v&&a(4,f=v.$$scope)},l.$$.update=()=>{l.$$.dirty&2&&a(3,o=n==="success"?"background: var(--ons-color-success-tint); border-color: var(--ons-color-success);":n==="pending"?"background: var(--ons-color-pending-tint); border-color: var(--ons-color-pending);":n==="error"?"background: var(--ons-color-errors-tint); border-color: var(--ons-color-errors);":null)},[p,n,_,o,f,u]}class Y_ extends qi{constructor(i){super(),Zi(this,i,_v,gv,Ui,{title:0,mode:1,important:2})}}function Tm(l){let i,a;return{c(){i=je("h2"),a=Ut(l[3]),this.h()},l(o){i=qe(o,"H2",{class:!0});var u=Ye(i);a=Vt(u,l[3]),u.forEach(Q),this.h()},h(){me(i,"class","section-title"),Zt(i,"ons-u-vh",l[4])},m(o,u){Fe(o,i,u),De(i,a)},p(o,u){u&8&&Ci(a,o[3]),u&16&&Zt(i,"ons-u-vh",o[4])},d(o){o&&Q(i)}}}function yv(l){let i,a,o,u=l[3]&&Tm(l);const f=l[10].default,p=Ir(f,l,l[11],null);return{c(){i=je("section"),u&&u.c(),a=gt(),p&&p.c(),this.h()},l(n){i=qe(n,"SECTION",{"aria-label":!0,class:!0});var _=Ye(i);u&&u.l(_),a=_t(_),p&&p.l(_),_.forEach(Q),this.h()},h(){me(i,"aria-label",l[3]),me(i,"class","ons-feature__section")},m(n,_){Fe(n,i,_),u&&u.m(i,null),De(i,a),p&&p.m(i,null),o=!0},p(n,_){n[3]?u?u.p(n,_):(u=Tm(n),u.c(),u.m(i,a)):u&&(u.d(1),u=null),p&&p.p&&(!o||_&2048)&&Ar(p,f,n,n[11],o?zr(f,n[11],_,null):Pr(n[11]),null),(!o||_&8)&&me(i,"aria-label",n[3])},i(n){o||(Ge(p,n),o=!0)},o(n){tt(p,n),o=!1},d(n){n&&Q(i),u&&u.d(),p&&p.d(n)}}}function vv(l){let i,a;return i=new rl({props:{id:l[0]?l[0]:Pf(l[3]),cls:l[1],theme:l[5],themeOverrides:l[6],width:l[2],marginTop:l[8],marginBottom:l[9],background:l[7],$$slots:{default:[yv]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,[u]){const f={};u&9&&(f.id=o[0]?o[0]:Pf(o[3])),u&2&&(f.cls=o[1]),u&32&&(f.theme=o[5]),u&64&&(f.themeOverrides=o[6]),u&4&&(f.width=o[2]),u&256&&(f.marginTop=o[8]),u&512&&(f.marginBottom=o[9]),u&128&&(f.background=o[7]),u&2072&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function bv(l,i,a){let{$$slots:o={},$$scope:u}=i,{id:f=null}=i,{cls:p=null}=i,{width:n="narrow"}=i,{title:_=""}=i,{hideTitle:v=!1}=i,{theme:S=null}=i,{themeOverrides:T=null}=i,{background:I=null}=i,{marginTop:z=!1}=i,{marginBottom:M=!0}=i;return l.$$set=C=>{"id"in C&&a(0,f=C.id),"cls"in C&&a(1,p=C.cls),"width"in C&&a(2,n=C.width),"title"in C&&a(3,_=C.title),"hideTitle"in C&&a(4,v=C.hideTitle),"theme"in C&&a(5,S=C.theme),"themeOverrides"in C&&a(6,T=C.themeOverrides),"background"in C&&a(7,I=C.background),"marginTop"in C&&a(8,z=C.marginTop),"marginBottom"in C&&a(9,M=C.marginBottom),"$$scope"in C&&a(11,u=C.$$scope)},[f,p,n,_,v,S,T,I,z,M,o,u]}class wv extends qi{constructor(i){super(),Zi(this,i,bv,vv,Ui,{id:0,cls:1,width:2,title:3,hideTitle:4,theme:5,themeOverrides:6,background:7,marginTop:8,marginBottom:9})}}function xv(l){let i,a,o,u,f,p,n,_=`
';return{c(){i=je("div"),i.innerHTML=a,this.h()},l(o){i=qe(o,"DIV",{class:!0,"data-svelte-h":!0}),Cr(i)!=="svelte-pqjcyt"&&(i.innerHTML=a),this.h()},h(){me(i,"class","ons-grid__col ons-col-2@m svelte-lohx48")},m(o,u){Fe(o,i,u)},d(o){o&&Q(i)}}}function Rm(l){let i,a='
';return{c(){i=je("div"),i.innerHTML=a,this.h()},l(o){i=qe(o,"DIV",{class:!0,"data-svelte-h":!0}),Cr(i)!=="svelte-9wk1rb"&&(i.innerHTML=a),this.h()},h(){me(i,"class","ons-grid ons-u-mb-m")},m(o,u){Fe(o,i,u)},d(o){o&&Q(i)}}}function Lv(l){let i,a,o,u,f,p,n,_,v,S,T,I,z,M;const C=l[7].before,R=Ir(C,l,l[8],Dm);let D=l[1]&&Lm();const F=l[7].default,j=Ir(F,l,l[8],null),ee=l[7].brand,oe=Ir(ee,l,l[8],Mm);let se=l[2]&&Rm();I=new Pv({props:{meta:l[3]}});const ne=l[7].after,re=Ir(ne,l,l[8],zm);return{c(){i=je("section"),R&&R.c(),a=gt(),o=je("div"),u=je("div"),f=je("h1"),p=Ut(l[0]),n=gt(),D&&D.c(),_=gt(),j&&j.c(),v=gt(),oe&&oe.c(),S=gt(),se&&se.c(),T=gt(),ei(I.$$.fragment),z=gt(),re&&re.c(),this.h()},l(ve){i=qe(ve,"SECTION",{class:!0});var ze=Ye(i);R&&R.l(ze),a=_t(ze),o=qe(ze,"DIV",{class:!0});var nt=Ye(o);u=qe(nt,"DIV",{class:!0});var be=Ye(u);f=qe(be,"H1",{class:!0});var Ke=Ye(f);p=Vt(Ke,l[0]),Ke.forEach(Q),be.forEach(Q),n=_t(nt),D&&D.l(nt),nt.forEach(Q),_=_t(ze),j&&j.l(ze),v=_t(ze),oe&&oe.l(ze),S=_t(ze),se&&se.l(ze),T=_t(ze),si(I.$$.fragment,ze),z=_t(ze),re&&re.l(ze),ze.forEach(Q),this.h()},h(){me(f,"class","ons-u-fs-xxxl ons-u-mt-s ons-u-mb-m ons-u-pb-no ons-u-pt-no"),me(u,"class","ons-grid__col ons-col-10@m svelte-lohx48"),me(o,"class","ons-grid"),me(i,"class","ons-u-mb-xl")},m(ve,ze){Fe(ve,i,ze),R&&R.m(i,null),De(i,a),De(i,o),De(o,u),De(u,f),De(f,p),De(o,n),D&&D.m(o,null),De(i,_),j&&j.m(i,null),De(i,v),oe&&oe.m(i,null),De(i,S),se&&se.m(i,null),De(i,T),ti(I,i,null),De(i,z),re&&re.m(i,null),M=!0},p(ve,ze){R&&R.p&&(!M||ze&256)&&Ar(R,C,ve,ve[8],M?zr(C,ve[8],ze,Dv):Pr(ve[8]),Dm),(!M||ze&1)&&Ci(p,ve[0]),ve[1]?D||(D=Lm(),D.c(),D.m(o,null)):D&&(D.d(1),D=null),j&&j.p&&(!M||ze&256)&&Ar(j,F,ve,ve[8],M?zr(F,ve[8],ze,null):Pr(ve[8]),null),oe&&oe.p&&(!M||ze&256)&&Ar(oe,ee,ve,ve[8],M?zr(ee,ve[8],ze,Mv):Pr(ve[8]),Mm),ve[2]?se||(se=Rm(),se.c(),se.m(i,T)):se&&(se.d(1),se=null);const nt={};ze&8&&(nt.meta=ve[3]),I.$set(nt),re&&re.p&&(!M||ze&256)&&Ar(re,ne,ve,ve[8],M?zr(ne,ve[8],ze,zv):Pr(ve[8]),zm)},i(ve){M||(Ge(R,ve),Ge(j,ve),Ge(oe,ve),Ge(I.$$.fragment,ve),Ge(re,ve),M=!0)},o(ve){tt(R,ve),tt(j,ve),tt(oe,ve),tt(I.$$.fragment,ve),tt(re,ve),M=!1},d(ve){ve&&Q(i),R&&R.d(ve),D&&D.d(),j&&j.d(ve),oe&&oe.d(ve),se&&se.d(),ii(I),re&&re.d(ve)}}}function Rv(l){let i,a;return i=new rl({props:{theme:l[4],themeOverrides:l[5],background:l[6],$$slots:{default:[Lv]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,[u]){const f={};u&16&&(f.theme=o[4]),u&32&&(f.themeOverrides=o[5]),u&64&&(f.background=o[6]),u&271&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function Bv(l,i,a){let{$$slots:o={},$$scope:u}=i,{title:f="Page title"}=i,{natStatBadge:p=!1}=i,{censusLogo:n=!1}=i,{meta:_=null}=i,{theme:v=null}=i,{themeOverrides:S=null}=i,{background:T=null}=i;return l.$$set=I=>{"title"in I&&a(0,f=I.title),"natStatBadge"in I&&a(1,p=I.natStatBadge),"censusLogo"in I&&a(2,n=I.censusLogo),"meta"in I&&a(3,_=I.meta),"theme"in I&&a(4,v=I.theme),"themeOverrides"in I&&a(5,S=I.themeOverrides),"background"in I&&a(6,T=I.background),"$$scope"in I&&a(8,u=I.$$scope)},[f,p,n,_,v,S,T,o,u]}class Ov extends qi{constructor(i){super(),Zi(this,i,Bv,Rv,Ui,{title:0,natStatBadge:1,censusLogo:2,meta:3,theme:4,themeOverrides:5,background:6})}}function Bm(l){let i,a,o,u;return{c(){i=ya("svg"),a=ya("path"),this.h()},l(f){i=va(f,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0,fill:!0});var p=Ye(i);a=va(p,"path",{d:!0}),Ye(a).forEach(Q),p.forEach(Q),this.h()},h(){me(a,"d",o=l[3][l[0]].d),me(i,"class","ons-svg-icon"),me(i,"viewBox",u=l[3][l[0]].viewBox),me(i,"xmlns","http://www.w3.org/2000/svg"),me(i,"focusable","false"),me(i,"fill","currentColor"),Zt(i,"ons-u-ml-xs",l[1]),Zt(i,"ons-u-mr-xs",l[2])},m(f,p){Fe(f,i,p),De(i,a)},p(f,p){p&1&&o!==(o=f[3][f[0]].d)&&me(a,"d",o),p&1&&u!==(u=f[3][f[0]].viewBox)&&me(i,"viewBox",u),p&2&&Zt(i,"ons-u-ml-xs",f[1]),p&4&&Zt(i,"ons-u-mr-xs",f[2])},d(f){f&&Q(i)}}}function Fv(l){let i,a=l[3][l[0]]&&Bm(l);return{c(){a&&a.c(),i=ri()},l(o){a&&a.l(o),i=ri()},m(o,u){a&&a.m(o,u),Fe(o,i,u)},p(o,[u]){o[3][o[0]]?a?a.p(o,u):(a=Bm(o),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},i:wi,o:wi,d(o){o&&Q(i),a&&a.d(o)}}}function Nv(l,i,a){let{type:o="arrow"}=i,{marginLeft:u=!1}=i,{marginRight:f=!1}=i;const p={arrow:{d:"m10 .2-.9.9c-.1.1-.1.4 0 .5l4 4H.6c-.2 0-.4.2-.4.4v1.2c0 .2.2.4.4.4h12.5l-3.9 3.7c-.2.2-.2.4 0 .6l.8.9c.2.2.4.2.6 0L16.8 7c.2-.2.2-.4 0-.6L10.7.3c-.3-.2-.5-.2-.7-.1z",viewBox:"0 0 17 13"},externalLink:{d:"M13.5,9H13a.5.5,0,0,0-.5.5v3h-9v-9h3A.5.5,0,0,0,7,3V2.5A.5.5,0,0,0,6.5,2h-4a.5.5,0,0,0-.5.5v11a.5.5,0,0,0,.5.5h11a.5.5,0,0,0,.5-.5v-4A.5.5,0,0,0,13.5,9Z M8.83,7.88a.51.51,0,0,0,.71,0l2.31-2.32,1.28,1.28A.51.51,0,0,0,14,6.49v-4a.52.52,0,0,0-.5-.5h-4A.51.51,0,0,0,9,2.52a.58.58,0,0,0,.14.33l1.28,1.28L8.12,6.46a.51.51,0,0,0,0,.71Z",viewBox:"2 2 12 12"},signout:{d:"M13.85,7.65l-2.5-2.5a.5.5,0,0,0-.71,0,.48.48,0,0,0-.15.36V7h-3a.5.5,0,0,0-.5.5v1a.5.5,0,0,0,.5.5h3v1.5A.49.49,0,0,0,11,11a.48.48,0,0,0,.34-.14l2.51-2.5a.49.49,0,0,0,0-.68Z M8.5,14h-6a.5.5,0,0,1-.5-.5V2.5A.5.5,0,0,1,2.5,2h6a.5.5,0,0,1,.5.5V3a.5.5,0,0,1-.5.5h-5v9h5A.5.5,0,0,1,9,13v.5A.5.5,0,0,1,8.5,14Z",viewBox:"0 0 12 12"},print:{d:"M17 4H3C1.3 4 0 5.2 0 6.8v5.5h4V16h12v-3.7h4V6.8C20 5.2 18.7 4 17 4zm-3 10H6V9h8v5zm3-6a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-1-8H4v3h12V0z",viewBox:"0 0 20 16"},download:{d:"M5.6 9a.48.48 0 0 0 .7 0l3-3.2a.48.48 0 0 0 0-.7C9.3 5 9.2 5 9 5H7.5V.5A.47.47 0 0 0 7 0H5a.47.47 0 0 0-.5.5V5H3a.47.47 0 0 0-.5.5.37.37 0 0 0 .1.3Z M11.5 9H11a.47.47 0 0 0-.5.5v1h-9v-1A.47.47 0 0 0 1 9H.5a.47.47 0 0 0-.5.5v2a.47.47 0 0 0 .5.5h11a.47.47 0 0 0 .5-.5v-2a.47.47 0 0 0-.5-.5Z",viewBox:"0 0 12 12"},tick:{d:"M14.35,3.9l-.71-.71a.5.5,0,0,0-.71,0h0L5.79,10.34,3.07,7.61a.51.51,0,0,0-.71,0l-.71.71a.51.51,0,0,0,0,.71l3.78,3.78a.5.5,0,0,0,.71,0h0L14.35,4.6A.5.5,0,0,0,14.35,3.9Z",viewBox:"1.5 3 13 10"},search:{d:"M11.86 10.23 8.62 6.99a4.63 4.63 0 1 0-6.34 1.64 4.55 4.55 0 0 0 2.36.64 4.65 4.65 0 0 0 2.33-.65l3.24 3.23a.46.46 0 0 0 .65 0l1-1a.48.48 0 0 0 0-.62Zm-5-3.32a3.28 3.28 0 0 1-2.31.93 3.22 3.22 0 1 1 2.35-.93Z",viewBox:"0 0 12 12"}};return l.$$set=n=>{"type"in n&&a(0,o=n.type),"marginLeft"in n&&a(1,u=n.marginLeft),"marginRight"in n&&a(2,f=n.marginRight)},[o,u,f,p]}let nh=class extends qi{constructor(i){super(),Zi(this,i,Nv,Fv,Ui,{type:0,marginLeft:1,marginRight:2})}};function Uv(l){let i,a,o,u,f,p,n,_,v=l[4]&&l[5]==="before"&&Om(l);const S=l[9].default,T=Ir(S,l,l[8],null);let I=l[4]&&l[5]==="after"&&Fm(l);return{c(){i=je("button"),a=je("span"),v&&v.c(),o=gt(),u=je("span"),T&&T.c(),f=gt(),I&&I.c(),this.h()},l(z){i=qe(z,"BUTTON",{type:!0,class:!0});var M=Ye(i);a=qe(M,"SPAN",{class:!0});var C=Ye(a);v&&v.l(C),o=_t(C),u=qe(C,"SPAN",{class:!0});var R=Ye(u);T&&T.l(R),R.forEach(Q),f=_t(C),I&&I.l(C),C.forEach(Q),M.forEach(Q),this.h()},h(){me(u,"class","ons-btn__text"),me(a,"class","ons-btn__inner"),me(i,"type",l[0]),me(i,"class","ons-btn"),i.disabled=l[6],Zt(i,"ons-btn--small",l[3]),Zt(i,"ons-btn--secondary",l[1]==="secondary"),Zt(i,"ons-btn--ghost",l[1]==="ghost"),Zt(i,"ons-btn--disabled",l[6])},m(z,M){Fe(z,i,M),De(i,a),v&&v.m(a,null),De(a,o),De(a,u),T&&T.m(u,null),De(a,f),I&&I.m(a,null),p=!0,n||(_=Ms(i,"click",l[11]),n=!0)},p(z,M){z[4]&&z[5]==="before"?v?(v.p(z,M),M&48&&Ge(v,1)):(v=Om(z),v.c(),Ge(v,1),v.m(a,o)):v&&(Vi(),tt(v,1,1,()=>{v=null}),$i()),T&&T.p&&(!p||M&256)&&Ar(T,S,z,z[8],p?zr(S,z[8],M,null):Pr(z[8]),null),z[4]&&z[5]==="after"?I?(I.p(z,M),M&48&&Ge(I,1)):(I=Fm(z),I.c(),Ge(I,1),I.m(a,null)):I&&(Vi(),tt(I,1,1,()=>{I=null}),$i()),(!p||M&1)&&me(i,"type",z[0]),(!p||M&64)&&(i.disabled=z[6]),(!p||M&8)&&Zt(i,"ons-btn--small",z[3]),(!p||M&2)&&Zt(i,"ons-btn--secondary",z[1]==="secondary"),(!p||M&2)&&Zt(i,"ons-btn--ghost",z[1]==="ghost"),(!p||M&64)&&Zt(i,"ons-btn--disabled",z[6])},i(z){p||(Ge(v),Ge(T,z),Ge(I),p=!0)},o(z){tt(v),tt(T,z),tt(I),p=!1},d(z){z&&Q(i),v&&v.d(),T&&T.d(z),I&&I.d(),n=!1,_()}}}function Vv(l){let i,a,o,u,f,p,n,_,v,S=l[4]&&l[5]==="before"&&Nm(l);const T=l[9].default,I=Ir(T,l,l[8],null);let z=l[4]&&l[5]==="after"&&Um(l);return{c(){i=je("a"),a=je("span"),S&&S.c(),o=gt(),u=je("span"),I&&I.c(),f=gt(),z&&z.c(),this.h()},l(M){i=qe(M,"A",{href:!0,role:!0,class:!0,disabled:!0});var C=Ye(i);a=qe(C,"SPAN",{class:!0});var R=Ye(a);S&&S.l(R),o=_t(R),u=qe(R,"SPAN",{class:!0});var D=Ye(u);I&&I.l(D),D.forEach(Q),f=_t(R),z&&z.l(R),R.forEach(Q),C.forEach(Q),this.h()},h(){me(u,"class","ons-btn__text"),me(a,"class","ons-btn__inner"),me(i,"href",p=l[6]?null:l[2]),me(i,"role","button"),me(i,"class","ons-btn ons-btn--link ons-js-submit-btn"),me(i,"disabled",l[6]),Zt(i,"ons-btn--small",l[3]),Zt(i,"ons-btn--secondary",l[1]==="secondary"),Zt(i,"ons-btn--ghost",l[1]==="ghost"),Zt(i,"ons-btn--disabled",l[6])},m(M,C){Fe(M,i,C),De(i,a),S&&S.m(a,null),De(a,o),De(a,u),I&&I.m(u,null),De(a,f),z&&z.m(a,null),n=!0,_||(v=Ms(i,"click",l[10]),_=!0)},p(M,C){M[4]&&M[5]==="before"?S?(S.p(M,C),C&48&&Ge(S,1)):(S=Nm(M),S.c(),Ge(S,1),S.m(a,o)):S&&(Vi(),tt(S,1,1,()=>{S=null}),$i()),I&&I.p&&(!n||C&256)&&Ar(I,T,M,M[8],n?zr(T,M[8],C,null):Pr(M[8]),null),M[4]&&M[5]==="after"?z?(z.p(M,C),C&48&&Ge(z,1)):(z=Um(M),z.c(),Ge(z,1),z.m(a,null)):z&&(Vi(),tt(z,1,1,()=>{z=null}),$i()),(!n||C&68&&p!==(p=M[6]?null:M[2]))&&me(i,"href",p),(!n||C&64)&&me(i,"disabled",M[6]),(!n||C&8)&&Zt(i,"ons-btn--small",M[3]),(!n||C&2)&&Zt(i,"ons-btn--secondary",M[1]==="secondary"),(!n||C&2)&&Zt(i,"ons-btn--ghost",M[1]==="ghost"),(!n||C&64)&&Zt(i,"ons-btn--disabled",M[6])},i(M){n||(Ge(S),Ge(I,M),Ge(z),n=!0)},o(M){tt(S),tt(I,M),tt(z),n=!1},d(M){M&&Q(i),S&&S.d(),I&&I.d(M),z&&z.d(),_=!1,v()}}}function Om(l){let i,a;return i=new nh({props:{type:l[4],marginRight:!0}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&16&&(f.type=o[4]),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function Fm(l){let i,a;return i=new nh({props:{type:l[4],marginLeft:!0}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&16&&(f.type=o[4]),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function Nm(l){let i,a;return i=new nh({props:{type:l[4],marginRight:!0}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&16&&(f.type=o[4]),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function Um(l){let i,a;return i=new nh({props:{type:l[4],marginLeft:!0}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&16&&(f.type=o[4]),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function $v(l){let i,a,o,u;const f=[Vv,Uv],p=[];function n(_,v){return _[2]?0:1}return i=n(l),a=p[i]=f[i](l),{c(){a.c(),o=ri()},l(_){a.l(_),o=ri()},m(_,v){p[i].m(_,v),Fe(_,o,v),u=!0},p(_,[v]){let S=i;i=n(_),i===S?p[i].p(_,v):(Vi(),tt(p[S],1,1,()=>{p[S]=null}),$i(),a=p[i],a?a.p(_,v):(a=p[i]=f[i](_),a.c()),Ge(a,1),a.m(o.parentNode,o))},i(_){u||(Ge(a),u=!0)},o(_){tt(a),u=!1},d(_){_&&Q(o),p[i].d(_)}}}function jv(l,i,a){let{$$slots:o={},$$scope:u}=i;const f=$f();let{type:p="button"}=i,{variant:n="primary"}=i,{href:_=""}=i,{small:v=!1}=i,{icon:S=""}=i,{iconPosition:T="before"}=i,{disabled:I=!1}=i;const z=C=>f("click",C),M=C=>f("click",C);return l.$$set=C=>{"type"in C&&a(0,p=C.type),"variant"in C&&a(1,n=C.variant),"href"in C&&a(2,_=C.href),"small"in C&&a(3,v=C.small),"icon"in C&&a(4,S=C.icon),"iconPosition"in C&&a(5,T=C.iconPosition),"disabled"in C&&a(6,I=C.disabled),"$$scope"in C&&a(8,u=C.$$scope)},[p,n,_,v,S,T,I,f,u,o,z,M]}class qf extends qi{constructor(i){super(),Zi(this,i,jv,$v,Ui,{type:0,variant:1,href:2,small:3,icon:4,iconPosition:5,disabled:6})}}var bf=B1,qv=function(l){var i,a,o,u;if(i=/^((?:rgb|hs[lv]|cmyk|xyz|lab)a?)\s*\(([^\)]*)\)/.exec(l)){var f=i[1],p=f.replace(/a$/,""),n=p==="cmyk"?4:3;a=bf[p],o=i[2].replace(/^\s+|\s+$/g,"").split(/\s*,\s*/).map(function(v,S){return/%$/.test(v)&&S===n?parseFloat(v)/100:(/%$/.test(v),parseFloat(v))}),f===p&&o.push(1),u=o[n]===void 0?1:o[n],o=o.slice(0,n),a[p]=function(){return o}}else if(/^#[A-Fa-f0-9]+$/.test(l)){var p=l.replace(/^#/,""),n=p.length;a=bf.rgb,o=p.split(n===3?/(.)/:/(..)/),o=o.filter(Boolean).map(function(T){return parseInt(n===3?T+T:T,16)}),u=1,a.rgb=function(){return o},o[0]||(o[0]=0),o[1]||(o[1]=0),o[2]||(o[2]=0)}else a=bf.keyword,a.keyword=function(){return l},o=l,u=1;var _={rgb:void 0,hsl:void 0,hsv:void 0,cmyk:void 0,keyword:void 0,hex:void 0};try{_.rgb=a.rgb(o)}catch{}try{_.hsl=a.hsl(o)}catch{}try{_.hsv=a.hsv(o)}catch{}try{_.cmyk=a.cmyk(o)}catch{}try{_.keyword=a.keyword(o)}catch{}return _.rgb&&(_.hex="#"+_.rgb.map(function(v){var S=v.toString(16);return S.length===1?"0"+S:S}).join("")),_.rgb&&(_.rgba=_.rgb.concat(u)),_.hsl&&(_.hsla=_.hsl.concat(u)),_.hsv&&(_.hsva=_.hsv.concat(u)),_.cmyk&&(_.cmyka=_.cmyk.concat(u)),_};const Zv=rh(qv);function Gv(l){return l}function Wv(l){if(l==null)return Gv;var i,a,o=l.scale[0],u=l.scale[1],f=l.translate[0],p=l.translate[1];return function(n,_){_||(i=a=0);var v=2,S=n.length,T=new Array(S);for(T[0]=(i+=n[0])*o+f,T[1]=(a+=n[1])*u+p;v + 11.6069336,9.96313475 11.6069336,8.83813475 C11.581543,7.68774412 10.7612305,6.8125 9.42822263,6.8125 Z">`,Ge,q,We,Tt,it="this link will open in a new tab",Bt,Ne,Xe,ie,ve=``,De,Y,ue,Qe,wt="this link will open in a new tab",vt;return{c(){i=Be("section"),a=Be("h2"),o=Ot(l[0]),u=ut(),f=Be("ul"),p=Be("li"),n=Be("span"),n.innerHTML=_,v=ut(),E=Be("a"),S=Ot("Facebook"),C=Be("span"),C.textContent=z,I=ut(),L=Be("li"),D=Be("span"),D.innerHTML=F,V=ut(),ee=Be("a"),se=Ot("Twitter"),ne=Be("span"),ne.textContent=le,ce=ut(),Me=Be("li"),et=Be("span"),et.innerHTML=ye,Ge=ut(),q=Be("a"),We=Ot("LinkedIn"),Tt=Be("span"),Tt.textContent=it,Ne=ut(),Xe=Be("li"),ie=Be("span"),ie.innerHTML=ve,De=ut(),Y=Be("a"),ue=Ot("Email"),Qe=Be("span"),Qe.textContent=wt,this.h()},l(It){i=Oe(It,"SECTION",{class:!0,"aria-label":!0});var Nt=Je(i);a=Oe(Nt,"H2",{class:!0});var fi=Je(a);o=Ft(fi,l[0]),fi.forEach(X),u=ht(Nt),f=Oe(Nt,"UL",{class:!0});var gt=Je(f);p=Oe(gt,"LI",{class:!0});var _i=Je(p);n=Oe(_i,"SPAN",{class:!0,"data-svelte-h":!0}),dr(n)!=="svelte-ywkcxu"&&(n.innerHTML=_),v=ht(_i),E=Oe(_i,"A",{href:!0,class:!0,target:!0,rel:!0});var Z=Je(E);S=Ft(Z,"Facebook"),C=Oe(Z,"SPAN",{class:!0,"data-svelte-h":!0}),dr(C)!=="svelte-1i77wdx"&&(C.textContent=z),Z.forEach(X),_i.forEach(X),I=ht(gt),L=Oe(gt,"LI",{class:!0});var lt=Je(L);D=Oe(lt,"SPAN",{class:!0,"data-svelte-h":!0}),dr(D)!=="svelte-7gfqv"&&(D.innerHTML=F),V=ht(lt),ee=Oe(lt,"A",{href:!0,class:!0,target:!0,rel:!0});var nt=Je(ee);se=Ft(nt,"Twitter"),ne=Oe(nt,"SPAN",{class:!0,"data-svelte-h":!0}),dr(ne)!=="svelte-1i77wdx"&&(ne.textContent=le),nt.forEach(X),lt.forEach(X),ce=ht(gt),Me=Oe(gt,"LI",{class:!0});var Ee=Je(Me);et=Oe(Ee,"SPAN",{class:!0,"data-svelte-h":!0}),dr(et)!=="svelte-dxqxbr"&&(et.innerHTML=ye),Ge=ht(Ee),q=Oe(Ee,"A",{href:!0,class:!0,target:!0,rel:!0});var _e=Je(q);We=Ft(_e,"LinkedIn"),Tt=Oe(_e,"SPAN",{class:!0,"data-svelte-h":!0}),dr(Tt)!=="svelte-1i77wdx"&&(Tt.textContent=it),_e.forEach(X),Ee.forEach(X),Ne=ht(gt),Xe=Oe(gt,"LI",{class:!0});var Ze=Je(Xe);ie=Oe(Ze,"SPAN",{class:!0,"data-svelte-h":!0}),dr(ie)!=="svelte-1vk6k44"&&(ie.innerHTML=ve),De=ht(Ze),Y=Oe(Ze,"A",{href:!0,class:!0,target:!0,rel:!0});var pt=Je(Y);ue=Ft(pt,"Email"),Qe=Oe(pt,"SPAN",{class:!0,"data-svelte-h":!0}),dr(Qe)!=="svelte-1i77wdx"&&(Qe.textContent=wt),pt.forEach(X),Ze.forEach(X),gt.forEach(X),Nt.forEach(X),this.h()},h(){pe(a,"class","ons-u-fs-r--b ons-u-mb-xs"),pe(n,"class","ons-list__prefix"),pe(C,"class","ons-u-vh"),pe(E,"href",P="https://www.facebook.com/sharer/sharer.php?u="+l[6]),pe(E,"class","ons-list__link ons-u-fs-r ons-u-pt-xxs"),pe(E,"target","_blank"),pe(E,"rel","noreferrer external"),pe(p,"class","ons-list__item ons-u-pl-no ons-u-pr-xs"),pe(D,"class","ons-list__prefix"),pe(ne,"class","ons-u-vh"),pe(ee,"href",ge="https://twitter.com/intent/tweet?original_referer&text="+l[7]+"&url="+l[6]),pe(ee,"class","ons-list__link ons-u-fs-r ons-u-pt-xxs"),pe(ee,"target","_blank"),pe(ee,"rel","noreferrer external"),pe(L,"class","ons-list__item ons-u-pl-no ons-u-pr-xs"),pe(et,"class","ons-list__prefix"),pe(Tt,"class","ons-u-vh"),pe(q,"href",Bt="https://www.linkedin.com/sharing/share-offsite/?url="+l[6]),pe(q,"class","ons-list__link ons-u-fs-r ons-u-pt-xxs"),pe(q,"target","_blank"),pe(q,"rel","noreferrer external"),pe(Me,"class","ons-list__item ons-u-pl-no ons-u-pr-xs"),pe(ie,"class","ons-list__prefix"),pe(Qe,"class","ons-u-vh"),pe(Y,"href",vt="mailto:?subject="+l[7]+"&body="+l[7]+"%0A"+l[6]),pe(Y,"class","ons-list__link ons-u-fs-r ons-u-pt-xxs"),pe(Y,"target","_blank"),pe(Y,"rel","noreferrer external"),pe(Xe,"class","ons-list__item ons-u-pl-no ons-u-pr-xs"),pe(f,"class","ons-list ons-list--inline ons-list--bare ons-list--icons"),pe(i,"class","ons-grid ons-u-ml-no"),pe(i,"aria-label","Share this dataset")},m(It,Nt){Fe(It,i,Nt),Te(i,a),Te(a,o),Te(i,u),Te(i,f),Te(f,p),Te(p,n),Te(p,v),Te(p,E),Te(E,S),Te(E,C),Te(f,I),Te(f,L),Te(L,D),Te(L,V),Te(L,ee),Te(ee,se),Te(ee,ne),Te(f,ce),Te(f,Me),Te(Me,et),Te(Me,Ge),Te(Me,q),Te(q,We),Te(q,Tt),Te(f,Ne),Te(f,Xe),Te(Xe,ie),Te(Xe,De),Te(Xe,Y),Te(Y,ue),Te(Y,Qe)},p(It,Nt){Nt&1&&vi(o,It[0]),Nt&64&&P!==(P="https://www.facebook.com/sharer/sharer.php?u="+It[6])&&pe(E,"href",P),Nt&192&&ge!==(ge="https://twitter.com/intent/tweet?original_referer&text="+It[7]+"&url="+It[6])&&pe(ee,"href",ge),Nt&64&&Bt!==(Bt="https://www.linkedin.com/sharing/share-offsite/?url="+It[6])&&pe(q,"href",Bt),Nt&192&&vt!==(vt="mailto:?subject="+It[7]+"&body="+It[7]+"%0A"+It[6])&&pe(Y,"href",vt)},d(It){It&&X(i)}}}function Av(l){let i,a;return i=new rl({props:{theme:l[2],themeOverrides:l[3],width:l[1],marginTop:l[4],marginBottom:l[5],$$slots:{default:[Iv]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,[u]){const f={};u&4&&(f.theme=o[2]),u&8&&(f.themeOverrides=o[3]),u&2&&(f.width=o[1]),u&16&&(f.marginTop=o[4]),u&32&&(f.marginBottom=o[5]),u&449&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function Pv(l,i,a){let{title:o="Share this page"}=i,{width:u="narrow"}=i,{theme:f=null}=i,{themeOverrides:p=null}=i,{marginTop:n=!1}=i,{marginBottom:_=!0}=i,v="",E="";return th(()=>{a(6,v=document.location.href),a(7,E=document.title)}),l.$$set=S=>{"title"in S&&a(0,o=S.title),"width"in S&&a(1,u=S.width),"theme"in S&&a(2,f=S.theme),"themeOverrides"in S&&a(3,p=S.themeOverrides),"marginTop"in S&&a(4,n=S.marginTop),"marginBottom"in S&&a(5,_=S.marginBottom)},[o,u,f,p,n,_,v,E]}class zv extends qi{constructor(i){super(),Zi(this,i,Pv,Av,Ui,{title:0,width:1,theme:2,themeOverrides:3,marginTop:4,marginBottom:5})}}function Cm(l,i,a){const o=l.slice();return o[1]=i[a],o[3]=a,o}function Im(l){let i,a=Mi(l[0]),o=[];for(let u=0;u{"meta"in u&&a(0,o=u.meta)},[o]}class Bv extends qi{constructor(i){super(),Zi(this,i,Rv,Lv,Ui,{meta:0})}}const Ov=l=>({}),zm=l=>({}),Fv=l=>({}),Mm=l=>({}),Nv=l=>({}),Dm=l=>({});function Lm(l){let i,a='
';return{c(){i=Be("div"),i.innerHTML=a,this.h()},l(o){i=Oe(o,"DIV",{class:!0,"data-svelte-h":!0}),dr(i)!=="svelte-pqjcyt"&&(i.innerHTML=a),this.h()},h(){pe(i,"class","ons-grid__col ons-col-2@m svelte-lohx48")},m(o,u){Fe(o,i,u)},d(o){o&&X(i)}}}function Rm(l){let i,a='
';return{c(){i=Be("div"),i.innerHTML=a,this.h()},l(o){i=Oe(o,"DIV",{class:!0,"data-svelte-h":!0}),dr(i)!=="svelte-9wk1rb"&&(i.innerHTML=a),this.h()},h(){pe(i,"class","ons-grid ons-u-mb-m")},m(o,u){Fe(o,i,u)},d(o){o&&X(i)}}}function Uv(l){let i,a,o,u,f,p,n,_,v,E,S,C,z,P;const I=l[7].before,L=Ir(I,l,l[8],Dm);let D=l[1]&&Lm();const F=l[7].default,V=Ir(F,l,l[8],null),ee=l[7].brand,se=Ir(ee,l,l[8],Mm);let ne=l[2]&&Rm();C=new Bv({props:{meta:l[3]}});const le=l[7].after,ge=Ir(le,l,l[8],zm);return{c(){i=Be("section"),L&&L.c(),a=ut(),o=Be("div"),u=Be("div"),f=Be("h1"),p=Ot(l[0]),n=ut(),D&&D.c(),_=ut(),V&&V.c(),v=ut(),se&&se.c(),E=ut(),ne&&ne.c(),S=ut(),ei(C.$$.fragment),z=ut(),ge&&ge.c(),this.h()},l(ce){i=Oe(ce,"SECTION",{class:!0});var Me=Je(i);L&&L.l(Me),a=ht(Me),o=Oe(Me,"DIV",{class:!0});var et=Je(o);u=Oe(et,"DIV",{class:!0});var ye=Je(u);f=Oe(ye,"H1",{class:!0});var Ge=Je(f);p=Ft(Ge,l[0]),Ge.forEach(X),ye.forEach(X),n=ht(et),D&&D.l(et),et.forEach(X),_=ht(Me),V&&V.l(Me),v=ht(Me),se&&se.l(Me),E=ht(Me),ne&&ne.l(Me),S=ht(Me),si(C.$$.fragment,Me),z=ht(Me),ge&&ge.l(Me),Me.forEach(X),this.h()},h(){pe(f,"class","ons-u-fs-xxxl ons-u-mt-s ons-u-mb-m ons-u-pb-no ons-u-pt-no"),pe(u,"class","ons-grid__col ons-col-10@m svelte-lohx48"),pe(o,"class","ons-grid"),pe(i,"class","ons-u-mb-xl")},m(ce,Me){Fe(ce,i,Me),L&&L.m(i,null),Te(i,a),Te(i,o),Te(o,u),Te(u,f),Te(f,p),Te(o,n),D&&D.m(o,null),Te(i,_),V&&V.m(i,null),Te(i,v),se&&se.m(i,null),Te(i,E),ne&&ne.m(i,null),Te(i,S),ti(C,i,null),Te(i,z),ge&&ge.m(i,null),P=!0},p(ce,Me){L&&L.p&&(!P||Me&256)&&Ar(L,I,ce,ce[8],P?zr(I,ce[8],Me,Nv):Pr(ce[8]),Dm),(!P||Me&1)&&vi(p,ce[0]),ce[1]?D||(D=Lm(),D.c(),D.m(o,null)):D&&(D.d(1),D=null),V&&V.p&&(!P||Me&256)&&Ar(V,F,ce,ce[8],P?zr(F,ce[8],Me,null):Pr(ce[8]),null),se&&se.p&&(!P||Me&256)&&Ar(se,ee,ce,ce[8],P?zr(ee,ce[8],Me,Fv):Pr(ce[8]),Mm),ce[2]?ne||(ne=Rm(),ne.c(),ne.m(i,S)):ne&&(ne.d(1),ne=null);const et={};Me&8&&(et.meta=ce[3]),C.$set(et),ge&&ge.p&&(!P||Me&256)&&Ar(ge,le,ce,ce[8],P?zr(le,ce[8],Me,Ov):Pr(ce[8]),zm)},i(ce){P||(Ke(L,ce),Ke(V,ce),Ke(se,ce),Ke(C.$$.fragment,ce),Ke(ge,ce),P=!0)},o(ce){st(L,ce),st(V,ce),st(se,ce),st(C.$$.fragment,ce),st(ge,ce),P=!1},d(ce){ce&&X(i),L&&L.d(ce),D&&D.d(),V&&V.d(ce),se&&se.d(ce),ne&&ne.d(),ii(C),ge&&ge.d(ce)}}}function Vv(l){let i,a;return i=new rl({props:{theme:l[4],themeOverrides:l[5],background:l[6],$$slots:{default:[Uv]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,[u]){const f={};u&16&&(f.theme=o[4]),u&32&&(f.themeOverrides=o[5]),u&64&&(f.background=o[6]),u&271&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function $v(l,i,a){let{$$slots:o={},$$scope:u}=i,{title:f="Page title"}=i,{natStatBadge:p=!1}=i,{censusLogo:n=!1}=i,{meta:_=null}=i,{theme:v=null}=i,{themeOverrides:E=null}=i,{background:S=null}=i;return l.$$set=C=>{"title"in C&&a(0,f=C.title),"natStatBadge"in C&&a(1,p=C.natStatBadge),"censusLogo"in C&&a(2,n=C.censusLogo),"meta"in C&&a(3,_=C.meta),"theme"in C&&a(4,v=C.theme),"themeOverrides"in C&&a(5,E=C.themeOverrides),"background"in C&&a(6,S=C.background),"$$scope"in C&&a(8,u=C.$$scope)},[f,p,n,_,v,E,S,o,u]}class jv extends qi{constructor(i){super(),Zi(this,i,$v,Vv,Ui,{title:0,natStatBadge:1,censusLogo:2,meta:3,theme:4,themeOverrides:5,background:6})}}function Bm(l){let i,a,o,u;return{c(){i=ya("svg"),a=ya("path"),this.h()},l(f){i=va(f,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0,fill:!0});var p=Je(i);a=va(p,"path",{d:!0}),Je(a).forEach(X),p.forEach(X),this.h()},h(){pe(a,"d",o=l[3][l[0]].d),pe(i,"class","ons-svg-icon"),pe(i,"viewBox",u=l[3][l[0]].viewBox),pe(i,"xmlns","http://www.w3.org/2000/svg"),pe(i,"focusable","false"),pe(i,"fill","currentColor"),Gt(i,"ons-u-ml-xs",l[1]),Gt(i,"ons-u-mr-xs",l[2])},m(f,p){Fe(f,i,p),Te(i,a)},p(f,p){p&1&&o!==(o=f[3][f[0]].d)&&pe(a,"d",o),p&1&&u!==(u=f[3][f[0]].viewBox)&&pe(i,"viewBox",u),p&2&&Gt(i,"ons-u-ml-xs",f[1]),p&4&&Gt(i,"ons-u-mr-xs",f[2])},d(f){f&&X(i)}}}function qv(l){let i,a=l[3][l[0]]&&Bm(l);return{c(){a&&a.c(),i=ri()},l(o){a&&a.l(o),i=ri()},m(o,u){a&&a.m(o,u),Fe(o,i,u)},p(o,[u]){o[3][o[0]]?a?a.p(o,u):(a=Bm(o),a.c(),a.m(i.parentNode,i)):a&&(a.d(1),a=null)},i:xi,o:xi,d(o){o&&X(i),a&&a.d(o)}}}function Zv(l,i,a){let{type:o="arrow"}=i,{marginLeft:u=!1}=i,{marginRight:f=!1}=i;const p={arrow:{d:"m10 .2-.9.9c-.1.1-.1.4 0 .5l4 4H.6c-.2 0-.4.2-.4.4v1.2c0 .2.2.4.4.4h12.5l-3.9 3.7c-.2.2-.2.4 0 .6l.8.9c.2.2.4.2.6 0L16.8 7c.2-.2.2-.4 0-.6L10.7.3c-.3-.2-.5-.2-.7-.1z",viewBox:"0 0 17 13"},externalLink:{d:"M13.5,9H13a.5.5,0,0,0-.5.5v3h-9v-9h3A.5.5,0,0,0,7,3V2.5A.5.5,0,0,0,6.5,2h-4a.5.5,0,0,0-.5.5v11a.5.5,0,0,0,.5.5h11a.5.5,0,0,0,.5-.5v-4A.5.5,0,0,0,13.5,9Z M8.83,7.88a.51.51,0,0,0,.71,0l2.31-2.32,1.28,1.28A.51.51,0,0,0,14,6.49v-4a.52.52,0,0,0-.5-.5h-4A.51.51,0,0,0,9,2.52a.58.58,0,0,0,.14.33l1.28,1.28L8.12,6.46a.51.51,0,0,0,0,.71Z",viewBox:"2 2 12 12"},signout:{d:"M13.85,7.65l-2.5-2.5a.5.5,0,0,0-.71,0,.48.48,0,0,0-.15.36V7h-3a.5.5,0,0,0-.5.5v1a.5.5,0,0,0,.5.5h3v1.5A.49.49,0,0,0,11,11a.48.48,0,0,0,.34-.14l2.51-2.5a.49.49,0,0,0,0-.68Z M8.5,14h-6a.5.5,0,0,1-.5-.5V2.5A.5.5,0,0,1,2.5,2h6a.5.5,0,0,1,.5.5V3a.5.5,0,0,1-.5.5h-5v9h5A.5.5,0,0,1,9,13v.5A.5.5,0,0,1,8.5,14Z",viewBox:"0 0 12 12"},print:{d:"M17 4H3C1.3 4 0 5.2 0 6.8v5.5h4V16h12v-3.7h4V6.8C20 5.2 18.7 4 17 4zm-3 10H6V9h8v5zm3-6a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-1-8H4v3h12V0z",viewBox:"0 0 20 16"},download:{d:"M5.6 9a.48.48 0 0 0 .7 0l3-3.2a.48.48 0 0 0 0-.7C9.3 5 9.2 5 9 5H7.5V.5A.47.47 0 0 0 7 0H5a.47.47 0 0 0-.5.5V5H3a.47.47 0 0 0-.5.5.37.37 0 0 0 .1.3Z M11.5 9H11a.47.47 0 0 0-.5.5v1h-9v-1A.47.47 0 0 0 1 9H.5a.47.47 0 0 0-.5.5v2a.47.47 0 0 0 .5.5h11a.47.47 0 0 0 .5-.5v-2a.47.47 0 0 0-.5-.5Z",viewBox:"0 0 12 12"},tick:{d:"M14.35,3.9l-.71-.71a.5.5,0,0,0-.71,0h0L5.79,10.34,3.07,7.61a.51.51,0,0,0-.71,0l-.71.71a.51.51,0,0,0,0,.71l3.78,3.78a.5.5,0,0,0,.71,0h0L14.35,4.6A.5.5,0,0,0,14.35,3.9Z",viewBox:"1.5 3 13 10"},search:{d:"M11.86 10.23 8.62 6.99a4.63 4.63 0 1 0-6.34 1.64 4.55 4.55 0 0 0 2.36.64 4.65 4.65 0 0 0 2.33-.65l3.24 3.23a.46.46 0 0 0 .65 0l1-1a.48.48 0 0 0 0-.62Zm-5-3.32a3.28 3.28 0 0 1-2.31.93 3.22 3.22 0 1 1 2.35-.93Z",viewBox:"0 0 12 12"}};return l.$$set=n=>{"type"in n&&a(0,o=n.type),"marginLeft"in n&&a(1,u=n.marginLeft),"marginRight"in n&&a(2,f=n.marginRight)},[o,u,f,p]}let nh=class extends qi{constructor(i){super(),Zi(this,i,Zv,qv,Ui,{type:0,marginLeft:1,marginRight:2})}};function Gv(l){let i,a,o,u,f,p,n,_,v=l[4]&&l[5]==="before"&&Om(l);const E=l[9].default,S=Ir(E,l,l[8],null);let C=l[4]&&l[5]==="after"&&Fm(l);return{c(){i=Be("button"),a=Be("span"),v&&v.c(),o=ut(),u=Be("span"),S&&S.c(),f=ut(),C&&C.c(),this.h()},l(z){i=Oe(z,"BUTTON",{type:!0,class:!0});var P=Je(i);a=Oe(P,"SPAN",{class:!0});var I=Je(a);v&&v.l(I),o=ht(I),u=Oe(I,"SPAN",{class:!0});var L=Je(u);S&&S.l(L),L.forEach(X),f=ht(I),C&&C.l(I),I.forEach(X),P.forEach(X),this.h()},h(){pe(u,"class","ons-btn__text"),pe(a,"class","ons-btn__inner"),pe(i,"type",l[0]),pe(i,"class","ons-btn"),i.disabled=l[6],Gt(i,"ons-btn--small",l[3]),Gt(i,"ons-btn--secondary",l[1]==="secondary"),Gt(i,"ons-btn--ghost",l[1]==="ghost"),Gt(i,"ons-btn--disabled",l[6])},m(z,P){Fe(z,i,P),Te(i,a),v&&v.m(a,null),Te(a,o),Te(a,u),S&&S.m(u,null),Te(a,f),C&&C.m(a,null),p=!0,n||(_=Ms(i,"click",l[11]),n=!0)},p(z,P){z[4]&&z[5]==="before"?v?(v.p(z,P),P&48&&Ke(v,1)):(v=Om(z),v.c(),Ke(v,1),v.m(a,o)):v&&(Vi(),st(v,1,1,()=>{v=null}),$i()),S&&S.p&&(!p||P&256)&&Ar(S,E,z,z[8],p?zr(E,z[8],P,null):Pr(z[8]),null),z[4]&&z[5]==="after"?C?(C.p(z,P),P&48&&Ke(C,1)):(C=Fm(z),C.c(),Ke(C,1),C.m(a,null)):C&&(Vi(),st(C,1,1,()=>{C=null}),$i()),(!p||P&1)&&pe(i,"type",z[0]),(!p||P&64)&&(i.disabled=z[6]),(!p||P&8)&&Gt(i,"ons-btn--small",z[3]),(!p||P&2)&&Gt(i,"ons-btn--secondary",z[1]==="secondary"),(!p||P&2)&&Gt(i,"ons-btn--ghost",z[1]==="ghost"),(!p||P&64)&&Gt(i,"ons-btn--disabled",z[6])},i(z){p||(Ke(v),Ke(S,z),Ke(C),p=!0)},o(z){st(v),st(S,z),st(C),p=!1},d(z){z&&X(i),v&&v.d(),S&&S.d(z),C&&C.d(),n=!1,_()}}}function Wv(l){let i,a,o,u,f,p,n,_,v,E=l[4]&&l[5]==="before"&&Nm(l);const S=l[9].default,C=Ir(S,l,l[8],null);let z=l[4]&&l[5]==="after"&&Um(l);return{c(){i=Be("a"),a=Be("span"),E&&E.c(),o=ut(),u=Be("span"),C&&C.c(),f=ut(),z&&z.c(),this.h()},l(P){i=Oe(P,"A",{href:!0,role:!0,class:!0,disabled:!0});var I=Je(i);a=Oe(I,"SPAN",{class:!0});var L=Je(a);E&&E.l(L),o=ht(L),u=Oe(L,"SPAN",{class:!0});var D=Je(u);C&&C.l(D),D.forEach(X),f=ht(L),z&&z.l(L),L.forEach(X),I.forEach(X),this.h()},h(){pe(u,"class","ons-btn__text"),pe(a,"class","ons-btn__inner"),pe(i,"href",p=l[6]?null:l[2]),pe(i,"role","button"),pe(i,"class","ons-btn ons-btn--link ons-js-submit-btn"),pe(i,"disabled",l[6]),Gt(i,"ons-btn--small",l[3]),Gt(i,"ons-btn--secondary",l[1]==="secondary"),Gt(i,"ons-btn--ghost",l[1]==="ghost"),Gt(i,"ons-btn--disabled",l[6])},m(P,I){Fe(P,i,I),Te(i,a),E&&E.m(a,null),Te(a,o),Te(a,u),C&&C.m(u,null),Te(a,f),z&&z.m(a,null),n=!0,_||(v=Ms(i,"click",l[10]),_=!0)},p(P,I){P[4]&&P[5]==="before"?E?(E.p(P,I),I&48&&Ke(E,1)):(E=Nm(P),E.c(),Ke(E,1),E.m(a,o)):E&&(Vi(),st(E,1,1,()=>{E=null}),$i()),C&&C.p&&(!n||I&256)&&Ar(C,S,P,P[8],n?zr(S,P[8],I,null):Pr(P[8]),null),P[4]&&P[5]==="after"?z?(z.p(P,I),I&48&&Ke(z,1)):(z=Um(P),z.c(),Ke(z,1),z.m(a,null)):z&&(Vi(),st(z,1,1,()=>{z=null}),$i()),(!n||I&68&&p!==(p=P[6]?null:P[2]))&&pe(i,"href",p),(!n||I&64)&&pe(i,"disabled",P[6]),(!n||I&8)&&Gt(i,"ons-btn--small",P[3]),(!n||I&2)&&Gt(i,"ons-btn--secondary",P[1]==="secondary"),(!n||I&2)&&Gt(i,"ons-btn--ghost",P[1]==="ghost"),(!n||I&64)&&Gt(i,"ons-btn--disabled",P[6])},i(P){n||(Ke(E),Ke(C,P),Ke(z),n=!0)},o(P){st(E),st(C,P),st(z),n=!1},d(P){P&&X(i),E&&E.d(),C&&C.d(P),z&&z.d(),_=!1,v()}}}function Om(l){let i,a;return i=new nh({props:{type:l[4],marginRight:!0}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&16&&(f.type=o[4]),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function Fm(l){let i,a;return i=new nh({props:{type:l[4],marginLeft:!0}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&16&&(f.type=o[4]),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function Nm(l){let i,a;return i=new nh({props:{type:l[4],marginRight:!0}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&16&&(f.type=o[4]),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function Um(l){let i,a;return i=new nh({props:{type:l[4],marginLeft:!0}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&16&&(f.type=o[4]),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function Hv(l){let i,a,o,u;const f=[Wv,Gv],p=[];function n(_,v){return _[2]?0:1}return i=n(l),a=p[i]=f[i](l),{c(){a.c(),o=ri()},l(_){a.l(_),o=ri()},m(_,v){p[i].m(_,v),Fe(_,o,v),u=!0},p(_,[v]){let E=i;i=n(_),i===E?p[i].p(_,v):(Vi(),st(p[E],1,1,()=>{p[E]=null}),$i(),a=p[i],a?a.p(_,v):(a=p[i]=f[i](_),a.c()),Ke(a,1),a.m(o.parentNode,o))},i(_){u||(Ke(a),u=!0)},o(_){st(a),u=!1},d(_){_&&X(o),p[i].d(_)}}}function Kv(l,i,a){let{$$slots:o={},$$scope:u}=i;const f=$f();let{type:p="button"}=i,{variant:n="primary"}=i,{href:_=""}=i,{small:v=!1}=i,{icon:E=""}=i,{iconPosition:S="before"}=i,{disabled:C=!1}=i;const z=I=>f("click",I),P=I=>f("click",I);return l.$$set=I=>{"type"in I&&a(0,p=I.type),"variant"in I&&a(1,n=I.variant),"href"in I&&a(2,_=I.href),"small"in I&&a(3,v=I.small),"icon"in I&&a(4,E=I.icon),"iconPosition"in I&&a(5,S=I.iconPosition),"disabled"in I&&a(6,C=I.disabled),"$$scope"in I&&a(8,u=I.$$scope)},[p,n,_,v,E,S,C,f,u,o,z,P]}class qf extends qi{constructor(i){super(),Zi(this,i,Kv,Hv,Ui,{type:0,variant:1,href:2,small:3,icon:4,iconPosition:5,disabled:6})}}var bf=$1,Xv=function(l){var i,a,o,u;if(i=/^((?:rgb|hs[lv]|cmyk|xyz|lab)a?)\s*\(([^\)]*)\)/.exec(l)){var f=i[1],p=f.replace(/a$/,""),n=p==="cmyk"?4:3;a=bf[p],o=i[2].replace(/^\s+|\s+$/g,"").split(/\s*,\s*/).map(function(v,E){return/%$/.test(v)&&E===n?parseFloat(v)/100:(/%$/.test(v),parseFloat(v))}),f===p&&o.push(1),u=o[n]===void 0?1:o[n],o=o.slice(0,n),a[p]=function(){return o}}else if(/^#[A-Fa-f0-9]+$/.test(l)){var p=l.replace(/^#/,""),n=p.length;a=bf.rgb,o=p.split(n===3?/(.)/:/(..)/),o=o.filter(Boolean).map(function(S){return parseInt(n===3?S+S:S,16)}),u=1,a.rgb=function(){return o},o[0]||(o[0]=0),o[1]||(o[1]=0),o[2]||(o[2]=0)}else a=bf.keyword,a.keyword=function(){return l},o=l,u=1;var _={rgb:void 0,hsl:void 0,hsv:void 0,cmyk:void 0,keyword:void 0,hex:void 0};try{_.rgb=a.rgb(o)}catch{}try{_.hsl=a.hsl(o)}catch{}try{_.hsv=a.hsv(o)}catch{}try{_.cmyk=a.cmyk(o)}catch{}try{_.keyword=a.keyword(o)}catch{}return _.rgb&&(_.hex="#"+_.rgb.map(function(v){var E=v.toString(16);return E.length===1?"0"+E:E}).join("")),_.rgb&&(_.rgba=_.rgb.concat(u)),_.hsl&&(_.hsla=_.hsl.concat(u)),_.hsv&&(_.hsva=_.hsv.concat(u)),_.cmyk&&(_.cmyka=_.cmyk.concat(u)),_};const Jv=rh(Xv);function Yv(l){return l}function Qv(l){if(l==null)return Yv;var i,a,o=l.scale[0],u=l.scale[1],f=l.translate[0],p=l.translate[1];return function(n,_){_||(i=a=0);var v=2,E=n.length,S=new Array(E);for(S[0]=(i+=n[0])*o+f,S[1]=(a+=n[1])*u+p;v @@ -426,29 +426,29 @@ import{T as $_,e as Ni,c as B1,b as j_,m as cm,l as mc,d as Wo,f as Ko,p as um,g -`}];function Uu(l){let i=0;for(const a of l)i+=a in wf?wf[a]:wf.AVERAGE;return i}const wf={0:8.9,1:8.9,2:8.9,3:8.9,4:8.9,5:8.9,6:8.9,7:8.9,8:8.9,9:8.9,a:8.9,b:8.9,c:8,d:8.9,e:8.9,f:4.43,g:8.9,h:8.9,i:3.57,j:3.57,k:8,l:3.57,m:13.33,n:8.9,o:8.9,p:8.9,q:8.9,r:5.33,s:8,t:4.43,u:8.9,v:8,w:11.57,x:8,y:8,z:8,A:10.67,B:10.67,C:11.57,D:11.57,E:10.67,F:9.77,G:12.43,H:11.57,I:4.43,J:8,K:10.67,L:8.9,M:13.33,N:11.57,O:12.43,P:10.67,Q:12.43,R:11.57,S:10.67,T:9.77,U:11.57,V:10.67,W:15.1,X:10.67,Y:10.67,Z:9.77," ":4.43,"!":4.43,'"':5.67,"#":8.9,$:8.9,"%":14.23,"&":10.67,"'":3.07,"(":5.33,")":5.33,"*":6.23,"+":9.33,",":4.43,"-":5.33,".":4.43,"/":4.43,":":4.43,";":4.43,"<":9.33,"=":9.33,">":9.33,"?":8.9,"@":16.23,"[":4.43,"]":4.43,"^":7.5,_:8.9,"`":5.33,"{":5.33,"|":4.17,"}":5.33,"~":9.33,AVERAGE:8.472},Yv={$id:"https://github.com/jtrim-ons/accessible-spreadsheet-creator",title:"Accessible Spreadsheet Creator",description:"A description of an accessible spreadsheet",type:"object",properties:{coverSheetTitle:{type:"string",title:"Cover sheet title",description:"The title displayed in cell A1 of the workbook.",minLength:1},coverSheetContents:{type:"array",title:"Cover sheet contents",description:"The lines below the cover sheet title. Each can be a subtitle starting with '## ', a link in Markdown style, or just text.",items:{type:"string"}},notes:{type:"array",title:"Notes",description:"The notes, each with a name that can be referred to in double square brackets and text.",items:{type:"object",title:"Note",properties:{name:{type:"string",title:"Note name",description:"A note name (e.g. note1) that can be referred to in a sheet using double square brackets (e.g. [[note1]])."},text:{type:"string",title:"Note text",description:"The text that will appear on the Notes page."}}}},sheets:{type:"array",title:"Sheets",description:"The data an metadata for the worksheets other than cover, contents and notes sheets.",items:{type:"object",title:"Sheet",properties:{sheetName:{type:"string",minLength:1,title:"Sheet name",description:"The name to appear in cell A1"},tableName:{type:"string",minLength:1,title:"Table name",description:"The name to give to the data table",pattern:"^[A-Za-z0-9_]*$"},sheetIntroText:{type:"array",title:"Sheet intro text",description:"Introductory text to appear below cell A2",items:{type:"string"}},columns:{type:"array",title:"Data columns",items:{type:"object",title:"Data column",description:"A column with its heading, number/text style and data.",properties:{style:{type:"string",title:"Number/text style",description:"'text'=text column; 'number_with_commas': integers with thousand separator; 'number_1dp': numbers to 1 decimal place"},heading:{type:"string",title:"Column heading",description:"Table column heading. May contain notes in double square brackets."},values:{type:"array",title:"Column values",description:"An array of text or numeric values",anyOf:[{items:{type:"number"}},{items:{type:"string"}}]}},required:["style","heading","values"]}}},required:["sheetName","tableName","columns"]}}},required:["coverSheetTitle","coverSheetContents","sheets"]};var zf={exports:{}},Q_={},ys={},el={},Ic={},Fi={},Ec={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.regexpCode=l.getEsmExportName=l.getProperty=l.safeStringify=l.stringify=l.strConcat=l.addCodeArg=l.str=l._=l.nil=l._Code=l.Name=l.IDENTIFIER=l._CodeOrName=void 0;class i{}l._CodeOrName=i,l.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class a extends i{constructor(F){if(super(),!l.IDENTIFIER.test(F))throw new Error("CodeGen: name must be a valid identifier");this.str=F}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}l.Name=a;class o extends i{constructor(F){super(),this._items=typeof F=="string"?[F]:F}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const F=this._items[0];return F===""||F==='""'}get str(){var F;return(F=this._str)!==null&&F!==void 0?F:this._str=this._items.reduce((j,ee)=>`${j}${ee}`,"")}get names(){var F;return(F=this._names)!==null&&F!==void 0?F:this._names=this._items.reduce((j,ee)=>(ee instanceof a&&(j[ee.str]=(j[ee.str]||0)+1),j),{})}}l._Code=o,l.nil=new o("");function u(D,...F){const j=[D[0]];let ee=0;for(;ee{if(T.scopePath===void 0)throw new Error(`CodeGen: name "${T}" has no value`);return(0,i._)`${v}${T.scopePath}`})}scopeCode(v=this._values,S,T){return this._reduceValues(v,I=>{if(I.value===void 0)throw new Error(`CodeGen: name "${I}" has no value`);return I.value.code},S,T)}_reduceValues(v,S,T={},I){let z=i.nil;for(const M in v){const C=v[M];if(!C)continue;const R=T[M]=T[M]||new Map;C.forEach(D=>{if(R.has(D))return;R.set(D,o.Started);let F=S(D);if(F){const j=this.opts.es5?l.varKinds.var:l.varKinds.const;z=(0,i._)`${z}${j} ${D} = ${F};${this.opts._n}`}else if(F=I==null?void 0:I(D))z=(0,i._)`${z}${F}${this.opts._n}`;else throw new a(D);R.set(D,o.Completed)})}return z}}l.ValueScope=n})(Mf);(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.or=l.and=l.not=l.CodeGen=l.operators=l.varKinds=l.ValueScopeName=l.ValueScope=l.Scope=l.Name=l.regexpCode=l.stringify=l.getProperty=l.nil=l.strConcat=l.str=l._=void 0;const i=Ec,a=Mf;var o=Ec;Object.defineProperty(l,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(l,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(l,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(l,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(l,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(l,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(l,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(l,"Name",{enumerable:!0,get:function(){return o.Name}});var u=Mf;Object.defineProperty(l,"Scope",{enumerable:!0,get:function(){return u.Scope}}),Object.defineProperty(l,"ValueScope",{enumerable:!0,get:function(){return u.ValueScope}}),Object.defineProperty(l,"ValueScopeName",{enumerable:!0,get:function(){return u.ValueScopeName}}),Object.defineProperty(l,"varKinds",{enumerable:!0,get:function(){return u.varKinds}}),l.operators={GT:new i._Code(">"),GTE:new i._Code(">="),LT:new i._Code("<"),LTE:new i._Code("<="),EQ:new i._Code("==="),NEQ:new i._Code("!=="),NOT:new i._Code("!"),OR:new i._Code("||"),AND:new i._Code("&&"),ADD:new i._Code("+")};class f{optimizeNodes(){return this}optimizeNames(Y,he){return this}}class p extends f{constructor(Y,he,Je){super(),this.varKind=Y,this.name=he,this.rhs=Je}render({es5:Y,_n:he}){const Je=Y?a.varKinds.var:this.varKind,kt=this.rhs===void 0?"":` = ${this.rhs}`;return`${Je} ${this.name}${kt};`+he}optimizeNames(Y,he){if(Y[this.name.str])return this.rhs&&(this.rhs=q(this.rhs,Y,he)),this}get names(){return this.rhs instanceof i._CodeOrName?this.rhs.names:{}}}class n extends f{constructor(Y,he,Je){super(),this.lhs=Y,this.rhs=he,this.sideEffects=Je}render({_n:Y}){return`${this.lhs} = ${this.rhs};`+Y}optimizeNames(Y,he){if(!(this.lhs instanceof i.Name&&!Y[this.lhs.str]&&!this.sideEffects))return this.rhs=q(this.rhs,Y,he),this}get names(){const Y=this.lhs instanceof i.Name?{}:{...this.lhs.names};return Ke(Y,this.rhs)}}class _ extends n{constructor(Y,he,Je,kt){super(Y,Je,kt),this.op=he}render({_n:Y}){return`${this.lhs} ${this.op}= ${this.rhs};`+Y}}class v extends f{constructor(Y){super(),this.label=Y,this.names={}}render({_n:Y}){return`${this.label}:`+Y}}class S extends f{constructor(Y){super(),this.label=Y,this.names={}}render({_n:Y}){return`break${this.label?` ${this.label}`:""};`+Y}}class T extends f{constructor(Y){super(),this.error=Y}render({_n:Y}){return`throw ${this.error};`+Y}get names(){return this.error.names}}class I extends f{constructor(Y){super(),this.code=Y}render({_n:Y}){return`${this.code};`+Y}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(Y,he){return this.code=q(this.code,Y,he),this}get names(){return this.code instanceof i._CodeOrName?this.code.names:{}}}class z extends f{constructor(Y=[]){super(),this.nodes=Y}render(Y){return this.nodes.reduce((he,Je)=>he+Je.render(Y),"")}optimizeNodes(){const{nodes:Y}=this;let he=Y.length;for(;he--;){const Je=Y[he].optimizeNodes();Array.isArray(Je)?Y.splice(he,1,...Je):Je?Y[he]=Je:Y.splice(he,1)}return Y.length>0?this:void 0}optimizeNames(Y,he){const{nodes:Je}=this;let kt=Je.length;for(;kt--;){const vt=Je[kt];vt.optimizeNames(Y,he)||(He(Y,vt.names),Je.splice(kt,1))}return Je.length>0?this:void 0}get names(){return this.nodes.reduce((Y,he)=>be(Y,he.names),{})}}class M extends z{render(Y){return"{"+Y._n+super.render(Y)+"}"+Y._n}}class C extends z{}class R extends M{}R.kind="else";class D extends M{constructor(Y,he){super(he),this.condition=Y}render(Y){let he=`if(${this.condition})`+super.render(Y);return this.else&&(he+="else "+this.else.render(Y)),he}optimizeNodes(){super.optimizeNodes();const Y=this.condition;if(Y===!0)return this.nodes;let he=this.else;if(he){const Je=he.optimizeNodes();he=this.else=Array.isArray(Je)?new R(Je):Je}if(he)return Y===!1?he instanceof D?he:he.nodes:this.nodes.length?this:new D(Rt(Y),he instanceof D?[he]:he.nodes);if(!(Y===!1||!this.nodes.length))return this}optimizeNames(Y,he){var Je;if(this.else=(Je=this.else)===null||Je===void 0?void 0:Je.optimizeNames(Y,he),!!(super.optimizeNames(Y,he)||this.else))return this.condition=q(this.condition,Y,he),this}get names(){const Y=super.names;return Ke(Y,this.condition),this.else&&be(Y,this.else.names),Y}}D.kind="if";class F extends M{}F.kind="for";class j extends F{constructor(Y){super(),this.iteration=Y}render(Y){return`for(${this.iteration})`+super.render(Y)}optimizeNames(Y,he){if(super.optimizeNames(Y,he))return this.iteration=q(this.iteration,Y,he),this}get names(){return be(super.names,this.iteration.names)}}class ee extends F{constructor(Y,he,Je,kt){super(),this.varKind=Y,this.name=he,this.from=Je,this.to=kt}render(Y){const he=Y.es5?a.varKinds.var:this.varKind,{name:Je,from:kt,to:vt}=this;return`for(${he} ${Je}=${kt}; ${Je}<${vt}; ${Je}++)`+super.render(Y)}get names(){const Y=Ke(super.names,this.from);return Ke(Y,this.to)}}class oe extends F{constructor(Y,he,Je,kt){super(),this.loop=Y,this.varKind=he,this.name=Je,this.iterable=kt}render(Y){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(Y)}optimizeNames(Y,he){if(super.optimizeNames(Y,he))return this.iterable=q(this.iterable,Y,he),this}get names(){return be(super.names,this.iterable.names)}}class se extends M{constructor(Y,he,Je){super(),this.name=Y,this.args=he,this.async=Je}render(Y){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(Y)}}se.kind="func";class ne extends z{render(Y){return"return "+super.render(Y)}}ne.kind="return";class re extends M{render(Y){let he="try"+super.render(Y);return this.catch&&(he+=this.catch.render(Y)),this.finally&&(he+=this.finally.render(Y)),he}optimizeNodes(){var Y,he;return super.optimizeNodes(),(Y=this.catch)===null||Y===void 0||Y.optimizeNodes(),(he=this.finally)===null||he===void 0||he.optimizeNodes(),this}optimizeNames(Y,he){var Je,kt;return super.optimizeNames(Y,he),(Je=this.catch)===null||Je===void 0||Je.optimizeNames(Y,he),(kt=this.finally)===null||kt===void 0||kt.optimizeNames(Y,he),this}get names(){const Y=super.names;return this.catch&&be(Y,this.catch.names),this.finally&&be(Y,this.finally.names),Y}}class ve extends M{constructor(Y){super(),this.error=Y}render(Y){return`catch(${this.error})`+super.render(Y)}}ve.kind="catch";class ze extends M{render(Y){return"finally"+super.render(Y)}}ze.kind="finally";class nt{constructor(Y,he={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...he,_n:he.lines?` -`:""},this._extScope=Y,this._scope=new a.Scope({parent:Y}),this._nodes=[new C]}toString(){return this._root.render(this.opts)}name(Y){return this._scope.name(Y)}scopeName(Y){return this._extScope.name(Y)}scopeValue(Y,he){const Je=this._extScope.value(Y,he);return(this._values[Je.prefix]||(this._values[Je.prefix]=new Set)).add(Je),Je}getScopeValue(Y,he){return this._extScope.getValue(Y,he)}scopeRefs(Y){return this._extScope.scopeRefs(Y,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(Y,he,Je,kt){const vt=this._scope.toName(he);return Je!==void 0&&kt&&(this._constants[vt.str]=Je),this._leafNode(new p(Y,vt,Je)),vt}const(Y,he,Je){return this._def(a.varKinds.const,Y,he,Je)}let(Y,he,Je){return this._def(a.varKinds.let,Y,he,Je)}var(Y,he,Je){return this._def(a.varKinds.var,Y,he,Je)}assign(Y,he,Je){return this._leafNode(new n(Y,he,Je))}add(Y,he){return this._leafNode(new _(Y,l.operators.ADD,he))}code(Y){return typeof Y=="function"?Y():Y!==i.nil&&this._leafNode(new I(Y)),this}object(...Y){const he=["{"];for(const[Je,kt]of Y)he.length>1&&he.push(","),he.push(Je),(Je!==kt||this.opts.es5)&&(he.push(":"),(0,i.addCodeArg)(he,kt));return he.push("}"),new i._Code(he)}if(Y,he,Je){if(this._blockNode(new D(Y)),he&&Je)this.code(he).else().code(Je).endIf();else if(he)this.code(he).endIf();else if(Je)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(Y){return this._elseNode(new D(Y))}else(){return this._elseNode(new R)}endIf(){return this._endBlockNode(D,R)}_for(Y,he){return this._blockNode(Y),he&&this.code(he).endFor(),this}for(Y,he){return this._for(new j(Y),he)}forRange(Y,he,Je,kt,vt=this.opts.es5?a.varKinds.var:a.varKinds.let){const Ct=this._scope.toName(Y);return this._for(new ee(vt,Ct,he,Je),()=>kt(Ct))}forOf(Y,he,Je,kt=a.varKinds.const){const vt=this._scope.toName(Y);if(this.opts.es5){const Ct=he instanceof i.Name?he:this.var("_arr",he);return this.forRange("_i",0,(0,i._)`${Ct}.length`,Bt=>{this.var(vt,(0,i._)`${Ct}[${Bt}]`),Je(vt)})}return this._for(new oe("of",kt,vt,he),()=>Je(vt))}forIn(Y,he,Je,kt=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(Y,(0,i._)`Object.keys(${he})`,Je);const vt=this._scope.toName(Y);return this._for(new oe("in",kt,vt,he),()=>Je(vt))}endFor(){return this._endBlockNode(F)}label(Y){return this._leafNode(new v(Y))}break(Y){return this._leafNode(new S(Y))}return(Y){const he=new ne;if(this._blockNode(he),this.code(Y),he.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(ne)}try(Y,he,Je){if(!he&&!Je)throw new Error('CodeGen: "try" without "catch" and "finally"');const kt=new re;if(this._blockNode(kt),this.code(Y),he){const vt=this.name("e");this._currNode=kt.catch=new ve(vt),he(vt)}return Je&&(this._currNode=kt.finally=new ze,this.code(Je)),this._endBlockNode(ve,ze)}throw(Y){return this._leafNode(new T(Y))}block(Y,he){return this._blockStarts.push(this._nodes.length),Y&&this.code(Y).endBlock(he),this}endBlock(Y){const he=this._blockStarts.pop();if(he===void 0)throw new Error("CodeGen: not in self-balancing block");const Je=this._nodes.length-he;if(Je<0||Y!==void 0&&Je!==Y)throw new Error(`CodeGen: wrong number of nodes: ${Je} vs ${Y} expected`);return this._nodes.length=he,this}func(Y,he=i.nil,Je,kt){return this._blockNode(new se(Y,he,Je)),kt&&this.code(kt).endFunc(),this}endFunc(){return this._endBlockNode(se)}optimize(Y=1){for(;Y-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(Y){return this._currNode.nodes.push(Y),this}_blockNode(Y){this._currNode.nodes.push(Y),this._nodes.push(Y)}_endBlockNode(Y,he){const Je=this._currNode;if(Je instanceof Y||he&&Je instanceof he)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${he?`${Y.kind}/${he.kind}`:Y.kind}"`)}_elseNode(Y){const he=this._currNode;if(!(he instanceof D))throw new Error('CodeGen: "else" without "if"');return this._currNode=he.else=Y,this}get _root(){return this._nodes[0]}get _currNode(){const Y=this._nodes;return Y[Y.length-1]}set _currNode(Y){const he=this._nodes;he[he.length-1]=Y}}l.CodeGen=nt;function be(Me,Y){for(const he in Y)Me[he]=(Me[he]||0)+(Y[he]||0);return Me}function Ke(Me,Y){return Y instanceof i._CodeOrName?be(Me,Y.names):Me}function q(Me,Y,he){if(Me instanceof i.Name)return Je(Me);if(!kt(Me))return Me;return new i._Code(Me._items.reduce((vt,Ct)=>(Ct instanceof i.Name&&(Ct=Je(Ct)),Ct instanceof i._Code?vt.push(...Ct._items):vt.push(Ct),vt),[]));function Je(vt){const Ct=he[vt.str];return Ct===void 0||Y[vt.str]!==1?vt:(delete Y[vt.str],Ct)}function kt(vt){return vt instanceof i._Code&&vt._items.some(Ct=>Ct instanceof i.Name&&Y[Ct.str]===1&&he[Ct.str]!==void 0)}}function He(Me,Y){for(const he in Y)Me[he]=(Me[he]||0)-(Y[he]||0)}function Rt(Me){return typeof Me=="boolean"||typeof Me=="number"||Me===null?!Me:(0,i._)`!${xe(Me)}`}l.not=Rt;const at=ae(l.operators.AND);function Wt(...Me){return Me.reduce(at)}l.and=Wt;const ot=ae(l.operators.OR);function st(...Me){return Me.reduce(ot)}l.or=st;function ae(Me){return(Y,he)=>Y===i.nil?he:he===i.nil?Y:(0,i._)`${xe(Y)} ${Me} ${xe(he)}`}function xe(Me){return Me instanceof i.Name?Me:(0,i._)`(${Me})`}})(Fi);var Gi={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.checkStrictMode=l.getErrorPath=l.Type=l.useFunc=l.setEvaluated=l.evaluatedPropsToName=l.mergeEvaluated=l.eachItem=l.unescapeJsonPointer=l.escapeJsonPointer=l.escapeFragment=l.unescapeFragment=l.schemaRefOrVal=l.schemaHasRulesButRef=l.schemaHasRules=l.checkUnknownRules=l.alwaysValidSchema=l.toHash=void 0;const i=Fi,a=Ec;function o(se){const ne={};for(const re of se)ne[re]=!0;return ne}l.toHash=o;function u(se,ne){return typeof ne=="boolean"?ne:Object.keys(ne).length===0?!0:(f(se,ne),!p(ne,se.self.RULES.all))}l.alwaysValidSchema=u;function f(se,ne=se.schema){const{opts:re,self:ve}=se;if(!re.strictSchema||typeof ne=="boolean")return;const ze=ve.RULES.keywords;for(const nt in ne)ze[nt]||oe(se,`unknown keyword: "${nt}"`)}l.checkUnknownRules=f;function p(se,ne){if(typeof se=="boolean")return!se;for(const re in se)if(ne[re])return!0;return!1}l.schemaHasRules=p;function n(se,ne){if(typeof se=="boolean")return!se;for(const re in se)if(re!=="$ref"&&ne.all[re])return!0;return!1}l.schemaHasRulesButRef=n;function _({topSchemaRef:se,schemaPath:ne},re,ve,ze){if(!ze){if(typeof re=="number"||typeof re=="boolean")return re;if(typeof re=="string")return(0,i._)`${re}`}return(0,i._)`${se}${ne}${(0,i.getProperty)(ve)}`}l.schemaRefOrVal=_;function v(se){return I(decodeURIComponent(se))}l.unescapeFragment=v;function S(se){return encodeURIComponent(T(se))}l.escapeFragment=S;function T(se){return typeof se=="number"?`${se}`:se.replace(/~/g,"~0").replace(/\//g,"~1")}l.escapeJsonPointer=T;function I(se){return se.replace(/~1/g,"/").replace(/~0/g,"~")}l.unescapeJsonPointer=I;function z(se,ne){if(Array.isArray(se))for(const re of se)ne(re);else ne(se)}l.eachItem=z;function M({mergeNames:se,mergeToName:ne,mergeValues:re,resultToName:ve}){return(ze,nt,be,Ke)=>{const q=be===void 0?nt:be instanceof i.Name?(nt instanceof i.Name?se(ze,nt,be):ne(ze,nt,be),be):nt instanceof i.Name?(ne(ze,be,nt),nt):re(nt,be);return Ke===i.Name&&!(q instanceof i.Name)?ve(ze,q):q}}l.mergeEvaluated={props:M({mergeNames:(se,ne,re)=>se.if((0,i._)`${re} !== true && ${ne} !== undefined`,()=>{se.if((0,i._)`${ne} === true`,()=>se.assign(re,!0),()=>se.assign(re,(0,i._)`${re} || {}`).code((0,i._)`Object.assign(${re}, ${ne})`))}),mergeToName:(se,ne,re)=>se.if((0,i._)`${re} !== true`,()=>{ne===!0?se.assign(re,!0):(se.assign(re,(0,i._)`${re} || {}`),R(se,re,ne))}),mergeValues:(se,ne)=>se===!0?!0:{...se,...ne},resultToName:C}),items:M({mergeNames:(se,ne,re)=>se.if((0,i._)`${re} !== true && ${ne} !== undefined`,()=>se.assign(re,(0,i._)`${ne} === true ? true : ${re} > ${ne} ? ${re} : ${ne}`)),mergeToName:(se,ne,re)=>se.if((0,i._)`${re} !== true`,()=>se.assign(re,ne===!0?!0:(0,i._)`${re} > ${ne} ? ${re} : ${ne}`)),mergeValues:(se,ne)=>se===!0?!0:Math.max(se,ne),resultToName:(se,ne)=>se.var("items",ne)})};function C(se,ne){if(ne===!0)return se.var("props",!0);const re=se.var("props",(0,i._)`{}`);return ne!==void 0&&R(se,re,ne),re}l.evaluatedPropsToName=C;function R(se,ne,re){Object.keys(re).forEach(ve=>se.assign((0,i._)`${ne}${(0,i.getProperty)(ve)}`,!0))}l.setEvaluated=R;const D={};function F(se,ne){return se.scopeValue("func",{ref:ne,code:D[ne.code]||(D[ne.code]=new a._Code(ne.code))})}l.useFunc=F;var j;(function(se){se[se.Num=0]="Num",se[se.Str=1]="Str"})(j=l.Type||(l.Type={}));function ee(se,ne,re){if(se instanceof i.Name){const ve=ne===j.Num;return re?ve?(0,i._)`"[" + ${se} + "]"`:(0,i._)`"['" + ${se} + "']"`:ve?(0,i._)`"/" + ${se}`:(0,i._)`"/" + ${se}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return re?(0,i.getProperty)(se).toString():"/"+T(se)}l.getErrorPath=ee;function oe(se,ne,re=se.opts.strictSchema){if(re){if(ne=`strict mode: ${ne}`,re===!0)throw new Error(ne);se.self.logger.warn(ne)}}l.checkStrictMode=oe})(Gi);var Ds={};Object.defineProperty(Ds,"__esModule",{value:!0});const _n=Fi,Qv={data:new _n.Name("data"),valCxt:new _n.Name("valCxt"),instancePath:new _n.Name("instancePath"),parentData:new _n.Name("parentData"),parentDataProperty:new _n.Name("parentDataProperty"),rootData:new _n.Name("rootData"),dynamicAnchors:new _n.Name("dynamicAnchors"),vErrors:new _n.Name("vErrors"),errors:new _n.Name("errors"),this:new _n.Name("this"),self:new _n.Name("self"),scope:new _n.Name("scope"),json:new _n.Name("json"),jsonPos:new _n.Name("jsonPos"),jsonLen:new _n.Name("jsonLen"),jsonPart:new _n.Name("jsonPart")};Ds.default=Qv;(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.extendErrors=l.resetErrorsCount=l.reportExtraError=l.reportError=l.keyword$DataError=l.keywordError=void 0;const i=Fi,a=Gi,o=Ds;l.keywordError={message:({keyword:R})=>(0,i.str)`must pass "${R}" keyword validation`},l.keyword$DataError={message:({keyword:R,schemaType:D})=>D?(0,i.str)`"${R}" keyword must be ${D} ($data)`:(0,i.str)`"${R}" keyword is invalid ($data)`};function u(R,D=l.keywordError,F,j){const{it:ee}=R,{gen:oe,compositeRule:se,allErrors:ne}=ee,re=T(R,D,F);j??(se||ne)?_(oe,re):v(ee,(0,i._)`[${re}]`)}l.reportError=u;function f(R,D=l.keywordError,F){const{it:j}=R,{gen:ee,compositeRule:oe,allErrors:se}=j,ne=T(R,D,F);_(ee,ne),oe||se||v(j,o.default.vErrors)}l.reportExtraError=f;function p(R,D){R.assign(o.default.errors,D),R.if((0,i._)`${o.default.vErrors} !== null`,()=>R.if(D,()=>R.assign((0,i._)`${o.default.vErrors}.length`,D),()=>R.assign(o.default.vErrors,null)))}l.resetErrorsCount=p;function n({gen:R,keyword:D,schemaValue:F,data:j,errsCount:ee,it:oe}){if(ee===void 0)throw new Error("ajv implementation error");const se=R.name("err");R.forRange("i",ee,o.default.errors,ne=>{R.const(se,(0,i._)`${o.default.vErrors}[${ne}]`),R.if((0,i._)`${se}.instancePath === undefined`,()=>R.assign((0,i._)`${se}.instancePath`,(0,i.strConcat)(o.default.instancePath,oe.errorPath))),R.assign((0,i._)`${se}.schemaPath`,(0,i.str)`${oe.errSchemaPath}/${D}`),oe.opts.verbose&&(R.assign((0,i._)`${se}.schema`,F),R.assign((0,i._)`${se}.data`,j))})}l.extendErrors=n;function _(R,D){const F=R.const("err",D);R.if((0,i._)`${o.default.vErrors} === null`,()=>R.assign(o.default.vErrors,(0,i._)`[${F}]`),(0,i._)`${o.default.vErrors}.push(${F})`),R.code((0,i._)`${o.default.errors}++`)}function v(R,D){const{gen:F,validateName:j,schemaEnv:ee}=R;ee.$async?F.throw((0,i._)`new ${R.ValidationError}(${D})`):(F.assign((0,i._)`${j}.errors`,D),F.return(!1))}const S={keyword:new i.Name("keyword"),schemaPath:new i.Name("schemaPath"),params:new i.Name("params"),propertyName:new i.Name("propertyName"),message:new i.Name("message"),schema:new i.Name("schema"),parentSchema:new i.Name("parentSchema")};function T(R,D,F){const{createErrors:j}=R.it;return j===!1?(0,i._)`{}`:I(R,D,F)}function I(R,D,F={}){const{gen:j,it:ee}=R,oe=[z(ee,F),M(R,F)];return C(R,D,oe),j.object(...oe)}function z({errorPath:R},{instancePath:D}){const F=D?(0,i.str)`${R}${(0,a.getErrorPath)(D,a.Type.Str)}`:R;return[o.default.instancePath,(0,i.strConcat)(o.default.instancePath,F)]}function M({keyword:R,it:{errSchemaPath:D}},{schemaPath:F,parentSchema:j}){let ee=j?D:(0,i.str)`${D}/${R}`;return F&&(ee=(0,i.str)`${ee}${(0,a.getErrorPath)(F,a.Type.Str)}`),[S.schemaPath,ee]}function C(R,{params:D,message:F},j){const{keyword:ee,data:oe,schemaValue:se,it:ne}=R,{opts:re,propertyName:ve,topSchemaRef:ze,schemaPath:nt}=ne;j.push([S.keyword,ee],[S.params,typeof D=="function"?D(R):D||(0,i._)`{}`]),re.messages&&j.push([S.message,typeof F=="function"?F(R):F]),re.verbose&&j.push([S.schema,se],[S.parentSchema,(0,i._)`${ze}${nt}`],[o.default.data,oe]),ve&&j.push([S.propertyName,ve])}})(Ic);Object.defineProperty(el,"__esModule",{value:!0});el.boolOrEmptySchema=el.topBoolOrEmptySchema=void 0;const eb=Ic,tb=Fi,ib=Ds,rb={message:"boolean schema is false"};function nb(l){const{gen:i,schema:a,validateName:o}=l;a===!1?ey(l,!1):typeof a=="object"&&a.$async===!0?i.return(ib.default.data):(i.assign((0,tb._)`${o}.errors`,null),i.return(!0))}el.topBoolOrEmptySchema=nb;function sb(l,i){const{gen:a,schema:o}=l;o===!1?(a.var(i,!1),ey(l)):a.var(i,!0)}el.boolOrEmptySchema=sb;function ey(l,i){const{gen:a,data:o}=l,u={gen:a,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:l};(0,eb.reportError)(u,rb,void 0,i)}var Ac={},Ya={};Object.defineProperty(Ya,"__esModule",{value:!0});Ya.getRules=Ya.isJSONType=void 0;const ab=["string","number","integer","boolean","null","object","array"],ob=new Set(ab);function lb(l){return typeof l=="string"&&ob.has(l)}Ya.isJSONType=lb;function cb(){const l={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...l,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},l.number,l.string,l.array,l.object],post:{rules:[]},all:{},keywords:{}}}Ya.getRules=cb;var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.shouldUseRule=Zs.shouldUseGroup=Zs.schemaHasRulesForType=void 0;function ub({schema:l,self:i},a){const o=i.RULES.types[a];return o&&o!==!0&&ty(l,o)}Zs.schemaHasRulesForType=ub;function ty(l,i){return i.rules.some(a=>iy(l,a))}Zs.shouldUseGroup=ty;function iy(l,i){var a;return l[i.keyword]!==void 0||((a=i.definition.implements)===null||a===void 0?void 0:a.some(o=>l[o]!==void 0))}Zs.shouldUseRule=iy;(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.reportTypeError=l.checkDataTypes=l.checkDataType=l.coerceAndCheckDataType=l.getJSONTypes=l.getSchemaTypes=l.DataType=void 0;const i=Ya,a=Zs,o=Ic,u=Fi,f=Gi;var p;(function(j){j[j.Correct=0]="Correct",j[j.Wrong=1]="Wrong"})(p=l.DataType||(l.DataType={}));function n(j){const ee=_(j.type);if(ee.includes("null")){if(j.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!ee.length&&j.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');j.nullable===!0&&ee.push("null")}return ee}l.getSchemaTypes=n;function _(j){const ee=Array.isArray(j)?j:j?[j]:[];if(ee.every(i.isJSONType))return ee;throw new Error("type must be JSONType or JSONType[]: "+ee.join(","))}l.getJSONTypes=_;function v(j,ee){const{gen:oe,data:se,opts:ne}=j,re=T(ee,ne.coerceTypes),ve=ee.length>0&&!(re.length===0&&ee.length===1&&(0,a.schemaHasRulesForType)(j,ee[0]));if(ve){const ze=C(ee,se,ne.strictNumbers,p.Wrong);oe.if(ze,()=>{re.length?I(j,ee,re):D(j)})}return ve}l.coerceAndCheckDataType=v;const S=new Set(["string","number","integer","boolean","null"]);function T(j,ee){return ee?j.filter(oe=>S.has(oe)||ee==="array"&&oe==="array"):[]}function I(j,ee,oe){const{gen:se,data:ne,opts:re}=j,ve=se.let("dataType",(0,u._)`typeof ${ne}`),ze=se.let("coerced",(0,u._)`undefined`);re.coerceTypes==="array"&&se.if((0,u._)`${ve} == 'object' && Array.isArray(${ne}) && ${ne}.length == 1`,()=>se.assign(ne,(0,u._)`${ne}[0]`).assign(ve,(0,u._)`typeof ${ne}`).if(C(ee,ne,re.strictNumbers),()=>se.assign(ze,ne))),se.if((0,u._)`${ze} !== undefined`);for(const be of oe)(S.has(be)||be==="array"&&re.coerceTypes==="array")&&nt(be);se.else(),D(j),se.endIf(),se.if((0,u._)`${ze} !== undefined`,()=>{se.assign(ne,ze),z(j,ze)});function nt(be){switch(be){case"string":se.elseIf((0,u._)`${ve} == "number" || ${ve} == "boolean"`).assign(ze,(0,u._)`"" + ${ne}`).elseIf((0,u._)`${ne} === null`).assign(ze,(0,u._)`""`);return;case"number":se.elseIf((0,u._)`${ve} == "boolean" || ${ne} === null - || (${ve} == "string" && ${ne} && ${ne} == +${ne})`).assign(ze,(0,u._)`+${ne}`);return;case"integer":se.elseIf((0,u._)`${ve} === "boolean" || ${ne} === null - || (${ve} === "string" && ${ne} && ${ne} == +${ne} && !(${ne} % 1))`).assign(ze,(0,u._)`+${ne}`);return;case"boolean":se.elseIf((0,u._)`${ne} === "false" || ${ne} === 0 || ${ne} === null`).assign(ze,!1).elseIf((0,u._)`${ne} === "true" || ${ne} === 1`).assign(ze,!0);return;case"null":se.elseIf((0,u._)`${ne} === "" || ${ne} === 0 || ${ne} === false`),se.assign(ze,null);return;case"array":se.elseIf((0,u._)`${ve} === "string" || ${ve} === "number" - || ${ve} === "boolean" || ${ne} === null`).assign(ze,(0,u._)`[${ne}]`)}}}function z({gen:j,parentData:ee,parentDataProperty:oe},se){j.if((0,u._)`${ee} !== undefined`,()=>j.assign((0,u._)`${ee}[${oe}]`,se))}function M(j,ee,oe,se=p.Correct){const ne=se===p.Correct?u.operators.EQ:u.operators.NEQ;let re;switch(j){case"null":return(0,u._)`${ee} ${ne} null`;case"array":re=(0,u._)`Array.isArray(${ee})`;break;case"object":re=(0,u._)`${ee} && typeof ${ee} == "object" && !Array.isArray(${ee})`;break;case"integer":re=ve((0,u._)`!(${ee} % 1) && !isNaN(${ee})`);break;case"number":re=ve();break;default:return(0,u._)`typeof ${ee} ${ne} ${j}`}return se===p.Correct?re:(0,u.not)(re);function ve(ze=u.nil){return(0,u.and)((0,u._)`typeof ${ee} == "number"`,ze,oe?(0,u._)`isFinite(${ee})`:u.nil)}}l.checkDataType=M;function C(j,ee,oe,se){if(j.length===1)return M(j[0],ee,oe,se);let ne;const re=(0,f.toHash)(j);if(re.array&&re.object){const ve=(0,u._)`typeof ${ee} != "object"`;ne=re.null?ve:(0,u._)`!${ee} || ${ve}`,delete re.null,delete re.array,delete re.object}else ne=u.nil;re.number&&delete re.integer;for(const ve in re)ne=(0,u.and)(ne,M(ve,ee,oe,se));return ne}l.checkDataTypes=C;const R={message:({schema:j})=>`must be ${j}`,params:({schema:j,schemaValue:ee})=>typeof j=="string"?(0,u._)`{type: ${j}}`:(0,u._)`{type: ${ee}}`};function D(j){const ee=F(j);(0,o.reportError)(ee,R)}l.reportTypeError=D;function F(j){const{gen:ee,data:oe,schema:se}=j,ne=(0,f.schemaRefOrVal)(j,se,"type");return{gen:ee,keyword:"type",data:oe,schema:se.type,schemaCode:ne,schemaValue:ne,parentSchema:se,params:{},it:j}}})(Ac);var sh={};Object.defineProperty(sh,"__esModule",{value:!0});sh.assignDefaults=void 0;const jo=Fi,hb=Gi;function fb(l,i){const{properties:a,items:o}=l.schema;if(i==="object"&&a)for(const u in a)$m(l,u,a[u].default);else i==="array"&&Array.isArray(o)&&o.forEach((u,f)=>$m(l,f,u.default))}sh.assignDefaults=fb;function $m(l,i,a){const{gen:o,compositeRule:u,data:f,opts:p}=l;if(a===void 0)return;const n=(0,jo._)`${f}${(0,jo.getProperty)(i)}`;if(u){(0,hb.checkStrictMode)(l,`default is ignored for: ${n}`);return}let _=(0,jo._)`${n} === undefined`;p.useDefaults==="empty"&&(_=(0,jo._)`${_} || ${n} === null || ${n} === ""`),o.if(_,(0,jo._)`${n} = ${(0,jo.stringify)(a)}`)}var zs={},Oi={};Object.defineProperty(Oi,"__esModule",{value:!0});Oi.validateUnion=Oi.validateArray=Oi.usePattern=Oi.callValidateCode=Oi.schemaProperties=Oi.allSchemaProperties=Oi.noPropertyInData=Oi.propertyInData=Oi.isOwnProperty=Oi.hasPropFunc=Oi.reportMissingProp=Oi.checkMissingProp=Oi.checkReportMissingProp=void 0;const ur=Fi,Zf=Gi,da=Ds,db=Gi;function pb(l,i){const{gen:a,data:o,it:u}=l;a.if(Wf(a,o,i,u.opts.ownProperties),()=>{l.setParams({missingProperty:(0,ur._)`${i}`},!0),l.error()})}Oi.checkReportMissingProp=pb;function mb({gen:l,data:i,it:{opts:a}},o,u){return(0,ur.or)(...o.map(f=>(0,ur.and)(Wf(l,i,f,a.ownProperties),(0,ur._)`${u} = ${f}`)))}Oi.checkMissingProp=mb;function gb(l,i){l.setParams({missingProperty:i},!0),l.error()}Oi.reportMissingProp=gb;function ry(l){return l.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ur._)`Object.prototype.hasOwnProperty`})}Oi.hasPropFunc=ry;function Gf(l,i,a){return(0,ur._)`${ry(l)}.call(${i}, ${a})`}Oi.isOwnProperty=Gf;function _b(l,i,a,o){const u=(0,ur._)`${i}${(0,ur.getProperty)(a)} !== undefined`;return o?(0,ur._)`${u} && ${Gf(l,i,a)}`:u}Oi.propertyInData=_b;function Wf(l,i,a,o){const u=(0,ur._)`${i}${(0,ur.getProperty)(a)} === undefined`;return o?(0,ur.or)(u,(0,ur.not)(Gf(l,i,a))):u}Oi.noPropertyInData=Wf;function ny(l){return l?Object.keys(l).filter(i=>i!=="__proto__"):[]}Oi.allSchemaProperties=ny;function yb(l,i){return ny(i).filter(a=>!(0,Zf.alwaysValidSchema)(l,i[a]))}Oi.schemaProperties=yb;function vb({schemaCode:l,data:i,it:{gen:a,topSchemaRef:o,schemaPath:u,errorPath:f},it:p},n,_,v){const S=v?(0,ur._)`${l}, ${i}, ${o}${u}`:i,T=[[da.default.instancePath,(0,ur.strConcat)(da.default.instancePath,f)],[da.default.parentData,p.parentData],[da.default.parentDataProperty,p.parentDataProperty],[da.default.rootData,da.default.rootData]];p.opts.dynamicRef&&T.push([da.default.dynamicAnchors,da.default.dynamicAnchors]);const I=(0,ur._)`${S}, ${a.object(...T)}`;return _!==ur.nil?(0,ur._)`${n}.call(${_}, ${I})`:(0,ur._)`${n}(${I})`}Oi.callValidateCode=vb;const bb=(0,ur._)`new RegExp`;function wb({gen:l,it:{opts:i}},a){const o=i.unicodeRegExp?"u":"",{regExp:u}=i.code,f=u(a,o);return l.scopeValue("pattern",{key:f.toString(),ref:f,code:(0,ur._)`${u.code==="new RegExp"?bb:(0,db.useFunc)(l,u)}(${a}, ${o})`})}Oi.usePattern=wb;function xb(l){const{gen:i,data:a,keyword:o,it:u}=l,f=i.name("valid");if(u.allErrors){const n=i.let("valid",!0);return p(()=>i.assign(n,!1)),n}return i.var(f,!0),p(()=>i.break()),f;function p(n){const _=i.const("len",(0,ur._)`${a}.length`);i.forRange("i",0,_,v=>{l.subschema({keyword:o,dataProp:v,dataPropType:Zf.Type.Num},f),i.if((0,ur.not)(f),n)})}}Oi.validateArray=xb;function Sb(l){const{gen:i,schema:a,keyword:o,it:u}=l;if(!Array.isArray(a))throw new Error("ajv implementation error");if(a.some(_=>(0,Zf.alwaysValidSchema)(u,_))&&!u.opts.unevaluated)return;const p=i.let("valid",!1),n=i.name("_valid");i.block(()=>a.forEach((_,v)=>{const S=l.subschema({keyword:o,schemaProp:v,compositeRule:!0},n);i.assign(p,(0,ur._)`${p} || ${n}`),l.mergeValidEvaluated(S,n)||i.if((0,ur.not)(p))})),l.result(p,()=>l.reset(),()=>l.error(!0))}Oi.validateUnion=Sb;Object.defineProperty(zs,"__esModule",{value:!0});zs.validateKeywordUsage=zs.validSchemaType=zs.funcKeywordCode=zs.macroKeywordCode=void 0;const Mn=Fi,Ga=Ds,Eb=Oi,kb=Ic;function Tb(l,i){const{gen:a,keyword:o,schema:u,parentSchema:f,it:p}=l,n=i.macro.call(p.self,u,f,p),_=sy(a,o,n);p.opts.validateSchema!==!1&&p.self.validateSchema(n,!0);const v=a.name("valid");l.subschema({schema:n,schemaPath:Mn.nil,errSchemaPath:`${p.errSchemaPath}/${o}`,topSchemaRef:_,compositeRule:!0},v),l.pass(v,()=>l.error(!0))}zs.macroKeywordCode=Tb;function Cb(l,i){var a;const{gen:o,keyword:u,schema:f,parentSchema:p,$data:n,it:_}=l;Ab(_,i);const v=!n&&i.compile?i.compile.call(_.self,f,p,_):i.validate,S=sy(o,u,v),T=o.let("valid");l.block$data(T,I),l.ok((a=i.valid)!==null&&a!==void 0?a:T);function I(){if(i.errors===!1)C(),i.modifying&&jm(l),R(()=>l.error());else{const D=i.async?z():M();i.modifying&&jm(l),R(()=>Ib(l,D))}}function z(){const D=o.let("ruleErrs",null);return o.try(()=>C((0,Mn._)`await `),F=>o.assign(T,!1).if((0,Mn._)`${F} instanceof ${_.ValidationError}`,()=>o.assign(D,(0,Mn._)`${F}.errors`),()=>o.throw(F))),D}function M(){const D=(0,Mn._)`${S}.errors`;return o.assign(D,null),C(Mn.nil),D}function C(D=i.async?(0,Mn._)`await `:Mn.nil){const F=_.opts.passContext?Ga.default.this:Ga.default.self,j=!("compile"in i&&!n||i.schema===!1);o.assign(T,(0,Mn._)`${D}${(0,Eb.callValidateCode)(l,S,F,j)}`,i.modifying)}function R(D){var F;o.if((0,Mn.not)((F=i.valid)!==null&&F!==void 0?F:T),D)}}zs.funcKeywordCode=Cb;function jm(l){const{gen:i,data:a,it:o}=l;i.if(o.parentData,()=>i.assign(a,(0,Mn._)`${o.parentData}[${o.parentDataProperty}]`))}function Ib(l,i){const{gen:a}=l;a.if((0,Mn._)`Array.isArray(${i})`,()=>{a.assign(Ga.default.vErrors,(0,Mn._)`${Ga.default.vErrors} === null ? ${i} : ${Ga.default.vErrors}.concat(${i})`).assign(Ga.default.errors,(0,Mn._)`${Ga.default.vErrors}.length`),(0,kb.extendErrors)(l)},()=>l.error())}function Ab({schemaEnv:l},i){if(i.async&&!l.$async)throw new Error("async keyword in sync schema")}function sy(l,i,a){if(a===void 0)throw new Error(`keyword "${i}" failed to compile`);return l.scopeValue("keyword",typeof a=="function"?{ref:a}:{ref:a,code:(0,Mn.stringify)(a)})}function Pb(l,i,a=!1){return!i.length||i.some(o=>o==="array"?Array.isArray(l):o==="object"?l&&typeof l=="object"&&!Array.isArray(l):typeof l==o||a&&typeof l>"u")}zs.validSchemaType=Pb;function zb({schema:l,opts:i,self:a,errSchemaPath:o},u,f){if(Array.isArray(u.keyword)?!u.keyword.includes(f):u.keyword!==f)throw new Error("ajv implementation error");const p=u.dependencies;if(p!=null&&p.some(n=>!Object.prototype.hasOwnProperty.call(l,n)))throw new Error(`parent schema must have dependencies of ${f}: ${p.join(",")}`);if(u.validateSchema&&!u.validateSchema(l[f])){const _=`keyword "${f}" value is invalid at path "${o}": `+a.errorsText(u.validateSchema.errors);if(i.validateSchema==="log")a.logger.error(_);else throw new Error(_)}}zs.validateKeywordUsage=zb;var _a={};Object.defineProperty(_a,"__esModule",{value:!0});_a.extendSubschemaMode=_a.extendSubschemaData=_a.getSubschema=void 0;const As=Fi,ay=Gi;function Mb(l,{keyword:i,schemaProp:a,schema:o,schemaPath:u,errSchemaPath:f,topSchemaRef:p}){if(i!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){const n=l.schema[i];return a===void 0?{schema:n,schemaPath:(0,As._)`${l.schemaPath}${(0,As.getProperty)(i)}`,errSchemaPath:`${l.errSchemaPath}/${i}`}:{schema:n[a],schemaPath:(0,As._)`${l.schemaPath}${(0,As.getProperty)(i)}${(0,As.getProperty)(a)}`,errSchemaPath:`${l.errSchemaPath}/${i}/${(0,ay.escapeFragment)(a)}`}}if(o!==void 0){if(u===void 0||f===void 0||p===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:u,topSchemaRef:p,errSchemaPath:f}}throw new Error('either "keyword" or "schema" must be passed')}_a.getSubschema=Mb;function Db(l,i,{dataProp:a,dataPropType:o,data:u,dataTypes:f,propertyName:p}){if(u!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:n}=i;if(a!==void 0){const{errorPath:v,dataPathArr:S,opts:T}=i,I=n.let("data",(0,As._)`${i.data}${(0,As.getProperty)(a)}`,!0);_(I),l.errorPath=(0,As.str)`${v}${(0,ay.getErrorPath)(a,o,T.jsPropertySyntax)}`,l.parentDataProperty=(0,As._)`${a}`,l.dataPathArr=[...S,l.parentDataProperty]}if(u!==void 0){const v=u instanceof As.Name?u:n.let("data",u,!0);_(v),p!==void 0&&(l.propertyName=p)}f&&(l.dataTypes=f);function _(v){l.data=v,l.dataLevel=i.dataLevel+1,l.dataTypes=[],i.definedProperties=new Set,l.parentData=i.data,l.dataNames=[...i.dataNames,v]}}_a.extendSubschemaData=Db;function Lb(l,{jtdDiscriminator:i,jtdMetadata:a,compositeRule:o,createErrors:u,allErrors:f}){o!==void 0&&(l.compositeRule=o),u!==void 0&&(l.createErrors=u),f!==void 0&&(l.allErrors=f),l.jtdDiscriminator=i,l.jtdMetadata=a}_a.extendSubschemaMode=Lb;var ln={},oy=function l(i,a){if(i===a)return!0;if(i&&a&&typeof i=="object"&&typeof a=="object"){if(i.constructor!==a.constructor)return!1;var o,u,f;if(Array.isArray(i)){if(o=i.length,o!=a.length)return!1;for(u=o;u--!==0;)if(!l(i[u],a[u]))return!1;return!0}if(i.constructor===RegExp)return i.source===a.source&&i.flags===a.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===a.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===a.toString();if(f=Object.keys(i),o=f.length,o!==Object.keys(a).length)return!1;for(u=o;u--!==0;)if(!Object.prototype.hasOwnProperty.call(a,f[u]))return!1;for(u=o;u--!==0;){var p=f[u];if(!l(i[p],a[p]))return!1}return!0}return i!==i&&a!==a},ly={exports:{}},ma=ly.exports=function(l,i,a){typeof i=="function"&&(a=i,i={}),a=i.cb||a;var o=typeof a=="function"?a:a.pre||function(){},u=a.post||function(){};Vu(i,o,u,l,"",l)};ma.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ma.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ma.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ma.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Vu(l,i,a,o,u,f,p,n,_,v){if(o&&typeof o=="object"&&!Array.isArray(o)){i(o,u,f,p,n,_,v);for(var S in o){var T=o[S];if(Array.isArray(T)){if(S in ma.arrayKeywords)for(var I=0;Ii+=cy(o)),i===1/0))return 1/0}return i}function uy(l,i="",a){a!==!1&&(i=Jo(i));const o=l.parse(i);return hy(l,o)}ln.getFullPath=uy;function hy(l,i){return l.serialize(i).split("#")[0]+"#"}ln._getFullPath=hy;const jb=/#\/?$/;function Jo(l){return l?l.replace(jb,""):""}ln.normalizeId=Jo;function qb(l,i,a){return a=Jo(a),l.resolve(i,a)}ln.resolveUrl=qb;const Zb=/^[a-z_][-a-z0-9._]*$/i;function Gb(l,i){if(typeof l=="boolean")return{};const{schemaId:a,uriResolver:o}=this.opts,u=Jo(l[a]||i),f={"":u},p=uy(o,u,!1),n={},_=new Set;return Nb(l,{allKeys:!0},(T,I,z,M)=>{if(M===void 0)return;const C=p+I;let R=f[M];typeof T[a]=="string"&&(R=D.call(this,T[a])),F.call(this,T.$anchor),F.call(this,T.$dynamicAnchor),f[I]=R;function D(j){const ee=this.opts.uriResolver.resolve;if(j=Jo(R?ee(R,j):j),_.has(j))throw S(j);_.add(j);let oe=this.refs[j];return typeof oe=="string"&&(oe=this.refs[oe]),typeof oe=="object"?v(T,oe.schema,j):j!==Jo(C)&&(j[0]==="#"?(v(T,n[j],j),n[j]=T):this.refs[j]=C),j}function F(j){if(typeof j=="string"){if(!Zb.test(j))throw new Error(`invalid anchor "${j}"`);D.call(this,`#${j}`)}}}),n;function v(T,I,z){if(I!==void 0&&!Fb(T,I))throw S(z)}function S(T){return new Error(`reference "${T}" resolves to more than one schema`)}}ln.getSchemaRefs=Gb;Object.defineProperty(ys,"__esModule",{value:!0});ys.getData=ys.KeywordCxt=ys.validateFunctionCode=void 0;const fy=el,qm=Ac,Hf=Zs,Zu=Ac,Wb=sh,yc=zs,xf=_a,hi=Fi,Ti=Ds,Hb=ln,Gs=Gi,dc=Ic;function Kb(l){if(my(l)&&(gy(l),py(l))){Yb(l);return}dy(l,()=>(0,fy.topBoolOrEmptySchema)(l))}ys.validateFunctionCode=Kb;function dy({gen:l,validateName:i,schema:a,schemaEnv:o,opts:u},f){u.code.es5?l.func(i,(0,hi._)`${Ti.default.data}, ${Ti.default.valCxt}`,o.$async,()=>{l.code((0,hi._)`"use strict"; ${Zm(a,u)}`),Jb(l,u),l.code(f)}):l.func(i,(0,hi._)`${Ti.default.data}, ${Xb(u)}`,o.$async,()=>l.code(Zm(a,u)).code(f))}function Xb(l){return(0,hi._)`{${Ti.default.instancePath}="", ${Ti.default.parentData}, ${Ti.default.parentDataProperty}, ${Ti.default.rootData}=${Ti.default.data}${l.dynamicRef?(0,hi._)`, ${Ti.default.dynamicAnchors}={}`:hi.nil}}={}`}function Jb(l,i){l.if(Ti.default.valCxt,()=>{l.var(Ti.default.instancePath,(0,hi._)`${Ti.default.valCxt}.${Ti.default.instancePath}`),l.var(Ti.default.parentData,(0,hi._)`${Ti.default.valCxt}.${Ti.default.parentData}`),l.var(Ti.default.parentDataProperty,(0,hi._)`${Ti.default.valCxt}.${Ti.default.parentDataProperty}`),l.var(Ti.default.rootData,(0,hi._)`${Ti.default.valCxt}.${Ti.default.rootData}`),i.dynamicRef&&l.var(Ti.default.dynamicAnchors,(0,hi._)`${Ti.default.valCxt}.${Ti.default.dynamicAnchors}`)},()=>{l.var(Ti.default.instancePath,(0,hi._)`""`),l.var(Ti.default.parentData,(0,hi._)`undefined`),l.var(Ti.default.parentDataProperty,(0,hi._)`undefined`),l.var(Ti.default.rootData,Ti.default.data),i.dynamicRef&&l.var(Ti.default.dynamicAnchors,(0,hi._)`{}`)})}function Yb(l){const{schema:i,opts:a,gen:o}=l;dy(l,()=>{a.$comment&&i.$comment&&yy(l),rw(l),o.let(Ti.default.vErrors,null),o.let(Ti.default.errors,0),a.unevaluated&&Qb(l),_y(l),aw(l)})}function Qb(l){const{gen:i,validateName:a}=l;l.evaluated=i.const("evaluated",(0,hi._)`${a}.evaluated`),i.if((0,hi._)`${l.evaluated}.dynamicProps`,()=>i.assign((0,hi._)`${l.evaluated}.props`,(0,hi._)`undefined`)),i.if((0,hi._)`${l.evaluated}.dynamicItems`,()=>i.assign((0,hi._)`${l.evaluated}.items`,(0,hi._)`undefined`))}function Zm(l,i){const a=typeof l=="object"&&l[i.schemaId];return a&&(i.code.source||i.code.process)?(0,hi._)`/*# sourceURL=${a} */`:hi.nil}function ew(l,i){if(my(l)&&(gy(l),py(l))){tw(l,i);return}(0,fy.boolOrEmptySchema)(l,i)}function py({schema:l,self:i}){if(typeof l=="boolean")return!l;for(const a in l)if(i.RULES.all[a])return!0;return!1}function my(l){return typeof l.schema!="boolean"}function tw(l,i){const{schema:a,gen:o,opts:u}=l;u.$comment&&a.$comment&&yy(l),nw(l),sw(l);const f=o.const("_errs",Ti.default.errors);_y(l,f),o.var(i,(0,hi._)`${f} === ${Ti.default.errors}`)}function gy(l){(0,Gs.checkUnknownRules)(l),iw(l)}function _y(l,i){if(l.opts.jtd)return Gm(l,[],!1,i);const a=(0,qm.getSchemaTypes)(l.schema),o=(0,qm.coerceAndCheckDataType)(l,a);Gm(l,a,!o,i)}function iw(l){const{schema:i,errSchemaPath:a,opts:o,self:u}=l;i.$ref&&o.ignoreKeywordsWithRef&&(0,Gs.schemaHasRulesButRef)(i,u.RULES)&&u.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}function rw(l){const{schema:i,opts:a}=l;i.default!==void 0&&a.useDefaults&&a.strictSchema&&(0,Gs.checkStrictMode)(l,"default is ignored in the schema root")}function nw(l){const i=l.schema[l.opts.schemaId];i&&(l.baseId=(0,Hb.resolveUrl)(l.opts.uriResolver,l.baseId,i))}function sw(l){if(l.schema.$async&&!l.schemaEnv.$async)throw new Error("async schema in sync schema")}function yy({gen:l,schemaEnv:i,schema:a,errSchemaPath:o,opts:u}){const f=a.$comment;if(u.$comment===!0)l.code((0,hi._)`${Ti.default.self}.logger.log(${f})`);else if(typeof u.$comment=="function"){const p=(0,hi.str)`${o}/$comment`,n=l.scopeValue("root",{ref:i.root});l.code((0,hi._)`${Ti.default.self}.opts.$comment(${f}, ${p}, ${n}.schema)`)}}function aw(l){const{gen:i,schemaEnv:a,validateName:o,ValidationError:u,opts:f}=l;a.$async?i.if((0,hi._)`${Ti.default.errors} === 0`,()=>i.return(Ti.default.data),()=>i.throw((0,hi._)`new ${u}(${Ti.default.vErrors})`)):(i.assign((0,hi._)`${o}.errors`,Ti.default.vErrors),f.unevaluated&&ow(l),i.return((0,hi._)`${Ti.default.errors} === 0`))}function ow({gen:l,evaluated:i,props:a,items:o}){a instanceof hi.Name&&l.assign((0,hi._)`${i}.props`,a),o instanceof hi.Name&&l.assign((0,hi._)`${i}.items`,o)}function Gm(l,i,a,o){const{gen:u,schema:f,data:p,allErrors:n,opts:_,self:v}=l,{RULES:S}=v;if(f.$ref&&(_.ignoreKeywordsWithRef||!(0,Gs.schemaHasRulesButRef)(f,S))){u.block(()=>wy(l,"$ref",S.all.$ref.definition));return}_.jtd||lw(l,i),u.block(()=>{for(const I of S.rules)T(I);T(S.post)});function T(I){(0,Hf.shouldUseGroup)(f,I)&&(I.type?(u.if((0,Zu.checkDataType)(I.type,p,_.strictNumbers)),Wm(l,I),i.length===1&&i[0]===I.type&&a&&(u.else(),(0,Zu.reportTypeError)(l)),u.endIf()):Wm(l,I),n||u.if((0,hi._)`${Ti.default.errors} === ${o||0}`))}}function Wm(l,i){const{gen:a,schema:o,opts:{useDefaults:u}}=l;u&&(0,Wb.assignDefaults)(l,i.type),a.block(()=>{for(const f of i.rules)(0,Hf.shouldUseRule)(o,f)&&wy(l,f.keyword,f.definition,i.type)})}function lw(l,i){l.schemaEnv.meta||!l.opts.strictTypes||(cw(l,i),l.opts.allowUnionTypes||uw(l,i),hw(l,l.dataTypes))}function cw(l,i){if(i.length){if(!l.dataTypes.length){l.dataTypes=i;return}i.forEach(a=>{vy(l.dataTypes,a)||Kf(l,`type "${a}" not allowed by context "${l.dataTypes.join(",")}"`)}),dw(l,i)}}function uw(l,i){i.length>1&&!(i.length===2&&i.includes("null"))&&Kf(l,"use allowUnionTypes to allow union type keyword")}function hw(l,i){const a=l.self.RULES.all;for(const o in a){const u=a[o];if(typeof u=="object"&&(0,Hf.shouldUseRule)(l.schema,u)){const{type:f}=u.definition;f.length&&!f.some(p=>fw(i,p))&&Kf(l,`missing type "${f.join(",")}" for keyword "${o}"`)}}}function fw(l,i){return l.includes(i)||i==="number"&&l.includes("integer")}function vy(l,i){return l.includes(i)||i==="integer"&&l.includes("number")}function dw(l,i){const a=[];for(const o of l.dataTypes)vy(i,o)?a.push(o):i.includes("integer")&&o==="number"&&a.push("integer");l.dataTypes=a}function Kf(l,i){const a=l.schemaEnv.baseId+l.errSchemaPath;i+=` at "${a}" (strictTypes)`,(0,Gs.checkStrictMode)(l,i,l.opts.strictTypes)}class by{constructor(i,a,o){if((0,yc.validateKeywordUsage)(i,a,o),this.gen=i.gen,this.allErrors=i.allErrors,this.keyword=o,this.data=i.data,this.schema=i.schema[o],this.$data=a.$data&&i.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Gs.schemaRefOrVal)(i,this.schema,o,this.$data),this.schemaType=a.schemaType,this.parentSchema=i.schema,this.params={},this.it=i,this.def=a,this.$data)this.schemaCode=i.gen.const("vSchema",xy(this.$data,i));else if(this.schemaCode=this.schemaValue,!(0,yc.validSchemaType)(this.schema,a.schemaType,a.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(a.schemaType)}`);("code"in a?a.trackErrors:a.errors!==!1)&&(this.errsCount=i.gen.const("_errs",Ti.default.errors))}result(i,a,o){this.failResult((0,hi.not)(i),a,o)}failResult(i,a,o){this.gen.if(i),o?o():this.error(),a?(this.gen.else(),a(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(i,a){this.failResult((0,hi.not)(i),void 0,a)}fail(i){if(i===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(i),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(i){if(!this.$data)return this.fail(i);const{schemaCode:a}=this;this.fail((0,hi._)`${a} !== undefined && (${(0,hi.or)(this.invalid$data(),i)})`)}error(i,a,o){if(a){this.setParams(a),this._error(i,o),this.setParams({});return}this._error(i,o)}_error(i,a){(i?dc.reportExtraError:dc.reportError)(this,this.def.error,a)}$dataError(){(0,dc.reportError)(this,this.def.$dataError||dc.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,dc.resetErrorsCount)(this.gen,this.errsCount)}ok(i){this.allErrors||this.gen.if(i)}setParams(i,a){a?Object.assign(this.params,i):this.params=i}block$data(i,a,o=hi.nil){this.gen.block(()=>{this.check$data(i,o),a()})}check$data(i=hi.nil,a=hi.nil){if(!this.$data)return;const{gen:o,schemaCode:u,schemaType:f,def:p}=this;o.if((0,hi.or)((0,hi._)`${u} === undefined`,a)),i!==hi.nil&&o.assign(i,!0),(f.length||p.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),i!==hi.nil&&o.assign(i,!1)),o.else()}invalid$data(){const{gen:i,schemaCode:a,schemaType:o,def:u,it:f}=this;return(0,hi.or)(p(),n());function p(){if(o.length){if(!(a instanceof hi.Name))throw new Error("ajv implementation error");const _=Array.isArray(o)?o:[o];return(0,hi._)`${(0,Zu.checkDataTypes)(_,a,f.opts.strictNumbers,Zu.DataType.Wrong)}`}return hi.nil}function n(){if(u.validateSchema){const _=i.scopeValue("validate$data",{ref:u.validateSchema});return(0,hi._)`!${_}(${a})`}return hi.nil}}subschema(i,a){const o=(0,xf.getSubschema)(this.it,i);(0,xf.extendSubschemaData)(o,this.it,i),(0,xf.extendSubschemaMode)(o,i);const u={...this.it,...o,items:void 0,props:void 0};return ew(u,a),u}mergeEvaluated(i,a){const{it:o,gen:u}=this;o.opts.unevaluated&&(o.props!==!0&&i.props!==void 0&&(o.props=Gs.mergeEvaluated.props(u,i.props,o.props,a)),o.items!==!0&&i.items!==void 0&&(o.items=Gs.mergeEvaluated.items(u,i.items,o.items,a)))}mergeValidEvaluated(i,a){const{it:o,gen:u}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return u.if(a,()=>this.mergeEvaluated(i,hi.Name)),!0}}ys.KeywordCxt=by;function wy(l,i,a,o){const u=new by(l,a,i);"code"in a?a.code(u,o):u.$data&&a.validate?(0,yc.funcKeywordCode)(u,a):"macro"in a?(0,yc.macroKeywordCode)(u,a):(a.compile||a.validate)&&(0,yc.funcKeywordCode)(u,a)}const pw=/^\/(?:[^~]|~0|~1)*$/,mw=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function xy(l,{dataLevel:i,dataNames:a,dataPathArr:o}){let u,f;if(l==="")return Ti.default.rootData;if(l[0]==="/"){if(!pw.test(l))throw new Error(`Invalid JSON-pointer: ${l}`);u=l,f=Ti.default.rootData}else{const v=mw.exec(l);if(!v)throw new Error(`Invalid JSON-pointer: ${l}`);const S=+v[1];if(u=v[2],u==="#"){if(S>=i)throw new Error(_("property/index",S));return o[i-S]}if(S>i)throw new Error(_("data",S));if(f=a[i-S],!u)return f}let p=f;const n=u.split("/");for(const v of n)v&&(f=(0,hi._)`${f}${(0,hi.getProperty)((0,Gs.unescapeJsonPointer)(v))}`,p=(0,hi._)`${p} && ${f}`);return p;function _(v,S){return`Cannot access ${v} ${S} levels up, current level is ${i}`}}ys.getData=xy;var Pc={};Object.defineProperty(Pc,"__esModule",{value:!0});class gw extends Error{constructor(i){super("validation failed"),this.errors=i,this.ajv=this.validation=!0}}Pc.default=gw;var zc={};Object.defineProperty(zc,"__esModule",{value:!0});const Sf=ln;class _w extends Error{constructor(i,a,o,u){super(u||`can't resolve reference ${o} from id ${a}`),this.missingRef=(0,Sf.resolveUrl)(i,a,o),this.missingSchema=(0,Sf.normalizeId)((0,Sf.getFullPath)(i,this.missingRef))}}zc.default=_w;var Nn={};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.resolveSchema=Nn.getCompilingSchema=Nn.resolveRef=Nn.compileSchema=Nn.SchemaEnv=void 0;const ps=Fi,yw=Pc,Za=Ds,_s=ln,Hm=Gi,vw=ys;class ah{constructor(i){var a;this.refs={},this.dynamicAnchors={};let o;typeof i.schema=="object"&&(o=i.schema),this.schema=i.schema,this.schemaId=i.schemaId,this.root=i.root||this,this.baseId=(a=i.baseId)!==null&&a!==void 0?a:(0,_s.normalizeId)(o==null?void 0:o[i.schemaId||"$id"]),this.schemaPath=i.schemaPath,this.localRefs=i.localRefs,this.meta=i.meta,this.$async=o==null?void 0:o.$async,this.refs={}}}Nn.SchemaEnv=ah;function Xf(l){const i=Sy.call(this,l);if(i)return i;const a=(0,_s.getFullPath)(this.opts.uriResolver,l.root.baseId),{es5:o,lines:u}=this.opts.code,{ownProperties:f}=this.opts,p=new ps.CodeGen(this.scope,{es5:o,lines:u,ownProperties:f});let n;l.$async&&(n=p.scopeValue("Error",{ref:yw.default,code:(0,ps._)`require("ajv/dist/runtime/validation_error").default`}));const _=p.scopeName("validate");l.validateName=_;const v={gen:p,allErrors:this.opts.allErrors,data:Za.default.data,parentData:Za.default.parentData,parentDataProperty:Za.default.parentDataProperty,dataNames:[Za.default.data],dataPathArr:[ps.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:p.scopeValue("schema",this.opts.code.source===!0?{ref:l.schema,code:(0,ps.stringify)(l.schema)}:{ref:l.schema}),validateName:_,ValidationError:n,schema:l.schema,schemaEnv:l,rootId:a,baseId:l.baseId||a,schemaPath:ps.nil,errSchemaPath:l.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ps._)`""`,opts:this.opts,self:this};let S;try{this._compilations.add(l),(0,vw.validateFunctionCode)(v),p.optimize(this.opts.code.optimize);const T=p.toString();S=`${p.scopeRefs(Za.default.scope)}return ${T}`,this.opts.code.process&&(S=this.opts.code.process(S,l));const z=new Function(`${Za.default.self}`,`${Za.default.scope}`,S)(this,this.scope.get());if(this.scope.value(_,{ref:z}),z.errors=null,z.schema=l.schema,z.schemaEnv=l,l.$async&&(z.$async=!0),this.opts.code.source===!0&&(z.source={validateName:_,validateCode:T,scopeValues:p._values}),this.opts.unevaluated){const{props:M,items:C}=v;z.evaluated={props:M instanceof ps.Name?void 0:M,items:C instanceof ps.Name?void 0:C,dynamicProps:M instanceof ps.Name,dynamicItems:C instanceof ps.Name},z.source&&(z.source.evaluated=(0,ps.stringify)(z.evaluated))}return l.validate=z,l}catch(T){throw delete l.validate,delete l.validateName,S&&this.logger.error("Error compiling schema, function code:",S),T}finally{this._compilations.delete(l)}}Nn.compileSchema=Xf;function bw(l,i,a){var o;a=(0,_s.resolveUrl)(this.opts.uriResolver,i,a);const u=l.refs[a];if(u)return u;let f=Sw.call(this,l,a);if(f===void 0){const p=(o=l.localRefs)===null||o===void 0?void 0:o[a],{schemaId:n}=this.opts;p&&(f=new ah({schema:p,schemaId:n,root:l,baseId:i}))}if(f!==void 0)return l.refs[a]=ww.call(this,f)}Nn.resolveRef=bw;function ww(l){return(0,_s.inlineRef)(l.schema,this.opts.inlineRefs)?l.schema:l.validate?l:Xf.call(this,l)}function Sy(l){for(const i of this._compilations)if(xw(i,l))return i}Nn.getCompilingSchema=Sy;function xw(l,i){return l.schema===i.schema&&l.root===i.root&&l.baseId===i.baseId}function Sw(l,i){let a;for(;typeof(a=this.refs[i])=="string";)i=a;return a||this.schemas[i]||oh.call(this,l,i)}function oh(l,i){const a=this.opts.uriResolver.parse(i),o=(0,_s._getFullPath)(this.opts.uriResolver,a);let u=(0,_s.getFullPath)(this.opts.uriResolver,l.baseId,void 0);if(Object.keys(l.schema).length>0&&o===u)return Ef.call(this,a,l);const f=(0,_s.normalizeId)(o),p=this.refs[f]||this.schemas[f];if(typeof p=="string"){const n=oh.call(this,l,p);return typeof(n==null?void 0:n.schema)!="object"?void 0:Ef.call(this,a,n)}if(typeof(p==null?void 0:p.schema)=="object"){if(p.validate||Xf.call(this,p),f===(0,_s.normalizeId)(i)){const{schema:n}=p,{schemaId:_}=this.opts,v=n[_];return v&&(u=(0,_s.resolveUrl)(this.opts.uriResolver,u,v)),new ah({schema:n,schemaId:_,root:l,baseId:u})}return Ef.call(this,a,p)}}Nn.resolveSchema=oh;const Ew=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ef(l,{baseId:i,schema:a,root:o}){var u;if(((u=l.fragment)===null||u===void 0?void 0:u[0])!=="/")return;for(const n of l.fragment.slice(1).split("/")){if(typeof a=="boolean")return;const _=a[(0,Hm.unescapeFragment)(n)];if(_===void 0)return;a=_;const v=typeof a=="object"&&a[this.opts.schemaId];!Ew.has(n)&&v&&(i=(0,_s.resolveUrl)(this.opts.uriResolver,i,v))}let f;if(typeof a!="boolean"&&a.$ref&&!(0,Hm.schemaHasRulesButRef)(a,this.RULES)){const n=(0,_s.resolveUrl)(this.opts.uriResolver,i,a.$ref);f=oh.call(this,o,n)}const{schemaId:p}=this.opts;if(f=f||new ah({schema:a,schemaId:p,root:o,baseId:i}),f.schema!==f.root.schema)return f}const kw="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Tw="Meta-schema for $data reference (JSON AnySchema extension proposal)",Cw="object",Iw=["$data"],Aw={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Pw=!1,zw={$id:kw,description:Tw,type:Cw,required:Iw,properties:Aw,additionalProperties:Pw};var Jf={},Lf={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(l,i){(function(a,o){o(i)})(Ho,function(a){function o(){for(var H=arguments.length,X=Array(H),le=0;le1){X[0]=X[0].slice(0,-1);for(var ke=X.length-1,Be=1;Be= 0x80 (not a basic code point)","invalid-input":"Invalid input"},nt=C-R,be=Math.floor,Ke=String.fromCharCode;function q(H){throw new RangeError(ze[H])}function He(H,X){for(var le=[],ke=H.length;ke--;)le[ke]=X(H[ke]);return le}function Rt(H,X){var le=H.split("@"),ke="";le.length>1&&(ke=le[0]+"@",H=le[1]),H=H.replace(ve,".");var Be=H.split("."),bt=He(Be,X).join(".");return ke+bt}function at(H){for(var X=[],le=0,ke=H.length;le=55296&&Be<=56319&&le>1,X+=be(X/le);X>nt*D>>1;Be+=C)X=be(X/nt);return be(Be+(nt+1)*X/(X+F))},xe=function(X){var le=[],ke=X.length,Be=0,bt=oe,dt=ee,Tt=X.lastIndexOf(se);Tt<0&&(Tt=0);for(var qt=0;qt=128&&q("not-basic"),le.push(X.charCodeAt(qt));for(var di=Tt>0?Tt+1:0;di=ke&&q("invalid-input");var ai=ot(X.charCodeAt(di++));(ai>=C||ai>be((M-Be)/ni))&&q("overflow"),Be+=ai*ni;var gi=li<=dt?R:li>=dt+D?D:li-dt;if(aibe(M/Pi)&&q("overflow"),ni*=Pi}var Si=le.length+1;dt=ae(Be-Yt,Si,Yt==0),be(Be/Si)>M-bt&&q("overflow"),bt+=be(Be/Si),Be%=Si,le.splice(Be++,0,bt)}return String.fromCodePoint.apply(String,le)},Me=function(X){var le=[];X=at(X);var ke=X.length,Be=oe,bt=0,dt=ee,Tt=!0,qt=!1,di=void 0;try{for(var Yt=X[Symbol.iterator](),ni;!(Tt=(ni=Yt.next()).done);Tt=!0){var li=ni.value;li<128&&le.push(Ke(li))}}catch(Yr){qt=!0,di=Yr}finally{try{!Tt&&Yt.return&&Yt.return()}finally{if(qt)throw di}}var ai=le.length,gi=ai;for(ai&&le.push(se);gi=Be&&nsbe((M-bt)/Ai)&&q("overflow"),bt+=(Pi-Be)*Ai,Be=Pi;var Jr=!0,un=!1,lr=void 0;try{for(var Mr=X[Symbol.iterator](),to;!(Jr=(to=Mr.next()).done);Jr=!0){var Er=to.value;if(ErM&&q("overflow"),Er==Be){for(var Dr=bt,ss=C;;ss+=C){var vn=ss<=dt?R:ss>=dt+D?D:ss-dt;if(Dr>6|192).toString(16).toUpperCase()+"%"+(X&63|128).toString(16).toUpperCase():le="%"+(X>>12|224).toString(16).toUpperCase()+"%"+(X>>6&63|128).toString(16).toUpperCase()+"%"+(X&63|128).toString(16).toUpperCase(),le}function Ct(H){for(var X="",le=0,ke=H.length;le=194&&Be<224){if(ke-le>=6){var bt=parseInt(H.substr(le+4,2),16);X+=String.fromCharCode((Be&31)<<6|bt&63)}else X+=H.substr(le,6);le+=6}else if(Be>=224){if(ke-le>=9){var dt=parseInt(H.substr(le+4,2),16),Tt=parseInt(H.substr(le+7,2),16);X+=String.fromCharCode((Be&15)<<12|(dt&63)<<6|Tt&63)}else X+=H.substr(le,9);le+=9}else X+=H.substr(le,3),le+=3}return X}function Bt(H,X){function le(ke){var Be=Ct(ke);return Be.match(X.UNRESERVED)?Be:ke}return H.scheme&&(H.scheme=String(H.scheme).replace(X.PCT_ENCODED,le).toLowerCase().replace(X.NOT_SCHEME,"")),H.userinfo!==void 0&&(H.userinfo=String(H.userinfo).replace(X.PCT_ENCODED,le).replace(X.NOT_USERINFO,vt).replace(X.PCT_ENCODED,p)),H.host!==void 0&&(H.host=String(H.host).replace(X.PCT_ENCODED,le).toLowerCase().replace(X.NOT_HOST,vt).replace(X.PCT_ENCODED,p)),H.path!==void 0&&(H.path=String(H.path).replace(X.PCT_ENCODED,le).replace(H.scheme?X.NOT_PATH:X.NOT_PATH_NOSCHEME,vt).replace(X.PCT_ENCODED,p)),H.query!==void 0&&(H.query=String(H.query).replace(X.PCT_ENCODED,le).replace(X.NOT_QUERY,vt).replace(X.PCT_ENCODED,p)),H.fragment!==void 0&&(H.fragment=String(H.fragment).replace(X.PCT_ENCODED,le).replace(X.NOT_FRAGMENT,vt).replace(X.PCT_ENCODED,p)),H}function fi(H){return H.replace(/^0*(.*)/,"$1")||"0"}function pt(H,X){var le=H.match(X.IPV4ADDRESS)||[],ke=I(le,2),Be=ke[1];return Be?Be.split(".").map(fi).join("."):H}function _i(H,X){var le=H.match(X.IPV6ADDRESS)||[],ke=I(le,3),Be=ke[1],bt=ke[2];if(Be){for(var dt=Be.toLowerCase().split("::").reverse(),Tt=I(dt,2),qt=Tt[0],di=Tt[1],Yt=di?di.split(":").map(fi):[],ni=qt.split(":").map(fi),li=X.IPV4ADDRESS.test(ni[ni.length-1]),ai=li?7:8,gi=ni.length-ai,Pi=Array(ai),Si=0;Si1){var rs=Pi.slice(0,yn.index),ns=Pi.slice(yn.index+yn.length);pr=rs.join(":")+"::"+ns.join(":")}else pr=Pi.join(":");return bt&&(pr+="%"+bt),pr}else return H}var Z=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,lt="".match(/(){0}/)[1]===void 0;function et(H){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},le={},ke=X.iri!==!1?T:S;X.reference==="suffix"&&(H=(X.scheme?X.scheme+":":"")+"//"+H);var Be=H.match(Z);if(Be){lt?(le.scheme=Be[1],le.userinfo=Be[3],le.host=Be[4],le.port=parseInt(Be[5],10),le.path=Be[6]||"",le.query=Be[7],le.fragment=Be[8],isNaN(le.port)&&(le.port=Be[5])):(le.scheme=Be[1]||void 0,le.userinfo=H.indexOf("@")!==-1?Be[3]:void 0,le.host=H.indexOf("//")!==-1?Be[4]:void 0,le.port=parseInt(Be[5],10),le.path=Be[6]||"",le.query=H.indexOf("?")!==-1?Be[7]:void 0,le.fragment=H.indexOf("#")!==-1?Be[8]:void 0,isNaN(le.port)&&(le.port=H.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?Be[4]:void 0)),le.host&&(le.host=_i(pt(le.host,ke),ke)),le.scheme===void 0&&le.userinfo===void 0&&le.host===void 0&&le.port===void 0&&!le.path&&le.query===void 0?le.reference="same-document":le.scheme===void 0?le.reference="relative":le.fragment===void 0?le.reference="absolute":le.reference="uri",X.reference&&X.reference!=="suffix"&&X.reference!==le.reference&&(le.error=le.error||"URI is not a "+X.reference+" reference.");var bt=kt[(X.scheme||le.scheme||"").toLowerCase()];if(!X.unicodeSupport&&(!bt||!bt.unicodeSupport)){if(le.host&&(X.domainHost||bt&&bt.domainHost))try{le.host=Je.toASCII(le.host.replace(ke.PCT_ENCODED,Ct).toLowerCase())}catch(dt){le.error=le.error||"Host's domain name can not be converted to ASCII via punycode: "+dt}Bt(le,S)}else Bt(le,ke);bt&&bt.parse&&bt.parse(le,X)}else le.error=le.error||"URI can not be parsed.";return le}function Se(H,X){var le=X.iri!==!1?T:S,ke=[];return H.userinfo!==void 0&&(ke.push(H.userinfo),ke.push("@")),H.host!==void 0&&ke.push(_i(pt(String(H.host),le),le).replace(le.IPV6ADDRESS,function(Be,bt,dt){return"["+bt+(dt?"%25"+dt:"")+"]"})),(typeof H.port=="number"||typeof H.port=="string")&&(ke.push(":"),ke.push(String(H.port))),ke.length?ke.join(""):void 0}var ge=/^\.\.?\//,$e=/^\/\.(\/|$)/,ft=/^\/\.\.(\/|$)/,Ie=/^\/?(?:.|\n)*?(?=\/|$)/;function We(H){for(var X=[];H.length;)if(H.match(ge))H=H.replace(ge,"");else if(H.match($e))H=H.replace($e,"/");else if(H.match(ft))H=H.replace(ft,"/"),X.pop();else if(H==="."||H==="..")H="";else{var le=H.match(Ie);if(le){var ke=le[0];H=H.slice(ke.length),X.push(ke)}else throw new Error("Unexpected dot segment condition")}return X.join("")}function wt(H){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},le=X.iri?T:S,ke=[],Be=kt[(X.scheme||H.scheme||"").toLowerCase()];if(Be&&Be.serialize&&Be.serialize(H,X),H.host&&!le.IPV6ADDRESS.test(H.host)){if(X.domainHost||Be&&Be.domainHost)try{H.host=X.iri?Je.toUnicode(H.host):Je.toASCII(H.host.replace(le.PCT_ENCODED,Ct).toLowerCase())}catch(Tt){H.error=H.error||"Host's domain name can not be converted to "+(X.iri?"Unicode":"ASCII")+" via punycode: "+Tt}}Bt(H,le),X.reference!=="suffix"&&H.scheme&&(ke.push(H.scheme),ke.push(":"));var bt=Se(H,X);if(bt!==void 0&&(X.reference!=="suffix"&&ke.push("//"),ke.push(bt),H.path&&H.path.charAt(0)!=="/"&&ke.push("/")),H.path!==void 0){var dt=H.path;!X.absolutePath&&(!Be||!Be.absolutePath)&&(dt=We(dt)),bt===void 0&&(dt=dt.replace(/^\/\//,"/%2F")),ke.push(dt)}return H.query!==void 0&&(ke.push("?"),ke.push(H.query)),H.fragment!==void 0&&(ke.push("#"),ke.push(H.fragment)),ke.join("")}function Et(H,X){var le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ke=arguments[3],Be={};return ke||(H=et(wt(H,le),le),X=et(wt(X,le),le)),le=le||{},!le.tolerant&&X.scheme?(Be.scheme=X.scheme,Be.userinfo=X.userinfo,Be.host=X.host,Be.port=X.port,Be.path=We(X.path||""),Be.query=X.query):(X.userinfo!==void 0||X.host!==void 0||X.port!==void 0?(Be.userinfo=X.userinfo,Be.host=X.host,Be.port=X.port,Be.path=We(X.path||""),Be.query=X.query):(X.path?(X.path.charAt(0)==="/"?Be.path=We(X.path):((H.userinfo!==void 0||H.host!==void 0||H.port!==void 0)&&!H.path?Be.path="/"+X.path:H.path?Be.path=H.path.slice(0,H.path.lastIndexOf("/")+1)+X.path:Be.path=X.path,Be.path=We(Be.path)),Be.query=X.query):(Be.path=H.path,X.query!==void 0?Be.query=X.query:Be.query=H.query),Be.userinfo=H.userinfo,Be.host=H.host,Be.port=H.port),Be.scheme=H.scheme),Be.fragment=X.fragment,Be}function ct(H,X,le){var ke=_({scheme:"null"},le);return wt(Et(et(H,ke),et(X,ke),ke,!0),ke)}function Xt(H,X){return typeof H=="string"?H=wt(et(H,X),X):f(H)==="object"&&(H=et(wt(H,X),X)),H}function Ii(H,X,le){return typeof H=="string"?H=wt(et(H,le),le):f(H)==="object"&&(H=wt(H,le)),typeof X=="string"?X=wt(et(X,le),le):f(X)==="object"&&(X=wt(X,le)),H===X}function ki(H,X){return H&&H.toString().replace(!X||!X.iri?S.ESCAPE:T.ESCAPE,vt)}function Wi(H,X){return H&&H.toString().replace(!X||!X.iri?S.PCT_ENCODED:T.PCT_ENCODED,Ct)}var ar={scheme:"http",domainHost:!0,parse:function(X,le){return X.host||(X.error=X.error||"HTTP URIs must have a host."),X},serialize:function(X,le){var ke=String(X.scheme).toLowerCase()==="https";return(X.port===(ke?443:80)||X.port==="")&&(X.port=void 0),X.path||(X.path="/"),X}},dr={scheme:"https",domainHost:ar.domainHost,parse:ar.parse,serialize:ar.serialize};function Gr(H){return typeof H.secure=="boolean"?H.secure:String(H.scheme).toLowerCase()==="wss"}var mt={scheme:"ws",domainHost:!0,parse:function(X,le){var ke=X;return ke.secure=Gr(ke),ke.resourceName=(ke.path||"/")+(ke.query?"?"+ke.query:""),ke.path=void 0,ke.query=void 0,ke},serialize:function(X,le){if((X.port===(Gr(X)?443:80)||X.port==="")&&(X.port=void 0),typeof X.secure=="boolean"&&(X.scheme=X.secure?"wss":"ws",X.secure=void 0),X.resourceName){var ke=X.resourceName.split("?"),Be=I(ke,2),bt=Be[0],dt=Be[1];X.path=bt&&bt!=="/"?bt:void 0,X.query=dt,X.resourceName=void 0}return X.fragment=void 0,X}},Ji={scheme:"wss",domainHost:mt.domainHost,parse:mt.parse,serialize:mt.serialize},wr={},xr="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",or="[0-9A-Fa-f]",Pt=u(u("%[EFef]"+or+"%"+or+or+"%"+or+or)+"|"+u("%[89A-Fa-f]"+or+"%"+or+or)+"|"+u("%"+or+or)),vi="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",bi="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Sr=o(bi,'[\\"\\\\]'),Vr="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",pi=new RegExp(xr,"g"),cn=new RegExp(Pt,"g"),_e=new RegExp(o("[^]",vi,"[\\.]",'[\\"]',Sr),"g"),G=new RegExp(o("[^]",xr,Vr),"g"),K=G;function ce(H){var X=Ct(H);return X.match(pi)?X:H}var ye={scheme:"mailto",parse:function(X,le){var ke=X,Be=ke.to=ke.path?ke.path.split(","):[];if(ke.path=void 0,ke.query){for(var bt=!1,dt={},Tt=ke.query.split("&"),qt=0,di=Tt.length;qtnew RegExp(st,ae);z.code="new RegExp";const M=["removeAdditional","useDefaults","coerceTypes"],C=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),R={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},D={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},F=200;function j(st){var ae,xe,Me,Y,he,Je,kt,vt,Ct,Bt,fi,pt,_i,Z,lt,et,Se,ge,$e,ft,Ie,We,wt,Et,ct;const Xt=st.strict,Ii=(ae=st.code)===null||ae===void 0?void 0:ae.optimize,ki=Ii===!0||Ii===void 0?1:Ii||0,Wi=(Me=(xe=st.code)===null||xe===void 0?void 0:xe.regExp)!==null&&Me!==void 0?Me:z,ar=(Y=st.uriResolver)!==null&&Y!==void 0?Y:I.default;return{strictSchema:(Je=(he=st.strictSchema)!==null&&he!==void 0?he:Xt)!==null&&Je!==void 0?Je:!0,strictNumbers:(vt=(kt=st.strictNumbers)!==null&&kt!==void 0?kt:Xt)!==null&&vt!==void 0?vt:!0,strictTypes:(Bt=(Ct=st.strictTypes)!==null&&Ct!==void 0?Ct:Xt)!==null&&Bt!==void 0?Bt:"log",strictTuples:(pt=(fi=st.strictTuples)!==null&&fi!==void 0?fi:Xt)!==null&&pt!==void 0?pt:"log",strictRequired:(Z=(_i=st.strictRequired)!==null&&_i!==void 0?_i:Xt)!==null&&Z!==void 0?Z:!1,code:st.code?{...st.code,optimize:ki,regExp:Wi}:{optimize:ki,regExp:Wi},loopRequired:(lt=st.loopRequired)!==null&<!==void 0?lt:F,loopEnum:(et=st.loopEnum)!==null&&et!==void 0?et:F,meta:(Se=st.meta)!==null&&Se!==void 0?Se:!0,messages:(ge=st.messages)!==null&&ge!==void 0?ge:!0,inlineRefs:($e=st.inlineRefs)!==null&&$e!==void 0?$e:!0,schemaId:(ft=st.schemaId)!==null&&ft!==void 0?ft:"$id",addUsedSchema:(Ie=st.addUsedSchema)!==null&&Ie!==void 0?Ie:!0,validateSchema:(We=st.validateSchema)!==null&&We!==void 0?We:!0,validateFormats:(wt=st.validateFormats)!==null&&wt!==void 0?wt:!0,unicodeRegExp:(Et=st.unicodeRegExp)!==null&&Et!==void 0?Et:!0,int32range:(ct=st.int32range)!==null&&ct!==void 0?ct:!0,uriResolver:ar}}class ee{constructor(ae={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,ae=this.opts={...ae,...j(ae)};const{es5:xe,lines:Me}=this.opts.code;this.scope=new n.ValueScope({scope:{},prefixes:C,es5:xe,lines:Me}),this.logger=be(ae.logger);const Y=ae.validateFormats;ae.validateFormats=!1,this.RULES=(0,f.getRules)(),oe.call(this,R,ae,"NOT SUPPORTED"),oe.call(this,D,ae,"DEPRECATED","warn"),this._metaOpts=ze.call(this),ae.formats&&re.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),ae.keywords&&ve.call(this,ae.keywords),typeof ae.meta=="object"&&this.addMetaSchema(ae.meta),ne.call(this),ae.validateFormats=Y}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:ae,meta:xe,schemaId:Me}=this.opts;let Y=T;Me==="id"&&(Y={...T},Y.id=Y.$id,delete Y.$id),xe&&ae&&this.addMetaSchema(Y,Y[Me],!1)}defaultMeta(){const{meta:ae,schemaId:xe}=this.opts;return this.opts.defaultMeta=typeof ae=="object"?ae[xe]||ae:void 0}validate(ae,xe){let Me;if(typeof ae=="string"){if(Me=this.getSchema(ae),!Me)throw new Error(`no schema with key or ref "${ae}"`)}else Me=this.compile(ae);const Y=Me(xe);return"$async"in Me||(this.errors=Me.errors),Y}compile(ae,xe){const Me=this._addSchema(ae,xe);return Me.validate||this._compileSchemaEnv(Me)}compileAsync(ae,xe){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:Me}=this.opts;return Y.call(this,ae,xe);async function Y(Bt,fi){await he.call(this,Bt.$schema);const pt=this._addSchema(Bt,fi);return pt.validate||Je.call(this,pt)}async function he(Bt){Bt&&!this.getSchema(Bt)&&await Y.call(this,{$ref:Bt},!0)}async function Je(Bt){try{return this._compileSchemaEnv(Bt)}catch(fi){if(!(fi instanceof u.default))throw fi;return kt.call(this,fi),await vt.call(this,fi.missingSchema),Je.call(this,Bt)}}function kt({missingSchema:Bt,missingRef:fi}){if(this.refs[Bt])throw new Error(`AnySchema ${Bt} is loaded but ${fi} cannot be resolved`)}async function vt(Bt){const fi=await Ct.call(this,Bt);this.refs[Bt]||await he.call(this,fi.$schema),this.refs[Bt]||this.addSchema(fi,Bt,xe)}async function Ct(Bt){const fi=this._loading[Bt];if(fi)return fi;try{return await(this._loading[Bt]=Me(Bt))}finally{delete this._loading[Bt]}}}addSchema(ae,xe,Me,Y=this.opts.validateSchema){if(Array.isArray(ae)){for(const Je of ae)this.addSchema(Je,void 0,Me,Y);return this}let he;if(typeof ae=="object"){const{schemaId:Je}=this.opts;if(he=ae[Je],he!==void 0&&typeof he!="string")throw new Error(`schema ${Je} must be string`)}return xe=(0,_.normalizeId)(xe||he),this._checkUnique(xe),this.schemas[xe]=this._addSchema(ae,Me,xe,Y,!0),this}addMetaSchema(ae,xe,Me=this.opts.validateSchema){return this.addSchema(ae,xe,!0,Me),this}validateSchema(ae,xe){if(typeof ae=="boolean")return!0;let Me;if(Me=ae.$schema,Me!==void 0&&typeof Me!="string")throw new Error("$schema must be a string");if(Me=Me||this.opts.defaultMeta||this.defaultMeta(),!Me)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const Y=this.validate(Me,ae);if(!Y&&xe){const he="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(he);else throw new Error(he)}return Y}getSchema(ae){let xe;for(;typeof(xe=se.call(this,ae))=="string";)ae=xe;if(xe===void 0){const{schemaId:Me}=this.opts,Y=new p.SchemaEnv({schema:{},schemaId:Me});if(xe=p.resolveSchema.call(this,Y,ae),!xe)return;this.refs[ae]=xe}return xe.validate||this._compileSchemaEnv(xe)}removeSchema(ae){if(ae instanceof RegExp)return this._removeAllSchemas(this.schemas,ae),this._removeAllSchemas(this.refs,ae),this;switch(typeof ae){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const xe=se.call(this,ae);return typeof xe=="object"&&this._cache.delete(xe.schema),delete this.schemas[ae],delete this.refs[ae],this}case"object":{const xe=ae;this._cache.delete(xe);let Me=ae[this.opts.schemaId];return Me&&(Me=(0,_.normalizeId)(Me),delete this.schemas[Me],delete this.refs[Me]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(ae){for(const xe of ae)this.addKeyword(xe);return this}addKeyword(ae,xe){let Me;if(typeof ae=="string")Me=ae,typeof xe=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),xe.keyword=Me);else if(typeof ae=="object"&&xe===void 0){if(xe=ae,Me=xe.keyword,Array.isArray(Me)&&!Me.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(q.call(this,Me,xe),!xe)return(0,S.eachItem)(Me,he=>He.call(this,he)),this;at.call(this,xe);const Y={...xe,type:(0,v.getJSONTypes)(xe.type),schemaType:(0,v.getJSONTypes)(xe.schemaType)};return(0,S.eachItem)(Me,Y.type.length===0?he=>He.call(this,he,Y):he=>Y.type.forEach(Je=>He.call(this,he,Y,Je))),this}getKeyword(ae){const xe=this.RULES.all[ae];return typeof xe=="object"?xe.definition:!!xe}removeKeyword(ae){const{RULES:xe}=this;delete xe.keywords[ae],delete xe.all[ae];for(const Me of xe.rules){const Y=Me.rules.findIndex(he=>he.keyword===ae);Y>=0&&Me.rules.splice(Y,1)}return this}addFormat(ae,xe){return typeof xe=="string"&&(xe=new RegExp(xe)),this.formats[ae]=xe,this}errorsText(ae=this.errors,{separator:xe=", ",dataVar:Me="data"}={}){return!ae||ae.length===0?"No errors":ae.map(Y=>`${Me}${Y.instancePath} ${Y.message}`).reduce((Y,he)=>Y+xe+he)}$dataMetaSchema(ae,xe){const Me=this.RULES.all;ae=JSON.parse(JSON.stringify(ae));for(const Y of xe){const he=Y.split("/").slice(1);let Je=ae;for(const kt of he)Je=Je[kt];for(const kt in Me){const vt=Me[kt];if(typeof vt!="object")continue;const{$data:Ct}=vt.definition,Bt=Je[kt];Ct&&Bt&&(Je[kt]=ot(Bt))}}return ae}_removeAllSchemas(ae,xe){for(const Me in ae){const Y=ae[Me];(!xe||xe.test(Me))&&(typeof Y=="string"?delete ae[Me]:Y&&!Y.meta&&(this._cache.delete(Y.schema),delete ae[Me]))}}_addSchema(ae,xe,Me,Y=this.opts.validateSchema,he=this.opts.addUsedSchema){let Je;const{schemaId:kt}=this.opts;if(typeof ae=="object")Je=ae[kt];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof ae!="boolean")throw new Error("schema must be object or boolean")}let vt=this._cache.get(ae);if(vt!==void 0)return vt;Me=(0,_.normalizeId)(Je||Me);const Ct=_.getSchemaRefs.call(this,ae,Me);return vt=new p.SchemaEnv({schema:ae,schemaId:kt,meta:xe,baseId:Me,localRefs:Ct}),this._cache.set(vt.schema,vt),he&&!Me.startsWith("#")&&(Me&&this._checkUnique(Me),this.refs[Me]=vt),Y&&this.validateSchema(ae,!0),vt}_checkUnique(ae){if(this.schemas[ae]||this.refs[ae])throw new Error(`schema with key or id "${ae}" already exists`)}_compileSchemaEnv(ae){if(ae.meta?this._compileMetaSchema(ae):p.compileSchema.call(this,ae),!ae.validate)throw new Error("ajv implementation error");return ae.validate}_compileMetaSchema(ae){const xe=this.opts;this.opts=this._metaOpts;try{p.compileSchema.call(this,ae)}finally{this.opts=xe}}}l.default=ee,ee.ValidationError=o.default,ee.MissingRefError=u.default;function oe(st,ae,xe,Me="error"){for(const Y in st){const he=Y;he in ae&&this.logger[Me](`${xe}: option ${Y}. ${st[he]}`)}}function se(st){return st=(0,_.normalizeId)(st),this.schemas[st]||this.refs[st]}function ne(){const st=this.opts.schemas;if(st)if(Array.isArray(st))this.addSchema(st);else for(const ae in st)this.addSchema(st[ae],ae)}function re(){for(const st in this.opts.formats){const ae=this.opts.formats[st];ae&&this.addFormat(st,ae)}}function ve(st){if(Array.isArray(st)){this.addVocabulary(st);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const ae in st){const xe=st[ae];xe.keyword||(xe.keyword=ae),this.addKeyword(xe)}}function ze(){const st={...this.opts};for(const ae of M)delete st[ae];return st}const nt={log(){},warn(){},error(){}};function be(st){if(st===!1)return nt;if(st===void 0)return console;if(st.log&&st.warn&&st.error)return st;throw new Error("logger must implement log, warn and error methods")}const Ke=/^[a-z_$][a-z0-9_$:-]*$/i;function q(st,ae){const{RULES:xe}=this;if((0,S.eachItem)(st,Me=>{if(xe.keywords[Me])throw new Error(`Keyword ${Me} is already defined`);if(!Ke.test(Me))throw new Error(`Keyword ${Me} has invalid name`)}),!!ae&&ae.$data&&!("code"in ae||"validate"in ae))throw new Error('$data keyword must have "code" or "validate" function')}function He(st,ae,xe){var Me;const Y=ae==null?void 0:ae.post;if(xe&&Y)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:he}=this;let Je=Y?he.post:he.rules.find(({type:vt})=>vt===xe);if(Je||(Je={type:xe,rules:[]},he.rules.push(Je)),he.keywords[st]=!0,!ae)return;const kt={keyword:st,definition:{...ae,type:(0,v.getJSONTypes)(ae.type),schemaType:(0,v.getJSONTypes)(ae.schemaType)}};ae.before?Rt.call(this,Je,kt,ae.before):Je.rules.push(kt),he.all[st]=kt,(Me=ae.implements)===null||Me===void 0||Me.forEach(vt=>this.addKeyword(vt))}function Rt(st,ae,xe){const Me=st.rules.findIndex(Y=>Y.keyword===xe);Me>=0?st.rules.splice(Me,0,ae):(st.rules.push(ae),this.logger.warn(`rule ${xe} is not defined`))}function at(st){let{metaSchema:ae}=st;ae!==void 0&&(st.$data&&this.opts.$data&&(ae=ot(ae)),st.validateSchema=this.compile(ae,!0))}const Wt={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ot(st){return{anyOf:[st,Wt]}}})(Q_);var Yf={},Qf={},ed={};Object.defineProperty(ed,"__esModule",{value:!0});const Dw={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};ed.default=Dw;var Qa={};Object.defineProperty(Qa,"__esModule",{value:!0});Qa.callRef=Qa.getValidate=void 0;const Lw=zc,Km=Oi,Fn=Fi,qo=Ds,Xm=Nn,Mu=Gi,Rw={keyword:"$ref",schemaType:"string",code(l){const{gen:i,schema:a,it:o}=l,{baseId:u,schemaEnv:f,validateName:p,opts:n,self:_}=o,{root:v}=f;if((a==="#"||a==="#/")&&u===v.baseId)return T();const S=Xm.resolveRef.call(_,v,u,a);if(S===void 0)throw new Lw.default(o.opts.uriResolver,u,a);if(S instanceof Xm.SchemaEnv)return I(S);return z(S);function T(){if(f===v)return $u(l,p,f,f.$async);const M=i.scopeValue("root",{ref:v});return $u(l,(0,Fn._)`${M}.validate`,v,v.$async)}function I(M){const C=ky(l,M);$u(l,C,M,M.$async)}function z(M){const C=i.scopeValue("schema",n.code.source===!0?{ref:M,code:(0,Fn.stringify)(M)}:{ref:M}),R=i.name("valid"),D=l.subschema({schema:M,dataTypes:[],schemaPath:Fn.nil,topSchemaRef:C,errSchemaPath:a},R);l.mergeEvaluated(D),l.ok(R)}}};function ky(l,i){const{gen:a}=l;return i.validate?a.scopeValue("validate",{ref:i.validate}):(0,Fn._)`${a.scopeValue("wrapper",{ref:i})}.validate`}Qa.getValidate=ky;function $u(l,i,a,o){const{gen:u,it:f}=l,{allErrors:p,schemaEnv:n,opts:_}=f,v=_.passContext?qo.default.this:Fn.nil;o?S():T();function S(){if(!n.$async)throw new Error("async schema referenced by sync schema");const M=u.let("valid");u.try(()=>{u.code((0,Fn._)`await ${(0,Km.callValidateCode)(l,i,v)}`),z(i),p||u.assign(M,!0)},C=>{u.if((0,Fn._)`!(${C} instanceof ${f.ValidationError})`,()=>u.throw(C)),I(C),p||u.assign(M,!1)}),l.ok(M)}function T(){l.result((0,Km.callValidateCode)(l,i,v),()=>z(i),()=>I(i))}function I(M){const C=(0,Fn._)`${M}.errors`;u.assign(qo.default.vErrors,(0,Fn._)`${qo.default.vErrors} === null ? ${C} : ${qo.default.vErrors}.concat(${C})`),u.assign(qo.default.errors,(0,Fn._)`${qo.default.vErrors}.length`)}function z(M){var C;if(!f.opts.unevaluated)return;const R=(C=a==null?void 0:a.validate)===null||C===void 0?void 0:C.evaluated;if(f.props!==!0)if(R&&!R.dynamicProps)R.props!==void 0&&(f.props=Mu.mergeEvaluated.props(u,R.props,f.props));else{const D=u.var("props",(0,Fn._)`${M}.evaluated.props`);f.props=Mu.mergeEvaluated.props(u,D,f.props,Fn.Name)}if(f.items!==!0)if(R&&!R.dynamicItems)R.items!==void 0&&(f.items=Mu.mergeEvaluated.items(u,R.items,f.items));else{const D=u.var("items",(0,Fn._)`${M}.evaluated.items`);f.items=Mu.mergeEvaluated.items(u,D,f.items,Fn.Name)}}}Qa.callRef=$u;Qa.default=Rw;Object.defineProperty(Qf,"__esModule",{value:!0});const Bw=ed,Ow=Qa,Fw=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Bw.default,Ow.default];Qf.default=Fw;var td={},id={};Object.defineProperty(id,"__esModule",{value:!0});const Gu=Fi,pa=Gu.operators,Wu={maximum:{okStr:"<=",ok:pa.LTE,fail:pa.GT},minimum:{okStr:">=",ok:pa.GTE,fail:pa.LT},exclusiveMaximum:{okStr:"<",ok:pa.LT,fail:pa.GTE},exclusiveMinimum:{okStr:">",ok:pa.GT,fail:pa.LTE}},Nw={message:({keyword:l,schemaCode:i})=>(0,Gu.str)`must be ${Wu[l].okStr} ${i}`,params:({keyword:l,schemaCode:i})=>(0,Gu._)`{comparison: ${Wu[l].okStr}, limit: ${i}}`},Uw={keyword:Object.keys(Wu),type:"number",schemaType:"number",$data:!0,error:Nw,code(l){const{keyword:i,data:a,schemaCode:o}=l;l.fail$data((0,Gu._)`${a} ${Wu[i].fail} ${o} || isNaN(${a})`)}};id.default=Uw;var rd={};Object.defineProperty(rd,"__esModule",{value:!0});const vc=Fi,Vw={message:({schemaCode:l})=>(0,vc.str)`must be multiple of ${l}`,params:({schemaCode:l})=>(0,vc._)`{multipleOf: ${l}}`},$w={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Vw,code(l){const{gen:i,data:a,schemaCode:o,it:u}=l,f=u.opts.multipleOfPrecision,p=i.let("res"),n=f?(0,vc._)`Math.abs(Math.round(${p}) - ${p}) > 1e-${f}`:(0,vc._)`${p} !== parseInt(${p})`;l.fail$data((0,vc._)`(${o} === 0 || (${p} = ${a}/${o}, ${n}))`)}};rd.default=$w;var nd={},sd={};Object.defineProperty(sd,"__esModule",{value:!0});function Ty(l){const i=l.length;let a=0,o=0,u;for(;o=55296&&u<=56319&&o(0,Wa._)`{limit: ${l}}`},Gw={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Zw,code(l){const{keyword:i,data:a,schemaCode:o,it:u}=l,f=i==="maxLength"?Wa.operators.GT:Wa.operators.LT,p=u.opts.unicode===!1?(0,Wa._)`${a}.length`:(0,Wa._)`${(0,jw.useFunc)(l.gen,qw.default)}(${a})`;l.fail$data((0,Wa._)`${p} ${f} ${o}`)}};nd.default=Gw;var ad={};Object.defineProperty(ad,"__esModule",{value:!0});const Ww=Oi,Hu=Fi,Hw={message:({schemaCode:l})=>(0,Hu.str)`must match pattern "${l}"`,params:({schemaCode:l})=>(0,Hu._)`{pattern: ${l}}`},Kw={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Hw,code(l){const{data:i,$data:a,schema:o,schemaCode:u,it:f}=l,p=f.opts.unicodeRegExp?"u":"",n=a?(0,Hu._)`(new RegExp(${u}, ${p}))`:(0,Ww.usePattern)(l,o);l.fail$data((0,Hu._)`!${n}.test(${i})`)}};ad.default=Kw;var od={};Object.defineProperty(od,"__esModule",{value:!0});const bc=Fi,Xw={message({keyword:l,schemaCode:i}){const a=l==="maxProperties"?"more":"fewer";return(0,bc.str)`must NOT have ${a} than ${i} properties`},params:({schemaCode:l})=>(0,bc._)`{limit: ${l}}`},Jw={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Xw,code(l){const{keyword:i,data:a,schemaCode:o}=l,u=i==="maxProperties"?bc.operators.GT:bc.operators.LT;l.fail$data((0,bc._)`Object.keys(${a}).length ${u} ${o}`)}};od.default=Jw;var ld={};Object.defineProperty(ld,"__esModule",{value:!0});const pc=Oi,wc=Fi,Yw=Gi,Qw={message:({params:{missingProperty:l}})=>(0,wc.str)`must have required property '${l}'`,params:({params:{missingProperty:l}})=>(0,wc._)`{missingProperty: ${l}}`},ex={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Qw,code(l){const{gen:i,schema:a,schemaCode:o,data:u,$data:f,it:p}=l,{opts:n}=p;if(!f&&a.length===0)return;const _=a.length>=n.loopRequired;if(p.allErrors?v():S(),n.strictRequired){const z=l.parentSchema.properties,{definedProperties:M}=l.it;for(const C of a)if((z==null?void 0:z[C])===void 0&&!M.has(C)){const R=p.schemaEnv.baseId+p.errSchemaPath,D=`required property "${C}" is not defined at "${R}" (strictRequired)`;(0,Yw.checkStrictMode)(p,D,p.opts.strictRequired)}}function v(){if(_||f)l.block$data(wc.nil,T);else for(const z of a)(0,pc.checkReportMissingProp)(l,z)}function S(){const z=i.let("missing");if(_||f){const M=i.let("valid",!0);l.block$data(M,()=>I(z,M)),l.ok(M)}else i.if((0,pc.checkMissingProp)(l,a,z)),(0,pc.reportMissingProp)(l,z),i.else()}function T(){i.forOf("prop",o,z=>{l.setParams({missingProperty:z}),i.if((0,pc.noPropertyInData)(i,u,z,n.ownProperties),()=>l.error())})}function I(z,M){l.setParams({missingProperty:z}),i.forOf(z,o,()=>{i.assign(M,(0,pc.propertyInData)(i,u,z,n.ownProperties)),i.if((0,wc.not)(M),()=>{l.error(),i.break()})},wc.nil)}}};ld.default=ex;var cd={};Object.defineProperty(cd,"__esModule",{value:!0});const xc=Fi,tx={message({keyword:l,schemaCode:i}){const a=l==="maxItems"?"more":"fewer";return(0,xc.str)`must NOT have ${a} than ${i} items`},params:({schemaCode:l})=>(0,xc._)`{limit: ${l}}`},ix={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:tx,code(l){const{keyword:i,data:a,schemaCode:o}=l,u=i==="maxItems"?xc.operators.GT:xc.operators.LT;l.fail$data((0,xc._)`${a}.length ${u} ${o}`)}};cd.default=ix;var ud={},Mc={};Object.defineProperty(Mc,"__esModule",{value:!0});const Cy=oy;Cy.code='require("ajv/dist/runtime/equal").default';Mc.default=Cy;Object.defineProperty(ud,"__esModule",{value:!0});const kf=Ac,on=Fi,rx=Gi,nx=Mc,sx={message:({params:{i:l,j:i}})=>(0,on.str)`must NOT have duplicate items (items ## ${i} and ${l} are identical)`,params:({params:{i:l,j:i}})=>(0,on._)`{i: ${l}, j: ${i}}`},ax={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:sx,code(l){const{gen:i,data:a,$data:o,schema:u,parentSchema:f,schemaCode:p,it:n}=l;if(!o&&!u)return;const _=i.let("valid"),v=f.items?(0,kf.getSchemaTypes)(f.items):[];l.block$data(_,S,(0,on._)`${p} === false`),l.ok(_);function S(){const M=i.let("i",(0,on._)`${a}.length`),C=i.let("j");l.setParams({i:M,j:C}),i.assign(_,!0),i.if((0,on._)`${M} > 1`,()=>(T()?I:z)(M,C))}function T(){return v.length>0&&!v.some(M=>M==="object"||M==="array")}function I(M,C){const R=i.name("item"),D=(0,kf.checkDataTypes)(v,R,n.opts.strictNumbers,kf.DataType.Wrong),F=i.const("indices",(0,on._)`{}`);i.for((0,on._)`;${M}--;`,()=>{i.let(R,(0,on._)`${a}[${M}]`),i.if(D,(0,on._)`continue`),v.length>1&&i.if((0,on._)`typeof ${R} == "string"`,(0,on._)`${R} += "_"`),i.if((0,on._)`typeof ${F}[${R}] == "number"`,()=>{i.assign(C,(0,on._)`${F}[${R}]`),l.error(),i.assign(_,!1).break()}).code((0,on._)`${F}[${R}] = ${M}`)})}function z(M,C){const R=(0,rx.useFunc)(i,nx.default),D=i.name("outer");i.label(D).for((0,on._)`;${M}--;`,()=>i.for((0,on._)`${C} = ${M}; ${C}--;`,()=>i.if((0,on._)`${R}(${a}[${M}], ${a}[${C}])`,()=>{l.error(),i.assign(_,!1).break(D)})))}}};ud.default=ax;var hd={};Object.defineProperty(hd,"__esModule",{value:!0});const Rf=Fi,ox=Gi,lx=Mc,cx={message:"must be equal to constant",params:({schemaCode:l})=>(0,Rf._)`{allowedValue: ${l}}`},ux={keyword:"const",$data:!0,error:cx,code(l){const{gen:i,data:a,$data:o,schemaCode:u,schema:f}=l;o||f&&typeof f=="object"?l.fail$data((0,Rf._)`!${(0,ox.useFunc)(i,lx.default)}(${a}, ${u})`):l.fail((0,Rf._)`${f} !== ${a}`)}};hd.default=ux;var fd={};Object.defineProperty(fd,"__esModule",{value:!0});const gc=Fi,hx=Gi,fx=Mc,dx={message:"must be equal to one of the allowed values",params:({schemaCode:l})=>(0,gc._)`{allowedValues: ${l}}`},px={keyword:"enum",schemaType:"array",$data:!0,error:dx,code(l){const{gen:i,data:a,$data:o,schema:u,schemaCode:f,it:p}=l;if(!o&&u.length===0)throw new Error("enum must have non-empty array");const n=u.length>=p.opts.loopEnum;let _;const v=()=>_??(_=(0,hx.useFunc)(i,fx.default));let S;if(n||o)S=i.let("valid"),l.block$data(S,T);else{if(!Array.isArray(u))throw new Error("ajv implementation error");const z=i.const("vSchema",f);S=(0,gc.or)(...u.map((M,C)=>I(z,C)))}l.pass(S);function T(){i.assign(S,!1),i.forOf("v",f,z=>i.if((0,gc._)`${v()}(${a}, ${z})`,()=>i.assign(S,!0).break()))}function I(z,M){const C=u[M];return typeof C=="object"&&C!==null?(0,gc._)`${v()}(${a}, ${z}[${M}])`:(0,gc._)`${a} === ${C}`}}};fd.default=px;Object.defineProperty(td,"__esModule",{value:!0});const mx=id,gx=rd,_x=nd,yx=ad,vx=od,bx=ld,wx=cd,xx=ud,Sx=hd,Ex=fd,kx=[mx.default,gx.default,_x.default,yx.default,vx.default,bx.default,wx.default,xx.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Sx.default,Ex.default];td.default=kx;var dd={},nl={};Object.defineProperty(nl,"__esModule",{value:!0});nl.validateAdditionalItems=void 0;const Ha=Fi,Bf=Gi,Tx={message:({params:{len:l}})=>(0,Ha.str)`must NOT have more than ${l} items`,params:({params:{len:l}})=>(0,Ha._)`{limit: ${l}}`},Cx={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Tx,code(l){const{parentSchema:i,it:a}=l,{items:o}=i;if(!Array.isArray(o)){(0,Bf.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}Iy(l,o)}};function Iy(l,i){const{gen:a,schema:o,data:u,keyword:f,it:p}=l;p.items=!0;const n=a.const("len",(0,Ha._)`${u}.length`);if(o===!1)l.setParams({len:i.length}),l.pass((0,Ha._)`${n} <= ${i.length}`);else if(typeof o=="object"&&!(0,Bf.alwaysValidSchema)(p,o)){const v=a.var("valid",(0,Ha._)`${n} <= ${i.length}`);a.if((0,Ha.not)(v),()=>_(v)),l.ok(v)}function _(v){a.forRange("i",i.length,n,S=>{l.subschema({keyword:f,dataProp:S,dataPropType:Bf.Type.Num},v),p.allErrors||a.if((0,Ha.not)(v),()=>a.break())})}}nl.validateAdditionalItems=Iy;nl.default=Cx;var pd={},sl={};Object.defineProperty(sl,"__esModule",{value:!0});sl.validateTuple=void 0;const Jm=Fi,ju=Gi,Ix=Oi,Ax={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(l){const{schema:i,it:a}=l;if(Array.isArray(i))return Ay(l,"additionalItems",i);a.items=!0,!(0,ju.alwaysValidSchema)(a,i)&&l.ok((0,Ix.validateArray)(l))}};function Ay(l,i,a=l.schema){const{gen:o,parentSchema:u,data:f,keyword:p,it:n}=l;S(u),n.opts.unevaluated&&a.length&&n.items!==!0&&(n.items=ju.mergeEvaluated.items(o,a.length,n.items));const _=o.name("valid"),v=o.const("len",(0,Jm._)`${f}.length`);a.forEach((T,I)=>{(0,ju.alwaysValidSchema)(n,T)||(o.if((0,Jm._)`${v} > ${I}`,()=>l.subschema({keyword:p,schemaProp:I,dataProp:I},_)),l.ok(_))});function S(T){const{opts:I,errSchemaPath:z}=n,M=a.length,C=M===T.minItems&&(M===T.maxItems||T[i]===!1);if(I.strictTuples&&!C){const R=`"${p}" is ${M}-tuple, but minItems or maxItems/${i} are not specified or different at path "${z}"`;(0,ju.checkStrictMode)(n,R,I.strictTuples)}}}sl.validateTuple=Ay;sl.default=Ax;Object.defineProperty(pd,"__esModule",{value:!0});const Px=sl,zx={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:l=>(0,Px.validateTuple)(l,"items")};pd.default=zx;var md={};Object.defineProperty(md,"__esModule",{value:!0});const Ym=Fi,Mx=Gi,Dx=Oi,Lx=nl,Rx={message:({params:{len:l}})=>(0,Ym.str)`must NOT have more than ${l} items`,params:({params:{len:l}})=>(0,Ym._)`{limit: ${l}}`},Bx={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Rx,code(l){const{schema:i,parentSchema:a,it:o}=l,{prefixItems:u}=a;o.items=!0,!(0,Mx.alwaysValidSchema)(o,i)&&(u?(0,Lx.validateAdditionalItems)(l,u):l.ok((0,Dx.validateArray)(l)))}};md.default=Bx;var gd={};Object.defineProperty(gd,"__esModule",{value:!0});const ts=Fi,Du=Gi,Ox={message:({params:{min:l,max:i}})=>i===void 0?(0,ts.str)`must contain at least ${l} valid item(s)`:(0,ts.str)`must contain at least ${l} and no more than ${i} valid item(s)`,params:({params:{min:l,max:i}})=>i===void 0?(0,ts._)`{minContains: ${l}}`:(0,ts._)`{minContains: ${l}, maxContains: ${i}}`},Fx={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Ox,code(l){const{gen:i,schema:a,parentSchema:o,data:u,it:f}=l;let p,n;const{minContains:_,maxContains:v}=o;f.opts.next?(p=_===void 0?1:_,n=v):p=1;const S=i.const("len",(0,ts._)`${u}.length`);if(l.setParams({min:p,max:n}),n===void 0&&p===0){(0,Du.checkStrictMode)(f,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(n!==void 0&&p>n){(0,Du.checkStrictMode)(f,'"minContains" > "maxContains" is always invalid'),l.fail();return}if((0,Du.alwaysValidSchema)(f,a)){let C=(0,ts._)`${S} >= ${p}`;n!==void 0&&(C=(0,ts._)`${C} && ${S} <= ${n}`),l.pass(C);return}f.items=!0;const T=i.name("valid");n===void 0&&p===1?z(T,()=>i.if(T,()=>i.break())):p===0?(i.let(T,!0),n!==void 0&&i.if((0,ts._)`${u}.length > 0`,I)):(i.let(T,!1),I()),l.result(T,()=>l.reset());function I(){const C=i.name("_valid"),R=i.let("count",0);z(C,()=>i.if(C,()=>M(R)))}function z(C,R){i.forRange("i",0,S,D=>{l.subschema({keyword:"contains",dataProp:D,dataPropType:Du.Type.Num,compositeRule:!0},C),R()})}function M(C){i.code((0,ts._)`${C}++`),n===void 0?i.if((0,ts._)`${C} >= ${p}`,()=>i.assign(T,!0).break()):(i.if((0,ts._)`${C} > ${n}`,()=>i.assign(T,!1).break()),p===1?i.assign(T,!0):i.if((0,ts._)`${C} >= ${p}`,()=>i.assign(T,!0)))}}};gd.default=Fx;var Py={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.validateSchemaDeps=l.validatePropertyDeps=l.error=void 0;const i=Fi,a=Gi,o=Oi;l.error={message:({params:{property:_,depsCount:v,deps:S}})=>{const T=v===1?"property":"properties";return(0,i.str)`must have ${T} ${S} when property ${_} is present`},params:({params:{property:_,depsCount:v,deps:S,missingProperty:T}})=>(0,i._)`{property: ${_}, - missingProperty: ${T}, +`}];function Uu(l){let i=0;for(const a of l)i+=a in wf?wf[a]:wf.AVERAGE;return i}const wf={0:8.9,1:8.9,2:8.9,3:8.9,4:8.9,5:8.9,6:8.9,7:8.9,8:8.9,9:8.9,a:8.9,b:8.9,c:8,d:8.9,e:8.9,f:4.43,g:8.9,h:8.9,i:3.57,j:3.57,k:8,l:3.57,m:13.33,n:8.9,o:8.9,p:8.9,q:8.9,r:5.33,s:8,t:4.43,u:8.9,v:8,w:11.57,x:8,y:8,z:8,A:10.67,B:10.67,C:11.57,D:11.57,E:10.67,F:9.77,G:12.43,H:11.57,I:4.43,J:8,K:10.67,L:8.9,M:13.33,N:11.57,O:12.43,P:10.67,Q:12.43,R:11.57,S:10.67,T:9.77,U:11.57,V:10.67,W:15.1,X:10.67,Y:10.67,Z:9.77," ":4.43,"!":4.43,'"':5.67,"#":8.9,$:8.9,"%":14.23,"&":10.67,"'":3.07,"(":5.33,")":5.33,"*":6.23,"+":9.33,",":4.43,"-":5.33,".":4.43,"/":4.43,":":4.43,";":4.43,"<":9.33,"=":9.33,">":9.33,"?":8.9,"@":16.23,"[":4.43,"]":4.43,"^":7.5,_:8.9,"`":5.33,"{":5.33,"|":4.17,"}":5.33,"~":9.33,AVERAGE:8.472},nb={$id:"https://github.com/jtrim-ons/accessible-spreadsheet-creator",title:"Accessible Spreadsheet Creator",description:"A description of an accessible spreadsheet",type:"object",properties:{coverSheetTitle:{type:"string",title:"Cover sheet title",description:"The title displayed in cell A1 of the workbook.",minLength:1},coverSheetContents:{type:"array",title:"Cover sheet contents",description:"The lines below the cover sheet title. Each can be a subtitle starting with '## ', a link in Markdown style, or just text.",items:{type:"string"}},notes:{type:"array",title:"Notes",description:"The notes, each with a name that can be referred to in double square brackets and text.",items:{type:"object",title:"Note",properties:{name:{type:"string",title:"Note name",description:"A note name (e.g. note1) that can be referred to in a sheet using double square brackets (e.g. [[note1]])."},text:{type:"string",title:"Note text",description:"The text that will appear on the Notes page."}}}},sheets:{type:"array",title:"Sheets",description:"The data an metadata for the worksheets other than cover, contents and notes sheets.",items:{type:"object",title:"Sheet",properties:{sheetName:{type:"string",minLength:1,title:"Sheet name",description:"The name to appear in cell A1"},tableName:{type:"string",minLength:1,title:"Table name",description:"The name to give to the data table",pattern:"^[A-Za-z0-9_]*$"},sheetIntroText:{type:"array",title:"Sheet intro text",description:"Introductory text to appear below cell A2",items:{type:"string"}},columns:{type:"array",title:"Data columns",items:{type:"object",title:"Data column",description:"A column with its heading, number/text style and data.",properties:{style:{type:"string",title:"Number/text style",description:"'text'=text column; 'number_with_commas': integers with thousand separator; 'number_1dp': numbers to 1 decimal place"},heading:{type:"string",title:"Column heading",description:"Table column heading. May contain notes in double square brackets."},values:{type:"array",title:"Column values",description:"An array of text or numeric values",anyOf:[{items:{type:"number"}},{items:{type:"string"}}]}},required:["style","heading","values"]}}},required:["sheetName","tableName","columns"]}}},required:["coverSheetTitle","coverSheetContents","sheets"]};var zf={exports:{}},sy={},ys={},el={},Ic={},Ni={},Sc={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.regexpCode=l.getEsmExportName=l.getProperty=l.safeStringify=l.stringify=l.strConcat=l.addCodeArg=l.str=l._=l.nil=l._Code=l.Name=l.IDENTIFIER=l._CodeOrName=void 0;class i{}l._CodeOrName=i,l.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class a extends i{constructor(F){if(super(),!l.IDENTIFIER.test(F))throw new Error("CodeGen: name must be a valid identifier");this.str=F}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}l.Name=a;class o extends i{constructor(F){super(),this._items=typeof F=="string"?[F]:F}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const F=this._items[0];return F===""||F==='""'}get str(){var F;return(F=this._str)!==null&&F!==void 0?F:this._str=this._items.reduce((V,ee)=>`${V}${ee}`,"")}get names(){var F;return(F=this._names)!==null&&F!==void 0?F:this._names=this._items.reduce((V,ee)=>(ee instanceof a&&(V[ee.str]=(V[ee.str]||0)+1),V),{})}}l._Code=o,l.nil=new o("");function u(D,...F){const V=[D[0]];let ee=0;for(;ee{if(S.scopePath===void 0)throw new Error(`CodeGen: name "${S}" has no value`);return(0,i._)`${v}${S.scopePath}`})}scopeCode(v=this._values,E,S){return this._reduceValues(v,C=>{if(C.value===void 0)throw new Error(`CodeGen: name "${C}" has no value`);return C.value.code},E,S)}_reduceValues(v,E,S={},C){let z=i.nil;for(const P in v){const I=v[P];if(!I)continue;const L=S[P]=S[P]||new Map;I.forEach(D=>{if(L.has(D))return;L.set(D,o.Started);let F=E(D);if(F){const V=this.opts.es5?l.varKinds.var:l.varKinds.const;z=(0,i._)`${z}${V} ${D} = ${F};${this.opts._n}`}else if(F=C==null?void 0:C(D))z=(0,i._)`${z}${F}${this.opts._n}`;else throw new a(D);L.set(D,o.Completed)})}return z}}l.ValueScope=n})(Mf);(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.or=l.and=l.not=l.CodeGen=l.operators=l.varKinds=l.ValueScopeName=l.ValueScope=l.Scope=l.Name=l.regexpCode=l.stringify=l.getProperty=l.nil=l.strConcat=l.str=l._=void 0;const i=Sc,a=Mf;var o=Sc;Object.defineProperty(l,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(l,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(l,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(l,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(l,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(l,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(l,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(l,"Name",{enumerable:!0,get:function(){return o.Name}});var u=Mf;Object.defineProperty(l,"Scope",{enumerable:!0,get:function(){return u.Scope}}),Object.defineProperty(l,"ValueScope",{enumerable:!0,get:function(){return u.ValueScope}}),Object.defineProperty(l,"ValueScopeName",{enumerable:!0,get:function(){return u.ValueScopeName}}),Object.defineProperty(l,"varKinds",{enumerable:!0,get:function(){return u.varKinds}}),l.operators={GT:new i._Code(">"),GTE:new i._Code(">="),LT:new i._Code("<"),LTE:new i._Code("<="),EQ:new i._Code("==="),NEQ:new i._Code("!=="),NOT:new i._Code("!"),OR:new i._Code("||"),AND:new i._Code("&&"),ADD:new i._Code("+")};class f{optimizeNodes(){return this}optimizeNames(Y,ue){return this}}class p extends f{constructor(Y,ue,Qe){super(),this.varKind=Y,this.name=ue,this.rhs=Qe}render({es5:Y,_n:ue}){const Qe=Y?a.varKinds.var:this.varKind,wt=this.rhs===void 0?"":` = ${this.rhs}`;return`${Qe} ${this.name}${wt};`+ue}optimizeNames(Y,ue){if(Y[this.name.str])return this.rhs&&(this.rhs=q(this.rhs,Y,ue)),this}get names(){return this.rhs instanceof i._CodeOrName?this.rhs.names:{}}}class n extends f{constructor(Y,ue,Qe){super(),this.lhs=Y,this.rhs=ue,this.sideEffects=Qe}render({_n:Y}){return`${this.lhs} = ${this.rhs};`+Y}optimizeNames(Y,ue){if(!(this.lhs instanceof i.Name&&!Y[this.lhs.str]&&!this.sideEffects))return this.rhs=q(this.rhs,Y,ue),this}get names(){const Y=this.lhs instanceof i.Name?{}:{...this.lhs.names};return Ge(Y,this.rhs)}}class _ extends n{constructor(Y,ue,Qe,wt){super(Y,Qe,wt),this.op=ue}render({_n:Y}){return`${this.lhs} ${this.op}= ${this.rhs};`+Y}}class v extends f{constructor(Y){super(),this.label=Y,this.names={}}render({_n:Y}){return`${this.label}:`+Y}}class E extends f{constructor(Y){super(),this.label=Y,this.names={}}render({_n:Y}){return`break${this.label?` ${this.label}`:""};`+Y}}class S extends f{constructor(Y){super(),this.error=Y}render({_n:Y}){return`throw ${this.error};`+Y}get names(){return this.error.names}}class C extends f{constructor(Y){super(),this.code=Y}render({_n:Y}){return`${this.code};`+Y}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(Y,ue){return this.code=q(this.code,Y,ue),this}get names(){return this.code instanceof i._CodeOrName?this.code.names:{}}}class z extends f{constructor(Y=[]){super(),this.nodes=Y}render(Y){return this.nodes.reduce((ue,Qe)=>ue+Qe.render(Y),"")}optimizeNodes(){const{nodes:Y}=this;let ue=Y.length;for(;ue--;){const Qe=Y[ue].optimizeNodes();Array.isArray(Qe)?Y.splice(ue,1,...Qe):Qe?Y[ue]=Qe:Y.splice(ue,1)}return Y.length>0?this:void 0}optimizeNames(Y,ue){const{nodes:Qe}=this;let wt=Qe.length;for(;wt--;){const vt=Qe[wt];vt.optimizeNames(Y,ue)||(We(Y,vt.names),Qe.splice(wt,1))}return Qe.length>0?this:void 0}get names(){return this.nodes.reduce((Y,ue)=>ye(Y,ue.names),{})}}class P extends z{render(Y){return"{"+Y._n+super.render(Y)+"}"+Y._n}}class I extends z{}class L extends P{}L.kind="else";class D extends P{constructor(Y,ue){super(ue),this.condition=Y}render(Y){let ue=`if(${this.condition})`+super.render(Y);return this.else&&(ue+="else "+this.else.render(Y)),ue}optimizeNodes(){super.optimizeNodes();const Y=this.condition;if(Y===!0)return this.nodes;let ue=this.else;if(ue){const Qe=ue.optimizeNodes();ue=this.else=Array.isArray(Qe)?new L(Qe):Qe}if(ue)return Y===!1?ue instanceof D?ue:ue.nodes:this.nodes.length?this:new D(Tt(Y),ue instanceof D?[ue]:ue.nodes);if(!(Y===!1||!this.nodes.length))return this}optimizeNames(Y,ue){var Qe;if(this.else=(Qe=this.else)===null||Qe===void 0?void 0:Qe.optimizeNames(Y,ue),!!(super.optimizeNames(Y,ue)||this.else))return this.condition=q(this.condition,Y,ue),this}get names(){const Y=super.names;return Ge(Y,this.condition),this.else&&ye(Y,this.else.names),Y}}D.kind="if";class F extends P{}F.kind="for";class V extends F{constructor(Y){super(),this.iteration=Y}render(Y){return`for(${this.iteration})`+super.render(Y)}optimizeNames(Y,ue){if(super.optimizeNames(Y,ue))return this.iteration=q(this.iteration,Y,ue),this}get names(){return ye(super.names,this.iteration.names)}}class ee extends F{constructor(Y,ue,Qe,wt){super(),this.varKind=Y,this.name=ue,this.from=Qe,this.to=wt}render(Y){const ue=Y.es5?a.varKinds.var:this.varKind,{name:Qe,from:wt,to:vt}=this;return`for(${ue} ${Qe}=${wt}; ${Qe}<${vt}; ${Qe}++)`+super.render(Y)}get names(){const Y=Ge(super.names,this.from);return Ge(Y,this.to)}}class se extends F{constructor(Y,ue,Qe,wt){super(),this.loop=Y,this.varKind=ue,this.name=Qe,this.iterable=wt}render(Y){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(Y)}optimizeNames(Y,ue){if(super.optimizeNames(Y,ue))return this.iterable=q(this.iterable,Y,ue),this}get names(){return ye(super.names,this.iterable.names)}}class ne extends P{constructor(Y,ue,Qe){super(),this.name=Y,this.args=ue,this.async=Qe}render(Y){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(Y)}}ne.kind="func";class le extends z{render(Y){return"return "+super.render(Y)}}le.kind="return";class ge extends P{render(Y){let ue="try"+super.render(Y);return this.catch&&(ue+=this.catch.render(Y)),this.finally&&(ue+=this.finally.render(Y)),ue}optimizeNodes(){var Y,ue;return super.optimizeNodes(),(Y=this.catch)===null||Y===void 0||Y.optimizeNodes(),(ue=this.finally)===null||ue===void 0||ue.optimizeNodes(),this}optimizeNames(Y,ue){var Qe,wt;return super.optimizeNames(Y,ue),(Qe=this.catch)===null||Qe===void 0||Qe.optimizeNames(Y,ue),(wt=this.finally)===null||wt===void 0||wt.optimizeNames(Y,ue),this}get names(){const Y=super.names;return this.catch&&ye(Y,this.catch.names),this.finally&&ye(Y,this.finally.names),Y}}class ce extends P{constructor(Y){super(),this.error=Y}render(Y){return`catch(${this.error})`+super.render(Y)}}ce.kind="catch";class Me extends P{render(Y){return"finally"+super.render(Y)}}Me.kind="finally";class et{constructor(Y,ue={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...ue,_n:ue.lines?` +`:""},this._extScope=Y,this._scope=new a.Scope({parent:Y}),this._nodes=[new I]}toString(){return this._root.render(this.opts)}name(Y){return this._scope.name(Y)}scopeName(Y){return this._extScope.name(Y)}scopeValue(Y,ue){const Qe=this._extScope.value(Y,ue);return(this._values[Qe.prefix]||(this._values[Qe.prefix]=new Set)).add(Qe),Qe}getScopeValue(Y,ue){return this._extScope.getValue(Y,ue)}scopeRefs(Y){return this._extScope.scopeRefs(Y,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(Y,ue,Qe,wt){const vt=this._scope.toName(ue);return Qe!==void 0&&wt&&(this._constants[vt.str]=Qe),this._leafNode(new p(Y,vt,Qe)),vt}const(Y,ue,Qe){return this._def(a.varKinds.const,Y,ue,Qe)}let(Y,ue,Qe){return this._def(a.varKinds.let,Y,ue,Qe)}var(Y,ue,Qe){return this._def(a.varKinds.var,Y,ue,Qe)}assign(Y,ue,Qe){return this._leafNode(new n(Y,ue,Qe))}add(Y,ue){return this._leafNode(new _(Y,l.operators.ADD,ue))}code(Y){return typeof Y=="function"?Y():Y!==i.nil&&this._leafNode(new C(Y)),this}object(...Y){const ue=["{"];for(const[Qe,wt]of Y)ue.length>1&&ue.push(","),ue.push(Qe),(Qe!==wt||this.opts.es5)&&(ue.push(":"),(0,i.addCodeArg)(ue,wt));return ue.push("}"),new i._Code(ue)}if(Y,ue,Qe){if(this._blockNode(new D(Y)),ue&&Qe)this.code(ue).else().code(Qe).endIf();else if(ue)this.code(ue).endIf();else if(Qe)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(Y){return this._elseNode(new D(Y))}else(){return this._elseNode(new L)}endIf(){return this._endBlockNode(D,L)}_for(Y,ue){return this._blockNode(Y),ue&&this.code(ue).endFor(),this}for(Y,ue){return this._for(new V(Y),ue)}forRange(Y,ue,Qe,wt,vt=this.opts.es5?a.varKinds.var:a.varKinds.let){const It=this._scope.toName(Y);return this._for(new ee(vt,It,ue,Qe),()=>wt(It))}forOf(Y,ue,Qe,wt=a.varKinds.const){const vt=this._scope.toName(Y);if(this.opts.es5){const It=ue instanceof i.Name?ue:this.var("_arr",ue);return this.forRange("_i",0,(0,i._)`${It}.length`,Nt=>{this.var(vt,(0,i._)`${It}[${Nt}]`),Qe(vt)})}return this._for(new se("of",wt,vt,ue),()=>Qe(vt))}forIn(Y,ue,Qe,wt=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(Y,(0,i._)`Object.keys(${ue})`,Qe);const vt=this._scope.toName(Y);return this._for(new se("in",wt,vt,ue),()=>Qe(vt))}endFor(){return this._endBlockNode(F)}label(Y){return this._leafNode(new v(Y))}break(Y){return this._leafNode(new E(Y))}return(Y){const ue=new le;if(this._blockNode(ue),this.code(Y),ue.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(le)}try(Y,ue,Qe){if(!ue&&!Qe)throw new Error('CodeGen: "try" without "catch" and "finally"');const wt=new ge;if(this._blockNode(wt),this.code(Y),ue){const vt=this.name("e");this._currNode=wt.catch=new ce(vt),ue(vt)}return Qe&&(this._currNode=wt.finally=new Me,this.code(Qe)),this._endBlockNode(ce,Me)}throw(Y){return this._leafNode(new S(Y))}block(Y,ue){return this._blockStarts.push(this._nodes.length),Y&&this.code(Y).endBlock(ue),this}endBlock(Y){const ue=this._blockStarts.pop();if(ue===void 0)throw new Error("CodeGen: not in self-balancing block");const Qe=this._nodes.length-ue;if(Qe<0||Y!==void 0&&Qe!==Y)throw new Error(`CodeGen: wrong number of nodes: ${Qe} vs ${Y} expected`);return this._nodes.length=ue,this}func(Y,ue=i.nil,Qe,wt){return this._blockNode(new ne(Y,ue,Qe)),wt&&this.code(wt).endFunc(),this}endFunc(){return this._endBlockNode(ne)}optimize(Y=1){for(;Y-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(Y){return this._currNode.nodes.push(Y),this}_blockNode(Y){this._currNode.nodes.push(Y),this._nodes.push(Y)}_endBlockNode(Y,ue){const Qe=this._currNode;if(Qe instanceof Y||ue&&Qe instanceof ue)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${ue?`${Y.kind}/${ue.kind}`:Y.kind}"`)}_elseNode(Y){const ue=this._currNode;if(!(ue instanceof D))throw new Error('CodeGen: "else" without "if"');return this._currNode=ue.else=Y,this}get _root(){return this._nodes[0]}get _currNode(){const Y=this._nodes;return Y[Y.length-1]}set _currNode(Y){const ue=this._nodes;ue[ue.length-1]=Y}}l.CodeGen=et;function ye(De,Y){for(const ue in Y)De[ue]=(De[ue]||0)+(Y[ue]||0);return De}function Ge(De,Y){return Y instanceof i._CodeOrName?ye(De,Y.names):De}function q(De,Y,ue){if(De instanceof i.Name)return Qe(De);if(!wt(De))return De;return new i._Code(De._items.reduce((vt,It)=>(It instanceof i.Name&&(It=Qe(It)),It instanceof i._Code?vt.push(...It._items):vt.push(It),vt),[]));function Qe(vt){const It=ue[vt.str];return It===void 0||Y[vt.str]!==1?vt:(delete Y[vt.str],It)}function wt(vt){return vt instanceof i._Code&&vt._items.some(It=>It instanceof i.Name&&Y[It.str]===1&&ue[It.str]!==void 0)}}function We(De,Y){for(const ue in Y)De[ue]=(De[ue]||0)-(Y[ue]||0)}function Tt(De){return typeof De=="boolean"||typeof De=="number"||De===null?!De:(0,i._)`!${ve(De)}`}l.not=Tt;const it=ie(l.operators.AND);function Bt(...De){return De.reduce(it)}l.and=Bt;const Ne=ie(l.operators.OR);function Xe(...De){return De.reduce(Ne)}l.or=Xe;function ie(De){return(Y,ue)=>Y===i.nil?ue:ue===i.nil?Y:(0,i._)`${ve(Y)} ${De} ${ve(ue)}`}function ve(De){return De instanceof i.Name?De:(0,i._)`(${De})`}})(Ni);var Gi={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.checkStrictMode=l.getErrorPath=l.Type=l.useFunc=l.setEvaluated=l.evaluatedPropsToName=l.mergeEvaluated=l.eachItem=l.unescapeJsonPointer=l.escapeJsonPointer=l.escapeFragment=l.unescapeFragment=l.schemaRefOrVal=l.schemaHasRulesButRef=l.schemaHasRules=l.checkUnknownRules=l.alwaysValidSchema=l.toHash=void 0;const i=Ni,a=Sc;function o(ne){const le={};for(const ge of ne)le[ge]=!0;return le}l.toHash=o;function u(ne,le){return typeof le=="boolean"?le:Object.keys(le).length===0?!0:(f(ne,le),!p(le,ne.self.RULES.all))}l.alwaysValidSchema=u;function f(ne,le=ne.schema){const{opts:ge,self:ce}=ne;if(!ge.strictSchema||typeof le=="boolean")return;const Me=ce.RULES.keywords;for(const et in le)Me[et]||se(ne,`unknown keyword: "${et}"`)}l.checkUnknownRules=f;function p(ne,le){if(typeof ne=="boolean")return!ne;for(const ge in ne)if(le[ge])return!0;return!1}l.schemaHasRules=p;function n(ne,le){if(typeof ne=="boolean")return!ne;for(const ge in ne)if(ge!=="$ref"&&le.all[ge])return!0;return!1}l.schemaHasRulesButRef=n;function _({topSchemaRef:ne,schemaPath:le},ge,ce,Me){if(!Me){if(typeof ge=="number"||typeof ge=="boolean")return ge;if(typeof ge=="string")return(0,i._)`${ge}`}return(0,i._)`${ne}${le}${(0,i.getProperty)(ce)}`}l.schemaRefOrVal=_;function v(ne){return C(decodeURIComponent(ne))}l.unescapeFragment=v;function E(ne){return encodeURIComponent(S(ne))}l.escapeFragment=E;function S(ne){return typeof ne=="number"?`${ne}`:ne.replace(/~/g,"~0").replace(/\//g,"~1")}l.escapeJsonPointer=S;function C(ne){return ne.replace(/~1/g,"/").replace(/~0/g,"~")}l.unescapeJsonPointer=C;function z(ne,le){if(Array.isArray(ne))for(const ge of ne)le(ge);else le(ne)}l.eachItem=z;function P({mergeNames:ne,mergeToName:le,mergeValues:ge,resultToName:ce}){return(Me,et,ye,Ge)=>{const q=ye===void 0?et:ye instanceof i.Name?(et instanceof i.Name?ne(Me,et,ye):le(Me,et,ye),ye):et instanceof i.Name?(le(Me,ye,et),et):ge(et,ye);return Ge===i.Name&&!(q instanceof i.Name)?ce(Me,q):q}}l.mergeEvaluated={props:P({mergeNames:(ne,le,ge)=>ne.if((0,i._)`${ge} !== true && ${le} !== undefined`,()=>{ne.if((0,i._)`${le} === true`,()=>ne.assign(ge,!0),()=>ne.assign(ge,(0,i._)`${ge} || {}`).code((0,i._)`Object.assign(${ge}, ${le})`))}),mergeToName:(ne,le,ge)=>ne.if((0,i._)`${ge} !== true`,()=>{le===!0?ne.assign(ge,!0):(ne.assign(ge,(0,i._)`${ge} || {}`),L(ne,ge,le))}),mergeValues:(ne,le)=>ne===!0?!0:{...ne,...le},resultToName:I}),items:P({mergeNames:(ne,le,ge)=>ne.if((0,i._)`${ge} !== true && ${le} !== undefined`,()=>ne.assign(ge,(0,i._)`${le} === true ? true : ${ge} > ${le} ? ${ge} : ${le}`)),mergeToName:(ne,le,ge)=>ne.if((0,i._)`${ge} !== true`,()=>ne.assign(ge,le===!0?!0:(0,i._)`${ge} > ${le} ? ${ge} : ${le}`)),mergeValues:(ne,le)=>ne===!0?!0:Math.max(ne,le),resultToName:(ne,le)=>ne.var("items",le)})};function I(ne,le){if(le===!0)return ne.var("props",!0);const ge=ne.var("props",(0,i._)`{}`);return le!==void 0&&L(ne,ge,le),ge}l.evaluatedPropsToName=I;function L(ne,le,ge){Object.keys(ge).forEach(ce=>ne.assign((0,i._)`${le}${(0,i.getProperty)(ce)}`,!0))}l.setEvaluated=L;const D={};function F(ne,le){return ne.scopeValue("func",{ref:le,code:D[le.code]||(D[le.code]=new a._Code(le.code))})}l.useFunc=F;var V;(function(ne){ne[ne.Num=0]="Num",ne[ne.Str=1]="Str"})(V=l.Type||(l.Type={}));function ee(ne,le,ge){if(ne instanceof i.Name){const ce=le===V.Num;return ge?ce?(0,i._)`"[" + ${ne} + "]"`:(0,i._)`"['" + ${ne} + "']"`:ce?(0,i._)`"/" + ${ne}`:(0,i._)`"/" + ${ne}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return ge?(0,i.getProperty)(ne).toString():"/"+S(ne)}l.getErrorPath=ee;function se(ne,le,ge=ne.opts.strictSchema){if(ge){if(le=`strict mode: ${le}`,ge===!0)throw new Error(le);ne.self.logger.warn(le)}}l.checkStrictMode=se})(Gi);var Ds={};Object.defineProperty(Ds,"__esModule",{value:!0});const _n=Ni,sb={data:new _n.Name("data"),valCxt:new _n.Name("valCxt"),instancePath:new _n.Name("instancePath"),parentData:new _n.Name("parentData"),parentDataProperty:new _n.Name("parentDataProperty"),rootData:new _n.Name("rootData"),dynamicAnchors:new _n.Name("dynamicAnchors"),vErrors:new _n.Name("vErrors"),errors:new _n.Name("errors"),this:new _n.Name("this"),self:new _n.Name("self"),scope:new _n.Name("scope"),json:new _n.Name("json"),jsonPos:new _n.Name("jsonPos"),jsonLen:new _n.Name("jsonLen"),jsonPart:new _n.Name("jsonPart")};Ds.default=sb;(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.extendErrors=l.resetErrorsCount=l.reportExtraError=l.reportError=l.keyword$DataError=l.keywordError=void 0;const i=Ni,a=Gi,o=Ds;l.keywordError={message:({keyword:L})=>(0,i.str)`must pass "${L}" keyword validation`},l.keyword$DataError={message:({keyword:L,schemaType:D})=>D?(0,i.str)`"${L}" keyword must be ${D} ($data)`:(0,i.str)`"${L}" keyword is invalid ($data)`};function u(L,D=l.keywordError,F,V){const{it:ee}=L,{gen:se,compositeRule:ne,allErrors:le}=ee,ge=S(L,D,F);V??(ne||le)?_(se,ge):v(ee,(0,i._)`[${ge}]`)}l.reportError=u;function f(L,D=l.keywordError,F){const{it:V}=L,{gen:ee,compositeRule:se,allErrors:ne}=V,le=S(L,D,F);_(ee,le),se||ne||v(V,o.default.vErrors)}l.reportExtraError=f;function p(L,D){L.assign(o.default.errors,D),L.if((0,i._)`${o.default.vErrors} !== null`,()=>L.if(D,()=>L.assign((0,i._)`${o.default.vErrors}.length`,D),()=>L.assign(o.default.vErrors,null)))}l.resetErrorsCount=p;function n({gen:L,keyword:D,schemaValue:F,data:V,errsCount:ee,it:se}){if(ee===void 0)throw new Error("ajv implementation error");const ne=L.name("err");L.forRange("i",ee,o.default.errors,le=>{L.const(ne,(0,i._)`${o.default.vErrors}[${le}]`),L.if((0,i._)`${ne}.instancePath === undefined`,()=>L.assign((0,i._)`${ne}.instancePath`,(0,i.strConcat)(o.default.instancePath,se.errorPath))),L.assign((0,i._)`${ne}.schemaPath`,(0,i.str)`${se.errSchemaPath}/${D}`),se.opts.verbose&&(L.assign((0,i._)`${ne}.schema`,F),L.assign((0,i._)`${ne}.data`,V))})}l.extendErrors=n;function _(L,D){const F=L.const("err",D);L.if((0,i._)`${o.default.vErrors} === null`,()=>L.assign(o.default.vErrors,(0,i._)`[${F}]`),(0,i._)`${o.default.vErrors}.push(${F})`),L.code((0,i._)`${o.default.errors}++`)}function v(L,D){const{gen:F,validateName:V,schemaEnv:ee}=L;ee.$async?F.throw((0,i._)`new ${L.ValidationError}(${D})`):(F.assign((0,i._)`${V}.errors`,D),F.return(!1))}const E={keyword:new i.Name("keyword"),schemaPath:new i.Name("schemaPath"),params:new i.Name("params"),propertyName:new i.Name("propertyName"),message:new i.Name("message"),schema:new i.Name("schema"),parentSchema:new i.Name("parentSchema")};function S(L,D,F){const{createErrors:V}=L.it;return V===!1?(0,i._)`{}`:C(L,D,F)}function C(L,D,F={}){const{gen:V,it:ee}=L,se=[z(ee,F),P(L,F)];return I(L,D,se),V.object(...se)}function z({errorPath:L},{instancePath:D}){const F=D?(0,i.str)`${L}${(0,a.getErrorPath)(D,a.Type.Str)}`:L;return[o.default.instancePath,(0,i.strConcat)(o.default.instancePath,F)]}function P({keyword:L,it:{errSchemaPath:D}},{schemaPath:F,parentSchema:V}){let ee=V?D:(0,i.str)`${D}/${L}`;return F&&(ee=(0,i.str)`${ee}${(0,a.getErrorPath)(F,a.Type.Str)}`),[E.schemaPath,ee]}function I(L,{params:D,message:F},V){const{keyword:ee,data:se,schemaValue:ne,it:le}=L,{opts:ge,propertyName:ce,topSchemaRef:Me,schemaPath:et}=le;V.push([E.keyword,ee],[E.params,typeof D=="function"?D(L):D||(0,i._)`{}`]),ge.messages&&V.push([E.message,typeof F=="function"?F(L):F]),ge.verbose&&V.push([E.schema,ne],[E.parentSchema,(0,i._)`${Me}${et}`],[o.default.data,se]),ce&&V.push([E.propertyName,ce])}})(Ic);Object.defineProperty(el,"__esModule",{value:!0});el.boolOrEmptySchema=el.topBoolOrEmptySchema=void 0;const ab=Ic,ob=Ni,lb=Ds,cb={message:"boolean schema is false"};function ub(l){const{gen:i,schema:a,validateName:o}=l;a===!1?ay(l,!1):typeof a=="object"&&a.$async===!0?i.return(lb.default.data):(i.assign((0,ob._)`${o}.errors`,null),i.return(!0))}el.topBoolOrEmptySchema=ub;function hb(l,i){const{gen:a,schema:o}=l;o===!1?(a.var(i,!1),ay(l)):a.var(i,!0)}el.boolOrEmptySchema=hb;function ay(l,i){const{gen:a,data:o}=l,u={gen:a,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:l};(0,ab.reportError)(u,cb,void 0,i)}var Ac={},Ya={};Object.defineProperty(Ya,"__esModule",{value:!0});Ya.getRules=Ya.isJSONType=void 0;const fb=["string","number","integer","boolean","null","object","array"],db=new Set(fb);function pb(l){return typeof l=="string"&&db.has(l)}Ya.isJSONType=pb;function mb(){const l={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...l,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},l.number,l.string,l.array,l.object],post:{rules:[]},all:{},keywords:{}}}Ya.getRules=mb;var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.shouldUseRule=Zs.shouldUseGroup=Zs.schemaHasRulesForType=void 0;function gb({schema:l,self:i},a){const o=i.RULES.types[a];return o&&o!==!0&&oy(l,o)}Zs.schemaHasRulesForType=gb;function oy(l,i){return i.rules.some(a=>ly(l,a))}Zs.shouldUseGroup=oy;function ly(l,i){var a;return l[i.keyword]!==void 0||((a=i.definition.implements)===null||a===void 0?void 0:a.some(o=>l[o]!==void 0))}Zs.shouldUseRule=ly;(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.reportTypeError=l.checkDataTypes=l.checkDataType=l.coerceAndCheckDataType=l.getJSONTypes=l.getSchemaTypes=l.DataType=void 0;const i=Ya,a=Zs,o=Ic,u=Ni,f=Gi;var p;(function(V){V[V.Correct=0]="Correct",V[V.Wrong=1]="Wrong"})(p=l.DataType||(l.DataType={}));function n(V){const ee=_(V.type);if(ee.includes("null")){if(V.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!ee.length&&V.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');V.nullable===!0&&ee.push("null")}return ee}l.getSchemaTypes=n;function _(V){const ee=Array.isArray(V)?V:V?[V]:[];if(ee.every(i.isJSONType))return ee;throw new Error("type must be JSONType or JSONType[]: "+ee.join(","))}l.getJSONTypes=_;function v(V,ee){const{gen:se,data:ne,opts:le}=V,ge=S(ee,le.coerceTypes),ce=ee.length>0&&!(ge.length===0&&ee.length===1&&(0,a.schemaHasRulesForType)(V,ee[0]));if(ce){const Me=I(ee,ne,le.strictNumbers,p.Wrong);se.if(Me,()=>{ge.length?C(V,ee,ge):D(V)})}return ce}l.coerceAndCheckDataType=v;const E=new Set(["string","number","integer","boolean","null"]);function S(V,ee){return ee?V.filter(se=>E.has(se)||ee==="array"&&se==="array"):[]}function C(V,ee,se){const{gen:ne,data:le,opts:ge}=V,ce=ne.let("dataType",(0,u._)`typeof ${le}`),Me=ne.let("coerced",(0,u._)`undefined`);ge.coerceTypes==="array"&&ne.if((0,u._)`${ce} == 'object' && Array.isArray(${le}) && ${le}.length == 1`,()=>ne.assign(le,(0,u._)`${le}[0]`).assign(ce,(0,u._)`typeof ${le}`).if(I(ee,le,ge.strictNumbers),()=>ne.assign(Me,le))),ne.if((0,u._)`${Me} !== undefined`);for(const ye of se)(E.has(ye)||ye==="array"&&ge.coerceTypes==="array")&&et(ye);ne.else(),D(V),ne.endIf(),ne.if((0,u._)`${Me} !== undefined`,()=>{ne.assign(le,Me),z(V,Me)});function et(ye){switch(ye){case"string":ne.elseIf((0,u._)`${ce} == "number" || ${ce} == "boolean"`).assign(Me,(0,u._)`"" + ${le}`).elseIf((0,u._)`${le} === null`).assign(Me,(0,u._)`""`);return;case"number":ne.elseIf((0,u._)`${ce} == "boolean" || ${le} === null + || (${ce} == "string" && ${le} && ${le} == +${le})`).assign(Me,(0,u._)`+${le}`);return;case"integer":ne.elseIf((0,u._)`${ce} === "boolean" || ${le} === null + || (${ce} === "string" && ${le} && ${le} == +${le} && !(${le} % 1))`).assign(Me,(0,u._)`+${le}`);return;case"boolean":ne.elseIf((0,u._)`${le} === "false" || ${le} === 0 || ${le} === null`).assign(Me,!1).elseIf((0,u._)`${le} === "true" || ${le} === 1`).assign(Me,!0);return;case"null":ne.elseIf((0,u._)`${le} === "" || ${le} === 0 || ${le} === false`),ne.assign(Me,null);return;case"array":ne.elseIf((0,u._)`${ce} === "string" || ${ce} === "number" + || ${ce} === "boolean" || ${le} === null`).assign(Me,(0,u._)`[${le}]`)}}}function z({gen:V,parentData:ee,parentDataProperty:se},ne){V.if((0,u._)`${ee} !== undefined`,()=>V.assign((0,u._)`${ee}[${se}]`,ne))}function P(V,ee,se,ne=p.Correct){const le=ne===p.Correct?u.operators.EQ:u.operators.NEQ;let ge;switch(V){case"null":return(0,u._)`${ee} ${le} null`;case"array":ge=(0,u._)`Array.isArray(${ee})`;break;case"object":ge=(0,u._)`${ee} && typeof ${ee} == "object" && !Array.isArray(${ee})`;break;case"integer":ge=ce((0,u._)`!(${ee} % 1) && !isNaN(${ee})`);break;case"number":ge=ce();break;default:return(0,u._)`typeof ${ee} ${le} ${V}`}return ne===p.Correct?ge:(0,u.not)(ge);function ce(Me=u.nil){return(0,u.and)((0,u._)`typeof ${ee} == "number"`,Me,se?(0,u._)`isFinite(${ee})`:u.nil)}}l.checkDataType=P;function I(V,ee,se,ne){if(V.length===1)return P(V[0],ee,se,ne);let le;const ge=(0,f.toHash)(V);if(ge.array&&ge.object){const ce=(0,u._)`typeof ${ee} != "object"`;le=ge.null?ce:(0,u._)`!${ee} || ${ce}`,delete ge.null,delete ge.array,delete ge.object}else le=u.nil;ge.number&&delete ge.integer;for(const ce in ge)le=(0,u.and)(le,P(ce,ee,se,ne));return le}l.checkDataTypes=I;const L={message:({schema:V})=>`must be ${V}`,params:({schema:V,schemaValue:ee})=>typeof V=="string"?(0,u._)`{type: ${V}}`:(0,u._)`{type: ${ee}}`};function D(V){const ee=F(V);(0,o.reportError)(ee,L)}l.reportTypeError=D;function F(V){const{gen:ee,data:se,schema:ne}=V,le=(0,f.schemaRefOrVal)(V,ne,"type");return{gen:ee,keyword:"type",data:se,schema:ne.type,schemaCode:le,schemaValue:le,parentSchema:ne,params:{},it:V}}})(Ac);var sh={};Object.defineProperty(sh,"__esModule",{value:!0});sh.assignDefaults=void 0;const jo=Ni,_b=Gi;function yb(l,i){const{properties:a,items:o}=l.schema;if(i==="object"&&a)for(const u in a)$m(l,u,a[u].default);else i==="array"&&Array.isArray(o)&&o.forEach((u,f)=>$m(l,f,u.default))}sh.assignDefaults=yb;function $m(l,i,a){const{gen:o,compositeRule:u,data:f,opts:p}=l;if(a===void 0)return;const n=(0,jo._)`${f}${(0,jo.getProperty)(i)}`;if(u){(0,_b.checkStrictMode)(l,`default is ignored for: ${n}`);return}let _=(0,jo._)`${n} === undefined`;p.useDefaults==="empty"&&(_=(0,jo._)`${_} || ${n} === null || ${n} === ""`),o.if(_,(0,jo._)`${n} = ${(0,jo.stringify)(a)}`)}var zs={},Fi={};Object.defineProperty(Fi,"__esModule",{value:!0});Fi.validateUnion=Fi.validateArray=Fi.usePattern=Fi.callValidateCode=Fi.schemaProperties=Fi.allSchemaProperties=Fi.noPropertyInData=Fi.propertyInData=Fi.isOwnProperty=Fi.hasPropFunc=Fi.reportMissingProp=Fi.checkMissingProp=Fi.checkReportMissingProp=void 0;const ur=Ni,Zf=Gi,da=Ds,vb=Gi;function bb(l,i){const{gen:a,data:o,it:u}=l;a.if(Wf(a,o,i,u.opts.ownProperties),()=>{l.setParams({missingProperty:(0,ur._)`${i}`},!0),l.error()})}Fi.checkReportMissingProp=bb;function wb({gen:l,data:i,it:{opts:a}},o,u){return(0,ur.or)(...o.map(f=>(0,ur.and)(Wf(l,i,f,a.ownProperties),(0,ur._)`${u} = ${f}`)))}Fi.checkMissingProp=wb;function xb(l,i){l.setParams({missingProperty:i},!0),l.error()}Fi.reportMissingProp=xb;function cy(l){return l.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ur._)`Object.prototype.hasOwnProperty`})}Fi.hasPropFunc=cy;function Gf(l,i,a){return(0,ur._)`${cy(l)}.call(${i}, ${a})`}Fi.isOwnProperty=Gf;function Eb(l,i,a,o){const u=(0,ur._)`${i}${(0,ur.getProperty)(a)} !== undefined`;return o?(0,ur._)`${u} && ${Gf(l,i,a)}`:u}Fi.propertyInData=Eb;function Wf(l,i,a,o){const u=(0,ur._)`${i}${(0,ur.getProperty)(a)} === undefined`;return o?(0,ur.or)(u,(0,ur.not)(Gf(l,i,a))):u}Fi.noPropertyInData=Wf;function uy(l){return l?Object.keys(l).filter(i=>i!=="__proto__"):[]}Fi.allSchemaProperties=uy;function Sb(l,i){return uy(i).filter(a=>!(0,Zf.alwaysValidSchema)(l,i[a]))}Fi.schemaProperties=Sb;function kb({schemaCode:l,data:i,it:{gen:a,topSchemaRef:o,schemaPath:u,errorPath:f},it:p},n,_,v){const E=v?(0,ur._)`${l}, ${i}, ${o}${u}`:i,S=[[da.default.instancePath,(0,ur.strConcat)(da.default.instancePath,f)],[da.default.parentData,p.parentData],[da.default.parentDataProperty,p.parentDataProperty],[da.default.rootData,da.default.rootData]];p.opts.dynamicRef&&S.push([da.default.dynamicAnchors,da.default.dynamicAnchors]);const C=(0,ur._)`${E}, ${a.object(...S)}`;return _!==ur.nil?(0,ur._)`${n}.call(${_}, ${C})`:(0,ur._)`${n}(${C})`}Fi.callValidateCode=kb;const Tb=(0,ur._)`new RegExp`;function Cb({gen:l,it:{opts:i}},a){const o=i.unicodeRegExp?"u":"",{regExp:u}=i.code,f=u(a,o);return l.scopeValue("pattern",{key:f.toString(),ref:f,code:(0,ur._)`${u.code==="new RegExp"?Tb:(0,vb.useFunc)(l,u)}(${a}, ${o})`})}Fi.usePattern=Cb;function Ib(l){const{gen:i,data:a,keyword:o,it:u}=l,f=i.name("valid");if(u.allErrors){const n=i.let("valid",!0);return p(()=>i.assign(n,!1)),n}return i.var(f,!0),p(()=>i.break()),f;function p(n){const _=i.const("len",(0,ur._)`${a}.length`);i.forRange("i",0,_,v=>{l.subschema({keyword:o,dataProp:v,dataPropType:Zf.Type.Num},f),i.if((0,ur.not)(f),n)})}}Fi.validateArray=Ib;function Ab(l){const{gen:i,schema:a,keyword:o,it:u}=l;if(!Array.isArray(a))throw new Error("ajv implementation error");if(a.some(_=>(0,Zf.alwaysValidSchema)(u,_))&&!u.opts.unevaluated)return;const p=i.let("valid",!1),n=i.name("_valid");i.block(()=>a.forEach((_,v)=>{const E=l.subschema({keyword:o,schemaProp:v,compositeRule:!0},n);i.assign(p,(0,ur._)`${p} || ${n}`),l.mergeValidEvaluated(E,n)||i.if((0,ur.not)(p))})),l.result(p,()=>l.reset(),()=>l.error(!0))}Fi.validateUnion=Ab;Object.defineProperty(zs,"__esModule",{value:!0});zs.validateKeywordUsage=zs.validSchemaType=zs.funcKeywordCode=zs.macroKeywordCode=void 0;const Mn=Ni,Ga=Ds,Pb=Fi,zb=Ic;function Mb(l,i){const{gen:a,keyword:o,schema:u,parentSchema:f,it:p}=l,n=i.macro.call(p.self,u,f,p),_=hy(a,o,n);p.opts.validateSchema!==!1&&p.self.validateSchema(n,!0);const v=a.name("valid");l.subschema({schema:n,schemaPath:Mn.nil,errSchemaPath:`${p.errSchemaPath}/${o}`,topSchemaRef:_,compositeRule:!0},v),l.pass(v,()=>l.error(!0))}zs.macroKeywordCode=Mb;function Db(l,i){var a;const{gen:o,keyword:u,schema:f,parentSchema:p,$data:n,it:_}=l;Rb(_,i);const v=!n&&i.compile?i.compile.call(_.self,f,p,_):i.validate,E=hy(o,u,v),S=o.let("valid");l.block$data(S,C),l.ok((a=i.valid)!==null&&a!==void 0?a:S);function C(){if(i.errors===!1)I(),i.modifying&&jm(l),L(()=>l.error());else{const D=i.async?z():P();i.modifying&&jm(l),L(()=>Lb(l,D))}}function z(){const D=o.let("ruleErrs",null);return o.try(()=>I((0,Mn._)`await `),F=>o.assign(S,!1).if((0,Mn._)`${F} instanceof ${_.ValidationError}`,()=>o.assign(D,(0,Mn._)`${F}.errors`),()=>o.throw(F))),D}function P(){const D=(0,Mn._)`${E}.errors`;return o.assign(D,null),I(Mn.nil),D}function I(D=i.async?(0,Mn._)`await `:Mn.nil){const F=_.opts.passContext?Ga.default.this:Ga.default.self,V=!("compile"in i&&!n||i.schema===!1);o.assign(S,(0,Mn._)`${D}${(0,Pb.callValidateCode)(l,E,F,V)}`,i.modifying)}function L(D){var F;o.if((0,Mn.not)((F=i.valid)!==null&&F!==void 0?F:S),D)}}zs.funcKeywordCode=Db;function jm(l){const{gen:i,data:a,it:o}=l;i.if(o.parentData,()=>i.assign(a,(0,Mn._)`${o.parentData}[${o.parentDataProperty}]`))}function Lb(l,i){const{gen:a}=l;a.if((0,Mn._)`Array.isArray(${i})`,()=>{a.assign(Ga.default.vErrors,(0,Mn._)`${Ga.default.vErrors} === null ? ${i} : ${Ga.default.vErrors}.concat(${i})`).assign(Ga.default.errors,(0,Mn._)`${Ga.default.vErrors}.length`),(0,zb.extendErrors)(l)},()=>l.error())}function Rb({schemaEnv:l},i){if(i.async&&!l.$async)throw new Error("async keyword in sync schema")}function hy(l,i,a){if(a===void 0)throw new Error(`keyword "${i}" failed to compile`);return l.scopeValue("keyword",typeof a=="function"?{ref:a}:{ref:a,code:(0,Mn.stringify)(a)})}function Bb(l,i,a=!1){return!i.length||i.some(o=>o==="array"?Array.isArray(l):o==="object"?l&&typeof l=="object"&&!Array.isArray(l):typeof l==o||a&&typeof l>"u")}zs.validSchemaType=Bb;function Ob({schema:l,opts:i,self:a,errSchemaPath:o},u,f){if(Array.isArray(u.keyword)?!u.keyword.includes(f):u.keyword!==f)throw new Error("ajv implementation error");const p=u.dependencies;if(p!=null&&p.some(n=>!Object.prototype.hasOwnProperty.call(l,n)))throw new Error(`parent schema must have dependencies of ${f}: ${p.join(",")}`);if(u.validateSchema&&!u.validateSchema(l[f])){const _=`keyword "${f}" value is invalid at path "${o}": `+a.errorsText(u.validateSchema.errors);if(i.validateSchema==="log")a.logger.error(_);else throw new Error(_)}}zs.validateKeywordUsage=Ob;var _a={};Object.defineProperty(_a,"__esModule",{value:!0});_a.extendSubschemaMode=_a.extendSubschemaData=_a.getSubschema=void 0;const As=Ni,fy=Gi;function Fb(l,{keyword:i,schemaProp:a,schema:o,schemaPath:u,errSchemaPath:f,topSchemaRef:p}){if(i!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(i!==void 0){const n=l.schema[i];return a===void 0?{schema:n,schemaPath:(0,As._)`${l.schemaPath}${(0,As.getProperty)(i)}`,errSchemaPath:`${l.errSchemaPath}/${i}`}:{schema:n[a],schemaPath:(0,As._)`${l.schemaPath}${(0,As.getProperty)(i)}${(0,As.getProperty)(a)}`,errSchemaPath:`${l.errSchemaPath}/${i}/${(0,fy.escapeFragment)(a)}`}}if(o!==void 0){if(u===void 0||f===void 0||p===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:u,topSchemaRef:p,errSchemaPath:f}}throw new Error('either "keyword" or "schema" must be passed')}_a.getSubschema=Fb;function Nb(l,i,{dataProp:a,dataPropType:o,data:u,dataTypes:f,propertyName:p}){if(u!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:n}=i;if(a!==void 0){const{errorPath:v,dataPathArr:E,opts:S}=i,C=n.let("data",(0,As._)`${i.data}${(0,As.getProperty)(a)}`,!0);_(C),l.errorPath=(0,As.str)`${v}${(0,fy.getErrorPath)(a,o,S.jsPropertySyntax)}`,l.parentDataProperty=(0,As._)`${a}`,l.dataPathArr=[...E,l.parentDataProperty]}if(u!==void 0){const v=u instanceof As.Name?u:n.let("data",u,!0);_(v),p!==void 0&&(l.propertyName=p)}f&&(l.dataTypes=f);function _(v){l.data=v,l.dataLevel=i.dataLevel+1,l.dataTypes=[],i.definedProperties=new Set,l.parentData=i.data,l.dataNames=[...i.dataNames,v]}}_a.extendSubschemaData=Nb;function Ub(l,{jtdDiscriminator:i,jtdMetadata:a,compositeRule:o,createErrors:u,allErrors:f}){o!==void 0&&(l.compositeRule=o),u!==void 0&&(l.createErrors=u),f!==void 0&&(l.allErrors=f),l.jtdDiscriminator=i,l.jtdMetadata=a}_a.extendSubschemaMode=Ub;var ln={},dy=function l(i,a){if(i===a)return!0;if(i&&a&&typeof i=="object"&&typeof a=="object"){if(i.constructor!==a.constructor)return!1;var o,u,f;if(Array.isArray(i)){if(o=i.length,o!=a.length)return!1;for(u=o;u--!==0;)if(!l(i[u],a[u]))return!1;return!0}if(i.constructor===RegExp)return i.source===a.source&&i.flags===a.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===a.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===a.toString();if(f=Object.keys(i),o=f.length,o!==Object.keys(a).length)return!1;for(u=o;u--!==0;)if(!Object.prototype.hasOwnProperty.call(a,f[u]))return!1;for(u=o;u--!==0;){var p=f[u];if(!l(i[p],a[p]))return!1}return!0}return i!==i&&a!==a},py={exports:{}},ma=py.exports=function(l,i,a){typeof i=="function"&&(a=i,i={}),a=i.cb||a;var o=typeof a=="function"?a:a.pre||function(){},u=a.post||function(){};Vu(i,o,u,l,"",l)};ma.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ma.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ma.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ma.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Vu(l,i,a,o,u,f,p,n,_,v){if(o&&typeof o=="object"&&!Array.isArray(o)){i(o,u,f,p,n,_,v);for(var E in o){var S=o[E];if(Array.isArray(S)){if(E in ma.arrayKeywords)for(var C=0;Ci+=my(o)),i===1/0))return 1/0}return i}function gy(l,i="",a){a!==!1&&(i=Jo(i));const o=l.parse(i);return _y(l,o)}ln.getFullPath=gy;function _y(l,i){return l.serialize(i).split("#")[0]+"#"}ln._getFullPath=_y;const Kb=/#\/?$/;function Jo(l){return l?l.replace(Kb,""):""}ln.normalizeId=Jo;function Xb(l,i,a){return a=Jo(a),l.resolve(i,a)}ln.resolveUrl=Xb;const Jb=/^[a-z_][-a-z0-9._]*$/i;function Yb(l,i){if(typeof l=="boolean")return{};const{schemaId:a,uriResolver:o}=this.opts,u=Jo(l[a]||i),f={"":u},p=gy(o,u,!1),n={},_=new Set;return Zb(l,{allKeys:!0},(S,C,z,P)=>{if(P===void 0)return;const I=p+C;let L=f[P];typeof S[a]=="string"&&(L=D.call(this,S[a])),F.call(this,S.$anchor),F.call(this,S.$dynamicAnchor),f[C]=L;function D(V){const ee=this.opts.uriResolver.resolve;if(V=Jo(L?ee(L,V):V),_.has(V))throw E(V);_.add(V);let se=this.refs[V];return typeof se=="string"&&(se=this.refs[se]),typeof se=="object"?v(S,se.schema,V):V!==Jo(I)&&(V[0]==="#"?(v(S,n[V],V),n[V]=S):this.refs[V]=I),V}function F(V){if(typeof V=="string"){if(!Jb.test(V))throw new Error(`invalid anchor "${V}"`);D.call(this,`#${V}`)}}}),n;function v(S,C,z){if(C!==void 0&&!qb(S,C))throw E(z)}function E(S){return new Error(`reference "${S}" resolves to more than one schema`)}}ln.getSchemaRefs=Yb;Object.defineProperty(ys,"__esModule",{value:!0});ys.getData=ys.KeywordCxt=ys.validateFunctionCode=void 0;const yy=el,qm=Ac,Hf=Zs,Zu=Ac,Qb=sh,yc=zs,xf=_a,hi=Ni,Ci=Ds,ew=ln,Gs=Gi,dc=Ic;function tw(l){if(wy(l)&&(xy(l),by(l))){nw(l);return}vy(l,()=>(0,yy.topBoolOrEmptySchema)(l))}ys.validateFunctionCode=tw;function vy({gen:l,validateName:i,schema:a,schemaEnv:o,opts:u},f){u.code.es5?l.func(i,(0,hi._)`${Ci.default.data}, ${Ci.default.valCxt}`,o.$async,()=>{l.code((0,hi._)`"use strict"; ${Zm(a,u)}`),rw(l,u),l.code(f)}):l.func(i,(0,hi._)`${Ci.default.data}, ${iw(u)}`,o.$async,()=>l.code(Zm(a,u)).code(f))}function iw(l){return(0,hi._)`{${Ci.default.instancePath}="", ${Ci.default.parentData}, ${Ci.default.parentDataProperty}, ${Ci.default.rootData}=${Ci.default.data}${l.dynamicRef?(0,hi._)`, ${Ci.default.dynamicAnchors}={}`:hi.nil}}={}`}function rw(l,i){l.if(Ci.default.valCxt,()=>{l.var(Ci.default.instancePath,(0,hi._)`${Ci.default.valCxt}.${Ci.default.instancePath}`),l.var(Ci.default.parentData,(0,hi._)`${Ci.default.valCxt}.${Ci.default.parentData}`),l.var(Ci.default.parentDataProperty,(0,hi._)`${Ci.default.valCxt}.${Ci.default.parentDataProperty}`),l.var(Ci.default.rootData,(0,hi._)`${Ci.default.valCxt}.${Ci.default.rootData}`),i.dynamicRef&&l.var(Ci.default.dynamicAnchors,(0,hi._)`${Ci.default.valCxt}.${Ci.default.dynamicAnchors}`)},()=>{l.var(Ci.default.instancePath,(0,hi._)`""`),l.var(Ci.default.parentData,(0,hi._)`undefined`),l.var(Ci.default.parentDataProperty,(0,hi._)`undefined`),l.var(Ci.default.rootData,Ci.default.data),i.dynamicRef&&l.var(Ci.default.dynamicAnchors,(0,hi._)`{}`)})}function nw(l){const{schema:i,opts:a,gen:o}=l;vy(l,()=>{a.$comment&&i.$comment&&Sy(l),cw(l),o.let(Ci.default.vErrors,null),o.let(Ci.default.errors,0),a.unevaluated&&sw(l),Ey(l),fw(l)})}function sw(l){const{gen:i,validateName:a}=l;l.evaluated=i.const("evaluated",(0,hi._)`${a}.evaluated`),i.if((0,hi._)`${l.evaluated}.dynamicProps`,()=>i.assign((0,hi._)`${l.evaluated}.props`,(0,hi._)`undefined`)),i.if((0,hi._)`${l.evaluated}.dynamicItems`,()=>i.assign((0,hi._)`${l.evaluated}.items`,(0,hi._)`undefined`))}function Zm(l,i){const a=typeof l=="object"&&l[i.schemaId];return a&&(i.code.source||i.code.process)?(0,hi._)`/*# sourceURL=${a} */`:hi.nil}function aw(l,i){if(wy(l)&&(xy(l),by(l))){ow(l,i);return}(0,yy.boolOrEmptySchema)(l,i)}function by({schema:l,self:i}){if(typeof l=="boolean")return!l;for(const a in l)if(i.RULES.all[a])return!0;return!1}function wy(l){return typeof l.schema!="boolean"}function ow(l,i){const{schema:a,gen:o,opts:u}=l;u.$comment&&a.$comment&&Sy(l),uw(l),hw(l);const f=o.const("_errs",Ci.default.errors);Ey(l,f),o.var(i,(0,hi._)`${f} === ${Ci.default.errors}`)}function xy(l){(0,Gs.checkUnknownRules)(l),lw(l)}function Ey(l,i){if(l.opts.jtd)return Gm(l,[],!1,i);const a=(0,qm.getSchemaTypes)(l.schema),o=(0,qm.coerceAndCheckDataType)(l,a);Gm(l,a,!o,i)}function lw(l){const{schema:i,errSchemaPath:a,opts:o,self:u}=l;i.$ref&&o.ignoreKeywordsWithRef&&(0,Gs.schemaHasRulesButRef)(i,u.RULES)&&u.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}function cw(l){const{schema:i,opts:a}=l;i.default!==void 0&&a.useDefaults&&a.strictSchema&&(0,Gs.checkStrictMode)(l,"default is ignored in the schema root")}function uw(l){const i=l.schema[l.opts.schemaId];i&&(l.baseId=(0,ew.resolveUrl)(l.opts.uriResolver,l.baseId,i))}function hw(l){if(l.schema.$async&&!l.schemaEnv.$async)throw new Error("async schema in sync schema")}function Sy({gen:l,schemaEnv:i,schema:a,errSchemaPath:o,opts:u}){const f=a.$comment;if(u.$comment===!0)l.code((0,hi._)`${Ci.default.self}.logger.log(${f})`);else if(typeof u.$comment=="function"){const p=(0,hi.str)`${o}/$comment`,n=l.scopeValue("root",{ref:i.root});l.code((0,hi._)`${Ci.default.self}.opts.$comment(${f}, ${p}, ${n}.schema)`)}}function fw(l){const{gen:i,schemaEnv:a,validateName:o,ValidationError:u,opts:f}=l;a.$async?i.if((0,hi._)`${Ci.default.errors} === 0`,()=>i.return(Ci.default.data),()=>i.throw((0,hi._)`new ${u}(${Ci.default.vErrors})`)):(i.assign((0,hi._)`${o}.errors`,Ci.default.vErrors),f.unevaluated&&dw(l),i.return((0,hi._)`${Ci.default.errors} === 0`))}function dw({gen:l,evaluated:i,props:a,items:o}){a instanceof hi.Name&&l.assign((0,hi._)`${i}.props`,a),o instanceof hi.Name&&l.assign((0,hi._)`${i}.items`,o)}function Gm(l,i,a,o){const{gen:u,schema:f,data:p,allErrors:n,opts:_,self:v}=l,{RULES:E}=v;if(f.$ref&&(_.ignoreKeywordsWithRef||!(0,Gs.schemaHasRulesButRef)(f,E))){u.block(()=>Cy(l,"$ref",E.all.$ref.definition));return}_.jtd||pw(l,i),u.block(()=>{for(const C of E.rules)S(C);S(E.post)});function S(C){(0,Hf.shouldUseGroup)(f,C)&&(C.type?(u.if((0,Zu.checkDataType)(C.type,p,_.strictNumbers)),Wm(l,C),i.length===1&&i[0]===C.type&&a&&(u.else(),(0,Zu.reportTypeError)(l)),u.endIf()):Wm(l,C),n||u.if((0,hi._)`${Ci.default.errors} === ${o||0}`))}}function Wm(l,i){const{gen:a,schema:o,opts:{useDefaults:u}}=l;u&&(0,Qb.assignDefaults)(l,i.type),a.block(()=>{for(const f of i.rules)(0,Hf.shouldUseRule)(o,f)&&Cy(l,f.keyword,f.definition,i.type)})}function pw(l,i){l.schemaEnv.meta||!l.opts.strictTypes||(mw(l,i),l.opts.allowUnionTypes||gw(l,i),_w(l,l.dataTypes))}function mw(l,i){if(i.length){if(!l.dataTypes.length){l.dataTypes=i;return}i.forEach(a=>{ky(l.dataTypes,a)||Kf(l,`type "${a}" not allowed by context "${l.dataTypes.join(",")}"`)}),vw(l,i)}}function gw(l,i){i.length>1&&!(i.length===2&&i.includes("null"))&&Kf(l,"use allowUnionTypes to allow union type keyword")}function _w(l,i){const a=l.self.RULES.all;for(const o in a){const u=a[o];if(typeof u=="object"&&(0,Hf.shouldUseRule)(l.schema,u)){const{type:f}=u.definition;f.length&&!f.some(p=>yw(i,p))&&Kf(l,`missing type "${f.join(",")}" for keyword "${o}"`)}}}function yw(l,i){return l.includes(i)||i==="number"&&l.includes("integer")}function ky(l,i){return l.includes(i)||i==="integer"&&l.includes("number")}function vw(l,i){const a=[];for(const o of l.dataTypes)ky(i,o)?a.push(o):i.includes("integer")&&o==="number"&&a.push("integer");l.dataTypes=a}function Kf(l,i){const a=l.schemaEnv.baseId+l.errSchemaPath;i+=` at "${a}" (strictTypes)`,(0,Gs.checkStrictMode)(l,i,l.opts.strictTypes)}class Ty{constructor(i,a,o){if((0,yc.validateKeywordUsage)(i,a,o),this.gen=i.gen,this.allErrors=i.allErrors,this.keyword=o,this.data=i.data,this.schema=i.schema[o],this.$data=a.$data&&i.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Gs.schemaRefOrVal)(i,this.schema,o,this.$data),this.schemaType=a.schemaType,this.parentSchema=i.schema,this.params={},this.it=i,this.def=a,this.$data)this.schemaCode=i.gen.const("vSchema",Iy(this.$data,i));else if(this.schemaCode=this.schemaValue,!(0,yc.validSchemaType)(this.schema,a.schemaType,a.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(a.schemaType)}`);("code"in a?a.trackErrors:a.errors!==!1)&&(this.errsCount=i.gen.const("_errs",Ci.default.errors))}result(i,a,o){this.failResult((0,hi.not)(i),a,o)}failResult(i,a,o){this.gen.if(i),o?o():this.error(),a?(this.gen.else(),a(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(i,a){this.failResult((0,hi.not)(i),void 0,a)}fail(i){if(i===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(i),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(i){if(!this.$data)return this.fail(i);const{schemaCode:a}=this;this.fail((0,hi._)`${a} !== undefined && (${(0,hi.or)(this.invalid$data(),i)})`)}error(i,a,o){if(a){this.setParams(a),this._error(i,o),this.setParams({});return}this._error(i,o)}_error(i,a){(i?dc.reportExtraError:dc.reportError)(this,this.def.error,a)}$dataError(){(0,dc.reportError)(this,this.def.$dataError||dc.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,dc.resetErrorsCount)(this.gen,this.errsCount)}ok(i){this.allErrors||this.gen.if(i)}setParams(i,a){a?Object.assign(this.params,i):this.params=i}block$data(i,a,o=hi.nil){this.gen.block(()=>{this.check$data(i,o),a()})}check$data(i=hi.nil,a=hi.nil){if(!this.$data)return;const{gen:o,schemaCode:u,schemaType:f,def:p}=this;o.if((0,hi.or)((0,hi._)`${u} === undefined`,a)),i!==hi.nil&&o.assign(i,!0),(f.length||p.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),i!==hi.nil&&o.assign(i,!1)),o.else()}invalid$data(){const{gen:i,schemaCode:a,schemaType:o,def:u,it:f}=this;return(0,hi.or)(p(),n());function p(){if(o.length){if(!(a instanceof hi.Name))throw new Error("ajv implementation error");const _=Array.isArray(o)?o:[o];return(0,hi._)`${(0,Zu.checkDataTypes)(_,a,f.opts.strictNumbers,Zu.DataType.Wrong)}`}return hi.nil}function n(){if(u.validateSchema){const _=i.scopeValue("validate$data",{ref:u.validateSchema});return(0,hi._)`!${_}(${a})`}return hi.nil}}subschema(i,a){const o=(0,xf.getSubschema)(this.it,i);(0,xf.extendSubschemaData)(o,this.it,i),(0,xf.extendSubschemaMode)(o,i);const u={...this.it,...o,items:void 0,props:void 0};return aw(u,a),u}mergeEvaluated(i,a){const{it:o,gen:u}=this;o.opts.unevaluated&&(o.props!==!0&&i.props!==void 0&&(o.props=Gs.mergeEvaluated.props(u,i.props,o.props,a)),o.items!==!0&&i.items!==void 0&&(o.items=Gs.mergeEvaluated.items(u,i.items,o.items,a)))}mergeValidEvaluated(i,a){const{it:o,gen:u}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return u.if(a,()=>this.mergeEvaluated(i,hi.Name)),!0}}ys.KeywordCxt=Ty;function Cy(l,i,a,o){const u=new Ty(l,a,i);"code"in a?a.code(u,o):u.$data&&a.validate?(0,yc.funcKeywordCode)(u,a):"macro"in a?(0,yc.macroKeywordCode)(u,a):(a.compile||a.validate)&&(0,yc.funcKeywordCode)(u,a)}const bw=/^\/(?:[^~]|~0|~1)*$/,ww=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Iy(l,{dataLevel:i,dataNames:a,dataPathArr:o}){let u,f;if(l==="")return Ci.default.rootData;if(l[0]==="/"){if(!bw.test(l))throw new Error(`Invalid JSON-pointer: ${l}`);u=l,f=Ci.default.rootData}else{const v=ww.exec(l);if(!v)throw new Error(`Invalid JSON-pointer: ${l}`);const E=+v[1];if(u=v[2],u==="#"){if(E>=i)throw new Error(_("property/index",E));return o[i-E]}if(E>i)throw new Error(_("data",E));if(f=a[i-E],!u)return f}let p=f;const n=u.split("/");for(const v of n)v&&(f=(0,hi._)`${f}${(0,hi.getProperty)((0,Gs.unescapeJsonPointer)(v))}`,p=(0,hi._)`${p} && ${f}`);return p;function _(v,E){return`Cannot access ${v} ${E} levels up, current level is ${i}`}}ys.getData=Iy;var Pc={};Object.defineProperty(Pc,"__esModule",{value:!0});class xw extends Error{constructor(i){super("validation failed"),this.errors=i,this.ajv=this.validation=!0}}Pc.default=xw;var zc={};Object.defineProperty(zc,"__esModule",{value:!0});const Ef=ln;class Ew extends Error{constructor(i,a,o,u){super(u||`can't resolve reference ${o} from id ${a}`),this.missingRef=(0,Ef.resolveUrl)(i,a,o),this.missingSchema=(0,Ef.normalizeId)((0,Ef.getFullPath)(i,this.missingRef))}}zc.default=Ew;var Nn={};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.resolveSchema=Nn.getCompilingSchema=Nn.resolveRef=Nn.compileSchema=Nn.SchemaEnv=void 0;const ps=Ni,Sw=Pc,Za=Ds,_s=ln,Hm=Gi,kw=ys;class ah{constructor(i){var a;this.refs={},this.dynamicAnchors={};let o;typeof i.schema=="object"&&(o=i.schema),this.schema=i.schema,this.schemaId=i.schemaId,this.root=i.root||this,this.baseId=(a=i.baseId)!==null&&a!==void 0?a:(0,_s.normalizeId)(o==null?void 0:o[i.schemaId||"$id"]),this.schemaPath=i.schemaPath,this.localRefs=i.localRefs,this.meta=i.meta,this.$async=o==null?void 0:o.$async,this.refs={}}}Nn.SchemaEnv=ah;function Xf(l){const i=Ay.call(this,l);if(i)return i;const a=(0,_s.getFullPath)(this.opts.uriResolver,l.root.baseId),{es5:o,lines:u}=this.opts.code,{ownProperties:f}=this.opts,p=new ps.CodeGen(this.scope,{es5:o,lines:u,ownProperties:f});let n;l.$async&&(n=p.scopeValue("Error",{ref:Sw.default,code:(0,ps._)`require("ajv/dist/runtime/validation_error").default`}));const _=p.scopeName("validate");l.validateName=_;const v={gen:p,allErrors:this.opts.allErrors,data:Za.default.data,parentData:Za.default.parentData,parentDataProperty:Za.default.parentDataProperty,dataNames:[Za.default.data],dataPathArr:[ps.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:p.scopeValue("schema",this.opts.code.source===!0?{ref:l.schema,code:(0,ps.stringify)(l.schema)}:{ref:l.schema}),validateName:_,ValidationError:n,schema:l.schema,schemaEnv:l,rootId:a,baseId:l.baseId||a,schemaPath:ps.nil,errSchemaPath:l.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ps._)`""`,opts:this.opts,self:this};let E;try{this._compilations.add(l),(0,kw.validateFunctionCode)(v),p.optimize(this.opts.code.optimize);const S=p.toString();E=`${p.scopeRefs(Za.default.scope)}return ${S}`,this.opts.code.process&&(E=this.opts.code.process(E,l));const z=new Function(`${Za.default.self}`,`${Za.default.scope}`,E)(this,this.scope.get());if(this.scope.value(_,{ref:z}),z.errors=null,z.schema=l.schema,z.schemaEnv=l,l.$async&&(z.$async=!0),this.opts.code.source===!0&&(z.source={validateName:_,validateCode:S,scopeValues:p._values}),this.opts.unevaluated){const{props:P,items:I}=v;z.evaluated={props:P instanceof ps.Name?void 0:P,items:I instanceof ps.Name?void 0:I,dynamicProps:P instanceof ps.Name,dynamicItems:I instanceof ps.Name},z.source&&(z.source.evaluated=(0,ps.stringify)(z.evaluated))}return l.validate=z,l}catch(S){throw delete l.validate,delete l.validateName,E&&this.logger.error("Error compiling schema, function code:",E),S}finally{this._compilations.delete(l)}}Nn.compileSchema=Xf;function Tw(l,i,a){var o;a=(0,_s.resolveUrl)(this.opts.uriResolver,i,a);const u=l.refs[a];if(u)return u;let f=Aw.call(this,l,a);if(f===void 0){const p=(o=l.localRefs)===null||o===void 0?void 0:o[a],{schemaId:n}=this.opts;p&&(f=new ah({schema:p,schemaId:n,root:l,baseId:i}))}if(f!==void 0)return l.refs[a]=Cw.call(this,f)}Nn.resolveRef=Tw;function Cw(l){return(0,_s.inlineRef)(l.schema,this.opts.inlineRefs)?l.schema:l.validate?l:Xf.call(this,l)}function Ay(l){for(const i of this._compilations)if(Iw(i,l))return i}Nn.getCompilingSchema=Ay;function Iw(l,i){return l.schema===i.schema&&l.root===i.root&&l.baseId===i.baseId}function Aw(l,i){let a;for(;typeof(a=this.refs[i])=="string";)i=a;return a||this.schemas[i]||oh.call(this,l,i)}function oh(l,i){const a=this.opts.uriResolver.parse(i),o=(0,_s._getFullPath)(this.opts.uriResolver,a);let u=(0,_s.getFullPath)(this.opts.uriResolver,l.baseId,void 0);if(Object.keys(l.schema).length>0&&o===u)return Sf.call(this,a,l);const f=(0,_s.normalizeId)(o),p=this.refs[f]||this.schemas[f];if(typeof p=="string"){const n=oh.call(this,l,p);return typeof(n==null?void 0:n.schema)!="object"?void 0:Sf.call(this,a,n)}if(typeof(p==null?void 0:p.schema)=="object"){if(p.validate||Xf.call(this,p),f===(0,_s.normalizeId)(i)){const{schema:n}=p,{schemaId:_}=this.opts,v=n[_];return v&&(u=(0,_s.resolveUrl)(this.opts.uriResolver,u,v)),new ah({schema:n,schemaId:_,root:l,baseId:u})}return Sf.call(this,a,p)}}Nn.resolveSchema=oh;const Pw=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Sf(l,{baseId:i,schema:a,root:o}){var u;if(((u=l.fragment)===null||u===void 0?void 0:u[0])!=="/")return;for(const n of l.fragment.slice(1).split("/")){if(typeof a=="boolean")return;const _=a[(0,Hm.unescapeFragment)(n)];if(_===void 0)return;a=_;const v=typeof a=="object"&&a[this.opts.schemaId];!Pw.has(n)&&v&&(i=(0,_s.resolveUrl)(this.opts.uriResolver,i,v))}let f;if(typeof a!="boolean"&&a.$ref&&!(0,Hm.schemaHasRulesButRef)(a,this.RULES)){const n=(0,_s.resolveUrl)(this.opts.uriResolver,i,a.$ref);f=oh.call(this,o,n)}const{schemaId:p}=this.opts;if(f=f||new ah({schema:a,schemaId:p,root:o,baseId:i}),f.schema!==f.root.schema)return f}const zw="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Mw="Meta-schema for $data reference (JSON AnySchema extension proposal)",Dw="object",Lw=["$data"],Rw={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Bw=!1,Ow={$id:zw,description:Mw,type:Dw,required:Lw,properties:Rw,additionalProperties:Bw};var Jf={},Lf={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(l,i){(function(a,o){o(i)})(Ho,function(a){function o(){for(var H=arguments.length,J=Array(H),ae=0;ae1){J[0]=J[0].slice(0,-1);for(var ke=J.length-1,Ue=1;Ue= 0x80 (not a basic code point)","invalid-input":"Invalid input"},et=I-L,ye=Math.floor,Ge=String.fromCharCode;function q(H){throw new RangeError(Me[H])}function We(H,J){for(var ae=[],ke=H.length;ke--;)ae[ke]=J(H[ke]);return ae}function Tt(H,J){var ae=H.split("@"),ke="";ae.length>1&&(ke=ae[0]+"@",H=ae[1]),H=H.replace(ce,".");var Ue=H.split("."),bt=We(Ue,J).join(".");return ke+bt}function it(H){for(var J=[],ae=0,ke=H.length;ae=55296&&Ue<=56319&&ae>1,J+=ye(J/ae);J>et*D>>1;Ue+=I)J=ye(J/et);return ye(Ue+(et+1)*J/(J+F))},ve=function(J){var ae=[],ke=J.length,Ue=0,bt=se,mt=ee,Ct=J.lastIndexOf(ne);Ct<0&&(Ct=0);for(var Zt=0;Zt=128&&q("not-basic"),ae.push(J.charCodeAt(Zt));for(var di=Ct>0?Ct+1:0;di=ke&&q("invalid-input");var ai=Ne(J.charCodeAt(di++));(ai>=I||ai>ye((P-Ue)/ni))&&q("overflow"),Ue+=ai*ni;var gi=li<=mt?L:li>=mt+D?D:li-mt;if(aiye(P/Pi)&&q("overflow"),ni*=Pi}var Si=ae.length+1;mt=ie(Ue-Yt,Si,Yt==0),ye(Ue/Si)>P-bt&&q("overflow"),bt+=ye(Ue/Si),Ue%=Si,ae.splice(Ue++,0,bt)}return String.fromCodePoint.apply(String,ae)},De=function(J){var ae=[];J=it(J);var ke=J.length,Ue=se,bt=0,mt=ee,Ct=!0,Zt=!1,di=void 0;try{for(var Yt=J[Symbol.iterator](),ni;!(Ct=(ni=Yt.next()).done);Ct=!0){var li=ni.value;li<128&&ae.push(Ge(li))}}catch(Yr){Zt=!0,di=Yr}finally{try{!Ct&&Yt.return&&Yt.return()}finally{if(Zt)throw di}}var ai=ae.length,gi=ai;for(ai&&ae.push(ne);gi=Ue&&nsye((P-bt)/Ai)&&q("overflow"),bt+=(Pi-Ue)*Ai,Ue=Pi;var Jr=!0,un=!1,lr=void 0;try{for(var Dr=J[Symbol.iterator](),to;!(Jr=(to=Dr.next()).done);Jr=!0){var kr=to.value;if(krP&&q("overflow"),kr==Ue){for(var Lr=bt,ss=I;;ss+=I){var vn=ss<=mt?L:ss>=mt+D?D:ss-mt;if(Lr>6|192).toString(16).toUpperCase()+"%"+(J&63|128).toString(16).toUpperCase():ae="%"+(J>>12|224).toString(16).toUpperCase()+"%"+(J>>6&63|128).toString(16).toUpperCase()+"%"+(J&63|128).toString(16).toUpperCase(),ae}function It(H){for(var J="",ae=0,ke=H.length;ae=194&&Ue<224){if(ke-ae>=6){var bt=parseInt(H.substr(ae+4,2),16);J+=String.fromCharCode((Ue&31)<<6|bt&63)}else J+=H.substr(ae,6);ae+=6}else if(Ue>=224){if(ke-ae>=9){var mt=parseInt(H.substr(ae+4,2),16),Ct=parseInt(H.substr(ae+7,2),16);J+=String.fromCharCode((Ue&15)<<12|(mt&63)<<6|Ct&63)}else J+=H.substr(ae,9);ae+=9}else J+=H.substr(ae,3),ae+=3}return J}function Nt(H,J){function ae(ke){var Ue=It(ke);return Ue.match(J.UNRESERVED)?Ue:ke}return H.scheme&&(H.scheme=String(H.scheme).replace(J.PCT_ENCODED,ae).toLowerCase().replace(J.NOT_SCHEME,"")),H.userinfo!==void 0&&(H.userinfo=String(H.userinfo).replace(J.PCT_ENCODED,ae).replace(J.NOT_USERINFO,vt).replace(J.PCT_ENCODED,p)),H.host!==void 0&&(H.host=String(H.host).replace(J.PCT_ENCODED,ae).toLowerCase().replace(J.NOT_HOST,vt).replace(J.PCT_ENCODED,p)),H.path!==void 0&&(H.path=String(H.path).replace(J.PCT_ENCODED,ae).replace(H.scheme?J.NOT_PATH:J.NOT_PATH_NOSCHEME,vt).replace(J.PCT_ENCODED,p)),H.query!==void 0&&(H.query=String(H.query).replace(J.PCT_ENCODED,ae).replace(J.NOT_QUERY,vt).replace(J.PCT_ENCODED,p)),H.fragment!==void 0&&(H.fragment=String(H.fragment).replace(J.PCT_ENCODED,ae).replace(J.NOT_FRAGMENT,vt).replace(J.PCT_ENCODED,p)),H}function fi(H){return H.replace(/^0*(.*)/,"$1")||"0"}function gt(H,J){var ae=H.match(J.IPV4ADDRESS)||[],ke=C(ae,2),Ue=ke[1];return Ue?Ue.split(".").map(fi).join("."):H}function _i(H,J){var ae=H.match(J.IPV6ADDRESS)||[],ke=C(ae,3),Ue=ke[1],bt=ke[2];if(Ue){for(var mt=Ue.toLowerCase().split("::").reverse(),Ct=C(mt,2),Zt=Ct[0],di=Ct[1],Yt=di?di.split(":").map(fi):[],ni=Zt.split(":").map(fi),li=J.IPV4ADDRESS.test(ni[ni.length-1]),ai=li?7:8,gi=ni.length-ai,Pi=Array(ai),Si=0;Si1){var rs=Pi.slice(0,yn.index),ns=Pi.slice(yn.index+yn.length);mr=rs.join(":")+"::"+ns.join(":")}else mr=Pi.join(":");return bt&&(mr+="%"+bt),mr}else return H}var Z=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,lt="".match(/(){0}/)[1]===void 0;function nt(H){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ae={},ke=J.iri!==!1?S:E;J.reference==="suffix"&&(H=(J.scheme?J.scheme+":":"")+"//"+H);var Ue=H.match(Z);if(Ue){lt?(ae.scheme=Ue[1],ae.userinfo=Ue[3],ae.host=Ue[4],ae.port=parseInt(Ue[5],10),ae.path=Ue[6]||"",ae.query=Ue[7],ae.fragment=Ue[8],isNaN(ae.port)&&(ae.port=Ue[5])):(ae.scheme=Ue[1]||void 0,ae.userinfo=H.indexOf("@")!==-1?Ue[3]:void 0,ae.host=H.indexOf("//")!==-1?Ue[4]:void 0,ae.port=parseInt(Ue[5],10),ae.path=Ue[6]||"",ae.query=H.indexOf("?")!==-1?Ue[7]:void 0,ae.fragment=H.indexOf("#")!==-1?Ue[8]:void 0,isNaN(ae.port)&&(ae.port=H.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?Ue[4]:void 0)),ae.host&&(ae.host=_i(gt(ae.host,ke),ke)),ae.scheme===void 0&&ae.userinfo===void 0&&ae.host===void 0&&ae.port===void 0&&!ae.path&&ae.query===void 0?ae.reference="same-document":ae.scheme===void 0?ae.reference="relative":ae.fragment===void 0?ae.reference="absolute":ae.reference="uri",J.reference&&J.reference!=="suffix"&&J.reference!==ae.reference&&(ae.error=ae.error||"URI is not a "+J.reference+" reference.");var bt=wt[(J.scheme||ae.scheme||"").toLowerCase()];if(!J.unicodeSupport&&(!bt||!bt.unicodeSupport)){if(ae.host&&(J.domainHost||bt&&bt.domainHost))try{ae.host=Qe.toASCII(ae.host.replace(ke.PCT_ENCODED,It).toLowerCase())}catch(mt){ae.error=ae.error||"Host's domain name can not be converted to ASCII via punycode: "+mt}Nt(ae,E)}else Nt(ae,ke);bt&&bt.parse&&bt.parse(ae,J)}else ae.error=ae.error||"URI can not be parsed.";return ae}function Ee(H,J){var ae=J.iri!==!1?S:E,ke=[];return H.userinfo!==void 0&&(ke.push(H.userinfo),ke.push("@")),H.host!==void 0&&ke.push(_i(gt(String(H.host),ae),ae).replace(ae.IPV6ADDRESS,function(Ue,bt,mt){return"["+bt+(mt?"%25"+mt:"")+"]"})),(typeof H.port=="number"||typeof H.port=="string")&&(ke.push(":"),ke.push(String(H.port))),ke.length?ke.join(""):void 0}var _e=/^\.\.?\//,Ze=/^\/\.(\/|$)/,pt=/^\/\.\.(\/|$)/,Ae=/^\/?(?:.|\n)*?(?=\/|$)/;function Ye(H){for(var J=[];H.length;)if(H.match(_e))H=H.replace(_e,"");else if(H.match(Ze))H=H.replace(Ze,"/");else if(H.match(pt))H=H.replace(pt,"/"),J.pop();else if(H==="."||H==="..")H="";else{var ae=H.match(Ae);if(ae){var ke=ae[0];H=H.slice(ke.length),J.push(ke)}else throw new Error("Unexpected dot segment condition")}return J.join("")}function xt(H){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ae=J.iri?S:E,ke=[],Ue=wt[(J.scheme||H.scheme||"").toLowerCase()];if(Ue&&Ue.serialize&&Ue.serialize(H,J),H.host&&!ae.IPV6ADDRESS.test(H.host)){if(J.domainHost||Ue&&Ue.domainHost)try{H.host=J.iri?Qe.toUnicode(H.host):Qe.toASCII(H.host.replace(ae.PCT_ENCODED,It).toLowerCase())}catch(Ct){H.error=H.error||"Host's domain name can not be converted to "+(J.iri?"Unicode":"ASCII")+" via punycode: "+Ct}}Nt(H,ae),J.reference!=="suffix"&&H.scheme&&(ke.push(H.scheme),ke.push(":"));var bt=Ee(H,J);if(bt!==void 0&&(J.reference!=="suffix"&&ke.push("//"),ke.push(bt),H.path&&H.path.charAt(0)!=="/"&&ke.push("/")),H.path!==void 0){var mt=H.path;!J.absolutePath&&(!Ue||!Ue.absolutePath)&&(mt=Ye(mt)),bt===void 0&&(mt=mt.replace(/^\/\//,"/%2F")),ke.push(mt)}return H.query!==void 0&&(ke.push("?"),ke.push(H.query)),H.fragment!==void 0&&(ke.push("#"),ke.push(H.fragment)),ke.join("")}function kt(H,J){var ae=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ke=arguments[3],Ue={};return ke||(H=nt(xt(H,ae),ae),J=nt(xt(J,ae),ae)),ae=ae||{},!ae.tolerant&&J.scheme?(Ue.scheme=J.scheme,Ue.userinfo=J.userinfo,Ue.host=J.host,Ue.port=J.port,Ue.path=Ye(J.path||""),Ue.query=J.query):(J.userinfo!==void 0||J.host!==void 0||J.port!==void 0?(Ue.userinfo=J.userinfo,Ue.host=J.host,Ue.port=J.port,Ue.path=Ye(J.path||""),Ue.query=J.query):(J.path?(J.path.charAt(0)==="/"?Ue.path=Ye(J.path):((H.userinfo!==void 0||H.host!==void 0||H.port!==void 0)&&!H.path?Ue.path="/"+J.path:H.path?Ue.path=H.path.slice(0,H.path.lastIndexOf("/")+1)+J.path:Ue.path=J.path,Ue.path=Ye(Ue.path)),Ue.query=J.query):(Ue.path=H.path,J.query!==void 0?Ue.query=J.query:Ue.query=H.query),Ue.userinfo=H.userinfo,Ue.host=H.host,Ue.port=H.port),Ue.scheme=H.scheme),Ue.fragment=J.fragment,Ue}function ct(H,J,ae){var ke=_({scheme:"null"},ae);return xt(kt(nt(H,ke),nt(J,ke),ke,!0),ke)}function Xt(H,J){return typeof H=="string"?H=xt(nt(H,J),J):f(H)==="object"&&(H=nt(xt(H,J),J)),H}function Ii(H,J,ae){return typeof H=="string"?H=xt(nt(H,ae),ae):f(H)==="object"&&(H=xt(H,ae)),typeof J=="string"?J=xt(nt(J,ae),ae):f(J)==="object"&&(J=xt(J,ae)),H===J}function Ti(H,J){return H&&H.toString().replace(!J||!J.iri?E.ESCAPE:S.ESCAPE,vt)}function Wi(H,J){return H&&H.toString().replace(!J||!J.iri?E.PCT_ENCODED:S.PCT_ENCODED,It)}var ar={scheme:"http",domainHost:!0,parse:function(J,ae){return J.host||(J.error=J.error||"HTTP URIs must have a host."),J},serialize:function(J,ae){var ke=String(J.scheme).toLowerCase()==="https";return(J.port===(ke?443:80)||J.port==="")&&(J.port=void 0),J.path||(J.path="/"),J}},pr={scheme:"https",domainHost:ar.domainHost,parse:ar.parse,serialize:ar.serialize};function Gr(H){return typeof H.secure=="boolean"?H.secure:String(H.scheme).toLowerCase()==="wss"}var _t={scheme:"ws",domainHost:!0,parse:function(J,ae){var ke=J;return ke.secure=Gr(ke),ke.resourceName=(ke.path||"/")+(ke.query?"?"+ke.query:""),ke.path=void 0,ke.query=void 0,ke},serialize:function(J,ae){if((J.port===(Gr(J)?443:80)||J.port==="")&&(J.port=void 0),typeof J.secure=="boolean"&&(J.scheme=J.secure?"wss":"ws",J.secure=void 0),J.resourceName){var ke=J.resourceName.split("?"),Ue=C(ke,2),bt=Ue[0],mt=Ue[1];J.path=bt&&bt!=="/"?bt:void 0,J.query=mt,J.resourceName=void 0}return J.fragment=void 0,J}},Ji={scheme:"wss",domainHost:_t.domainHost,parse:_t.parse,serialize:_t.serialize},xr={},Er="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",or="[0-9A-Fa-f]",zt=u(u("%[EFef]"+or+"%"+or+or+"%"+or+or)+"|"+u("%[89A-Fa-f]"+or+"%"+or+or)+"|"+u("%"+or+or)),bi="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",wi="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Sr=o(wi,'[\\"\\\\]'),$r="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",pi=new RegExp(Er,"g"),cn=new RegExp(zt,"g"),be=new RegExp(o("[^]",bi,"[\\.]",'[\\"]',Sr),"g"),G=new RegExp(o("[^]",Er,$r),"g"),K=G;function oe(H){var J=It(H);return J.match(pi)?J:H}var we={scheme:"mailto",parse:function(J,ae){var ke=J,Ue=ke.to=ke.path?ke.path.split(","):[];if(ke.path=void 0,ke.query){for(var bt=!1,mt={},Ct=ke.query.split("&"),Zt=0,di=Ct.length;Ztnew RegExp(Xe,ie);z.code="new RegExp";const P=["removeAdditional","useDefaults","coerceTypes"],I=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),L={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},D={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},F=200;function V(Xe){var ie,ve,De,Y,ue,Qe,wt,vt,It,Nt,fi,gt,_i,Z,lt,nt,Ee,_e,Ze,pt,Ae,Ye,xt,kt,ct;const Xt=Xe.strict,Ii=(ie=Xe.code)===null||ie===void 0?void 0:ie.optimize,Ti=Ii===!0||Ii===void 0?1:Ii||0,Wi=(De=(ve=Xe.code)===null||ve===void 0?void 0:ve.regExp)!==null&&De!==void 0?De:z,ar=(Y=Xe.uriResolver)!==null&&Y!==void 0?Y:C.default;return{strictSchema:(Qe=(ue=Xe.strictSchema)!==null&&ue!==void 0?ue:Xt)!==null&&Qe!==void 0?Qe:!0,strictNumbers:(vt=(wt=Xe.strictNumbers)!==null&&wt!==void 0?wt:Xt)!==null&&vt!==void 0?vt:!0,strictTypes:(Nt=(It=Xe.strictTypes)!==null&&It!==void 0?It:Xt)!==null&&Nt!==void 0?Nt:"log",strictTuples:(gt=(fi=Xe.strictTuples)!==null&&fi!==void 0?fi:Xt)!==null&>!==void 0?gt:"log",strictRequired:(Z=(_i=Xe.strictRequired)!==null&&_i!==void 0?_i:Xt)!==null&&Z!==void 0?Z:!1,code:Xe.code?{...Xe.code,optimize:Ti,regExp:Wi}:{optimize:Ti,regExp:Wi},loopRequired:(lt=Xe.loopRequired)!==null&<!==void 0?lt:F,loopEnum:(nt=Xe.loopEnum)!==null&&nt!==void 0?nt:F,meta:(Ee=Xe.meta)!==null&&Ee!==void 0?Ee:!0,messages:(_e=Xe.messages)!==null&&_e!==void 0?_e:!0,inlineRefs:(Ze=Xe.inlineRefs)!==null&&Ze!==void 0?Ze:!0,schemaId:(pt=Xe.schemaId)!==null&&pt!==void 0?pt:"$id",addUsedSchema:(Ae=Xe.addUsedSchema)!==null&&Ae!==void 0?Ae:!0,validateSchema:(Ye=Xe.validateSchema)!==null&&Ye!==void 0?Ye:!0,validateFormats:(xt=Xe.validateFormats)!==null&&xt!==void 0?xt:!0,unicodeRegExp:(kt=Xe.unicodeRegExp)!==null&&kt!==void 0?kt:!0,int32range:(ct=Xe.int32range)!==null&&ct!==void 0?ct:!0,uriResolver:ar}}class ee{constructor(ie={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,ie=this.opts={...ie,...V(ie)};const{es5:ve,lines:De}=this.opts.code;this.scope=new n.ValueScope({scope:{},prefixes:I,es5:ve,lines:De}),this.logger=ye(ie.logger);const Y=ie.validateFormats;ie.validateFormats=!1,this.RULES=(0,f.getRules)(),se.call(this,L,ie,"NOT SUPPORTED"),se.call(this,D,ie,"DEPRECATED","warn"),this._metaOpts=Me.call(this),ie.formats&&ge.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),ie.keywords&&ce.call(this,ie.keywords),typeof ie.meta=="object"&&this.addMetaSchema(ie.meta),le.call(this),ie.validateFormats=Y}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:ie,meta:ve,schemaId:De}=this.opts;let Y=S;De==="id"&&(Y={...S},Y.id=Y.$id,delete Y.$id),ve&&ie&&this.addMetaSchema(Y,Y[De],!1)}defaultMeta(){const{meta:ie,schemaId:ve}=this.opts;return this.opts.defaultMeta=typeof ie=="object"?ie[ve]||ie:void 0}validate(ie,ve){let De;if(typeof ie=="string"){if(De=this.getSchema(ie),!De)throw new Error(`no schema with key or ref "${ie}"`)}else De=this.compile(ie);const Y=De(ve);return"$async"in De||(this.errors=De.errors),Y}compile(ie,ve){const De=this._addSchema(ie,ve);return De.validate||this._compileSchemaEnv(De)}compileAsync(ie,ve){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:De}=this.opts;return Y.call(this,ie,ve);async function Y(Nt,fi){await ue.call(this,Nt.$schema);const gt=this._addSchema(Nt,fi);return gt.validate||Qe.call(this,gt)}async function ue(Nt){Nt&&!this.getSchema(Nt)&&await Y.call(this,{$ref:Nt},!0)}async function Qe(Nt){try{return this._compileSchemaEnv(Nt)}catch(fi){if(!(fi instanceof u.default))throw fi;return wt.call(this,fi),await vt.call(this,fi.missingSchema),Qe.call(this,Nt)}}function wt({missingSchema:Nt,missingRef:fi}){if(this.refs[Nt])throw new Error(`AnySchema ${Nt} is loaded but ${fi} cannot be resolved`)}async function vt(Nt){const fi=await It.call(this,Nt);this.refs[Nt]||await ue.call(this,fi.$schema),this.refs[Nt]||this.addSchema(fi,Nt,ve)}async function It(Nt){const fi=this._loading[Nt];if(fi)return fi;try{return await(this._loading[Nt]=De(Nt))}finally{delete this._loading[Nt]}}}addSchema(ie,ve,De,Y=this.opts.validateSchema){if(Array.isArray(ie)){for(const Qe of ie)this.addSchema(Qe,void 0,De,Y);return this}let ue;if(typeof ie=="object"){const{schemaId:Qe}=this.opts;if(ue=ie[Qe],ue!==void 0&&typeof ue!="string")throw new Error(`schema ${Qe} must be string`)}return ve=(0,_.normalizeId)(ve||ue),this._checkUnique(ve),this.schemas[ve]=this._addSchema(ie,De,ve,Y,!0),this}addMetaSchema(ie,ve,De=this.opts.validateSchema){return this.addSchema(ie,ve,!0,De),this}validateSchema(ie,ve){if(typeof ie=="boolean")return!0;let De;if(De=ie.$schema,De!==void 0&&typeof De!="string")throw new Error("$schema must be a string");if(De=De||this.opts.defaultMeta||this.defaultMeta(),!De)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const Y=this.validate(De,ie);if(!Y&&ve){const ue="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(ue);else throw new Error(ue)}return Y}getSchema(ie){let ve;for(;typeof(ve=ne.call(this,ie))=="string";)ie=ve;if(ve===void 0){const{schemaId:De}=this.opts,Y=new p.SchemaEnv({schema:{},schemaId:De});if(ve=p.resolveSchema.call(this,Y,ie),!ve)return;this.refs[ie]=ve}return ve.validate||this._compileSchemaEnv(ve)}removeSchema(ie){if(ie instanceof RegExp)return this._removeAllSchemas(this.schemas,ie),this._removeAllSchemas(this.refs,ie),this;switch(typeof ie){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const ve=ne.call(this,ie);return typeof ve=="object"&&this._cache.delete(ve.schema),delete this.schemas[ie],delete this.refs[ie],this}case"object":{const ve=ie;this._cache.delete(ve);let De=ie[this.opts.schemaId];return De&&(De=(0,_.normalizeId)(De),delete this.schemas[De],delete this.refs[De]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(ie){for(const ve of ie)this.addKeyword(ve);return this}addKeyword(ie,ve){let De;if(typeof ie=="string")De=ie,typeof ve=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),ve.keyword=De);else if(typeof ie=="object"&&ve===void 0){if(ve=ie,De=ve.keyword,Array.isArray(De)&&!De.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(q.call(this,De,ve),!ve)return(0,E.eachItem)(De,ue=>We.call(this,ue)),this;it.call(this,ve);const Y={...ve,type:(0,v.getJSONTypes)(ve.type),schemaType:(0,v.getJSONTypes)(ve.schemaType)};return(0,E.eachItem)(De,Y.type.length===0?ue=>We.call(this,ue,Y):ue=>Y.type.forEach(Qe=>We.call(this,ue,Y,Qe))),this}getKeyword(ie){const ve=this.RULES.all[ie];return typeof ve=="object"?ve.definition:!!ve}removeKeyword(ie){const{RULES:ve}=this;delete ve.keywords[ie],delete ve.all[ie];for(const De of ve.rules){const Y=De.rules.findIndex(ue=>ue.keyword===ie);Y>=0&&De.rules.splice(Y,1)}return this}addFormat(ie,ve){return typeof ve=="string"&&(ve=new RegExp(ve)),this.formats[ie]=ve,this}errorsText(ie=this.errors,{separator:ve=", ",dataVar:De="data"}={}){return!ie||ie.length===0?"No errors":ie.map(Y=>`${De}${Y.instancePath} ${Y.message}`).reduce((Y,ue)=>Y+ve+ue)}$dataMetaSchema(ie,ve){const De=this.RULES.all;ie=JSON.parse(JSON.stringify(ie));for(const Y of ve){const ue=Y.split("/").slice(1);let Qe=ie;for(const wt of ue)Qe=Qe[wt];for(const wt in De){const vt=De[wt];if(typeof vt!="object")continue;const{$data:It}=vt.definition,Nt=Qe[wt];It&&Nt&&(Qe[wt]=Ne(Nt))}}return ie}_removeAllSchemas(ie,ve){for(const De in ie){const Y=ie[De];(!ve||ve.test(De))&&(typeof Y=="string"?delete ie[De]:Y&&!Y.meta&&(this._cache.delete(Y.schema),delete ie[De]))}}_addSchema(ie,ve,De,Y=this.opts.validateSchema,ue=this.opts.addUsedSchema){let Qe;const{schemaId:wt}=this.opts;if(typeof ie=="object")Qe=ie[wt];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof ie!="boolean")throw new Error("schema must be object or boolean")}let vt=this._cache.get(ie);if(vt!==void 0)return vt;De=(0,_.normalizeId)(Qe||De);const It=_.getSchemaRefs.call(this,ie,De);return vt=new p.SchemaEnv({schema:ie,schemaId:wt,meta:ve,baseId:De,localRefs:It}),this._cache.set(vt.schema,vt),ue&&!De.startsWith("#")&&(De&&this._checkUnique(De),this.refs[De]=vt),Y&&this.validateSchema(ie,!0),vt}_checkUnique(ie){if(this.schemas[ie]||this.refs[ie])throw new Error(`schema with key or id "${ie}" already exists`)}_compileSchemaEnv(ie){if(ie.meta?this._compileMetaSchema(ie):p.compileSchema.call(this,ie),!ie.validate)throw new Error("ajv implementation error");return ie.validate}_compileMetaSchema(ie){const ve=this.opts;this.opts=this._metaOpts;try{p.compileSchema.call(this,ie)}finally{this.opts=ve}}}l.default=ee,ee.ValidationError=o.default,ee.MissingRefError=u.default;function se(Xe,ie,ve,De="error"){for(const Y in Xe){const ue=Y;ue in ie&&this.logger[De](`${ve}: option ${Y}. ${Xe[ue]}`)}}function ne(Xe){return Xe=(0,_.normalizeId)(Xe),this.schemas[Xe]||this.refs[Xe]}function le(){const Xe=this.opts.schemas;if(Xe)if(Array.isArray(Xe))this.addSchema(Xe);else for(const ie in Xe)this.addSchema(Xe[ie],ie)}function ge(){for(const Xe in this.opts.formats){const ie=this.opts.formats[Xe];ie&&this.addFormat(Xe,ie)}}function ce(Xe){if(Array.isArray(Xe)){this.addVocabulary(Xe);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const ie in Xe){const ve=Xe[ie];ve.keyword||(ve.keyword=ie),this.addKeyword(ve)}}function Me(){const Xe={...this.opts};for(const ie of P)delete Xe[ie];return Xe}const et={log(){},warn(){},error(){}};function ye(Xe){if(Xe===!1)return et;if(Xe===void 0)return console;if(Xe.log&&Xe.warn&&Xe.error)return Xe;throw new Error("logger must implement log, warn and error methods")}const Ge=/^[a-z_$][a-z0-9_$:-]*$/i;function q(Xe,ie){const{RULES:ve}=this;if((0,E.eachItem)(Xe,De=>{if(ve.keywords[De])throw new Error(`Keyword ${De} is already defined`);if(!Ge.test(De))throw new Error(`Keyword ${De} has invalid name`)}),!!ie&&ie.$data&&!("code"in ie||"validate"in ie))throw new Error('$data keyword must have "code" or "validate" function')}function We(Xe,ie,ve){var De;const Y=ie==null?void 0:ie.post;if(ve&&Y)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:ue}=this;let Qe=Y?ue.post:ue.rules.find(({type:vt})=>vt===ve);if(Qe||(Qe={type:ve,rules:[]},ue.rules.push(Qe)),ue.keywords[Xe]=!0,!ie)return;const wt={keyword:Xe,definition:{...ie,type:(0,v.getJSONTypes)(ie.type),schemaType:(0,v.getJSONTypes)(ie.schemaType)}};ie.before?Tt.call(this,Qe,wt,ie.before):Qe.rules.push(wt),ue.all[Xe]=wt,(De=ie.implements)===null||De===void 0||De.forEach(vt=>this.addKeyword(vt))}function Tt(Xe,ie,ve){const De=Xe.rules.findIndex(Y=>Y.keyword===ve);De>=0?Xe.rules.splice(De,0,ie):(Xe.rules.push(ie),this.logger.warn(`rule ${ve} is not defined`))}function it(Xe){let{metaSchema:ie}=Xe;ie!==void 0&&(Xe.$data&&this.opts.$data&&(ie=Ne(ie)),Xe.validateSchema=this.compile(ie,!0))}const Bt={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ne(Xe){return{anyOf:[Xe,Bt]}}})(sy);var Yf={},Qf={},ed={};Object.defineProperty(ed,"__esModule",{value:!0});const Nw={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};ed.default=Nw;var Qa={};Object.defineProperty(Qa,"__esModule",{value:!0});Qa.callRef=Qa.getValidate=void 0;const Uw=zc,Km=Fi,Fn=Ni,qo=Ds,Xm=Nn,Mu=Gi,Vw={keyword:"$ref",schemaType:"string",code(l){const{gen:i,schema:a,it:o}=l,{baseId:u,schemaEnv:f,validateName:p,opts:n,self:_}=o,{root:v}=f;if((a==="#"||a==="#/")&&u===v.baseId)return S();const E=Xm.resolveRef.call(_,v,u,a);if(E===void 0)throw new Uw.default(o.opts.uriResolver,u,a);if(E instanceof Xm.SchemaEnv)return C(E);return z(E);function S(){if(f===v)return $u(l,p,f,f.$async);const P=i.scopeValue("root",{ref:v});return $u(l,(0,Fn._)`${P}.validate`,v,v.$async)}function C(P){const I=zy(l,P);$u(l,I,P,P.$async)}function z(P){const I=i.scopeValue("schema",n.code.source===!0?{ref:P,code:(0,Fn.stringify)(P)}:{ref:P}),L=i.name("valid"),D=l.subschema({schema:P,dataTypes:[],schemaPath:Fn.nil,topSchemaRef:I,errSchemaPath:a},L);l.mergeEvaluated(D),l.ok(L)}}};function zy(l,i){const{gen:a}=l;return i.validate?a.scopeValue("validate",{ref:i.validate}):(0,Fn._)`${a.scopeValue("wrapper",{ref:i})}.validate`}Qa.getValidate=zy;function $u(l,i,a,o){const{gen:u,it:f}=l,{allErrors:p,schemaEnv:n,opts:_}=f,v=_.passContext?qo.default.this:Fn.nil;o?E():S();function E(){if(!n.$async)throw new Error("async schema referenced by sync schema");const P=u.let("valid");u.try(()=>{u.code((0,Fn._)`await ${(0,Km.callValidateCode)(l,i,v)}`),z(i),p||u.assign(P,!0)},I=>{u.if((0,Fn._)`!(${I} instanceof ${f.ValidationError})`,()=>u.throw(I)),C(I),p||u.assign(P,!1)}),l.ok(P)}function S(){l.result((0,Km.callValidateCode)(l,i,v),()=>z(i),()=>C(i))}function C(P){const I=(0,Fn._)`${P}.errors`;u.assign(qo.default.vErrors,(0,Fn._)`${qo.default.vErrors} === null ? ${I} : ${qo.default.vErrors}.concat(${I})`),u.assign(qo.default.errors,(0,Fn._)`${qo.default.vErrors}.length`)}function z(P){var I;if(!f.opts.unevaluated)return;const L=(I=a==null?void 0:a.validate)===null||I===void 0?void 0:I.evaluated;if(f.props!==!0)if(L&&!L.dynamicProps)L.props!==void 0&&(f.props=Mu.mergeEvaluated.props(u,L.props,f.props));else{const D=u.var("props",(0,Fn._)`${P}.evaluated.props`);f.props=Mu.mergeEvaluated.props(u,D,f.props,Fn.Name)}if(f.items!==!0)if(L&&!L.dynamicItems)L.items!==void 0&&(f.items=Mu.mergeEvaluated.items(u,L.items,f.items));else{const D=u.var("items",(0,Fn._)`${P}.evaluated.items`);f.items=Mu.mergeEvaluated.items(u,D,f.items,Fn.Name)}}}Qa.callRef=$u;Qa.default=Vw;Object.defineProperty(Qf,"__esModule",{value:!0});const $w=ed,jw=Qa,qw=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",$w.default,jw.default];Qf.default=qw;var td={},id={};Object.defineProperty(id,"__esModule",{value:!0});const Gu=Ni,pa=Gu.operators,Wu={maximum:{okStr:"<=",ok:pa.LTE,fail:pa.GT},minimum:{okStr:">=",ok:pa.GTE,fail:pa.LT},exclusiveMaximum:{okStr:"<",ok:pa.LT,fail:pa.GTE},exclusiveMinimum:{okStr:">",ok:pa.GT,fail:pa.LTE}},Zw={message:({keyword:l,schemaCode:i})=>(0,Gu.str)`must be ${Wu[l].okStr} ${i}`,params:({keyword:l,schemaCode:i})=>(0,Gu._)`{comparison: ${Wu[l].okStr}, limit: ${i}}`},Gw={keyword:Object.keys(Wu),type:"number",schemaType:"number",$data:!0,error:Zw,code(l){const{keyword:i,data:a,schemaCode:o}=l;l.fail$data((0,Gu._)`${a} ${Wu[i].fail} ${o} || isNaN(${a})`)}};id.default=Gw;var rd={};Object.defineProperty(rd,"__esModule",{value:!0});const vc=Ni,Ww={message:({schemaCode:l})=>(0,vc.str)`must be multiple of ${l}`,params:({schemaCode:l})=>(0,vc._)`{multipleOf: ${l}}`},Hw={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Ww,code(l){const{gen:i,data:a,schemaCode:o,it:u}=l,f=u.opts.multipleOfPrecision,p=i.let("res"),n=f?(0,vc._)`Math.abs(Math.round(${p}) - ${p}) > 1e-${f}`:(0,vc._)`${p} !== parseInt(${p})`;l.fail$data((0,vc._)`(${o} === 0 || (${p} = ${a}/${o}, ${n}))`)}};rd.default=Hw;var nd={},sd={};Object.defineProperty(sd,"__esModule",{value:!0});function My(l){const i=l.length;let a=0,o=0,u;for(;o=55296&&u<=56319&&o(0,Wa._)`{limit: ${l}}`},Yw={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Jw,code(l){const{keyword:i,data:a,schemaCode:o,it:u}=l,f=i==="maxLength"?Wa.operators.GT:Wa.operators.LT,p=u.opts.unicode===!1?(0,Wa._)`${a}.length`:(0,Wa._)`${(0,Kw.useFunc)(l.gen,Xw.default)}(${a})`;l.fail$data((0,Wa._)`${p} ${f} ${o}`)}};nd.default=Yw;var ad={};Object.defineProperty(ad,"__esModule",{value:!0});const Qw=Fi,Hu=Ni,ex={message:({schemaCode:l})=>(0,Hu.str)`must match pattern "${l}"`,params:({schemaCode:l})=>(0,Hu._)`{pattern: ${l}}`},tx={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:ex,code(l){const{data:i,$data:a,schema:o,schemaCode:u,it:f}=l,p=f.opts.unicodeRegExp?"u":"",n=a?(0,Hu._)`(new RegExp(${u}, ${p}))`:(0,Qw.usePattern)(l,o);l.fail$data((0,Hu._)`!${n}.test(${i})`)}};ad.default=tx;var od={};Object.defineProperty(od,"__esModule",{value:!0});const bc=Ni,ix={message({keyword:l,schemaCode:i}){const a=l==="maxProperties"?"more":"fewer";return(0,bc.str)`must NOT have ${a} than ${i} properties`},params:({schemaCode:l})=>(0,bc._)`{limit: ${l}}`},rx={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:ix,code(l){const{keyword:i,data:a,schemaCode:o}=l,u=i==="maxProperties"?bc.operators.GT:bc.operators.LT;l.fail$data((0,bc._)`Object.keys(${a}).length ${u} ${o}`)}};od.default=rx;var ld={};Object.defineProperty(ld,"__esModule",{value:!0});const pc=Fi,wc=Ni,nx=Gi,sx={message:({params:{missingProperty:l}})=>(0,wc.str)`must have required property '${l}'`,params:({params:{missingProperty:l}})=>(0,wc._)`{missingProperty: ${l}}`},ax={keyword:"required",type:"object",schemaType:"array",$data:!0,error:sx,code(l){const{gen:i,schema:a,schemaCode:o,data:u,$data:f,it:p}=l,{opts:n}=p;if(!f&&a.length===0)return;const _=a.length>=n.loopRequired;if(p.allErrors?v():E(),n.strictRequired){const z=l.parentSchema.properties,{definedProperties:P}=l.it;for(const I of a)if((z==null?void 0:z[I])===void 0&&!P.has(I)){const L=p.schemaEnv.baseId+p.errSchemaPath,D=`required property "${I}" is not defined at "${L}" (strictRequired)`;(0,nx.checkStrictMode)(p,D,p.opts.strictRequired)}}function v(){if(_||f)l.block$data(wc.nil,S);else for(const z of a)(0,pc.checkReportMissingProp)(l,z)}function E(){const z=i.let("missing");if(_||f){const P=i.let("valid",!0);l.block$data(P,()=>C(z,P)),l.ok(P)}else i.if((0,pc.checkMissingProp)(l,a,z)),(0,pc.reportMissingProp)(l,z),i.else()}function S(){i.forOf("prop",o,z=>{l.setParams({missingProperty:z}),i.if((0,pc.noPropertyInData)(i,u,z,n.ownProperties),()=>l.error())})}function C(z,P){l.setParams({missingProperty:z}),i.forOf(z,o,()=>{i.assign(P,(0,pc.propertyInData)(i,u,z,n.ownProperties)),i.if((0,wc.not)(P),()=>{l.error(),i.break()})},wc.nil)}}};ld.default=ax;var cd={};Object.defineProperty(cd,"__esModule",{value:!0});const xc=Ni,ox={message({keyword:l,schemaCode:i}){const a=l==="maxItems"?"more":"fewer";return(0,xc.str)`must NOT have ${a} than ${i} items`},params:({schemaCode:l})=>(0,xc._)`{limit: ${l}}`},lx={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:ox,code(l){const{keyword:i,data:a,schemaCode:o}=l,u=i==="maxItems"?xc.operators.GT:xc.operators.LT;l.fail$data((0,xc._)`${a}.length ${u} ${o}`)}};cd.default=lx;var ud={},Mc={};Object.defineProperty(Mc,"__esModule",{value:!0});const Dy=dy;Dy.code='require("ajv/dist/runtime/equal").default';Mc.default=Dy;Object.defineProperty(ud,"__esModule",{value:!0});const kf=Ac,on=Ni,cx=Gi,ux=Mc,hx={message:({params:{i:l,j:i}})=>(0,on.str)`must NOT have duplicate items (items ## ${i} and ${l} are identical)`,params:({params:{i:l,j:i}})=>(0,on._)`{i: ${l}, j: ${i}}`},fx={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:hx,code(l){const{gen:i,data:a,$data:o,schema:u,parentSchema:f,schemaCode:p,it:n}=l;if(!o&&!u)return;const _=i.let("valid"),v=f.items?(0,kf.getSchemaTypes)(f.items):[];l.block$data(_,E,(0,on._)`${p} === false`),l.ok(_);function E(){const P=i.let("i",(0,on._)`${a}.length`),I=i.let("j");l.setParams({i:P,j:I}),i.assign(_,!0),i.if((0,on._)`${P} > 1`,()=>(S()?C:z)(P,I))}function S(){return v.length>0&&!v.some(P=>P==="object"||P==="array")}function C(P,I){const L=i.name("item"),D=(0,kf.checkDataTypes)(v,L,n.opts.strictNumbers,kf.DataType.Wrong),F=i.const("indices",(0,on._)`{}`);i.for((0,on._)`;${P}--;`,()=>{i.let(L,(0,on._)`${a}[${P}]`),i.if(D,(0,on._)`continue`),v.length>1&&i.if((0,on._)`typeof ${L} == "string"`,(0,on._)`${L} += "_"`),i.if((0,on._)`typeof ${F}[${L}] == "number"`,()=>{i.assign(I,(0,on._)`${F}[${L}]`),l.error(),i.assign(_,!1).break()}).code((0,on._)`${F}[${L}] = ${P}`)})}function z(P,I){const L=(0,cx.useFunc)(i,ux.default),D=i.name("outer");i.label(D).for((0,on._)`;${P}--;`,()=>i.for((0,on._)`${I} = ${P}; ${I}--;`,()=>i.if((0,on._)`${L}(${a}[${P}], ${a}[${I}])`,()=>{l.error(),i.assign(_,!1).break(D)})))}}};ud.default=fx;var hd={};Object.defineProperty(hd,"__esModule",{value:!0});const Rf=Ni,dx=Gi,px=Mc,mx={message:"must be equal to constant",params:({schemaCode:l})=>(0,Rf._)`{allowedValue: ${l}}`},gx={keyword:"const",$data:!0,error:mx,code(l){const{gen:i,data:a,$data:o,schemaCode:u,schema:f}=l;o||f&&typeof f=="object"?l.fail$data((0,Rf._)`!${(0,dx.useFunc)(i,px.default)}(${a}, ${u})`):l.fail((0,Rf._)`${f} !== ${a}`)}};hd.default=gx;var fd={};Object.defineProperty(fd,"__esModule",{value:!0});const gc=Ni,_x=Gi,yx=Mc,vx={message:"must be equal to one of the allowed values",params:({schemaCode:l})=>(0,gc._)`{allowedValues: ${l}}`},bx={keyword:"enum",schemaType:"array",$data:!0,error:vx,code(l){const{gen:i,data:a,$data:o,schema:u,schemaCode:f,it:p}=l;if(!o&&u.length===0)throw new Error("enum must have non-empty array");const n=u.length>=p.opts.loopEnum;let _;const v=()=>_??(_=(0,_x.useFunc)(i,yx.default));let E;if(n||o)E=i.let("valid"),l.block$data(E,S);else{if(!Array.isArray(u))throw new Error("ajv implementation error");const z=i.const("vSchema",f);E=(0,gc.or)(...u.map((P,I)=>C(z,I)))}l.pass(E);function S(){i.assign(E,!1),i.forOf("v",f,z=>i.if((0,gc._)`${v()}(${a}, ${z})`,()=>i.assign(E,!0).break()))}function C(z,P){const I=u[P];return typeof I=="object"&&I!==null?(0,gc._)`${v()}(${a}, ${z}[${P}])`:(0,gc._)`${a} === ${I}`}}};fd.default=bx;Object.defineProperty(td,"__esModule",{value:!0});const wx=id,xx=rd,Ex=nd,Sx=ad,kx=od,Tx=ld,Cx=cd,Ix=ud,Ax=hd,Px=fd,zx=[wx.default,xx.default,Ex.default,Sx.default,kx.default,Tx.default,Cx.default,Ix.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Ax.default,Px.default];td.default=zx;var dd={},nl={};Object.defineProperty(nl,"__esModule",{value:!0});nl.validateAdditionalItems=void 0;const Ha=Ni,Bf=Gi,Mx={message:({params:{len:l}})=>(0,Ha.str)`must NOT have more than ${l} items`,params:({params:{len:l}})=>(0,Ha._)`{limit: ${l}}`},Dx={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Mx,code(l){const{parentSchema:i,it:a}=l,{items:o}=i;if(!Array.isArray(o)){(0,Bf.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}Ly(l,o)}};function Ly(l,i){const{gen:a,schema:o,data:u,keyword:f,it:p}=l;p.items=!0;const n=a.const("len",(0,Ha._)`${u}.length`);if(o===!1)l.setParams({len:i.length}),l.pass((0,Ha._)`${n} <= ${i.length}`);else if(typeof o=="object"&&!(0,Bf.alwaysValidSchema)(p,o)){const v=a.var("valid",(0,Ha._)`${n} <= ${i.length}`);a.if((0,Ha.not)(v),()=>_(v)),l.ok(v)}function _(v){a.forRange("i",i.length,n,E=>{l.subschema({keyword:f,dataProp:E,dataPropType:Bf.Type.Num},v),p.allErrors||a.if((0,Ha.not)(v),()=>a.break())})}}nl.validateAdditionalItems=Ly;nl.default=Dx;var pd={},sl={};Object.defineProperty(sl,"__esModule",{value:!0});sl.validateTuple=void 0;const Jm=Ni,ju=Gi,Lx=Fi,Rx={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(l){const{schema:i,it:a}=l;if(Array.isArray(i))return Ry(l,"additionalItems",i);a.items=!0,!(0,ju.alwaysValidSchema)(a,i)&&l.ok((0,Lx.validateArray)(l))}};function Ry(l,i,a=l.schema){const{gen:o,parentSchema:u,data:f,keyword:p,it:n}=l;E(u),n.opts.unevaluated&&a.length&&n.items!==!0&&(n.items=ju.mergeEvaluated.items(o,a.length,n.items));const _=o.name("valid"),v=o.const("len",(0,Jm._)`${f}.length`);a.forEach((S,C)=>{(0,ju.alwaysValidSchema)(n,S)||(o.if((0,Jm._)`${v} > ${C}`,()=>l.subschema({keyword:p,schemaProp:C,dataProp:C},_)),l.ok(_))});function E(S){const{opts:C,errSchemaPath:z}=n,P=a.length,I=P===S.minItems&&(P===S.maxItems||S[i]===!1);if(C.strictTuples&&!I){const L=`"${p}" is ${P}-tuple, but minItems or maxItems/${i} are not specified or different at path "${z}"`;(0,ju.checkStrictMode)(n,L,C.strictTuples)}}}sl.validateTuple=Ry;sl.default=Rx;Object.defineProperty(pd,"__esModule",{value:!0});const Bx=sl,Ox={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:l=>(0,Bx.validateTuple)(l,"items")};pd.default=Ox;var md={};Object.defineProperty(md,"__esModule",{value:!0});const Ym=Ni,Fx=Gi,Nx=Fi,Ux=nl,Vx={message:({params:{len:l}})=>(0,Ym.str)`must NOT have more than ${l} items`,params:({params:{len:l}})=>(0,Ym._)`{limit: ${l}}`},$x={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Vx,code(l){const{schema:i,parentSchema:a,it:o}=l,{prefixItems:u}=a;o.items=!0,!(0,Fx.alwaysValidSchema)(o,i)&&(u?(0,Ux.validateAdditionalItems)(l,u):l.ok((0,Nx.validateArray)(l)))}};md.default=$x;var gd={};Object.defineProperty(gd,"__esModule",{value:!0});const ts=Ni,Du=Gi,jx={message:({params:{min:l,max:i}})=>i===void 0?(0,ts.str)`must contain at least ${l} valid item(s)`:(0,ts.str)`must contain at least ${l} and no more than ${i} valid item(s)`,params:({params:{min:l,max:i}})=>i===void 0?(0,ts._)`{minContains: ${l}}`:(0,ts._)`{minContains: ${l}, maxContains: ${i}}`},qx={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:jx,code(l){const{gen:i,schema:a,parentSchema:o,data:u,it:f}=l;let p,n;const{minContains:_,maxContains:v}=o;f.opts.next?(p=_===void 0?1:_,n=v):p=1;const E=i.const("len",(0,ts._)`${u}.length`);if(l.setParams({min:p,max:n}),n===void 0&&p===0){(0,Du.checkStrictMode)(f,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(n!==void 0&&p>n){(0,Du.checkStrictMode)(f,'"minContains" > "maxContains" is always invalid'),l.fail();return}if((0,Du.alwaysValidSchema)(f,a)){let I=(0,ts._)`${E} >= ${p}`;n!==void 0&&(I=(0,ts._)`${I} && ${E} <= ${n}`),l.pass(I);return}f.items=!0;const S=i.name("valid");n===void 0&&p===1?z(S,()=>i.if(S,()=>i.break())):p===0?(i.let(S,!0),n!==void 0&&i.if((0,ts._)`${u}.length > 0`,C)):(i.let(S,!1),C()),l.result(S,()=>l.reset());function C(){const I=i.name("_valid"),L=i.let("count",0);z(I,()=>i.if(I,()=>P(L)))}function z(I,L){i.forRange("i",0,E,D=>{l.subschema({keyword:"contains",dataProp:D,dataPropType:Du.Type.Num,compositeRule:!0},I),L()})}function P(I){i.code((0,ts._)`${I}++`),n===void 0?i.if((0,ts._)`${I} >= ${p}`,()=>i.assign(S,!0).break()):(i.if((0,ts._)`${I} > ${n}`,()=>i.assign(S,!1).break()),p===1?i.assign(S,!0):i.if((0,ts._)`${I} >= ${p}`,()=>i.assign(S,!0)))}}};gd.default=qx;var By={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.validateSchemaDeps=l.validatePropertyDeps=l.error=void 0;const i=Ni,a=Gi,o=Fi;l.error={message:({params:{property:_,depsCount:v,deps:E}})=>{const S=v===1?"property":"properties";return(0,i.str)`must have ${S} ${E} when property ${_} is present`},params:({params:{property:_,depsCount:v,deps:E,missingProperty:S}})=>(0,i._)`{property: ${_}, + missingProperty: ${S}, depsCount: ${v}, - deps: ${S}}`};const u={keyword:"dependencies",type:"object",schemaType:"object",error:l.error,code(_){const[v,S]=f(_);p(_,v),n(_,S)}};function f({schema:_}){const v={},S={};for(const T in _){if(T==="__proto__")continue;const I=Array.isArray(_[T])?v:S;I[T]=_[T]}return[v,S]}function p(_,v=_.schema){const{gen:S,data:T,it:I}=_;if(Object.keys(v).length===0)return;const z=S.let("missing");for(const M in v){const C=v[M];if(C.length===0)continue;const R=(0,o.propertyInData)(S,T,M,I.opts.ownProperties);_.setParams({property:M,depsCount:C.length,deps:C.join(", ")}),I.allErrors?S.if(R,()=>{for(const D of C)(0,o.checkReportMissingProp)(_,D)}):(S.if((0,i._)`${R} && (${(0,o.checkMissingProp)(_,C,z)})`),(0,o.reportMissingProp)(_,z),S.else())}}l.validatePropertyDeps=p;function n(_,v=_.schema){const{gen:S,data:T,keyword:I,it:z}=_,M=S.name("valid");for(const C in v)(0,a.alwaysValidSchema)(z,v[C])||(S.if((0,o.propertyInData)(S,T,C,z.opts.ownProperties),()=>{const R=_.subschema({keyword:I,schemaProp:C},M);_.mergeValidEvaluated(R,M)},()=>S.var(M,!0)),_.ok(M))}l.validateSchemaDeps=n,l.default=u})(Py);var _d={};Object.defineProperty(_d,"__esModule",{value:!0});const zy=Fi,Nx=Gi,Ux={message:"property name must be valid",params:({params:l})=>(0,zy._)`{propertyName: ${l.propertyName}}`},Vx={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Ux,code(l){const{gen:i,schema:a,data:o,it:u}=l;if((0,Nx.alwaysValidSchema)(u,a))return;const f=i.name("valid");i.forIn("key",o,p=>{l.setParams({propertyName:p}),l.subschema({keyword:"propertyNames",data:p,dataTypes:["string"],propertyName:p,compositeRule:!0},f),i.if((0,zy.not)(f),()=>{l.error(!0),u.allErrors||i.break()})}),l.ok(f)}};_d.default=Vx;var lh={};Object.defineProperty(lh,"__esModule",{value:!0});const Lu=Oi,gs=Fi,$x=Ds,Ru=Gi,jx={message:"must NOT have additional properties",params:({params:l})=>(0,gs._)`{additionalProperty: ${l.additionalProperty}}`},qx={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:jx,code(l){const{gen:i,schema:a,parentSchema:o,data:u,errsCount:f,it:p}=l;if(!f)throw new Error("ajv implementation error");const{allErrors:n,opts:_}=p;if(p.props=!0,_.removeAdditional!=="all"&&(0,Ru.alwaysValidSchema)(p,a))return;const v=(0,Lu.allSchemaProperties)(o.properties),S=(0,Lu.allSchemaProperties)(o.patternProperties);T(),l.ok((0,gs._)`${f} === ${$x.default.errors}`);function T(){i.forIn("key",u,R=>{!v.length&&!S.length?M(R):i.if(I(R),()=>M(R))})}function I(R){let D;if(v.length>8){const F=(0,Ru.schemaRefOrVal)(p,o.properties,"properties");D=(0,Lu.isOwnProperty)(i,F,R)}else v.length?D=(0,gs.or)(...v.map(F=>(0,gs._)`${R} === ${F}`)):D=gs.nil;return S.length&&(D=(0,gs.or)(D,...S.map(F=>(0,gs._)`${(0,Lu.usePattern)(l,F)}.test(${R})`))),(0,gs.not)(D)}function z(R){i.code((0,gs._)`delete ${u}[${R}]`)}function M(R){if(_.removeAdditional==="all"||_.removeAdditional&&a===!1){z(R);return}if(a===!1){l.setParams({additionalProperty:R}),l.error(),n||i.break();return}if(typeof a=="object"&&!(0,Ru.alwaysValidSchema)(p,a)){const D=i.name("valid");_.removeAdditional==="failing"?(C(R,D,!1),i.if((0,gs.not)(D),()=>{l.reset(),z(R)})):(C(R,D),n||i.if((0,gs.not)(D),()=>i.break()))}}function C(R,D,F){const j={keyword:"additionalProperties",dataProp:R,dataPropType:Ru.Type.Str};F===!1&&Object.assign(j,{compositeRule:!0,createErrors:!1,allErrors:!1}),l.subschema(j,D)}}};lh.default=qx;var yd={};Object.defineProperty(yd,"__esModule",{value:!0});const Zx=ys,Qm=Oi,Tf=Gi,eg=lh,Gx={keyword:"properties",type:"object",schemaType:"object",code(l){const{gen:i,schema:a,parentSchema:o,data:u,it:f}=l;f.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&eg.default.code(new Zx.KeywordCxt(f,eg.default,"additionalProperties"));const p=(0,Qm.allSchemaProperties)(a);for(const T of p)f.definedProperties.add(T);f.opts.unevaluated&&p.length&&f.props!==!0&&(f.props=Tf.mergeEvaluated.props(i,(0,Tf.toHash)(p),f.props));const n=p.filter(T=>!(0,Tf.alwaysValidSchema)(f,a[T]));if(n.length===0)return;const _=i.name("valid");for(const T of n)v(T)?S(T):(i.if((0,Qm.propertyInData)(i,u,T,f.opts.ownProperties)),S(T),f.allErrors||i.else().var(_,!0),i.endIf()),l.it.definedProperties.add(T),l.ok(_);function v(T){return f.opts.useDefaults&&!f.compositeRule&&a[T].default!==void 0}function S(T){l.subschema({keyword:"properties",schemaProp:T,dataProp:T},_)}}};yd.default=Gx;var vd={};Object.defineProperty(vd,"__esModule",{value:!0});const tg=Oi,Bu=Fi,ig=Gi,rg=Gi,Wx={keyword:"patternProperties",type:"object",schemaType:"object",code(l){const{gen:i,schema:a,data:o,parentSchema:u,it:f}=l,{opts:p}=f,n=(0,tg.allSchemaProperties)(a),_=n.filter(C=>(0,ig.alwaysValidSchema)(f,a[C]));if(n.length===0||_.length===n.length&&(!f.opts.unevaluated||f.props===!0))return;const v=p.strictSchema&&!p.allowMatchingProperties&&u.properties,S=i.name("valid");f.props!==!0&&!(f.props instanceof Bu.Name)&&(f.props=(0,rg.evaluatedPropsToName)(i,f.props));const{props:T}=f;I();function I(){for(const C of n)v&&z(C),f.allErrors?M(C):(i.var(S,!0),M(C),i.if(S))}function z(C){for(const R in v)new RegExp(C).test(R)&&(0,ig.checkStrictMode)(f,`property ${R} matches pattern ${C} (use allowMatchingProperties)`)}function M(C){i.forIn("key",o,R=>{i.if((0,Bu._)`${(0,tg.usePattern)(l,C)}.test(${R})`,()=>{const D=_.includes(C);D||l.subschema({keyword:"patternProperties",schemaProp:C,dataProp:R,dataPropType:rg.Type.Str},S),f.opts.unevaluated&&T!==!0?i.assign((0,Bu._)`${T}[${R}]`,!0):!D&&!f.allErrors&&i.if((0,Bu.not)(S),()=>i.break())})})}}};vd.default=Wx;var bd={};Object.defineProperty(bd,"__esModule",{value:!0});const Hx=Gi,Kx={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(l){const{gen:i,schema:a,it:o}=l;if((0,Hx.alwaysValidSchema)(o,a)){l.fail();return}const u=i.name("valid");l.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},u),l.failResult(u,()=>l.reset(),()=>l.error())},error:{message:"must NOT be valid"}};bd.default=Kx;var wd={};Object.defineProperty(wd,"__esModule",{value:!0});const Xx=Oi,Jx={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Xx.validateUnion,error:{message:"must match a schema in anyOf"}};wd.default=Jx;var xd={};Object.defineProperty(xd,"__esModule",{value:!0});const qu=Fi,Yx=Gi,Qx={message:"must match exactly one schema in oneOf",params:({params:l})=>(0,qu._)`{passingSchemas: ${l.passing}}`},e2={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Qx,code(l){const{gen:i,schema:a,parentSchema:o,it:u}=l;if(!Array.isArray(a))throw new Error("ajv implementation error");if(u.opts.discriminator&&o.discriminator)return;const f=a,p=i.let("valid",!1),n=i.let("passing",null),_=i.name("_valid");l.setParams({passing:n}),i.block(v),l.result(p,()=>l.reset(),()=>l.error(!0));function v(){f.forEach((S,T)=>{let I;(0,Yx.alwaysValidSchema)(u,S)?i.var(_,!0):I=l.subschema({keyword:"oneOf",schemaProp:T,compositeRule:!0},_),T>0&&i.if((0,qu._)`${_} && ${p}`).assign(p,!1).assign(n,(0,qu._)`[${n}, ${T}]`).else(),i.if(_,()=>{i.assign(p,!0),i.assign(n,T),I&&l.mergeEvaluated(I,qu.Name)})})}}};xd.default=e2;var Sd={};Object.defineProperty(Sd,"__esModule",{value:!0});const t2=Gi,i2={keyword:"allOf",schemaType:"array",code(l){const{gen:i,schema:a,it:o}=l;if(!Array.isArray(a))throw new Error("ajv implementation error");const u=i.name("valid");a.forEach((f,p)=>{if((0,t2.alwaysValidSchema)(o,f))return;const n=l.subschema({keyword:"allOf",schemaProp:p},u);l.ok(u),l.mergeEvaluated(n)})}};Sd.default=i2;var Ed={};Object.defineProperty(Ed,"__esModule",{value:!0});const Ku=Fi,My=Gi,r2={message:({params:l})=>(0,Ku.str)`must match "${l.ifClause}" schema`,params:({params:l})=>(0,Ku._)`{failingKeyword: ${l.ifClause}}`},n2={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:r2,code(l){const{gen:i,parentSchema:a,it:o}=l;a.then===void 0&&a.else===void 0&&(0,My.checkStrictMode)(o,'"if" without "then" and "else" is ignored');const u=ng(o,"then"),f=ng(o,"else");if(!u&&!f)return;const p=i.let("valid",!0),n=i.name("_valid");if(_(),l.reset(),u&&f){const S=i.let("ifClause");l.setParams({ifClause:S}),i.if(n,v("then",S),v("else",S))}else u?i.if(n,v("then")):i.if((0,Ku.not)(n),v("else"));l.pass(p,()=>l.error(!0));function _(){const S=l.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},n);l.mergeEvaluated(S)}function v(S,T){return()=>{const I=l.subschema({keyword:S},n);i.assign(p,n),l.mergeValidEvaluated(I,p),T?i.assign(T,(0,Ku._)`${S}`):l.setParams({ifClause:S})}}}};function ng(l,i){const a=l.schema[i];return a!==void 0&&!(0,My.alwaysValidSchema)(l,a)}Ed.default=n2;var kd={};Object.defineProperty(kd,"__esModule",{value:!0});const s2=Gi,a2={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:l,parentSchema:i,it:a}){i.if===void 0&&(0,s2.checkStrictMode)(a,`"${l}" without "if" is ignored`)}};kd.default=a2;Object.defineProperty(dd,"__esModule",{value:!0});const o2=nl,l2=pd,c2=sl,u2=md,h2=gd,f2=Py,d2=_d,p2=lh,m2=yd,g2=vd,_2=bd,y2=wd,v2=xd,b2=Sd,w2=Ed,x2=kd;function S2(l=!1){const i=[_2.default,y2.default,v2.default,b2.default,w2.default,x2.default,d2.default,p2.default,f2.default,m2.default,g2.default];return l?i.push(l2.default,u2.default):i.push(o2.default,c2.default),i.push(h2.default),i}dd.default=S2;var Td={},Cd={};Object.defineProperty(Cd,"__esModule",{value:!0});const Ur=Fi,E2={message:({schemaCode:l})=>(0,Ur.str)`must match format "${l}"`,params:({schemaCode:l})=>(0,Ur._)`{format: ${l}}`},k2={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:E2,code(l,i){const{gen:a,data:o,$data:u,schema:f,schemaCode:p,it:n}=l,{opts:_,errSchemaPath:v,schemaEnv:S,self:T}=n;if(!_.validateFormats)return;u?I():z();function I(){const M=a.scopeValue("formats",{ref:T.formats,code:_.code.formats}),C=a.const("fDef",(0,Ur._)`${M}[${p}]`),R=a.let("fType"),D=a.let("format");a.if((0,Ur._)`typeof ${C} == "object" && !(${C} instanceof RegExp)`,()=>a.assign(R,(0,Ur._)`${C}.type || "string"`).assign(D,(0,Ur._)`${C}.validate`),()=>a.assign(R,(0,Ur._)`"string"`).assign(D,C)),l.fail$data((0,Ur.or)(F(),j()));function F(){return _.strictSchema===!1?Ur.nil:(0,Ur._)`${p} && !${D}`}function j(){const ee=S.$async?(0,Ur._)`(${C}.async ? await ${D}(${o}) : ${D}(${o}))`:(0,Ur._)`${D}(${o})`,oe=(0,Ur._)`(typeof ${D} == "function" ? ${ee} : ${D}.test(${o}))`;return(0,Ur._)`${D} && ${D} !== true && ${R} === ${i} && !${oe}`}}function z(){const M=T.formats[f];if(!M){F();return}if(M===!0)return;const[C,R,D]=j(M);C===i&&l.pass(ee());function F(){if(_.strictSchema===!1){T.logger.warn(oe());return}throw new Error(oe());function oe(){return`unknown format "${f}" ignored in schema at path "${v}"`}}function j(oe){const se=oe instanceof RegExp?(0,Ur.regexpCode)(oe):_.code.formats?(0,Ur._)`${_.code.formats}${(0,Ur.getProperty)(f)}`:void 0,ne=a.scopeValue("formats",{key:f,ref:oe,code:se});return typeof oe=="object"&&!(oe instanceof RegExp)?[oe.type||"string",oe.validate,(0,Ur._)`${ne}.validate`]:["string",oe,ne]}function ee(){if(typeof M=="object"&&!(M instanceof RegExp)&&M.async){if(!S.$async)throw new Error("async format in sync schema");return(0,Ur._)`await ${D}(${o})`}return typeof R=="function"?(0,Ur._)`${D}(${o})`:(0,Ur._)`${D}.test(${o})`}}}};Cd.default=k2;Object.defineProperty(Td,"__esModule",{value:!0});const T2=Cd,C2=[T2.default];Td.default=C2;var tl={};Object.defineProperty(tl,"__esModule",{value:!0});tl.contentVocabulary=tl.metadataVocabulary=void 0;tl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];tl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Yf,"__esModule",{value:!0});const I2=Qf,A2=td,P2=dd,z2=Td,sg=tl,M2=[I2.default,A2.default,(0,P2.default)(),z2.default,sg.metadataVocabulary,sg.contentVocabulary];Yf.default=M2;var Id={},Dy={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.DiscrError=void 0,function(i){i.Tag="tag",i.Mapping="mapping"}(l.DiscrError||(l.DiscrError={}))})(Dy);Object.defineProperty(Id,"__esModule",{value:!0});const Go=Fi,Of=Dy,ag=Nn,D2=Gi,L2={message:({params:{discrError:l,tagName:i}})=>l===Of.DiscrError.Tag?`tag "${i}" must be string`:`value of tag "${i}" must be in oneOf`,params:({params:{discrError:l,tag:i,tagName:a}})=>(0,Go._)`{error: ${l}, tag: ${a}, tagValue: ${i}}`},R2={keyword:"discriminator",type:"object",schemaType:"object",error:L2,code(l){const{gen:i,data:a,schema:o,parentSchema:u,it:f}=l,{oneOf:p}=u;if(!f.opts.discriminator)throw new Error("discriminator: requires discriminator option");const n=o.propertyName;if(typeof n!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!p)throw new Error("discriminator: requires oneOf keyword");const _=i.let("valid",!1),v=i.const("tag",(0,Go._)`${a}${(0,Go.getProperty)(n)}`);i.if((0,Go._)`typeof ${v} == "string"`,()=>S(),()=>l.error(!1,{discrError:Of.DiscrError.Tag,tag:v,tagName:n})),l.ok(_);function S(){const z=I();i.if(!1);for(const M in z)i.elseIf((0,Go._)`${v} === ${M}`),i.assign(_,T(z[M]));i.else(),l.error(!1,{discrError:Of.DiscrError.Mapping,tag:v,tagName:n}),i.endIf()}function T(z){const M=i.name("valid"),C=l.subschema({keyword:"oneOf",schemaProp:z},M);return l.mergeEvaluated(C,Go.Name),M}function I(){var z;const M={},C=D(u);let R=!0;for(let ee=0;eethis.addVocabulary(M)),this.opts.discriminator&&this.addKeyword(u.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const M=this.opts.$data?this.$dataMetaSchema(f,p):f;this.addMetaSchema(M,n,!1),this.refs["http://json-schema.org/schema"]=n}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(n)?n:void 0)}}l.exports=i=_,Object.defineProperty(i,"__esModule",{value:!0}),i.default=_;var v=ys;Object.defineProperty(i,"KeywordCxt",{enumerable:!0,get:function(){return v.KeywordCxt}});var S=Fi;Object.defineProperty(i,"_",{enumerable:!0,get:function(){return S._}}),Object.defineProperty(i,"str",{enumerable:!0,get:function(){return S.str}}),Object.defineProperty(i,"stringify",{enumerable:!0,get:function(){return S.stringify}}),Object.defineProperty(i,"nil",{enumerable:!0,get:function(){return S.nil}}),Object.defineProperty(i,"Name",{enumerable:!0,get:function(){return S.Name}}),Object.defineProperty(i,"CodeGen",{enumerable:!0,get:function(){return S.CodeGen}});var T=Pc;Object.defineProperty(i,"ValidationError",{enumerable:!0,get:function(){return T.default}});var I=zc;Object.defineProperty(i,"MissingRefError",{enumerable:!0,get:function(){return I.default}})})(zf,zf.exports);var j2=zf.exports;const q2=rh(j2);/*! + deps: ${E}}`};const u={keyword:"dependencies",type:"object",schemaType:"object",error:l.error,code(_){const[v,E]=f(_);p(_,v),n(_,E)}};function f({schema:_}){const v={},E={};for(const S in _){if(S==="__proto__")continue;const C=Array.isArray(_[S])?v:E;C[S]=_[S]}return[v,E]}function p(_,v=_.schema){const{gen:E,data:S,it:C}=_;if(Object.keys(v).length===0)return;const z=E.let("missing");for(const P in v){const I=v[P];if(I.length===0)continue;const L=(0,o.propertyInData)(E,S,P,C.opts.ownProperties);_.setParams({property:P,depsCount:I.length,deps:I.join(", ")}),C.allErrors?E.if(L,()=>{for(const D of I)(0,o.checkReportMissingProp)(_,D)}):(E.if((0,i._)`${L} && (${(0,o.checkMissingProp)(_,I,z)})`),(0,o.reportMissingProp)(_,z),E.else())}}l.validatePropertyDeps=p;function n(_,v=_.schema){const{gen:E,data:S,keyword:C,it:z}=_,P=E.name("valid");for(const I in v)(0,a.alwaysValidSchema)(z,v[I])||(E.if((0,o.propertyInData)(E,S,I,z.opts.ownProperties),()=>{const L=_.subschema({keyword:C,schemaProp:I},P);_.mergeValidEvaluated(L,P)},()=>E.var(P,!0)),_.ok(P))}l.validateSchemaDeps=n,l.default=u})(By);var _d={};Object.defineProperty(_d,"__esModule",{value:!0});const Oy=Ni,Zx=Gi,Gx={message:"property name must be valid",params:({params:l})=>(0,Oy._)`{propertyName: ${l.propertyName}}`},Wx={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Gx,code(l){const{gen:i,schema:a,data:o,it:u}=l;if((0,Zx.alwaysValidSchema)(u,a))return;const f=i.name("valid");i.forIn("key",o,p=>{l.setParams({propertyName:p}),l.subschema({keyword:"propertyNames",data:p,dataTypes:["string"],propertyName:p,compositeRule:!0},f),i.if((0,Oy.not)(f),()=>{l.error(!0),u.allErrors||i.break()})}),l.ok(f)}};_d.default=Wx;var lh={};Object.defineProperty(lh,"__esModule",{value:!0});const Lu=Fi,gs=Ni,Hx=Ds,Ru=Gi,Kx={message:"must NOT have additional properties",params:({params:l})=>(0,gs._)`{additionalProperty: ${l.additionalProperty}}`},Xx={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Kx,code(l){const{gen:i,schema:a,parentSchema:o,data:u,errsCount:f,it:p}=l;if(!f)throw new Error("ajv implementation error");const{allErrors:n,opts:_}=p;if(p.props=!0,_.removeAdditional!=="all"&&(0,Ru.alwaysValidSchema)(p,a))return;const v=(0,Lu.allSchemaProperties)(o.properties),E=(0,Lu.allSchemaProperties)(o.patternProperties);S(),l.ok((0,gs._)`${f} === ${Hx.default.errors}`);function S(){i.forIn("key",u,L=>{!v.length&&!E.length?P(L):i.if(C(L),()=>P(L))})}function C(L){let D;if(v.length>8){const F=(0,Ru.schemaRefOrVal)(p,o.properties,"properties");D=(0,Lu.isOwnProperty)(i,F,L)}else v.length?D=(0,gs.or)(...v.map(F=>(0,gs._)`${L} === ${F}`)):D=gs.nil;return E.length&&(D=(0,gs.or)(D,...E.map(F=>(0,gs._)`${(0,Lu.usePattern)(l,F)}.test(${L})`))),(0,gs.not)(D)}function z(L){i.code((0,gs._)`delete ${u}[${L}]`)}function P(L){if(_.removeAdditional==="all"||_.removeAdditional&&a===!1){z(L);return}if(a===!1){l.setParams({additionalProperty:L}),l.error(),n||i.break();return}if(typeof a=="object"&&!(0,Ru.alwaysValidSchema)(p,a)){const D=i.name("valid");_.removeAdditional==="failing"?(I(L,D,!1),i.if((0,gs.not)(D),()=>{l.reset(),z(L)})):(I(L,D),n||i.if((0,gs.not)(D),()=>i.break()))}}function I(L,D,F){const V={keyword:"additionalProperties",dataProp:L,dataPropType:Ru.Type.Str};F===!1&&Object.assign(V,{compositeRule:!0,createErrors:!1,allErrors:!1}),l.subschema(V,D)}}};lh.default=Xx;var yd={};Object.defineProperty(yd,"__esModule",{value:!0});const Jx=ys,Qm=Fi,Tf=Gi,eg=lh,Yx={keyword:"properties",type:"object",schemaType:"object",code(l){const{gen:i,schema:a,parentSchema:o,data:u,it:f}=l;f.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&eg.default.code(new Jx.KeywordCxt(f,eg.default,"additionalProperties"));const p=(0,Qm.allSchemaProperties)(a);for(const S of p)f.definedProperties.add(S);f.opts.unevaluated&&p.length&&f.props!==!0&&(f.props=Tf.mergeEvaluated.props(i,(0,Tf.toHash)(p),f.props));const n=p.filter(S=>!(0,Tf.alwaysValidSchema)(f,a[S]));if(n.length===0)return;const _=i.name("valid");for(const S of n)v(S)?E(S):(i.if((0,Qm.propertyInData)(i,u,S,f.opts.ownProperties)),E(S),f.allErrors||i.else().var(_,!0),i.endIf()),l.it.definedProperties.add(S),l.ok(_);function v(S){return f.opts.useDefaults&&!f.compositeRule&&a[S].default!==void 0}function E(S){l.subschema({keyword:"properties",schemaProp:S,dataProp:S},_)}}};yd.default=Yx;var vd={};Object.defineProperty(vd,"__esModule",{value:!0});const tg=Fi,Bu=Ni,ig=Gi,rg=Gi,Qx={keyword:"patternProperties",type:"object",schemaType:"object",code(l){const{gen:i,schema:a,data:o,parentSchema:u,it:f}=l,{opts:p}=f,n=(0,tg.allSchemaProperties)(a),_=n.filter(I=>(0,ig.alwaysValidSchema)(f,a[I]));if(n.length===0||_.length===n.length&&(!f.opts.unevaluated||f.props===!0))return;const v=p.strictSchema&&!p.allowMatchingProperties&&u.properties,E=i.name("valid");f.props!==!0&&!(f.props instanceof Bu.Name)&&(f.props=(0,rg.evaluatedPropsToName)(i,f.props));const{props:S}=f;C();function C(){for(const I of n)v&&z(I),f.allErrors?P(I):(i.var(E,!0),P(I),i.if(E))}function z(I){for(const L in v)new RegExp(I).test(L)&&(0,ig.checkStrictMode)(f,`property ${L} matches pattern ${I} (use allowMatchingProperties)`)}function P(I){i.forIn("key",o,L=>{i.if((0,Bu._)`${(0,tg.usePattern)(l,I)}.test(${L})`,()=>{const D=_.includes(I);D||l.subschema({keyword:"patternProperties",schemaProp:I,dataProp:L,dataPropType:rg.Type.Str},E),f.opts.unevaluated&&S!==!0?i.assign((0,Bu._)`${S}[${L}]`,!0):!D&&!f.allErrors&&i.if((0,Bu.not)(E),()=>i.break())})})}}};vd.default=Qx;var bd={};Object.defineProperty(bd,"__esModule",{value:!0});const e2=Gi,t2={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(l){const{gen:i,schema:a,it:o}=l;if((0,e2.alwaysValidSchema)(o,a)){l.fail();return}const u=i.name("valid");l.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},u),l.failResult(u,()=>l.reset(),()=>l.error())},error:{message:"must NOT be valid"}};bd.default=t2;var wd={};Object.defineProperty(wd,"__esModule",{value:!0});const i2=Fi,r2={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:i2.validateUnion,error:{message:"must match a schema in anyOf"}};wd.default=r2;var xd={};Object.defineProperty(xd,"__esModule",{value:!0});const qu=Ni,n2=Gi,s2={message:"must match exactly one schema in oneOf",params:({params:l})=>(0,qu._)`{passingSchemas: ${l.passing}}`},a2={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:s2,code(l){const{gen:i,schema:a,parentSchema:o,it:u}=l;if(!Array.isArray(a))throw new Error("ajv implementation error");if(u.opts.discriminator&&o.discriminator)return;const f=a,p=i.let("valid",!1),n=i.let("passing",null),_=i.name("_valid");l.setParams({passing:n}),i.block(v),l.result(p,()=>l.reset(),()=>l.error(!0));function v(){f.forEach((E,S)=>{let C;(0,n2.alwaysValidSchema)(u,E)?i.var(_,!0):C=l.subschema({keyword:"oneOf",schemaProp:S,compositeRule:!0},_),S>0&&i.if((0,qu._)`${_} && ${p}`).assign(p,!1).assign(n,(0,qu._)`[${n}, ${S}]`).else(),i.if(_,()=>{i.assign(p,!0),i.assign(n,S),C&&l.mergeEvaluated(C,qu.Name)})})}}};xd.default=a2;var Ed={};Object.defineProperty(Ed,"__esModule",{value:!0});const o2=Gi,l2={keyword:"allOf",schemaType:"array",code(l){const{gen:i,schema:a,it:o}=l;if(!Array.isArray(a))throw new Error("ajv implementation error");const u=i.name("valid");a.forEach((f,p)=>{if((0,o2.alwaysValidSchema)(o,f))return;const n=l.subschema({keyword:"allOf",schemaProp:p},u);l.ok(u),l.mergeEvaluated(n)})}};Ed.default=l2;var Sd={};Object.defineProperty(Sd,"__esModule",{value:!0});const Ku=Ni,Fy=Gi,c2={message:({params:l})=>(0,Ku.str)`must match "${l.ifClause}" schema`,params:({params:l})=>(0,Ku._)`{failingKeyword: ${l.ifClause}}`},u2={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:c2,code(l){const{gen:i,parentSchema:a,it:o}=l;a.then===void 0&&a.else===void 0&&(0,Fy.checkStrictMode)(o,'"if" without "then" and "else" is ignored');const u=ng(o,"then"),f=ng(o,"else");if(!u&&!f)return;const p=i.let("valid",!0),n=i.name("_valid");if(_(),l.reset(),u&&f){const E=i.let("ifClause");l.setParams({ifClause:E}),i.if(n,v("then",E),v("else",E))}else u?i.if(n,v("then")):i.if((0,Ku.not)(n),v("else"));l.pass(p,()=>l.error(!0));function _(){const E=l.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},n);l.mergeEvaluated(E)}function v(E,S){return()=>{const C=l.subschema({keyword:E},n);i.assign(p,n),l.mergeValidEvaluated(C,p),S?i.assign(S,(0,Ku._)`${E}`):l.setParams({ifClause:E})}}}};function ng(l,i){const a=l.schema[i];return a!==void 0&&!(0,Fy.alwaysValidSchema)(l,a)}Sd.default=u2;var kd={};Object.defineProperty(kd,"__esModule",{value:!0});const h2=Gi,f2={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:l,parentSchema:i,it:a}){i.if===void 0&&(0,h2.checkStrictMode)(a,`"${l}" without "if" is ignored`)}};kd.default=f2;Object.defineProperty(dd,"__esModule",{value:!0});const d2=nl,p2=pd,m2=sl,g2=md,_2=gd,y2=By,v2=_d,b2=lh,w2=yd,x2=vd,E2=bd,S2=wd,k2=xd,T2=Ed,C2=Sd,I2=kd;function A2(l=!1){const i=[E2.default,S2.default,k2.default,T2.default,C2.default,I2.default,v2.default,b2.default,y2.default,w2.default,x2.default];return l?i.push(p2.default,g2.default):i.push(d2.default,m2.default),i.push(_2.default),i}dd.default=A2;var Td={},Cd={};Object.defineProperty(Cd,"__esModule",{value:!0});const Vr=Ni,P2={message:({schemaCode:l})=>(0,Vr.str)`must match format "${l}"`,params:({schemaCode:l})=>(0,Vr._)`{format: ${l}}`},z2={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:P2,code(l,i){const{gen:a,data:o,$data:u,schema:f,schemaCode:p,it:n}=l,{opts:_,errSchemaPath:v,schemaEnv:E,self:S}=n;if(!_.validateFormats)return;u?C():z();function C(){const P=a.scopeValue("formats",{ref:S.formats,code:_.code.formats}),I=a.const("fDef",(0,Vr._)`${P}[${p}]`),L=a.let("fType"),D=a.let("format");a.if((0,Vr._)`typeof ${I} == "object" && !(${I} instanceof RegExp)`,()=>a.assign(L,(0,Vr._)`${I}.type || "string"`).assign(D,(0,Vr._)`${I}.validate`),()=>a.assign(L,(0,Vr._)`"string"`).assign(D,I)),l.fail$data((0,Vr.or)(F(),V()));function F(){return _.strictSchema===!1?Vr.nil:(0,Vr._)`${p} && !${D}`}function V(){const ee=E.$async?(0,Vr._)`(${I}.async ? await ${D}(${o}) : ${D}(${o}))`:(0,Vr._)`${D}(${o})`,se=(0,Vr._)`(typeof ${D} == "function" ? ${ee} : ${D}.test(${o}))`;return(0,Vr._)`${D} && ${D} !== true && ${L} === ${i} && !${se}`}}function z(){const P=S.formats[f];if(!P){F();return}if(P===!0)return;const[I,L,D]=V(P);I===i&&l.pass(ee());function F(){if(_.strictSchema===!1){S.logger.warn(se());return}throw new Error(se());function se(){return`unknown format "${f}" ignored in schema at path "${v}"`}}function V(se){const ne=se instanceof RegExp?(0,Vr.regexpCode)(se):_.code.formats?(0,Vr._)`${_.code.formats}${(0,Vr.getProperty)(f)}`:void 0,le=a.scopeValue("formats",{key:f,ref:se,code:ne});return typeof se=="object"&&!(se instanceof RegExp)?[se.type||"string",se.validate,(0,Vr._)`${le}.validate`]:["string",se,le]}function ee(){if(typeof P=="object"&&!(P instanceof RegExp)&&P.async){if(!E.$async)throw new Error("async format in sync schema");return(0,Vr._)`await ${D}(${o})`}return typeof L=="function"?(0,Vr._)`${D}(${o})`:(0,Vr._)`${D}.test(${o})`}}}};Cd.default=z2;Object.defineProperty(Td,"__esModule",{value:!0});const M2=Cd,D2=[M2.default];Td.default=D2;var tl={};Object.defineProperty(tl,"__esModule",{value:!0});tl.contentVocabulary=tl.metadataVocabulary=void 0;tl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];tl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Yf,"__esModule",{value:!0});const L2=Qf,R2=td,B2=dd,O2=Td,sg=tl,F2=[L2.default,R2.default,(0,B2.default)(),O2.default,sg.metadataVocabulary,sg.contentVocabulary];Yf.default=F2;var Id={},Ny={};(function(l){Object.defineProperty(l,"__esModule",{value:!0}),l.DiscrError=void 0,function(i){i.Tag="tag",i.Mapping="mapping"}(l.DiscrError||(l.DiscrError={}))})(Ny);Object.defineProperty(Id,"__esModule",{value:!0});const Go=Ni,Of=Ny,ag=Nn,N2=Gi,U2={message:({params:{discrError:l,tagName:i}})=>l===Of.DiscrError.Tag?`tag "${i}" must be string`:`value of tag "${i}" must be in oneOf`,params:({params:{discrError:l,tag:i,tagName:a}})=>(0,Go._)`{error: ${l}, tag: ${a}, tagValue: ${i}}`},V2={keyword:"discriminator",type:"object",schemaType:"object",error:U2,code(l){const{gen:i,data:a,schema:o,parentSchema:u,it:f}=l,{oneOf:p}=u;if(!f.opts.discriminator)throw new Error("discriminator: requires discriminator option");const n=o.propertyName;if(typeof n!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!p)throw new Error("discriminator: requires oneOf keyword");const _=i.let("valid",!1),v=i.const("tag",(0,Go._)`${a}${(0,Go.getProperty)(n)}`);i.if((0,Go._)`typeof ${v} == "string"`,()=>E(),()=>l.error(!1,{discrError:Of.DiscrError.Tag,tag:v,tagName:n})),l.ok(_);function E(){const z=C();i.if(!1);for(const P in z)i.elseIf((0,Go._)`${v} === ${P}`),i.assign(_,S(z[P]));i.else(),l.error(!1,{discrError:Of.DiscrError.Mapping,tag:v,tagName:n}),i.endIf()}function S(z){const P=i.name("valid"),I=l.subschema({keyword:"oneOf",schemaProp:z},P);return l.mergeEvaluated(I,Go.Name),P}function C(){var z;const P={},I=D(u);let L=!0;for(let ee=0;eethis.addVocabulary(P)),this.opts.discriminator&&this.addKeyword(u.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const P=this.opts.$data?this.$dataMetaSchema(f,p):f;this.addMetaSchema(P,n,!1),this.refs["http://json-schema.org/schema"]=n}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(n)?n:void 0)}}l.exports=i=_,Object.defineProperty(i,"__esModule",{value:!0}),i.default=_;var v=ys;Object.defineProperty(i,"KeywordCxt",{enumerable:!0,get:function(){return v.KeywordCxt}});var E=Ni;Object.defineProperty(i,"_",{enumerable:!0,get:function(){return E._}}),Object.defineProperty(i,"str",{enumerable:!0,get:function(){return E.str}}),Object.defineProperty(i,"stringify",{enumerable:!0,get:function(){return E.stringify}}),Object.defineProperty(i,"nil",{enumerable:!0,get:function(){return E.nil}}),Object.defineProperty(i,"Name",{enumerable:!0,get:function(){return E.Name}}),Object.defineProperty(i,"CodeGen",{enumerable:!0,get:function(){return E.CodeGen}});var S=Pc;Object.defineProperty(i,"ValidationError",{enumerable:!0,get:function(){return S.default}});var C=zc;Object.defineProperty(i,"MissingRefError",{enumerable:!0,get:function(){return C.default}})})(zf,zf.exports);var K2=zf.exports;const X2=rh(K2);/*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js - */var Z2=Object.prototype.toString,al=Array.isArray||function(i){return Z2.call(i)==="[object Array]"};function Ad(l){return typeof l=="function"}function G2(l){return al(l)?"array":typeof l}function Cf(l){return l.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function og(l,i){return l!=null&&typeof l=="object"&&i in l}function W2(l,i){return l!=null&&typeof l!="object"&&l.hasOwnProperty&&l.hasOwnProperty(i)}var H2=RegExp.prototype.test;function K2(l,i){return H2.call(l,i)}var X2=/\S/;function J2(l){return!K2(X2,l)}var Y2={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Q2(l){return String(l).replace(/[&<>"'`=\/]/g,function(a){return Y2[a]})}var eS=/\s*/,tS=/\s+/,lg=/\s*=/,iS=/\s*\}/,rS=/#|\^|\/|>|\{|&|=|!/;function nS(l,i){if(!l)return[];var a=!1,o=[],u=[],f=[],p=!1,n=!1,_="",v=0;function S(){if(p&&!n)for(;f.length;)delete u[f.pop()];else f=[];p=!1,n=!1}var T,I,z;function M(re){if(typeof re=="string"&&(re=re.split(tS,2)),!al(re)||re.length!==2)throw new Error("Invalid tags: "+re);T=new RegExp(Cf(re[0])+"\\s*"),I=new RegExp("\\s*"+Cf(re[1])),z=new RegExp("\\s*"+Cf("}"+re[1]))}M(i||is.tags);for(var C=new Dc(l),R,D,F,j,ee,oe;!C.eos();){if(R=C.pos,F=C.scanUntil(T),F)for(var se=0,ne=F.length;se"?ee=[D,F,R,C.pos,_,v,a]:ee=[D,F,R,C.pos],v++,u.push(ee),D==="#"||D==="^")o.push(ee);else if(D==="/"){if(oe=o.pop(),!oe)throw new Error('Unopened section "'+F+'" at '+R);if(oe[1]!==F)throw new Error('Unclosed section "'+oe[1]+'" at '+R)}else D==="name"||D==="{"||D==="&"?n=!0:D==="="&&M(F)}if(S(),oe=o.pop(),oe)throw new Error('Unclosed section "'+oe[1]+'" at '+C.pos);return aS(sS(u))}function sS(l){for(var i=[],a,o,u=0,f=l.length;u0?o[o.length-1][4]:i;break;default:a.push(u)}return i}function Dc(l){this.string=l,this.tail=l,this.pos=0}Dc.prototype.eos=function(){return this.tail===""};Dc.prototype.scan=function(i){var a=this.tail.match(i);if(!a||a.index!==0)return"";var o=a[0];return this.tail=this.tail.substring(o.length),this.pos+=o.length,o};Dc.prototype.scanUntil=function(i){var a=this.tail.search(i),o;switch(a){case-1:o=this.tail,this.tail="";break;case 0:o="";break;default:o=this.tail.substring(0,a),this.tail=this.tail.substring(a)}return this.pos+=o.length,o};function il(l,i){this.view=l,this.cache={".":this.view},this.parent=i}il.prototype.push=function(i){return new il(i,this)};il.prototype.lookup=function(i){var a=this.cache,o;if(a.hasOwnProperty(i))o=a[i];else{for(var u=this,f,p,n,_=!1;u;){if(i.indexOf(".")>0)for(f=u.view,p=i.split("."),n=0;f!=null&&n"?v=this.renderPartial(n,a,o,f):_==="&"?v=this.unescapedValue(n,a):_==="name"?v=this.escapedValue(n,a,f):_==="text"&&(v=this.rawValue(n)),v!==void 0&&(p+=v);return p};Dn.prototype.renderSection=function(i,a,o,u,f){var p=this,n="",_=a.lookup(i[1]);function v(I){return p.render(I,a,o,f)}if(_){if(al(_))for(var S=0,T=_.length;S":">",'"':""","'":"'","/":"/","`":"`","=":"="};function sE(l){return String(l).replace(/[&<>"'`=\/]/g,function(a){return nE[a]})}var aE=/\s*/,oE=/\s+/,lg=/\s*=/,lE=/\s*\}/,cE=/#|\^|\/|>|\{|&|=|!/;function uE(l,i){if(!l)return[];var a=!1,o=[],u=[],f=[],p=!1,n=!1,_="",v=0;function E(){if(p&&!n)for(;f.length;)delete u[f.pop()];else f=[];p=!1,n=!1}var S,C,z;function P(ge){if(typeof ge=="string"&&(ge=ge.split(oE,2)),!al(ge)||ge.length!==2)throw new Error("Invalid tags: "+ge);S=new RegExp(Cf(ge[0])+"\\s*"),C=new RegExp("\\s*"+Cf(ge[1])),z=new RegExp("\\s*"+Cf("}"+ge[1]))}P(i||is.tags);for(var I=new Dc(l),L,D,F,V,ee,se;!I.eos();){if(L=I.pos,F=I.scanUntil(S),F)for(var ne=0,le=F.length;ne"?ee=[D,F,L,I.pos,_,v,a]:ee=[D,F,L,I.pos],v++,u.push(ee),D==="#"||D==="^")o.push(ee);else if(D==="/"){if(se=o.pop(),!se)throw new Error('Unopened section "'+F+'" at '+L);if(se[1]!==F)throw new Error('Unclosed section "'+se[1]+'" at '+L)}else D==="name"||D==="{"||D==="&"?n=!0:D==="="&&P(F)}if(E(),se=o.pop(),se)throw new Error('Unclosed section "'+se[1]+'" at '+I.pos);return fE(hE(u))}function hE(l){for(var i=[],a,o,u=0,f=l.length;u0?o[o.length-1][4]:i;break;default:a.push(u)}return i}function Dc(l){this.string=l,this.tail=l,this.pos=0}Dc.prototype.eos=function(){return this.tail===""};Dc.prototype.scan=function(i){var a=this.tail.match(i);if(!a||a.index!==0)return"";var o=a[0];return this.tail=this.tail.substring(o.length),this.pos+=o.length,o};Dc.prototype.scanUntil=function(i){var a=this.tail.search(i),o;switch(a){case-1:o=this.tail,this.tail="";break;case 0:o="";break;default:o=this.tail.substring(0,a),this.tail=this.tail.substring(a)}return this.pos+=o.length,o};function il(l,i){this.view=l,this.cache={".":this.view},this.parent=i}il.prototype.push=function(i){return new il(i,this)};il.prototype.lookup=function(i){var a=this.cache,o;if(a.hasOwnProperty(i))o=a[i];else{for(var u=this,f,p,n,_=!1;u;){if(i.indexOf(".")>0)for(f=u.view,p=i.split("."),n=0;f!=null&&n"?v=this.renderPartial(n,a,o,f):_==="&"?v=this.unescapedValue(n,a):_==="name"?v=this.escapedValue(n,a,f):_==="text"&&(v=this.rawValue(n)),v!==void 0&&(p+=v);return p};Dn.prototype.renderSection=function(i,a,o,u,f){var p=this,n="",_=a.lookup(i[1]);function v(C){return p.render(C,a,o,f)}if(_){if(al(_))for(var E=0,S=_.length;E0||!o)&&(f[p]=u+f[p]);return f.join(` -`)};Dn.prototype.renderPartial=function(i,a,o,u){if(o){var f=this.getConfigTags(u),p=Ad(o)?o(i[1]):o[i[1]];if(p!=null){var n=i[6],_=i[5],v=i[4],S=p;_==0&&v&&(S=this.indentPartial(p,v,n));var T=this.parse(S,f);return this.renderTokens(T,a,o,S,u)}}};Dn.prototype.unescapedValue=function(i,a){var o=a.lookup(i[1]);if(o!=null)return o};Dn.prototype.escapedValue=function(i,a,o){var u=this.getConfigEscape(o)||is.escape,f=a.lookup(i[1]);if(f!=null)return typeof f=="number"&&u===is.escape?String(f):u(f)};Dn.prototype.rawValue=function(i){return i[1]};Dn.prototype.getConfigTags=function(i){return al(i)?i:i&&typeof i=="object"?i.tags:void 0};Dn.prototype.getConfigEscape=function(i){if(i&&typeof i=="object"&&!al(i))return i.escape};var is={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(l){kc.templateCache=l},get templateCache(){return kc.templateCache}},kc=new Dn;is.clearCache=function(){return kc.clearCache()};is.parse=function(i,a){return kc.parse(i,a)};is.render=function(i,a,o,u){if(typeof i!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+G2(i)+'" was given as the first argument for mustache#render(template, view, partials)');return kc.render(i,a,o,u)};is.escape=Q2;is.Scanner=Dc;is.Context=il;is.Writer=Dn;let Ou=null;function Zo(l,i){return String.fromCodePoint("A".codePointAt(0)-1+l)+i}function oS(l,i){if(i==="text")return l.map(a=>({isText:!0,displayValue:a}));if(i==="number_with_commas")return l.map(a=>({isNumeric:!0,rawValue:a,displayValue:a.toLocaleString("en-GB"),style:i}));if(i==="number_1dp")return l.map(a=>({isNumeric:!0,rawValue:a,displayValue:a.toFixed(1),style:i}));throw new Error("Unrecognised column style: "+i)}function cg(l,i){i(l.sheetName,a=>{l.sheetName=a});for(let a=0;a{l.sheetIntroText[a]=o});for(const a of l.columns)if(i(a.heading,o=>{a.heading=o}),a.style==="text")for(let o=0;o{a.values[o]=u})}function lS(l,i){if(!l)return[];const a=/\[\[[^\]]+\]\]/g;let o=l.map(({name:f,text:p})=>({name:f,text:p,used:!1}));const u=new Map(o.map(f=>[`[[${f.name}]]`,f]));for(const f of i)f.sheetIntroText||(f.sheetIntroText=[]),f.hasNotes=!1,cg(f,p=>{for(const n of p.match(a)||[])u.get(n).used=!0,f.hasNotes=!0});o=o.filter(f=>f.used),o.forEach((f,p)=>f.name=`[note ${p+1}]`);for(const f of i)if(f.hasNotes){const p=n=>u.get(n).name;cg(f,(n,_)=>{_(n.replace(a,p))})}return o}function cS(l){return(Math.max(...l.map(a=>Uu(a)))/37.8+.5).toFixed(2)}function ug(l){const i=l.split(" "),a=15.45*37.8,o=Uu(" ");let u=1,f=Uu(i[0]);for(const p of i.slice(1)){const n=Uu(p);f+=o+n,f>a&&(++u,f=n)}return u}function uS(l){return l.flatMap(i=>i.split(` -`)).map((i,a)=>{if(i.startsWith("## "))return{isSubtitle:!0,text:i.slice(3)};if(/^\[.*\]\(.*\)$/.test(i)){const o=i.slice(1,-1).split("](");return{isHyperlink:!0,text:o[0],href:o[1],rowCount:ug(".")}}return{isText:!0,text:i,rowCount:ug(i)}})}function hS(l){let i="This worksheet contains one table.";return l?i+" Some cells refer to notes, which can be found on the notes worksheet.":i}function fS(l){if(Ou||(Ou=new q2().compile(Yv)),!Ou(l))throw console.log(Ou.errors),new Error("Input did not match the schema");const a={coverSheetTitle:l.coverSheetTitle,firstTocCell:Zo(1,3),lastTocCell:Zo(2,3+l.sheets.length),coverSheetContents:uS(l.coverSheetContents),sheets:JSON.parse(JSON.stringify(l.sheets))};a.coverSheetRowStyles=[...new Set(a.coverSheetContents.map(o=>o.rowCount).filter(Boolean))].map(o=>({styleName:"coverSheetRowStyle_"+o,rowHeightCm:o*.53+.4})),a.notes=lS(l.notes,a.sheets),a.notes.length>0&&(a.hasNotes=!0,a.firstNotesTableCell=Zo(1,3),a.lastNotesTableCell=Zo(2,3+a.notes.length)),a.tableCount=a.sheets.length+2+a.hasNotes;for(let o=0;o({text:f,isLastIntroRow:p===u.sheetIntroText.length-1})),u.firstTableCell=Zo(1,2+u.sheetIntroText.length),u.lastTableCell=Zo(u.columns.length,2+u.columns[0].values.length+u.sheetIntroText.length);for(const f of u.columns)f.valuesFormatted=oS(f.values,f.style),f.isNumeric=f.style!=="text",f.headingLines=f.heading.split(` -`);u.rows=[];for(let f=0;fp.valuesFormatted[f])});u.columnStyles=u.columns.map((f,p)=>{const n=Math.max(2.4,cS(f.valuesFormatted.map(_=>_.displayValue)));return{name:"colStyle"+o+"_"+p,widthCm:n}})}return Jv.map(o=>({filename:o.filename,contents:is.render(o.contents,a)}))}const hg="https://ons-dp-prod-cdn.s3.eu-west-2.amazonaws.com/maptiles/pgp-data/";function dS(l){let i=[...l].sort((o,u)=>o.key.localeCompare(u.key));return{selString:l.length==0?"data":i.map((o,u)=>u0?i[i.length-1].code:null}}async function Ly(l,i=[],a=window.fetch){if(i.length>0&&!i[0].newFormat)throw new Error("OLD FORMAT!");let{selString:o,lastCode:u}=dS(i),f={data:{}},p;if(i.length===0){let n=`${hg}${i.length}var_percent/${o}.json`;p=await(await a(n)).json(),f.total_pop={count:p.sex.count[0]+p.sex.count[1],percent:100}}else{let n=`${hg}${i.length}var-combined_percent/${o}.json`,v=await(await a(n)).json();p=v.bar_chart_data[u],f.mapData=v.map_data[u],f.total_pop=p.total_pop}for(let n of l){f.data[n.key]={};for(let _ of n.tables)f.data[n.key][_.code]={values:p[_.code]}}return f}function pS(l,i,a){for(let o=1;ol.label===i.label?0:l.label==="Not answered"?1:i.label==="Not answered"?-1:l.label==="Other religion"?1:i.label==="Other religion"?-1:l.label.localeCompare(i.label,"en-GB");function Xu(l,i,a){let o=a.all[l][i].values,u=a.selected[l][i].values,f=[],p=j_[i].map((n,_)=>({...n,index:_}));return i==="religion_tb"&&(p=[...p].sort(Ry)),p.forEach(n=>{let _=n.label,v=o.percent[n.index],S=u.percent[n.index];a.selected.total_pop!=a.all.total_pop&&f.push({group:"This group",category:_,value:S}),f.push({group:"Whole population",category:_,value:v})}),f}function dg(l){if(l===100)return"100";const i=l.toFixed(1);return i!=="0.0"?i:"Less than 0.05"}function eo(l){return l.split(": ").slice(-1)[0]}function Nf(l,i){const a=i.selected.residents[l].values;return a!=="blocked"&&a!==void 0&&a.percent[0]!=null}function gS(l){return["This spreadsheet contains the data for a profile generated using the tool 'Create a population group profile' on the Office for National Statistics website.",`[View this profile on the ONS website](${document.location.href})`,"## Source","Census 2021 from the Office for National Statistics","## Selected population group","This profile is for people who share the following characteristic"+(l.length>1?"s.":"."),...l.map(a=>` - ${a.topic}: ${eo(a.label)}`),"## More Census data","[Other census datasets are available on the ONS website.](https://www.ons.gov.uk/census)","## Contact","[Email Census Customer Services](mailto:census.customerservices@ons.gov.uk?subject=Create%20a%20population%20group%20profile)","Phone +44 1329 444972"]}function _S(l,i){let a=["Source: Census 2021 from the Office for National Statistics"];return l==="resident_age_18b"&&i.some(o=>o.topic==="Age")&&a.push("Note: the data in this table is not filtered by the selected age range ("+i.filter(o=>o.topic==="Age")[0].label+")."),a}function yS(l,i,a){console.log({data:l,datasets:i,selected:a});const o={coverSheetTitle:"Data Downloaded from 'Create a Population Group Profile'",coverSheetContents:gS(a),tableHeadings:["Category","Selected group %","England and Wales %","Selected group count","England and Wales count"],sheets:[]};o.sheets.push({sheetName:"Total population",tableName:"total_population",sheetIntroText:["Source: Census 2021 from the Office for National Statistics"],columns:[{heading:"Group",style:"text",values:["Selected group"]},{heading:"Count",style:"number_with_commas",values:[l.selected.total_pop.count]},{heading:"% of England and Wales population",style:"number_1dp",values:[l.selected.total_pop.percent]}]});let u=l.geoPerc.filter(f=>f.value!=null).sort((f,p)=>f.name.localeCompare(p.name,"en-GB"));u.length>0&&o.sheets.push({sheetName:"Percentage of Population, by Local Authority",tableName:"percentage_of_population",sheetIntroText:["Source: Census 2021 from the Office for National Statistics"],columns:[{heading:"Local Authority",style:"text",values:u.map(f=>f.name)},{heading:"% of Local Authority Population",style:"number_1dp",values:u.map(f=>f.value)},{heading:"Count",style:"number_with_commas",values:u.map(f=>f.count)}]});for(let f of i[0].tables){if(f.code==="resident_age_23a"||!Nf(f.code,l)||l.selected.residents[f.code].values==null)continue;let p={sheetName:Ff(f.key).replace("Age (B)","Age"),tableName:f.code,sheetIntroText:_S(f.code,a),columns:[{heading:"Category",style:"text",values:j_[f.code].map(n=>n.label)},{heading:`Selected group +`)};Dn.prototype.renderPartial=function(i,a,o,u){if(o){var f=this.getConfigTags(u),p=Ad(o)?o(i[1]):o[i[1]];if(p!=null){var n=i[6],_=i[5],v=i[4],E=p;_==0&&v&&(E=this.indentPartial(p,v,n));var S=this.parse(E,f);return this.renderTokens(S,a,o,E,u)}}};Dn.prototype.unescapedValue=function(i,a){var o=a.lookup(i[1]);if(o!=null)return o};Dn.prototype.escapedValue=function(i,a,o){var u=this.getConfigEscape(o)||is.escape,f=a.lookup(i[1]);if(f!=null)return typeof f=="number"&&u===is.escape?String(f):u(f)};Dn.prototype.rawValue=function(i){return i[1]};Dn.prototype.getConfigTags=function(i){return al(i)?i:i&&typeof i=="object"?i.tags:void 0};Dn.prototype.getConfigEscape=function(i){if(i&&typeof i=="object"&&!al(i))return i.escape};var is={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(l){kc.templateCache=l},get templateCache(){return kc.templateCache}},kc=new Dn;is.clearCache=function(){return kc.clearCache()};is.parse=function(i,a){return kc.parse(i,a)};is.render=function(i,a,o,u){if(typeof i!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Y2(i)+'" was given as the first argument for mustache#render(template, view, partials)');return kc.render(i,a,o,u)};is.escape=sE;is.Scanner=Dc;is.Context=il;is.Writer=Dn;let Ou=null;function Zo(l,i){return String.fromCodePoint("A".codePointAt(0)-1+l)+i}function dE(l,i){if(i==="text")return l.map(a=>({isText:!0,displayValue:a}));if(i==="number_with_commas")return l.map(a=>({isNumeric:!0,rawValue:a,displayValue:a.toLocaleString("en-GB"),style:i}));if(i==="number_1dp")return l.map(a=>({isNumeric:!0,rawValue:a,displayValue:a.toFixed(1),style:i}));throw new Error("Unrecognised column style: "+i)}function cg(l,i){i(l.sheetName,a=>{l.sheetName=a});for(let a=0;a{l.sheetIntroText[a]=o});for(const a of l.columns)if(i(a.heading,o=>{a.heading=o}),a.style==="text")for(let o=0;o{a.values[o]=u})}function pE(l,i){if(!l)return[];const a=/\[\[[^\]]+\]\]/g;let o=l.map(({name:f,text:p})=>({name:f,text:p,used:!1}));const u=new Map(o.map(f=>[`[[${f.name}]]`,f]));for(const f of i)f.sheetIntroText||(f.sheetIntroText=[]),f.hasNotes=!1,cg(f,p=>{for(const n of p.match(a)||[])u.get(n).used=!0,f.hasNotes=!0});o=o.filter(f=>f.used),o.forEach((f,p)=>f.name=`[note ${p+1}]`);for(const f of i)if(f.hasNotes){const p=n=>u.get(n).name;cg(f,(n,_)=>{_(n.replace(a,p))})}return o}function mE(l){return(Math.max(...l.map(a=>Uu(a)))/37.8+.5).toFixed(2)}function ug(l){const i=l.split(" "),a=15.45*37.8,o=Uu(" ");let u=1,f=Uu(i[0]);for(const p of i.slice(1)){const n=Uu(p);f+=o+n,f>a&&(++u,f=n)}return u}function gE(l){return l.flatMap(i=>i.split(` +`)).map((i,a)=>{if(i.startsWith("## "))return{isSubtitle:!0,text:i.slice(3)};if(/^\[.*\]\(.*\)$/.test(i)){const o=i.slice(1,-1).split("](");return{isHyperlink:!0,text:o[0],href:o[1],rowCount:ug(".")}}return{isText:!0,text:i,rowCount:ug(i)}})}function _E(l){let i="This worksheet contains one table.";return l?i+" Some cells refer to notes, which can be found on the notes worksheet.":i}function yE(l){if(Ou||(Ou=new X2().compile(nb)),!Ou(l))throw console.log(Ou.errors),new Error("Input did not match the schema");const a={coverSheetTitle:l.coverSheetTitle,firstTocCell:Zo(1,3),lastTocCell:Zo(2,3+l.sheets.length),coverSheetContents:gE(l.coverSheetContents),sheets:JSON.parse(JSON.stringify(l.sheets))};a.coverSheetRowStyles=[...new Set(a.coverSheetContents.map(o=>o.rowCount).filter(Boolean))].map(o=>({styleName:"coverSheetRowStyle_"+o,rowHeightCm:o*.53+.4})),a.notes=pE(l.notes,a.sheets),a.notes.length>0&&(a.hasNotes=!0,a.firstNotesTableCell=Zo(1,3),a.lastNotesTableCell=Zo(2,3+a.notes.length)),a.tableCount=a.sheets.length+2+a.hasNotes;for(let o=0;o({text:f,isLastIntroRow:p===u.sheetIntroText.length-1})),u.firstTableCell=Zo(1,2+u.sheetIntroText.length),u.lastTableCell=Zo(u.columns.length,2+u.columns[0].values.length+u.sheetIntroText.length);for(const f of u.columns)f.valuesFormatted=dE(f.values,f.style),f.isNumeric=f.style!=="text",f.headingLines=f.heading.split(` +`);u.rows=[];for(let f=0;fp.valuesFormatted[f])});u.columnStyles=u.columns.map((f,p)=>{const n=Math.max(2.4,mE(f.valuesFormatted.map(_=>_.displayValue)));return{name:"colStyle"+o+"_"+p,widthCm:n}})}return rb.map(o=>({filename:o.filename,contents:is.render(o.contents,a)}))}const hg="https://ons-dp-prod-cdn.s3.eu-west-2.amazonaws.com/maptiles/pgp-data/";function vE(l){let i=[...l].sort((o,u)=>o.key.localeCompare(u.key));return{selString:l.length==0?"data":i.map((o,u)=>u0?i[i.length-1].code:null}}async function Uy(l,i=[],a=window.fetch){if(i.length>0&&!i[0].newFormat)throw new Error("OLD FORMAT!");let{selString:o,lastCode:u}=vE(i),f={data:{}},p;if(i.length===0){let n=`${hg}${i.length}var_percent/${o}.json`;p=await(await a(n)).json(),f.total_pop={count:p.sex.count[0]+p.sex.count[1],percent:100}}else{let n=`${hg}${i.length}var-combined_percent/${o}.json`,v=await(await a(n)).json();p=v.bar_chart_data[u],f.mapData=v.map_data[u],f.total_pop=p.total_pop}for(let n of l){f.data[n.key]={};for(let _ of n.tables)f.data[n.key][_.code]={values:p[_.code]}}return f}function bE(l,i,a){for(let o=1;ol.label===i.label?0:l.label==="Not answered"?1:i.label==="Not answered"?-1:l.label==="Other religion"?1:i.label==="Other religion"?-1:l.label.localeCompare(i.label,"en-GB");function Xu(l,i,a){let o=a.all[l][i].values,u=a.selected[l][i].values,f=[],p=K_[i].map((n,_)=>({...n,index:_}));return i==="religion_tb"&&(p=[...p].sort(Vy)),p.forEach(n=>{let _=n.label,v=o.percent[n.index],E=u.percent[n.index];a.selected.total_pop!=a.all.total_pop&&f.push({group:"This group",category:_,value:E}),f.push({group:"Whole population",category:_,value:v})}),f}function dg(l){if(l===100)return"100";const i=l.toFixed(1);return i!=="0.0"?i:"Less than 0.05"}function eo(l){return l.split(": ").slice(-1)[0]}function Nf(l,i){const a=i.selected.residents[l].values;return a!=="blocked"&&a!==void 0&&a.percent[0]!=null}function xE(l){return["This spreadsheet contains the data for a profile generated using the tool 'Create a population group profile' on the Office for National Statistics website.",`[View this profile on the ONS website](${document.location.href})`,"## Source","Census 2021 from the Office for National Statistics","## Selected population group","This profile is for people who share the following characteristic"+(l.length>1?"s.":"."),...l.map(a=>` - ${a.topic}: ${eo(a.label)}`),"## More Census data","[Other census datasets are available on the ONS website.](https://www.ons.gov.uk/census)","## Contact","[Email Census Customer Services](mailto:census.customerservices@ons.gov.uk?subject=Create%20a%20population%20group%20profile)","Phone +44 1329 444972"]}function EE(l,i){let a=["Source: Census 2021 from the Office for National Statistics"];return l==="resident_age_18b"&&i.some(o=>o.topic==="Age")&&a.push("Note: the data in this table is not filtered by the selected age range ("+i.filter(o=>o.topic==="Age")[0].label+")."),a}function SE(l,i,a){console.log({data:l,datasets:i,selected:a});const o={coverSheetTitle:"Data Downloaded from 'Create a Population Group Profile'",coverSheetContents:xE(a),tableHeadings:["Category","Selected group %","England and Wales %","Selected group count","England and Wales count"],sheets:[]};o.sheets.push({sheetName:"Total population",tableName:"total_population",sheetIntroText:["Source: Census 2021 from the Office for National Statistics"],columns:[{heading:"Group",style:"text",values:["Selected group"]},{heading:"Count",style:"number_with_commas",values:[l.selected.total_pop.count]},{heading:"% of England and Wales population",style:"number_1dp",values:[l.selected.total_pop.percent]}]});let u=l.geoPerc.filter(f=>f.value!=null).sort((f,p)=>f.name.localeCompare(p.name,"en-GB"));u.length>0&&o.sheets.push({sheetName:"Percentage of Population, by Local Authority",tableName:"percentage_of_population",sheetIntroText:["Source: Census 2021 from the Office for National Statistics"],columns:[{heading:"Local Authority",style:"text",values:u.map(f=>f.name)},{heading:"% of Local Authority Population",style:"number_1dp",values:u.map(f=>f.value)},{heading:"Count",style:"number_with_commas",values:u.map(f=>f.count)}]});for(let f of i[0].tables){if(f.code==="resident_age_23a"||!Nf(f.code,l)||l.selected.residents[f.code].values==null)continue;let p={sheetName:Ff(f.key).replace("Age (B)","Age"),tableName:f.code,sheetIntroText:EE(f.code,a),columns:[{heading:"Category",style:"text",values:K_[f.code].map(n=>n.label)},{heading:`Selected group (%)`,style:"number_1dp",values:l.selected.residents[f.code].values.percent},{heading:`England and Wales (%)`,style:"number_1dp",values:l.all.residents[f.code].values.percent},{heading:`Selected group (count)`,style:"number_with_commas",values:l.selected.residents[f.code].values.count},{heading:`England and Wales -(count)`,style:"number_with_commas",values:l.all.residents[f.code].values.count}]};o.sheets.push(p)}return fS(o)}async function vS({fetch:l}){let i=await mS(Xo+mc.url,mc.layer,l),a=(await Ly(Ko,[],l)).data,o=[],u={},f=[];return i.features.forEach(p=>{const n=p.properties[mc.code],_=p.properties[mc.name],v={code:n,name:_};o.push(v),u[n]=v,f.push({...v,value:100,color:Wo.seq[4]})}),{geojson:i,geoCodesAndNames:o,geoCodesLookup:u,geoPerc:f,all:a,selected:null}}const rT=Object.freeze(Object.defineProperty({__proto__:null,load:vS},Symbol.toStringTag,{value:"Module"})),bS=X_("goto"),wS=X_("after_navigate");function xS(l){return l.slice().sort(function(i,a){return i-a})}function pg(l,i){for(var a=[],o=0;o0){var f=(a[i]-a[l-1])/(i-l+1);u=o[i]-o[l-1]-(i-l+1)*f*f}else u=o[i]-a[i]*a[i]/(i+1);return u<0?0:u}function Vf(l,i,a,o,u,f,p){if(!(l>i)){var n=Math.floor((l+i)/2);o[a][n]=o[a-1][n-1],u[a][n]=n;var _=a;l>a&&(_=Math.max(_,u[a][l-1]||0)),_=Math.max(_,u[a-1][n]||0);var v=n-1;i=_&&(S=Uf(M,n,f,p),!(S+o[a-1][_-1]>=o[a][n]));--M)T=Uf(_,n,f,p),I=T+o[a-1][_-1],Il.length)throw new Error("cannot generate more classes than there are data values");var a=xS(l),o=SS(a);if(o===1)return[a];var u=pg(i,a.length),f=pg(i,a.length);ES(a,u,f);for(var p=[],n=f[0].length-1,_=f.length-1;_>=0;_--){var v=f[_][n];p[_]=a.slice(v,n+1),_>0&&(n=v-1)}return p}function mg(l,i,a){const o=l.slice();return o[15]=i[a],o}function gg(l,i,a){const o=l.slice();return o[18]=i[a],o[20]=a,o}function _g(l,i,a){const o=l.slice();return o[18]=i[a],o[20]=a,o}function yg(l,i,a){const o=l.slice();return o[15]=i[a],o[20]=a,o}function vg(l){let i,a=Ni(l[9]),o=[];for(let u=0;uF.toFixed(1)}=i,{suffix:I="%"}=i,{base:z=null}=i,{barHeight:M=25}=i,{markerWidth:C=3}=i,{showLegend:R=!0}=i;function D(F,j){let ee={},oe=[];for(const ne of F)ee[ne[j]]||(ee[ne[j]]={label:ne[j],values:[]},oe.push(ne[j])),ee[ne[j]].values.push(ne);let se=[];return oe.forEach(ne=>{se.push(ee[ne])}),se}return l.$$set=F=>{"data"in F&&a(10,n=F.data),"xKey"in F&&a(0,_=F.xKey),"yKey"in F&&a(11,v=F.yKey),"zKey"in F&&a(12,S=F.zKey),"formatTick"in F&&a(1,T=F.formatTick),"suffix"in F&&a(2,I=F.suffix),"base"in F&&a(3,z=F.base),"barHeight"in F&&a(4,M=F.barHeight),"markerWidth"in F&&a(5,C=F.markerWidth),"showLegend"in F&&a(6,R=F.showLegend)},l.$$.update=()=>{l.$$.dirty&1025&&a(13,o=Math.max(...n.map(F=>F[_]))),l.$$.dirty&5120&&a(9,u=n.map(F=>F[S]).filter((F,j,ee)=>ee.indexOf(F)===j)),l.$$.dirty&8192&&a(8,f=F=>F/o*100),l.$$.dirty&3072&&a(7,p=D(n,v))},[_,T,I,z,M,C,R,p,f,u,n,v,S,o]}class PS extends qi{constructor(i){super(),Zi(this,i,AS,IS,Ui,{data:10,xKey:0,yKey:11,zKey:12,formatTick:1,suffix:2,base:3,barHeight:4,markerWidth:5,showLegend:6})}}function zS(l){let i,a,o;return{c(){i=ya("svg"),a=ya("path"),this.h()},l(u){i=va(u,"svg",{class:!0,viewBox:!0,"fill-rule":!0,"clip-rule":!0,"aria-hidden":!0,focusable:!0,style:!0});var f=Ye(i);a=va(f,"path",{d:!0}),Ye(a).forEach(Q),f.forEach(Q),this.h()},h(){me(a,"d",o=l[4][l[0]]),me(i,"class","ico svelte-175xtay"),me(i,"viewBox","0 0 24 24"),me(i,"fill-rule","evenodd"),me(i,"clip-rule","evenodd"),me(i,"aria-hidden","true"),me(i,"focusable","false"),me(i,"style",l[3]),Zt(i,"margin",l[2]),Zt(i,"noclick",!l[1])},m(u,f){Fe(u,i,f),De(i,a)},p(u,[f]){f&1&&o!==(o=u[4][u[0]])&&me(a,"d",o),f&8&&me(i,"style",u[3]),f&4&&Zt(i,"margin",u[2]),f&2&&Zt(i,"noclick",!u[1])},i:wi,o:wi,d(u){u&&Q(i)}}}function MS(l,i,a){let o,{type:u="compass"}=i,{rotation:f=0}=i,{position:p="inline"}=i,{clickable:n=!1}=i,{margin:_=!1}=i;const v={compass:"M22 12c0-5.52-4.48-10-10-10S2 6.48 2 12s4.48 10 10 10 10-4.48 10-10zm-10 1H8v-2h4V8l4 4-4 4v-3z",info:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 15c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm1-8h-2V7h2v2z",chart:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM8 17c-.55 0-1-.45-1-1v-5c0-.55.45-1 1-1s1 .45 1 1v5c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v8c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1z",share:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z",chevron:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z",full:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",full_exit:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z",shuffle:"M10.59 9.17 5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z",replay:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z",save:"M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zm-6 .67 2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z",tick:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",cross:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",arrow:"M5,13h11.2l-2.9,2.9c-0.4,0.4-0.4,1,0,1.4s1,0.4,1.4,0l4.6-4.6c0.4-0.4,0.4-1,0-1.4l-4.6-4.6c-0.4-0.4-1-0.4-1.4,0c0,0,0,0,0,0c-0.4,0.4-0.4,1,0,1.4l2.9,2.9H5c-0.6,0-1,0.4-1,1S4.4,13,5,13z",plus:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1z",minus:"M18 13H6c-.55 0-1-.45-1-1s.45-1 1-1h12c.55 0 1 .45 1 1s-.45 1-1 1z",subdir:"m19 15-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z",touch:"M9 11.24V7.5C9 6.12 10.12 5 11.5 5S14 6.12 14 7.5v3.74c1.21-.81 2-2.18 2-3.74C16 5.01 13.99 3 11.5 3S7 5.01 7 7.5c0 1.56.79 2.93 2 3.74zm9.84 4.63-4.54-2.26c-.17-.07-.35-.11-.54-.11H13v-6c0-.83-.67-1.5-1.5-1.5S10 6.67 10 7.5v10.74c-3.6-.76-3.54-.75-3.67-.75-.31 0-.59.13-.79.33l-.79.8 4.94 4.94c.27.27.65.44 1.06.44h6.79c.75 0 1.33-.55 1.44-1.28l.75-5.27c.01-.07.02-.14.02-.2 0-.62-.38-1.16-.91-1.38z",launch:"M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h5c.55 0 1-.45 1-1s-.45-1-1-1H5c-1.11 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6c0-.55-.45-1-1-1s-1 .45-1 1v5c0 .55-.45 1-1 1zM14 4c0 .55.45 1 1 1h2.59l-9.13 9.13c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L19 6.41V9c0 .55.45 1 1 1s1-.45 1-1V3h-6c-.55 0-1 .45-1 1z",close:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",error:"M 12 2 C 6.48 2 2 6.48 2 12 s 4.48 10 10 10 s 10 -4.48 10 -10 S 17.52 2 12 2 z m 1 15 h -2 v -2 h 2 v 2 z m 0 -4 h -2 V 7 h 2 v 6 z"};return l.$$set=S=>{"type"in S&&a(0,u=S.type),"rotation"in S&&a(5,f=S.rotation),"position"in S&&a(6,p=S.position),"clickable"in S&&a(1,n=S.clickable),"margin"in S&&a(2,_=S.margin)},l.$$.update=()=>{l.$$.dirty&96&&a(3,o=`transform: translate(0, 15%) scale(1.5) rotate(${-f}deg);${["left","right"].includes(p)?` position: absolute; ${p}: 10px;`:""}`)},[u,n,_,o,v,f,p]}class ch extends qi{constructor(i){super(),Zi(this,i,MS,zS,Ui,{type:0,rotation:5,position:6,clickable:1,margin:2})}}function kg(l,i,a){const o=l.slice();return o[11]=i[a],o}function Tg(l){let i,a="Back",o,u;return{c(){i=je("button"),i.textContent=a,this.h()},l(f){i=qe(f,"BUTTON",{class:!0,"data-svelte-h":!0}),Cr(i)!=="svelte-pv0rgn"&&(i.textContent=a),this.h()},h(){me(i,"class","hidden-on-desktop svelte-1iovvug")},m(f,p){Fe(f,i,p),o||(u=Ms(i,"click",function(){G_(l[3])&&l[3].apply(this,arguments)}),o=!0)},p(f,p){l=f},d(f){f&&Q(i),o=!1,u()}}}function Cg(l){let i,a,o,u,f=eo(Ju(l[11],l[4]))+"",p;return{c(){i=je("br"),a=gt(),o=je("div"),u=Ut("Selected: "),p=Ut(f),this.h()},l(n){i=qe(n,"BR",{}),a=_t(n),o=qe(n,"DIV",{class:!0});var _=Ye(o);u=Vt(_,"Selected: "),p=Vt(_,f),_.forEach(Q),this.h()},h(){me(o,"class","selected-item-label svelte-1iovvug")},m(n,_){Fe(n,i,_),Fe(n,a,_),Fe(n,o,_),De(o,u),De(o,p)},p(n,_){_&18&&f!==(f=eo(Ju(n[11],n[4]))+"")&&Ci(p,f)},d(n){n&&(Q(i),Q(a),Q(o))}}}function Ig(l){let i,a=l[6](l[11])+"",o,u,f,p,n,_=Ju(l[11],l[4]),v,S,T;p=new ch({props:{type:"chevron"}});let I=_&&Cg(l);function z(){return l[10](l[11])}return{c(){i=je("button"),o=Ut(a),u=gt(),f=je("span"),ei(p.$$.fragment),n=gt(),I&&I.c(),this.h()},l(M){i=qe(M,"BUTTON",{class:!0});var C=Ye(i);o=Vt(C,a),u=_t(C),f=qe(C,"SPAN",{class:!0});var R=Ye(f);si(p.$$.fragment,R),R.forEach(Q),n=_t(C),I&&I.l(C),C.forEach(Q),this.h()},h(){me(f,"class","right-chevron svelte-1iovvug"),me(i,"class","svelte-1iovvug"),Zt(i,"plain-button",!0),Zt(i,"selected",l[11]===l[0])},m(M,C){Fe(M,i,C),De(i,o),De(i,u),De(i,f),ti(p,f,null),De(i,n),I&&I.m(i,null),v=!0,S||(T=Ms(i,"click",z),S=!0)},p(M,C){l=M,(!v||C&66)&&a!==(a=l[6](l[11])+"")&&Ci(o,a),C&18&&(_=Ju(l[11],l[4])),_?I?I.p(l,C):(I=Cg(l),I.c(),I.m(i,null)):I&&(I.d(1),I=null),(!v||C&3)&&Zt(i,"selected",l[11]===l[0])},i(M){v||(Ge(p.$$.fragment,M),v=!0)},o(M){tt(p.$$.fragment,M),v=!1},d(M){M&&Q(i),ii(p),I&&I.d(),S=!1,T()}}}function DS(l){let i,a,o,u,f,p,n,_=l[3]!=null&&Tg(l),v=Ni(l[1]),S=[];for(let M=0;Mtt(S[M],1,1,()=>{S[M]=null}),I=l[9].default,z=Ir(I,l,l[8],null);return{c(){i=je("div"),_&&_.c(),a=gt(),o=je("h5"),u=Ut(l[5]),f=gt();for(let M=0;MM.label}=i,{selected:T=null}=i,{hiddenOnMobile:I=!1}=i;const z=M=>{a(0,T=M),p(M)};return l.$$set=M=>{"options"in M&&a(1,f=M.options),"clickCallback"in M&&a(2,p=M.clickCallback),"backButtonCallback"in M&&a(3,n=M.backButtonCallback),"globalSelectedCategories"in M&&a(4,_=M.globalSelectedCategories),"columnTitle"in M&&a(5,v=M.columnTitle),"labeller"in M&&a(6,S=M.labeller),"selected"in M&&a(0,T=M.selected),"hiddenOnMobile"in M&&a(7,I=M.hiddenOnMobile),"$$scope"in M&&a(8,u=M.$$scope)},[T,f,p,n,_,v,S,I,u,o,z]}class BS extends qi{constructor(i){super(),Zi(this,i,RS,DS,Ui,{options:1,clickCallback:2,backButtonCallback:3,globalSelectedCategories:4,columnTitle:5,labeller:6,selected:0,hiddenOnMobile:7})}}function Ag(l,i,a){const o=l.slice();return o[14]=i[a],o[16]=a,o}function Pg(l){let i,a,o,u="Back",f,p,n,_,v;return{c(){i=je("ol"),a=je("li"),o=je("button"),o.textContent=u,f=gt(),p=ya("svg"),n=ya("path"),this.h()},l(S){i=qe(S,"OL",{class:!0});var T=Ye(i);a=qe(T,"LI",{class:!0,id:!0});var I=Ye(a);o=qe(I,"BUTTON",{class:!0,"data-svelte-h":!0}),Cr(o)!=="svelte-10k8otn"&&(o.textContent=u),f=_t(I),p=va(I,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0,fill:!0});var z=Ye(p);n=va(z,"path",{d:!0,transform:!0}),Ye(n).forEach(Q),z.forEach(Q),I.forEach(Q),T.forEach(Q),this.h()},h(){me(o,"class","btn-link ons-breadcrumb__link"),me(n,"d","M5.74,14.28l-.57-.56a.5.5,0,0,1,0-.71h0l5-5-5-5a.5.5,0,0,1,0-.71h0l.57-.56a.5.5,0,0,1,.71,0h0l5.93,5.93a.5.5,0,0,1,0,.7L6.45,14.28a.5.5,0,0,1-.71,0Z"),me(n,"transform","translate(-5.02 -1.59)"),me(p,"class","ons-svg-icon svelte-w4p0hu"),me(p,"viewBox","0 0 8 13"),me(p,"xmlns","http://www.w3.org/2000/svg"),me(p,"focusable","false"),me(p,"fill","currentColor"),me(a,"class","ons-breadcrumb__item"),me(a,"id","breadcrumb-1"),me(i,"class","ons-breadcrumb__items ons-u-fs-s")},m(S,T){Fe(S,i,T),De(i,a),De(a,o),De(a,f),De(a,p),De(p,n),_||(v=Ms(o,"click",function(){G_(l[3])&&l[3].apply(this,arguments)}),_=!0)},p(S,T){l=S},d(S){S&&Q(i),_=!1,v()}}}function zg(l){let i,a;return i=new qf({props:{variant:"secondary",small:!0,disabled:l[7],$$slots:{default:[OS]},$$scope:{ctx:l}}}),i.$on("click",l[11]),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&128&&(f.disabled=o[7]),u&8192&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function OS(l){let i;return{c(){i=Ut("Remove selection")},l(a){i=Vt(a,"Remove selection")},m(a,o){Fe(a,i,o)},d(a){a&&Q(i)}}}function FS(l){let i,a=l[0],o,u,f=Dg(l);const p=l[10].default,n=Ir(p,l,l[13],null);return{c(){i=je("div"),f.c(),o=gt(),n&&n.c(),this.h()},l(_){i=qe(_,"DIV",{class:!0});var v=Ye(i);f.l(v),v.forEach(Q),o=_t(_),n&&n.l(_),this.h()},h(){me(i,"class","ons-radios__items")},m(_,v){Fe(_,i,v),f.m(i,null),Fe(_,o,v),n&&n.m(_,v),u=!0},p(_,v){v&1&&Ui(a,a=_[0])?(f.d(1),f=Dg(_),f.c(),f.m(i,null)):f.p(_,v),n&&n.p&&(!u||v&8192)&&Ar(n,p,_,_[13],u?zr(p,_[13],v,null):Pr(_[13]),null)},i(_){u||(Ge(n,_),u=!0)},o(_){tt(n,_),u=!1},d(_){_&&(Q(i),Q(o)),f.d(_),n&&n.d(_)}}}function NS(l){let i;return{c(){i=Ut(`At most three characteristics can be selected. To add another - characteristic, please remove one of the three selected ones.`)},l(a){i=Vt(a,`At most three characteristics can be selected. To add another - characteristic, please remove one of the three selected ones.`)},m(a,o){Fe(a,i,o)},p:wi,i:wi,o:wi,d(a){a&&Q(i)}}}function Mg(l){let i,a,o,u,f,p=l[6](l[14])+"",n,_,v,S;function T(){return l[12](l[14])}return{c(){i=je("button"),a=je("span"),o=je("span"),u=gt(),f=je("span"),n=Ut(p),_=gt(),this.h()},l(I){i=qe(I,"BUTTON",{class:!0});var z=Ye(i);a=qe(z,"SPAN",{class:!0});var M=Ye(a);o=qe(M,"SPAN",{class:!0}),Ye(o).forEach(Q),u=_t(M),f=qe(M,"SPAN",{class:!0});var C=Ye(f);n=Vt(C,p),C.forEach(Q),M.forEach(Q),_=_t(z),z.forEach(Q),this.h()},h(){me(o,"class","ons-radio__input ons-js-radio svelte-1cwdic4"),me(f,"class","ons-radio__label svelte-1cwdic4"),me(a,"class","ons-radio ons-radio--no-border"),me(i,"class","ons-radios__item ons-radios__item--no-border svelte-1cwdic4"),i.disabled=l[7],Zt(i,"ons-radio__checked",Rg(l[14],l[4]))},m(I,z){Fe(I,i,z),De(i,a),De(a,o),De(a,u),De(a,f),De(f,n),De(i,_),v||(S=[W_(VS.call(null,i,l[16]===0)),Ms(i,"click",T)],v=!0)},p(I,z){l=I,z&65&&p!==(p=l[6](l[14])+"")&&Ci(n,p),z&128&&(i.disabled=l[7]),z&17&&Zt(i,"ons-radio__checked",Rg(l[14],l[4]))},d(I){I&&Q(i),v=!1,j1(S)}}}function Dg(l){let i,a=Ni(l[0]),o=[];for(let u=0;u{C=null}),$i());let oe=T;T=F(j,ee),T===oe?D[T].p(j,ee):(Vi(),tt(D[oe],1,1,()=>{D[oe]=null}),$i(),I=D[T],I?I.p(j,ee):(I=D[T]=R[T](j),I.c()),Ge(I,1),I.m(i,null)),(!z||ee&256)&&Zt(i,"hidden-first-column",j[8])},i(j){z||(Ge(C),Ge(I),z=!0)},o(j){tt(C),tt(I),z=!1},d(j){j&&Q(i),M&&M.d(),C&&C.d(),D[T].d()}}}function Lg(l){console.log("clicked",l)}function If(l,i){for(let a of i)if(a.topic===l.label)return a.label;return!1}function Rg(l,i){for(const a of i)if(a.var===l.var&&a.code===l.code)return!0;return!1}function VS(l,i){i&&l.focus()}function $S(l,i,a){let{$$slots:o={},$$scope:u}=i,{options:f=[]}=i,{clickCallback:p=Lg}=i,{removeCatCallback:n=Lg}=i,{backButtonCallback:_=null}=i,{globalSelectedCategories:v=[]}=i,{columnTitle:S="column title"}=i,{labeller:T=D=>D.label}=i,{disabled:I=!1}=i,{hiddenOnMobile:z=!1}=i,{currentVar:M=null}=i;const C=()=>n(M),R=D=>p(D);return l.$$set=D=>{"options"in D&&a(0,f=D.options),"clickCallback"in D&&a(1,p=D.clickCallback),"removeCatCallback"in D&&a(2,n=D.removeCatCallback),"backButtonCallback"in D&&a(3,_=D.backButtonCallback),"globalSelectedCategories"in D&&a(4,v=D.globalSelectedCategories),"columnTitle"in D&&a(5,S=D.columnTitle),"labeller"in D&&a(6,T=D.labeller),"disabled"in D&&a(7,I=D.disabled),"hiddenOnMobile"in D&&a(8,z=D.hiddenOnMobile),"currentVar"in D&&a(9,M=D.currentVar),"$$scope"in D&&a(13,u=D.$$scope)},[f,p,n,_,v,S,T,I,z,M,o,C,R,u]}class jS extends qi{constructor(i){super(),Zi(this,i,$S,US,Ui,{options:0,clickCallback:1,removeCatCallback:2,backButtonCallback:3,globalSelectedCategories:4,columnTitle:5,labeller:6,disabled:7,hiddenOnMobile:8,currentVar:9})}}function Bg(l,i,a){const o=l.slice();return o[16]=i[a],o}function Og(l){let i,a,o=Ni([l[0].vars[l[7][l[0].label]]]),u=[];for(let p=0;p<1;p+=1)u[p]=Ug(Bg(l,o,p));const f=p=>tt(u[p],1,1,()=>{u[p]=null});return{c(){for(let p=0;p<1;p+=1)u[p].c();i=ri()},l(p){for(let n=0;n<1;n+=1)u[n].l(p);i=ri()},m(p,n){for(let _=0;_<1;_+=1)u[_]&&u[_].m(p,n);Fe(p,i,n),a=!0},p(p,n){if(n&2043){o=Ni([p[0].vars[p[7][p[0].label]]]);let _;for(_=0;_<1;_+=1){const v=Bg(p,o,_);u[_]?(u[_].p(v,n),Ge(u[_],1)):(u[_]=Ug(v),u[_].c(),Ge(u[_],1),u[_].m(i.parentNode,i))}for(Vi(),_=1;_<1;_+=1)f(_);$i()}},i(p){if(!a){for(let n=0;n<1;n+=1)Ge(u[n]);a=!0}},o(p){u=u.filter(Boolean);for(let n=0;n<1;n+=1)tt(u[n]);a=!1},d(p){p&&Q(i),Zr(u,p)}}}function Fg(l){let i,a,o,u,f,p;return a=new ch({props:{type:"chevron",rotation:90}}),{c(){i=je("button"),ei(a.$$.fragment),o=Ut(" Show fewer"),this.h()},l(n){i=qe(n,"BUTTON",{class:!0});var _=Ye(i);si(a.$$.fragment,_),o=Vt(_," Show fewer"),_.forEach(Q),this.h()},h(){me(i,"class","btn-link")},m(n,_){Fe(n,i,_),ti(a,i,null),De(i,o),u=!0,f||(p=Ms(i,"click",l[9]),f=!0)},p:wi,i(n){u||(Ge(a.$$.fragment,n),u=!0)},o(n){tt(a.$$.fragment,n),u=!1},d(n){n&&Q(i),ii(a),f=!1,p()}}}function Ng(l){let i,a,o,u,f,p;return a=new ch({props:{type:"chevron",rotation:-90}}),{c(){i=je("button"),ei(a.$$.fragment),o=Ut(" Show more"),this.h()},l(n){i=qe(n,"BUTTON",{class:!0});var _=Ye(i);si(a.$$.fragment,_),o=Vt(_," Show more"),_.forEach(Q),this.h()},h(){me(i,"class","btn-link")},m(n,_){Fe(n,i,_),ti(a,i,null),De(i,o),u=!0,f||(p=Ms(i,"click",l[8]),f=!0)},p:wi,i(n){u||(Ge(a.$$.fragment,n),u=!0)},o(n){tt(a.$$.fragment,n),u=!1},d(n){n&&Q(i),ii(a),f=!1,p()}}}function qS(l){let i,a,o,u=l[7][l[0].label]>0&&Fg(l),f=l[7][l[0].label]0?u?(u.p(p,n),n&129&&Ge(u,1)):(u=Fg(p),u.c(),Ge(u,1),u.m(i.parentNode,i)):u&&(Vi(),tt(u,1,1,()=>{u=null}),$i()),p[7][p[0].label]{f=null}),$i())},i(p){o||(Ge(u),Ge(f),o=!0)},o(p){tt(u),tt(f),o=!1},d(p){p&&(Q(i),Q(a)),u&&u.d(p),f&&f.d(p)}}}function Ug(l){let i,a,o;function u(..._){return l[12](l[16],..._)}function f(..._){return l[13](l[16],..._)}function p(_){l[15](_)}let n={columnTitle:l[0].label,options:l[10](l[16]),clickCallback:u,removeCatCallback:f,backButtonCallback:l[14],globalSelectedCategories:l[5],currentVar:l[0],disabled:l[6],$$slots:{default:[qS]},$$scope:{ctx:l}};return l[1]!==void 0&&(n.selected=l[1]),i=new jS({props:n}),Ja.push(()=>Qo(i,"selected",p)),{c(){ei(i.$$.fragment)},l(_){si(i.$$.fragment,_)},m(_,v){ti(i,_,v),o=!0},p(_,v){l=_;const S={};v&1&&(S.columnTitle=l[0].label),v&129&&(S.options=l[10](l[16])),v&137&&(S.clickCallback=u),v&145&&(S.removeCatCallback=f),v&1&&(S.backButtonCallback=l[14]),v&32&&(S.globalSelectedCategories=l[5]),v&1&&(S.currentVar=l[0]),v&64&&(S.disabled=l[6]),v&524417&&(S.$$scope={dirty:v,ctx:l}),!a&&v&2&&(a=!0,S.selected=l[1],Yo(()=>a=!1)),i.$set(S)},i(_){o||(Ge(i.$$.fragment,_),o=!0)},o(_){tt(i.$$.fragment,_),o=!1},d(_){ii(i,_)}}}function Vg(l){let i,a,o=l[0]!=null&&Og(l);return{c(){o&&o.c(),i=ri()},l(u){o&&o.l(u),i=ri()},m(u,f){o&&o.m(u,f),Fe(u,i,f),a=!0},p(u,f){u[0]!=null?o?(o.p(u,f),f&1&&Ge(o,1)):(o=Og(u),o.c(),Ge(o,1),o.m(i.parentNode,i)):o&&(Vi(),tt(o,1,1,()=>{o=null}),$i())},i(u){a||(Ge(o),a=!0)},o(u){tt(o),a=!1},d(u){u&&Q(i),o&&o.d(u)}}}function ZS(l){let i,a,o,u,f=l[0],p;function n(S){l[11](S)}let _={columnTitle:"Select a variable",clickCallback:HS,options:l[2],globalSelectedCategories:l[5],hiddenOnMobile:l[0]!=null};l[0]!==void 0&&(_.selected=l[0]),a=new BS({props:_}),Ja.push(()=>Qo(a,"selected",n));let v=Vg(l);return{c(){i=je("div"),ei(a.$$.fragment),u=gt(),v.c(),this.h()},l(S){i=qe(S,"DIV",{class:!0});var T=Ye(i);si(a.$$.fragment,T),u=_t(T),v.l(T),T.forEach(Q),this.h()},h(){me(i,"class","container svelte-9mqv54")},m(S,T){Fe(S,i,T),ti(a,i,null),De(i,u),v.m(i,null),p=!0},p(S,[T]){const I={};T&4&&(I.options=S[2]),T&32&&(I.globalSelectedCategories=S[5]),T&1&&(I.hiddenOnMobile=S[0]!=null),!o&&T&1&&(o=!0,I.selected=S[0],Yo(()=>o=!1)),a.$set(I),T&1&&Ui(f,f=S[0])?(Vi(),tt(v,1,1,wi),$i(),v=Vg(S),v.c(),Ge(v,1),v.m(i,null)):v.p(S,T)},i(S){p||(Ge(a.$$.fragment,S),Ge(v),p=!0)},o(S){tt(a.$$.fragment,S),tt(v),p=!1},d(S){S&&Q(i),ii(a),v.d(S)}}}function GS(l,i){console.log(l,i)}function WS(l,i){console.log(l,i)}const HS=()=>{};function KS(l,i,a){let o,{options:u=[]}=i,{clickCallback:f=GS}=i,{removeCatCallback:p=WS}=i,{globalSelectedCategories:n=[]}=i,{disabled:_=!1}=i,{activeColumn:v=null}=i,{activeCategory:S=null}=i;function T(){a(7,++o[v.label],o)}function I(){a(7,--o[v.label],o)}function z(j){return console.log(j),j.key!=="religion_tb"?j.cats:j.cats.sort(Ry)}function M(j){v=j,a(0,v)}const C=(j,ee)=>f(j,ee),R=(j,ee)=>p(j,ee),D=()=>a(0,v=null);function F(j){S=j,a(1,S)}return l.$$set=j=>{"options"in j&&a(2,u=j.options),"clickCallback"in j&&a(3,f=j.clickCallback),"removeCatCallback"in j&&a(4,p=j.removeCatCallback),"globalSelectedCategories"in j&&a(5,n=j.globalSelectedCategories),"disabled"in j&&a(6,_=j.disabled),"activeColumn"in j&&a(0,v=j.activeColumn),"activeCategory"in j&&a(1,S=j.activeCategory)},l.$$.update=()=>{l.$$.dirty&4&&a(7,o=function(){let j={};return u.forEach(ee=>j[ee.label]=0),j}())},[v,S,u,f,p,n,_,o,T,I,z,M,C,R,D,F]}class XS extends qi{constructor(i){super(),Zi(this,i,KS,ZS,Ui,{options:2,clickCallback:3,removeCatCallback:4,globalSelectedCategories:5,disabled:6,activeColumn:0,activeCategory:1})}}var By={exports:{}};(function(l,i){(function(a,o){l.exports=o()})(Ho,function(){var a,o,u;function f(n,_){if(!a)a=_;else if(!o)o=_;else{var v="var sharedChunk = {}; ("+a+")(sharedChunk); ("+o+")(sharedChunk);",S={};a(S),u=_(S),typeof window<"u"&&(u.workerUrl=window.URL.createObjectURL(new Blob([v],{type:"text/javascript"})))}}f(["exports"],function(n){function _(r,e,s,h){return new(s||(s=Promise))(function(m,b){function x(B){try{P(h.next(B))}catch(N){b(N)}}function E(B){try{P(h.throw(B))}catch(N){b(N)}}function P(B){var N;B.done?m(B.value):(N=B.value,N instanceof s?N:new s(function($){$(N)})).then(x,E)}P((h=h.apply(r,e||[])).next())})}function v(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}typeof SuppressedError=="function"&&SuppressedError;var S=T;function T(r,e){this.x=r,this.y=e}T.prototype={clone:function(){return new T(this.x,this.y)},add:function(r){return this.clone()._add(r)},sub:function(r){return this.clone()._sub(r)},multByPoint:function(r){return this.clone()._multByPoint(r)},divByPoint:function(r){return this.clone()._divByPoint(r)},mult:function(r){return this.clone()._mult(r)},div:function(r){return this.clone()._div(r)},rotate:function(r){return this.clone()._rotate(r)},rotateAround:function(r,e){return this.clone()._rotateAround(r,e)},matMult:function(r){return this.clone()._matMult(r)},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(r){return this.x===r.x&&this.y===r.y},dist:function(r){return Math.sqrt(this.distSqr(r))},distSqr:function(r){var e=r.x-this.x,s=r.y-this.y;return e*e+s*s},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith:function(r){return this.angleWithSep(r.x,r.y)},angleWithSep:function(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult:function(r){var e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add:function(r){return this.x+=r.x,this.y+=r.y,this},_sub:function(r){return this.x-=r.x,this.y-=r.y,this},_mult:function(r){return this.x*=r,this.y*=r,this},_div:function(r){return this.x/=r,this.y/=r,this},_multByPoint:function(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint:function(r){return this.x/=r.x,this.y/=r.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var r=this.y;return this.y=this.x,this.x=-r,this},_rotate:function(r){var e=Math.cos(r),s=Math.sin(r),h=s*this.x+e*this.y;return this.x=e*this.x-s*this.y,this.y=h,this},_rotateAround:function(r,e){var s=Math.cos(r),h=Math.sin(r),m=e.y+h*(this.x-e.x)+s*(this.y-e.y);return this.x=e.x+s*(this.x-e.x)-h*(this.y-e.y),this.y=m,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},T.convert=function(r){return r instanceof T?r:Array.isArray(r)?new T(r[0],r[1]):r};var I=v(S),z=M;function M(r,e,s,h){this.cx=3*r,this.bx=3*(s-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(h-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=e,this.p2x=s,this.p2y=h}M.prototype={sampleCurveX:function(r){return((this.ax*r+this.bx)*r+this.cx)*r},sampleCurveY:function(r){return((this.ay*r+this.by)*r+this.cy)*r},sampleCurveDerivativeX:function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},solveCurveX:function(r,e){if(e===void 0&&(e=1e-6),r<0)return 0;if(r>1)return 1;for(var s=r,h=0;h<8;h++){var m=this.sampleCurveX(s)-r;if(Math.abs(m)m?x=s:E=s,s=.5*(E-x)+x;return s},solve:function(r,e){return this.sampleCurveY(this.solveCurveX(r,e))}};var C=v(z);let R,D;function F(){return R==null&&(R=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),R}function j(){if(D==null&&(D=!1,F())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let h=0;h<5*5;h++){const m=4*h;e.fillStyle=`rgb(${m},${m+1},${m+2})`,e.fillRect(h%5,Math.floor(h/5),1,1)}const s=e.getImageData(0,0,5,5).data;for(let h=0;h<5*5*4;h++)if(h%4!=3&&s[h]!==h){D=!0;break}}}return D||!1}function ee(r,e,s,h){const m=new C(r,e,s,h);return function(b){return m.solve(b)}}const oe=ee(.25,.1,.25,1);function se(r,e,s){return Math.min(s,Math.max(e,r))}function ne(r,e,s){const h=s-e,m=((r-e)%h+h)%h+e;return m===e?s:m}function re(r,...e){for(const s of e)for(const h in s)r[h]=s[h];return r}let ve=1;function ze(r,e,s){const h={};for(const m in r)h[m]=e.call(s||this,r[m],m,r);return h}function nt(r,e,s){const h={};for(const m in r)e.call(s||this,r[m],m,r)&&(h[m]=r[m]);return h}function be(r){return Array.isArray(r)?r.map(be):typeof r=="object"&&r?ze(r,be):r}const Ke={};function q(r){Ke[r]||(typeof console<"u"&&console.warn(r),Ke[r]=!0)}function He(r,e,s){return(s.y-r.y)*(e.x-r.x)>(e.y-r.y)*(s.x-r.x)}function Rt(r){let e=0;for(let s,h,m=0,b=r.length,x=b-1;m"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(r,{timestamp:0});try{const x=b==null?void 0:b.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const E=x.startsWith("BGR"),P=new Uint8ClampedArray(h*m*4);if(yield b.copyTo(P,function(B,N,$,W,te){const ie=4*Math.max(-N,0),de=(Math.max(0,$)-$)*W*4+ie,Ee=4*W,Ae=Math.max(0,N),Ve=Math.max(0,$);return{rect:{x:Ae,y:Ve,width:Math.min(B.width,N+W)-Ae,height:Math.min(B.height,$+te)-Ve},layout:[{offset:de,stride:Ee}]}}(r,e,s,h,m)),E)for(let B=0;BcancelAnimationFrame(e)}},getImageData(r,e=0){return this.getImageCanvasContext(r).getImageData(-e,-e,r.width+2*e,r.height+2*e)},getImageCanvasContext(r){const e=window.document.createElement("canvas"),s=e.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return e.width=r.width,e.height=r.height,s.drawImage(r,0,0,r.width,r.height),s},resolveURL:r=>(he||(he=document.createElement("a")),he.href=r,he.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Je==null&&(Je=matchMedia("(prefers-reduced-motion: reduce)")),Je.matches)}},vt={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class Ct extends Error{constructor(e,s,h,m){super(`AJAXError: ${s} (${e}): ${h}`),this.status=e,this.statusText=s,this.url=h,this.body=m}}const Bt=at()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,fi=r=>vt.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))];function pt(r,e){const s=new AbortController,h=new Request(r.url,{method:r.method||"GET",body:r.body,credentials:r.credentials,headers:r.headers,cache:r.cache,referrer:Bt(),signal:s.signal});let m=!1,b=!1;return r.type==="json"&&h.headers.set("Accept","application/json"),b||fetch(h).then(x=>x.ok?(E=>{(r.type==="arrayBuffer"||r.type==="image"?E.arrayBuffer():r.type==="json"?E.json():E.text()).then(P=>{b||(m=!0,e(null,P,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(P=>{b||e(new Error(P.message))})})(x):x.blob().then(E=>e(new Ct(x.status,x.statusText,r.url,E)))).catch(x=>{x.code!==20&&e(new Error(x.message))}),{cancel:()=>{b=!0,m||s.abort()}}}const _i=function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){if(at()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",r,e);if(!at())return(fi(r.url)||pt)(r,e)}if(!(/^file:/.test(s=r.url)||/^file:/.test(Bt())&&!/^\w+:/.test(s))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return pt(r,e);if(at()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",r,e,void 0,!0)}var s;return function(h,m){const b=new XMLHttpRequest;b.open(h.method||"GET",h.url,!0),h.type!=="arrayBuffer"&&h.type!=="image"||(b.responseType="arraybuffer");for(const x in h.headers)b.setRequestHeader(x,h.headers[x]);return h.type==="json"&&(b.responseType="text",b.setRequestHeader("Accept","application/json")),b.withCredentials=h.credentials==="include",b.onerror=()=>{m(new Error(b.statusText))},b.onload=()=>{if((b.status>=200&&b.status<300||b.status===0)&&b.response!==null){let x=b.response;if(h.type==="json")try{x=JSON.parse(b.response)}catch(E){return m(E)}m(null,x,b.getResponseHeader("Cache-Control"),b.getResponseHeader("Expires"))}else{const x=new Blob([b.response],{type:b.getResponseHeader("Content-Type")});m(new Ct(b.status,b.statusText,h.url,x))}},b.send(h.body),{cancel:()=>b.abort()}}(r,e)},Z=function(r,e){return _i(re(r,{type:"arrayBuffer"}),e)};function lt(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const e=new URL(r),s=window.location;return e.protocol===s.protocol&&e.host===s.host}function et(r,e,s){s[r]&&s[r].indexOf(e)!==-1||(s[r]=s[r]||[],s[r].push(e))}function Se(r,e,s){if(s&&s[r]){const h=s[r].indexOf(e);h!==-1&&s[r].splice(h,1)}}class ge{constructor(e,s={}){re(this,s),this.type=e}}class $e extends ge{constructor(e,s={}){super("error",re({error:e},s))}}class ft{on(e,s){return this._listeners=this._listeners||{},et(e,s,this._listeners),this}off(e,s){return Se(e,s,this._listeners),Se(e,s,this._oneTimeListeners),this}once(e,s){return s?(this._oneTimeListeners=this._oneTimeListeners||{},et(e,s,this._oneTimeListeners),this):new Promise(h=>this.once(e,h))}fire(e,s){typeof e=="string"&&(e=new ge(e,s||{}));const h=e.type;if(this.listens(h)){e.target=this;const m=this._listeners&&this._listeners[h]?this._listeners[h].slice():[];for(const E of m)E.call(this,e);const b=this._oneTimeListeners&&this._oneTimeListeners[h]?this._oneTimeListeners[h].slice():[];for(const E of b)Se(h,E,this._oneTimeListeners),E.call(this,e);const x=this._eventedParent;x&&(re(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(e))}else e instanceof $e&&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,s){return this._eventedParent=e,this._eventedParentData=s,this}}var Ie={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},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 We=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function wt(r,e){const s={};for(const h in r)h!=="ref"&&(s[h]=r[h]);return We.forEach(h=>{h in e&&(s[h]=e[h])}),s}function Et(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let s=0;s`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Ne=[or,Pt,vi,bi,Sr,_e,Vr,ye(pi),G,K,ce];function Re(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Re(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const s of Ne)if(!Re(s,e))return null}}return`Expected ${Ce(r)} but found ${Ce(e)} instead.`}function Pe(r,e){return e.some(s=>s.kind===r.kind)}function H(r,e){return e.some(s=>s==="null"?r===null:s==="array"?Array.isArray(r):s==="object"?r&&!Array.isArray(r)&&typeof r=="object":s===typeof r)}function X(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}const le=.96422,ke=.82521,Be=4/29,bt=6/29,dt=3*bt*bt,Tt=bt*bt*bt,qt=Math.PI/180,di=180/Math.PI;function Yt(r){return(r%=360)<0&&(r+=360),r}function ni([r,e,s,h]){let m,b;const x=ai((.2225045*(r=li(r))+.7168786*(e=li(e))+.0606169*(s=li(s)))/1);r===e&&e===s?m=b=x:(m=ai((.4360747*r+.3850649*e+.1430804*s)/le),b=ai((.0139322*r+.0971045*e+.7141733*s)/ke));const E=116*x-16;return[E<0?0:E,500*(m-x),200*(x-b),h]}function li(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function ai(r){return r>Tt?Math.pow(r,1/3):r/dt+Be}function gi([r,e,s,h]){let m=(r+16)/116,b=isNaN(e)?m:m+e/500,x=isNaN(s)?m:m-s/200;return m=1*Si(m),b=le*Si(b),x=ke*Si(x),[Pi(3.1338561*b-1.6168667*m-.4906146*x),Pi(-.9787684*b+1.9161415*m+.033454*x),Pi(.0719453*b-.2289914*m+1.4052427*x),h]}function Pi(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function Si(r){return r>bt?r*r*r:dt*(r-Be)}function $r(r){return parseInt(r.padEnd(2,r),16)/255}function yn(r,e){return pr(e?r/100:r,0,1)}function pr(r,e,s){return Math.min(Math.max(e,r),s)}function rs(r){return!r.some(Number.isNaN)}const ns={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 Ai{constructor(e,s,h,m=1,b=!0){this.r=e,this.g=s,this.b=h,this.a=m,b||(this.r*=m,this.g*=m,this.b*=m,m||this.overwriteGetter("rgb",[e,s,h,m]))}static parse(e){if(e instanceof Ai)return e;if(typeof e!="string")return;const s=function(h){if((h=h.toLowerCase().trim())==="transparent")return[0,0,0,0];const m=ns[h];if(m){const[x,E,P]=m;return[x/255,E/255,P/255,1]}if(h.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(h)){const x=h.length<6?1:2;let E=1;return[$r(h.slice(E,E+=x)),$r(h.slice(E,E+=x)),$r(h.slice(E,E+=x)),$r(h.slice(E,E+x)||"ff")]}if(h.startsWith("rgb")){const x=h.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[E,P,B,N,$,W,te,ie,de,Ee,Ae,Ve]=x,Le=[N||" ",te||" ",Ee].join("");if(Le===" "||Le===" /"||Le===",,"||Le===",,,"){const Ze=[B,W,de].join(""),Qe=Ze==="%%%"?100:Ze===""?255:0;if(Qe){const ht=[pr(+P/Qe,0,1),pr(+$/Qe,0,1),pr(+ie/Qe,0,1),Ae?yn(+Ae,Ve):1];if(rs(ht))return ht}}return}}const b=h.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[x,E,P,B,N,$,W,te,ie]=b,de=[P||" ",N||" ",W].join("");if(de===" "||de===" /"||de===",,"||de===",,,"){const Ee=[+E,pr(+B,0,100),pr(+$,0,100),te?yn(+te,ie):1];if(rs(Ee))return function([Ae,Ve,Le,Ze]){function Qe(ht){const Ft=(ht+Ae/30)%12,Ht=Ve*Math.min(Le,1-Le);return Le-Ht*Math.max(-1,Math.min(Ft-3,9-Ft,1))}return Ae=Yt(Ae),Ve/=100,Le/=100,[Qe(0),Qe(8),Qe(4),Ze]}(Ee)}}}(e);return s?new Ai(...s,!1):void 0}get rgb(){const{r:e,g:s,b:h,a:m}=this,b=m||1/0;return this.overwriteGetter("rgb",[e/b,s/b,h/b,m])}get hcl(){return this.overwriteGetter("hcl",function(e){const[s,h,m,b]=ni(e),x=Math.sqrt(h*h+m*m);return[Math.round(1e4*x)?Yt(Math.atan2(m,h)*di):NaN,x,s,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ni(this.rgb))}overwriteGetter(e,s){return Object.defineProperty(this,e,{value:s}),s}toString(){const[e,s,h,m]=this.rgb;return`rgba(${[e,s,h].map(b=>Math.round(255*b)).join(",")},${m})`}}Ai.black=new Ai(0,0,0,1),Ai.white=new Ai(1,1,1,1),Ai.transparent=new Ai(0,0,0,0),Ai.red=new Ai(1,0,0,1);class Jr{constructor(e,s,h){this.sensitivity=e?s?"variant":"case":s?"accent":"base",this.locale=h,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,s){return this.collator.compare(e,s)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class un{constructor(e,s,h,m,b){this.text=e,this.image=s,this.scale=h,this.fontStack=m,this.textColor=b}}class lr{constructor(e){this.sections=e}static fromString(e){return new lr([new un(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 lr?e:lr.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Mr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Mr)return e;if(typeof e=="number")return new Mr([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const s of e)if(typeof s!="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 Mr(e)}}toString(){return JSON.stringify(this.values)}}const to=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Er{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Er)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let s=0;s=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof s=="number"&&s>=0&&s<=255?h===void 0||typeof h=="number"&&h>=0&&h<=1?null:`Invalid rgba value [${[r,e,s,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof h=="number"?[r,e,s,h]:[r,e,s]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function vn(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Ai||r instanceof Jr||r instanceof lr||r instanceof Mr||r instanceof Er||r instanceof Dr)return!0;if(Array.isArray(r)){for(const e of r)if(!vn(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!vn(r[e]))return!1;return!0}return!1}function yi(r){if(r===null)return or;if(typeof r=="string")return vi;if(typeof r=="boolean")return bi;if(typeof r=="number")return Pt;if(r instanceof Ai)return Sr;if(r instanceof Jr)return cn;if(r instanceof lr)return _e;if(r instanceof Mr)return G;if(r instanceof Er)return ce;if(r instanceof Dr)return K;if(Array.isArray(r)){const e=r.length;let s;for(const h of r){const m=yi(h);if(s){if(s===m)continue;s=pi;break}s=m}return ye(s||pi,e)}return Vr}function vs(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof Ai||r instanceof lr||r instanceof Mr||r instanceof Er||r instanceof Dr?r.toString():JSON.stringify(r)}class Yr{constructor(e,s){this.type=e,this.value=s}static parse(e,s){if(e.length!==2)return s.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!vn(e[1]))return s.error("invalid value");const h=e[1];let m=yi(h);const b=s.expectedType;return m.kind!=="array"||m.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(m=b),new Yr(m,h)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class mr{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ba={string:vi,number:Pt,boolean:bi,object:Vr};class Ln{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");let h,m=1;const b=e[0];if(b==="array"){let E,P;if(e.length>2){const B=e[1];if(typeof B!="string"||!(B in ba)||B==="object")return s.error('The item type argument of "array" must be one of string, number, boolean',1);E=ba[B],m++}else E=pi;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return s.error('The length argument to "array" must be a positive integer literal',2);P=e[2],m++}h=ye(E,P)}else{if(!ba[b])throw new Error(`Types doesn't contain name = ${b}`);h=ba[b]}const x=[];for(;me.outputDefined())}}const Lc={"to-boolean":bi,"to-color":Sr,"to-number":Pt,"to-string":vi};class as{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");const h=e[0];if(!Lc[h])throw new Error(`Can't parse ${h} as it is not part of the known types`);if((h==="to-boolean"||h==="to-string")&&e.length!==2)return s.error("Expected one argument.");const m=Lc[h],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(s)}: expected an array containing either three or four numeric values.`:ss(s[0],s[1],s[2],s[3]),!h))return new Ai(s[0]/255,s[1]/255,s[2]/255,s[3])}throw new mr(h||`Could not parse color from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"padding":{let s;for(const h of this.args){s=h.evaluate(e);const m=Mr.parse(s);if(m)return m}throw new mr(`Could not parse padding from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"variableAnchorOffsetCollection":{let s;for(const h of this.args){s=h.evaluate(e);const m=Er.parse(s);if(m)return m}throw new mr(`Could not parse variableAnchorOffsetCollection from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"number":{let s=null;for(const h of this.args){if(s=h.evaluate(e),s===null)return 0;const m=Number(s);if(!isNaN(m))return m}throw new mr(`Could not convert ${JSON.stringify(s)} to number.`)}case"formatted":return lr.fromString(vs(this.args[0].evaluate(e)));case"resolvedImage":return Dr.fromString(vs(this.args[0].evaluate(e)));default:return vs(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Rc=["Unknown","Point","LineString","Polygon"];class Bc{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"?Rc[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 s=this._parseColorCache[e];return s||(s=this._parseColorCache[e]=Ai.parse(e)),s}}class io{constructor(e,s,h=[],m,b=new xr,x=[]){this.registry=e,this.path=h,this.key=h.map(E=>`[${E}]`).join(""),this.scope=b,this.errors=x,this.expectedType=m,this._isConstant=s}parse(e,s,h,m,b={}){return s?this.concat(s,h,m)._parse(e,b):this._parse(e,b)}_parse(e,s){function h(m,b,x){return x==="assert"?new Ln(b,[m]):x==="coerce"?new as(b,[m]):m}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 m=e[0];if(typeof m!="string")return this.error(`Expression name must be a string, but found ${typeof m} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[m];if(b){let x=b.parse(e,this);if(!x)return null;if(this.expectedType){const E=this.expectedType,P=x.type;if(E.kind!=="string"&&E.kind!=="number"&&E.kind!=="boolean"&&E.kind!=="object"&&E.kind!=="array"||P.kind!=="value")if(E.kind!=="color"&&E.kind!=="formatted"&&E.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string")if(E.kind!=="padding"||P.kind!=="value"&&P.kind!=="number"&&P.kind!=="array")if(E.kind!=="variableAnchorOffsetCollection"||P.kind!=="value"&&P.kind!=="array"){if(this.checkSubtype(E,P))return null}else x=h(x,E,s.typeAnnotation||"coerce");else x=h(x,E,s.typeAnnotation||"coerce");else x=h(x,E,s.typeAnnotation||"coerce");else x=h(x,E,s.typeAnnotation||"assert")}if(!(x instanceof Yr)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const E=new Bc;try{x=new Yr(x.type,x.evaluate(E))}catch(P){return this.error(P.message),null}}return x}return this.error(`Unknown expression "${m}". 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,s,h){const m=typeof e=="number"?this.path.concat(e):this.path,b=h?this.scope.concat(h):this.scope;return new io(this.registry,this._isConstant,m,s||null,b,this.errors)}error(e,...s){const h=`${this.key}${s.map(m=>`[${m}]`).join("")}`;this.errors.push(new wr(h,e))}checkSubtype(e,s){const h=Re(e,s);return h&&this.error(h),h}}class ro{constructor(e,s,h){this.type=cn,this.locale=h,this.caseSensitive=e,this.diacriticSensitive=s}static parse(e,s){if(e.length!==2)return s.error("Expected one argument.");const h=e[1];if(typeof h!="object"||Array.isArray(h))return s.error("Collator options argument must be an object.");const m=s.parse(h["case-sensitive"]!==void 0&&h["case-sensitive"],1,bi);if(!m)return null;const b=s.parse(h["diacritic-sensitive"]!==void 0&&h["diacritic-sensitive"],1,bi);if(!b)return null;let x=null;return h.locale&&(x=s.parse(h.locale,1,vi),!x)?null:new ro(m,b,x)}evaluate(e){return new Jr(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 bs=8192;function no(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function wa(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function uh(r,e){const s=(180+r[0])/360,h=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,m=Math.pow(2,e.z);return[Math.round(s*m*bs),Math.round(h*m*bs)]}function hh(r,e,s){const h=r[0]-e[0],m=r[1]-e[1],b=r[0]-s[0],x=r[1]-s[1];return h*x-b*m==0&&h*b<=0&&m*x<=0}function xa(r,e){let s=!1;for(let x=0,E=e.length;x(h=r)[1]!=(b=P[B+1])[1]>h[1]&&h[0]<(b[0]-m[0])*(h[1]-m[1])/(b[1]-m[1])+m[0]&&(s=!s)}}var h,m,b;return s}function fh(r,e){for(let s=0;s0&&E<0||x<0&&E>0}function dh(r,e,s){for(const B of s)for(let N=0;Ns[2]){const m=.5*h;let b=r[0]-s[0]>m?-h:s[0]-r[0]>m?h:0;b===0&&(b=r[0]-s[2]>m?-h:s[2]-r[0]>m?h:0),r[0]+=b}no(e,r)}function ul(r,e,s,h){const m=Math.pow(2,h.z)*bs,b=[h.x*bs,h.y*bs],x=[];for(const E of r)for(const P of E){const B=[P.x+b[0],P.y+b[1]];cl(B,e,s,m),x.push(B)}return x}function Uc(r,e,s,h){const m=Math.pow(2,h.z)*bs,b=[h.x*bs,h.y*bs],x=[];for(const P of r){const B=[];for(const N of P){const $=[N.x+b[0],N.y+b[1]];no(e,$),B.push($)}x.push(B)}if(e[2]-e[0]<=m/2){(E=e)[0]=E[1]=1/0,E[2]=E[3]=-1/0;for(const P of x)for(const B of P)cl(B,e,s,m)}var E;return x}class Ls{constructor(e,s){this.type=bi,this.geojson=e,this.geometries=s}static parse(e,s){if(e.length!==2)return s.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(vn(e[1])){const h=e[1];if(h.type==="FeatureCollection")for(let m=0;m!Array.isArray(B)||B.length===e.length-1);let P=null;for(const[B,N]of E){P=new io(s.registry,ao,s.path,null,s.scope);const $=[];let W=!1;for(let te=1;te{return W=$,Array.isArray(W)?`(${W.map(Ce).join(", ")})`:`(${Ce(W.type)}...)`;var W}).join(" | "),N=[];for(let $=1;${s=e?s&&ao(h):s&&h instanceof Yr}),!!s&&oo(r)&&Ws(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function oo(r){if(r instanceof Rn&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof Ls)return!1;let e=!0;return r.eachChild(s=>{e&&!oo(s)&&(e=!1)}),e}function Sa(r){if(r instanceof Rn&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(s=>{e&&!Sa(s)&&(e=!1)}),e}function Ws(r,e){if(r instanceof Rn&&e.indexOf(r.name)>=0)return!1;let s=!0;return r.eachChild(h=>{s&&!Ws(h,e)&&(s=!1)}),s}function Rs(r,e){const s=r.length-1;let h,m,b=0,x=s,E=0;for(;b<=x;)if(E=Math.floor((b+x)/2),h=r[E],m=r[E+1],h<=e){if(E===s||ee))throw new mr("Input is not a number.");x=E-1}return 0}class Bi{constructor(e,s,h){this.type=e,this.input=s,this.labels=[],this.outputs=[];for(const[m,b]of h)this.labels.push(m),this.outputs.push(b)}static parse(e,s){if(e.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return s.error("Expected an even number of arguments.");const h=s.parse(e[1],1,Pt);if(!h)return null;const m=[];let b=null;s.expectedType&&s.expectedType.kind!=="value"&&(b=s.expectedType);for(let x=1;x=E)return s.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',B);const $=s.parse(P,N,b);if(!$)return null;b=b||$.type,m.push([E,$])}return new Bi(b,h,m)}evaluate(e){const s=this.labels,h=this.outputs;if(s.length===1)return h[0].evaluate(e);const m=this.input.evaluate(e);if(m<=s[0])return h[0].evaluate(e);const b=s.length;return m>=s[b-1]?h[b-1].evaluate(e):h[Rs(s,m)].evaluate(e)}eachChild(e){e(this.input);for(const s of this.outputs)e(s)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Bs(r,e,s){return r+s*(e-r)}function lo(r,e,s){return r.map((h,m)=>Bs(h,e[m],s))}const bn={number:Bs,color:function(r,e,s,h="rgb"){switch(h){case"rgb":{const[m,b,x,E]=lo(r.rgb,e.rgb,s);return new Ai(m,b,x,E,!1)}case"hcl":{const[m,b,x,E]=r.hcl,[P,B,N,$]=e.hcl;let W,te;if(isNaN(m)||isNaN(P))isNaN(m)?isNaN(P)?W=NaN:(W=P,x!==1&&x!==0||(te=B)):(W=m,N!==1&&N!==0||(te=b));else{let Ve=P-m;P>m&&Ve>180?Ve-=360:P180&&(Ve+=360),W=m+s*Ve}const[ie,de,Ee,Ae]=function([Ve,Le,Ze,Qe]){return Ve=isNaN(Ve)?0:Ve*qt,gi([Ze,Math.cos(Ve)*Le,Math.sin(Ve)*Le,Qe])}([W,te??Bs(b,B,s),Bs(x,N,s),Bs(E,$,s)]);return new Ai(ie,de,Ee,Ae,!1)}case"lab":{const[m,b,x,E]=gi(lo(r.lab,e.lab,s));return new Ai(m,b,x,E,!1)}}},array:lo,padding:function(r,e,s){return new Mr(lo(r.values,e.values,s))},variableAnchorOffsetCollection:function(r,e,s){const h=r.values,m=e.values;if(h.length!==m.length)throw new mr(`Cannot interpolate values of different length. from: ${r.toString()}, to: ${e.toString()}`);const b=[];for(let x=0;xtypeof N!="number"||N<0||N>1))return s.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);m={name:"cubic-bezier",controlPoints:B}}}if(e.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return s.error("Expected an even number of arguments.");if(b=s.parse(b,2,Pt),!b)return null;const E=[];let P=null;h==="interpolate-hcl"||h==="interpolate-lab"?P=Sr:s.expectedType&&s.expectedType.kind!=="value"&&(P=s.expectedType);for(let B=0;B=N)return s.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',W);const ie=s.parse($,te,P);if(!ie)return null;P=P||ie.type,E.push([N,ie])}return X(P,Pt)||X(P,Sr)||X(P,G)||X(P,ce)||X(P,ye(Pt))?new wn(P,h,m,b,E):s.error(`Type ${Ce(P)} is not interpolatable.`)}evaluate(e){const s=this.labels,h=this.outputs;if(s.length===1)return h[0].evaluate(e);const m=this.input.evaluate(e);if(m<=s[0])return h[0].evaluate(e);const b=s.length;if(m>=s[b-1])return h[b-1].evaluate(e);const x=Rs(s,m),E=wn.interpolationFactor(this.interpolation,m,s[x],s[x+1]),P=h[x].evaluate(e),B=h[x+1].evaluate(e);switch(this.operator){case"interpolate":return bn[this.type.kind](P,B,E);case"interpolate-hcl":return bn.color(P,B,E,"hcl");case"interpolate-lab":return bn.color(P,B,E,"lab")}}eachChild(e){e(this.input);for(const s of this.outputs)e(s)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function hl(r,e,s,h){const m=h-s,b=r-s;return m===0?0:e===1?b/m:(Math.pow(e,b)-1)/(Math.pow(e,m)-1)}class co{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expectected at least one argument.");let h=null;const m=s.expectedType;m&&m.kind!=="value"&&(h=m);const b=[];for(const E of e.slice(1)){const P=s.parse(E,1+b.length,h,void 0,{typeAnnotation:"omit"});if(!P)return null;h=h||P.type,b.push(P)}if(!h)throw new Error("No output type");const x=m&&b.some(E=>Re(m,E.type));return new co(x?pi:h,b)}evaluate(e){let s,h=null,m=0;for(const b of this.args)if(m++,h=b.evaluate(e),h&&h instanceof Dr&&!h.available&&(s||(s=h.name),h=null,m===this.args.length&&(h=s)),h!==null)break;return h}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class uo{constructor(e,s){this.type=s.type,this.bindings=[].concat(e),this.result=s}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const s of this.bindings)e(s[1]);e(this.result)}static parse(e,s){if(e.length<4)return s.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const h=[];for(let b=1;b=h.length)throw new mr(`Array index out of bounds: ${s} > ${h.length-1}.`);if(s!==Math.floor(s))throw new mr(`Array index must be an integer, but found ${s} instead.`);return h[s]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class dl{constructor(e,s){this.type=bi,this.needle=e,this.haystack=s}static parse(e,s){if(e.length!==3)return s.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const h=s.parse(e[1],1,pi),m=s.parse(e[2],2,pi);return h&&m?Pe(h.type,[bi,vi,Pt,or,pi])?new dl(h,m):s.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ce(h.type)} instead`):null}evaluate(e){const s=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!h)return!1;if(!H(s,["boolean","string","number","null"]))throw new mr(`Expected first argument to be of type boolean, string, number or null, but found ${Ce(yi(s))} instead.`);if(!H(h,["string","array"]))throw new mr(`Expected second argument to be of type array or string, but found ${Ce(yi(h))} instead.`);return h.indexOf(s)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class ho{constructor(e,s,h){this.type=Pt,this.needle=e,this.haystack=s,this.fromIndex=h}static parse(e,s){if(e.length<=2||e.length>=5)return s.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=s.parse(e[1],1,pi),m=s.parse(e[2],2,pi);if(!h||!m)return null;if(!Pe(h.type,[bi,vi,Pt,or,pi]))return s.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ce(h.type)} instead`);if(e.length===4){const b=s.parse(e[3],3,Pt);return b?new ho(h,m,b):null}return new ho(h,m)}evaluate(e){const s=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!H(s,["boolean","string","number","null"]))throw new mr(`Expected first argument to be of type boolean, string, number or null, but found ${Ce(yi(s))} instead.`);if(!H(h,["string","array"]))throw new mr(`Expected second argument to be of type array or string, but found ${Ce(yi(h))} instead.`);if(this.fromIndex){const m=this.fromIndex.evaluate(e);return h.indexOf(s,m)}return h.indexOf(s)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class pl{constructor(e,s,h,m,b,x){this.inputType=e,this.type=s,this.input=h,this.cases=m,this.outputs=b,this.otherwise=x}static parse(e,s){if(e.length<5)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return s.error("Expected an even number of arguments.");let h,m;s.expectedType&&s.expectedType.kind!=="value"&&(m=s.expectedType);const b={},x=[];for(let B=2;BNumber.MAX_SAFE_INTEGER)return W.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ie=="number"&&Math.floor(ie)!==ie)return W.error("Numeric branch labels must be integer values.");if(h){if(W.checkSubtype(h,yi(ie)))return null}else h=yi(ie);if(b[String(ie)]!==void 0)return W.error("Branch labels must be unique.");b[String(ie)]=x.length}const te=s.parse($,B,m);if(!te)return null;m=m||te.type,x.push(te)}const E=s.parse(e[1],1,pi);if(!E)return null;const P=s.parse(e[e.length-1],e.length-1,m);return P?E.type.kind!=="value"&&s.concat(1).checkSubtype(h,E.type)?null:new pl(h,m,E,b,x,P):null}evaluate(e){const s=this.input.evaluate(e);return(yi(s)===this.inputType&&this.outputs[this.cases[s]]||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 ml{constructor(e,s,h){this.type=e,this.branches=s,this.otherwise=h}static parse(e,s){if(e.length<4)return s.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return s.error("Expected an odd number of arguments.");let h;s.expectedType&&s.expectedType.kind!=="value"&&(h=s.expectedType);const m=[];for(let x=1;xs.outputDefined())&&this.otherwise.outputDefined()}}class fo{constructor(e,s,h,m){this.type=e,this.input=s,this.beginIndex=h,this.endIndex=m}static parse(e,s){if(e.length<=2||e.length>=5)return s.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=s.parse(e[1],1,pi),m=s.parse(e[2],2,Pt);if(!h||!m)return null;if(!Pe(h.type,[ye(pi),vi,pi]))return s.error(`Expected first argument to be of type array or string, but found ${Ce(h.type)} instead`);if(e.length===4){const b=s.parse(e[3],3,Pt);return b?new fo(h.type,h,m,b):null}return new fo(h.type,h,m)}evaluate(e){const s=this.input.evaluate(e),h=this.beginIndex.evaluate(e);if(!H(s,["string","array"]))throw new mr(`Expected first argument to be of type array or string, but found ${Ce(yi(s))} instead.`);if(this.endIndex){const m=this.endIndex.evaluate(e);return s.slice(h,m)}return s.slice(h)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Vc(r,e){return r==="=="||r==="!="?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 $c(r,e,s,h){return h.compare(e,s)===0}function Hs(r,e,s){const h=r!=="=="&&r!=="!=";return class Oy{constructor(b,x,E){this.type=bi,this.lhs=b,this.rhs=x,this.collator=E,this.hasUntypedArgument=b.type.kind==="value"||x.type.kind==="value"}static parse(b,x){if(b.length!==3&&b.length!==4)return x.error("Expected two or three arguments.");const E=b[0];let P=x.parse(b[1],1,pi);if(!P)return null;if(!Vc(E,P.type))return x.concat(1).error(`"${E}" comparisons are not supported for type '${Ce(P.type)}'.`);let B=x.parse(b[2],2,pi);if(!B)return null;if(!Vc(E,B.type))return x.concat(2).error(`"${E}" comparisons are not supported for type '${Ce(B.type)}'.`);if(P.type.kind!==B.type.kind&&P.type.kind!=="value"&&B.type.kind!=="value")return x.error(`Cannot compare types '${Ce(P.type)}' and '${Ce(B.type)}'.`);h&&(P.type.kind==="value"&&B.type.kind!=="value"?P=new Ln(B.type,[P]):P.type.kind!=="value"&&B.type.kind==="value"&&(B=new Ln(P.type,[B])));let N=null;if(b.length===4){if(P.type.kind!=="string"&&B.type.kind!=="string"&&P.type.kind!=="value"&&B.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(N=x.parse(b[3],3,cn),!N)return null}return new Oy(P,B,N)}evaluate(b){const x=this.lhs.evaluate(b),E=this.rhs.evaluate(b);if(h&&this.hasUntypedArgument){const P=yi(x),B=yi(E);if(P.kind!==B.kind||P.kind!=="string"&&P.kind!=="number")throw new mr(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${P.kind}, ${B.kind}) instead.`)}if(this.collator&&!h&&this.hasUntypedArgument){const P=yi(x),B=yi(E);if(P.kind!=="string"||B.kind!=="string")return e(b,x,E)}return this.collator?s(b,x,E,this.collator.evaluate(b)):e(b,x,E)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const ph=Hs("==",function(r,e,s){return e===s},$c),mh=Hs("!=",function(r,e,s){return e!==s},function(r,e,s,h){return!$c(0,e,s,h)}),gh=Hs("<",function(r,e,s){return e",function(r,e,s){return e>s},function(r,e,s,h){return h.compare(e,s)>0}),yh=Hs("<=",function(r,e,s){return e<=s},function(r,e,s,h){return h.compare(e,s)<=0}),vh=Hs(">=",function(r,e,s){return e>=s},function(r,e,s,h){return h.compare(e,s)>=0});class gl{constructor(e,s,h,m,b){this.type=vi,this.number=e,this.locale=s,this.currency=h,this.minFractionDigits=m,this.maxFractionDigits=b}static parse(e,s){if(e.length!==3)return s.error("Expected two arguments.");const h=s.parse(e[1],1,Pt);if(!h)return null;const m=e[2];if(typeof m!="object"||Array.isArray(m))return s.error("NumberFormat options argument must be an object.");let b=null;if(m.locale&&(b=s.parse(m.locale,1,vi),!b))return null;let x=null;if(m.currency&&(x=s.parse(m.currency,1,vi),!x))return null;let E=null;if(m["min-fraction-digits"]&&(E=s.parse(m["min-fraction-digits"],1,Pt),!E))return null;let P=null;return m["max-fraction-digits"]&&(P=s.parse(m["max-fraction-digits"],1,Pt),!P)?null:new gl(h,b,x,E,P)}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 po{constructor(e){this.type=_e,this.sections=e}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");const h=e[1];if(!Array.isArray(h)&&typeof h=="object")return s.error("First argument must be an image or text section.");const m=[];let b=!1;for(let x=1;x<=e.length-1;++x){const E=e[x];if(b&&typeof E=="object"&&!Array.isArray(E)){b=!1;let P=null;if(E["font-scale"]&&(P=s.parse(E["font-scale"],1,Pt),!P))return null;let B=null;if(E["text-font"]&&(B=s.parse(E["text-font"],1,ye(vi)),!B))return null;let N=null;if(E["text-color"]&&(N=s.parse(E["text-color"],1,Sr),!N))return null;const $=m[m.length-1];$.scale=P,$.font=B,$.textColor=N}else{const P=s.parse(e[x],1,pi);if(!P)return null;const B=P.type.kind;if(B!=="string"&&B!=="value"&&B!=="null"&&B!=="resolvedImage")return s.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,m.push({content:P,scale:null,font:null,textColor:null})}}return new po(m)}evaluate(e){return new lr(this.sections.map(s=>{const h=s.content.evaluate(e);return yi(h)===K?new un("",h,null,null,null):new un(vs(h),null,s.scale?s.scale.evaluate(e):null,s.font?s.font.evaluate(e).join(","):null,s.textColor?s.textColor.evaluate(e):null)}))}eachChild(e){for(const s of this.sections)e(s.content),s.scale&&e(s.scale),s.font&&e(s.font),s.textColor&&e(s.textColor)}outputDefined(){return!1}}class _l{constructor(e){this.type=K,this.input=e}static parse(e,s){if(e.length!==2)return s.error("Expected two arguments.");const h=s.parse(e[1],1,vi);return h?new _l(h):s.error("No image name provided.")}evaluate(e){const s=this.input.evaluate(e),h=Dr.fromString(s);return h&&e.availableImages&&(h.available=e.availableImages.indexOf(s)>-1),h}eachChild(e){e(this.input)}outputDefined(){return!1}}class yl{constructor(e){this.type=Pt,this.input=e}static parse(e,s){if(e.length!==2)return s.error(`Expected 1 argument, but found ${e.length-1} instead.`);const h=s.parse(e[1],1);return h?h.type.kind!=="array"&&h.type.kind!=="string"&&h.type.kind!=="value"?s.error(`Expected argument of type string or array, but found ${Ce(h.type)} instead.`):new yl(h):null}evaluate(e){const s=this.input.evaluate(e);if(typeof s=="string"||Array.isArray(s))return s.length;throw new mr(`Expected value to be of type string or array, but found ${Ce(yi(s))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Ks={"==":ph,"!=":mh,">":_h,"<":gh,">=":vh,"<=":yh,array:Ln,at:fl,boolean:Ln,case:ml,coalesce:co,collator:ro,format:po,image:_l,in:dl,"index-of":ho,interpolate:wn,"interpolate-hcl":wn,"interpolate-lab":wn,length:yl,let:uo,literal:Yr,match:pl,number:Ln,"number-format":gl,object:Ln,slice:fo,step:Bi,string:Ln,"to-boolean":as,"to-color":as,"to-number":as,"to-string":as,var:so,within:Ls};function jc(r,[e,s,h,m]){e=e.evaluate(r),s=s.evaluate(r),h=h.evaluate(r);const b=m?m.evaluate(r):1,x=ss(e,s,h,b);if(x)throw new mr(x);return new Ai(e/255,s/255,h/255,b,!1)}function qc(r,e){return r in e}function vl(r,e){const s=e[r];return s===void 0?null:s}function Os(r){return{type:r}}function mo(r){return{result:"success",value:r}}function Xs(r){return{result:"error",value:r}}function Js(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Zc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function bl(r){return!!r.expression&&r.expression.interpolated}function mi(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function go(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Ri(r){return r}function _o(r,e){const s=e.type==="color",h=r.stops&&typeof r.stops[0][0]=="object",m=h||!(h||r.property!==void 0),b=r.type||(bl(e)?"exponential":"interval");if(s||e.type==="padding"){const N=s?Ai.parse:Mr.parse;(r=Ji({},r)).stops&&(r.stops=r.stops.map($=>[$[0],N($[1])])),r.default=N(r.default?r.default:e.default)}if(r.colorSpace&&(x=r.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var x;let E,P,B;if(b==="exponential")E=wl;else if(b==="interval")E=yo;else if(b==="categorical"){E=er,P=Object.create(null);for(const N of r.stops)P[N[0]]=N[1];B=typeof r.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);E=bh}if(h){const N={},$=[];for(let ie=0;ieie[0]),evaluate:({zoom:ie},de)=>wl({stops:W,base:r.base},e,ie).evaluate(ie,de)}}if(m){const N=b==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:N,interpolationFactor:wn.interpolationFactor.bind(void 0,N),zoomStops:r.stops.map($=>$[0]),evaluate:({zoom:$})=>E(r,e,$,P,B)}}return{kind:"source",evaluate(N,$){const W=$&&$.properties?$.properties[r.property]:void 0;return W===void 0?Ki(r.default,e.default):E(r,e,W,P,B)}}}function Ki(r,e,s){return r!==void 0?r:e!==void 0?e:s!==void 0?s:void 0}function er(r,e,s,h,m){return Ki(typeof s===m?h[s]:void 0,r.default,e.default)}function yo(r,e,s){if(mi(s)!=="number")return Ki(r.default,e.default);const h=r.stops.length;if(h===1||s<=r.stops[0][0])return r.stops[0][1];if(s>=r.stops[h-1][0])return r.stops[h-1][1];const m=Rs(r.stops.map(b=>b[0]),s);return r.stops[m][1]}function wl(r,e,s){const h=r.base!==void 0?r.base:1;if(mi(s)!=="number")return Ki(r.default,e.default);const m=r.stops.length;if(m===1||s<=r.stops[0][0])return r.stops[0][1];if(s>=r.stops[m-1][0])return r.stops[m-1][1];const b=Rs(r.stops.map(N=>N[0]),s),x=function(N,$,W,te){const ie=te-W,de=N-W;return ie===0?0:$===1?de/ie:(Math.pow($,de)-1)/(Math.pow($,ie)-1)}(s,h,r.stops[b][0],r.stops[b+1][0]),E=r.stops[b][1],P=r.stops[b+1][1],B=bn[e.type]||Ri;return typeof E.evaluate=="function"?{evaluate(...N){const $=E.evaluate.apply(void 0,N),W=P.evaluate.apply(void 0,N);if($!==void 0&&W!==void 0)return B($,W,x,r.colorSpace)}}:B(E,P,x,r.colorSpace)}function bh(r,e,s){switch(e.type){case"color":s=Ai.parse(s);break;case"formatted":s=lr.fromString(s.toString());break;case"resolvedImage":s=Dr.fromString(s.toString());break;case"padding":s=Mr.parse(s);break;default:mi(s)===e.type||e.type==="enum"&&e.values[s]||(s=void 0)}return Ki(s,r.default,e.default)}Rn.register(Ks,{error:[{kind:"error"},[vi],(r,[e])=>{throw new mr(e.evaluate(r))}],typeof:[vi,[pi],(r,[e])=>Ce(yi(e.evaluate(r)))],"to-rgba":[ye(Pt,4),[Sr],(r,[e])=>{const[s,h,m,b]=e.evaluate(r).rgb;return[255*s,255*h,255*m,b]}],rgb:[Sr,[Pt,Pt,Pt],jc],rgba:[Sr,[Pt,Pt,Pt,Pt],jc],has:{type:bi,overloads:[[[vi],(r,[e])=>qc(e.evaluate(r),r.properties())],[[vi,Vr],(r,[e,s])=>qc(e.evaluate(r),s.evaluate(r))]]},get:{type:pi,overloads:[[[vi],(r,[e])=>vl(e.evaluate(r),r.properties())],[[vi,Vr],(r,[e,s])=>vl(e.evaluate(r),s.evaluate(r))]]},"feature-state":[pi,[vi],(r,[e])=>vl(e.evaluate(r),r.featureState||{})],properties:[Vr,[],r=>r.properties()],"geometry-type":[vi,[],r=>r.geometryType()],id:[pi,[],r=>r.id()],zoom:[Pt,[],r=>r.globals.zoom],"heatmap-density":[Pt,[],r=>r.globals.heatmapDensity||0],"line-progress":[Pt,[],r=>r.globals.lineProgress||0],accumulated:[pi,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Pt,Os(Pt),(r,e)=>{let s=0;for(const h of e)s+=h.evaluate(r);return s}],"*":[Pt,Os(Pt),(r,e)=>{let s=1;for(const h of e)s*=h.evaluate(r);return s}],"-":{type:Pt,overloads:[[[Pt,Pt],(r,[e,s])=>e.evaluate(r)-s.evaluate(r)],[[Pt],(r,[e])=>-e.evaluate(r)]]},"/":[Pt,[Pt,Pt],(r,[e,s])=>e.evaluate(r)/s.evaluate(r)],"%":[Pt,[Pt,Pt],(r,[e,s])=>e.evaluate(r)%s.evaluate(r)],ln2:[Pt,[],()=>Math.LN2],pi:[Pt,[],()=>Math.PI],e:[Pt,[],()=>Math.E],"^":[Pt,[Pt,Pt],(r,[e,s])=>Math.pow(e.evaluate(r),s.evaluate(r))],sqrt:[Pt,[Pt],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[Pt,[Pt],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[Pt,[Pt],(r,[e])=>Math.log(e.evaluate(r))],log2:[Pt,[Pt],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[Pt,[Pt],(r,[e])=>Math.sin(e.evaluate(r))],cos:[Pt,[Pt],(r,[e])=>Math.cos(e.evaluate(r))],tan:[Pt,[Pt],(r,[e])=>Math.tan(e.evaluate(r))],asin:[Pt,[Pt],(r,[e])=>Math.asin(e.evaluate(r))],acos:[Pt,[Pt],(r,[e])=>Math.acos(e.evaluate(r))],atan:[Pt,[Pt],(r,[e])=>Math.atan(e.evaluate(r))],min:[Pt,Os(Pt),(r,e)=>Math.min(...e.map(s=>s.evaluate(r)))],max:[Pt,Os(Pt),(r,e)=>Math.max(...e.map(s=>s.evaluate(r)))],abs:[Pt,[Pt],(r,[e])=>Math.abs(e.evaluate(r))],round:[Pt,[Pt],(r,[e])=>{const s=e.evaluate(r);return s<0?-Math.round(-s):Math.round(s)}],floor:[Pt,[Pt],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[Pt,[Pt],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[bi,[vi,pi],(r,[e,s])=>r.properties()[e.value]===s.value],"filter-id-==":[bi,[pi],(r,[e])=>r.id()===e.value],"filter-type-==":[bi,[vi],(r,[e])=>r.geometryType()===e.value],"filter-<":[bi,[vi,pi],(r,[e,s])=>{const h=r.properties()[e.value],m=s.value;return typeof h==typeof m&&h{const s=r.id(),h=e.value;return typeof s==typeof h&&s":[bi,[vi,pi],(r,[e,s])=>{const h=r.properties()[e.value],m=s.value;return typeof h==typeof m&&h>m}],"filter-id->":[bi,[pi],(r,[e])=>{const s=r.id(),h=e.value;return typeof s==typeof h&&s>h}],"filter-<=":[bi,[vi,pi],(r,[e,s])=>{const h=r.properties()[e.value],m=s.value;return typeof h==typeof m&&h<=m}],"filter-id-<=":[bi,[pi],(r,[e])=>{const s=r.id(),h=e.value;return typeof s==typeof h&&s<=h}],"filter->=":[bi,[vi,pi],(r,[e,s])=>{const h=r.properties()[e.value],m=s.value;return typeof h==typeof m&&h>=m}],"filter-id->=":[bi,[pi],(r,[e])=>{const s=r.id(),h=e.value;return typeof s==typeof h&&s>=h}],"filter-has":[bi,[pi],(r,[e])=>e.value in r.properties()],"filter-has-id":[bi,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[bi,[ye(vi)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[bi,[ye(pi)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[bi,[vi,ye(pi)],(r,[e,s])=>s.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[bi,[vi,ye(pi)],(r,[e,s])=>function(h,m,b,x){for(;b<=x;){const E=b+x>>1;if(m[E]===h)return!0;m[E]>h?x=E-1:b=E+1}return!1}(r.properties()[e.value],s.value,0,s.value.length-1)],all:{type:bi,overloads:[[[bi,bi],(r,[e,s])=>e.evaluate(r)&&s.evaluate(r)],[Os(bi),(r,e)=>{for(const s of e)if(!s.evaluate(r))return!1;return!0}]]},any:{type:bi,overloads:[[[bi,bi],(r,[e,s])=>e.evaluate(r)||s.evaluate(r)],[Os(bi),(r,e)=>{for(const s of e)if(s.evaluate(r))return!0;return!1}]]},"!":[bi,[bi],(r,[e])=>!e.evaluate(r)],"is-supported-script":[bi,[vi],(r,[e])=>{const s=r.globals&&r.globals.isSupportedScript;return!s||s(e.evaluate(r))}],upcase:[vi,[vi],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[vi,[vi],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[vi,Os(pi),(r,e)=>e.map(s=>vs(s.evaluate(r))).join("")],"resolved-locale":[vi,[cn],(r,[e])=>e.evaluate(r).resolvedLocale()]});class xl{constructor(e,s){var h;this.expression=e,this._warningHistory={},this._evaluator=new Bc,this._defaultValue=s?(h=s).type==="color"&&go(h.default)?new Ai(0,0,0,0):h.type==="color"?Ai.parse(h.default)||null:h.type==="padding"?Mr.parse(h.default)||null:h.type==="variableAnchorOffsetCollection"?Er.parse(h.default)||null:h.default===void 0?null:h.default:null,this._enumValues=s&&s.type==="enum"?s.values:null}evaluateWithoutErrorHandling(e,s,h,m,b,x){return this._evaluator.globals=e,this._evaluator.feature=s,this._evaluator.featureState=h,this._evaluator.canonical=m,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(e,s,h,m,b,x){this._evaluator.globals=e,this._evaluator.feature=s||null,this._evaluator.featureState=h||null,this._evaluator.canonical=m,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||null;try{const E=this.expression.evaluate(this._evaluator);if(E==null||typeof E=="number"&&E!=E)return this._defaultValue;if(this._enumValues&&!(E in this._enumValues))throw new mr(`Expected value to be one of ${Object.keys(this._enumValues).map(P=>JSON.stringify(P)).join(", ")}, but found ${JSON.stringify(E)} instead.`);return E}catch(E){return this._warningHistory[E.message]||(this._warningHistory[E.message]=!0,typeof console<"u"&&console.warn(E.message)),this._defaultValue}}}function vo(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Ks}function bo(r,e){const s=new io(Ks,ao,[],e?function(m){const b={color:Sr,string:vi,number:Pt,enum:vi,boolean:bi,formatted:_e,padding:G,resolvedImage:K,variableAnchorOffsetCollection:ce};return m.type==="array"?ye(b[m.value]||pi,m.length):b[m.type]}(e):void 0),h=s.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?mo(new xl(h,e)):Xs(s.errors)}class wo{constructor(e,s){this.kind=e,this._styleExpression=s,this.isStateDependent=e!=="constant"&&!Sa(s.expression)}evaluateWithoutErrorHandling(e,s,h,m,b,x){return this._styleExpression.evaluateWithoutErrorHandling(e,s,h,m,b,x)}evaluate(e,s,h,m,b,x){return this._styleExpression.evaluate(e,s,h,m,b,x)}}class xo{constructor(e,s,h,m){this.kind=e,this.zoomStops=h,this._styleExpression=s,this.isStateDependent=e!=="camera"&&!Sa(s.expression),this.interpolationType=m}evaluateWithoutErrorHandling(e,s,h,m,b,x){return this._styleExpression.evaluateWithoutErrorHandling(e,s,h,m,b,x)}evaluate(e,s,h,m,b,x){return this._styleExpression.evaluate(e,s,h,m,b,x)}interpolationFactor(e,s,h){return this.interpolationType?wn.interpolationFactor(this.interpolationType,e,s,h):0}}function Sl(r,e){const s=bo(r,e);if(s.result==="error")return s;const h=s.value.expression,m=oo(h);if(!m&&!Js(e))return Xs([new wr("","data expressions not supported")]);const b=Ws(h,["zoom"]);if(!b&&!Zc(e))return Xs([new wr("","zoom expressions not supported")]);const x=Ys(h);return x||b?x instanceof wr?Xs([x]):x instanceof wn&&!bl(e)?Xs([new wr("",'"interpolate" expressions cannot be used with this property')]):mo(x?new xo(m?"camera":"composite",s.value,x.labels,x instanceof wn?x.interpolation:void 0):new wo(m?"constant":"source",s.value)):Xs([new wr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ea{constructor(e,s){this._parameters=e,this._specification=s,Ji(this,_o(this._parameters,this._specification))}static deserialize(e){return new Ea(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ys(r){let e=null;if(r instanceof uo)e=Ys(r.result);else if(r instanceof co){for(const s of r.args)if(e=Ys(s),e)break}else(r instanceof Bi||r instanceof wn)&&r.input instanceof Rn&&r.input.name==="zoom"&&(e=r);return e instanceof wr||r.eachChild(s=>{const h=Ys(s);h instanceof wr?e=h:!e&&h?e=new wr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&h&&e!==h&&(e=new wr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function El(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!El(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const wh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function kl(r){if(r==null)return{filter:()=>!0,needGeometry:!1};El(r)||(r=So(r));const e=bo(r,wh);if(e.result==="error")throw new Error(e.value.map(s=>`${s.key}: ${s.message}`).join(", "));return{filter:(s,h,m)=>e.value.evaluate(s,h,{},m),needGeometry:Gc(r)}}function xh(r,e){return re?1:0}function Gc(r){if(!Array.isArray(r))return!1;if(r[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?Tl(r[1],r[2],e):e==="any"?(s=r.slice(1),["any"].concat(s.map(So))):e==="all"?["all"].concat(r.slice(1).map(So)):e==="none"?["all"].concat(r.slice(1).map(So).map(ka)):e==="in"?Wc(r[1],r.slice(2)):e==="!in"?ka(Wc(r[1],r.slice(2))):e==="has"?Cl(r[1]):e==="!has"?ka(Cl(r[1])):e!=="within"||r;var s}function Tl(r,e,s){switch(r){case"$type":return[`filter-type-${s}`,e];case"$id":return[`filter-id-${s}`,e];default:return[`filter-${s}`,r,e]}}function Wc(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(s=>typeof s!=typeof e[0])?["filter-in-large",r,["literal",e.sort(xh)]]:["filter-in-small",r,["literal",e]]}}function Cl(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function ka(r){return["!",r]}function Qs(r){const e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let m="[";for(const b of r)m+=`${Qs(b)},`;return`${m}]`}const s=Object.keys(r).sort();let h="{";for(let m=0;mh.maximum?[new mt(e,s,`${s} is greater than the maximum value ${h.maximum}`)]:[]}function Al(r){const e=r.valueSpec,s=hr(r.value.type);let h,m,b,x={};const E=s!=="categorical"&&r.value.property===void 0,P=!E,B=mi(r.value.stops)==="array"&&mi(r.value.stops[0])==="array"&&mi(r.value.stops[0][0])==="object",N=Qr({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(te){if(s==="identity")return[new mt(te.key,te.value,'identity function may not have a "stops" property')];let ie=[];const de=te.value;return ie=ie.concat(Ta({key:te.key,value:de,valueSpec:te.valueSpec,validateSpec:te.validateSpec,style:te.style,styleSpec:te.styleSpec,arrayElementValidator:$})),mi(de)==="array"&&de.length===0&&ie.push(new mt(te.key,de,"array must have at least one stop")),ie},default:function(te){return te.validateSpec({key:te.key,value:te.value,valueSpec:e,validateSpec:te.validateSpec,style:te.style,styleSpec:te.styleSpec})}}});return s==="identity"&&E&&N.push(new mt(r.key,r.value,'missing required property "property"')),s==="identity"||r.value.stops||N.push(new mt(r.key,r.value,'missing required property "stops"')),s==="exponential"&&r.valueSpec.expression&&!bl(r.valueSpec)&&N.push(new mt(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(P&&!Js(r.valueSpec)?N.push(new mt(r.key,r.value,"property functions not supported")):E&&!Zc(r.valueSpec)&&N.push(new mt(r.key,r.value,"zoom functions not supported"))),s!=="categorical"&&!B||r.value.property!==void 0||N.push(new mt(r.key,r.value,'"property" property is required')),N;function $(te){let ie=[];const de=te.value,Ee=te.key;if(mi(de)!=="array")return[new mt(Ee,de,`array expected, ${mi(de)} found`)];if(de.length!==2)return[new mt(Ee,de,`array length 2 expected, length ${de.length} found`)];if(B){if(mi(de[0])!=="object")return[new mt(Ee,de,`object expected, ${mi(de[0])} found`)];if(de[0].zoom===void 0)return[new mt(Ee,de,"object stop key must have zoom")];if(de[0].value===void 0)return[new mt(Ee,de,"object stop key must have value")];if(b&&b>hr(de[0].zoom))return[new mt(Ee,de[0].zoom,"stop zoom values must appear in ascending order")];hr(de[0].zoom)!==b&&(b=hr(de[0].zoom),m=void 0,x={}),ie=ie.concat(Qr({key:`${Ee}[0]`,value:de[0],valueSpec:{zoom:{}},validateSpec:te.validateSpec,style:te.style,styleSpec:te.styleSpec,objectElementValidators:{zoom:Ca,value:W}}))}else ie=ie.concat(W({key:`${Ee}[0]`,value:de[0],valueSpec:{},validateSpec:te.validateSpec,style:te.style,styleSpec:te.styleSpec},de));return vo(os(de[1]))?ie.concat([new mt(`${Ee}[1]`,de[1],"expressions are not allowed in function stops.")]):ie.concat(te.validateSpec({key:`${Ee}[1]`,value:de[1],valueSpec:e,validateSpec:te.validateSpec,style:te.style,styleSpec:te.styleSpec}))}function W(te,ie){const de=mi(te.value),Ee=hr(te.value),Ae=te.value!==null?te.value:ie;if(h){if(de!==h)return[new mt(te.key,Ae,`${de} stop domain type must match previous stop domain type ${h}`)]}else h=de;if(de!=="number"&&de!=="string"&&de!=="boolean")return[new mt(te.key,Ae,"stop domain value must be a number, string, or boolean")];if(de!=="number"&&s!=="categorical"){let Ve=`number expected, ${de} found`;return Js(e)&&s===void 0&&(Ve+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new mt(te.key,Ae,Ve)]}return s!=="categorical"||de!=="number"||isFinite(Ee)&&Math.floor(Ee)===Ee?s!=="categorical"&&de==="number"&&m!==void 0&&Eenew mt(`${r.key}${h.key}`,r.value,h.message));const s=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!s.outputDefined())return[new mt(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!Sa(s))return[new mt(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Sa(s))return[new mt(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Ws(s,["zoom","feature-state"]))return[new mt(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!oo(s))return[new mt(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ws(r){const e=r.key,s=r.value,h=r.valueSpec,m=[];return Array.isArray(h.values)?h.values.indexOf(hr(s))===-1&&m.push(new mt(e,s,`expected one of [${h.values.join(", ")}], ${JSON.stringify(s)} found`)):Object.keys(h.values).indexOf(hr(s))===-1&&m.push(new mt(e,s,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(s)} found`)),m}function Pl(r){return El(os(r.value))?ea(Ji({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Hc(r)}function Hc(r){const e=r.value,s=r.key;if(mi(e)!=="array")return[new mt(s,e,`array expected, ${mi(e)} found`)];const h=r.styleSpec;let m,b=[];if(e.length<1)return[new mt(s,e,"filter array must have at least 1 element")];switch(b=b.concat(ws({key:`${s}[0]`,value:e[0],valueSpec:h.filter_operator,style:r.style,styleSpec:r.styleSpec})),hr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&hr(e[1])==="$type"&&b.push(new mt(s,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&b.push(new mt(s,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(m=mi(e[1]),m!=="string"&&b.push(new mt(`${s}[1]`,e[1],`string expected, ${m} found`)));for(let x=2;x{B in s&&e.push(new mt(h,s[B],`"${B}" is prohibited for ref layers`))}),m.layers.forEach(B=>{hr(B.id)===E&&(P=B)}),P?P.ref?e.push(new mt(h,s.ref,"ref cannot reference another ref layer")):x=hr(P.type):e.push(new mt(h,s.ref,`ref layer "${E}" not found`))}else if(x!=="background")if(s.source){const P=m.sources&&m.sources[s.source],B=P&&hr(P.type);P?B==="vector"&&x==="raster"?e.push(new mt(h,s.source,`layer "${s.id}" requires a raster source`)):B!=="raster-dem"&&x==="hillshade"?e.push(new mt(h,s.source,`layer "${s.id}" requires a raster-dem source`)):B==="raster"&&x!=="raster"?e.push(new mt(h,s.source,`layer "${s.id}" requires a vector source`)):B!=="vector"||s["source-layer"]?B==="raster-dem"&&x!=="hillshade"?e.push(new mt(h,s.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!s.paint||!s.paint["line-gradient"]||B==="geojson"&&P.lineMetrics||e.push(new mt(h,s,`layer "${s.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new mt(h,s,`layer "${s.id}" must specify a "source-layer"`)):e.push(new mt(h,s.source,`source "${s.source}" not found`))}else e.push(new mt(h,s,'missing required property "source"'));return e=e.concat(Qr({key:h,value:s,valueSpec:b.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${h}.type`,value:s.type,valueSpec:b.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:s,objectKey:"type"}),filter:Pl,layout:P=>Qr({layer:s,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":B=>Jc(Ji({layerType:x},B))}}),paint:P=>Qr({layer:s,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":B=>Xc(Ji({layerType:x},B))}})}})),e}function Wn(r){const e=r.value,s=r.key,h=mi(e);return h!=="string"?[new mt(s,e,`string expected, ${h} found`)]:[]}const xn={promoteId:function({key:r,value:e}){if(mi(e)==="string")return Wn({key:r,value:e});{const s=[];for(const h in e)s.push(...Wn({key:`${r}.${h}`,value:e[h]}));return s}}};function Aa(r){const e=r.value,s=r.key,h=r.styleSpec,m=r.style,b=r.validateSpec;if(!e.type)return[new mt(s,e,'"type" is required')];const x=hr(e.type);let E;switch(x){case"vector":case"raster":return E=Qr({key:s,value:e,valueSpec:h[`source_${x.replace("-","_")}`],style:r.style,styleSpec:h,objectElementValidators:xn,validateSpec:b}),E;case"raster-dem":return E=function(P){var B;const N=(B=P.sourceName)!==null&&B!==void 0?B:"",$=P.value,W=P.styleSpec,te=W.source_raster_dem,ie=P.style;let de=[];const Ee=mi($);if($===void 0)return de;if(Ee!=="object")return de.push(new mt("source_raster_dem",$,`object expected, ${Ee} found`)),de;const Ae=hr($.encoding)==="custom",Ve=["redFactor","greenFactor","blueFactor","baseShift"],Le=P.value.encoding?`"${P.value.encoding}"`:"Default";for(const Ze in $)!Ae&&Ve.includes(Ze)?de.push(new mt(Ze,$[Ze],`In "${N}": "${Ze}" is only valid when "encoding" is set to "custom". ${Le} encoding found`)):te[Ze]?de=de.concat(P.validateSpec({key:Ze,value:$[Ze],valueSpec:te[Ze],validateSpec:P.validateSpec,style:ie,styleSpec:W})):de.push(new mt(Ze,$[Ze],`unknown property "${Ze}"`));return de}({sourceName:s,value:e,style:r.style,styleSpec:h,validateSpec:b}),E;case"geojson":if(E=Qr({key:s,value:e,valueSpec:h.source_geojson,style:m,styleSpec:h,validateSpec:b,objectElementValidators:xn}),e.cluster)for(const P in e.clusterProperties){const[B,N]=e.clusterProperties[P],$=typeof B=="string"?[B,["accumulated"],["get",P]]:B;E.push(...ea({key:`${s}.${P}.map`,value:N,validateSpec:b,expressionContext:"cluster-map"})),E.push(...ea({key:`${s}.${P}.reduce`,value:$,validateSpec:b,expressionContext:"cluster-reduce"}))}return E;case"video":return Qr({key:s,value:e,valueSpec:h.source_video,style:m,validateSpec:b,styleSpec:h});case"image":return Qr({key:s,value:e,valueSpec:h.source_image,style:m,validateSpec:b,styleSpec:h});case"canvas":return[new mt(s,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ws({key:`${s}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:m,validateSpec:b,styleSpec:h})}}function Yc(r){const e=r.value,s=r.styleSpec,h=s.light,m=r.style;let b=[];const x=mi(e);if(e===void 0)return b;if(x!=="object")return b=b.concat([new mt("light",e,`object expected, ${x} found`)]),b;for(const E in e){const P=E.match(/^(.*)-transition$/);b=b.concat(P&&h[P[1]]&&h[P[1]].transition?r.validateSpec({key:E,value:e[E],valueSpec:s.transition,validateSpec:r.validateSpec,style:m,styleSpec:s}):h[E]?r.validateSpec({key:E,value:e[E],valueSpec:h[E],validateSpec:r.validateSpec,style:m,styleSpec:s}):[new mt(E,e[E],`unknown property "${E}"`)])}return b}function Qc(r){const e=r.value,s=r.styleSpec,h=s.terrain,m=r.style;let b=[];const x=mi(e);if(e===void 0)return b;if(x!=="object")return b=b.concat([new mt("terrain",e,`object expected, ${x} found`)]),b;for(const E in e)b=b.concat(h[E]?r.validateSpec({key:E,value:e[E],valueSpec:h[E],validateSpec:r.validateSpec,style:m,styleSpec:s}):[new mt(E,e[E],`unknown property "${E}"`)]);return b}function eu(r){let e=[];const s=r.value,h=r.key;if(Array.isArray(s)){const m=[],b=[];for(const x in s)s[x].id&&m.includes(s[x].id)&&e.push(new mt(h,s,`all the sprites' ids must be unique, but ${s[x].id} is duplicated`)),m.push(s[x].id),s[x].url&&b.includes(s[x].url)&&e.push(new mt(h,s,`all the sprites' URLs must be unique, but ${s[x].url} is duplicated`)),b.push(s[x].url),e=e.concat(Qr({key:`${h}[${x}]`,value:s[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}return Wn({key:h,value:s})}const ta={"*":()=>[],array:Ta,boolean:function(r){const e=r.value,s=r.key,h=mi(e);return h!=="boolean"?[new mt(s,e,`boolean expected, ${h} found`)]:[]},number:Ca,color:function(r){const e=r.key,s=r.value,h=mi(s);return h!=="string"?[new mt(e,s,`color expected, ${h} found`)]:Ai.parse(String(s))?[]:[new mt(e,s,`color expected, "${s}" found`)]},constants:Il,enum:ws,filter:Pl,function:Al,layer:Ia,object:Qr,source:Aa,light:Yc,terrain:Qc,string:Wn,formatted:function(r){return Wn(r).length===0?[]:ea(r)},resolvedImage:function(r){return Wn(r).length===0?[]:ea(r)},padding:function(r){const e=r.key,s=r.value;if(mi(s)==="array"){if(s.length<1||s.length>4)return[new mt(e,s,`padding requires 1 to 4 values; ${s.length} values found`)];const h={type:"number"};let m=[];for(let b=0;b[]}})),r.constants&&(s=s.concat(Il({key:"constants",value:r.constants,style:r,styleSpec:e,validateSpec:Pa}))),tu(s)}function Un(r){return function(e){return r({...e,validateSpec:Pa})}}function tu(r){return[].concat(r).sort((e,s)=>e.line-s.line)}function Sn(r){return function(...e){return tu(r.apply(this,e))}}Hn.source=Sn(Un(Aa)),Hn.sprite=Sn(Un(eu)),Hn.glyphs=Sn(Un(Eo)),Hn.light=Sn(Un(Yc)),Hn.terrain=Sn(Un(Qc)),Hn.layer=Sn(Un(Ia)),Hn.filter=Sn(Un(Pl)),Hn.paintProperty=Sn(Un(Xc)),Hn.layoutProperty=Sn(Un(Jc));const za=Hn,zl=za.light,iu=za.paintProperty,Ml=za.layoutProperty;function Dl(r,e){let s=!1;if(e&&e.length)for(const h of e)r.fire(new $e(new Error(h.message))),s=!0;return s}class ia{constructor(e,s,h){const m=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const x=new Int32Array(this.arrayBuffer);e=x[0],this.d=(s=x[1])+2*(h=x[2]);for(let P=0;P=$[ie+0]&&m>=$[ie+1])?(E[te]=!0,x.push(N[te])):E[te]=!1}}}}_forEachCell(e,s,h,m,b,x,E,P){const B=this._convertToCellCoord(e),N=this._convertToCellCoord(s),$=this._convertToCellCoord(h),W=this._convertToCellCoord(m);for(let te=B;te<=$;te++)for(let ie=N;ie<=W;ie++){const de=this.d*ie+te;if((!P||P(this._convertFromCellCoord(te),this._convertFromCellCoord(ie),this._convertFromCellCoord(te+1),this._convertFromCellCoord(ie+1)))&&b.call(this,e,s,h,m,de,x,E,P))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,s=3+this.cells.length+1+1;let h=0;for(let x=0;x=0)continue;const x=r[b];m[b]=xs[h].shallow.indexOf(b)>=0?x:ra(x,e)}r instanceof Error&&(m.message=r.message)}if(m.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(m.$name=h),m}throw new Error("can't serialize object of type "+typeof r)}function Da(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||Ma(r)||st(r)||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(Da);if(typeof r=="object"){const e=r.$name||"Object";if(!xs[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:s}=xs[e];if(!s)throw new Error(`can't deserialize unregistered class ${e}`);if(s.deserialize)return s.deserialize(r);const h=Object.create(s.prototype);for(const m of Object.keys(r)){if(m==="$name")continue;const b=r[m];h[m]=xs[e].shallow.indexOf(m)>=0?b:Da(b)}return h}throw new Error("can't deserialize object of type "+typeof r)}class Ll{constructor(){this.first=!0}update(e,s){const h=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=h,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=h,!0):(this.lastFloorZoom>h?(this.lastIntegerZoom=h+1,this.lastIntegerZoomTime=s):this.lastFloorZoomr>=128&&r<=255,Arabic:r=>r>=1536&&r<=1791,"Arabic Supplement":r=>r>=1872&&r<=1919,"Arabic Extended-A":r=>r>=2208&&r<=2303,"Hangul Jamo":r=>r>=4352&&r<=4607,"Unified Canadian Aboriginal Syllabics":r=>r>=5120&&r<=5759,Khmer:r=>r>=6016&&r<=6143,"Unified Canadian Aboriginal Syllabics Extended":r=>r>=6320&&r<=6399,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"CJK Radicals Supplement":r=>r>=11904&&r<=12031,"Kangxi Radicals":r=>r>=12032&&r<=12255,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Bopomofo:r=>r>=12544&&r<=12591,"Hangul Compatibility Jamo":r=>r>=12592&&r<=12687,Kanbun:r=>r>=12688&&r<=12703,"Bopomofo Extended":r=>r>=12704&&r<=12735,"CJK Strokes":r=>r>=12736&&r<=12783,"Katakana Phonetic Extensions":r=>r>=12784&&r<=12799,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"CJK Unified Ideographs Extension A":r=>r>=13312&&r<=19903,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Yi Syllables":r=>r>=40960&&r<=42127,"Yi Radicals":r=>r>=42128&&r<=42191,"Hangul Jamo Extended-A":r=>r>=43360&&r<=43391,"Hangul Syllables":r=>r>=44032&&r<=55215,"Hangul Jamo Extended-B":r=>r>=55216&&r<=55295,"Private Use Area":r=>r>=57344&&r<=63743,"CJK Compatibility Ideographs":r=>r>=63744&&r<=64255,"Arabic Presentation Forms-A":r=>r>=64336&&r<=65023,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Arabic Presentation Forms-B":r=>r>=65136&&r<=65279,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519};function La(r){for(const e of r)if(Rl(e.charCodeAt(0)))return!0;return!1}function Eh(r){for(const e of r)if(!kh(e.charCodeAt(0)))return!1;return!0}function kh(r){return!(Nt.Arabic(r)||Nt["Arabic Supplement"](r)||Nt["Arabic Extended-A"](r)||Nt["Arabic Presentation Forms-A"](r)||Nt["Arabic Presentation Forms-B"](r))}function Rl(r){return!(r!==746&&r!==747&&(r<4352||!(Nt["Bopomofo Extended"](r)||Nt.Bopomofo(r)||Nt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||Nt["CJK Compatibility Ideographs"](r)||Nt["CJK Compatibility"](r)||Nt["CJK Radicals Supplement"](r)||Nt["CJK Strokes"](r)||!(!Nt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||Nt["CJK Unified Ideographs Extension A"](r)||Nt["CJK Unified Ideographs"](r)||Nt["Enclosed CJK Letters and Months"](r)||Nt["Hangul Compatibility Jamo"](r)||Nt["Hangul Jamo Extended-A"](r)||Nt["Hangul Jamo Extended-B"](r)||Nt["Hangul Jamo"](r)||Nt["Hangul Syllables"](r)||Nt.Hiragana(r)||Nt["Ideographic Description Characters"](r)||Nt.Kanbun(r)||Nt["Kangxi Radicals"](r)||Nt["Katakana Phonetic Extensions"](r)||Nt.Katakana(r)&&r!==12540||!(!Nt["Halfwidth and Fullwidth Forms"](r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!Nt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||Nt["Unified Canadian Aboriginal Syllabics"](r)||Nt["Unified Canadian Aboriginal Syllabics Extended"](r)||Nt["Vertical Forms"](r)||Nt["Yijing Hexagram Symbols"](r)||Nt["Yi Syllables"](r)||Nt["Yi Radicals"](r))))}function ru(r){return!(Rl(r)||function(e){return!!(Nt["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Nt["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)||Nt["Letterlike Symbols"](e)||Nt["Number Forms"](e)||Nt["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)||Nt["Control Pictures"](e)&&e!==9251||Nt["Optical Character Recognition"](e)||Nt["Enclosed Alphanumerics"](e)||Nt["Geometric Shapes"](e)||Nt["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Nt["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Nt["CJK Symbols and Punctuation"](e)||Nt.Katakana(e)||Nt["Private Use Area"](e)||Nt["CJK Compatibility Forms"](e)||Nt["Small Form Variants"](e)||Nt["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(r))}function Bl(r){return r>=1424&&r<=2303||Nt["Arabic Presentation Forms-A"](r)||Nt["Arabic Presentation Forms-B"](r)}function Th(r,e){return!(!e&&Bl(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||Nt.Khmer(r))}function Ch(r){for(const e of r)if(Bl(e.charCodeAt(0)))return!0;return!1}const Ol="deferred",Fl="loading",Nl="loaded";let Ul=null,hn="unavailable",Vn=null;const nu=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(hn="error"),Ul&&Ul(r)};function Ra(){Vl.fire(new ge("pluginStateChange",{pluginStatus:hn,pluginURL:Vn}))}const Vl=new ft,$l=function(){return hn},jl=function(){if(hn!==Ol||!Vn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");hn=Fl,Ra(),Vn&&Z({url:Vn},r=>{r?nu(r):(hn=Nl,Ra())})},En={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>hn===Nl||En.applyArabicShaping!=null,isLoading:()=>hn===Fl,setState(r){if(!at())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");hn=r.pluginStatus,Vn=r.pluginURL},isParsed(){if(!at())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return En.applyArabicShaping!=null&&En.processBidirectionalText!=null&&En.processStyledBidirectionalText!=null},getPluginURL(){if(!at())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Vn}};class tr{constructor(e,s){this.zoom=e,s?(this.now=s.now,this.fadeDuration=s.fadeDuration,this.zoomHistory=s.zoomHistory,this.transition=s.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ll,this.transition={})}isSupportedScript(e){return function(s,h){for(const m of s)if(!Th(m.charCodeAt(0),h))return!1;return!0}(e,En.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,s=e-Math.floor(e),h=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:s+(1-s)*h}:{fromScale:.5,toScale:1,t:1-(1-h)*s}}}class ko{constructor(e,s){this.property=e,this.value=s,this.expression=function(h,m){if(go(h))return new Ea(h,m);if(vo(h)){const b=Sl(h,m);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=h;return m.type==="color"&&typeof h=="string"?b=Ai.parse(h):m.type!=="padding"||typeof h!="number"&&!Array.isArray(h)?m.type==="variableAnchorOffsetCollection"&&Array.isArray(h)&&(b=Er.parse(h)):b=Mr.parse(h),{kind:"constant",evaluate:()=>b}}}(s===void 0?e.specification.default:s,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,s,h){return this.property.possiblyEvaluate(this,e,s,h)}}class ql{constructor(e){this.property=e,this.value=new ko(e,void 0)}transitioned(e,s){return new au(this.property,this.value,s,re({},e.transition,this.transition),e.now)}untransitioned(){return new au(this.property,this.value,null,{},0)}}class su{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return be(this._values[e].value.value)}setValue(e,s){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new ql(this._values[e].property)),this._values[e].value=new ko(this._values[e].property,s===null?void 0:be(s))}getTransition(e){return be(this._values[e].transition)}setTransition(e,s){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new ql(this._values[e].property)),this._values[e].transition=be(s)||void 0}serialize(){const e={};for(const s of Object.keys(this._values)){const h=this.getValue(s);h!==void 0&&(e[s]=h);const m=this.getTransition(s);m!==void 0&&(e[`${s}-transition`]=m)}return e}transitioned(e,s){const h=new ou(this._properties);for(const m of Object.keys(this._values))h._values[m]=this._values[m].transitioned(e,s._values[m]);return h}untransitioned(){const e=new ou(this._properties);for(const s of Object.keys(this._values))e._values[s]=this._values[s].untransitioned();return e}}class au{constructor(e,s,h,m,b){this.property=e,this.value=s,this.begin=b+m.delay||0,this.end=this.begin+m.duration||0,e.specification.transition&&(m.delay||m.duration)&&(this.prior=h)}possiblyEvaluate(e,s,h){const m=e.now||0,b=this.value.possiblyEvaluate(e,s,h),x=this.prior;if(x){if(m>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(m=1)return 1;const B=P*P,N=B*P;return 4*(P<.5?N:3*(P-B)+N-.75)}(E))}}return b}}class ou{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,s,h){const m=new To(this._properties);for(const b of Object.keys(this._values))m._values[b]=this._values[b].possiblyEvaluate(e,s,h);return m}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class na{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return be(this._values[e].value)}setValue(e,s){this._values[e]=new ko(this._values[e].property,s===null?void 0:be(s))}serialize(){const e={};for(const s of Object.keys(this._values)){const h=this.getValue(s);h!==void 0&&(e[s]=h)}return e}possiblyEvaluate(e,s,h){const m=new To(this._properties);for(const b of Object.keys(this._values))m._values[b]=this._values[b].possiblyEvaluate(e,s,h);return m}}class Kn{constructor(e,s,h){this.property=e,this.value=s,this.parameters=h}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,s,h,m){return this.property.evaluate(this.value,this.parameters,e,s,h,m)}}class To{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Qt{constructor(e){this.specification=e}possiblyEvaluate(e,s){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(s)}interpolate(e,s,h){const m=bn[this.specification.type];return m?m(e,s,h):e}}class ci{constructor(e,s){this.specification=e,this.overrides=s}possiblyEvaluate(e,s,h,m){return new Kn(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(s,null,{},h,m)}:e.expression,s)}interpolate(e,s,h){if(e.value.kind!=="constant"||s.value.kind!=="constant")return e;if(e.value.value===void 0||s.value.value===void 0)return new Kn(this,{kind:"constant",value:void 0},e.parameters);const m=bn[this.specification.type];if(m){const b=m(e.value.value,s.value.value,h);return new Kn(this,{kind:"constant",value:b},e.parameters)}return e}evaluate(e,s,h,m,b,x){return e.kind==="constant"?e.value:e.evaluate(s,h,m,b,x)}}class Co extends ci{possiblyEvaluate(e,s,h,m){if(e.value===void 0)return new Kn(this,{kind:"constant",value:void 0},s);if(e.expression.kind==="constant"){const b=e.expression.evaluate(s,null,{},h,m),x=e.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,E=this._calculate(x,x,x,s);return new Kn(this,{kind:"constant",value:E},s)}if(e.expression.kind==="camera"){const b=this._calculate(e.expression.evaluate({zoom:s.zoom-1}),e.expression.evaluate({zoom:s.zoom}),e.expression.evaluate({zoom:s.zoom+1}),s);return new Kn(this,{kind:"constant",value:b},s)}return new Kn(this,e.expression,s)}evaluate(e,s,h,m,b,x){if(e.kind==="source"){const E=e.evaluate(s,h,m,b,x);return this._calculate(E,E,E,s)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(s.zoom)-1},h,m),e.evaluate({zoom:Math.floor(s.zoom)},h,m),e.evaluate({zoom:Math.floor(s.zoom)+1},h,m),s):e.value}_calculate(e,s,h,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:e,to:s}:{from:h,to:s}}interpolate(e){return e}}class Zl{constructor(e){this.specification=e}possiblyEvaluate(e,s,h,m){if(e.value!==void 0){if(e.expression.kind==="constant"){const b=e.expression.evaluate(s,null,{},h,m);return this._calculate(b,b,b,s)}return this._calculate(e.expression.evaluate(new tr(Math.floor(s.zoom-1),s)),e.expression.evaluate(new tr(Math.floor(s.zoom),s)),e.expression.evaluate(new tr(Math.floor(s.zoom+1),s)),s)}}_calculate(e,s,h,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:e,to:s}:{from:h,to:s}}interpolate(e){return e}}class Xn{constructor(e){this.specification=e}possiblyEvaluate(e,s,h,m){return!!e.expression.evaluate(s,null,{},h,m)}interpolate(){return!1}}class en{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const s in e){const h=e[s];h.specification.overridable&&this.overridableProperties.push(s);const m=this.defaultPropertyValues[s]=new ko(h,void 0),b=this.defaultTransitionablePropertyValues[s]=new ql(h);this.defaultTransitioningPropertyValues[s]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=m.possiblyEvaluate({})}}}$t("DataDrivenProperty",ci),$t("DataConstantProperty",Qt),$t("CrossFadedDataDrivenProperty",Co),$t("CrossFadedProperty",Zl),$t("ColorRampProperty",Xn);const Io="-transition";class $n extends ft{constructor(e,s){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),s.layout&&(this._unevaluatedLayout=new na(s.layout)),s.paint)){this._transitionablePaint=new su(s.paint);for(const h in e.paint)this.setPaintProperty(h,e.paint[h],{validate:!1});for(const h in e.layout)this.setLayoutProperty(h,e.layout[h],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new To(s.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,s,h={}){s!=null&&this._validate(Ml,`layers.${this.id}.layout.${e}`,e,s,h)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,s):this.visibility=s)}getPaintProperty(e){return e.endsWith(Io)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,s,h={}){if(s!=null&&this._validate(iu,`layers.${this.id}.paint.${e}`,e,s,h))return!1;if(e.endsWith(Io))return this._transitionablePaint.setTransition(e.slice(0,-11),s||void 0),!1;{const m=this._transitionablePaint._values[e],b=m.property.specification["property-type"]==="cross-faded-data-driven",x=m.value.isDataDriven(),E=m.value;this._transitionablePaint.setValue(e,s),this._handleSpecialPaintPropertyUpdate(e);const P=this._transitionablePaint._values[e].value;return P.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(e,E,P)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,s,h){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,s){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,s)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,s)}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),nt(e,(s,h)=>!(s===void 0||h==="layout"&&!Object.keys(s).length||h==="paint"&&!Object.keys(s).length))}_validate(e,s,h,m,b={}){return(!b||b.validate!==!1)&&Dl(this,e.call(za,{key:s,layerType:this.type,objectKey:h,value:m,styleSpec:Ie,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const s=this.paint.get(e);if(s instanceof Kn&&Js(s.property.specification)&&(s.value.kind==="source"||s.value.kind==="composite")&&s.value.isStateDependent)return!0}return!1}}const Gl={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ba{constructor(e,s){this._structArray=e,this._pos1=s*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Yi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,s){return e._trim(),s&&(e.isTransferred=!0,s.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const s=Object.create(this.prototype);return s.arrayBuffer=e.arrayBuffer,s.length=e.length,s.capacity=e.arrayBuffer.byteLength/s.bytesPerElement,s._refreshViews(),s}_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 s=this.uint8;this._refreshViews(),s&&this.uint8.set(s)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ir(r,e=1){let s=0,h=0;return{members:r.map(m=>{const b=Gl[m.type].BYTES_PER_ELEMENT,x=s=lu(s,Math.max(e,b)),E=m.components||1;return h=Math.max(h,b),s+=b*E,{name:m.name,type:m.type,components:E,offset:x}}),size:lu(s,Math.max(h,e)),alignment:e}}function lu(r,e){return Math.ceil(r/e)*e}class sa extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s){const h=this.length;return this.resize(h+1),this.emplace(h,e,s)}emplace(e,s,h){const m=2*e;return this.int16[m+0]=s,this.int16[m+1]=h,e}}sa.prototype.bytesPerElement=4,$t("StructArrayLayout2i4",sa);class Ss extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,s,h)}emplace(e,s,h,m){const b=3*e;return this.int16[b+0]=s,this.int16[b+1]=h,this.int16[b+2]=m,e}}Ss.prototype.bytesPerElement=6,$t("StructArrayLayout3i6",Ss);class Wl extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,m){const b=this.length;return this.resize(b+1),this.emplace(b,e,s,h,m)}emplace(e,s,h,m,b){const x=4*e;return this.int16[x+0]=s,this.int16[x+1]=h,this.int16[x+2]=m,this.int16[x+3]=b,e}}Wl.prototype.bytesPerElement=8,$t("StructArrayLayout4i8",Wl);class Hl extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,e,s,h,m,b,x)}emplace(e,s,h,m,b,x,E){const P=6*e;return this.int16[P+0]=s,this.int16[P+1]=h,this.int16[P+2]=m,this.int16[P+3]=b,this.int16[P+4]=x,this.int16[P+5]=E,e}}Hl.prototype.bytesPerElement=12,$t("StructArrayLayout2i4i12",Hl);class Ao extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,e,s,h,m,b,x)}emplace(e,s,h,m,b,x,E){const P=4*e,B=8*e;return this.int16[P+0]=s,this.int16[P+1]=h,this.uint8[B+4]=m,this.uint8[B+5]=b,this.uint8[B+6]=x,this.uint8[B+7]=E,e}}Ao.prototype.bytesPerElement=8,$t("StructArrayLayout2i4ub8",Ao);class Oa extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s){const h=this.length;return this.resize(h+1),this.emplace(h,e,s)}emplace(e,s,h){const m=2*e;return this.float32[m+0]=s,this.float32[m+1]=h,e}}Oa.prototype.bytesPerElement=8,$t("StructArrayLayout2f8",Oa);class Kl extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b,x,E,P,B,N){const $=this.length;return this.resize($+1),this.emplace($,e,s,h,m,b,x,E,P,B,N)}emplace(e,s,h,m,b,x,E,P,B,N,$){const W=10*e;return this.uint16[W+0]=s,this.uint16[W+1]=h,this.uint16[W+2]=m,this.uint16[W+3]=b,this.uint16[W+4]=x,this.uint16[W+5]=E,this.uint16[W+6]=P,this.uint16[W+7]=B,this.uint16[W+8]=N,this.uint16[W+9]=$,e}}Kl.prototype.bytesPerElement=20,$t("StructArrayLayout10ui20",Kl);class ji extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b,x,E,P,B,N,$,W){const te=this.length;return this.resize(te+1),this.emplace(te,e,s,h,m,b,x,E,P,B,N,$,W)}emplace(e,s,h,m,b,x,E,P,B,N,$,W,te){const ie=12*e;return this.int16[ie+0]=s,this.int16[ie+1]=h,this.int16[ie+2]=m,this.int16[ie+3]=b,this.uint16[ie+4]=x,this.uint16[ie+5]=E,this.uint16[ie+6]=P,this.uint16[ie+7]=B,this.int16[ie+8]=N,this.int16[ie+9]=$,this.int16[ie+10]=W,this.int16[ie+11]=te,e}}ji.prototype.bytesPerElement=24,$t("StructArrayLayout4i4ui4i24",ji);class y extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,s,h)}emplace(e,s,h,m){const b=3*e;return this.float32[b+0]=s,this.float32[b+1]=h,this.float32[b+2]=m,e}}y.prototype.bytesPerElement=12,$t("StructArrayLayout3f12",y);class t extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.uint32[1*e+0]=s,e}}t.prototype.bytesPerElement=4,$t("StructArrayLayout1ul4",t);class c extends Yi{_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,s,h,m,b,x,E,P,B){const N=this.length;return this.resize(N+1),this.emplace(N,e,s,h,m,b,x,E,P,B)}emplace(e,s,h,m,b,x,E,P,B,N){const $=10*e,W=5*e;return this.int16[$+0]=s,this.int16[$+1]=h,this.int16[$+2]=m,this.int16[$+3]=b,this.int16[$+4]=x,this.int16[$+5]=E,this.uint32[W+3]=P,this.uint16[$+8]=B,this.uint16[$+9]=N,e}}c.prototype.bytesPerElement=20,$t("StructArrayLayout6i1ul2ui20",c);class d extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b,x){const E=this.length;return this.resize(E+1),this.emplace(E,e,s,h,m,b,x)}emplace(e,s,h,m,b,x,E){const P=6*e;return this.int16[P+0]=s,this.int16[P+1]=h,this.int16[P+2]=m,this.int16[P+3]=b,this.int16[P+4]=x,this.int16[P+5]=E,e}}d.prototype.bytesPerElement=12,$t("StructArrayLayout2i2i2i12",d);class g extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b){const x=this.length;return this.resize(x+1),this.emplace(x,e,s,h,m,b)}emplace(e,s,h,m,b,x){const E=4*e,P=8*e;return this.float32[E+0]=s,this.float32[E+1]=h,this.float32[E+2]=m,this.int16[P+6]=b,this.int16[P+7]=x,e}}g.prototype.bytesPerElement=16,$t("StructArrayLayout2f1f2i16",g);class w extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h,m){const b=this.length;return this.resize(b+1),this.emplace(b,e,s,h,m)}emplace(e,s,h,m,b){const x=12*e,E=3*e;return this.uint8[x+0]=s,this.uint8[x+1]=h,this.float32[E+1]=m,this.float32[E+2]=b,e}}w.prototype.bytesPerElement=12,$t("StructArrayLayout2ub2f12",w);class k extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,s,h)}emplace(e,s,h,m){const b=3*e;return this.uint16[b+0]=s,this.uint16[b+1]=h,this.uint16[b+2]=m,e}}k.prototype.bytesPerElement=6,$t("StructArrayLayout3ui6",k);class A extends Yi{_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,s,h,m,b,x,E,P,B,N,$,W,te,ie,de,Ee,Ae){const Ve=this.length;return this.resize(Ve+1),this.emplace(Ve,e,s,h,m,b,x,E,P,B,N,$,W,te,ie,de,Ee,Ae)}emplace(e,s,h,m,b,x,E,P,B,N,$,W,te,ie,de,Ee,Ae,Ve){const Le=24*e,Ze=12*e,Qe=48*e;return this.int16[Le+0]=s,this.int16[Le+1]=h,this.uint16[Le+2]=m,this.uint16[Le+3]=b,this.uint32[Ze+2]=x,this.uint32[Ze+3]=E,this.uint32[Ze+4]=P,this.uint16[Le+10]=B,this.uint16[Le+11]=N,this.uint16[Le+12]=$,this.float32[Ze+7]=W,this.float32[Ze+8]=te,this.uint8[Qe+36]=ie,this.uint8[Qe+37]=de,this.uint8[Qe+38]=Ee,this.uint32[Ze+10]=Ae,this.int16[Le+22]=Ve,e}}A.prototype.bytesPerElement=48,$t("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",A);class L extends Yi{_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,s,h,m,b,x,E,P,B,N,$,W,te,ie,de,Ee,Ae,Ve,Le,Ze,Qe,ht,Ft,Ht,Ot,Lt,zt,jt){const Mt=this.length;return this.resize(Mt+1),this.emplace(Mt,e,s,h,m,b,x,E,P,B,N,$,W,te,ie,de,Ee,Ae,Ve,Le,Ze,Qe,ht,Ft,Ht,Ot,Lt,zt,jt)}emplace(e,s,h,m,b,x,E,P,B,N,$,W,te,ie,de,Ee,Ae,Ve,Le,Ze,Qe,ht,Ft,Ht,Ot,Lt,zt,jt,Mt){const St=32*e,oi=16*e;return this.int16[St+0]=s,this.int16[St+1]=h,this.int16[St+2]=m,this.int16[St+3]=b,this.int16[St+4]=x,this.int16[St+5]=E,this.int16[St+6]=P,this.int16[St+7]=B,this.uint16[St+8]=N,this.uint16[St+9]=$,this.uint16[St+10]=W,this.uint16[St+11]=te,this.uint16[St+12]=ie,this.uint16[St+13]=de,this.uint16[St+14]=Ee,this.uint16[St+15]=Ae,this.uint16[St+16]=Ve,this.uint16[St+17]=Le,this.uint16[St+18]=Ze,this.uint16[St+19]=Qe,this.uint16[St+20]=ht,this.uint16[St+21]=Ft,this.uint16[St+22]=Ht,this.uint32[oi+12]=Ot,this.float32[oi+13]=Lt,this.float32[oi+14]=zt,this.uint16[St+30]=jt,this.uint16[St+31]=Mt,e}}L.prototype.bytesPerElement=64,$t("StructArrayLayout8i15ui1ul2f2ui64",L);class O extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.float32[1*e+0]=s,e}}O.prototype.bytesPerElement=4,$t("StructArrayLayout1f4",O);class U extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,s,h)}emplace(e,s,h,m){const b=3*e;return this.uint16[6*e+0]=s,this.float32[b+1]=h,this.float32[b+2]=m,e}}U.prototype.bytesPerElement=12,$t("StructArrayLayout1ui2f12",U);class V extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,s,h)}emplace(e,s,h,m){const b=4*e;return this.uint32[2*e+0]=s,this.uint16[b+2]=h,this.uint16[b+3]=m,e}}V.prototype.bytesPerElement=8,$t("StructArrayLayout1ul2ui8",V);class J extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s){const h=this.length;return this.resize(h+1),this.emplace(h,e,s)}emplace(e,s,h){const m=2*e;return this.uint16[m+0]=s,this.uint16[m+1]=h,e}}J.prototype.bytesPerElement=4,$t("StructArrayLayout2ui4",J);class pe extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.uint16[1*e+0]=s,e}}pe.prototype.bytesPerElement=2,$t("StructArrayLayout1ui2",pe);class fe extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h,m){const b=this.length;return this.resize(b+1),this.emplace(b,e,s,h,m)}emplace(e,s,h,m,b){const x=4*e;return this.float32[x+0]=s,this.float32[x+1]=h,this.float32[x+2]=m,this.float32[x+3]=b,e}}fe.prototype.bytesPerElement=16,$t("StructArrayLayout4f16",fe);class we extends Ba{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 I(this.anchorPointX,this.anchorPointY)}}we.prototype.size=20;class ue extends c{get(e){return new we(this,e)}}$t("CollisionBoxArray",ue);class Oe extends Ba{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]}}Oe.prototype.size=48;class Xe extends A{get(e){return new Oe(this,e)}}$t("PlacedSymbolArray",Xe);class Te extends Ba{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 collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Te.prototype.size=64;class Ue extends L{get(e){return new Te(this,e)}}$t("SymbolInstanceArray",Ue);class it extends O{getoffsetX(e){return this.float32[1*e+0]}}$t("GlyphOffsetArray",it);class rt extends Ss{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}$t("SymbolLineVertexArray",rt);class ut extends Ba{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}ut.prototype.size=12;class xt extends U{get(e){return new ut(this,e)}}$t("TextAnchorOffsetArray",xt);class yt extends Ba{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]}}yt.prototype.size=8;class It extends V{get(e){return new yt(this,e)}}$t("FeatureIndexArray",It);class Gt extends sa{}class Mi extends sa{}class Dt extends sa{}class ui extends Hl{}class Kt extends Ao{}class rr extends Oa{}class xi extends Kl{}class Ei extends ji{}class Di extends y{}class gr extends t{}class Xi extends d{}class Bn extends w{}class fr extends k{}class cr extends J{}const kn=ir([{name:"a_pos",components:2,type:"Int16"}],4),{members:Jn}=kn;class nr{constructor(e=[]){this.segments=e}prepareSegment(e,s,h,m){let b=this.segments[this.segments.length-1];return e>nr.MAX_VERTEX_ARRAY_LENGTH&&q(`Max vertices per segment is ${nr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!b||b.vertexLength+e>nr.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==m)&&(b={vertexOffset:s.length,primitiveOffset:h.length,vertexLength:0,primitiveLength:0},m!==void 0&&(b.sortKey=m),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const e of this.segments)for(const s in e.vaos)e.vaos[s].destroy()}static simpleSegment(e,s,h,m){return new nr([{vertexOffset:e,primitiveOffset:s,vertexLength:h,primitiveLength:m,vaos:{},sortKey:0}])}}function Es(r,e){return 256*(r=se(Math.floor(r),0,255))+se(Math.floor(e),0,255)}nr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,$t("SegmentVector",nr);const ks=ir([{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 ls={exports:{}},Fs={exports:{}};Fs.exports=function(r,e){var s,h,m,b,x,E,P,B;for(h=r.length-(s=3&r.length),m=e,x=3432918353,E=461845907,B=0;B>>16)*x&65535)<<16)&4294967295)<<15|P>>>17))*E+(((P>>>16)*E&65535)<<16)&4294967295)<<13|m>>>19))+((5*(m>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(P=0,s){case 3:P^=(255&r.charCodeAt(B+2))<<16;case 2:P^=(255&r.charCodeAt(B+1))<<8;case 1:m^=P=(65535&(P=(P=(65535&(P^=255&r.charCodeAt(B)))*x+(((P>>>16)*x&65535)<<16)&4294967295)<<15|P>>>17))*E+(((P>>>16)*E&65535)<<16)&4294967295}return m^=r.length,m=2246822507*(65535&(m^=m>>>16))+((2246822507*(m>>>16)&65535)<<16)&4294967295,m=3266489909*(65535&(m^=m>>>13))+((3266489909*(m>>>16)&65535)<<16)&4294967295,(m^=m>>>16)>>>0};var tn=Fs.exports,jr={exports:{}};jr.exports=function(r,e){for(var s,h=r.length,m=e^h,b=0;h>=4;)s=1540483477*(65535&(s=255&r.charCodeAt(b)|(255&r.charCodeAt(++b))<<8|(255&r.charCodeAt(++b))<<16|(255&r.charCodeAt(++b))<<24))+((1540483477*(s>>>16)&65535)<<16),m=1540483477*(65535&m)+((1540483477*(m>>>16)&65535)<<16)^(s=1540483477*(65535&(s^=s>>>24))+((1540483477*(s>>>16)&65535)<<16)),h-=4,++b;switch(h){case 3:m^=(255&r.charCodeAt(b+2))<<16;case 2:m^=(255&r.charCodeAt(b+1))<<8;case 1:m=1540483477*(65535&(m^=255&r.charCodeAt(b)))+((1540483477*(m>>>16)&65535)<<16)}return m=1540483477*(65535&(m^=m>>>13))+((1540483477*(m>>>16)&65535)<<16),(m^=m>>>15)>>>0};var Wr=tn,Fa=jr.exports;ls.exports=Wr,ls.exports.murmur3=Wr,ls.exports.murmur2=Fa;var _r=v(ls.exports);class yr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,s,h,m){this.ids.push(Tn(e)),this.positions.push(s,h,m)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const s=Tn(e);let h=0,m=this.ids.length-1;for(;h>1;this.ids[x]>=s?m=x:h=x+1}const b=[];for(;this.ids[h]===s;)b.push({index:this.positions[3*h],start:this.positions[3*h+1],end:this.positions[3*h+2]}),h++;return b}static serialize(e,s){const h=new Float64Array(e.ids),m=new Uint32Array(e.positions);return vr(h,m,0,h.length-1),s&&s.push(h.buffer,m.buffer),{ids:h,positions:m}}static deserialize(e){const s=new yr;return s.ids=e.ids,s.positions=e.positions,s.indexed=!0,s}}function Tn(r){const e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:_r(String(r))}function vr(r,e,s,h){for(;s>1];let b=s-1,x=h+1;for(;;){do b++;while(r[b]m);if(b>=x)break;Po(r,b,x),Po(e,3*b,3*x),Po(e,3*b+1,3*x+1),Po(e,3*b+2,3*x+2)}x-s`u_${m}`),this.type=h}setUniform(e,s,h){e.set(h.constantOr(this.value))}getBinding(e,s,h){return this.type==="color"?new uu(e,s):new zo(e,s)}}class Us{constructor(e,s){this.uniformNames=s.map(h=>`u_${h}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,s){this.pixelRatioFrom=s.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=s.tlbr,this.patternTo=e.tlbr}setUniform(e,s,h,m){const b=m==="u_pattern_to"?this.patternTo:m==="u_pattern_from"?this.patternFrom:m==="u_pixel_ratio_to"?this.pixelRatioTo:m==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&e.set(b)}getBinding(e,s,h){return h.substr(0,9)==="u_pattern"?new cu(e,s):new zo(e,s)}}class Yn{constructor(e,s,h,m){this.expression=e,this.type=h,this.maxValue=0,this.paintVertexAttributes=s.map(b=>({name:`a_${b}`,type:"Float32",components:h==="color"?2:1,offset:0})),this.paintVertexArray=new m}populatePaintArray(e,s,h,m,b){const x=this.paintVertexArray.length,E=this.expression.evaluate(new tr(0),s,{},m,[],b);this.paintVertexArray.resize(e),this._setPaintValue(x,e,E)}updatePaintArray(e,s,h,m){const b=this.expression.evaluate({zoom:0},h,m);this._setPaintValue(e,s,b)}_setPaintValue(e,s,h){if(this.type==="color"){const m=Ts(h);for(let b=e;b`u_${E}_t`),this.type=h,this.useIntegerZoom=m,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=s.map(E=>({name:`a_${E}`,type:"Float32",components:h==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(e,s,h,m,b){const x=this.expression.evaluate(new tr(this.zoom),s,{},m,[],b),E=this.expression.evaluate(new tr(this.zoom+1),s,{},m,[],b),P=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(P,e,x,E)}updatePaintArray(e,s,h,m){const b=this.expression.evaluate({zoom:this.zoom},h,m),x=this.expression.evaluate({zoom:this.zoom+1},h,m);this._setPaintValue(e,s,b,x)}_setPaintValue(e,s,h,m){if(this.type==="color"){const b=Ts(h),x=Ts(m);for(let E=e;E`#define HAS_UNIFORM_${m}`))}return e}getBinderAttributes(){const e=[];for(const s in this.binders){const h=this.binders[s];if(h instanceof Yn||h instanceof Cn)for(let m=0;m!0){this.programConfigurations={};for(const m of e)this.programConfigurations[m.id]=new Mo(m,s,h);this.needsUpload=!1,this._featureMap=new yr,this._bufferOffset=0}populatePaintArrays(e,s,h,m,b,x){for(const E in this.programConfigurations)this.programConfigurations[E].populatePaintArrays(e,s,m,b,x);s.id!==void 0&&this._featureMap.add(s.id,h,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,s,h,m){for(const b of h)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(e,this._featureMap,s,b,m)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const s in this.programConfigurations)this.programConfigurations[s].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function $y(r,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"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function Pd(r,e,s){const h={color:{source:Oa,composite:fe},number:{source:O,composite:Oa}},m=function(b){return{"line-pattern":{source:xi,composite:xi},"fill-pattern":{source:xi,composite:xi},"fill-extrusion-pattern":{source:xi,composite:xi}}[b]}(r);return m&&m[s]||h[e][s]}$t("ConstantBinder",aa),$t("CrossFadedConstantBinder",Us),$t("SourceExpressionBinder",Yn),$t("CrossFadedCompositeBinder",cs),$t("CompositeExpressionBinder",Cn),$t("ProgramConfiguration",Mo,{omit:["_buffers"]}),$t("ProgramConfigurationSet",Na);const kr=8192,Ah=Math.pow(2,14)-1,zd=-Ah-1;function Ua(r){const e=kr/r.extent,s=r.loadGeometry();for(let h=0;hx.x+1||Px.y+1)&&q("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return s}function Va(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?Ua(r):[]}}function hu(r,e,s,h,m){r.emplaceBack(2*e+(h+1)/2,2*s+(m+1)/2)}class Ph{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(s=>s.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Mi,this.indexArray=new fr,this.segments=new nr,this.programConfigurations=new Na(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){const m=this.layers[0],b=[];let x=null,E=!1;m.type==="circle"&&(x=m.layout.get("circle-sort-key"),E=!x.isConstant());for(const{feature:P,id:B,index:N,sourceLayerIndex:$}of e){const W=this.layers[0]._featureFilter.needGeometry,te=Va(P,W);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),te,h))continue;const ie=E?x.evaluate(te,{},h):void 0,de={id:B,properties:P.properties,type:P.type,sourceLayerIndex:$,index:N,geometry:W?te.geometry:Ua(P),patterns:{},sortKey:ie};b.push(de)}E&&b.sort((P,B)=>P.sortKey-B.sortKey);for(const P of b){const{geometry:B,index:N,sourceLayerIndex:$}=P,W=e[N].feature;this.addFeature(P,B,N,h),s.featureIndex.insert(W,B,N,$,this.index)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Jn),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,s,h,m){for(const b of s)for(const x of b){const E=x.x,P=x.y;if(E<0||E>=kr||P<0||P>=kr)continue;const B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),N=B.vertexLength;hu(this.layoutVertexArray,E,P,-1,-1),hu(this.layoutVertexArray,E,P,1,-1),hu(this.layoutVertexArray,E,P,1,1),hu(this.layoutVertexArray,E,P,-1,1),this.indexArray.emplaceBack(N,N+1,N+2),this.indexArray.emplaceBack(N,N+3,N+2),B.vertexLength+=4,B.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,{},m)}}function Md(r,e){for(let s=0;s1){if(zh(r,e))return!0;for(let h=0;h1?s:s.sub(e)._mult(m)._add(e))}function Rd(r,e){let s,h,m,b=!1;for(let x=0;xe.y!=m.y>e.y&&e.x<(m.x-h.x)*(e.y-h.y)/(m.y-h.y)+h.x&&(b=!b)}return b}function Do(r,e){let s=!1;for(let h=0,m=r.length-1;he.y!=x.y>e.y&&e.x<(x.x-b.x)*(e.y-b.y)/(x.y-b.y)+b.x&&(s=!s)}return s}function Gy(r,e,s){const h=s[0],m=s[2];if(r.xm.x&&e.x>m.x||r.ym.y&&e.y>m.y)return!1;const b=He(r,e,s[0]);return b!==He(r,e,s[1])||b!==He(r,e,s[2])||b!==He(r,e,s[3])}function Xl(r,e,s){const h=e.paint.get(r).value;return h.kind==="constant"?h.value:s.programConfigurations.get(e.id).getMaxValue(r)}function fu(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function du(r,e,s,h,m){if(!e[0]&&!e[1])return r;const b=I.convert(e)._mult(m);s==="viewport"&&b._rotate(-h);const x=[];for(let E=0;ENd(Ee,de))}(B,P),te=$?N*E:N;for(const ie of m)for(const de of ie){const Ee=$?de:Nd(de,P);let Ae=te;const Ve=pu([],[de.x,de.y,0,1],P);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Ae*=Ve[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Ae*=x.cameraToCenterDistance/Ve[3]),jy(W,Ee,Ae))return!0}return!1}}function Nd(r,e){const s=pu([],[r.x,r.y,0,1],e);return new I(s[0]/s[3],s[1]/s[3])}class Ud extends Ph{}let Vd;$t("HeatmapBucket",Ud,{omit:["layers"]});var Xy={get paint(){return Vd=Vd||new en({"heatmap-radius":new ci(Ie.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ci(Ie.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Qt(Ie.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Xn(Ie.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Qt(Ie.paint_heatmap["heatmap-opacity"])})}};function Lh(r,{width:e,height:s},h,m){if(m){if(m instanceof Uint8ClampedArray)m=new Uint8Array(m.buffer);else if(m.length!==e*s*h)throw new RangeError(`mismatched image size. expected: ${m.length} but got: ${e*s*h}`)}else m=new Uint8Array(e*s*h);return r.width=e,r.height=s,r.data=m,r}function $d(r,{width:e,height:s},h){if(e===r.width&&s===r.height)return;const m=Lh({},{width:e,height:s},h);Rh(r,m,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,s)},h),r.width=e,r.height=s,r.data=m.data}function Rh(r,e,s,h,m,b){if(m.width===0||m.height===0)return e;if(m.width>r.width||m.height>r.height||s.x>r.width-m.width||s.y>r.height-m.height)throw new RangeError("out of range source coordinates for image copy");if(m.width>e.width||m.height>e.height||h.x>e.width-m.width||h.y>e.height-m.height)throw new RangeError("out of range destination coordinates for image copy");const x=r.data,E=e.data;if(x===E)throw new Error("srcData equals dstData, so image is already copied");for(let P=0;P{e[r.evaluationKey]=P;const B=r.expression.evaluate(e);m.data[x+E+0]=Math.floor(255*B.r/B.a),m.data[x+E+1]=Math.floor(255*B.g/B.a),m.data[x+E+2]=Math.floor(255*B.b/B.a),m.data[x+E+3]=Math.floor(255*B.a)};if(r.clips)for(let x=0,E=0;x80*s){h=b=r[0],m=x=r[1];for(var ie=s;ie<$;ie+=s)(E=r[ie])b&&(b=E),P>x&&(x=P);B=(B=Math.max(b-h,x-m))!==0?32767/B:0}return Ql(W,te,s,h,m,B,0),te}function Zd(r,e,s,h,m){var b,x;if(m===Nh(r,e,s,h)>0)for(b=e;b=e;b-=h)x=Hd(b,r[b],r[b+1],x);return x&&gu(x,x.next)&&(tc(x),x=x.next),x}function $a(r,e){if(!r)return r;e||(e=r);var s,h=r;do if(s=!1,h.steiner||!gu(h,h.next)&&br(h.prev,h,h.next)!==0)h=h.next;else{if(tc(h),(h=e=h.prev)===h.next)break;s=!0}while(s||h!==e);return e}function Ql(r,e,s,h,m,b,x){if(r){!x&&b&&function(N,$,W,te){var ie=N;do ie.z===0&&(ie.z=Oh(ie.x,ie.y,$,W,te)),ie.prevZ=ie.prev,ie.nextZ=ie.next,ie=ie.next;while(ie!==N);ie.prevZ.nextZ=null,ie.prevZ=null,function(de){var Ee,Ae,Ve,Le,Ze,Qe,ht,Ft,Ht=1;do{for(Ae=de,de=null,Ze=null,Qe=0;Ae;){for(Qe++,Ve=Ae,ht=0,Ee=0;Ee0||Ft>0&&Ve;)ht!==0&&(Ft===0||!Ve||Ae.z<=Ve.z)?(Le=Ae,Ae=Ae.nextZ,ht--):(Le=Ve,Ve=Ve.nextZ,Ft--),Ze?Ze.nextZ=Le:de=Le,Le.prevZ=Ze,Ze=Le;Ae=Ve}Ze.nextZ=null,Ht*=2}while(Qe>1)}(ie)}(r,h,m,b);for(var E,P,B=r;r.prev!==r.next;)if(E=r.prev,P=r.next,b?r0(r,h,m,b):i0(r))e.push(E.i/s|0),e.push(r.i/s|0),e.push(P.i/s|0),tc(r),r=P.next,B=P.next;else if((r=P)===B){x?x===1?Ql(r=n0($a(r),e,s),e,s,h,m,b,2):x===2&&s0(r,e,s,h,m,b):Ql($a(r),e,s,h,m,b,1);break}}}function i0(r){var e=r.prev,s=r,h=r.next;if(br(e,s,h)>=0)return!1;for(var m=e.x,b=s.x,x=h.x,E=e.y,P=s.y,B=h.y,N=mb?m>x?m:x:b>x?b:x,te=E>P?E>B?E:B:P>B?P:B,ie=h.next;ie!==e;){if(ie.x>=N&&ie.x<=W&&ie.y>=$&&ie.y<=te&&Ro(m,E,b,P,x,B,ie.x,ie.y)&&br(ie.prev,ie,ie.next)>=0)return!1;ie=ie.next}return!0}function r0(r,e,s,h){var m=r.prev,b=r,x=r.next;if(br(m,b,x)>=0)return!1;for(var E=m.x,P=b.x,B=x.x,N=m.y,$=b.y,W=x.y,te=EP?E>B?E:B:P>B?P:B,Ee=N>$?N>W?N:W:$>W?$:W,Ae=Oh(te,ie,e,s,h),Ve=Oh(de,Ee,e,s,h),Le=r.prevZ,Ze=r.nextZ;Le&&Le.z>=Ae&&Ze&&Ze.z<=Ve;){if(Le.x>=te&&Le.x<=de&&Le.y>=ie&&Le.y<=Ee&&Le!==m&&Le!==x&&Ro(E,N,P,$,B,W,Le.x,Le.y)&&br(Le.prev,Le,Le.next)>=0||(Le=Le.prevZ,Ze.x>=te&&Ze.x<=de&&Ze.y>=ie&&Ze.y<=Ee&&Ze!==m&&Ze!==x&&Ro(E,N,P,$,B,W,Ze.x,Ze.y)&&br(Ze.prev,Ze,Ze.next)>=0))return!1;Ze=Ze.nextZ}for(;Le&&Le.z>=Ae;){if(Le.x>=te&&Le.x<=de&&Le.y>=ie&&Le.y<=Ee&&Le!==m&&Le!==x&&Ro(E,N,P,$,B,W,Le.x,Le.y)&&br(Le.prev,Le,Le.next)>=0)return!1;Le=Le.prevZ}for(;Ze&&Ze.z<=Ve;){if(Ze.x>=te&&Ze.x<=de&&Ze.y>=ie&&Ze.y<=Ee&&Ze!==m&&Ze!==x&&Ro(E,N,P,$,B,W,Ze.x,Ze.y)&&br(Ze.prev,Ze,Ze.next)>=0)return!1;Ze=Ze.nextZ}return!0}function n0(r,e,s){var h=r;do{var m=h.prev,b=h.next.next;!gu(m,b)&&Gd(m,h,h.next,b)&&ec(m,b)&&ec(b,m)&&(e.push(m.i/s|0),e.push(h.i/s|0),e.push(b.i/s|0),tc(h),tc(h.next),h=r=b),h=h.next}while(h!==r);return $a(h)}function s0(r,e,s,h,m,b){var x=r;do{for(var E=x.next.next;E!==x.prev;){if(x.i!==E.i&&u0(x,E)){var P=Wd(x,E);return x=$a(x,x.next),P=$a(P,P.next),Ql(x,e,s,h,m,b,0),void Ql(P,e,s,h,m,b,0)}E=E.next}x=x.next}while(x!==r)}function a0(r,e){return r.x-e.x}function o0(r,e){var s=function(m,b){var x,E=b,P=m.x,B=m.y,N=-1/0;do{if(B<=E.y&&B>=E.next.y&&E.next.y!==E.y){var $=E.x+(B-E.y)*(E.next.x-E.x)/(E.next.y-E.y);if($<=P&&$>N&&(N=$,x=E.x=E.x&&E.x>=ie&&P!==E.x&&Ro(Bx.x||E.x===x.x&&l0(x,E)))&&(x=E,Ee=W)),E=E.next;while(E!==te);return x}(r,e);if(!s)return e;var h=Wd(s,r);return $a(h,h.next),$a(s,s.next)}function l0(r,e){return br(r.prev,r,e.prev)<0&&br(e.next,r,r.next)<0}function Oh(r,e,s,h,m){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-s)*m|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-h)*m|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function c0(r){var e=r,s=r;do(e.x=(r-x)*(b-E)&&(r-x)*(h-E)>=(s-x)*(e-E)&&(s-x)*(b-E)>=(m-x)*(h-E)}function u0(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!function(s,h){var m=s;do{if(m.i!==s.i&&m.next.i!==s.i&&m.i!==h.i&&m.next.i!==h.i&&Gd(m,m.next,s,h))return!0;m=m.next}while(m!==s);return!1}(r,e)&&(ec(r,e)&&ec(e,r)&&function(s,h){var m=s,b=!1,x=(s.x+h.x)/2,E=(s.y+h.y)/2;do m.y>E!=m.next.y>E&&m.next.y!==m.y&&x<(m.next.x-m.x)*(E-m.y)/(m.next.y-m.y)+m.x&&(b=!b),m=m.next;while(m!==s);return b}(r,e)&&(br(r.prev,r,e.prev)||br(r,e.prev,e))||gu(r,e)&&br(r.prev,r,r.next)>0&&br(e.prev,e,e.next)>0)}function br(r,e,s){return(e.y-r.y)*(s.x-e.x)-(e.x-r.x)*(s.y-e.y)}function gu(r,e){return r.x===e.x&&r.y===e.y}function Gd(r,e,s,h){var m=yu(br(r,e,s)),b=yu(br(r,e,h)),x=yu(br(s,h,r)),E=yu(br(s,h,e));return m!==b&&x!==E||!(m!==0||!_u(r,s,e))||!(b!==0||!_u(r,h,e))||!(x!==0||!_u(s,r,h))||!(E!==0||!_u(s,e,h))}function _u(r,e,s){return e.x<=Math.max(r.x,s.x)&&e.x>=Math.min(r.x,s.x)&&e.y<=Math.max(r.y,s.y)&&e.y>=Math.min(r.y,s.y)}function yu(r){return r>0?1:r<0?-1:0}function ec(r,e){return br(r.prev,r,r.next)<0?br(r,e,r.next)>=0&&br(r,r.prev,e)>=0:br(r,e,r.prev)<0||br(r,r.next,e)<0}function Wd(r,e){var s=new Fh(r.i,r.x,r.y),h=new Fh(e.i,e.x,e.y),m=r.next,b=e.prev;return r.next=e,e.prev=r,s.next=m,m.prev=s,h.next=s,s.prev=h,b.next=h,h.prev=b,h}function Hd(r,e,s,h){var m=new Fh(r,e,s);return h?(m.next=h.next,m.prev=h,h.next.prev=m,h.next=m):(m.prev=m,m.next=m),m}function tc(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Fh(r,e,s){this.i=r,this.x=e,this.y=s,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Nh(r,e,s,h){for(var m=0,b=e,x=s-h;b0&&s.holes.push(h+=r[m-1].length)}return s};var Kd=v(Bh.exports);function h0(r,e,s,h,m){Xd(r,e,s||0,h||r.length-1,m||f0)}function Xd(r,e,s,h,m){for(;h>s;){if(h-s>600){var b=h-s+1,x=e-s+1,E=Math.log(b),P=.5*Math.exp(2*E/3),B=.5*Math.sqrt(E*P*(b-P)/b)*(x-b/2<0?-1:1);Xd(r,e,Math.max(s,Math.floor(e-x*P/b+B)),Math.min(h,Math.floor(e+(b-x)*P/b+B)),m)}var N=r[e],$=s,W=h;for(ic(r,s,e),m(r[h],N)>0&&ic(r,s,h);$0;)W--}m(r[s],N)===0?ic(r,s,W):ic(r,++W,h),W<=e&&(s=W+1),e<=W&&(h=W-1)}}function ic(r,e,s){var h=r[e];r[e]=r[s],r[s]=h}function f0(r,e){return re?1:0}function Uh(r,e){const s=r.length;if(s<=1)return[r];const h=[];let m,b;for(let x=0;x1)for(let x=0;xs.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Dt,this.indexArray=new fr,this.indexArray2=new cr,this.programConfigurations=new Na(e.layers,e.zoom),this.segments=new nr,this.segments2=new nr,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){this.hasPattern=Vh("fill",this.layers,s);const m=this.layers[0].layout.get("fill-sort-key"),b=!m.isConstant(),x=[];for(const{feature:E,id:P,index:B,sourceLayerIndex:N}of e){const $=this.layers[0]._featureFilter.needGeometry,W=Va(E,$);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),W,h))continue;const te=b?m.evaluate(W,{},h,s.availableImages):void 0,ie={id:P,properties:E.properties,type:E.type,sourceLayerIndex:N,index:B,geometry:$?W.geometry:Ua(E),patterns:{},sortKey:te};x.push(ie)}b&&x.sort((E,P)=>E.sortKey-P.sortKey);for(const E of x){const{geometry:P,index:B,sourceLayerIndex:N}=E;if(this.hasPattern){const $=$h("fill",this.layers,E,this.zoom,s);this.patternFeatures.push($)}else this.addFeature(E,P,B,h,{});s.featureIndex.insert(e[B].feature,P,B,N,this.index)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}addFeatures(e,s,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,s,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,t0),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,s,h,m,b){for(const x of Uh(s,500)){let E=0;for(const te of x)E+=te.length;const P=this.segments.prepareSegment(E,this.layoutVertexArray,this.indexArray),B=P.vertexLength,N=[],$=[];for(const te of x){if(te.length===0)continue;te!==x[0]&&$.push(N.length/2);const ie=this.segments2.prepareSegment(te.length,this.layoutVertexArray,this.indexArray2),de=ie.vertexLength;this.layoutVertexArray.emplaceBack(te[0].x,te[0].y),this.indexArray2.emplaceBack(de+te.length-1,de),N.push(te[0].x),N.push(te[0].y);for(let Ee=1;Ee>3}if(m--,h===1||h===2)b+=r.readSVarint(),x+=r.readSVarint(),h===1&&(e&&E.push(e),e=[]),e.push(new v0(b,x));else{if(h!==7)throw new Error("unknown command "+h);e&&e.push(e[0].clone())}}return e&&E.push(e),E},Bo.prototype.bbox=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,s=1,h=0,m=0,b=0,x=1/0,E=-1/0,P=1/0,B=-1/0;r.pos>3}if(h--,s===1||s===2)(m+=r.readSVarint())E&&(E=m),(b+=r.readSVarint())B&&(B=b);else if(s!==7)throw new Error("unknown command "+s)}return[x,P,E,B]},Bo.prototype.toGeoJSON=function(r,e,s){var h,m,b=this.extent*Math.pow(2,s),x=this.extent*r,E=this.extent*e,P=this.loadGeometry(),B=Bo.types[this.type];function N(te){for(var ie=0;ie>3;m=x===1?h.readString():x===2?h.readFloat():x===3?h.readDouble():x===4?h.readVarint64():x===5?h.readVarint():x===6?h.readSVarint():x===7?h.readBoolean():null}return m}(s))}tp.prototype.feature=function(r){if(r<0||r>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[r];var e=this._pbf.readVarint()+this._pbf.pos;return new x0(this._pbf,e,this.extent,this._keys,this._values)};var E0=ep;function k0(r,e,s){if(r===3){var h=new E0(s,s.readVarint()+s.pos);h.length&&(e[h.name]=h)}}oa.VectorTile=function(r,e){this.layers=r.readFields(k0,{},e)},oa.VectorTileFeature=Qd,oa.VectorTileLayer=ep;const T0=oa.VectorTileFeature.types,qh=Math.pow(2,13);function rc(r,e,s,h,m,b,x,E){r.emplaceBack(e,s,2*Math.floor(h*qh)+x,m*qh*2,b*qh*2,Math.round(E))}class Zh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(s=>s.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new ui,this.centroidVertexArray=new Gt,this.indexArray=new fr,this.programConfigurations=new Na(e.layers,e.zoom),this.segments=new nr,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){this.features=[],this.hasPattern=Vh("fill-extrusion",this.layers,s);for(const{feature:m,id:b,index:x,sourceLayerIndex:E}of e){const P=this.layers[0]._featureFilter.needGeometry,B=Va(m,P);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),B,h))continue;const N={id:b,sourceLayerIndex:E,index:x,geometry:P?B.geometry:Ua(m),properties:m.properties,type:m.type,patterns:{}};this.hasPattern?this.features.push($h("fill-extrusion",this.layers,N,this.zoom,s)):this.addFeature(N,N.geometry,x,h,{}),s.featureIndex.insert(m,N.geometry,x,E,this.index,!0)}}addFeatures(e,s,h){for(const m of this.features){const{geometry:b}=m;this.addFeature(m,b,m.index,s,h)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}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,y0),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,_0.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,s,h,m,b){const x={x:0,y:0,vertexCount:0};for(const E of Uh(s,500)){let P=0;for(const ie of E)P+=ie.length;let B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const ie of E){if(ie.length===0||I0(ie))continue;let de=0;for(let Ee=0;Ee=1){const Ve=ie[Ee-1];if(!C0(Ae,Ve)){B.vertexLength+4>nr.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Le=Ae.sub(Ve)._perp()._unit(),Ze=Ve.dist(Ae);de+Ze>32768&&(de=0),rc(this.layoutVertexArray,Ae.x,Ae.y,Le.x,Le.y,0,0,de),rc(this.layoutVertexArray,Ae.x,Ae.y,Le.x,Le.y,0,1,de),x.x+=2*Ae.x,x.y+=2*Ae.y,x.vertexCount+=2,de+=Ze,rc(this.layoutVertexArray,Ve.x,Ve.y,Le.x,Le.y,0,0,de),rc(this.layoutVertexArray,Ve.x,Ve.y,Le.x,Le.y,0,1,de),x.x+=2*Ve.x,x.y+=2*Ve.y,x.vertexCount+=2;const Qe=B.vertexLength;this.indexArray.emplaceBack(Qe,Qe+2,Qe+1),this.indexArray.emplaceBack(Qe+1,Qe+2,Qe+3),B.vertexLength+=4,B.primitiveLength+=2}}}}if(B.vertexLength+P>nr.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(P,this.layoutVertexArray,this.indexArray)),T0[e.type]!=="Polygon")continue;const N=[],$=[],W=B.vertexLength;for(const ie of E)if(ie.length!==0){ie!==E[0]&&$.push(N.length/2);for(let de=0;dekr)||r.y===e.y&&(r.y<0||r.y>kr)}function I0(r){return r.every(e=>e.x<0)||r.every(e=>e.x>kr)||r.every(e=>e.y<0)||r.every(e=>e.y>kr)}let ip;$t("FillExtrusionBucket",Zh,{omit:["layers","features"]});var A0={get paint(){return ip=ip||new en({"fill-extrusion-opacity":new Qt(Ie["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ci(Ie["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Qt(Ie["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Qt(Ie["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Co(Ie["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ci(Ie["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ci(Ie["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Qt(Ie["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class P0 extends $n{constructor(e){super(e,A0)}createBucket(e){return new Zh(e)}queryRadius(){return fu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,s,h,m,b,x,E,P){const B=du(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,E),N=this.paint.get("fill-extrusion-height").evaluate(s,h),$=this.paint.get("fill-extrusion-base").evaluate(s,h),W=function(ie,de,Ee,Ae){const Ve=[];for(const Le of ie){const Ze=[Le.x,Le.y,0,1];pu(Ze,Ze,de),Ve.push(new I(Ze[0]/Ze[3],Ze[1]/Ze[3]))}return Ve}(B,P),te=function(ie,de,Ee,Ae){const Ve=[],Le=[],Ze=Ae[8]*de,Qe=Ae[9]*de,ht=Ae[10]*de,Ft=Ae[11]*de,Ht=Ae[8]*Ee,Ot=Ae[9]*Ee,Lt=Ae[10]*Ee,zt=Ae[11]*Ee;for(const jt of ie){const Mt=[],St=[];for(const oi of jt){const Jt=oi.x,zi=oi.y,Qi=Ae[0]*Jt+Ae[4]*zi+Ae[12],sr=Ae[1]*Jt+Ae[5]*zi+Ae[13],Rr=Ae[2]*Jt+Ae[6]*zi+Ae[14],On=Ae[3]*Jt+Ae[7]*zi+Ae[15],dn=Rr+ht,Tr=On+Ft,qr=Qi+Ht,Kr=sr+Ot,pn=Rr+Lt,mn=On+zt,Br=new I((Qi+Ze)/Tr,(sr+Qe)/Tr);Br.z=dn/Tr,Mt.push(Br);const Or=new I(qr/mn,Kr/mn);Or.z=pn/mn,St.push(Or)}Ve.push(Mt),Le.push(St)}return[Ve,Le]}(m,$,N,P);return function(ie,de,Ee){let Ae=1/0;Dd(Ee,de)&&(Ae=rp(Ee,de[0]));for(let Ve=0;Ves.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(s=>{this.gradients[s.id]={}}),this.layoutVertexArray=new Kt,this.layoutVertexArray2=new rr,this.indexArray=new fr,this.programConfigurations=new Na(e.layers,e.zoom),this.segments=new nr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){this.hasPattern=Vh("line",this.layers,s);const m=this.layers[0].layout.get("line-sort-key"),b=!m.isConstant(),x=[];for(const{feature:E,id:P,index:B,sourceLayerIndex:N}of e){const $=this.layers[0]._featureFilter.needGeometry,W=Va(E,$);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),W,h))continue;const te=b?m.evaluate(W,{},h):void 0,ie={id:P,properties:E.properties,type:E.type,sourceLayerIndex:N,index:B,geometry:$?W.geometry:Ua(E),patterns:{},sortKey:te};x.push(ie)}b&&x.sort((E,P)=>E.sortKey-P.sortKey);for(const E of x){const{geometry:P,index:B,sourceLayerIndex:N}=E;if(this.hasPattern){const $=$h("line",this.layers,E,this.zoom,s);this.patternFeatures.push($)}else this.addFeature(E,P,B,h,{});s.featureIndex.insert(e[B].feature,P,B,N,this.index)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}addFeatures(e,s,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,s,h)}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,L0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,M0),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,s,h,m,b){const x=this.layers[0].layout,E=x.get("line-join").evaluate(e,{}),P=x.get("line-cap"),B=x.get("line-miter-limit"),N=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const $ of s)this.addLine($,e,E,P,B,N);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,b,m)}addLine(e,s,h,m,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Ae=0;Ae=2&&e[P-1].equals(e[P-2]);)P--;let B=0;for(;B0;if(Ft&&Ae>B){const zt=W.dist(te);if(zt>2*N){const jt=W.sub(W.sub(te)._mult(N/zt)._round());this.updateDistance(te,jt),this.addCurrentVertex(jt,de,0,0,$),te=jt}}const Ot=te&&ie;let Lt=Ot?h:E?"butt":m;if(Ot&&Lt==="round"&&(Qeb&&(Lt="bevel"),Lt==="bevel"&&(Qe>2&&(Lt="flipbevel"),Qe100)Ve=Ee.mult(-1);else{const zt=Qe*de.add(Ee).mag()/de.sub(Ee).mag();Ve._perp()._mult(zt*(Ht?-1:1))}this.addCurrentVertex(W,Ve,0,0,$),this.addCurrentVertex(W,Ve.mult(-1),0,0,$)}else if(Lt==="bevel"||Lt==="fakeround"){const zt=-Math.sqrt(Qe*Qe-1),jt=Ht?zt:0,Mt=Ht?0:zt;if(te&&this.addCurrentVertex(W,de,jt,Mt,$),Lt==="fakeround"){const St=Math.round(180*ht/Math.PI/20);for(let oi=1;oi2*N){const jt=W.add(ie.sub(W)._mult(N/zt)._round());this.updateDistance(W,jt),this.addCurrentVertex(jt,Ee,0,0,$),W=jt}}}}addCurrentVertex(e,s,h,m,b,x=!1){const E=s.y*m-s.x,P=-s.y-s.x*m;this.addHalfVertex(e,s.x+s.y*h,s.y-s.x*h,x,!1,h,b),this.addHalfVertex(e,E,P,x,!0,-m,b),this.distance>np/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,s,h,m,b,x))}addHalfVertex({x:e,y:s},h,m,b,x,E,P){const B=.5*(this.lineClips?this.scaledDistance*(np-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(b?1:0),(s<<1)+(x?1:0),Math.round(63*h)+128,Math.round(63*m)+128,1+(E===0?0:E<0?-1:1)|(63&B)<<2,B>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const N=P.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,N),P.primitiveLength++),x?this.e2=N:this.e1=N}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,s){this.distance+=e.dist(s),this.updateScaledDistance()}}let sp,ap;$t("LineBucket",Gh,{omit:["layers","patternFeatures"]});var op={get paint(){return ap=ap||new en({"line-opacity":new ci(Ie.paint_line["line-opacity"]),"line-color":new ci(Ie.paint_line["line-color"]),"line-translate":new Qt(Ie.paint_line["line-translate"]),"line-translate-anchor":new Qt(Ie.paint_line["line-translate-anchor"]),"line-width":new ci(Ie.paint_line["line-width"]),"line-gap-width":new ci(Ie.paint_line["line-gap-width"]),"line-offset":new ci(Ie.paint_line["line-offset"]),"line-blur":new ci(Ie.paint_line["line-blur"]),"line-dasharray":new Zl(Ie.paint_line["line-dasharray"]),"line-pattern":new Co(Ie.paint_line["line-pattern"]),"line-gradient":new Xn(Ie.paint_line["line-gradient"])})},get layout(){return sp=sp||new en({"line-cap":new Qt(Ie.layout_line["line-cap"]),"line-join":new ci(Ie.layout_line["line-join"]),"line-miter-limit":new Qt(Ie.layout_line["line-miter-limit"]),"line-round-limit":new Qt(Ie.layout_line["line-round-limit"]),"line-sort-key":new ci(Ie.layout_line["line-sort-key"])})}};class O0 extends ci{possiblyEvaluate(e,s){return s=new tr(Math.floor(s.zoom),{now:s.now,fadeDuration:s.fadeDuration,zoomHistory:s.zoomHistory,transition:s.transition}),super.possiblyEvaluate(e,s)}evaluate(e,s,h,m){return s=re({},s,{zoom:Math.floor(s.zoom)}),super.evaluate(e,s,h,m)}}let vu;class F0 extends $n{constructor(e){super(e,op),this.gradientVersion=0,vu||(vu=new O0(op.paint.properties["line-width"].specification),vu.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const s=this.gradientExpression();this.stepInterpolant=!!function(h){return h._styleExpression!==void 0}(s)&&s._styleExpression.expression instanceof Bi,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,s){super.recalculate(e,s),this.paint._values["line-floorwidth"]=vu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Gh(e)}queryRadius(e){const s=e,h=lp(Xl("line-width",this,s),Xl("line-gap-width",this,s)),m=Xl("line-offset",this,s);return h/2+Math.abs(m)+fu(this.paint.get("line-translate"))}queryIntersectsFeature(e,s,h,m,b,x,E){const P=du(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,E),B=E/2*lp(this.paint.get("line-width").evaluate(s,h),this.paint.get("line-gap-width").evaluate(s,h)),N=this.paint.get("line-offset").evaluate(s,h);return N&&(m=function($,W){const te=[];for(let ie=0;ie<$.length;ie++){const de=$[ie],Ee=[];for(let Ae=0;Ae=3){for(let Ee=0;Ee0?e+2*r:r}const N0=ir([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),U0=ir([{name:"a_projected_pos",components:3,type:"Float32"}],4);ir([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const V0=ir([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ir([{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 cp=ir([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),$0=ir([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function j0(r,e,s){return r.sections.forEach(h=>{h.text=function(m,b,x){const E=b.layout.get("text-transform").evaluate(x,{});return E==="uppercase"?m=m.toLocaleUpperCase():E==="lowercase"&&(m=m.toLocaleLowerCase()),En.applyArabicShaping&&(m=En.applyArabicShaping(m)),m}(h.text,e,s)}),r}ir([{name:"triangle",components:3,type:"Uint16"}]),ir([{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"}]),ir([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),ir([{type:"Float32",name:"offsetX"}]),ir([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ir([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const sc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Lr=24,up=Hi,hp=function(r,e,s,h,m){var b,x,E=8*m-h-1,P=(1<>1,N=-7,$=s?m-1:0,W=s?-1:1,te=r[e+$];for($+=W,b=te&(1<<-N)-1,te>>=-N,N+=E;N>0;b=256*b+r[e+$],$+=W,N-=8);for(x=b&(1<<-N)-1,b>>=-N,N+=h;N>0;x=256*x+r[e+$],$+=W,N-=8);if(b===0)b=1-B;else{if(b===P)return x?NaN:1/0*(te?-1:1);x+=Math.pow(2,h),b-=B}return(te?-1:1)*x*Math.pow(2,b-h)},fp=function(r,e,s,h,m,b){var x,E,P,B=8*b-m-1,N=(1<>1,W=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,te=h?0:b-1,ie=h?1:-1,de=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(E=isNaN(e)?1:0,x=N):(x=Math.floor(Math.log(e)/Math.LN2),e*(P=Math.pow(2,-x))<1&&(x--,P*=2),(e+=x+$>=1?W/P:W*Math.pow(2,1-$))*P>=2&&(x++,P/=2),x+$>=N?(E=0,x=N):x+$>=1?(E=(e*P-1)*Math.pow(2,m),x+=$):(E=e*Math.pow(2,$-1)*Math.pow(2,m),x=0));m>=8;r[s+te]=255&E,te+=ie,E/=256,m-=8);for(x=x<0;r[s+te]=255&x,te+=ie,x/=256,B-=8);r[s+te-ie]|=128*de};function Hi(r){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(r)?r:new Uint8Array(r||0),this.pos=0,this.type=0,this.length=this.buf.length}Hi.Varint=0,Hi.Fixed64=1,Hi.Bytes=2,Hi.Fixed32=5;var Wh=4294967296,dp=1/Wh,pp=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Vs(r){return r.type===Hi.Bytes?r.readVarint()+r.pos:r.pos+1}function Oo(r,e,s){return s?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function mp(r,e,s){var h=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));s.realloc(h);for(var m=s.pos-1;m>=r;m--)s.buf[m+h]=s.buf[m]}function q0(r,e){for(var s=0;s>>8,r[s+2]=e>>>16,r[s+3]=e>>>24}function gp(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+(r[e+3]<<24)}Hi.prototype={destroy:function(){this.buf=null},readFields:function(r,e,s){for(s=s||this.length;this.pos>3,b=this.pos;this.type=7&h,r(m,e,this),this.pos===b&&this.skip(h)}return e},readMessage:function(r,e){return this.readFields(r,e,this.readVarint()+this.pos)},readFixed32:function(){var r=bu(this.buf,this.pos);return this.pos+=4,r},readSFixed32:function(){var r=gp(this.buf,this.pos);return this.pos+=4,r},readFixed64:function(){var r=bu(this.buf,this.pos)+bu(this.buf,this.pos+4)*Wh;return this.pos+=8,r},readSFixed64:function(){var r=bu(this.buf,this.pos)+gp(this.buf,this.pos+4)*Wh;return this.pos+=8,r},readFloat:function(){var r=hp(this.buf,this.pos,!0,23,4);return this.pos+=4,r},readDouble:function(){var r=hp(this.buf,this.pos,!0,52,8);return this.pos+=8,r},readVarint:function(r){var e,s,h=this.buf;return e=127&(s=h[this.pos++]),s<128?e:(e|=(127&(s=h[this.pos++]))<<7,s<128?e:(e|=(127&(s=h[this.pos++]))<<14,s<128?e:(e|=(127&(s=h[this.pos++]))<<21,s<128?e:function(m,b,x){var E,P,B=x.buf;if(E=(112&(P=B[x.pos++]))>>4,P<128||(E|=(127&(P=B[x.pos++]))<<3,P<128)||(E|=(127&(P=B[x.pos++]))<<10,P<128)||(E|=(127&(P=B[x.pos++]))<<17,P<128)||(E|=(127&(P=B[x.pos++]))<<24,P<128)||(E|=(1&(P=B[x.pos++]))<<31,P<128))return Oo(m,E,b);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(s=h[this.pos]))<<28,r,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var r=this.readVarint();return r%2==1?(r+1)/-2:r/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=12&&pp?function(s,h,m){return pp.decode(s.subarray(h,m))}(this.buf,e,r):function(s,h,m){for(var b="",x=h;x239?4:N>223?3:N>191?2:1;if(x+W>m)break;W===1?N<128&&($=N):W===2?(192&(E=s[x+1]))==128&&($=(31&N)<<6|63&E)<=127&&($=null):W===3?(P=s[x+2],(192&(E=s[x+1]))==128&&(192&P)==128&&(($=(15&N)<<12|(63&E)<<6|63&P)<=2047||$>=55296&&$<=57343)&&($=null)):W===4&&(P=s[x+2],B=s[x+3],(192&(E=s[x+1]))==128&&(192&P)==128&&(192&B)==128&&(($=(15&N)<<18|(63&E)<<12|(63&P)<<6|63&B)<=65535||$>=1114112)&&($=null)),$===null?($=65533,W=1):$>65535&&($-=65536,b+=String.fromCharCode($>>>10&1023|55296),$=56320|1023&$),b+=String.fromCharCode($),x+=W}return b}(this.buf,e,r)},readBytes:function(){var r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e},readPackedVarint:function(r,e){if(this.type!==Hi.Bytes)return r.push(this.readVarint(e));var s=Vs(this);for(r=r||[];this.pos127;);else if(e===Hi.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Hi.Fixed32)this.pos+=4;else{if(e!==Hi.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(r,e){this.writeVarint(r<<3|e)},realloc:function(r){for(var e=this.length||16;e268435455||r<0?function(e,s){var h,m;if(e>=0?(h=e%4294967296|0,m=e/4294967296|0):(m=~(-e/4294967296),4294967295^(h=~(-e%4294967296))?h=h+1|0:(h=0,m=m+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),function(b,x,E){E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,b>>>=7,E.buf[E.pos++]=127&b|128,E.buf[E.pos]=127&(b>>>=7)}(h,0,s),function(b,x){var E=(7&b)<<4;x.buf[x.pos++]|=E|((b>>>=3)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b)))))}(m,s)}(r,this):(this.realloc(4),this.buf[this.pos++]=127&r|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=r>>>7&127))))},writeSVarint:function(r){this.writeVarint(r<0?2*-r-1:2*r)},writeBoolean:function(r){this.writeVarint(!!r)},writeString:function(r){r=String(r),this.realloc(4*r.length),this.pos++;var e=this.pos;this.pos=function(h,m,b){for(var x,E,P=0;P55295&&x<57344){if(!E){x>56319||P+1===m.length?(h[b++]=239,h[b++]=191,h[b++]=189):E=x;continue}if(x<56320){h[b++]=239,h[b++]=191,h[b++]=189,E=x;continue}x=E-55296<<10|x-56320|65536,E=null}else E&&(h[b++]=239,h[b++]=191,h[b++]=189,E=null);x<128?h[b++]=x:(x<2048?h[b++]=x>>6|192:(x<65536?h[b++]=x>>12|224:(h[b++]=x>>18|240,h[b++]=x>>12&63|128),h[b++]=x>>6&63|128),h[b++]=63&x|128)}return b}(this.buf,r,this.pos);var s=this.pos-e;s>=128&&mp(e,s,this),this.pos=e-1,this.writeVarint(s),this.pos+=s},writeFloat:function(r){this.realloc(4),fp(this.buf,r,this.pos,!0,23,4),this.pos+=4},writeDouble:function(r){this.realloc(8),fp(this.buf,r,this.pos,!0,52,8),this.pos+=8},writeBytes:function(r){var e=r.length;this.writeVarint(e),this.realloc(e);for(var s=0;s=128&&mp(s,h,this),this.pos=s-1,this.writeVarint(h),this.pos+=h},writeMessage:function(r,e,s){this.writeTag(r,Hi.Bytes),this.writeRawMessage(e,s)},writePackedVarint:function(r,e){e.length&&this.writeMessage(r,q0,e)},writePackedSVarint:function(r,e){e.length&&this.writeMessage(r,Z0,e)},writePackedBoolean:function(r,e){e.length&&this.writeMessage(r,H0,e)},writePackedFloat:function(r,e){e.length&&this.writeMessage(r,G0,e)},writePackedDouble:function(r,e){e.length&&this.writeMessage(r,W0,e)},writePackedFixed32:function(r,e){e.length&&this.writeMessage(r,K0,e)},writePackedSFixed32:function(r,e){e.length&&this.writeMessage(r,X0,e)},writePackedFixed64:function(r,e){e.length&&this.writeMessage(r,J0,e)},writePackedSFixed64:function(r,e){e.length&&this.writeMessage(r,Y0,e)},writeBytesField:function(r,e){this.writeTag(r,Hi.Bytes),this.writeBytes(e)},writeFixed32Field:function(r,e){this.writeTag(r,Hi.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(r,e){this.writeTag(r,Hi.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(r,e){this.writeTag(r,Hi.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(r,e){this.writeTag(r,Hi.Fixed64),this.writeSFixed64(e)},writeVarintField:function(r,e){this.writeTag(r,Hi.Varint),this.writeVarint(e)},writeSVarintField:function(r,e){this.writeTag(r,Hi.Varint),this.writeSVarint(e)},writeStringField:function(r,e){this.writeTag(r,Hi.Bytes),this.writeString(e)},writeFloatField:function(r,e){this.writeTag(r,Hi.Fixed32),this.writeFloat(e)},writeDoubleField:function(r,e){this.writeTag(r,Hi.Fixed64),this.writeDouble(e)},writeBooleanField:function(r,e){this.writeVarintField(r,!!e)}};var Hh=v(up);const Kh=3;function Q0(r,e,s){r===1&&s.readMessage(e1,e)}function e1(r,e,s){if(r===3){const{id:h,bitmap:m,width:b,height:x,left:E,top:P,advance:B}=s.readMessage(t1,{});e.push({id:h,bitmap:new Yl({width:b+2*Kh,height:x+2*Kh},m),metrics:{width:b,height:x,left:E,top:P,advance:B}})}}function t1(r,e,s){r===1?e.id=s.readVarint():r===2?e.bitmap=s.readBytes():r===3?e.width=s.readVarint():r===4?e.height=s.readVarint():r===5?e.left=s.readSVarint():r===6?e.top=s.readSVarint():r===7&&(e.advance=s.readVarint())}const _p=Kh;function yp(r){let e=0,s=0;for(const x of r)e+=x.w*x.h,s=Math.max(s,x.w);r.sort((x,E)=>E.h-x.h);const h=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),s),h:1/0}];let m=0,b=0;for(const x of r)for(let E=h.length-1;E>=0;E--){const P=h[E];if(!(x.w>P.w||x.h>P.h)){if(x.x=P.x,x.y=P.y,b=Math.max(b,x.y+x.h),m=Math.max(m,x.x+x.w),x.w===P.w&&x.h===P.h){const B=h.pop();E=0&&h>=e&&xu[this.text.charCodeAt(h)];h--)s--;this.text=this.text.substring(e,s),this.sectionIndex=this.sectionIndex.slice(e,s)}substring(e,s){const h=new No;return h.text=this.text.substring(e,s),h.sectionIndex=this.sectionIndex.slice(e,s),h.sections=this.sections,h}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,s)=>Math.max(e,this.sections[s].scale),0)}addTextSection(e,s){this.text+=e.text,this.sections.push(oc.forText(e.scale,e.fontStack||s));const h=this.sections.length-1;for(let m=0;m=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function wu(r,e,s,h,m,b,x,E,P,B,N,$,W,te,ie,de){const Ee=No.fromFeature(r,m);let Ae;$===n.WritingMode.vertical&&Ee.verticalizePunctuation();const{processBidirectionalText:Ve,processStyledBidirectionalText:Le}=En;if(Ve&&Ee.sections.length===1){Ae=[];const ht=Ve(Ee.toString(),Jh(Ee,B,b,e,h,te,ie));for(const Ft of ht){const Ht=new No;Ht.text=Ft,Ht.sections=Ee.sections;for(let Ot=0;Ot0&&js>An&&(An=js)}else{const Zn=Ht[Li.fontStack],zn=Zn&&Zn[Xr];if(zn&&zn.rect)us=zn.rect,Qn=zn.metrics;else{const js=Ft[Li.fontStack],fc=js&&js[Xr];if(!fc)continue;Qn=fc.metrics}Nr=(Or-Li.scale)*Lr}es?(ht.verticalizable=!0,nn.push({glyph:Xr,imageName:hs,x:Qi,y:sr+Nr,vertical:es,scale:Li.scale,fontStack:Li.fontStack,sectionIndex:sn,metrics:Qn,rect:us}),Qi+=$s*Li.scale+oi):(nn.push({glyph:Xr,imageName:hs,x:Qi,y:sr+Nr,vertical:es,scale:Li.scale,fontStack:Li.fontStack,sectionIndex:sn,metrics:Qn,rect:us}),Qi+=Qn.advance*Li.scale+oi)}nn.length!==0&&(Rr=Math.max(Qi-oi,Rr),n1(nn,0,nn.length-1,dn,An)),Qi=0;const Pn=zt*Or+An;gn.lineOffset=Math.max(An,rn),sr+=Pn,On=Math.max(Pn,On),++Tr}var qr;const Kr=sr-ac,{horizontalAlign:pn,verticalAlign:mn}=Yh(jt);(function(Br,Or,rn,gn,nn,An,Pn,Fr,Li){const sn=(Or-rn)*nn;let Xr=0;Xr=An!==Pn?-Fr*gn-ac:(-gn*Li+.5)*Pn;for(const Nr of Br)for(const Qn of Nr.positionedGlyphs)Qn.x+=sn,Qn.y+=Xr})(ht.positionedLines,dn,pn,mn,Rr,On,zt,Kr,Lt.length),ht.top+=-mn*Kr,ht.bottom=ht.top+Kr,ht.left+=-pn*Rr,ht.right=ht.left+Rr}(Qe,e,s,h,Ae,x,E,P,$,B,W,de),!function(ht){for(const Ft of ht)if(Ft.positionedGlyphs.length!==0)return!1;return!0}(Ze)&&Qe}const xu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},i1={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 bp(r,e,s,h,m,b){if(e.imageName){const x=h[e.imageName];return x?x.displaySize[0]*e.scale*Lr/b+m:0}{const x=s[e.fontStack],E=x&&x[r];return E?E.metrics.advance*e.scale+m:0}}function wp(r,e,s,h){const m=Math.pow(r-e,2);return h?r=0;let N=0;for(let W=0;Wx.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=Dh([]),this.placementViewportMatrix=Dh([]);const s=this.layers[0]._unevaluatedLayout._values;this.textSizeData=kp(this.zoom,s["text-size"]),this.iconSizeData=kp(this.zoom,s["icon-size"]);const h=this.layers[0].layout,m=h.get("symbol-sort-key"),b=h.get("symbol-z-order");this.canOverlap=Qh(h,"text-overlap","text-allow-overlap")!=="never"||Qh(h,"icon-overlap","icon-allow-overlap")!=="never"||h.get("text-ignore-placement")||h.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!m.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,h.get("symbol-placement")==="point"&&(this.writingModes=h.get("text-writing-mode").map(x=>n.WritingMode[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=e.sourceID}createArrays(){this.text=new tf(new Na(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new tf(new Na(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new it,this.lineVertexArray=new rt,this.symbolInstances=new Ue,this.textAnchorOffsets=new xt}calculateGlyphDependencies(e,s,h,m,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),N=P.value.kind!=="constant"||!!P.value.value||Object.keys(P.parameters).length>0,$=b.get("symbol-sort-key");if(this.features=[],!B&&!N)return;const W=s.iconDependencies,te=s.glyphDependencies,ie=s.availableImages,de=new tr(this.zoom);for(const{feature:Ee,id:Ae,index:Ve,sourceLayerIndex:Le}of e){const Ze=m._featureFilter.needGeometry,Qe=Va(Ee,Ze);if(!m._featureFilter.filter(de,Qe,h))continue;let ht,Ft;if(Ze||(Qe.geometry=Ua(Ee)),B){const Ot=m.getValueAndResolveTokens("text-field",Qe,h,ie),Lt=lr.factory(Ot);l1(Lt)&&(this.hasRTLText=!0),(!this.hasRTLText||$l()==="unavailable"||this.hasRTLText&&En.isParsed())&&(ht=j0(Lt,m,Qe))}if(N){const Ot=m.getValueAndResolveTokens("icon-image",Qe,h,ie);Ft=Ot instanceof Dr?Ot:Dr.fromString(Ot)}if(!ht&&!Ft)continue;const Ht=this.sortFeaturesByKey?$.evaluate(Qe,{},h):void 0;if(this.features.push({id:Ae,text:ht,icon:Ft,index:Ve,sourceLayerIndex:Le,geometry:Qe.geometry,properties:Ee.properties,type:a1[Ee.type],sortKey:Ht}),Ft&&(W[Ft.name]=!0),ht){const Ot=x.evaluate(Qe,{},h).join(","),Lt=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(n.WritingMode.vertical)>=0;for(const zt of ht.sections)if(zt.image)W[zt.image.name]=!0;else{const jt=La(ht.toString()),Mt=zt.fontStack||Ot,St=te[Mt]=te[Mt]||{};this.calculateGlyphDependencies(zt.text,St,Lt,this.allowVerticalPlacement,jt)}}}b.get("symbol-placement")==="line"&&(this.features=function(Ee){const Ae={},Ve={},Le=[];let Ze=0;function Qe(Ot){Le.push(Ee[Ot]),Ze++}function ht(Ot,Lt,zt){const jt=Ve[Ot];return delete Ve[Ot],Ve[Lt]=jt,Le[jt].geometry[0].pop(),Le[jt].geometry[0]=Le[jt].geometry[0].concat(zt[0]),jt}function Ft(Ot,Lt,zt){const jt=Ae[Lt];return delete Ae[Lt],Ae[Ot]=jt,Le[jt].geometry[0].shift(),Le[jt].geometry[0]=zt[0].concat(Le[jt].geometry[0]),jt}function Ht(Ot,Lt,zt){const jt=zt?Lt[0][Lt[0].length-1]:Lt[0][0];return`${Ot}:${jt.x}:${jt.y}`}for(let Ot=0;OtOt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Ee,Ae)=>Ee.sortKey-Ae.sortKey)}update(e,s,h){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,s,this.layers,h),this.icon.programConfigurations.updatePaintArrays(e,s,this.layers,h))}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,s){const h=this.lineVertexArray.length;if(e.segment!==void 0){let m=e.dist(s[e.segment+1]),b=e.dist(s[e.segment]);const x={};for(let E=e.segment+1;E=0;E--)x[E]={x:s[E].x,y:s[E].y,tileUnitDistanceFromAnchor:b},E>0&&(b+=s[E-1].dist(s[E]));for(let E=0;E0}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,s){const h=e.placedSymbolArray.get(s),m=h.vertexStartIndex+4*h.numGlyphs;for(let b=h.vertexStartIndex;bm[E]-m[P]||b[P]-b[E]),x}addToSortKeyRanges(e,s){const h=this.sortKeyRanges[this.sortKeyRanges.length-1];h&&h.sortKey===s?h.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:s,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 s of this.symbolInstanceIndexes){const h=this.symbolInstances.get(s);this.featureSortOrder.push(h.featureIndex),[h.rightJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.leftJustifiedTextSymbolIndex].forEach((m,b,x)=>{m>=0&&x.indexOf(m)===b&&this.addIndicesForPlacedSymbol(this.text,m)}),h.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,h.verticalPlacedTextSymbolIndex),h.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.placedIconSymbolIndex),h.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Tp,Cp;$t("SymbolBucket",Uo,{omit:["layers","collisionBoxArray","features","compareText"]}),Uo.MAX_GLYPHS=65535,Uo.addDynamicAttributes=ef;var nf={get paint(){return Cp=Cp||new en({"icon-opacity":new ci(Ie.paint_symbol["icon-opacity"]),"icon-color":new ci(Ie.paint_symbol["icon-color"]),"icon-halo-color":new ci(Ie.paint_symbol["icon-halo-color"]),"icon-halo-width":new ci(Ie.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ci(Ie.paint_symbol["icon-halo-blur"]),"icon-translate":new Qt(Ie.paint_symbol["icon-translate"]),"icon-translate-anchor":new Qt(Ie.paint_symbol["icon-translate-anchor"]),"text-opacity":new ci(Ie.paint_symbol["text-opacity"]),"text-color":new ci(Ie.paint_symbol["text-color"],{runtimeType:Sr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new ci(Ie.paint_symbol["text-halo-color"]),"text-halo-width":new ci(Ie.paint_symbol["text-halo-width"]),"text-halo-blur":new ci(Ie.paint_symbol["text-halo-blur"]),"text-translate":new Qt(Ie.paint_symbol["text-translate"]),"text-translate-anchor":new Qt(Ie.paint_symbol["text-translate-anchor"])})},get layout(){return Tp=Tp||new en({"symbol-placement":new Qt(Ie.layout_symbol["symbol-placement"]),"symbol-spacing":new Qt(Ie.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Qt(Ie.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ci(Ie.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Qt(Ie.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Qt(Ie.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Qt(Ie.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Qt(Ie.layout_symbol["icon-ignore-placement"]),"icon-optional":new Qt(Ie.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Qt(Ie.layout_symbol["icon-rotation-alignment"]),"icon-size":new ci(Ie.layout_symbol["icon-size"]),"icon-text-fit":new Qt(Ie.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Qt(Ie.layout_symbol["icon-text-fit-padding"]),"icon-image":new ci(Ie.layout_symbol["icon-image"]),"icon-rotate":new ci(Ie.layout_symbol["icon-rotate"]),"icon-padding":new ci(Ie.layout_symbol["icon-padding"]),"icon-keep-upright":new Qt(Ie.layout_symbol["icon-keep-upright"]),"icon-offset":new ci(Ie.layout_symbol["icon-offset"]),"icon-anchor":new ci(Ie.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Qt(Ie.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Qt(Ie.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Qt(Ie.layout_symbol["text-rotation-alignment"]),"text-field":new ci(Ie.layout_symbol["text-field"]),"text-font":new ci(Ie.layout_symbol["text-font"]),"text-size":new ci(Ie.layout_symbol["text-size"]),"text-max-width":new ci(Ie.layout_symbol["text-max-width"]),"text-line-height":new Qt(Ie.layout_symbol["text-line-height"]),"text-letter-spacing":new ci(Ie.layout_symbol["text-letter-spacing"]),"text-justify":new ci(Ie.layout_symbol["text-justify"]),"text-radial-offset":new ci(Ie.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Qt(Ie.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ci(Ie.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ci(Ie.layout_symbol["text-anchor"]),"text-max-angle":new Qt(Ie.layout_symbol["text-max-angle"]),"text-writing-mode":new Qt(Ie.layout_symbol["text-writing-mode"]),"text-rotate":new ci(Ie.layout_symbol["text-rotate"]),"text-padding":new Qt(Ie.layout_symbol["text-padding"]),"text-keep-upright":new Qt(Ie.layout_symbol["text-keep-upright"]),"text-transform":new ci(Ie.layout_symbol["text-transform"]),"text-offset":new ci(Ie.layout_symbol["text-offset"]),"text-allow-overlap":new Qt(Ie.layout_symbol["text-allow-overlap"]),"text-overlap":new Qt(Ie.layout_symbol["text-overlap"]),"text-ignore-placement":new Qt(Ie.layout_symbol["text-ignore-placement"]),"text-optional":new Qt(Ie.layout_symbol["text-optional"])})}};class Ip{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 s=this.defaultValue.property.overrides;if(s&&s.hasOverride(e.formattedSection))return s.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}}$t("FormatSectionOverride",Ip,{omit:["defaultValue"]});class Eu extends $n{constructor(e){super(e,nf)}recalculate(e,s){if(super.recalculate(e,s),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 h=this.layout.get("text-writing-mode");if(h){const m=[];for(const b of h)m.indexOf(b)<0&&m.push(b);this.layout._values["text-writing-mode"]=m}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,s,h,m){const b=this.layout.get(e).evaluate(s,{},h,m),x=this._unevaluatedLayout._values[e];return x.isDataDriven()||vo(x.value)||!b?b:function(E,P){return P.replace(/{([^{}]+)}/g,(B,N)=>N in E?String(E[N]):"")}(s.properties,b)}createBucket(e){return new Uo(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of nf.paint.overridableProperties){if(!Eu.hasPaintOverride(this.layout,e))continue;const s=this.paint.get(e),h=new Ip(s),m=new xl(h,s.property.specification);let b=null;b=s.value.kind==="constant"||s.value.kind==="source"?new wo("source",m):new xo("composite",m,s.value.zoomStops),this.paint._values[e]=new Kn(s.property,b,s.parameters)}}_handleOverridablePaintPropertyUpdate(e,s,h){return!(!this.layout||s.isDataDriven()||h.isDataDriven())&&Eu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,s){const h=e.get("text-field"),m=nf.paint.properties[s];let b=!1;const x=E=>{for(const P of E)if(m.overrides&&m.overrides.hasOverride(P))return void(b=!0)};if(h.value.kind==="constant"&&h.value.value instanceof lr)x(h.value.value.sections);else if(h.value.kind==="source"){const E=B=>{b||(B instanceof Yr&&yi(B.value)===_e?x(B.value.sections):B instanceof po?x(B.sections):B.eachChild(E))},P=h.value;P._styleExpression&&E(P._styleExpression.expression)}return b}}let Ap;var c1={get paint(){return Ap=Ap||new en({"background-color":new Qt(Ie.paint_background["background-color"]),"background-pattern":new Zl(Ie.paint_background["background-pattern"]),"background-opacity":new Qt(Ie.paint_background["background-opacity"])})}};class u1 extends $n{constructor(e){super(e,c1)}}let Pp;var h1={get paint(){return Pp=Pp||new en({"raster-opacity":new Qt(Ie.paint_raster["raster-opacity"]),"raster-hue-rotate":new Qt(Ie.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Qt(Ie.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Qt(Ie.paint_raster["raster-brightness-max"]),"raster-saturation":new Qt(Ie.paint_raster["raster-saturation"]),"raster-contrast":new Qt(Ie.paint_raster["raster-contrast"]),"raster-resampling":new Qt(Ie.paint_raster["raster-resampling"]),"raster-fade-duration":new Qt(Ie.paint_raster["raster-fade-duration"])})}};class f1 extends $n{constructor(e){super(e,h1)}}class d1 extends $n{constructor(e){super(e,{}),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.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")}}class p1{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const sf=63710088e-1;class ua{constructor(e,s){if(isNaN(e)||isNaN(s))throw new Error(`Invalid LngLat object: (${e}, ${s})`);if(this.lng=+e,this.lat=+s,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ua(ne(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const s=Math.PI/180,h=this.lat*s,m=e.lat*s,b=Math.sin(h)*Math.sin(m)+Math.cos(h)*Math.cos(m)*Math.cos((e.lng-this.lng)*s);return sf*Math.acos(Math.min(b,1))}static convert(e){if(e instanceof ua)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new ua(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new ua(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 zp=2*Math.PI*sf;function Mp(r){return zp*Math.cos(r*Math.PI/180)}function Dp(r){return(180+r)/360}function Lp(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Rp(r,e){return r/Mp(e)}function af(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}class ku{constructor(e,s,h=0){this.x=+e,this.y=+s,this.z=+h}static fromLngLat(e,s=0){const h=ua.convert(e);return new ku(Dp(h.lng),Lp(h.lat),Rp(s,h.lat))}toLngLat(){return new ua(360*this.x-180,af(this.y))}toAltitude(){return this.z*Mp(af(this.y))}meterInMercatorCoordinateUnits(){return 1/zp*(e=af(this.y),1/Math.cos(e*Math.PI/180));var e}}function Bp(r,e,s){var h=2*Math.PI*6378137/256/Math.pow(2,s);return[r*h-2*Math.PI*6378137/2,e*h-2*Math.PI*6378137/2]}class of{constructor(e,s,h){if(e<0||e>25||h<0||h>=Math.pow(2,e)||s<0||s>=Math.pow(2,e))throw new Error(`x=${s}, y=${h}, 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=s,this.y=h,this.key=cc(0,e,e,s,h)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,s,h){const m=(x=this.y,E=this.z,P=Bp(256*(b=this.x),256*(x=Math.pow(2,E)-x-1),E),B=Bp(256*(b+1),256*(x+1),E),P[0]+","+P[1]+","+B[0]+","+B[1]);var b,x,E,P,B;const N=function($,W,te){let ie,de="";for(let Ee=$;Ee>0;Ee--)ie=1<1?"@2x":"").replace(/{quadkey}/g,N).replace(/{bbox-epsg-3857}/g,m)}isChildOf(e){const s=this.z-e.z;return s>0&&e.x===this.x>>s&&e.y===this.y>>s}getTilePoint(e){const s=Math.pow(2,this.z);return new I((e.x*s-this.x)*kr,(e.y*s-this.y)*kr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Op{constructor(e,s){this.wrap=e,this.canonical=s,this.key=cc(e,s.z,s.z,s.x,s.y)}}class qn{constructor(e,s,h,m,b){if(e= z; overscaledZ = ${e}; z = ${h}`);this.overscaledZ=e,this.wrap=s,this.canonical=new of(h,+m,+b),this.key=cc(s,e,h,m,b)}clone(){return new qn(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 s=this.canonical.z-e;return e>this.canonical.z?new qn(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new qn(e,this.wrap,e,this.canonical.x>>s,this.canonical.y>>s)}calculateScaledKey(e,s){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-e;return e>this.canonical.z?cc(this.wrap*+s,e,this.canonical.z,this.canonical.x,this.canonical.y):cc(this.wrap*+s,e,e,this.canonical.x>>h,this.canonical.y>>h)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const s=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>s&&e.canonical.y===this.canonical.y>>s}children(e){if(this.overscaledZ>=e)return[new qn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const s=this.canonical.z+1,h=2*this.canonical.x,m=2*this.canonical.y;return[new qn(s,this.wrap,s,h,m),new qn(s,this.wrap,s,h+1,m),new qn(s,this.wrap,s,h,m+1),new qn(s,this.wrap,s,h+1,m+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=$),$=this.dim+1||s<-1||s>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(s+1)*this.stride+(e+1)}unpack(e,s,h){return e*this.redFactor+s*this.greenFactor+h*this.blueFactor-this.baseShift}getPixels(){return new jn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,s,h){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let m=s*this.dim,b=s*this.dim+this.dim,x=h*this.dim,E=h*this.dim+this.dim;switch(s){case-1:m=b-1;break;case 1:b=m+1}switch(h){case-1:x=E-1;break;case 1:E=x+1}const P=-s*this.dim,B=-h*this.dim;for(let N=x;N=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 Up{constructor(e,s,h,m,b){this.type="Feature",this._vectorTileFeature=e,e._z=s,e._x=h,e._y=m,this.properties=e.properties,this.id=b}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 s in this)s!=="_geometry"&&s!=="_vectorTileFeature"&&(e[s]=this[s]);return e}}class Vp{constructor(e,s){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ia(kr,16,0),this.grid3D=new ia(kr,16,0),this.featureIndexArray=new It,this.promoteId=s}insert(e,s,h,m,b,x){const E=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(h,m,b);const P=x?this.grid3D:this.grid;for(let B=0;B=0&&$[3]>=0&&P.insert(E,$[0],$[1],$[2],$[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new oa.VectorTile(new Hh(this.rawTileData)).layers,this.sourceLayerCoder=new Np(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,s,h,m){this.loadVTLayers();const b=e.params||{},x=kr/e.tileSize/e.scale,E=kl(b.filter),P=e.queryGeometry,B=e.queryPadding*x,N=jp(P),$=this.grid.query(N.minX-B,N.minY-B,N.maxX+B,N.maxY+B),W=jp(e.cameraQueryGeometry),te=this.grid3D.query(W.minX-B,W.minY-B,W.maxX+B,W.maxY+B,(Ee,Ae,Ve,Le)=>function(Ze,Qe,ht,Ft,Ht){for(const Lt of Ze)if(Qe<=Lt.x&&ht<=Lt.y&&Ft>=Lt.x&&Ht>=Lt.y)return!0;const Ot=[new I(Qe,ht),new I(Qe,Ht),new I(Ft,Ht),new I(Ft,ht)];if(Ze.length>2){for(const Lt of Ot)if(Do(Ze,Lt))return!0}for(let Lt=0;Lt(Le||(Le=Ua(Ze)),Qe.queryIntersectsFeature(P,Ze,ht,Le,this.z,e.transform,x,e.pixelPosMatrix)))}return ie}loadMatchingFeature(e,s,h,m,b,x,E,P,B,N,$){const W=this.bucketLayerIDs[s];if(x&&!function(Ee,Ae){for(let Ve=0;Ve=0)return!0;return!1}(x,W))return;const te=this.sourceLayerCoder.decode(h),ie=this.vtLayers[te].feature(m);if(b.needGeometry){const Ee=Va(ie,!0);if(!b.filter(new tr(this.tileID.overscaledZ),Ee,this.tileID.canonical))return}else if(!b.filter(new tr(this.tileID.overscaledZ),ie))return;const de=this.getId(ie,te);for(let Ee=0;Ee{const E=e instanceof To?e.get(x):null;return E&&E.evaluate?E.evaluate(s,h,m):E})}function jp(r){let e=1/0,s=1/0,h=-1/0,m=-1/0;for(const b of r)e=Math.min(e,b.x),s=Math.min(s,b.y),h=Math.max(h,b.x),m=Math.max(m,b.y);return{minX:e,minY:s,maxX:h,maxY:m}}function m1(r,e){return e-r}function qp(r,e,s,h,m){const b=[];for(let x=0;x=h&&$.x>=h||(N.x>=h?N=new I(h,N.y+(h-N.x)/($.x-N.x)*($.y-N.y))._round():$.x>=h&&($=new I(h,N.y+(h-N.x)/($.x-N.x)*($.y-N.y))._round()),N.y>=m&&$.y>=m||(N.y>=m?N=new I(N.x+(m-N.y)/($.y-N.y)*($.x-N.x),m)._round():$.y>=m&&($=new I(N.x+(m-N.y)/($.y-N.y)*($.x-N.x),m)._round()),P&&N.equals(P[P.length-1])||(P=[N],b.push(P)),P.push($)))))}}return b}$t("FeatureIndex",Vp,{omit:["rawTileData","sourceLayerCoder"]});class ha extends I{constructor(e,s,h,m){super(e,s),this.angle=h,m!==void 0&&(this.segment=m)}clone(){return new ha(this.x,this.y,this.angle,this.segment)}}function Zp(r,e,s,h,m){if(e.segment===void 0||s===0)return!0;let b=e,x=e.segment+1,E=0;for(;E>-s/2;){if(x--,x<0)return!1;E-=r[x].dist(b),b=r[x]}E+=r[x].dist(r[x+1]),x++;const P=[];let B=0;for(;Eh;)B-=P.shift().angleDelta;if(B>m)return!1;x++,E+=N.dist($)}return!0}function Gp(r){let e=0;for(let s=0;sB){const ie=(B-P)/te,de=bn.number($.x,W.x,ie),Ee=bn.number($.y,W.y,ie),Ae=new ha(de,Ee,W.angleTo($),N);return Ae._round(),!x||Zp(r,Ae,E,x,e)?Ae:void 0}P+=te}}function _1(r,e,s,h,m,b,x,E,P){const B=Wp(h,b,x),N=Hp(h,m),$=N*x,W=r[0].x===0||r[0].x===P||r[0].y===0||r[0].y===P;return e-$=0&&Ze=0&&Qe=0&&W+B<=N){const ht=new ha(Ze,Qe,Ve,ie);ht._round(),h&&!Zp(r,ht,b,h,m)||te.push(ht)}}$+=Ae}return E||te.length||x||(te=Kp(r,$/2,s,h,m,b,x,!0,P)),te}$t("Anchor",ha);const Vo=In;function Xp(r,e,s,h){const m=[],b=r.image,x=b.pixelRatio,E=b.paddedRect.w-2*Vo,P=b.paddedRect.h-2*Vo,B=r.right-r.left,N=r.bottom-r.top,$=b.stretchX||[[0,E]],W=b.stretchY||[[0,P]],te=(zt,jt)=>zt+jt[1]-jt[0],ie=$.reduce(te,0),de=W.reduce(te,0),Ee=E-ie,Ae=P-de;let Ve=0,Le=ie,Ze=0,Qe=de,ht=0,Ft=Ee,Ht=0,Ot=Ae;if(b.content&&h){const zt=b.content;Ve=Tu($,0,zt[0]),Ze=Tu(W,0,zt[1]),Le=Tu($,zt[0],zt[2]),Qe=Tu(W,zt[1],zt[3]),ht=zt[0]-Ve,Ht=zt[1]-Ze,Ft=zt[2]-zt[0]-Le,Ot=zt[3]-zt[1]-Qe}const Lt=(zt,jt,Mt,St)=>{const oi=Cu(zt.stretch-Ve,Le,B,r.left),Jt=Iu(zt.fixed-ht,Ft,zt.stretch,ie),zi=Cu(jt.stretch-Ze,Qe,N,r.top),Qi=Iu(jt.fixed-Ht,Ot,jt.stretch,de),sr=Cu(Mt.stretch-Ve,Le,B,r.left),Rr=Iu(Mt.fixed-ht,Ft,Mt.stretch,ie),On=Cu(St.stretch-Ze,Qe,N,r.top),dn=Iu(St.fixed-Ht,Ot,St.stretch,de),Tr=new I(oi,zi),qr=new I(sr,zi),Kr=new I(sr,On),pn=new I(oi,On),mn=new I(Jt/x,Qi/x),Br=new I(Rr/x,dn/x),Or=e*Math.PI/180;if(Or){const nn=Math.sin(Or),An=Math.cos(Or),Pn=[An,-nn,nn,An];Tr._matMult(Pn),qr._matMult(Pn),pn._matMult(Pn),Kr._matMult(Pn)}const rn=zt.stretch+zt.fixed,gn=jt.stretch+jt.fixed;return{tl:Tr,tr:qr,bl:pn,br:Kr,tex:{x:b.paddedRect.x+Vo+rn,y:b.paddedRect.y+Vo+gn,w:Mt.stretch+Mt.fixed-rn,h:St.stretch+St.fixed-gn},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:mn,pixelOffsetBR:Br,minFontScaleX:Ft/x/B,minFontScaleY:Ot/x/N,isSDF:s}};if(h&&(b.stretchX||b.stretchY)){const zt=Jp($,Ee,ie),jt=Jp(W,Ae,de);for(let Mt=0;Mt0&&(ie=Math.max(10,ie),this.circleDiameter=ie)}else{let $=x.top*E-P[0],W=x.bottom*E+P[2],te=x.left*E-P[3],ie=x.right*E+P[1];const de=x.collisionPadding;if(de&&(te-=de[0]*E,$-=de[1]*E,ie+=de[2]*E,W+=de[3]*E),N){const Ee=new I(te,$),Ae=new I(ie,$),Ve=new I(te,W),Le=new I(ie,W),Ze=N*Math.PI/180;Ee._rotate(Ze),Ae._rotate(Ze),Ve._rotate(Ze),Le._rotate(Ze),te=Math.min(Ee.x,Ae.x,Ve.x,Le.x),ie=Math.max(Ee.x,Ae.x,Ve.x,Le.x),$=Math.min(Ee.y,Ae.y,Ve.y,Le.y),W=Math.max(Ee.y,Ae.y,Ve.y,Le.y)}e.emplaceBack(s.x,s.y,te,$,ie,W,h,m,b)}this.boxEndIndex=e.length}}class y1{constructor(e=[],s=v1){if(this.data=e,this.length=this.data.length,this.compare=s,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],s=this.data.pop();return this.length--,this.length>0&&(this.data[0]=s,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:s,compare:h}=this,m=s[e];for(;e>0;){const b=e-1>>1,x=s[b];if(h(m,x)>=0)break;s[e]=x,e=b}s[e]=m}_down(e){const{data:s,compare:h}=this,m=this.length>>1,b=s[e];for(;e=0)break;s[e]=E,e=x}s[e]=b}}function v1(r,e){return re?1:0}function b1(r,e=1,s=!1){let h=1/0,m=1/0,b=-1/0,x=-1/0;const E=r[0];for(let te=0;teb)&&(b=ie.x),(!te||ie.y>x)&&(x=ie.y)}const P=Math.min(b-h,x-m);let B=P/2;const N=new y1([],w1);if(P===0)return new I(h,m);for(let te=h;te$.d||!$.d)&&($=te,s&&console.log("found best %d after %d probes",Math.round(1e4*te.d)/1e4,W)),te.max-$.d<=e||(B=te.h/2,N.push(new $o(te.p.x-B,te.p.y-B,B,r)),N.push(new $o(te.p.x+B,te.p.y-B,B,r)),N.push(new $o(te.p.x-B,te.p.y+B,B,r)),N.push(new $o(te.p.x+B,te.p.y+B,B,r)),W+=4)}return s&&(console.log(`num probes: ${W}`),console.log(`best distance: ${$.d}`)),$.p}function w1(r,e){return e.max-r.max}function $o(r,e,s,h){this.p=new I(r,e),this.h=s,this.d=function(m,b){let x=!1,E=1/0;for(let P=0;Pm.y!=ie.y>m.y&&m.x<(ie.x-te.x)*(m.y-te.y)/(ie.y-te.y)+te.x&&(x=!x),E=Math.min(E,Ld(m,te,ie))}}return(x?1:-1)*Math.sqrt(E)}(this.p,h),this.max=this.d+this.h*Math.SQRT2}var Hr;n.TextAnchorEnum=void 0,(Hr=n.TextAnchorEnum||(n.TextAnchorEnum={}))[Hr.center=1]="center",Hr[Hr.left=2]="left",Hr[Hr.right=3]="right",Hr[Hr.top=4]="top",Hr[Hr.bottom=5]="bottom",Hr[Hr["top-left"]=6]="top-left",Hr[Hr["top-right"]=7]="top-right",Hr[Hr["bottom-left"]=8]="bottom-left",Hr[Hr["bottom-right"]=9]="bottom-right";const fa=7,lf=Number.POSITIVE_INFINITY;function Yp(r,e){return e[1]!==lf?function(s,h,m){let b=0,x=0;switch(h=Math.abs(h),m=Math.abs(m),s){case"top-right":case"top-left":case"top":x=m-fa;break;case"bottom-right":case"bottom-left":case"bottom":x=-m+fa}switch(s){case"top-right":case"bottom-right":case"right":b=-h;break;case"top-left":case"bottom-left":case"left":b=h}return[b,x]}(r,e[0],e[1]):function(s,h){let m=0,b=0;h<0&&(h=0);const x=h/Math.SQRT2;switch(s){case"top-right":case"top-left":b=x-fa;break;case"bottom-right":case"bottom-left":b=-x+fa;break;case"bottom":b=-h+fa;break;case"top":b=h-fa}switch(s){case"top-right":case"bottom-right":m=-x;break;case"top-left":case"bottom-left":m=x;break;case"left":m=h;break;case"right":m=-h}return[m,b]}(r,e[0])}function Qp(r,e,s){var h;const m=r.layout,b=(h=m.get("text-variable-anchor-offset"))===null||h===void 0?void 0:h.evaluate(e,{},s);if(b){const E=b.values,P=[];for(let B=0;BW*Lr);N.startsWith("top")?$[1]-=fa:N.startsWith("bottom")&&($[1]+=fa),P[B+1]=$}return new Er(P)}const x=m.get("text-variable-anchor");if(x){let E;E=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[m.get("text-radial-offset").evaluate(e,{},s)*Lr,lf]:m.get("text-offset").evaluate(e,{},s).map(B=>B*Lr);const P=[];for(const B of x)P.push(B,Yp(B,E));return new Er(P)}return null}function cf(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function x1(r,e,s,h,m,b,x,E,P,B,N){let $=b.textMaxSize.evaluate(e,{});$===void 0&&($=x);const W=r.layers[0].layout,te=W.get("icon-offset").evaluate(e,{},N),ie=tm(s.horizontal),de=x/24,Ee=r.tilePixelRatio*de,Ae=r.tilePixelRatio*$/24,Ve=r.tilePixelRatio*E,Le=r.tilePixelRatio*W.get("symbol-spacing"),Ze=W.get("text-padding")*r.tilePixelRatio,Qe=function(St,oi,Jt,zi=1){const Qi=St.get("icon-padding").evaluate(oi,{},Jt),sr=Qi&&Qi.values;return[sr[0]*zi,sr[1]*zi,sr[2]*zi,sr[3]*zi]}(W,e,N,r.tilePixelRatio),ht=W.get("text-max-angle")/180*Math.PI,Ft=W.get("text-rotation-alignment")!=="viewport"&&W.get("symbol-placement")!=="point",Ht=W.get("icon-rotation-alignment")==="map"&&W.get("symbol-placement")!=="point",Ot=W.get("symbol-placement"),Lt=Le/2,zt=W.get("icon-text-fit");let jt;h&&zt!=="none"&&(r.allowVerticalPlacement&&s.vertical&&(jt=Ep(h,s.vertical,zt,W.get("icon-text-fit-padding"),te,de)),ie&&(h=Ep(h,ie,zt,W.get("icon-text-fit-padding"),te,de)));const Mt=(St,oi)=>{oi.x<0||oi.x>=kr||oi.y<0||oi.y>=kr||function(Jt,zi,Qi,sr,Rr,On,dn,Tr,qr,Kr,pn,mn,Br,Or,rn,gn,nn,An,Pn,Fr,Li,sn,Xr,Nr,Qn){const us=Jt.addToLineVertexArray(zi,Qi);let hs,$s,es,Zn,zn=0,js=0,fc=0,sm=0,_f=-1,yf=-1;const qs={};let am=_r("");if(Jt.allowVerticalPlacement&&sr.vertical){const an=Tr.layout.get("text-rotate").evaluate(Li,{},Nr)+90;es=new Au(qr,zi,Kr,pn,mn,sr.vertical,Br,Or,rn,an),dn&&(Zn=new Au(qr,zi,Kr,pn,mn,dn,nn,An,rn,an))}if(Rr){const an=Tr.layout.get("icon-rotate").evaluate(Li,{}),Gn=Tr.layout.get("icon-text-fit")!=="none",ja=Xp(Rr,an,Xr,Gn),ds=dn?Xp(dn,an,Xr,Gn):void 0;$s=new Au(qr,zi,Kr,pn,mn,Rr,nn,An,!1,an),zn=4*ja.length;const qa=Jt.iconSizeData;let Is=null;qa.kind==="source"?(Is=[Cs*Tr.layout.get("icon-size").evaluate(Li,{})],Is[0]>ca&&q(`${Jt.layerIds[0]}: Value for "icon-size" is >= ${lc}. Reduce your "icon-size".`)):qa.kind==="composite"&&(Is=[Cs*sn.compositeIconSizes[0].evaluate(Li,{},Nr),Cs*sn.compositeIconSizes[1].evaluate(Li,{},Nr)],(Is[0]>ca||Is[1]>ca)&&q(`${Jt.layerIds[0]}: Value for "icon-size" is >= ${lc}. Reduce your "icon-size".`)),Jt.addSymbols(Jt.icon,ja,Is,Fr,Pn,Li,n.WritingMode.none,zi,us.lineStartIndex,us.lineLength,-1,Nr),_f=Jt.icon.placedSymbolArray.length-1,ds&&(js=4*ds.length,Jt.addSymbols(Jt.icon,ds,Is,Fr,Pn,Li,n.WritingMode.vertical,zi,us.lineStartIndex,us.lineLength,-1,Nr),yf=Jt.icon.placedSymbolArray.length-1)}const om=Object.keys(sr.horizontal);for(const an of om){const Gn=sr.horizontal[an];if(!hs){am=_r(Gn.text);const ds=Tr.layout.get("text-rotate").evaluate(Li,{},Nr);hs=new Au(qr,zi,Kr,pn,mn,Gn,Br,Or,rn,ds)}const ja=Gn.positionedLines.length===1;if(fc+=em(Jt,zi,Gn,On,Tr,rn,Li,gn,us,sr.vertical?n.WritingMode.horizontal:n.WritingMode.horizontalOnly,ja?om:[an],qs,_f,sn,Nr),ja)break}sr.vertical&&(sm+=em(Jt,zi,sr.vertical,On,Tr,rn,Li,gn,us,n.WritingMode.vertical,["vertical"],qs,yf,sn,Nr));const k1=hs?hs.boxStartIndex:Jt.collisionBoxArray.length,T1=hs?hs.boxEndIndex:Jt.collisionBoxArray.length,C1=es?es.boxStartIndex:Jt.collisionBoxArray.length,I1=es?es.boxEndIndex:Jt.collisionBoxArray.length,A1=$s?$s.boxStartIndex:Jt.collisionBoxArray.length,P1=$s?$s.boxEndIndex:Jt.collisionBoxArray.length,z1=Zn?Zn.boxStartIndex:Jt.collisionBoxArray.length,M1=Zn?Zn.boxEndIndex:Jt.collisionBoxArray.length;let fs=-1;const zu=(an,Gn)=>an&&an.circleDiameter?Math.max(an.circleDiameter,Gn):Gn;fs=zu(hs,fs),fs=zu(es,fs),fs=zu($s,fs),fs=zu(Zn,fs);const lm=fs>-1?1:0;lm&&(fs*=Qn/Lr),Jt.glyphOffsetArray.length>=Uo.MAX_GLYPHS&&q("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Li.sortKey!==void 0&&Jt.addToSortKeyRanges(Jt.symbolInstances.length,Li.sortKey);const D1=Qp(Tr,Li,Nr),[L1,R1]=function(an,Gn){const ja=an.length,ds=Gn==null?void 0:Gn.values;if((ds==null?void 0:ds.length)>0)for(let qa=0;qa=0?qs.right:-1,qs.center>=0?qs.center:-1,qs.left>=0?qs.left:-1,qs.vertical||-1,_f,yf,am,k1,T1,C1,I1,A1,P1,z1,M1,Kr,fc,sm,zn,js,lm,0,Br,fs,L1,R1)}(r,oi,St,s,h,m,jt,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,Ee,[Ze,Ze,Ze,Ze],Ft,P,Ve,Qe,Ht,te,e,b,B,N,x)};if(Ot==="line")for(const St of qp(e.geometry,0,0,kr,kr)){const oi=_1(St,Le,ht,s.vertical||ie,h,24,Ae,r.overscaling,kr);for(const Jt of oi)ie&&S1(r,ie.text,Lt,Jt)||Mt(St,Jt)}else if(Ot==="line-center"){for(const St of e.geometry)if(St.length>1){const oi=g1(St,ht,s.vertical||ie,h,24,Ae);oi&&Mt(St,oi)}}else if(e.type==="Polygon")for(const St of Uh(e.geometry,0)){const oi=b1(St,16);Mt(St[0],new ha(oi.x,oi.y,0))}else if(e.type==="LineString")for(const St of e.geometry)Mt(St,new ha(St[0].x,St[0].y,0));else if(e.type==="Point")for(const St of e.geometry)for(const oi of St)Mt([oi],new ha(oi.x,oi.y,0))}function em(r,e,s,h,m,b,x,E,P,B,N,$,W,te,ie){const de=function(Ve,Le,Ze,Qe,ht,Ft,Ht,Ot){const Lt=Qe.layout.get("text-rotate").evaluate(Ft,{})*Math.PI/180,zt=[];for(const jt of Le.positionedLines)for(const Mt of jt.positionedGlyphs){if(!Mt.rect)continue;const St=Mt.rect||{};let oi=_p+1,Jt=!0,zi=1,Qi=0;const sr=(ht||Ot)&&Mt.vertical,Rr=Mt.metrics.advance*Mt.scale/2;if(Ot&&Le.verticalizable&&(Qi=jt.lineOffset/2-(Mt.imageName?-(Lr-Mt.metrics.width*Mt.scale)/2:(Mt.scale-1)*Lr)),Mt.imageName){const Fr=Ht[Mt.imageName];Jt=Fr.sdf,zi=Fr.pixelRatio,oi=In/zi}const On=ht?[Mt.x+Rr,Mt.y]:[0,0];let dn=ht?[0,0]:[Mt.x+Rr+Ze[0],Mt.y+Ze[1]-Qi],Tr=[0,0];sr&&(Tr=dn,dn=[0,0]);const qr=Mt.metrics.isDoubleResolution?2:1,Kr=(Mt.metrics.left-oi)*Mt.scale-Rr+dn[0],pn=(-Mt.metrics.top-oi)*Mt.scale+dn[1],mn=Kr+St.w/qr*Mt.scale/zi,Br=pn+St.h/qr*Mt.scale/zi,Or=new I(Kr,pn),rn=new I(mn,pn),gn=new I(Kr,Br),nn=new I(mn,Br);if(sr){const Fr=new I(-Rr,Rr-ac),Li=-Math.PI/2,sn=Lr/2-Rr,Xr=new I(5-ac-sn,-(Mt.imageName?sn:0)),Nr=new I(...Tr);Or._rotateAround(Li,Fr)._add(Xr)._add(Nr),rn._rotateAround(Li,Fr)._add(Xr)._add(Nr),gn._rotateAround(Li,Fr)._add(Xr)._add(Nr),nn._rotateAround(Li,Fr)._add(Xr)._add(Nr)}if(Lt){const Fr=Math.sin(Lt),Li=Math.cos(Lt),sn=[Li,-Fr,Fr,Li];Or._matMult(sn),rn._matMult(sn),gn._matMult(sn),nn._matMult(sn)}const An=new I(0,0),Pn=new I(0,0);zt.push({tl:Or,tr:rn,bl:gn,br:nn,tex:St,writingMode:Le.writingMode,glyphOffset:On,sectionIndex:Mt.sectionIndex,isSDF:Jt,pixelOffsetTL:An,pixelOffsetBR:Pn,minFontScaleX:0,minFontScaleY:0})}return zt}(0,s,E,m,b,x,h,r.allowVerticalPlacement),Ee=r.textSizeData;let Ae=null;Ee.kind==="source"?(Ae=[Cs*m.layout.get("text-size").evaluate(x,{})],Ae[0]>ca&&q(`${r.layerIds[0]}: Value for "text-size" is >= ${lc}. Reduce your "text-size".`)):Ee.kind==="composite"&&(Ae=[Cs*te.compositeTextSizes[0].evaluate(x,{},ie),Cs*te.compositeTextSizes[1].evaluate(x,{},ie)],(Ae[0]>ca||Ae[1]>ca)&&q(`${r.layerIds[0]}: Value for "text-size" is >= ${lc}. Reduce your "text-size".`)),r.addSymbols(r.text,de,Ae,E,b,x,B,e,P.lineStartIndex,P.lineLength,W,ie);for(const Ve of N)$[Ve]=r.text.placedSymbolArray.length-1;return 4*de.length}function tm(r){for(const e in r)return r[e];return null}function S1(r,e,s,h){const m=r.compareText;if(e in m){const b=m[e];for(let x=b.length-1;x>=0;x--)if(h.dist(b[x])>4;if(m!==1)throw new Error(`Got v${m} data when expected v1.`);const b=im[15&h];if(!b)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(e,2,1),[E]=new Uint32Array(e,4,1);return new uf(E,x,b,e)}constructor(e,s=64,h=Float64Array,m){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+s,2),65535),this.ArrayType=h,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const b=im.indexOf(this.ArrayType),x=2*e*this.ArrayType.BYTES_PER_ELEMENT,E=e*this.IndexArrayType.BYTES_PER_ELEMENT,P=(8-E%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${h}.`);m&&m instanceof ArrayBuffer?(this.data=m,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+E+P,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+x+E+P),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+E+P,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=s,new Uint32Array(this.data,4,1)[0]=e)}add(e,s){const h=this._pos>>1;return this.ids[h]=h,this.coords[this._pos++]=e,this.coords[this._pos++]=s,h}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return hf(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,s,h,m){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:E}=this,P=[0,b.length-1,0],B=[];for(;P.length;){const N=P.pop()||0,$=P.pop()||0,W=P.pop()||0;if($-W<=E){for(let Ee=W;Ee<=$;Ee++){const Ae=x[2*Ee],Ve=x[2*Ee+1];Ae>=e&&Ae<=h&&Ve>=s&&Ve<=m&&B.push(b[Ee])}continue}const te=W+$>>1,ie=x[2*te],de=x[2*te+1];ie>=e&&ie<=h&&de>=s&&de<=m&&B.push(b[te]),(N===0?e<=ie:s<=de)&&(P.push(W),P.push(te-1),P.push(1-N)),(N===0?h>=ie:m>=de)&&(P.push(te+1),P.push($),P.push(1-N))}return B}within(e,s,h){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:b,nodeSize:x}=this,E=[0,m.length-1,0],P=[],B=h*h;for(;E.length;){const N=E.pop()||0,$=E.pop()||0,W=E.pop()||0;if($-W<=x){for(let Ee=W;Ee<=$;Ee++)nm(b[2*Ee],b[2*Ee+1],e,s)<=B&&P.push(m[Ee]);continue}const te=W+$>>1,ie=b[2*te],de=b[2*te+1];nm(ie,de,e,s)<=B&&P.push(m[te]),(N===0?e-h<=ie:s-h<=de)&&(E.push(W),E.push(te-1),E.push(1-N)),(N===0?e+h>=ie:s+h>=de)&&(E.push(te+1),E.push($),E.push(1-N))}return P}}function hf(r,e,s,h,m,b){if(m-h<=s)return;const x=h+m>>1;rm(r,e,x,h,m,b),hf(r,e,s,h,x-1,1-b),hf(r,e,s,x+1,m,1-b)}function rm(r,e,s,h,m,b){for(;m>h;){if(m-h>600){const B=m-h+1,N=s-h+1,$=Math.log(B),W=.5*Math.exp(2*$/3),te=.5*Math.sqrt($*W*(B-W)/B)*(N-B/2<0?-1:1);rm(r,e,s,Math.max(h,Math.floor(s-N*W/B+te)),Math.min(m,Math.floor(s+(B-N)*W/B+te)),b)}const x=e[2*s+b];let E=h,P=m;for(uc(r,e,h,s),e[2*m+b]>x&&uc(r,e,h,m);Ex;)P--}e[2*h+b]===x?uc(r,e,h,P):(P++,uc(r,e,P,m)),P<=s&&(h=P+1),s<=P&&(m=P-1)}}function uc(r,e,s,h){ff(r,s,h),ff(e,2*s,2*h),ff(e,2*s+1,2*h+1)}function ff(r,e,s){const h=r[e];r[e]=r[s],r[s]=h}function nm(r,e,s,h){const m=r-s,b=e-h;return m*m+b*b}var df;n.PerformanceMarkers=void 0,(df=n.PerformanceMarkers||(n.PerformanceMarkers={})).create="create",df.load="load",df.fullLoad="fullLoad";let Pu=null,hc=[];const pf=1e3/60,mf="loadTime",gf="fullLoadTime",E1={mark(r){performance.mark(r)},frame(r){const e=r;Pu!=null&&hc.push(e-Pu),Pu=e},clearMetrics(){Pu=null,hc=[],performance.clearMeasures(mf),performance.clearMeasures(gf);for(const r in n.PerformanceMarkers)performance.clearMarks(n.PerformanceMarkers[r])},getPerformanceMetrics(){performance.measure(mf,n.PerformanceMarkers.create,n.PerformanceMarkers.load),performance.measure(gf,n.PerformanceMarkers.create,n.PerformanceMarkers.fullLoad);const r=performance.getEntriesByName(mf)[0].duration,e=performance.getEntriesByName(gf)[0].duration,s=hc.length,h=1/(hc.reduce((b,x)=>b+x,0)/s/1e3),m=hc.filter(b=>b>pf).reduce((b,x)=>b+(x-pf)/pf,0);return{loadTime:r,fullLoadTime:e,fps:h,percentDroppedFrames:m/(s+m)*100,totalFrames:s}}};n.AJAXError=Ct,n.ARRAY_TYPE=Lo,n.Actor=class{constructor(r,e,s){this.receive=h=>{const m=h.data,b=m.id;if(b&&(!m.targetMapId||this.mapId===m.targetMapId))if(m.type===""){delete this.tasks[b];const x=this.cancelCallbacks[b];delete this.cancelCallbacks[b],x&&x()}else at()||m.mustQueue?(this.tasks[b]=m,this.taskQueue.push(b),this.invoker.trigger()):this.processTask(b,m)},this.process=()=>{if(!this.taskQueue.length)return;const h=this.taskQueue.shift(),m=this.tasks[h];delete this.tasks[h],this.taskQueue.length&&this.invoker.trigger(),m&&this.processTask(h,m)},this.target=r,this.parent=e,this.mapId=s,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new p1(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=at()?r:window}send(r,e,s,h,m=!1){const b=Math.round(1e18*Math.random()).toString(36).substring(0,10);s&&(this.callbacks[b]=s);const x=ot(this.globalScope)?void 0:[];return this.target.postMessage({id:b,type:r,hasCallback:!!s,targetMapId:h,mustQueue:m,sourceMapId:this.mapId,data:ra(e,x)},x),{cancel:()=>{s&&delete this.callbacks[b],this.target.postMessage({id:b,type:"",targetMapId:h,sourceMapId:this.mapId})}}}processTask(r,e){if(e.type===""){const s=this.callbacks[r];delete this.callbacks[r],s&&(e.error?s(Da(e.error)):s(null,Da(e.data)))}else{let s=!1;const h=ot(this.globalScope)?void 0:[],m=e.hasCallback?(E,P)=>{s=!0,delete this.cancelCallbacks[r],this.target.postMessage({id:r,type:"",sourceMapId:this.mapId,error:E?ra(E):null,data:ra(P,h)},h)}:E=>{s=!0};let b=null;const x=Da(e.data);if(this.parent[e.type])b=this.parent[e.type](e.sourceMapId,x,m);else if(this.parent.getWorkerSource){const E=e.type.split(".");b=this.parent.getWorkerSource(e.sourceMapId,E[0],x.source)[E[1]](x,m)}else m(new Error(`Could not find function ${e.type}`));!s&&b&&b.cancel&&(this.cancelCallbacks[r]=b.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},n.AlphaImage=Yl,n.CanonicalTileID=of,n.CollisionBoxArray=ue,n.CollisionCircleLayoutArray=class extends g{},n.Color=Ai,n.DEMData=Fp,n.DataConstantProperty=Qt,n.DictionaryCoder=Np,n.EXTENT=kr,n.ErrorEvent=$e,n.EvaluationParameters=tr,n.Event=ge,n.Evented=ft,n.FeatureIndex=Vp,n.FillBucket=jh,n.FillExtrusionBucket=Zh,n.GeoJSONFeature=Up,n.ImageAtlas=vp,n.ImagePosition=Xh,n.KDBush=uf,n.LineBucket=Gh,n.LineStripIndexArray=class extends pe{},n.LngLat=ua,n.MercatorCoordinate=ku,n.ONE_EM=Lr,n.OverscaledTileID=qn,n.PerformanceUtils=E1,n.Point=I,n.Pos3dArray=class extends Ss{},n.PosArray=Gt,n.Properties=en,n.Protobuf=Hh,n.QuadTriangleArray=class extends k{},n.RGBAImage=jn,n.RasterBoundsArray=class extends Wl{},n.RequestPerformance=class{constructor(r){this._marks={start:[r.url,"start"].join("#"),end:[r.url,"end"].join("#"),measure:r.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let r=performance.getEntriesByName(this._marks.measure);return r.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),r=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),r}},n.SegmentVector=nr,n.SymbolBucket=Uo,n.Transitionable=su,n.TriangleIndexArray=fr,n.Uniform1f=zo,n.Uniform1i=class extends Ns{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},n.Uniform2f=class extends Ns{constructor(r,e){super(r,e),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},n.Uniform3f=class extends Ns{constructor(r,e){super(r,e),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},n.Uniform4f=cu,n.UniformColor=uu,n.UniformMatrix4f=class extends Ns{constructor(r,e){super(r,e),this.current=Ih}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},n.UnwrappedTileID=Op,n.ValidationError=mt,n.ZoomHistory=Ll,n.__awaiter=_,n.addDynamicAttributes=ef,n.arrayBufferToImage=function(r,e){const s=new Image;s.onload=()=>{e(null,s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame(()=>{s.src=ae})},s.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 h=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(h):ae},n.arrayBufferToImageBitmap=function(r,e){const s=new Blob([new Uint8Array(r)],{type:"image/png"});createImageBitmap(s).then(h=>{e(null,h)}).catch(h=>{e(new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},n.asyncAll=function(r,e,s){if(!r.length)return s(null,[]);let h=r.length;const m=new Array(r.length);let b=null;r.forEach((x,E)=>{e(x,(P,B)=>{P&&(b=P),m[E]=B,--h==0&&s(b,m)})})},n.bezier=ee,n.browser=kt,n.clamp=se,n.clipLine=qp,n.clone=function(r){var e=new Lo(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},n.clone$1=be,n.collisionCircleLayout=$0,n.config=vt,n.copy=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},n.create=function(){var r=new Lo(16);return Lo!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},n.createExpression=bo,n.createFilter=kl,n.createLayout=ir,n.createStyleLayer=function(r){if(r.type==="custom")return new d1(r);switch(r.type){case"background":return new u1(r);case"circle":return new Ky(r);case"fill":return new m0(r);case"fill-extrusion":return new P0(r);case"heatmap":return new Jy(r);case"hillshade":return new Qy(r);case"line":return new F0(r);case"raster":return new f1(r);case"symbol":return new Eu(r)}},n.deepEqual=function r(e,s){if(Array.isArray(e)){if(!Array.isArray(s)||e.length!==s.length)return!1;for(let h=0;h{h[x.source]?s.push({command:ct.removeLayer,args:[x.id]}):b.push(x)}),s=s.concat(m),function(x,E,P){E=E||[];const B=(x=x||[]).map(dr),N=E.map(dr),$=x.reduce(Gr,{}),W=E.reduce(Gr,{}),te=B.slice(),ie=Object.create(null);let de,Ee,Ae,Ve,Le,Ze,Qe;for(de=0,Ee=0;de{}}},n.groupByLayout=function(r,e){const s={};for(let m=0;m@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(s,h,m,b)=>{const x=m||b;return e[h]=!x||x.toLowerCase(),""}),e["max-age"]){const s=parseInt(e["max-age"],10);isNaN(s)?delete e["max-age"]:e["max-age"]=s}return e},n.parseGlyphPbf=function(r){return new Hh(r).readFields(Q0,[])},n.pbf=up,n.performSymbolLayout=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=kr/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const e=r.bucket.layers[0],s=e.layout,h=e._unevaluatedLayout._values,m={layoutIconSize:h["icon-size"].possiblyEvaluate(new tr(r.bucket.zoom+1),r.canonical),layoutTextSize:h["text-size"].possiblyEvaluate(new tr(r.bucket.zoom+1),r.canonical),textMaxSize:h["text-size"].possiblyEvaluate(new tr(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:B,maxZoom:N}=r.bucket.textSizeData;m.compositeTextSizes=[h["text-size"].possiblyEvaluate(new tr(B),r.canonical),h["text-size"].possiblyEvaluate(new tr(N),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:B,maxZoom:N}=r.bucket.iconSizeData;m.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new tr(B),r.canonical),h["icon-size"].possiblyEvaluate(new tr(N),r.canonical)]}const b=s.get("text-line-height")*Lr,x=s.get("text-rotation-alignment")!=="viewport"&&s.get("symbol-placement")!=="point",E=s.get("text-keep-upright"),P=s.get("text-size");for(const B of r.bucket.features){const N=s.get("text-font").evaluate(B,{},r.canonical).join(","),$=P.evaluate(B,{},r.canonical),W=m.layoutTextSize.evaluate(B,{},r.canonical),te=m.layoutIconSize.evaluate(B,{},r.canonical),ie={horizontal:{},vertical:void 0},de=B.text;let Ee,Ae=[0,0];if(de){const Ze=de.toString(),Qe=s.get("text-letter-spacing").evaluate(B,{},r.canonical)*Lr,ht=Eh(Ze)?Qe:0,Ft=s.get("text-anchor").evaluate(B,{},r.canonical),Ht=Qp(e,B,r.canonical);if(!Ht){const Mt=s.get("text-radial-offset").evaluate(B,{},r.canonical);Ae=Mt?Yp(Ft,[Mt*Lr,lf]):s.get("text-offset").evaluate(B,{},r.canonical).map(St=>St*Lr)}let Ot=x?"center":s.get("text-justify").evaluate(B,{},r.canonical);const Lt=s.get("symbol-placement"),zt=Lt==="point"?s.get("text-max-width").evaluate(B,{},r.canonical)*Lr:0,jt=()=>{r.bucket.allowVerticalPlacement&&La(Ze)&&(ie.vertical=wu(de,r.glyphMap,r.glyphPositions,r.imagePositions,N,zt,b,Ft,"left",ht,Ae,n.WritingMode.vertical,!0,Lt,W,$))};if(!x&&Ht){const Mt=new Set;if(Ot==="auto")for(let oi=0;oithis._layers[le.id]),Ne=Ce[0];if(Ne.visibility==="none")continue;const Re=Ne.source||"";let Pe=this.familiesBySource[Re];Pe||(Pe=this.familiesBySource[Re]={});const H=Ne.sourceLayer||"_geojsonTileLayer";let X=Pe[H];X||(X=Pe[H]=[]),X.push(Ce)}}}class v{constructor(G){const K={},ce=[];for(const Re in G){const Pe=G[Re],H=K[Re]={};for(const X in Pe){const le=Pe[+X];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;const ke={x:0,y:0,w:le.bitmap.width+2,h:le.bitmap.height+2};ce.push(ke),H[X]={rect:ke,metrics:le.metrics}}}const{w:ye,h:Ce}=n.potpack(ce),Ne=new n.AlphaImage({width:ye||1,height:Ce||1});for(const Re in G){const Pe=G[Re];for(const H in Pe){const X=Pe[+H];if(!X||X.bitmap.width===0||X.bitmap.height===0)continue;const le=K[Re][H].rect;n.AlphaImage.copy(X.bitmap,Ne,{x:0,y:0},{x:le.x+1,y:le.y+1},X.bitmap)}}this.image=Ne,this.positions=K}}n.register("GlyphAtlas",v);class S{constructor(G){this.tileID=new n.OverscaledTileID(G.tileID.overscaledZ,G.tileID.wrap,G.tileID.canonical.z,G.tileID.canonical.x,G.tileID.canonical.y),this.uid=G.uid,this.zoom=G.zoom,this.pixelRatio=G.pixelRatio,this.tileSize=G.tileSize,this.source=G.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=G.showCollisionBoxes,this.collectResourceTiming=!!G.collectResourceTiming,this.returnDependencies=!!G.returnDependencies,this.promoteId=G.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(G,K,ce,ye,Ce){this.status="parsing",this.data=G,this.collisionBoxArray=new n.CollisionBoxArray;const Ne=new n.DictionaryCoder(Object.keys(G.layers).sort()),Re=new n.FeatureIndex(this.tileID,this.promoteId);Re.bucketLayerIDs=[];const Pe={},H={featureIndex:Re,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ce},X=K.familiesBySource[this.source];for(const ni in X){const li=G.layers[ni];if(!li)continue;li.version===1&&n.warnOnce(`Vector tile source "${this.source}" layer "${ni}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ai=Ne.encode(ni),gi=[];for(let Pi=0;Pi=Si.maxzoom||Si.visibility!=="none"&&(T(Pi,this.zoom,ce),(Pe[Si.id]=Si.createBucket({index:Re.bucketLayerIDs.length,layers:Pi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ai,sourceID:this.source})).populate(gi,H,this.tileID.canonical),Re.bucketLayerIDs.push(Pi.map($r=>$r.id)))}}let le,ke,Be,bt;const dt=n.mapObject(H.glyphDependencies,ni=>Object.keys(ni).map(Number));this.inFlightDependencies.forEach(ni=>ni==null?void 0:ni.cancel()),this.inFlightDependencies=[];const Tt=++this.dependencySentinel;Object.keys(dt).length?this.inFlightDependencies.push(ye.send("getGlyphs",{uid:this.uid,stacks:dt,source:this.source,tileID:this.tileID,type:"glyphs"},(ni,li)=>{Tt===this.dependencySentinel&&(le||(le=ni,ke=li,Yt.call(this)))})):ke={};const qt=Object.keys(H.iconDependencies);qt.length?this.inFlightDependencies.push(ye.send("getImages",{icons:qt,source:this.source,tileID:this.tileID,type:"icons"},(ni,li)=>{Tt===this.dependencySentinel&&(le||(le=ni,Be=li,Yt.call(this)))})):Be={};const di=Object.keys(H.patternDependencies);function Yt(){if(le)return Ce(le);if(ke&&Be&&bt){const ni=new v(ke),li=new n.ImageAtlas(Be,bt);for(const ai in Pe){const gi=Pe[ai];gi instanceof n.SymbolBucket?(T(gi.layers,this.zoom,ce),n.performSymbolLayout({bucket:gi,glyphMap:ke,glyphPositions:ni.positions,imageMap:Be,imagePositions:li.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):gi.hasPattern&&(gi instanceof n.LineBucket||gi instanceof n.FillBucket||gi instanceof n.FillExtrusionBucket)&&(T(gi.layers,this.zoom,ce),gi.addFeatures(H,this.tileID.canonical,li.patternPositions))}this.status="done",Ce(null,{buckets:Object.values(Pe).filter(ai=>!ai.isEmpty()),featureIndex:Re,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ni.image,imageAtlas:li,glyphMap:this.returnDependencies?ke:null,iconMap:this.returnDependencies?Be:null,glyphPositions:this.returnDependencies?ni.positions:null})}}di.length?this.inFlightDependencies.push(ye.send("getImages",{icons:di,source:this.source,tileID:this.tileID,type:"patterns"},(ni,li)=>{Tt===this.dependencySentinel&&(le||(le=ni,bt=li,Yt.call(this)))})):bt={},Yt.call(this)}}function T(_e,G,K){const ce=new n.EvaluationParameters(G);for(const ye of _e)ye.recalculate(ce,K)}function I(_e,G){const K=n.getArrayBuffer(_e.request,(ce,ye,Ce,Ne)=>{if(ce)G(ce);else if(ye)try{const Re=new n.vectorTile.VectorTile(new n.Protobuf(ye));G(null,{vectorTile:Re,rawData:ye,cacheControl:Ce,expires:Ne})}catch(Re){const Pe=new Uint8Array(ye);let H=`Unable to parse the tile at ${_e.request.url}, `;H+=Pe[0]===31&&Pe[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${Re.messge}`,G(new Error(H))}});return()=>{K.cancel(),G()}}class z{constructor(G,K,ce,ye){this.actor=G,this.layerIndex=K,this.availableImages=ce,this.loadVectorData=ye||I,this.fetching={},this.loading={},this.loaded={}}loadTile(G,K){const ce=G.uid;this.loading||(this.loading={});const ye=!!(G&&G.request&&G.request.collectResourceTiming)&&new n.RequestPerformance(G.request),Ce=this.loading[ce]=new S(G);Ce.abort=this.loadVectorData(G,(Ne,Re)=>{if(delete this.loading[ce],Ne||!Re)return Ce.status="done",this.loaded[ce]=Ce,K(Ne);const Pe=Re.rawData,H={};Re.expires&&(H.expires=Re.expires),Re.cacheControl&&(H.cacheControl=Re.cacheControl);const X={};if(ye){const le=ye.finish();le&&(X.resourceTiming=JSON.parse(JSON.stringify(le)))}Ce.vectorTile=Re.vectorTile,Ce.parse(Re.vectorTile,this.layerIndex,this.availableImages,this.actor,(le,ke)=>{if(delete this.fetching[ce],le||!ke)return K(le);K(null,n.extend({rawTileData:Pe.slice(0)},ke,H,X))}),this.loaded=this.loaded||{},this.loaded[ce]=Ce,this.fetching[ce]={rawTileData:Pe,cacheControl:H,resourceTiming:X}})}reloadTile(G,K){const ce=this.loaded,ye=G.uid;if(ce&&ce[ye]){const Ce=ce[ye];Ce.showCollisionBoxes=G.showCollisionBoxes,Ce.status==="parsing"?Ce.parse(Ce.vectorTile,this.layerIndex,this.availableImages,this.actor,(Ne,Re)=>{if(Ne||!Re)return K(Ne,Re);let Pe;if(this.fetching[ye]){const{rawTileData:H,cacheControl:X,resourceTiming:le}=this.fetching[ye];delete this.fetching[ye],Pe=n.extend({rawTileData:H.slice(0)},Re,X,le)}else Pe=Re;K(null,Pe)}):Ce.status==="done"&&(Ce.vectorTile?Ce.parse(Ce.vectorTile,this.layerIndex,this.availableImages,this.actor,K):K())}}abortTile(G,K){const ce=this.loading,ye=G.uid;ce&&ce[ye]&&ce[ye].abort&&(ce[ye].abort(),delete ce[ye]),K()}removeTile(G,K){const ce=this.loaded,ye=G.uid;ce&&ce[ye]&&delete ce[ye],K()}}class M{constructor(){this.loaded={}}loadTile(G,K){return n.__awaiter(this,void 0,void 0,function*(){const{uid:ce,encoding:ye,rawImageData:Ce,redFactor:Ne,greenFactor:Re,blueFactor:Pe,baseShift:H}=G,X=Ce.width+2,le=Ce.height+2,ke=n.isImageBitmap(Ce)?new n.RGBAImage({width:X,height:le},yield n.getImageData(Ce,-1,-1,X,le)):Ce,Be=new n.DEMData(ce,ke,ye,Ne,Re,Pe,H);this.loaded=this.loaded||{},this.loaded[ce]=Be,K(null,Be)})}removeTile(G){const K=this.loaded,ce=G.uid;K&&K[ce]&&delete K[ce]}}function C(_e,G){if(_e.length!==0){R(_e[0],G);for(var K=1;K<_e.length;K++)R(_e[K],!G)}}function R(_e,G){for(var K=0,ce=0,ye=0,Ce=_e.length,Ne=Ce-1;ye=Math.abs(Re)?K-Pe+Re:Re-Pe+K,K=Pe}K+ce>=0!=!!G&&_e.reverse()}var D=n.getDefaultExportFromCjs(function _e(G,K){var ce,ye=G&&G.type;if(ye==="FeatureCollection")for(ce=0;ce>31}function at(_e,G){for(var K=_e.loadGeometry(),ce=_e.type,ye=0,Ce=0,Ne=K.length,Re=0;Re_e},ae=Math.fround||(xe=new Float32Array(1),_e=>(xe[0]=+_e,xe[0]));var xe;const Me=3,Y=5,he=6;class Je{constructor(G){this.options=Object.assign(Object.create(st),G),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(G){const{log:K,minZoom:ce,maxZoom:ye}=this.options;K&&console.time("total time");const Ce=`prepare ${G.length} points`;K&&console.time(Ce),this.points=G;const Ne=[];for(let Pe=0;Pe=ce;Pe--){const H=+Date.now();Re=this.trees[Pe]=this._createTree(this._cluster(Re,Pe)),K&&console.log("z%d: %d clusters in %dms",Pe,Re.numItems,+Date.now()-H)}return K&&console.timeEnd("total time"),this}getClusters(G,K){let ce=((G[0]+180)%360+360)%360-180;const ye=Math.max(-90,Math.min(90,G[1]));let Ce=G[2]===180?180:((G[2]+180)%360+360)%360-180;const Ne=Math.max(-90,Math.min(90,G[3]));if(G[2]-G[0]>=360)ce=-180,Ce=180;else if(ce>Ce){const le=this.getClusters([ce,ye,180,Ne],K),ke=this.getClusters([-180,ye,Ce,Ne],K);return le.concat(ke)}const Re=this.trees[this._limitZoom(K)],Pe=Re.range(Ct(ce),Bt(Ne),Ct(Ce),Bt(ye)),H=Re.data,X=[];for(const le of Pe){const ke=this.stride*le;X.push(H[ke+Y]>1?kt(H,ke,this.clusterProps):this.points[H[ke+Me]])}return X}getChildren(G){const K=this._getOriginId(G),ce=this._getOriginZoom(G),ye="No cluster with the specified id.",Ce=this.trees[ce];if(!Ce)throw new Error(ye);const Ne=Ce.data;if(K*this.stride>=Ne.length)throw new Error(ye);const Re=this.options.radius/(this.options.extent*Math.pow(2,ce-1)),Pe=Ce.within(Ne[K*this.stride],Ne[K*this.stride+1],Re),H=[];for(const X of Pe){const le=X*this.stride;Ne[le+4]===G&&H.push(Ne[le+Y]>1?kt(Ne,le,this.clusterProps):this.points[Ne[le+Me]])}if(H.length===0)throw new Error(ye);return H}getLeaves(G,K,ce){const ye=[];return this._appendLeaves(ye,G,K=K||10,ce=ce||0,0),ye}getTile(G,K,ce){const ye=this.trees[this._limitZoom(G)],Ce=Math.pow(2,G),{extent:Ne,radius:Re}=this.options,Pe=Re/Ne,H=(ce-Pe)/Ce,X=(ce+1+Pe)/Ce,le={features:[]};return this._addTileFeatures(ye.range((K-Pe)/Ce,H,(K+1+Pe)/Ce,X),ye.data,K,ce,Ce,le),K===0&&this._addTileFeatures(ye.range(1-Pe/Ce,H,1,X),ye.data,Ce,ce,Ce,le),K===Ce-1&&this._addTileFeatures(ye.range(0,H,Pe/Ce,X),ye.data,-1,ce,Ce,le),le.features.length?le:null}getClusterExpansionZoom(G){let K=this._getOriginZoom(G)-1;for(;K<=this.options.maxZoom;){const ce=this.getChildren(G);if(K++,ce.length!==1)break;G=ce[0].properties.cluster_id}return K}_appendLeaves(G,K,ce,ye,Ce){const Ne=this.getChildren(K);for(const Re of Ne){const Pe=Re.properties;if(Pe&&Pe.cluster?Ce+Pe.point_count<=ye?Ce+=Pe.point_count:Ce=this._appendLeaves(G,Pe.cluster_id,ce,ye,Ce):Ce1;let X,le,ke;if(H)X=vt(K,Pe,this.clusterProps),le=K[Pe],ke=K[Pe+1];else{const dt=this.points[K[Pe+Me]];X=dt.properties;const[Tt,qt]=dt.geometry.coordinates;le=Ct(Tt),ke=Bt(qt)}const Be={type:1,geometry:[[Math.round(this.options.extent*(le*Ce-ce)),Math.round(this.options.extent*(ke*Ce-ye))]],tags:X};let bt;bt=H||this.options.generateId?K[Pe+Me]:this.points[K[Pe+Me]].id,bt!==void 0&&(Be.id=bt),Ne.features.push(Be)}}_limitZoom(G){return Math.max(this.options.minZoom,Math.min(Math.floor(+G),this.options.maxZoom+1))}_cluster(G,K){const{radius:ce,extent:ye,reduce:Ce,minPoints:Ne}=this.options,Re=ce/(ye*Math.pow(2,K)),Pe=G.data,H=[],X=this.stride;for(let le=0;leK&&(Tt+=Pe[di+Y])}if(Tt>dt&&Tt>=Ne){let qt,di=ke*dt,Yt=Be*dt,ni=-1;const li=((le/X|0)<<5)+(K+1)+this.points.length;for(const ai of bt){const gi=ai*X;if(Pe[gi+2]<=K)continue;Pe[gi+2]=K;const Pi=Pe[gi+Y];di+=Pe[gi]*Pi,Yt+=Pe[gi+1]*Pi,Pe[gi+4]=li,Ce&&(qt||(qt=this._map(Pe,le,!0),ni=this.clusterProps.length,this.clusterProps.push(qt)),Ce(qt,this._map(Pe,gi)))}Pe[le+4]=li,H.push(di/Tt,Yt/Tt,1/0,li,-1,Tt),Ce&&H.push(ni)}else{for(let qt=0;qt1)for(const qt of bt){const di=qt*X;if(!(Pe[di+2]<=K)){Pe[di+2]=K;for(let Yt=0;Yt>5}_getOriginZoom(G){return(G-this.points.length)%32}_map(G,K,ce){if(G[K+Y]>1){const Ne=this.clusterProps[G[K+he]];return ce?Object.assign({},Ne):Ne}const ye=this.points[G[K+Me]].properties,Ce=this.options.map(ye);return ce&&Ce===ye?Object.assign({},Ce):Ce}}function kt(_e,G,K){return{type:"Feature",id:_e[G+Me],properties:vt(_e,G,K),geometry:{type:"Point",coordinates:[(ce=_e[G],360*(ce-.5)),fi(_e[G+1])]}};var ce}function vt(_e,G,K){const ce=_e[G+Y],ye=ce>=1e4?`${Math.round(ce/1e3)}k`:ce>=1e3?Math.round(ce/100)/10+"k":ce,Ce=_e[G+he],Ne=Ce===-1?{}:Object.assign({},K[Ce]);return Object.assign(Ne,{cluster:!0,cluster_id:_e[G+Me],point_count:ce,point_count_abbreviated:ye})}function Ct(_e){return _e/360+.5}function Bt(_e){const G=Math.sin(_e*Math.PI/180),K=.5-.25*Math.log((1+G)/(1-G))/Math.PI;return K<0?0:K>1?1:K}function fi(_e){const G=(180-360*_e)*Math.PI/180;return 360*Math.atan(Math.exp(G))/Math.PI-90}function pt(_e,G,K,ce){for(var ye,Ce=ce,Ne=K-G>>1,Re=K-G,Pe=_e[G],H=_e[G+1],X=_e[K],le=_e[K+1],ke=G+3;keCe)ye=ke,Ce=Be;else if(Be===Ce){var bt=Math.abs(ke-Ne);btce&&(ye-G>3&&pt(_e,G,ye,ce),_e[ye+2]=Ce,K-ye>3&&pt(_e,ye,K,ce))}function _i(_e,G,K,ce,ye,Ce){var Ne=ye-K,Re=Ce-ce;if(Ne!==0||Re!==0){var Pe=((_e-K)*Ne+(G-ce)*Re)/(Ne*Ne+Re*Re);Pe>1?(K=ye,ce=Ce):Pe>0&&(K+=Ne*Pe,ce+=Re*Pe)}return(Ne=_e-K)*Ne+(Re=G-ce)*Re}function Z(_e,G,K,ce){var ye={id:_e===void 0?null:_e,type:G,geometry:K,tags:ce,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ce){var Ne=Ce.geometry,Re=Ce.type;if(Re==="Point"||Re==="MultiPoint"||Re==="LineString")lt(Ce,Ne);else if(Re==="Polygon"||Re==="MultiLineString")for(var Pe=0;Pe0&&(Ne+=ce?(ye*H-Pe*Ce)/2:Math.sqrt(Math.pow(Pe-ye,2)+Math.pow(H-Ce,2))),ye=Pe,Ce=H}var X=G.length-3;G[2]=1,pt(G,0,X,K),G[X+2]=1,G.size=Math.abs(Ne),G.start=0,G.end=G.size}function $e(_e,G,K,ce){for(var ye=0;ye<_e.length;ye++){var Ce=[];ge(_e[ye],Ce,K,ce),G.push(Ce)}}function ft(_e){return _e/360+.5}function Ie(_e){var G=Math.sin(_e*Math.PI/180),K=.5-.25*Math.log((1+G)/(1-G))/Math.PI;return K<0?0:K>1?1:K}function We(_e,G,K,ce,ye,Ce,Ne,Re){if(ce/=G,Ce>=(K/=G)&&Ne=ce)return null;for(var Pe=[],H=0;H<_e.length;H++){var X=_e[H],le=X.geometry,ke=X.type,Be=ye===0?X.minX:X.minY,bt=ye===0?X.maxX:X.maxY;if(Be>=K&&bt=ce)){var dt=[];if(ke==="Point"||ke==="MultiPoint")wt(le,dt,K,ce,ye);else if(ke==="LineString")Et(le,dt,K,ce,ye,!1,Re.lineMetrics);else if(ke==="MultiLineString")Xt(le,dt,K,ce,ye,!1);else if(ke==="Polygon")Xt(le,dt,K,ce,ye,!0);else if(ke==="MultiPolygon")for(var Tt=0;Tt=K&&Ne<=ce&&(G.push(_e[Ce]),G.push(_e[Ce+1]),G.push(_e[Ce+2]))}}function Et(_e,G,K,ce,ye,Ce,Ne){for(var Re,Pe,H=ct(_e),X=ye===0?ki:Wi,le=_e.start,ke=0;ke<_e.length-3;ke+=3){var Be=_e[ke],bt=_e[ke+1],dt=_e[ke+2],Tt=_e[ke+3],qt=_e[ke+4],di=ye===0?Be:bt,Yt=ye===0?Tt:qt,ni=!1;Ne&&(Re=Math.sqrt(Math.pow(Be-Tt,2)+Math.pow(bt-qt,2))),diK&&(Pe=X(H,Be,bt,Tt,qt,K),Ne&&(H.start=le+Re*Pe)):di>ce?Yt=K&&(Pe=X(H,Be,bt,Tt,qt,K),ni=!0),Yt>ce&&di<=ce&&(Pe=X(H,Be,bt,Tt,qt,ce),ni=!0),!Ce&&ni&&(Ne&&(H.end=le+Re*Pe),G.push(H),H=ct(_e)),Ne&&(le+=Re)}var li=_e.length-3;Be=_e[li],bt=_e[li+1],dt=_e[li+2],(di=ye===0?Be:bt)>=K&&di<=ce&&Ii(H,Be,bt,dt),li=H.length-3,Ce&&li>=3&&(H[li]!==H[0]||H[li+1]!==H[1])&&Ii(H,H[0],H[1],H[2]),H.length&&G.push(H)}function ct(_e){var G=[];return G.size=_e.size,G.start=_e.start,G.end=_e.end,G}function Xt(_e,G,K,ce,ye,Ce){for(var Ne=0;Ne<_e.length;Ne++)Et(_e[Ne],G,K,ce,ye,Ce,!1)}function Ii(_e,G,K,ce){_e.push(G),_e.push(K),_e.push(ce)}function ki(_e,G,K,ce,ye,Ce){var Ne=(Ce-G)/(ce-G);return _e.push(Ce),_e.push(K+(ye-K)*Ne),_e.push(1),Ne}function Wi(_e,G,K,ce,ye,Ce){var Ne=(Ce-K)/(ye-K);return _e.push(G+(ce-G)*Ne),_e.push(Ce),_e.push(1),Ne}function ar(_e,G){for(var K=[],ce=0;ce<_e.length;ce++){var ye,Ce=_e[ce],Ne=Ce.type;if(Ne==="Point"||Ne==="MultiPoint"||Ne==="LineString")ye=dr(Ce.geometry,G);else if(Ne==="MultiLineString"||Ne==="Polygon"){ye=[];for(var Re=0;ReNe.maxX&&(Ne.maxX=X),le>Ne.maxY&&(Ne.maxY=le)}return Ne}function wr(_e,G,K,ce){var ye=G.geometry,Ce=G.type,Ne=[];if(Ce==="Point"||Ce==="MultiPoint")for(var Re=0;Re0&&G.size<(ye?Ne:ce))K.numPoints+=G.length/3;else{for(var Re=[],Pe=0;PeNe)&&(K.numSimplified++,Re.push(G[Pe]),Re.push(G[Pe+1])),K.numPoints++;ye&&function(H,X){for(var le=0,ke=0,Be=H.length,bt=Be-2;ke0===X)for(ke=0,Be=H.length;ke24)throw new Error("maxZoom should be in the 0-24 range");if(G.promoteId&&G.generateId)throw new Error("promoteId and generateId cannot be used together.");var ce=function(ye,Ce){var Ne=[];if(ye.type==="FeatureCollection")for(var Re=0;Re1&&console.time("creation"),ke=this.tiles[le]=Ji(_e,G,K,ce,Pe),this.tileCoords.push({z:G,x:K,y:ce}),H)){H>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",G,K,ce,ke.numFeatures,ke.numPoints,ke.numSimplified),console.timeEnd("creation"));var Be="z"+G;this.stats[Be]=(this.stats[Be]||0)+1,this.total++}if(ke.source=_e,ye){if(G===Pe.maxZoom||G===ye)continue;var bt=1<1&&console.time("clipping");var dt,Tt,qt,di,Yt,ni,li=.5*Pe.buffer/Pe.extent,ai=.5-li,gi=.5+li,Pi=1+li;dt=Tt=qt=di=null,Yt=We(_e,X,K-li,K+gi,0,ke.minX,ke.maxX,Pe),ni=We(_e,X,K+ai,K+Pi,0,ke.minX,ke.maxX,Pe),_e=null,Yt&&(dt=We(Yt,X,ce-li,ce+gi,1,ke.minY,ke.maxY,Pe),Tt=We(Yt,X,ce+ai,ce+Pi,1,ke.minY,ke.maxY,Pe),Yt=null),ni&&(qt=We(ni,X,ce-li,ce+gi,1,ke.minY,ke.maxY,Pe),di=We(ni,X,ce+ai,ce+Pi,1,ke.minY,ke.maxY,Pe),ni=null),H>1&&console.timeEnd("clipping"),Re.push(dt||[],G+1,2*K,2*ce),Re.push(Tt||[],G+1,2*K,2*ce+1),Re.push(qt||[],G+1,2*K+1,2*ce),Re.push(di||[],G+1,2*K+1,2*ce+1)}}},or.prototype.getTile=function(_e,G,K){var ce=this.options,ye=ce.extent,Ce=ce.debug;if(_e<0||_e>24)return null;var Ne=1<<_e,Re=Pt(_e,G=(G%Ne+Ne)%Ne,K);if(this.tiles[Re])return Gr(this.tiles[Re],ye);Ce>1&&console.log("drilling down to z%d-%d-%d",_e,G,K);for(var Pe,H=_e,X=G,le=K;!Pe&&H>0;)H--,X=Math.floor(X/2),le=Math.floor(le/2),Pe=this.tiles[Pt(H,X,le)];return Pe&&Pe.source?(Ce>1&&console.log("found parent tile z%d-%d-%d",H,X,le),Ce>1&&console.time("drilling down"),this.splitTile(Pe.source,H,X,le,_e,G,K),Ce>1&&console.timeEnd("drilling down"),this.tiles[Re]?Gr(this.tiles[Re],ye):null):null};class pi extends z{constructor(G,K,ce,ye){super(G,K,ce,Vr),this._dataUpdateable=new Map,this.loadGeoJSON=(Ce,Ne)=>{const{promoteId:Re}=Ce;if(Ce.request)return n.getJSON(Ce.request,(Pe,H,X,le)=>{this._dataUpdateable=bi(H,Re)?Sr(H,Re):void 0,Ne(Pe,H,X,le)});if(typeof Ce.data=="string")try{const Pe=JSON.parse(Ce.data);this._dataUpdateable=bi(Pe,Re)?Sr(Pe,Re):void 0,Ne(null,Pe)}catch{Ne(new Error(`Input data given to '${Ce.source}' is not a valid GeoJSON object.`))}else Ce.dataDiff?this._dataUpdateable?(function(Pe,H,X){var le,ke,Be,bt;if(H.removeAll&&Pe.clear(),H.remove)for(const dt of H.remove)Pe.delete(dt);if(H.add)for(const dt of H.add){const Tt=vi(dt,X);Tt!=null&&Pe.set(Tt,dt)}if(H.update)for(const dt of H.update){let Tt=Pe.get(dt.id);if(Tt==null)continue;const qt=!dt.removeAllProperties&&(((le=dt.removeProperties)===null||le===void 0?void 0:le.length)>0||((ke=dt.addOrUpdateProperties)===null||ke===void 0?void 0:ke.length)>0);if((dt.newGeometry||dt.removeAllProperties||qt)&&(Tt=Object.assign({},Tt),Pe.set(dt.id,Tt),qt&&(Tt.properties=Object.assign({},Tt.properties))),dt.newGeometry&&(Tt.geometry=dt.newGeometry),dt.removeAllProperties)Tt.properties={};else if(((Be=dt.removeProperties)===null||Be===void 0?void 0:Be.length)>0)for(const di of dt.removeProperties)Object.prototype.hasOwnProperty.call(Tt.properties,di)&&delete Tt.properties[di];if(((bt=dt.addOrUpdateProperties)===null||bt===void 0?void 0:bt.length)>0)for(const{key:di,value:Yt}of dt.addOrUpdateProperties)Tt.properties[di]=Yt}}(this._dataUpdateable,Ce.dataDiff,Re),Ne(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):Ne(new Error(`Cannot update existing geojson data in ${Ce.source}`)):Ne(new Error(`Input data given to '${Ce.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},ye&&(this.loadGeoJSON=ye)}loadData(G,K){var ce;(ce=this._pendingRequest)===null||ce===void 0||ce.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const ye=!!(G&&G.request&&G.request.collectResourceTiming)&&new n.RequestPerformance(G.request);this._pendingCallback=K,this._pendingRequest=this.loadGeoJSON(G,(Ce,Ne)=>{if(delete this._pendingCallback,delete this._pendingRequest,Ce||!Ne)return K(Ce);if(typeof Ne!="object")return K(new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`));{D(Ne,!0);try{if(G.filter){const Pe=n.createExpression(G.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Pe.result==="error")throw new Error(Pe.value.map(X=>`${X.key}: ${X.message}`).join(", "));Ne={type:"FeatureCollection",features:Ne.features.filter(X=>Pe.value.evaluate({zoom:0},X))}}this._geoJSONIndex=G.cluster?new Je(function({superclusterOptions:Pe,clusterProperties:H}){if(!H||!Pe)return Pe;const X={},le={},ke={accumulated:null,zoom:0},Be={properties:null},bt=Object.keys(H);for(const dt of bt){const[Tt,qt]=H[dt],di=n.createExpression(qt),Yt=n.createExpression(typeof Tt=="string"?[Tt,["accumulated"],["get",dt]]:Tt);X[dt]=di.value,le[dt]=Yt.value}return Pe.map=dt=>{Be.properties=dt;const Tt={};for(const qt of bt)Tt[qt]=X[qt].evaluate(ke,Be);return Tt},Pe.reduce=(dt,Tt)=>{Be.properties=Tt;for(const qt of bt)ke.accumulated=dt[qt],dt[qt]=le[qt].evaluate(ke,Be)},Pe}(G)).load(Ne.features):function(Pe,H){return new or(Pe,H)}(Ne,G.geojsonVtOptions)}catch(Pe){return K(Pe)}this.loaded={};const Re={};if(ye){const Pe=ye.finish();Pe&&(Re.resourceTiming={},Re.resourceTiming[G.source]=JSON.parse(JSON.stringify(Pe)))}K(null,Re)}})}reloadTile(G,K){const ce=this.loaded;return ce&&ce[G.uid]?super.reloadTile(G,K):this.loadTile(G,K)}removeSource(G,K){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),K()}getClusterExpansionZoom(G,K){try{K(null,this._geoJSONIndex.getClusterExpansionZoom(G.clusterId))}catch(ce){K(ce)}}getClusterChildren(G,K){try{K(null,this._geoJSONIndex.getChildren(G.clusterId))}catch(ce){K(ce)}}getClusterLeaves(G,K){try{K(null,this._geoJSONIndex.getLeaves(G.clusterId,G.limit,G.offset))}catch(ce){K(ce)}}}class cn{constructor(G){this.self=G,this.actor=new n.Actor(G,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:z,geojson:pi},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(K,ce)=>{if(this.workerSourceTypes[K])throw new Error(`Worker source with name "${K}" already registered.`);this.workerSourceTypes[K]=ce},this.self.registerRTLTextPlugin=K=>{if(n.plugin.isParsed())throw new Error("RTL text plugin already registered.");n.plugin.applyArabicShaping=K.applyArabicShaping,n.plugin.processBidirectionalText=K.processBidirectionalText,n.plugin.processStyledBidirectionalText=K.processStyledBidirectionalText}}setReferrer(G,K){this.referrer=K}setImages(G,K,ce){this.availableImages[G]=K;for(const ye in this.workerSources[G]){const Ce=this.workerSources[G][ye];for(const Ne in Ce)Ce[Ne].availableImages=K}ce()}setLayers(G,K,ce){this.getLayerIndex(G).replace(K),ce()}updateLayers(G,K,ce){this.getLayerIndex(G).update(K.layers,K.removedIds),ce()}loadTile(G,K,ce){this.getWorkerSource(G,K.type,K.source).loadTile(K,ce)}loadDEMTile(G,K,ce){this.getDEMWorkerSource(G,K.source).loadTile(K,ce)}reloadTile(G,K,ce){this.getWorkerSource(G,K.type,K.source).reloadTile(K,ce)}abortTile(G,K,ce){this.getWorkerSource(G,K.type,K.source).abortTile(K,ce)}removeTile(G,K,ce){this.getWorkerSource(G,K.type,K.source).removeTile(K,ce)}removeDEMTile(G,K){this.getDEMWorkerSource(G,K.source).removeTile(K)}removeSource(G,K,ce){if(!this.workerSources[G]||!this.workerSources[G][K.type]||!this.workerSources[G][K.type][K.source])return;const ye=this.workerSources[G][K.type][K.source];delete this.workerSources[G][K.type][K.source],ye.removeSource!==void 0?ye.removeSource(K,ce):ce()}loadWorkerSource(G,K,ce){try{this.self.importScripts(K.url),ce()}catch(ye){ce(ye.toString())}}syncRTLPluginState(G,K,ce){try{n.plugin.setState(K);const ye=n.plugin.getPluginURL();if(n.plugin.isLoaded()&&!n.plugin.isParsed()&&ye!=null){this.self.importScripts(ye);const Ce=n.plugin.isParsed();ce(Ce?void 0:new Error(`RTL Text Plugin failed to import scripts from ${ye}`),Ce)}}catch(ye){ce(ye.toString())}}getAvailableImages(G){let K=this.availableImages[G];return K||(K=[]),K}getLayerIndex(G){let K=this.layerIndexes[G];return K||(K=this.layerIndexes[G]=new _),K}getWorkerSource(G,K,ce){if(this.workerSources[G]||(this.workerSources[G]={}),this.workerSources[G][K]||(this.workerSources[G][K]={}),!this.workerSources[G][K][ce]){const ye={send:(Ce,Ne,Re)=>{this.actor.send(Ce,Ne,Re,G)}};this.workerSources[G][K][ce]=new this.workerSourceTypes[K](ye,this.getLayerIndex(G),this.getAvailableImages(G))}return this.workerSources[G][K][ce]}getDEMWorkerSource(G,K){return this.demWorkerSources[G]||(this.demWorkerSources[G]={}),this.demWorkerSources[G][K]||(this.demWorkerSources[G][K]=new M),this.demWorkerSources[G][K]}}return n.isWorker()&&(self.worker=new cn(self)),cn}),f(["./shared"],function(n){var _="3.5.1";class v{static testProp(t){if(!v.docStyle)return t[0];for(let c=0;c{window.removeEventListener("click",v.suppressClickInternal,!0)},0)}static mousePos(t,c){const d=t.getBoundingClientRect();return new n.Point(c.clientX-d.left-t.clientLeft,c.clientY-d.top-t.clientTop)}static touchPos(t,c){const d=t.getBoundingClientRect(),g=[];for(let w=0;w{t=[],c=0,d=0,g={}},y.addThrottleControl=O=>{const U=d++;return g[U]=O,U},y.removeThrottleControl=O=>{delete g[O],A()},y.getImage=(O,U,V=!0)=>{S.supported&&(O.headers||(O.headers={}),O.headers.accept="image/webp,*/*");const J={requestParameters:O,supportImageRefresh:V,callback:U,cancelled:!1,completed:!1,cancel:()=>{J.completed||J.cancelled||(J.cancelled=!0,J.innerRequest&&(J.innerRequest.cancel(),c--),A())}};return t.push(J),A(),J};const w=O=>{const{requestParameters:U,supportImageRefresh:V,callback:J}=O;return n.extend(U,{type:"image"}),(V!==!1||n.isWorker()||n.getProtocolAction(U.url)||U.headers&&!Object.keys(U.headers).reduce((pe,fe)=>pe&&fe==="accept",!0)?n.makeRequest:L)(U,(pe,fe,we,ue)=>{k(O,J,pe,fe,we,ue)})},k=(O,U,V,J,pe,fe)=>{V?U(V):J instanceof HTMLImageElement||n.isImageBitmap(J)?U(null,J):J&&((we,ue)=>{typeof createImageBitmap=="function"?n.arrayBufferToImageBitmap(we,ue):n.arrayBufferToImage(we,ue)})(J,(we,ue)=>{we!=null?U(we):ue!=null&&U(null,ue,{cacheControl:pe,expires:fe})}),O.cancelled||(O.completed=!0,c--,A())},A=()=>{const O=(()=>{const U=Object.keys(g);let V=!1;if(U.length>0){for(const J of U)if(V=g[J](),V)break}return V})()?n.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:n.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let U=c;U0;U++){const V=t.shift();if(V.cancelled){U--;continue}const J=w(V);c++,V.innerRequest=J}},L=(O,U)=>{const V=new Image,J=O.url;let pe=!1;const fe=O.credentials;return fe&&fe==="include"?V.crossOrigin="use-credentials":(fe&&fe==="same-origin"||!n.sameOrigin(J))&&(V.crossOrigin="anonymous"),V.fetchPriority="high",V.onload=()=>{U(null,V),V.onerror=V.onload=null},V.onerror=()=>{pe||U(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.")),V.onerror=V.onload=null},V.src=J,{cancel:()=>{pe=!0,V.src=""}}}}(R||(R={})),R.resetRequestQueue(),function(y){y.Glyphs="Glyphs",y.Image="Image",y.Source="Source",y.SpriteImage="SpriteImage",y.SpriteJSON="SpriteJSON",y.Style="Style",y.Tile="Tile",y.Unknown="Unknown"}(D||(D={}));class F{constructor(t){this._transformRequestFn=t}transformRequest(t,c){return this._transformRequestFn&&this._transformRequestFn(t,c)||{url:t}}normalizeSpriteURL(t,c,d){const g=function(w){const k=w.match(j);if(!k)throw new Error(`Unable to parse URL "${w}"`);return{protocol:k[1],authority:k[2],path:k[3]||"/",params:k[4]?k[4].split("&"):[]}}(t);return g.path+=`${c}${d}`,function(w){const k=w.params.length?`?${w.params.join("&")}`:"";return`${w.protocol}://${w.authority}${w.path}${k}`}(g)}setTransformRequest(t){this._transformRequestFn=t}}const j=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ee(y){var t=new n.ARRAY_TYPE(3);return t[0]=y[0],t[1]=y[1],t[2]=y[2],t}var oe,se=function(y,t,c){return y[0]=t[0]-c[0],y[1]=t[1]-c[1],y[2]=t[2]-c[2],y};oe=new n.ARRAY_TYPE(3),n.ARRAY_TYPE!=Float32Array&&(oe[0]=0,oe[1]=0,oe[2]=0);var ne=function(y){var t=y[0],c=y[1];return t*t+c*c};function re(y){const t=[];if(typeof y=="string")t.push({id:"default",url:y});else if(y&&y.length>0){const c=[];for(const{id:d,url:g}of y){const w=`${d}${g}`;c.indexOf(w)===-1&&(c.push(w),t.push({id:d,url:g}))}}return t}function ve(y,t,c,d,g){if(d)return void y(d);if(g!==Object.values(t).length||g!==Object.values(c).length)return;const w={};for(const k in t){w[k]={};const A=n.browser.getImageCanvasContext(c[k]),L=t[k];for(const O in L){const{width:U,height:V,x:J,y:pe,sdf:fe,pixelRatio:we,stretchX:ue,stretchY:Oe,content:Xe}=L[O];w[k][O]={data:null,pixelRatio:we,sdf:fe,stretchX:ue,stretchY:Oe,content:Xe,spriteData:{width:U,height:V,x:J,y:pe,context:A}}}}y(null,w)}(function(){var y=new n.ARRAY_TYPE(2);n.ARRAY_TYPE!=Float32Array&&(y[0]=0,y[1]=0)})();class ze{constructor(t,c,d,g){this.context=t,this.format=d,this.texture=t.gl.createTexture(),this.update(c,g)}update(t,c,d){const{width:g,height:w}=t,k=!(this.size&&this.size[0]===g&&this.size[1]===w||d),{context:A}=this,{gl:L}=A;if(this.useMipmap=!!(c&&c.useMipmap),L.bindTexture(L.TEXTURE_2D,this.texture),A.pixelStoreUnpackFlipY.set(!1),A.pixelStoreUnpack.set(1),A.pixelStoreUnpackPremultiplyAlpha.set(this.format===L.RGBA&&(!c||c.premultiply!==!1)),k)this.size=[g,w],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||n.isImageBitmap(t)?L.texImage2D(L.TEXTURE_2D,0,this.format,this.format,L.UNSIGNED_BYTE,t):L.texImage2D(L.TEXTURE_2D,0,this.format,g,w,0,this.format,L.UNSIGNED_BYTE,t.data);else{const{x:O,y:U}=d||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||n.isImageBitmap(t)?L.texSubImage2D(L.TEXTURE_2D,0,O,U,L.RGBA,L.UNSIGNED_BYTE,t):L.texSubImage2D(L.TEXTURE_2D,0,O,U,g,w,L.RGBA,L.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&L.generateMipmap(L.TEXTURE_2D)}bind(t,c,d){const{context:g}=this,{gl:w}=g;w.bindTexture(w.TEXTURE_2D,this.texture),d!==w.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=w.LINEAR),t!==this.filter&&(w.texParameteri(w.TEXTURE_2D,w.TEXTURE_MAG_FILTER,t),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,d||t),this.filter=t),c!==this.wrap&&(w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,c),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,c),this.wrap=c)}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 nt(y){const{userImage:t}=y;return!!(t&&t.render&&t.render())&&(y.data.replace(new Uint8Array(t.data.buffer)),!0)}class be extends n.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new n.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:c,callback:d}of this.requestors)this._notify(c,d);this.requestors=[]}}getImage(t){const c=this.images[t];if(c&&!c.data&&c.spriteData){const d=c.spriteData;c.data=new n.RGBAImage({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),c.spriteData=null}return c}addImage(t,c){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,c)&&(this.images[t]=c)}_validate(t,c){let d=!0;const g=c.data||c.spriteData;return this._validateStretch(c.stretchX,g&&g.width)||(this.fire(new n.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),d=!1),this._validateStretch(c.stretchY,g&&g.height)||(this.fire(new n.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),d=!1),this._validateContent(c.content,c)||(this.fire(new n.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),d=!1),d}_validateStretch(t,c){if(!t)return!0;let d=0;for(const g of t){if(g[0]-1);L++,w[L]=A,k[L]=O,k[L+1]=Ke}for(let A=0,L=0;A{let A=this.entries[g];A||(A=this.entries[g]={glyphs:{},requests:{},ranges:{}});let L=A.glyphs[w];if(L!==void 0)return void k(null,{stack:g,id:w,glyph:L});if(L=this._tinySDF(A,g,w),L)return A.glyphs[w]=L,void k(null,{stack:g,id:w,glyph:L});const O=Math.floor(w/256);if(256*O>65535)return void k(new Error("glyphs > 65535 not supported"));if(A.ranges[O])return void k(null,{stack:g,id:w,glyph:L});if(!this.url)return void k(new Error("glyphsUrl is not set"));let U=A.requests[O];U||(U=A.requests[O]=[],Rt.loadGlyphRange(g,O,this.url,this.requestManager,(V,J)=>{if(J){for(const pe in J)this._doesCharSupportLocalGlyph(+pe)||(A.glyphs[+pe]=J[+pe]);A.ranges[O]=!0}for(const pe of U)pe(V,J);delete A.requests[O]})),U.push((V,J)=>{V?k(V):J&&k(null,{stack:g,id:w,glyph:J[w]||null})})},(g,w)=>{if(g)c(g);else if(w){const k={};for(const{stack:A,id:L,glyph:O}of w)(k[A]||(k[A]={}))[L]=O&&{id:O.id,bitmap:O.bitmap.clone(),metrics:O.metrics};c(null,k)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(n.unicodeBlockLookup["CJK Unified Ideographs"](t)||n.unicodeBlockLookup["Hangul Syllables"](t)||n.unicodeBlockLookup.Hiragana(t)||n.unicodeBlockLookup.Katakana(t))}_tinySDF(t,c,d){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let w=t.tinySDF;if(!w){let A="400";/bold/i.test(c)?A="900":/medium/i.test(c)?A="500":/light/i.test(c)&&(A="200"),w=t.tinySDF=new Rt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:A})}const k=w.draw(String.fromCharCode(d));return{id:d,bitmap:new n.AlphaImage({width:k.width||60,height:k.height||60},k.data),metrics:{width:k.glyphWidth/2||24,height:k.glyphHeight/2||24,left:k.glyphLeft/2+.5||0,top:k.glyphTop/2-27.5||-8,advance:k.glyphAdvance/2||24,isDoubleResolution:!0}}}}Rt.loadGlyphRange=function(y,t,c,d,g){const w=256*t,k=w+255,A=d.transformRequest(c.replace("{fontstack}",y).replace("{range}",`${w}-${k}`),D.Glyphs);n.getArrayBuffer(A,(L,O)=>{if(L)g(L);else if(O){const U={};for(const V of n.parseGlyphPbf(O))U[V.id]=V;g(null,U)}})},Rt.TinySDF=class{constructor({fontSize:y=24,buffer:t=3,radius:c=8,cutoff:d=.25,fontFamily:g="sans-serif",fontWeight:w="normal",fontStyle:k="normal"}={}){this.buffer=t,this.cutoff=d,this.radius=c;const A=this.size=y+4*t,L=this._createCanvas(A),O=this.ctx=L.getContext("2d",{willReadFrequently:!0});O.font=`${k} ${w} ${y}px ${g}`,O.textBaseline="alphabetic",O.textAlign="left",O.fillStyle="black",this.gridOuter=new Float64Array(A*A),this.gridInner=new Float64Array(A*A),this.f=new Float64Array(A),this.z=new Float64Array(A+1),this.v=new Uint16Array(A)}_createCanvas(y){const t=document.createElement("canvas");return t.width=t.height=y,t}draw(y){const{width:t,actualBoundingBoxAscent:c,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:w}=this.ctx.measureText(y),k=Math.ceil(c),A=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(w-g))),L=Math.min(this.size-this.buffer,k+Math.ceil(d)),O=A+2*this.buffer,U=L+2*this.buffer,V=Math.max(O*U,0),J=new Uint8ClampedArray(V),pe={data:J,width:O,height:U,glyphWidth:A,glyphHeight:L,glyphTop:k,glyphLeft:0,glyphAdvance:t};if(A===0||L===0)return pe;const{ctx:fe,buffer:we,gridInner:ue,gridOuter:Oe}=this;fe.clearRect(we,we,A,L),fe.fillText(y,we,we+k);const Xe=fe.getImageData(we,we,A,L);Oe.fill(Ke,0,V),ue.fill(0,0,V);for(let Te=0;Te0?ut*ut:0,ue[rt]=ut<0?ut*ut:0}}q(Oe,0,0,O,U,O,this.f,this.v,this.z),q(ue,we,we,A,L,O,this.f,this.v,this.z);for(let Te=0;Te1&&(L=t[++A]);const U=Math.abs(O-L.left),V=Math.abs(O-L.right),J=Math.min(U,V);let pe;const fe=w/d*(g+1);if(L.isDash){const we=g-Math.abs(fe);pe=Math.sqrt(J*J+we*we)}else pe=g-Math.sqrt(J*J+fe*fe);this.data[k+O]=Math.max(0,Math.min(255,pe+128))}}}addRegularDash(t){for(let A=t.length-1;A>=0;--A){const L=t[A],O=t[A+1];L.zeroLength?t.splice(A,1):O&&O.isDash===L.isDash&&(O.left=L.left,t.splice(A,1))}const c=t[0],d=t[t.length-1];c.isDash===d.isDash&&(c.left=d.left-this.width,d.right=c.right+this.width);const g=this.width*this.nextRow;let w=0,k=t[w];for(let A=0;A1&&(k=t[++w]);const L=Math.abs(A-k.left),O=Math.abs(A-k.right),U=Math.min(L,O);this.data[g+A]=Math.max(0,Math.min(255,(k.isDash?U:-U)+128))}}addDash(t,c){const d=c?7:0,g=2*d+1;if(this.nextRow+g>this.height)return n.warnOnce("LineAtlas out of space"),null;let w=0;for(let A=0;A{g.send(t,c,w)},d=d||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(c=>{c.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function xe(y,t,c){const d=function(g,w){if(g)return c(g);if(w){const k=n.pick(n.extend(w,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);w.vector_layers&&(k.vectorLayers=w.vector_layers,k.vectorLayerIds=k.vectorLayers.map(A=>A.id)),c(null,k)}};return y.url?n.getJSON(t.transformRequest(y.url,D.Source),d):n.browser.frame(()=>d(null,y))}ae.Actor=n.Actor;class Me{constructor(t,c){t&&(c?this.setSouthWest(t).setNorthEast(c):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 n.LngLat?new n.LngLat(t.lng,t.lat):n.LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof n.LngLat?new n.LngLat(t.lng,t.lat):n.LngLat.convert(t),this}extend(t){const c=this._sw,d=this._ne;let g,w;if(t instanceof n.LngLat)g=t,w=t;else{if(!(t instanceof Me))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Me.convert(t)):this.extend(n.LngLat.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(n.LngLat.convert(t)):this;if(g=t._sw,w=t._ne,!g||!w)return this}return c||d?(c.lng=Math.min(g.lng,c.lng),c.lat=Math.min(g.lat,c.lat),d.lng=Math.max(w.lng,d.lng),d.lat=Math.max(w.lat,d.lat)):(this._sw=new n.LngLat(g.lng,g.lat),this._ne=new n.LngLat(w.lng,w.lat)),this}getCenter(){return new n.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 n.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new n.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:c,lat:d}=n.LngLat.convert(t);let g=this._sw.lng<=c&&c<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=c&&c>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&g}static convert(t){return t instanceof Me?t:t&&new Me(t)}static fromLngLat(t,c=0){const d=360*c/40075017,g=d/Math.cos(Math.PI/180*t.lat);return new Me(new n.LngLat(t.lng-g,t.lat-d),new n.LngLat(t.lng+g,t.lat+d))}}class Y{constructor(t,c,d){this.bounds=Me.convert(this.validateBounds(t)),this.minzoom=c||0,this.maxzoom=d||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 c=Math.pow(2,t.z),d=Math.floor(n.mercatorXfromLng(this.bounds.getWest())*c),g=Math.floor(n.mercatorYfromLat(this.bounds.getNorth())*c),w=Math.ceil(n.mercatorXfromLng(this.bounds.getEast())*c),k=Math.ceil(n.mercatorYfromLat(this.bounds.getSouth())*c);return t.x>=d&&t.x=g&&t.y{this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=xe(this._options,this.map._requestManager,(w,k)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),w?this.fire(new n.ErrorEvent(w)):k&&(n.extend(this,k),k.bounds&&(this.tileBounds=new Y(k.bounds,this.minzoom,this.maxzoom)),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})))})},this.serialize=()=>n.extend({},this._options),this.id=t,this.dispatcher=d,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,n.extend(this,n.pick(c,["url","scheme","tileSize","promoteId"])),this._options=n.extend({type:"vector"},c),this._collectResourceTiming=c.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(g)}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)}loadTile(t,c){const d=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g={request:this.map._requestManager.transformRequest(d,D.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 w(k,A){return delete t.request,t.aborted?c(null):k&&k.status!==404?c(k):(A&&A.resourceTiming&&(t.resourceTiming=A.resourceTiming),this.map._refreshExpiredTiles&&A&&t.setExpiryData(A),t.loadVectorData(A,this.map.painter),c(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}g.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=c:t.request=t.actor.send("reloadTile",g,w.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",g,w.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 Je extends n.Evented{constructor(t,c,d,g){super(),this.id=t,this.dispatcher=d,this.setEventedParent(g),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=n.extend({type:"raster"},c),n.extend(this,n.pick(c,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=xe(this._options,this.map._requestManager,(t,c)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new n.ErrorEvent(t)):c&&(n.extend(this,c),c.bounds&&(this.tileBounds=new Y(c.bounds,this.minzoom,this.maxzoom)),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new n.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)}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}serialize(){return n.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,c){const d=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=R.getImage(this.map._requestManager.transformRequest(d,D.Tile),(g,w,k)=>{if(delete t.request,t.aborted)t.state="unloaded",c(null);else if(g)t.state="errored",c(g);else if(w){this.map._refreshExpiredTiles&&k&&t.setExpiryData(k);const A=this.map.painter.context,L=A.gl;t.texture=this.map.painter.getTileTexture(w.width),t.texture?t.texture.update(w,{useMipmap:!0}):(t.texture=new ze(A,w,L.RGBA,{useMipmap:!0}),t.texture.bind(L.LINEAR,L.CLAMP_TO_EDGE,L.LINEAR_MIPMAP_NEAREST),A.extTextureFilterAnisotropic&&L.texParameterf(L.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax)),t.state="loaded",c(null)}},this.map._refreshExpiredTiles)}abortTile(t,c){t.request&&(t.request.cancel(),delete t.request),c()}unloadTile(t,c){t.texture&&this.map.painter.saveTileTexture(t.texture),c()}hasTransition(){return!1}}class kt extends Je{constructor(t,c,d,g){super(t,c,d,g),this.type="raster-dem",this.maxzoom=22,this._options=n.extend({type:"raster-dem"},c),this.encoding=c.encoding||"mapbox",this.redFactor=c.redFactor,this.greenFactor=c.greenFactor,this.blueFactor=c.blueFactor,this.baseShift=c.baseShift}loadTile(t,c){const d=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g=this.map._requestManager.transformRequest(d,D.Tile);function w(k,A){k&&(t.state="errored",c(k)),A&&(t.dem=A,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",c(null))}t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.request=R.getImage(g,(k,A,L)=>n.__awaiter(this,void 0,void 0,function*(){if(delete t.request,t.aborted)t.state="unloaded",c(null);else if(k)t.state="errored",c(k);else if(A){this.map._refreshExpiredTiles&&t.setExpiryData(L);const O=n.isImageBitmap(A)&&n.offscreenCanvasSupported()?A:yield function(V){return n.__awaiter(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&n.isOffscreenCanvasDistorted()){const J=V.width+2,pe=V.height+2;try{return new n.RGBAImage({width:J,height:pe},yield n.readImageUsingVideoFrame(V,-1,-1,J,pe))}catch{}}return n.browser.getImageData(V,1)})}(A),U={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:O,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",U,w))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(t){const c=t.canonical,d=Math.pow(2,c.z),g=(c.x-1+d)%d,w=c.x===0?t.wrap-1:t.wrap,k=(c.x+1+d)%d,A=c.x+1===d?t.wrap+1:t.wrap,L={};return L[new n.OverscaledTileID(t.overscaledZ,w,c.z,g,c.y).key]={backfilled:!1},L[new n.OverscaledTileID(t.overscaledZ,A,c.z,k,c.y).key]={backfilled:!1},c.y>0&&(L[new n.OverscaledTileID(t.overscaledZ,w,c.z,g,c.y-1).key]={backfilled:!1},L[new n.OverscaledTileID(t.overscaledZ,t.wrap,c.z,c.x,c.y-1).key]={backfilled:!1},L[new n.OverscaledTileID(t.overscaledZ,A,c.z,k,c.y-1).key]={backfilled:!1}),c.y+1{this._updateWorkerData()},this.serialize=()=>n.extend({},this._options,{type:this.type,data:this._data}),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=d.getActor(),this.setEventedParent(g),this._data=c.data,this._options=n.extend({},c),this._collectResourceTiming=c.collectResourceTiming,c.maxzoom!==void 0&&(this.maxzoom=c.maxzoom),c.type&&(this.type=c.type),c.attribution&&(this.attribution=c.attribution),this.promoteId=c.promoteId;const w=n.EXTENT/this.tileSize;this.workerOptions=n.extend({source:this.id,cluster:c.cluster||!1,geojsonVtOptions:{buffer:(c.buffer!==void 0?c.buffer:128)*w,tolerance:(c.tolerance!==void 0?c.tolerance:.375)*w,extent:n.EXTENT,maxZoom:this.maxzoom,lineMetrics:c.lineMetrics||!1,generateId:c.generateId||!1},superclusterOptions:{maxZoom:c.clusterMaxZoom!==void 0?c.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,c.clusterMinPoints||2),extent:n.EXTENT,radius:(c.clusterRadius||50)*w,log:!1,generateId:c.generateId||!1},clusterProperties:c.clusterProperties,filter:c.filter},c.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,c){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},c),this}getClusterChildren(t,c){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},c),this}getClusterLeaves(t,c,d,g){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:c,offset:d},g),this}_updateWorkerData(t){const c=n.extend({},this.workerOptions);t?c.dataDiff=t:typeof this._data=="string"?(c.request=this.map._requestManager.transformRequest(n.browser.resolveURL(this._data),D.Source),c.request.collectResourceTiming=this._collectResourceTiming):c.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new n.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,c,(d,g)=>{if(this._pendingLoads--,this._removed||g&&g.abandoned)return void this.fire(new n.Event("dataabort",{dataType:"source"}));let w=null;if(g&&g.resourceTiming&&g.resourceTiming[this.id]&&(w=g.resourceTiming[this.id].slice(0)),d)return void this.fire(new n.ErrorEvent(d));const k={dataType:"source"};this._collectResourceTiming&&w&&w.length>0&&n.extend(k,{resourceTiming:w}),this.fire(new n.Event("data",Object.assign(Object.assign({},k),{sourceDataType:"metadata"}))),this.fire(new n.Event("data",Object.assign(Object.assign({},k),{sourceDataType:"content"})))})}loaded(){return this._pendingLoads===0}loadTile(t,c){const d=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const g={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(d,g,(w,k)=>(delete t.request,t.unloadVectorData(),t.aborted?c(null):w?c(w):(t.loadVectorData(k,this.map.painter,d==="reloadTile"),c(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})}hasTransition(){return!1}}var Ct=n.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Bt extends n.Evented{constructor(t,c,d,g){super(),this.load=(w,k)=>{this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=R.getImage(this.map._requestManager.transformRequest(this.url,D.Image),(A,L)=>{this._request=null,this._loaded=!0,A?this.fire(new n.ErrorEvent(A)):L&&(this.image=L,w&&(this.coordinates=w),k&&k(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const w=this.map.painter.context,k=w.gl;this.boundsBuffer||(this.boundsBuffer=w.createVertexBuffer(this._boundsArray,Ct.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new ze(w,this.image,k.RGBA),this.texture.bind(k.LINEAR,k.CLAMP_TO_EDGE));let A=!1;for(const L in this.tiles){const O=this.tiles[L];O.state!=="loaded"&&(O.state="loaded",O.texture=this.texture,A=!0)}A&&this.fire(new n.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=t,this.dispatcher=d,this.coordinates=c.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=c}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 n.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 c=t.map(n.MercatorCoordinate.fromLngLat);this.tileID=function(g){let w=1/0,k=1/0,A=-1/0,L=-1/0;for(const J of g)w=Math.min(w,J.x),k=Math.min(k,J.y),A=Math.max(A,J.x),L=Math.max(L,J.y);const O=Math.max(A-w,L-k),U=Math.max(0,Math.floor(-Math.log(O)/Math.LN2)),V=Math.pow(2,U);return new n.CanonicalTileID(U,Math.floor((w+A)/2*V),Math.floor((k+L)/2*V))}(c),this.minzoom=this.maxzoom=this.tileID.z;const d=c.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new n.RasterBoundsArray,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,n.EXTENT,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,n.EXTENT),this._boundsArray.emplaceBack(d[2].x,d[2].y,n.EXTENT,n.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,c){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},c(null)):(t.state="errored",c(null))}hasTransition(){return!1}}class fi extends Bt{constructor(t,c,d,g){super(t,c,d,g),this.load=()=>{this._loaded=!1;const w=this.options;this.urls=[];for(const k of w.urls)this.urls.push(this.map._requestManager.transformRequest(k,D.Source).url);n.getVideo(this.urls,(k,A)=>{this._loaded=!0,k?this.fire(new n.ErrorEvent(k)):A&&(this.video=A,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const w=this.map.painter.context,k=w.gl;this.boundsBuffer||(this.boundsBuffer=w.createVertexBuffer(this._boundsArray,Ct.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(k.LINEAR,k.CLAMP_TO_EDGE),k.texSubImage2D(k.TEXTURE_2D,0,0,0,k.RGBA,k.UNSIGNED_BYTE,this.video)):(this.texture=new ze(w,this.video,k.RGBA),this.texture.bind(k.LINEAR,k.CLAMP_TO_EDGE));let A=!1;for(const L in this.tiles){const O=this.tiles[L];O.state!=="loaded"&&(O.state="loaded",O.texture=this.texture,A=!0)}A&&this.fire(new n.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=c}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const c=this.video.seekable;tc.end(0)?this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${c.start(0)} and ${c.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)))}hasTransition(){return this.video&&!this.video.paused}}class pt extends Bt{constructor(t,c,d,g){super(t,c,d,g),this.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 n.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())},this.prepare=()=>{let w=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,w=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,w=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const k=this.map.painter.context,A=k.gl;this.boundsBuffer||(this.boundsBuffer=k.createVertexBuffer(this._boundsArray,Ct.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(w||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new ze(k,this.canvas,A.RGBA,{premultiply:!0});let L=!1;for(const O in this.tiles){const U=this.tiles[O];U.state!=="loaded"&&(U.state="loaded",U.texture=this.texture,L=!0)}L&&this.fire(new n.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),c.coordinates?Array.isArray(c.coordinates)&&c.coordinates.length===4&&!c.coordinates.some(w=>!Array.isArray(w)||w.length!==2||w.some(k=>typeof k!="number"))||this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),c.animate&&typeof c.animate!="boolean"&&this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),c.canvas?typeof c.canvas=="string"||c.canvas instanceof HTMLCanvasElement||this.fire(new n.ErrorEvent(new n.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 n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=c,this.animate=c.animate===void 0||c.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}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 _i={},Z=y=>{switch(y){case"geojson":return vt;case"image":return Bt;case"raster":return Je;case"raster-dem":return kt;case"vector":return he;case"video":return fi;case"canvas":return pt}return _i[y]};function lt(y,t){const c=n.create();return n.translate(c,c,[1,1,0]),n.scale(c,c,[.5*y.width,.5*y.height,1]),n.multiply(c,c,y.calculatePosMatrix(t.toUnwrapped()))}function et(y,t,c,d,g,w){const k=function(V,J,pe){if(V)for(const fe of V){const we=J[fe];if(we&&we.source===pe&&we.type==="fill-extrusion")return!0}else for(const fe in J){const we=J[fe];if(we.source===pe&&we.type==="fill-extrusion")return!0}return!1}(g&&g.layers,t,y.id),A=w.maxPitchScaleFactor(),L=y.tilesIn(d,A,k);L.sort(Se);const O=[];for(const V of L)O.push({wrappedTileID:V.tileID.wrapped().key,queryResults:V.tile.queryRenderedFeatures(t,c,y._state,V.queryGeometry,V.cameraQueryGeometry,V.scale,g,w,A,lt(y.transform,V.tileID))});const U=function(V){const J={},pe={};for(const fe of V){const we=fe.queryResults,ue=fe.wrappedTileID,Oe=pe[ue]=pe[ue]||{};for(const Xe in we){const Te=we[Xe],Ue=Oe[Xe]=Oe[Xe]||{},it=J[Xe]=J[Xe]||[];for(const rt of Te)Ue[rt.featureIndex]||(Ue[rt.featureIndex]=!0,it.push(rt))}}return J}(O);for(const V in U)U[V].forEach(J=>{const pe=J.feature,fe=y.getFeatureState(pe.layer["source-layer"],pe.id);pe.source=pe.layer.source,pe.layer["source-layer"]&&(pe.sourceLayer=pe.layer["source-layer"]),pe.state=fe});return U}function Se(y,t){const c=y.tileID,d=t.tileID;return c.overscaledZ-d.overscaledZ||c.canonical.y-d.canonical.y||c.wrap-d.wrap||c.canonical.x-d.canonical.x}class ge{constructor(t,c){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=n.uniqueId(),this.uses=0,this.tileSize=c,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 c=t+this.timeAdded;cw.getLayer(O)).filter(Boolean);if(L.length!==0){A.layers=L,A.stateDependentLayerIds&&(A.stateDependentLayers=A.stateDependentLayerIds.map(O=>L.filter(U=>U.id===O)[0]));for(const O of L)k[O.id]=A}}return k}(t.buckets,c.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const w=this.buckets[g];if(w instanceof n.SymbolBucket){if(this.hasSymbolBuckets=!0,!d)break;w.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const w=this.buckets[g];if(w instanceof n.SymbolBucket&&w.hasRTLText){this.hasRTLText=!0,n.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const g in this.buckets){const w=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,c.style.getLayer(g).queryRadius(w))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new n.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 d in this.buckets){const g=this.buckets[d];g.uploadPending()&&g.upload(t)}const c=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new ze(t,this.imageAtlas.image,c.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new ze(t,this.glyphAtlasImage,c.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,c,d,g,w,k,A,L,O,U){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:w,scale:k,tileSize:this.tileSize,pixelPosMatrix:U,transform:L,params:A,queryPadding:this.queryPadding*O},t,c,d):{}}querySourceFeatures(t,c){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const g=d.loadVTLayers(),w=c&&c.sourceLayer?c.sourceLayer:"",k=g._geojsonTileLayer||g[w];if(!k)return;const A=n.createFilter(c&&c.filter),{z:L,x:O,y:U}=this.tileID.canonical,V={z:L,x:O,y:U};for(let J=0;Jd)g=!1;else if(c)if(this.expirationTime{this.remove(t,w)},d)),this.data[g].push(w),this.order.push(g),this.order.length>this.max){const k=this._getAndRemoveByKey(this.order[0]);k&&this.onRemove(k)}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 c=this.data[t].shift();return c.timeout&&clearTimeout(c.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),c.value}getByKey(t){const c=this.data[t];return c?c[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,c){if(!this.has(t))return this;const d=t.wrapped().key,g=c===void 0?0:this.data[d].indexOf(c),w=this.data[d][g];return this.data[d].splice(g,1),w.timeout&&clearTimeout(w.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(w.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const c=this._getAndRemoveByKey(this.order[0]);c&&this.onRemove(c)}return this}filter(t){const c=[];for(const d in this.data)for(const g of this.data[d])t(g.value)||c.push(g);for(const d of c)this.remove(d.value.tileID,d)}}class ft{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,c,d){const g=String(c);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][g]=this.stateChanges[t][g]||{},n.extend(this.stateChanges[t][g],d),this.deletedStates[t]===null){this.deletedStates[t]={};for(const w in this.state[t])w!==g&&(this.deletedStates[t][w]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][g]===null){this.deletedStates[t][g]={};for(const w in this.state[t][g])d[w]||(this.deletedStates[t][g][w]=null)}else for(const w in d)this.deletedStates[t]&&this.deletedStates[t][g]&&this.deletedStates[t][g][w]===null&&delete this.deletedStates[t][g][w]}removeFeatureState(t,c,d){if(this.deletedStates[t]===null)return;const g=String(c);if(this.deletedStates[t]=this.deletedStates[t]||{},d&&c!==void 0)this.deletedStates[t][g]!==null&&(this.deletedStates[t][g]=this.deletedStates[t][g]||{},this.deletedStates[t][g][d]=null);else if(c!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][g])for(d in this.deletedStates[t][g]={},this.stateChanges[t][g])this.deletedStates[t][g][d]=null;else this.deletedStates[t][g]=null;else this.deletedStates[t]=null}getState(t,c){const d=String(c),g=n.extend({},(this.state[t]||{})[d],(this.stateChanges[t]||{})[d]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const w=this.deletedStates[t][c];if(w===null)return{};for(const k in w)delete g[k]}return g}initializeTileState(t,c){t.setFeatureState(this.state,c)}coalesceChanges(t,c){const d={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const w={};for(const k in this.stateChanges[g])this.state[g][k]||(this.state[g][k]={}),n.extend(this.state[g][k],this.stateChanges[g][k]),w[k]=this.state[g][k];d[g]=w}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const w={};if(this.deletedStates[g]===null)for(const k in this.state[g])w[k]={},this.state[g][k]={};else for(const k in this.deletedStates[g]){if(this.deletedStates[g][k]===null)this.state[g][k]={};else for(const A of Object.keys(this.deletedStates[g][k]))delete this.state[g][k][A];w[k]=this.state[g][k]}d[g]=d[g]||{},n.extend(d[g],w)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const g in t)t[g].setFeatureState(d,c)}}class Ie extends n.Evented{constructor(t,c,d){super(),this.id=t,this.dispatcher=d,this.on("data",g=>{g.dataType==="source"&&g.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&g.dataType==="source"&&g.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=((g,w,k,A)=>{const L=new(Z(w.type))(g,w,k,A);if(L.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${L.id}`);return L})(t,c,d,this),this._tiles={},this._cache=new $e(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ft,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 c=this._tiles[t];if(c.state!=="loaded"&&c.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,c){return this._source.loadTile(t,c)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new n.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 c in this._tiles){const d=this._tiles[c];d.upload(t),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(We).map(t=>t.key)}getRenderableIds(t){const c=[];for(const d in this._tiles)this._isIdRenderable(d,t)&&c.push(this._tiles[d]);return t?c.sort((d,g)=>{const w=d.tileID,k=g.tileID,A=new n.Point(w.canonical.x,w.canonical.y)._rotate(this.transform.angle),L=new n.Point(k.canonical.x,k.canonical.y)._rotate(this.transform.angle);return w.overscaledZ-k.overscaledZ||L.y-A.y||L.x-A.x}).map(d=>d.tileID.key):c.map(d=>d.tileID).sort(We).map(d=>d.key)}hasRenderableParent(t){const c=this.findLoadedParent(t,0);return!!c&&this._isIdRenderable(c.tileID.key)}_isIdRenderable(t,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(c||!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,c){const d=this._tiles[t];d&&(d.state!=="loading"&&(d.state=c),this._loadTile(d,this._tileLoaded.bind(this,d,t,c)))}_tileLoaded(t,c,d,g){if(g)return t.state="errored",void(g.status!==404?this._source.fire(new n.ErrorEvent(g,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=n.browser.now(),d==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(c,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 n.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const c=this.getRenderableIds();for(let g=0;g1||(Math.abs(k)>1&&(Math.abs(k+L)===1?k+=L:Math.abs(k-L)===1&&(k-=L)),w.dem&&g.dem&&(g.dem.backfillBorder(w.dem,k,A),g.neighboringTiles&&g.neighboringTiles[O]&&(g.neighboringTiles[O].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,c,d,g){for(const w in this._tiles){let k=this._tiles[w];if(g[w]||!k.hasData()||k.tileID.overscaledZ<=c||k.tileID.overscaledZ>d)continue;let A=k.tileID;for(;k&&k.tileID.overscaledZ>c+1;){const O=k.tileID.scaledTo(k.tileID.overscaledZ-1);k=this._tiles[O.key],k&&k.hasData()&&(A=O)}let L=A;for(;L.overscaledZ>c;)if(L=L.scaledTo(L.overscaledZ-1),t[L.key]){g[A.key]=A;break}}}findLoadedParent(t,c){if(t.key in this._loadedParentTiles){const d=this._loadedParentTiles[t.key];return d&&d.tileID.overscaledZ>=c?d:null}for(let d=t.overscaledZ-1;d>=c;d--){const g=t.scaledTo(d),w=this._getLoadedTile(g);if(w)return w}}_getLoadedTile(t){const c=this._tiles[t.key];return c&&c.hasData()?c:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const c=Math.ceil(t.width/this._source.tileSize)+1,d=Math.ceil(t.height/this._source.tileSize)+1,g=Math.floor(c*d*(this._maxTileCacheZoomLevels===null?n.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),w=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(w)}handleWrapJump(t){const c=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,c){const d={};for(const g in this._tiles){const w=this._tiles[g];w.tileID=w.tileID.unwrapTo(w.tileID.wrap+c),d[w.tileID.key]=w}this._tiles=d;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(t,c){if(this.transform=t,this.terrain=c,!this._sourceLoaded||this._paused)return;let d;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(U=>new n.OverscaledTileID(U.canonical.z,U.wrap,U.canonical.z,U.canonical.x,U.canonical.y)):(d=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:c}),this._source.hasTile&&(d=d.filter(U=>this._source.hasTile(U)))):d=[];const g=t.coveringZoomLevel(this._source),w=Math.max(g-Ie.maxOverzooming,this._source.minzoom),k=Math.max(g+Ie.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const U={};for(const V of d)if(V.canonical.z>this._source.minzoom){const J=V.scaledTo(V.canonical.z-1);U[J.key]=J;const pe=V.scaledTo(Math.max(this._source.minzoom,Math.min(V.canonical.z,5)));U[pe.key]=pe}d=d.concat(Object.values(U))}const A=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,A&&this.fire(new n.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const L=this._updateRetainedTiles(d,g);if(wt(this._source.type)){const U={},V={},J=Object.keys(L),pe=n.browser.now();for(const fe of J){const we=L[fe],ue=this._tiles[fe];if(!ue||ue.fadeEndTime!==0&&ue.fadeEndTime<=pe)continue;const Oe=this.findLoadedParent(we,w);Oe&&(this._addTile(Oe.tileID),U[Oe.tileID.key]=Oe.tileID),V[fe]=we}this._retainLoadedChildren(V,g,k,L);for(const fe in U)L[fe]||(this._coveredTiles[fe]=!0,L[fe]=U[fe]);if(c){const fe={},we={};for(const ue of d)this._tiles[ue.key].hasData()?fe[ue.key]=ue:we[ue.key]=ue;for(const ue in we){const Oe=we[ue].children(this._source.maxzoom);this._tiles[Oe[0].key]&&this._tiles[Oe[1].key]&&this._tiles[Oe[2].key]&&this._tiles[Oe[3].key]&&(fe[Oe[0].key]=L[Oe[0].key]=Oe[0],fe[Oe[1].key]=L[Oe[1].key]=Oe[1],fe[Oe[2].key]=L[Oe[2].key]=Oe[2],fe[Oe[3].key]=L[Oe[3].key]=Oe[3],delete we[ue])}for(const ue in we){const Oe=this.findLoadedParent(we[ue],this._source.minzoom);if(Oe){fe[Oe.tileID.key]=L[Oe.tileID.key]=Oe.tileID;for(const Xe in fe)fe[Xe].isChildOf(Oe.tileID)&&delete fe[Xe]}}for(const ue in this._tiles)fe[ue]||(this._coveredTiles[ue]=!0)}}for(const U in L)this._tiles[U].clearFadeHold();const O=n.keysDifference(this._tiles,L);for(const U of O){const V=this._tiles[U];V.hasSymbolBuckets&&!V.holdingForFade()?V.setHoldDuration(this.map._fadeDuration):V.hasSymbolBuckets&&!V.symbolFadeFinished()||this._removeTile(U)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,c){const d={},g={},w=Math.max(c-Ie.maxOverzooming,this._source.minzoom),k=Math.max(c+Ie.maxUnderzooming,this._source.minzoom),A={};for(const L of t){const O=this._addTile(L);d[L.key]=L,O.hasData()||cthis._source.maxzoom){const V=L.children(this._source.maxzoom)[0],J=this.getTile(V);if(J&&J.hasData()){d[V.key]=V;continue}}else{const V=L.children(this._source.maxzoom);if(d[V[0].key]&&d[V[1].key]&&d[V[2].key]&&d[V[3].key])continue}let U=O.wasRequested();for(let V=L.overscaledZ-1;V>=w;--V){const J=L.scaledTo(V);if(g[J.key])break;if(g[J.key]=!0,O=this.getTile(J),!O&&U&&(O=this._addTile(J)),O){const pe=O.hasData();if((U||pe)&&(d[J.key]=J),U=O.wasRequested(),pe)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const c=[];let d,g=this._tiles[t].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){d=this._loadedParentTiles[g.key];break}c.push(g.key);const w=g.scaledTo(g.overscaledZ-1);if(d=this._getLoadedTile(w),d)break;g=w}for(const w of c)this._loadedParentTiles[w]=d}}_addTile(t){let c=this._tiles[t.key];if(c)return c;c=this._cache.getAndRemove(t),c&&(this._setTileReloadTimer(t.key,c),c.tileID=t,this._state.initializeTileState(c,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,c)));const d=c;return c||(c=new ge(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(c,this._tileLoaded.bind(this,c,t.key,c.state))),c.uses++,this._tiles[t.key]=c,d||this._source.fire(new n.Event("dataloading",{tile:c,coord:c.tileID,dataType:"source"})),c}_setTileReloadTimer(t,c){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const d=c.getExpiryTimeout();d&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},d))}_removeTile(t){const c=this._tiles[t];c&&(c.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),c.uses>0||(c.hasData()&&c.state!=="reloading"?this._cache.add(c.tileID,c,c.getExpiryTimeout()):(c.aborted=!0,this._abortTile(c),this._unloadTile(c))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,c,d){const g=[],w=this.transform;if(!w)return g;const k=d?w.getCameraQueryGeometry(t):t,A=t.map(fe=>w.pointCoordinate(fe,this.terrain)),L=k.map(fe=>w.pointCoordinate(fe,this.terrain)),O=this.getIds();let U=1/0,V=1/0,J=-1/0,pe=-1/0;for(const fe of L)U=Math.min(U,fe.x),V=Math.min(V,fe.y),J=Math.max(J,fe.x),pe=Math.max(pe,fe.y);for(let fe=0;fe=0&&Te[1].y+Xe>=0){const Ue=A.map(rt=>ue.getTilePoint(rt)),it=L.map(rt=>ue.getTilePoint(rt));g.push({tile:we,tileID:ue,queryGeometry:Ue,cameraQueryGeometry:it,scale:Oe})}}return g}getVisibleCoordinates(t){const c=this.getRenderableIds(t).map(d=>this._tiles[d].tileID);for(const d of c)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return c}hasTransition(){if(this._source.hasTransition())return!0;if(wt(this._source.type)){const t=n.browser.now();for(const c in this._tiles)if(this._tiles[c].fadeEndTime>=t)return!0}return!1}setFeatureState(t,c,d){this._state.updateState(t=t||"_geojsonTileLayer",c,d)}removeFeatureState(t,c,d){this._state.removeFeatureState(t=t||"_geojsonTileLayer",c,d)}getFeatureState(t,c){return this._state.getState(t=t||"_geojsonTileLayer",c)}setDependencies(t,c,d){const g=this._tiles[t];g&&g.setDependencies(c,d)}reloadTilesForDependencies(t,c){for(const d in this._tiles)this._tiles[d].hasDependency(t,c)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(t,c))}}function We(y,t){const c=Math.abs(2*y.wrap)-+(y.wrap<0),d=Math.abs(2*t.wrap)-+(t.wrap<0);return y.overscaledZ-t.overscaledZ||d-c||t.canonical.y-y.canonical.y||t.canonical.x-y.canonical.x}function wt(y){return y==="raster"||y==="image"||y==="video"}Ie.maxOverzooming=10,Ie.maxUnderzooming=3;const Et="mapboxgl_preloaded_worker_pool";class ct{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{c.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Et]}numActive(){return Object.keys(this.active).length}}const Xt=Math.floor(n.browser.hardwareConcurrency/2);let Ii;function ki(){return Ii||(Ii=new ct),Ii}ct.workerCount=n.isSafari(globalThis)?Math.max(Math.min(Xt,3),1):1;class Wi{constructor(t,c){this.reset(t,c)}reset(t,c){this.points=t||[],this._distances=[0];for(let d=1;d0?(g-k)/A:0;return this.points[w].mult(1-L).add(this.points[c].mult(L))}}function ar(y,t){let c=!0;return y==="always"||y!=="never"&&t!=="never"||(c=!1),c}class dr{constructor(t,c,d){const g=this.boxCells=[],w=this.circleCells=[];this.xCellCount=Math.ceil(t/d),this.yCellCount=Math.ceil(c/d);for(let k=0;kthis.width||g<0||c>this.height)return[];const L=[];if(t<=0&&c<=0&&this.width<=d&&this.height<=g){if(w)return[{key:null,x1:t,y1:c,x2:d,y2:g}];for(let O=0;O0}hitTestCircle(t,c,d,g,w){const k=t-d,A=t+d,L=c-d,O=c+d;if(A<0||k>this.width||O<0||L>this.height)return!1;const U=[];return this._forEachCell(k,L,A,O,this._queryCellCircle,U,{hitTest:!0,overlapMode:g,circle:{x:t,y:c,radius:d},seenUids:{box:{},circle:{}}},w),U.length>0}_queryCell(t,c,d,g,w,k,A,L){const{seenUids:O,hitTest:U,overlapMode:V}=A,J=this.boxCells[w];if(J!==null){const fe=this.bboxes;for(const we of J)if(!O.box[we]){O.box[we]=!0;const ue=4*we,Oe=this.boxKeys[we];if(t<=fe[ue+2]&&c<=fe[ue+3]&&d>=fe[ue+0]&&g>=fe[ue+1]&&(!L||L(Oe))&&(!U||!ar(V,Oe.overlapMode))&&(k.push({key:Oe,x1:fe[ue],y1:fe[ue+1],x2:fe[ue+2],y2:fe[ue+3]}),U))return!0}}const pe=this.circleCells[w];if(pe!==null){const fe=this.circles;for(const we of pe)if(!O.circle[we]){O.circle[we]=!0;const ue=3*we,Oe=this.circleKeys[we];if(this._circleAndRectCollide(fe[ue],fe[ue+1],fe[ue+2],t,c,d,g)&&(!L||L(Oe))&&(!U||!ar(V,Oe.overlapMode))){const Xe=fe[ue],Te=fe[ue+1],Ue=fe[ue+2];if(k.push({key:Oe,x1:Xe-Ue,y1:Te-Ue,x2:Xe+Ue,y2:Te+Ue}),U)return!0}}}return!1}_queryCellCircle(t,c,d,g,w,k,A,L){const{circle:O,seenUids:U,overlapMode:V}=A,J=this.boxCells[w];if(J!==null){const fe=this.bboxes;for(const we of J)if(!U.box[we]){U.box[we]=!0;const ue=4*we,Oe=this.boxKeys[we];if(this._circleAndRectCollide(O.x,O.y,O.radius,fe[ue+0],fe[ue+1],fe[ue+2],fe[ue+3])&&(!L||L(Oe))&&!ar(V,Oe.overlapMode))return k.push(!0),!0}}const pe=this.circleCells[w];if(pe!==null){const fe=this.circles;for(const we of pe)if(!U.circle[we]){U.circle[we]=!0;const ue=3*we,Oe=this.circleKeys[we];if(this._circlesCollide(fe[ue],fe[ue+1],fe[ue+2],O.x,O.y,O.radius)&&(!L||L(Oe))&&!ar(V,Oe.overlapMode))return k.push(!0),!0}}}_forEachCell(t,c,d,g,w,k,A,L){const O=this._convertToXCellCoord(t),U=this._convertToYCellCoord(c),V=this._convertToXCellCoord(d),J=this._convertToYCellCoord(g);for(let pe=O;pe<=V;pe++)for(let fe=U;fe<=J;fe++)if(w.call(this,t,c,d,g,this.xCellCount*fe+pe,k,A,L))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,c,d,g,w,k){const A=g-t,L=w-c,O=d+k;return O*O>A*A+L*L}_circleAndRectCollide(t,c,d,g,w,k,A){const L=(k-g)/2,O=Math.abs(t-(g+L));if(O>L+d)return!1;const U=(A-w)/2,V=Math.abs(c-(w+U));if(V>U+d)return!1;if(O<=L||V<=U)return!0;const J=O-L,pe=V-U;return J*J+pe*pe<=d*d}}function Gr(y,t,c,d,g){const w=n.create();return t?(n.scale(w,w,[1/g,1/g,1]),c||n.rotateZ(w,w,d.angle)):n.multiply(w,d.labelPlaneMatrix,y),w}function mt(y,t,c,d,g){if(t){const w=n.clone(y);return n.scale(w,w,[g,g,1]),c||n.rotateZ(w,w,-d.angle),w}return d.glCoordMatrix}function Ji(y,t,c){let d;c?(d=[y.x,y.y,c(y.x,y.y),1],n.transformMat4(d,d,t)):(d=[y.x,y.y,0,1],ce(d,d,t));const g=d[3];return{point:new n.Point(d[0]/g,d[1]/g),signedDistanceFromCamera:g}}function wr(y,t){return .5+y/t*.5}function xr(y,t){const c=y[0]/y[3],d=y[1]/y[3];return c>=-t[0]&&c<=t[0]&&d>=-t[1]&&d<=t[1]}function or(y,t,c,d,g,w,k,A,L,O){const U=d?y.textSizeData:y.iconSizeData,V=n.evaluateSizeForZoom(U,c.transform.zoom),J=[256/c.width*2+1,256/c.height*2+1],pe=d?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;pe.clear();const fe=y.lineVertexArray,we=d?y.text.placedSymbolArray:y.icon.placedSymbolArray,ue=c.transform.width/c.transform.height;let Oe=!1;for(let Xe=0;XeMath.abs(c.x-t.x)*d?{useVertical:!0}:(y===n.WritingMode.vertical?t.yc.x)?{needsFlipping:!0}:null}function bi(y,t,c,d,g,w,k,A,L,O,U,V,J,pe,fe,we){const ue=t/24,Oe=y.lineOffsetX*ue,Xe=y.lineOffsetY*ue;let Te;if(y.numGlyphs>1){const Ue=y.glyphStartIndex+y.numGlyphs,it=y.lineStartIndex,rt=y.lineStartIndex+y.lineLength,ut=Pt(ue,A,Oe,Xe,c,U,V,y,L,w,J,fe,we);if(!ut)return{notEnoughRoom:!0};const xt=Ji(ut.first.point,k,we).point,yt=Ji(ut.last.point,k,we).point;if(d&&!c){const It=vi(y.writingMode,xt,yt,pe);if(It)return It}Te=[ut.first];for(let It=y.glyphStartIndex+1;It0?xt.point:Sr(V,ut,it,1,g,we),It=vi(y.writingMode,it,yt,pe);if(It)return It}const Ue=_e(ue*A.getoffsetX(y.glyphStartIndex),Oe,Xe,c,U,V,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,L,w,J,fe,we);if(!Ue)return{notEnoughRoom:!0};Te=[Ue]}for(const Ue of Te)n.addDynamicAttributes(O,Ue.point,Ue.angle);return{}}function Sr(y,t,c,d,g,w){const k=Ji(y.add(y.sub(t)._unit()),g,w).point,A=c.sub(k);return c.add(A._mult(d/A.mag()))}function Vr(y,t){const{projectionCache:c,lineVertexArray:d,labelPlaneMatrix:g,tileAnchorPoint:w,distanceFromAnchor:k,getElevation:A,previousVertex:L,direction:O,absOffsetX:U}=t;if(c.projections[y])return c.projections[y];const V=new n.Point(d.getx(y),d.gety(y)),J=Ji(V,g,A);if(J.signedDistanceFromCamera>0)return c.projections[y]=J.point,J.point;const pe=y-O;return Sr(k===0?w:new n.Point(d.getx(pe),d.gety(pe)),V,L,U-k+1,g,A)}function pi(y,t,c){return y._unit()._perp()._mult(t*c)}function cn(y,t,c,d,g,w,k,A){const{projectionCache:L,direction:O}=A;if(L.offsets[y])return L.offsets[y];const U=c.add(t);if(y+O=g)return L.offsets[y]=U,U;const V=Vr(y+O,A),J=pi(V.sub(c),k,O),pe=c.add(J),fe=V.add(J);return L.offsets[y]=n.findLineIntersection(w,U,pe,fe)||U,L.offsets[y]}function _e(y,t,c,d,g,w,k,A,L,O,U,V,J,pe){const fe=d?y-t:y+t;let we=fe>0?1:-1,ue=0;d&&(we*=-1,ue=Math.PI),we<0&&(ue+=Math.PI);let Oe,Xe,Te=we>0?A+k:A+k+1,Ue=g,it=g,rt=0,ut=0;const xt=Math.abs(fe),yt=[];let It;for(;rt+ut<=xt;){if(Te+=we,Te=L)return null;rt+=ut,it=Ue,Xe=Oe;const Dt={projectionCache:V,lineVertexArray:O,labelPlaneMatrix:U,tileAnchorPoint:w,distanceFromAnchor:rt,getElevation:pe,previousVertex:it,direction:we,absOffsetX:xt};if(Ue=Vr(Te,Dt),c===0)yt.push(it),It=Ue.sub(it);else{let ui;const Kt=Ue.sub(it);ui=Kt.mag()===0?pi(Vr(Te+we,Dt).sub(Ue),c,we):pi(Kt,c,we),Xe||(Xe=it.add(ui)),Oe=cn(Te,ui,Ue,A,L,Xe,c,Dt),yt.push(Xe),It=Oe.sub(Xe)}ut=It.mag()}const Gt=It._mult((xt-rt)/ut)._add(Xe||it),Mi=ue+Math.atan2(Ue.y-it.y,Ue.x-it.x);return yt.push(Gt),{point:Gt,angle:J?Mi:0,path:yt}}const G=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function K(y,t){for(let c=0;c=1;Ei--)Kt.push(Dt.path[Ei]);for(let Ei=1;EiJi(Di,L,fe));Kt=Ei.some(Di=>Di.signedDistanceFromCamera<=0)?[]:Ei.map(Di=>Di.point)}let xi=[];if(Kt.length>0){const Ei=Kt[0].clone(),Di=Kt[0].clone();for(let gr=1;gr=It.x&&Di.x<=Gt.x&&Ei.y>=It.y&&Di.y<=Gt.y?[Kt]:Di.xGt.x||Di.yGt.y?[]:n.clipLine([Kt],It.x,It.y,Gt.x,Gt.y)}for(const Ei of xi){Mi.reset(Ei,.25*yt);let Di=0;Di=Mi.length<=.5*yt?1:Math.ceil(Mi.paddedLength/rr)+1;for(let gr=0;gr=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(t,c,d,g){return d>=0&&t=0&&cd.collisionGroupID===c}}return this.collisionGroups[t]}}function Be(y,t,c,d,g){const{horizontalAlign:w,verticalAlign:k}=n.getAnchorAlignment(y);return new n.Point(-(w-.5)*t+d[0]*g,-(k-.5)*c+d[1]*g)}function bt(y,t,c,d,g,w){const{x1:k,x2:A,y1:L,y2:O,anchorPointX:U,anchorPointY:V}=y,J=new n.Point(t,c);return d&&J._rotate(g?w:-w),{x1:k+J.x,y1:L+J.y,x2:A+J.x,y2:O+J.y,anchorPointX:U,anchorPointY:V}}class dt{constructor(t,c,d,g,w){this.transform=t.clone(),this.terrain=c,this.collisionIndex=new Ce(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new ke(g),this.collisionCircleArrays={},this.prevPlacement=w,w&&(w.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,c,d,g){const w=d.getBucket(c),k=d.latestFeatureIndex;if(!w||!k||c.id!==w.layerIds[0])return;const A=d.collisionBoxArray,L=w.layers[0].layout,O=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),U=d.tileSize/n.EXTENT,V=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),J=L.get("text-pitch-alignment")==="map",pe=L.get("text-rotation-alignment")==="map",fe=Ne(d,1,this.transform.zoom),we=Gr(V,J,pe,this.transform,fe);let ue=null;if(J){const Xe=mt(V,J,pe,this.transform,fe);ue=n.multiply([],this.transform.labelPlaneMatrix,Xe)}this.retainedQueryData[w.bucketInstanceId]=new le(w.bucketInstanceId,k,w.sourceLayerIndex,w.index,d.tileID);const Oe={bucket:w,layout:L,posMatrix:V,textLabelPlaneMatrix:we,labelToScreenMatrix:ue,scale:O,textPixelRatio:U,holdingForFade:d.holdingForFade(),collisionBoxArray:A,partiallyEvaluatedTextSize:n.evaluateSizeForZoom(w.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(w.sourceID)};if(g)for(const Xe of w.sortKeyRanges){const{sortKey:Te,symbolInstanceStart:Ue,symbolInstanceEnd:it}=Xe;t.push({sortKey:Te,symbolInstanceStart:Ue,symbolInstanceEnd:it,parameters:Oe})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:w.symbolInstances.length,parameters:Oe})}attemptAnchorPlacement(t,c,d,g,w,k,A,L,O,U,V,J,pe,fe,we,ue){const Oe=n.TextAnchorEnum[t.textAnchor],Xe=[t.textOffset0,t.textOffset1],Te=Be(Oe,d,g,Xe,w),Ue=this.collisionIndex.placeCollisionBox(bt(c,Te.x,Te.y,k,A,this.transform.angle),V,L,O,U.predicate,ue);if((!we||this.collisionIndex.placeCollisionBox(bt(we,Te.x,Te.y,k,A,this.transform.angle),V,L,O,U.predicate,ue).box.length!==0)&&Ue.box.length>0){let it;if(this.prevPlacement&&this.prevPlacement.variableOffsets[J.crossTileID]&&this.prevPlacement.placements[J.crossTileID]&&this.prevPlacement.placements[J.crossTileID].text&&(it=this.prevPlacement.variableOffsets[J.crossTileID].anchor),J.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[J.crossTileID]={textOffset:Xe,width:d,height:g,anchor:Oe,textBoxScale:w,prevAnchor:it},this.markUsedJustification(pe,Oe,J,fe),pe.allowVerticalPlacement&&(this.markUsedOrientation(pe,fe,J),this.placedOrientations[J.crossTileID]=fe),{shift:Te,placedGlyphBoxes:Ue}}}placeLayerBucketPart(t,c,d){const{bucket:g,layout:w,posMatrix:k,textLabelPlaneMatrix:A,labelToScreenMatrix:L,textPixelRatio:O,holdingForFade:U,collisionBoxArray:V,partiallyEvaluatedTextSize:J,collisionGroup:pe}=t.parameters,fe=w.get("text-optional"),we=w.get("icon-optional"),ue=n.getOverlapMode(w,"text-overlap","text-allow-overlap"),Oe=ue==="always",Xe=n.getOverlapMode(w,"icon-overlap","icon-allow-overlap"),Te=Xe==="always",Ue=w.get("text-rotation-alignment")==="map",it=w.get("text-pitch-alignment")==="map",rt=w.get("icon-text-fit")!=="none",ut=w.get("symbol-z-order")==="viewport-y",xt=Oe&&(Te||!g.hasIconData()||we),yt=Te&&(Oe||!g.hasTextData()||fe);!g.collisionArrays&&V&&g.deserializeCollisionBoxes(V);const It=this.retainedQueryData[g.bucketInstanceId].tileID,Gt=this.terrain?(Dt,ui)=>this.terrain.getElevation(It,Dt,ui):null,Mi=(Dt,ui)=>{var Kt,rr;if(c[Dt.crossTileID])return;if(U)return void(this.placements[Dt.crossTileID]=new H(!1,!1,!1));let xi=!1,Ei=!1,Di=!0,gr=null,Xi={box:null,offscreen:null},Bn={box:null,offscreen:null},fr=null,cr=null,kn=null,Jn=0,nr=0,Es=0;ui.textFeatureIndex?Jn=ui.textFeatureIndex:Dt.useRuntimeCollisionCircles&&(Jn=Dt.featureIndex),ui.verticalTextFeatureIndex&&(nr=ui.verticalTextFeatureIndex);const ks=ui.textBox;if(ks){const tn=_r=>{let yr=n.WritingMode.horizontal;if(g.allowVerticalPlacement&&!_r&&this.prevPlacement){const Tn=this.prevPlacement.placedOrientations[Dt.crossTileID];Tn&&(this.placedOrientations[Dt.crossTileID]=Tn,yr=Tn,this.markUsedOrientation(g,yr,Dt))}return yr},jr=(_r,yr)=>{if(g.allowVerticalPlacement&&Dt.numVerticalGlyphVertices>0&&ui.verticalTextBox){for(const Tn of g.writingModes)if(Tn===n.WritingMode.vertical?(Xi=yr(),Bn=Xi):Xi=_r(),Xi&&Xi.box&&Xi.box.length)break}else Xi=_r()},Wr=Dt.textAnchorOffsetStartIndex,Fa=Dt.textAnchorOffsetEndIndex;if(Fa===Wr){const _r=(yr,Tn)=>{const vr=this.collisionIndex.placeCollisionBox(yr,ue,O,k,pe.predicate,Gt);return vr&&vr.box&&vr.box.length&&(this.markUsedOrientation(g,Tn,Dt),this.placedOrientations[Dt.crossTileID]=Tn),vr};jr(()=>_r(ks,n.WritingMode.horizontal),()=>{const yr=ui.verticalTextBox;return g.allowVerticalPlacement&&Dt.numVerticalGlyphVertices>0&&yr?_r(yr,n.WritingMode.vertical):{box:null,offscreen:null}}),tn(Xi&&Xi.box&&Xi.box.length)}else{let _r=n.TextAnchorEnum[(rr=(Kt=this.prevPlacement)===null||Kt===void 0?void 0:Kt.variableOffsets[Dt.crossTileID])===null||rr===void 0?void 0:rr.anchor];const yr=(vr,Po,Ns)=>{const zo=vr.x2-vr.x1,cu=vr.y2-vr.y1,uu=Dt.textBoxScale,Ih=rt&&Xe==="never"?Po:null;let Ts={box:[],offscreen:!1},aa=ue==="never"?1:2,Us="never";_r&&aa++;for(let Yn=0;Ynyr(ks,ui.iconBox,n.WritingMode.horizontal),()=>{const vr=ui.verticalTextBox;return g.allowVerticalPlacement&&!(Xi&&Xi.box&&Xi.box.length)&&Dt.numVerticalGlyphVertices>0&&vr?yr(vr,ui.verticalIconBox,n.WritingMode.vertical):{box:null,offscreen:null}}),Xi&&(xi=Xi.box,Di=Xi.offscreen);const Tn=tn(Xi&&Xi.box);if(!xi&&this.prevPlacement){const vr=this.prevPlacement.variableOffsets[Dt.crossTileID];vr&&(this.variableOffsets[Dt.crossTileID]=vr,this.markUsedJustification(g,vr.anchor,Dt,Tn))}}}if(fr=Xi,xi=fr&&fr.box&&fr.box.length>0,Di=fr&&fr.offscreen,Dt.useRuntimeCollisionCircles){const tn=g.text.placedSymbolArray.get(Dt.centerJustifiedTextSymbolIndex),jr=n.evaluateSizeForFeature(g.textSizeData,J,tn),Wr=w.get("text-padding");cr=this.collisionIndex.placeCollisionCircles(ue,tn,g.lineVertexArray,g.glyphOffsetArray,jr,k,A,L,d,it,pe.predicate,Dt.collisionCircleDiameter,Wr,Gt),cr.circles.length&&cr.collisionDetected&&!d&&n.warnOnce("Collisions detected, but collision boxes are not shown"),xi=Oe||cr.circles.length>0&&!cr.collisionDetected,Di=Di&&cr.offscreen}if(ui.iconFeatureIndex&&(Es=ui.iconFeatureIndex),ui.iconBox){const tn=jr=>{const Wr=rt&&gr?bt(jr,gr.x,gr.y,Ue,it,this.transform.angle):jr;return this.collisionIndex.placeCollisionBox(Wr,Xe,O,k,pe.predicate,Gt)};Bn&&Bn.box&&Bn.box.length&&ui.verticalIconBox?(kn=tn(ui.verticalIconBox),Ei=kn.box.length>0):(kn=tn(ui.iconBox),Ei=kn.box.length>0),Di=Di&&kn.offscreen}const ls=fe||Dt.numHorizontalGlyphVertices===0&&Dt.numVerticalGlyphVertices===0,Fs=we||Dt.numIconVertices===0;if(ls||Fs?Fs?ls||(Ei=Ei&&xi):xi=Ei&&xi:Ei=xi=Ei&&xi,xi&&fr&&fr.box&&this.collisionIndex.insertCollisionBox(fr.box,ue,w.get("text-ignore-placement"),g.bucketInstanceId,Bn&&Bn.box&&nr?nr:Jn,pe.ID),Ei&&kn&&this.collisionIndex.insertCollisionBox(kn.box,Xe,w.get("icon-ignore-placement"),g.bucketInstanceId,Es,pe.ID),cr&&(xi&&this.collisionIndex.insertCollisionCircles(cr.circles,ue,w.get("text-ignore-placement"),g.bucketInstanceId,Jn,pe.ID),d)){const tn=g.bucketInstanceId;let jr=this.collisionCircleArrays[tn];jr===void 0&&(jr=this.collisionCircleArrays[tn]=new X);for(let Wr=0;Wr=0;--ui){const Kt=Dt[ui];Mi(g.symbolInstances.get(Kt),g.collisionArrays[Kt])}}else for(let Dt=t.symbolInstanceStart;Dt=0&&(t.text.placedSymbolArray.get(A).crossTileID=w>=0&&A!==w?0:d.crossTileID)}markUsedOrientation(t,c,d){const g=c===n.WritingMode.horizontal||c===n.WritingMode.horizontalOnly?c:0,w=c===n.WritingMode.vertical?c:0,k=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const A of k)t.text.placedSymbolArray.get(A).placedOrientation=g;d.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=w)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const c=this.prevPlacement;let d=!1;this.prevZoomAdjustment=c?c.zoomAdjustment(this.transform.zoom):0;const g=c?c.symbolFadeChange(t):1,w=c?c.opacities:{},k=c?c.variableOffsets:{},A=c?c.placedOrientations:{};for(const L in this.placements){const O=this.placements[L],U=w[L];U?(this.opacities[L]=new Pe(U,g,O.text,O.icon),d=d||O.text!==U.text.placed||O.icon!==U.icon.placed):(this.opacities[L]=new Pe(null,g,O.text,O.icon,O.skipFade),d=d||O.text||O.icon)}for(const L in w){const O=w[L];if(!this.opacities[L]){const U=new Pe(O,g,!1,!1);U.isHidden()||(this.opacities[L]=U,d=d||O.text.placed||O.icon.placed)}}for(const L in k)this.variableOffsets[L]||!this.opacities[L]||this.opacities[L].isHidden()||(this.variableOffsets[L]=k[L]);for(const L in A)this.placedOrientations[L]||!this.opacities[L]||this.opacities[L].isHidden()||(this.placedOrientations[L]=A[L]);if(c&&c.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=c?c.lastPlacementChangeTime:t)}updateLayerOpacities(t,c){const d={};for(const g of c){const w=g.getBucket(t);w&&g.latestFeatureIndex&&t.id===w.layerIds[0]&&this.updateBucketOpacities(w,d,g.collisionBoxArray)}}updateBucketOpacities(t,c,d){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 g=t.layers[0],w=g.layout,k=new Pe(null,0,!1,!1,!0),A=w.get("text-allow-overlap"),L=w.get("icon-allow-overlap"),O=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),U=w.get("text-rotation-alignment")==="map",V=w.get("text-pitch-alignment")==="map",J=w.get("icon-text-fit")!=="none",pe=new Pe(null,0,A&&(L||!t.hasIconData()||w.get("icon-optional")),L&&(A||!t.hasTextData()||w.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const fe=(we,ue,Oe)=>{for(let Xe=0;Xe0,rt=this.placedOrientations[ue.crossTileID],ut=rt===n.WritingMode.vertical,xt=rt===n.WritingMode.horizontal||rt===n.WritingMode.horizontalOnly;if(Oe>0||Xe>0){const yt=Pi(Ue.text);fe(t.text,Oe,ut?Si:yt),fe(t.text,Xe,xt?Si:yt);const It=Ue.text.isHidden();[ue.rightJustifiedTextSymbolIndex,ue.centerJustifiedTextSymbolIndex,ue.leftJustifiedTextSymbolIndex].forEach(Dt=>{Dt>=0&&(t.text.placedSymbolArray.get(Dt).hidden=It||ut?1:0)}),ue.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(ue.verticalPlacedTextSymbolIndex).hidden=It||xt?1:0);const Gt=this.variableOffsets[ue.crossTileID];Gt&&this.markUsedJustification(t,Gt.anchor,ue,rt);const Mi=this.placedOrientations[ue.crossTileID];Mi&&(this.markUsedJustification(t,"left",ue,Mi),this.markUsedOrientation(t,Mi,ue))}if(it){const yt=Pi(Ue.icon),It=!(J&&ue.verticalPlacedIconSymbolIndex&&ut);ue.placedIconSymbolIndex>=0&&(fe(t.icon,ue.numIconVertices,It?yt:Si),t.icon.placedSymbolArray.get(ue.placedIconSymbolIndex).hidden=Ue.icon.isHidden()),ue.verticalPlacedIconSymbolIndex>=0&&(fe(t.icon,ue.numVerticalIconVertices,It?Si:yt),t.icon.placedSymbolArray.get(ue.verticalPlacedIconSymbolIndex).hidden=Ue.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const yt=t.collisionArrays[we];if(yt){let It=new n.Point(0,0);if(yt.textBox||yt.verticalTextBox){let Mi=!0;if(O){const Dt=this.variableOffsets[Te];Dt?(It=Be(Dt.anchor,Dt.width,Dt.height,Dt.textOffset,Dt.textBoxScale),U&&It._rotate(V?this.transform.angle:-this.transform.angle)):Mi=!1}yt.textBox&&Tt(t.textCollisionBox.collisionVertexArray,Ue.text.placed,!Mi||ut,It.x,It.y),yt.verticalTextBox&&Tt(t.textCollisionBox.collisionVertexArray,Ue.text.placed,!Mi||xt,It.x,It.y)}const Gt=!!(!xt&&yt.verticalIconBox);yt.iconBox&&Tt(t.iconCollisionBox.collisionVertexArray,Ue.icon.placed,Gt,J?It.x:0,J?It.y:0),yt.verticalIconBox&&Tt(t.iconCollisionBox.collisionVertexArray,Ue.icon.placed,!Gt,J?It.x:0,J?It.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 we=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=we.invProjMatrix,t.placementViewportMatrix=we.viewportMatrix,t.collisionCircleArray=we.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 Tt(y,t,c,d,g){y.emplaceBack(t?1:0,c?1:0,d||0,g||0),y.emplaceBack(t?1:0,c?1:0,d||0,g||0),y.emplaceBack(t?1:0,c?1:0,d||0,g||0),y.emplaceBack(t?1:0,c?1:0,d||0,g||0)}const qt=Math.pow(2,25),di=Math.pow(2,24),Yt=Math.pow(2,17),ni=Math.pow(2,16),li=Math.pow(2,9),ai=Math.pow(2,8),gi=Math.pow(2,1);function Pi(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const t=y.placed?1:0,c=Math.floor(127*y.opacity);return c*qt+t*di+c*Yt+t*ni+c*li+t*ai+c*gi+t}const Si=0;class $r{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,c,d,g,w){const k=this._bucketParts;for(;this._currentTileIndexA.sortKey-L.sortKey));this._currentPartIndex!this._forceFullPlacement&&n.browser.now()-g>2;for(;this._currentPlacementIndex>=0;){const k=c[t[this._currentPlacementIndex]],A=this.placement.collisionIndex.transform.zoom;if(k.type==="symbol"&&(!k.minzoom||k.minzoom<=A)&&(!k.maxzoom||k.maxzoom>A)){if(this._inProgressLayer||(this._inProgressLayer=new $r(k)),this._inProgressLayer.continuePlacement(d[k.source],this.placement,this._showCollisionBoxes,k,w))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const pr=512/n.EXTENT/2;class rs{constructor(t,c,d){this.tileID=t,this.bucketInstanceId=d,this._symbolsByKey={};const g=new Map;for(let w=0;w({x:Math.floor(L.anchorX*pr),y:Math.floor(L.anchorY*pr)})),crossTileIDs:k.map(L=>L.crossTileID)};if(A.positions.length>128){const L=new n.KDBush(A.positions.length,16,Uint16Array);for(const{x:O,y:U}of A.positions)L.add(O,U);L.finish(),delete A.positions,A.index=L}this._symbolsByKey[w]=A}}getScaledCoordinates(t,c){const{x:d,y:g,z:w}=this.tileID.canonical,{x:k,y:A,z:L}=c.canonical,O=pr/Math.pow(2,L-w),U=(A*n.EXTENT+t.anchorY)*O,V=g*n.EXTENT*pr;return{x:Math.floor((k*n.EXTENT+t.anchorX)*O-d*n.EXTENT*pr),y:Math.floor(U-V)}}findMatches(t,c,d){const g=this.tileID.canonical.zt)}}class ns{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ai{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const c=Math.round((t-this.lng)/360);if(c!==0)for(const d in this.indexes){const g=this.indexes[d],w={};for(const k in g){const A=g[k];A.tileID=A.tileID.unwrapTo(A.tileID.wrap+c),w[A.tileID.key]=A}this.indexes[d]=w}this.lng=t}addBucket(t,c,d){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===c.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let w=0;wt.overscaledZ)for(const A in k){const L=k[A];L.tileID.isChildOf(t)&&L.findMatches(c.symbolInstances,t,g)}else{const A=k[t.scaledTo(Number(w)).key];A&&A.findMatches(c.symbolInstances,t,g)}}for(let w=0;w{c[d]=!0});for(const d in this.layerIndexes)c[d]||delete this.layerIndexes[d]}}const un=(y,t)=>n.emitValidationErrors(y,t&&t.filter(c=>c.identifier!=="source.canvas")),lr=n.pick(n.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Mr=n.pick(n.operations,["setCenter","setZoom","setBearing","setPitch"]),to=n.emptyStyle();class Er extends n.Evented{constructor(t,c={}){super(),this.map=t,this.dispatcher=new ae(ki(),this,t._getMapId()),this.imageManager=new be,this.imageManager.setEventedParent(this),this.glyphManager=new Rt(t._requestManager,c.localIdeographFontFamily),this.lineAtlas=new st(256,512),this.crossTileSymbolIndex=new Jr,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new n.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",n.getReferrer());const d=this;this._rtlTextPluginCallback=Er.registerForPluginStateChange(g=>{d.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:g.pluginStatus,pluginURL:g.pluginURL},(w,k)=>{if(n.triggerPluginCompletionEvent(w),k&&k.every(A=>A))for(const A in d.sourceCaches){const L=d.sourceCaches[A].getSource().type;L!=="vector"&&L!=="geojson"||d.sourceCaches[A].reload()}})}),this.on("data",g=>{if(g.dataType!=="source"||g.sourceDataType!=="metadata")return;const w=this.sourceCaches[g.sourceId];if(!w)return;const k=w.getSource();if(k&&k.vectorLayerIds)for(const A in this._layers){const L=this._layers[A];L.source===k.id&&this._validateLayer(L)}})}loadURL(t,c={},d){this.fire(new n.Event("dataloading",{dataType:"style"})),c.validate=typeof c.validate!="boolean"||c.validate;const g=this.map._requestManager.transformRequest(t,D.Style);this._request=n.getJSON(g,(w,k)=>{this._request=null,w?this.fire(new n.ErrorEvent(w)):k&&this._load(k,c,d)})}loadJSON(t,c={},d){this.fire(new n.Event("dataloading",{dataType:"style"})),this._request=n.browser.frame(()=>{this._request=null,c.validate=c.validate!==!1,this._load(t,c,d)})}loadEmpty(){this.fire(new n.Event("dataloading",{dataType:"style"})),this._load(to,{validate:!1})}_load(t,c,d){var g;const w=c.transformStyle?c.transformStyle(d,t):t;if(!c.validate||!un(this,n.validateStyle(w))){this._loaded=!0,this.stylesheet=w;for(const k in w.sources)this.addSource(k,w.sources[k],{validate:!1});w.sprite?this._loadSprite(w.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(w.glyphs),this._createLayers(),this.light=new ot(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new n.Event("data",{dataType:"style"})),this.fire(new n.Event("style.load"))}}_createLayers(){const t=n.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(c=>c.id),this._layers={},this._serializedLayers=null;for(const c of t){const d=n.createStyleLayer(c);d.setEventedParent(this,{layer:{id:c.id}}),this._layers[c.id]=d}}_loadSprite(t,c=!1,d=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(g,w,k,A){const L=re(g),O=L.length,U=k>1?"@2x":"",V={},J={},pe={};for(const{id:fe,url:we}of L){const ue=w.transformRequest(w.normalizeSpriteURL(we,U,".json"),D.SpriteJSON),Oe=`${fe}_${ue.url}`;V[Oe]=n.getJSON(ue,(Ue,it)=>{delete V[Oe],J[fe]=it,ve(A,J,pe,Ue,O)});const Xe=w.transformRequest(w.normalizeSpriteURL(we,U,".png"),D.SpriteImage),Te=`${fe}_${Xe.url}`;V[Te]=R.getImage(Xe,(Ue,it)=>{delete V[Te],pe[fe]=it,ve(A,J,pe,Ue,O)})}return{cancel(){for(const fe of Object.values(V))fe.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(g,w)=>{if(this._spriteRequest=null,g)this.fire(new n.ErrorEvent(g));else if(w)for(const k in w){this._spritesImagesIds[k]=[];const A=this._spritesImagesIds[k]?this._spritesImagesIds[k].filter(L=>!(L in w)):[];for(const L of A)this.imageManager.removeImage(L),this._changedImages[L]=!0;for(const L in w[k]){const O=k==="default"?L:`${k}:${L}`;this._spritesImagesIds[k].push(O),O in this.imageManager.images?this.imageManager.updateImage(O,w[k][L],!1):this.imageManager.addImage(O,w[k][L]),c&&(this._changedImages[O]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),c&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new n.Event("data",{dataType:"style"})),d&&d(g)})}_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 n.Event("data",{dataType:"style"}))}_validateLayer(t){const c=this.sourceCaches[t.source];if(!c)return;const d=t.sourceLayer;if(!d)return;const g=c.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(d)===-1)&&this.fire(new n.ErrorEvent(new Error(`Source layer "${d}" does not exist on source "${g.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 c=this._serializedAllLayers();if(!t||t.length===0)return Object.values(c);const d=[];for(const g of t)c[g]&&d.push(c[g]);return d}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const c=Object.keys(this._layers);for(const d of c){const g=this._layers[d];g.type!=="custom"&&(t[d]=g.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 c=this._changed;if(this._changed){const g=Object.keys(this._updatedLayers),w=Object.keys(this._removedLayers);(g.length||w.length)&&this._updateWorkerLayers(g,w);for(const k in this._updatedSources){const A=this._updatedSources[k];if(A==="reload")this._reloadSource(k);else{if(A!=="clear")throw new Error(`Invalid action ${A}`);this._clearSource(k)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const k in this._updatedPaintProps)this._layers[k].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const d={};for(const g in this.sourceCaches){const w=this.sourceCaches[g];d[g]=w.used,w.used=!1}for(const g of this._order){const w=this._layers[g];w.recalculate(t,this._availableImages),!w.isHidden(t.zoom)&&w.source&&(this.sourceCaches[w.source].used=!0)}for(const g in d){const w=this.sourceCaches[g];d[g]!==w.used&&w.fire(new n.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(t),this.z=t.zoom,c&&this.fire(new n.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const c in this.sourceCaches)this.sourceCaches[c].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,c){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:c})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,c={}){this._checkLoaded();const d=this.serialize();if(t=c.transformStyle?c.transformStyle(d,t):t,un(this,n.validateStyle(t)))return!1;(t=n.clone$1(t)).layers=n.derefLayers(t.layers);const g=n.diffStyles(d,t).filter(k=>!(k.command in Mr));if(g.length===0)return!1;const w=g.filter(k=>!(k.command in lr));if(w.length>0)throw new Error(`Unimplemented: ${w.map(k=>k.command).join(", ")}.`);for(const k of g)k.command!=="setTransition"&&this[k.command].apply(this,k.args);return this.stylesheet=t,this._serializedLayers=null,!0}addImage(t,c){if(this.getImage(t))return this.fire(new n.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,c),this._afterImageUpdated(t)}updateImage(t,c){this.imageManager.updateImage(t,c)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new n.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 n.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,c,d={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!c.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(c).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(c.type)>=0&&this._validate(n.validateStyle.source,`sources.${t}`,c,null,d))return;this.map&&this.map._collectResourceTiming&&(c.collectResourceTiming=!0);const g=this.sourceCaches[t]=new Ie(t,c,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:t})),g.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 d in this._layers)if(this._layers[d].source===t)return this.fire(new n.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));const c=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],c.fire(new n.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),c.setEventedParent(null),c.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,c){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const d=this.sourceCaches[t].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(c),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,c,d={}){this._checkLoaded();const g=t.id;if(this.getLayer(g))return void this.fire(new n.ErrorEvent(new Error(`Layer "${g}" already exists on this map.`)));let w;if(t.type==="custom"){if(un(this,n.validateCustomStyleLayer(t)))return;w=n.createStyleLayer(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(g,t.source),t=n.clone$1(t),t=n.extend(t,{source:g})),this._validate(n.validateStyle.layer,`layers.${g}`,t,{arrayIndex:-1},d))return;w=n.createStyleLayer(t),this._validateLayer(w),w.setEventedParent(this,{layer:{id:g}})}const k=c?this._order.indexOf(c):this._order.length;if(c&&k===-1)this.fire(new n.ErrorEvent(new Error(`Cannot add layer "${g}" before non-existing layer "${c}".`)));else{if(this._order.splice(k,0,g),this._layerOrderChanged=!0,this._layers[g]=w,this._removedLayers[g]&&w.source&&w.type!=="custom"){const A=this._removedLayers[g];delete this._removedLayers[g],A.type!==w.type?this._updatedSources[w.source]="clear":(this._updatedSources[w.source]="reload",this.sourceCaches[w.source].pause())}this._updateLayer(w),w.onAdd&&w.onAdd(this.map)}}moveLayer(t,c){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new n.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===c)return;const d=this._order.indexOf(t);this._order.splice(d,1);const g=c?this._order.indexOf(c):this._order.length;c&&g===-1?this.fire(new n.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${c}".`))):(this._order.splice(g,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const c=this._layers[t];if(!c)return void this.fire(new n.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));c.setEventedParent(null);const d=this._order.indexOf(t);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=c,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],c.onRemove&&c.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,c,d){this._checkLoaded();const g=this.getLayer(t);g?g.minzoom===c&&g.maxzoom===d||(c!=null&&(g.minzoom=c),d!=null&&(g.maxzoom=d),this._updateLayer(g)):this.fire(new n.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,c,d={}){this._checkLoaded();const g=this.getLayer(t);if(g){if(!n.deepEqual(g.filter,c))return c==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(n.validateStyle.filter,`layers.${g.id}.filter`,c,null,d)||(g.filter=n.clone$1(c),this._updateLayer(g)))}else this.fire(new n.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return n.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,c,d,g={}){this._checkLoaded();const w=this.getLayer(t);w?n.deepEqual(w.getLayoutProperty(c),d)||(w.setLayoutProperty(c,d,g),this._updateLayer(w)):this.fire(new n.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,c){const d=this.getLayer(t);if(d)return d.getLayoutProperty(c);this.fire(new n.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,c,d,g={}){this._checkLoaded();const w=this.getLayer(t);w?n.deepEqual(w.getPaintProperty(c),d)||(w.setPaintProperty(c,d,g)&&this._updateLayer(w),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new n.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,c){return this.getLayer(t).getPaintProperty(c)}setFeatureState(t,c){this._checkLoaded();const d=t.source,g=t.sourceLayer,w=this.sourceCaches[d];if(w===void 0)return void this.fire(new n.ErrorEvent(new Error(`The source '${d}' does not exist in the map's style.`)));const k=w.getSource().type;k==="geojson"&&g?this.fire(new n.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):k!=="vector"||g?(t.id===void 0&&this.fire(new n.ErrorEvent(new Error("The feature id parameter must be provided."))),w.setFeatureState(g,t.id,c)):this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,c){this._checkLoaded();const d=t.source,g=this.sourceCaches[d];if(g===void 0)return void this.fire(new n.ErrorEvent(new Error(`The source '${d}' does not exist in the map's style.`)));const w=g.getSource().type,k=w==="vector"?t.sourceLayer:void 0;w!=="vector"||k?c&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new n.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(k,t.id,c):this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const c=t.source,d=t.sourceLayer,g=this.sourceCaches[c];if(g!==void 0)return g.getSource().type!=="vector"||d?(t.id===void 0&&this.fire(new n.ErrorEvent(new Error("The feature id parameter must be provided."))),g.getFeatureState(d,t.id)):void this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new n.ErrorEvent(new Error(`The source '${c}' does not exist in the map's style.`)))}getTransition(){return n.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=n.mapObject(this.sourceCaches,g=>g.serialize()),c=this._serializeByIds(this._order),d=this.stylesheet;return n.filterObject({version:d.version,name:d.name,metadata:d.metadata,light:d.light,center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch,sprite:d.sprite,glyphs:d.glyphs,transition:d.transition,sources:t,layers:c},g=>g!==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 c=k=>this._layers[k].type==="fill-extrusion",d={},g=[];for(let k=this._order.length-1;k>=0;k--){const A=this._order[k];if(c(A)){d[A]=k;for(const L of t){const O=L[A];if(O)for(const U of O)g.push(U)}}}g.sort((k,A)=>A.intersectionZ-k.intersectionZ);const w=[];for(let k=this._order.length-1;k>=0;k--){const A=this._order[k];if(c(A))for(let L=g.length-1;L>=0;L--){const O=g[L].feature;if(d[O.layer.id]{const xt=Oe.featureSortOrder;if(xt){const yt=xt.indexOf(rt.featureIndex);return xt.indexOf(ut.featureIndex)-yt}return ut.featureIndex-rt.featureIndex});for(const rt of it)Ue.push(rt)}}for(const Oe in fe)fe[Oe].forEach(Xe=>{const Te=Xe.feature,Ue=O[A[Oe].source].getFeatureState(Te.layer["source-layer"],Te.id);Te.source=Te.layer.source,Te.layer["source-layer"]&&(Te.sourceLayer=Te.layer["source-layer"]),Te.state=Ue});return fe}(this._layers,k,this.sourceCaches,t,c,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(w)}querySourceFeatures(t,c){c&&c.filter&&this._validate(n.validateStyle.filter,"querySourceFeatures.filter",c.filter,null,c);const d=this.sourceCaches[t];return d?function(g,w){const k=g.getRenderableIds().map(O=>g.getTileByID(O)),A=[],L={};for(let O=0;O{_i[g]=w})(t,c),c.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:c.workerSourceURL},d):d(null,null))}getLight(){return this.light.getLight()}setLight(t,c={}){this._checkLoaded();const d=this.light.getLight();let g=!1;for(const k in t)if(!n.deepEqual(t[k],d[k])){g=!0;break}if(!g)return;const w={now:n.browser.now(),transition:n.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,c),this.light.updateTransitions(w)}_validate(t,c,d,g,w={}){return(!w||w.validate!==!1)&&un(this,t.call(n.validateStyle,n.extend({key:c,style:this.serialize(),value:d,styleSpec:n.v8Spec},g)))}_remove(t=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),n.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const c in this._layers)this._layers[c].setEventedParent(null);for(const c in this.sourceCaches){const d=this.sourceCaches[c];d.setEventedParent(null),d.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const c in this.sourceCaches)this.sourceCaches[c].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,c,d,g,w=!1){let k=!1,A=!1;const L={};for(const O of this._order){const U=this._layers[O];if(U.type!=="symbol")continue;if(!L[U.source]){const J=this.sourceCaches[U.source];L[U.source]=J.getRenderableIds(!0).map(pe=>J.getTileByID(pe)).sort((pe,fe)=>fe.tileID.overscaledZ-pe.tileID.overscaledZ||(pe.tileID.isLessThan(fe.tileID)?-1:1))}const V=this.crossTileSymbolIndex.addLayer(U,L[U.source],t.center.lng);k=k||V}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((w=w||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(n.browser.now(),t.zoom))&&(this.pauseablePlacement=new yn(t,this.map.terrain,this._order,w,c,d,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,L),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(n.browser.now()),A=!0),k&&this.pauseablePlacement.placement.setStale()),A||k)for(const O of this._order){const U=this._layers[O];U.type==="symbol"&&this.placement.updateLayerOpacities(U,L[U.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(n.browser.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,c,d){this.imageManager.getImages(c.icons,d),this._updateTilesForChangedImages();const g=this.sourceCaches[c.source];g&&g.setDependencies(c.tileID.key,c.type,c.icons)}getGlyphs(t,c,d){this.glyphManager.getGlyphs(c.stacks,d);const g=this.sourceCaches[c.source];g&&g.setDependencies(c.tileID.key,c.type,[""])}getResource(t,c,d){return n.makeRequest(c,d)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,c={}){this._checkLoaded(),t&&this._validate(n.validateStyle.glyphs,"glyphs",t,null,c)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,c,d={},g){this._checkLoaded();const w=[{id:t,url:c}],k=[...re(this.stylesheet.sprite),...w];this._validate(n.validateStyle.sprite,"sprite",k,null,d)||(this.stylesheet.sprite=k,this._loadSprite(w,!0,g))}removeSprite(t){this._checkLoaded();const c=re(this.stylesheet.sprite);if(c.find(d=>d.id===t)){if(this._spritesImagesIds[t])for(const d of this._spritesImagesIds[t])this.imageManager.removeImage(d),this._changedImages[d]=!0;c.splice(c.findIndex(d=>d.id===t),1),this.stylesheet.sprite=c.length>0?c:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new n.Event("data",{dataType:"style"}))}else this.fire(new n.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return re(this.stylesheet.sprite)}setSprite(t,c={},d){this._checkLoaded(),t&&this._validate(n.validateStyle.sprite,"sprite",t,null,c)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,d):(this._unloadSprite(),d&&d(null)))}}Er.registerForPluginStateChange=n.registerForPluginStateChange;var Dr=n.createLayout([{name:"a_pos",type:"Int16",components:2}]),ss="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 vn={prelude:yi(`#ifdef GL_ES +(count)`,style:"number_with_commas",values:l.all.residents[f.code].values.count}]};o.sheets.push(p)}return yE(o)}async function kE({fetch:l}){let i=await wE(Xo+mc.url,mc.layer,l),a=(await Uy(Ko,[],l)).data,o=[],u={},f=[];return i.features.forEach(p=>{const n=p.properties[mc.code],_=p.properties[mc.name],v={code:n,name:_};o.push(v),u[n]=v,f.push({...v,value:100,color:Wo.seq[4]})}),{geojson:i,geoCodesAndNames:o,geoCodesLookup:u,geoPerc:f,all:a,selected:null}}const cT=Object.freeze(Object.defineProperty({__proto__:null,load:kE},Symbol.toStringTag,{value:"Module"})),TE=iy("goto"),CE=iy("after_navigate");function IE(l){return l.slice().sort(function(i,a){return i-a})}function pg(l,i){for(var a=[],o=0;o0){var f=(a[i]-a[l-1])/(i-l+1);u=o[i]-o[l-1]-(i-l+1)*f*f}else u=o[i]-a[i]*a[i]/(i+1);return u<0?0:u}function Vf(l,i,a,o,u,f,p){if(!(l>i)){var n=Math.floor((l+i)/2);o[a][n]=o[a-1][n-1],u[a][n]=n;var _=a;l>a&&(_=Math.max(_,u[a][l-1]||0)),_=Math.max(_,u[a-1][n]||0);var v=n-1;i=_&&(E=Uf(P,n,f,p),!(E+o[a-1][_-1]>=o[a][n]));--P)S=Uf(_,n,f,p),C=S+o[a-1][_-1],Cl.length)throw new Error("cannot generate more classes than there are data values");var a=IE(l),o=AE(a);if(o===1)return[a];var u=pg(i,a.length),f=pg(i,a.length);PE(a,u,f);for(var p=[],n=f[0].length-1,_=f.length-1;_>=0;_--){var v=f[_][n];p[_]=a.slice(v,n+1),_>0&&(n=v-1)}return p}function mg(l,i,a){const o=l.slice();return o[15]=i[a],o}function gg(l,i,a){const o=l.slice();return o[18]=i[a],o[20]=a,o}function _g(l,i,a){const o=l.slice();return o[18]=i[a],o[20]=a,o}function yg(l,i,a){const o=l.slice();return o[15]=i[a],o[20]=a,o}function vg(l,i,a){const o=l.slice();return o[15]=i[a],o}function bg(l,i,a){const o=l.slice();return o[18]=i[a],o[20]=a,o}function wg(l){let i,a=l[1](l[18][l[0]])+"",o,u;return{c(){i=Be("td"),o=Ot(a),u=Ot(l[2])},l(f){i=Oe(f,"TD",{});var p=Je(i);o=Ft(p,a),u=Ft(p,l[2]),p.forEach(X)},m(f,p){Fe(f,i,p),Te(i,o),Te(i,u)},p(f,p){p&131&&a!==(a=f[1](f[18][f[0]])+"")&&vi(o,a),p&4&&vi(u,f[2])},d(f){f&&X(i)}}}function xg(l){let i,a,o=l[15].label+"",u,f,p,n=Mi(l[15].values),_=[];for(let v=0;vF.toFixed(1)}=i,{suffix:C="%"}=i,{base:z=null}=i,{barHeight:P=25}=i,{markerWidth:I=3}=i,{showLegend:L=!0}=i;function D(F,V){let ee={},se=[];for(const le of F)ee[le[V]]||(ee[le[V]]={label:le[V],values:[]},se.push(le[V])),ee[le[V]].values.push(le);let ne=[];return se.forEach(le=>{ne.push(ee[le])}),ne}return l.$$set=F=>{"data"in F&&a(10,n=F.data),"xKey"in F&&a(0,_=F.xKey),"yKey"in F&&a(11,v=F.yKey),"zKey"in F&&a(12,E=F.zKey),"formatTick"in F&&a(1,S=F.formatTick),"suffix"in F&&a(2,C=F.suffix),"base"in F&&a(3,z=F.base),"barHeight"in F&&a(4,P=F.barHeight),"markerWidth"in F&&a(5,I=F.markerWidth),"showLegend"in F&&a(6,L=F.showLegend)},l.$$.update=()=>{l.$$.dirty&1025&&a(13,o=Math.max(...n.map(F=>F[_]))),l.$$.dirty&5120&&a(9,u=n.map(F=>F[E]).filter((F,V,ee)=>ee.indexOf(F)===V)),l.$$.dirty&8192&&a(8,f=F=>F/o*100),l.$$.dirty&3072&&a(7,p=D(n,v))},[_,S,C,z,P,I,L,p,f,u,n,v,E,o]}class BE extends qi{constructor(i){super(),Zi(this,i,RE,LE,Ui,{data:10,xKey:0,yKey:11,zKey:12,formatTick:1,suffix:2,base:3,barHeight:4,markerWidth:5,showLegend:6})}}function OE(l){let i,a,o;return{c(){i=ya("svg"),a=ya("path"),this.h()},l(u){i=va(u,"svg",{class:!0,viewBox:!0,"fill-rule":!0,"clip-rule":!0,"aria-hidden":!0,focusable:!0,style:!0});var f=Je(i);a=va(f,"path",{d:!0}),Je(a).forEach(X),f.forEach(X),this.h()},h(){pe(a,"d",o=l[4][l[0]]),pe(i,"class","ico svelte-175xtay"),pe(i,"viewBox","0 0 24 24"),pe(i,"fill-rule","evenodd"),pe(i,"clip-rule","evenodd"),pe(i,"aria-hidden","true"),pe(i,"focusable","false"),pe(i,"style",l[3]),Gt(i,"margin",l[2]),Gt(i,"noclick",!l[1])},m(u,f){Fe(u,i,f),Te(i,a)},p(u,[f]){f&1&&o!==(o=u[4][u[0]])&&pe(a,"d",o),f&8&&pe(i,"style",u[3]),f&4&&Gt(i,"margin",u[2]),f&2&&Gt(i,"noclick",!u[1])},i:xi,o:xi,d(u){u&&X(i)}}}function FE(l,i,a){let o,{type:u="compass"}=i,{rotation:f=0}=i,{position:p="inline"}=i,{clickable:n=!1}=i,{margin:_=!1}=i;const v={compass:"M22 12c0-5.52-4.48-10-10-10S2 6.48 2 12s4.48 10 10 10 10-4.48 10-10zm-10 1H8v-2h4V8l4 4-4 4v-3z",info:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 15c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm1-8h-2V7h2v2z",chart:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM8 17c-.55 0-1-.45-1-1v-5c0-.55.45-1 1-1s1 .45 1 1v5c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v8c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1z",share:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z",chevron:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z",full:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",full_exit:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z",shuffle:"M10.59 9.17 5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z",replay:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z",save:"M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zm-6 .67 2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z",tick:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",cross:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",arrow:"M5,13h11.2l-2.9,2.9c-0.4,0.4-0.4,1,0,1.4s1,0.4,1.4,0l4.6-4.6c0.4-0.4,0.4-1,0-1.4l-4.6-4.6c-0.4-0.4-1-0.4-1.4,0c0,0,0,0,0,0c-0.4,0.4-0.4,1,0,1.4l2.9,2.9H5c-0.6,0-1,0.4-1,1S4.4,13,5,13z",plus:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1z",minus:"M18 13H6c-.55 0-1-.45-1-1s.45-1 1-1h12c.55 0 1 .45 1 1s-.45 1-1 1z",subdir:"m19 15-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z",touch:"M9 11.24V7.5C9 6.12 10.12 5 11.5 5S14 6.12 14 7.5v3.74c1.21-.81 2-2.18 2-3.74C16 5.01 13.99 3 11.5 3S7 5.01 7 7.5c0 1.56.79 2.93 2 3.74zm9.84 4.63-4.54-2.26c-.17-.07-.35-.11-.54-.11H13v-6c0-.83-.67-1.5-1.5-1.5S10 6.67 10 7.5v10.74c-3.6-.76-3.54-.75-3.67-.75-.31 0-.59.13-.79.33l-.79.8 4.94 4.94c.27.27.65.44 1.06.44h6.79c.75 0 1.33-.55 1.44-1.28l.75-5.27c.01-.07.02-.14.02-.2 0-.62-.38-1.16-.91-1.38z",launch:"M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h5c.55 0 1-.45 1-1s-.45-1-1-1H5c-1.11 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6c0-.55-.45-1-1-1s-1 .45-1 1v5c0 .55-.45 1-1 1zM14 4c0 .55.45 1 1 1h2.59l-9.13 9.13c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L19 6.41V9c0 .55.45 1 1 1s1-.45 1-1V3h-6c-.55 0-1 .45-1 1z",close:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",error:"M 12 2 C 6.48 2 2 6.48 2 12 s 4.48 10 10 10 s 10 -4.48 10 -10 S 17.52 2 12 2 z m 1 15 h -2 v -2 h 2 v 2 z m 0 -4 h -2 V 7 h 2 v 6 z"};return l.$$set=E=>{"type"in E&&a(0,u=E.type),"rotation"in E&&a(5,f=E.rotation),"position"in E&&a(6,p=E.position),"clickable"in E&&a(1,n=E.clickable),"margin"in E&&a(2,_=E.margin)},l.$$.update=()=>{l.$$.dirty&96&&a(3,o=`transform: translate(0, 15%) scale(1.5) rotate(${-f}deg);${["left","right"].includes(p)?` position: absolute; ${p}: 10px;`:""}`)},[u,n,_,o,v,f,p]}class ch extends qi{constructor(i){super(),Zi(this,i,FE,OE,Ui,{type:0,rotation:5,position:6,clickable:1,margin:2})}}function Ag(l,i,a){const o=l.slice();return o[11]=i[a],o}function Pg(l){let i,a="Back",o,u;return{c(){i=Be("button"),i.textContent=a,this.h()},l(f){i=Oe(f,"BUTTON",{class:!0,"data-svelte-h":!0}),dr(i)!=="svelte-pv0rgn"&&(i.textContent=a),this.h()},h(){pe(i,"class","hidden-on-desktop svelte-1iovvug")},m(f,p){Fe(f,i,p),o||(u=Ms(i,"click",function(){Y_(l[3])&&l[3].apply(this,arguments)}),o=!0)},p(f,p){l=f},d(f){f&&X(i),o=!1,u()}}}function zg(l){let i,a,o,u,f=eo(Ju(l[11],l[4]))+"",p;return{c(){i=Be("br"),a=ut(),o=Be("div"),u=Ot("Selected: "),p=Ot(f),this.h()},l(n){i=Oe(n,"BR",{}),a=ht(n),o=Oe(n,"DIV",{class:!0});var _=Je(o);u=Ft(_,"Selected: "),p=Ft(_,f),_.forEach(X),this.h()},h(){pe(o,"class","selected-item-label svelte-1iovvug")},m(n,_){Fe(n,i,_),Fe(n,a,_),Fe(n,o,_),Te(o,u),Te(o,p)},p(n,_){_&18&&f!==(f=eo(Ju(n[11],n[4]))+"")&&vi(p,f)},d(n){n&&(X(i),X(a),X(o))}}}function Mg(l){let i,a=l[6](l[11])+"",o,u,f,p,n,_=Ju(l[11],l[4]),v,E,S;p=new ch({props:{type:"chevron"}});let C=_&&zg(l);function z(){return l[10](l[11])}return{c(){i=Be("button"),o=Ot(a),u=ut(),f=Be("span"),ei(p.$$.fragment),n=ut(),C&&C.c(),this.h()},l(P){i=Oe(P,"BUTTON",{class:!0});var I=Je(i);o=Ft(I,a),u=ht(I),f=Oe(I,"SPAN",{class:!0});var L=Je(f);si(p.$$.fragment,L),L.forEach(X),n=ht(I),C&&C.l(I),I.forEach(X),this.h()},h(){pe(f,"class","right-chevron svelte-1iovvug"),pe(i,"class","svelte-1iovvug"),Gt(i,"plain-button",!0),Gt(i,"selected",l[11]===l[0])},m(P,I){Fe(P,i,I),Te(i,o),Te(i,u),Te(i,f),ti(p,f,null),Te(i,n),C&&C.m(i,null),v=!0,E||(S=Ms(i,"click",z),E=!0)},p(P,I){l=P,(!v||I&66)&&a!==(a=l[6](l[11])+"")&&vi(o,a),I&18&&(_=Ju(l[11],l[4])),_?C?C.p(l,I):(C=zg(l),C.c(),C.m(i,null)):C&&(C.d(1),C=null),(!v||I&3)&&Gt(i,"selected",l[11]===l[0])},i(P){v||(Ke(p.$$.fragment,P),v=!0)},o(P){st(p.$$.fragment,P),v=!1},d(P){P&&X(i),ii(p),C&&C.d(),E=!1,S()}}}function NE(l){let i,a,o,u,f,p,n,_=l[3]!=null&&Pg(l),v=Mi(l[1]),E=[];for(let P=0;Pst(E[P],1,1,()=>{E[P]=null}),C=l[9].default,z=Ir(C,l,l[8],null);return{c(){i=Be("div"),_&&_.c(),a=ut(),o=Be("h5"),u=Ot(l[5]),f=ut();for(let P=0;PP.label}=i,{selected:S=null}=i,{hiddenOnMobile:C=!1}=i;const z=P=>{a(0,S=P),p(P)};return l.$$set=P=>{"options"in P&&a(1,f=P.options),"clickCallback"in P&&a(2,p=P.clickCallback),"backButtonCallback"in P&&a(3,n=P.backButtonCallback),"globalSelectedCategories"in P&&a(4,_=P.globalSelectedCategories),"columnTitle"in P&&a(5,v=P.columnTitle),"labeller"in P&&a(6,E=P.labeller),"selected"in P&&a(0,S=P.selected),"hiddenOnMobile"in P&&a(7,C=P.hiddenOnMobile),"$$scope"in P&&a(8,u=P.$$scope)},[S,f,p,n,_,v,E,C,u,o,z]}class $E extends qi{constructor(i){super(),Zi(this,i,VE,NE,Ui,{options:1,clickCallback:2,backButtonCallback:3,globalSelectedCategories:4,columnTitle:5,labeller:6,selected:0,hiddenOnMobile:7})}}function Dg(l,i,a){const o=l.slice();return o[14]=i[a],o[16]=a,o}function Lg(l){let i,a,o,u="Back",f,p,n,_,v;return{c(){i=Be("ol"),a=Be("li"),o=Be("button"),o.textContent=u,f=ut(),p=ya("svg"),n=ya("path"),this.h()},l(E){i=Oe(E,"OL",{class:!0});var S=Je(i);a=Oe(S,"LI",{class:!0,id:!0});var C=Je(a);o=Oe(C,"BUTTON",{class:!0,"data-svelte-h":!0}),dr(o)!=="svelte-10k8otn"&&(o.textContent=u),f=ht(C),p=va(C,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0,fill:!0});var z=Je(p);n=va(z,"path",{d:!0,transform:!0}),Je(n).forEach(X),z.forEach(X),C.forEach(X),S.forEach(X),this.h()},h(){pe(o,"class","btn-link ons-breadcrumb__link"),pe(n,"d","M5.74,14.28l-.57-.56a.5.5,0,0,1,0-.71h0l5-5-5-5a.5.5,0,0,1,0-.71h0l.57-.56a.5.5,0,0,1,.71,0h0l5.93,5.93a.5.5,0,0,1,0,.7L6.45,14.28a.5.5,0,0,1-.71,0Z"),pe(n,"transform","translate(-5.02 -1.59)"),pe(p,"class","ons-svg-icon svelte-w4p0hu"),pe(p,"viewBox","0 0 8 13"),pe(p,"xmlns","http://www.w3.org/2000/svg"),pe(p,"focusable","false"),pe(p,"fill","currentColor"),pe(a,"class","ons-breadcrumb__item"),pe(a,"id","breadcrumb-1"),pe(i,"class","ons-breadcrumb__items ons-u-fs-s")},m(E,S){Fe(E,i,S),Te(i,a),Te(a,o),Te(a,f),Te(a,p),Te(p,n),_||(v=Ms(o,"click",function(){Y_(l[3])&&l[3].apply(this,arguments)}),_=!0)},p(E,S){l=E},d(E){E&&X(i),_=!1,v()}}}function Rg(l){let i,a;return i=new qf({props:{variant:"secondary",small:!0,disabled:l[7],$$slots:{default:[jE]},$$scope:{ctx:l}}}),i.$on("click",l[11]),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&128&&(f.disabled=o[7]),u&8192&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function jE(l){let i;return{c(){i=Ot("Remove selection")},l(a){i=Ft(a,"Remove selection")},m(a,o){Fe(a,i,o)},d(a){a&&X(i)}}}function qE(l){let i,a=l[0],o,u,f=Og(l);const p=l[10].default,n=Ir(p,l,l[13],null);return{c(){i=Be("div"),f.c(),o=ut(),n&&n.c(),this.h()},l(_){i=Oe(_,"DIV",{class:!0});var v=Je(i);f.l(v),v.forEach(X),o=ht(_),n&&n.l(_),this.h()},h(){pe(i,"class","ons-radios__items")},m(_,v){Fe(_,i,v),f.m(i,null),Fe(_,o,v),n&&n.m(_,v),u=!0},p(_,v){v&1&&Ui(a,a=_[0])?(f.d(1),f=Og(_),f.c(),f.m(i,null)):f.p(_,v),n&&n.p&&(!u||v&8192)&&Ar(n,p,_,_[13],u?zr(p,_[13],v,null):Pr(_[13]),null)},i(_){u||(Ke(n,_),u=!0)},o(_){st(n,_),u=!1},d(_){_&&(X(i),X(o)),f.d(_),n&&n.d(_)}}}function ZE(l){let i;return{c(){i=Ot(`At most three characteristics can be selected. To add another + characteristic, please remove one of the three selected ones.`)},l(a){i=Ft(a,`At most three characteristics can be selected. To add another + characteristic, please remove one of the three selected ones.`)},m(a,o){Fe(a,i,o)},p:xi,i:xi,o:xi,d(a){a&&X(i)}}}function Bg(l){let i,a,o,u,f,p=l[6](l[14])+"",n,_,v,E;function S(){return l[12](l[14])}return{c(){i=Be("button"),a=Be("span"),o=Be("span"),u=ut(),f=Be("span"),n=Ot(p),_=ut(),this.h()},l(C){i=Oe(C,"BUTTON",{class:!0});var z=Je(i);a=Oe(z,"SPAN",{class:!0});var P=Je(a);o=Oe(P,"SPAN",{class:!0}),Je(o).forEach(X),u=ht(P),f=Oe(P,"SPAN",{class:!0});var I=Je(f);n=Ft(I,p),I.forEach(X),P.forEach(X),_=ht(z),z.forEach(X),this.h()},h(){pe(o,"class","ons-radio__input ons-js-radio svelte-1cwdic4"),pe(f,"class","ons-radio__label svelte-1cwdic4"),pe(a,"class","ons-radio ons-radio--no-border"),pe(i,"class","ons-radios__item ons-radios__item--no-border svelte-1cwdic4"),i.disabled=l[7],Gt(i,"ons-radio__checked",Ng(l[14],l[4]))},m(C,z){Fe(C,i,z),Te(i,a),Te(a,o),Te(a,u),Te(a,f),Te(f,n),Te(i,_),v||(E=[Q_(WE.call(null,i,l[16]===0)),Ms(i,"click",S)],v=!0)},p(C,z){l=C,z&65&&p!==(p=l[6](l[14])+"")&&vi(n,p),z&128&&(i.disabled=l[7]),z&17&&Gt(i,"ons-radio__checked",Ng(l[14],l[4]))},d(C){C&&X(i),v=!1,K1(E)}}}function Og(l){let i,a=Mi(l[0]),o=[];for(let u=0;u{I=null}),$i());let se=S;S=F(V,ee),S===se?D[S].p(V,ee):(Vi(),st(D[se],1,1,()=>{D[se]=null}),$i(),C=D[S],C?C.p(V,ee):(C=D[S]=L[S](V),C.c()),Ke(C,1),C.m(i,null)),(!z||ee&256)&&Gt(i,"hidden-first-column",V[8])},i(V){z||(Ke(I),Ke(C),z=!0)},o(V){st(I),st(C),z=!1},d(V){V&&X(i),P&&P.d(),I&&I.d(),D[S].d()}}}function Fg(l){console.log("clicked",l)}function If(l,i){for(let a of i)if(a.topic===l.label)return a.label;return!1}function Ng(l,i){for(const a of i)if(a.var===l.var&&a.code===l.code)return!0;return!1}function WE(l,i){i&&l.focus()}function HE(l,i,a){let{$$slots:o={},$$scope:u}=i,{options:f=[]}=i,{clickCallback:p=Fg}=i,{removeCatCallback:n=Fg}=i,{backButtonCallback:_=null}=i,{globalSelectedCategories:v=[]}=i,{columnTitle:E="column title"}=i,{labeller:S=D=>D.label}=i,{disabled:C=!1}=i,{hiddenOnMobile:z=!1}=i,{currentVar:P=null}=i;const I=()=>n(P),L=D=>p(D);return l.$$set=D=>{"options"in D&&a(0,f=D.options),"clickCallback"in D&&a(1,p=D.clickCallback),"removeCatCallback"in D&&a(2,n=D.removeCatCallback),"backButtonCallback"in D&&a(3,_=D.backButtonCallback),"globalSelectedCategories"in D&&a(4,v=D.globalSelectedCategories),"columnTitle"in D&&a(5,E=D.columnTitle),"labeller"in D&&a(6,S=D.labeller),"disabled"in D&&a(7,C=D.disabled),"hiddenOnMobile"in D&&a(8,z=D.hiddenOnMobile),"currentVar"in D&&a(9,P=D.currentVar),"$$scope"in D&&a(13,u=D.$$scope)},[f,p,n,_,v,E,S,C,z,P,o,I,L,u]}class KE extends qi{constructor(i){super(),Zi(this,i,HE,GE,Ui,{options:0,clickCallback:1,removeCatCallback:2,backButtonCallback:3,globalSelectedCategories:4,columnTitle:5,labeller:6,disabled:7,hiddenOnMobile:8,currentVar:9})}}function Ug(l,i,a){const o=l.slice();return o[16]=i[a],o}function Vg(l){let i,a,o=Mi([l[0].vars[l[7][l[0].label]]]),u=[];for(let p=0;p<1;p+=1)u[p]=qg(Ug(l,o,p));const f=p=>st(u[p],1,1,()=>{u[p]=null});return{c(){for(let p=0;p<1;p+=1)u[p].c();i=ri()},l(p){for(let n=0;n<1;n+=1)u[n].l(p);i=ri()},m(p,n){for(let _=0;_<1;_+=1)u[_]&&u[_].m(p,n);Fe(p,i,n),a=!0},p(p,n){if(n&2043){o=Mi([p[0].vars[p[7][p[0].label]]]);let _;for(_=0;_<1;_+=1){const v=Ug(p,o,_);u[_]?(u[_].p(v,n),Ke(u[_],1)):(u[_]=qg(v),u[_].c(),Ke(u[_],1),u[_].m(i.parentNode,i))}for(Vi(),_=1;_<1;_+=1)f(_);$i()}},i(p){if(!a){for(let n=0;n<1;n+=1)Ke(u[n]);a=!0}},o(p){u=u.filter(Boolean);for(let n=0;n<1;n+=1)st(u[n]);a=!1},d(p){p&&X(i),Mr(u,p)}}}function $g(l){let i,a,o,u,f,p;return a=new ch({props:{type:"chevron",rotation:90}}),{c(){i=Be("button"),ei(a.$$.fragment),o=Ot(" Show fewer"),this.h()},l(n){i=Oe(n,"BUTTON",{class:!0});var _=Je(i);si(a.$$.fragment,_),o=Ft(_," Show fewer"),_.forEach(X),this.h()},h(){pe(i,"class","btn-link")},m(n,_){Fe(n,i,_),ti(a,i,null),Te(i,o),u=!0,f||(p=Ms(i,"click",l[9]),f=!0)},p:xi,i(n){u||(Ke(a.$$.fragment,n),u=!0)},o(n){st(a.$$.fragment,n),u=!1},d(n){n&&X(i),ii(a),f=!1,p()}}}function jg(l){let i,a,o,u,f,p;return a=new ch({props:{type:"chevron",rotation:-90}}),{c(){i=Be("button"),ei(a.$$.fragment),o=Ot(" Show more"),this.h()},l(n){i=Oe(n,"BUTTON",{class:!0});var _=Je(i);si(a.$$.fragment,_),o=Ft(_," Show more"),_.forEach(X),this.h()},h(){pe(i,"class","btn-link")},m(n,_){Fe(n,i,_),ti(a,i,null),Te(i,o),u=!0,f||(p=Ms(i,"click",l[8]),f=!0)},p:xi,i(n){u||(Ke(a.$$.fragment,n),u=!0)},o(n){st(a.$$.fragment,n),u=!1},d(n){n&&X(i),ii(a),f=!1,p()}}}function XE(l){let i,a,o,u=l[7][l[0].label]>0&&$g(l),f=l[7][l[0].label]0?u?(u.p(p,n),n&129&&Ke(u,1)):(u=$g(p),u.c(),Ke(u,1),u.m(i.parentNode,i)):u&&(Vi(),st(u,1,1,()=>{u=null}),$i()),p[7][p[0].label]{f=null}),$i())},i(p){o||(Ke(u),Ke(f),o=!0)},o(p){st(u),st(f),o=!1},d(p){p&&(X(i),X(a)),u&&u.d(p),f&&f.d(p)}}}function qg(l){let i,a,o;function u(..._){return l[12](l[16],..._)}function f(..._){return l[13](l[16],..._)}function p(_){l[15](_)}let n={columnTitle:l[0].label,options:l[10](l[16]),clickCallback:u,removeCatCallback:f,backButtonCallback:l[14],globalSelectedCategories:l[5],currentVar:l[0],disabled:l[6],$$slots:{default:[XE]},$$scope:{ctx:l}};return l[1]!==void 0&&(n.selected=l[1]),i=new KE({props:n}),Ja.push(()=>Qo(i,"selected",p)),{c(){ei(i.$$.fragment)},l(_){si(i.$$.fragment,_)},m(_,v){ti(i,_,v),o=!0},p(_,v){l=_;const E={};v&1&&(E.columnTitle=l[0].label),v&129&&(E.options=l[10](l[16])),v&137&&(E.clickCallback=u),v&145&&(E.removeCatCallback=f),v&1&&(E.backButtonCallback=l[14]),v&32&&(E.globalSelectedCategories=l[5]),v&1&&(E.currentVar=l[0]),v&64&&(E.disabled=l[6]),v&524417&&(E.$$scope={dirty:v,ctx:l}),!a&&v&2&&(a=!0,E.selected=l[1],Yo(()=>a=!1)),i.$set(E)},i(_){o||(Ke(i.$$.fragment,_),o=!0)},o(_){st(i.$$.fragment,_),o=!1},d(_){ii(i,_)}}}function Zg(l){let i,a,o=l[0]!=null&&Vg(l);return{c(){o&&o.c(),i=ri()},l(u){o&&o.l(u),i=ri()},m(u,f){o&&o.m(u,f),Fe(u,i,f),a=!0},p(u,f){u[0]!=null?o?(o.p(u,f),f&1&&Ke(o,1)):(o=Vg(u),o.c(),Ke(o,1),o.m(i.parentNode,i)):o&&(Vi(),st(o,1,1,()=>{o=null}),$i())},i(u){a||(Ke(o),a=!0)},o(u){st(o),a=!1},d(u){u&&X(i),o&&o.d(u)}}}function JE(l){let i,a,o,u,f=l[0],p;function n(E){l[11](E)}let _={columnTitle:"Select a variable",clickCallback:eS,options:l[2],globalSelectedCategories:l[5],hiddenOnMobile:l[0]!=null};l[0]!==void 0&&(_.selected=l[0]),a=new $E({props:_}),Ja.push(()=>Qo(a,"selected",n));let v=Zg(l);return{c(){i=Be("div"),ei(a.$$.fragment),u=ut(),v.c(),this.h()},l(E){i=Oe(E,"DIV",{class:!0});var S=Je(i);si(a.$$.fragment,S),u=ht(S),v.l(S),S.forEach(X),this.h()},h(){pe(i,"class","container svelte-9mqv54")},m(E,S){Fe(E,i,S),ti(a,i,null),Te(i,u),v.m(i,null),p=!0},p(E,[S]){const C={};S&4&&(C.options=E[2]),S&32&&(C.globalSelectedCategories=E[5]),S&1&&(C.hiddenOnMobile=E[0]!=null),!o&&S&1&&(o=!0,C.selected=E[0],Yo(()=>o=!1)),a.$set(C),S&1&&Ui(f,f=E[0])?(Vi(),st(v,1,1,xi),$i(),v=Zg(E),v.c(),Ke(v,1),v.m(i,null)):v.p(E,S)},i(E){p||(Ke(a.$$.fragment,E),Ke(v),p=!0)},o(E){st(a.$$.fragment,E),st(v),p=!1},d(E){E&&X(i),ii(a),v.d(E)}}}function YE(l,i){console.log(l,i)}function QE(l,i){console.log(l,i)}const eS=()=>{};function tS(l,i,a){let o,{options:u=[]}=i,{clickCallback:f=YE}=i,{removeCatCallback:p=QE}=i,{globalSelectedCategories:n=[]}=i,{disabled:_=!1}=i,{activeColumn:v=null}=i,{activeCategory:E=null}=i;function S(){a(7,++o[v.label],o)}function C(){a(7,--o[v.label],o)}function z(V){return console.log(V),V.key!=="religion_tb"?V.cats:V.cats.sort(Vy)}function P(V){v=V,a(0,v)}const I=(V,ee)=>f(V,ee),L=(V,ee)=>p(V,ee),D=()=>a(0,v=null);function F(V){E=V,a(1,E)}return l.$$set=V=>{"options"in V&&a(2,u=V.options),"clickCallback"in V&&a(3,f=V.clickCallback),"removeCatCallback"in V&&a(4,p=V.removeCatCallback),"globalSelectedCategories"in V&&a(5,n=V.globalSelectedCategories),"disabled"in V&&a(6,_=V.disabled),"activeColumn"in V&&a(0,v=V.activeColumn),"activeCategory"in V&&a(1,E=V.activeCategory)},l.$$.update=()=>{l.$$.dirty&4&&a(7,o=function(){let V={};return u.forEach(ee=>V[ee.label]=0),V}())},[v,E,u,f,p,n,_,o,S,C,z,P,I,L,D,F]}class iS extends qi{constructor(i){super(),Zi(this,i,tS,JE,Ui,{options:2,clickCallback:3,removeCatCallback:4,globalSelectedCategories:5,disabled:6,activeColumn:0,activeCategory:1})}}var $y={exports:{}};(function(l,i){(function(a,o){l.exports=o()})(Ho,function(){var a,o,u;function f(n,_){if(!a)a=_;else if(!o)o=_;else{var v="var sharedChunk = {}; ("+a+")(sharedChunk); ("+o+")(sharedChunk);",E={};a(E),u=_(E),typeof window<"u"&&(u.workerUrl=window.URL.createObjectURL(new Blob([v],{type:"text/javascript"})))}}f(["exports"],function(n){function _(r,e,s,h){return new(s||(s=Promise))(function(m,b){function x(B){try{M(h.next(B))}catch(N){b(N)}}function k(B){try{M(h.throw(B))}catch(N){b(N)}}function M(B){var N;B.done?m(B.value):(N=B.value,N instanceof s?N:new s(function(j){j(N)})).then(x,k)}M((h=h.apply(r,e||[])).next())})}function v(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}typeof SuppressedError=="function"&&SuppressedError;var E=S;function S(r,e){this.x=r,this.y=e}S.prototype={clone:function(){return new S(this.x,this.y)},add:function(r){return this.clone()._add(r)},sub:function(r){return this.clone()._sub(r)},multByPoint:function(r){return this.clone()._multByPoint(r)},divByPoint:function(r){return this.clone()._divByPoint(r)},mult:function(r){return this.clone()._mult(r)},div:function(r){return this.clone()._div(r)},rotate:function(r){return this.clone()._rotate(r)},rotateAround:function(r,e){return this.clone()._rotateAround(r,e)},matMult:function(r){return this.clone()._matMult(r)},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(r){return this.x===r.x&&this.y===r.y},dist:function(r){return Math.sqrt(this.distSqr(r))},distSqr:function(r){var e=r.x-this.x,s=r.y-this.y;return e*e+s*s},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith:function(r){return this.angleWithSep(r.x,r.y)},angleWithSep:function(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult:function(r){var e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add:function(r){return this.x+=r.x,this.y+=r.y,this},_sub:function(r){return this.x-=r.x,this.y-=r.y,this},_mult:function(r){return this.x*=r,this.y*=r,this},_div:function(r){return this.x/=r,this.y/=r,this},_multByPoint:function(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint:function(r){return this.x/=r.x,this.y/=r.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var r=this.y;return this.y=this.x,this.x=-r,this},_rotate:function(r){var e=Math.cos(r),s=Math.sin(r),h=s*this.x+e*this.y;return this.x=e*this.x-s*this.y,this.y=h,this},_rotateAround:function(r,e){var s=Math.cos(r),h=Math.sin(r),m=e.y+h*(this.x-e.x)+s*(this.y-e.y);return this.x=e.x+s*(this.x-e.x)-h*(this.y-e.y),this.y=m,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},S.convert=function(r){return r instanceof S?r:Array.isArray(r)?new S(r[0],r[1]):r};var C=v(E),z=P;function P(r,e,s,h){this.cx=3*r,this.bx=3*(s-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(h-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=e,this.p2x=s,this.p2y=h}P.prototype={sampleCurveX:function(r){return((this.ax*r+this.bx)*r+this.cx)*r},sampleCurveY:function(r){return((this.ay*r+this.by)*r+this.cy)*r},sampleCurveDerivativeX:function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},solveCurveX:function(r,e){if(e===void 0&&(e=1e-6),r<0)return 0;if(r>1)return 1;for(var s=r,h=0;h<8;h++){var m=this.sampleCurveX(s)-r;if(Math.abs(m)m?x=s:k=s,s=.5*(k-x)+x;return s},solve:function(r,e){return this.sampleCurveY(this.solveCurveX(r,e))}};var I=v(z);let L,D;function F(){return L==null&&(L=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),L}function V(){if(D==null&&(D=!1,F())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let h=0;h<5*5;h++){const m=4*h;e.fillStyle=`rgb(${m},${m+1},${m+2})`,e.fillRect(h%5,Math.floor(h/5),1,1)}const s=e.getImageData(0,0,5,5).data;for(let h=0;h<5*5*4;h++)if(h%4!=3&&s[h]!==h){D=!0;break}}}return D||!1}function ee(r,e,s,h){const m=new I(r,e,s,h);return function(b){return m.solve(b)}}const se=ee(.25,.1,.25,1);function ne(r,e,s){return Math.min(s,Math.max(e,r))}function le(r,e,s){const h=s-e,m=((r-e)%h+h)%h+e;return m===e?s:m}function ge(r,...e){for(const s of e)for(const h in s)r[h]=s[h];return r}let ce=1;function Me(r,e,s){const h={};for(const m in r)h[m]=e.call(s||this,r[m],m,r);return h}function et(r,e,s){const h={};for(const m in r)e.call(s||this,r[m],m,r)&&(h[m]=r[m]);return h}function ye(r){return Array.isArray(r)?r.map(ye):typeof r=="object"&&r?Me(r,ye):r}const Ge={};function q(r){Ge[r]||(typeof console<"u"&&console.warn(r),Ge[r]=!0)}function We(r,e,s){return(s.y-r.y)*(e.x-r.x)>(e.y-r.y)*(s.x-r.x)}function Tt(r){let e=0;for(let s,h,m=0,b=r.length,x=b-1;m"u")throw new Error("VideoFrame not supported");const b=new VideoFrame(r,{timestamp:0});try{const x=b==null?void 0:b.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const k=x.startsWith("BGR"),M=new Uint8ClampedArray(h*m*4);if(yield b.copyTo(M,function(B,N,j,W,te){const re=4*Math.max(-N,0),de=(Math.max(0,j)-j)*W*4+re,Se=4*W,Pe=Math.max(0,N),qe=Math.max(0,j);return{rect:{x:Pe,y:qe,width:Math.min(B.width,N+W)-Pe,height:Math.min(B.height,j+te)-qe},layout:[{offset:de,stride:Se}]}}(r,e,s,h,m)),k)for(let B=0;BcancelAnimationFrame(e)}},getImageData(r,e=0){return this.getImageCanvasContext(r).getImageData(-e,-e,r.width+2*e,r.height+2*e)},getImageCanvasContext(r){const e=window.document.createElement("canvas"),s=e.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return e.width=r.width,e.height=r.height,s.drawImage(r,0,0,r.width,r.height),s},resolveURL:r=>(ue||(ue=document.createElement("a")),ue.href=r,ue.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Qe==null&&(Qe=matchMedia("(prefers-reduced-motion: reduce)")),Qe.matches)}},vt={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class It extends Error{constructor(e,s,h,m){super(`AJAXError: ${s} (${e}): ${h}`),this.status=e,this.statusText=s,this.url=h,this.body=m}}const Nt=it()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,fi=r=>vt.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))];function gt(r,e){const s=new AbortController,h=new Request(r.url,{method:r.method||"GET",body:r.body,credentials:r.credentials,headers:r.headers,cache:r.cache,referrer:Nt(),signal:s.signal});let m=!1,b=!1;return r.type==="json"&&h.headers.set("Accept","application/json"),b||fetch(h).then(x=>x.ok?(k=>{(r.type==="arrayBuffer"||r.type==="image"?k.arrayBuffer():r.type==="json"?k.json():k.text()).then(M=>{b||(m=!0,e(null,M,k.headers.get("Cache-Control"),k.headers.get("Expires")))}).catch(M=>{b||e(new Error(M.message))})})(x):x.blob().then(k=>e(new It(x.status,x.statusText,r.url,k)))).catch(x=>{x.code!==20&&e(new Error(x.message))}),{cancel:()=>{b=!0,m||s.abort()}}}const _i=function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){if(it()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",r,e);if(!it())return(fi(r.url)||gt)(r,e)}if(!(/^file:/.test(s=r.url)||/^file:/.test(Nt())&&!/^\w+:/.test(s))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return gt(r,e);if(it()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",r,e,void 0,!0)}var s;return function(h,m){const b=new XMLHttpRequest;b.open(h.method||"GET",h.url,!0),h.type!=="arrayBuffer"&&h.type!=="image"||(b.responseType="arraybuffer");for(const x in h.headers)b.setRequestHeader(x,h.headers[x]);return h.type==="json"&&(b.responseType="text",b.setRequestHeader("Accept","application/json")),b.withCredentials=h.credentials==="include",b.onerror=()=>{m(new Error(b.statusText))},b.onload=()=>{if((b.status>=200&&b.status<300||b.status===0)&&b.response!==null){let x=b.response;if(h.type==="json")try{x=JSON.parse(b.response)}catch(k){return m(k)}m(null,x,b.getResponseHeader("Cache-Control"),b.getResponseHeader("Expires"))}else{const x=new Blob([b.response],{type:b.getResponseHeader("Content-Type")});m(new It(b.status,b.statusText,h.url,x))}},b.send(h.body),{cancel:()=>b.abort()}}(r,e)},Z=function(r,e){return _i(ge(r,{type:"arrayBuffer"}),e)};function lt(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const e=new URL(r),s=window.location;return e.protocol===s.protocol&&e.host===s.host}function nt(r,e,s){s[r]&&s[r].indexOf(e)!==-1||(s[r]=s[r]||[],s[r].push(e))}function Ee(r,e,s){if(s&&s[r]){const h=s[r].indexOf(e);h!==-1&&s[r].splice(h,1)}}class _e{constructor(e,s={}){ge(this,s),this.type=e}}class Ze extends _e{constructor(e,s={}){super("error",ge({error:e},s))}}class pt{on(e,s){return this._listeners=this._listeners||{},nt(e,s,this._listeners),this}off(e,s){return Ee(e,s,this._listeners),Ee(e,s,this._oneTimeListeners),this}once(e,s){return s?(this._oneTimeListeners=this._oneTimeListeners||{},nt(e,s,this._oneTimeListeners),this):new Promise(h=>this.once(e,h))}fire(e,s){typeof e=="string"&&(e=new _e(e,s||{}));const h=e.type;if(this.listens(h)){e.target=this;const m=this._listeners&&this._listeners[h]?this._listeners[h].slice():[];for(const k of m)k.call(this,e);const b=this._oneTimeListeners&&this._oneTimeListeners[h]?this._oneTimeListeners[h].slice():[];for(const k of b)Ee(h,k,this._oneTimeListeners),k.call(this,e);const x=this._eventedParent;x&&(ge(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(e))}else e instanceof Ze&&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,s){return this._eventedParent=e,this._eventedParentData=s,this}}var Ae={$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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},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 Ye=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function xt(r,e){const s={};for(const h in r)h!=="ref"&&(s[h]=r[h]);return Ye.forEach(h=>{h in e&&(s[h]=e[h])}),s}function kt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let s=0;s`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const $e=[or,zt,bi,wi,Sr,be,$r,we(pi),G,K,oe];function Re(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Re(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const s of $e)if(!Re(s,e))return null}}return`Expected ${Ie(r)} but found ${Ie(e)} instead.`}function ze(r,e){return e.some(s=>s.kind===r.kind)}function H(r,e){return e.some(s=>s==="null"?r===null:s==="array"?Array.isArray(r):s==="object"?r&&!Array.isArray(r)&&typeof r=="object":s===typeof r)}function J(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}const ae=.96422,ke=.82521,Ue=4/29,bt=6/29,mt=3*bt*bt,Ct=bt*bt*bt,Zt=Math.PI/180,di=180/Math.PI;function Yt(r){return(r%=360)<0&&(r+=360),r}function ni([r,e,s,h]){let m,b;const x=ai((.2225045*(r=li(r))+.7168786*(e=li(e))+.0606169*(s=li(s)))/1);r===e&&e===s?m=b=x:(m=ai((.4360747*r+.3850649*e+.1430804*s)/ae),b=ai((.0139322*r+.0971045*e+.7141733*s)/ke));const k=116*x-16;return[k<0?0:k,500*(m-x),200*(x-b),h]}function li(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function ai(r){return r>Ct?Math.pow(r,1/3):r/mt+Ue}function gi([r,e,s,h]){let m=(r+16)/116,b=isNaN(e)?m:m+e/500,x=isNaN(s)?m:m-s/200;return m=1*Si(m),b=ae*Si(b),x=ke*Si(x),[Pi(3.1338561*b-1.6168667*m-.4906146*x),Pi(-.9787684*b+1.9161415*m+.033454*x),Pi(.0719453*b-.2289914*m+1.4052427*x),h]}function Pi(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function Si(r){return r>bt?r*r*r:mt*(r-Ue)}function jr(r){return parseInt(r.padEnd(2,r),16)/255}function yn(r,e){return mr(e?r/100:r,0,1)}function mr(r,e,s){return Math.min(Math.max(e,r),s)}function rs(r){return!r.some(Number.isNaN)}const ns={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 Ai{constructor(e,s,h,m=1,b=!0){this.r=e,this.g=s,this.b=h,this.a=m,b||(this.r*=m,this.g*=m,this.b*=m,m||this.overwriteGetter("rgb",[e,s,h,m]))}static parse(e){if(e instanceof Ai)return e;if(typeof e!="string")return;const s=function(h){if((h=h.toLowerCase().trim())==="transparent")return[0,0,0,0];const m=ns[h];if(m){const[x,k,M]=m;return[x/255,k/255,M/255,1]}if(h.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(h)){const x=h.length<6?1:2;let k=1;return[jr(h.slice(k,k+=x)),jr(h.slice(k,k+=x)),jr(h.slice(k,k+=x)),jr(h.slice(k,k+x)||"ff")]}if(h.startsWith("rgb")){const x=h.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[k,M,B,N,j,W,te,re,de,Se,Pe,qe]=x,Le=[N||" ",te||" ",Se].join("");if(Le===" "||Le===" /"||Le===",,"||Le===",,,"){const He=[B,W,de].join(""),rt=He==="%%%"?100:He===""?255:0;if(rt){const dt=[mr(+M/rt,0,1),mr(+j/rt,0,1),mr(+re/rt,0,1),Pe?yn(+Pe,qe):1];if(rs(dt))return dt}}return}}const b=h.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(b){const[x,k,M,B,N,j,W,te,re]=b,de=[M||" ",N||" ",W].join("");if(de===" "||de===" /"||de===",,"||de===",,,"){const Se=[+k,mr(+B,0,100),mr(+j,0,100),te?yn(+te,re):1];if(rs(Se))return function([Pe,qe,Le,He]){function rt(dt){const Vt=(dt+Pe/30)%12,Ht=qe*Math.min(Le,1-Le);return Le-Ht*Math.max(-1,Math.min(Vt-3,9-Vt,1))}return Pe=Yt(Pe),qe/=100,Le/=100,[rt(0),rt(8),rt(4),He]}(Se)}}}(e);return s?new Ai(...s,!1):void 0}get rgb(){const{r:e,g:s,b:h,a:m}=this,b=m||1/0;return this.overwriteGetter("rgb",[e/b,s/b,h/b,m])}get hcl(){return this.overwriteGetter("hcl",function(e){const[s,h,m,b]=ni(e),x=Math.sqrt(h*h+m*m);return[Math.round(1e4*x)?Yt(Math.atan2(m,h)*di):NaN,x,s,b]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ni(this.rgb))}overwriteGetter(e,s){return Object.defineProperty(this,e,{value:s}),s}toString(){const[e,s,h,m]=this.rgb;return`rgba(${[e,s,h].map(b=>Math.round(255*b)).join(",")},${m})`}}Ai.black=new Ai(0,0,0,1),Ai.white=new Ai(1,1,1,1),Ai.transparent=new Ai(0,0,0,0),Ai.red=new Ai(1,0,0,1);class Jr{constructor(e,s,h){this.sensitivity=e?s?"variant":"case":s?"accent":"base",this.locale=h,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,s){return this.collator.compare(e,s)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class un{constructor(e,s,h,m,b){this.text=e,this.image=s,this.scale=h,this.fontStack=m,this.textColor=b}}class lr{constructor(e){this.sections=e}static fromString(e){return new lr([new un(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 lr?e:lr.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class Dr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Dr)return e;if(typeof e=="number")return new Dr([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const s of e)if(typeof s!="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 Dr(e)}}toString(){return JSON.stringify(this.values)}}const to=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class kr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof kr)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let s=0;s=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof s=="number"&&s>=0&&s<=255?h===void 0||typeof h=="number"&&h>=0&&h<=1?null:`Invalid rgba value [${[r,e,s,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof h=="number"?[r,e,s,h]:[r,e,s]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function vn(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof Ai||r instanceof Jr||r instanceof lr||r instanceof Dr||r instanceof kr||r instanceof Lr)return!0;if(Array.isArray(r)){for(const e of r)if(!vn(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!vn(r[e]))return!1;return!0}return!1}function yi(r){if(r===null)return or;if(typeof r=="string")return bi;if(typeof r=="boolean")return wi;if(typeof r=="number")return zt;if(r instanceof Ai)return Sr;if(r instanceof Jr)return cn;if(r instanceof lr)return be;if(r instanceof Dr)return G;if(r instanceof kr)return oe;if(r instanceof Lr)return K;if(Array.isArray(r)){const e=r.length;let s;for(const h of r){const m=yi(h);if(s){if(s===m)continue;s=pi;break}s=m}return we(s||pi,e)}return $r}function vs(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof Ai||r instanceof lr||r instanceof Dr||r instanceof kr||r instanceof Lr?r.toString():JSON.stringify(r)}class Yr{constructor(e,s){this.type=e,this.value=s}static parse(e,s){if(e.length!==2)return s.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!vn(e[1]))return s.error("invalid value");const h=e[1];let m=yi(h);const b=s.expectedType;return m.kind!=="array"||m.N!==0||!b||b.kind!=="array"||typeof b.N=="number"&&b.N!==0||(m=b),new Yr(m,h)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class gr{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ba={string:bi,number:zt,boolean:wi,object:$r};class Ln{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");let h,m=1;const b=e[0];if(b==="array"){let k,M;if(e.length>2){const B=e[1];if(typeof B!="string"||!(B in ba)||B==="object")return s.error('The item type argument of "array" must be one of string, number, boolean',1);k=ba[B],m++}else k=pi;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return s.error('The length argument to "array" must be a positive integer literal',2);M=e[2],m++}h=we(k,M)}else{if(!ba[b])throw new Error(`Types doesn't contain name = ${b}`);h=ba[b]}const x=[];for(;me.outputDefined())}}const Lc={"to-boolean":wi,"to-color":Sr,"to-number":zt,"to-string":bi};class as{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");const h=e[0];if(!Lc[h])throw new Error(`Can't parse ${h} as it is not part of the known types`);if((h==="to-boolean"||h==="to-string")&&e.length!==2)return s.error("Expected one argument.");const m=Lc[h],b=[];for(let x=1;x4?`Invalid rbga value ${JSON.stringify(s)}: expected an array containing either three or four numeric values.`:ss(s[0],s[1],s[2],s[3]),!h))return new Ai(s[0]/255,s[1]/255,s[2]/255,s[3])}throw new gr(h||`Could not parse color from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"padding":{let s;for(const h of this.args){s=h.evaluate(e);const m=Dr.parse(s);if(m)return m}throw new gr(`Could not parse padding from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"variableAnchorOffsetCollection":{let s;for(const h of this.args){s=h.evaluate(e);const m=kr.parse(s);if(m)return m}throw new gr(`Could not parse variableAnchorOffsetCollection from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"number":{let s=null;for(const h of this.args){if(s=h.evaluate(e),s===null)return 0;const m=Number(s);if(!isNaN(m))return m}throw new gr(`Could not convert ${JSON.stringify(s)} to number.`)}case"formatted":return lr.fromString(vs(this.args[0].evaluate(e)));case"resolvedImage":return Lr.fromString(vs(this.args[0].evaluate(e)));default:return vs(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const Rc=["Unknown","Point","LineString","Polygon"];class Bc{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"?Rc[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 s=this._parseColorCache[e];return s||(s=this._parseColorCache[e]=Ai.parse(e)),s}}class io{constructor(e,s,h=[],m,b=new Er,x=[]){this.registry=e,this.path=h,this.key=h.map(k=>`[${k}]`).join(""),this.scope=b,this.errors=x,this.expectedType=m,this._isConstant=s}parse(e,s,h,m,b={}){return s?this.concat(s,h,m)._parse(e,b):this._parse(e,b)}_parse(e,s){function h(m,b,x){return x==="assert"?new Ln(b,[m]):x==="coerce"?new as(b,[m]):m}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 m=e[0];if(typeof m!="string")return this.error(`Expression name must be a string, but found ${typeof m} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const b=this.registry[m];if(b){let x=b.parse(e,this);if(!x)return null;if(this.expectedType){const k=this.expectedType,M=x.type;if(k.kind!=="string"&&k.kind!=="number"&&k.kind!=="boolean"&&k.kind!=="object"&&k.kind!=="array"||M.kind!=="value")if(k.kind!=="color"&&k.kind!=="formatted"&&k.kind!=="resolvedImage"||M.kind!=="value"&&M.kind!=="string")if(k.kind!=="padding"||M.kind!=="value"&&M.kind!=="number"&&M.kind!=="array")if(k.kind!=="variableAnchorOffsetCollection"||M.kind!=="value"&&M.kind!=="array"){if(this.checkSubtype(k,M))return null}else x=h(x,k,s.typeAnnotation||"coerce");else x=h(x,k,s.typeAnnotation||"coerce");else x=h(x,k,s.typeAnnotation||"coerce");else x=h(x,k,s.typeAnnotation||"assert")}if(!(x instanceof Yr)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const k=new Bc;try{x=new Yr(x.type,x.evaluate(k))}catch(M){return this.error(M.message),null}}return x}return this.error(`Unknown expression "${m}". 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,s,h){const m=typeof e=="number"?this.path.concat(e):this.path,b=h?this.scope.concat(h):this.scope;return new io(this.registry,this._isConstant,m,s||null,b,this.errors)}error(e,...s){const h=`${this.key}${s.map(m=>`[${m}]`).join("")}`;this.errors.push(new xr(h,e))}checkSubtype(e,s){const h=Re(e,s);return h&&this.error(h),h}}class ro{constructor(e,s,h){this.type=cn,this.locale=h,this.caseSensitive=e,this.diacriticSensitive=s}static parse(e,s){if(e.length!==2)return s.error("Expected one argument.");const h=e[1];if(typeof h!="object"||Array.isArray(h))return s.error("Collator options argument must be an object.");const m=s.parse(h["case-sensitive"]!==void 0&&h["case-sensitive"],1,wi);if(!m)return null;const b=s.parse(h["diacritic-sensitive"]!==void 0&&h["diacritic-sensitive"],1,wi);if(!b)return null;let x=null;return h.locale&&(x=s.parse(h.locale,1,bi),!x)?null:new ro(m,b,x)}evaluate(e){return new Jr(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 bs=8192;function no(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function wa(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function uh(r,e){const s=(180+r[0])/360,h=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,m=Math.pow(2,e.z);return[Math.round(s*m*bs),Math.round(h*m*bs)]}function hh(r,e,s){const h=r[0]-e[0],m=r[1]-e[1],b=r[0]-s[0],x=r[1]-s[1];return h*x-b*m==0&&h*b<=0&&m*x<=0}function xa(r,e){let s=!1;for(let x=0,k=e.length;x(h=r)[1]!=(b=M[B+1])[1]>h[1]&&h[0]<(b[0]-m[0])*(h[1]-m[1])/(b[1]-m[1])+m[0]&&(s=!s)}}var h,m,b;return s}function fh(r,e){for(let s=0;s0&&k<0||x<0&&k>0}function dh(r,e,s){for(const B of s)for(let N=0;Ns[2]){const m=.5*h;let b=r[0]-s[0]>m?-h:s[0]-r[0]>m?h:0;b===0&&(b=r[0]-s[2]>m?-h:s[2]-r[0]>m?h:0),r[0]+=b}no(e,r)}function ul(r,e,s,h){const m=Math.pow(2,h.z)*bs,b=[h.x*bs,h.y*bs],x=[];for(const k of r)for(const M of k){const B=[M.x+b[0],M.y+b[1]];cl(B,e,s,m),x.push(B)}return x}function Uc(r,e,s,h){const m=Math.pow(2,h.z)*bs,b=[h.x*bs,h.y*bs],x=[];for(const M of r){const B=[];for(const N of M){const j=[N.x+b[0],N.y+b[1]];no(e,j),B.push(j)}x.push(B)}if(e[2]-e[0]<=m/2){(k=e)[0]=k[1]=1/0,k[2]=k[3]=-1/0;for(const M of x)for(const B of M)cl(B,e,s,m)}var k;return x}class Ls{constructor(e,s){this.type=wi,this.geojson=e,this.geometries=s}static parse(e,s){if(e.length!==2)return s.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(vn(e[1])){const h=e[1];if(h.type==="FeatureCollection")for(let m=0;m!Array.isArray(B)||B.length===e.length-1);let M=null;for(const[B,N]of k){M=new io(s.registry,ao,s.path,null,s.scope);const j=[];let W=!1;for(let te=1;te{return W=j,Array.isArray(W)?`(${W.map(Ie).join(", ")})`:`(${Ie(W.type)}...)`;var W}).join(" | "),N=[];for(let j=1;j{s=e?s&&ao(h):s&&h instanceof Yr}),!!s&&oo(r)&&Ws(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function oo(r){if(r instanceof Rn&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof Ls)return!1;let e=!0;return r.eachChild(s=>{e&&!oo(s)&&(e=!1)}),e}function Ea(r){if(r instanceof Rn&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(s=>{e&&!Ea(s)&&(e=!1)}),e}function Ws(r,e){if(r instanceof Rn&&e.indexOf(r.name)>=0)return!1;let s=!0;return r.eachChild(h=>{s&&!Ws(h,e)&&(s=!1)}),s}function Rs(r,e){const s=r.length-1;let h,m,b=0,x=s,k=0;for(;b<=x;)if(k=Math.floor((b+x)/2),h=r[k],m=r[k+1],h<=e){if(k===s||ee))throw new gr("Input is not a number.");x=k-1}return 0}class Oi{constructor(e,s,h){this.type=e,this.input=s,this.labels=[],this.outputs=[];for(const[m,b]of h)this.labels.push(m),this.outputs.push(b)}static parse(e,s){if(e.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return s.error("Expected an even number of arguments.");const h=s.parse(e[1],1,zt);if(!h)return null;const m=[];let b=null;s.expectedType&&s.expectedType.kind!=="value"&&(b=s.expectedType);for(let x=1;x=k)return s.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',B);const j=s.parse(M,N,b);if(!j)return null;b=b||j.type,m.push([k,j])}return new Oi(b,h,m)}evaluate(e){const s=this.labels,h=this.outputs;if(s.length===1)return h[0].evaluate(e);const m=this.input.evaluate(e);if(m<=s[0])return h[0].evaluate(e);const b=s.length;return m>=s[b-1]?h[b-1].evaluate(e):h[Rs(s,m)].evaluate(e)}eachChild(e){e(this.input);for(const s of this.outputs)e(s)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Bs(r,e,s){return r+s*(e-r)}function lo(r,e,s){return r.map((h,m)=>Bs(h,e[m],s))}const bn={number:Bs,color:function(r,e,s,h="rgb"){switch(h){case"rgb":{const[m,b,x,k]=lo(r.rgb,e.rgb,s);return new Ai(m,b,x,k,!1)}case"hcl":{const[m,b,x,k]=r.hcl,[M,B,N,j]=e.hcl;let W,te;if(isNaN(m)||isNaN(M))isNaN(m)?isNaN(M)?W=NaN:(W=M,x!==1&&x!==0||(te=B)):(W=m,N!==1&&N!==0||(te=b));else{let qe=M-m;M>m&&qe>180?qe-=360:M180&&(qe+=360),W=m+s*qe}const[re,de,Se,Pe]=function([qe,Le,He,rt]){return qe=isNaN(qe)?0:qe*Zt,gi([He,Math.cos(qe)*Le,Math.sin(qe)*Le,rt])}([W,te??Bs(b,B,s),Bs(x,N,s),Bs(k,j,s)]);return new Ai(re,de,Se,Pe,!1)}case"lab":{const[m,b,x,k]=gi(lo(r.lab,e.lab,s));return new Ai(m,b,x,k,!1)}}},array:lo,padding:function(r,e,s){return new Dr(lo(r.values,e.values,s))},variableAnchorOffsetCollection:function(r,e,s){const h=r.values,m=e.values;if(h.length!==m.length)throw new gr(`Cannot interpolate values of different length. from: ${r.toString()}, to: ${e.toString()}`);const b=[];for(let x=0;xtypeof N!="number"||N<0||N>1))return s.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);m={name:"cubic-bezier",controlPoints:B}}}if(e.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return s.error("Expected an even number of arguments.");if(b=s.parse(b,2,zt),!b)return null;const k=[];let M=null;h==="interpolate-hcl"||h==="interpolate-lab"?M=Sr:s.expectedType&&s.expectedType.kind!=="value"&&(M=s.expectedType);for(let B=0;B=N)return s.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',W);const re=s.parse(j,te,M);if(!re)return null;M=M||re.type,k.push([N,re])}return J(M,zt)||J(M,Sr)||J(M,G)||J(M,oe)||J(M,we(zt))?new wn(M,h,m,b,k):s.error(`Type ${Ie(M)} is not interpolatable.`)}evaluate(e){const s=this.labels,h=this.outputs;if(s.length===1)return h[0].evaluate(e);const m=this.input.evaluate(e);if(m<=s[0])return h[0].evaluate(e);const b=s.length;if(m>=s[b-1])return h[b-1].evaluate(e);const x=Rs(s,m),k=wn.interpolationFactor(this.interpolation,m,s[x],s[x+1]),M=h[x].evaluate(e),B=h[x+1].evaluate(e);switch(this.operator){case"interpolate":return bn[this.type.kind](M,B,k);case"interpolate-hcl":return bn.color(M,B,k,"hcl");case"interpolate-lab":return bn.color(M,B,k,"lab")}}eachChild(e){e(this.input);for(const s of this.outputs)e(s)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function hl(r,e,s,h){const m=h-s,b=r-s;return m===0?0:e===1?b/m:(Math.pow(e,b)-1)/(Math.pow(e,m)-1)}class co{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expectected at least one argument.");let h=null;const m=s.expectedType;m&&m.kind!=="value"&&(h=m);const b=[];for(const k of e.slice(1)){const M=s.parse(k,1+b.length,h,void 0,{typeAnnotation:"omit"});if(!M)return null;h=h||M.type,b.push(M)}if(!h)throw new Error("No output type");const x=m&&b.some(k=>Re(m,k.type));return new co(x?pi:h,b)}evaluate(e){let s,h=null,m=0;for(const b of this.args)if(m++,h=b.evaluate(e),h&&h instanceof Lr&&!h.available&&(s||(s=h.name),h=null,m===this.args.length&&(h=s)),h!==null)break;return h}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class uo{constructor(e,s){this.type=s.type,this.bindings=[].concat(e),this.result=s}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const s of this.bindings)e(s[1]);e(this.result)}static parse(e,s){if(e.length<4)return s.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const h=[];for(let b=1;b=h.length)throw new gr(`Array index out of bounds: ${s} > ${h.length-1}.`);if(s!==Math.floor(s))throw new gr(`Array index must be an integer, but found ${s} instead.`);return h[s]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class dl{constructor(e,s){this.type=wi,this.needle=e,this.haystack=s}static parse(e,s){if(e.length!==3)return s.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const h=s.parse(e[1],1,pi),m=s.parse(e[2],2,pi);return h&&m?ze(h.type,[wi,bi,zt,or,pi])?new dl(h,m):s.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ie(h.type)} instead`):null}evaluate(e){const s=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!h)return!1;if(!H(s,["boolean","string","number","null"]))throw new gr(`Expected first argument to be of type boolean, string, number or null, but found ${Ie(yi(s))} instead.`);if(!H(h,["string","array"]))throw new gr(`Expected second argument to be of type array or string, but found ${Ie(yi(h))} instead.`);return h.indexOf(s)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class ho{constructor(e,s,h){this.type=zt,this.needle=e,this.haystack=s,this.fromIndex=h}static parse(e,s){if(e.length<=2||e.length>=5)return s.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=s.parse(e[1],1,pi),m=s.parse(e[2],2,pi);if(!h||!m)return null;if(!ze(h.type,[wi,bi,zt,or,pi]))return s.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ie(h.type)} instead`);if(e.length===4){const b=s.parse(e[3],3,zt);return b?new ho(h,m,b):null}return new ho(h,m)}evaluate(e){const s=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!H(s,["boolean","string","number","null"]))throw new gr(`Expected first argument to be of type boolean, string, number or null, but found ${Ie(yi(s))} instead.`);if(!H(h,["string","array"]))throw new gr(`Expected second argument to be of type array or string, but found ${Ie(yi(h))} instead.`);if(this.fromIndex){const m=this.fromIndex.evaluate(e);return h.indexOf(s,m)}return h.indexOf(s)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class pl{constructor(e,s,h,m,b,x){this.inputType=e,this.type=s,this.input=h,this.cases=m,this.outputs=b,this.otherwise=x}static parse(e,s){if(e.length<5)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return s.error("Expected an even number of arguments.");let h,m;s.expectedType&&s.expectedType.kind!=="value"&&(m=s.expectedType);const b={},x=[];for(let B=2;BNumber.MAX_SAFE_INTEGER)return W.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof re=="number"&&Math.floor(re)!==re)return W.error("Numeric branch labels must be integer values.");if(h){if(W.checkSubtype(h,yi(re)))return null}else h=yi(re);if(b[String(re)]!==void 0)return W.error("Branch labels must be unique.");b[String(re)]=x.length}const te=s.parse(j,B,m);if(!te)return null;m=m||te.type,x.push(te)}const k=s.parse(e[1],1,pi);if(!k)return null;const M=s.parse(e[e.length-1],e.length-1,m);return M?k.type.kind!=="value"&&s.concat(1).checkSubtype(h,k.type)?null:new pl(h,m,k,b,x,M):null}evaluate(e){const s=this.input.evaluate(e);return(yi(s)===this.inputType&&this.outputs[this.cases[s]]||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 ml{constructor(e,s,h){this.type=e,this.branches=s,this.otherwise=h}static parse(e,s){if(e.length<4)return s.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return s.error("Expected an odd number of arguments.");let h;s.expectedType&&s.expectedType.kind!=="value"&&(h=s.expectedType);const m=[];for(let x=1;xs.outputDefined())&&this.otherwise.outputDefined()}}class fo{constructor(e,s,h,m){this.type=e,this.input=s,this.beginIndex=h,this.endIndex=m}static parse(e,s){if(e.length<=2||e.length>=5)return s.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=s.parse(e[1],1,pi),m=s.parse(e[2],2,zt);if(!h||!m)return null;if(!ze(h.type,[we(pi),bi,pi]))return s.error(`Expected first argument to be of type array or string, but found ${Ie(h.type)} instead`);if(e.length===4){const b=s.parse(e[3],3,zt);return b?new fo(h.type,h,m,b):null}return new fo(h.type,h,m)}evaluate(e){const s=this.input.evaluate(e),h=this.beginIndex.evaluate(e);if(!H(s,["string","array"]))throw new gr(`Expected first argument to be of type array or string, but found ${Ie(yi(s))} instead.`);if(this.endIndex){const m=this.endIndex.evaluate(e);return s.slice(h,m)}return s.slice(h)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Vc(r,e){return r==="=="||r==="!="?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 $c(r,e,s,h){return h.compare(e,s)===0}function Hs(r,e,s){const h=r!=="=="&&r!=="!=";return class jy{constructor(b,x,k){this.type=wi,this.lhs=b,this.rhs=x,this.collator=k,this.hasUntypedArgument=b.type.kind==="value"||x.type.kind==="value"}static parse(b,x){if(b.length!==3&&b.length!==4)return x.error("Expected two or three arguments.");const k=b[0];let M=x.parse(b[1],1,pi);if(!M)return null;if(!Vc(k,M.type))return x.concat(1).error(`"${k}" comparisons are not supported for type '${Ie(M.type)}'.`);let B=x.parse(b[2],2,pi);if(!B)return null;if(!Vc(k,B.type))return x.concat(2).error(`"${k}" comparisons are not supported for type '${Ie(B.type)}'.`);if(M.type.kind!==B.type.kind&&M.type.kind!=="value"&&B.type.kind!=="value")return x.error(`Cannot compare types '${Ie(M.type)}' and '${Ie(B.type)}'.`);h&&(M.type.kind==="value"&&B.type.kind!=="value"?M=new Ln(B.type,[M]):M.type.kind!=="value"&&B.type.kind==="value"&&(B=new Ln(M.type,[B])));let N=null;if(b.length===4){if(M.type.kind!=="string"&&B.type.kind!=="string"&&M.type.kind!=="value"&&B.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(N=x.parse(b[3],3,cn),!N)return null}return new jy(M,B,N)}evaluate(b){const x=this.lhs.evaluate(b),k=this.rhs.evaluate(b);if(h&&this.hasUntypedArgument){const M=yi(x),B=yi(k);if(M.kind!==B.kind||M.kind!=="string"&&M.kind!=="number")throw new gr(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${M.kind}, ${B.kind}) instead.`)}if(this.collator&&!h&&this.hasUntypedArgument){const M=yi(x),B=yi(k);if(M.kind!=="string"||B.kind!=="string")return e(b,x,k)}return this.collator?s(b,x,k,this.collator.evaluate(b)):e(b,x,k)}eachChild(b){b(this.lhs),b(this.rhs),this.collator&&b(this.collator)}outputDefined(){return!0}}}const ph=Hs("==",function(r,e,s){return e===s},$c),mh=Hs("!=",function(r,e,s){return e!==s},function(r,e,s,h){return!$c(0,e,s,h)}),gh=Hs("<",function(r,e,s){return e",function(r,e,s){return e>s},function(r,e,s,h){return h.compare(e,s)>0}),yh=Hs("<=",function(r,e,s){return e<=s},function(r,e,s,h){return h.compare(e,s)<=0}),vh=Hs(">=",function(r,e,s){return e>=s},function(r,e,s,h){return h.compare(e,s)>=0});class gl{constructor(e,s,h,m,b){this.type=bi,this.number=e,this.locale=s,this.currency=h,this.minFractionDigits=m,this.maxFractionDigits=b}static parse(e,s){if(e.length!==3)return s.error("Expected two arguments.");const h=s.parse(e[1],1,zt);if(!h)return null;const m=e[2];if(typeof m!="object"||Array.isArray(m))return s.error("NumberFormat options argument must be an object.");let b=null;if(m.locale&&(b=s.parse(m.locale,1,bi),!b))return null;let x=null;if(m.currency&&(x=s.parse(m.currency,1,bi),!x))return null;let k=null;if(m["min-fraction-digits"]&&(k=s.parse(m["min-fraction-digits"],1,zt),!k))return null;let M=null;return m["max-fraction-digits"]&&(M=s.parse(m["max-fraction-digits"],1,zt),!M)?null:new gl(h,b,x,k,M)}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 po{constructor(e){this.type=be,this.sections=e}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");const h=e[1];if(!Array.isArray(h)&&typeof h=="object")return s.error("First argument must be an image or text section.");const m=[];let b=!1;for(let x=1;x<=e.length-1;++x){const k=e[x];if(b&&typeof k=="object"&&!Array.isArray(k)){b=!1;let M=null;if(k["font-scale"]&&(M=s.parse(k["font-scale"],1,zt),!M))return null;let B=null;if(k["text-font"]&&(B=s.parse(k["text-font"],1,we(bi)),!B))return null;let N=null;if(k["text-color"]&&(N=s.parse(k["text-color"],1,Sr),!N))return null;const j=m[m.length-1];j.scale=M,j.font=B,j.textColor=N}else{const M=s.parse(e[x],1,pi);if(!M)return null;const B=M.type.kind;if(B!=="string"&&B!=="value"&&B!=="null"&&B!=="resolvedImage")return s.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");b=!0,m.push({content:M,scale:null,font:null,textColor:null})}}return new po(m)}evaluate(e){return new lr(this.sections.map(s=>{const h=s.content.evaluate(e);return yi(h)===K?new un("",h,null,null,null):new un(vs(h),null,s.scale?s.scale.evaluate(e):null,s.font?s.font.evaluate(e).join(","):null,s.textColor?s.textColor.evaluate(e):null)}))}eachChild(e){for(const s of this.sections)e(s.content),s.scale&&e(s.scale),s.font&&e(s.font),s.textColor&&e(s.textColor)}outputDefined(){return!1}}class _l{constructor(e){this.type=K,this.input=e}static parse(e,s){if(e.length!==2)return s.error("Expected two arguments.");const h=s.parse(e[1],1,bi);return h?new _l(h):s.error("No image name provided.")}evaluate(e){const s=this.input.evaluate(e),h=Lr.fromString(s);return h&&e.availableImages&&(h.available=e.availableImages.indexOf(s)>-1),h}eachChild(e){e(this.input)}outputDefined(){return!1}}class yl{constructor(e){this.type=zt,this.input=e}static parse(e,s){if(e.length!==2)return s.error(`Expected 1 argument, but found ${e.length-1} instead.`);const h=s.parse(e[1],1);return h?h.type.kind!=="array"&&h.type.kind!=="string"&&h.type.kind!=="value"?s.error(`Expected argument of type string or array, but found ${Ie(h.type)} instead.`):new yl(h):null}evaluate(e){const s=this.input.evaluate(e);if(typeof s=="string"||Array.isArray(s))return s.length;throw new gr(`Expected value to be of type string or array, but found ${Ie(yi(s))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const Ks={"==":ph,"!=":mh,">":_h,"<":gh,">=":vh,"<=":yh,array:Ln,at:fl,boolean:Ln,case:ml,coalesce:co,collator:ro,format:po,image:_l,in:dl,"index-of":ho,interpolate:wn,"interpolate-hcl":wn,"interpolate-lab":wn,length:yl,let:uo,literal:Yr,match:pl,number:Ln,"number-format":gl,object:Ln,slice:fo,step:Oi,string:Ln,"to-boolean":as,"to-color":as,"to-number":as,"to-string":as,var:so,within:Ls};function jc(r,[e,s,h,m]){e=e.evaluate(r),s=s.evaluate(r),h=h.evaluate(r);const b=m?m.evaluate(r):1,x=ss(e,s,h,b);if(x)throw new gr(x);return new Ai(e/255,s/255,h/255,b,!1)}function qc(r,e){return r in e}function vl(r,e){const s=e[r];return s===void 0?null:s}function Os(r){return{type:r}}function mo(r){return{result:"success",value:r}}function Xs(r){return{result:"error",value:r}}function Js(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Zc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function bl(r){return!!r.expression&&r.expression.interpolated}function mi(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function go(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Bi(r){return r}function _o(r,e){const s=e.type==="color",h=r.stops&&typeof r.stops[0][0]=="object",m=h||!(h||r.property!==void 0),b=r.type||(bl(e)?"exponential":"interval");if(s||e.type==="padding"){const N=s?Ai.parse:Dr.parse;(r=Ji({},r)).stops&&(r.stops=r.stops.map(j=>[j[0],N(j[1])])),r.default=N(r.default?r.default:e.default)}if(r.colorSpace&&(x=r.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var x;let k,M,B;if(b==="exponential")k=wl;else if(b==="interval")k=yo;else if(b==="categorical"){k=er,M=Object.create(null);for(const N of r.stops)M[N[0]]=N[1];B=typeof r.stops[0][0]}else{if(b!=="identity")throw new Error(`Unknown function type "${b}"`);k=bh}if(h){const N={},j=[];for(let re=0;rere[0]),evaluate:({zoom:re},de)=>wl({stops:W,base:r.base},e,re).evaluate(re,de)}}if(m){const N=b==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:N,interpolationFactor:wn.interpolationFactor.bind(void 0,N),zoomStops:r.stops.map(j=>j[0]),evaluate:({zoom:j})=>k(r,e,j,M,B)}}return{kind:"source",evaluate(N,j){const W=j&&j.properties?j.properties[r.property]:void 0;return W===void 0?Ki(r.default,e.default):k(r,e,W,M,B)}}}function Ki(r,e,s){return r!==void 0?r:e!==void 0?e:s!==void 0?s:void 0}function er(r,e,s,h,m){return Ki(typeof s===m?h[s]:void 0,r.default,e.default)}function yo(r,e,s){if(mi(s)!=="number")return Ki(r.default,e.default);const h=r.stops.length;if(h===1||s<=r.stops[0][0])return r.stops[0][1];if(s>=r.stops[h-1][0])return r.stops[h-1][1];const m=Rs(r.stops.map(b=>b[0]),s);return r.stops[m][1]}function wl(r,e,s){const h=r.base!==void 0?r.base:1;if(mi(s)!=="number")return Ki(r.default,e.default);const m=r.stops.length;if(m===1||s<=r.stops[0][0])return r.stops[0][1];if(s>=r.stops[m-1][0])return r.stops[m-1][1];const b=Rs(r.stops.map(N=>N[0]),s),x=function(N,j,W,te){const re=te-W,de=N-W;return re===0?0:j===1?de/re:(Math.pow(j,de)-1)/(Math.pow(j,re)-1)}(s,h,r.stops[b][0],r.stops[b+1][0]),k=r.stops[b][1],M=r.stops[b+1][1],B=bn[e.type]||Bi;return typeof k.evaluate=="function"?{evaluate(...N){const j=k.evaluate.apply(void 0,N),W=M.evaluate.apply(void 0,N);if(j!==void 0&&W!==void 0)return B(j,W,x,r.colorSpace)}}:B(k,M,x,r.colorSpace)}function bh(r,e,s){switch(e.type){case"color":s=Ai.parse(s);break;case"formatted":s=lr.fromString(s.toString());break;case"resolvedImage":s=Lr.fromString(s.toString());break;case"padding":s=Dr.parse(s);break;default:mi(s)===e.type||e.type==="enum"&&e.values[s]||(s=void 0)}return Ki(s,r.default,e.default)}Rn.register(Ks,{error:[{kind:"error"},[bi],(r,[e])=>{throw new gr(e.evaluate(r))}],typeof:[bi,[pi],(r,[e])=>Ie(yi(e.evaluate(r)))],"to-rgba":[we(zt,4),[Sr],(r,[e])=>{const[s,h,m,b]=e.evaluate(r).rgb;return[255*s,255*h,255*m,b]}],rgb:[Sr,[zt,zt,zt],jc],rgba:[Sr,[zt,zt,zt,zt],jc],has:{type:wi,overloads:[[[bi],(r,[e])=>qc(e.evaluate(r),r.properties())],[[bi,$r],(r,[e,s])=>qc(e.evaluate(r),s.evaluate(r))]]},get:{type:pi,overloads:[[[bi],(r,[e])=>vl(e.evaluate(r),r.properties())],[[bi,$r],(r,[e,s])=>vl(e.evaluate(r),s.evaluate(r))]]},"feature-state":[pi,[bi],(r,[e])=>vl(e.evaluate(r),r.featureState||{})],properties:[$r,[],r=>r.properties()],"geometry-type":[bi,[],r=>r.geometryType()],id:[pi,[],r=>r.id()],zoom:[zt,[],r=>r.globals.zoom],"heatmap-density":[zt,[],r=>r.globals.heatmapDensity||0],"line-progress":[zt,[],r=>r.globals.lineProgress||0],accumulated:[pi,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[zt,Os(zt),(r,e)=>{let s=0;for(const h of e)s+=h.evaluate(r);return s}],"*":[zt,Os(zt),(r,e)=>{let s=1;for(const h of e)s*=h.evaluate(r);return s}],"-":{type:zt,overloads:[[[zt,zt],(r,[e,s])=>e.evaluate(r)-s.evaluate(r)],[[zt],(r,[e])=>-e.evaluate(r)]]},"/":[zt,[zt,zt],(r,[e,s])=>e.evaluate(r)/s.evaluate(r)],"%":[zt,[zt,zt],(r,[e,s])=>e.evaluate(r)%s.evaluate(r)],ln2:[zt,[],()=>Math.LN2],pi:[zt,[],()=>Math.PI],e:[zt,[],()=>Math.E],"^":[zt,[zt,zt],(r,[e,s])=>Math.pow(e.evaluate(r),s.evaluate(r))],sqrt:[zt,[zt],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[zt,[zt],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[zt,[zt],(r,[e])=>Math.log(e.evaluate(r))],log2:[zt,[zt],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[zt,[zt],(r,[e])=>Math.sin(e.evaluate(r))],cos:[zt,[zt],(r,[e])=>Math.cos(e.evaluate(r))],tan:[zt,[zt],(r,[e])=>Math.tan(e.evaluate(r))],asin:[zt,[zt],(r,[e])=>Math.asin(e.evaluate(r))],acos:[zt,[zt],(r,[e])=>Math.acos(e.evaluate(r))],atan:[zt,[zt],(r,[e])=>Math.atan(e.evaluate(r))],min:[zt,Os(zt),(r,e)=>Math.min(...e.map(s=>s.evaluate(r)))],max:[zt,Os(zt),(r,e)=>Math.max(...e.map(s=>s.evaluate(r)))],abs:[zt,[zt],(r,[e])=>Math.abs(e.evaluate(r))],round:[zt,[zt],(r,[e])=>{const s=e.evaluate(r);return s<0?-Math.round(-s):Math.round(s)}],floor:[zt,[zt],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[zt,[zt],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[wi,[bi,pi],(r,[e,s])=>r.properties()[e.value]===s.value],"filter-id-==":[wi,[pi],(r,[e])=>r.id()===e.value],"filter-type-==":[wi,[bi],(r,[e])=>r.geometryType()===e.value],"filter-<":[wi,[bi,pi],(r,[e,s])=>{const h=r.properties()[e.value],m=s.value;return typeof h==typeof m&&h{const s=r.id(),h=e.value;return typeof s==typeof h&&s":[wi,[bi,pi],(r,[e,s])=>{const h=r.properties()[e.value],m=s.value;return typeof h==typeof m&&h>m}],"filter-id->":[wi,[pi],(r,[e])=>{const s=r.id(),h=e.value;return typeof s==typeof h&&s>h}],"filter-<=":[wi,[bi,pi],(r,[e,s])=>{const h=r.properties()[e.value],m=s.value;return typeof h==typeof m&&h<=m}],"filter-id-<=":[wi,[pi],(r,[e])=>{const s=r.id(),h=e.value;return typeof s==typeof h&&s<=h}],"filter->=":[wi,[bi,pi],(r,[e,s])=>{const h=r.properties()[e.value],m=s.value;return typeof h==typeof m&&h>=m}],"filter-id->=":[wi,[pi],(r,[e])=>{const s=r.id(),h=e.value;return typeof s==typeof h&&s>=h}],"filter-has":[wi,[pi],(r,[e])=>e.value in r.properties()],"filter-has-id":[wi,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[wi,[we(bi)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[wi,[we(pi)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[wi,[bi,we(pi)],(r,[e,s])=>s.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[wi,[bi,we(pi)],(r,[e,s])=>function(h,m,b,x){for(;b<=x;){const k=b+x>>1;if(m[k]===h)return!0;m[k]>h?x=k-1:b=k+1}return!1}(r.properties()[e.value],s.value,0,s.value.length-1)],all:{type:wi,overloads:[[[wi,wi],(r,[e,s])=>e.evaluate(r)&&s.evaluate(r)],[Os(wi),(r,e)=>{for(const s of e)if(!s.evaluate(r))return!1;return!0}]]},any:{type:wi,overloads:[[[wi,wi],(r,[e,s])=>e.evaluate(r)||s.evaluate(r)],[Os(wi),(r,e)=>{for(const s of e)if(s.evaluate(r))return!0;return!1}]]},"!":[wi,[wi],(r,[e])=>!e.evaluate(r)],"is-supported-script":[wi,[bi],(r,[e])=>{const s=r.globals&&r.globals.isSupportedScript;return!s||s(e.evaluate(r))}],upcase:[bi,[bi],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[bi,[bi],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[bi,Os(pi),(r,e)=>e.map(s=>vs(s.evaluate(r))).join("")],"resolved-locale":[bi,[cn],(r,[e])=>e.evaluate(r).resolvedLocale()]});class xl{constructor(e,s){var h;this.expression=e,this._warningHistory={},this._evaluator=new Bc,this._defaultValue=s?(h=s).type==="color"&&go(h.default)?new Ai(0,0,0,0):h.type==="color"?Ai.parse(h.default)||null:h.type==="padding"?Dr.parse(h.default)||null:h.type==="variableAnchorOffsetCollection"?kr.parse(h.default)||null:h.default===void 0?null:h.default:null,this._enumValues=s&&s.type==="enum"?s.values:null}evaluateWithoutErrorHandling(e,s,h,m,b,x){return this._evaluator.globals=e,this._evaluator.feature=s,this._evaluator.featureState=h,this._evaluator.canonical=m,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(e,s,h,m,b,x){this._evaluator.globals=e,this._evaluator.feature=s||null,this._evaluator.featureState=h||null,this._evaluator.canonical=m,this._evaluator.availableImages=b||null,this._evaluator.formattedSection=x||null;try{const k=this.expression.evaluate(this._evaluator);if(k==null||typeof k=="number"&&k!=k)return this._defaultValue;if(this._enumValues&&!(k in this._enumValues))throw new gr(`Expected value to be one of ${Object.keys(this._enumValues).map(M=>JSON.stringify(M)).join(", ")}, but found ${JSON.stringify(k)} instead.`);return k}catch(k){return this._warningHistory[k.message]||(this._warningHistory[k.message]=!0,typeof console<"u"&&console.warn(k.message)),this._defaultValue}}}function vo(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Ks}function bo(r,e){const s=new io(Ks,ao,[],e?function(m){const b={color:Sr,string:bi,number:zt,enum:bi,boolean:wi,formatted:be,padding:G,resolvedImage:K,variableAnchorOffsetCollection:oe};return m.type==="array"?we(b[m.value]||pi,m.length):b[m.type]}(e):void 0),h=s.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?mo(new xl(h,e)):Xs(s.errors)}class wo{constructor(e,s){this.kind=e,this._styleExpression=s,this.isStateDependent=e!=="constant"&&!Ea(s.expression)}evaluateWithoutErrorHandling(e,s,h,m,b,x){return this._styleExpression.evaluateWithoutErrorHandling(e,s,h,m,b,x)}evaluate(e,s,h,m,b,x){return this._styleExpression.evaluate(e,s,h,m,b,x)}}class xo{constructor(e,s,h,m){this.kind=e,this.zoomStops=h,this._styleExpression=s,this.isStateDependent=e!=="camera"&&!Ea(s.expression),this.interpolationType=m}evaluateWithoutErrorHandling(e,s,h,m,b,x){return this._styleExpression.evaluateWithoutErrorHandling(e,s,h,m,b,x)}evaluate(e,s,h,m,b,x){return this._styleExpression.evaluate(e,s,h,m,b,x)}interpolationFactor(e,s,h){return this.interpolationType?wn.interpolationFactor(this.interpolationType,e,s,h):0}}function El(r,e){const s=bo(r,e);if(s.result==="error")return s;const h=s.value.expression,m=oo(h);if(!m&&!Js(e))return Xs([new xr("","data expressions not supported")]);const b=Ws(h,["zoom"]);if(!b&&!Zc(e))return Xs([new xr("","zoom expressions not supported")]);const x=Ys(h);return x||b?x instanceof xr?Xs([x]):x instanceof wn&&!bl(e)?Xs([new xr("",'"interpolate" expressions cannot be used with this property')]):mo(x?new xo(m?"camera":"composite",s.value,x.labels,x instanceof wn?x.interpolation:void 0):new wo(m?"constant":"source",s.value)):Xs([new xr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Sa{constructor(e,s){this._parameters=e,this._specification=s,Ji(this,_o(this._parameters,this._specification))}static deserialize(e){return new Sa(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Ys(r){let e=null;if(r instanceof uo)e=Ys(r.result);else if(r instanceof co){for(const s of r.args)if(e=Ys(s),e)break}else(r instanceof Oi||r instanceof wn)&&r.input instanceof Rn&&r.input.name==="zoom"&&(e=r);return e instanceof xr||r.eachChild(s=>{const h=Ys(s);h instanceof xr?e=h:!e&&h?e=new xr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&h&&e!==h&&(e=new xr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Sl(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!Sl(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const wh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function kl(r){if(r==null)return{filter:()=>!0,needGeometry:!1};Sl(r)||(r=Eo(r));const e=bo(r,wh);if(e.result==="error")throw new Error(e.value.map(s=>`${s.key}: ${s.message}`).join(", "));return{filter:(s,h,m)=>e.value.evaluate(s,h,{},m),needGeometry:Gc(r)}}function xh(r,e){return re?1:0}function Gc(r){if(!Array.isArray(r))return!1;if(r[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?Tl(r[1],r[2],e):e==="any"?(s=r.slice(1),["any"].concat(s.map(Eo))):e==="all"?["all"].concat(r.slice(1).map(Eo)):e==="none"?["all"].concat(r.slice(1).map(Eo).map(ka)):e==="in"?Wc(r[1],r.slice(2)):e==="!in"?ka(Wc(r[1],r.slice(2))):e==="has"?Cl(r[1]):e==="!has"?ka(Cl(r[1])):e!=="within"||r;var s}function Tl(r,e,s){switch(r){case"$type":return[`filter-type-${s}`,e];case"$id":return[`filter-id-${s}`,e];default:return[`filter-${s}`,r,e]}}function Wc(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(s=>typeof s!=typeof e[0])?["filter-in-large",r,["literal",e.sort(xh)]]:["filter-in-small",r,["literal",e]]}}function Cl(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function ka(r){return["!",r]}function Qs(r){const e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let m="[";for(const b of r)m+=`${Qs(b)},`;return`${m}]`}const s=Object.keys(r).sort();let h="{";for(let m=0;mh.maximum?[new _t(e,s,`${s} is greater than the maximum value ${h.maximum}`)]:[]}function Al(r){const e=r.valueSpec,s=hr(r.value.type);let h,m,b,x={};const k=s!=="categorical"&&r.value.property===void 0,M=!k,B=mi(r.value.stops)==="array"&&mi(r.value.stops[0])==="array"&&mi(r.value.stops[0][0])==="object",N=Qr({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(te){if(s==="identity")return[new _t(te.key,te.value,'identity function may not have a "stops" property')];let re=[];const de=te.value;return re=re.concat(Ta({key:te.key,value:de,valueSpec:te.valueSpec,validateSpec:te.validateSpec,style:te.style,styleSpec:te.styleSpec,arrayElementValidator:j})),mi(de)==="array"&&de.length===0&&re.push(new _t(te.key,de,"array must have at least one stop")),re},default:function(te){return te.validateSpec({key:te.key,value:te.value,valueSpec:e,validateSpec:te.validateSpec,style:te.style,styleSpec:te.styleSpec})}}});return s==="identity"&&k&&N.push(new _t(r.key,r.value,'missing required property "property"')),s==="identity"||r.value.stops||N.push(new _t(r.key,r.value,'missing required property "stops"')),s==="exponential"&&r.valueSpec.expression&&!bl(r.valueSpec)&&N.push(new _t(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(M&&!Js(r.valueSpec)?N.push(new _t(r.key,r.value,"property functions not supported")):k&&!Zc(r.valueSpec)&&N.push(new _t(r.key,r.value,"zoom functions not supported"))),s!=="categorical"&&!B||r.value.property!==void 0||N.push(new _t(r.key,r.value,'"property" property is required')),N;function j(te){let re=[];const de=te.value,Se=te.key;if(mi(de)!=="array")return[new _t(Se,de,`array expected, ${mi(de)} found`)];if(de.length!==2)return[new _t(Se,de,`array length 2 expected, length ${de.length} found`)];if(B){if(mi(de[0])!=="object")return[new _t(Se,de,`object expected, ${mi(de[0])} found`)];if(de[0].zoom===void 0)return[new _t(Se,de,"object stop key must have zoom")];if(de[0].value===void 0)return[new _t(Se,de,"object stop key must have value")];if(b&&b>hr(de[0].zoom))return[new _t(Se,de[0].zoom,"stop zoom values must appear in ascending order")];hr(de[0].zoom)!==b&&(b=hr(de[0].zoom),m=void 0,x={}),re=re.concat(Qr({key:`${Se}[0]`,value:de[0],valueSpec:{zoom:{}},validateSpec:te.validateSpec,style:te.style,styleSpec:te.styleSpec,objectElementValidators:{zoom:Ca,value:W}}))}else re=re.concat(W({key:`${Se}[0]`,value:de[0],valueSpec:{},validateSpec:te.validateSpec,style:te.style,styleSpec:te.styleSpec},de));return vo(os(de[1]))?re.concat([new _t(`${Se}[1]`,de[1],"expressions are not allowed in function stops.")]):re.concat(te.validateSpec({key:`${Se}[1]`,value:de[1],valueSpec:e,validateSpec:te.validateSpec,style:te.style,styleSpec:te.styleSpec}))}function W(te,re){const de=mi(te.value),Se=hr(te.value),Pe=te.value!==null?te.value:re;if(h){if(de!==h)return[new _t(te.key,Pe,`${de} stop domain type must match previous stop domain type ${h}`)]}else h=de;if(de!=="number"&&de!=="string"&&de!=="boolean")return[new _t(te.key,Pe,"stop domain value must be a number, string, or boolean")];if(de!=="number"&&s!=="categorical"){let qe=`number expected, ${de} found`;return Js(e)&&s===void 0&&(qe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new _t(te.key,Pe,qe)]}return s!=="categorical"||de!=="number"||isFinite(Se)&&Math.floor(Se)===Se?s!=="categorical"&&de==="number"&&m!==void 0&&Senew _t(`${r.key}${h.key}`,r.value,h.message));const s=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!s.outputDefined())return[new _t(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!Ea(s))return[new _t(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Ea(s))return[new _t(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Ws(s,["zoom","feature-state"]))return[new _t(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!oo(s))return[new _t(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ws(r){const e=r.key,s=r.value,h=r.valueSpec,m=[];return Array.isArray(h.values)?h.values.indexOf(hr(s))===-1&&m.push(new _t(e,s,`expected one of [${h.values.join(", ")}], ${JSON.stringify(s)} found`)):Object.keys(h.values).indexOf(hr(s))===-1&&m.push(new _t(e,s,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(s)} found`)),m}function Pl(r){return Sl(os(r.value))?ea(Ji({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Hc(r)}function Hc(r){const e=r.value,s=r.key;if(mi(e)!=="array")return[new _t(s,e,`array expected, ${mi(e)} found`)];const h=r.styleSpec;let m,b=[];if(e.length<1)return[new _t(s,e,"filter array must have at least 1 element")];switch(b=b.concat(ws({key:`${s}[0]`,value:e[0],valueSpec:h.filter_operator,style:r.style,styleSpec:r.styleSpec})),hr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&hr(e[1])==="$type"&&b.push(new _t(s,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&b.push(new _t(s,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(m=mi(e[1]),m!=="string"&&b.push(new _t(`${s}[1]`,e[1],`string expected, ${m} found`)));for(let x=2;x{B in s&&e.push(new _t(h,s[B],`"${B}" is prohibited for ref layers`))}),m.layers.forEach(B=>{hr(B.id)===k&&(M=B)}),M?M.ref?e.push(new _t(h,s.ref,"ref cannot reference another ref layer")):x=hr(M.type):e.push(new _t(h,s.ref,`ref layer "${k}" not found`))}else if(x!=="background")if(s.source){const M=m.sources&&m.sources[s.source],B=M&&hr(M.type);M?B==="vector"&&x==="raster"?e.push(new _t(h,s.source,`layer "${s.id}" requires a raster source`)):B!=="raster-dem"&&x==="hillshade"?e.push(new _t(h,s.source,`layer "${s.id}" requires a raster-dem source`)):B==="raster"&&x!=="raster"?e.push(new _t(h,s.source,`layer "${s.id}" requires a vector source`)):B!=="vector"||s["source-layer"]?B==="raster-dem"&&x!=="hillshade"?e.push(new _t(h,s.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!s.paint||!s.paint["line-gradient"]||B==="geojson"&&M.lineMetrics||e.push(new _t(h,s,`layer "${s.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new _t(h,s,`layer "${s.id}" must specify a "source-layer"`)):e.push(new _t(h,s.source,`source "${s.source}" not found`))}else e.push(new _t(h,s,'missing required property "source"'));return e=e.concat(Qr({key:h,value:s,valueSpec:b.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${h}.type`,value:s.type,valueSpec:b.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:s,objectKey:"type"}),filter:Pl,layout:M=>Qr({layer:s,key:M.key,value:M.value,style:M.style,styleSpec:M.styleSpec,validateSpec:M.validateSpec,objectElementValidators:{"*":B=>Jc(Ji({layerType:x},B))}}),paint:M=>Qr({layer:s,key:M.key,value:M.value,style:M.style,styleSpec:M.styleSpec,validateSpec:M.validateSpec,objectElementValidators:{"*":B=>Xc(Ji({layerType:x},B))}})}})),e}function Wn(r){const e=r.value,s=r.key,h=mi(e);return h!=="string"?[new _t(s,e,`string expected, ${h} found`)]:[]}const xn={promoteId:function({key:r,value:e}){if(mi(e)==="string")return Wn({key:r,value:e});{const s=[];for(const h in e)s.push(...Wn({key:`${r}.${h}`,value:e[h]}));return s}}};function Aa(r){const e=r.value,s=r.key,h=r.styleSpec,m=r.style,b=r.validateSpec;if(!e.type)return[new _t(s,e,'"type" is required')];const x=hr(e.type);let k;switch(x){case"vector":case"raster":return k=Qr({key:s,value:e,valueSpec:h[`source_${x.replace("-","_")}`],style:r.style,styleSpec:h,objectElementValidators:xn,validateSpec:b}),k;case"raster-dem":return k=function(M){var B;const N=(B=M.sourceName)!==null&&B!==void 0?B:"",j=M.value,W=M.styleSpec,te=W.source_raster_dem,re=M.style;let de=[];const Se=mi(j);if(j===void 0)return de;if(Se!=="object")return de.push(new _t("source_raster_dem",j,`object expected, ${Se} found`)),de;const Pe=hr(j.encoding)==="custom",qe=["redFactor","greenFactor","blueFactor","baseShift"],Le=M.value.encoding?`"${M.value.encoding}"`:"Default";for(const He in j)!Pe&&qe.includes(He)?de.push(new _t(He,j[He],`In "${N}": "${He}" is only valid when "encoding" is set to "custom". ${Le} encoding found`)):te[He]?de=de.concat(M.validateSpec({key:He,value:j[He],valueSpec:te[He],validateSpec:M.validateSpec,style:re,styleSpec:W})):de.push(new _t(He,j[He],`unknown property "${He}"`));return de}({sourceName:s,value:e,style:r.style,styleSpec:h,validateSpec:b}),k;case"geojson":if(k=Qr({key:s,value:e,valueSpec:h.source_geojson,style:m,styleSpec:h,validateSpec:b,objectElementValidators:xn}),e.cluster)for(const M in e.clusterProperties){const[B,N]=e.clusterProperties[M],j=typeof B=="string"?[B,["accumulated"],["get",M]]:B;k.push(...ea({key:`${s}.${M}.map`,value:N,validateSpec:b,expressionContext:"cluster-map"})),k.push(...ea({key:`${s}.${M}.reduce`,value:j,validateSpec:b,expressionContext:"cluster-reduce"}))}return k;case"video":return Qr({key:s,value:e,valueSpec:h.source_video,style:m,validateSpec:b,styleSpec:h});case"image":return Qr({key:s,value:e,valueSpec:h.source_image,style:m,validateSpec:b,styleSpec:h});case"canvas":return[new _t(s,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ws({key:`${s}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:m,validateSpec:b,styleSpec:h})}}function Yc(r){const e=r.value,s=r.styleSpec,h=s.light,m=r.style;let b=[];const x=mi(e);if(e===void 0)return b;if(x!=="object")return b=b.concat([new _t("light",e,`object expected, ${x} found`)]),b;for(const k in e){const M=k.match(/^(.*)-transition$/);b=b.concat(M&&h[M[1]]&&h[M[1]].transition?r.validateSpec({key:k,value:e[k],valueSpec:s.transition,validateSpec:r.validateSpec,style:m,styleSpec:s}):h[k]?r.validateSpec({key:k,value:e[k],valueSpec:h[k],validateSpec:r.validateSpec,style:m,styleSpec:s}):[new _t(k,e[k],`unknown property "${k}"`)])}return b}function Qc(r){const e=r.value,s=r.styleSpec,h=s.terrain,m=r.style;let b=[];const x=mi(e);if(e===void 0)return b;if(x!=="object")return b=b.concat([new _t("terrain",e,`object expected, ${x} found`)]),b;for(const k in e)b=b.concat(h[k]?r.validateSpec({key:k,value:e[k],valueSpec:h[k],validateSpec:r.validateSpec,style:m,styleSpec:s}):[new _t(k,e[k],`unknown property "${k}"`)]);return b}function eu(r){let e=[];const s=r.value,h=r.key;if(Array.isArray(s)){const m=[],b=[];for(const x in s)s[x].id&&m.includes(s[x].id)&&e.push(new _t(h,s,`all the sprites' ids must be unique, but ${s[x].id} is duplicated`)),m.push(s[x].id),s[x].url&&b.includes(s[x].url)&&e.push(new _t(h,s,`all the sprites' URLs must be unique, but ${s[x].url} is duplicated`)),b.push(s[x].url),e=e.concat(Qr({key:`${h}[${x}]`,value:s[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}return Wn({key:h,value:s})}const ta={"*":()=>[],array:Ta,boolean:function(r){const e=r.value,s=r.key,h=mi(e);return h!=="boolean"?[new _t(s,e,`boolean expected, ${h} found`)]:[]},number:Ca,color:function(r){const e=r.key,s=r.value,h=mi(s);return h!=="string"?[new _t(e,s,`color expected, ${h} found`)]:Ai.parse(String(s))?[]:[new _t(e,s,`color expected, "${s}" found`)]},constants:Il,enum:ws,filter:Pl,function:Al,layer:Ia,object:Qr,source:Aa,light:Yc,terrain:Qc,string:Wn,formatted:function(r){return Wn(r).length===0?[]:ea(r)},resolvedImage:function(r){return Wn(r).length===0?[]:ea(r)},padding:function(r){const e=r.key,s=r.value;if(mi(s)==="array"){if(s.length<1||s.length>4)return[new _t(e,s,`padding requires 1 to 4 values; ${s.length} values found`)];const h={type:"number"};let m=[];for(let b=0;b[]}})),r.constants&&(s=s.concat(Il({key:"constants",value:r.constants,style:r,styleSpec:e,validateSpec:Pa}))),tu(s)}function Un(r){return function(e){return r({...e,validateSpec:Pa})}}function tu(r){return[].concat(r).sort((e,s)=>e.line-s.line)}function En(r){return function(...e){return tu(r.apply(this,e))}}Hn.source=En(Un(Aa)),Hn.sprite=En(Un(eu)),Hn.glyphs=En(Un(So)),Hn.light=En(Un(Yc)),Hn.terrain=En(Un(Qc)),Hn.layer=En(Un(Ia)),Hn.filter=En(Un(Pl)),Hn.paintProperty=En(Un(Xc)),Hn.layoutProperty=En(Un(Jc));const za=Hn,zl=za.light,iu=za.paintProperty,Ml=za.layoutProperty;function Dl(r,e){let s=!1;if(e&&e.length)for(const h of e)r.fire(new Ze(new Error(h.message))),s=!0;return s}class ia{constructor(e,s,h){const m=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const x=new Int32Array(this.arrayBuffer);e=x[0],this.d=(s=x[1])+2*(h=x[2]);for(let M=0;M=j[re+0]&&m>=j[re+1])?(k[te]=!0,x.push(N[te])):k[te]=!1}}}}_forEachCell(e,s,h,m,b,x,k,M){const B=this._convertToCellCoord(e),N=this._convertToCellCoord(s),j=this._convertToCellCoord(h),W=this._convertToCellCoord(m);for(let te=B;te<=j;te++)for(let re=N;re<=W;re++){const de=this.d*re+te;if((!M||M(this._convertFromCellCoord(te),this._convertFromCellCoord(re),this._convertFromCellCoord(te+1),this._convertFromCellCoord(re+1)))&&b.call(this,e,s,h,m,de,x,k,M))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,s=3+this.cells.length+1+1;let h=0;for(let x=0;x=0)continue;const x=r[b];m[b]=xs[h].shallow.indexOf(b)>=0?x:ra(x,e)}r instanceof Error&&(m.message=r.message)}if(m.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(m.$name=h),m}throw new Error("can't serialize object of type "+typeof r)}function Da(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||Ma(r)||Xe(r)||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(Da);if(typeof r=="object"){const e=r.$name||"Object";if(!xs[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:s}=xs[e];if(!s)throw new Error(`can't deserialize unregistered class ${e}`);if(s.deserialize)return s.deserialize(r);const h=Object.create(s.prototype);for(const m of Object.keys(r)){if(m==="$name")continue;const b=r[m];h[m]=xs[e].shallow.indexOf(m)>=0?b:Da(b)}return h}throw new Error("can't deserialize object of type "+typeof r)}class Ll{constructor(){this.first=!0}update(e,s){const h=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=h,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=h,!0):(this.lastFloorZoom>h?(this.lastIntegerZoom=h+1,this.lastIntegerZoomTime=s):this.lastFloorZoomr>=128&&r<=255,Arabic:r=>r>=1536&&r<=1791,"Arabic Supplement":r=>r>=1872&&r<=1919,"Arabic Extended-A":r=>r>=2208&&r<=2303,"Hangul Jamo":r=>r>=4352&&r<=4607,"Unified Canadian Aboriginal Syllabics":r=>r>=5120&&r<=5759,Khmer:r=>r>=6016&&r<=6143,"Unified Canadian Aboriginal Syllabics Extended":r=>r>=6320&&r<=6399,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"CJK Radicals Supplement":r=>r>=11904&&r<=12031,"Kangxi Radicals":r=>r>=12032&&r<=12255,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Bopomofo:r=>r>=12544&&r<=12591,"Hangul Compatibility Jamo":r=>r>=12592&&r<=12687,Kanbun:r=>r>=12688&&r<=12703,"Bopomofo Extended":r=>r>=12704&&r<=12735,"CJK Strokes":r=>r>=12736&&r<=12783,"Katakana Phonetic Extensions":r=>r>=12784&&r<=12799,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"CJK Unified Ideographs Extension A":r=>r>=13312&&r<=19903,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Yi Syllables":r=>r>=40960&&r<=42127,"Yi Radicals":r=>r>=42128&&r<=42191,"Hangul Jamo Extended-A":r=>r>=43360&&r<=43391,"Hangul Syllables":r=>r>=44032&&r<=55215,"Hangul Jamo Extended-B":r=>r>=55216&&r<=55295,"Private Use Area":r=>r>=57344&&r<=63743,"CJK Compatibility Ideographs":r=>r>=63744&&r<=64255,"Arabic Presentation Forms-A":r=>r>=64336&&r<=65023,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Arabic Presentation Forms-B":r=>r>=65136&&r<=65279,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519};function La(r){for(const e of r)if(Rl(e.charCodeAt(0)))return!0;return!1}function Sh(r){for(const e of r)if(!kh(e.charCodeAt(0)))return!1;return!0}function kh(r){return!($t.Arabic(r)||$t["Arabic Supplement"](r)||$t["Arabic Extended-A"](r)||$t["Arabic Presentation Forms-A"](r)||$t["Arabic Presentation Forms-B"](r))}function Rl(r){return!(r!==746&&r!==747&&(r<4352||!($t["Bopomofo Extended"](r)||$t.Bopomofo(r)||$t["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||$t["CJK Compatibility Ideographs"](r)||$t["CJK Compatibility"](r)||$t["CJK Radicals Supplement"](r)||$t["CJK Strokes"](r)||!(!$t["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||$t["CJK Unified Ideographs Extension A"](r)||$t["CJK Unified Ideographs"](r)||$t["Enclosed CJK Letters and Months"](r)||$t["Hangul Compatibility Jamo"](r)||$t["Hangul Jamo Extended-A"](r)||$t["Hangul Jamo Extended-B"](r)||$t["Hangul Jamo"](r)||$t["Hangul Syllables"](r)||$t.Hiragana(r)||$t["Ideographic Description Characters"](r)||$t.Kanbun(r)||$t["Kangxi Radicals"](r)||$t["Katakana Phonetic Extensions"](r)||$t.Katakana(r)&&r!==12540||!(!$t["Halfwidth and Fullwidth Forms"](r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!$t["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||$t["Unified Canadian Aboriginal Syllabics"](r)||$t["Unified Canadian Aboriginal Syllabics Extended"](r)||$t["Vertical Forms"](r)||$t["Yijing Hexagram Symbols"](r)||$t["Yi Syllables"](r)||$t["Yi Radicals"](r))))}function ru(r){return!(Rl(r)||function(e){return!!($t["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||$t["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)||$t["Letterlike Symbols"](e)||$t["Number Forms"](e)||$t["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)||$t["Control Pictures"](e)&&e!==9251||$t["Optical Character Recognition"](e)||$t["Enclosed Alphanumerics"](e)||$t["Geometric Shapes"](e)||$t["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||$t["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||$t["CJK Symbols and Punctuation"](e)||$t.Katakana(e)||$t["Private Use Area"](e)||$t["CJK Compatibility Forms"](e)||$t["Small Form Variants"](e)||$t["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(r))}function Bl(r){return r>=1424&&r<=2303||$t["Arabic Presentation Forms-A"](r)||$t["Arabic Presentation Forms-B"](r)}function Th(r,e){return!(!e&&Bl(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||$t.Khmer(r))}function Ch(r){for(const e of r)if(Bl(e.charCodeAt(0)))return!0;return!1}const Ol="deferred",Fl="loading",Nl="loaded";let Ul=null,hn="unavailable",Vn=null;const nu=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(hn="error"),Ul&&Ul(r)};function Ra(){Vl.fire(new _e("pluginStateChange",{pluginStatus:hn,pluginURL:Vn}))}const Vl=new pt,$l=function(){return hn},jl=function(){if(hn!==Ol||!Vn)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");hn=Fl,Ra(),Vn&&Z({url:Vn},r=>{r?nu(r):(hn=Nl,Ra())})},Sn={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>hn===Nl||Sn.applyArabicShaping!=null,isLoading:()=>hn===Fl,setState(r){if(!it())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");hn=r.pluginStatus,Vn=r.pluginURL},isParsed(){if(!it())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Sn.applyArabicShaping!=null&&Sn.processBidirectionalText!=null&&Sn.processStyledBidirectionalText!=null},getPluginURL(){if(!it())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Vn}};class tr{constructor(e,s){this.zoom=e,s?(this.now=s.now,this.fadeDuration=s.fadeDuration,this.zoomHistory=s.zoomHistory,this.transition=s.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ll,this.transition={})}isSupportedScript(e){return function(s,h){for(const m of s)if(!Th(m.charCodeAt(0),h))return!1;return!0}(e,Sn.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,s=e-Math.floor(e),h=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:s+(1-s)*h}:{fromScale:.5,toScale:1,t:1-(1-h)*s}}}class ko{constructor(e,s){this.property=e,this.value=s,this.expression=function(h,m){if(go(h))return new Sa(h,m);if(vo(h)){const b=El(h,m);if(b.result==="error")throw new Error(b.value.map(x=>`${x.key}: ${x.message}`).join(", "));return b.value}{let b=h;return m.type==="color"&&typeof h=="string"?b=Ai.parse(h):m.type!=="padding"||typeof h!="number"&&!Array.isArray(h)?m.type==="variableAnchorOffsetCollection"&&Array.isArray(h)&&(b=kr.parse(h)):b=Dr.parse(h),{kind:"constant",evaluate:()=>b}}}(s===void 0?e.specification.default:s,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,s,h){return this.property.possiblyEvaluate(this,e,s,h)}}class ql{constructor(e){this.property=e,this.value=new ko(e,void 0)}transitioned(e,s){return new au(this.property,this.value,s,ge({},e.transition,this.transition),e.now)}untransitioned(){return new au(this.property,this.value,null,{},0)}}class su{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return ye(this._values[e].value.value)}setValue(e,s){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new ql(this._values[e].property)),this._values[e].value=new ko(this._values[e].property,s===null?void 0:ye(s))}getTransition(e){return ye(this._values[e].transition)}setTransition(e,s){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new ql(this._values[e].property)),this._values[e].transition=ye(s)||void 0}serialize(){const e={};for(const s of Object.keys(this._values)){const h=this.getValue(s);h!==void 0&&(e[s]=h);const m=this.getTransition(s);m!==void 0&&(e[`${s}-transition`]=m)}return e}transitioned(e,s){const h=new ou(this._properties);for(const m of Object.keys(this._values))h._values[m]=this._values[m].transitioned(e,s._values[m]);return h}untransitioned(){const e=new ou(this._properties);for(const s of Object.keys(this._values))e._values[s]=this._values[s].untransitioned();return e}}class au{constructor(e,s,h,m,b){this.property=e,this.value=s,this.begin=b+m.delay||0,this.end=this.begin+m.duration||0,e.specification.transition&&(m.delay||m.duration)&&(this.prior=h)}possiblyEvaluate(e,s,h){const m=e.now||0,b=this.value.possiblyEvaluate(e,s,h),x=this.prior;if(x){if(m>this.end)return this.prior=null,b;if(this.value.isDataDriven())return this.prior=null,b;if(m=1)return 1;const B=M*M,N=B*M;return 4*(M<.5?N:3*(M-B)+N-.75)}(k))}}return b}}class ou{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,s,h){const m=new To(this._properties);for(const b of Object.keys(this._values))m._values[b]=this._values[b].possiblyEvaluate(e,s,h);return m}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class na{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return ye(this._values[e].value)}setValue(e,s){this._values[e]=new ko(this._values[e].property,s===null?void 0:ye(s))}serialize(){const e={};for(const s of Object.keys(this._values)){const h=this.getValue(s);h!==void 0&&(e[s]=h)}return e}possiblyEvaluate(e,s,h){const m=new To(this._properties);for(const b of Object.keys(this._values))m._values[b]=this._values[b].possiblyEvaluate(e,s,h);return m}}class Kn{constructor(e,s,h){this.property=e,this.value=s,this.parameters=h}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,s,h,m){return this.property.evaluate(this.value,this.parameters,e,s,h,m)}}class To{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Qt{constructor(e){this.specification=e}possiblyEvaluate(e,s){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(s)}interpolate(e,s,h){const m=bn[this.specification.type];return m?m(e,s,h):e}}class ci{constructor(e,s){this.specification=e,this.overrides=s}possiblyEvaluate(e,s,h,m){return new Kn(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(s,null,{},h,m)}:e.expression,s)}interpolate(e,s,h){if(e.value.kind!=="constant"||s.value.kind!=="constant")return e;if(e.value.value===void 0||s.value.value===void 0)return new Kn(this,{kind:"constant",value:void 0},e.parameters);const m=bn[this.specification.type];if(m){const b=m(e.value.value,s.value.value,h);return new Kn(this,{kind:"constant",value:b},e.parameters)}return e}evaluate(e,s,h,m,b,x){return e.kind==="constant"?e.value:e.evaluate(s,h,m,b,x)}}class Co extends ci{possiblyEvaluate(e,s,h,m){if(e.value===void 0)return new Kn(this,{kind:"constant",value:void 0},s);if(e.expression.kind==="constant"){const b=e.expression.evaluate(s,null,{},h,m),x=e.property.specification.type==="resolvedImage"&&typeof b!="string"?b.name:b,k=this._calculate(x,x,x,s);return new Kn(this,{kind:"constant",value:k},s)}if(e.expression.kind==="camera"){const b=this._calculate(e.expression.evaluate({zoom:s.zoom-1}),e.expression.evaluate({zoom:s.zoom}),e.expression.evaluate({zoom:s.zoom+1}),s);return new Kn(this,{kind:"constant",value:b},s)}return new Kn(this,e.expression,s)}evaluate(e,s,h,m,b,x){if(e.kind==="source"){const k=e.evaluate(s,h,m,b,x);return this._calculate(k,k,k,s)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(s.zoom)-1},h,m),e.evaluate({zoom:Math.floor(s.zoom)},h,m),e.evaluate({zoom:Math.floor(s.zoom)+1},h,m),s):e.value}_calculate(e,s,h,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:e,to:s}:{from:h,to:s}}interpolate(e){return e}}class Zl{constructor(e){this.specification=e}possiblyEvaluate(e,s,h,m){if(e.value!==void 0){if(e.expression.kind==="constant"){const b=e.expression.evaluate(s,null,{},h,m);return this._calculate(b,b,b,s)}return this._calculate(e.expression.evaluate(new tr(Math.floor(s.zoom-1),s)),e.expression.evaluate(new tr(Math.floor(s.zoom),s)),e.expression.evaluate(new tr(Math.floor(s.zoom+1),s)),s)}}_calculate(e,s,h,m){return m.zoom>m.zoomHistory.lastIntegerZoom?{from:e,to:s}:{from:h,to:s}}interpolate(e){return e}}class Xn{constructor(e){this.specification=e}possiblyEvaluate(e,s,h,m){return!!e.expression.evaluate(s,null,{},h,m)}interpolate(){return!1}}class en{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const s in e){const h=e[s];h.specification.overridable&&this.overridableProperties.push(s);const m=this.defaultPropertyValues[s]=new ko(h,void 0),b=this.defaultTransitionablePropertyValues[s]=new ql(h);this.defaultTransitioningPropertyValues[s]=b.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=m.possiblyEvaluate({})}}}jt("DataDrivenProperty",ci),jt("DataConstantProperty",Qt),jt("CrossFadedDataDrivenProperty",Co),jt("CrossFadedProperty",Zl),jt("ColorRampProperty",Xn);const Io="-transition";class $n extends pt{constructor(e,s){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),s.layout&&(this._unevaluatedLayout=new na(s.layout)),s.paint)){this._transitionablePaint=new su(s.paint);for(const h in e.paint)this.setPaintProperty(h,e.paint[h],{validate:!1});for(const h in e.layout)this.setLayoutProperty(h,e.layout[h],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new To(s.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,s,h={}){s!=null&&this._validate(Ml,`layers.${this.id}.layout.${e}`,e,s,h)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,s):this.visibility=s)}getPaintProperty(e){return e.endsWith(Io)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,s,h={}){if(s!=null&&this._validate(iu,`layers.${this.id}.paint.${e}`,e,s,h))return!1;if(e.endsWith(Io))return this._transitionablePaint.setTransition(e.slice(0,-11),s||void 0),!1;{const m=this._transitionablePaint._values[e],b=m.property.specification["property-type"]==="cross-faded-data-driven",x=m.value.isDataDriven(),k=m.value;this._transitionablePaint.setValue(e,s),this._handleSpecialPaintPropertyUpdate(e);const M=this._transitionablePaint._values[e].value;return M.isDataDriven()||x||b||this._handleOverridablePaintPropertyUpdate(e,k,M)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,s,h){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,s){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,s)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,s)}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),et(e,(s,h)=>!(s===void 0||h==="layout"&&!Object.keys(s).length||h==="paint"&&!Object.keys(s).length))}_validate(e,s,h,m,b={}){return(!b||b.validate!==!1)&&Dl(this,e.call(za,{key:s,layerType:this.type,objectKey:h,value:m,styleSpec:Ae,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const s=this.paint.get(e);if(s instanceof Kn&&Js(s.property.specification)&&(s.value.kind==="source"||s.value.kind==="composite")&&s.value.isStateDependent)return!0}return!1}}const Gl={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ba{constructor(e,s){this._structArray=e,this._pos1=s*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Yi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,s){return e._trim(),s&&(e.isTransferred=!0,s.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const s=Object.create(this.prototype);return s.arrayBuffer=e.arrayBuffer,s.length=e.length,s.capacity=e.arrayBuffer.byteLength/s.bytesPerElement,s._refreshViews(),s}_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 s=this.uint8;this._refreshViews(),s&&this.uint8.set(s)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ir(r,e=1){let s=0,h=0;return{members:r.map(m=>{const b=Gl[m.type].BYTES_PER_ELEMENT,x=s=lu(s,Math.max(e,b)),k=m.components||1;return h=Math.max(h,b),s+=b*k,{name:m.name,type:m.type,components:k,offset:x}}),size:lu(s,Math.max(h,e)),alignment:e}}function lu(r,e){return Math.ceil(r/e)*e}class sa extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s){const h=this.length;return this.resize(h+1),this.emplace(h,e,s)}emplace(e,s,h){const m=2*e;return this.int16[m+0]=s,this.int16[m+1]=h,e}}sa.prototype.bytesPerElement=4,jt("StructArrayLayout2i4",sa);class Es extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,s,h)}emplace(e,s,h,m){const b=3*e;return this.int16[b+0]=s,this.int16[b+1]=h,this.int16[b+2]=m,e}}Es.prototype.bytesPerElement=6,jt("StructArrayLayout3i6",Es);class Wl extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,m){const b=this.length;return this.resize(b+1),this.emplace(b,e,s,h,m)}emplace(e,s,h,m,b){const x=4*e;return this.int16[x+0]=s,this.int16[x+1]=h,this.int16[x+2]=m,this.int16[x+3]=b,e}}Wl.prototype.bytesPerElement=8,jt("StructArrayLayout4i8",Wl);class Hl extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b,x){const k=this.length;return this.resize(k+1),this.emplace(k,e,s,h,m,b,x)}emplace(e,s,h,m,b,x,k){const M=6*e;return this.int16[M+0]=s,this.int16[M+1]=h,this.int16[M+2]=m,this.int16[M+3]=b,this.int16[M+4]=x,this.int16[M+5]=k,e}}Hl.prototype.bytesPerElement=12,jt("StructArrayLayout2i4i12",Hl);class Ao extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b,x){const k=this.length;return this.resize(k+1),this.emplace(k,e,s,h,m,b,x)}emplace(e,s,h,m,b,x,k){const M=4*e,B=8*e;return this.int16[M+0]=s,this.int16[M+1]=h,this.uint8[B+4]=m,this.uint8[B+5]=b,this.uint8[B+6]=x,this.uint8[B+7]=k,e}}Ao.prototype.bytesPerElement=8,jt("StructArrayLayout2i4ub8",Ao);class Oa extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s){const h=this.length;return this.resize(h+1),this.emplace(h,e,s)}emplace(e,s,h){const m=2*e;return this.float32[m+0]=s,this.float32[m+1]=h,e}}Oa.prototype.bytesPerElement=8,jt("StructArrayLayout2f8",Oa);class Kl extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b,x,k,M,B,N){const j=this.length;return this.resize(j+1),this.emplace(j,e,s,h,m,b,x,k,M,B,N)}emplace(e,s,h,m,b,x,k,M,B,N,j){const W=10*e;return this.uint16[W+0]=s,this.uint16[W+1]=h,this.uint16[W+2]=m,this.uint16[W+3]=b,this.uint16[W+4]=x,this.uint16[W+5]=k,this.uint16[W+6]=M,this.uint16[W+7]=B,this.uint16[W+8]=N,this.uint16[W+9]=j,e}}Kl.prototype.bytesPerElement=20,jt("StructArrayLayout10ui20",Kl);class ji extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b,x,k,M,B,N,j,W){const te=this.length;return this.resize(te+1),this.emplace(te,e,s,h,m,b,x,k,M,B,N,j,W)}emplace(e,s,h,m,b,x,k,M,B,N,j,W,te){const re=12*e;return this.int16[re+0]=s,this.int16[re+1]=h,this.int16[re+2]=m,this.int16[re+3]=b,this.uint16[re+4]=x,this.uint16[re+5]=k,this.uint16[re+6]=M,this.uint16[re+7]=B,this.int16[re+8]=N,this.int16[re+9]=j,this.int16[re+10]=W,this.int16[re+11]=te,e}}ji.prototype.bytesPerElement=24,jt("StructArrayLayout4i4ui4i24",ji);class y extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,s,h)}emplace(e,s,h,m){const b=3*e;return this.float32[b+0]=s,this.float32[b+1]=h,this.float32[b+2]=m,e}}y.prototype.bytesPerElement=12,jt("StructArrayLayout3f12",y);class t extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.uint32[1*e+0]=s,e}}t.prototype.bytesPerElement=4,jt("StructArrayLayout1ul4",t);class c extends Yi{_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,s,h,m,b,x,k,M,B){const N=this.length;return this.resize(N+1),this.emplace(N,e,s,h,m,b,x,k,M,B)}emplace(e,s,h,m,b,x,k,M,B,N){const j=10*e,W=5*e;return this.int16[j+0]=s,this.int16[j+1]=h,this.int16[j+2]=m,this.int16[j+3]=b,this.int16[j+4]=x,this.int16[j+5]=k,this.uint32[W+3]=M,this.uint16[j+8]=B,this.uint16[j+9]=N,e}}c.prototype.bytesPerElement=20,jt("StructArrayLayout6i1ul2ui20",c);class d extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b,x){const k=this.length;return this.resize(k+1),this.emplace(k,e,s,h,m,b,x)}emplace(e,s,h,m,b,x,k){const M=6*e;return this.int16[M+0]=s,this.int16[M+1]=h,this.int16[M+2]=m,this.int16[M+3]=b,this.int16[M+4]=x,this.int16[M+5]=k,e}}d.prototype.bytesPerElement=12,jt("StructArrayLayout2i2i2i12",d);class g extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,m,b){const x=this.length;return this.resize(x+1),this.emplace(x,e,s,h,m,b)}emplace(e,s,h,m,b,x){const k=4*e,M=8*e;return this.float32[k+0]=s,this.float32[k+1]=h,this.float32[k+2]=m,this.int16[M+6]=b,this.int16[M+7]=x,e}}g.prototype.bytesPerElement=16,jt("StructArrayLayout2f1f2i16",g);class w extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h,m){const b=this.length;return this.resize(b+1),this.emplace(b,e,s,h,m)}emplace(e,s,h,m,b){const x=12*e,k=3*e;return this.uint8[x+0]=s,this.uint8[x+1]=h,this.float32[k+1]=m,this.float32[k+2]=b,e}}w.prototype.bytesPerElement=12,jt("StructArrayLayout2ub2f12",w);class T extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,s,h)}emplace(e,s,h,m){const b=3*e;return this.uint16[b+0]=s,this.uint16[b+1]=h,this.uint16[b+2]=m,e}}T.prototype.bytesPerElement=6,jt("StructArrayLayout3ui6",T);class A extends Yi{_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,s,h,m,b,x,k,M,B,N,j,W,te,re,de,Se,Pe){const qe=this.length;return this.resize(qe+1),this.emplace(qe,e,s,h,m,b,x,k,M,B,N,j,W,te,re,de,Se,Pe)}emplace(e,s,h,m,b,x,k,M,B,N,j,W,te,re,de,Se,Pe,qe){const Le=24*e,He=12*e,rt=48*e;return this.int16[Le+0]=s,this.int16[Le+1]=h,this.uint16[Le+2]=m,this.uint16[Le+3]=b,this.uint32[He+2]=x,this.uint32[He+3]=k,this.uint32[He+4]=M,this.uint16[Le+10]=B,this.uint16[Le+11]=N,this.uint16[Le+12]=j,this.float32[He+7]=W,this.float32[He+8]=te,this.uint8[rt+36]=re,this.uint8[rt+37]=de,this.uint8[rt+38]=Se,this.uint32[He+10]=Pe,this.int16[Le+22]=qe,e}}A.prototype.bytesPerElement=48,jt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",A);class R extends Yi{_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,s,h,m,b,x,k,M,B,N,j,W,te,re,de,Se,Pe,qe,Le,He,rt,dt,Vt,Ht,Ut,Rt,Mt,qt){const Dt=this.length;return this.resize(Dt+1),this.emplace(Dt,e,s,h,m,b,x,k,M,B,N,j,W,te,re,de,Se,Pe,qe,Le,He,rt,dt,Vt,Ht,Ut,Rt,Mt,qt)}emplace(e,s,h,m,b,x,k,M,B,N,j,W,te,re,de,Se,Pe,qe,Le,He,rt,dt,Vt,Ht,Ut,Rt,Mt,qt,Dt){const St=32*e,oi=16*e;return this.int16[St+0]=s,this.int16[St+1]=h,this.int16[St+2]=m,this.int16[St+3]=b,this.int16[St+4]=x,this.int16[St+5]=k,this.int16[St+6]=M,this.int16[St+7]=B,this.uint16[St+8]=N,this.uint16[St+9]=j,this.uint16[St+10]=W,this.uint16[St+11]=te,this.uint16[St+12]=re,this.uint16[St+13]=de,this.uint16[St+14]=Se,this.uint16[St+15]=Pe,this.uint16[St+16]=qe,this.uint16[St+17]=Le,this.uint16[St+18]=He,this.uint16[St+19]=rt,this.uint16[St+20]=dt,this.uint16[St+21]=Vt,this.uint16[St+22]=Ht,this.uint32[oi+12]=Ut,this.float32[oi+13]=Rt,this.float32[oi+14]=Mt,this.uint16[St+30]=qt,this.uint16[St+31]=Dt,e}}R.prototype.bytesPerElement=64,jt("StructArrayLayout8i15ui1ul2f2ui64",R);class O extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.float32[1*e+0]=s,e}}O.prototype.bytesPerElement=4,jt("StructArrayLayout1f4",O);class U extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,s,h)}emplace(e,s,h,m){const b=3*e;return this.uint16[6*e+0]=s,this.float32[b+1]=h,this.float32[b+2]=m,e}}U.prototype.bytesPerElement=12,jt("StructArrayLayout1ui2f12",U);class $ extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h){const m=this.length;return this.resize(m+1),this.emplace(m,e,s,h)}emplace(e,s,h,m){const b=4*e;return this.uint32[2*e+0]=s,this.uint16[b+2]=h,this.uint16[b+3]=m,e}}$.prototype.bytesPerElement=8,jt("StructArrayLayout1ul2ui8",$);class Q extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s){const h=this.length;return this.resize(h+1),this.emplace(h,e,s)}emplace(e,s,h){const m=2*e;return this.uint16[m+0]=s,this.uint16[m+1]=h,e}}Q.prototype.bytesPerElement=4,jt("StructArrayLayout2ui4",Q);class me extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.uint16[1*e+0]=s,e}}me.prototype.bytesPerElement=2,jt("StructArrayLayout1ui2",me);class fe extends Yi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h,m){const b=this.length;return this.resize(b+1),this.emplace(b,e,s,h,m)}emplace(e,s,h,m,b){const x=4*e;return this.float32[x+0]=s,this.float32[x+1]=h,this.float32[x+2]=m,this.float32[x+3]=b,e}}fe.prototype.bytesPerElement=16,jt("StructArrayLayout4f16",fe);class xe extends Ba{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 C(this.anchorPointX,this.anchorPointY)}}xe.prototype.size=20;class he extends c{get(e){return new xe(this,e)}}jt("CollisionBoxArray",he);class Ve extends Ba{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]}}Ve.prototype.size=48;class tt extends A{get(e){return new Ve(this,e)}}jt("PlacedSymbolArray",tt);class Ce extends Ba{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 collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Ce.prototype.size=64;class je extends R{get(e){return new Ce(this,e)}}jt("SymbolInstanceArray",je);class at extends O{getoffsetX(e){return this.float32[1*e+0]}}jt("GlyphOffsetArray",at);class ot extends Es{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}jt("SymbolLineVertexArray",ot);class ft extends Ba{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}ft.prototype.size=12;class Et extends U{get(e){return new ft(this,e)}}jt("TextAnchorOffsetArray",Et);class yt extends Ba{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]}}yt.prototype.size=8;class At extends ${get(e){return new yt(this,e)}}jt("FeatureIndexArray",At);class Wt extends sa{}class Di extends sa{}class Lt extends sa{}class ui extends Hl{}class Kt extends Ao{}class rr extends Oa{}class Ei extends Kl{}class ki extends ji{}class Li extends y{}class _r extends t{}class Xi extends d{}class Bn extends w{}class fr extends T{}class cr extends Q{}const kn=ir([{name:"a_pos",components:2,type:"Int16"}],4),{members:Jn}=kn;class nr{constructor(e=[]){this.segments=e}prepareSegment(e,s,h,m){let b=this.segments[this.segments.length-1];return e>nr.MAX_VERTEX_ARRAY_LENGTH&&q(`Max vertices per segment is ${nr.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!b||b.vertexLength+e>nr.MAX_VERTEX_ARRAY_LENGTH||b.sortKey!==m)&&(b={vertexOffset:s.length,primitiveOffset:h.length,vertexLength:0,primitiveLength:0},m!==void 0&&(b.sortKey=m),this.segments.push(b)),b}get(){return this.segments}destroy(){for(const e of this.segments)for(const s in e.vaos)e.vaos[s].destroy()}static simpleSegment(e,s,h,m){return new nr([{vertexOffset:e,primitiveOffset:s,vertexLength:h,primitiveLength:m,vaos:{},sortKey:0}])}}function Ss(r,e){return 256*(r=ne(Math.floor(r),0,255))+ne(Math.floor(e),0,255)}nr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,jt("SegmentVector",nr);const ks=ir([{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 ls={exports:{}},Fs={exports:{}};Fs.exports=function(r,e){var s,h,m,b,x,k,M,B;for(h=r.length-(s=3&r.length),m=e,x=3432918353,k=461845907,B=0;B>>16)*x&65535)<<16)&4294967295)<<15|M>>>17))*k+(((M>>>16)*k&65535)<<16)&4294967295)<<13|m>>>19))+((5*(m>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(M=0,s){case 3:M^=(255&r.charCodeAt(B+2))<<16;case 2:M^=(255&r.charCodeAt(B+1))<<8;case 1:m^=M=(65535&(M=(M=(65535&(M^=255&r.charCodeAt(B)))*x+(((M>>>16)*x&65535)<<16)&4294967295)<<15|M>>>17))*k+(((M>>>16)*k&65535)<<16)&4294967295}return m^=r.length,m=2246822507*(65535&(m^=m>>>16))+((2246822507*(m>>>16)&65535)<<16)&4294967295,m=3266489909*(65535&(m^=m>>>13))+((3266489909*(m>>>16)&65535)<<16)&4294967295,(m^=m>>>16)>>>0};var tn=Fs.exports,qr={exports:{}};qr.exports=function(r,e){for(var s,h=r.length,m=e^h,b=0;h>=4;)s=1540483477*(65535&(s=255&r.charCodeAt(b)|(255&r.charCodeAt(++b))<<8|(255&r.charCodeAt(++b))<<16|(255&r.charCodeAt(++b))<<24))+((1540483477*(s>>>16)&65535)<<16),m=1540483477*(65535&m)+((1540483477*(m>>>16)&65535)<<16)^(s=1540483477*(65535&(s^=s>>>24))+((1540483477*(s>>>16)&65535)<<16)),h-=4,++b;switch(h){case 3:m^=(255&r.charCodeAt(b+2))<<16;case 2:m^=(255&r.charCodeAt(b+1))<<8;case 1:m=1540483477*(65535&(m^=255&r.charCodeAt(b)))+((1540483477*(m>>>16)&65535)<<16)}return m=1540483477*(65535&(m^=m>>>13))+((1540483477*(m>>>16)&65535)<<16),(m^=m>>>15)>>>0};var Wr=tn,Fa=qr.exports;ls.exports=Wr,ls.exports.murmur3=Wr,ls.exports.murmur2=Fa;var yr=v(ls.exports);class vr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,s,h,m){this.ids.push(Tn(e)),this.positions.push(s,h,m)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const s=Tn(e);let h=0,m=this.ids.length-1;for(;h>1;this.ids[x]>=s?m=x:h=x+1}const b=[];for(;this.ids[h]===s;)b.push({index:this.positions[3*h],start:this.positions[3*h+1],end:this.positions[3*h+2]}),h++;return b}static serialize(e,s){const h=new Float64Array(e.ids),m=new Uint32Array(e.positions);return br(h,m,0,h.length-1),s&&s.push(h.buffer,m.buffer),{ids:h,positions:m}}static deserialize(e){const s=new vr;return s.ids=e.ids,s.positions=e.positions,s.indexed=!0,s}}function Tn(r){const e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:yr(String(r))}function br(r,e,s,h){for(;s>1];let b=s-1,x=h+1;for(;;){do b++;while(r[b]m);if(b>=x)break;Po(r,b,x),Po(e,3*b,3*x),Po(e,3*b+1,3*x+1),Po(e,3*b+2,3*x+2)}x-s`u_${m}`),this.type=h}setUniform(e,s,h){e.set(h.constantOr(this.value))}getBinding(e,s,h){return this.type==="color"?new uu(e,s):new zo(e,s)}}class Us{constructor(e,s){this.uniformNames=s.map(h=>`u_${h}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,s){this.pixelRatioFrom=s.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=s.tlbr,this.patternTo=e.tlbr}setUniform(e,s,h,m){const b=m==="u_pattern_to"?this.patternTo:m==="u_pattern_from"?this.patternFrom:m==="u_pixel_ratio_to"?this.pixelRatioTo:m==="u_pixel_ratio_from"?this.pixelRatioFrom:null;b&&e.set(b)}getBinding(e,s,h){return h.substr(0,9)==="u_pattern"?new cu(e,s):new zo(e,s)}}class Yn{constructor(e,s,h,m){this.expression=e,this.type=h,this.maxValue=0,this.paintVertexAttributes=s.map(b=>({name:`a_${b}`,type:"Float32",components:h==="color"?2:1,offset:0})),this.paintVertexArray=new m}populatePaintArray(e,s,h,m,b){const x=this.paintVertexArray.length,k=this.expression.evaluate(new tr(0),s,{},m,[],b);this.paintVertexArray.resize(e),this._setPaintValue(x,e,k)}updatePaintArray(e,s,h,m){const b=this.expression.evaluate({zoom:0},h,m);this._setPaintValue(e,s,b)}_setPaintValue(e,s,h){if(this.type==="color"){const m=Ts(h);for(let b=e;b`u_${k}_t`),this.type=h,this.useIntegerZoom=m,this.zoom=b,this.maxValue=0,this.paintVertexAttributes=s.map(k=>({name:`a_${k}`,type:"Float32",components:h==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(e,s,h,m,b){const x=this.expression.evaluate(new tr(this.zoom),s,{},m,[],b),k=this.expression.evaluate(new tr(this.zoom+1),s,{},m,[],b),M=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(M,e,x,k)}updatePaintArray(e,s,h,m){const b=this.expression.evaluate({zoom:this.zoom},h,m),x=this.expression.evaluate({zoom:this.zoom+1},h,m);this._setPaintValue(e,s,b,x)}_setPaintValue(e,s,h,m){if(this.type==="color"){const b=Ts(h),x=Ts(m);for(let k=e;k`#define HAS_UNIFORM_${m}`))}return e}getBinderAttributes(){const e=[];for(const s in this.binders){const h=this.binders[s];if(h instanceof Yn||h instanceof Cn)for(let m=0;m!0){this.programConfigurations={};for(const m of e)this.programConfigurations[m.id]=new Mo(m,s,h);this.needsUpload=!1,this._featureMap=new vr,this._bufferOffset=0}populatePaintArrays(e,s,h,m,b,x){for(const k in this.programConfigurations)this.programConfigurations[k].populatePaintArrays(e,s,m,b,x);s.id!==void 0&&this._featureMap.add(s.id,h,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,s,h,m){for(const b of h)this.needsUpload=this.programConfigurations[b.id].updatePaintArrays(e,this._featureMap,s,b,m)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const s in this.programConfigurations)this.programConfigurations[s].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Hy(r,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"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function Pd(r,e,s){const h={color:{source:Oa,composite:fe},number:{source:O,composite:Oa}},m=function(b){return{"line-pattern":{source:Ei,composite:Ei},"fill-pattern":{source:Ei,composite:Ei},"fill-extrusion-pattern":{source:Ei,composite:Ei}}[b]}(r);return m&&m[s]||h[e][s]}jt("ConstantBinder",aa),jt("CrossFadedConstantBinder",Us),jt("SourceExpressionBinder",Yn),jt("CrossFadedCompositeBinder",cs),jt("CompositeExpressionBinder",Cn),jt("ProgramConfiguration",Mo,{omit:["_buffers"]}),jt("ProgramConfigurationSet",Na);const Tr=8192,Ah=Math.pow(2,14)-1,zd=-Ah-1;function Ua(r){const e=Tr/r.extent,s=r.loadGeometry();for(let h=0;hx.x+1||Mx.y+1)&&q("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return s}function Va(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?Ua(r):[]}}function hu(r,e,s,h,m){r.emplaceBack(2*e+(h+1)/2,2*s+(m+1)/2)}class Ph{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(s=>s.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Di,this.indexArray=new fr,this.segments=new nr,this.programConfigurations=new Na(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){const m=this.layers[0],b=[];let x=null,k=!1;m.type==="circle"&&(x=m.layout.get("circle-sort-key"),k=!x.isConstant());for(const{feature:M,id:B,index:N,sourceLayerIndex:j}of e){const W=this.layers[0]._featureFilter.needGeometry,te=Va(M,W);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),te,h))continue;const re=k?x.evaluate(te,{},h):void 0,de={id:B,properties:M.properties,type:M.type,sourceLayerIndex:j,index:N,geometry:W?te.geometry:Ua(M),patterns:{},sortKey:re};b.push(de)}k&&b.sort((M,B)=>M.sortKey-B.sortKey);for(const M of b){const{geometry:B,index:N,sourceLayerIndex:j}=M,W=e[N].feature;this.addFeature(M,B,N,h),s.featureIndex.insert(W,B,N,j,this.index)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Jn),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,s,h,m){for(const b of s)for(const x of b){const k=x.x,M=x.y;if(k<0||k>=Tr||M<0||M>=Tr)continue;const B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),N=B.vertexLength;hu(this.layoutVertexArray,k,M,-1,-1),hu(this.layoutVertexArray,k,M,1,-1),hu(this.layoutVertexArray,k,M,1,1),hu(this.layoutVertexArray,k,M,-1,1),this.indexArray.emplaceBack(N,N+1,N+2),this.indexArray.emplaceBack(N,N+3,N+2),B.vertexLength+=4,B.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,{},m)}}function Md(r,e){for(let s=0;s1){if(zh(r,e))return!0;for(let h=0;h1?s:s.sub(e)._mult(m)._add(e))}function Rd(r,e){let s,h,m,b=!1;for(let x=0;xe.y!=m.y>e.y&&e.x<(m.x-h.x)*(e.y-h.y)/(m.y-h.y)+h.x&&(b=!b)}return b}function Do(r,e){let s=!1;for(let h=0,m=r.length-1;he.y!=x.y>e.y&&e.x<(x.x-b.x)*(e.y-b.y)/(x.y-b.y)+b.x&&(s=!s)}return s}function Yy(r,e,s){const h=s[0],m=s[2];if(r.xm.x&&e.x>m.x||r.ym.y&&e.y>m.y)return!1;const b=We(r,e,s[0]);return b!==We(r,e,s[1])||b!==We(r,e,s[2])||b!==We(r,e,s[3])}function Xl(r,e,s){const h=e.paint.get(r).value;return h.kind==="constant"?h.value:s.programConfigurations.get(e.id).getMaxValue(r)}function fu(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function du(r,e,s,h,m){if(!e[0]&&!e[1])return r;const b=C.convert(e)._mult(m);s==="viewport"&&b._rotate(-h);const x=[];for(let k=0;kNd(Se,de))}(B,M),te=j?N*k:N;for(const re of m)for(const de of re){const Se=j?de:Nd(de,M);let Pe=te;const qe=pu([],[de.x,de.y,0,1],M);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?Pe*=qe[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(Pe*=x.cameraToCenterDistance/qe[3]),Ky(W,Se,Pe))return!0}return!1}}function Nd(r,e){const s=pu([],[r.x,r.y,0,1],e);return new C(s[0]/s[3],s[1]/s[3])}class Ud extends Ph{}let Vd;jt("HeatmapBucket",Ud,{omit:["layers"]});var i0={get paint(){return Vd=Vd||new en({"heatmap-radius":new ci(Ae.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ci(Ae.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Qt(Ae.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Xn(Ae.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Qt(Ae.paint_heatmap["heatmap-opacity"])})}};function Lh(r,{width:e,height:s},h,m){if(m){if(m instanceof Uint8ClampedArray)m=new Uint8Array(m.buffer);else if(m.length!==e*s*h)throw new RangeError(`mismatched image size. expected: ${m.length} but got: ${e*s*h}`)}else m=new Uint8Array(e*s*h);return r.width=e,r.height=s,r.data=m,r}function $d(r,{width:e,height:s},h){if(e===r.width&&s===r.height)return;const m=Lh({},{width:e,height:s},h);Rh(r,m,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,s)},h),r.width=e,r.height=s,r.data=m.data}function Rh(r,e,s,h,m,b){if(m.width===0||m.height===0)return e;if(m.width>r.width||m.height>r.height||s.x>r.width-m.width||s.y>r.height-m.height)throw new RangeError("out of range source coordinates for image copy");if(m.width>e.width||m.height>e.height||h.x>e.width-m.width||h.y>e.height-m.height)throw new RangeError("out of range destination coordinates for image copy");const x=r.data,k=e.data;if(x===k)throw new Error("srcData equals dstData, so image is already copied");for(let M=0;M{e[r.evaluationKey]=M;const B=r.expression.evaluate(e);m.data[x+k+0]=Math.floor(255*B.r/B.a),m.data[x+k+1]=Math.floor(255*B.g/B.a),m.data[x+k+2]=Math.floor(255*B.b/B.a),m.data[x+k+3]=Math.floor(255*B.a)};if(r.clips)for(let x=0,k=0;x80*s){h=b=r[0],m=x=r[1];for(var re=s;reb&&(b=k),M>x&&(x=M);B=(B=Math.max(b-h,x-m))!==0?32767/B:0}return Ql(W,te,s,h,m,B,0),te}function Zd(r,e,s,h,m){var b,x;if(m===Nh(r,e,s,h)>0)for(b=e;b=e;b-=h)x=Hd(b,r[b],r[b+1],x);return x&&gu(x,x.next)&&(tc(x),x=x.next),x}function $a(r,e){if(!r)return r;e||(e=r);var s,h=r;do if(s=!1,h.steiner||!gu(h,h.next)&&wr(h.prev,h,h.next)!==0)h=h.next;else{if(tc(h),(h=e=h.prev)===h.next)break;s=!0}while(s||h!==e);return e}function Ql(r,e,s,h,m,b,x){if(r){!x&&b&&function(N,j,W,te){var re=N;do re.z===0&&(re.z=Oh(re.x,re.y,j,W,te)),re.prevZ=re.prev,re.nextZ=re.next,re=re.next;while(re!==N);re.prevZ.nextZ=null,re.prevZ=null,function(de){var Se,Pe,qe,Le,He,rt,dt,Vt,Ht=1;do{for(Pe=de,de=null,He=null,rt=0;Pe;){for(rt++,qe=Pe,dt=0,Se=0;Se0||Vt>0&&qe;)dt!==0&&(Vt===0||!qe||Pe.z<=qe.z)?(Le=Pe,Pe=Pe.nextZ,dt--):(Le=qe,qe=qe.nextZ,Vt--),He?He.nextZ=Le:de=Le,Le.prevZ=He,He=Le;Pe=qe}He.nextZ=null,Ht*=2}while(rt>1)}(re)}(r,h,m,b);for(var k,M,B=r;r.prev!==r.next;)if(k=r.prev,M=r.next,b?c0(r,h,m,b):l0(r))e.push(k.i/s|0),e.push(r.i/s|0),e.push(M.i/s|0),tc(r),r=M.next,B=M.next;else if((r=M)===B){x?x===1?Ql(r=u0($a(r),e,s),e,s,h,m,b,2):x===2&&h0(r,e,s,h,m,b):Ql($a(r),e,s,h,m,b,1);break}}}function l0(r){var e=r.prev,s=r,h=r.next;if(wr(e,s,h)>=0)return!1;for(var m=e.x,b=s.x,x=h.x,k=e.y,M=s.y,B=h.y,N=mb?m>x?m:x:b>x?b:x,te=k>M?k>B?k:B:M>B?M:B,re=h.next;re!==e;){if(re.x>=N&&re.x<=W&&re.y>=j&&re.y<=te&&Ro(m,k,b,M,x,B,re.x,re.y)&&wr(re.prev,re,re.next)>=0)return!1;re=re.next}return!0}function c0(r,e,s,h){var m=r.prev,b=r,x=r.next;if(wr(m,b,x)>=0)return!1;for(var k=m.x,M=b.x,B=x.x,N=m.y,j=b.y,W=x.y,te=kM?k>B?k:B:M>B?M:B,Se=N>j?N>W?N:W:j>W?j:W,Pe=Oh(te,re,e,s,h),qe=Oh(de,Se,e,s,h),Le=r.prevZ,He=r.nextZ;Le&&Le.z>=Pe&&He&&He.z<=qe;){if(Le.x>=te&&Le.x<=de&&Le.y>=re&&Le.y<=Se&&Le!==m&&Le!==x&&Ro(k,N,M,j,B,W,Le.x,Le.y)&&wr(Le.prev,Le,Le.next)>=0||(Le=Le.prevZ,He.x>=te&&He.x<=de&&He.y>=re&&He.y<=Se&&He!==m&&He!==x&&Ro(k,N,M,j,B,W,He.x,He.y)&&wr(He.prev,He,He.next)>=0))return!1;He=He.nextZ}for(;Le&&Le.z>=Pe;){if(Le.x>=te&&Le.x<=de&&Le.y>=re&&Le.y<=Se&&Le!==m&&Le!==x&&Ro(k,N,M,j,B,W,Le.x,Le.y)&&wr(Le.prev,Le,Le.next)>=0)return!1;Le=Le.prevZ}for(;He&&He.z<=qe;){if(He.x>=te&&He.x<=de&&He.y>=re&&He.y<=Se&&He!==m&&He!==x&&Ro(k,N,M,j,B,W,He.x,He.y)&&wr(He.prev,He,He.next)>=0)return!1;He=He.nextZ}return!0}function u0(r,e,s){var h=r;do{var m=h.prev,b=h.next.next;!gu(m,b)&&Gd(m,h,h.next,b)&&ec(m,b)&&ec(b,m)&&(e.push(m.i/s|0),e.push(h.i/s|0),e.push(b.i/s|0),tc(h),tc(h.next),h=r=b),h=h.next}while(h!==r);return $a(h)}function h0(r,e,s,h,m,b){var x=r;do{for(var k=x.next.next;k!==x.prev;){if(x.i!==k.i&&g0(x,k)){var M=Wd(x,k);return x=$a(x,x.next),M=$a(M,M.next),Ql(x,e,s,h,m,b,0),void Ql(M,e,s,h,m,b,0)}k=k.next}x=x.next}while(x!==r)}function f0(r,e){return r.x-e.x}function d0(r,e){var s=function(m,b){var x,k=b,M=m.x,B=m.y,N=-1/0;do{if(B<=k.y&&B>=k.next.y&&k.next.y!==k.y){var j=k.x+(B-k.y)*(k.next.x-k.x)/(k.next.y-k.y);if(j<=M&&j>N&&(N=j,x=k.x=k.x&&k.x>=re&&M!==k.x&&Ro(Bx.x||k.x===x.x&&p0(x,k)))&&(x=k,Se=W)),k=k.next;while(k!==te);return x}(r,e);if(!s)return e;var h=Wd(s,r);return $a(h,h.next),$a(s,s.next)}function p0(r,e){return wr(r.prev,r,e.prev)<0&&wr(e.next,r,r.next)<0}function Oh(r,e,s,h,m){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-s)*m|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-h)*m|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function m0(r){var e=r,s=r;do(e.x=(r-x)*(b-k)&&(r-x)*(h-k)>=(s-x)*(e-k)&&(s-x)*(b-k)>=(m-x)*(h-k)}function g0(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!function(s,h){var m=s;do{if(m.i!==s.i&&m.next.i!==s.i&&m.i!==h.i&&m.next.i!==h.i&&Gd(m,m.next,s,h))return!0;m=m.next}while(m!==s);return!1}(r,e)&&(ec(r,e)&&ec(e,r)&&function(s,h){var m=s,b=!1,x=(s.x+h.x)/2,k=(s.y+h.y)/2;do m.y>k!=m.next.y>k&&m.next.y!==m.y&&x<(m.next.x-m.x)*(k-m.y)/(m.next.y-m.y)+m.x&&(b=!b),m=m.next;while(m!==s);return b}(r,e)&&(wr(r.prev,r,e.prev)||wr(r,e.prev,e))||gu(r,e)&&wr(r.prev,r,r.next)>0&&wr(e.prev,e,e.next)>0)}function wr(r,e,s){return(e.y-r.y)*(s.x-e.x)-(e.x-r.x)*(s.y-e.y)}function gu(r,e){return r.x===e.x&&r.y===e.y}function Gd(r,e,s,h){var m=yu(wr(r,e,s)),b=yu(wr(r,e,h)),x=yu(wr(s,h,r)),k=yu(wr(s,h,e));return m!==b&&x!==k||!(m!==0||!_u(r,s,e))||!(b!==0||!_u(r,h,e))||!(x!==0||!_u(s,r,h))||!(k!==0||!_u(s,e,h))}function _u(r,e,s){return e.x<=Math.max(r.x,s.x)&&e.x>=Math.min(r.x,s.x)&&e.y<=Math.max(r.y,s.y)&&e.y>=Math.min(r.y,s.y)}function yu(r){return r>0?1:r<0?-1:0}function ec(r,e){return wr(r.prev,r,r.next)<0?wr(r,e,r.next)>=0&&wr(r,r.prev,e)>=0:wr(r,e,r.prev)<0||wr(r,r.next,e)<0}function Wd(r,e){var s=new Fh(r.i,r.x,r.y),h=new Fh(e.i,e.x,e.y),m=r.next,b=e.prev;return r.next=e,e.prev=r,s.next=m,m.prev=s,h.next=s,s.prev=h,b.next=h,h.prev=b,h}function Hd(r,e,s,h){var m=new Fh(r,e,s);return h?(m.next=h.next,m.prev=h,h.next.prev=m,h.next=m):(m.prev=m,m.next=m),m}function tc(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Fh(r,e,s){this.i=r,this.x=e,this.y=s,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Nh(r,e,s,h){for(var m=0,b=e,x=s-h;b0&&s.holes.push(h+=r[m-1].length)}return s};var Kd=v(Bh.exports);function _0(r,e,s,h,m){Xd(r,e,s||0,h||r.length-1,m||y0)}function Xd(r,e,s,h,m){for(;h>s;){if(h-s>600){var b=h-s+1,x=e-s+1,k=Math.log(b),M=.5*Math.exp(2*k/3),B=.5*Math.sqrt(k*M*(b-M)/b)*(x-b/2<0?-1:1);Xd(r,e,Math.max(s,Math.floor(e-x*M/b+B)),Math.min(h,Math.floor(e+(b-x)*M/b+B)),m)}var N=r[e],j=s,W=h;for(ic(r,s,e),m(r[h],N)>0&&ic(r,s,h);j0;)W--}m(r[s],N)===0?ic(r,s,W):ic(r,++W,h),W<=e&&(s=W+1),e<=W&&(h=W-1)}}function ic(r,e,s){var h=r[e];r[e]=r[s],r[s]=h}function y0(r,e){return re?1:0}function Uh(r,e){const s=r.length;if(s<=1)return[r];const h=[];let m,b;for(let x=0;x1)for(let x=0;xs.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Lt,this.indexArray=new fr,this.indexArray2=new cr,this.programConfigurations=new Na(e.layers,e.zoom),this.segments=new nr,this.segments2=new nr,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){this.hasPattern=Vh("fill",this.layers,s);const m=this.layers[0].layout.get("fill-sort-key"),b=!m.isConstant(),x=[];for(const{feature:k,id:M,index:B,sourceLayerIndex:N}of e){const j=this.layers[0]._featureFilter.needGeometry,W=Va(k,j);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),W,h))continue;const te=b?m.evaluate(W,{},h,s.availableImages):void 0,re={id:M,properties:k.properties,type:k.type,sourceLayerIndex:N,index:B,geometry:j?W.geometry:Ua(k),patterns:{},sortKey:te};x.push(re)}b&&x.sort((k,M)=>k.sortKey-M.sortKey);for(const k of x){const{geometry:M,index:B,sourceLayerIndex:N}=k;if(this.hasPattern){const j=$h("fill",this.layers,k,this.zoom,s);this.patternFeatures.push(j)}else this.addFeature(k,M,B,h,{});s.featureIndex.insert(e[B].feature,M,B,N,this.index)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}addFeatures(e,s,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,s,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,o0),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,s,h,m,b){for(const x of Uh(s,500)){let k=0;for(const te of x)k+=te.length;const M=this.segments.prepareSegment(k,this.layoutVertexArray,this.indexArray),B=M.vertexLength,N=[],j=[];for(const te of x){if(te.length===0)continue;te!==x[0]&&j.push(N.length/2);const re=this.segments2.prepareSegment(te.length,this.layoutVertexArray,this.indexArray2),de=re.vertexLength;this.layoutVertexArray.emplaceBack(te[0].x,te[0].y),this.indexArray2.emplaceBack(de+te.length-1,de),N.push(te[0].x),N.push(te[0].y);for(let Se=1;Se>3}if(m--,h===1||h===2)b+=r.readSVarint(),x+=r.readSVarint(),h===1&&(e&&k.push(e),e=[]),e.push(new k0(b,x));else{if(h!==7)throw new Error("unknown command "+h);e&&e.push(e[0].clone())}}return e&&k.push(e),k},Bo.prototype.bbox=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,s=1,h=0,m=0,b=0,x=1/0,k=-1/0,M=1/0,B=-1/0;r.pos>3}if(h--,s===1||s===2)(m+=r.readSVarint())k&&(k=m),(b+=r.readSVarint())B&&(B=b);else if(s!==7)throw new Error("unknown command "+s)}return[x,M,k,B]},Bo.prototype.toGeoJSON=function(r,e,s){var h,m,b=this.extent*Math.pow(2,s),x=this.extent*r,k=this.extent*e,M=this.loadGeometry(),B=Bo.types[this.type];function N(te){for(var re=0;re>3;m=x===1?h.readString():x===2?h.readFloat():x===3?h.readDouble():x===4?h.readVarint64():x===5?h.readVarint():x===6?h.readSVarint():x===7?h.readBoolean():null}return m}(s))}tp.prototype.feature=function(r){if(r<0||r>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[r];var e=this._pbf.readVarint()+this._pbf.pos;return new I0(this._pbf,e,this.extent,this._keys,this._values)};var P0=ep;function z0(r,e,s){if(r===3){var h=new P0(s,s.readVarint()+s.pos);h.length&&(e[h.name]=h)}}oa.VectorTile=function(r,e){this.layers=r.readFields(z0,{},e)},oa.VectorTileFeature=Qd,oa.VectorTileLayer=ep;const M0=oa.VectorTileFeature.types,qh=Math.pow(2,13);function rc(r,e,s,h,m,b,x,k){r.emplaceBack(e,s,2*Math.floor(h*qh)+x,m*qh*2,b*qh*2,Math.round(k))}class Zh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(s=>s.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new ui,this.centroidVertexArray=new Wt,this.indexArray=new fr,this.programConfigurations=new Na(e.layers,e.zoom),this.segments=new nr,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){this.features=[],this.hasPattern=Vh("fill-extrusion",this.layers,s);for(const{feature:m,id:b,index:x,sourceLayerIndex:k}of e){const M=this.layers[0]._featureFilter.needGeometry,B=Va(m,M);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),B,h))continue;const N={id:b,sourceLayerIndex:k,index:x,geometry:M?B.geometry:Ua(m),properties:m.properties,type:m.type,patterns:{}};this.hasPattern?this.features.push($h("fill-extrusion",this.layers,N,this.zoom,s)):this.addFeature(N,N.geometry,x,h,{}),s.featureIndex.insert(m,N.geometry,x,k,this.index,!0)}}addFeatures(e,s,h){for(const m of this.features){const{geometry:b}=m;this.addFeature(m,b,m.index,s,h)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}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,S0),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,E0.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,s,h,m,b){const x={x:0,y:0,vertexCount:0};for(const k of Uh(s,500)){let M=0;for(const re of k)M+=re.length;let B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const re of k){if(re.length===0||L0(re))continue;let de=0;for(let Se=0;Se=1){const qe=re[Se-1];if(!D0(Pe,qe)){B.vertexLength+4>nr.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Le=Pe.sub(qe)._perp()._unit(),He=qe.dist(Pe);de+He>32768&&(de=0),rc(this.layoutVertexArray,Pe.x,Pe.y,Le.x,Le.y,0,0,de),rc(this.layoutVertexArray,Pe.x,Pe.y,Le.x,Le.y,0,1,de),x.x+=2*Pe.x,x.y+=2*Pe.y,x.vertexCount+=2,de+=He,rc(this.layoutVertexArray,qe.x,qe.y,Le.x,Le.y,0,0,de),rc(this.layoutVertexArray,qe.x,qe.y,Le.x,Le.y,0,1,de),x.x+=2*qe.x,x.y+=2*qe.y,x.vertexCount+=2;const rt=B.vertexLength;this.indexArray.emplaceBack(rt,rt+2,rt+1),this.indexArray.emplaceBack(rt+1,rt+2,rt+3),B.vertexLength+=4,B.primitiveLength+=2}}}}if(B.vertexLength+M>nr.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(M,this.layoutVertexArray,this.indexArray)),M0[e.type]!=="Polygon")continue;const N=[],j=[],W=B.vertexLength;for(const re of k)if(re.length!==0){re!==k[0]&&j.push(N.length/2);for(let de=0;deTr)||r.y===e.y&&(r.y<0||r.y>Tr)}function L0(r){return r.every(e=>e.x<0)||r.every(e=>e.x>Tr)||r.every(e=>e.y<0)||r.every(e=>e.y>Tr)}let ip;jt("FillExtrusionBucket",Zh,{omit:["layers","features"]});var R0={get paint(){return ip=ip||new en({"fill-extrusion-opacity":new Qt(Ae["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ci(Ae["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Qt(Ae["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Qt(Ae["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Co(Ae["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ci(Ae["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ci(Ae["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Qt(Ae["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class B0 extends $n{constructor(e){super(e,R0)}createBucket(e){return new Zh(e)}queryRadius(){return fu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,s,h,m,b,x,k,M){const B=du(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,k),N=this.paint.get("fill-extrusion-height").evaluate(s,h),j=this.paint.get("fill-extrusion-base").evaluate(s,h),W=function(re,de,Se,Pe){const qe=[];for(const Le of re){const He=[Le.x,Le.y,0,1];pu(He,He,de),qe.push(new C(He[0]/He[3],He[1]/He[3]))}return qe}(B,M),te=function(re,de,Se,Pe){const qe=[],Le=[],He=Pe[8]*de,rt=Pe[9]*de,dt=Pe[10]*de,Vt=Pe[11]*de,Ht=Pe[8]*Se,Ut=Pe[9]*Se,Rt=Pe[10]*Se,Mt=Pe[11]*Se;for(const qt of re){const Dt=[],St=[];for(const oi of qt){const Jt=oi.x,zi=oi.y,Qi=Pe[0]*Jt+Pe[4]*zi+Pe[12],sr=Pe[1]*Jt+Pe[5]*zi+Pe[13],Br=Pe[2]*Jt+Pe[6]*zi+Pe[14],On=Pe[3]*Jt+Pe[7]*zi+Pe[15],dn=Br+dt,Cr=On+Vt,Zr=Qi+Ht,Kr=sr+Ut,pn=Br+Rt,mn=On+Mt,Or=new C((Qi+He)/Cr,(sr+rt)/Cr);Or.z=dn/Cr,Dt.push(Or);const Fr=new C(Zr/mn,Kr/mn);Fr.z=pn/mn,St.push(Fr)}qe.push(Dt),Le.push(St)}return[qe,Le]}(m,j,N,M);return function(re,de,Se){let Pe=1/0;Dd(Se,de)&&(Pe=rp(Se,de[0]));for(let qe=0;qes.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(s=>{this.gradients[s.id]={}}),this.layoutVertexArray=new Kt,this.layoutVertexArray2=new rr,this.indexArray=new fr,this.programConfigurations=new Na(e.layers,e.zoom),this.segments=new nr,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){this.hasPattern=Vh("line",this.layers,s);const m=this.layers[0].layout.get("line-sort-key"),b=!m.isConstant(),x=[];for(const{feature:k,id:M,index:B,sourceLayerIndex:N}of e){const j=this.layers[0]._featureFilter.needGeometry,W=Va(k,j);if(!this.layers[0]._featureFilter.filter(new tr(this.zoom),W,h))continue;const te=b?m.evaluate(W,{},h):void 0,re={id:M,properties:k.properties,type:k.type,sourceLayerIndex:N,index:B,geometry:j?W.geometry:Ua(k),patterns:{},sortKey:te};x.push(re)}b&&x.sort((k,M)=>k.sortKey-M.sortKey);for(const k of x){const{geometry:M,index:B,sourceLayerIndex:N}=k;if(this.hasPattern){const j=$h("line",this.layers,k,this.zoom,s);this.patternFeatures.push(j)}else this.addFeature(k,M,B,h,{});s.featureIndex.insert(e[B].feature,M,B,N,this.index)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}addFeatures(e,s,h){for(const m of this.patternFeatures)this.addFeature(m,m.geometry,m.index,s,h)}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,U0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,F0),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,s,h,m,b){const x=this.layers[0].layout,k=x.get("line-join").evaluate(e,{}),M=x.get("line-cap"),B=x.get("line-miter-limit"),N=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const j of s)this.addLine(j,e,k,M,B,N);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,b,m)}addLine(e,s,h,m,b,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Pe=0;Pe=2&&e[M-1].equals(e[M-2]);)M--;let B=0;for(;B0;if(Vt&&Pe>B){const Mt=W.dist(te);if(Mt>2*N){const qt=W.sub(W.sub(te)._mult(N/Mt)._round());this.updateDistance(te,qt),this.addCurrentVertex(qt,de,0,0,j),te=qt}}const Ut=te&&re;let Rt=Ut?h:k?"butt":m;if(Ut&&Rt==="round"&&(rtb&&(Rt="bevel"),Rt==="bevel"&&(rt>2&&(Rt="flipbevel"),rt100)qe=Se.mult(-1);else{const Mt=rt*de.add(Se).mag()/de.sub(Se).mag();qe._perp()._mult(Mt*(Ht?-1:1))}this.addCurrentVertex(W,qe,0,0,j),this.addCurrentVertex(W,qe.mult(-1),0,0,j)}else if(Rt==="bevel"||Rt==="fakeround"){const Mt=-Math.sqrt(rt*rt-1),qt=Ht?Mt:0,Dt=Ht?0:Mt;if(te&&this.addCurrentVertex(W,de,qt,Dt,j),Rt==="fakeround"){const St=Math.round(180*dt/Math.PI/20);for(let oi=1;oi2*N){const qt=W.add(re.sub(W)._mult(N/Mt)._round());this.updateDistance(W,qt),this.addCurrentVertex(qt,Se,0,0,j),W=qt}}}}addCurrentVertex(e,s,h,m,b,x=!1){const k=s.y*m-s.x,M=-s.y-s.x*m;this.addHalfVertex(e,s.x+s.y*h,s.y-s.x*h,x,!1,h,b),this.addHalfVertex(e,k,M,x,!0,-m,b),this.distance>np/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,s,h,m,b,x))}addHalfVertex({x:e,y:s},h,m,b,x,k,M){const B=.5*(this.lineClips?this.scaledDistance*(np-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(b?1:0),(s<<1)+(x?1:0),Math.round(63*h)+128,Math.round(63*m)+128,1+(k===0?0:k<0?-1:1)|(63&B)<<2,B>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const N=M.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,N),M.primitiveLength++),x?this.e2=N:this.e1=N}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,s){this.distance+=e.dist(s),this.updateScaledDistance()}}let sp,ap;jt("LineBucket",Gh,{omit:["layers","patternFeatures"]});var op={get paint(){return ap=ap||new en({"line-opacity":new ci(Ae.paint_line["line-opacity"]),"line-color":new ci(Ae.paint_line["line-color"]),"line-translate":new Qt(Ae.paint_line["line-translate"]),"line-translate-anchor":new Qt(Ae.paint_line["line-translate-anchor"]),"line-width":new ci(Ae.paint_line["line-width"]),"line-gap-width":new ci(Ae.paint_line["line-gap-width"]),"line-offset":new ci(Ae.paint_line["line-offset"]),"line-blur":new ci(Ae.paint_line["line-blur"]),"line-dasharray":new Zl(Ae.paint_line["line-dasharray"]),"line-pattern":new Co(Ae.paint_line["line-pattern"]),"line-gradient":new Xn(Ae.paint_line["line-gradient"])})},get layout(){return sp=sp||new en({"line-cap":new Qt(Ae.layout_line["line-cap"]),"line-join":new ci(Ae.layout_line["line-join"]),"line-miter-limit":new Qt(Ae.layout_line["line-miter-limit"]),"line-round-limit":new Qt(Ae.layout_line["line-round-limit"]),"line-sort-key":new ci(Ae.layout_line["line-sort-key"])})}};class j0 extends ci{possiblyEvaluate(e,s){return s=new tr(Math.floor(s.zoom),{now:s.now,fadeDuration:s.fadeDuration,zoomHistory:s.zoomHistory,transition:s.transition}),super.possiblyEvaluate(e,s)}evaluate(e,s,h,m){return s=ge({},s,{zoom:Math.floor(s.zoom)}),super.evaluate(e,s,h,m)}}let vu;class q0 extends $n{constructor(e){super(e,op),this.gradientVersion=0,vu||(vu=new j0(op.paint.properties["line-width"].specification),vu.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const s=this.gradientExpression();this.stepInterpolant=!!function(h){return h._styleExpression!==void 0}(s)&&s._styleExpression.expression instanceof Oi,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,s){super.recalculate(e,s),this.paint._values["line-floorwidth"]=vu.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Gh(e)}queryRadius(e){const s=e,h=lp(Xl("line-width",this,s),Xl("line-gap-width",this,s)),m=Xl("line-offset",this,s);return h/2+Math.abs(m)+fu(this.paint.get("line-translate"))}queryIntersectsFeature(e,s,h,m,b,x,k){const M=du(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,k),B=k/2*lp(this.paint.get("line-width").evaluate(s,h),this.paint.get("line-gap-width").evaluate(s,h)),N=this.paint.get("line-offset").evaluate(s,h);return N&&(m=function(j,W){const te=[];for(let re=0;re=3){for(let Se=0;Se0?e+2*r:r}const Z0=ir([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),G0=ir([{name:"a_projected_pos",components:3,type:"Float32"}],4);ir([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const W0=ir([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);ir([{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 cp=ir([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),H0=ir([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function K0(r,e,s){return r.sections.forEach(h=>{h.text=function(m,b,x){const k=b.layout.get("text-transform").evaluate(x,{});return k==="uppercase"?m=m.toLocaleUpperCase():k==="lowercase"&&(m=m.toLocaleLowerCase()),Sn.applyArabicShaping&&(m=Sn.applyArabicShaping(m)),m}(h.text,e,s)}),r}ir([{name:"triangle",components:3,type:"Uint16"}]),ir([{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"}]),ir([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),ir([{type:"Float32",name:"offsetX"}]),ir([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ir([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const sc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Rr=24,up=Hi,hp=function(r,e,s,h,m){var b,x,k=8*m-h-1,M=(1<>1,N=-7,j=s?m-1:0,W=s?-1:1,te=r[e+j];for(j+=W,b=te&(1<<-N)-1,te>>=-N,N+=k;N>0;b=256*b+r[e+j],j+=W,N-=8);for(x=b&(1<<-N)-1,b>>=-N,N+=h;N>0;x=256*x+r[e+j],j+=W,N-=8);if(b===0)b=1-B;else{if(b===M)return x?NaN:1/0*(te?-1:1);x+=Math.pow(2,h),b-=B}return(te?-1:1)*x*Math.pow(2,b-h)},fp=function(r,e,s,h,m,b){var x,k,M,B=8*b-m-1,N=(1<>1,W=m===23?Math.pow(2,-24)-Math.pow(2,-77):0,te=h?0:b-1,re=h?1:-1,de=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(k=isNaN(e)?1:0,x=N):(x=Math.floor(Math.log(e)/Math.LN2),e*(M=Math.pow(2,-x))<1&&(x--,M*=2),(e+=x+j>=1?W/M:W*Math.pow(2,1-j))*M>=2&&(x++,M/=2),x+j>=N?(k=0,x=N):x+j>=1?(k=(e*M-1)*Math.pow(2,m),x+=j):(k=e*Math.pow(2,j-1)*Math.pow(2,m),x=0));m>=8;r[s+te]=255&k,te+=re,k/=256,m-=8);for(x=x<0;r[s+te]=255&x,te+=re,x/=256,B-=8);r[s+te-re]|=128*de};function Hi(r){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(r)?r:new Uint8Array(r||0),this.pos=0,this.type=0,this.length=this.buf.length}Hi.Varint=0,Hi.Fixed64=1,Hi.Bytes=2,Hi.Fixed32=5;var Wh=4294967296,dp=1/Wh,pp=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Vs(r){return r.type===Hi.Bytes?r.readVarint()+r.pos:r.pos+1}function Oo(r,e,s){return s?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function mp(r,e,s){var h=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));s.realloc(h);for(var m=s.pos-1;m>=r;m--)s.buf[m+h]=s.buf[m]}function X0(r,e){for(var s=0;s>>8,r[s+2]=e>>>16,r[s+3]=e>>>24}function gp(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+(r[e+3]<<24)}Hi.prototype={destroy:function(){this.buf=null},readFields:function(r,e,s){for(s=s||this.length;this.pos>3,b=this.pos;this.type=7&h,r(m,e,this),this.pos===b&&this.skip(h)}return e},readMessage:function(r,e){return this.readFields(r,e,this.readVarint()+this.pos)},readFixed32:function(){var r=bu(this.buf,this.pos);return this.pos+=4,r},readSFixed32:function(){var r=gp(this.buf,this.pos);return this.pos+=4,r},readFixed64:function(){var r=bu(this.buf,this.pos)+bu(this.buf,this.pos+4)*Wh;return this.pos+=8,r},readSFixed64:function(){var r=bu(this.buf,this.pos)+gp(this.buf,this.pos+4)*Wh;return this.pos+=8,r},readFloat:function(){var r=hp(this.buf,this.pos,!0,23,4);return this.pos+=4,r},readDouble:function(){var r=hp(this.buf,this.pos,!0,52,8);return this.pos+=8,r},readVarint:function(r){var e,s,h=this.buf;return e=127&(s=h[this.pos++]),s<128?e:(e|=(127&(s=h[this.pos++]))<<7,s<128?e:(e|=(127&(s=h[this.pos++]))<<14,s<128?e:(e|=(127&(s=h[this.pos++]))<<21,s<128?e:function(m,b,x){var k,M,B=x.buf;if(k=(112&(M=B[x.pos++]))>>4,M<128||(k|=(127&(M=B[x.pos++]))<<3,M<128)||(k|=(127&(M=B[x.pos++]))<<10,M<128)||(k|=(127&(M=B[x.pos++]))<<17,M<128)||(k|=(127&(M=B[x.pos++]))<<24,M<128)||(k|=(1&(M=B[x.pos++]))<<31,M<128))return Oo(m,k,b);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(s=h[this.pos]))<<28,r,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var r=this.readVarint();return r%2==1?(r+1)/-2:r/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=12&&pp?function(s,h,m){return pp.decode(s.subarray(h,m))}(this.buf,e,r):function(s,h,m){for(var b="",x=h;x239?4:N>223?3:N>191?2:1;if(x+W>m)break;W===1?N<128&&(j=N):W===2?(192&(k=s[x+1]))==128&&(j=(31&N)<<6|63&k)<=127&&(j=null):W===3?(M=s[x+2],(192&(k=s[x+1]))==128&&(192&M)==128&&((j=(15&N)<<12|(63&k)<<6|63&M)<=2047||j>=55296&&j<=57343)&&(j=null)):W===4&&(M=s[x+2],B=s[x+3],(192&(k=s[x+1]))==128&&(192&M)==128&&(192&B)==128&&((j=(15&N)<<18|(63&k)<<12|(63&M)<<6|63&B)<=65535||j>=1114112)&&(j=null)),j===null?(j=65533,W=1):j>65535&&(j-=65536,b+=String.fromCharCode(j>>>10&1023|55296),j=56320|1023&j),b+=String.fromCharCode(j),x+=W}return b}(this.buf,e,r)},readBytes:function(){var r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e},readPackedVarint:function(r,e){if(this.type!==Hi.Bytes)return r.push(this.readVarint(e));var s=Vs(this);for(r=r||[];this.pos127;);else if(e===Hi.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Hi.Fixed32)this.pos+=4;else{if(e!==Hi.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(r,e){this.writeVarint(r<<3|e)},realloc:function(r){for(var e=this.length||16;e268435455||r<0?function(e,s){var h,m;if(e>=0?(h=e%4294967296|0,m=e/4294967296|0):(m=~(-e/4294967296),4294967295^(h=~(-e%4294967296))?h=h+1|0:(h=0,m=m+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),function(b,x,k){k.buf[k.pos++]=127&b|128,b>>>=7,k.buf[k.pos++]=127&b|128,b>>>=7,k.buf[k.pos++]=127&b|128,b>>>=7,k.buf[k.pos++]=127&b|128,k.buf[k.pos]=127&(b>>>=7)}(h,0,s),function(b,x){var k=(7&b)<<4;x.buf[x.pos++]|=k|((b>>>=3)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b|((b>>>=7)?128:0),b&&(x.buf[x.pos++]=127&b)))))}(m,s)}(r,this):(this.realloc(4),this.buf[this.pos++]=127&r|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=r>>>7&127))))},writeSVarint:function(r){this.writeVarint(r<0?2*-r-1:2*r)},writeBoolean:function(r){this.writeVarint(!!r)},writeString:function(r){r=String(r),this.realloc(4*r.length),this.pos++;var e=this.pos;this.pos=function(h,m,b){for(var x,k,M=0;M55295&&x<57344){if(!k){x>56319||M+1===m.length?(h[b++]=239,h[b++]=191,h[b++]=189):k=x;continue}if(x<56320){h[b++]=239,h[b++]=191,h[b++]=189,k=x;continue}x=k-55296<<10|x-56320|65536,k=null}else k&&(h[b++]=239,h[b++]=191,h[b++]=189,k=null);x<128?h[b++]=x:(x<2048?h[b++]=x>>6|192:(x<65536?h[b++]=x>>12|224:(h[b++]=x>>18|240,h[b++]=x>>12&63|128),h[b++]=x>>6&63|128),h[b++]=63&x|128)}return b}(this.buf,r,this.pos);var s=this.pos-e;s>=128&&mp(e,s,this),this.pos=e-1,this.writeVarint(s),this.pos+=s},writeFloat:function(r){this.realloc(4),fp(this.buf,r,this.pos,!0,23,4),this.pos+=4},writeDouble:function(r){this.realloc(8),fp(this.buf,r,this.pos,!0,52,8),this.pos+=8},writeBytes:function(r){var e=r.length;this.writeVarint(e),this.realloc(e);for(var s=0;s=128&&mp(s,h,this),this.pos=s-1,this.writeVarint(h),this.pos+=h},writeMessage:function(r,e,s){this.writeTag(r,Hi.Bytes),this.writeRawMessage(e,s)},writePackedVarint:function(r,e){e.length&&this.writeMessage(r,X0,e)},writePackedSVarint:function(r,e){e.length&&this.writeMessage(r,J0,e)},writePackedBoolean:function(r,e){e.length&&this.writeMessage(r,e1,e)},writePackedFloat:function(r,e){e.length&&this.writeMessage(r,Y0,e)},writePackedDouble:function(r,e){e.length&&this.writeMessage(r,Q0,e)},writePackedFixed32:function(r,e){e.length&&this.writeMessage(r,t1,e)},writePackedSFixed32:function(r,e){e.length&&this.writeMessage(r,i1,e)},writePackedFixed64:function(r,e){e.length&&this.writeMessage(r,r1,e)},writePackedSFixed64:function(r,e){e.length&&this.writeMessage(r,n1,e)},writeBytesField:function(r,e){this.writeTag(r,Hi.Bytes),this.writeBytes(e)},writeFixed32Field:function(r,e){this.writeTag(r,Hi.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(r,e){this.writeTag(r,Hi.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(r,e){this.writeTag(r,Hi.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(r,e){this.writeTag(r,Hi.Fixed64),this.writeSFixed64(e)},writeVarintField:function(r,e){this.writeTag(r,Hi.Varint),this.writeVarint(e)},writeSVarintField:function(r,e){this.writeTag(r,Hi.Varint),this.writeSVarint(e)},writeStringField:function(r,e){this.writeTag(r,Hi.Bytes),this.writeString(e)},writeFloatField:function(r,e){this.writeTag(r,Hi.Fixed32),this.writeFloat(e)},writeDoubleField:function(r,e){this.writeTag(r,Hi.Fixed64),this.writeDouble(e)},writeBooleanField:function(r,e){this.writeVarintField(r,!!e)}};var Hh=v(up);const Kh=3;function s1(r,e,s){r===1&&s.readMessage(a1,e)}function a1(r,e,s){if(r===3){const{id:h,bitmap:m,width:b,height:x,left:k,top:M,advance:B}=s.readMessage(o1,{});e.push({id:h,bitmap:new Yl({width:b+2*Kh,height:x+2*Kh},m),metrics:{width:b,height:x,left:k,top:M,advance:B}})}}function o1(r,e,s){r===1?e.id=s.readVarint():r===2?e.bitmap=s.readBytes():r===3?e.width=s.readVarint():r===4?e.height=s.readVarint():r===5?e.left=s.readSVarint():r===6?e.top=s.readSVarint():r===7&&(e.advance=s.readVarint())}const _p=Kh;function yp(r){let e=0,s=0;for(const x of r)e+=x.w*x.h,s=Math.max(s,x.w);r.sort((x,k)=>k.h-x.h);const h=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),s),h:1/0}];let m=0,b=0;for(const x of r)for(let k=h.length-1;k>=0;k--){const M=h[k];if(!(x.w>M.w||x.h>M.h)){if(x.x=M.x,x.y=M.y,b=Math.max(b,x.y+x.h),m=Math.max(m,x.x+x.w),x.w===M.w&&x.h===M.h){const B=h.pop();k=0&&h>=e&&xu[this.text.charCodeAt(h)];h--)s--;this.text=this.text.substring(e,s),this.sectionIndex=this.sectionIndex.slice(e,s)}substring(e,s){const h=new No;return h.text=this.text.substring(e,s),h.sectionIndex=this.sectionIndex.slice(e,s),h.sections=this.sections,h}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,s)=>Math.max(e,this.sections[s].scale),0)}addTextSection(e,s){this.text+=e.text,this.sections.push(oc.forText(e.scale,e.fontStack||s));const h=this.sections.length-1;for(let m=0;m=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function wu(r,e,s,h,m,b,x,k,M,B,N,j,W,te,re,de){const Se=No.fromFeature(r,m);let Pe;j===n.WritingMode.vertical&&Se.verticalizePunctuation();const{processBidirectionalText:qe,processStyledBidirectionalText:Le}=Sn;if(qe&&Se.sections.length===1){Pe=[];const dt=qe(Se.toString(),Jh(Se,B,b,e,h,te,re));for(const Vt of dt){const Ht=new No;Ht.text=Vt,Ht.sections=Se.sections;for(let Ut=0;Ut0&&js>An&&(An=js)}else{const Zn=Ht[Ri.fontStack],zn=Zn&&Zn[Xr];if(zn&&zn.rect)us=zn.rect,Qn=zn.metrics;else{const js=Vt[Ri.fontStack],fc=js&&js[Xr];if(!fc)continue;Qn=fc.metrics}Ur=(Fr-Ri.scale)*Rr}es?(dt.verticalizable=!0,nn.push({glyph:Xr,imageName:hs,x:Qi,y:sr+Ur,vertical:es,scale:Ri.scale,fontStack:Ri.fontStack,sectionIndex:sn,metrics:Qn,rect:us}),Qi+=$s*Ri.scale+oi):(nn.push({glyph:Xr,imageName:hs,x:Qi,y:sr+Ur,vertical:es,scale:Ri.scale,fontStack:Ri.fontStack,sectionIndex:sn,metrics:Qn,rect:us}),Qi+=Qn.advance*Ri.scale+oi)}nn.length!==0&&(Br=Math.max(Qi-oi,Br),u1(nn,0,nn.length-1,dn,An)),Qi=0;const Pn=Mt*Fr+An;gn.lineOffset=Math.max(An,rn),sr+=Pn,On=Math.max(Pn,On),++Cr}var Zr;const Kr=sr-ac,{horizontalAlign:pn,verticalAlign:mn}=Yh(qt);(function(Or,Fr,rn,gn,nn,An,Pn,Nr,Ri){const sn=(Fr-rn)*nn;let Xr=0;Xr=An!==Pn?-Nr*gn-ac:(-gn*Ri+.5)*Pn;for(const Ur of Or)for(const Qn of Ur.positionedGlyphs)Qn.x+=sn,Qn.y+=Xr})(dt.positionedLines,dn,pn,mn,Br,On,Mt,Kr,Rt.length),dt.top+=-mn*Kr,dt.bottom=dt.top+Kr,dt.left+=-pn*Br,dt.right=dt.left+Br}(rt,e,s,h,Pe,x,k,M,j,B,W,de),!function(dt){for(const Vt of dt)if(Vt.positionedGlyphs.length!==0)return!1;return!0}(He)&&rt}const xu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},l1={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 bp(r,e,s,h,m,b){if(e.imageName){const x=h[e.imageName];return x?x.displaySize[0]*e.scale*Rr/b+m:0}{const x=s[e.fontStack],k=x&&x[r];return k?k.metrics.advance*e.scale+m:0}}function wp(r,e,s,h){const m=Math.pow(r-e,2);return h?r=0;let N=0;for(let W=0;Wx.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=Dh([]),this.placementViewportMatrix=Dh([]);const s=this.layers[0]._unevaluatedLayout._values;this.textSizeData=kp(this.zoom,s["text-size"]),this.iconSizeData=kp(this.zoom,s["icon-size"]);const h=this.layers[0].layout,m=h.get("symbol-sort-key"),b=h.get("symbol-z-order");this.canOverlap=Qh(h,"text-overlap","text-allow-overlap")!=="never"||Qh(h,"icon-overlap","icon-allow-overlap")!=="never"||h.get("text-ignore-placement")||h.get("icon-ignore-placement"),this.sortFeaturesByKey=b!=="viewport-y"&&!m.isConstant(),this.sortFeaturesByY=(b==="viewport-y"||b==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,h.get("symbol-placement")==="point"&&(this.writingModes=h.get("text-writing-mode").map(x=>n.WritingMode[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=e.sourceID}createArrays(){this.text=new tf(new Na(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new tf(new Na(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new at,this.lineVertexArray=new ot,this.symbolInstances=new je,this.textAnchorOffsets=new Et}calculateGlyphDependencies(e,s,h,m,b){for(let x=0;x0)&&(x.value.kind!=="constant"||x.value.value.length>0),N=M.value.kind!=="constant"||!!M.value.value||Object.keys(M.parameters).length>0,j=b.get("symbol-sort-key");if(this.features=[],!B&&!N)return;const W=s.iconDependencies,te=s.glyphDependencies,re=s.availableImages,de=new tr(this.zoom);for(const{feature:Se,id:Pe,index:qe,sourceLayerIndex:Le}of e){const He=m._featureFilter.needGeometry,rt=Va(Se,He);if(!m._featureFilter.filter(de,rt,h))continue;let dt,Vt;if(He||(rt.geometry=Ua(Se)),B){const Ut=m.getValueAndResolveTokens("text-field",rt,h,re),Rt=lr.factory(Ut);p1(Rt)&&(this.hasRTLText=!0),(!this.hasRTLText||$l()==="unavailable"||this.hasRTLText&&Sn.isParsed())&&(dt=K0(Rt,m,rt))}if(N){const Ut=m.getValueAndResolveTokens("icon-image",rt,h,re);Vt=Ut instanceof Lr?Ut:Lr.fromString(Ut)}if(!dt&&!Vt)continue;const Ht=this.sortFeaturesByKey?j.evaluate(rt,{},h):void 0;if(this.features.push({id:Pe,text:dt,icon:Vt,index:qe,sourceLayerIndex:Le,geometry:rt.geometry,properties:Se.properties,type:f1[Se.type],sortKey:Ht}),Vt&&(W[Vt.name]=!0),dt){const Ut=x.evaluate(rt,{},h).join(","),Rt=b.get("text-rotation-alignment")!=="viewport"&&b.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(n.WritingMode.vertical)>=0;for(const Mt of dt.sections)if(Mt.image)W[Mt.image.name]=!0;else{const qt=La(dt.toString()),Dt=Mt.fontStack||Ut,St=te[Dt]=te[Dt]||{};this.calculateGlyphDependencies(Mt.text,St,Rt,this.allowVerticalPlacement,qt)}}}b.get("symbol-placement")==="line"&&(this.features=function(Se){const Pe={},qe={},Le=[];let He=0;function rt(Ut){Le.push(Se[Ut]),He++}function dt(Ut,Rt,Mt){const qt=qe[Ut];return delete qe[Ut],qe[Rt]=qt,Le[qt].geometry[0].pop(),Le[qt].geometry[0]=Le[qt].geometry[0].concat(Mt[0]),qt}function Vt(Ut,Rt,Mt){const qt=Pe[Rt];return delete Pe[Rt],Pe[Ut]=qt,Le[qt].geometry[0].shift(),Le[qt].geometry[0]=Mt[0].concat(Le[qt].geometry[0]),qt}function Ht(Ut,Rt,Mt){const qt=Mt?Rt[0][Rt[0].length-1]:Rt[0][0];return`${Ut}:${qt.x}:${qt.y}`}for(let Ut=0;UtUt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((Se,Pe)=>Se.sortKey-Pe.sortKey)}update(e,s,h){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,s,this.layers,h),this.icon.programConfigurations.updatePaintArrays(e,s,this.layers,h))}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,s){const h=this.lineVertexArray.length;if(e.segment!==void 0){let m=e.dist(s[e.segment+1]),b=e.dist(s[e.segment]);const x={};for(let k=e.segment+1;k=0;k--)x[k]={x:s[k].x,y:s[k].y,tileUnitDistanceFromAnchor:b},k>0&&(b+=s[k-1].dist(s[k]));for(let k=0;k0}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,s){const h=e.placedSymbolArray.get(s),m=h.vertexStartIndex+4*h.numGlyphs;for(let b=h.vertexStartIndex;bm[k]-m[M]||b[M]-b[k]),x}addToSortKeyRanges(e,s){const h=this.sortKeyRanges[this.sortKeyRanges.length-1];h&&h.sortKey===s?h.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:s,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 s of this.symbolInstanceIndexes){const h=this.symbolInstances.get(s);this.featureSortOrder.push(h.featureIndex),[h.rightJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.leftJustifiedTextSymbolIndex].forEach((m,b,x)=>{m>=0&&x.indexOf(m)===b&&this.addIndicesForPlacedSymbol(this.text,m)}),h.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,h.verticalPlacedTextSymbolIndex),h.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.placedIconSymbolIndex),h.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Tp,Cp;jt("SymbolBucket",Uo,{omit:["layers","collisionBoxArray","features","compareText"]}),Uo.MAX_GLYPHS=65535,Uo.addDynamicAttributes=ef;var nf={get paint(){return Cp=Cp||new en({"icon-opacity":new ci(Ae.paint_symbol["icon-opacity"]),"icon-color":new ci(Ae.paint_symbol["icon-color"]),"icon-halo-color":new ci(Ae.paint_symbol["icon-halo-color"]),"icon-halo-width":new ci(Ae.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ci(Ae.paint_symbol["icon-halo-blur"]),"icon-translate":new Qt(Ae.paint_symbol["icon-translate"]),"icon-translate-anchor":new Qt(Ae.paint_symbol["icon-translate-anchor"]),"text-opacity":new ci(Ae.paint_symbol["text-opacity"]),"text-color":new ci(Ae.paint_symbol["text-color"],{runtimeType:Sr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new ci(Ae.paint_symbol["text-halo-color"]),"text-halo-width":new ci(Ae.paint_symbol["text-halo-width"]),"text-halo-blur":new ci(Ae.paint_symbol["text-halo-blur"]),"text-translate":new Qt(Ae.paint_symbol["text-translate"]),"text-translate-anchor":new Qt(Ae.paint_symbol["text-translate-anchor"])})},get layout(){return Tp=Tp||new en({"symbol-placement":new Qt(Ae.layout_symbol["symbol-placement"]),"symbol-spacing":new Qt(Ae.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Qt(Ae.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ci(Ae.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Qt(Ae.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Qt(Ae.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Qt(Ae.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Qt(Ae.layout_symbol["icon-ignore-placement"]),"icon-optional":new Qt(Ae.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Qt(Ae.layout_symbol["icon-rotation-alignment"]),"icon-size":new ci(Ae.layout_symbol["icon-size"]),"icon-text-fit":new Qt(Ae.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Qt(Ae.layout_symbol["icon-text-fit-padding"]),"icon-image":new ci(Ae.layout_symbol["icon-image"]),"icon-rotate":new ci(Ae.layout_symbol["icon-rotate"]),"icon-padding":new ci(Ae.layout_symbol["icon-padding"]),"icon-keep-upright":new Qt(Ae.layout_symbol["icon-keep-upright"]),"icon-offset":new ci(Ae.layout_symbol["icon-offset"]),"icon-anchor":new ci(Ae.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Qt(Ae.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Qt(Ae.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Qt(Ae.layout_symbol["text-rotation-alignment"]),"text-field":new ci(Ae.layout_symbol["text-field"]),"text-font":new ci(Ae.layout_symbol["text-font"]),"text-size":new ci(Ae.layout_symbol["text-size"]),"text-max-width":new ci(Ae.layout_symbol["text-max-width"]),"text-line-height":new Qt(Ae.layout_symbol["text-line-height"]),"text-letter-spacing":new ci(Ae.layout_symbol["text-letter-spacing"]),"text-justify":new ci(Ae.layout_symbol["text-justify"]),"text-radial-offset":new ci(Ae.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Qt(Ae.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new ci(Ae.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new ci(Ae.layout_symbol["text-anchor"]),"text-max-angle":new Qt(Ae.layout_symbol["text-max-angle"]),"text-writing-mode":new Qt(Ae.layout_symbol["text-writing-mode"]),"text-rotate":new ci(Ae.layout_symbol["text-rotate"]),"text-padding":new Qt(Ae.layout_symbol["text-padding"]),"text-keep-upright":new Qt(Ae.layout_symbol["text-keep-upright"]),"text-transform":new ci(Ae.layout_symbol["text-transform"]),"text-offset":new ci(Ae.layout_symbol["text-offset"]),"text-allow-overlap":new Qt(Ae.layout_symbol["text-allow-overlap"]),"text-overlap":new Qt(Ae.layout_symbol["text-overlap"]),"text-ignore-placement":new Qt(Ae.layout_symbol["text-ignore-placement"]),"text-optional":new Qt(Ae.layout_symbol["text-optional"])})}};class Ip{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 s=this.defaultValue.property.overrides;if(s&&s.hasOverride(e.formattedSection))return s.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}}jt("FormatSectionOverride",Ip,{omit:["defaultValue"]});class Su extends $n{constructor(e){super(e,nf)}recalculate(e,s){if(super.recalculate(e,s),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 h=this.layout.get("text-writing-mode");if(h){const m=[];for(const b of h)m.indexOf(b)<0&&m.push(b);this.layout._values["text-writing-mode"]=m}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,s,h,m){const b=this.layout.get(e).evaluate(s,{},h,m),x=this._unevaluatedLayout._values[e];return x.isDataDriven()||vo(x.value)||!b?b:function(k,M){return M.replace(/{([^{}]+)}/g,(B,N)=>N in k?String(k[N]):"")}(s.properties,b)}createBucket(e){return new Uo(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of nf.paint.overridableProperties){if(!Su.hasPaintOverride(this.layout,e))continue;const s=this.paint.get(e),h=new Ip(s),m=new xl(h,s.property.specification);let b=null;b=s.value.kind==="constant"||s.value.kind==="source"?new wo("source",m):new xo("composite",m,s.value.zoomStops),this.paint._values[e]=new Kn(s.property,b,s.parameters)}}_handleOverridablePaintPropertyUpdate(e,s,h){return!(!this.layout||s.isDataDriven()||h.isDataDriven())&&Su.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,s){const h=e.get("text-field"),m=nf.paint.properties[s];let b=!1;const x=k=>{for(const M of k)if(m.overrides&&m.overrides.hasOverride(M))return void(b=!0)};if(h.value.kind==="constant"&&h.value.value instanceof lr)x(h.value.value.sections);else if(h.value.kind==="source"){const k=B=>{b||(B instanceof Yr&&yi(B.value)===be?x(B.value.sections):B instanceof po?x(B.sections):B.eachChild(k))},M=h.value;M._styleExpression&&k(M._styleExpression.expression)}return b}}let Ap;var m1={get paint(){return Ap=Ap||new en({"background-color":new Qt(Ae.paint_background["background-color"]),"background-pattern":new Zl(Ae.paint_background["background-pattern"]),"background-opacity":new Qt(Ae.paint_background["background-opacity"])})}};class g1 extends $n{constructor(e){super(e,m1)}}let Pp;var _1={get paint(){return Pp=Pp||new en({"raster-opacity":new Qt(Ae.paint_raster["raster-opacity"]),"raster-hue-rotate":new Qt(Ae.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Qt(Ae.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Qt(Ae.paint_raster["raster-brightness-max"]),"raster-saturation":new Qt(Ae.paint_raster["raster-saturation"]),"raster-contrast":new Qt(Ae.paint_raster["raster-contrast"]),"raster-resampling":new Qt(Ae.paint_raster["raster-resampling"]),"raster-fade-duration":new Qt(Ae.paint_raster["raster-fade-duration"])})}};class y1 extends $n{constructor(e){super(e,_1)}}class v1 extends $n{constructor(e){super(e,{}),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.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")}}class b1{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const sf=63710088e-1;class ua{constructor(e,s){if(isNaN(e)||isNaN(s))throw new Error(`Invalid LngLat object: (${e}, ${s})`);if(this.lng=+e,this.lat=+s,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ua(le(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const s=Math.PI/180,h=this.lat*s,m=e.lat*s,b=Math.sin(h)*Math.sin(m)+Math.cos(h)*Math.cos(m)*Math.cos((e.lng-this.lng)*s);return sf*Math.acos(Math.min(b,1))}static convert(e){if(e instanceof ua)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new ua(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new ua(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 zp=2*Math.PI*sf;function Mp(r){return zp*Math.cos(r*Math.PI/180)}function Dp(r){return(180+r)/360}function Lp(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Rp(r,e){return r/Mp(e)}function af(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}class ku{constructor(e,s,h=0){this.x=+e,this.y=+s,this.z=+h}static fromLngLat(e,s=0){const h=ua.convert(e);return new ku(Dp(h.lng),Lp(h.lat),Rp(s,h.lat))}toLngLat(){return new ua(360*this.x-180,af(this.y))}toAltitude(){return this.z*Mp(af(this.y))}meterInMercatorCoordinateUnits(){return 1/zp*(e=af(this.y),1/Math.cos(e*Math.PI/180));var e}}function Bp(r,e,s){var h=2*Math.PI*6378137/256/Math.pow(2,s);return[r*h-2*Math.PI*6378137/2,e*h-2*Math.PI*6378137/2]}class of{constructor(e,s,h){if(e<0||e>25||h<0||h>=Math.pow(2,e)||s<0||s>=Math.pow(2,e))throw new Error(`x=${s}, y=${h}, 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=s,this.y=h,this.key=cc(0,e,e,s,h)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,s,h){const m=(x=this.y,k=this.z,M=Bp(256*(b=this.x),256*(x=Math.pow(2,k)-x-1),k),B=Bp(256*(b+1),256*(x+1),k),M[0]+","+M[1]+","+B[0]+","+B[1]);var b,x,k,M,B;const N=function(j,W,te){let re,de="";for(let Se=j;Se>0;Se--)re=1<1?"@2x":"").replace(/{quadkey}/g,N).replace(/{bbox-epsg-3857}/g,m)}isChildOf(e){const s=this.z-e.z;return s>0&&e.x===this.x>>s&&e.y===this.y>>s}getTilePoint(e){const s=Math.pow(2,this.z);return new C((e.x*s-this.x)*Tr,(e.y*s-this.y)*Tr)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Op{constructor(e,s){this.wrap=e,this.canonical=s,this.key=cc(e,s.z,s.z,s.x,s.y)}}class qn{constructor(e,s,h,m,b){if(e= z; overscaledZ = ${e}; z = ${h}`);this.overscaledZ=e,this.wrap=s,this.canonical=new of(h,+m,+b),this.key=cc(s,e,h,m,b)}clone(){return new qn(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 s=this.canonical.z-e;return e>this.canonical.z?new qn(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new qn(e,this.wrap,e,this.canonical.x>>s,this.canonical.y>>s)}calculateScaledKey(e,s){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-e;return e>this.canonical.z?cc(this.wrap*+s,e,this.canonical.z,this.canonical.x,this.canonical.y):cc(this.wrap*+s,e,e,this.canonical.x>>h,this.canonical.y>>h)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const s=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>s&&e.canonical.y===this.canonical.y>>s}children(e){if(this.overscaledZ>=e)return[new qn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const s=this.canonical.z+1,h=2*this.canonical.x,m=2*this.canonical.y;return[new qn(s,this.wrap,s,h,m),new qn(s,this.wrap,s,h+1,m),new qn(s,this.wrap,s,h,m+1),new qn(s,this.wrap,s,h+1,m+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=j),j=this.dim+1||s<-1||s>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(s+1)*this.stride+(e+1)}unpack(e,s,h){return e*this.redFactor+s*this.greenFactor+h*this.blueFactor-this.baseShift}getPixels(){return new jn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,s,h){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let m=s*this.dim,b=s*this.dim+this.dim,x=h*this.dim,k=h*this.dim+this.dim;switch(s){case-1:m=b-1;break;case 1:b=m+1}switch(h){case-1:x=k-1;break;case 1:k=x+1}const M=-s*this.dim,B=-h*this.dim;for(let N=x;N=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 Up{constructor(e,s,h,m,b){this.type="Feature",this._vectorTileFeature=e,e._z=s,e._x=h,e._y=m,this.properties=e.properties,this.id=b}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 s in this)s!=="_geometry"&&s!=="_vectorTileFeature"&&(e[s]=this[s]);return e}}class Vp{constructor(e,s){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ia(Tr,16,0),this.grid3D=new ia(Tr,16,0),this.featureIndexArray=new At,this.promoteId=s}insert(e,s,h,m,b,x){const k=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(h,m,b);const M=x?this.grid3D:this.grid;for(let B=0;B=0&&j[3]>=0&&M.insert(k,j[0],j[1],j[2],j[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new oa.VectorTile(new Hh(this.rawTileData)).layers,this.sourceLayerCoder=new Np(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,s,h,m){this.loadVTLayers();const b=e.params||{},x=Tr/e.tileSize/e.scale,k=kl(b.filter),M=e.queryGeometry,B=e.queryPadding*x,N=jp(M),j=this.grid.query(N.minX-B,N.minY-B,N.maxX+B,N.maxY+B),W=jp(e.cameraQueryGeometry),te=this.grid3D.query(W.minX-B,W.minY-B,W.maxX+B,W.maxY+B,(Se,Pe,qe,Le)=>function(He,rt,dt,Vt,Ht){for(const Rt of He)if(rt<=Rt.x&&dt<=Rt.y&&Vt>=Rt.x&&Ht>=Rt.y)return!0;const Ut=[new C(rt,dt),new C(rt,Ht),new C(Vt,Ht),new C(Vt,dt)];if(He.length>2){for(const Rt of Ut)if(Do(He,Rt))return!0}for(let Rt=0;Rt(Le||(Le=Ua(He)),rt.queryIntersectsFeature(M,He,dt,Le,this.z,e.transform,x,e.pixelPosMatrix)))}return re}loadMatchingFeature(e,s,h,m,b,x,k,M,B,N,j){const W=this.bucketLayerIDs[s];if(x&&!function(Se,Pe){for(let qe=0;qe=0)return!0;return!1}(x,W))return;const te=this.sourceLayerCoder.decode(h),re=this.vtLayers[te].feature(m);if(b.needGeometry){const Se=Va(re,!0);if(!b.filter(new tr(this.tileID.overscaledZ),Se,this.tileID.canonical))return}else if(!b.filter(new tr(this.tileID.overscaledZ),re))return;const de=this.getId(re,te);for(let Se=0;Se{const k=e instanceof To?e.get(x):null;return k&&k.evaluate?k.evaluate(s,h,m):k})}function jp(r){let e=1/0,s=1/0,h=-1/0,m=-1/0;for(const b of r)e=Math.min(e,b.x),s=Math.min(s,b.y),h=Math.max(h,b.x),m=Math.max(m,b.y);return{minX:e,minY:s,maxX:h,maxY:m}}function w1(r,e){return e-r}function qp(r,e,s,h,m){const b=[];for(let x=0;x=h&&j.x>=h||(N.x>=h?N=new C(h,N.y+(h-N.x)/(j.x-N.x)*(j.y-N.y))._round():j.x>=h&&(j=new C(h,N.y+(h-N.x)/(j.x-N.x)*(j.y-N.y))._round()),N.y>=m&&j.y>=m||(N.y>=m?N=new C(N.x+(m-N.y)/(j.y-N.y)*(j.x-N.x),m)._round():j.y>=m&&(j=new C(N.x+(m-N.y)/(j.y-N.y)*(j.x-N.x),m)._round()),M&&N.equals(M[M.length-1])||(M=[N],b.push(M)),M.push(j)))))}}return b}jt("FeatureIndex",Vp,{omit:["rawTileData","sourceLayerCoder"]});class ha extends C{constructor(e,s,h,m){super(e,s),this.angle=h,m!==void 0&&(this.segment=m)}clone(){return new ha(this.x,this.y,this.angle,this.segment)}}function Zp(r,e,s,h,m){if(e.segment===void 0||s===0)return!0;let b=e,x=e.segment+1,k=0;for(;k>-s/2;){if(x--,x<0)return!1;k-=r[x].dist(b),b=r[x]}k+=r[x].dist(r[x+1]),x++;const M=[];let B=0;for(;kh;)B-=M.shift().angleDelta;if(B>m)return!1;x++,k+=N.dist(j)}return!0}function Gp(r){let e=0;for(let s=0;sB){const re=(B-M)/te,de=bn.number(j.x,W.x,re),Se=bn.number(j.y,W.y,re),Pe=new ha(de,Se,W.angleTo(j),N);return Pe._round(),!x||Zp(r,Pe,k,x,e)?Pe:void 0}M+=te}}function E1(r,e,s,h,m,b,x,k,M){const B=Wp(h,b,x),N=Hp(h,m),j=N*x,W=r[0].x===0||r[0].x===M||r[0].y===0||r[0].y===M;return e-j=0&&He=0&&rt=0&&W+B<=N){const dt=new ha(He,rt,qe,re);dt._round(),h&&!Zp(r,dt,b,h,m)||te.push(dt)}}j+=Pe}return k||te.length||x||(te=Kp(r,j/2,s,h,m,b,x,!0,M)),te}jt("Anchor",ha);const Vo=In;function Xp(r,e,s,h){const m=[],b=r.image,x=b.pixelRatio,k=b.paddedRect.w-2*Vo,M=b.paddedRect.h-2*Vo,B=r.right-r.left,N=r.bottom-r.top,j=b.stretchX||[[0,k]],W=b.stretchY||[[0,M]],te=(Mt,qt)=>Mt+qt[1]-qt[0],re=j.reduce(te,0),de=W.reduce(te,0),Se=k-re,Pe=M-de;let qe=0,Le=re,He=0,rt=de,dt=0,Vt=Se,Ht=0,Ut=Pe;if(b.content&&h){const Mt=b.content;qe=Tu(j,0,Mt[0]),He=Tu(W,0,Mt[1]),Le=Tu(j,Mt[0],Mt[2]),rt=Tu(W,Mt[1],Mt[3]),dt=Mt[0]-qe,Ht=Mt[1]-He,Vt=Mt[2]-Mt[0]-Le,Ut=Mt[3]-Mt[1]-rt}const Rt=(Mt,qt,Dt,St)=>{const oi=Cu(Mt.stretch-qe,Le,B,r.left),Jt=Iu(Mt.fixed-dt,Vt,Mt.stretch,re),zi=Cu(qt.stretch-He,rt,N,r.top),Qi=Iu(qt.fixed-Ht,Ut,qt.stretch,de),sr=Cu(Dt.stretch-qe,Le,B,r.left),Br=Iu(Dt.fixed-dt,Vt,Dt.stretch,re),On=Cu(St.stretch-He,rt,N,r.top),dn=Iu(St.fixed-Ht,Ut,St.stretch,de),Cr=new C(oi,zi),Zr=new C(sr,zi),Kr=new C(sr,On),pn=new C(oi,On),mn=new C(Jt/x,Qi/x),Or=new C(Br/x,dn/x),Fr=e*Math.PI/180;if(Fr){const nn=Math.sin(Fr),An=Math.cos(Fr),Pn=[An,-nn,nn,An];Cr._matMult(Pn),Zr._matMult(Pn),pn._matMult(Pn),Kr._matMult(Pn)}const rn=Mt.stretch+Mt.fixed,gn=qt.stretch+qt.fixed;return{tl:Cr,tr:Zr,bl:pn,br:Kr,tex:{x:b.paddedRect.x+Vo+rn,y:b.paddedRect.y+Vo+gn,w:Dt.stretch+Dt.fixed-rn,h:St.stretch+St.fixed-gn},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:mn,pixelOffsetBR:Or,minFontScaleX:Vt/x/B,minFontScaleY:Ut/x/N,isSDF:s}};if(h&&(b.stretchX||b.stretchY)){const Mt=Jp(j,Se,re),qt=Jp(W,Pe,de);for(let Dt=0;Dt0&&(re=Math.max(10,re),this.circleDiameter=re)}else{let j=x.top*k-M[0],W=x.bottom*k+M[2],te=x.left*k-M[3],re=x.right*k+M[1];const de=x.collisionPadding;if(de&&(te-=de[0]*k,j-=de[1]*k,re+=de[2]*k,W+=de[3]*k),N){const Se=new C(te,j),Pe=new C(re,j),qe=new C(te,W),Le=new C(re,W),He=N*Math.PI/180;Se._rotate(He),Pe._rotate(He),qe._rotate(He),Le._rotate(He),te=Math.min(Se.x,Pe.x,qe.x,Le.x),re=Math.max(Se.x,Pe.x,qe.x,Le.x),j=Math.min(Se.y,Pe.y,qe.y,Le.y),W=Math.max(Se.y,Pe.y,qe.y,Le.y)}e.emplaceBack(s.x,s.y,te,j,re,W,h,m,b)}this.boxEndIndex=e.length}}class S1{constructor(e=[],s=k1){if(this.data=e,this.length=this.data.length,this.compare=s,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],s=this.data.pop();return this.length--,this.length>0&&(this.data[0]=s,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:s,compare:h}=this,m=s[e];for(;e>0;){const b=e-1>>1,x=s[b];if(h(m,x)>=0)break;s[e]=x,e=b}s[e]=m}_down(e){const{data:s,compare:h}=this,m=this.length>>1,b=s[e];for(;e=0)break;s[e]=k,e=x}s[e]=b}}function k1(r,e){return re?1:0}function T1(r,e=1,s=!1){let h=1/0,m=1/0,b=-1/0,x=-1/0;const k=r[0];for(let te=0;teb)&&(b=re.x),(!te||re.y>x)&&(x=re.y)}const M=Math.min(b-h,x-m);let B=M/2;const N=new S1([],C1);if(M===0)return new C(h,m);for(let te=h;tej.d||!j.d)&&(j=te,s&&console.log("found best %d after %d probes",Math.round(1e4*te.d)/1e4,W)),te.max-j.d<=e||(B=te.h/2,N.push(new $o(te.p.x-B,te.p.y-B,B,r)),N.push(new $o(te.p.x+B,te.p.y-B,B,r)),N.push(new $o(te.p.x-B,te.p.y+B,B,r)),N.push(new $o(te.p.x+B,te.p.y+B,B,r)),W+=4)}return s&&(console.log(`num probes: ${W}`),console.log(`best distance: ${j.d}`)),j.p}function C1(r,e){return e.max-r.max}function $o(r,e,s,h){this.p=new C(r,e),this.h=s,this.d=function(m,b){let x=!1,k=1/0;for(let M=0;Mm.y!=re.y>m.y&&m.x<(re.x-te.x)*(m.y-te.y)/(re.y-te.y)+te.x&&(x=!x),k=Math.min(k,Ld(m,te,re))}}return(x?1:-1)*Math.sqrt(k)}(this.p,h),this.max=this.d+this.h*Math.SQRT2}var Hr;n.TextAnchorEnum=void 0,(Hr=n.TextAnchorEnum||(n.TextAnchorEnum={}))[Hr.center=1]="center",Hr[Hr.left=2]="left",Hr[Hr.right=3]="right",Hr[Hr.top=4]="top",Hr[Hr.bottom=5]="bottom",Hr[Hr["top-left"]=6]="top-left",Hr[Hr["top-right"]=7]="top-right",Hr[Hr["bottom-left"]=8]="bottom-left",Hr[Hr["bottom-right"]=9]="bottom-right";const fa=7,lf=Number.POSITIVE_INFINITY;function Yp(r,e){return e[1]!==lf?function(s,h,m){let b=0,x=0;switch(h=Math.abs(h),m=Math.abs(m),s){case"top-right":case"top-left":case"top":x=m-fa;break;case"bottom-right":case"bottom-left":case"bottom":x=-m+fa}switch(s){case"top-right":case"bottom-right":case"right":b=-h;break;case"top-left":case"bottom-left":case"left":b=h}return[b,x]}(r,e[0],e[1]):function(s,h){let m=0,b=0;h<0&&(h=0);const x=h/Math.SQRT2;switch(s){case"top-right":case"top-left":b=x-fa;break;case"bottom-right":case"bottom-left":b=-x+fa;break;case"bottom":b=-h+fa;break;case"top":b=h-fa}switch(s){case"top-right":case"bottom-right":m=-x;break;case"top-left":case"bottom-left":m=x;break;case"left":m=h;break;case"right":m=-h}return[m,b]}(r,e[0])}function Qp(r,e,s){var h;const m=r.layout,b=(h=m.get("text-variable-anchor-offset"))===null||h===void 0?void 0:h.evaluate(e,{},s);if(b){const k=b.values,M=[];for(let B=0;BW*Rr);N.startsWith("top")?j[1]-=fa:N.startsWith("bottom")&&(j[1]+=fa),M[B+1]=j}return new kr(M)}const x=m.get("text-variable-anchor");if(x){let k;k=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[m.get("text-radial-offset").evaluate(e,{},s)*Rr,lf]:m.get("text-offset").evaluate(e,{},s).map(B=>B*Rr);const M=[];for(const B of x)M.push(B,Yp(B,k));return new kr(M)}return null}function cf(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function I1(r,e,s,h,m,b,x,k,M,B,N){let j=b.textMaxSize.evaluate(e,{});j===void 0&&(j=x);const W=r.layers[0].layout,te=W.get("icon-offset").evaluate(e,{},N),re=tm(s.horizontal),de=x/24,Se=r.tilePixelRatio*de,Pe=r.tilePixelRatio*j/24,qe=r.tilePixelRatio*k,Le=r.tilePixelRatio*W.get("symbol-spacing"),He=W.get("text-padding")*r.tilePixelRatio,rt=function(St,oi,Jt,zi=1){const Qi=St.get("icon-padding").evaluate(oi,{},Jt),sr=Qi&&Qi.values;return[sr[0]*zi,sr[1]*zi,sr[2]*zi,sr[3]*zi]}(W,e,N,r.tilePixelRatio),dt=W.get("text-max-angle")/180*Math.PI,Vt=W.get("text-rotation-alignment")!=="viewport"&&W.get("symbol-placement")!=="point",Ht=W.get("icon-rotation-alignment")==="map"&&W.get("symbol-placement")!=="point",Ut=W.get("symbol-placement"),Rt=Le/2,Mt=W.get("icon-text-fit");let qt;h&&Mt!=="none"&&(r.allowVerticalPlacement&&s.vertical&&(qt=Sp(h,s.vertical,Mt,W.get("icon-text-fit-padding"),te,de)),re&&(h=Sp(h,re,Mt,W.get("icon-text-fit-padding"),te,de)));const Dt=(St,oi)=>{oi.x<0||oi.x>=Tr||oi.y<0||oi.y>=Tr||function(Jt,zi,Qi,sr,Br,On,dn,Cr,Zr,Kr,pn,mn,Or,Fr,rn,gn,nn,An,Pn,Nr,Ri,sn,Xr,Ur,Qn){const us=Jt.addToLineVertexArray(zi,Qi);let hs,$s,es,Zn,zn=0,js=0,fc=0,sm=0,_f=-1,yf=-1;const qs={};let am=yr("");if(Jt.allowVerticalPlacement&&sr.vertical){const an=Cr.layout.get("text-rotate").evaluate(Ri,{},Ur)+90;es=new Au(Zr,zi,Kr,pn,mn,sr.vertical,Or,Fr,rn,an),dn&&(Zn=new Au(Zr,zi,Kr,pn,mn,dn,nn,An,rn,an))}if(Br){const an=Cr.layout.get("icon-rotate").evaluate(Ri,{}),Gn=Cr.layout.get("icon-text-fit")!=="none",ja=Xp(Br,an,Xr,Gn),ds=dn?Xp(dn,an,Xr,Gn):void 0;$s=new Au(Zr,zi,Kr,pn,mn,Br,nn,An,!1,an),zn=4*ja.length;const qa=Jt.iconSizeData;let Is=null;qa.kind==="source"?(Is=[Cs*Cr.layout.get("icon-size").evaluate(Ri,{})],Is[0]>ca&&q(`${Jt.layerIds[0]}: Value for "icon-size" is >= ${lc}. Reduce your "icon-size".`)):qa.kind==="composite"&&(Is=[Cs*sn.compositeIconSizes[0].evaluate(Ri,{},Ur),Cs*sn.compositeIconSizes[1].evaluate(Ri,{},Ur)],(Is[0]>ca||Is[1]>ca)&&q(`${Jt.layerIds[0]}: Value for "icon-size" is >= ${lc}. Reduce your "icon-size".`)),Jt.addSymbols(Jt.icon,ja,Is,Nr,Pn,Ri,n.WritingMode.none,zi,us.lineStartIndex,us.lineLength,-1,Ur),_f=Jt.icon.placedSymbolArray.length-1,ds&&(js=4*ds.length,Jt.addSymbols(Jt.icon,ds,Is,Nr,Pn,Ri,n.WritingMode.vertical,zi,us.lineStartIndex,us.lineLength,-1,Ur),yf=Jt.icon.placedSymbolArray.length-1)}const om=Object.keys(sr.horizontal);for(const an of om){const Gn=sr.horizontal[an];if(!hs){am=yr(Gn.text);const ds=Cr.layout.get("text-rotate").evaluate(Ri,{},Ur);hs=new Au(Zr,zi,Kr,pn,mn,Gn,Or,Fr,rn,ds)}const ja=Gn.positionedLines.length===1;if(fc+=em(Jt,zi,Gn,On,Cr,rn,Ri,gn,us,sr.vertical?n.WritingMode.horizontal:n.WritingMode.horizontalOnly,ja?om:[an],qs,_f,sn,Ur),ja)break}sr.vertical&&(sm+=em(Jt,zi,sr.vertical,On,Cr,rn,Ri,gn,us,n.WritingMode.vertical,["vertical"],qs,yf,sn,Ur));const z1=hs?hs.boxStartIndex:Jt.collisionBoxArray.length,M1=hs?hs.boxEndIndex:Jt.collisionBoxArray.length,D1=es?es.boxStartIndex:Jt.collisionBoxArray.length,L1=es?es.boxEndIndex:Jt.collisionBoxArray.length,R1=$s?$s.boxStartIndex:Jt.collisionBoxArray.length,B1=$s?$s.boxEndIndex:Jt.collisionBoxArray.length,O1=Zn?Zn.boxStartIndex:Jt.collisionBoxArray.length,F1=Zn?Zn.boxEndIndex:Jt.collisionBoxArray.length;let fs=-1;const zu=(an,Gn)=>an&&an.circleDiameter?Math.max(an.circleDiameter,Gn):Gn;fs=zu(hs,fs),fs=zu(es,fs),fs=zu($s,fs),fs=zu(Zn,fs);const lm=fs>-1?1:0;lm&&(fs*=Qn/Rr),Jt.glyphOffsetArray.length>=Uo.MAX_GLYPHS&&q("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ri.sortKey!==void 0&&Jt.addToSortKeyRanges(Jt.symbolInstances.length,Ri.sortKey);const N1=Qp(Cr,Ri,Ur),[U1,V1]=function(an,Gn){const ja=an.length,ds=Gn==null?void 0:Gn.values;if((ds==null?void 0:ds.length)>0)for(let qa=0;qa=0?qs.right:-1,qs.center>=0?qs.center:-1,qs.left>=0?qs.left:-1,qs.vertical||-1,_f,yf,am,z1,M1,D1,L1,R1,B1,O1,F1,Kr,fc,sm,zn,js,lm,0,Or,fs,U1,V1)}(r,oi,St,s,h,m,qt,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,Se,[He,He,He,He],Vt,M,qe,rt,Ht,te,e,b,B,N,x)};if(Ut==="line")for(const St of qp(e.geometry,0,0,Tr,Tr)){const oi=E1(St,Le,dt,s.vertical||re,h,24,Pe,r.overscaling,Tr);for(const Jt of oi)re&&A1(r,re.text,Rt,Jt)||Dt(St,Jt)}else if(Ut==="line-center"){for(const St of e.geometry)if(St.length>1){const oi=x1(St,dt,s.vertical||re,h,24,Pe);oi&&Dt(St,oi)}}else if(e.type==="Polygon")for(const St of Uh(e.geometry,0)){const oi=T1(St,16);Dt(St[0],new ha(oi.x,oi.y,0))}else if(e.type==="LineString")for(const St of e.geometry)Dt(St,new ha(St[0].x,St[0].y,0));else if(e.type==="Point")for(const St of e.geometry)for(const oi of St)Dt([oi],new ha(oi.x,oi.y,0))}function em(r,e,s,h,m,b,x,k,M,B,N,j,W,te,re){const de=function(qe,Le,He,rt,dt,Vt,Ht,Ut){const Rt=rt.layout.get("text-rotate").evaluate(Vt,{})*Math.PI/180,Mt=[];for(const qt of Le.positionedLines)for(const Dt of qt.positionedGlyphs){if(!Dt.rect)continue;const St=Dt.rect||{};let oi=_p+1,Jt=!0,zi=1,Qi=0;const sr=(dt||Ut)&&Dt.vertical,Br=Dt.metrics.advance*Dt.scale/2;if(Ut&&Le.verticalizable&&(Qi=qt.lineOffset/2-(Dt.imageName?-(Rr-Dt.metrics.width*Dt.scale)/2:(Dt.scale-1)*Rr)),Dt.imageName){const Nr=Ht[Dt.imageName];Jt=Nr.sdf,zi=Nr.pixelRatio,oi=In/zi}const On=dt?[Dt.x+Br,Dt.y]:[0,0];let dn=dt?[0,0]:[Dt.x+Br+He[0],Dt.y+He[1]-Qi],Cr=[0,0];sr&&(Cr=dn,dn=[0,0]);const Zr=Dt.metrics.isDoubleResolution?2:1,Kr=(Dt.metrics.left-oi)*Dt.scale-Br+dn[0],pn=(-Dt.metrics.top-oi)*Dt.scale+dn[1],mn=Kr+St.w/Zr*Dt.scale/zi,Or=pn+St.h/Zr*Dt.scale/zi,Fr=new C(Kr,pn),rn=new C(mn,pn),gn=new C(Kr,Or),nn=new C(mn,Or);if(sr){const Nr=new C(-Br,Br-ac),Ri=-Math.PI/2,sn=Rr/2-Br,Xr=new C(5-ac-sn,-(Dt.imageName?sn:0)),Ur=new C(...Cr);Fr._rotateAround(Ri,Nr)._add(Xr)._add(Ur),rn._rotateAround(Ri,Nr)._add(Xr)._add(Ur),gn._rotateAround(Ri,Nr)._add(Xr)._add(Ur),nn._rotateAround(Ri,Nr)._add(Xr)._add(Ur)}if(Rt){const Nr=Math.sin(Rt),Ri=Math.cos(Rt),sn=[Ri,-Nr,Nr,Ri];Fr._matMult(sn),rn._matMult(sn),gn._matMult(sn),nn._matMult(sn)}const An=new C(0,0),Pn=new C(0,0);Mt.push({tl:Fr,tr:rn,bl:gn,br:nn,tex:St,writingMode:Le.writingMode,glyphOffset:On,sectionIndex:Dt.sectionIndex,isSDF:Jt,pixelOffsetTL:An,pixelOffsetBR:Pn,minFontScaleX:0,minFontScaleY:0})}return Mt}(0,s,k,m,b,x,h,r.allowVerticalPlacement),Se=r.textSizeData;let Pe=null;Se.kind==="source"?(Pe=[Cs*m.layout.get("text-size").evaluate(x,{})],Pe[0]>ca&&q(`${r.layerIds[0]}: Value for "text-size" is >= ${lc}. Reduce your "text-size".`)):Se.kind==="composite"&&(Pe=[Cs*te.compositeTextSizes[0].evaluate(x,{},re),Cs*te.compositeTextSizes[1].evaluate(x,{},re)],(Pe[0]>ca||Pe[1]>ca)&&q(`${r.layerIds[0]}: Value for "text-size" is >= ${lc}. Reduce your "text-size".`)),r.addSymbols(r.text,de,Pe,k,b,x,B,e,M.lineStartIndex,M.lineLength,W,re);for(const qe of N)j[qe]=r.text.placedSymbolArray.length-1;return 4*de.length}function tm(r){for(const e in r)return r[e];return null}function A1(r,e,s,h){const m=r.compareText;if(e in m){const b=m[e];for(let x=b.length-1;x>=0;x--)if(h.dist(b[x])>4;if(m!==1)throw new Error(`Got v${m} data when expected v1.`);const b=im[15&h];if(!b)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(e,2,1),[k]=new Uint32Array(e,4,1);return new uf(k,x,b,e)}constructor(e,s=64,h=Float64Array,m){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+s,2),65535),this.ArrayType=h,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const b=im.indexOf(this.ArrayType),x=2*e*this.ArrayType.BYTES_PER_ELEMENT,k=e*this.IndexArrayType.BYTES_PER_ELEMENT,M=(8-k%8)%8;if(b<0)throw new Error(`Unexpected typed array class: ${h}.`);m&&m instanceof ArrayBuffer?(this.data=m,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+k+M,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+x+k+M),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+k+M,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+b]),new Uint16Array(this.data,2,1)[0]=s,new Uint32Array(this.data,4,1)[0]=e)}add(e,s){const h=this._pos>>1;return this.ids[h]=h,this.coords[this._pos++]=e,this.coords[this._pos++]=s,h}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return hf(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,s,h,m){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:b,coords:x,nodeSize:k}=this,M=[0,b.length-1,0],B=[];for(;M.length;){const N=M.pop()||0,j=M.pop()||0,W=M.pop()||0;if(j-W<=k){for(let Se=W;Se<=j;Se++){const Pe=x[2*Se],qe=x[2*Se+1];Pe>=e&&Pe<=h&&qe>=s&&qe<=m&&B.push(b[Se])}continue}const te=W+j>>1,re=x[2*te],de=x[2*te+1];re>=e&&re<=h&&de>=s&&de<=m&&B.push(b[te]),(N===0?e<=re:s<=de)&&(M.push(W),M.push(te-1),M.push(1-N)),(N===0?h>=re:m>=de)&&(M.push(te+1),M.push(j),M.push(1-N))}return B}within(e,s,h){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:m,coords:b,nodeSize:x}=this,k=[0,m.length-1,0],M=[],B=h*h;for(;k.length;){const N=k.pop()||0,j=k.pop()||0,W=k.pop()||0;if(j-W<=x){for(let Se=W;Se<=j;Se++)nm(b[2*Se],b[2*Se+1],e,s)<=B&&M.push(m[Se]);continue}const te=W+j>>1,re=b[2*te],de=b[2*te+1];nm(re,de,e,s)<=B&&M.push(m[te]),(N===0?e-h<=re:s-h<=de)&&(k.push(W),k.push(te-1),k.push(1-N)),(N===0?e+h>=re:s+h>=de)&&(k.push(te+1),k.push(j),k.push(1-N))}return M}}function hf(r,e,s,h,m,b){if(m-h<=s)return;const x=h+m>>1;rm(r,e,x,h,m,b),hf(r,e,s,h,x-1,1-b),hf(r,e,s,x+1,m,1-b)}function rm(r,e,s,h,m,b){for(;m>h;){if(m-h>600){const B=m-h+1,N=s-h+1,j=Math.log(B),W=.5*Math.exp(2*j/3),te=.5*Math.sqrt(j*W*(B-W)/B)*(N-B/2<0?-1:1);rm(r,e,s,Math.max(h,Math.floor(s-N*W/B+te)),Math.min(m,Math.floor(s+(B-N)*W/B+te)),b)}const x=e[2*s+b];let k=h,M=m;for(uc(r,e,h,s),e[2*m+b]>x&&uc(r,e,h,m);kx;)M--}e[2*h+b]===x?uc(r,e,h,M):(M++,uc(r,e,M,m)),M<=s&&(h=M+1),s<=M&&(m=M-1)}}function uc(r,e,s,h){ff(r,s,h),ff(e,2*s,2*h),ff(e,2*s+1,2*h+1)}function ff(r,e,s){const h=r[e];r[e]=r[s],r[s]=h}function nm(r,e,s,h){const m=r-s,b=e-h;return m*m+b*b}var df;n.PerformanceMarkers=void 0,(df=n.PerformanceMarkers||(n.PerformanceMarkers={})).create="create",df.load="load",df.fullLoad="fullLoad";let Pu=null,hc=[];const pf=1e3/60,mf="loadTime",gf="fullLoadTime",P1={mark(r){performance.mark(r)},frame(r){const e=r;Pu!=null&&hc.push(e-Pu),Pu=e},clearMetrics(){Pu=null,hc=[],performance.clearMeasures(mf),performance.clearMeasures(gf);for(const r in n.PerformanceMarkers)performance.clearMarks(n.PerformanceMarkers[r])},getPerformanceMetrics(){performance.measure(mf,n.PerformanceMarkers.create,n.PerformanceMarkers.load),performance.measure(gf,n.PerformanceMarkers.create,n.PerformanceMarkers.fullLoad);const r=performance.getEntriesByName(mf)[0].duration,e=performance.getEntriesByName(gf)[0].duration,s=hc.length,h=1/(hc.reduce((b,x)=>b+x,0)/s/1e3),m=hc.filter(b=>b>pf).reduce((b,x)=>b+(x-pf)/pf,0);return{loadTime:r,fullLoadTime:e,fps:h,percentDroppedFrames:m/(s+m)*100,totalFrames:s}}};n.AJAXError=It,n.ARRAY_TYPE=Lo,n.Actor=class{constructor(r,e,s){this.receive=h=>{const m=h.data,b=m.id;if(b&&(!m.targetMapId||this.mapId===m.targetMapId))if(m.type===""){delete this.tasks[b];const x=this.cancelCallbacks[b];delete this.cancelCallbacks[b],x&&x()}else it()||m.mustQueue?(this.tasks[b]=m,this.taskQueue.push(b),this.invoker.trigger()):this.processTask(b,m)},this.process=()=>{if(!this.taskQueue.length)return;const h=this.taskQueue.shift(),m=this.tasks[h];delete this.tasks[h],this.taskQueue.length&&this.invoker.trigger(),m&&this.processTask(h,m)},this.target=r,this.parent=e,this.mapId=s,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new b1(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=it()?r:window}send(r,e,s,h,m=!1){const b=Math.round(1e18*Math.random()).toString(36).substring(0,10);s&&(this.callbacks[b]=s);const x=Ne(this.globalScope)?void 0:[];return this.target.postMessage({id:b,type:r,hasCallback:!!s,targetMapId:h,mustQueue:m,sourceMapId:this.mapId,data:ra(e,x)},x),{cancel:()=>{s&&delete this.callbacks[b],this.target.postMessage({id:b,type:"",targetMapId:h,sourceMapId:this.mapId})}}}processTask(r,e){if(e.type===""){const s=this.callbacks[r];delete this.callbacks[r],s&&(e.error?s(Da(e.error)):s(null,Da(e.data)))}else{let s=!1;const h=Ne(this.globalScope)?void 0:[],m=e.hasCallback?(k,M)=>{s=!0,delete this.cancelCallbacks[r],this.target.postMessage({id:r,type:"",sourceMapId:this.mapId,error:k?ra(k):null,data:ra(M,h)},h)}:k=>{s=!0};let b=null;const x=Da(e.data);if(this.parent[e.type])b=this.parent[e.type](e.sourceMapId,x,m);else if(this.parent.getWorkerSource){const k=e.type.split(".");b=this.parent.getWorkerSource(e.sourceMapId,k[0],x.source)[k[1]](x,m)}else m(new Error(`Could not find function ${e.type}`));!s&&b&&b.cancel&&(this.cancelCallbacks[r]=b.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},n.AlphaImage=Yl,n.CanonicalTileID=of,n.CollisionBoxArray=he,n.CollisionCircleLayoutArray=class extends g{},n.Color=Ai,n.DEMData=Fp,n.DataConstantProperty=Qt,n.DictionaryCoder=Np,n.EXTENT=Tr,n.ErrorEvent=Ze,n.EvaluationParameters=tr,n.Event=_e,n.Evented=pt,n.FeatureIndex=Vp,n.FillBucket=jh,n.FillExtrusionBucket=Zh,n.GeoJSONFeature=Up,n.ImageAtlas=vp,n.ImagePosition=Xh,n.KDBush=uf,n.LineBucket=Gh,n.LineStripIndexArray=class extends me{},n.LngLat=ua,n.MercatorCoordinate=ku,n.ONE_EM=Rr,n.OverscaledTileID=qn,n.PerformanceUtils=P1,n.Point=C,n.Pos3dArray=class extends Es{},n.PosArray=Wt,n.Properties=en,n.Protobuf=Hh,n.QuadTriangleArray=class extends T{},n.RGBAImage=jn,n.RasterBoundsArray=class extends Wl{},n.RequestPerformance=class{constructor(r){this._marks={start:[r.url,"start"].join("#"),end:[r.url,"end"].join("#"),measure:r.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let r=performance.getEntriesByName(this._marks.measure);return r.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),r=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),r}},n.SegmentVector=nr,n.SymbolBucket=Uo,n.Transitionable=su,n.TriangleIndexArray=fr,n.Uniform1f=zo,n.Uniform1i=class extends Ns{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},n.Uniform2f=class extends Ns{constructor(r,e){super(r,e),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},n.Uniform3f=class extends Ns{constructor(r,e){super(r,e),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},n.Uniform4f=cu,n.UniformColor=uu,n.UniformMatrix4f=class extends Ns{constructor(r,e){super(r,e),this.current=Ih}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},n.UnwrappedTileID=Op,n.ValidationError=_t,n.ZoomHistory=Ll,n.__awaiter=_,n.addDynamicAttributes=ef,n.arrayBufferToImage=function(r,e){const s=new Image;s.onload=()=>{e(null,s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame(()=>{s.src=ie})},s.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 h=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(h):ie},n.arrayBufferToImageBitmap=function(r,e){const s=new Blob([new Uint8Array(r)],{type:"image/png"});createImageBitmap(s).then(h=>{e(null,h)}).catch(h=>{e(new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},n.asyncAll=function(r,e,s){if(!r.length)return s(null,[]);let h=r.length;const m=new Array(r.length);let b=null;r.forEach((x,k)=>{e(x,(M,B)=>{M&&(b=M),m[k]=B,--h==0&&s(b,m)})})},n.bezier=ee,n.browser=wt,n.clamp=ne,n.clipLine=qp,n.clone=function(r){var e=new Lo(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},n.clone$1=ye,n.collisionCircleLayout=H0,n.config=vt,n.copy=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},n.create=function(){var r=new Lo(16);return Lo!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},n.createExpression=bo,n.createFilter=kl,n.createLayout=ir,n.createStyleLayer=function(r){if(r.type==="custom")return new v1(r);switch(r.type){case"background":return new g1(r);case"circle":return new t0(r);case"fill":return new w0(r);case"fill-extrusion":return new B0(r);case"heatmap":return new r0(r);case"hillshade":return new s0(r);case"line":return new q0(r);case"raster":return new y1(r);case"symbol":return new Su(r)}},n.deepEqual=function r(e,s){if(Array.isArray(e)){if(!Array.isArray(s)||e.length!==s.length)return!1;for(let h=0;h{h[x.source]?s.push({command:ct.removeLayer,args:[x.id]}):b.push(x)}),s=s.concat(m),function(x,k,M){k=k||[];const B=(x=x||[]).map(pr),N=k.map(pr),j=x.reduce(Gr,{}),W=k.reduce(Gr,{}),te=B.slice(),re=Object.create(null);let de,Se,Pe,qe,Le,He,rt;for(de=0,Se=0;de{}}},n.groupByLayout=function(r,e){const s={};for(let m=0;m@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(s,h,m,b)=>{const x=m||b;return e[h]=!x||x.toLowerCase(),""}),e["max-age"]){const s=parseInt(e["max-age"],10);isNaN(s)?delete e["max-age"]:e["max-age"]=s}return e},n.parseGlyphPbf=function(r){return new Hh(r).readFields(s1,[])},n.pbf=up,n.performSymbolLayout=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=Tr/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const e=r.bucket.layers[0],s=e.layout,h=e._unevaluatedLayout._values,m={layoutIconSize:h["icon-size"].possiblyEvaluate(new tr(r.bucket.zoom+1),r.canonical),layoutTextSize:h["text-size"].possiblyEvaluate(new tr(r.bucket.zoom+1),r.canonical),textMaxSize:h["text-size"].possiblyEvaluate(new tr(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:B,maxZoom:N}=r.bucket.textSizeData;m.compositeTextSizes=[h["text-size"].possiblyEvaluate(new tr(B),r.canonical),h["text-size"].possiblyEvaluate(new tr(N),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:B,maxZoom:N}=r.bucket.iconSizeData;m.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new tr(B),r.canonical),h["icon-size"].possiblyEvaluate(new tr(N),r.canonical)]}const b=s.get("text-line-height")*Rr,x=s.get("text-rotation-alignment")!=="viewport"&&s.get("symbol-placement")!=="point",k=s.get("text-keep-upright"),M=s.get("text-size");for(const B of r.bucket.features){const N=s.get("text-font").evaluate(B,{},r.canonical).join(","),j=M.evaluate(B,{},r.canonical),W=m.layoutTextSize.evaluate(B,{},r.canonical),te=m.layoutIconSize.evaluate(B,{},r.canonical),re={horizontal:{},vertical:void 0},de=B.text;let Se,Pe=[0,0];if(de){const He=de.toString(),rt=s.get("text-letter-spacing").evaluate(B,{},r.canonical)*Rr,dt=Sh(He)?rt:0,Vt=s.get("text-anchor").evaluate(B,{},r.canonical),Ht=Qp(e,B,r.canonical);if(!Ht){const Dt=s.get("text-radial-offset").evaluate(B,{},r.canonical);Pe=Dt?Yp(Vt,[Dt*Rr,lf]):s.get("text-offset").evaluate(B,{},r.canonical).map(St=>St*Rr)}let Ut=x?"center":s.get("text-justify").evaluate(B,{},r.canonical);const Rt=s.get("symbol-placement"),Mt=Rt==="point"?s.get("text-max-width").evaluate(B,{},r.canonical)*Rr:0,qt=()=>{r.bucket.allowVerticalPlacement&&La(He)&&(re.vertical=wu(de,r.glyphMap,r.glyphPositions,r.imagePositions,N,Mt,b,Vt,"left",dt,Pe,n.WritingMode.vertical,!0,Rt,W,j))};if(!x&&Ht){const Dt=new Set;if(Ut==="auto")for(let oi=0;oithis._layers[ae.id]),$e=Ie[0];if($e.visibility==="none")continue;const Re=$e.source||"";let ze=this.familiesBySource[Re];ze||(ze=this.familiesBySource[Re]={});const H=$e.sourceLayer||"_geojsonTileLayer";let J=ze[H];J||(J=ze[H]=[]),J.push(Ie)}}}class v{constructor(G){const K={},oe=[];for(const Re in G){const ze=G[Re],H=K[Re]={};for(const J in ze){const ae=ze[+J];if(!ae||ae.bitmap.width===0||ae.bitmap.height===0)continue;const ke={x:0,y:0,w:ae.bitmap.width+2,h:ae.bitmap.height+2};oe.push(ke),H[J]={rect:ke,metrics:ae.metrics}}}const{w:we,h:Ie}=n.potpack(oe),$e=new n.AlphaImage({width:we||1,height:Ie||1});for(const Re in G){const ze=G[Re];for(const H in ze){const J=ze[+H];if(!J||J.bitmap.width===0||J.bitmap.height===0)continue;const ae=K[Re][H].rect;n.AlphaImage.copy(J.bitmap,$e,{x:0,y:0},{x:ae.x+1,y:ae.y+1},J.bitmap)}}this.image=$e,this.positions=K}}n.register("GlyphAtlas",v);class E{constructor(G){this.tileID=new n.OverscaledTileID(G.tileID.overscaledZ,G.tileID.wrap,G.tileID.canonical.z,G.tileID.canonical.x,G.tileID.canonical.y),this.uid=G.uid,this.zoom=G.zoom,this.pixelRatio=G.pixelRatio,this.tileSize=G.tileSize,this.source=G.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=G.showCollisionBoxes,this.collectResourceTiming=!!G.collectResourceTiming,this.returnDependencies=!!G.returnDependencies,this.promoteId=G.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(G,K,oe,we,Ie){this.status="parsing",this.data=G,this.collisionBoxArray=new n.CollisionBoxArray;const $e=new n.DictionaryCoder(Object.keys(G.layers).sort()),Re=new n.FeatureIndex(this.tileID,this.promoteId);Re.bucketLayerIDs=[];const ze={},H={featureIndex:Re,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:oe},J=K.familiesBySource[this.source];for(const ni in J){const li=G.layers[ni];if(!li)continue;li.version===1&&n.warnOnce(`Vector tile source "${this.source}" layer "${ni}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ai=$e.encode(ni),gi=[];for(let Pi=0;Pi=Si.maxzoom||Si.visibility!=="none"&&(S(Pi,this.zoom,oe),(ze[Si.id]=Si.createBucket({index:Re.bucketLayerIDs.length,layers:Pi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ai,sourceID:this.source})).populate(gi,H,this.tileID.canonical),Re.bucketLayerIDs.push(Pi.map(jr=>jr.id)))}}let ae,ke,Ue,bt;const mt=n.mapObject(H.glyphDependencies,ni=>Object.keys(ni).map(Number));this.inFlightDependencies.forEach(ni=>ni==null?void 0:ni.cancel()),this.inFlightDependencies=[];const Ct=++this.dependencySentinel;Object.keys(mt).length?this.inFlightDependencies.push(we.send("getGlyphs",{uid:this.uid,stacks:mt,source:this.source,tileID:this.tileID,type:"glyphs"},(ni,li)=>{Ct===this.dependencySentinel&&(ae||(ae=ni,ke=li,Yt.call(this)))})):ke={};const Zt=Object.keys(H.iconDependencies);Zt.length?this.inFlightDependencies.push(we.send("getImages",{icons:Zt,source:this.source,tileID:this.tileID,type:"icons"},(ni,li)=>{Ct===this.dependencySentinel&&(ae||(ae=ni,Ue=li,Yt.call(this)))})):Ue={};const di=Object.keys(H.patternDependencies);function Yt(){if(ae)return Ie(ae);if(ke&&Ue&&bt){const ni=new v(ke),li=new n.ImageAtlas(Ue,bt);for(const ai in ze){const gi=ze[ai];gi instanceof n.SymbolBucket?(S(gi.layers,this.zoom,oe),n.performSymbolLayout({bucket:gi,glyphMap:ke,glyphPositions:ni.positions,imageMap:Ue,imagePositions:li.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):gi.hasPattern&&(gi instanceof n.LineBucket||gi instanceof n.FillBucket||gi instanceof n.FillExtrusionBucket)&&(S(gi.layers,this.zoom,oe),gi.addFeatures(H,this.tileID.canonical,li.patternPositions))}this.status="done",Ie(null,{buckets:Object.values(ze).filter(ai=>!ai.isEmpty()),featureIndex:Re,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ni.image,imageAtlas:li,glyphMap:this.returnDependencies?ke:null,iconMap:this.returnDependencies?Ue:null,glyphPositions:this.returnDependencies?ni.positions:null})}}di.length?this.inFlightDependencies.push(we.send("getImages",{icons:di,source:this.source,tileID:this.tileID,type:"patterns"},(ni,li)=>{Ct===this.dependencySentinel&&(ae||(ae=ni,bt=li,Yt.call(this)))})):bt={},Yt.call(this)}}function S(be,G,K){const oe=new n.EvaluationParameters(G);for(const we of be)we.recalculate(oe,K)}function C(be,G){const K=n.getArrayBuffer(be.request,(oe,we,Ie,$e)=>{if(oe)G(oe);else if(we)try{const Re=new n.vectorTile.VectorTile(new n.Protobuf(we));G(null,{vectorTile:Re,rawData:we,cacheControl:Ie,expires:$e})}catch(Re){const ze=new Uint8Array(we);let H=`Unable to parse the tile at ${be.request.url}, `;H+=ze[0]===31&&ze[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${Re.messge}`,G(new Error(H))}});return()=>{K.cancel(),G()}}class z{constructor(G,K,oe,we){this.actor=G,this.layerIndex=K,this.availableImages=oe,this.loadVectorData=we||C,this.fetching={},this.loading={},this.loaded={}}loadTile(G,K){const oe=G.uid;this.loading||(this.loading={});const we=!!(G&&G.request&&G.request.collectResourceTiming)&&new n.RequestPerformance(G.request),Ie=this.loading[oe]=new E(G);Ie.abort=this.loadVectorData(G,($e,Re)=>{if(delete this.loading[oe],$e||!Re)return Ie.status="done",this.loaded[oe]=Ie,K($e);const ze=Re.rawData,H={};Re.expires&&(H.expires=Re.expires),Re.cacheControl&&(H.cacheControl=Re.cacheControl);const J={};if(we){const ae=we.finish();ae&&(J.resourceTiming=JSON.parse(JSON.stringify(ae)))}Ie.vectorTile=Re.vectorTile,Ie.parse(Re.vectorTile,this.layerIndex,this.availableImages,this.actor,(ae,ke)=>{if(delete this.fetching[oe],ae||!ke)return K(ae);K(null,n.extend({rawTileData:ze.slice(0)},ke,H,J))}),this.loaded=this.loaded||{},this.loaded[oe]=Ie,this.fetching[oe]={rawTileData:ze,cacheControl:H,resourceTiming:J}})}reloadTile(G,K){const oe=this.loaded,we=G.uid;if(oe&&oe[we]){const Ie=oe[we];Ie.showCollisionBoxes=G.showCollisionBoxes,Ie.status==="parsing"?Ie.parse(Ie.vectorTile,this.layerIndex,this.availableImages,this.actor,($e,Re)=>{if($e||!Re)return K($e,Re);let ze;if(this.fetching[we]){const{rawTileData:H,cacheControl:J,resourceTiming:ae}=this.fetching[we];delete this.fetching[we],ze=n.extend({rawTileData:H.slice(0)},Re,J,ae)}else ze=Re;K(null,ze)}):Ie.status==="done"&&(Ie.vectorTile?Ie.parse(Ie.vectorTile,this.layerIndex,this.availableImages,this.actor,K):K())}}abortTile(G,K){const oe=this.loading,we=G.uid;oe&&oe[we]&&oe[we].abort&&(oe[we].abort(),delete oe[we]),K()}removeTile(G,K){const oe=this.loaded,we=G.uid;oe&&oe[we]&&delete oe[we],K()}}class P{constructor(){this.loaded={}}loadTile(G,K){return n.__awaiter(this,void 0,void 0,function*(){const{uid:oe,encoding:we,rawImageData:Ie,redFactor:$e,greenFactor:Re,blueFactor:ze,baseShift:H}=G,J=Ie.width+2,ae=Ie.height+2,ke=n.isImageBitmap(Ie)?new n.RGBAImage({width:J,height:ae},yield n.getImageData(Ie,-1,-1,J,ae)):Ie,Ue=new n.DEMData(oe,ke,we,$e,Re,ze,H);this.loaded=this.loaded||{},this.loaded[oe]=Ue,K(null,Ue)})}removeTile(G){const K=this.loaded,oe=G.uid;K&&K[oe]&&delete K[oe]}}function I(be,G){if(be.length!==0){L(be[0],G);for(var K=1;K=Math.abs(Re)?K-ze+Re:Re-ze+K,K=ze}K+oe>=0!=!!G&&be.reverse()}var D=n.getDefaultExportFromCjs(function be(G,K){var oe,we=G&&G.type;if(we==="FeatureCollection")for(oe=0;oe>31}function it(be,G){for(var K=be.loadGeometry(),oe=be.type,we=0,Ie=0,$e=K.length,Re=0;Re<$e;Re++){var ze=K[Re],H=1;oe===1&&(H=ze.length),G.writeVarint(We(1,H));for(var J=oe===3?ze.length-1:ze.length,ae=0;aebe},ie=Math.fround||(ve=new Float32Array(1),be=>(ve[0]=+be,ve[0]));var ve;const De=3,Y=5,ue=6;class Qe{constructor(G){this.options=Object.assign(Object.create(Xe),G),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(G){const{log:K,minZoom:oe,maxZoom:we}=this.options;K&&console.time("total time");const Ie=`prepare ${G.length} points`;K&&console.time(Ie),this.points=G;const $e=[];for(let ze=0;ze=oe;ze--){const H=+Date.now();Re=this.trees[ze]=this._createTree(this._cluster(Re,ze)),K&&console.log("z%d: %d clusters in %dms",ze,Re.numItems,+Date.now()-H)}return K&&console.timeEnd("total time"),this}getClusters(G,K){let oe=((G[0]+180)%360+360)%360-180;const we=Math.max(-90,Math.min(90,G[1]));let Ie=G[2]===180?180:((G[2]+180)%360+360)%360-180;const $e=Math.max(-90,Math.min(90,G[3]));if(G[2]-G[0]>=360)oe=-180,Ie=180;else if(oe>Ie){const ae=this.getClusters([oe,we,180,$e],K),ke=this.getClusters([-180,we,Ie,$e],K);return ae.concat(ke)}const Re=this.trees[this._limitZoom(K)],ze=Re.range(It(oe),Nt($e),It(Ie),Nt(we)),H=Re.data,J=[];for(const ae of ze){const ke=this.stride*ae;J.push(H[ke+Y]>1?wt(H,ke,this.clusterProps):this.points[H[ke+De]])}return J}getChildren(G){const K=this._getOriginId(G),oe=this._getOriginZoom(G),we="No cluster with the specified id.",Ie=this.trees[oe];if(!Ie)throw new Error(we);const $e=Ie.data;if(K*this.stride>=$e.length)throw new Error(we);const Re=this.options.radius/(this.options.extent*Math.pow(2,oe-1)),ze=Ie.within($e[K*this.stride],$e[K*this.stride+1],Re),H=[];for(const J of ze){const ae=J*this.stride;$e[ae+4]===G&&H.push($e[ae+Y]>1?wt($e,ae,this.clusterProps):this.points[$e[ae+De]])}if(H.length===0)throw new Error(we);return H}getLeaves(G,K,oe){const we=[];return this._appendLeaves(we,G,K=K||10,oe=oe||0,0),we}getTile(G,K,oe){const we=this.trees[this._limitZoom(G)],Ie=Math.pow(2,G),{extent:$e,radius:Re}=this.options,ze=Re/$e,H=(oe-ze)/Ie,J=(oe+1+ze)/Ie,ae={features:[]};return this._addTileFeatures(we.range((K-ze)/Ie,H,(K+1+ze)/Ie,J),we.data,K,oe,Ie,ae),K===0&&this._addTileFeatures(we.range(1-ze/Ie,H,1,J),we.data,Ie,oe,Ie,ae),K===Ie-1&&this._addTileFeatures(we.range(0,H,ze/Ie,J),we.data,-1,oe,Ie,ae),ae.features.length?ae:null}getClusterExpansionZoom(G){let K=this._getOriginZoom(G)-1;for(;K<=this.options.maxZoom;){const oe=this.getChildren(G);if(K++,oe.length!==1)break;G=oe[0].properties.cluster_id}return K}_appendLeaves(G,K,oe,we,Ie){const $e=this.getChildren(K);for(const Re of $e){const ze=Re.properties;if(ze&&ze.cluster?Ie+ze.point_count<=we?Ie+=ze.point_count:Ie=this._appendLeaves(G,ze.cluster_id,oe,we,Ie):Ie1;let J,ae,ke;if(H)J=vt(K,ze,this.clusterProps),ae=K[ze],ke=K[ze+1];else{const mt=this.points[K[ze+De]];J=mt.properties;const[Ct,Zt]=mt.geometry.coordinates;ae=It(Ct),ke=Nt(Zt)}const Ue={type:1,geometry:[[Math.round(this.options.extent*(ae*Ie-oe)),Math.round(this.options.extent*(ke*Ie-we))]],tags:J};let bt;bt=H||this.options.generateId?K[ze+De]:this.points[K[ze+De]].id,bt!==void 0&&(Ue.id=bt),$e.features.push(Ue)}}_limitZoom(G){return Math.max(this.options.minZoom,Math.min(Math.floor(+G),this.options.maxZoom+1))}_cluster(G,K){const{radius:oe,extent:we,reduce:Ie,minPoints:$e}=this.options,Re=oe/(we*Math.pow(2,K)),ze=G.data,H=[],J=this.stride;for(let ae=0;aeK&&(Ct+=ze[di+Y])}if(Ct>mt&&Ct>=$e){let Zt,di=ke*mt,Yt=Ue*mt,ni=-1;const li=((ae/J|0)<<5)+(K+1)+this.points.length;for(const ai of bt){const gi=ai*J;if(ze[gi+2]<=K)continue;ze[gi+2]=K;const Pi=ze[gi+Y];di+=ze[gi]*Pi,Yt+=ze[gi+1]*Pi,ze[gi+4]=li,Ie&&(Zt||(Zt=this._map(ze,ae,!0),ni=this.clusterProps.length,this.clusterProps.push(Zt)),Ie(Zt,this._map(ze,gi)))}ze[ae+4]=li,H.push(di/Ct,Yt/Ct,1/0,li,-1,Ct),Ie&&H.push(ni)}else{for(let Zt=0;Zt1)for(const Zt of bt){const di=Zt*J;if(!(ze[di+2]<=K)){ze[di+2]=K;for(let Yt=0;Yt>5}_getOriginZoom(G){return(G-this.points.length)%32}_map(G,K,oe){if(G[K+Y]>1){const $e=this.clusterProps[G[K+ue]];return oe?Object.assign({},$e):$e}const we=this.points[G[K+De]].properties,Ie=this.options.map(we);return oe&&Ie===we?Object.assign({},Ie):Ie}}function wt(be,G,K){return{type:"Feature",id:be[G+De],properties:vt(be,G,K),geometry:{type:"Point",coordinates:[(oe=be[G],360*(oe-.5)),fi(be[G+1])]}};var oe}function vt(be,G,K){const oe=be[G+Y],we=oe>=1e4?`${Math.round(oe/1e3)}k`:oe>=1e3?Math.round(oe/100)/10+"k":oe,Ie=be[G+ue],$e=Ie===-1?{}:Object.assign({},K[Ie]);return Object.assign($e,{cluster:!0,cluster_id:be[G+De],point_count:oe,point_count_abbreviated:we})}function It(be){return be/360+.5}function Nt(be){const G=Math.sin(be*Math.PI/180),K=.5-.25*Math.log((1+G)/(1-G))/Math.PI;return K<0?0:K>1?1:K}function fi(be){const G=(180-360*be)*Math.PI/180;return 360*Math.atan(Math.exp(G))/Math.PI-90}function gt(be,G,K,oe){for(var we,Ie=oe,$e=K-G>>1,Re=K-G,ze=be[G],H=be[G+1],J=be[K],ae=be[K+1],ke=G+3;keIe)we=ke,Ie=Ue;else if(Ue===Ie){var bt=Math.abs(ke-$e);btoe&&(we-G>3&>(be,G,we,oe),be[we+2]=Ie,K-we>3&>(be,we,K,oe))}function _i(be,G,K,oe,we,Ie){var $e=we-K,Re=Ie-oe;if($e!==0||Re!==0){var ze=((be-K)*$e+(G-oe)*Re)/($e*$e+Re*Re);ze>1?(K=we,oe=Ie):ze>0&&(K+=$e*ze,oe+=Re*ze)}return($e=be-K)*$e+(Re=G-oe)*Re}function Z(be,G,K,oe){var we={id:be===void 0?null:be,type:G,geometry:K,tags:oe,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(Ie){var $e=Ie.geometry,Re=Ie.type;if(Re==="Point"||Re==="MultiPoint"||Re==="LineString")lt(Ie,$e);else if(Re==="Polygon"||Re==="MultiLineString")for(var ze=0;ze<$e.length;ze++)lt(Ie,$e[ze]);else if(Re==="MultiPolygon")for(ze=0;ze<$e.length;ze++)for(var H=0;H<$e[ze].length;H++)lt(Ie,$e[ze][H])}(we),we}function lt(be,G){for(var K=0;K0&&($e+=oe?(we*H-ze*Ie)/2:Math.sqrt(Math.pow(ze-we,2)+Math.pow(H-Ie,2))),we=ze,Ie=H}var J=G.length-3;G[2]=1,gt(G,0,J,K),G[J+2]=1,G.size=Math.abs($e),G.start=0,G.end=G.size}function Ze(be,G,K,oe){for(var we=0;we1?1:K}function Ye(be,G,K,oe,we,Ie,$e,Re){if(oe/=G,Ie>=(K/=G)&&$e=oe)return null;for(var ze=[],H=0;H=K&&bt=oe)){var mt=[];if(ke==="Point"||ke==="MultiPoint")xt(ae,mt,K,oe,we);else if(ke==="LineString")kt(ae,mt,K,oe,we,!1,Re.lineMetrics);else if(ke==="MultiLineString")Xt(ae,mt,K,oe,we,!1);else if(ke==="Polygon")Xt(ae,mt,K,oe,we,!0);else if(ke==="MultiPolygon")for(var Ct=0;Ct=K&&$e<=oe&&(G.push(be[Ie]),G.push(be[Ie+1]),G.push(be[Ie+2]))}}function kt(be,G,K,oe,we,Ie,$e){for(var Re,ze,H=ct(be),J=we===0?Ti:Wi,ae=be.start,ke=0;keK&&(ze=J(H,Ue,bt,Ct,Zt,K),$e&&(H.start=ae+Re*ze)):di>oe?Yt=K&&(ze=J(H,Ue,bt,Ct,Zt,K),ni=!0),Yt>oe&&di<=oe&&(ze=J(H,Ue,bt,Ct,Zt,oe),ni=!0),!Ie&&ni&&($e&&(H.end=ae+Re*ze),G.push(H),H=ct(be)),$e&&(ae+=Re)}var li=be.length-3;Ue=be[li],bt=be[li+1],mt=be[li+2],(di=we===0?Ue:bt)>=K&&di<=oe&&Ii(H,Ue,bt,mt),li=H.length-3,Ie&&li>=3&&(H[li]!==H[0]||H[li+1]!==H[1])&&Ii(H,H[0],H[1],H[2]),H.length&&G.push(H)}function ct(be){var G=[];return G.size=be.size,G.start=be.start,G.end=be.end,G}function Xt(be,G,K,oe,we,Ie){for(var $e=0;$e$e.maxX&&($e.maxX=J),ae>$e.maxY&&($e.maxY=ae)}return $e}function xr(be,G,K,oe){var we=G.geometry,Ie=G.type,$e=[];if(Ie==="Point"||Ie==="MultiPoint")for(var Re=0;Re0&&G.size<(we?$e:oe))K.numPoints+=G.length/3;else{for(var Re=[],ze=0;ze$e)&&(K.numSimplified++,Re.push(G[ze]),Re.push(G[ze+1])),K.numPoints++;we&&function(H,J){for(var ae=0,ke=0,Ue=H.length,bt=Ue-2;ke0===J)for(ke=0,Ue=H.length;ke24)throw new Error("maxZoom should be in the 0-24 range");if(G.promoteId&&G.generateId)throw new Error("promoteId and generateId cannot be used together.");var oe=function(we,Ie){var $e=[];if(we.type==="FeatureCollection")for(var Re=0;Re1&&console.time("creation"),ke=this.tiles[ae]=Ji(be,G,K,oe,ze),this.tileCoords.push({z:G,x:K,y:oe}),H)){H>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",G,K,oe,ke.numFeatures,ke.numPoints,ke.numSimplified),console.timeEnd("creation"));var Ue="z"+G;this.stats[Ue]=(this.stats[Ue]||0)+1,this.total++}if(ke.source=be,we){if(G===ze.maxZoom||G===we)continue;var bt=1<1&&console.time("clipping");var mt,Ct,Zt,di,Yt,ni,li=.5*ze.buffer/ze.extent,ai=.5-li,gi=.5+li,Pi=1+li;mt=Ct=Zt=di=null,Yt=Ye(be,J,K-li,K+gi,0,ke.minX,ke.maxX,ze),ni=Ye(be,J,K+ai,K+Pi,0,ke.minX,ke.maxX,ze),be=null,Yt&&(mt=Ye(Yt,J,oe-li,oe+gi,1,ke.minY,ke.maxY,ze),Ct=Ye(Yt,J,oe+ai,oe+Pi,1,ke.minY,ke.maxY,ze),Yt=null),ni&&(Zt=Ye(ni,J,oe-li,oe+gi,1,ke.minY,ke.maxY,ze),di=Ye(ni,J,oe+ai,oe+Pi,1,ke.minY,ke.maxY,ze),ni=null),H>1&&console.timeEnd("clipping"),Re.push(mt||[],G+1,2*K,2*oe),Re.push(Ct||[],G+1,2*K,2*oe+1),Re.push(Zt||[],G+1,2*K+1,2*oe),Re.push(di||[],G+1,2*K+1,2*oe+1)}}},or.prototype.getTile=function(be,G,K){var oe=this.options,we=oe.extent,Ie=oe.debug;if(be<0||be>24)return null;var $e=1<1&&console.log("drilling down to z%d-%d-%d",be,G,K);for(var ze,H=be,J=G,ae=K;!ze&&H>0;)H--,J=Math.floor(J/2),ae=Math.floor(ae/2),ze=this.tiles[zt(H,J,ae)];return ze&&ze.source?(Ie>1&&console.log("found parent tile z%d-%d-%d",H,J,ae),Ie>1&&console.time("drilling down"),this.splitTile(ze.source,H,J,ae,be,G,K),Ie>1&&console.timeEnd("drilling down"),this.tiles[Re]?Gr(this.tiles[Re],we):null):null};class pi extends z{constructor(G,K,oe,we){super(G,K,oe,$r),this._dataUpdateable=new Map,this.loadGeoJSON=(Ie,$e)=>{const{promoteId:Re}=Ie;if(Ie.request)return n.getJSON(Ie.request,(ze,H,J,ae)=>{this._dataUpdateable=wi(H,Re)?Sr(H,Re):void 0,$e(ze,H,J,ae)});if(typeof Ie.data=="string")try{const ze=JSON.parse(Ie.data);this._dataUpdateable=wi(ze,Re)?Sr(ze,Re):void 0,$e(null,ze)}catch{$e(new Error(`Input data given to '${Ie.source}' is not a valid GeoJSON object.`))}else Ie.dataDiff?this._dataUpdateable?(function(ze,H,J){var ae,ke,Ue,bt;if(H.removeAll&&ze.clear(),H.remove)for(const mt of H.remove)ze.delete(mt);if(H.add)for(const mt of H.add){const Ct=bi(mt,J);Ct!=null&&ze.set(Ct,mt)}if(H.update)for(const mt of H.update){let Ct=ze.get(mt.id);if(Ct==null)continue;const Zt=!mt.removeAllProperties&&(((ae=mt.removeProperties)===null||ae===void 0?void 0:ae.length)>0||((ke=mt.addOrUpdateProperties)===null||ke===void 0?void 0:ke.length)>0);if((mt.newGeometry||mt.removeAllProperties||Zt)&&(Ct=Object.assign({},Ct),ze.set(mt.id,Ct),Zt&&(Ct.properties=Object.assign({},Ct.properties))),mt.newGeometry&&(Ct.geometry=mt.newGeometry),mt.removeAllProperties)Ct.properties={};else if(((Ue=mt.removeProperties)===null||Ue===void 0?void 0:Ue.length)>0)for(const di of mt.removeProperties)Object.prototype.hasOwnProperty.call(Ct.properties,di)&&delete Ct.properties[di];if(((bt=mt.addOrUpdateProperties)===null||bt===void 0?void 0:bt.length)>0)for(const{key:di,value:Yt}of mt.addOrUpdateProperties)Ct.properties[di]=Yt}}(this._dataUpdateable,Ie.dataDiff,Re),$e(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):$e(new Error(`Cannot update existing geojson data in ${Ie.source}`)):$e(new Error(`Input data given to '${Ie.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},we&&(this.loadGeoJSON=we)}loadData(G,K){var oe;(oe=this._pendingRequest)===null||oe===void 0||oe.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const we=!!(G&&G.request&&G.request.collectResourceTiming)&&new n.RequestPerformance(G.request);this._pendingCallback=K,this._pendingRequest=this.loadGeoJSON(G,(Ie,$e)=>{if(delete this._pendingCallback,delete this._pendingRequest,Ie||!$e)return K(Ie);if(typeof $e!="object")return K(new Error(`Input data given to '${G.source}' is not a valid GeoJSON object.`));{D($e,!0);try{if(G.filter){const ze=n.createExpression(G.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ze.result==="error")throw new Error(ze.value.map(J=>`${J.key}: ${J.message}`).join(", "));$e={type:"FeatureCollection",features:$e.features.filter(J=>ze.value.evaluate({zoom:0},J))}}this._geoJSONIndex=G.cluster?new Qe(function({superclusterOptions:ze,clusterProperties:H}){if(!H||!ze)return ze;const J={},ae={},ke={accumulated:null,zoom:0},Ue={properties:null},bt=Object.keys(H);for(const mt of bt){const[Ct,Zt]=H[mt],di=n.createExpression(Zt),Yt=n.createExpression(typeof Ct=="string"?[Ct,["accumulated"],["get",mt]]:Ct);J[mt]=di.value,ae[mt]=Yt.value}return ze.map=mt=>{Ue.properties=mt;const Ct={};for(const Zt of bt)Ct[Zt]=J[Zt].evaluate(ke,Ue);return Ct},ze.reduce=(mt,Ct)=>{Ue.properties=Ct;for(const Zt of bt)ke.accumulated=mt[Zt],mt[Zt]=ae[Zt].evaluate(ke,Ue)},ze}(G)).load($e.features):function(ze,H){return new or(ze,H)}($e,G.geojsonVtOptions)}catch(ze){return K(ze)}this.loaded={};const Re={};if(we){const ze=we.finish();ze&&(Re.resourceTiming={},Re.resourceTiming[G.source]=JSON.parse(JSON.stringify(ze)))}K(null,Re)}})}reloadTile(G,K){const oe=this.loaded;return oe&&oe[G.uid]?super.reloadTile(G,K):this.loadTile(G,K)}removeSource(G,K){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),K()}getClusterExpansionZoom(G,K){try{K(null,this._geoJSONIndex.getClusterExpansionZoom(G.clusterId))}catch(oe){K(oe)}}getClusterChildren(G,K){try{K(null,this._geoJSONIndex.getChildren(G.clusterId))}catch(oe){K(oe)}}getClusterLeaves(G,K){try{K(null,this._geoJSONIndex.getLeaves(G.clusterId,G.limit,G.offset))}catch(oe){K(oe)}}}class cn{constructor(G){this.self=G,this.actor=new n.Actor(G,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:z,geojson:pi},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(K,oe)=>{if(this.workerSourceTypes[K])throw new Error(`Worker source with name "${K}" already registered.`);this.workerSourceTypes[K]=oe},this.self.registerRTLTextPlugin=K=>{if(n.plugin.isParsed())throw new Error("RTL text plugin already registered.");n.plugin.applyArabicShaping=K.applyArabicShaping,n.plugin.processBidirectionalText=K.processBidirectionalText,n.plugin.processStyledBidirectionalText=K.processStyledBidirectionalText}}setReferrer(G,K){this.referrer=K}setImages(G,K,oe){this.availableImages[G]=K;for(const we in this.workerSources[G]){const Ie=this.workerSources[G][we];for(const $e in Ie)Ie[$e].availableImages=K}oe()}setLayers(G,K,oe){this.getLayerIndex(G).replace(K),oe()}updateLayers(G,K,oe){this.getLayerIndex(G).update(K.layers,K.removedIds),oe()}loadTile(G,K,oe){this.getWorkerSource(G,K.type,K.source).loadTile(K,oe)}loadDEMTile(G,K,oe){this.getDEMWorkerSource(G,K.source).loadTile(K,oe)}reloadTile(G,K,oe){this.getWorkerSource(G,K.type,K.source).reloadTile(K,oe)}abortTile(G,K,oe){this.getWorkerSource(G,K.type,K.source).abortTile(K,oe)}removeTile(G,K,oe){this.getWorkerSource(G,K.type,K.source).removeTile(K,oe)}removeDEMTile(G,K){this.getDEMWorkerSource(G,K.source).removeTile(K)}removeSource(G,K,oe){if(!this.workerSources[G]||!this.workerSources[G][K.type]||!this.workerSources[G][K.type][K.source])return;const we=this.workerSources[G][K.type][K.source];delete this.workerSources[G][K.type][K.source],we.removeSource!==void 0?we.removeSource(K,oe):oe()}loadWorkerSource(G,K,oe){try{this.self.importScripts(K.url),oe()}catch(we){oe(we.toString())}}syncRTLPluginState(G,K,oe){try{n.plugin.setState(K);const we=n.plugin.getPluginURL();if(n.plugin.isLoaded()&&!n.plugin.isParsed()&&we!=null){this.self.importScripts(we);const Ie=n.plugin.isParsed();oe(Ie?void 0:new Error(`RTL Text Plugin failed to import scripts from ${we}`),Ie)}}catch(we){oe(we.toString())}}getAvailableImages(G){let K=this.availableImages[G];return K||(K=[]),K}getLayerIndex(G){let K=this.layerIndexes[G];return K||(K=this.layerIndexes[G]=new _),K}getWorkerSource(G,K,oe){if(this.workerSources[G]||(this.workerSources[G]={}),this.workerSources[G][K]||(this.workerSources[G][K]={}),!this.workerSources[G][K][oe]){const we={send:(Ie,$e,Re)=>{this.actor.send(Ie,$e,Re,G)}};this.workerSources[G][K][oe]=new this.workerSourceTypes[K](we,this.getLayerIndex(G),this.getAvailableImages(G))}return this.workerSources[G][K][oe]}getDEMWorkerSource(G,K){return this.demWorkerSources[G]||(this.demWorkerSources[G]={}),this.demWorkerSources[G][K]||(this.demWorkerSources[G][K]=new P),this.demWorkerSources[G][K]}}return n.isWorker()&&(self.worker=new cn(self)),cn}),f(["./shared"],function(n){var _="3.5.1";class v{static testProp(t){if(!v.docStyle)return t[0];for(let c=0;c{window.removeEventListener("click",v.suppressClickInternal,!0)},0)}static mousePos(t,c){const d=t.getBoundingClientRect();return new n.Point(c.clientX-d.left-t.clientLeft,c.clientY-d.top-t.clientTop)}static touchPos(t,c){const d=t.getBoundingClientRect(),g=[];for(let w=0;w{t=[],c=0,d=0,g={}},y.addThrottleControl=O=>{const U=d++;return g[U]=O,U},y.removeThrottleControl=O=>{delete g[O],A()},y.getImage=(O,U,$=!0)=>{E.supported&&(O.headers||(O.headers={}),O.headers.accept="image/webp,*/*");const Q={requestParameters:O,supportImageRefresh:$,callback:U,cancelled:!1,completed:!1,cancel:()=>{Q.completed||Q.cancelled||(Q.cancelled=!0,Q.innerRequest&&(Q.innerRequest.cancel(),c--),A())}};return t.push(Q),A(),Q};const w=O=>{const{requestParameters:U,supportImageRefresh:$,callback:Q}=O;return n.extend(U,{type:"image"}),($!==!1||n.isWorker()||n.getProtocolAction(U.url)||U.headers&&!Object.keys(U.headers).reduce((me,fe)=>me&&fe==="accept",!0)?n.makeRequest:R)(U,(me,fe,xe,he)=>{T(O,Q,me,fe,xe,he)})},T=(O,U,$,Q,me,fe)=>{$?U($):Q instanceof HTMLImageElement||n.isImageBitmap(Q)?U(null,Q):Q&&((xe,he)=>{typeof createImageBitmap=="function"?n.arrayBufferToImageBitmap(xe,he):n.arrayBufferToImage(xe,he)})(Q,(xe,he)=>{xe!=null?U(xe):he!=null&&U(null,he,{cacheControl:me,expires:fe})}),O.cancelled||(O.completed=!0,c--,A())},A=()=>{const O=(()=>{const U=Object.keys(g);let $=!1;if(U.length>0){for(const Q of U)if($=g[Q](),$)break}return $})()?n.config.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:n.config.MAX_PARALLEL_IMAGE_REQUESTS;for(let U=c;U0;U++){const $=t.shift();if($.cancelled){U--;continue}const Q=w($);c++,$.innerRequest=Q}},R=(O,U)=>{const $=new Image,Q=O.url;let me=!1;const fe=O.credentials;return fe&&fe==="include"?$.crossOrigin="use-credentials":(fe&&fe==="same-origin"||!n.sameOrigin(Q))&&($.crossOrigin="anonymous"),$.fetchPriority="high",$.onload=()=>{U(null,$),$.onerror=$.onload=null},$.onerror=()=>{me||U(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.")),$.onerror=$.onload=null},$.src=Q,{cancel:()=>{me=!0,$.src=""}}}}(L||(L={})),L.resetRequestQueue(),function(y){y.Glyphs="Glyphs",y.Image="Image",y.Source="Source",y.SpriteImage="SpriteImage",y.SpriteJSON="SpriteJSON",y.Style="Style",y.Tile="Tile",y.Unknown="Unknown"}(D||(D={}));class F{constructor(t){this._transformRequestFn=t}transformRequest(t,c){return this._transformRequestFn&&this._transformRequestFn(t,c)||{url:t}}normalizeSpriteURL(t,c,d){const g=function(w){const T=w.match(V);if(!T)throw new Error(`Unable to parse URL "${w}"`);return{protocol:T[1],authority:T[2],path:T[3]||"/",params:T[4]?T[4].split("&"):[]}}(t);return g.path+=`${c}${d}`,function(w){const T=w.params.length?`?${w.params.join("&")}`:"";return`${w.protocol}://${w.authority}${w.path}${T}`}(g)}setTransformRequest(t){this._transformRequestFn=t}}const V=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ee(y){var t=new n.ARRAY_TYPE(3);return t[0]=y[0],t[1]=y[1],t[2]=y[2],t}var se,ne=function(y,t,c){return y[0]=t[0]-c[0],y[1]=t[1]-c[1],y[2]=t[2]-c[2],y};se=new n.ARRAY_TYPE(3),n.ARRAY_TYPE!=Float32Array&&(se[0]=0,se[1]=0,se[2]=0);var le=function(y){var t=y[0],c=y[1];return t*t+c*c};function ge(y){const t=[];if(typeof y=="string")t.push({id:"default",url:y});else if(y&&y.length>0){const c=[];for(const{id:d,url:g}of y){const w=`${d}${g}`;c.indexOf(w)===-1&&(c.push(w),t.push({id:d,url:g}))}}return t}function ce(y,t,c,d,g){if(d)return void y(d);if(g!==Object.values(t).length||g!==Object.values(c).length)return;const w={};for(const T in t){w[T]={};const A=n.browser.getImageCanvasContext(c[T]),R=t[T];for(const O in R){const{width:U,height:$,x:Q,y:me,sdf:fe,pixelRatio:xe,stretchX:he,stretchY:Ve,content:tt}=R[O];w[T][O]={data:null,pixelRatio:xe,sdf:fe,stretchX:he,stretchY:Ve,content:tt,spriteData:{width:U,height:$,x:Q,y:me,context:A}}}}y(null,w)}(function(){var y=new n.ARRAY_TYPE(2);n.ARRAY_TYPE!=Float32Array&&(y[0]=0,y[1]=0)})();class Me{constructor(t,c,d,g){this.context=t,this.format=d,this.texture=t.gl.createTexture(),this.update(c,g)}update(t,c,d){const{width:g,height:w}=t,T=!(this.size&&this.size[0]===g&&this.size[1]===w||d),{context:A}=this,{gl:R}=A;if(this.useMipmap=!!(c&&c.useMipmap),R.bindTexture(R.TEXTURE_2D,this.texture),A.pixelStoreUnpackFlipY.set(!1),A.pixelStoreUnpack.set(1),A.pixelStoreUnpackPremultiplyAlpha.set(this.format===R.RGBA&&(!c||c.premultiply!==!1)),T)this.size=[g,w],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||n.isImageBitmap(t)?R.texImage2D(R.TEXTURE_2D,0,this.format,this.format,R.UNSIGNED_BYTE,t):R.texImage2D(R.TEXTURE_2D,0,this.format,g,w,0,this.format,R.UNSIGNED_BYTE,t.data);else{const{x:O,y:U}=d||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||n.isImageBitmap(t)?R.texSubImage2D(R.TEXTURE_2D,0,O,U,R.RGBA,R.UNSIGNED_BYTE,t):R.texSubImage2D(R.TEXTURE_2D,0,O,U,g,w,R.RGBA,R.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&R.generateMipmap(R.TEXTURE_2D)}bind(t,c,d){const{context:g}=this,{gl:w}=g;w.bindTexture(w.TEXTURE_2D,this.texture),d!==w.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(d=w.LINEAR),t!==this.filter&&(w.texParameteri(w.TEXTURE_2D,w.TEXTURE_MAG_FILTER,t),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,d||t),this.filter=t),c!==this.wrap&&(w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,c),w.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,c),this.wrap=c)}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 et(y){const{userImage:t}=y;return!!(t&&t.render&&t.render())&&(y.data.replace(new Uint8Array(t.data.buffer)),!0)}class ye extends n.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new n.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:c,callback:d}of this.requestors)this._notify(c,d);this.requestors=[]}}getImage(t){const c=this.images[t];if(c&&!c.data&&c.spriteData){const d=c.spriteData;c.data=new n.RGBAImage({width:d.width,height:d.height},d.context.getImageData(d.x,d.y,d.width,d.height).data),c.spriteData=null}return c}addImage(t,c){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,c)&&(this.images[t]=c)}_validate(t,c){let d=!0;const g=c.data||c.spriteData;return this._validateStretch(c.stretchX,g&&g.width)||(this.fire(new n.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),d=!1),this._validateStretch(c.stretchY,g&&g.height)||(this.fire(new n.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),d=!1),this._validateContent(c.content,c)||(this.fire(new n.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),d=!1),d}_validateStretch(t,c){if(!t)return!0;let d=0;for(const g of t){if(g[0]-1);R++,w[R]=A,T[R]=O,T[R+1]=Ge}for(let A=0,R=0;A{let A=this.entries[g];A||(A=this.entries[g]={glyphs:{},requests:{},ranges:{}});let R=A.glyphs[w];if(R!==void 0)return void T(null,{stack:g,id:w,glyph:R});if(R=this._tinySDF(A,g,w),R)return A.glyphs[w]=R,void T(null,{stack:g,id:w,glyph:R});const O=Math.floor(w/256);if(256*O>65535)return void T(new Error("glyphs > 65535 not supported"));if(A.ranges[O])return void T(null,{stack:g,id:w,glyph:R});if(!this.url)return void T(new Error("glyphsUrl is not set"));let U=A.requests[O];U||(U=A.requests[O]=[],Tt.loadGlyphRange(g,O,this.url,this.requestManager,($,Q)=>{if(Q){for(const me in Q)this._doesCharSupportLocalGlyph(+me)||(A.glyphs[+me]=Q[+me]);A.ranges[O]=!0}for(const me of U)me($,Q);delete A.requests[O]})),U.push(($,Q)=>{$?T($):Q&&T(null,{stack:g,id:w,glyph:Q[w]||null})})},(g,w)=>{if(g)c(g);else if(w){const T={};for(const{stack:A,id:R,glyph:O}of w)(T[A]||(T[A]={}))[R]=O&&{id:O.id,bitmap:O.bitmap.clone(),metrics:O.metrics};c(null,T)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(n.unicodeBlockLookup["CJK Unified Ideographs"](t)||n.unicodeBlockLookup["Hangul Syllables"](t)||n.unicodeBlockLookup.Hiragana(t)||n.unicodeBlockLookup.Katakana(t))}_tinySDF(t,c,d){const g=this.localIdeographFontFamily;if(!g||!this._doesCharSupportLocalGlyph(d))return;let w=t.tinySDF;if(!w){let A="400";/bold/i.test(c)?A="900":/medium/i.test(c)?A="500":/light/i.test(c)&&(A="200"),w=t.tinySDF=new Tt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:g,fontWeight:A})}const T=w.draw(String.fromCharCode(d));return{id:d,bitmap:new n.AlphaImage({width:T.width||60,height:T.height||60},T.data),metrics:{width:T.glyphWidth/2||24,height:T.glyphHeight/2||24,left:T.glyphLeft/2+.5||0,top:T.glyphTop/2-27.5||-8,advance:T.glyphAdvance/2||24,isDoubleResolution:!0}}}}Tt.loadGlyphRange=function(y,t,c,d,g){const w=256*t,T=w+255,A=d.transformRequest(c.replace("{fontstack}",y).replace("{range}",`${w}-${T}`),D.Glyphs);n.getArrayBuffer(A,(R,O)=>{if(R)g(R);else if(O){const U={};for(const $ of n.parseGlyphPbf(O))U[$.id]=$;g(null,U)}})},Tt.TinySDF=class{constructor({fontSize:y=24,buffer:t=3,radius:c=8,cutoff:d=.25,fontFamily:g="sans-serif",fontWeight:w="normal",fontStyle:T="normal"}={}){this.buffer=t,this.cutoff=d,this.radius=c;const A=this.size=y+4*t,R=this._createCanvas(A),O=this.ctx=R.getContext("2d",{willReadFrequently:!0});O.font=`${T} ${w} ${y}px ${g}`,O.textBaseline="alphabetic",O.textAlign="left",O.fillStyle="black",this.gridOuter=new Float64Array(A*A),this.gridInner=new Float64Array(A*A),this.f=new Float64Array(A),this.z=new Float64Array(A+1),this.v=new Uint16Array(A)}_createCanvas(y){const t=document.createElement("canvas");return t.width=t.height=y,t}draw(y){const{width:t,actualBoundingBoxAscent:c,actualBoundingBoxDescent:d,actualBoundingBoxLeft:g,actualBoundingBoxRight:w}=this.ctx.measureText(y),T=Math.ceil(c),A=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(w-g))),R=Math.min(this.size-this.buffer,T+Math.ceil(d)),O=A+2*this.buffer,U=R+2*this.buffer,$=Math.max(O*U,0),Q=new Uint8ClampedArray($),me={data:Q,width:O,height:U,glyphWidth:A,glyphHeight:R,glyphTop:T,glyphLeft:0,glyphAdvance:t};if(A===0||R===0)return me;const{ctx:fe,buffer:xe,gridInner:he,gridOuter:Ve}=this;fe.clearRect(xe,xe,A,R),fe.fillText(y,xe,xe+T);const tt=fe.getImageData(xe,xe,A,R);Ve.fill(Ge,0,$),he.fill(0,0,$);for(let Ce=0;Ce0?ft*ft:0,he[ot]=ft<0?ft*ft:0}}q(Ve,0,0,O,U,O,this.f,this.v,this.z),q(he,xe,xe,A,R,O,this.f,this.v,this.z);for(let Ce=0;Ce<$;Ce++){const je=Math.sqrt(Ve[Ce])-Math.sqrt(he[Ce]);Q[Ce]=Math.round(255-255*(je/this.radius+this.cutoff))}return me}};class it{constructor(){this.specification=n.v8Spec.light.position}possiblyEvaluate(t,c){return n.sphericalToCartesian(t.expression.evaluate(c))}interpolate(t,c,d){return{x:n.interpolate.number(t.x,c.x,d),y:n.interpolate.number(t.y,c.y,d),z:n.interpolate.number(t.z,c.z,d)}}}let Bt;class Ne extends n.Evented{constructor(t){super(),Bt=Bt||new n.Properties({anchor:new n.DataConstantProperty(n.v8Spec.light.anchor),position:new it,color:new n.DataConstantProperty(n.v8Spec.light.color),intensity:new n.DataConstantProperty(n.v8Spec.light.intensity)}),this._transitionable=new n.Transitionable(Bt),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,c={}){if(!this._validate(n.validateLight,t,c))for(const d in t){const g=t[d];d.endsWith("-transition")?this._transitionable.setTransition(d.slice(0,-11),g):this._transitionable.setValue(d,g)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,c,d){return(!d||d.validate!==!1)&&n.emitValidationErrors(this,t.call(n.validateStyle,n.extend({value:c,style:{glyphs:!0,sprite:!0},styleSpec:n.v8Spec})))}}class Xe{constructor(t,c){this.width=t,this.height=c,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,c){const d=t.join(",")+String(c);return this.dashEntry[d]||(this.dashEntry[d]=this.addDash(t,c)),this.dashEntry[d]}getDashRanges(t,c,d){const g=[];let w=t.length%2==1?-t[t.length-1]*d:0,T=t[0]*d,A=!0;g.push({left:w,right:T,isDash:A,zeroLength:t[0]===0});let R=t[0];for(let O=1;O1&&(R=t[++A]);const U=Math.abs(O-R.left),$=Math.abs(O-R.right),Q=Math.min(U,$);let me;const fe=w/d*(g+1);if(R.isDash){const xe=g-Math.abs(fe);me=Math.sqrt(Q*Q+xe*xe)}else me=g-Math.sqrt(Q*Q+fe*fe);this.data[T+O]=Math.max(0,Math.min(255,me+128))}}}addRegularDash(t){for(let A=t.length-1;A>=0;--A){const R=t[A],O=t[A+1];R.zeroLength?t.splice(A,1):O&&O.isDash===R.isDash&&(O.left=R.left,t.splice(A,1))}const c=t[0],d=t[t.length-1];c.isDash===d.isDash&&(c.left=d.left-this.width,d.right=c.right+this.width);const g=this.width*this.nextRow;let w=0,T=t[w];for(let A=0;A1&&(T=t[++w]);const R=Math.abs(A-T.left),O=Math.abs(A-T.right),U=Math.min(R,O);this.data[g+A]=Math.max(0,Math.min(255,(T.isDash?U:-U)+128))}}addDash(t,c){const d=c?7:0,g=2*d+1;if(this.nextRow+g>this.height)return n.warnOnce("LineAtlas out of space"),null;let w=0;for(let A=0;A{g.send(t,c,w)},d=d||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(c=>{c.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}}function ve(y,t,c){const d=function(g,w){if(g)return c(g);if(w){const T=n.pick(n.extend(w,y),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);w.vector_layers&&(T.vectorLayers=w.vector_layers,T.vectorLayerIds=T.vectorLayers.map(A=>A.id)),c(null,T)}};return y.url?n.getJSON(t.transformRequest(y.url,D.Source),d):n.browser.frame(()=>d(null,y))}ie.Actor=n.Actor;class De{constructor(t,c){t&&(c?this.setSouthWest(t).setNorthEast(c):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 n.LngLat?new n.LngLat(t.lng,t.lat):n.LngLat.convert(t),this}setSouthWest(t){return this._sw=t instanceof n.LngLat?new n.LngLat(t.lng,t.lat):n.LngLat.convert(t),this}extend(t){const c=this._sw,d=this._ne;let g,w;if(t instanceof n.LngLat)g=t,w=t;else{if(!(t instanceof De))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(De.convert(t)):this.extend(n.LngLat.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(n.LngLat.convert(t)):this;if(g=t._sw,w=t._ne,!g||!w)return this}return c||d?(c.lng=Math.min(g.lng,c.lng),c.lat=Math.min(g.lat,c.lat),d.lng=Math.max(w.lng,d.lng),d.lat=Math.max(w.lat,d.lat)):(this._sw=new n.LngLat(g.lng,g.lat),this._ne=new n.LngLat(w.lng,w.lat)),this}getCenter(){return new n.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 n.LngLat(this.getWest(),this.getNorth())}getSouthEast(){return new n.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:c,lat:d}=n.LngLat.convert(t);let g=this._sw.lng<=c&&c<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=c&&c>=this._ne.lng),this._sw.lat<=d&&d<=this._ne.lat&&g}static convert(t){return t instanceof De?t:t&&new De(t)}static fromLngLat(t,c=0){const d=360*c/40075017,g=d/Math.cos(Math.PI/180*t.lat);return new De(new n.LngLat(t.lng-g,t.lat-d),new n.LngLat(t.lng+g,t.lat+d))}}class Y{constructor(t,c,d){this.bounds=De.convert(this.validateBounds(t)),this.minzoom=c||0,this.maxzoom=d||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 c=Math.pow(2,t.z),d=Math.floor(n.mercatorXfromLng(this.bounds.getWest())*c),g=Math.floor(n.mercatorYfromLat(this.bounds.getNorth())*c),w=Math.ceil(n.mercatorXfromLng(this.bounds.getEast())*c),T=Math.ceil(n.mercatorYfromLat(this.bounds.getSouth())*c);return t.x>=d&&t.x=g&&t.y{this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ve(this._options,this.map._requestManager,(w,T)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),w?this.fire(new n.ErrorEvent(w)):T&&(n.extend(this,T),T.bounds&&(this.tileBounds=new Y(T.bounds,this.minzoom,this.maxzoom)),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})))})},this.serialize=()=>n.extend({},this._options),this.id=t,this.dispatcher=d,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,n.extend(this,n.pick(c,["url","scheme","tileSize","promoteId"])),this._options=n.extend({type:"vector"},c),this._collectResourceTiming=c.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(g)}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)}loadTile(t,c){const d=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g={request:this.map._requestManager.transformRequest(d,D.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 w(T,A){return delete t.request,t.aborted?c(null):T&&T.status!==404?c(T):(A&&A.resourceTiming&&(t.resourceTiming=A.resourceTiming),this.map._refreshExpiredTiles&&A&&t.setExpiryData(A),t.loadVectorData(A,this.map.painter),c(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}g.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=c:t.request=t.actor.send("reloadTile",g,w.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",g,w.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 Qe extends n.Evented{constructor(t,c,d,g){super(),this.id=t,this.dispatcher=d,this.setEventedParent(g),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=n.extend({type:"raster"},c),n.extend(this,n.pick(c,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=ve(this._options,this.map._requestManager,(t,c)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new n.ErrorEvent(t)):c&&(n.extend(this,c),c.bounds&&(this.tileBounds=new Y(c.bounds,this.minzoom,this.maxzoom)),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new n.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)}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}serialize(){return n.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,c){const d=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=L.getImage(this.map._requestManager.transformRequest(d,D.Tile),(g,w,T)=>{if(delete t.request,t.aborted)t.state="unloaded",c(null);else if(g)t.state="errored",c(g);else if(w){this.map._refreshExpiredTiles&&T&&t.setExpiryData(T);const A=this.map.painter.context,R=A.gl;t.texture=this.map.painter.getTileTexture(w.width),t.texture?t.texture.update(w,{useMipmap:!0}):(t.texture=new Me(A,w,R.RGBA,{useMipmap:!0}),t.texture.bind(R.LINEAR,R.CLAMP_TO_EDGE,R.LINEAR_MIPMAP_NEAREST),A.extTextureFilterAnisotropic&&R.texParameterf(R.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax)),t.state="loaded",c(null)}},this.map._refreshExpiredTiles)}abortTile(t,c){t.request&&(t.request.cancel(),delete t.request),c()}unloadTile(t,c){t.texture&&this.map.painter.saveTileTexture(t.texture),c()}hasTransition(){return!1}}class wt extends Qe{constructor(t,c,d,g){super(t,c,d,g),this.type="raster-dem",this.maxzoom=22,this._options=n.extend({type:"raster-dem"},c),this.encoding=c.encoding||"mapbox",this.redFactor=c.redFactor,this.greenFactor=c.greenFactor,this.blueFactor=c.blueFactor,this.baseShift=c.baseShift}loadTile(t,c){const d=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),g=this.map._requestManager.transformRequest(d,D.Tile);function w(T,A){T&&(t.state="errored",c(T)),A&&(t.dem=A,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",c(null))}t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.request=L.getImage(g,(T,A,R)=>n.__awaiter(this,void 0,void 0,function*(){if(delete t.request,t.aborted)t.state="unloaded",c(null);else if(T)t.state="errored",c(T);else if(A){this.map._refreshExpiredTiles&&t.setExpiryData(R);const O=n.isImageBitmap(A)&&n.offscreenCanvasSupported()?A:yield function($){return n.__awaiter(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&n.isOffscreenCanvasDistorted()){const Q=$.width+2,me=$.height+2;try{return new n.RGBAImage({width:Q,height:me},yield n.readImageUsingVideoFrame($,-1,-1,Q,me))}catch{}}return n.browser.getImageData($,1)})}(A),U={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:O,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",U,w))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(t){const c=t.canonical,d=Math.pow(2,c.z),g=(c.x-1+d)%d,w=c.x===0?t.wrap-1:t.wrap,T=(c.x+1+d)%d,A=c.x+1===d?t.wrap+1:t.wrap,R={};return R[new n.OverscaledTileID(t.overscaledZ,w,c.z,g,c.y).key]={backfilled:!1},R[new n.OverscaledTileID(t.overscaledZ,A,c.z,T,c.y).key]={backfilled:!1},c.y>0&&(R[new n.OverscaledTileID(t.overscaledZ,w,c.z,g,c.y-1).key]={backfilled:!1},R[new n.OverscaledTileID(t.overscaledZ,t.wrap,c.z,c.x,c.y-1).key]={backfilled:!1},R[new n.OverscaledTileID(t.overscaledZ,A,c.z,T,c.y-1).key]={backfilled:!1}),c.y+1{this._updateWorkerData()},this.serialize=()=>n.extend({},this._options,{type:this.type,data:this._data}),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=d.getActor(),this.setEventedParent(g),this._data=c.data,this._options=n.extend({},c),this._collectResourceTiming=c.collectResourceTiming,c.maxzoom!==void 0&&(this.maxzoom=c.maxzoom),c.type&&(this.type=c.type),c.attribution&&(this.attribution=c.attribution),this.promoteId=c.promoteId;const w=n.EXTENT/this.tileSize;this.workerOptions=n.extend({source:this.id,cluster:c.cluster||!1,geojsonVtOptions:{buffer:(c.buffer!==void 0?c.buffer:128)*w,tolerance:(c.tolerance!==void 0?c.tolerance:.375)*w,extent:n.EXTENT,maxZoom:this.maxzoom,lineMetrics:c.lineMetrics||!1,generateId:c.generateId||!1},superclusterOptions:{maxZoom:c.clusterMaxZoom!==void 0?c.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,c.clusterMinPoints||2),extent:n.EXTENT,radius:(c.clusterRadius||50)*w,log:!1,generateId:c.generateId||!1},clusterProperties:c.clusterProperties,filter:c.filter},c.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData(),this}updateData(t){return this._updateWorkerData(t),this}setClusterOptions(t){return this.workerOptions.cluster=t.cluster,t&&(t.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=t.clusterRadius),t.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=t.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(t,c){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},c),this}getClusterChildren(t,c){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},c),this}getClusterLeaves(t,c,d,g){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:c,offset:d},g),this}_updateWorkerData(t){const c=n.extend({},this.workerOptions);t?c.dataDiff=t:typeof this._data=="string"?(c.request=this.map._requestManager.transformRequest(n.browser.resolveURL(this._data),D.Source),c.request.collectResourceTiming=this._collectResourceTiming):c.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new n.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,c,(d,g)=>{if(this._pendingLoads--,this._removed||g&&g.abandoned)return void this.fire(new n.Event("dataabort",{dataType:"source"}));let w=null;if(g&&g.resourceTiming&&g.resourceTiming[this.id]&&(w=g.resourceTiming[this.id].slice(0)),d)return void this.fire(new n.ErrorEvent(d));const T={dataType:"source"};this._collectResourceTiming&&w&&w.length>0&&n.extend(T,{resourceTiming:w}),this.fire(new n.Event("data",Object.assign(Object.assign({},T),{sourceDataType:"metadata"}))),this.fire(new n.Event("data",Object.assign(Object.assign({},T),{sourceDataType:"content"})))})}loaded(){return this._pendingLoads===0}loadTile(t,c){const d=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const g={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(d,g,(w,T)=>(delete t.request,t.unloadVectorData(),t.aborted?c(null):w?c(w):(t.loadVectorData(T,this.map.painter,d==="reloadTile"),c(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})}hasTransition(){return!1}}var It=n.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Nt extends n.Evented{constructor(t,c,d,g){super(),this.load=(w,T)=>{this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=L.getImage(this.map._requestManager.transformRequest(this.url,D.Image),(A,R)=>{this._request=null,this._loaded=!0,A?this.fire(new n.ErrorEvent(A)):R&&(this.image=R,w&&(this.coordinates=w),T&&T(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const w=this.map.painter.context,T=w.gl;this.boundsBuffer||(this.boundsBuffer=w.createVertexBuffer(this._boundsArray,It.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Me(w,this.image,T.RGBA),this.texture.bind(T.LINEAR,T.CLAMP_TO_EDGE));let A=!1;for(const R in this.tiles){const O=this.tiles[R];O.state!=="loaded"&&(O.state="loaded",O.texture=this.texture,A=!0)}A&&this.fire(new n.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=t,this.dispatcher=d,this.coordinates=c.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(g),this.options=c}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 n.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 c=t.map(n.MercatorCoordinate.fromLngLat);this.tileID=function(g){let w=1/0,T=1/0,A=-1/0,R=-1/0;for(const Q of g)w=Math.min(w,Q.x),T=Math.min(T,Q.y),A=Math.max(A,Q.x),R=Math.max(R,Q.y);const O=Math.max(A-w,R-T),U=Math.max(0,Math.floor(-Math.log(O)/Math.LN2)),$=Math.pow(2,U);return new n.CanonicalTileID(U,Math.floor((w+A)/2*$),Math.floor((T+R)/2*$))}(c),this.minzoom=this.maxzoom=this.tileID.z;const d=c.map(g=>this.tileID.getTilePoint(g)._round());return this._boundsArray=new n.RasterBoundsArray,this._boundsArray.emplaceBack(d[0].x,d[0].y,0,0),this._boundsArray.emplaceBack(d[1].x,d[1].y,n.EXTENT,0),this._boundsArray.emplaceBack(d[3].x,d[3].y,0,n.EXTENT),this._boundsArray.emplaceBack(d[2].x,d[2].y,n.EXTENT,n.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(t,c){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},c(null)):(t.state="errored",c(null))}hasTransition(){return!1}}class fi extends Nt{constructor(t,c,d,g){super(t,c,d,g),this.load=()=>{this._loaded=!1;const w=this.options;this.urls=[];for(const T of w.urls)this.urls.push(this.map._requestManager.transformRequest(T,D.Source).url);n.getVideo(this.urls,(T,A)=>{this._loaded=!0,T?this.fire(new n.ErrorEvent(T)):A&&(this.video=A,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const w=this.map.painter.context,T=w.gl;this.boundsBuffer||(this.boundsBuffer=w.createVertexBuffer(this._boundsArray,It.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(T.LINEAR,T.CLAMP_TO_EDGE),T.texSubImage2D(T.TEXTURE_2D,0,0,0,T.RGBA,T.UNSIGNED_BYTE,this.video)):(this.texture=new Me(w,this.video,T.RGBA),this.texture.bind(T.LINEAR,T.CLAMP_TO_EDGE));let A=!1;for(const R in this.tiles){const O=this.tiles[R];O.state!=="loaded"&&(O.state="loaded",O.texture=this.texture,A=!0)}A&&this.fire(new n.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=c}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const c=this.video.seekable;tc.end(0)?this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${c.start(0)} and ${c.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)))}hasTransition(){return this.video&&!this.video.paused}}class gt extends Nt{constructor(t,c,d,g){super(t,c,d,g),this.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 n.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())},this.prepare=()=>{let w=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,w=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,w=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const T=this.map.painter.context,A=T.gl;this.boundsBuffer||(this.boundsBuffer=T.createVertexBuffer(this._boundsArray,It.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(w||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Me(T,this.canvas,A.RGBA,{premultiply:!0});let R=!1;for(const O in this.tiles){const U=this.tiles[O];U.state!=="loaded"&&(U.state="loaded",U.texture=this.texture,R=!0)}R&&this.fire(new n.Event("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),c.coordinates?Array.isArray(c.coordinates)&&c.coordinates.length===4&&!c.coordinates.some(w=>!Array.isArray(w)||w.length!==2||w.some(T=>typeof T!="number"))||this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),c.animate&&typeof c.animate!="boolean"&&this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),c.canvas?typeof c.canvas=="string"||c.canvas instanceof HTMLCanvasElement||this.fire(new n.ErrorEvent(new n.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 n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=c,this.animate=c.animate===void 0||c.animate}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}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 _i={},Z=y=>{switch(y){case"geojson":return vt;case"image":return Nt;case"raster":return Qe;case"raster-dem":return wt;case"vector":return ue;case"video":return fi;case"canvas":return gt}return _i[y]};function lt(y,t){const c=n.create();return n.translate(c,c,[1,1,0]),n.scale(c,c,[.5*y.width,.5*y.height,1]),n.multiply(c,c,y.calculatePosMatrix(t.toUnwrapped()))}function nt(y,t,c,d,g,w){const T=function($,Q,me){if($)for(const fe of $){const xe=Q[fe];if(xe&&xe.source===me&&xe.type==="fill-extrusion")return!0}else for(const fe in Q){const xe=Q[fe];if(xe.source===me&&xe.type==="fill-extrusion")return!0}return!1}(g&&g.layers,t,y.id),A=w.maxPitchScaleFactor(),R=y.tilesIn(d,A,T);R.sort(Ee);const O=[];for(const $ of R)O.push({wrappedTileID:$.tileID.wrapped().key,queryResults:$.tile.queryRenderedFeatures(t,c,y._state,$.queryGeometry,$.cameraQueryGeometry,$.scale,g,w,A,lt(y.transform,$.tileID))});const U=function($){const Q={},me={};for(const fe of $){const xe=fe.queryResults,he=fe.wrappedTileID,Ve=me[he]=me[he]||{};for(const tt in xe){const Ce=xe[tt],je=Ve[tt]=Ve[tt]||{},at=Q[tt]=Q[tt]||[];for(const ot of Ce)je[ot.featureIndex]||(je[ot.featureIndex]=!0,at.push(ot))}}return Q}(O);for(const $ in U)U[$].forEach(Q=>{const me=Q.feature,fe=y.getFeatureState(me.layer["source-layer"],me.id);me.source=me.layer.source,me.layer["source-layer"]&&(me.sourceLayer=me.layer["source-layer"]),me.state=fe});return U}function Ee(y,t){const c=y.tileID,d=t.tileID;return c.overscaledZ-d.overscaledZ||c.canonical.y-d.canonical.y||c.wrap-d.wrap||c.canonical.x-d.canonical.x}class _e{constructor(t,c){this.timeAdded=0,this.fadeEndTime=0,this.tileID=t,this.uid=n.uniqueId(),this.uses=0,this.tileSize=c,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 c=t+this.timeAdded;cw.getLayer(O)).filter(Boolean);if(R.length!==0){A.layers=R,A.stateDependentLayerIds&&(A.stateDependentLayers=A.stateDependentLayerIds.map(O=>R.filter(U=>U.id===O)[0]));for(const O of R)T[O.id]=A}}return T}(t.buckets,c.style),this.hasSymbolBuckets=!1;for(const g in this.buckets){const w=this.buckets[g];if(w instanceof n.SymbolBucket){if(this.hasSymbolBuckets=!0,!d)break;w.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const g in this.buckets){const w=this.buckets[g];if(w instanceof n.SymbolBucket&&w.hasRTLText){this.hasRTLText=!0,n.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const g in this.buckets){const w=this.buckets[g];this.queryPadding=Math.max(this.queryPadding,c.style.getLayer(g).queryRadius(w))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new n.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 d in this.buckets){const g=this.buckets[d];g.uploadPending()&&g.upload(t)}const c=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Me(t,this.imageAtlas.image,c.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Me(t,this.glyphAtlasImage,c.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,c,d,g,w,T,A,R,O,U){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:g,cameraQueryGeometry:w,scale:T,tileSize:this.tileSize,pixelPosMatrix:U,transform:R,params:A,queryPadding:this.queryPadding*O},t,c,d):{}}querySourceFeatures(t,c){const d=this.latestFeatureIndex;if(!d||!d.rawTileData)return;const g=d.loadVTLayers(),w=c&&c.sourceLayer?c.sourceLayer:"",T=g._geojsonTileLayer||g[w];if(!T)return;const A=n.createFilter(c&&c.filter),{z:R,x:O,y:U}=this.tileID.canonical,$={z:R,x:O,y:U};for(let Q=0;Qd)g=!1;else if(c)if(this.expirationTime{this.remove(t,w)},d)),this.data[g].push(w),this.order.push(g),this.order.length>this.max){const T=this._getAndRemoveByKey(this.order[0]);T&&this.onRemove(T)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const c=this.data[t].shift();return c.timeout&&clearTimeout(c.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),c.value}getByKey(t){const c=this.data[t];return c?c[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,c){if(!this.has(t))return this;const d=t.wrapped().key,g=c===void 0?0:this.data[d].indexOf(c),w=this.data[d][g];return this.data[d].splice(g,1),w.timeout&&clearTimeout(w.timeout),this.data[d].length===0&&delete this.data[d],this.onRemove(w.value),this.order.splice(this.order.indexOf(d),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const c=this._getAndRemoveByKey(this.order[0]);c&&this.onRemove(c)}return this}filter(t){const c=[];for(const d in this.data)for(const g of this.data[d])t(g.value)||c.push(g);for(const d of c)this.remove(d.value.tileID,d)}}class pt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,c,d){const g=String(c);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][g]=this.stateChanges[t][g]||{},n.extend(this.stateChanges[t][g],d),this.deletedStates[t]===null){this.deletedStates[t]={};for(const w in this.state[t])w!==g&&(this.deletedStates[t][w]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][g]===null){this.deletedStates[t][g]={};for(const w in this.state[t][g])d[w]||(this.deletedStates[t][g][w]=null)}else for(const w in d)this.deletedStates[t]&&this.deletedStates[t][g]&&this.deletedStates[t][g][w]===null&&delete this.deletedStates[t][g][w]}removeFeatureState(t,c,d){if(this.deletedStates[t]===null)return;const g=String(c);if(this.deletedStates[t]=this.deletedStates[t]||{},d&&c!==void 0)this.deletedStates[t][g]!==null&&(this.deletedStates[t][g]=this.deletedStates[t][g]||{},this.deletedStates[t][g][d]=null);else if(c!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][g])for(d in this.deletedStates[t][g]={},this.stateChanges[t][g])this.deletedStates[t][g][d]=null;else this.deletedStates[t][g]=null;else this.deletedStates[t]=null}getState(t,c){const d=String(c),g=n.extend({},(this.state[t]||{})[d],(this.stateChanges[t]||{})[d]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const w=this.deletedStates[t][c];if(w===null)return{};for(const T in w)delete g[T]}return g}initializeTileState(t,c){t.setFeatureState(this.state,c)}coalesceChanges(t,c){const d={};for(const g in this.stateChanges){this.state[g]=this.state[g]||{};const w={};for(const T in this.stateChanges[g])this.state[g][T]||(this.state[g][T]={}),n.extend(this.state[g][T],this.stateChanges[g][T]),w[T]=this.state[g][T];d[g]=w}for(const g in this.deletedStates){this.state[g]=this.state[g]||{};const w={};if(this.deletedStates[g]===null)for(const T in this.state[g])w[T]={},this.state[g][T]={};else for(const T in this.deletedStates[g]){if(this.deletedStates[g][T]===null)this.state[g][T]={};else for(const A of Object.keys(this.deletedStates[g][T]))delete this.state[g][T][A];w[T]=this.state[g][T]}d[g]=d[g]||{},n.extend(d[g],w)}if(this.stateChanges={},this.deletedStates={},Object.keys(d).length!==0)for(const g in t)t[g].setFeatureState(d,c)}}class Ae extends n.Evented{constructor(t,c,d){super(),this.id=t,this.dispatcher=d,this.on("data",g=>{g.dataType==="source"&&g.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&g.dataType==="source"&&g.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=((g,w,T,A)=>{const R=new(Z(w.type))(g,w,T,A);if(R.id!==g)throw new Error(`Expected Source id to be ${g} instead of ${R.id}`);return R})(t,c,d,this),this._tiles={},this._cache=new Ze(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new pt,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 c=this._tiles[t];if(c.state!=="loaded"&&c.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,c){return this._source.loadTile(t,c)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new n.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 c in this._tiles){const d=this._tiles[c];d.upload(t),d.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Ye).map(t=>t.key)}getRenderableIds(t){const c=[];for(const d in this._tiles)this._isIdRenderable(d,t)&&c.push(this._tiles[d]);return t?c.sort((d,g)=>{const w=d.tileID,T=g.tileID,A=new n.Point(w.canonical.x,w.canonical.y)._rotate(this.transform.angle),R=new n.Point(T.canonical.x,T.canonical.y)._rotate(this.transform.angle);return w.overscaledZ-T.overscaledZ||R.y-A.y||R.x-A.x}).map(d=>d.tileID.key):c.map(d=>d.tileID).sort(Ye).map(d=>d.key)}hasRenderableParent(t){const c=this.findLoadedParent(t,0);return!!c&&this._isIdRenderable(c.tileID.key)}_isIdRenderable(t,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(c||!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,c){const d=this._tiles[t];d&&(d.state!=="loading"&&(d.state=c),this._loadTile(d,this._tileLoaded.bind(this,d,t,c)))}_tileLoaded(t,c,d,g){if(g)return t.state="errored",void(g.status!==404?this._source.fire(new n.ErrorEvent(g,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=n.browser.now(),d==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(c,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 n.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const c=this.getRenderableIds();for(let g=0;g1||(Math.abs(T)>1&&(Math.abs(T+R)===1?T+=R:Math.abs(T-R)===1&&(T-=R)),w.dem&&g.dem&&(g.dem.backfillBorder(w.dem,T,A),g.neighboringTiles&&g.neighboringTiles[O]&&(g.neighboringTiles[O].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,c,d,g){for(const w in this._tiles){let T=this._tiles[w];if(g[w]||!T.hasData()||T.tileID.overscaledZ<=c||T.tileID.overscaledZ>d)continue;let A=T.tileID;for(;T&&T.tileID.overscaledZ>c+1;){const O=T.tileID.scaledTo(T.tileID.overscaledZ-1);T=this._tiles[O.key],T&&T.hasData()&&(A=O)}let R=A;for(;R.overscaledZ>c;)if(R=R.scaledTo(R.overscaledZ-1),t[R.key]){g[A.key]=A;break}}}findLoadedParent(t,c){if(t.key in this._loadedParentTiles){const d=this._loadedParentTiles[t.key];return d&&d.tileID.overscaledZ>=c?d:null}for(let d=t.overscaledZ-1;d>=c;d--){const g=t.scaledTo(d),w=this._getLoadedTile(g);if(w)return w}}_getLoadedTile(t){const c=this._tiles[t.key];return c&&c.hasData()?c:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const c=Math.ceil(t.width/this._source.tileSize)+1,d=Math.ceil(t.height/this._source.tileSize)+1,g=Math.floor(c*d*(this._maxTileCacheZoomLevels===null?n.config.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),w=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,g):g;this._cache.setMaxSize(w)}handleWrapJump(t){const c=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,c){const d={};for(const g in this._tiles){const w=this._tiles[g];w.tileID=w.tileID.unwrapTo(w.tileID.wrap+c),d[w.tileID.key]=w}this._tiles=d;for(const g in this._timers)clearTimeout(this._timers[g]),delete this._timers[g];for(const g in this._tiles)this._setTileReloadTimer(g,this._tiles[g])}}update(t,c){if(this.transform=t,this.terrain=c,!this._sourceLoaded||this._paused)return;let d;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?d=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(U=>new n.OverscaledTileID(U.canonical.z,U.wrap,U.canonical.z,U.canonical.x,U.canonical.y)):(d=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:c}),this._source.hasTile&&(d=d.filter(U=>this._source.hasTile(U)))):d=[];const g=t.coveringZoomLevel(this._source),w=Math.max(g-Ae.maxOverzooming,this._source.minzoom),T=Math.max(g+Ae.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const U={};for(const $ of d)if($.canonical.z>this._source.minzoom){const Q=$.scaledTo($.canonical.z-1);U[Q.key]=Q;const me=$.scaledTo(Math.max(this._source.minzoom,Math.min($.canonical.z,5)));U[me.key]=me}d=d.concat(Object.values(U))}const A=d.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,A&&this.fire(new n.Event("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const R=this._updateRetainedTiles(d,g);if(xt(this._source.type)){const U={},$={},Q=Object.keys(R),me=n.browser.now();for(const fe of Q){const xe=R[fe],he=this._tiles[fe];if(!he||he.fadeEndTime!==0&&he.fadeEndTime<=me)continue;const Ve=this.findLoadedParent(xe,w);Ve&&(this._addTile(Ve.tileID),U[Ve.tileID.key]=Ve.tileID),$[fe]=xe}this._retainLoadedChildren($,g,T,R);for(const fe in U)R[fe]||(this._coveredTiles[fe]=!0,R[fe]=U[fe]);if(c){const fe={},xe={};for(const he of d)this._tiles[he.key].hasData()?fe[he.key]=he:xe[he.key]=he;for(const he in xe){const Ve=xe[he].children(this._source.maxzoom);this._tiles[Ve[0].key]&&this._tiles[Ve[1].key]&&this._tiles[Ve[2].key]&&this._tiles[Ve[3].key]&&(fe[Ve[0].key]=R[Ve[0].key]=Ve[0],fe[Ve[1].key]=R[Ve[1].key]=Ve[1],fe[Ve[2].key]=R[Ve[2].key]=Ve[2],fe[Ve[3].key]=R[Ve[3].key]=Ve[3],delete xe[he])}for(const he in xe){const Ve=this.findLoadedParent(xe[he],this._source.minzoom);if(Ve){fe[Ve.tileID.key]=R[Ve.tileID.key]=Ve.tileID;for(const tt in fe)fe[tt].isChildOf(Ve.tileID)&&delete fe[tt]}}for(const he in this._tiles)fe[he]||(this._coveredTiles[he]=!0)}}for(const U in R)this._tiles[U].clearFadeHold();const O=n.keysDifference(this._tiles,R);for(const U of O){const $=this._tiles[U];$.hasSymbolBuckets&&!$.holdingForFade()?$.setHoldDuration(this.map._fadeDuration):$.hasSymbolBuckets&&!$.symbolFadeFinished()||this._removeTile(U)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,c){const d={},g={},w=Math.max(c-Ae.maxOverzooming,this._source.minzoom),T=Math.max(c+Ae.maxUnderzooming,this._source.minzoom),A={};for(const R of t){const O=this._addTile(R);d[R.key]=R,O.hasData()||cthis._source.maxzoom){const $=R.children(this._source.maxzoom)[0],Q=this.getTile($);if(Q&&Q.hasData()){d[$.key]=$;continue}}else{const $=R.children(this._source.maxzoom);if(d[$[0].key]&&d[$[1].key]&&d[$[2].key]&&d[$[3].key])continue}let U=O.wasRequested();for(let $=R.overscaledZ-1;$>=w;--$){const Q=R.scaledTo($);if(g[Q.key])break;if(g[Q.key]=!0,O=this.getTile(Q),!O&&U&&(O=this._addTile(Q)),O){const me=O.hasData();if((U||me)&&(d[Q.key]=Q),U=O.wasRequested(),me)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const c=[];let d,g=this._tiles[t].tileID;for(;g.overscaledZ>0;){if(g.key in this._loadedParentTiles){d=this._loadedParentTiles[g.key];break}c.push(g.key);const w=g.scaledTo(g.overscaledZ-1);if(d=this._getLoadedTile(w),d)break;g=w}for(const w of c)this._loadedParentTiles[w]=d}}_addTile(t){let c=this._tiles[t.key];if(c)return c;c=this._cache.getAndRemove(t),c&&(this._setTileReloadTimer(t.key,c),c.tileID=t,this._state.initializeTileState(c,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,c)));const d=c;return c||(c=new _e(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(c,this._tileLoaded.bind(this,c,t.key,c.state))),c.uses++,this._tiles[t.key]=c,d||this._source.fire(new n.Event("dataloading",{tile:c,coord:c.tileID,dataType:"source"})),c}_setTileReloadTimer(t,c){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const d=c.getExpiryTimeout();d&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},d))}_removeTile(t){const c=this._tiles[t];c&&(c.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),c.uses>0||(c.hasData()&&c.state!=="reloading"?this._cache.add(c.tileID,c,c.getExpiryTimeout()):(c.aborted=!0,this._abortTile(c),this._unloadTile(c))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,c,d){const g=[],w=this.transform;if(!w)return g;const T=d?w.getCameraQueryGeometry(t):t,A=t.map(fe=>w.pointCoordinate(fe,this.terrain)),R=T.map(fe=>w.pointCoordinate(fe,this.terrain)),O=this.getIds();let U=1/0,$=1/0,Q=-1/0,me=-1/0;for(const fe of R)U=Math.min(U,fe.x),$=Math.min($,fe.y),Q=Math.max(Q,fe.x),me=Math.max(me,fe.y);for(let fe=0;fe=0&&Ce[1].y+tt>=0){const je=A.map(ot=>he.getTilePoint(ot)),at=R.map(ot=>he.getTilePoint(ot));g.push({tile:xe,tileID:he,queryGeometry:je,cameraQueryGeometry:at,scale:Ve})}}return g}getVisibleCoordinates(t){const c=this.getRenderableIds(t).map(d=>this._tiles[d].tileID);for(const d of c)d.posMatrix=this.transform.calculatePosMatrix(d.toUnwrapped());return c}hasTransition(){if(this._source.hasTransition())return!0;if(xt(this._source.type)){const t=n.browser.now();for(const c in this._tiles)if(this._tiles[c].fadeEndTime>=t)return!0}return!1}setFeatureState(t,c,d){this._state.updateState(t=t||"_geojsonTileLayer",c,d)}removeFeatureState(t,c,d){this._state.removeFeatureState(t=t||"_geojsonTileLayer",c,d)}getFeatureState(t,c){return this._state.getState(t=t||"_geojsonTileLayer",c)}setDependencies(t,c,d){const g=this._tiles[t];g&&g.setDependencies(c,d)}reloadTilesForDependencies(t,c){for(const d in this._tiles)this._tiles[d].hasDependency(t,c)&&this._reloadTile(d,"reloading");this._cache.filter(d=>!d.hasDependency(t,c))}}function Ye(y,t){const c=Math.abs(2*y.wrap)-+(y.wrap<0),d=Math.abs(2*t.wrap)-+(t.wrap<0);return y.overscaledZ-t.overscaledZ||d-c||t.canonical.y-y.canonical.y||t.canonical.x-y.canonical.x}function xt(y){return y==="raster"||y==="image"||y==="video"}Ae.maxOverzooming=10,Ae.maxUnderzooming=3;const kt="mapboxgl_preloaded_worker_pool";class ct{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{c.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[kt]}numActive(){return Object.keys(this.active).length}}const Xt=Math.floor(n.browser.hardwareConcurrency/2);let Ii;function Ti(){return Ii||(Ii=new ct),Ii}ct.workerCount=n.isSafari(globalThis)?Math.max(Math.min(Xt,3),1):1;class Wi{constructor(t,c){this.reset(t,c)}reset(t,c){this.points=t||[],this._distances=[0];for(let d=1;d0?(g-T)/A:0;return this.points[w].mult(1-R).add(this.points[c].mult(R))}}function ar(y,t){let c=!0;return y==="always"||y!=="never"&&t!=="never"||(c=!1),c}class pr{constructor(t,c,d){const g=this.boxCells=[],w=this.circleCells=[];this.xCellCount=Math.ceil(t/d),this.yCellCount=Math.ceil(c/d);for(let T=0;Tthis.width||g<0||c>this.height)return[];const R=[];if(t<=0&&c<=0&&this.width<=d&&this.height<=g){if(w)return[{key:null,x1:t,y1:c,x2:d,y2:g}];for(let O=0;O0}hitTestCircle(t,c,d,g,w){const T=t-d,A=t+d,R=c-d,O=c+d;if(A<0||T>this.width||O<0||R>this.height)return!1;const U=[];return this._forEachCell(T,R,A,O,this._queryCellCircle,U,{hitTest:!0,overlapMode:g,circle:{x:t,y:c,radius:d},seenUids:{box:{},circle:{}}},w),U.length>0}_queryCell(t,c,d,g,w,T,A,R){const{seenUids:O,hitTest:U,overlapMode:$}=A,Q=this.boxCells[w];if(Q!==null){const fe=this.bboxes;for(const xe of Q)if(!O.box[xe]){O.box[xe]=!0;const he=4*xe,Ve=this.boxKeys[xe];if(t<=fe[he+2]&&c<=fe[he+3]&&d>=fe[he+0]&&g>=fe[he+1]&&(!R||R(Ve))&&(!U||!ar($,Ve.overlapMode))&&(T.push({key:Ve,x1:fe[he],y1:fe[he+1],x2:fe[he+2],y2:fe[he+3]}),U))return!0}}const me=this.circleCells[w];if(me!==null){const fe=this.circles;for(const xe of me)if(!O.circle[xe]){O.circle[xe]=!0;const he=3*xe,Ve=this.circleKeys[xe];if(this._circleAndRectCollide(fe[he],fe[he+1],fe[he+2],t,c,d,g)&&(!R||R(Ve))&&(!U||!ar($,Ve.overlapMode))){const tt=fe[he],Ce=fe[he+1],je=fe[he+2];if(T.push({key:Ve,x1:tt-je,y1:Ce-je,x2:tt+je,y2:Ce+je}),U)return!0}}}return!1}_queryCellCircle(t,c,d,g,w,T,A,R){const{circle:O,seenUids:U,overlapMode:$}=A,Q=this.boxCells[w];if(Q!==null){const fe=this.bboxes;for(const xe of Q)if(!U.box[xe]){U.box[xe]=!0;const he=4*xe,Ve=this.boxKeys[xe];if(this._circleAndRectCollide(O.x,O.y,O.radius,fe[he+0],fe[he+1],fe[he+2],fe[he+3])&&(!R||R(Ve))&&!ar($,Ve.overlapMode))return T.push(!0),!0}}const me=this.circleCells[w];if(me!==null){const fe=this.circles;for(const xe of me)if(!U.circle[xe]){U.circle[xe]=!0;const he=3*xe,Ve=this.circleKeys[xe];if(this._circlesCollide(fe[he],fe[he+1],fe[he+2],O.x,O.y,O.radius)&&(!R||R(Ve))&&!ar($,Ve.overlapMode))return T.push(!0),!0}}}_forEachCell(t,c,d,g,w,T,A,R){const O=this._convertToXCellCoord(t),U=this._convertToYCellCoord(c),$=this._convertToXCellCoord(d),Q=this._convertToYCellCoord(g);for(let me=O;me<=$;me++)for(let fe=U;fe<=Q;fe++)if(w.call(this,t,c,d,g,this.xCellCount*fe+me,T,A,R))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,c,d,g,w,T){const A=g-t,R=w-c,O=d+T;return O*O>A*A+R*R}_circleAndRectCollide(t,c,d,g,w,T,A){const R=(T-g)/2,O=Math.abs(t-(g+R));if(O>R+d)return!1;const U=(A-w)/2,$=Math.abs(c-(w+U));if($>U+d)return!1;if(O<=R||$<=U)return!0;const Q=O-R,me=$-U;return Q*Q+me*me<=d*d}}function Gr(y,t,c,d,g){const w=n.create();return t?(n.scale(w,w,[1/g,1/g,1]),c||n.rotateZ(w,w,d.angle)):n.multiply(w,d.labelPlaneMatrix,y),w}function _t(y,t,c,d,g){if(t){const w=n.clone(y);return n.scale(w,w,[g,g,1]),c||n.rotateZ(w,w,-d.angle),w}return d.glCoordMatrix}function Ji(y,t,c){let d;c?(d=[y.x,y.y,c(y.x,y.y),1],n.transformMat4(d,d,t)):(d=[y.x,y.y,0,1],oe(d,d,t));const g=d[3];return{point:new n.Point(d[0]/g,d[1]/g),signedDistanceFromCamera:g}}function xr(y,t){return .5+y/t*.5}function Er(y,t){const c=y[0]/y[3],d=y[1]/y[3];return c>=-t[0]&&c<=t[0]&&d>=-t[1]&&d<=t[1]}function or(y,t,c,d,g,w,T,A,R,O){const U=d?y.textSizeData:y.iconSizeData,$=n.evaluateSizeForZoom(U,c.transform.zoom),Q=[256/c.width*2+1,256/c.height*2+1],me=d?y.text.dynamicLayoutVertexArray:y.icon.dynamicLayoutVertexArray;me.clear();const fe=y.lineVertexArray,xe=d?y.text.placedSymbolArray:y.icon.placedSymbolArray,he=c.transform.width/c.transform.height;let Ve=!1;for(let tt=0;ttMath.abs(c.x-t.x)*d?{useVertical:!0}:(y===n.WritingMode.vertical?t.yc.x)?{needsFlipping:!0}:null}function wi(y,t,c,d,g,w,T,A,R,O,U,$,Q,me,fe,xe){const he=t/24,Ve=y.lineOffsetX*he,tt=y.lineOffsetY*he;let Ce;if(y.numGlyphs>1){const je=y.glyphStartIndex+y.numGlyphs,at=y.lineStartIndex,ot=y.lineStartIndex+y.lineLength,ft=zt(he,A,Ve,tt,c,U,$,y,R,w,Q,fe,xe);if(!ft)return{notEnoughRoom:!0};const Et=Ji(ft.first.point,T,xe).point,yt=Ji(ft.last.point,T,xe).point;if(d&&!c){const At=bi(y.writingMode,Et,yt,me);if(At)return At}Ce=[ft.first];for(let At=y.glyphStartIndex+1;At0?Et.point:Sr($,ft,at,1,g,xe),At=bi(y.writingMode,at,yt,me);if(At)return At}const je=be(he*A.getoffsetX(y.glyphStartIndex),Ve,tt,c,U,$,y.segment,y.lineStartIndex,y.lineStartIndex+y.lineLength,R,w,Q,fe,xe);if(!je)return{notEnoughRoom:!0};Ce=[je]}for(const je of Ce)n.addDynamicAttributes(O,je.point,je.angle);return{}}function Sr(y,t,c,d,g,w){const T=Ji(y.add(y.sub(t)._unit()),g,w).point,A=c.sub(T);return c.add(A._mult(d/A.mag()))}function $r(y,t){const{projectionCache:c,lineVertexArray:d,labelPlaneMatrix:g,tileAnchorPoint:w,distanceFromAnchor:T,getElevation:A,previousVertex:R,direction:O,absOffsetX:U}=t;if(c.projections[y])return c.projections[y];const $=new n.Point(d.getx(y),d.gety(y)),Q=Ji($,g,A);if(Q.signedDistanceFromCamera>0)return c.projections[y]=Q.point,Q.point;const me=y-O;return Sr(T===0?w:new n.Point(d.getx(me),d.gety(me)),$,R,U-T+1,g,A)}function pi(y,t,c){return y._unit()._perp()._mult(t*c)}function cn(y,t,c,d,g,w,T,A){const{projectionCache:R,direction:O}=A;if(R.offsets[y])return R.offsets[y];const U=c.add(t);if(y+O=g)return R.offsets[y]=U,U;const $=$r(y+O,A),Q=pi($.sub(c),T,O),me=c.add(Q),fe=$.add(Q);return R.offsets[y]=n.findLineIntersection(w,U,me,fe)||U,R.offsets[y]}function be(y,t,c,d,g,w,T,A,R,O,U,$,Q,me){const fe=d?y-t:y+t;let xe=fe>0?1:-1,he=0;d&&(xe*=-1,he=Math.PI),xe<0&&(he+=Math.PI);let Ve,tt,Ce=xe>0?A+T:A+T+1,je=g,at=g,ot=0,ft=0;const Et=Math.abs(fe),yt=[];let At;for(;ot+ft<=Et;){if(Ce+=xe,Ce=R)return null;ot+=ft,at=je,tt=Ve;const Lt={projectionCache:$,lineVertexArray:O,labelPlaneMatrix:U,tileAnchorPoint:w,distanceFromAnchor:ot,getElevation:me,previousVertex:at,direction:xe,absOffsetX:Et};if(je=$r(Ce,Lt),c===0)yt.push(at),At=je.sub(at);else{let ui;const Kt=je.sub(at);ui=Kt.mag()===0?pi($r(Ce+xe,Lt).sub(je),c,xe):pi(Kt,c,xe),tt||(tt=at.add(ui)),Ve=cn(Ce,ui,je,A,R,tt,c,Lt),yt.push(tt),At=Ve.sub(tt)}ft=At.mag()}const Wt=At._mult((Et-ot)/ft)._add(tt||at),Di=he+Math.atan2(je.y-at.y,je.x-at.x);return yt.push(Wt),{point:Wt,angle:Q?Di:0,path:yt}}const G=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function K(y,t){for(let c=0;c=1;ki--)Kt.push(Lt.path[ki]);for(let ki=1;kiJi(Li,R,fe));Kt=ki.some(Li=>Li.signedDistanceFromCamera<=0)?[]:ki.map(Li=>Li.point)}let Ei=[];if(Kt.length>0){const ki=Kt[0].clone(),Li=Kt[0].clone();for(let _r=1;_r=At.x&&Li.x<=Wt.x&&ki.y>=At.y&&Li.y<=Wt.y?[Kt]:Li.xWt.x||Li.yWt.y?[]:n.clipLine([Kt],At.x,At.y,Wt.x,Wt.y)}for(const ki of Ei){Di.reset(ki,.25*yt);let Li=0;Li=Di.length<=.5*yt?1:Math.ceil(Di.paddedLength/rr)+1;for(let _r=0;_r=this.screenRightBoundary||gthis.screenBottomBoundary}isInsideGrid(t,c,d,g){return d>=0&&t=0&&cd.collisionGroupID===c}}return this.collisionGroups[t]}}function Ue(y,t,c,d,g){const{horizontalAlign:w,verticalAlign:T}=n.getAnchorAlignment(y);return new n.Point(-(w-.5)*t+d[0]*g,-(T-.5)*c+d[1]*g)}function bt(y,t,c,d,g,w){const{x1:T,x2:A,y1:R,y2:O,anchorPointX:U,anchorPointY:$}=y,Q=new n.Point(t,c);return d&&Q._rotate(g?w:-w),{x1:T+Q.x,y1:R+Q.y,x2:A+Q.x,y2:O+Q.y,anchorPointX:U,anchorPointY:$}}class mt{constructor(t,c,d,g,w){this.transform=t.clone(),this.terrain=c,this.collisionIndex=new Ie(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new ke(g),this.collisionCircleArrays={},this.prevPlacement=w,w&&(w.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,c,d,g){const w=d.getBucket(c),T=d.latestFeatureIndex;if(!w||!T||c.id!==w.layerIds[0])return;const A=d.collisionBoxArray,R=w.layers[0].layout,O=Math.pow(2,this.transform.zoom-d.tileID.overscaledZ),U=d.tileSize/n.EXTENT,$=this.transform.calculatePosMatrix(d.tileID.toUnwrapped()),Q=R.get("text-pitch-alignment")==="map",me=R.get("text-rotation-alignment")==="map",fe=$e(d,1,this.transform.zoom),xe=Gr($,Q,me,this.transform,fe);let he=null;if(Q){const tt=_t($,Q,me,this.transform,fe);he=n.multiply([],this.transform.labelPlaneMatrix,tt)}this.retainedQueryData[w.bucketInstanceId]=new ae(w.bucketInstanceId,T,w.sourceLayerIndex,w.index,d.tileID);const Ve={bucket:w,layout:R,posMatrix:$,textLabelPlaneMatrix:xe,labelToScreenMatrix:he,scale:O,textPixelRatio:U,holdingForFade:d.holdingForFade(),collisionBoxArray:A,partiallyEvaluatedTextSize:n.evaluateSizeForZoom(w.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(w.sourceID)};if(g)for(const tt of w.sortKeyRanges){const{sortKey:Ce,symbolInstanceStart:je,symbolInstanceEnd:at}=tt;t.push({sortKey:Ce,symbolInstanceStart:je,symbolInstanceEnd:at,parameters:Ve})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:w.symbolInstances.length,parameters:Ve})}attemptAnchorPlacement(t,c,d,g,w,T,A,R,O,U,$,Q,me,fe,xe,he){const Ve=n.TextAnchorEnum[t.textAnchor],tt=[t.textOffset0,t.textOffset1],Ce=Ue(Ve,d,g,tt,w),je=this.collisionIndex.placeCollisionBox(bt(c,Ce.x,Ce.y,T,A,this.transform.angle),$,R,O,U.predicate,he);if((!xe||this.collisionIndex.placeCollisionBox(bt(xe,Ce.x,Ce.y,T,A,this.transform.angle),$,R,O,U.predicate,he).box.length!==0)&&je.box.length>0){let at;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID]&&this.prevPlacement.placements[Q.crossTileID].text&&(at=this.prevPlacement.variableOffsets[Q.crossTileID].anchor),Q.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Q.crossTileID]={textOffset:tt,width:d,height:g,anchor:Ve,textBoxScale:w,prevAnchor:at},this.markUsedJustification(me,Ve,Q,fe),me.allowVerticalPlacement&&(this.markUsedOrientation(me,fe,Q),this.placedOrientations[Q.crossTileID]=fe),{shift:Ce,placedGlyphBoxes:je}}}placeLayerBucketPart(t,c,d){const{bucket:g,layout:w,posMatrix:T,textLabelPlaneMatrix:A,labelToScreenMatrix:R,textPixelRatio:O,holdingForFade:U,collisionBoxArray:$,partiallyEvaluatedTextSize:Q,collisionGroup:me}=t.parameters,fe=w.get("text-optional"),xe=w.get("icon-optional"),he=n.getOverlapMode(w,"text-overlap","text-allow-overlap"),Ve=he==="always",tt=n.getOverlapMode(w,"icon-overlap","icon-allow-overlap"),Ce=tt==="always",je=w.get("text-rotation-alignment")==="map",at=w.get("text-pitch-alignment")==="map",ot=w.get("icon-text-fit")!=="none",ft=w.get("symbol-z-order")==="viewport-y",Et=Ve&&(Ce||!g.hasIconData()||xe),yt=Ce&&(Ve||!g.hasTextData()||fe);!g.collisionArrays&&$&&g.deserializeCollisionBoxes($);const At=this.retainedQueryData[g.bucketInstanceId].tileID,Wt=this.terrain?(Lt,ui)=>this.terrain.getElevation(At,Lt,ui):null,Di=(Lt,ui)=>{var Kt,rr;if(c[Lt.crossTileID])return;if(U)return void(this.placements[Lt.crossTileID]=new H(!1,!1,!1));let Ei=!1,ki=!1,Li=!0,_r=null,Xi={box:null,offscreen:null},Bn={box:null,offscreen:null},fr=null,cr=null,kn=null,Jn=0,nr=0,Ss=0;ui.textFeatureIndex?Jn=ui.textFeatureIndex:Lt.useRuntimeCollisionCircles&&(Jn=Lt.featureIndex),ui.verticalTextFeatureIndex&&(nr=ui.verticalTextFeatureIndex);const ks=ui.textBox;if(ks){const tn=yr=>{let vr=n.WritingMode.horizontal;if(g.allowVerticalPlacement&&!yr&&this.prevPlacement){const Tn=this.prevPlacement.placedOrientations[Lt.crossTileID];Tn&&(this.placedOrientations[Lt.crossTileID]=Tn,vr=Tn,this.markUsedOrientation(g,vr,Lt))}return vr},qr=(yr,vr)=>{if(g.allowVerticalPlacement&&Lt.numVerticalGlyphVertices>0&&ui.verticalTextBox){for(const Tn of g.writingModes)if(Tn===n.WritingMode.vertical?(Xi=vr(),Bn=Xi):Xi=yr(),Xi&&Xi.box&&Xi.box.length)break}else Xi=yr()},Wr=Lt.textAnchorOffsetStartIndex,Fa=Lt.textAnchorOffsetEndIndex;if(Fa===Wr){const yr=(vr,Tn)=>{const br=this.collisionIndex.placeCollisionBox(vr,he,O,T,me.predicate,Wt);return br&&br.box&&br.box.length&&(this.markUsedOrientation(g,Tn,Lt),this.placedOrientations[Lt.crossTileID]=Tn),br};qr(()=>yr(ks,n.WritingMode.horizontal),()=>{const vr=ui.verticalTextBox;return g.allowVerticalPlacement&&Lt.numVerticalGlyphVertices>0&&vr?yr(vr,n.WritingMode.vertical):{box:null,offscreen:null}}),tn(Xi&&Xi.box&&Xi.box.length)}else{let yr=n.TextAnchorEnum[(rr=(Kt=this.prevPlacement)===null||Kt===void 0?void 0:Kt.variableOffsets[Lt.crossTileID])===null||rr===void 0?void 0:rr.anchor];const vr=(br,Po,Ns)=>{const zo=br.x2-br.x1,cu=br.y2-br.y1,uu=Lt.textBoxScale,Ih=ot&&tt==="never"?Po:null;let Ts={box:[],offscreen:!1},aa=he==="never"?1:2,Us="never";yr&&aa++;for(let Yn=0;Ynvr(ks,ui.iconBox,n.WritingMode.horizontal),()=>{const br=ui.verticalTextBox;return g.allowVerticalPlacement&&!(Xi&&Xi.box&&Xi.box.length)&&Lt.numVerticalGlyphVertices>0&&br?vr(br,ui.verticalIconBox,n.WritingMode.vertical):{box:null,offscreen:null}}),Xi&&(Ei=Xi.box,Li=Xi.offscreen);const Tn=tn(Xi&&Xi.box);if(!Ei&&this.prevPlacement){const br=this.prevPlacement.variableOffsets[Lt.crossTileID];br&&(this.variableOffsets[Lt.crossTileID]=br,this.markUsedJustification(g,br.anchor,Lt,Tn))}}}if(fr=Xi,Ei=fr&&fr.box&&fr.box.length>0,Li=fr&&fr.offscreen,Lt.useRuntimeCollisionCircles){const tn=g.text.placedSymbolArray.get(Lt.centerJustifiedTextSymbolIndex),qr=n.evaluateSizeForFeature(g.textSizeData,Q,tn),Wr=w.get("text-padding");cr=this.collisionIndex.placeCollisionCircles(he,tn,g.lineVertexArray,g.glyphOffsetArray,qr,T,A,R,d,at,me.predicate,Lt.collisionCircleDiameter,Wr,Wt),cr.circles.length&&cr.collisionDetected&&!d&&n.warnOnce("Collisions detected, but collision boxes are not shown"),Ei=Ve||cr.circles.length>0&&!cr.collisionDetected,Li=Li&&cr.offscreen}if(ui.iconFeatureIndex&&(Ss=ui.iconFeatureIndex),ui.iconBox){const tn=qr=>{const Wr=ot&&_r?bt(qr,_r.x,_r.y,je,at,this.transform.angle):qr;return this.collisionIndex.placeCollisionBox(Wr,tt,O,T,me.predicate,Wt)};Bn&&Bn.box&&Bn.box.length&&ui.verticalIconBox?(kn=tn(ui.verticalIconBox),ki=kn.box.length>0):(kn=tn(ui.iconBox),ki=kn.box.length>0),Li=Li&&kn.offscreen}const ls=fe||Lt.numHorizontalGlyphVertices===0&&Lt.numVerticalGlyphVertices===0,Fs=xe||Lt.numIconVertices===0;if(ls||Fs?Fs?ls||(ki=ki&&Ei):Ei=ki&&Ei:ki=Ei=ki&&Ei,Ei&&fr&&fr.box&&this.collisionIndex.insertCollisionBox(fr.box,he,w.get("text-ignore-placement"),g.bucketInstanceId,Bn&&Bn.box&&nr?nr:Jn,me.ID),ki&&kn&&this.collisionIndex.insertCollisionBox(kn.box,tt,w.get("icon-ignore-placement"),g.bucketInstanceId,Ss,me.ID),cr&&(Ei&&this.collisionIndex.insertCollisionCircles(cr.circles,he,w.get("text-ignore-placement"),g.bucketInstanceId,Jn,me.ID),d)){const tn=g.bucketInstanceId;let qr=this.collisionCircleArrays[tn];qr===void 0&&(qr=this.collisionCircleArrays[tn]=new J);for(let Wr=0;Wr=0;--ui){const Kt=Lt[ui];Di(g.symbolInstances.get(Kt),g.collisionArrays[Kt])}}else for(let Lt=t.symbolInstanceStart;Lt=0&&(t.text.placedSymbolArray.get(A).crossTileID=w>=0&&A!==w?0:d.crossTileID)}markUsedOrientation(t,c,d){const g=c===n.WritingMode.horizontal||c===n.WritingMode.horizontalOnly?c:0,w=c===n.WritingMode.vertical?c:0,T=[d.leftJustifiedTextSymbolIndex,d.centerJustifiedTextSymbolIndex,d.rightJustifiedTextSymbolIndex];for(const A of T)t.text.placedSymbolArray.get(A).placedOrientation=g;d.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(d.verticalPlacedTextSymbolIndex).placedOrientation=w)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const c=this.prevPlacement;let d=!1;this.prevZoomAdjustment=c?c.zoomAdjustment(this.transform.zoom):0;const g=c?c.symbolFadeChange(t):1,w=c?c.opacities:{},T=c?c.variableOffsets:{},A=c?c.placedOrientations:{};for(const R in this.placements){const O=this.placements[R],U=w[R];U?(this.opacities[R]=new ze(U,g,O.text,O.icon),d=d||O.text!==U.text.placed||O.icon!==U.icon.placed):(this.opacities[R]=new ze(null,g,O.text,O.icon,O.skipFade),d=d||O.text||O.icon)}for(const R in w){const O=w[R];if(!this.opacities[R]){const U=new ze(O,g,!1,!1);U.isHidden()||(this.opacities[R]=U,d=d||O.text.placed||O.icon.placed)}}for(const R in T)this.variableOffsets[R]||!this.opacities[R]||this.opacities[R].isHidden()||(this.variableOffsets[R]=T[R]);for(const R in A)this.placedOrientations[R]||!this.opacities[R]||this.opacities[R].isHidden()||(this.placedOrientations[R]=A[R]);if(c&&c.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");d?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=c?c.lastPlacementChangeTime:t)}updateLayerOpacities(t,c){const d={};for(const g of c){const w=g.getBucket(t);w&&g.latestFeatureIndex&&t.id===w.layerIds[0]&&this.updateBucketOpacities(w,d,g.collisionBoxArray)}}updateBucketOpacities(t,c,d){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 g=t.layers[0],w=g.layout,T=new ze(null,0,!1,!1,!0),A=w.get("text-allow-overlap"),R=w.get("icon-allow-overlap"),O=g._unevaluatedLayout.hasValue("text-variable-anchor")||g._unevaluatedLayout.hasValue("text-variable-anchor-offset"),U=w.get("text-rotation-alignment")==="map",$=w.get("text-pitch-alignment")==="map",Q=w.get("icon-text-fit")!=="none",me=new ze(null,0,A&&(R||!t.hasIconData()||w.get("icon-optional")),R&&(A||!t.hasTextData()||w.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const fe=(xe,he,Ve)=>{for(let tt=0;tt0,ot=this.placedOrientations[he.crossTileID],ft=ot===n.WritingMode.vertical,Et=ot===n.WritingMode.horizontal||ot===n.WritingMode.horizontalOnly;if(Ve>0||tt>0){const yt=Pi(je.text);fe(t.text,Ve,ft?Si:yt),fe(t.text,tt,Et?Si:yt);const At=je.text.isHidden();[he.rightJustifiedTextSymbolIndex,he.centerJustifiedTextSymbolIndex,he.leftJustifiedTextSymbolIndex].forEach(Lt=>{Lt>=0&&(t.text.placedSymbolArray.get(Lt).hidden=At||ft?1:0)}),he.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(he.verticalPlacedTextSymbolIndex).hidden=At||Et?1:0);const Wt=this.variableOffsets[he.crossTileID];Wt&&this.markUsedJustification(t,Wt.anchor,he,ot);const Di=this.placedOrientations[he.crossTileID];Di&&(this.markUsedJustification(t,"left",he,Di),this.markUsedOrientation(t,Di,he))}if(at){const yt=Pi(je.icon),At=!(Q&&he.verticalPlacedIconSymbolIndex&&ft);he.placedIconSymbolIndex>=0&&(fe(t.icon,he.numIconVertices,At?yt:Si),t.icon.placedSymbolArray.get(he.placedIconSymbolIndex).hidden=je.icon.isHidden()),he.verticalPlacedIconSymbolIndex>=0&&(fe(t.icon,he.numVerticalIconVertices,At?Si:yt),t.icon.placedSymbolArray.get(he.verticalPlacedIconSymbolIndex).hidden=je.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const yt=t.collisionArrays[xe];if(yt){let At=new n.Point(0,0);if(yt.textBox||yt.verticalTextBox){let Di=!0;if(O){const Lt=this.variableOffsets[Ce];Lt?(At=Ue(Lt.anchor,Lt.width,Lt.height,Lt.textOffset,Lt.textBoxScale),U&&At._rotate($?this.transform.angle:-this.transform.angle)):Di=!1}yt.textBox&&Ct(t.textCollisionBox.collisionVertexArray,je.text.placed,!Di||ft,At.x,At.y),yt.verticalTextBox&&Ct(t.textCollisionBox.collisionVertexArray,je.text.placed,!Di||Et,At.x,At.y)}const Wt=!!(!Et&&yt.verticalIconBox);yt.iconBox&&Ct(t.iconCollisionBox.collisionVertexArray,je.icon.placed,Wt,Q?At.x:0,Q?At.y:0),yt.verticalIconBox&&Ct(t.iconCollisionBox.collisionVertexArray,je.icon.placed,!Wt,Q?At.x:0,Q?At.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 xe=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=xe.invProjMatrix,t.placementViewportMatrix=xe.viewportMatrix,t.collisionCircleArray=xe.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 Ct(y,t,c,d,g){y.emplaceBack(t?1:0,c?1:0,d||0,g||0),y.emplaceBack(t?1:0,c?1:0,d||0,g||0),y.emplaceBack(t?1:0,c?1:0,d||0,g||0),y.emplaceBack(t?1:0,c?1:0,d||0,g||0)}const Zt=Math.pow(2,25),di=Math.pow(2,24),Yt=Math.pow(2,17),ni=Math.pow(2,16),li=Math.pow(2,9),ai=Math.pow(2,8),gi=Math.pow(2,1);function Pi(y){if(y.opacity===0&&!y.placed)return 0;if(y.opacity===1&&y.placed)return 4294967295;const t=y.placed?1:0,c=Math.floor(127*y.opacity);return c*Zt+t*di+c*Yt+t*ni+c*li+t*ai+c*gi+t}const Si=0;class jr{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,c,d,g,w){const T=this._bucketParts;for(;this._currentTileIndexA.sortKey-R.sortKey));this._currentPartIndex!this._forceFullPlacement&&n.browser.now()-g>2;for(;this._currentPlacementIndex>=0;){const T=c[t[this._currentPlacementIndex]],A=this.placement.collisionIndex.transform.zoom;if(T.type==="symbol"&&(!T.minzoom||T.minzoom<=A)&&(!T.maxzoom||T.maxzoom>A)){if(this._inProgressLayer||(this._inProgressLayer=new jr(T)),this._inProgressLayer.continuePlacement(d[T.source],this.placement,this._showCollisionBoxes,T,w))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const mr=512/n.EXTENT/2;class rs{constructor(t,c,d){this.tileID=t,this.bucketInstanceId=d,this._symbolsByKey={};const g=new Map;for(let w=0;w({x:Math.floor(R.anchorX*mr),y:Math.floor(R.anchorY*mr)})),crossTileIDs:T.map(R=>R.crossTileID)};if(A.positions.length>128){const R=new n.KDBush(A.positions.length,16,Uint16Array);for(const{x:O,y:U}of A.positions)R.add(O,U);R.finish(),delete A.positions,A.index=R}this._symbolsByKey[w]=A}}getScaledCoordinates(t,c){const{x:d,y:g,z:w}=this.tileID.canonical,{x:T,y:A,z:R}=c.canonical,O=mr/Math.pow(2,R-w),U=(A*n.EXTENT+t.anchorY)*O,$=g*n.EXTENT*mr;return{x:Math.floor((T*n.EXTENT+t.anchorX)*O-d*n.EXTENT*mr),y:Math.floor(U-$)}}findMatches(t,c,d){const g=this.tileID.canonical.zt)}}class ns{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ai{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const c=Math.round((t-this.lng)/360);if(c!==0)for(const d in this.indexes){const g=this.indexes[d],w={};for(const T in g){const A=g[T];A.tileID=A.tileID.unwrapTo(A.tileID.wrap+c),w[A.tileID.key]=A}this.indexes[d]=w}this.lng=t}addBucket(t,c,d){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===c.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let w=0;wt.overscaledZ)for(const A in T){const R=T[A];R.tileID.isChildOf(t)&&R.findMatches(c.symbolInstances,t,g)}else{const A=T[t.scaledTo(Number(w)).key];A&&A.findMatches(c.symbolInstances,t,g)}}for(let w=0;w{c[d]=!0});for(const d in this.layerIndexes)c[d]||delete this.layerIndexes[d]}}const un=(y,t)=>n.emitValidationErrors(y,t&&t.filter(c=>c.identifier!=="source.canvas")),lr=n.pick(n.operations,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Dr=n.pick(n.operations,["setCenter","setZoom","setBearing","setPitch"]),to=n.emptyStyle();class kr extends n.Evented{constructor(t,c={}){super(),this.map=t,this.dispatcher=new ie(Ti(),this,t._getMapId()),this.imageManager=new ye,this.imageManager.setEventedParent(this),this.glyphManager=new Tt(t._requestManager,c.localIdeographFontFamily),this.lineAtlas=new Xe(256,512),this.crossTileSymbolIndex=new Jr,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new n.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",n.getReferrer());const d=this;this._rtlTextPluginCallback=kr.registerForPluginStateChange(g=>{d.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:g.pluginStatus,pluginURL:g.pluginURL},(w,T)=>{if(n.triggerPluginCompletionEvent(w),T&&T.every(A=>A))for(const A in d.sourceCaches){const R=d.sourceCaches[A].getSource().type;R!=="vector"&&R!=="geojson"||d.sourceCaches[A].reload()}})}),this.on("data",g=>{if(g.dataType!=="source"||g.sourceDataType!=="metadata")return;const w=this.sourceCaches[g.sourceId];if(!w)return;const T=w.getSource();if(T&&T.vectorLayerIds)for(const A in this._layers){const R=this._layers[A];R.source===T.id&&this._validateLayer(R)}})}loadURL(t,c={},d){this.fire(new n.Event("dataloading",{dataType:"style"})),c.validate=typeof c.validate!="boolean"||c.validate;const g=this.map._requestManager.transformRequest(t,D.Style);this._request=n.getJSON(g,(w,T)=>{this._request=null,w?this.fire(new n.ErrorEvent(w)):T&&this._load(T,c,d)})}loadJSON(t,c={},d){this.fire(new n.Event("dataloading",{dataType:"style"})),this._request=n.browser.frame(()=>{this._request=null,c.validate=c.validate!==!1,this._load(t,c,d)})}loadEmpty(){this.fire(new n.Event("dataloading",{dataType:"style"})),this._load(to,{validate:!1})}_load(t,c,d){var g;const w=c.transformStyle?c.transformStyle(d,t):t;if(!c.validate||!un(this,n.validateStyle(w))){this._loaded=!0,this.stylesheet=w;for(const T in w.sources)this.addSource(T,w.sources[T],{validate:!1});w.sprite?this._loadSprite(w.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(w.glyphs),this._createLayers(),this.light=new Ne(this.stylesheet.light),this.map.setTerrain((g=this.stylesheet.terrain)!==null&&g!==void 0?g:null),this.fire(new n.Event("data",{dataType:"style"})),this.fire(new n.Event("style.load"))}}_createLayers(){const t=n.derefLayers(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",t),this._order=t.map(c=>c.id),this._layers={},this._serializedLayers=null;for(const c of t){const d=n.createStyleLayer(c);d.setEventedParent(this,{layer:{id:c.id}}),this._layers[c.id]=d}}_loadSprite(t,c=!1,d=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(g,w,T,A){const R=ge(g),O=R.length,U=T>1?"@2x":"",$={},Q={},me={};for(const{id:fe,url:xe}of R){const he=w.transformRequest(w.normalizeSpriteURL(xe,U,".json"),D.SpriteJSON),Ve=`${fe}_${he.url}`;$[Ve]=n.getJSON(he,(je,at)=>{delete $[Ve],Q[fe]=at,ce(A,Q,me,je,O)});const tt=w.transformRequest(w.normalizeSpriteURL(xe,U,".png"),D.SpriteImage),Ce=`${fe}_${tt.url}`;$[Ce]=L.getImage(tt,(je,at)=>{delete $[Ce],me[fe]=at,ce(A,Q,me,je,O)})}return{cancel(){for(const fe of Object.values($))fe.cancel()}}}(t,this.map._requestManager,this.map.getPixelRatio(),(g,w)=>{if(this._spriteRequest=null,g)this.fire(new n.ErrorEvent(g));else if(w)for(const T in w){this._spritesImagesIds[T]=[];const A=this._spritesImagesIds[T]?this._spritesImagesIds[T].filter(R=>!(R in w)):[];for(const R of A)this.imageManager.removeImage(R),this._changedImages[R]=!0;for(const R in w[T]){const O=T==="default"?R:`${T}:${R}`;this._spritesImagesIds[T].push(O),O in this.imageManager.images?this.imageManager.updateImage(O,w[T][R],!1):this.imageManager.addImage(O,w[T][R]),c&&(this._changedImages[O]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),c&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new n.Event("data",{dataType:"style"})),d&&d(g)})}_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 n.Event("data",{dataType:"style"}))}_validateLayer(t){const c=this.sourceCaches[t.source];if(!c)return;const d=t.sourceLayer;if(!d)return;const g=c.getSource();(g.type==="geojson"||g.vectorLayerIds&&g.vectorLayerIds.indexOf(d)===-1)&&this.fire(new n.ErrorEvent(new Error(`Source layer "${d}" does not exist on source "${g.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 c=this._serializedAllLayers();if(!t||t.length===0)return Object.values(c);const d=[];for(const g of t)c[g]&&d.push(c[g]);return d}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const c=Object.keys(this._layers);for(const d of c){const g=this._layers[d];g.type!=="custom"&&(t[d]=g.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 c=this._changed;if(this._changed){const g=Object.keys(this._updatedLayers),w=Object.keys(this._removedLayers);(g.length||w.length)&&this._updateWorkerLayers(g,w);for(const T in this._updatedSources){const A=this._updatedSources[T];if(A==="reload")this._reloadSource(T);else{if(A!=="clear")throw new Error(`Invalid action ${A}`);this._clearSource(T)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const T in this._updatedPaintProps)this._layers[T].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const d={};for(const g in this.sourceCaches){const w=this.sourceCaches[g];d[g]=w.used,w.used=!1}for(const g of this._order){const w=this._layers[g];w.recalculate(t,this._availableImages),!w.isHidden(t.zoom)&&w.source&&(this.sourceCaches[w.source].used=!0)}for(const g in d){const w=this.sourceCaches[g];d[g]!==w.used&&w.fire(new n.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:g}))}this.light.recalculate(t),this.z=t.zoom,c&&this.fire(new n.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const c in this.sourceCaches)this.sourceCaches[c].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,c){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(t),removedIds:c})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,c={}){this._checkLoaded();const d=this.serialize();if(t=c.transformStyle?c.transformStyle(d,t):t,un(this,n.validateStyle(t)))return!1;(t=n.clone$1(t)).layers=n.derefLayers(t.layers);const g=n.diffStyles(d,t).filter(T=>!(T.command in Dr));if(g.length===0)return!1;const w=g.filter(T=>!(T.command in lr));if(w.length>0)throw new Error(`Unimplemented: ${w.map(T=>T.command).join(", ")}.`);for(const T of g)T.command!=="setTransition"&&this[T.command].apply(this,T.args);return this.stylesheet=t,this._serializedLayers=null,!0}addImage(t,c){if(this.getImage(t))return this.fire(new n.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,c),this._afterImageUpdated(t)}updateImage(t,c){this.imageManager.updateImage(t,c)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new n.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 n.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,c,d={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!c.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(c).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(c.type)>=0&&this._validate(n.validateStyle.source,`sources.${t}`,c,null,d))return;this.map&&this.map._collectResourceTiming&&(c.collectResourceTiming=!0);const g=this.sourceCaches[t]=new Ae(t,c,this.dispatcher);g.style=this,g.setEventedParent(this,()=>({isSourceLoaded:g.loaded(),source:g.serialize(),sourceId:t})),g.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 d in this._layers)if(this._layers[d].source===t)return this.fire(new n.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));const c=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],c.fire(new n.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),c.setEventedParent(null),c.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,c){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const d=this.sourceCaches[t].getSource();if(d.type!=="geojson")throw new Error(`geojsonSource.type is ${d.type}, which is !== 'geojson`);d.setData(c),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,c,d={}){this._checkLoaded();const g=t.id;if(this.getLayer(g))return void this.fire(new n.ErrorEvent(new Error(`Layer "${g}" already exists on this map.`)));let w;if(t.type==="custom"){if(un(this,n.validateCustomStyleLayer(t)))return;w=n.createStyleLayer(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(g,t.source),t=n.clone$1(t),t=n.extend(t,{source:g})),this._validate(n.validateStyle.layer,`layers.${g}`,t,{arrayIndex:-1},d))return;w=n.createStyleLayer(t),this._validateLayer(w),w.setEventedParent(this,{layer:{id:g}})}const T=c?this._order.indexOf(c):this._order.length;if(c&&T===-1)this.fire(new n.ErrorEvent(new Error(`Cannot add layer "${g}" before non-existing layer "${c}".`)));else{if(this._order.splice(T,0,g),this._layerOrderChanged=!0,this._layers[g]=w,this._removedLayers[g]&&w.source&&w.type!=="custom"){const A=this._removedLayers[g];delete this._removedLayers[g],A.type!==w.type?this._updatedSources[w.source]="clear":(this._updatedSources[w.source]="reload",this.sourceCaches[w.source].pause())}this._updateLayer(w),w.onAdd&&w.onAdd(this.map)}}moveLayer(t,c){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new n.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===c)return;const d=this._order.indexOf(t);this._order.splice(d,1);const g=c?this._order.indexOf(c):this._order.length;c&&g===-1?this.fire(new n.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${c}".`))):(this._order.splice(g,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const c=this._layers[t];if(!c)return void this.fire(new n.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));c.setEventedParent(null);const d=this._order.indexOf(t);this._order.splice(d,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=c,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],c.onRemove&&c.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,c,d){this._checkLoaded();const g=this.getLayer(t);g?g.minzoom===c&&g.maxzoom===d||(c!=null&&(g.minzoom=c),d!=null&&(g.maxzoom=d),this._updateLayer(g)):this.fire(new n.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,c,d={}){this._checkLoaded();const g=this.getLayer(t);if(g){if(!n.deepEqual(g.filter,c))return c==null?(g.filter=void 0,void this._updateLayer(g)):void(this._validate(n.validateStyle.filter,`layers.${g.id}.filter`,c,null,d)||(g.filter=n.clone$1(c),this._updateLayer(g)))}else this.fire(new n.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return n.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,c,d,g={}){this._checkLoaded();const w=this.getLayer(t);w?n.deepEqual(w.getLayoutProperty(c),d)||(w.setLayoutProperty(c,d,g),this._updateLayer(w)):this.fire(new n.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,c){const d=this.getLayer(t);if(d)return d.getLayoutProperty(c);this.fire(new n.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,c,d,g={}){this._checkLoaded();const w=this.getLayer(t);w?n.deepEqual(w.getPaintProperty(c),d)||(w.setPaintProperty(c,d,g)&&this._updateLayer(w),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new n.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,c){return this.getLayer(t).getPaintProperty(c)}setFeatureState(t,c){this._checkLoaded();const d=t.source,g=t.sourceLayer,w=this.sourceCaches[d];if(w===void 0)return void this.fire(new n.ErrorEvent(new Error(`The source '${d}' does not exist in the map's style.`)));const T=w.getSource().type;T==="geojson"&&g?this.fire(new n.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):T!=="vector"||g?(t.id===void 0&&this.fire(new n.ErrorEvent(new Error("The feature id parameter must be provided."))),w.setFeatureState(g,t.id,c)):this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,c){this._checkLoaded();const d=t.source,g=this.sourceCaches[d];if(g===void 0)return void this.fire(new n.ErrorEvent(new Error(`The source '${d}' does not exist in the map's style.`)));const w=g.getSource().type,T=w==="vector"?t.sourceLayer:void 0;w!=="vector"||T?c&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new n.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):g.removeFeatureState(T,t.id,c):this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const c=t.source,d=t.sourceLayer,g=this.sourceCaches[c];if(g!==void 0)return g.getSource().type!=="vector"||d?(t.id===void 0&&this.fire(new n.ErrorEvent(new Error("The feature id parameter must be provided."))),g.getFeatureState(d,t.id)):void this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new n.ErrorEvent(new Error(`The source '${c}' does not exist in the map's style.`)))}getTransition(){return n.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=n.mapObject(this.sourceCaches,g=>g.serialize()),c=this._serializeByIds(this._order),d=this.stylesheet;return n.filterObject({version:d.version,name:d.name,metadata:d.metadata,light:d.light,center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch,sprite:d.sprite,glyphs:d.glyphs,transition:d.transition,sources:t,layers:c},g=>g!==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 c=T=>this._layers[T].type==="fill-extrusion",d={},g=[];for(let T=this._order.length-1;T>=0;T--){const A=this._order[T];if(c(A)){d[A]=T;for(const R of t){const O=R[A];if(O)for(const U of O)g.push(U)}}}g.sort((T,A)=>A.intersectionZ-T.intersectionZ);const w=[];for(let T=this._order.length-1;T>=0;T--){const A=this._order[T];if(c(A))for(let R=g.length-1;R>=0;R--){const O=g[R].feature;if(d[O.layer.id]{const Et=Ve.featureSortOrder;if(Et){const yt=Et.indexOf(ot.featureIndex);return Et.indexOf(ft.featureIndex)-yt}return ft.featureIndex-ot.featureIndex});for(const ot of at)je.push(ot)}}for(const Ve in fe)fe[Ve].forEach(tt=>{const Ce=tt.feature,je=O[A[Ve].source].getFeatureState(Ce.layer["source-layer"],Ce.id);Ce.source=Ce.layer.source,Ce.layer["source-layer"]&&(Ce.sourceLayer=Ce.layer["source-layer"]),Ce.state=je});return fe}(this._layers,T,this.sourceCaches,t,c,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(w)}querySourceFeatures(t,c){c&&c.filter&&this._validate(n.validateStyle.filter,"querySourceFeatures.filter",c.filter,null,c);const d=this.sourceCaches[t];return d?function(g,w){const T=g.getRenderableIds().map(O=>g.getTileByID(O)),A=[],R={};for(let O=0;O{_i[g]=w})(t,c),c.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:c.workerSourceURL},d):d(null,null))}getLight(){return this.light.getLight()}setLight(t,c={}){this._checkLoaded();const d=this.light.getLight();let g=!1;for(const T in t)if(!n.deepEqual(t[T],d[T])){g=!0;break}if(!g)return;const w={now:n.browser.now(),transition:n.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,c),this.light.updateTransitions(w)}_validate(t,c,d,g,w={}){return(!w||w.validate!==!1)&&un(this,t.call(n.validateStyle,n.extend({key:c,style:this.serialize(),value:d,styleSpec:n.v8Spec},g)))}_remove(t=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),n.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const c in this._layers)this._layers[c].setEventedParent(null);for(const c in this.sourceCaches){const d=this.sourceCaches[c];d.setEventedParent(null),d.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const c in this.sourceCaches)this.sourceCaches[c].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,c,d,g,w=!1){let T=!1,A=!1;const R={};for(const O of this._order){const U=this._layers[O];if(U.type!=="symbol")continue;if(!R[U.source]){const Q=this.sourceCaches[U.source];R[U.source]=Q.getRenderableIds(!0).map(me=>Q.getTileByID(me)).sort((me,fe)=>fe.tileID.overscaledZ-me.tileID.overscaledZ||(me.tileID.isLessThan(fe.tileID)?-1:1))}const $=this.crossTileSymbolIndex.addLayer(U,R[U.source],t.center.lng);T=T||$}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((w=w||this._layerOrderChanged||d===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(n.browser.now(),t.zoom))&&(this.pauseablePlacement=new yn(t,this.map.terrain,this._order,w,c,d,g,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,R),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(n.browser.now()),A=!0),T&&this.pauseablePlacement.placement.setStale()),A||T)for(const O of this._order){const U=this._layers[O];U.type==="symbol"&&this.placement.updateLayerOpacities(U,R[U.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(n.browser.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,c,d){this.imageManager.getImages(c.icons,d),this._updateTilesForChangedImages();const g=this.sourceCaches[c.source];g&&g.setDependencies(c.tileID.key,c.type,c.icons)}getGlyphs(t,c,d){this.glyphManager.getGlyphs(c.stacks,d);const g=this.sourceCaches[c.source];g&&g.setDependencies(c.tileID.key,c.type,[""])}getResource(t,c,d){return n.makeRequest(c,d)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,c={}){this._checkLoaded(),t&&this._validate(n.validateStyle.glyphs,"glyphs",t,null,c)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,c,d={},g){this._checkLoaded();const w=[{id:t,url:c}],T=[...ge(this.stylesheet.sprite),...w];this._validate(n.validateStyle.sprite,"sprite",T,null,d)||(this.stylesheet.sprite=T,this._loadSprite(w,!0,g))}removeSprite(t){this._checkLoaded();const c=ge(this.stylesheet.sprite);if(c.find(d=>d.id===t)){if(this._spritesImagesIds[t])for(const d of this._spritesImagesIds[t])this.imageManager.removeImage(d),this._changedImages[d]=!0;c.splice(c.findIndex(d=>d.id===t),1),this.stylesheet.sprite=c.length>0?c:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new n.Event("data",{dataType:"style"}))}else this.fire(new n.ErrorEvent(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return ge(this.stylesheet.sprite)}setSprite(t,c={},d){this._checkLoaded(),t&&this._validate(n.validateStyle.sprite,"sprite",t,null,c)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,d):(this._unloadSprite(),d&&d(null)))}}kr.registerForPluginStateChange=n.registerForPluginStateChange;var Lr=n.createLayout([{name:"a_pos",type:"Int16",components:2}]),ss="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 vn={prelude:yi(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -972,62 +972,62 @@ 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:yi("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",ss),terrainDepth:yi("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);}",ss),terrainCoords:yi("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);}",ss)};function yi(y,t){const c=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=t.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),w=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),k=w?w.concat(g):g,A={};return{fragmentSource:y=y.replace(c,(L,O,U,V,J)=>(A[J]=!0,O==="define"?` -#ifndef HAS_UNIFORM_u_${J} -varying ${U} ${V} ${J}; +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:yi("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",ss),terrainDepth:yi("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);}",ss),terrainCoords:yi("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);}",ss)};function yi(y,t){const c=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,d=t.match(/attribute ([\w]+) ([\w]+)/g),g=y.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),w=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),T=w?w.concat(g):g,A={};return{fragmentSource:y=y.replace(c,(R,O,U,$,Q)=>(A[Q]=!0,O==="define"?` +#ifndef HAS_UNIFORM_u_${Q} +varying ${U} ${$} ${Q}; #else -uniform ${U} ${V} u_${J}; +uniform ${U} ${$} u_${Q}; #endif `:` -#ifdef HAS_UNIFORM_u_${J} - ${U} ${V} ${J} = u_${J}; +#ifdef HAS_UNIFORM_u_${Q} + ${U} ${$} ${Q} = u_${Q}; #endif -`)),vertexSource:t=t.replace(c,(L,O,U,V,J)=>{const pe=V==="float"?"vec2":"vec4",fe=J.match(/color/)?"color":pe;return A[J]?O==="define"?` -#ifndef HAS_UNIFORM_u_${J} -uniform lowp float u_${J}_t; -attribute ${U} ${pe} a_${J}; -varying ${U} ${V} ${J}; +`)),vertexSource:t=t.replace(c,(R,O,U,$,Q)=>{const me=$==="float"?"vec2":"vec4",fe=Q.match(/color/)?"color":me;return A[Q]?O==="define"?` +#ifndef HAS_UNIFORM_u_${Q} +uniform lowp float u_${Q}_t; +attribute ${U} ${me} a_${Q}; +varying ${U} ${$} ${Q}; #else -uniform ${U} ${V} u_${J}; +uniform ${U} ${$} u_${Q}; #endif `:fe==="vec4"?` -#ifndef HAS_UNIFORM_u_${J} - ${J} = a_${J}; +#ifndef HAS_UNIFORM_u_${Q} + ${Q} = a_${Q}; #else - ${U} ${V} ${J} = u_${J}; + ${U} ${$} ${Q} = u_${Q}; #endif `:` -#ifndef HAS_UNIFORM_u_${J} - ${J} = unpack_mix_${fe}(a_${J}, u_${J}_t); +#ifndef HAS_UNIFORM_u_${Q} + ${Q} = unpack_mix_${fe}(a_${Q}, u_${Q}_t); #else - ${U} ${V} ${J} = u_${J}; + ${U} ${$} ${Q} = u_${Q}; #endif `:O==="define"?` -#ifndef HAS_UNIFORM_u_${J} -uniform lowp float u_${J}_t; -attribute ${U} ${pe} a_${J}; +#ifndef HAS_UNIFORM_u_${Q} +uniform lowp float u_${Q}_t; +attribute ${U} ${me} a_${Q}; #else -uniform ${U} ${V} u_${J}; +uniform ${U} ${$} u_${Q}; #endif `:fe==="vec4"?` -#ifndef HAS_UNIFORM_u_${J} - ${U} ${V} ${J} = a_${J}; +#ifndef HAS_UNIFORM_u_${Q} + ${U} ${$} ${Q} = a_${Q}; #else - ${U} ${V} ${J} = u_${J}; + ${U} ${$} ${Q} = u_${Q}; #endif `:` -#ifndef HAS_UNIFORM_u_${J} - ${U} ${V} ${J} = unpack_mix_${fe}(a_${J}, u_${J}_t); +#ifndef HAS_UNIFORM_u_${Q} + ${U} ${$} ${Q} = unpack_mix_${fe}(a_${Q}, u_${Q}_t); #else - ${U} ${V} ${J} = u_${J}; + ${U} ${$} ${Q} = u_${Q}; #endif -`}),staticAttributes:d,staticUniforms:k}}class vs{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,c,d,g,w,k,A,L,O){this.context=t;let U=this.boundPaintVertexBuffers.length!==g.length;for(let V=0;!U&&V({u_depth:new n.Uniform1i(rt,ut.u_depth),u_terrain:new n.Uniform1i(rt,ut.u_terrain),u_terrain_dim:new n.Uniform1f(rt,ut.u_terrain_dim),u_terrain_matrix:new n.UniformMatrix4f(rt,ut.u_terrain_matrix),u_terrain_unpack:new n.Uniform4f(rt,ut.u_terrain_unpack),u_terrain_exaggeration:new n.Uniform1f(rt,ut.u_terrain_exaggeration)}))(t,it),this.binderUniforms=d?d.getUniforms(t,it):[]}draw(t,c,d,g,w,k,A,L,O,U,V,J,pe,fe,we,ue,Oe,Xe){const Te=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(d),t.setStencilMode(g),t.setColorMode(w),t.setCullFace(k),L){t.activeTexture.set(Te.TEXTURE2),Te.bindTexture(Te.TEXTURE_2D,L.depthTexture),t.activeTexture.set(Te.TEXTURE3),Te.bindTexture(Te.TEXTURE_2D,L.texture);for(const it in this.terrainUniforms)this.terrainUniforms[it].set(L[it])}for(const it in this.fixedUniforms)this.fixedUniforms[it].set(A[it]);we&&we.setUniforms(t,this.binderUniforms,pe,{zoom:fe});let Ue=0;switch(c){case Te.LINES:Ue=2;break;case Te.TRIANGLES:Ue=3;break;case Te.LINE_STRIP:Ue=1}for(const it of J.get()){const rt=it.vaos||(it.vaos={});(rt[O]||(rt[O]=new vs)).bind(t,this,U,we?we.getPaintVertexBuffers():[],V,it.vertexOffset,ue,Oe,Xe),Te.drawElements(c,it.primitiveLength*Ue,Te.UNSIGNED_SHORT,it.primitiveOffset*Ue*2)}}}function ba(y,t,c){const d=1/Ne(c,1,t.transform.tileZoom),g=Math.pow(2,c.tileID.overscaledZ),w=c.tileSize*Math.pow(2,t.transform.tileZoom)/g,k=w*(c.tileID.canonical.x+c.tileID.wrap*g),A=w*c.tileID.canonical.y;return{u_image:0,u_texsize:c.imageAtlasTexture.size,u_scale:[d,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[k>>16,A>>16],u_pixel_coord_lower:[65535&k,65535&A]}}const Ln=(y,t,c,d)=>{const g=t.style.light,w=g.properties.get("position"),k=[w.x,w.y,w.z],A=function(){var O=new n.ARRAY_TYPE(9);return n.ARRAY_TYPE!=Float32Array&&(O[1]=0,O[2]=0,O[3]=0,O[5]=0,O[6]=0,O[7]=0),O[0]=1,O[4]=1,O[8]=1,O}();g.properties.get("anchor")==="viewport"&&function(O,U){var V=Math.sin(U),J=Math.cos(U);O[0]=J,O[1]=V,O[2]=0,O[3]=-V,O[4]=J,O[5]=0,O[6]=0,O[7]=0,O[8]=1}(A,-t.transform.angle),function(O,U,V){var J=U[0],pe=U[1],fe=U[2];O[0]=J*V[0]+pe*V[3]+fe*V[6],O[1]=J*V[1]+pe*V[4]+fe*V[7],O[2]=J*V[2]+pe*V[5]+fe*V[8]}(k,k,A);const L=g.properties.get("color");return{u_matrix:y,u_lightpos:k,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[L.r,L.g,L.b],u_vertical_gradient:+c,u_opacity:d}},Lc=(y,t,c,d,g,w,k)=>n.extend(Ln(y,t,c,d),ba(w,t,k),{u_height_factor:-Math.pow(2,g.overscaledZ)/k.tileSize/8}),as=y=>({u_matrix:y}),Rc=(y,t,c,d)=>n.extend(as(y),ba(c,t,d)),Bc=(y,t)=>({u_matrix:y,u_world:t}),io=(y,t,c,d,g)=>n.extend(Rc(y,t,c,d),{u_world:g}),ro=(y,t,c,d)=>{const g=y.transform;let w,k;if(d.paint.get("circle-pitch-alignment")==="map"){const A=Ne(c,1,g.zoom);w=!0,k=[A,A]}else w=!1,k=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(t.posMatrix,c,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+w,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:k}},bs=(y,t,c)=>{const d=Ne(c,1,t.zoom),g=Math.pow(2,t.zoom-c.tileID.overscaledZ),w=c.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[t.pixelsToGLUnits[0]/(d*g),t.pixelsToGLUnits[1]/(d*g)],u_overscale_factor:w}},no=(y,t,c=1)=>({u_matrix:y,u_color:t,u_overlay:0,u_overlay_scale:c}),wa=y=>({u_matrix:y}),uh=(y,t,c,d)=>({u_matrix:y,u_extrude_scale:Ne(t,1,c),u_intensity:d});function hh(y,t){const c=Math.pow(2,t.canonical.z),d=t.canonical.y;return[new n.MercatorCoordinate(0,d/c).toLngLat().lat,new n.MercatorCoordinate(0,(d+1)/c).toLngLat().lat]}const xa=(y,t,c,d)=>{const g=y.transform;return{u_matrix:Fc(y,t,c,d),u_ratio:1/Ne(t,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},fh=(y,t,c,d,g)=>n.extend(xa(y,t,c,g),{u_image:0,u_image_height:d}),Oc=(y,t,c,d,g)=>{const w=y.transform,k=ol(t,w);return{u_matrix:Fc(y,t,c,g),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Ne(t,1,w.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[k,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/w.pixelsToGLUnits[0],1/w.pixelsToGLUnits[1]]}},dh=(y,t,c,d,g,w)=>{const k=y.lineAtlas,A=ol(t,y.transform),L=c.layout.get("line-cap")==="round",O=k.getDash(d.from,L),U=k.getDash(d.to,L),V=O.width*g.fromScale,J=U.width*g.toScale;return n.extend(xa(y,t,c,w),{u_patternscale_a:[A/V,-O.height/2],u_patternscale_b:[A/J,-U.height/2],u_sdfgamma:k.width/(256*Math.min(V,J)*y.pixelRatio)/2,u_image:0,u_tex_y_a:O.y,u_tex_y_b:U.y,u_mix:g.t})};function ol(y,t){return 1/Ne(y,1,t.tileZoom)}function Fc(y,t,c,d){return y.translatePosMatrix(d?d.posMatrix:t.tileID.posMatrix,t,c.paint.get("line-translate"),c.paint.get("line-translate-anchor"))}const ll=(y,t,c,d,g)=>{return{u_matrix:y,u_tl_parent:t,u_scale_parent:c,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(k=g.paint.get("raster-saturation"),k>0?1-1/(1.001-k):-k),u_contrast_factor:(w=g.paint.get("raster-contrast"),w>0?1/(1-w):1+w),u_spin_weights:Nc(g.paint.get("raster-hue-rotate"))};var w,k};function Nc(y){y*=Math.PI/180;const t=Math.sin(y),c=Math.cos(y);return[(2*c+1)/3,(-Math.sqrt(3)*t-c+1)/3,(Math.sqrt(3)*t-c+1)/3]}const cl=(y,t,c,d,g,w,k,A,L,O)=>{const U=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:U.cameraToCenterDistance,u_pitch:U.pitch/360*2*Math.PI,u_rotate_symbol:+c,u_aspect_ratio:U.width/U.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:w,u_label_plane_matrix:k,u_coord_matrix:A,u_is_text:+L,u_pitch_with_map:+d,u_texsize:O,u_texture:0}},ul=(y,t,c,d,g,w,k,A,L,O,U)=>{const V=g.transform;return n.extend(cl(y,t,c,d,g,w,k,A,L,O),{u_gamma_scale:d?Math.cos(V._pitch)*V.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+U})},Uc=(y,t,c,d,g,w,k,A,L,O)=>n.extend(ul(y,t,c,d,g,w,k,A,!0,L,!0),{u_texsize_icon:O,u_texture_icon:1}),Ls=(y,t,c)=>({u_matrix:y,u_opacity:t,u_color:c}),so=(y,t,c,d,g,w)=>n.extend(function(k,A,L,O){const U=L.imageManager.getPattern(k.from.toString()),V=L.imageManager.getPattern(k.to.toString()),{width:J,height:pe}=L.imageManager.getPixelSize(),fe=Math.pow(2,O.tileID.overscaledZ),we=O.tileSize*Math.pow(2,L.transform.tileZoom)/fe,ue=we*(O.tileID.canonical.x+O.tileID.wrap*fe),Oe=we*O.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:U.tl,u_pattern_br_a:U.br,u_pattern_tl_b:V.tl,u_pattern_br_b:V.br,u_texsize:[J,pe],u_mix:A.t,u_pattern_size_a:U.displaySize,u_pattern_size_b:V.displaySize,u_scale_a:A.fromScale,u_scale_b:A.toScale,u_tile_units_to_pixels:1/Ne(O,1,L.transform.tileZoom),u_pixel_coord_upper:[ue>>16,Oe>>16],u_pixel_coord_lower:[65535&ue,65535&Oe]}}(d,w,c,g),{u_matrix:y,u_opacity:t}),Rn={fillExtrusion:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_lightpos:new n.Uniform3f(y,t.u_lightpos),u_lightintensity:new n.Uniform1f(y,t.u_lightintensity),u_lightcolor:new n.Uniform3f(y,t.u_lightcolor),u_vertical_gradient:new n.Uniform1f(y,t.u_vertical_gradient),u_opacity:new n.Uniform1f(y,t.u_opacity)}),fillExtrusionPattern:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_lightpos:new n.Uniform3f(y,t.u_lightpos),u_lightintensity:new n.Uniform1f(y,t.u_lightintensity),u_lightcolor:new n.Uniform3f(y,t.u_lightcolor),u_vertical_gradient:new n.Uniform1f(y,t.u_vertical_gradient),u_height_factor:new n.Uniform1f(y,t.u_height_factor),u_image:new n.Uniform1i(y,t.u_image),u_texsize:new n.Uniform2f(y,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(y,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(y,t.u_scale),u_fade:new n.Uniform1f(y,t.u_fade),u_opacity:new n.Uniform1f(y,t.u_opacity)}),fill:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix)}),fillPattern:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_image:new n.Uniform1i(y,t.u_image),u_texsize:new n.Uniform2f(y,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(y,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(y,t.u_scale),u_fade:new n.Uniform1f(y,t.u_fade)}),fillOutline:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_world:new n.Uniform2f(y,t.u_world)}),fillOutlinePattern:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_world:new n.Uniform2f(y,t.u_world),u_image:new n.Uniform1i(y,t.u_image),u_texsize:new n.Uniform2f(y,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(y,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(y,t.u_scale),u_fade:new n.Uniform1f(y,t.u_fade)}),circle:(y,t)=>({u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_scale_with_map:new n.Uniform1i(y,t.u_scale_with_map),u_pitch_with_map:new n.Uniform1i(y,t.u_pitch_with_map),u_extrude_scale:new n.Uniform2f(y,t.u_extrude_scale),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_matrix:new n.UniformMatrix4f(y,t.u_matrix)}),collisionBox:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_pixels_to_tile_units:new n.Uniform1f(y,t.u_pixels_to_tile_units),u_extrude_scale:new n.Uniform2f(y,t.u_extrude_scale),u_overscale_factor:new n.Uniform1f(y,t.u_overscale_factor)}),collisionCircle:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_inv_matrix:new n.UniformMatrix4f(y,t.u_inv_matrix),u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_viewport_size:new n.Uniform2f(y,t.u_viewport_size)}),debug:(y,t)=>({u_color:new n.UniformColor(y,t.u_color),u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_overlay:new n.Uniform1i(y,t.u_overlay),u_overlay_scale:new n.Uniform1f(y,t.u_overlay_scale)}),clippingMask:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix)}),heatmap:(y,t)=>({u_extrude_scale:new n.Uniform1f(y,t.u_extrude_scale),u_intensity:new n.Uniform1f(y,t.u_intensity),u_matrix:new n.UniformMatrix4f(y,t.u_matrix)}),heatmapTexture:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_world:new n.Uniform2f(y,t.u_world),u_image:new n.Uniform1i(y,t.u_image),u_color_ramp:new n.Uniform1i(y,t.u_color_ramp),u_opacity:new n.Uniform1f(y,t.u_opacity)}),hillshade:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_image:new n.Uniform1i(y,t.u_image),u_latrange:new n.Uniform2f(y,t.u_latrange),u_light:new n.Uniform2f(y,t.u_light),u_shadow:new n.UniformColor(y,t.u_shadow),u_highlight:new n.UniformColor(y,t.u_highlight),u_accent:new n.UniformColor(y,t.u_accent)}),hillshadePrepare:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_image:new n.Uniform1i(y,t.u_image),u_dimension:new n.Uniform2f(y,t.u_dimension),u_zoom:new n.Uniform1f(y,t.u_zoom),u_unpack:new n.Uniform4f(y,t.u_unpack)}),line:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_ratio:new n.Uniform1f(y,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(y,t.u_units_to_pixels)}),lineGradient:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_ratio:new n.Uniform1f(y,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(y,t.u_units_to_pixels),u_image:new n.Uniform1i(y,t.u_image),u_image_height:new n.Uniform1f(y,t.u_image_height)}),linePattern:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_texsize:new n.Uniform2f(y,t.u_texsize),u_ratio:new n.Uniform1f(y,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_image:new n.Uniform1i(y,t.u_image),u_units_to_pixels:new n.Uniform2f(y,t.u_units_to_pixels),u_scale:new n.Uniform3f(y,t.u_scale),u_fade:new n.Uniform1f(y,t.u_fade)}),lineSDF:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_ratio:new n.Uniform1f(y,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(y,t.u_units_to_pixels),u_patternscale_a:new n.Uniform2f(y,t.u_patternscale_a),u_patternscale_b:new n.Uniform2f(y,t.u_patternscale_b),u_sdfgamma:new n.Uniform1f(y,t.u_sdfgamma),u_image:new n.Uniform1i(y,t.u_image),u_tex_y_a:new n.Uniform1f(y,t.u_tex_y_a),u_tex_y_b:new n.Uniform1f(y,t.u_tex_y_b),u_mix:new n.Uniform1f(y,t.u_mix)}),raster:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_tl_parent:new n.Uniform2f(y,t.u_tl_parent),u_scale_parent:new n.Uniform1f(y,t.u_scale_parent),u_buffer_scale:new n.Uniform1f(y,t.u_buffer_scale),u_fade_t:new n.Uniform1f(y,t.u_fade_t),u_opacity:new n.Uniform1f(y,t.u_opacity),u_image0:new n.Uniform1i(y,t.u_image0),u_image1:new n.Uniform1i(y,t.u_image1),u_brightness_low:new n.Uniform1f(y,t.u_brightness_low),u_brightness_high:new n.Uniform1f(y,t.u_brightness_high),u_saturation_factor:new n.Uniform1f(y,t.u_saturation_factor),u_contrast_factor:new n.Uniform1f(y,t.u_contrast_factor),u_spin_weights:new n.Uniform3f(y,t.u_spin_weights)}),symbolIcon:(y,t)=>({u_is_size_zoom_constant:new n.Uniform1i(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(y,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(y,t.u_size_t),u_size:new n.Uniform1f(y,t.u_size),u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(y,t.u_pitch),u_rotate_symbol:new n.Uniform1i(y,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(y,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(y,t.u_fade_change),u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(y,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(y,t.u_coord_matrix),u_is_text:new n.Uniform1i(y,t.u_is_text),u_pitch_with_map:new n.Uniform1i(y,t.u_pitch_with_map),u_texsize:new n.Uniform2f(y,t.u_texsize),u_texture:new n.Uniform1i(y,t.u_texture)}),symbolSDF:(y,t)=>({u_is_size_zoom_constant:new n.Uniform1i(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(y,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(y,t.u_size_t),u_size:new n.Uniform1f(y,t.u_size),u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(y,t.u_pitch),u_rotate_symbol:new n.Uniform1i(y,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(y,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(y,t.u_fade_change),u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(y,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(y,t.u_coord_matrix),u_is_text:new n.Uniform1i(y,t.u_is_text),u_pitch_with_map:new n.Uniform1i(y,t.u_pitch_with_map),u_texsize:new n.Uniform2f(y,t.u_texsize),u_texture:new n.Uniform1i(y,t.u_texture),u_gamma_scale:new n.Uniform1f(y,t.u_gamma_scale),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_is_halo:new n.Uniform1i(y,t.u_is_halo)}),symbolTextAndIcon:(y,t)=>({u_is_size_zoom_constant:new n.Uniform1i(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(y,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(y,t.u_size_t),u_size:new n.Uniform1f(y,t.u_size),u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(y,t.u_pitch),u_rotate_symbol:new n.Uniform1i(y,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(y,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(y,t.u_fade_change),u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(y,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(y,t.u_coord_matrix),u_is_text:new n.Uniform1i(y,t.u_is_text),u_pitch_with_map:new n.Uniform1i(y,t.u_pitch_with_map),u_texsize:new n.Uniform2f(y,t.u_texsize),u_texsize_icon:new n.Uniform2f(y,t.u_texsize_icon),u_texture:new n.Uniform1i(y,t.u_texture),u_texture_icon:new n.Uniform1i(y,t.u_texture_icon),u_gamma_scale:new n.Uniform1f(y,t.u_gamma_scale),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_is_halo:new n.Uniform1i(y,t.u_is_halo)}),background:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_opacity:new n.Uniform1f(y,t.u_opacity),u_color:new n.UniformColor(y,t.u_color)}),backgroundPattern:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_opacity:new n.Uniform1f(y,t.u_opacity),u_image:new n.Uniform1i(y,t.u_image),u_pattern_tl_a:new n.Uniform2f(y,t.u_pattern_tl_a),u_pattern_br_a:new n.Uniform2f(y,t.u_pattern_br_a),u_pattern_tl_b:new n.Uniform2f(y,t.u_pattern_tl_b),u_pattern_br_b:new n.Uniform2f(y,t.u_pattern_br_b),u_texsize:new n.Uniform2f(y,t.u_texsize),u_mix:new n.Uniform1f(y,t.u_mix),u_pattern_size_a:new n.Uniform2f(y,t.u_pattern_size_a),u_pattern_size_b:new n.Uniform2f(y,t.u_pattern_size_b),u_scale_a:new n.Uniform1f(y,t.u_scale_a),u_scale_b:new n.Uniform1f(y,t.u_scale_b),u_pixel_coord_upper:new n.Uniform2f(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(y,t.u_pixel_coord_lower),u_tile_units_to_pixels:new n.Uniform1f(y,t.u_tile_units_to_pixels)}),terrain:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_texture:new n.Uniform1i(y,t.u_texture),u_ele_delta:new n.Uniform1f(y,t.u_ele_delta)}),terrainDepth:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_ele_delta:new n.Uniform1f(y,t.u_ele_delta)}),terrainCoords:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_texture:new n.Uniform1i(y,t.u_texture),u_terrain_coords_id:new n.Uniform1f(y,t.u_terrain_coords_id),u_ele_delta:new n.Uniform1f(y,t.u_ele_delta)})};class ao{constructor(t,c,d){this.context=t;const g=t.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,c.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete c.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const c=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),c.bufferSubData(c.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const oo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Sa{constructor(t,c,d,g){this.length=c.length,this.attributes=d,this.itemSize=c.bytesPerElement,this.dynamicDraw=g,this.context=t;const w=t.gl;this.buffer=w.createBuffer(),t.bindVertexBuffer.set(this.buffer),w.bufferData(w.ARRAY_BUFFER,c.arrayBuffer,this.dynamicDraw?w.DYNAMIC_DRAW:w.STATIC_DRAW),this.dynamicDraw||delete c.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 c=this.context.gl;this.bind(),c.bufferSubData(c.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,c){for(let d=0;d0){const It=n.create(),Gt=ut;n.mul(It,rt.placementInvProjMatrix,y.transform.glCoordMatrix),n.mul(It,It,rt.placementViewportMatrix),U.push({circleArray:yt,circleOffset:J,transform:Gt,invTransform:It,coord:Ue}),V+=yt.length/4,J=V}xt&&O.draw(A,L.LINES,Ri.disabled,Ki.disabled,y.colorModeForRenderPass(),er.disabled,bs(ut,y.transform,it),y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ue),c.id,xt.layoutVertexBuffer,xt.indexBuffer,xt.segments,null,y.transform.zoom,null,null,xt.collisionVertexBuffer)}if(!k||!U.length)return;const pe=y.useProgram("collisionCircle"),fe=new n.CollisionCircleLayoutArray;fe.resize(4*V),fe._trim();let we=0;for(const Te of U)for(let Ue=0;Ue=0&&(fe[ue.associatedIconIndex]={shiftedAnchor:Mi,angle:Dt})}else K(ue.numGlyphs,J)}if(O){pe.clear();const we=y.icon.placedSymbolArray;for(let ue=0;uey.style.map.terrain.getElevation(xt,Tn,vr):null,yr=c.layout.get("text-rotation-alignment")==="map";or(It,xt.posMatrix,y,g,Jn,nr,ue,O,yr,_r)}const ls=y.translatePosMatrix(xt.posMatrix,yt,w,k),Fs=Oe||g&&rt||ks?bh:Jn,tn=y.translatePosMatrix(nr,yt,w,k,!0),jr=Dt&&c.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Wr;Wr=Dt?It.iconsInText?Uc(ui.kind,xi,Xe,ue,y,ls,Fs,tn,Di,fr):ul(ui.kind,xi,Xe,ue,y,ls,Fs,tn,g,Di,!0):cl(ui.kind,xi,Xe,ue,y,ls,Fs,tn,g,Di);const Fa={program:rr,buffers:Gt,uniformValues:Wr,atlasTexture:gr,atlasTextureIcon:cr,atlasInterpolation:Xi,atlasInterpolationIcon:Bn,isSDF:Dt,hasHalo:jr};if(Te&&It.canOverlap){Ue=!0;const _r=Gt.segments.get();for(const yr of _r)ut.push({segments:new n.SegmentVector([yr]),sortKey:yr.sortKey,state:Fa,terrainData:Ei})}else ut.push({segments:Gt.segments,sortKey:0,state:Fa,terrainData:Ei})}Ue&&ut.sort((xt,yt)=>xt.sortKey-yt.sortKey);for(const xt of ut){const yt=xt.state;if(J.activeTexture.set(pe.TEXTURE0),yt.atlasTexture.bind(yt.atlasInterpolation,pe.CLAMP_TO_EDGE),yt.atlasTextureIcon&&(J.activeTexture.set(pe.TEXTURE1),yt.atlasTextureIcon&&yt.atlasTextureIcon.bind(yt.atlasInterpolationIcon,pe.CLAMP_TO_EDGE)),yt.isSDF){const It=yt.uniformValues;yt.hasHalo&&(It.u_is_halo=1,xo(yt.buffers,xt.segments,c,y,yt.program,it,U,V,It,xt.terrainData)),It.u_is_halo=0}xo(yt.buffers,xt.segments,c,y,yt.program,it,U,V,yt.uniformValues,xt.terrainData)}}function xo(y,t,c,d,g,w,k,A,L,O){const U=d.context;g.draw(U,U.gl.TRIANGLES,w,k,A,er.disabled,L,O,c.id,y.layoutVertexBuffer,y.indexBuffer,t,c.paint,d.transform.zoom,y.programConfigurations.get(c.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function Sl(y,t,c,d,g){if(!c||!d||!d.imageAtlas)return;const w=d.imageAtlas.patternPositions;let k=w[c.to.toString()],A=w[c.from.toString()];if(!k||!A){const L=g.getPaintProperty(t);k=w[L],A=w[L]}k&&A&&y.setConstantPatternPositions(k,A)}function Ea(y,t,c,d,g,w,k){const A=y.context.gl,L="fill-pattern",O=c.paint.get(L),U=O&&O.constantOr(1),V=c.getCrossfadeParameters();let J,pe,fe,we,ue;k?(pe=U&&!c.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",J=A.LINES):(pe=U?"fillPattern":"fill",J=A.TRIANGLES);const Oe=O.constantOr(null);for(const Xe of d){const Te=t.getTile(Xe);if(U&&!Te.patternsLoaded())continue;const Ue=Te.getBucket(c);if(!Ue)continue;const it=Ue.programConfigurations.get(c.id),rt=y.useProgram(pe,it),ut=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Xe);U&&(y.context.activeTexture.set(A.TEXTURE0),Te.imageAtlasTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),it.updatePaintBuffers(V)),Sl(it,L,Oe,Te,c);const xt=ut?Xe:null,yt=y.translatePosMatrix(xt?xt.posMatrix:Xe.posMatrix,Te,c.paint.get("fill-translate"),c.paint.get("fill-translate-anchor"));if(k){we=Ue.indexBuffer2,ue=Ue.segments2;const It=[A.drawingBufferWidth,A.drawingBufferHeight];fe=pe==="fillOutlinePattern"&&U?io(yt,y,V,Te,It):Bc(yt,It)}else we=Ue.indexBuffer,ue=Ue.segments,fe=U?Rc(yt,y,V,Te):as(yt);rt.draw(y.context,J,g,y.stencilModeForClipping(Xe),w,er.disabled,fe,ut,c.id,Ue.layoutVertexBuffer,we,ue,c.paint,y.transform.zoom,it)}}function Ys(y,t,c,d,g,w,k){const A=y.context,L=A.gl,O="fill-extrusion-pattern",U=c.paint.get(O),V=U.constantOr(1),J=c.getCrossfadeParameters(),pe=c.paint.get("fill-extrusion-opacity"),fe=U.constantOr(null);for(const we of d){const ue=t.getTile(we),Oe=ue.getBucket(c);if(!Oe)continue;const Xe=y.style.map.terrain&&y.style.map.terrain.getTerrainData(we),Te=Oe.programConfigurations.get(c.id),Ue=y.useProgram(V?"fillExtrusionPattern":"fillExtrusion",Te);V&&(y.context.activeTexture.set(L.TEXTURE0),ue.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),Te.updatePaintBuffers(J)),Sl(Te,O,fe,ue,c);const it=y.translatePosMatrix(we.posMatrix,ue,c.paint.get("fill-extrusion-translate"),c.paint.get("fill-extrusion-translate-anchor")),rt=c.paint.get("fill-extrusion-vertical-gradient"),ut=V?Lc(it,y,rt,pe,we,J,ue):Ln(it,y,rt,pe);Ue.draw(A,A.gl.TRIANGLES,g,w,k,er.backCCW,ut,Xe,c.id,Oe.layoutVertexBuffer,Oe.indexBuffer,Oe.segments,c.paint,y.transform.zoom,Te,y.style.map.terrain&&Oe.centroidVertexBuffer)}}function El(y,t,c,d,g,w,k){const A=y.context,L=A.gl,O=c.fbo;if(!O)return;const U=y.useProgram("hillshade"),V=y.style.map.terrain&&y.style.map.terrain.getTerrainData(t);A.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_2D,O.colorAttachment.get()),U.draw(A,L.TRIANGLES,g,w,k,er.disabled,((J,pe,fe,we)=>{const ue=fe.paint.get("hillshade-shadow-color"),Oe=fe.paint.get("hillshade-highlight-color"),Xe=fe.paint.get("hillshade-accent-color");let Te=fe.paint.get("hillshade-illumination-direction")*(Math.PI/180);fe.paint.get("hillshade-illumination-anchor")==="viewport"&&(Te-=J.transform.angle);const Ue=!J.options.moving;return{u_matrix:we?we.posMatrix:J.transform.calculatePosMatrix(pe.tileID.toUnwrapped(),Ue),u_image:0,u_latrange:hh(0,pe.tileID),u_light:[fe.paint.get("hillshade-exaggeration"),Te],u_shadow:ue,u_highlight:Oe,u_accent:Xe}})(y,c,d,V?t:null),V,d.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function wh(y,t,c,d,g,w){const k=y.context,A=k.gl,L=t.dem;if(L&&L.data){const O=L.dim,U=L.stride,V=L.getPixels();if(k.activeTexture.set(A.TEXTURE1),k.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||y.getTileTexture(U),t.demTexture){const pe=t.demTexture;pe.update(V,{premultiply:!1}),pe.bind(A.NEAREST,A.CLAMP_TO_EDGE)}else t.demTexture=new ze(k,V,A.RGBA,{premultiply:!1}),t.demTexture.bind(A.NEAREST,A.CLAMP_TO_EDGE);k.activeTexture.set(A.TEXTURE0);let J=t.fbo;if(!J){const pe=new ze(k,{width:O,height:O,data:null},A.RGBA);pe.bind(A.LINEAR,A.CLAMP_TO_EDGE),J=t.fbo=k.createFramebuffer(O,O,!0,!1),J.colorAttachment.set(pe.texture)}k.bindFramebuffer.set(J.framebuffer),k.viewport.set([0,0,O,O]),y.useProgram("hillshadePrepare").draw(k,A.TRIANGLES,d,g,w,er.disabled,((pe,fe)=>{const we=fe.stride,ue=n.create();return n.ortho(ue,0,n.EXTENT,-n.EXTENT,0,0,1),n.translate(ue,ue,[0,-n.EXTENT,0]),{u_matrix:ue,u_image:1,u_dimension:[we,we],u_zoom:pe.overscaledZ,u_unpack:fe.getUnpackVector()}})(t.tileID,L),null,c.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function kl(y,t,c,d,g,w){const k=d.paint.get("raster-fade-duration");if(!w&&k>0){const A=n.browser.now(),L=(A-y.timeAdded)/k,O=t?(A-t.timeAdded)/k:-1,U=c.getSource(),V=g.coveringZoomLevel({tileSize:U.tileSize,roundZoom:U.roundZoom}),J=!t||Math.abs(t.tileID.overscaledZ-V)>Math.abs(y.tileID.overscaledZ-V),pe=J&&y.refreshedUponExpiration?1:n.clamp(J?L:1-O,0,1);return y.refreshedUponExpiration&&L>=1&&(y.refreshedUponExpiration=!1),t?{opacity:1,mix:1-pe}:{opacity:pe,mix:0}}return{opacity:1,mix:0}}const xh=new n.Color(1,0,0,1),Gc=new n.Color(0,1,0,1),So=new n.Color(0,0,1,1),Tl=new n.Color(1,0,1,1),Wc=new n.Color(0,1,1,1);function Cl(y,t,c,d){Qs(y,0,t+c/2,y.transform.width,c,d)}function ka(y,t,c,d){Qs(y,t-c/2,0,c,y.transform.height,d)}function Qs(y,t,c,d,g,w){const k=y.context,A=k.gl;A.enable(A.SCISSOR_TEST),A.scissor(t*y.pixelRatio,c*y.pixelRatio,d*y.pixelRatio,g*y.pixelRatio),k.clear({color:w}),A.disable(A.SCISSOR_TEST)}function Sh(y,t,c){const d=y.context,g=d.gl,w=c.posMatrix,k=y.useProgram("debug"),A=Ri.disabled,L=Ki.disabled,O=y.colorModeForRenderPass(),U="$debug",V=y.style.map.terrain&&y.style.map.terrain.getTerrainData(c);d.activeTexture.set(g.TEXTURE0);const J=t.getTileByID(c.key).latestRawTileData,pe=Math.floor((J&&J.byteLength||0)/1024),fe=t.getTile(c).tileSize,we=512/Math.min(fe,512)*(c.overscaledZ/y.transform.zoom)*.5;let ue=c.canonical.toString();c.overscaledZ!==c.canonical.z&&(ue+=` => ${c.overscaledZ}`),function(Oe,Xe){Oe.initDebugOverlayCanvas();const Te=Oe.debugOverlayCanvas,Ue=Oe.context.gl,it=Oe.debugOverlayCanvas.getContext("2d");it.clearRect(0,0,Te.width,Te.height),it.shadowColor="white",it.shadowBlur=2,it.lineWidth=1.5,it.strokeStyle="white",it.textBaseline="top",it.font="bold 36px Open Sans, sans-serif",it.fillText(Xe,5,5),it.strokeText(Xe,5,5),Oe.debugOverlayTexture.update(Te),Oe.debugOverlayTexture.bind(Ue.LINEAR,Ue.CLAMP_TO_EDGE)}(y,`${ue} ${pe}kB`),k.draw(d,g.TRIANGLES,A,L,mi.alphaBlended,er.disabled,no(w,n.Color.transparent,we),null,U,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),k.draw(d,g.LINE_STRIP,A,L,O,er.disabled,no(w,n.Color.red),V,U,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Il(y,t,c){const d=y.context,g=d.gl,w=y.colorModeForRenderPass(),k=new Ri(g.LEQUAL,Ri.ReadWrite,y.depthRangeFor3D),A=y.useProgram("terrain"),L=t.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,y.width,y.height]);for(const O of c){const U=y.renderToTexture.getTexture(O),V=t.getTerrainData(O.tileID);d.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,U.texture);const J={u_matrix:y.transform.calculatePosMatrix(O.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(y.transform.zoom)};A.draw(d,g.TRIANGLES,k,Ki.disabled,w,er.backCCW,J,V,"terrain",L.vertexBuffer,L.indexBuffer,L.segments)}}class hr{constructor(t,c){this.context=new go(t),this.transform=c,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:n.create(),renderTime:0},this.setup(),this.numSublayers=Ie.maxUnderzooming+Ie.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jr}resize(t,c,d){if(this.width=Math.floor(t*d),this.height=Math.floor(c*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const t=this.context,c=new n.PosArray;c.emplaceBack(0,0),c.emplaceBack(n.EXTENT,0),c.emplaceBack(0,n.EXTENT),c.emplaceBack(n.EXTENT,n.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(c,Dr.members),this.tileExtentSegments=n.SegmentVector.simpleSegment(0,0,4,2);const d=new n.PosArray;d.emplaceBack(0,0),d.emplaceBack(n.EXTENT,0),d.emplaceBack(0,n.EXTENT),d.emplaceBack(n.EXTENT,n.EXTENT),this.debugBuffer=t.createVertexBuffer(d,Dr.members),this.debugSegments=n.SegmentVector.simpleSegment(0,0,4,5);const g=new n.RasterBoundsArray;g.emplaceBack(0,0,0,0),g.emplaceBack(n.EXTENT,0,n.EXTENT,0),g.emplaceBack(0,n.EXTENT,0,n.EXTENT),g.emplaceBack(n.EXTENT,n.EXTENT,n.EXTENT,n.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(g,Ct.members),this.rasterBoundsSegments=n.SegmentVector.simpleSegment(0,0,4,2);const w=new n.PosArray;w.emplaceBack(0,0),w.emplaceBack(1,0),w.emplaceBack(0,1),w.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(w,Dr.members),this.viewportSegments=n.SegmentVector.simpleSegment(0,0,4,2);const k=new n.LineStripIndexArray;k.emplaceBack(0),k.emplaceBack(1),k.emplaceBack(3),k.emplaceBack(2),k.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(k);const A=new n.TriangleIndexArray;A.emplaceBack(0,1,2),A.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(A);const L=this.context.gl;this.stencilClearMode=new Ki({func:L.ALWAYS,mask:0},0,255,L.ZERO,L.ZERO,L.ZERO)}clearStencil(){const t=this.context,c=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=n.create();n.ortho(d,0,this.width,this.height,0,0,1),n.scale(d,d,[c.drawingBufferWidth,c.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,c.TRIANGLES,Ri.disabled,this.stencilClearMode,mi.disabled,er.disabled,wa(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,c){if(this.currentStencilSource===t.source||!t.isTileClipped()||!c||!c.length)return;this.currentStencilSource=t.source;const d=this.context,g=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(mi.disabled),d.setDepthMode(Ri.disabled);const w=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const k of c){const A=this._tileClippingMaskIDs[k.key]=this.nextStencilID++,L=this.style.map.terrain&&this.style.map.terrain.getTerrainData(k);w.draw(d,g.TRIANGLES,Ri.disabled,new Ki({func:g.ALWAYS,mask:0},A,255,g.KEEP,g.KEEP,g.REPLACE),mi.disabled,er.disabled,wa(k.posMatrix),L,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,c=this.context.gl;return new Ki({func:c.NOTEQUAL,mask:255},t,255,c.KEEP,c.KEEP,c.REPLACE)}stencilModeForClipping(t){const c=this.context.gl;return new Ki({func:c.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,c.KEEP,c.KEEP,c.REPLACE)}stencilConfigForOverlap(t){const c=this.context.gl,d=t.sort((k,A)=>A.overscaledZ-k.overscaledZ),g=d[d.length-1].overscaledZ,w=d[0].overscaledZ-g+1;if(w>1){this.currentStencilSource=void 0,this.nextStencilID+w>256&&this.clearStencil();const k={};for(let A=0;A=0;this.currentLayer--){const L=this.style._layers[d[this.currentLayer]],O=g[L.source],U=w[L.source];this._renderTileClippingMasks(L,U),this.renderLayer(this,O,L,U)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerue.source&&!ue.isHidden(U)?[O.sourceCaches[ue.source]]:[]),pe=J.filter(ue=>ue.getSource().type==="vector"),fe=J.filter(ue=>ue.getSource().type!=="vector"),we=ue=>{(!V||V.getSource().maxzoomwe(ue)),V||fe.forEach(ue=>we(ue)),V}(this.style,this.transform.zoom);L&&function(O,U,V){for(let J=0;Jpe.style.map.terrain.getElevation(rt,ui,Kt):null)}}}(L,w,A,k,A.layout.get("text-rotation-alignment"),A.layout.get("text-pitch-alignment"),O),A.paint.get("icon-opacity").constantOr(1)!==0&&wo(w,k,A,L,!1,A.paint.get("icon-translate"),A.paint.get("icon-translate-anchor"),A.layout.get("icon-rotation-alignment"),A.layout.get("icon-pitch-alignment"),A.layout.get("icon-keep-upright"),U,V),A.paint.get("text-opacity").constantOr(1)!==0&&wo(w,k,A,L,!0,A.paint.get("text-translate"),A.paint.get("text-translate-anchor"),A.layout.get("text-rotation-alignment"),A.layout.get("text-pitch-alignment"),A.layout.get("text-keep-upright"),U,V),k.map.showCollisionBoxes&&(wl(w,k,A,L,A.paint.get("text-translate"),A.paint.get("text-translate-anchor"),!0),wl(w,k,A,L,A.paint.get("icon-translate"),A.paint.get("icon-translate-anchor"),!1))})(t,c,d,g,this.style.placement.variableOffsets);break;case"circle":(function(w,k,A,L){if(w.renderPass!=="translucent")return;const O=A.paint.get("circle-opacity"),U=A.paint.get("circle-stroke-width"),V=A.paint.get("circle-stroke-opacity"),J=!A.layout.get("circle-sort-key").isConstant();if(O.constantOr(1)===0&&(U.constantOr(1)===0||V.constantOr(1)===0))return;const pe=w.context,fe=pe.gl,we=w.depthModeForSublayer(0,Ri.ReadOnly),ue=Ki.disabled,Oe=w.colorModeForRenderPass(),Xe=[];for(let Te=0;TeTe.sortKey-Ue.sortKey);for(const Te of Xe){const{programConfiguration:Ue,program:it,layoutVertexBuffer:rt,indexBuffer:ut,uniformValues:xt,terrainData:yt}=Te.state;it.draw(pe,fe.TRIANGLES,we,ue,Oe,er.disabled,xt,yt,A.id,rt,ut,Te.segments,A.paint,w.transform.zoom,Ue)}})(t,c,d,g);break;case"heatmap":(function(w,k,A,L){if(A.paint.get("heatmap-opacity")!==0)if(w.renderPass==="offscreen"){const O=w.context,U=O.gl,V=Ki.disabled,J=new mi([U.ONE,U.ONE],n.Color.transparent,[!0,!0,!0,!0]);(function(pe,fe,we){const ue=pe.gl;pe.activeTexture.set(ue.TEXTURE1),pe.viewport.set([0,0,fe.width/4,fe.height/4]);let Oe=we.heatmapFbo;if(Oe)ue.bindTexture(ue.TEXTURE_2D,Oe.colorAttachment.get()),pe.bindFramebuffer.set(Oe.framebuffer);else{const Xe=ue.createTexture();ue.bindTexture(ue.TEXTURE_2D,Xe),ue.texParameteri(ue.TEXTURE_2D,ue.TEXTURE_WRAP_S,ue.CLAMP_TO_EDGE),ue.texParameteri(ue.TEXTURE_2D,ue.TEXTURE_WRAP_T,ue.CLAMP_TO_EDGE),ue.texParameteri(ue.TEXTURE_2D,ue.TEXTURE_MIN_FILTER,ue.LINEAR),ue.texParameteri(ue.TEXTURE_2D,ue.TEXTURE_MAG_FILTER,ue.LINEAR),Oe=we.heatmapFbo=pe.createFramebuffer(fe.width/4,fe.height/4,!1,!1),function(Te,Ue,it,rt){var ut,xt;const yt=Te.gl,It=(ut=Te.HALF_FLOAT)!==null&&ut!==void 0?ut:yt.UNSIGNED_BYTE,Gt=(xt=Te.RGBA16F)!==null&&xt!==void 0?xt:yt.RGBA;yt.texImage2D(yt.TEXTURE_2D,0,Gt,Ue.width/4,Ue.height/4,0,yt.RGBA,It,null),rt.colorAttachment.set(it)}(pe,fe,Xe,Oe)}})(O,w,A),O.clear({color:n.Color.transparent});for(let pe=0;pe{const Te=n.create();n.ortho(Te,0,we.width,we.height,0,0,1);const Ue=we.context.gl;return{u_matrix:Te,u_world:[Ue.drawingBufferWidth,Ue.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:ue.paint.get("heatmap-opacity")}})(O,U),null,U.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,U.paint,O.transform.zoom)}(w,A))})(t,c,d,g);break;case"line":(function(w,k,A,L){if(w.renderPass!=="translucent")return;const O=A.paint.get("line-opacity"),U=A.paint.get("line-width");if(O.constantOr(1)===0||U.constantOr(1)===0)return;const V=w.depthModeForSublayer(0,Ri.ReadOnly),J=w.colorModeForRenderPass(),pe=A.paint.get("line-dasharray"),fe=A.paint.get("line-pattern"),we=fe.constantOr(1),ue=A.paint.get("line-gradient"),Oe=A.getCrossfadeParameters(),Xe=we?"linePattern":pe?"lineSDF":ue?"lineGradient":"line",Te=w.context,Ue=Te.gl;let it=!0;for(const rt of L){const ut=k.getTile(rt);if(we&&!ut.patternsLoaded())continue;const xt=ut.getBucket(A);if(!xt)continue;const yt=xt.programConfigurations.get(A.id),It=w.context.program.get(),Gt=w.useProgram(Xe,yt),Mi=it||Gt.program!==It,Dt=w.style.map.terrain&&w.style.map.terrain.getTerrainData(rt),ui=fe.constantOr(null);if(ui&&ut.imageAtlas){const xi=ut.imageAtlas,Ei=xi.patternPositions[ui.to.toString()],Di=xi.patternPositions[ui.from.toString()];Ei&&Di&&yt.setConstantPatternPositions(Ei,Di)}const Kt=Dt?rt:null,rr=we?Oc(w,ut,A,Oe,Kt):pe?dh(w,ut,A,pe,Oe,Kt):ue?fh(w,ut,A,xt.lineClipsArray.length,Kt):xa(w,ut,A,Kt);if(we)Te.activeTexture.set(Ue.TEXTURE0),ut.imageAtlasTexture.bind(Ue.LINEAR,Ue.CLAMP_TO_EDGE),yt.updatePaintBuffers(Oe);else if(pe&&(Mi||w.lineAtlas.dirty))Te.activeTexture.set(Ue.TEXTURE0),w.lineAtlas.bind(Te);else if(ue){const xi=xt.gradients[A.id];let Ei=xi.texture;if(A.gradientVersion!==xi.version){let Di=256;if(A.stepInterpolant){const gr=k.getSource().maxzoom,Xi=rt.canonical.z===gr?Math.ceil(1<0?c.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const c=this.imageManager.getPattern(t.from.toString()),d=this.imageManager.getPattern(t.to.toString());return!c||!d}useProgram(t,c){this.cache=this.cache||{};const d=t+(c?c.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new mr(this.context,vn[t],c,Rn[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}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 ze(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:c}=this.context.gl;return this.width!==t||this.height!==c}}class os{constructor(t,c){this.points=t,this.planes=c}static fromInvProjectionMatrix(t,c,d){const g=Math.pow(2,d),w=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(A=>{const L=1/(A=n.transformMat4([],A,t))[3]/c*g;return n.mul$1(A,A,[L,L,1/A[3],L])}),k=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(A=>{const L=function(J,pe){var fe=pe[0],we=pe[1],ue=pe[2],Oe=fe*fe+we*we+ue*ue;return Oe>0&&(Oe=1/Math.sqrt(Oe)),J[0]=pe[0]*Oe,J[1]=pe[1]*Oe,J[2]=pe[2]*Oe,J}([],function(J,pe,fe){var we=pe[0],ue=pe[1],Oe=pe[2],Xe=fe[0],Te=fe[1],Ue=fe[2];return J[0]=ue*Ue-Oe*Te,J[1]=Oe*Xe-we*Ue,J[2]=we*Te-ue*Xe,J}([],se([],w[A[0]],w[A[1]]),se([],w[A[2]],w[A[1]]))),O=-((U=L)[0]*(V=w[A[1]])[0]+U[1]*V[1]+U[2]*V[2]);var U,V;return L.concat(O)});return new os(w,k)}}class Qr{constructor(t,c){this.min=t,this.max=c,this.center=function(d,g,w){return d[0]=.5*g[0],d[1]=.5*g[1],d[2]=.5*g[2],d}([],function(d,g,w){return d[0]=g[0]+w[0],d[1]=g[1]+w[1],d[2]=g[2]+w[2],d}([],this.min,this.max))}quadrant(t){const c=[t%2==0,t<2],d=ee(this.min),g=ee(this.max);for(let w=0;w=0&&k++;if(k===0)return 0;k!==c.length&&(d=!1)}if(d)return 2;for(let g=0;g<3;g++){let w=Number.MAX_VALUE,k=-Number.MAX_VALUE;for(let A=0;Athis.max[g]-this.min[g])return 0}return 1}}class Ta{constructor(t=0,c=0,d=0,g=0){if(isNaN(t)||t<0||isNaN(c)||c<0||isNaN(d)||d<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=c,this.left=d,this.right=g}interpolate(t,c,d){return c.top!=null&&t.top!=null&&(this.top=n.interpolate.number(t.top,c.top,d)),c.bottom!=null&&t.bottom!=null&&(this.bottom=n.interpolate.number(t.bottom,c.bottom,d)),c.left!=null&&t.left!=null&&(this.left=n.interpolate.number(t.left,c.left,d)),c.right!=null&&t.right!=null&&(this.right=n.interpolate.number(t.right,c.right,d)),this}getCenter(t,c){const d=n.clamp((this.left+t-this.right)/2,0,t),g=n.clamp((this.top+c-this.bottom)/2,0,c);return new n.Point(d,g)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Ta(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Ca{constructor(t,c,d,g,w){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=w===void 0||!!w,this._minZoom=t||0,this._maxZoom=c||22,this._minPitch=d??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new n.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ta,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new Ca(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._minEleveationForCurrentTile=t._minEleveationForCurrentTile,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 n.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const c=-n.wrap(t,-180,180)*Math.PI/180;this.angle!==c&&(this._unmodified=!1,this.angle=c,this._calcMatrices(),this.rotationMatrix=function(){var d=new n.ARRAY_TYPE(4);return n.ARRAY_TYPE!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,g,w){var k=g[0],A=g[1],L=g[2],O=g[3],U=Math.sin(w),V=Math.cos(w);d[0]=k*V+L*U,d[1]=A*V+O*U,d[2]=k*-U+L*V,d[3]=A*-U+O*V}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const c=n.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==c&&(this._unmodified=!1,this._pitch=c,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 c=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==c&&(this._unmodified=!1,this._zoom=c,this.tileZoom=Math.max(0,Math.floor(c)),this.scale=this.zoomScale(c),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,c,d){this._unmodified=!1,this._edgeInsets.interpolate(t,c,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const c=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,c)}getVisibleUnwrappedCoordinates(t){const c=[new n.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const d=this.pointCoordinate(new n.Point(0,0)),g=this.pointCoordinate(new n.Point(this.width,0)),w=this.pointCoordinate(new n.Point(this.width,this.height)),k=this.pointCoordinate(new n.Point(0,this.height)),A=Math.floor(Math.min(d.x,g.x,w.x,k.x)),L=Math.floor(Math.max(d.x,g.x,w.x,k.x)),O=1;for(let U=A-O;U<=L+O;U++)U!==0&&c.push(new n.UnwrappedTileID(U,t))}return c}coveringTiles(t){var c,d;let g=this.coveringZoomLevel(t);const w=g;if(t.minzoom!==void 0&&gt.maxzoom&&(g=t.maxzoom);const k=this.pointCoordinate(this.getCameraPoint()),A=n.MercatorCoordinate.fromLngLat(this.center),L=Math.pow(2,g),O=[L*k.x,L*k.y,0],U=[L*A.x,L*A.y,0],V=os.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let J=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(J=g);const pe=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,fe=Te=>({aabb:new Qr([Te*L,0,0],[(Te+1)*L,L,0]),zoom:0,x:0,y:0,wrap:Te,fullyVisible:!1}),we=[],ue=[],Oe=g,Xe=t.reparseOverscaled?w:g;if(this._renderWorldCopies)for(let Te=1;Te<=3;Te++)we.push(fe(-Te)),we.push(fe(Te));for(we.push(fe(0));we.length>0;){const Te=we.pop(),Ue=Te.x,it=Te.y;let rt=Te.fullyVisible;if(!rt){const Gt=Te.aabb.intersects(V);if(Gt===0)continue;rt=Gt===2}const ut=t.terrain?O:U,xt=Te.aabb.distanceX(ut),yt=Te.aabb.distanceY(ut),It=Math.max(Math.abs(xt),Math.abs(yt));if(Te.zoom===Oe||It>pe+(1<=J){const Gt=Oe-Te.zoom,Mi=O[0]-.5-(Ue<>1),ui=Te.zoom+1;let Kt=Te.aabb.quadrant(Gt);if(t.terrain){const rr=new n.OverscaledTileID(ui,Te.wrap,ui,Mi,Dt),xi=t.terrain.getMinMaxElevation(rr),Ei=(c=xi.minElevation)!==null&&c!==void 0?c:this.elevation,Di=(d=xi.maxElevation)!==null&&d!==void 0?d:this.elevation;Kt=new Qr([Kt.min[0],Kt.min[1],Ei],[Kt.max[0],Kt.max[1],Di])}we.push({aabb:Kt,zoom:ui,x:Mi,y:Dt,wrap:Te.wrap,fullyVisible:rt})}}return ue.sort((Te,Ue)=>Te.distanceSq-Ue.distanceSq).map(Te=>Te.tileID)}resize(t,c){this.width=t,this.height=c,this.pixelsToGLUnits=[2/t,-2/c],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 c=n.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new n.Point(n.mercatorXfromLng(t.lng)*this.worldSize,n.mercatorYfromLat(c)*this.worldSize)}unproject(t){return new n.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const c=this.pointLocation(this.centerPoint,t),d=t.getElevationForLngLatZoom(c,this.tileZoom);if(!(this.elevation-d))return;const g=this.getCameraPosition(),w=n.MercatorCoordinate.fromLngLat(g.lngLat,g.altitude),k=n.MercatorCoordinate.fromLngLat(c,d),A=w.x-k.x,L=w.y-k.y,O=w.z-k.z,U=Math.sqrt(A*A+L*L+O*O),V=this.scaleZoom(this.cameraToCenterDistance/U/this.tileSize);this._elevation=d,this._center=c,this.zoom=V}setLocationAtPoint(t,c){const d=this.pointCoordinate(c),g=this.pointCoordinate(this.centerPoint),w=this.locationCoordinate(t),k=new n.MercatorCoordinate(w.x-(d.x-g.x),w.y-(d.y-g.y));this.center=this.coordinateLocation(k),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,c){return c?this.coordinatePoint(this.locationCoordinate(t),c.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,c){return this.coordinateLocation(this.pointCoordinate(t,c))}locationCoordinate(t){return n.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,c){if(c){const J=c.pointCoordinate(t);if(J!=null)return J}const d=[t.x,t.y,0,1],g=[t.x,t.y,1,1];n.transformMat4(d,d,this.pixelMatrixInverse),n.transformMat4(g,g,this.pixelMatrixInverse);const w=d[3],k=g[3],A=d[1]/w,L=g[1]/k,O=d[2]/w,U=g[2]/k,V=O===U?0:(0-O)/(U-O);return new n.MercatorCoordinate(n.interpolate.number(d[0]/w,g[0]/k,V)/this.worldSize,n.interpolate.number(A,L,V)/this.worldSize)}coordinatePoint(t,c=0,d=this.pixelMatrix){const g=[t.x*this.worldSize,t.y*this.worldSize,c,1];return n.transformMat4(g,g,d),new n.Point(g[0]/g[3],g[1]/g[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new Me().extend(this.pointLocation(new n.Point(0,t))).extend(this.pointLocation(new n.Point(this.width,t))).extend(this.pointLocation(new n.Point(this.width,this.height))).extend(this.pointLocation(new n.Point(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Me([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,c=!1){const d=t.key,g=c?this._alignedPosMatrixCache:this._posMatrixCache;if(g[d])return g[d];const w=t.canonical,k=this.worldSize/this.zoomScale(w.z),A=w.x+Math.pow(2,w.z)*t.wrap,L=n.identity(new Float64Array(16));return n.translate(L,L,[A*k,w.y*k,0]),n.scale(L,L,[k/n.EXTENT,k/n.EXTENT,1]),n.multiply(L,c?this.alignedProjMatrix:this.projMatrix,L),g[d]=new Float32Array(L),g[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,c,d,g,w=-90,k=90,A=-180,L=180;const O=this.size,U=this._unmodified;if(this.latRange){const pe=this.latRange;w=n.mercatorYfromLat(pe[1])*this.worldSize,k=n.mercatorYfromLat(pe[0])*this.worldSize,t=k-wk&&(g=k-fe)}if(this.lngRange){const pe=(A+L)/2,fe=n.wrap(V.x,pe-this.worldSize/2,pe+this.worldSize/2),we=O.x/2;fe-weL&&(d=L-we)}d===void 0&&g===void 0||(this.center=this.unproject(new n.Point(d!==void 0?d:V.x,g!==void 0?g:V.y)).wrap()),this._unmodified=U,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,c=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=n.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let g=n.identity(new Float64Array(16));n.scale(g,g,[this.width/2,-this.height/2,1]),n.translate(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=n.identity(new Float64Array(16)),n.scale(g,g,[1,-1,1]),n.translate(g,g,[-1,-1,0]),n.scale(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const w=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),k=Math.min(this.elevation,this._minEleveationForCurrentTile),A=w-k*this._pixelPerMeter/Math.cos(this._pitch),L=k<0?A:w,O=Math.PI/2+this._pitch,U=this._fov*(.5+t.y/this.height),V=Math.sin(U)*L/Math.sin(n.clamp(Math.PI-O-U,.01,Math.PI-.01)),J=this.getHorizon(),pe=2*Math.atan(J/this.cameraToCenterDistance)*(.5+t.y/(2*J)),fe=Math.sin(pe)*L/Math.sin(n.clamp(Math.PI-O-pe,.01,Math.PI-.01)),we=Math.min(V,fe),ue=1.01*(Math.cos(Math.PI/2-this._pitch)*we+L),Oe=this.height/50;g=new Float64Array(16),n.perspective(g,this._fov,this.width/this.height,Oe,ue),g[8]=2*-t.x/this.width,g[9]=2*t.y/this.height,n.scale(g,g,[1,-1,1]),n.translate(g,g,[0,0,-this.cameraToCenterDistance]),n.rotateX(g,g,this._pitch),n.rotateZ(g,g,this.angle),n.translate(g,g,[-c,-d,0]),this.mercatorMatrix=n.scale([],g,[this.worldSize,this.worldSize,this.worldSize]),n.scale(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=n.multiply(new Float64Array(16),this.labelPlaneMatrix,g),n.translate(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=n.invert([],g),this.pixelMatrix3D=n.multiply(new Float64Array(16),this.labelPlaneMatrix,g);const Xe=this.width%2/2,Te=this.height%2/2,Ue=Math.cos(this.angle),it=Math.sin(this.angle),rt=c-Math.round(c)+Ue*Xe+it*Te,ut=d-Math.round(d)+Ue*Te+it*Xe,xt=new Float64Array(g);if(n.translate(xt,xt,[rt>.5?rt-1:rt,ut>.5?ut-1:ut,0]),this.alignedProjMatrix=xt,g=n.invert(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new n.Point(0,0)),c=[t.x*this.worldSize,t.y*this.worldSize,0,1];return n.transformMat4(c,c,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new n.Point(0,t))}getCameraQueryGeometry(t){const c=this.getCameraPoint();if(t.length===1)return[t[0],c];{let d=c.x,g=c.y,w=c.x,k=c.y;for(const A of t)d=Math.min(d,A.x),g=Math.min(g,A.y),w=Math.max(w,A.x),k=Math.max(k,A.y);return[new n.Point(d,g),new n.Point(w,g),new n.Point(w,k),new n.Point(d,k),new n.Point(d,g)]}}}function Al(y,t){let c,d=!1,g=null,w=null;const k=()=>{g=null,d&&(y.apply(w,c),g=setTimeout(k,t),d=!1)};return(...A)=>(d=!0,w=this,c=A,g||k(),g)}class ea{constructor(t){this._getCurrentHash=()=>{const c=window.location.hash.replace("#","");if(this._hashName){let d;return c.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(d=g)}),(d&&d[1]||"").split("/")}return c.split("/")},this._onHashChange=()=>{const c=this._getCurrentHash();if(c.length>=3&&!c.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(c[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+c[2],+c[1]],zoom:+c[0],bearing:d,pitch:+(c[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const c=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,c)}catch{}},this._updateHash=Al(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const c=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,g=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),w=Math.pow(10,g),k=Math.round(c.lng*w)/w,A=Math.round(c.lat*w)/w,L=this._map.getBearing(),O=this._map.getPitch();let U="";if(U+=t?`/${k}/${A}/${d}`:`${d}/${A}/${k}`,(L||O)&&(U+="/"+Math.round(10*L)/10),O&&(U+=`/${Math.round(O)}`),this._hashName){const V=this._hashName;let J=!1;const pe=window.location.hash.slice(1).split("&").map(fe=>{const we=fe.split("=")[0];return we===V?(J=!0,`${we}=${U}`):fe}).filter(fe=>fe);return J||pe.push(`${V}=${U}`),`#${pe.join("&")}`}return`#${U}`}}const ws={linearity:.3,easing:n.bezier(0,0,.3,1)},Pl=n.extend({deceleration:2500,maxSpeed:1400},ws),Hc=n.extend({deceleration:20,maxSpeed:1400},ws),Kc=n.extend({deceleration:1e3,maxSpeed:360},ws),Xc=n.extend({deceleration:1e3,maxSpeed:90},ws);class Jc{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:n.browser.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,c=n.browser.now();for(;t.length>0&&c-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const c={zoom:0,bearing:0,pitch:0,pan:new n.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:w}of this._inertiaBuffer)c.zoom+=w.zoomDelta||0,c.bearing+=w.bearingDelta||0,c.pitch+=w.pitchDelta||0,w.panDelta&&c.pan._add(w.panDelta),w.around&&(c.around=w.around),w.pinchAround&&(c.pinchAround=w.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(c.pan.mag()){const w=Wn(c.pan.mag(),d,n.extend({},Pl,t||{}));g.offset=c.pan.mult(w.amount/c.pan.mag()),g.center=this._map.transform.center,Ia(g,w)}if(c.zoom){const w=Wn(c.zoom,d,Hc);g.zoom=this._map.transform.zoom+w.amount,Ia(g,w)}if(c.bearing){const w=Wn(c.bearing,d,Kc);g.bearing=this._map.transform.bearing+n.clamp(w.amount,-179,179),Ia(g,w)}if(c.pitch){const w=Wn(c.pitch,d,Xc);g.pitch=this._map.transform.pitch+w.amount,Ia(g,w)}if(g.zoom||g.bearing){const w=c.pinchAround===void 0?c.around:c.pinchAround;g.around=w?this._map.unproject(w):this._map.getCenter()}return this.clear(),n.extend(g,{noMoveStart:!0})}}function Ia(y,t){(!y.duration||y.durationc.unproject(L)),A=w.reduce((L,O,U,V)=>L.add(O.div(V.length)),new n.Point(0,0));super(t,{points:w,point:A,lngLats:k,lngLat:c.unproject(A),originalEvent:d}),this._defaultPrevented=!1}}class Yc extends n.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,c,d){super(t,{originalEvent:d}),this._defaultPrevented=!1}}class Qc{constructor(t,c){this._map=t,this._clickTolerance=c.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Yc(t.type,this._map,t))}mousedown(t,c){return this._mousedownPos=c,this._firePreventable(new xn(t.type,this._map,t))}mouseup(t){this._map.fire(new xn(t.type,this._map,t))}click(t,c){this._mousedownPos&&this._mousedownPos.dist(c)>=this._clickTolerance||this._map.fire(new xn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new xn(t.type,this._map,t))}mouseover(t){this._map.fire(new xn(t.type,this._map,t))}mouseout(t){this._map.fire(new xn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Aa(t.type,this._map,t))}touchmove(t){this._map.fire(new Aa(t.type,this._map,t))}touchend(t){this._map.fire(new Aa(t.type,this._map,t))}touchcancel(t){this._map.fire(new Aa(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class eu{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new xn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new xn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new xn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ta{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(n.Point.convert(t),this._map.terrain)}}class Pa{constructor(t,c){this._map=t,this._tr=new ta(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=c.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,c){this.isEnabled()&&t.shiftKey&&t.button===0&&(v.disableDrag(),this._startPos=this._lastPos=c,this._active=!0)}mousemoveWindow(t,c){if(!this._active)return;const d=c;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)w.fitScreenCoordinates(d,g,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&&(v.remove(this._box),this._box=null),v.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,c){return this._map.fire(new n.Event(t,{originalEvent:c}))}}function Eo(y,t){if(y.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${t.length}`);const c={};for(let d=0;dthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),d.length===this.numTouches&&(this.centroid=function(g){const w=new n.Point(0,0);for(const k of g)w._add(k);return w.div(g.length)}(c),this.touches=Eo(d,c)))}touchmove(t,c,d){if(this.aborted||!this.centroid)return;const g=Eo(d,c);for(const w in this.touches){const k=g[w];(!k||k.dist(this.touches[w])>30)&&(this.aborted=!0)}}touchend(t,c,d){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class Un{constructor(t){this.singleTap=new Hn(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,c,d){this.singleTap.touchstart(t,c,d)}touchmove(t,c,d){this.singleTap.touchmove(t,c,d)}touchend(t,c,d){const g=this.singleTap.touchend(t,c,d);if(g){const w=t.timeStamp-this.lastTime<500,k=!this.lastTap||this.lastTap.dist(g)<30;if(w&&k||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class tu{constructor(t){this._tr=new ta(t),this._zoomIn=new Un({numTouches:1,numTaps:2}),this._zoomOut=new Un({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,c,d){this._zoomIn.touchstart(t,c,d),this._zoomOut.touchstart(t,c,d)}touchmove(t,c,d){this._zoomIn.touchmove(t,c,d),this._zoomOut.touchmove(t,c,d)}touchend(t,c,d){const g=this._zoomIn.touchend(t,c,d),w=this._zoomOut.touchend(t,c,d),k=this._tr;return g?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:A=>A.easeTo({duration:300,zoom:k.zoom+1,around:k.unproject(g)},{originalEvent:t})}):w?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:A=>A.easeTo({duration:300,zoom:k.zoom-1,around:k.unproject(w)},{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 Sn{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 c=this._moveFunction(...t);if(c.bearingDelta||c.pitchDelta||c.around||c.panDelta)return this._active=!0,c}dragStart(t,c){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=c.length?c[0]:c,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,c){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const g=c.length?c[0]:c;return!this._moved&&g.dist(d){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(t){t.preventDefault()}},Dl=({enable:y,clickTolerance:t,bearingDegreesPerPixelMoved:c=.8})=>{const d=new zl({checkCorrectEvent:g=>v.mouseButton(g)===0&&g.ctrlKey||v.mouseButton(g)===2});return new Sn({clickTolerance:t,move:(g,w)=>({bearingDelta:(w.x-g.x)*c}),moveStateManager:d,enable:y,assignEvents:Ml})},ia=({enable:y,clickTolerance:t,pitchDegreesPerPixelMoved:c=-.5})=>{const d=new zl({checkCorrectEvent:g=>v.mouseButton(g)===0&&g.ctrlKey||v.mouseButton(g)===2});return new Sn({clickTolerance:t,move:(g,w)=>({pitchDelta:(w.y-g.y)*c}),moveStateManager:d,enable:y,assignEvents:Ml})};class xs{constructor(t,c){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=c,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new n.Point(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,c,d){return this._calculateTransform(t,c,d)}touchmove(t,c,d){if(this._map._cooperativeGestures&&(this._minTouches===2&&d.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,d.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(d.length0&&(this._active=!0);const g=Eo(d,c),w=new n.Point(0,0),k=new n.Point(0,0);let A=0;for(const O in g){const U=g[O],V=this._touches[O];V&&(w._add(U),k._add(U.sub(V)),A++,g[O]=U)}if(this._touches=g,AMath.abs(y.x)}class Eh extends $t{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,c,d){super.touchstart(t,c,d),this._currentTouchCount=d.length}_start(t){this._lastPoints=t,La(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,c,d){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const g=t[0].sub(this._lastPoints[0]),w=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,w,d.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(g.y+w.y)/2*-.5}):void 0}gestureBeginsVertically(t,c,d){if(this._valid!==void 0)return this._valid;const g=t.mag()>=2,w=c.mag()>=2;if(!g&&!w)return;if(!g||!w)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const k=t.y>0==c.y>0;return La(t)&&La(c)&&k}}const kh={panStep:100,bearingStep:15,pitchStep:10};class Rl{constructor(t){this._tr=new ta(t);const c=kh;this._panStep=c.panStep,this._bearingStep=c.bearingStep,this._pitchStep=c.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let c=0,d=0,g=0,w=0,k=0;switch(t.keyCode){case 61:case 107:case 171:case 187:c=1;break;case 189:case 109:case 173:c=-1;break;case 37:t.shiftKey?d=-1:(t.preventDefault(),w=-1);break;case 39:t.shiftKey?d=1:(t.preventDefault(),w=1);break;case 38:t.shiftKey?g=1:(t.preventDefault(),k=-1);break;case 40:t.shiftKey?g=-1:(t.preventDefault(),k=1);break;default:return}return this._rotationDisabled&&(d=0,g=0),{cameraAnimation:A=>{const L=this._tr;A.easeTo({duration:300,easeId:"keyboardHandler",easing:ru,zoom:c?Math.round(L.zoom)+c*(t.shiftKey?2:1):L.zoom,bearing:L.bearing+d*this._bearingStep,pitch:L.pitch+g*this._pitchStep,offset:[-w*this._panStep,-k*this._panStep],center:L.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 ru(y){return y*(2-y)}const Bl=4.000244140625;class Th{constructor(t,c){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=t,this._tr=new ta(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=c,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||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 c=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const d=n.browser.now(),g=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,c!==0&&c%Bl==0?this._type="wheel":c!==0&&Math.abs(c)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=c,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(g*c)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,c+=this._lastValue)),t.shiftKey&&c&&(c/=4),this._type&&(this._lastWheelEvent=t,this._delta-=c,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const c=v.mousePos(this._el,t),d=this._tr;this._around=n.LngLat.convert(this._aroundCenter?d.center:d.unproject(c)),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const A=this._type==="wheel"&&Math.abs(this._delta)>Bl?this._wheelZoomRate:this._defaultZoomRate;let L=2/(1+Math.exp(-Math.abs(this._delta*A)));this._delta<0&&L!==0&&(L=1/L);const O=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(O*L))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const c=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,d=this._startZoom,g=this._easing;let w,k=!1;if(this._type==="wheel"&&d&&g){const A=Math.min((n.browser.now()-this._lastWheelEventTime)/200,1),L=g(A);w=n.interpolate.number(d,c,L),A<1?this._frameId||(this._frameId=!0):k=!0}else w=c,k=!0;return this._active=!0,k&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!k,zoomDelta:w-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let c=n.defaultEasing;if(this._prevEase){const d=this._prevEase,g=(n.browser.now()-d.start)/d.duration,w=d.easing(g+.01)-d.easing(g),k=.27/Math.sqrt(w*w+1e-4)*.01,A=Math.sqrt(.0729-k*k);c=n.bezier(k,A,.25,1)}return this._prevEase={start:n.browser.now(),duration:t,easing:c},c}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ch{constructor(t,c){this._clickZoom=t,this._tapZoom=c}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 Ol{constructor(t){this._tr=new ta(t),this.reset()}reset(){this._active=!1}dblclick(t,c){return t.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(c)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fl{constructor(){this._tap=new Un({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,c,d){if(!this._swipePoint)if(this._tapTime){const g=c[0],w=t.timeStamp-this._tapTime<500,k=this._tapPoint.dist(g)<30;w&&k?d.length>0&&(this._swipePoint=g,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(t,c,d)}touchmove(t,c,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const g=c[0],w=g.y-this._swipePoint.y;return this._swipePoint=g,t.preventDefault(),this._active=!0,{zoomDelta:w/128}}}else this._tap.touchmove(t,c,d)}touchend(t,c,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const g=this._tap.touchend(t,c,d);g&&(this._tapTime=t.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Nl{constructor(t,c,d){this._el=t,this._mousePan=c,this._touchPan=d}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 Ul{constructor(t,c,d){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=c,this._mousePitch=d}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 hn{constructor(t,c,d,g){this._el=t,this._touchZoom=c,this._touchRotate=d,this._tapDragZoom=g,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 Vn=y=>y.zoom||y.drag||y.pitch||y.rotate;class nu extends n.Event{}function Ra(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Vl{constructor(t,c){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,w)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const k=g.type==="renderFrame"?void 0:g,A={needsRenderFrame:!1},L={},O={},U=g.touches,V=U?this._getMapTouches(U):void 0,J=V?v.touchPos(this._el,V):v.mousePos(this._el,g);for(const{handlerName:we,handler:ue,allowed:Oe}of this._handlers){if(!ue.isEnabled())continue;let Xe;this._blockedByActive(O,Oe,we)?ue.reset():ue[w||g.type]&&(Xe=ue[w||g.type](g,J,V),this.mergeHandlerResult(A,L,Xe,we,k),Xe&&Xe.needsRenderFrame&&this._triggerRenderFrame()),(Xe||ue.isActive())&&(O[we]=ue)}const pe={};for(const we in this._previousActiveHandlers)O[we]||(pe[we]=k);this._previousActiveHandlers=O,(Object.keys(pe).length||Ra(A))&&(this._changes.push([A,L,pe]),this._triggerRenderFrame()),(Object.keys(O).length||Ra(A))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:fe}=A;fe&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],fe(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Jc(t),this._bearingSnap=c.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(c);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,w,k]of this._listeners)v.addEventListener(g,w,g===document?this.handleWindowEvent:this.handleEvent,k)}destroy(){for(const[t,c,d]of this._listeners)v.removeEventListener(t,c,t===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(t){const c=this._map,d=c.getCanvasContainer();this._add("mapEvent",new Qc(c,t));const g=c.boxZoom=new Pa(c,t);this._add("boxZoom",g),t.interactive&&t.boxZoom&&g.enable();const w=new tu(c),k=new Ol(c);c.doubleClickZoom=new Ch(k,w),this._add("tapZoom",w),this._add("clickZoom",k),t.interactive&&t.doubleClickZoom&&c.doubleClickZoom.enable();const A=new Fl;this._add("tapDragZoom",A);const L=c.touchPitch=new Eh(c);this._add("touchPitch",L),t.interactive&&t.touchPitch&&c.touchPitch.enable(t.touchPitch);const O=Dl(t),U=ia(t);c.dragRotate=new Ul(t,O,U),this._add("mouseRotate",O,["mousePitch"]),this._add("mousePitch",U,["mouseRotate"]),t.interactive&&t.dragRotate&&c.dragRotate.enable();const V=(({enable:Oe,clickTolerance:Xe})=>{const Te=new zl({checkCorrectEvent:Ue=>v.mouseButton(Ue)===0&&!Ue.ctrlKey});return new Sn({clickTolerance:Xe,move:(Ue,it)=>({around:it,panDelta:it.sub(Ue)}),activateOnStart:!0,moveStateManager:Te,enable:Oe,assignEvents:Ml})})(t),J=new xs(t,c);c.dragPan=new Nl(d,V,J),this._add("mousePan",V),this._add("touchPan",J,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&c.dragPan.enable(t.dragPan);const pe=new Nt,fe=new Da;c.touchZoomRotate=new hn(d,fe,pe,A),this._add("touchRotate",pe,["touchPan","touchZoom"]),this._add("touchZoom",fe,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&c.touchZoomRotate.enable(t.touchZoomRotate);const we=c.scrollZoom=new Th(c,()=>this._triggerRenderFrame());this._add("scrollZoom",we,["mousePan"]),t.interactive&&t.scrollZoom&&c.scrollZoom.enable(t.scrollZoom);const ue=c.keyboard=new Rl(c);this._add("keyboard",ue),t.interactive&&t.keyboard&&c.keyboard.enable(),this._add("blockableMapEvent",new eu(c))}_add(t,c,d){this._handlers.push({handlerName:t,handler:c,allowed:d}),this._handlersById[t]=c}stop(t){if(!this._updatingCamera){for(const{handler:c}of this._handlers)c.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!!Vn(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,c,d){for(const g in t)if(g!==d&&(!c||c.indexOf(g)<0))return!0;return!1}_getMapTouches(t){const c=[];for(const d of t)this._el.contains(d.target)&&c.push(d);return c}mergeHandlerResult(t,c,d,g,w){if(!d)return;n.extend(t,d);const k={handlerName:g,originalEvent:d.originalEvent||w};d.zoomDelta!==void 0&&(c.zoom=k),d.panDelta!==void 0&&(c.drag=k),d.pitchDelta!==void 0&&(c.pitch=k),d.bearingDelta!==void 0&&(c.rotate=k)}_applyChanges(){const t={},c={},d={};for(const[g,w,k]of this._changes)g.panDelta&&(t.panDelta=(t.panDelta||new n.Point(0,0))._add(g.panDelta)),g.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(t.around=g.around),g.pinchAround!==void 0&&(t.pinchAround=g.pinchAround),g.noInertia&&(t.noInertia=g.noInertia),n.extend(c,w),n.extend(d,k);this._updateMapTransform(t,c,d),this._changes=[]}_updateMapTransform(t,c,d){const g=this._map,w=g._getTransformForUpdate(),k=g.terrain;if(!(Ra(t)||k&&this._terrainMovement))return this._fireEvents(c,d,!0);let{panDelta:A,zoomDelta:L,bearingDelta:O,pitchDelta:U,around:V,pinchAround:J}=t;J!==void 0&&(V=J),g._stop(!0),V=V||g.transform.centerPoint;const pe=w.pointLocation(A?V.sub(A):V);O&&(w.bearing+=O),U&&(w.pitch+=U),L&&(w.zoom+=L),k?this._terrainMovement||!c.drag&&!c.zoom?c.drag&&this._terrainMovement?w.center=w.pointLocation(w.centerPoint.sub(A)):w.setLocationAtPoint(pe,V):(this._terrainMovement=!0,this._map._elevationFreeze=!0,w.setLocationAtPoint(pe,V),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,w.recalculateZoom(g.terrain)})):w.setLocationAtPoint(pe,V),g._applyUpdatedTransform(w),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(c,d,!0)}_fireEvents(t,c,d){const g=Vn(this._eventsInProgress),w=Vn(t),k={};for(const U in t){const{originalEvent:V}=t[U];this._eventsInProgress[U]||(k[`${U}start`]=V),this._eventsInProgress[U]=t[U]}!g&&w&&this._fireEvent("movestart",w.originalEvent);for(const U in k)this._fireEvent(U,k[U]);w&&this._fireEvent("move",w.originalEvent);for(const U in t){const{originalEvent:V}=t[U];this._fireEvent(U,V)}const A={};let L;for(const U in this._eventsInProgress){const{handlerName:V,originalEvent:J}=this._eventsInProgress[U];this._handlersById[V].isActive()||(delete this._eventsInProgress[U],L=c[V]||J,A[`${U}end`]=L)}for(const U in A)this._fireEvent(U,A[U]);const O=Vn(this._eventsInProgress);if(d&&(g||w)&&!O){this._updatingCamera=!0;const U=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),V=J=>J!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new nu("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class $l extends n.Evented{constructor(t,c){super(),this._renderFrameCallback=()=>{const d=Math.min((n.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=c.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new n.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,c){return this.jumpTo({center:t},c)}panBy(t,c,d){return t=n.Point.convert(t).mult(-1),this.panTo(this.transform.center,n.extend({offset:t},c),d)}panTo(t,c,d){return this.easeTo(n.extend({center:t},c),d)}getZoom(){return this.transform.zoom}setZoom(t,c){return this.jumpTo({zoom:t},c),this}zoomTo(t,c,d){return this.easeTo(n.extend({zoom:t},c),d)}zoomIn(t,c){return this.zoomTo(this.getZoom()+1,t,c),this}zoomOut(t,c){return this.zoomTo(this.getZoom()-1,t,c),this}getBearing(){return this.transform.bearing}setBearing(t,c){return this.jumpTo({bearing:t},c),this}getPadding(){return this.transform.padding}setPadding(t,c){return this.jumpTo({padding:t},c),this}rotateTo(t,c,d){return this.easeTo(n.extend({bearing:t},c),d)}resetNorth(t,c){return this.rotateTo(0,n.extend({duration:1e3},t),c),this}resetNorthPitch(t,c){return this.easeTo(n.extend({bearing:0,pitch:0,duration:1e3},t),c),this}snapToNorth(t,c){return Math.abs(this.getBearing()){if(this._zooming&&(d.zoom=n.interpolate.number(g,L,rt)),this._rotating&&(d.bearing=n.interpolate.number(w,O,rt)),this._pitching&&(d.pitch=n.interpolate.number(k,U,rt)),this._padding&&(d.interpolatePadding(A,V,rt),pe=d.centerPoint.add(J)),this.terrain&&!t.freezeElevation&&this._updateElevation(rt),Te)d.setLocationAtPoint(Te,Ue);else{const ut=d.zoomScale(d.zoom-g),xt=L>g?Math.min(2,Xe):Math.max(.5,Xe),yt=Math.pow(xt,1-rt),It=d.unproject(ue.add(Oe.mult(rt*yt)).mult(ut));d.setLocationAtPoint(d.renderWorldCopies?It.wrap():It,pe)}this._applyUpdatedTransform(d),this._fireMoveEvents(c)},rt=>{this.terrain&&this._finalizeElevation(),this._afterEase(c,rt)},t),this}_prepareEase(t,c,d={}){this._moving=!0,c||d.moving||this.fire(new n.Event("movestart",t)),this._zooming&&!d.zooming&&this.fire(new n.Event("zoomstart",t)),this._rotating&&!d.rotating&&this.fire(new n.Event("rotatestart",t)),this._pitching&&!d.pitching&&this.fire(new n.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const c=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&c!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(d-(c-(d*t+this._elevationStart))/(1-t)),this._elevationTarget=c}this.transform.elevation=n.interpolate.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!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 c=t.clone(),{center:d,zoom:g,pitch:w,bearing:k,elevation:A}=this.transformCameraUpdate(c);d&&(c.center=d),g!==void 0&&(c.zoom=g),w!==void 0&&(c.pitch=w),k!==void 0&&(c.bearing=k),A!==void 0&&(c.elevation=A),this.transform.apply(c)}_fireMoveEvents(t){this.fire(new n.Event("move",t)),this._zooming&&this.fire(new n.Event("zoom",t)),this._rotating&&this.fire(new n.Event("rotate",t)),this._pitching&&this.fire(new n.Event("pitch",t))}_afterEase(t,c){if(this._easeId&&c&&this._easeId===c)return;delete this._easeId;const d=this._zooming,g=this._rotating,w=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new n.Event("zoomend",t)),g&&this.fire(new n.Event("rotateend",t)),w&&this.fire(new n.Event("pitchend",t)),this.fire(new n.Event("moveend",t))}flyTo(t,c){if(!t.essential&&n.browser.prefersReducedMotion){const Kt=n.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Kt,c)}this.stop(),t=n.extend({offset:[0,0],speed:1.2,curve:1.42,easing:n.defaultEasing},t);const d=this._getTransformForUpdate(),g=this.getZoom(),w=this.getBearing(),k=this.getPitch(),A=this.getPadding(),L="zoom"in t?n.clamp(+t.zoom,d.minZoom,d.maxZoom):g,O="bearing"in t?this._normalizeBearing(t.bearing,w):w,U="pitch"in t?+t.pitch:k,V="padding"in t?t.padding:d.padding,J=d.zoomScale(L-g),pe=n.Point.convert(t.offset);let fe=d.centerPoint.add(pe);const we=d.pointLocation(fe),ue=n.LngLat.convert(t.center||we);this._normalizeCenter(ue);const Oe=d.project(we),Xe=d.project(ue).sub(Oe);let Te=t.curve;const Ue=Math.max(d.width,d.height),it=Ue/J,rt=Xe.mag();if("minZoom"in t){const Kt=n.clamp(Math.min(t.minZoom,g,L),d.minZoom,d.maxZoom),rr=Ue/d.zoomScale(Kt-g);Te=Math.sqrt(rr/rt*2)}const ut=Te*Te;function xt(Kt){const rr=(it*it-Ue*Ue+(Kt?-1:1)*ut*ut*rt*rt)/(2*(Kt?it:Ue)*ut*rt);return Math.log(Math.sqrt(rr*rr+1)-rr)}function yt(Kt){return(Math.exp(Kt)-Math.exp(-Kt))/2}function It(Kt){return(Math.exp(Kt)+Math.exp(-Kt))/2}const Gt=xt(!1);let Mi=function(Kt){return It(Gt)/It(Gt+Te*Kt)},Dt=function(Kt){return Ue*((It(Gt)*(yt(rr=Gt+Te*Kt)/It(rr))-yt(Gt))/ut)/rt;var rr},ui=(xt(!0)-Gt)/Te;if(Math.abs(rt)<1e-6||!isFinite(ui)){if(Math.abs(Ue-it)<1e-6)return this.easeTo(t,c);const Kt=itt.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=w!==O,this._pitching=U!==k,this._padding=!d.isPaddingEqual(V),this._prepareEase(c,!1),this.terrain&&this._prepareElevation(ue),this._ease(Kt=>{const rr=Kt*ui,xi=1/Mi(rr);d.zoom=Kt===1?L:g+d.scaleZoom(xi),this._rotating&&(d.bearing=n.interpolate.number(w,O,Kt)),this._pitching&&(d.pitch=n.interpolate.number(k,U,Kt)),this._padding&&(d.interpolatePadding(A,V,Kt),fe=d.centerPoint.add(pe)),this.terrain&&!t.freezeElevation&&this._updateElevation(Kt);const Ei=Kt===1?ue:d.unproject(Oe.add(Xe.mult(Dt(rr))).mult(xi));d.setLocationAtPoint(d.renderWorldCopies?Ei.wrap():Ei,fe),this._applyUpdatedTransform(d),this._fireMoveEvents(c)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(c)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,c){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,c)}if(!t){const d=this.handlers;d&&d.stop(!1)}return this}_ease(t,c,d){d.animate===!1||d.duration===0?(t(1),c()):(this._easeStart=n.browser.now(),this._easeOptions=d,this._onEaseFrame=t,this._onEaseEnd=c,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,c){t=n.wrap(t,-180,180);const d=Math.abs(t-c);return Math.abs(t-360-c)180?-360:d<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(n.LngLat.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}class jl{constructor(t={}){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=c=>{!c||c.sourceDataType!=="metadata"&&c.sourceDataType!=="visibility"&&c.dataType!=="style"&&c.type!=="terrain"||this._updateAttributions()},this._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"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=v.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=v.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=v.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(){v.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,c){const d=this._map._getUIString(`AttributionControl.${c}`);t.title=d,t.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const c=this._map.style.sourceCaches;for(const g in c){const w=c[g];if(w.used||w.usedForTerrain){const k=w.getSource();k.attribution&&t.indexOf(k.attribution)<0&&t.push(k.attribution)}}t=t.filter(g=>String(g).trim()),t.sort((g,w)=>g.length-w.length),t=t.filter((g,w)=>{for(let k=w+1;k=0)return!1;return!0});const d=t.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,t.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class En{constructor(t={}){this._updateCompact=()=>{const c=this._container.children;if(c.length){const d=c[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=v.create("div","maplibregl-ctrl");const c=v.create("a","maplibregl-ctrl-logo");return c.target="_blank",c.rel="noopener nofollow",c.href="https://maplibre.org/",c.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),c.setAttribute("rel","noopener nofollow"),this._container.appendChild(c),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){v.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class tr{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const c=++this._id;return this._queue.push({callback:t,id:c,cancelled:!1}),c}remove(t){const c=this._currentlyRunning,d=c?this._queue.concat(c):this._queue;for(const g of d)if(g.id===t)return void(g.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const c=this._currentlyRunning=this._queue;this._queue=[];for(const d of c)if(!d.cancelled&&(d.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const ko={"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 ql=n.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class su extends n.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,c){this.sourceCache.update(t,c),this._renderableTilesKeys=[];const d={};for(const g of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:c}))d[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),n.ortho(g.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),this._tiles[g.key]=new ge(g,this.tileSize));for(const g in this._tiles)d[g]||delete this._tiles[g]}freeRtt(t){for(const c in this._tiles){const d=this._tiles[c];(!t||d.tileID.equals(t)||d.tileID.isChildOf(t)||t.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const c={};for(const d of this._renderableTilesKeys){const g=this._tiles[d].tileID;if(g.canonical.equals(t.canonical)){const w=t.clone();w.posMatrix=new Float64Array(16),n.ortho(w.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),c[d]=w}else if(g.canonical.isChildOf(t.canonical)){const w=t.clone();w.posMatrix=new Float64Array(16);const k=g.canonical.z-t.canonical.z,A=g.canonical.x-(g.canonical.x>>k<>k<>k;n.ortho(w.posMatrix,0,O,0,O,0,1),n.translate(w.posMatrix,w.posMatrix,[-A*O,-L*O,0]),c[d]=w}else if(t.canonical.isChildOf(g.canonical)){const w=t.clone();w.posMatrix=new Float64Array(16);const k=t.canonical.z-g.canonical.z,A=t.canonical.x-(t.canonical.x>>k<>k<>k;n.ortho(w.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),n.translate(w.posMatrix,w.posMatrix,[A*O,L*O,0]),n.scale(w.posMatrix,w.posMatrix,[1/2**k,1/2**k,0]),c[d]=w}}return c}getSourceTile(t,c){const d=this.sourceCache._source;let g=t.overscaledZ-this.deltaZoom;if(g>d.maxzoom&&(g=d.maxzoom),g=d.minzoom&&(!w||!w.dem);)w=this.sourceCache.getTileByID(t.scaledTo(g--).key);return w}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(c=>c.timeAdded>=t)}}class au{constructor(t,c,d){this.painter=t,this.sourceCache=new su(c),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,c,d,g=n.EXTENT){var w;if(!(c>=0&&c=0&&dt.canonical.z&&(t.canonical.z>=g?w=t.canonical.z-g:n.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const k=t.canonical.x-(t.canonical.x>>w<>w<>8<<4|w>>8,c[k+3]=0;const d=new n.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(c.buffer)),g=new ze(t,d,t.gl.RGBA,{premultiply:!1});return g.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(t){const c=new Uint8Array(4),d=this.painter.context,g=d.gl;d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,g.RGBA,g.UNSIGNED_BYTE,c),d.bindFramebuffer.set(null);const w=c[0]+(c[2]>>4<<8),k=c[1]+((15&c[2])<<8),A=this.coordsIndex[255-c[3]],L=A&&this.sourceCache.getTileByID(A);if(!L)return null;const O=this._coordsTextureSize,U=(1<t.id!==c),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const c of this._recentlyUsed)if(!this._objects[c].inUse)return this._objects[c];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 na={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Kn{constructor(t,c){this.painter=t,this.terrain=c,this.pool=new ou(t.context,30,c.sourceCache.tileSize*c.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,c){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(d=>!t._layers[d].isHidden(c)),this._coordsDescendingInv={};for(const d in t.sourceCaches){this._coordsDescendingInv[d]={};const g=t.sourceCaches[d].getVisibleCoordinates();for(const w of g){const k=this.terrain.sourceCache.getTerrainCoords(w);for(const A in k)this._coordsDescendingInv[d][A]||(this._coordsDescendingInv[d][A]=[]),this._coordsDescendingInv[d][A].push(k[A])}}this._coordsDescendingInvStr={};for(const d of t._order){const g=t._layers[d],w=g.source;if(na[g.type]&&!this._coordsDescendingInvStr[w]){this._coordsDescendingInvStr[w]={};for(const k in this._coordsDescendingInv[w])this._coordsDescendingInvStr[w][k]=this._coordsDescendingInv[w][k].map(A=>A.key).sort().join()}}for(const d of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const w=this._coordsDescendingInvStr[g][d.tileID.key];w&&w!==d.rttCoords[g]&&(d.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const c=t.type,d=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(na[c]&&(this._prevType&&na[this._prevType]||this._stacks.push([]),this._prevType=c,this._stacks[this._stacks.length-1].push(t.id),!g))return!0;if(na[this._prevType]||na[c]&&g){this._prevType=c;const w=this._stacks.length-1,k=this._stacks[w]||[];for(const A of this._renderableTiles){if(this.pool.isFull()&&(Il(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(A),A.rtt[w]){const O=this.pool.getObjectForId(A.rtt[w].id);if(O.stamp===A.rtt[w].stamp){this.pool.useObject(O);continue}}const L=this.pool.getOrCreateFreeObject();this.pool.useObject(L),this.pool.stampObject(L),A.rtt[w]={id:L.id,stamp:L.stamp},d.context.bindFramebuffer.set(L.fbo.framebuffer),d.context.clear({color:n.Color.transparent,stencil:0}),d.currentStencilSource=void 0;for(let O=0;O{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Co={showCompass:!0,showZoom:!0,visualizePitch:!1};class Zl{constructor(t,c,d=!1){this.mousedown=k=>{this.startMouse(n.extend({},k,{ctrlKey:!0,preventDefault:()=>k.preventDefault()}),v.mousePos(this.element,k)),v.addEventListener(window,"mousemove",this.mousemove),v.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=k=>{this.moveMouse(k,v.mousePos(this.element,k))},this.mouseup=k=>{this.mouseRotate.dragEnd(k),this.mousePitch&&this.mousePitch.dragEnd(k),this.offTemp()},this.touchstart=k=>{k.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=v.touchPos(this.element,k.targetTouches)[0],this.startTouch(k,this._startPos),v.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),v.addEventListener(window,"touchend",this.touchend))},this.touchmove=k=>{k.targetTouches.length!==1?this.reset():(this._lastPos=v.touchPos(this.element,k.targetTouches)[0],this.moveTouch(k,this._lastPos))},this.touchend=k=>{k.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const g=t.dragRotate._mouseRotate.getClickTolerance(),w=t.dragRotate._mousePitch.getClickTolerance();this.element=c,this.mouseRotate=Dl({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:k,clickTolerance:A,bearingDegreesPerPixelMoved:L=.8})=>{const O=new iu;return new Sn({clickTolerance:A,move:(U,V)=>({bearingDelta:(V.x-U.x)*L}),moveStateManager:O,enable:k,assignEvents:ci})})({clickTolerance:g,enable:!0}),this.map=t,d&&(this.mousePitch=ia({clickTolerance:w,enable:!0}),this.touchPitch=(({enable:k,clickTolerance:A,pitchDegreesPerPixelMoved:L=-.5})=>{const O=new iu;return new Sn({clickTolerance:A,move:(U,V)=>({pitchDelta:(V.y-U.y)*L}),moveStateManager:O,enable:k,assignEvents:ci})})({clickTolerance:w,enable:!0})),v.addEventListener(c,"mousedown",this.mousedown),v.addEventListener(c,"touchstart",this.touchstart,{passive:!1}),v.addEventListener(c,"touchcancel",this.reset)}startMouse(t,c){this.mouseRotate.dragStart(t,c),this.mousePitch&&this.mousePitch.dragStart(t,c),v.disableDrag()}startTouch(t,c){this.touchRotate.dragStart(t,c),this.touchPitch&&this.touchPitch.dragStart(t,c),v.disableDrag()}moveMouse(t,c){const d=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(t,c)||{};if(g&&d.setBearing(d.getBearing()+g),this.mousePitch){const{pitchDelta:w}=this.mousePitch.dragMove(t,c)||{};w&&d.setPitch(d.getPitch()+w)}}moveTouch(t,c){const d=this.map,{bearingDelta:g}=this.touchRotate.dragMove(t,c)||{};if(g&&d.setBearing(d.getBearing()+g),this.touchPitch){const{pitchDelta:w}=this.touchPitch.dragMove(t,c)||{};w&&d.setPitch(d.getPitch()+w)}}off(){const t=this.element;v.removeEventListener(t,"mousedown",this.mousedown),v.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),v.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),v.removeEventListener(window,"touchend",this.touchend),v.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){v.enableDrag(),v.removeEventListener(window,"mousemove",this.mousemove),v.removeEventListener(window,"mouseup",this.mouseup),v.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),v.removeEventListener(window,"touchend",this.touchend)}}let Xn;function en(y,t,c){if(y=new n.LngLat(y.lng,y.lat),t){const d=new n.LngLat(y.lng-360,y.lat),g=new n.LngLat(y.lng+360,y.lat),w=c.locationPoint(y).distSqr(t);c.locationPoint(d).distSqr(t)180;){const d=c.locationPoint(y);if(d.x>=0&&d.y>=0&&d.x<=c.width&&d.y<=c.height)break;y.lng>c.center.lng?y.lng-=360:y.lng+=360}return y}const Io={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 $n(y,t,c){const d=y.classList;for(const g in Io)d.remove(`maplibregl-${c}-anchor-${g}`);d.add(`maplibregl-${c}-anchor-${t}`)}class Gl extends n.Evented{constructor(t){if(super(),this._onKeyPress=c=>{const d=c.code,g=c.charCode||c.keyCode;d!=="Space"&&d!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=c=>{const d=c.originalEvent.target,g=this._element;this._popup&&(d===g||g.contains(d))&&this.togglePopup()},this._update=c=>{if(!this._map)return;const d=this._map.loaded()&&!this._map.isMoving();((c==null?void 0:c.type)==="terrain"||(c==null?void 0:c.type)==="render"&&!d)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=en(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let g="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?g=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(g=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let w="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?w="rotateX(0deg)":this._pitchAlignment==="map"&&(w=`rotateX(${this._map.getPitch()}deg)`),c&&c.type!=="moveend"||(this._pos=this._pos.round()),v.setTransform(this._element,`${Io[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${w} ${g}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const k=this._map.unproject(this._pos),A=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=k.distanceTo(this._lngLat)>20*A?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=c=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=c.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=c.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 n.Event("dragstart"))),this.fire(new n.Event("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new n.Event("dragend")),this._state="inactive"},this._addDragHandler=c=>{this._element.contains(c.originalEvent.target)&&(c.preventDefault(),this._positionDelta=c.point.sub(this._pos).add(this._offset),this._pointerdownPos=c.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._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=n.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=v.create("div"),this._element.setAttribute("aria-label","Map marker");const c=v.createNS("http://www.w3.org/2000/svg","svg"),d=41,g=27;c.setAttributeNS(null,"display","block"),c.setAttributeNS(null,"height",`${d}px`),c.setAttributeNS(null,"width",`${g}px`),c.setAttributeNS(null,"viewBox",`0 0 ${g} ${d}`);const w=v.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"stroke","none"),w.setAttributeNS(null,"stroke-width","1"),w.setAttributeNS(null,"fill","none"),w.setAttributeNS(null,"fill-rule","evenodd");const k=v.createNS("http://www.w3.org/2000/svg","g");k.setAttributeNS(null,"fill-rule","nonzero");const A=v.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"transform","translate(3.0, 29.0)"),A.setAttributeNS(null,"fill","#000000");const L=[{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 Oe of L){const Xe=v.createNS("http://www.w3.org/2000/svg","ellipse");Xe.setAttributeNS(null,"opacity","0.04"),Xe.setAttributeNS(null,"cx","10.5"),Xe.setAttributeNS(null,"cy","5.80029008"),Xe.setAttributeNS(null,"rx",Oe.rx),Xe.setAttributeNS(null,"ry",Oe.ry),A.appendChild(Xe)}const O=v.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"fill",this._color);const U=v.createNS("http://www.w3.org/2000/svg","path");U.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),O.appendChild(U);const V=v.createNS("http://www.w3.org/2000/svg","g");V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"fill","#000000");const J=v.createNS("http://www.w3.org/2000/svg","path");J.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"),V.appendChild(J);const pe=v.createNS("http://www.w3.org/2000/svg","g");pe.setAttributeNS(null,"transform","translate(6.0, 7.0)"),pe.setAttributeNS(null,"fill","#FFFFFF");const fe=v.createNS("http://www.w3.org/2000/svg","g");fe.setAttributeNS(null,"transform","translate(8.0, 8.0)");const we=v.createNS("http://www.w3.org/2000/svg","circle");we.setAttributeNS(null,"fill","#000000"),we.setAttributeNS(null,"opacity","0.25"),we.setAttributeNS(null,"cx","5.5"),we.setAttributeNS(null,"cy","5.5"),we.setAttributeNS(null,"r","5.4999962");const ue=v.createNS("http://www.w3.org/2000/svg","circle");ue.setAttributeNS(null,"fill","#FFFFFF"),ue.setAttributeNS(null,"cx","5.5"),ue.setAttributeNS(null,"cy","5.5"),ue.setAttributeNS(null,"r","5.4999962"),fe.appendChild(we),fe.appendChild(ue),k.appendChild(A),k.appendChild(O),k.appendChild(V),k.appendChild(pe),k.appendChild(fe),c.appendChild(k),c.setAttributeNS(null,"height",d*this._scale+"px"),c.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(c),this._offset=n.Point.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",c=>{c.preventDefault()}),this._element.addEventListener("mousedown",c=>{c.preventDefault()}),$n(this._element,this._anchor,"marker"),t&&t.className)for(const c of t.className.split(" "))this._element.classList.add(c);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),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("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),v.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=n.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 g=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],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}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(t){return this._offset=n.Point.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ba={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Yi=0,ir=!1;const lu={maxWidth:100,unit:"metric"};function sa(y,t,c){const d=c&&c.maxWidth||100,g=y._container.clientHeight/2,w=y.unproject([0,g]),k=y.unproject([d,g]),A=w.distanceTo(k);if(c&&c.unit==="imperial"){const L=3.2808*A;L>5280?Ss(t,d,L/5280,y._getUIString("ScaleControl.Miles")):Ss(t,d,L,y._getUIString("ScaleControl.Feet"))}else c&&c.unit==="nautical"?Ss(t,d,A/1852,y._getUIString("ScaleControl.NauticalMiles")):A>=1e3?Ss(t,d,A/1e3,y._getUIString("ScaleControl.Kilometers")):Ss(t,d,A,y._getUIString("ScaleControl.Meters"))}function Ss(y,t,c,d){const g=function(w){const k=Math.pow(10,`${Math.floor(w)}`.length-1);let A=w/k;return A=A>=10?10:A>=5?5:A>=3?3:A>=2?2:A>=1?1:function(L){const O=Math.pow(10,Math.ceil(-Math.log(L)/Math.LN10));return Math.round(L*O)/O}(A),k*A}(c);y.style.width=t*(g/c)+"px",y.innerHTML=`${g} ${d}`}const Wl={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Hl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ao(y){if(y){if(typeof y=="number"){const t=Math.round(Math.abs(y)/Math.SQRT2);return{center:new n.Point(0,0),top:new n.Point(0,y),"top-left":new n.Point(t,t),"top-right":new n.Point(-t,t),bottom:new n.Point(0,-y),"bottom-left":new n.Point(t,-t),"bottom-right":new n.Point(-t,-t),left:new n.Point(y,0),right:new n.Point(-y,0)}}if(y instanceof n.Point||Array.isArray(y)){const t=n.Point.convert(y);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:n.Point.convert(y.center||[0,0]),top:n.Point.convert(y.top||[0,0]),"top-left":n.Point.convert(y["top-left"]||[0,0]),"top-right":n.Point.convert(y["top-right"]||[0,0]),bottom:n.Point.convert(y.bottom||[0,0]),"bottom-left":n.Point.convert(y["bottom-left"]||[0,0]),"bottom-right":n.Point.convert(y["bottom-right"]||[0,0]),left:n.Point.convert(y.left||[0,0]),right:n.Point.convert(y.right||[0,0])}}return Ao(new n.Point(0,0))}const Oa={extend:(y,...t)=>n.extend(y,...t),run(y){y()},logToElement(y,t=!1,c="log"){const d=window.document.getElementById(c);d&&(t&&(d.innerHTML=""),d.innerHTML+=`
${y}`)}},Kl=_;class ji{static get version(){return Kl}static get workerCount(){return ct.workerCount}static set workerCount(t){ct.workerCount=t}static get maxParallelImageRequests(){return n.config.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(t){n.config.MAX_PARALLEL_IMAGE_REQUESTS=t}static get workerUrl(){return n.config.WORKER_URL}static set workerUrl(t){n.config.WORKER_URL=t}static addProtocol(t,c){n.config.REGISTERED_PROTOCOLS[t]=c}static removeProtocol(t){delete n.config.REGISTERED_PROTOCOLS[t]}}return ji.Map=class extends $l{constructor(y){if(n.PerformanceUtils.mark(n.PerformanceMarkers.create),(y=n.extend({},Qt,y)).minZoom!=null&&y.maxZoom!=null&&y.minZoom>y.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(y.minPitch!=null&&y.maxPitch!=null&&y.minPitch>y.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(y.minPitch!=null&&y.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(y.maxPitch!=null&&y.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ca(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=t=>{t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new n.Event("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new n.Event("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._cooperativeGestures=y.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=y.maxTileCacheSize,this._maxTileCacheZoomLevels=y.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=y.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=y.preserveDrawingBuffer,this._antialias=y.antialias,this._trackResize=y.trackResize,this._bearingSnap=y.bearingSnap,this._refreshExpiredTiles=y.refreshExpiredTiles,this._fadeDuration=y.fadeDuration,this._crossSourceCollisions=y.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=y.collectResourceTiming,this._renderTaskQueue=new tr,this._controls=[],this._mapId=n.uniqueId(),this._locale=n.extend({},ko,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=R.addThrottleControl(()=>this.isMoving()),this._requestManager=new F(y.transformRequest),typeof y.container=="string"){if(this._container=document.getElementById(y.container),!this._container)throw new Error(`Container '${y.container}' not found.`)}else{if(!(y.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=y.container}if(y.maxBounds&&this.setMaxBounds(y.maxBounds),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 t=!1;const c=Al(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{t?c(d):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Vl(this,y),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=y.hash&&new ea(typeof y.hash=="string"&&y.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch}),y.bounds&&(this.resize(),this.fitBounds(y.bounds,n.extend({},y.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=y.localIdeographFontFamily,this._validateStyle=y.validateStyle,y.style&&this.setStyle(y.style,{localIdeographFontFamily:y.localIdeographFontFamily}),y.attributionControl&&this.addControl(new jl({customAttribution:y.customAttribution})),y.maplibreLogo&&this.addControl(new En,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update(t.dataType==="style"),this.fire(new n.Event(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new n.Event(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new n.Event("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(y,t){if(t===void 0&&(t=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new n.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const c=y.onAdd(this);this._controls.push(y);const d=this._controlPositions[t];return t.indexOf("bottom")!==-1?d.insertBefore(c,d.firstChild):d.appendChild(c),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new n.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(y);return t>-1&&this._controls.splice(t,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,t,c,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(c,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,t,c,d)}resize(y){var t;const c=this._containerDimensions(),d=c[0],g=c[1],w=this._getClampedPixelRatio(d,g);if(this._resizeCanvas(d,g,w),this.painter.resize(d,g,w),this.painter.overLimit()){const A=this.painter.context.gl;this._maxCanvasSize=[A.drawingBufferWidth,A.drawingBufferHeight];const L=this._getClampedPixelRatio(d,g);this._resizeCanvas(d,g,L),this.painter.resize(d,g,L)}this.transform.resize(d,g),(t=this._requestedCameraState)===null||t===void 0||t.resize(d,g);const k=!this._moving;return k&&(this.stop(),this.fire(new n.Event("movestart",y)).fire(new n.Event("move",y))),this.fire(new n.Event("resize",y)),k&&this.fire(new n.Event("moveend",y)),this}_getClampedPixelRatio(y,t){const{0:c,1:d}=this._maxCanvasSize,g=this.getPixelRatio(),w=y*g,k=t*g;return Math.min(w>c?c/w:1,k>d?d/k:1)*g}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(Me.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom)return this.transform.minZoom=y,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=y,this._update(),this.getZoom()>y&&this.setZoom(y),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.minPitch=y,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(y>=this.transform.minPitch)return this.transform.maxPitch=y,this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.renderWorldCopies=y,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(y){return this._cooperativeGestures=y,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(y){return this.transform.locationPoint(n.LngLat.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(n.Point.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,t,c){if(y==="mouseenter"||y==="mouseover"){let d=!1;return{layer:t,listener:c,delegates:{mousemove:w=>{const k=this.getLayer(t)?this.queryRenderedFeatures(w.point,{layers:[t]}):[];k.length?d||(d=!0,c.call(this,new xn(y,this,w.originalEvent,{features:k}))):d=!1},mouseout:()=>{d=!1}}}}if(y==="mouseleave"||y==="mouseout"){let d=!1;return{layer:t,listener:c,delegates:{mousemove:k=>{(this.getLayer(t)?this.queryRenderedFeatures(k.point,{layers:[t]}):[]).length?d=!0:d&&(d=!1,c.call(this,new xn(y,this,k.originalEvent)))},mouseout:k=>{d&&(d=!1,c.call(this,new xn(y,this,k.originalEvent)))}}}}{const d=g=>{const w=this.getLayer(t)?this.queryRenderedFeatures(g.point,{layers:[t]}):[];w.length&&(g.features=w,c.call(this,g),delete g.features)};return{layer:t,listener:c,delegates:{[y]:d}}}}on(y,t,c){if(c===void 0)return super.on(y,t);const d=this._createDelegatedListener(y,t,c);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(d);for(const g in d.delegates)this.on(g,d.delegates[g]);return this}once(y,t,c){if(c===void 0)return super.once(y,t);const d=this._createDelegatedListener(y,t,c);for(const g in d.delegates)this.once(g,d.delegates[g]);return this}off(y,t,c){return c===void 0?super.off(y,t):(this._delegatedListeners&&this._delegatedListeners[y]&&(d=>{const g=this._delegatedListeners[y];for(let w=0;wthis._updateStyle(y,t));const c=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new Er(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,t,c):this.style.loadJSON(y,t,c),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Er(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,t){if(typeof y=="string"){const c=this._requestManager.transformRequest(y,D.Style);n.getJSON(c,(d,g)=>{d?this.fire(new n.ErrorEvent(d)):g&&this._updateDiff(g,t)})}else typeof y=="object"&&this._updateDiff(y,t)}_updateDiff(y,t){try{this.style.setState(y,t)&&this._update(!0)}catch(c){n.warnOnce(`Unable to perform style diff: ${c.message||c.error||c}. Rebuilding the style from scratch.`),this._updateStyle(y,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():n.warnOnce("There is no style added to the map.")}addSource(y,t){return this._lazyInitEmptyStyle(),this.style.addSource(y,t),this._update(!0)}isSourceLoaded(y){const t=this.style&&this.style.sourceCaches[y];if(t!==void 0)return t.loaded();this.fire(new n.ErrorEvent(new Error(`There is no source with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const t=this.style.sourceCaches[y.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);for(const c in this.style._layers){const d=this.style._layers[c];d.type==="hillshade"&&d.source===y.source&&n.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 au(this.painter,t,y),this.painter.renderToTexture=new Kn(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=c=>{c.dataType==="style"?this.terrain.sourceCache.freeRtt():c.dataType==="source"&&c.tile&&(c.sourceId!==y.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(c.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._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new n.Event("terrain",{terrain:y})),this}getTerrain(){var y,t;return(t=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const t in y){const c=y[t]._tiles;for(const d in c){const g=c[d];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}addSourceType(y,t,c){return this._lazyInitEmptyStyle(),this.style.addSourceType(y,t,c)}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,t,c={}){const{pixelRatio:d=1,sdf:g=!1,stretchX:w,stretchY:k,content:A}=c;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||n.isImageBitmap(t))){if(t.width===void 0||t.height===void 0)return this.fire(new n.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:L,height:O,data:U}=t,V=t;return this.style.addImage(y,{data:new n.RGBAImage({width:L,height:O},new Uint8Array(U)),pixelRatio:d,stretchX:w,stretchY:k,content:A,sdf:g,version:0,userImage:V}),V.onAdd&&V.onAdd(this,y),this}}{const{width:L,height:O,data:U}=n.browser.getImageData(t);this.style.addImage(y,{data:new n.RGBAImage({width:L,height:O},U),pixelRatio:d,stretchX:w,stretchY:k,content:A,sdf:g,version:0})}}updateImage(y,t){const c=this.style.getImage(y);if(!c)return this.fire(new n.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=t instanceof HTMLImageElement||n.isImageBitmap(t)?n.browser.getImageData(t):t,{width:g,height:w,data:k}=d;if(g===void 0||w===void 0)return this.fire(new n.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(g!==c.data.width||w!==c.data.height)return this.fire(new n.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const A=!(t instanceof HTMLImageElement||n.isImageBitmap(t));return c.data.replace(k,A),this.style.updateImage(y,c),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new n.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y,t){R.getImage(this._requestManager.transformRequest(y,D.Image),t)}listImages(){return this.style.listImages()}addLayer(y,t){return this._lazyInitEmptyStyle(),this.style.addLayer(y,t),this._update(!0)}moveLayer(y,t){return this.style.moveLayer(y,t),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}setLayerZoomRange(y,t,c){return this.style.setLayerZoomRange(y,t,c),this._update(!0)}setFilter(y,t,c={}){return this.style.setFilter(y,t,c),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,t,c,d={}){return this.style.setPaintProperty(y,t,c,d),this._update(!0)}getPaintProperty(y,t){return this.style.getPaintProperty(y,t)}setLayoutProperty(y,t,c,d={}){return this.style.setLayoutProperty(y,t,c,d),this._update(!0)}getLayoutProperty(y,t){return this.style.getLayoutProperty(y,t)}setGlyphs(y,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,t,c={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,t,c,d=>{d||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,t,c=>{c||this._update(!0)}),this}setLight(y,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,t){return this.style.setFeatureState(y,t),this._update()}removeFeatureState(y,t){return this.style.removeFeatureState(y,t),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,t=0;return this._container&&(y=this._container.clientWidth||400,t=this._container.clientHeight||300),[y,t]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const t=this._canvasContainer=v.create("div","maplibregl-canvas-container",y);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=v.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 c=this._containerDimensions(),d=this._getClampedPixelRatio(c[0],c[1]);this._resizeCanvas(c[0],c[1],d);const g=this._controlContainer=v.create("div","maplibregl-control-container",y),w=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(k=>{w[k]=v.create("div",`maplibregl-ctrl-${k} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=v.create("div","maplibregl-cooperative-gesture-screen",this._container);let y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=` +`}),staticAttributes:d,staticUniforms:T}}class vs{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,c,d,g,w,T,A,R,O){this.context=t;let U=this.boundPaintVertexBuffers.length!==g.length;for(let $=0;!U&&$({u_depth:new n.Uniform1i(ot,ft.u_depth),u_terrain:new n.Uniform1i(ot,ft.u_terrain),u_terrain_dim:new n.Uniform1f(ot,ft.u_terrain_dim),u_terrain_matrix:new n.UniformMatrix4f(ot,ft.u_terrain_matrix),u_terrain_unpack:new n.Uniform4f(ot,ft.u_terrain_unpack),u_terrain_exaggeration:new n.Uniform1f(ot,ft.u_terrain_exaggeration)}))(t,at),this.binderUniforms=d?d.getUniforms(t,at):[]}draw(t,c,d,g,w,T,A,R,O,U,$,Q,me,fe,xe,he,Ve,tt){const Ce=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(d),t.setStencilMode(g),t.setColorMode(w),t.setCullFace(T),R){t.activeTexture.set(Ce.TEXTURE2),Ce.bindTexture(Ce.TEXTURE_2D,R.depthTexture),t.activeTexture.set(Ce.TEXTURE3),Ce.bindTexture(Ce.TEXTURE_2D,R.texture);for(const at in this.terrainUniforms)this.terrainUniforms[at].set(R[at])}for(const at in this.fixedUniforms)this.fixedUniforms[at].set(A[at]);xe&&xe.setUniforms(t,this.binderUniforms,me,{zoom:fe});let je=0;switch(c){case Ce.LINES:je=2;break;case Ce.TRIANGLES:je=3;break;case Ce.LINE_STRIP:je=1}for(const at of Q.get()){const ot=at.vaos||(at.vaos={});(ot[O]||(ot[O]=new vs)).bind(t,this,U,xe?xe.getPaintVertexBuffers():[],$,at.vertexOffset,he,Ve,tt),Ce.drawElements(c,at.primitiveLength*je,Ce.UNSIGNED_SHORT,at.primitiveOffset*je*2)}}}function ba(y,t,c){const d=1/$e(c,1,t.transform.tileZoom),g=Math.pow(2,c.tileID.overscaledZ),w=c.tileSize*Math.pow(2,t.transform.tileZoom)/g,T=w*(c.tileID.canonical.x+c.tileID.wrap*g),A=w*c.tileID.canonical.y;return{u_image:0,u_texsize:c.imageAtlasTexture.size,u_scale:[d,y.fromScale,y.toScale],u_fade:y.t,u_pixel_coord_upper:[T>>16,A>>16],u_pixel_coord_lower:[65535&T,65535&A]}}const Ln=(y,t,c,d)=>{const g=t.style.light,w=g.properties.get("position"),T=[w.x,w.y,w.z],A=function(){var O=new n.ARRAY_TYPE(9);return n.ARRAY_TYPE!=Float32Array&&(O[1]=0,O[2]=0,O[3]=0,O[5]=0,O[6]=0,O[7]=0),O[0]=1,O[4]=1,O[8]=1,O}();g.properties.get("anchor")==="viewport"&&function(O,U){var $=Math.sin(U),Q=Math.cos(U);O[0]=Q,O[1]=$,O[2]=0,O[3]=-$,O[4]=Q,O[5]=0,O[6]=0,O[7]=0,O[8]=1}(A,-t.transform.angle),function(O,U,$){var Q=U[0],me=U[1],fe=U[2];O[0]=Q*$[0]+me*$[3]+fe*$[6],O[1]=Q*$[1]+me*$[4]+fe*$[7],O[2]=Q*$[2]+me*$[5]+fe*$[8]}(T,T,A);const R=g.properties.get("color");return{u_matrix:y,u_lightpos:T,u_lightintensity:g.properties.get("intensity"),u_lightcolor:[R.r,R.g,R.b],u_vertical_gradient:+c,u_opacity:d}},Lc=(y,t,c,d,g,w,T)=>n.extend(Ln(y,t,c,d),ba(w,t,T),{u_height_factor:-Math.pow(2,g.overscaledZ)/T.tileSize/8}),as=y=>({u_matrix:y}),Rc=(y,t,c,d)=>n.extend(as(y),ba(c,t,d)),Bc=(y,t)=>({u_matrix:y,u_world:t}),io=(y,t,c,d,g)=>n.extend(Rc(y,t,c,d),{u_world:g}),ro=(y,t,c,d)=>{const g=y.transform;let w,T;if(d.paint.get("circle-pitch-alignment")==="map"){const A=$e(c,1,g.zoom);w=!0,T=[A,A]}else w=!1,T=g.pixelsToGLUnits;return{u_camera_to_center_distance:g.cameraToCenterDistance,u_scale_with_map:+(d.paint.get("circle-pitch-scale")==="map"),u_matrix:y.translatePosMatrix(t.posMatrix,c,d.paint.get("circle-translate"),d.paint.get("circle-translate-anchor")),u_pitch_with_map:+w,u_device_pixel_ratio:y.pixelRatio,u_extrude_scale:T}},bs=(y,t,c)=>{const d=$e(c,1,t.zoom),g=Math.pow(2,t.zoom-c.tileID.overscaledZ),w=c.tileID.overscaleFactor();return{u_matrix:y,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:d,u_extrude_scale:[t.pixelsToGLUnits[0]/(d*g),t.pixelsToGLUnits[1]/(d*g)],u_overscale_factor:w}},no=(y,t,c=1)=>({u_matrix:y,u_color:t,u_overlay:0,u_overlay_scale:c}),wa=y=>({u_matrix:y}),uh=(y,t,c,d)=>({u_matrix:y,u_extrude_scale:$e(t,1,c),u_intensity:d});function hh(y,t){const c=Math.pow(2,t.canonical.z),d=t.canonical.y;return[new n.MercatorCoordinate(0,d/c).toLngLat().lat,new n.MercatorCoordinate(0,(d+1)/c).toLngLat().lat]}const xa=(y,t,c,d)=>{const g=y.transform;return{u_matrix:Fc(y,t,c,d),u_ratio:1/$e(t,1,g.zoom),u_device_pixel_ratio:y.pixelRatio,u_units_to_pixels:[1/g.pixelsToGLUnits[0],1/g.pixelsToGLUnits[1]]}},fh=(y,t,c,d,g)=>n.extend(xa(y,t,c,g),{u_image:0,u_image_height:d}),Oc=(y,t,c,d,g)=>{const w=y.transform,T=ol(t,w);return{u_matrix:Fc(y,t,c,g),u_texsize:t.imageAtlasTexture.size,u_ratio:1/$e(t,1,w.zoom),u_device_pixel_ratio:y.pixelRatio,u_image:0,u_scale:[T,d.fromScale,d.toScale],u_fade:d.t,u_units_to_pixels:[1/w.pixelsToGLUnits[0],1/w.pixelsToGLUnits[1]]}},dh=(y,t,c,d,g,w)=>{const T=y.lineAtlas,A=ol(t,y.transform),R=c.layout.get("line-cap")==="round",O=T.getDash(d.from,R),U=T.getDash(d.to,R),$=O.width*g.fromScale,Q=U.width*g.toScale;return n.extend(xa(y,t,c,w),{u_patternscale_a:[A/$,-O.height/2],u_patternscale_b:[A/Q,-U.height/2],u_sdfgamma:T.width/(256*Math.min($,Q)*y.pixelRatio)/2,u_image:0,u_tex_y_a:O.y,u_tex_y_b:U.y,u_mix:g.t})};function ol(y,t){return 1/$e(y,1,t.tileZoom)}function Fc(y,t,c,d){return y.translatePosMatrix(d?d.posMatrix:t.tileID.posMatrix,t,c.paint.get("line-translate"),c.paint.get("line-translate-anchor"))}const ll=(y,t,c,d,g)=>{return{u_matrix:y,u_tl_parent:t,u_scale_parent:c,u_buffer_scale:1,u_fade_t:d.mix,u_opacity:d.opacity*g.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:g.paint.get("raster-brightness-min"),u_brightness_high:g.paint.get("raster-brightness-max"),u_saturation_factor:(T=g.paint.get("raster-saturation"),T>0?1-1/(1.001-T):-T),u_contrast_factor:(w=g.paint.get("raster-contrast"),w>0?1/(1-w):1+w),u_spin_weights:Nc(g.paint.get("raster-hue-rotate"))};var w,T};function Nc(y){y*=Math.PI/180;const t=Math.sin(y),c=Math.cos(y);return[(2*c+1)/3,(-Math.sqrt(3)*t-c+1)/3,(Math.sqrt(3)*t-c+1)/3]}const cl=(y,t,c,d,g,w,T,A,R,O)=>{const U=g.transform;return{u_is_size_zoom_constant:+(y==="constant"||y==="source"),u_is_size_feature_constant:+(y==="constant"||y==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:U.cameraToCenterDistance,u_pitch:U.pitch/360*2*Math.PI,u_rotate_symbol:+c,u_aspect_ratio:U.width/U.height,u_fade_change:g.options.fadeDuration?g.symbolFadeChange:1,u_matrix:w,u_label_plane_matrix:T,u_coord_matrix:A,u_is_text:+R,u_pitch_with_map:+d,u_texsize:O,u_texture:0}},ul=(y,t,c,d,g,w,T,A,R,O,U)=>{const $=g.transform;return n.extend(cl(y,t,c,d,g,w,T,A,R,O),{u_gamma_scale:d?Math.cos($._pitch)*$.cameraToCenterDistance:1,u_device_pixel_ratio:g.pixelRatio,u_is_halo:+U})},Uc=(y,t,c,d,g,w,T,A,R,O)=>n.extend(ul(y,t,c,d,g,w,T,A,!0,R,!0),{u_texsize_icon:O,u_texture_icon:1}),Ls=(y,t,c)=>({u_matrix:y,u_opacity:t,u_color:c}),so=(y,t,c,d,g,w)=>n.extend(function(T,A,R,O){const U=R.imageManager.getPattern(T.from.toString()),$=R.imageManager.getPattern(T.to.toString()),{width:Q,height:me}=R.imageManager.getPixelSize(),fe=Math.pow(2,O.tileID.overscaledZ),xe=O.tileSize*Math.pow(2,R.transform.tileZoom)/fe,he=xe*(O.tileID.canonical.x+O.tileID.wrap*fe),Ve=xe*O.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:U.tl,u_pattern_br_a:U.br,u_pattern_tl_b:$.tl,u_pattern_br_b:$.br,u_texsize:[Q,me],u_mix:A.t,u_pattern_size_a:U.displaySize,u_pattern_size_b:$.displaySize,u_scale_a:A.fromScale,u_scale_b:A.toScale,u_tile_units_to_pixels:1/$e(O,1,R.transform.tileZoom),u_pixel_coord_upper:[he>>16,Ve>>16],u_pixel_coord_lower:[65535&he,65535&Ve]}}(d,w,c,g),{u_matrix:y,u_opacity:t}),Rn={fillExtrusion:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_lightpos:new n.Uniform3f(y,t.u_lightpos),u_lightintensity:new n.Uniform1f(y,t.u_lightintensity),u_lightcolor:new n.Uniform3f(y,t.u_lightcolor),u_vertical_gradient:new n.Uniform1f(y,t.u_vertical_gradient),u_opacity:new n.Uniform1f(y,t.u_opacity)}),fillExtrusionPattern:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_lightpos:new n.Uniform3f(y,t.u_lightpos),u_lightintensity:new n.Uniform1f(y,t.u_lightintensity),u_lightcolor:new n.Uniform3f(y,t.u_lightcolor),u_vertical_gradient:new n.Uniform1f(y,t.u_vertical_gradient),u_height_factor:new n.Uniform1f(y,t.u_height_factor),u_image:new n.Uniform1i(y,t.u_image),u_texsize:new n.Uniform2f(y,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(y,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(y,t.u_scale),u_fade:new n.Uniform1f(y,t.u_fade),u_opacity:new n.Uniform1f(y,t.u_opacity)}),fill:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix)}),fillPattern:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_image:new n.Uniform1i(y,t.u_image),u_texsize:new n.Uniform2f(y,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(y,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(y,t.u_scale),u_fade:new n.Uniform1f(y,t.u_fade)}),fillOutline:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_world:new n.Uniform2f(y,t.u_world)}),fillOutlinePattern:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_world:new n.Uniform2f(y,t.u_world),u_image:new n.Uniform1i(y,t.u_image),u_texsize:new n.Uniform2f(y,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(y,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(y,t.u_scale),u_fade:new n.Uniform1f(y,t.u_fade)}),circle:(y,t)=>({u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_scale_with_map:new n.Uniform1i(y,t.u_scale_with_map),u_pitch_with_map:new n.Uniform1i(y,t.u_pitch_with_map),u_extrude_scale:new n.Uniform2f(y,t.u_extrude_scale),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_matrix:new n.UniformMatrix4f(y,t.u_matrix)}),collisionBox:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_pixels_to_tile_units:new n.Uniform1f(y,t.u_pixels_to_tile_units),u_extrude_scale:new n.Uniform2f(y,t.u_extrude_scale),u_overscale_factor:new n.Uniform1f(y,t.u_overscale_factor)}),collisionCircle:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_inv_matrix:new n.UniformMatrix4f(y,t.u_inv_matrix),u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_viewport_size:new n.Uniform2f(y,t.u_viewport_size)}),debug:(y,t)=>({u_color:new n.UniformColor(y,t.u_color),u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_overlay:new n.Uniform1i(y,t.u_overlay),u_overlay_scale:new n.Uniform1f(y,t.u_overlay_scale)}),clippingMask:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix)}),heatmap:(y,t)=>({u_extrude_scale:new n.Uniform1f(y,t.u_extrude_scale),u_intensity:new n.Uniform1f(y,t.u_intensity),u_matrix:new n.UniformMatrix4f(y,t.u_matrix)}),heatmapTexture:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_world:new n.Uniform2f(y,t.u_world),u_image:new n.Uniform1i(y,t.u_image),u_color_ramp:new n.Uniform1i(y,t.u_color_ramp),u_opacity:new n.Uniform1f(y,t.u_opacity)}),hillshade:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_image:new n.Uniform1i(y,t.u_image),u_latrange:new n.Uniform2f(y,t.u_latrange),u_light:new n.Uniform2f(y,t.u_light),u_shadow:new n.UniformColor(y,t.u_shadow),u_highlight:new n.UniformColor(y,t.u_highlight),u_accent:new n.UniformColor(y,t.u_accent)}),hillshadePrepare:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_image:new n.Uniform1i(y,t.u_image),u_dimension:new n.Uniform2f(y,t.u_dimension),u_zoom:new n.Uniform1f(y,t.u_zoom),u_unpack:new n.Uniform4f(y,t.u_unpack)}),line:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_ratio:new n.Uniform1f(y,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(y,t.u_units_to_pixels)}),lineGradient:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_ratio:new n.Uniform1f(y,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(y,t.u_units_to_pixels),u_image:new n.Uniform1i(y,t.u_image),u_image_height:new n.Uniform1f(y,t.u_image_height)}),linePattern:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_texsize:new n.Uniform2f(y,t.u_texsize),u_ratio:new n.Uniform1f(y,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_image:new n.Uniform1i(y,t.u_image),u_units_to_pixels:new n.Uniform2f(y,t.u_units_to_pixels),u_scale:new n.Uniform3f(y,t.u_scale),u_fade:new n.Uniform1f(y,t.u_fade)}),lineSDF:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_ratio:new n.Uniform1f(y,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(y,t.u_units_to_pixels),u_patternscale_a:new n.Uniform2f(y,t.u_patternscale_a),u_patternscale_b:new n.Uniform2f(y,t.u_patternscale_b),u_sdfgamma:new n.Uniform1f(y,t.u_sdfgamma),u_image:new n.Uniform1i(y,t.u_image),u_tex_y_a:new n.Uniform1f(y,t.u_tex_y_a),u_tex_y_b:new n.Uniform1f(y,t.u_tex_y_b),u_mix:new n.Uniform1f(y,t.u_mix)}),raster:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_tl_parent:new n.Uniform2f(y,t.u_tl_parent),u_scale_parent:new n.Uniform1f(y,t.u_scale_parent),u_buffer_scale:new n.Uniform1f(y,t.u_buffer_scale),u_fade_t:new n.Uniform1f(y,t.u_fade_t),u_opacity:new n.Uniform1f(y,t.u_opacity),u_image0:new n.Uniform1i(y,t.u_image0),u_image1:new n.Uniform1i(y,t.u_image1),u_brightness_low:new n.Uniform1f(y,t.u_brightness_low),u_brightness_high:new n.Uniform1f(y,t.u_brightness_high),u_saturation_factor:new n.Uniform1f(y,t.u_saturation_factor),u_contrast_factor:new n.Uniform1f(y,t.u_contrast_factor),u_spin_weights:new n.Uniform3f(y,t.u_spin_weights)}),symbolIcon:(y,t)=>({u_is_size_zoom_constant:new n.Uniform1i(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(y,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(y,t.u_size_t),u_size:new n.Uniform1f(y,t.u_size),u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(y,t.u_pitch),u_rotate_symbol:new n.Uniform1i(y,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(y,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(y,t.u_fade_change),u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(y,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(y,t.u_coord_matrix),u_is_text:new n.Uniform1i(y,t.u_is_text),u_pitch_with_map:new n.Uniform1i(y,t.u_pitch_with_map),u_texsize:new n.Uniform2f(y,t.u_texsize),u_texture:new n.Uniform1i(y,t.u_texture)}),symbolSDF:(y,t)=>({u_is_size_zoom_constant:new n.Uniform1i(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(y,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(y,t.u_size_t),u_size:new n.Uniform1f(y,t.u_size),u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(y,t.u_pitch),u_rotate_symbol:new n.Uniform1i(y,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(y,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(y,t.u_fade_change),u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(y,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(y,t.u_coord_matrix),u_is_text:new n.Uniform1i(y,t.u_is_text),u_pitch_with_map:new n.Uniform1i(y,t.u_pitch_with_map),u_texsize:new n.Uniform2f(y,t.u_texsize),u_texture:new n.Uniform1i(y,t.u_texture),u_gamma_scale:new n.Uniform1f(y,t.u_gamma_scale),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_is_halo:new n.Uniform1i(y,t.u_is_halo)}),symbolTextAndIcon:(y,t)=>({u_is_size_zoom_constant:new n.Uniform1i(y,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(y,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(y,t.u_size_t),u_size:new n.Uniform1f(y,t.u_size),u_camera_to_center_distance:new n.Uniform1f(y,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(y,t.u_pitch),u_rotate_symbol:new n.Uniform1i(y,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(y,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(y,t.u_fade_change),u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(y,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(y,t.u_coord_matrix),u_is_text:new n.Uniform1i(y,t.u_is_text),u_pitch_with_map:new n.Uniform1i(y,t.u_pitch_with_map),u_texsize:new n.Uniform2f(y,t.u_texsize),u_texsize_icon:new n.Uniform2f(y,t.u_texsize_icon),u_texture:new n.Uniform1i(y,t.u_texture),u_texture_icon:new n.Uniform1i(y,t.u_texture_icon),u_gamma_scale:new n.Uniform1f(y,t.u_gamma_scale),u_device_pixel_ratio:new n.Uniform1f(y,t.u_device_pixel_ratio),u_is_halo:new n.Uniform1i(y,t.u_is_halo)}),background:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_opacity:new n.Uniform1f(y,t.u_opacity),u_color:new n.UniformColor(y,t.u_color)}),backgroundPattern:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_opacity:new n.Uniform1f(y,t.u_opacity),u_image:new n.Uniform1i(y,t.u_image),u_pattern_tl_a:new n.Uniform2f(y,t.u_pattern_tl_a),u_pattern_br_a:new n.Uniform2f(y,t.u_pattern_br_a),u_pattern_tl_b:new n.Uniform2f(y,t.u_pattern_tl_b),u_pattern_br_b:new n.Uniform2f(y,t.u_pattern_br_b),u_texsize:new n.Uniform2f(y,t.u_texsize),u_mix:new n.Uniform1f(y,t.u_mix),u_pattern_size_a:new n.Uniform2f(y,t.u_pattern_size_a),u_pattern_size_b:new n.Uniform2f(y,t.u_pattern_size_b),u_scale_a:new n.Uniform1f(y,t.u_scale_a),u_scale_b:new n.Uniform1f(y,t.u_scale_b),u_pixel_coord_upper:new n.Uniform2f(y,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(y,t.u_pixel_coord_lower),u_tile_units_to_pixels:new n.Uniform1f(y,t.u_tile_units_to_pixels)}),terrain:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_texture:new n.Uniform1i(y,t.u_texture),u_ele_delta:new n.Uniform1f(y,t.u_ele_delta)}),terrainDepth:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_ele_delta:new n.Uniform1f(y,t.u_ele_delta)}),terrainCoords:(y,t)=>({u_matrix:new n.UniformMatrix4f(y,t.u_matrix),u_texture:new n.Uniform1i(y,t.u_texture),u_terrain_coords_id:new n.Uniform1f(y,t.u_terrain_coords_id),u_ele_delta:new n.Uniform1f(y,t.u_ele_delta)})};class ao{constructor(t,c,d){this.context=t;const g=t.gl;this.buffer=g.createBuffer(),this.dynamicDraw=!!d,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),g.bufferData(g.ELEMENT_ARRAY_BUFFER,c.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||delete c.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const c=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),c.bufferSubData(c.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const oo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ea{constructor(t,c,d,g){this.length=c.length,this.attributes=d,this.itemSize=c.bytesPerElement,this.dynamicDraw=g,this.context=t;const w=t.gl;this.buffer=w.createBuffer(),t.bindVertexBuffer.set(this.buffer),w.bufferData(w.ARRAY_BUFFER,c.arrayBuffer,this.dynamicDraw?w.DYNAMIC_DRAW:w.STATIC_DRAW),this.dynamicDraw||delete c.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 c=this.context.gl;this.bind(),c.bufferSubData(c.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,c){for(let d=0;d0){const At=n.create(),Wt=ft;n.mul(At,ot.placementInvProjMatrix,y.transform.glCoordMatrix),n.mul(At,At,ot.placementViewportMatrix),U.push({circleArray:yt,circleOffset:Q,transform:Wt,invTransform:At,coord:je}),$+=yt.length/4,Q=$}Et&&O.draw(A,R.LINES,Bi.disabled,Ki.disabled,y.colorModeForRenderPass(),er.disabled,bs(ft,y.transform,at),y.style.map.terrain&&y.style.map.terrain.getTerrainData(je),c.id,Et.layoutVertexBuffer,Et.indexBuffer,Et.segments,null,y.transform.zoom,null,null,Et.collisionVertexBuffer)}if(!T||!U.length)return;const me=y.useProgram("collisionCircle"),fe=new n.CollisionCircleLayoutArray;fe.resize(4*$),fe._trim();let xe=0;for(const Ce of U)for(let je=0;je=0&&(fe[he.associatedIconIndex]={shiftedAnchor:Di,angle:Lt})}else K(he.numGlyphs,Q)}if(O){me.clear();const xe=y.icon.placedSymbolArray;for(let he=0;hey.style.map.terrain.getElevation(Et,Tn,br):null,vr=c.layout.get("text-rotation-alignment")==="map";or(At,Et.posMatrix,y,g,Jn,nr,he,O,vr,yr)}const ls=y.translatePosMatrix(Et.posMatrix,yt,w,T),Fs=Ve||g&&ot||ks?bh:Jn,tn=y.translatePosMatrix(nr,yt,w,T,!0),qr=Lt&&c.paint.get(g?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Wr;Wr=Lt?At.iconsInText?Uc(ui.kind,Ei,tt,he,y,ls,Fs,tn,Li,fr):ul(ui.kind,Ei,tt,he,y,ls,Fs,tn,g,Li,!0):cl(ui.kind,Ei,tt,he,y,ls,Fs,tn,g,Li);const Fa={program:rr,buffers:Wt,uniformValues:Wr,atlasTexture:_r,atlasTextureIcon:cr,atlasInterpolation:Xi,atlasInterpolationIcon:Bn,isSDF:Lt,hasHalo:qr};if(Ce&&At.canOverlap){je=!0;const yr=Wt.segments.get();for(const vr of yr)ft.push({segments:new n.SegmentVector([vr]),sortKey:vr.sortKey,state:Fa,terrainData:ki})}else ft.push({segments:Wt.segments,sortKey:0,state:Fa,terrainData:ki})}je&&ft.sort((Et,yt)=>Et.sortKey-yt.sortKey);for(const Et of ft){const yt=Et.state;if(Q.activeTexture.set(me.TEXTURE0),yt.atlasTexture.bind(yt.atlasInterpolation,me.CLAMP_TO_EDGE),yt.atlasTextureIcon&&(Q.activeTexture.set(me.TEXTURE1),yt.atlasTextureIcon&&yt.atlasTextureIcon.bind(yt.atlasInterpolationIcon,me.CLAMP_TO_EDGE)),yt.isSDF){const At=yt.uniformValues;yt.hasHalo&&(At.u_is_halo=1,xo(yt.buffers,Et.segments,c,y,yt.program,at,U,$,At,Et.terrainData)),At.u_is_halo=0}xo(yt.buffers,Et.segments,c,y,yt.program,at,U,$,yt.uniformValues,Et.terrainData)}}function xo(y,t,c,d,g,w,T,A,R,O){const U=d.context;g.draw(U,U.gl.TRIANGLES,w,T,A,er.disabled,R,O,c.id,y.layoutVertexBuffer,y.indexBuffer,t,c.paint,d.transform.zoom,y.programConfigurations.get(c.id),y.dynamicLayoutVertexBuffer,y.opacityVertexBuffer)}function El(y,t,c,d,g){if(!c||!d||!d.imageAtlas)return;const w=d.imageAtlas.patternPositions;let T=w[c.to.toString()],A=w[c.from.toString()];if(!T||!A){const R=g.getPaintProperty(t);T=w[R],A=w[R]}T&&A&&y.setConstantPatternPositions(T,A)}function Sa(y,t,c,d,g,w,T){const A=y.context.gl,R="fill-pattern",O=c.paint.get(R),U=O&&O.constantOr(1),$=c.getCrossfadeParameters();let Q,me,fe,xe,he;T?(me=U&&!c.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Q=A.LINES):(me=U?"fillPattern":"fill",Q=A.TRIANGLES);const Ve=O.constantOr(null);for(const tt of d){const Ce=t.getTile(tt);if(U&&!Ce.patternsLoaded())continue;const je=Ce.getBucket(c);if(!je)continue;const at=je.programConfigurations.get(c.id),ot=y.useProgram(me,at),ft=y.style.map.terrain&&y.style.map.terrain.getTerrainData(tt);U&&(y.context.activeTexture.set(A.TEXTURE0),Ce.imageAtlasTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),at.updatePaintBuffers($)),El(at,R,Ve,Ce,c);const Et=ft?tt:null,yt=y.translatePosMatrix(Et?Et.posMatrix:tt.posMatrix,Ce,c.paint.get("fill-translate"),c.paint.get("fill-translate-anchor"));if(T){xe=je.indexBuffer2,he=je.segments2;const At=[A.drawingBufferWidth,A.drawingBufferHeight];fe=me==="fillOutlinePattern"&&U?io(yt,y,$,Ce,At):Bc(yt,At)}else xe=je.indexBuffer,he=je.segments,fe=U?Rc(yt,y,$,Ce):as(yt);ot.draw(y.context,Q,g,y.stencilModeForClipping(tt),w,er.disabled,fe,ft,c.id,je.layoutVertexBuffer,xe,he,c.paint,y.transform.zoom,at)}}function Ys(y,t,c,d,g,w,T){const A=y.context,R=A.gl,O="fill-extrusion-pattern",U=c.paint.get(O),$=U.constantOr(1),Q=c.getCrossfadeParameters(),me=c.paint.get("fill-extrusion-opacity"),fe=U.constantOr(null);for(const xe of d){const he=t.getTile(xe),Ve=he.getBucket(c);if(!Ve)continue;const tt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(xe),Ce=Ve.programConfigurations.get(c.id),je=y.useProgram($?"fillExtrusionPattern":"fillExtrusion",Ce);$&&(y.context.activeTexture.set(R.TEXTURE0),he.imageAtlasTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),Ce.updatePaintBuffers(Q)),El(Ce,O,fe,he,c);const at=y.translatePosMatrix(xe.posMatrix,he,c.paint.get("fill-extrusion-translate"),c.paint.get("fill-extrusion-translate-anchor")),ot=c.paint.get("fill-extrusion-vertical-gradient"),ft=$?Lc(at,y,ot,me,xe,Q,he):Ln(at,y,ot,me);je.draw(A,A.gl.TRIANGLES,g,w,T,er.backCCW,ft,tt,c.id,Ve.layoutVertexBuffer,Ve.indexBuffer,Ve.segments,c.paint,y.transform.zoom,Ce,y.style.map.terrain&&Ve.centroidVertexBuffer)}}function Sl(y,t,c,d,g,w,T){const A=y.context,R=A.gl,O=c.fbo;if(!O)return;const U=y.useProgram("hillshade"),$=y.style.map.terrain&&y.style.map.terrain.getTerrainData(t);A.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_2D,O.colorAttachment.get()),U.draw(A,R.TRIANGLES,g,w,T,er.disabled,((Q,me,fe,xe)=>{const he=fe.paint.get("hillshade-shadow-color"),Ve=fe.paint.get("hillshade-highlight-color"),tt=fe.paint.get("hillshade-accent-color");let Ce=fe.paint.get("hillshade-illumination-direction")*(Math.PI/180);fe.paint.get("hillshade-illumination-anchor")==="viewport"&&(Ce-=Q.transform.angle);const je=!Q.options.moving;return{u_matrix:xe?xe.posMatrix:Q.transform.calculatePosMatrix(me.tileID.toUnwrapped(),je),u_image:0,u_latrange:hh(0,me.tileID),u_light:[fe.paint.get("hillshade-exaggeration"),Ce],u_shadow:he,u_highlight:Ve,u_accent:tt}})(y,c,d,$?t:null),$,d.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments)}function wh(y,t,c,d,g,w){const T=y.context,A=T.gl,R=t.dem;if(R&&R.data){const O=R.dim,U=R.stride,$=R.getPixels();if(T.activeTexture.set(A.TEXTURE1),T.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||y.getTileTexture(U),t.demTexture){const me=t.demTexture;me.update($,{premultiply:!1}),me.bind(A.NEAREST,A.CLAMP_TO_EDGE)}else t.demTexture=new Me(T,$,A.RGBA,{premultiply:!1}),t.demTexture.bind(A.NEAREST,A.CLAMP_TO_EDGE);T.activeTexture.set(A.TEXTURE0);let Q=t.fbo;if(!Q){const me=new Me(T,{width:O,height:O,data:null},A.RGBA);me.bind(A.LINEAR,A.CLAMP_TO_EDGE),Q=t.fbo=T.createFramebuffer(O,O,!0,!1),Q.colorAttachment.set(me.texture)}T.bindFramebuffer.set(Q.framebuffer),T.viewport.set([0,0,O,O]),y.useProgram("hillshadePrepare").draw(T,A.TRIANGLES,d,g,w,er.disabled,((me,fe)=>{const xe=fe.stride,he=n.create();return n.ortho(he,0,n.EXTENT,-n.EXTENT,0,0,1),n.translate(he,he,[0,-n.EXTENT,0]),{u_matrix:he,u_image:1,u_dimension:[xe,xe],u_zoom:me.overscaledZ,u_unpack:fe.getUnpackVector()}})(t.tileID,R),null,c.id,y.rasterBoundsBuffer,y.quadTriangleIndexBuffer,y.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function kl(y,t,c,d,g,w){const T=d.paint.get("raster-fade-duration");if(!w&&T>0){const A=n.browser.now(),R=(A-y.timeAdded)/T,O=t?(A-t.timeAdded)/T:-1,U=c.getSource(),$=g.coveringZoomLevel({tileSize:U.tileSize,roundZoom:U.roundZoom}),Q=!t||Math.abs(t.tileID.overscaledZ-$)>Math.abs(y.tileID.overscaledZ-$),me=Q&&y.refreshedUponExpiration?1:n.clamp(Q?R:1-O,0,1);return y.refreshedUponExpiration&&R>=1&&(y.refreshedUponExpiration=!1),t?{opacity:1,mix:1-me}:{opacity:me,mix:0}}return{opacity:1,mix:0}}const xh=new n.Color(1,0,0,1),Gc=new n.Color(0,1,0,1),Eo=new n.Color(0,0,1,1),Tl=new n.Color(1,0,1,1),Wc=new n.Color(0,1,1,1);function Cl(y,t,c,d){Qs(y,0,t+c/2,y.transform.width,c,d)}function ka(y,t,c,d){Qs(y,t-c/2,0,c,y.transform.height,d)}function Qs(y,t,c,d,g,w){const T=y.context,A=T.gl;A.enable(A.SCISSOR_TEST),A.scissor(t*y.pixelRatio,c*y.pixelRatio,d*y.pixelRatio,g*y.pixelRatio),T.clear({color:w}),A.disable(A.SCISSOR_TEST)}function Eh(y,t,c){const d=y.context,g=d.gl,w=c.posMatrix,T=y.useProgram("debug"),A=Bi.disabled,R=Ki.disabled,O=y.colorModeForRenderPass(),U="$debug",$=y.style.map.terrain&&y.style.map.terrain.getTerrainData(c);d.activeTexture.set(g.TEXTURE0);const Q=t.getTileByID(c.key).latestRawTileData,me=Math.floor((Q&&Q.byteLength||0)/1024),fe=t.getTile(c).tileSize,xe=512/Math.min(fe,512)*(c.overscaledZ/y.transform.zoom)*.5;let he=c.canonical.toString();c.overscaledZ!==c.canonical.z&&(he+=` => ${c.overscaledZ}`),function(Ve,tt){Ve.initDebugOverlayCanvas();const Ce=Ve.debugOverlayCanvas,je=Ve.context.gl,at=Ve.debugOverlayCanvas.getContext("2d");at.clearRect(0,0,Ce.width,Ce.height),at.shadowColor="white",at.shadowBlur=2,at.lineWidth=1.5,at.strokeStyle="white",at.textBaseline="top",at.font="bold 36px Open Sans, sans-serif",at.fillText(tt,5,5),at.strokeText(tt,5,5),Ve.debugOverlayTexture.update(Ce),Ve.debugOverlayTexture.bind(je.LINEAR,je.CLAMP_TO_EDGE)}(y,`${he} ${me}kB`),T.draw(d,g.TRIANGLES,A,R,mi.alphaBlended,er.disabled,no(w,n.Color.transparent,xe),null,U,y.debugBuffer,y.quadTriangleIndexBuffer,y.debugSegments),T.draw(d,g.LINE_STRIP,A,R,O,er.disabled,no(w,n.Color.red),$,U,y.debugBuffer,y.tileBorderIndexBuffer,y.debugSegments)}function Il(y,t,c){const d=y.context,g=d.gl,w=y.colorModeForRenderPass(),T=new Bi(g.LEQUAL,Bi.ReadWrite,y.depthRangeFor3D),A=y.useProgram("terrain"),R=t.getTerrainMesh();d.bindFramebuffer.set(null),d.viewport.set([0,0,y.width,y.height]);for(const O of c){const U=y.renderToTexture.getTexture(O),$=t.getTerrainData(O.tileID);d.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,U.texture);const Q={u_matrix:y.transform.calculatePosMatrix(O.tileID.toUnwrapped()),u_texture:0,u_ele_delta:t.getMeshFrameDelta(y.transform.zoom)};A.draw(d,g.TRIANGLES,T,Ki.disabled,w,er.backCCW,Q,$,"terrain",R.vertexBuffer,R.indexBuffer,R.segments)}}class hr{constructor(t,c){this.context=new go(t),this.transform=c,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:n.create(),renderTime:0},this.setup(),this.numSublayers=Ae.maxUnderzooming+Ae.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Jr}resize(t,c,d){if(this.width=Math.floor(t*d),this.height=Math.floor(c*d),this.pixelRatio=d,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const g of this.style._order)this.style._layers[g].resize()}setup(){const t=this.context,c=new n.PosArray;c.emplaceBack(0,0),c.emplaceBack(n.EXTENT,0),c.emplaceBack(0,n.EXTENT),c.emplaceBack(n.EXTENT,n.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(c,Lr.members),this.tileExtentSegments=n.SegmentVector.simpleSegment(0,0,4,2);const d=new n.PosArray;d.emplaceBack(0,0),d.emplaceBack(n.EXTENT,0),d.emplaceBack(0,n.EXTENT),d.emplaceBack(n.EXTENT,n.EXTENT),this.debugBuffer=t.createVertexBuffer(d,Lr.members),this.debugSegments=n.SegmentVector.simpleSegment(0,0,4,5);const g=new n.RasterBoundsArray;g.emplaceBack(0,0,0,0),g.emplaceBack(n.EXTENT,0,n.EXTENT,0),g.emplaceBack(0,n.EXTENT,0,n.EXTENT),g.emplaceBack(n.EXTENT,n.EXTENT,n.EXTENT,n.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(g,It.members),this.rasterBoundsSegments=n.SegmentVector.simpleSegment(0,0,4,2);const w=new n.PosArray;w.emplaceBack(0,0),w.emplaceBack(1,0),w.emplaceBack(0,1),w.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(w,Lr.members),this.viewportSegments=n.SegmentVector.simpleSegment(0,0,4,2);const T=new n.LineStripIndexArray;T.emplaceBack(0),T.emplaceBack(1),T.emplaceBack(3),T.emplaceBack(2),T.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(T);const A=new n.TriangleIndexArray;A.emplaceBack(0,1,2),A.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(A);const R=this.context.gl;this.stencilClearMode=new Ki({func:R.ALWAYS,mask:0},0,255,R.ZERO,R.ZERO,R.ZERO)}clearStencil(){const t=this.context,c=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const d=n.create();n.ortho(d,0,this.width,this.height,0,0,1),n.scale(d,d,[c.drawingBufferWidth,c.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,c.TRIANGLES,Bi.disabled,this.stencilClearMode,mi.disabled,er.disabled,wa(d),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,c){if(this.currentStencilSource===t.source||!t.isTileClipped()||!c||!c.length)return;this.currentStencilSource=t.source;const d=this.context,g=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(mi.disabled),d.setDepthMode(Bi.disabled);const w=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const T of c){const A=this._tileClippingMaskIDs[T.key]=this.nextStencilID++,R=this.style.map.terrain&&this.style.map.terrain.getTerrainData(T);w.draw(d,g.TRIANGLES,Bi.disabled,new Ki({func:g.ALWAYS,mask:0},A,255,g.KEEP,g.KEEP,g.REPLACE),mi.disabled,er.disabled,wa(T.posMatrix),R,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,c=this.context.gl;return new Ki({func:c.NOTEQUAL,mask:255},t,255,c.KEEP,c.KEEP,c.REPLACE)}stencilModeForClipping(t){const c=this.context.gl;return new Ki({func:c.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,c.KEEP,c.KEEP,c.REPLACE)}stencilConfigForOverlap(t){const c=this.context.gl,d=t.sort((T,A)=>A.overscaledZ-T.overscaledZ),g=d[d.length-1].overscaledZ,w=d[0].overscaledZ-g+1;if(w>1){this.currentStencilSource=void 0,this.nextStencilID+w>256&&this.clearStencil();const T={};for(let A=0;A=0;this.currentLayer--){const R=this.style._layers[d[this.currentLayer]],O=g[R.source],U=w[R.source];this._renderTileClippingMasks(R,U),this.renderLayer(this,O,R,U)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerhe.source&&!he.isHidden(U)?[O.sourceCaches[he.source]]:[]),me=Q.filter(he=>he.getSource().type==="vector"),fe=Q.filter(he=>he.getSource().type!=="vector"),xe=he=>{(!$||$.getSource().maxzoomxe(he)),$||fe.forEach(he=>xe(he)),$}(this.style,this.transform.zoom);R&&function(O,U,$){for(let Q=0;Q<$.length;Q++)Eh(O,U,$[Q])}(this,R,R.getVisibleCoordinates())}this.options.showPadding&&function(R){const O=R.transform.padding;Cl(R,R.transform.height-(O.top||0),3,xh),Cl(R,O.bottom||0,3,Gc),ka(R,O.left||0,3,Eo),ka(R,R.transform.width-(O.right||0),3,Tl);const U=R.transform.centerPoint;(function($,Q,me,fe){Qs($,Q-1,me-10,2,20,fe),Qs($,Q-10,me-1,20,2,fe)})(R,U.x,R.transform.height-U.y,Wc)}(this),this.context.setDefault()}renderLayer(t,c,d,g){if(!d.isHidden(this.transform.zoom)&&(d.type==="background"||d.type==="custom"||(g||[]).length))switch(this.id=d.id,d.type){case"symbol":(function(w,T,A,R,O){if(w.renderPass!=="translucent")return;const U=Ki.disabled,$=w.colorModeForRenderPass();(A._unevaluatedLayout.hasValue("text-variable-anchor")||A._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(Q,me,fe,xe,he,Ve,tt){const Ce=me.transform,je=he==="map",at=Ve==="map";for(const ot of Q){const ft=xe.getTile(ot),Et=ft.getBucket(fe);if(!Et||!Et.text||!Et.text.segments.get().length)continue;const yt=n.evaluateSizeForZoom(Et.textSizeData,Ce.zoom),At=$e(ft,1,me.transform.zoom),Wt=Gr(ot.posMatrix,at,je,me.transform,At),Di=fe.layout.get("icon-text-fit")!=="none"&&Et.hasIconData();if(yt){const Lt=Math.pow(2,Ce.zoom-ft.tileID.overscaledZ);vo(Et,je,at,tt,Ce,Wt,ot.posMatrix,Lt,yt,Di,me.style.map.terrain?(ui,Kt)=>me.style.map.terrain.getElevation(ot,ui,Kt):null)}}}(R,w,A,T,A.layout.get("text-rotation-alignment"),A.layout.get("text-pitch-alignment"),O),A.paint.get("icon-opacity").constantOr(1)!==0&&wo(w,T,A,R,!1,A.paint.get("icon-translate"),A.paint.get("icon-translate-anchor"),A.layout.get("icon-rotation-alignment"),A.layout.get("icon-pitch-alignment"),A.layout.get("icon-keep-upright"),U,$),A.paint.get("text-opacity").constantOr(1)!==0&&wo(w,T,A,R,!0,A.paint.get("text-translate"),A.paint.get("text-translate-anchor"),A.layout.get("text-rotation-alignment"),A.layout.get("text-pitch-alignment"),A.layout.get("text-keep-upright"),U,$),T.map.showCollisionBoxes&&(wl(w,T,A,R,A.paint.get("text-translate"),A.paint.get("text-translate-anchor"),!0),wl(w,T,A,R,A.paint.get("icon-translate"),A.paint.get("icon-translate-anchor"),!1))})(t,c,d,g,this.style.placement.variableOffsets);break;case"circle":(function(w,T,A,R){if(w.renderPass!=="translucent")return;const O=A.paint.get("circle-opacity"),U=A.paint.get("circle-stroke-width"),$=A.paint.get("circle-stroke-opacity"),Q=!A.layout.get("circle-sort-key").isConstant();if(O.constantOr(1)===0&&(U.constantOr(1)===0||$.constantOr(1)===0))return;const me=w.context,fe=me.gl,xe=w.depthModeForSublayer(0,Bi.ReadOnly),he=Ki.disabled,Ve=w.colorModeForRenderPass(),tt=[];for(let Ce=0;CeCe.sortKey-je.sortKey);for(const Ce of tt){const{programConfiguration:je,program:at,layoutVertexBuffer:ot,indexBuffer:ft,uniformValues:Et,terrainData:yt}=Ce.state;at.draw(me,fe.TRIANGLES,xe,he,Ve,er.disabled,Et,yt,A.id,ot,ft,Ce.segments,A.paint,w.transform.zoom,je)}})(t,c,d,g);break;case"heatmap":(function(w,T,A,R){if(A.paint.get("heatmap-opacity")!==0)if(w.renderPass==="offscreen"){const O=w.context,U=O.gl,$=Ki.disabled,Q=new mi([U.ONE,U.ONE],n.Color.transparent,[!0,!0,!0,!0]);(function(me,fe,xe){const he=me.gl;me.activeTexture.set(he.TEXTURE1),me.viewport.set([0,0,fe.width/4,fe.height/4]);let Ve=xe.heatmapFbo;if(Ve)he.bindTexture(he.TEXTURE_2D,Ve.colorAttachment.get()),me.bindFramebuffer.set(Ve.framebuffer);else{const tt=he.createTexture();he.bindTexture(he.TEXTURE_2D,tt),he.texParameteri(he.TEXTURE_2D,he.TEXTURE_WRAP_S,he.CLAMP_TO_EDGE),he.texParameteri(he.TEXTURE_2D,he.TEXTURE_WRAP_T,he.CLAMP_TO_EDGE),he.texParameteri(he.TEXTURE_2D,he.TEXTURE_MIN_FILTER,he.LINEAR),he.texParameteri(he.TEXTURE_2D,he.TEXTURE_MAG_FILTER,he.LINEAR),Ve=xe.heatmapFbo=me.createFramebuffer(fe.width/4,fe.height/4,!1,!1),function(Ce,je,at,ot){var ft,Et;const yt=Ce.gl,At=(ft=Ce.HALF_FLOAT)!==null&&ft!==void 0?ft:yt.UNSIGNED_BYTE,Wt=(Et=Ce.RGBA16F)!==null&&Et!==void 0?Et:yt.RGBA;yt.texImage2D(yt.TEXTURE_2D,0,Wt,je.width/4,je.height/4,0,yt.RGBA,At,null),ot.colorAttachment.set(at)}(me,fe,tt,Ve)}})(O,w,A),O.clear({color:n.Color.transparent});for(let me=0;me{const Ce=n.create();n.ortho(Ce,0,xe.width,xe.height,0,0,1);const je=xe.context.gl;return{u_matrix:Ce,u_world:[je.drawingBufferWidth,je.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:he.paint.get("heatmap-opacity")}})(O,U),null,U.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,U.paint,O.transform.zoom)}(w,A))})(t,c,d,g);break;case"line":(function(w,T,A,R){if(w.renderPass!=="translucent")return;const O=A.paint.get("line-opacity"),U=A.paint.get("line-width");if(O.constantOr(1)===0||U.constantOr(1)===0)return;const $=w.depthModeForSublayer(0,Bi.ReadOnly),Q=w.colorModeForRenderPass(),me=A.paint.get("line-dasharray"),fe=A.paint.get("line-pattern"),xe=fe.constantOr(1),he=A.paint.get("line-gradient"),Ve=A.getCrossfadeParameters(),tt=xe?"linePattern":me?"lineSDF":he?"lineGradient":"line",Ce=w.context,je=Ce.gl;let at=!0;for(const ot of R){const ft=T.getTile(ot);if(xe&&!ft.patternsLoaded())continue;const Et=ft.getBucket(A);if(!Et)continue;const yt=Et.programConfigurations.get(A.id),At=w.context.program.get(),Wt=w.useProgram(tt,yt),Di=at||Wt.program!==At,Lt=w.style.map.terrain&&w.style.map.terrain.getTerrainData(ot),ui=fe.constantOr(null);if(ui&&ft.imageAtlas){const Ei=ft.imageAtlas,ki=Ei.patternPositions[ui.to.toString()],Li=Ei.patternPositions[ui.from.toString()];ki&&Li&&yt.setConstantPatternPositions(ki,Li)}const Kt=Lt?ot:null,rr=xe?Oc(w,ft,A,Ve,Kt):me?dh(w,ft,A,me,Ve,Kt):he?fh(w,ft,A,Et.lineClipsArray.length,Kt):xa(w,ft,A,Kt);if(xe)Ce.activeTexture.set(je.TEXTURE0),ft.imageAtlasTexture.bind(je.LINEAR,je.CLAMP_TO_EDGE),yt.updatePaintBuffers(Ve);else if(me&&(Di||w.lineAtlas.dirty))Ce.activeTexture.set(je.TEXTURE0),w.lineAtlas.bind(Ce);else if(he){const Ei=Et.gradients[A.id];let ki=Ei.texture;if(A.gradientVersion!==Ei.version){let Li=256;if(A.stepInterpolant){const _r=T.getSource().maxzoom,Xi=ot.canonical.z===_r?Math.ceil(1<0?c.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const c=this.imageManager.getPattern(t.from.toString()),d=this.imageManager.getPattern(t.to.toString());return!c||!d}useProgram(t,c){this.cache=this.cache||{};const d=t+(c?c.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[d]||(this.cache[d]=new gr(this.context,vn[t],c,Rn[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[d]}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 Me(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:c}=this.context.gl;return this.width!==t||this.height!==c}}class os{constructor(t,c){this.points=t,this.planes=c}static fromInvProjectionMatrix(t,c,d){const g=Math.pow(2,d),w=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(A=>{const R=1/(A=n.transformMat4([],A,t))[3]/c*g;return n.mul$1(A,A,[R,R,1/A[3],R])}),T=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(A=>{const R=function(Q,me){var fe=me[0],xe=me[1],he=me[2],Ve=fe*fe+xe*xe+he*he;return Ve>0&&(Ve=1/Math.sqrt(Ve)),Q[0]=me[0]*Ve,Q[1]=me[1]*Ve,Q[2]=me[2]*Ve,Q}([],function(Q,me,fe){var xe=me[0],he=me[1],Ve=me[2],tt=fe[0],Ce=fe[1],je=fe[2];return Q[0]=he*je-Ve*Ce,Q[1]=Ve*tt-xe*je,Q[2]=xe*Ce-he*tt,Q}([],ne([],w[A[0]],w[A[1]]),ne([],w[A[2]],w[A[1]]))),O=-((U=R)[0]*($=w[A[1]])[0]+U[1]*$[1]+U[2]*$[2]);var U,$;return R.concat(O)});return new os(w,T)}}class Qr{constructor(t,c){this.min=t,this.max=c,this.center=function(d,g,w){return d[0]=.5*g[0],d[1]=.5*g[1],d[2]=.5*g[2],d}([],function(d,g,w){return d[0]=g[0]+w[0],d[1]=g[1]+w[1],d[2]=g[2]+w[2],d}([],this.min,this.max))}quadrant(t){const c=[t%2==0,t<2],d=ee(this.min),g=ee(this.max);for(let w=0;w=0&&T++;if(T===0)return 0;T!==c.length&&(d=!1)}if(d)return 2;for(let g=0;g<3;g++){let w=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(let A=0;Athis.max[g]-this.min[g])return 0}return 1}}class Ta{constructor(t=0,c=0,d=0,g=0){if(isNaN(t)||t<0||isNaN(c)||c<0||isNaN(d)||d<0||isNaN(g)||g<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=c,this.left=d,this.right=g}interpolate(t,c,d){return c.top!=null&&t.top!=null&&(this.top=n.interpolate.number(t.top,c.top,d)),c.bottom!=null&&t.bottom!=null&&(this.bottom=n.interpolate.number(t.bottom,c.bottom,d)),c.left!=null&&t.left!=null&&(this.left=n.interpolate.number(t.left,c.left,d)),c.right!=null&&t.right!=null&&(this.right=n.interpolate.number(t.right,c.right,d)),this}getCenter(t,c){const d=n.clamp((this.left+t-this.right)/2,0,t),g=n.clamp((this.top+c-this.bottom)/2,0,c);return new n.Point(d,g)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Ta(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class Ca{constructor(t,c,d,g,w){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=w===void 0||!!w,this._minZoom=t||0,this._maxZoom=c||22,this._minPitch=d??0,this._maxPitch=g??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new n.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ta,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const t=new Ca(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._minEleveationForCurrentTile=t._minEleveationForCurrentTile,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 n.Point(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const c=-n.wrap(t,-180,180)*Math.PI/180;this.angle!==c&&(this._unmodified=!1,this.angle=c,this._calcMatrices(),this.rotationMatrix=function(){var d=new n.ARRAY_TYPE(4);return n.ARRAY_TYPE!=Float32Array&&(d[1]=0,d[2]=0),d[0]=1,d[3]=1,d}(),function(d,g,w){var T=g[0],A=g[1],R=g[2],O=g[3],U=Math.sin(w),$=Math.cos(w);d[0]=T*$+R*U,d[1]=A*$+O*U,d[2]=T*-U+R*$,d[3]=A*-U+O*$}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const c=n.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==c&&(this._unmodified=!1,this._pitch=c,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 c=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==c&&(this._unmodified=!1,this._zoom=c,this.tileZoom=Math.max(0,Math.floor(c)),this.scale=this.zoomScale(c),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,c,d){this._unmodified=!1,this._edgeInsets.interpolate(t,c,d),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const c=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,c)}getVisibleUnwrappedCoordinates(t){const c=[new n.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const d=this.pointCoordinate(new n.Point(0,0)),g=this.pointCoordinate(new n.Point(this.width,0)),w=this.pointCoordinate(new n.Point(this.width,this.height)),T=this.pointCoordinate(new n.Point(0,this.height)),A=Math.floor(Math.min(d.x,g.x,w.x,T.x)),R=Math.floor(Math.max(d.x,g.x,w.x,T.x)),O=1;for(let U=A-O;U<=R+O;U++)U!==0&&c.push(new n.UnwrappedTileID(U,t))}return c}coveringTiles(t){var c,d;let g=this.coveringZoomLevel(t);const w=g;if(t.minzoom!==void 0&&gt.maxzoom&&(g=t.maxzoom);const T=this.pointCoordinate(this.getCameraPoint()),A=n.MercatorCoordinate.fromLngLat(this.center),R=Math.pow(2,g),O=[R*T.x,R*T.y,0],U=[R*A.x,R*A.y,0],$=os.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,g);let Q=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(Q=g);const me=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,fe=Ce=>({aabb:new Qr([Ce*R,0,0],[(Ce+1)*R,R,0]),zoom:0,x:0,y:0,wrap:Ce,fullyVisible:!1}),xe=[],he=[],Ve=g,tt=t.reparseOverscaled?w:g;if(this._renderWorldCopies)for(let Ce=1;Ce<=3;Ce++)xe.push(fe(-Ce)),xe.push(fe(Ce));for(xe.push(fe(0));xe.length>0;){const Ce=xe.pop(),je=Ce.x,at=Ce.y;let ot=Ce.fullyVisible;if(!ot){const Wt=Ce.aabb.intersects($);if(Wt===0)continue;ot=Wt===2}const ft=t.terrain?O:U,Et=Ce.aabb.distanceX(ft),yt=Ce.aabb.distanceY(ft),At=Math.max(Math.abs(Et),Math.abs(yt));if(Ce.zoom===Ve||At>me+(1<=Q){const Wt=Ve-Ce.zoom,Di=O[0]-.5-(je<>1),ui=Ce.zoom+1;let Kt=Ce.aabb.quadrant(Wt);if(t.terrain){const rr=new n.OverscaledTileID(ui,Ce.wrap,ui,Di,Lt),Ei=t.terrain.getMinMaxElevation(rr),ki=(c=Ei.minElevation)!==null&&c!==void 0?c:this.elevation,Li=(d=Ei.maxElevation)!==null&&d!==void 0?d:this.elevation;Kt=new Qr([Kt.min[0],Kt.min[1],ki],[Kt.max[0],Kt.max[1],Li])}xe.push({aabb:Kt,zoom:ui,x:Di,y:Lt,wrap:Ce.wrap,fullyVisible:ot})}}return he.sort((Ce,je)=>Ce.distanceSq-je.distanceSq).map(Ce=>Ce.tileID)}resize(t,c){this.width=t,this.height=c,this.pixelsToGLUnits=[2/t,-2/c],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 c=n.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new n.Point(n.mercatorXfromLng(t.lng)*this.worldSize,n.mercatorYfromLat(c)*this.worldSize)}unproject(t){return new n.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const c=this.pointLocation(this.centerPoint,t),d=t.getElevationForLngLatZoom(c,this.tileZoom);if(!(this.elevation-d))return;const g=this.getCameraPosition(),w=n.MercatorCoordinate.fromLngLat(g.lngLat,g.altitude),T=n.MercatorCoordinate.fromLngLat(c,d),A=w.x-T.x,R=w.y-T.y,O=w.z-T.z,U=Math.sqrt(A*A+R*R+O*O),$=this.scaleZoom(this.cameraToCenterDistance/U/this.tileSize);this._elevation=d,this._center=c,this.zoom=$}setLocationAtPoint(t,c){const d=this.pointCoordinate(c),g=this.pointCoordinate(this.centerPoint),w=this.locationCoordinate(t),T=new n.MercatorCoordinate(w.x-(d.x-g.x),w.y-(d.y-g.y));this.center=this.coordinateLocation(T),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,c){return c?this.coordinatePoint(this.locationCoordinate(t),c.getElevationForLngLatZoom(t,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,c){return this.coordinateLocation(this.pointCoordinate(t,c))}locationCoordinate(t){return n.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,c){if(c){const Q=c.pointCoordinate(t);if(Q!=null)return Q}const d=[t.x,t.y,0,1],g=[t.x,t.y,1,1];n.transformMat4(d,d,this.pixelMatrixInverse),n.transformMat4(g,g,this.pixelMatrixInverse);const w=d[3],T=g[3],A=d[1]/w,R=g[1]/T,O=d[2]/w,U=g[2]/T,$=O===U?0:(0-O)/(U-O);return new n.MercatorCoordinate(n.interpolate.number(d[0]/w,g[0]/T,$)/this.worldSize,n.interpolate.number(A,R,$)/this.worldSize)}coordinatePoint(t,c=0,d=this.pixelMatrix){const g=[t.x*this.worldSize,t.y*this.worldSize,c,1];return n.transformMat4(g,g,d),new n.Point(g[0]/g[3],g[1]/g[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new De().extend(this.pointLocation(new n.Point(0,t))).extend(this.pointLocation(new n.Point(this.width,t))).extend(this.pointLocation(new n.Point(this.width,this.height))).extend(this.pointLocation(new n.Point(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new De([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,c=!1){const d=t.key,g=c?this._alignedPosMatrixCache:this._posMatrixCache;if(g[d])return g[d];const w=t.canonical,T=this.worldSize/this.zoomScale(w.z),A=w.x+Math.pow(2,w.z)*t.wrap,R=n.identity(new Float64Array(16));return n.translate(R,R,[A*T,w.y*T,0]),n.scale(R,R,[T/n.EXTENT,T/n.EXTENT,1]),n.multiply(R,c?this.alignedProjMatrix:this.projMatrix,R),g[d]=new Float32Array(R),g[d]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,c,d,g,w=-90,T=90,A=-180,R=180;const O=this.size,U=this._unmodified;if(this.latRange){const me=this.latRange;w=n.mercatorYfromLat(me[1])*this.worldSize,T=n.mercatorYfromLat(me[0])*this.worldSize,t=T-wT&&(g=T-fe)}if(this.lngRange){const me=(A+R)/2,fe=n.wrap($.x,me-this.worldSize/2,me+this.worldSize/2),xe=O.x/2;fe-xeR&&(d=R-xe)}d===void 0&&g===void 0||(this.center=this.unproject(new n.Point(d!==void 0?d:$.x,g!==void 0?g:$.y)).wrap()),this._unmodified=U,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,c=this.point.x,d=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=n.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let g=n.identity(new Float64Array(16));n.scale(g,g,[this.width/2,-this.height/2,1]),n.translate(g,g,[1,-1,0]),this.labelPlaneMatrix=g,g=n.identity(new Float64Array(16)),n.scale(g,g,[1,-1,1]),n.translate(g,g,[-1,-1,0]),n.scale(g,g,[2/this.width,2/this.height,1]),this.glCoordMatrix=g;const w=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),T=Math.min(this.elevation,this._minEleveationForCurrentTile),A=w-T*this._pixelPerMeter/Math.cos(this._pitch),R=T<0?A:w,O=Math.PI/2+this._pitch,U=this._fov*(.5+t.y/this.height),$=Math.sin(U)*R/Math.sin(n.clamp(Math.PI-O-U,.01,Math.PI-.01)),Q=this.getHorizon(),me=2*Math.atan(Q/this.cameraToCenterDistance)*(.5+t.y/(2*Q)),fe=Math.sin(me)*R/Math.sin(n.clamp(Math.PI-O-me,.01,Math.PI-.01)),xe=Math.min($,fe),he=1.01*(Math.cos(Math.PI/2-this._pitch)*xe+R),Ve=this.height/50;g=new Float64Array(16),n.perspective(g,this._fov,this.width/this.height,Ve,he),g[8]=2*-t.x/this.width,g[9]=2*t.y/this.height,n.scale(g,g,[1,-1,1]),n.translate(g,g,[0,0,-this.cameraToCenterDistance]),n.rotateX(g,g,this._pitch),n.rotateZ(g,g,this.angle),n.translate(g,g,[-c,-d,0]),this.mercatorMatrix=n.scale([],g,[this.worldSize,this.worldSize,this.worldSize]),n.scale(g,g,[1,1,this._pixelPerMeter]),this.pixelMatrix=n.multiply(new Float64Array(16),this.labelPlaneMatrix,g),n.translate(g,g,[0,0,-this.elevation]),this.projMatrix=g,this.invProjMatrix=n.invert([],g),this.pixelMatrix3D=n.multiply(new Float64Array(16),this.labelPlaneMatrix,g);const tt=this.width%2/2,Ce=this.height%2/2,je=Math.cos(this.angle),at=Math.sin(this.angle),ot=c-Math.round(c)+je*tt+at*Ce,ft=d-Math.round(d)+je*Ce+at*tt,Et=new Float64Array(g);if(n.translate(Et,Et,[ot>.5?ot-1:ot,ft>.5?ft-1:ft,0]),this.alignedProjMatrix=Et,g=n.invert(new Float64Array(16),this.pixelMatrix),!g)throw new Error("failed to invert matrix");this.pixelMatrixInverse=g,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new n.Point(0,0)),c=[t.x*this.worldSize,t.y*this.worldSize,0,1];return n.transformMat4(c,c,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new n.Point(0,t))}getCameraQueryGeometry(t){const c=this.getCameraPoint();if(t.length===1)return[t[0],c];{let d=c.x,g=c.y,w=c.x,T=c.y;for(const A of t)d=Math.min(d,A.x),g=Math.min(g,A.y),w=Math.max(w,A.x),T=Math.max(T,A.y);return[new n.Point(d,g),new n.Point(w,g),new n.Point(w,T),new n.Point(d,T),new n.Point(d,g)]}}}function Al(y,t){let c,d=!1,g=null,w=null;const T=()=>{g=null,d&&(y.apply(w,c),g=setTimeout(T,t),d=!1)};return(...A)=>(d=!0,w=this,c=A,g||T(),g)}class ea{constructor(t){this._getCurrentHash=()=>{const c=window.location.hash.replace("#","");if(this._hashName){let d;return c.split("&").map(g=>g.split("=")).forEach(g=>{g[0]===this._hashName&&(d=g)}),(d&&d[1]||"").split("/")}return c.split("/")},this._onHashChange=()=>{const c=this._getCurrentHash();if(c.length>=3&&!c.some(d=>isNaN(d))){const d=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(c[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+c[2],+c[1]],zoom:+c[0],bearing:d,pitch:+(c[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const c=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,c)}catch{}},this._updateHash=Al(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const c=this._map.getCenter(),d=Math.round(100*this._map.getZoom())/100,g=Math.ceil((d*Math.LN2+Math.log(512/360/.5))/Math.LN10),w=Math.pow(10,g),T=Math.round(c.lng*w)/w,A=Math.round(c.lat*w)/w,R=this._map.getBearing(),O=this._map.getPitch();let U="";if(U+=t?`/${T}/${A}/${d}`:`${d}/${A}/${T}`,(R||O)&&(U+="/"+Math.round(10*R)/10),O&&(U+=`/${Math.round(O)}`),this._hashName){const $=this._hashName;let Q=!1;const me=window.location.hash.slice(1).split("&").map(fe=>{const xe=fe.split("=")[0];return xe===$?(Q=!0,`${xe}=${U}`):fe}).filter(fe=>fe);return Q||me.push(`${$}=${U}`),`#${me.join("&")}`}return`#${U}`}}const ws={linearity:.3,easing:n.bezier(0,0,.3,1)},Pl=n.extend({deceleration:2500,maxSpeed:1400},ws),Hc=n.extend({deceleration:20,maxSpeed:1400},ws),Kc=n.extend({deceleration:1e3,maxSpeed:360},ws),Xc=n.extend({deceleration:1e3,maxSpeed:90},ws);class Jc{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:n.browser.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,c=n.browser.now();for(;t.length>0&&c-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const c={zoom:0,bearing:0,pitch:0,pan:new n.Point(0,0),pinchAround:void 0,around:void 0};for(const{settings:w}of this._inertiaBuffer)c.zoom+=w.zoomDelta||0,c.bearing+=w.bearingDelta||0,c.pitch+=w.pitchDelta||0,w.panDelta&&c.pan._add(w.panDelta),w.around&&(c.around=w.around),w.pinchAround&&(c.pinchAround=w.pinchAround);const d=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,g={};if(c.pan.mag()){const w=Wn(c.pan.mag(),d,n.extend({},Pl,t||{}));g.offset=c.pan.mult(w.amount/c.pan.mag()),g.center=this._map.transform.center,Ia(g,w)}if(c.zoom){const w=Wn(c.zoom,d,Hc);g.zoom=this._map.transform.zoom+w.amount,Ia(g,w)}if(c.bearing){const w=Wn(c.bearing,d,Kc);g.bearing=this._map.transform.bearing+n.clamp(w.amount,-179,179),Ia(g,w)}if(c.pitch){const w=Wn(c.pitch,d,Xc);g.pitch=this._map.transform.pitch+w.amount,Ia(g,w)}if(g.zoom||g.bearing){const w=c.pinchAround===void 0?c.around:c.pinchAround;g.around=w?this._map.unproject(w):this._map.getCenter()}return this.clear(),n.extend(g,{noMoveStart:!0})}}function Ia(y,t){(!y.duration||y.durationc.unproject(R)),A=w.reduce((R,O,U,$)=>R.add(O.div($.length)),new n.Point(0,0));super(t,{points:w,point:A,lngLats:T,lngLat:c.unproject(A),originalEvent:d}),this._defaultPrevented=!1}}class Yc extends n.Event{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,c,d){super(t,{originalEvent:d}),this._defaultPrevented=!1}}class Qc{constructor(t,c){this._map=t,this._clickTolerance=c.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Yc(t.type,this._map,t))}mousedown(t,c){return this._mousedownPos=c,this._firePreventable(new xn(t.type,this._map,t))}mouseup(t){this._map.fire(new xn(t.type,this._map,t))}click(t,c){this._mousedownPos&&this._mousedownPos.dist(c)>=this._clickTolerance||this._map.fire(new xn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new xn(t.type,this._map,t))}mouseover(t){this._map.fire(new xn(t.type,this._map,t))}mouseout(t){this._map.fire(new xn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Aa(t.type,this._map,t))}touchmove(t){this._map.fire(new Aa(t.type,this._map,t))}touchend(t){this._map.fire(new Aa(t.type,this._map,t))}touchcancel(t){this._map.fire(new Aa(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class eu{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new xn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new xn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new xn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ta{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(n.Point.convert(t),this._map.terrain)}}class Pa{constructor(t,c){this._map=t,this._tr=new ta(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=c.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,c){this.isEnabled()&&t.shiftKey&&t.button===0&&(v.disableDrag(),this._startPos=this._lastPos=c,this._active=!0)}mousemoveWindow(t,c){if(!this._active)return;const d=c;if(this._lastPos.equals(d)||!this._box&&d.dist(this._startPos)w.fitScreenCoordinates(d,g,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&&(v.remove(this._box),this._box=null),v.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,c){return this._map.fire(new n.Event(t,{originalEvent:c}))}}function So(y,t){if(y.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${y.length}, points ${t.length}`);const c={};for(let d=0;dthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),d.length===this.numTouches&&(this.centroid=function(g){const w=new n.Point(0,0);for(const T of g)w._add(T);return w.div(g.length)}(c),this.touches=So(d,c)))}touchmove(t,c,d){if(this.aborted||!this.centroid)return;const g=So(d,c);for(const w in this.touches){const T=g[w];(!T||T.dist(this.touches[w])>30)&&(this.aborted=!0)}}touchend(t,c,d){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),d.length===0){const g=!this.aborted&&this.centroid;if(this.reset(),g)return g}}}class Un{constructor(t){this.singleTap=new Hn(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,c,d){this.singleTap.touchstart(t,c,d)}touchmove(t,c,d){this.singleTap.touchmove(t,c,d)}touchend(t,c,d){const g=this.singleTap.touchend(t,c,d);if(g){const w=t.timeStamp-this.lastTime<500,T=!this.lastTap||this.lastTap.dist(g)<30;if(w&&T||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=g,this.count===this.numTaps)return this.reset(),g}}}class tu{constructor(t){this._tr=new ta(t),this._zoomIn=new Un({numTouches:1,numTaps:2}),this._zoomOut=new Un({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,c,d){this._zoomIn.touchstart(t,c,d),this._zoomOut.touchstart(t,c,d)}touchmove(t,c,d){this._zoomIn.touchmove(t,c,d),this._zoomOut.touchmove(t,c,d)}touchend(t,c,d){const g=this._zoomIn.touchend(t,c,d),w=this._zoomOut.touchend(t,c,d),T=this._tr;return g?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:A=>A.easeTo({duration:300,zoom:T.zoom+1,around:T.unproject(g)},{originalEvent:t})}):w?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:A=>A.easeTo({duration:300,zoom:T.zoom-1,around:T.unproject(w)},{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 En{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 c=this._moveFunction(...t);if(c.bearingDelta||c.pitchDelta||c.around||c.panDelta)return this._active=!0,c}dragStart(t,c){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=c.length?c[0]:c,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,c){if(!this.isEnabled())return;const d=this._lastPoint;if(!d)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const g=c.length?c[0]:c;return!this._moved&&g.dist(d){y.mousedown=y.dragStart,y.mousemoveWindow=y.dragMove,y.mouseup=y.dragEnd,y.contextmenu=function(t){t.preventDefault()}},Dl=({enable:y,clickTolerance:t,bearingDegreesPerPixelMoved:c=.8})=>{const d=new zl({checkCorrectEvent:g=>v.mouseButton(g)===0&&g.ctrlKey||v.mouseButton(g)===2});return new En({clickTolerance:t,move:(g,w)=>({bearingDelta:(w.x-g.x)*c}),moveStateManager:d,enable:y,assignEvents:Ml})},ia=({enable:y,clickTolerance:t,pitchDegreesPerPixelMoved:c=-.5})=>{const d=new zl({checkCorrectEvent:g=>v.mouseButton(g)===0&&g.ctrlKey||v.mouseButton(g)===2});return new En({clickTolerance:t,move:(g,w)=>({pitchDelta:(w.y-g.y)*c}),moveStateManager:d,enable:y,assignEvents:Ml})};class xs{constructor(t,c){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=c,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new n.Point(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,c,d){return this._calculateTransform(t,c,d)}touchmove(t,c,d){if(this._map._cooperativeGestures&&(this._minTouches===2&&d.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,d.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(d.length0&&(this._active=!0);const g=So(d,c),w=new n.Point(0,0),T=new n.Point(0,0);let A=0;for(const O in g){const U=g[O],$=this._touches[O];$&&(w._add(U),T._add(U.sub($)),A++,g[O]=U)}if(this._touches=g,AMath.abs(y.x)}class Sh extends jt{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,c,d){super.touchstart(t,c,d),this._currentTouchCount=d.length}_start(t){this._lastPoints=t,La(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,c,d){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const g=t[0].sub(this._lastPoints[0]),w=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(g,w,d.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(g.y+w.y)/2*-.5}):void 0}gestureBeginsVertically(t,c,d){if(this._valid!==void 0)return this._valid;const g=t.mag()>=2,w=c.mag()>=2;if(!g&&!w)return;if(!g||!w)return this._firstMove===void 0&&(this._firstMove=d),d-this._firstMove<100&&void 0;const T=t.y>0==c.y>0;return La(t)&&La(c)&&T}}const kh={panStep:100,bearingStep:15,pitchStep:10};class Rl{constructor(t){this._tr=new ta(t);const c=kh;this._panStep=c.panStep,this._bearingStep=c.bearingStep,this._pitchStep=c.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let c=0,d=0,g=0,w=0,T=0;switch(t.keyCode){case 61:case 107:case 171:case 187:c=1;break;case 189:case 109:case 173:c=-1;break;case 37:t.shiftKey?d=-1:(t.preventDefault(),w=-1);break;case 39:t.shiftKey?d=1:(t.preventDefault(),w=1);break;case 38:t.shiftKey?g=1:(t.preventDefault(),T=-1);break;case 40:t.shiftKey?g=-1:(t.preventDefault(),T=1);break;default:return}return this._rotationDisabled&&(d=0,g=0),{cameraAnimation:A=>{const R=this._tr;A.easeTo({duration:300,easeId:"keyboardHandler",easing:ru,zoom:c?Math.round(R.zoom)+c*(t.shiftKey?2:1):R.zoom,bearing:R.bearing+d*this._bearingStep,pitch:R.pitch+g*this._pitchStep,offset:[-w*this._panStep,-T*this._panStep],center:R.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 ru(y){return y*(2-y)}const Bl=4.000244140625;class Th{constructor(t,c){this._onTimeout=d=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)},this._map=t,this._tr=new ta(t),this._el=t.getCanvasContainer(),this._triggerRenderFrame=c,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||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 c=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const d=n.browser.now(),g=d-(this._lastWheelEventTime||0);this._lastWheelEventTime=d,c!==0&&c%Bl==0?this._type="wheel":c!==0&&Math.abs(c)<4?this._type="trackpad":g>400?(this._type=null,this._lastValue=c,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(g*c)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,c+=this._lastValue)),t.shiftKey&&c&&(c/=4),this._type&&(this._lastWheelEvent=t,this._delta-=c,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const c=v.mousePos(this._el,t),d=this._tr;this._around=n.LngLat.convert(this._aroundCenter?d.center:d.unproject(c)),this._aroundPoint=d.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(this._delta!==0){const A=this._type==="wheel"&&Math.abs(this._delta)>Bl?this._wheelZoomRate:this._defaultZoomRate;let R=2/(1+Math.exp(-Math.abs(this._delta*A)));this._delta<0&&R!==0&&(R=1/R);const O=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(O*R))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const c=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,d=this._startZoom,g=this._easing;let w,T=!1;if(this._type==="wheel"&&d&&g){const A=Math.min((n.browser.now()-this._lastWheelEventTime)/200,1),R=g(A);w=n.interpolate.number(d,c,R),A<1?this._frameId||(this._frameId=!0):T=!0}else w=c,T=!0;return this._active=!0,T&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!T,zoomDelta:w-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let c=n.defaultEasing;if(this._prevEase){const d=this._prevEase,g=(n.browser.now()-d.start)/d.duration,w=d.easing(g+.01)-d.easing(g),T=.27/Math.sqrt(w*w+1e-4)*.01,A=Math.sqrt(.0729-T*T);c=n.bezier(T,A,.25,1)}return this._prevEase={start:n.browser.now(),duration:t,easing:c},c}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ch{constructor(t,c){this._clickZoom=t,this._tapZoom=c}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 Ol{constructor(t){this._tr=new ta(t),this.reset()}reset(){this._active=!1}dblclick(t,c){return t.preventDefault(),{cameraAnimation:d=>{d.easeTo({duration:300,zoom:this._tr.zoom+(t.shiftKey?-1:1),around:this._tr.unproject(c)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Fl{constructor(){this._tap=new Un({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,c,d){if(!this._swipePoint)if(this._tapTime){const g=c[0],w=t.timeStamp-this._tapTime<500,T=this._tapPoint.dist(g)<30;w&&T?d.length>0&&(this._swipePoint=g,this._swipeTouch=d[0].identifier):this.reset()}else this._tap.touchstart(t,c,d)}touchmove(t,c,d){if(this._tapTime){if(this._swipePoint){if(d[0].identifier!==this._swipeTouch)return;const g=c[0],w=g.y-this._swipePoint.y;return this._swipePoint=g,t.preventDefault(),this._active=!0,{zoomDelta:w/128}}}else this._tap.touchmove(t,c,d)}touchend(t,c,d){if(this._tapTime)this._swipePoint&&d.length===0&&this.reset();else{const g=this._tap.touchend(t,c,d);g&&(this._tapTime=t.timeStamp,this._tapPoint=g)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Nl{constructor(t,c,d){this._el=t,this._mousePan=c,this._touchPan=d}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 Ul{constructor(t,c,d){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=c,this._mousePitch=d}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 hn{constructor(t,c,d,g){this._el=t,this._touchZoom=c,this._touchRotate=d,this._tapDragZoom=g,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 Vn=y=>y.zoom||y.drag||y.pitch||y.rotate;class nu extends n.Event{}function Ra(y){return y.panDelta&&y.panDelta.mag()||y.zoomDelta||y.bearingDelta||y.pitchDelta}class Vl{constructor(t,c){this.handleWindowEvent=g=>{this.handleEvent(g,`${g.type}Window`)},this.handleEvent=(g,w)=>{if(g.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const T=g.type==="renderFrame"?void 0:g,A={needsRenderFrame:!1},R={},O={},U=g.touches,$=U?this._getMapTouches(U):void 0,Q=$?v.touchPos(this._el,$):v.mousePos(this._el,g);for(const{handlerName:xe,handler:he,allowed:Ve}of this._handlers){if(!he.isEnabled())continue;let tt;this._blockedByActive(O,Ve,xe)?he.reset():he[w||g.type]&&(tt=he[w||g.type](g,Q,$),this.mergeHandlerResult(A,R,tt,xe,T),tt&&tt.needsRenderFrame&&this._triggerRenderFrame()),(tt||he.isActive())&&(O[xe]=he)}const me={};for(const xe in this._previousActiveHandlers)O[xe]||(me[xe]=T);this._previousActiveHandlers=O,(Object.keys(me).length||Ra(A))&&(this._changes.push([A,R,me]),this._triggerRenderFrame()),(Object.keys(O).length||Ra(A))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:fe}=A;fe&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],fe(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Jc(t),this._bearingSnap=c.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(c);const d=this._el;this._listeners=[[d,"touchstart",{passive:!0}],[d,"touchmove",{passive:!1}],[d,"touchend",void 0],[d,"touchcancel",void 0],[d,"mousedown",void 0],[d,"mousemove",void 0],[d,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[d,"mouseover",void 0],[d,"mouseout",void 0],[d,"dblclick",void 0],[d,"click",void 0],[d,"keydown",{capture:!1}],[d,"keyup",void 0],[d,"wheel",{passive:!1}],[d,"contextmenu",void 0],[window,"blur",void 0]];for(const[g,w,T]of this._listeners)v.addEventListener(g,w,g===document?this.handleWindowEvent:this.handleEvent,T)}destroy(){for(const[t,c,d]of this._listeners)v.removeEventListener(t,c,t===document?this.handleWindowEvent:this.handleEvent,d)}_addDefaultHandlers(t){const c=this._map,d=c.getCanvasContainer();this._add("mapEvent",new Qc(c,t));const g=c.boxZoom=new Pa(c,t);this._add("boxZoom",g),t.interactive&&t.boxZoom&&g.enable();const w=new tu(c),T=new Ol(c);c.doubleClickZoom=new Ch(T,w),this._add("tapZoom",w),this._add("clickZoom",T),t.interactive&&t.doubleClickZoom&&c.doubleClickZoom.enable();const A=new Fl;this._add("tapDragZoom",A);const R=c.touchPitch=new Sh(c);this._add("touchPitch",R),t.interactive&&t.touchPitch&&c.touchPitch.enable(t.touchPitch);const O=Dl(t),U=ia(t);c.dragRotate=new Ul(t,O,U),this._add("mouseRotate",O,["mousePitch"]),this._add("mousePitch",U,["mouseRotate"]),t.interactive&&t.dragRotate&&c.dragRotate.enable();const $=(({enable:Ve,clickTolerance:tt})=>{const Ce=new zl({checkCorrectEvent:je=>v.mouseButton(je)===0&&!je.ctrlKey});return new En({clickTolerance:tt,move:(je,at)=>({around:at,panDelta:at.sub(je)}),activateOnStart:!0,moveStateManager:Ce,enable:Ve,assignEvents:Ml})})(t),Q=new xs(t,c);c.dragPan=new Nl(d,$,Q),this._add("mousePan",$),this._add("touchPan",Q,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&c.dragPan.enable(t.dragPan);const me=new $t,fe=new Da;c.touchZoomRotate=new hn(d,fe,me,A),this._add("touchRotate",me,["touchPan","touchZoom"]),this._add("touchZoom",fe,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&c.touchZoomRotate.enable(t.touchZoomRotate);const xe=c.scrollZoom=new Th(c,()=>this._triggerRenderFrame());this._add("scrollZoom",xe,["mousePan"]),t.interactive&&t.scrollZoom&&c.scrollZoom.enable(t.scrollZoom);const he=c.keyboard=new Rl(c);this._add("keyboard",he),t.interactive&&t.keyboard&&c.keyboard.enable(),this._add("blockableMapEvent",new eu(c))}_add(t,c,d){this._handlers.push({handlerName:t,handler:c,allowed:d}),this._handlersById[t]=c}stop(t){if(!this._updatingCamera){for(const{handler:c}of this._handlers)c.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!!Vn(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,c,d){for(const g in t)if(g!==d&&(!c||c.indexOf(g)<0))return!0;return!1}_getMapTouches(t){const c=[];for(const d of t)this._el.contains(d.target)&&c.push(d);return c}mergeHandlerResult(t,c,d,g,w){if(!d)return;n.extend(t,d);const T={handlerName:g,originalEvent:d.originalEvent||w};d.zoomDelta!==void 0&&(c.zoom=T),d.panDelta!==void 0&&(c.drag=T),d.pitchDelta!==void 0&&(c.pitch=T),d.bearingDelta!==void 0&&(c.rotate=T)}_applyChanges(){const t={},c={},d={};for(const[g,w,T]of this._changes)g.panDelta&&(t.panDelta=(t.panDelta||new n.Point(0,0))._add(g.panDelta)),g.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+g.zoomDelta),g.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+g.bearingDelta),g.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+g.pitchDelta),g.around!==void 0&&(t.around=g.around),g.pinchAround!==void 0&&(t.pinchAround=g.pinchAround),g.noInertia&&(t.noInertia=g.noInertia),n.extend(c,w),n.extend(d,T);this._updateMapTransform(t,c,d),this._changes=[]}_updateMapTransform(t,c,d){const g=this._map,w=g._getTransformForUpdate(),T=g.terrain;if(!(Ra(t)||T&&this._terrainMovement))return this._fireEvents(c,d,!0);let{panDelta:A,zoomDelta:R,bearingDelta:O,pitchDelta:U,around:$,pinchAround:Q}=t;Q!==void 0&&($=Q),g._stop(!0),$=$||g.transform.centerPoint;const me=w.pointLocation(A?$.sub(A):$);O&&(w.bearing+=O),U&&(w.pitch+=U),R&&(w.zoom+=R),T?this._terrainMovement||!c.drag&&!c.zoom?c.drag&&this._terrainMovement?w.center=w.pointLocation(w.centerPoint.sub(A)):w.setLocationAtPoint(me,$):(this._terrainMovement=!0,this._map._elevationFreeze=!0,w.setLocationAtPoint(me,$),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,w.recalculateZoom(g.terrain)})):w.setLocationAtPoint(me,$),g._applyUpdatedTransform(w),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(c,d,!0)}_fireEvents(t,c,d){const g=Vn(this._eventsInProgress),w=Vn(t),T={};for(const U in t){const{originalEvent:$}=t[U];this._eventsInProgress[U]||(T[`${U}start`]=$),this._eventsInProgress[U]=t[U]}!g&&w&&this._fireEvent("movestart",w.originalEvent);for(const U in T)this._fireEvent(U,T[U]);w&&this._fireEvent("move",w.originalEvent);for(const U in t){const{originalEvent:$}=t[U];this._fireEvent(U,$)}const A={};let R;for(const U in this._eventsInProgress){const{handlerName:$,originalEvent:Q}=this._eventsInProgress[U];this._handlersById[$].isActive()||(delete this._eventsInProgress[U],R=c[$]||Q,A[`${U}end`]=R)}for(const U in A)this._fireEvent(U,A[U]);const O=Vn(this._eventsInProgress);if(d&&(g||w)&&!O){this._updatingCamera=!0;const U=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),$=Q=>Q!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new nu("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class $l extends n.Evented{constructor(t,c){super(),this._renderFrameCallback=()=>{const d=Math.min((n.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(d)),d<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=c.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new n.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,c){return this.jumpTo({center:t},c)}panBy(t,c,d){return t=n.Point.convert(t).mult(-1),this.panTo(this.transform.center,n.extend({offset:t},c),d)}panTo(t,c,d){return this.easeTo(n.extend({center:t},c),d)}getZoom(){return this.transform.zoom}setZoom(t,c){return this.jumpTo({zoom:t},c),this}zoomTo(t,c,d){return this.easeTo(n.extend({zoom:t},c),d)}zoomIn(t,c){return this.zoomTo(this.getZoom()+1,t,c),this}zoomOut(t,c){return this.zoomTo(this.getZoom()-1,t,c),this}getBearing(){return this.transform.bearing}setBearing(t,c){return this.jumpTo({bearing:t},c),this}getPadding(){return this.transform.padding}setPadding(t,c){return this.jumpTo({padding:t},c),this}rotateTo(t,c,d){return this.easeTo(n.extend({bearing:t},c),d)}resetNorth(t,c){return this.rotateTo(0,n.extend({duration:1e3},t),c),this}resetNorthPitch(t,c){return this.easeTo(n.extend({bearing:0,pitch:0,duration:1e3},t),c),this}snapToNorth(t,c){return Math.abs(this.getBearing()){if(this._zooming&&(d.zoom=n.interpolate.number(g,R,ot)),this._rotating&&(d.bearing=n.interpolate.number(w,O,ot)),this._pitching&&(d.pitch=n.interpolate.number(T,U,ot)),this._padding&&(d.interpolatePadding(A,$,ot),me=d.centerPoint.add(Q)),this.terrain&&!t.freezeElevation&&this._updateElevation(ot),Ce)d.setLocationAtPoint(Ce,je);else{const ft=d.zoomScale(d.zoom-g),Et=R>g?Math.min(2,tt):Math.max(.5,tt),yt=Math.pow(Et,1-ot),At=d.unproject(he.add(Ve.mult(ot*yt)).mult(ft));d.setLocationAtPoint(d.renderWorldCopies?At.wrap():At,me)}this._applyUpdatedTransform(d),this._fireMoveEvents(c)},ot=>{this.terrain&&this._finalizeElevation(),this._afterEase(c,ot)},t),this}_prepareEase(t,c,d={}){this._moving=!0,c||d.moving||this.fire(new n.Event("movestart",t)),this._zooming&&!d.zooming&&this.fire(new n.Event("zoomstart",t)),this._rotating&&!d.rotating&&this.fire(new n.Event("rotatestart",t)),this._pitching&&!d.pitching&&this.fire(new n.Event("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const c=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&c!==this._elevationTarget){const d=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(d-(c-(d*t+this._elevationStart))/(1-t)),this._elevationTarget=c}this.transform.elevation=n.interpolate.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!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 c=t.clone(),{center:d,zoom:g,pitch:w,bearing:T,elevation:A}=this.transformCameraUpdate(c);d&&(c.center=d),g!==void 0&&(c.zoom=g),w!==void 0&&(c.pitch=w),T!==void 0&&(c.bearing=T),A!==void 0&&(c.elevation=A),this.transform.apply(c)}_fireMoveEvents(t){this.fire(new n.Event("move",t)),this._zooming&&this.fire(new n.Event("zoom",t)),this._rotating&&this.fire(new n.Event("rotate",t)),this._pitching&&this.fire(new n.Event("pitch",t))}_afterEase(t,c){if(this._easeId&&c&&this._easeId===c)return;delete this._easeId;const d=this._zooming,g=this._rotating,w=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,d&&this.fire(new n.Event("zoomend",t)),g&&this.fire(new n.Event("rotateend",t)),w&&this.fire(new n.Event("pitchend",t)),this.fire(new n.Event("moveend",t))}flyTo(t,c){if(!t.essential&&n.browser.prefersReducedMotion){const Kt=n.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Kt,c)}this.stop(),t=n.extend({offset:[0,0],speed:1.2,curve:1.42,easing:n.defaultEasing},t);const d=this._getTransformForUpdate(),g=this.getZoom(),w=this.getBearing(),T=this.getPitch(),A=this.getPadding(),R="zoom"in t?n.clamp(+t.zoom,d.minZoom,d.maxZoom):g,O="bearing"in t?this._normalizeBearing(t.bearing,w):w,U="pitch"in t?+t.pitch:T,$="padding"in t?t.padding:d.padding,Q=d.zoomScale(R-g),me=n.Point.convert(t.offset);let fe=d.centerPoint.add(me);const xe=d.pointLocation(fe),he=n.LngLat.convert(t.center||xe);this._normalizeCenter(he);const Ve=d.project(xe),tt=d.project(he).sub(Ve);let Ce=t.curve;const je=Math.max(d.width,d.height),at=je/Q,ot=tt.mag();if("minZoom"in t){const Kt=n.clamp(Math.min(t.minZoom,g,R),d.minZoom,d.maxZoom),rr=je/d.zoomScale(Kt-g);Ce=Math.sqrt(rr/ot*2)}const ft=Ce*Ce;function Et(Kt){const rr=(at*at-je*je+(Kt?-1:1)*ft*ft*ot*ot)/(2*(Kt?at:je)*ft*ot);return Math.log(Math.sqrt(rr*rr+1)-rr)}function yt(Kt){return(Math.exp(Kt)-Math.exp(-Kt))/2}function At(Kt){return(Math.exp(Kt)+Math.exp(-Kt))/2}const Wt=Et(!1);let Di=function(Kt){return At(Wt)/At(Wt+Ce*Kt)},Lt=function(Kt){return je*((At(Wt)*(yt(rr=Wt+Ce*Kt)/At(rr))-yt(Wt))/ft)/ot;var rr},ui=(Et(!0)-Wt)/Ce;if(Math.abs(ot)<1e-6||!isFinite(ui)){if(Math.abs(je-at)<1e-6)return this.easeTo(t,c);const Kt=att.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=w!==O,this._pitching=U!==T,this._padding=!d.isPaddingEqual($),this._prepareEase(c,!1),this.terrain&&this._prepareElevation(he),this._ease(Kt=>{const rr=Kt*ui,Ei=1/Di(rr);d.zoom=Kt===1?R:g+d.scaleZoom(Ei),this._rotating&&(d.bearing=n.interpolate.number(w,O,Kt)),this._pitching&&(d.pitch=n.interpolate.number(T,U,Kt)),this._padding&&(d.interpolatePadding(A,$,Kt),fe=d.centerPoint.add(me)),this.terrain&&!t.freezeElevation&&this._updateElevation(Kt);const ki=Kt===1?he:d.unproject(Ve.add(tt.mult(Lt(rr))).mult(Ei));d.setLocationAtPoint(d.renderWorldCopies?ki.wrap():ki,fe),this._applyUpdatedTransform(d),this._fireMoveEvents(c)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(c)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,c){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const d=this._onEaseEnd;delete this._onEaseEnd,d.call(this,c)}if(!t){const d=this.handlers;d&&d.stop(!1)}return this}_ease(t,c,d){d.animate===!1||d.duration===0?(t(1),c()):(this._easeStart=n.browser.now(),this._easeOptions=d,this._onEaseFrame=t,this._onEaseEnd=c,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,c){t=n.wrap(t,-180,180);const d=Math.abs(t-c);return Math.abs(t-360-c)180?-360:d<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(n.LngLat.convert(t),this.transform.tileZoom)-this.transform.elevation:null}}class jl{constructor(t={}){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=c=>{!c||c.sourceDataType!=="metadata"&&c.sourceDataType!=="visibility"&&c.dataType!=="style"&&c.type!=="terrain"||this._updateAttributions()},this._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"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=v.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=v.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=v.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(){v.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,c){const d=this._map._getUIString(`AttributionControl.${c}`);t.title=d,t.setAttribute("aria-label",d)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(g=>typeof g!="string"?"":g)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const g=this._map.style.stylesheet;this.styleOwner=g.owner,this.styleId=g.id}const c=this._map.style.sourceCaches;for(const g in c){const w=c[g];if(w.used||w.usedForTerrain){const T=w.getSource();T.attribution&&t.indexOf(T.attribution)<0&&t.push(T.attribution)}}t=t.filter(g=>String(g).trim()),t.sort((g,w)=>g.length-w.length),t=t.filter((g,w)=>{for(let T=w+1;T=0)return!1;return!0});const d=t.join(" | ");d!==this._attribHTML&&(this._attribHTML=d,t.length?(this._innerContainer.innerHTML=d,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Sn{constructor(t={}){this._updateCompact=()=>{const c=this._container.children;if(c.length){const d=c[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&d.classList.add("maplibregl-compact"):d.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=v.create("div","maplibregl-ctrl");const c=v.create("a","maplibregl-ctrl-logo");return c.target="_blank",c.rel="noopener nofollow",c.href="https://maplibre.org/",c.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),c.setAttribute("rel","noopener nofollow"),this._container.appendChild(c),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){v.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class tr{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const c=++this._id;return this._queue.push({callback:t,id:c,cancelled:!1}),c}remove(t){const c=this._currentlyRunning,d=c?this._queue.concat(c):this._queue;for(const g of d)if(g.id===t)return void(g.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const c=this._currentlyRunning=this._queue;this._queue=[];for(const d of c)if(!d.cancelled&&(d.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const ko={"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 ql=n.createLayout([{name:"a_pos3d",type:"Int16",components:3}]);class su extends n.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,c){this.sourceCache.update(t,c),this._renderableTilesKeys=[];const d={};for(const g of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:c}))d[g.key]=!0,this._renderableTilesKeys.push(g.key),this._tiles[g.key]||(g.posMatrix=new Float64Array(16),n.ortho(g.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),this._tiles[g.key]=new _e(g,this.tileSize));for(const g in this._tiles)d[g]||delete this._tiles[g]}freeRtt(t){for(const c in this._tiles){const d=this._tiles[c];(!t||d.tileID.equals(t)||d.tileID.isChildOf(t)||t.isChildOf(d.tileID))&&(d.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const c={};for(const d of this._renderableTilesKeys){const g=this._tiles[d].tileID;if(g.canonical.equals(t.canonical)){const w=t.clone();w.posMatrix=new Float64Array(16),n.ortho(w.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),c[d]=w}else if(g.canonical.isChildOf(t.canonical)){const w=t.clone();w.posMatrix=new Float64Array(16);const T=g.canonical.z-t.canonical.z,A=g.canonical.x-(g.canonical.x>>T<>T<>T;n.ortho(w.posMatrix,0,O,0,O,0,1),n.translate(w.posMatrix,w.posMatrix,[-A*O,-R*O,0]),c[d]=w}else if(t.canonical.isChildOf(g.canonical)){const w=t.clone();w.posMatrix=new Float64Array(16);const T=t.canonical.z-g.canonical.z,A=t.canonical.x-(t.canonical.x>>T<>T<>T;n.ortho(w.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),n.translate(w.posMatrix,w.posMatrix,[A*O,R*O,0]),n.scale(w.posMatrix,w.posMatrix,[1/2**T,1/2**T,0]),c[d]=w}}return c}getSourceTile(t,c){const d=this.sourceCache._source;let g=t.overscaledZ-this.deltaZoom;if(g>d.maxzoom&&(g=d.maxzoom),g=d.minzoom&&(!w||!w.dem);)w=this.sourceCache.getTileByID(t.scaledTo(g--).key);return w}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(c=>c.timeAdded>=t)}}class au{constructor(t,c,d){this.painter=t,this.sourceCache=new su(c),this.options=d,this.exaggeration=typeof d.exaggeration=="number"?d.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,c,d,g=n.EXTENT){var w;if(!(c>=0&&c=0&&dt.canonical.z&&(t.canonical.z>=g?w=t.canonical.z-g:n.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const T=t.canonical.x-(t.canonical.x>>w<>w<>8<<4|w>>8,c[T+3]=0;const d=new n.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(c.buffer)),g=new Me(t,d,t.gl.RGBA,{premultiply:!1});return g.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=g,g}pointCoordinate(t){const c=new Uint8Array(4),d=this.painter.context,g=d.gl;d.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),g.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,g.RGBA,g.UNSIGNED_BYTE,c),d.bindFramebuffer.set(null);const w=c[0]+(c[2]>>4<<8),T=c[1]+((15&c[2])<<8),A=this.coordsIndex[255-c[3]],R=A&&this.sourceCache.getTileByID(A);if(!R)return null;const O=this._coordsTextureSize,U=(1<t.id!==c),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const c of this._recentlyUsed)if(!this._objects[c].inUse)return this._objects[c];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 na={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Kn{constructor(t,c){this.painter=t,this.terrain=c,this.pool=new ou(t.context,30,c.sourceCache.tileSize*c.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,c){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(d=>!t._layers[d].isHidden(c)),this._coordsDescendingInv={};for(const d in t.sourceCaches){this._coordsDescendingInv[d]={};const g=t.sourceCaches[d].getVisibleCoordinates();for(const w of g){const T=this.terrain.sourceCache.getTerrainCoords(w);for(const A in T)this._coordsDescendingInv[d][A]||(this._coordsDescendingInv[d][A]=[]),this._coordsDescendingInv[d][A].push(T[A])}}this._coordsDescendingInvStr={};for(const d of t._order){const g=t._layers[d],w=g.source;if(na[g.type]&&!this._coordsDescendingInvStr[w]){this._coordsDescendingInvStr[w]={};for(const T in this._coordsDescendingInv[w])this._coordsDescendingInvStr[w][T]=this._coordsDescendingInv[w][T].map(A=>A.key).sort().join()}}for(const d of this._renderableTiles)for(const g in this._coordsDescendingInvStr){const w=this._coordsDescendingInvStr[g][d.tileID.key];w&&w!==d.rttCoords[g]&&(d.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;const c=t.type,d=this.painter,g=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(na[c]&&(this._prevType&&na[this._prevType]||this._stacks.push([]),this._prevType=c,this._stacks[this._stacks.length-1].push(t.id),!g))return!0;if(na[this._prevType]||na[c]&&g){this._prevType=c;const w=this._stacks.length-1,T=this._stacks[w]||[];for(const A of this._renderableTiles){if(this.pool.isFull()&&(Il(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(A),A.rtt[w]){const O=this.pool.getObjectForId(A.rtt[w].id);if(O.stamp===A.rtt[w].stamp){this.pool.useObject(O);continue}}const R=this.pool.getOrCreateFreeObject();this.pool.useObject(R),this.pool.stampObject(R),A.rtt[w]={id:R.id,stamp:R.stamp},d.context.bindFramebuffer.set(R.fbo.framebuffer),d.context.clear({color:n.Color.transparent,stencil:0}),d.currentStencilSource=void 0;for(let O=0;O{y.touchstart=y.dragStart,y.touchmoveWindow=y.dragMove,y.touchend=y.dragEnd},Co={showCompass:!0,showZoom:!0,visualizePitch:!1};class Zl{constructor(t,c,d=!1){this.mousedown=T=>{this.startMouse(n.extend({},T,{ctrlKey:!0,preventDefault:()=>T.preventDefault()}),v.mousePos(this.element,T)),v.addEventListener(window,"mousemove",this.mousemove),v.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=T=>{this.moveMouse(T,v.mousePos(this.element,T))},this.mouseup=T=>{this.mouseRotate.dragEnd(T),this.mousePitch&&this.mousePitch.dragEnd(T),this.offTemp()},this.touchstart=T=>{T.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=v.touchPos(this.element,T.targetTouches)[0],this.startTouch(T,this._startPos),v.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),v.addEventListener(window,"touchend",this.touchend))},this.touchmove=T=>{T.targetTouches.length!==1?this.reset():(this._lastPos=v.touchPos(this.element,T.targetTouches)[0],this.moveTouch(T,this._lastPos))},this.touchend=T=>{T.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const g=t.dragRotate._mouseRotate.getClickTolerance(),w=t.dragRotate._mousePitch.getClickTolerance();this.element=c,this.mouseRotate=Dl({clickTolerance:g,enable:!0}),this.touchRotate=(({enable:T,clickTolerance:A,bearingDegreesPerPixelMoved:R=.8})=>{const O=new iu;return new En({clickTolerance:A,move:(U,$)=>({bearingDelta:($.x-U.x)*R}),moveStateManager:O,enable:T,assignEvents:ci})})({clickTolerance:g,enable:!0}),this.map=t,d&&(this.mousePitch=ia({clickTolerance:w,enable:!0}),this.touchPitch=(({enable:T,clickTolerance:A,pitchDegreesPerPixelMoved:R=-.5})=>{const O=new iu;return new En({clickTolerance:A,move:(U,$)=>({pitchDelta:($.y-U.y)*R}),moveStateManager:O,enable:T,assignEvents:ci})})({clickTolerance:w,enable:!0})),v.addEventListener(c,"mousedown",this.mousedown),v.addEventListener(c,"touchstart",this.touchstart,{passive:!1}),v.addEventListener(c,"touchcancel",this.reset)}startMouse(t,c){this.mouseRotate.dragStart(t,c),this.mousePitch&&this.mousePitch.dragStart(t,c),v.disableDrag()}startTouch(t,c){this.touchRotate.dragStart(t,c),this.touchPitch&&this.touchPitch.dragStart(t,c),v.disableDrag()}moveMouse(t,c){const d=this.map,{bearingDelta:g}=this.mouseRotate.dragMove(t,c)||{};if(g&&d.setBearing(d.getBearing()+g),this.mousePitch){const{pitchDelta:w}=this.mousePitch.dragMove(t,c)||{};w&&d.setPitch(d.getPitch()+w)}}moveTouch(t,c){const d=this.map,{bearingDelta:g}=this.touchRotate.dragMove(t,c)||{};if(g&&d.setBearing(d.getBearing()+g),this.touchPitch){const{pitchDelta:w}=this.touchPitch.dragMove(t,c)||{};w&&d.setPitch(d.getPitch()+w)}}off(){const t=this.element;v.removeEventListener(t,"mousedown",this.mousedown),v.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),v.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),v.removeEventListener(window,"touchend",this.touchend),v.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){v.enableDrag(),v.removeEventListener(window,"mousemove",this.mousemove),v.removeEventListener(window,"mouseup",this.mouseup),v.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),v.removeEventListener(window,"touchend",this.touchend)}}let Xn;function en(y,t,c){if(y=new n.LngLat(y.lng,y.lat),t){const d=new n.LngLat(y.lng-360,y.lat),g=new n.LngLat(y.lng+360,y.lat),w=c.locationPoint(y).distSqr(t);c.locationPoint(d).distSqr(t)180;){const d=c.locationPoint(y);if(d.x>=0&&d.y>=0&&d.x<=c.width&&d.y<=c.height)break;y.lng>c.center.lng?y.lng-=360:y.lng+=360}return y}const Io={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 $n(y,t,c){const d=y.classList;for(const g in Io)d.remove(`maplibregl-${c}-anchor-${g}`);d.add(`maplibregl-${c}-anchor-${t}`)}class Gl extends n.Evented{constructor(t){if(super(),this._onKeyPress=c=>{const d=c.code,g=c.charCode||c.keyCode;d!=="Space"&&d!=="Enter"&&g!==32&&g!==13||this.togglePopup()},this._onMapClick=c=>{const d=c.originalEvent.target,g=this._element;this._popup&&(d===g||g.contains(d))&&this.togglePopup()},this._update=c=>{if(!this._map)return;const d=this._map.loaded()&&!this._map.isMoving();((c==null?void 0:c.type)==="terrain"||(c==null?void 0:c.type)==="render"&&!d)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=en(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let g="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?g=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(g=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let w="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?w="rotateX(0deg)":this._pitchAlignment==="map"&&(w=`rotateX(${this._map.getPitch()}deg)`),c&&c.type!=="moveend"||(this._pos=this._pos.round()),v.setTransform(this._element,`${Io[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${w} ${g}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const T=this._map.unproject(this._pos),A=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=T.distanceTo(this._lngLat)>20*A?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=c=>{if(!this._isDragging){const d=this._clickTolerance||this._map._clickTolerance;this._isDragging=c.point.dist(this._pointerdownPos)>=d}this._isDragging&&(this._pos=c.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 n.Event("dragstart"))),this.fire(new n.Event("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new n.Event("dragend")),this._state="inactive"},this._addDragHandler=c=>{this._element.contains(c.originalEvent.target)&&(c.preventDefault(),this._positionDelta=c.point.sub(this._pos).add(this._offset),this._pointerdownPos=c.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._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=n.Point.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=v.create("div"),this._element.setAttribute("aria-label","Map marker");const c=v.createNS("http://www.w3.org/2000/svg","svg"),d=41,g=27;c.setAttributeNS(null,"display","block"),c.setAttributeNS(null,"height",`${d}px`),c.setAttributeNS(null,"width",`${g}px`),c.setAttributeNS(null,"viewBox",`0 0 ${g} ${d}`);const w=v.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"stroke","none"),w.setAttributeNS(null,"stroke-width","1"),w.setAttributeNS(null,"fill","none"),w.setAttributeNS(null,"fill-rule","evenodd");const T=v.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill-rule","nonzero");const A=v.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"transform","translate(3.0, 29.0)"),A.setAttributeNS(null,"fill","#000000");const R=[{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 Ve of R){const tt=v.createNS("http://www.w3.org/2000/svg","ellipse");tt.setAttributeNS(null,"opacity","0.04"),tt.setAttributeNS(null,"cx","10.5"),tt.setAttributeNS(null,"cy","5.80029008"),tt.setAttributeNS(null,"rx",Ve.rx),tt.setAttributeNS(null,"ry",Ve.ry),A.appendChild(tt)}const O=v.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"fill",this._color);const U=v.createNS("http://www.w3.org/2000/svg","path");U.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),O.appendChild(U);const $=v.createNS("http://www.w3.org/2000/svg","g");$.setAttributeNS(null,"opacity","0.25"),$.setAttributeNS(null,"fill","#000000");const Q=v.createNS("http://www.w3.org/2000/svg","path");Q.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"),$.appendChild(Q);const me=v.createNS("http://www.w3.org/2000/svg","g");me.setAttributeNS(null,"transform","translate(6.0, 7.0)"),me.setAttributeNS(null,"fill","#FFFFFF");const fe=v.createNS("http://www.w3.org/2000/svg","g");fe.setAttributeNS(null,"transform","translate(8.0, 8.0)");const xe=v.createNS("http://www.w3.org/2000/svg","circle");xe.setAttributeNS(null,"fill","#000000"),xe.setAttributeNS(null,"opacity","0.25"),xe.setAttributeNS(null,"cx","5.5"),xe.setAttributeNS(null,"cy","5.5"),xe.setAttributeNS(null,"r","5.4999962");const he=v.createNS("http://www.w3.org/2000/svg","circle");he.setAttributeNS(null,"fill","#FFFFFF"),he.setAttributeNS(null,"cx","5.5"),he.setAttributeNS(null,"cy","5.5"),he.setAttributeNS(null,"r","5.4999962"),fe.appendChild(xe),fe.appendChild(he),T.appendChild(A),T.appendChild(O),T.appendChild($),T.appendChild(me),T.appendChild(fe),c.appendChild(T),c.setAttributeNS(null,"height",d*this._scale+"px"),c.setAttributeNS(null,"width",g*this._scale+"px"),this._element.appendChild(c),this._offset=n.Point.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",c=>{c.preventDefault()}),this._element.addEventListener("mousedown",c=>{c.preventDefault()}),$n(this._element,this._anchor,"marker"),t&&t.className)for(const c of t.className.split(" "))this._element.classList.add(c);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),t.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("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),v.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=n.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 g=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[g,-1*(38.1-13.5+g)],"bottom-right":[-g,-1*(38.1-13.5+g)],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}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(t){return this._offset=n.Point.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ba={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Yi=0,ir=!1;const lu={maxWidth:100,unit:"metric"};function sa(y,t,c){const d=c&&c.maxWidth||100,g=y._container.clientHeight/2,w=y.unproject([0,g]),T=y.unproject([d,g]),A=w.distanceTo(T);if(c&&c.unit==="imperial"){const R=3.2808*A;R>5280?Es(t,d,R/5280,y._getUIString("ScaleControl.Miles")):Es(t,d,R,y._getUIString("ScaleControl.Feet"))}else c&&c.unit==="nautical"?Es(t,d,A/1852,y._getUIString("ScaleControl.NauticalMiles")):A>=1e3?Es(t,d,A/1e3,y._getUIString("ScaleControl.Kilometers")):Es(t,d,A,y._getUIString("ScaleControl.Meters"))}function Es(y,t,c,d){const g=function(w){const T=Math.pow(10,`${Math.floor(w)}`.length-1);let A=w/T;return A=A>=10?10:A>=5?5:A>=3?3:A>=2?2:A>=1?1:function(R){const O=Math.pow(10,Math.ceil(-Math.log(R)/Math.LN10));return Math.round(R*O)/O}(A),T*A}(c);y.style.width=t*(g/c)+"px",y.innerHTML=`${g} ${d}`}const Wl={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Hl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ao(y){if(y){if(typeof y=="number"){const t=Math.round(Math.abs(y)/Math.SQRT2);return{center:new n.Point(0,0),top:new n.Point(0,y),"top-left":new n.Point(t,t),"top-right":new n.Point(-t,t),bottom:new n.Point(0,-y),"bottom-left":new n.Point(t,-t),"bottom-right":new n.Point(-t,-t),left:new n.Point(y,0),right:new n.Point(-y,0)}}if(y instanceof n.Point||Array.isArray(y)){const t=n.Point.convert(y);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:n.Point.convert(y.center||[0,0]),top:n.Point.convert(y.top||[0,0]),"top-left":n.Point.convert(y["top-left"]||[0,0]),"top-right":n.Point.convert(y["top-right"]||[0,0]),bottom:n.Point.convert(y.bottom||[0,0]),"bottom-left":n.Point.convert(y["bottom-left"]||[0,0]),"bottom-right":n.Point.convert(y["bottom-right"]||[0,0]),left:n.Point.convert(y.left||[0,0]),right:n.Point.convert(y.right||[0,0])}}return Ao(new n.Point(0,0))}const Oa={extend:(y,...t)=>n.extend(y,...t),run(y){y()},logToElement(y,t=!1,c="log"){const d=window.document.getElementById(c);d&&(t&&(d.innerHTML=""),d.innerHTML+=`
${y}`)}},Kl=_;class ji{static get version(){return Kl}static get workerCount(){return ct.workerCount}static set workerCount(t){ct.workerCount=t}static get maxParallelImageRequests(){return n.config.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(t){n.config.MAX_PARALLEL_IMAGE_REQUESTS=t}static get workerUrl(){return n.config.WORKER_URL}static set workerUrl(t){n.config.WORKER_URL=t}static addProtocol(t,c){n.config.REGISTERED_PROTOCOLS[t]=c}static removeProtocol(t){delete n.config.REGISTERED_PROTOCOLS[t]}}return ji.Map=class extends $l{constructor(y){if(n.PerformanceUtils.mark(n.PerformanceMarkers.create),(y=n.extend({},Qt,y)).minZoom!=null&&y.maxZoom!=null&&y.minZoom>y.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(y.minPitch!=null&&y.maxPitch!=null&&y.minPitch>y.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(y.minPitch!=null&&y.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(y.maxPitch!=null&&y.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new Ca(y.minZoom,y.maxZoom,y.minPitch,y.maxPitch,y.renderWorldCopies),{bearingSnap:y.bearingSnap}),this._cooperativeGesturesOnWheel=t=>{this._onCooperativeGesture(t,t[this._metaKey],1)},this._contextLost=t=>{t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new n.Event("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new n.Event("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=y.interactive,this._cooperativeGestures=y.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=y.maxTileCacheSize,this._maxTileCacheZoomLevels=y.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=y.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=y.preserveDrawingBuffer,this._antialias=y.antialias,this._trackResize=y.trackResize,this._bearingSnap=y.bearingSnap,this._refreshExpiredTiles=y.refreshExpiredTiles,this._fadeDuration=y.fadeDuration,this._crossSourceCollisions=y.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=y.collectResourceTiming,this._renderTaskQueue=new tr,this._controls=[],this._mapId=n.uniqueId(),this._locale=n.extend({},ko,y.locale),this._clickTolerance=y.clickTolerance,this._overridePixelRatio=y.pixelRatio,this._maxCanvasSize=y.maxCanvasSize,this.transformCameraUpdate=y.transformCameraUpdate,this._imageQueueHandle=L.addThrottleControl(()=>this.isMoving()),this._requestManager=new F(y.transformRequest),typeof y.container=="string"){if(this._container=document.getElementById(y.container),!this._container)throw new Error(`Container '${y.container}' not found.`)}else{if(!(y.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=y.container}if(y.maxBounds&&this.setMaxBounds(y.maxBounds),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 t=!1;const c=Al(d=>{this._trackResize&&!this._removed&&this.resize(d)._update()},50);this._resizeObserver=new ResizeObserver(d=>{t?c(d):t=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Vl(this,y),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=y.hash&&new ea(typeof y.hash=="string"&&y.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch}),y.bounds&&(this.resize(),this.fitBounds(y.bounds,n.extend({},y.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=y.localIdeographFontFamily,this._validateStyle=y.validateStyle,y.style&&this.setStyle(y.style,{localIdeographFontFamily:y.localIdeographFontFamily}),y.attributionControl&&this.addControl(new jl({customAttribution:y.customAttribution})),y.maplibreLogo&&this.addControl(new Sn,y.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",t=>{this._update(t.dataType==="style"),this.fire(new n.Event(`${t.dataType}data`,t))}),this.on("dataloading",t=>{this.fire(new n.Event(`${t.dataType}dataloading`,t))}),this.on("dataabort",t=>{this.fire(new n.Event("sourcedataabort",t))})}_getMapId(){return this._mapId}addControl(y,t){if(t===void 0&&(t=y.getDefaultPosition?y.getDefaultPosition():"top-right"),!y||!y.onAdd)return this.fire(new n.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const c=y.onAdd(this);this._controls.push(y);const d=this._controlPositions[t];return t.indexOf("bottom")!==-1?d.insertBefore(c,d.firstChild):d.appendChild(c),this}removeControl(y){if(!y||!y.onRemove)return this.fire(new n.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(y);return t>-1&&this._controls.splice(t,1),y.onRemove(this),this}hasControl(y){return this._controls.indexOf(y)>-1}calculateCameraOptionsFromTo(y,t,c,d){return d==null&&this.terrain&&(d=this.terrain.getElevationForLngLatZoom(c,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(y,t,c,d)}resize(y){var t;const c=this._containerDimensions(),d=c[0],g=c[1],w=this._getClampedPixelRatio(d,g);if(this._resizeCanvas(d,g,w),this.painter.resize(d,g,w),this.painter.overLimit()){const A=this.painter.context.gl;this._maxCanvasSize=[A.drawingBufferWidth,A.drawingBufferHeight];const R=this._getClampedPixelRatio(d,g);this._resizeCanvas(d,g,R),this.painter.resize(d,g,R)}this.transform.resize(d,g),(t=this._requestedCameraState)===null||t===void 0||t.resize(d,g);const T=!this._moving;return T&&(this.stop(),this.fire(new n.Event("movestart",y)).fire(new n.Event("move",y))),this.fire(new n.Event("resize",y)),T&&this.fire(new n.Event("moveend",y)),this}_getClampedPixelRatio(y,t){const{0:c,1:d}=this._maxCanvasSize,g=this.getPixelRatio(),w=y*g,T=t*g;return Math.min(w>c?c/w:1,T>d?d/T:1)*g}getPixelRatio(){var y;return(y=this._overridePixelRatio)!==null&&y!==void 0?y:devicePixelRatio}setPixelRatio(y){this._overridePixelRatio=y,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(y){return this.transform.setMaxBounds(De.convert(y)),this._update()}setMinZoom(y){if((y=y??-2)>=-2&&y<=this.transform.maxZoom)return this.transform.minZoom=y,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=y,this._update(),this.getZoom()>y&&this.setZoom(y),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(y){if((y=y??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(y>=0&&y<=this.transform.maxPitch)return this.transform.minPitch=y,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(y>=this.transform.minPitch)return this.transform.maxPitch=y,this._update(),this.getPitch()>y&&this.setPitch(y),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(y){return this.transform.renderWorldCopies=y,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(y){return this._cooperativeGestures=y,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(y){return this.transform.locationPoint(n.LngLat.convert(y),this.style&&this.terrain)}unproject(y){return this.transform.pointLocation(n.Point.convert(y),this.terrain)}isMoving(){var y;return this._moving||((y=this.handlers)===null||y===void 0?void 0:y.isMoving())}isZooming(){var y;return this._zooming||((y=this.handlers)===null||y===void 0?void 0:y.isZooming())}isRotating(){var y;return this._rotating||((y=this.handlers)===null||y===void 0?void 0:y.isRotating())}_createDelegatedListener(y,t,c){if(y==="mouseenter"||y==="mouseover"){let d=!1;return{layer:t,listener:c,delegates:{mousemove:w=>{const T=this.getLayer(t)?this.queryRenderedFeatures(w.point,{layers:[t]}):[];T.length?d||(d=!0,c.call(this,new xn(y,this,w.originalEvent,{features:T}))):d=!1},mouseout:()=>{d=!1}}}}if(y==="mouseleave"||y==="mouseout"){let d=!1;return{layer:t,listener:c,delegates:{mousemove:T=>{(this.getLayer(t)?this.queryRenderedFeatures(T.point,{layers:[t]}):[]).length?d=!0:d&&(d=!1,c.call(this,new xn(y,this,T.originalEvent)))},mouseout:T=>{d&&(d=!1,c.call(this,new xn(y,this,T.originalEvent)))}}}}{const d=g=>{const w=this.getLayer(t)?this.queryRenderedFeatures(g.point,{layers:[t]}):[];w.length&&(g.features=w,c.call(this,g),delete g.features)};return{layer:t,listener:c,delegates:{[y]:d}}}}on(y,t,c){if(c===void 0)return super.on(y,t);const d=this._createDelegatedListener(y,t,c);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[y]=this._delegatedListeners[y]||[],this._delegatedListeners[y].push(d);for(const g in d.delegates)this.on(g,d.delegates[g]);return this}once(y,t,c){if(c===void 0)return super.once(y,t);const d=this._createDelegatedListener(y,t,c);for(const g in d.delegates)this.once(g,d.delegates[g]);return this}off(y,t,c){return c===void 0?super.off(y,t):(this._delegatedListeners&&this._delegatedListeners[y]&&(d=>{const g=this._delegatedListeners[y];for(let w=0;wthis._updateStyle(y,t));const c=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!y)),y?(this.style=new kr(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof y=="string"?this.style.loadURL(y,t,c):this.style.loadJSON(y,t,c),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new kr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(y,t){if(typeof y=="string"){const c=this._requestManager.transformRequest(y,D.Style);n.getJSON(c,(d,g)=>{d?this.fire(new n.ErrorEvent(d)):g&&this._updateDiff(g,t)})}else typeof y=="object"&&this._updateDiff(y,t)}_updateDiff(y,t){try{this.style.setState(y,t)&&this._update(!0)}catch(c){n.warnOnce(`Unable to perform style diff: ${c.message||c.error||c}. Rebuilding the style from scratch.`),this._updateStyle(y,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():n.warnOnce("There is no style added to the map.")}addSource(y,t){return this._lazyInitEmptyStyle(),this.style.addSource(y,t),this._update(!0)}isSourceLoaded(y){const t=this.style&&this.style.sourceCaches[y];if(t!==void 0)return t.loaded();this.fire(new n.ErrorEvent(new Error(`There is no source with ID '${y}'`)))}setTerrain(y){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),y){const t=this.style.sourceCaches[y.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${y.source}`);for(const c in this.style._layers){const d=this.style._layers[c];d.type==="hillshade"&&d.source===y.source&&n.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 au(this.painter,t,y),this.painter.renderToTexture=new Kn(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=c=>{c.dataType==="style"?this.terrain.sourceCache.freeRtt():c.dataType==="source"&&c.tile&&(c.sourceId!==y.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(c.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._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new n.Event("terrain",{terrain:y})),this}getTerrain(){var y,t;return(t=(y=this.terrain)===null||y===void 0?void 0:y.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const y=this.style&&this.style.sourceCaches;for(const t in y){const c=y[t]._tiles;for(const d in c){const g=c[d];if(g.state!=="loaded"&&g.state!=="errored")return!1}}return!0}addSourceType(y,t,c){return this._lazyInitEmptyStyle(),this.style.addSourceType(y,t,c)}removeSource(y){return this.style.removeSource(y),this._update(!0)}getSource(y){return this.style.getSource(y)}addImage(y,t,c={}){const{pixelRatio:d=1,sdf:g=!1,stretchX:w,stretchY:T,content:A}=c;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||n.isImageBitmap(t))){if(t.width===void 0||t.height===void 0)return this.fire(new n.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:R,height:O,data:U}=t,$=t;return this.style.addImage(y,{data:new n.RGBAImage({width:R,height:O},new Uint8Array(U)),pixelRatio:d,stretchX:w,stretchY:T,content:A,sdf:g,version:0,userImage:$}),$.onAdd&&$.onAdd(this,y),this}}{const{width:R,height:O,data:U}=n.browser.getImageData(t);this.style.addImage(y,{data:new n.RGBAImage({width:R,height:O},U),pixelRatio:d,stretchX:w,stretchY:T,content:A,sdf:g,version:0})}}updateImage(y,t){const c=this.style.getImage(y);if(!c)return this.fire(new n.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=t instanceof HTMLImageElement||n.isImageBitmap(t)?n.browser.getImageData(t):t,{width:g,height:w,data:T}=d;if(g===void 0||w===void 0)return this.fire(new n.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(g!==c.data.width||w!==c.data.height)return this.fire(new n.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const A=!(t instanceof HTMLImageElement||n.isImageBitmap(t));return c.data.replace(T,A),this.style.updateImage(y,c),this}getImage(y){return this.style.getImage(y)}hasImage(y){return y?!!this.style.getImage(y):(this.fire(new n.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(y){this.style.removeImage(y)}loadImage(y,t){L.getImage(this._requestManager.transformRequest(y,D.Image),t)}listImages(){return this.style.listImages()}addLayer(y,t){return this._lazyInitEmptyStyle(),this.style.addLayer(y,t),this._update(!0)}moveLayer(y,t){return this.style.moveLayer(y,t),this._update(!0)}removeLayer(y){return this.style.removeLayer(y),this._update(!0)}getLayer(y){return this.style.getLayer(y)}setLayerZoomRange(y,t,c){return this.style.setLayerZoomRange(y,t,c),this._update(!0)}setFilter(y,t,c={}){return this.style.setFilter(y,t,c),this._update(!0)}getFilter(y){return this.style.getFilter(y)}setPaintProperty(y,t,c,d={}){return this.style.setPaintProperty(y,t,c,d),this._update(!0)}getPaintProperty(y,t){return this.style.getPaintProperty(y,t)}setLayoutProperty(y,t,c,d={}){return this.style.setLayoutProperty(y,t,c,d),this._update(!0)}getLayoutProperty(y,t){return this.style.getLayoutProperty(y,t)}setGlyphs(y,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(y,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(y,t,c={}){return this._lazyInitEmptyStyle(),this.style.addSprite(y,t,c,d=>{d||this._update(!0)}),this}removeSprite(y){return this._lazyInitEmptyStyle(),this.style.removeSprite(y),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(y,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(y,t,c=>{c||this._update(!0)}),this}setLight(y,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(y,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(y,t){return this.style.setFeatureState(y,t),this._update()}removeFeatureState(y,t){return this.style.removeFeatureState(y,t),this._update()}getFeatureState(y){return this.style.getFeatureState(y)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let y=0,t=0;return this._container&&(y=this._container.clientWidth||400,t=this._container.clientHeight||300),[y,t]}_setupContainer(){const y=this._container;y.classList.add("maplibregl-map");const t=this._canvasContainer=v.create("div","maplibregl-canvas-container",y);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=v.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 c=this._containerDimensions(),d=this._getClampedPixelRatio(c[0],c[1]);this._resizeCanvas(c[0],c[1],d);const g=this._controlContainer=v.create("div","maplibregl-control-container",y),w=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(T=>{w[T]=v.create("div",`maplibregl-ctrl-${T} `,g)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=v.create("div","maplibregl-cooperative-gesture-screen",this._container);let y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(y=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
${y}
${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
- `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){v.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(y,t,c){this._canvas.width=Math.floor(c*y),this._canvas.height=Math.floor(c*t),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{t={requestedAttributes:y},d&&(t.statusMessage=d.statusMessage,t.type=d.type)},{once:!0});const c=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!c){const d="Failed to initialize WebGL";throw t?(t.message=d,new Error(JSON.stringify(t))):new Error(d)}this.painter=new hr(c,this.transform),S.testSupport(c)}_onCooperativeGesture(y,t,c){return!t&&c<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(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let c=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,w=n.browser.now();this.style.zoomHistory.update(g,w);const k=new n.EvaluationParameters(g,{now:w,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),A=k.crossFadingFactor();A===1&&A===this._crossFadingFactor||(c=!0,this._crossFadingFactor=A),this.style.update(k)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),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 n.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,n.PerformanceUtils.mark(n.PerformanceMarkers.load),this.fire(new n.Event("load"))),this.style&&(this.style.hasTransitions()||c)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new n.Event("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,n.PerformanceUtils.mark(n.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const c of this._controls)c.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),R.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.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),v.remove(this._canvasContainer),v.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),n.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new n.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=n.browser.frame(y=>{n.PerformanceUtils.frame(y),this._frame=null,this._render(y)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return To}getCameraTargetElevation(){return this.transform.elevation}},ji.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const t=this._map.getZoom(),c=t===this._map.getMaxZoom(),d=t===this._map.getMinZoom();this._zoomInButton.disabled=c,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",c.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,c)=>{const d=this._map._getUIString(`NavigationControl.${c}`);t.title=d,t.setAttribute("aria-label",d)},this.options=n.extend({},Co,y),this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),v.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})),v.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=v.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,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 Zl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){v.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(y,t){const c=v.create("button",y,this._container);return c.type="button",c.addEventListener("click",t),c}},ji.GeolocateControl=class extends n.Evented{constructor(y){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new n.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),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(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new n.Event("geolocate",t)),this._finish()}},this._updateCamera=t=>{const c=new n.LngLat(t.coords.longitude,t.coords.latitude),d=t.coords.accuracy,g=this._map.getBearing(),w=n.extend({bearing:g},this.options.fitBoundsOptions),k=Me.fromLngLat(c,d);this._map.fitBounds(k,w,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const c=new n.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(c).addTo(this._map),this._userLocationDotMarker.setLngLat(c).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.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 c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=c,this._geolocateButton.setAttribute("aria-label",c),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&ir)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new n.Event("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",c=>c.preventDefault()),this._geolocateButton=v.create("button","maplibregl-ctrl-geolocate",this._container),v.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){n.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=c,this._geolocateButton.setAttribute("aria-label",c)}else{const c=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=c,this._geolocateButton.setAttribute("aria-label",c)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=v.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Gl({element:this._dotElement}),this._circleElement=v.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Gl({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",c=>{c.geolocateSource||this._watchState!=="ACTIVE_LOCK"||c.originalEvent&&c.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 n.Event("trackuserlocationend")))})}},this.options=n.extend({},Ba,y)}onAdd(y){return this._map=y,this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,c=!1){Xn===void 0||c?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Xn=d.state!=="denied",t(Xn)}).catch(()=>{Xn=!!window.navigator.geolocation,t(Xn)}):(Xn=!!window.navigator.geolocation,t(Xn)):t(Xn)}(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(),v.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Yi=0,ir=!1}_isOutOfMapMaxBounds(y){const t=this._map.getMaxBounds(),c=y.coords;return t&&(c.longitudet.getEast()||c.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}`)}}_updateCircleRadius(){const y=this._map.getBounds(),t=y.getSouthEast(),c=y.getNorthEast(),d=t.distanceTo(c),g=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return n.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 n.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Yi--,ir=!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 n.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 n.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 y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Yi++,Yi>1?(y={maximumAge:6e5,timeout:0},ir=!0):(y=this.options.positionOptions,ir=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}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)}},ji.AttributionControl=jl,ji.LogoControl=En,ji.ScaleControl=class{constructor(y){this._onMove=()=>{sa(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,sa(this._map,this._container,this.options)},this.options=n.extend({},lu,y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){v.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},ji.FullscreenControl=class extends n.Evented{constructor(y={}){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,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:n.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(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=v.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){v.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=v.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);v.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_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 n.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new n.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()}},ji.TerrainControl=class{constructor(y){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=y}onAdd(y){return this._map=y,this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=v.create("button","maplibregl-ctrl-terrain",this._container),v.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(){v.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},ji.Popup=class extends n.Evented{constructor(y){super(),this.remove=()=>(this._content&&v.remove(this._content),this._container&&(v.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 n.Event("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=v.create("div","maplibregl-popup",this._map.getContainer()),this._tip=v.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const k of this.options.className.split(" "))this._container.classList.add(k);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=en(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const c=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let d=this.options.anchor;const g=Ao(this.options.offset);if(!d){const k=this._container.offsetWidth,A=this._container.offsetHeight;let L;L=c.y+g.bottom.ythis._map.transform.height-A?["bottom"]:[],c.xthis._map.transform.width-k/2&&L.push("right"),d=L.length===0?"bottom":L.join("-")}const w=c.add(g[d]).round();v.setTransform(this._container,`${Io[d]} translate(${w.x}px,${w.y}px)`),$n(this._container,d,"popup")},this._onClose=()=>{this.remove()},this.options=n.extend(Object.create(Wl),y)}addTo(y){return this._map&&this.remove(),this._map=y,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 n.Event("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=n.LngLat.convert(y),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(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const t=document.createDocumentFragment(),c=document.createElement("body");let d;for(c.innerHTML=y;d=c.firstChild,d;)t.appendChild(d);return this.setDOMContent(t)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=v.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){this._container&&this._container.classList.add(y)}removeClassName(y){this._container&&this._container.classList.remove(y)}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}_createCloseButton(){this.options.closeButton&&(this._closeButton=v.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))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(Hl);y&&y.focus()}},ji.Marker=Gl,ji.Style=Er,ji.LngLat=n.LngLat,ji.LngLatBounds=Me,ji.Point=n.Point,ji.MercatorCoordinate=n.MercatorCoordinate,ji.Evented=n.Evented,ji.AJAXError=n.AJAXError,ji.config=n.config,ji.CanvasSource=pt,ji.GeoJSONSource=vt,ji.ImageSource=Bt,ji.RasterDEMTileSource=kt,ji.RasterTileSource=Je,ji.VectorTileSource=he,ji.VideoSource=fi,ji.setRTLTextPlugin=n.setRTLTextPlugin,ji.getRTLTextPluginStatus=n.getRTLTextPluginStatus,ji.prewarm=function(){ki().acquire(Et)},ji.clearPrewarmedResources=function(){const y=Ii;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(Et),Ii=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()"))},Oa.extend(ji,{isSafari:n.isSafari,getPerformanceMetrics:n.PerformanceUtils.getPerformanceMetrics}),ji});var p=u;return p})})(By);var JS=By.exports;const _c=rh(JS);const{document:$g}=J_;function jg(l){let i;const a=l[19].default,o=Ir(a,l,l[18],null);return{c(){o&&o.c()},l(u){o&&o.l(u)},m(u,f){o&&o.m(u,f),i=!0},p(u,f){o&&o.p&&(!i||f&262144)&&Ar(o,a,u,u[18],i?zr(a,u[18],f,null):Pr(u[18]),null)},i(u){i||(Ge(o,u),i=!0)},o(u){tt(o,u),i=!1},d(u){o&&o.d(u)}}}function YS(l){let i,a,o,u,f,p=l[3]&&jg(l);return{c(){i=je("link"),o=gt(),u=je("div"),p&&p.c(),this.h()},l(n){const _=H_("svelte-12hmray",$g.head);i=qe(_,"LINK",{rel:!0,href:!0}),_.forEach(Q),o=_t(n),u=qe(n,"DIV",{id:!0,class:!0});var v=Ye(u);p&&p.l(v),v.forEach(Q),this.h()},h(){me(i,"rel","stylesheet"),me(i,"href",a=l[1]?l[1]:"https://unpkg.com/maplibre-gl@3.3.1/dist/maplibre-gl.css"),me(u,"id",l[0]),me(u,"class","map svelte-1tna482")},m(n,_){De($g.head,i),Fe(n,o,_),Fe(n,u,_),p&&p.m(u,null),l[20](u),f=!0},p(n,[_]){(!f||_&2&&a!==(a=n[1]?n[1]:"https://unpkg.com/maplibre-gl@3.3.1/dist/maplibre-gl.css"))&&me(i,"href",a),n[3]?p?(p.p(n,_),_&8&&Ge(p,1)):(p=jg(n),p.c(),Ge(p,1),p.m(u,null)):p&&(Vi(),tt(p,1,1,()=>{p=null}),$i()),(!f||_&1)&&me(u,"id",n[0])},i(n){f||(Ge(p),f=!0)},o(n){tt(p),f=!1},d(n){n&&(Q(o),Q(u)),Q(i),p&&p.d(),l[20](null)}}}function QS(l=1e3){return new Promise(i=>setTimeout(i,l))}function eE(l,i,a){let{$$slots:o={},$$scope:u}=i;const f=$f();let{map:p}=i,{id:n="map"}=i,{location:_={lng:15,lat:45,zoom:1}}=i,{style:v={version:8,sources:{},layers:[{id:"background",type:"background",paint:{"background-color":"lightgrey"}}]}}=i,{css:S=null}=i,{options:T={}}=i,{minzoom:I=0}=i,{maxzoom:z=14}=i,{controls:M=!1}=i,{tabbable:C=!1}=i,{zoom:R=null}=i,{center:D=null}=i,{pitch:F=null}=i,{bearing:j=null}=i,{interactive:ee=!0}=i,{attribution:oe=!0}=i,se,ne={},re=!1;Ka("map",{getMap:()=>p}),_.bounds?ne.bounds=_.bounds:_.lng&&_.lat&&(ne.center=[+_.lng,+_.lat],_.zoom&&(ne.zoom=+_.zoom),_.pitch&&(ne.pitch=+_.pitch),_.bearing&&(ne.bearing=+_.bearing)),oe||(ne.attributionControl=!1),ne={...ne,...T},th(()=>{a(4,p=new _c.Map({container:se,style:v,minZoom:I,maxZoom:z,interactive:ee,...ne})),M&&!Array.isArray(M)?p.addControl(new _c.NavigationControl({showCompass:!1})):Array.isArray(M)&&M!=["locate"]&&p.addControl(new _c.NavigationControl({showCompass:M.includes("compass"),visualizePitch:M.includes("pitch")})),Array.isArray(M)&&M.includes("locate")&&p.addControl(new _c.GeolocateControl),p.on("load",nt=>{a(5,R=p.getZoom()),a(6,D=p.getCenter()),a(7,F=p.getPitch()),a(8,j=p.getBearing()),a(3,re=!0),!C&&document.querySelector(`#${n} canvas`)&&(document.querySelector(`#${n} canvas`).tabIndex="-1"),f("load",{event:nt})}),p.on("moveend",()=>{a(5,R=p.getZoom()),a(6,D=p.getCenter()),a(7,F=p.getPitch()),a(8,j=p.getBearing())})}),ih(async()=>{await QS(250),p&&p.remove(),a(4,p=null)});function ve(nt){p&&p.setStyle(nt),f("style",{style:nt})}function ze(nt){Ja[nt?"unshift":"push"](()=>{se=nt,a(2,se)})}return l.$$set=nt=>{"map"in nt&&a(4,p=nt.map),"id"in nt&&a(0,n=nt.id),"location"in nt&&a(9,_=nt.location),"style"in nt&&a(10,v=nt.style),"css"in nt&&a(1,S=nt.css),"options"in nt&&a(11,T=nt.options),"minzoom"in nt&&a(12,I=nt.minzoom),"maxzoom"in nt&&a(13,z=nt.maxzoom),"controls"in nt&&a(14,M=nt.controls),"tabbable"in nt&&a(15,C=nt.tabbable),"zoom"in nt&&a(5,R=nt.zoom),"center"in nt&&a(6,D=nt.center),"pitch"in nt&&a(7,F=nt.pitch),"bearing"in nt&&a(8,j=nt.bearing),"interactive"in nt&&a(16,ee=nt.interactive),"attribution"in nt&&a(17,oe=nt.attribution),"$$scope"in nt&&a(18,u=nt.$$scope)},l.$$.update=()=>{l.$$.dirty&1024&&ve(v)},[n,S,se,re,p,R,D,F,j,_,v,T,I,z,M,C,ee,oe,u,o,ze]}let tE=class extends qi{constructor(i){super(),Zi(this,i,eE,YS,Ui,{map:4,id:0,location:9,style:10,css:1,options:11,minzoom:12,maxzoom:13,controls:14,tabbable:15,zoom:5,center:6,pitch:7,bearing:8,interactive:16,attribution:17})}};function qg(l){let i;const a=l[12].default,o=Ir(a,l,l[11],null);return{c(){o&&o.c()},l(u){o&&o.l(u)},m(u,f){o&&o.m(u,f),i=!0},p(u,f){o&&o.p&&(!i||f&2048)&&Ar(o,a,u,u[11],i?zr(a,u[11],f,null):Pr(u[11]),null)},i(u){i||(Ge(o,u),i=!0)},o(u){tt(o,u),i=!1},d(u){o&&o.d(u)}}}function iE(l){let i,a,o=l[0]&&qg(l);return{c(){o&&o.c(),i=ri()},l(u){o&&o.l(u),i=ri()},m(u,f){o&&o.m(u,f),Fe(u,i,f),a=!0},p(u,[f]){u[0]?o?(o.p(u,f),f&1&&Ge(o,1)):(o=qg(u),o.c(),Ge(o,1),o.m(i.parentNode,i)):o&&(Vi(),tt(o,1,1,()=>{o=null}),$i())},i(u){a||(Ge(o),a=!0)},o(u){tt(o),a=!1},d(u){u&&Q(i),o&&o.d(u)}}}function rE(l=1e3){return new Promise(i=>setTimeout(i,l))}function nE(l,i,a){let{$$slots:o={},$$scope:u}=i,{id:f}=i,{type:p}=i,{url:n=null}=i,{props:_={}}=i,{data:v=null}=i,{layer:S=null}=i,{promoteId:T=null}=i,{minzoom:I=null}=i,{maxzoom:z=null}=i,{tilesize:M=256}=i,C=!1,R=n;const{getMap:D}=Xa("map"),F=D();Ka("source",{source:f,layer:S,promoteId:T}),F.getSource(f)&&F.removeSource(f);async function j(){await rE(100),F.isSourceLoaded(f)?(a(0,C=!0),console.debug(f+" map source loaded!")):(console.debug("..."),j())}I&&(_.minzoom=I),z&&(_.maxzoom=z),S&&T?(_.promoteId={},_.promoteId[S]=T):T&&(_.promoteId=T);function ee(){console.debug(f+" map source loading...");let re;p=="geojson"?v?re={type:p,data:v,..._}:n&&(re={type:p,data:n,..._}):p=="vector"?re={type:p,tiles:[n],..._}:p=="raster"?re={type:p,tiles:[n],tileSize:M,..._}:p=="raster-dem"&&(re={type:p,tiles:[n],tileSize:M,..._}),re&&(F.addSource(f,re),j())}function oe(re){let ve=F.getSource(f);ve&&ve.setData(re)}function se(re){if(re!==R){let ve=F.getSource(f);ve&&ve.setTiles([re]),R=re}}function ne(re){re!==R&&(F.getSource(f).tiles=[re],F.style.sourceCaches[f].clearTiles(),F.style.sourceCaches[f].update(F.transform),F.triggerRepaint(),R=re)}return th(ee),ih(async()=>{F&&F.getSource(f)&&(F.getStyle().layers.filter(ve=>ve.source==f).forEach(ve=>{F.removeLayer(ve.id)}),F.removeSource(f))}),l.$$set=re=>{"id"in re&&a(2,f=re.id),"type"in re&&a(3,p=re.type),"url"in re&&a(4,n=re.url),"props"in re&&a(1,_=re.props),"data"in re&&a(5,v=re.data),"layer"in re&&a(6,S=re.layer),"promoteId"in re&&a(7,T=re.promoteId),"minzoom"in re&&a(8,I=re.minzoom),"maxzoom"in re&&a(9,z=re.maxzoom),"tilesize"in re&&a(10,M=re.tilesize),"$$scope"in re&&a(11,u=re.$$scope)},l.$$.update=()=>{l.$$.dirty&41&&p=="geojson"&&C&&oe(v),l.$$.dirty&25&&p=="vector"&&C&&se(n),l.$$.dirty&25&&p=="raster"&&C&&ne(n)},[C,_,f,p,n,v,S,T,I,z,M,u,o]}class sE extends qi{constructor(i){super(),Zi(this,i,nE,iE,Ui,{id:2,type:3,url:4,props:1,data:5,layer:6,promoteId:7,minzoom:8,maxzoom:9,tilesize:10})}}const aE=l=>({hovered:l[0]&1}),Zg=l=>({hovered:l[0]});function oE(l){let i;const a=l[30].default,o=Ir(a,l,l[29],Zg);return{c(){o&&o.c()},l(u){o&&o.l(u)},m(u,f){o&&o.m(u,f),i=!0},p(u,f){o&&o.p&&(!i||f[0]&536870913)&&Ar(o,a,u,u[29],i?zr(a,u[29],f,aE):Pr(u[29]),Zg)},i(u){i||(Ge(o,u),i=!0)},o(u){tt(o,u),i=!1},d(u){o&&o.d(u)}}}function lE(l,i,a){let o,{$$slots:u={},$$scope:f}=i;const p=$f();let{id:n}=i,{type:_}=i,{filter:v=null}=i,{layout:S={}}=i,{paint:T={}}=i,{data:I=null}=i,{colorKey:z="color"}=i,{nameKey:M=null}=i,{valueKey:C=null}=i,{idKey:R=null}=i,{select:D=!1}=i,{clickIgnore:F=!1}=i,{clickCenter:j=!1}=i,{selected:ee=null}=i,{hover:oe=!1}=i,{hovered:se=null}=i,{highlight:ne=!1}=i,{highlightKey:re="highlighted"}=i,{highlighted:ve=[]}=i,{order:ze=null}=i,{maxzoom:nt=null}=i,{minzoom:be=null}=i,{sourceLayer:Ke=null}=i,{visible:q=!0}=i;const{source:He,layer:Rt,promoteId:at}=Xa("source"),{getMap:Wt}=Xa("map"),ot=Wt();Ka("layer",{layer:n});const st=K_({id:null,feature:null,event:null});eh(l,st,pt=>a(34,o=pt)),Ka("hover",st),R=R||at,Ke=Ke||Rt;let ae=null,xe=null,Me=[],Y={...S};S.visibility||(Y.visibility=q?"visible":"none");let he={id:n,type:_,source:He,paint:T,layout:Y};v&&(he.filter=v),Ke&&(he["source-layer"]=Ke),nt&&(he.maxzoom=nt),be&&(he.minzoom=be),th(()=>{ot.getLayer(n)&&ot.removeLayer(n),ot.addLayer(he,ze)});let Je=[];function kt(pt,_i=z){console.debug("updating colors...");for(const Z of Je)ot.setFeatureState({source:He,sourceLayer:Ke,id:Z},{color:null,value:null});Je=[];for(const Z of pt)ot.setFeatureState({source:He,sourceLayer:Ke,id:Z[R]},{color:_i?Z[_i]:null,value:C?Z[C]:null,name:M?Z[M]:null}),Je.push(Z[R])}function vt(pt){ot.getLayer(n)&&ot.setFilter(n,pt)}function Ct(pt){if(ot.getLayer(n))for(const _i in pt)ot.setLayoutProperty(n,_i,pt[_i])}function Bt(pt){if(ot.getLayer(n))for(const _i in pt)ot.setPaintProperty(n,_i,pt[_i])}function fi(pt){!S.visibility&&ot.getLayer(n)&&ot.setLayoutProperty(n,"visibility",pt?"visible":"none")}return D&&ot.on("click",n,pt=>{if(pt.features.length>0&&!F){let _i=pt.features[0];if(a(2,ee=_i.id),p("select",{id:ee,feature:_i,event:pt}),ae&&ot.setFeatureState({source:He,sourceLayer:Ke,id:ae},{selected:!1}),ot.setFeatureState({source:He,sourceLayer:Ke,id:ee},{selected:!0}),j){let Z=centroid(pt.features[0].toJSON().geometry);ot.flyTo({center:Z.geometry.coordinates})}a(26,ae=ee)}}),oe&&(ot.on("mousemove",n,pt=>{if(pt.features.length>0){se&&ot.setFeatureState({source:He,sourceLayer:Ke,id:se},{hovered:!1});let _i=pt.features[0];a(0,se=a(27,xe=_i.id)),st.set({id:se,feature:_i,event:pt}),p("hover",o),ot.setFeatureState({source:He,sourceLayer:Ke,id:se},{hovered:!0}),ot.getCanvas().style.cursor="pointer"}}),ot.on("mouseleave",n,pt=>{se&&ot.setFeatureState({source:He,sourceLayer:Ke,id:se},{hovered:!1}),a(0,se=a(27,xe=null)),st.set({id:null,feature:null,event:pt}),p("hover",o),ot.getCanvas().style.cursor=""})),ih(async()=>{ot&&ot.getLayer(n)&&ot.removeLayer(n)}),l.$$set=pt=>{"id"in pt&&a(5,n=pt.id),"type"in pt&&a(6,_=pt.type),"filter"in pt&&a(7,v=pt.filter),"layout"in pt&&a(8,S=pt.layout),"paint"in pt&&a(9,T=pt.paint),"data"in pt&&a(10,I=pt.data),"colorKey"in pt&&a(11,z=pt.colorKey),"nameKey"in pt&&a(12,M=pt.nameKey),"valueKey"in pt&&a(13,C=pt.valueKey),"idKey"in pt&&a(4,R=pt.idKey),"select"in pt&&a(14,D=pt.select),"clickIgnore"in pt&&a(15,F=pt.clickIgnore),"clickCenter"in pt&&a(16,j=pt.clickCenter),"selected"in pt&&a(2,ee=pt.selected),"hover"in pt&&a(17,oe=pt.hover),"hovered"in pt&&a(0,se=pt.hovered),"highlight"in pt&&a(18,ne=pt.highlight),"highlightKey"in pt&&a(19,re=pt.highlightKey),"highlighted"in pt&&a(20,ve=pt.highlighted),"order"in pt&&a(21,ze=pt.order),"maxzoom"in pt&&a(22,nt=pt.maxzoom),"minzoom"in pt&&a(23,be=pt.minzoom),"sourceLayer"in pt&&a(3,Ke=pt.sourceLayer),"visible"in pt&&a(24,q=pt.visible),"$$scope"in pt&&a(29,f=pt.$$scope)},l.$$.update=()=>{if(l.$$.dirty[0]&3072&&I&&kt(I,z),l.$$.dirty[0]&128&&vt(v),l.$$.dirty[0]&256&&Ct(S),l.$$.dirty[0]&512&&Bt(T),l.$$.dirty[0]&16777216&&fi(q),l.$$.dirty[0]&270270472&&ne&&ve!=Me){if(Me[0])for(const pt of Me){let _i={};_i[re]=!1,ot.setFeatureState({source:He,sourceLayer:Ke,id:pt},_i)}if(a(28,Me=ve),ve[0])for(const pt of ve){let _i={};_i[re]=!0,ot.setFeatureState({source:He,sourceLayer:Ke,id:pt},_i)}}l.$$.dirty[0]&67125260&&D&&ee!=ae&&(ae&&ot.setFeatureState({source:He,sourceLayer:Ke,id:ae},{selected:!1}),ee&&ot.setFeatureState({source:He,sourceLayer:Ke,id:ee},{selected:!0}),a(26,ae=ee)),l.$$.dirty[0]&134348809&&oe&&se!=xe&&(xe&&ot.setFeatureState({source:He,sourceLayer:Ke,id:xe},{hovered:!1}),se&&ot.setFeatureState({source:He,sourceLayer:Ke,id:se},{hovered:!0}),a(27,xe=se))},[se,st,ee,Ke,R,n,_,v,S,T,I,z,M,C,D,F,j,oe,ne,re,ve,ze,nt,be,q,kt,ae,xe,Me,f,u]}class Af extends qi{constructor(i){super(),Zi(this,i,lE,oE,Ui,{id:5,type:6,filter:7,layout:8,paint:9,data:10,colorKey:11,nameKey:12,valueKey:13,idKey:4,select:14,clickIgnore:15,clickCenter:16,selected:2,hover:17,hovered:0,highlight:18,highlightKey:19,highlighted:20,order:21,maxzoom:22,minzoom:23,sourceLayer:3,visible:24,updateColors:25},null,[-1,-1])}get updateColors(){return this.$$.ctx[25]}}function cE(l,i,a){let o,{content:u}=i;const f=new _c.Popup({closeButton:!1,closeOnClick:!1}),{getMap:p}=Xa("map"),n=p(),_=Xa("hover");eh(l,_,S=>a(2,o=S));function v(S,T){S.id?f.setLngLat(S.event.lngLat).setHTML(T||S.code).addTo(n):f.remove()}return ih(()=>f.remove()),l.$$set=S=>{"content"in S&&a(1,u=S.content)},l.$$.update=()=>{l.$$.dirty&6&&v(o,u)},[_,u,o]}class uE extends qi{constructor(i){super(),Zi(this,i,cE,null,Ui,{content:1})}}function Gg(l,i,a){const o=l.slice();return o[9]=i[a],o[11]=a,o}function Wg(l){let i,a,o,u,f,p=l[4](l[2][l[11]])+"",n;return{c(){i=je("div"),a=gt(),o=je("div"),u=gt(),f=je("div"),n=Ut(p),this.h()},l(_){i=qe(_,"DIV",{class:!0,style:!0}),Ye(i).forEach(Q),a=_t(_),o=qe(_,"DIV",{class:!0,style:!0}),Ye(o).forEach(Q),u=_t(_),f=qe(_,"DIV",{class:!0,style:!0});var v=Ye(f);n=Vt(v,p),v.forEach(Q),this.h()},h(){me(i,"class","block svelte-4k2wr9"),At(i,"width",100/(l[2].length-1)+"%"),At(i,"left",l[11]*(100/(l[2].length-1))+"%"),At(i,"background-color",l[3][l[11]]),me(o,"class","line svelte-4k2wr9"),At(o,"left",l[11]*(100/(l[2].length-1))+"%"),me(f,"class","tick svelte-4k2wr9"),At(f,"left",l[11]*(100/(l[2].length-1))+"%"),Zt(f,"tick-start",l[11]==0)},m(_,v){Fe(_,i,v),Fe(_,a,v),Fe(_,o,v),Fe(_,u,v),Fe(_,f,v),De(f,n)},p(_,v){v&4&&At(i,"width",100/(_[2].length-1)+"%"),v&4&&At(i,"left",_[11]*(100/(_[2].length-1))+"%"),v&8&&At(i,"background-color",_[3][_[11]]),v&4&&At(o,"left",_[11]*(100/(_[2].length-1))+"%"),v&20&&p!==(p=_[4](_[2][_[11]])+"")&&Ci(n,p),v&4&&At(f,"left",_[11]*(100/(_[2].length-1))+"%")},d(_){_&&(Q(i),Q(a),Q(o),Q(u),Q(f))}}}function Hg(l){let i,a=`${l[7](l[0],l[2])}%`,o,u,f=l[5](l[0])+"",p,n;return{c(){i=je("div"),o=gt(),u=je("div"),p=Ut(f),n=Ut(l[6]),this.h()},l(_){i=qe(_,"DIV",{class:!0}),Ye(i).forEach(Q),o=_t(_),u=qe(_,"DIV",{class:!0,style:!0});var v=Ye(u);p=Vt(v,f),n=Vt(v,l[6]),v.forEach(Q),this.h()},h(){me(i,"class","marker svelte-4k2wr9"),At(i,"left",a),me(u,"class","value svelte-4k2wr9"),At(u,"left",l[7](l[0],l[2])+"%")},m(_,v){Fe(_,i,v),Fe(_,o,v),Fe(_,u,v),De(u,p),De(u,n)},p(_,v){v&5&&a!==(a=`${_[7](_[0],_[2])}%`)&&At(i,"left",a),v&33&&f!==(f=_[5](_[0])+"")&&Ci(p,f),v&64&&Ci(n,_[6]),v&5&&At(u,"left",_[7](_[0],_[2])+"%")},d(_){_&&(Q(i),Q(o),Q(u))}}}function hE(l){let i,a,o,u,f,p=l[4](l[2][l[2].length-1])+"",n,_,v,S=Ni(l[2].slice(1)),T=[];for(let z=0;zI.toFixed(1)}=i,{formatVal:v=I=>I.toFixed(1)}=i,{suffix:S="%"}=i;const T=(I,z)=>{let M=0;for(;I>z[M+1];)M+=1;let C=100/(z.length-1),R=(I-z[M])/(z[M+1]-z[M]);return(M+R)*C};return l.$$set=I=>{"hovered"in I&&a(0,o=I.hovered),"lineWidth"in I&&a(8,u=I.lineWidth),"height"in I&&a(1,f=I.height),"breaks"in I&&a(2,p=I.breaks),"colors"in I&&a(3,n=I.colors),"formatTick"in I&&a(4,_=I.formatTick),"formatVal"in I&&a(5,v=I.formatVal),"suffix"in I&&a(6,S=I.suffix)},[o,f,p,n,_,v,S,T,u]}class dE extends qi{constructor(i){super(),Zi(this,i,fE,hE,Ui,{hovered:0,lineWidth:8,height:1,breaks:2,colors:3,formatTick:4,formatVal:5,suffix:6})}}function Kg(l,i,a){const o=l.slice();return o[2]=i[a],o[4]=a,o}function Xg(l){let i,a,o,u=l[2].name+"",f,p,n,_=l[2].value.toFixed(1)+"",v,S,T;return{c(){i=je("tr"),a=je("td"),o=je("strong"),f=Ut(u),p=gt(),n=je("td"),v=Ut(_),S=Ut("%"),T=gt(),this.h()},l(I){i=qe(I,"TR",{});var z=Ye(i);a=qe(z,"TD",{class:!0});var M=Ye(a);o=qe(M,"STRONG",{});var C=Ye(o);f=Vt(C,u),C.forEach(Q),M.forEach(Q),p=_t(z),n=qe(z,"TD",{class:!0});var R=Ye(n);v=Vt(R,_),S=Vt(R,"%"),R.forEach(Q),T=_t(z),z.forEach(Q),this.h()},h(){me(a,"class","svelte-1i52e02"),me(n,"class","text-right svelte-1i52e02")},m(I,z){Fe(I,i,z),De(i,a),De(a,o),De(o,f),De(i,p),De(i,n),De(n,v),De(n,S),De(i,T)},p(I,z){z&1&&u!==(u=I[2].name+"")&&Ci(f,u),z&1&&_!==(_=I[2].value.toFixed(1)+"")&&Ci(v,_)},d(I){I&&Q(i)}}}function pE(l){let i,a,o=Ni(l[0]),u=[];for(let f=0;f{"data"in f&&a(0,o=f.data),"offset"in f&&a(1,u=f.offset)},[o,u]}class Fy extends qi{constructor(i){super(),Zi(this,i,mE,pE,Ui,{data:0,offset:1})}}function gE(l){let i,a,o,u,f="No data";return{c(){i=je("div"),a=je("div"),o=gt(),u=je("div"),u.textContent=f,this.h()},l(p){i=qe(p,"DIV",{class:!0,style:!0});var n=Ye(i);a=qe(n,"DIV",{class:!0,style:!0}),Ye(a).forEach(Q),o=_t(n),u=qe(n,"DIV",{class:!0,"data-svelte-h":!0}),Cr(u)!=="svelte-1n9tqdn"&&(u.textContent=f),n.forEach(Q),this.h()},h(){me(a,"class","block svelte-b1cp2z"),At(a,"width","100%"),At(a,"background-color",l[1]),me(u,"class","tick svelte-b1cp2z"),me(i,"class","container svelte-b1cp2z"),At(i,"height",l[0]+"px")},m(p,n){Fe(p,i,n),De(i,a),De(i,o),De(i,u)},p(p,[n]){n&2&&At(a,"background-color",p[1]),n&1&&At(i,"height",p[0]+"px")},i:wi,o:wi,d(p){p&&Q(i)}}}function _E(l,i,a){let{height:o=15}=i,{color:u="lightgrey"}=i;return l.$$set=f=>{"height"in f&&a(0,o=f.height),"color"in f&&a(1,u=f.color)},[o,u]}class yE extends qi{constructor(i){super(),Zi(this,i,_E,gE,Ui,{height:0,color:1})}}function vE(l){let i,a=`People with the selected characteristics as a proportion of the whole - population in each area.`;return{c(){i=je("p"),i.textContent=a,this.h()},l(o){i=qe(o,"P",{class:!0,"data-svelte-h":!0}),Cr(i)!=="svelte-16szk9e"&&(i.textContent=a),this.h()},h(){me(i,"class","subtitle svelte-xikkwp")},m(o,u){Fe(o,i,u)},p:wi,d(o){o&&Q(i)}}}function Jg(l){let i,a;return i=new sE({props:{id:"lad",type:"geojson",data:l[0].geojson,promoteId:l[2].code,$$slots:{default:[wE]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.data=o[0].geojson),u&4&&(f.promoteId=o[2].code),u&8321&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function bE(l){let i,a;return i=new uE({props:{content:l[8](l[7])}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&128&&(f.content=o[8](o[7])),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function wE(l){let i,a,o,u,f,p,n;function _(S){l[9](S)}let v={id:"lad-fill",data:l[0].geoPerc,idKey:"code",nameKey:"name",valueKey:"value",hover:!0,tooltip:!0,type:"fill",paint:{"fill-color":["case",["!=",["feature-state","color"],null],["feature-state","color"],"rgba(255, 255, 255, 0)"],"fill-opacity":.8},order:"place_other",$$slots:{default:[bE]},$$scope:{ctx:l}};return l[7]!==void 0&&(v.hovered=l[7]),i=new Af({props:v}),Ja.push(()=>Qo(i,"hovered",_)),u=new Af({props:{id:"lad-line",type:"line",paint:{"line-color":"white","line-width":.3},order:"place_other"}}),p=new Af({props:{id:"lad-hover",type:"line",paint:{"line-color":"black","line-width":2,"line-opacity":["case",["==",["feature-state","hovered"],!0],1,0]},order:"place_other"}}),{c(){ei(i.$$.fragment),o=gt(),ei(u.$$.fragment),f=gt(),ei(p.$$.fragment)},l(S){si(i.$$.fragment,S),o=_t(S),si(u.$$.fragment,S),f=_t(S),si(p.$$.fragment,S)},m(S,T){ti(i,S,T),Fe(S,o,T),ti(u,S,T),Fe(S,f,T),ti(p,S,T),n=!0},p(S,T){const I={};T&1&&(I.data=S[0].geoPerc),T&8320&&(I.$$scope={dirty:T,ctx:S}),!a&&T&128&&(a=!0,I.hovered=S[7],Yo(()=>a=!1)),i.$set(I)},i(S){n||(Ge(i.$$.fragment,S),Ge(u.$$.fragment,S),Ge(p.$$.fragment,S),n=!0)},o(S){tt(i.$$.fragment,S),tt(u.$$.fragment,S),tt(p.$$.fragment,S),n=!1},d(S){S&&(Q(o),Q(f)),ii(i,S),ii(u,S),ii(p,S)}}}function xE(l){let i,a,o=l[0].geojson&&l[0].geoPerc&&Jg(l);return{c(){o&&o.c(),i=ri()},l(u){o&&o.l(u),i=ri()},m(u,f){o&&o.m(u,f),Fe(u,i,f),a=!0},p(u,f){u[0].geojson&&u[0].geoPerc?o?(o.p(u,f),f&1&&Ge(o,1)):(o=Jg(u),o.c(),Ge(o,1),o.m(i.parentNode,i)):o&&(Vi(),tt(o,1,1,()=>{o=null}),$i())},i(u){a||(Ge(o),a=!0)},o(u){tt(o),a=!1},d(u){u&&Q(i),o&&o.d(u)}}}function Yg(l){let i,a,o,u,f=l[0].geoPerc.some(e_),p;o=new dE({props:{breaks:l[0].geoBreaks,hovered:l[7]&&l[0].geoPerc.find(l[10])?l[0].geoPerc.find(l[11]).value:null,colors:l[0].geoBreaks[1]==100?[l[6].seq[4]]:l[6].seq}});let n=f&&Qg();return{c(){i=je("div"),a=je("div"),ei(o.$$.fragment),u=gt(),n&&n.c(),this.h()},l(_){i=qe(_,"DIV",{class:!0});var v=Ye(i);a=qe(v,"DIV",{class:!0});var S=Ye(a);si(o.$$.fragment,S),S.forEach(Q),u=_t(v),n&&n.l(v),v.forEach(Q),this.h()},h(){me(a,"class","map-legend-breaks svelte-xikkwp"),me(i,"class","map-legend svelte-xikkwp")},m(_,v){Fe(_,i,v),De(i,a),ti(o,a,null),De(i,u),n&&n.m(i,null),p=!0},p(_,v){const S={};v&1&&(S.breaks=_[0].geoBreaks),v&129&&(S.hovered=_[7]&&_[0].geoPerc.find(_[10])?_[0].geoPerc.find(_[11]).value:null),v&65&&(S.colors=_[0].geoBreaks[1]==100?[_[6].seq[4]]:_[6].seq),o.$set(S),v&1&&(f=_[0].geoPerc.some(e_)),f?n?v&1&&Ge(n,1):(n=Qg(),n.c(),Ge(n,1),n.m(i,null)):n&&(Vi(),tt(n,1,1,()=>{n=null}),$i())},i(_){p||(Ge(o.$$.fragment,_),Ge(n),p=!0)},o(_){tt(o.$$.fragment,_),tt(n),p=!1},d(_){_&&Q(i),ii(o),n&&n.d()}}}function Qg(l){let i,a,o;return a=new yE({}),{c(){i=je("div"),ei(a.$$.fragment),this.h()},l(u){i=qe(u,"DIV",{class:!0});var f=Ye(i);si(a.$$.fragment,f),f.forEach(Q),this.h()},h(){me(i,"class","map-legend-nodata svelte-xikkwp")},m(u,f){Fe(u,i,f),ti(a,i,null),o=!0},i(u){o||(Ge(a.$$.fragment,u),o=!0)},o(u){tt(a.$$.fragment,u),o=!1},d(u){u&&Q(i),ii(a)}}}function SE(l){let i,a,o,u,f;a=new tE({props:{css:Xo+"/css/maplibre-gl.css",style:l[1],location:{bounds:l[3]},options:{maxBounds:l[4],preserveDrawingBuffer:!0,cooperativeGestures:!0},maxzoom:10,controls:!0,$$slots:{default:[xE]},$$scope:{ctx:l}}});let p=l[0].geoBreaks&&l[0].geoPerc&&Yg(l);return{c(){i=je("div"),ei(a.$$.fragment),o=gt(),p&&p.c(),u=ri(),this.h()},l(n){i=qe(n,"DIV",{});var _=Ye(i);si(a.$$.fragment,_),_.forEach(Q),o=_t(n),p&&p.l(n),u=ri(),this.h()},h(){At(i,"height","450px")},m(n,_){Fe(n,i,_),ti(a,i,null),Fe(n,o,_),p&&p.m(n,_),Fe(n,u,_),f=!0},p(n,_){const v={};_&2&&(v.style=n[1]),_&8&&(v.location={bounds:n[3]}),_&16&&(v.options={maxBounds:n[4],preserveDrawingBuffer:!0,cooperativeGestures:!0}),_&8325&&(v.$$scope={dirty:_,ctx:n}),a.$set(v),n[0].geoBreaks&&n[0].geoPerc?p?(p.p(n,_),_&1&&Ge(p,1)):(p=Yg(n),p.c(),Ge(p,1),p.m(u.parentNode,u)):p&&(Vi(),tt(p,1,1,()=>{p=null}),$i())},i(n){f||(Ge(a.$$.fragment,n),Ge(p),f=!0)},o(n){tt(a.$$.fragment,n),tt(p),f=!1},d(n){n&&(Q(i),Q(o),Q(u)),ii(a),p&&p.d(n)}}}function EE(l){let i,a="Make a selection to see rankings.";return{c(){i=je("span"),i.textContent=a,this.h()},l(o){i=qe(o,"SPAN",{class:!0,"data-svelte-h":!0}),Cr(i)!=="svelte-14ggolm"&&(i.textContent=a),this.h()},h(){me(i,"class","muted svelte-xikkwp")},m(o,u){Fe(o,i,u)},p:wi,i:wi,o:wi,d(o){o&&Q(i)}}}function kE(l){let i,a;return i=new Fy({props:{data:[...l[0].geoPerc].filter(t_).sort(i_).slice(0,5)}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.data=[...o[0].geoPerc].filter(t_).sort(i_).slice(0,5)),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function TE(l){let i,a,o,u;const f=[kE,EE],p=[];function n(_,v){return _[0].geoPerc&&_[5][0]?0:1}return i=n(l),a=p[i]=f[i](l),{c(){a.c(),o=ri()},l(_){a.l(_),o=ri()},m(_,v){p[i].m(_,v),Fe(_,o,v),u=!0},p(_,v){let S=i;i=n(_),i===S?p[i].p(_,v):(Vi(),tt(p[S],1,1,()=>{p[S]=null}),$i(),a=p[i],a?a.p(_,v):(a=p[i]=f[i](_),a.c()),Ge(a,1),a.m(o.parentNode,o))},i(_){u||(Ge(a),u=!0)},o(_){tt(a),u=!1},d(_){_&&Q(o),p[i].d(_)}}}function CE(l){let i,a="Make a selection to see rankings.";return{c(){i=je("span"),i.textContent=a,this.h()},l(o){i=qe(o,"SPAN",{class:!0,"data-svelte-h":!0}),Cr(i)!=="svelte-14ggolm"&&(i.textContent=a),this.h()},h(){me(i,"class","muted svelte-xikkwp")},m(o,u){Fe(o,i,u)},p:wi,i:wi,o:wi,d(o){o&&Q(i)}}}function IE(l){let i,a;return i=new Fy({props:{data:l[0].geoPerc.filter(r_).sort(n_).slice(-5),offset:l[0].geoPerc.filter(s_).length-4}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.data=o[0].geoPerc.filter(r_).sort(n_).slice(-5)),u&1&&(f.offset=o[0].geoPerc.filter(s_).length-4),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function AE(l){let i,a,o,u;const f=[IE,CE],p=[];function n(_,v){return _[0].geoPerc&&_[5][0]?0:1}return i=n(l),a=p[i]=f[i](l),{c(){a.c(),o=ri()},l(_){a.l(_),o=ri()},m(_,v){p[i].m(_,v),Fe(_,o,v),u=!0},p(_,v){let S=i;i=n(_),i===S?p[i].p(_,v):(Vi(),tt(p[S],1,1,()=>{p[S]=null}),$i(),a=p[i],a?a.p(_,v):(a=p[i]=f[i](_),a.c()),Ge(a,1),a.m(o.parentNode,o))},i(_){u||(Ge(a),u=!0)},o(_){tt(a),u=!1},d(_){_&&Q(o),p[i].d(_)}}}function PE(l){let i,a,o,u,f,p,n,_;return i=new Ps({props:{colspan:3,rowspan:1,noBackground:!0,$$slots:{default:[vE]},$$scope:{ctx:l}}}),o=new Ps({props:{colspan:2,rowspan:2,noBackground:!0,$$slots:{default:[SE]},$$scope:{ctx:l}}}),f=new Ps({props:{title:"Areas with high %",$$slots:{default:[TE]},$$scope:{ctx:l}}}),n=new Ps({props:{title:"Areas with low %",$$slots:{default:[AE]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment),a=gt(),ei(o.$$.fragment),u=gt(),ei(f.$$.fragment),p=gt(),ei(n.$$.fragment)},l(v){si(i.$$.fragment,v),a=_t(v),si(o.$$.fragment,v),u=_t(v),si(f.$$.fragment,v),p=_t(v),si(n.$$.fragment,v)},m(v,S){ti(i,v,S),Fe(v,a,S),ti(o,v,S),Fe(v,u,S),ti(f,v,S),Fe(v,p,S),ti(n,v,S),_=!0},p(v,S){const T={};S&8192&&(T.$$scope={dirty:S,ctx:v}),i.$set(T);const I={};S&8415&&(I.$$scope={dirty:S,ctx:v}),o.$set(I);const z={};S&8225&&(z.$$scope={dirty:S,ctx:v}),f.$set(z);const M={};S&8225&&(M.$$scope={dirty:S,ctx:v}),n.$set(M)},i(v){_||(Ge(i.$$.fragment,v),Ge(o.$$.fragment,v),Ge(f.$$.fragment,v),Ge(n.$$.fragment,v),_=!0)},o(v){tt(i.$$.fragment,v),tt(o.$$.fragment,v),tt(f.$$.fragment,v),tt(n.$$.fragment,v),_=!1},d(v){v&&(Q(a),Q(u),Q(p)),ii(i,v),ii(o,v),ii(f,v),ii(n,v)}}}function zE(l){let i,a;return i=new jf({props:{title:"Population by area",height:"auto",cls:"ons-cards pgp-map-tiles",$$slots:{default:[PE]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,[u]){const f={};u&8447&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}const e_=l=>l.value===null,t_=l=>l.value!=null,i_=(l,i)=>i.value-l.value,r_=l=>l.value!=null,n_=(l,i)=>i.value-l.value,s_=l=>l.value!=null;function ME(l,i,a){let o,{data:u}=i,{mapStyle:f}=i,{ladBounds:p}=i,{mapBounds:n}=i,{maxBounds:_}=i,{selected:v}=i,{colors:S}=i,T;const I=R=>{var F;let D="";if(R){D=`${u.geoCodesLookup[T].name}
`;const j=(F=o==null?void 0:o[R])==null?void 0:F.value;D+=j!=null?`${j}%`:"No data"}return D};function z(R){T=R,a(7,T)}const M=R=>R.code==T,C=R=>R.code==T;return l.$$set=R=>{"data"in R&&a(0,u=R.data),"mapStyle"in R&&a(1,f=R.mapStyle),"ladBounds"in R&&a(2,p=R.ladBounds),"mapBounds"in R&&a(3,n=R.mapBounds),"maxBounds"in R&&a(4,_=R.maxBounds),"selected"in R&&a(5,v=R.selected),"colors"in R&&a(6,S=R.colors)},l.$$.update=()=>{l.$$.dirty&1&&(o=(R=>{const D={};return console.log("data",R),Array.isArray(R)&&R.forEach(F=>D[F.code]=F),D})(u.geoPerc))},[u,f,p,n,_,v,S,T,I,z,M,C]}class DE extends qi{constructor(i){super(),Zi(this,i,ME,zE,Ui,{data:0,mapStyle:1,ladBounds:2,mapBounds:3,maxBounds:4,selected:5,colors:6})}}function a_(l){let i,a;return i=new Ps({props:{title:l[0],$$slots:{default:[OE]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.title=o[0]),u&30&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function LE(l){let i,a,o;var u=l[3];function f(p,n){return{props:{data:p[2].selected&&Xu("residents",p[1].code,p[2]),showLegend:!1}}}return u&&(i=fm(u,f(l))),{c(){i&&ei(i.$$.fragment),a=ri()},l(p){i&&si(i.$$.fragment,p),a=ri()},m(p,n){i&&ti(i,p,n),Fe(p,a,n),o=!0},p(p,n){if(n&8&&u!==(u=p[3])){if(i){Vi();const _=i;tt(_.$$.fragment,1,0,()=>{ii(_,1)}),$i()}u?(i=fm(u,f(p)),ei(i.$$.fragment),Ge(i.$$.fragment,1),ti(i,a.parentNode,a)):i=null}else if(u){const _={};n&6&&(_.data=p[2].selected&&Xu("residents",p[1].code,p[2])),i.$set(_)}},i(p){o||(i&&Ge(i.$$.fragment,p),o=!0)},o(p){i&&tt(i.$$.fragment,p),o=!1},d(p){p&&Q(a),i&&ii(i,p)}}}function RE(l){let i,a=Cc.nodata+"",o;return{c(){i=je("span"),o=Ut(a),this.h()},l(u){i=qe(u,"SPAN",{class:!0});var f=Ye(i);o=Vt(f,a),f.forEach(Q),this.h()},h(){me(i,"class","num-desc svelte-1yn8adz")},m(u,f){Fe(u,i,f),De(i,o)},p:wi,i:wi,o:wi,d(u){u&&Q(i)}}}function BE(l){let i,a=Cc.blocked+"",o;return{c(){i=je("span"),o=Ut(a),this.h()},l(u){i=qe(u,"SPAN",{class:!0});var f=Ye(i);o=Vt(f,a),f.forEach(Q),this.h()},h(){me(i,"class","num-desc svelte-1yn8adz")},m(u,f){Fe(u,i,f),De(i,o)},p:wi,i:wi,o:wi,d(u){u&&Q(i)}}}function OE(l){let i,a,o,u,f,p=um[l[1].code]+"",n,_;const v=[BE,RE,LE],S=[];function T(I,z){return I[2].selected.residents[I[1].code].values==="blocked"?0:I[2].selected.residents[I[1].code].values.percent[0]==null?1:2}return i=T(l),a=S[i]=v[i](l),{c(){a.c(),o=gt(),u=je("span"),f=Ut("% of "),n=Ut(p),this.h()},l(I){a.l(I),o=_t(I),u=qe(I,"SPAN",{class:!0});var z=Ye(u);f=Vt(z,"% of "),n=Vt(z,p),z.forEach(Q),this.h()},h(){me(u,"class","num-desc svelte-1yn8adz")},m(I,z){S[i].m(I,z),Fe(I,o,z),Fe(I,u,z),De(u,f),De(u,n),_=!0},p(I,z){let M=i;i=T(I),i===M?S[i].p(I,z):(Vi(),tt(S[M],1,1,()=>{S[M]=null}),$i(),a=S[i],a?a.p(I,z):(a=S[i]=v[i](I),a.c()),Ge(a,1),a.m(o.parentNode,o)),(!_||z&2)&&p!==(p=um[I[1].code]+"")&&Ci(n,p)},i(I){_||(Ge(a),_=!0)},o(I){tt(a),_=!1},d(I){I&&(Q(o),Q(u)),S[i].d(I)}}}function FE(l){var u,f;let i,a,o=((f=(u=l[2].selected.residents)==null?void 0:u[l[1].code])==null?void 0:f.values)&&a_(l);return{c(){o&&o.c(),i=ri()},l(p){o&&o.l(p),i=ri()},m(p,n){o&&o.m(p,n),Fe(p,i,n),a=!0},p(p,[n]){var _,v;(v=(_=p[2].selected.residents)==null?void 0:_[p[1].code])!=null&&v.values?o?(o.p(p,n),n&6&&Ge(o,1)):(o=a_(p),o.c(),Ge(o,1),o.m(i.parentNode,i)):o&&(Vi(),tt(o,1,1,()=>{o=null}),$i())},i(p){a||(Ge(o),a=!0)},o(p){tt(o),a=!1},d(p){p&&Q(i),o&&o.d(p)}}}function NE(l,i,a){let{title:o}=i,{table:u}=i,{data:f}=i,{chart_type:p}=i;return l.$$set=n=>{"title"in n&&a(0,o=n.title),"table"in n&&a(1,u=n.table),"data"in n&&a(2,f=n.data),"chart_type"in n&&a(3,p=n.chart_type)},[o,u,f,p]}class Ny extends qi{constructor(i){super(),Zi(this,i,NE,FE,Ui,{title:0,table:1,data:2,chart_type:3})}}function UE(l){let i,a;const o=l[5].default,u=Ir(o,l,l[4],null);return{c(){i=je("mark"),u&&u.c(),this.h()},l(f){i=qe(f,"MARK",{class:!0,style:!0,role:!0});var p=Ye(i);u&&u.l(p),p.forEach(Q),this.h()},h(){me(i,"class","em svelte-1602h77"),At(i,"background-color",l[0]),At(i,"color",l[2]),me(i,"role","presentation"),Zt(i,"nowrap",l[1])},m(f,p){Fe(f,i,p),u&&u.m(i,null),a=!0},p(f,[p]){u&&u.p&&(!a||p&16)&&Ar(u,o,f,f[4],a?zr(o,f[4],p,null):Pr(f[4]),null),(!a||p&1)&&At(i,"background-color",f[0]),(!a||p&4)&&At(i,"color",f[2]),(!a||p&2)&&Zt(i,"nowrap",f[1])},i(f){a||(Ge(u,f),a=!0)},o(f){tt(u,f),a=!1},d(f){f&&Q(i),u&&u.d(f)}}}function VE(l,i,a){let o,{$$slots:u={},$$scope:f}=i,{color:p="lightgrey"}=i,{nowrap:n=!0}=i;function _(S){return(S[0]*299+S[1]*587+S[2]*114)/1e3>125?"black":"white"}let v="black";return l.$$set=S=>{"color"in S&&a(0,p=S.color),"nowrap"in S&&a(1,n=S.nowrap),"$$scope"in S&&a(4,f=S.$$scope)},l.$$.update=()=>{l.$$.dirty&1&&a(3,o=Zv(p).rgb),l.$$.dirty&8&&o&&a(2,v=_(o))},[p,n,v,o,f,u]}class $E extends qi{constructor(i){super(),Zi(this,i,VE,UE,Ui,{color:0,nowrap:1})}}function jE(l){let i,a=l[0].selected.total_pop.count.toLocaleString()+"",o,u,f,p="people",n,_,v,S,T;return v=new $E({props:{color:"lightgrey",$$slots:{default:[ZE]},$$scope:{ctx:l}}}),{c(){i=je("div"),o=Ut(a),u=gt(),f=je("div"),f.textContent=p,n=gt(),_=je("div"),ei(v.$$.fragment),S=Ut(" of the total population of England and Wales"),this.h()},l(I){i=qe(I,"DIV",{class:!0});var z=Ye(i);o=Vt(z,a),z.forEach(Q),u=_t(I),f=qe(I,"DIV",{class:!0,"data-svelte-h":!0}),Cr(f)!=="svelte-hz5rwm"&&(f.textContent=p),n=_t(I),_=qe(I,"DIV",{class:!0});var M=Ye(_);si(v.$$.fragment,M),S=Vt(M," of the total population of England and Wales"),M.forEach(Q),this.h()},h(){me(i,"class","num-big svelte-c46qp4"),me(f,"class","num-suffix svelte-c46qp4"),me(_,"class","num-desc svelte-c46qp4")},m(I,z){Fe(I,i,z),De(i,o),Fe(I,u,z),Fe(I,f,z),Fe(I,n,z),Fe(I,_,z),ti(v,_,null),De(_,S),T=!0},p(I,z){(!T||z&1)&&a!==(a=I[0].selected.total_pop.count.toLocaleString()+"")&&Ci(o,a);const M={};z&3&&(M.$$scope={dirty:z,ctx:I}),v.$set(M)},i(I){T||(Ge(v.$$.fragment,I),T=!0)},o(I){tt(v.$$.fragment,I),T=!1},d(I){I&&(Q(i),Q(u),Q(f),Q(n),Q(_)),ii(v)}}}function qE(l){let i,a=Cc.nodata+"",o;return{c(){i=je("div"),o=Ut(a),this.h()},l(u){i=qe(u,"DIV",{class:!0});var f=Ye(i);o=Vt(f,a),f.forEach(Q),this.h()},h(){me(i,"class","num-desc svelte-c46qp4")},m(u,f){Fe(u,i,f),De(i,o)},p:wi,i:wi,o:wi,d(u){u&&Q(i)}}}function ZE(l){let i=dg(l[0].selected.total_pop.percent)+"",a,o;return{c(){a=Ut(i),o=Ut("%")},l(u){a=Vt(u,i),o=Vt(u,"%")},m(u,f){Fe(u,a,f),Fe(u,o,f)},p(u,f){f&1&&i!==(i=dg(u[0].selected.total_pop.percent)+"")&&Ci(a,i)},d(u){u&&(Q(a),Q(o))}}}function GE(l){let i,a,o,u;const f=[qE,jE],p=[];function n(_,v){return _[0].selected.total_pop.count==null?0:1}return i=n(l),a=p[i]=f[i](l),{c(){a.c(),o=ri()},l(_){a.l(_),o=ri()},m(_,v){p[i].m(_,v),Fe(_,o,v),u=!0},p(_,v){let S=i;i=n(_),i===S?p[i].p(_,v):(Vi(),tt(p[S],1,1,()=>{p[S]=null}),$i(),a=p[i],a?a.p(_,v):(a=p[i]=f[i](_),a.c()),Ge(a,1),a.m(o.parentNode,o))},i(_){u||(Ge(a),u=!0)},o(_){tt(a),u=!1},d(_){_&&Q(o),p[i].d(_)}}}function WE(l){let i,a;return i=new Ps({props:{title:"Population",$$slots:{default:[GE]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,[u]){const f={};u&3&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function HE(l,i,a){let{data:o}=i;return l.$$set=u=>{"data"in u&&a(0,o=u.data)},[o]}class KE extends qi{constructor(i){super(),Zi(this,i,HE,WE,Ui,{data:0})}}function XE(l){let i,a,o,u,f=`translateX(${l[3]/l[1]+(l[1]-l[4])}px)`,p,n=`${l[2]}px`,_=`${l[4]}px`;return{c(){i=je("div"),a=Ut(l[0]),o=gt(),u=je("div"),this.h()},l(v){i=qe(v,"DIV",{class:!0});var S=Ye(i);a=Vt(S,l[0]),o=_t(S),u=qe(S,"DIV",{class:!0}),Ye(u).forEach(Q),S.forEach(Q),this.h()},h(){me(u,"class","caret svelte-1491tb3"),At(u,"transform",f),me(i,"class","tooltip svelte-1491tb3"),q_(()=>l[6].call(i)),At(i,"top",n),At(i,"left",_)},m(v,S){Fe(v,i,S),De(i,a),De(i,o),De(i,u),p=Z_(i,l[6].bind(i))},p(v,[S]){S&1&&Ci(a,v[0]),S&26&&f!==(f=`translateX(${v[3]/v[1]+(v[1]-v[4])}px)`)&&At(u,"transform",f),S&4&&n!==(n=`${v[2]}px`)&&At(i,"top",n),S&16&&_!==(_=`${v[4]}px`)&&At(i,"left",_)},i:wi,o:wi,d(v){v&&Q(i),p()}}}const Fu=4;function JE(l,i,a){let o,{title:u}=i,{x:f}=i,{y:p}=i,{width:n}=i,_;function v(){_=this.clientWidth,a(3,_)}return l.$$set=S=>{"title"in S&&a(0,u=S.title),"x"in S&&a(1,f=S.x),"y"in S&&a(2,p=S.y),"width"in S&&a(5,n=S.width)},l.$$.update=()=>{l.$$.dirty&42&&a(4,o=_&&f+_/2>n-Fu?n-_/2-Fu:_&&f-_/2<0+Fu?_/2+Fu:f)},[u,f,p,_,o,n,v]}class YE extends qi{constructor(i){super(),Zi(this,i,JE,XE,Ui,{title:0,x:1,y:2,width:5})}}function QE(l){let i,a;function o(f){i=l.getAttribute("title"),l.removeAttribute("title");let p=document.body.getBoundingClientRect(),n=l.getBoundingClientRect(),_=n.bottom,v=(n.left+n.right)/2;a=new YE({props:{title:i,x:v,y:_-p.y,width:p.width},target:document.body})}function u(){a.$destroy(),l.setAttribute("title",i)}return l.addEventListener("mouseover",o),l.addEventListener("mouseout",u),{destroy(){a&&a.$destroy(),l.removeEventListener("mouseover",o),l.removeEventListener("mouseout",u)}}}function o_(l,i,a){const o=l.slice();return o[21]=i[a],o[23]=a,o}function l_(l,i,a){const o=l.slice();return o[24]=i[a],o[26]=a,o}function c_(l,i,a){const o=l.slice();return o[24]=i[a],o[26]=a,o}function u_(l,i,a){const o=l.slice();return o[28]=i[a],o[23]=a,o}function h_(l){let i,a=Ni(l[13]),o=[];for(let u=0;u1?` (${l[2](l[11][l[23]+1].values[l[26]][l[1]])}%)`:"")),me(i,"class","bar svelte-clbyb4"),At(i,"bottom","0"),At(i,"height",o),At(i,"left",u),At(i,"width",f)},m(_,v){Fe(_,i,v),p||(n=W_(QE.call(null,i)),p=!0)},p(_,v){v&2055&&a!==(a=`${_[24][_[0]]}: ${_[2](_[24][_[1]])}%`+(_[11].length>1?` (${_[2](_[11][_[23]+1].values[_[26]][_[1]])}%)`:""))&&me(i,"title",a),v&6146&&o!==(o=`${_[12](_[24][_[1]])}%`)&&At(i,"height",o),v&16384&&u!==(u=`calc(${_[26]/_[14].length*100}%)`)&&At(i,"left",u),v&16384&&f!==(f=`calc(${1/_[14].length*100}% - 2px)`)&&At(i,"width",f)},d(_){_&&Q(i),p=!1,n()}}}function m_(l){let i;function a(f,p){return f[23]==0?tk:ek}let u=a(l)(l);return{c(){u.c(),i=ri()},l(f){u.l(f),i=ri()},m(f,p){u.m(f,p),Fe(f,i,p)},p(f,p){u.p(f,p)},d(f){f&&Q(i),u.d(f)}}}function g_(l){let i,a,o=l[6][0]!=0&&__(l),u=l[6][1]!=18&&y_(l);return{c(){o&&o.c(),i=gt(),u&&u.c(),a=ri()},l(f){o&&o.l(f),i=_t(f),u&&u.l(f),a=ri()},m(f,p){o&&o.m(f,p),Fe(f,i,p),u&&u.m(f,p),Fe(f,a,p)},p(f,p){f[6][0]!=0?o?o.p(f,p):(o=__(f),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null),f[6][1]!=18?u?u.p(f,p):(u=y_(f),u.c(),u.m(a.parentNode,a)):u&&(u.d(1),u=null)},d(f){f&&(Q(i),Q(a)),o&&o.d(f),u&&u.d(f)}}}function __(l){let i,a=`${l[16](l[11])}%`;return{c(){i=je("div"),this.h()},l(o){i=qe(o,"DIV",{class:!0}),Ye(i).forEach(Q),this.h()},h(){me(i,"class","mask svelte-clbyb4"),At(i,"bottom","0"),At(i,"height",a),At(i,"left","0"),At(i,"width",l[15](l[6][0]))},m(o,u){Fe(o,i,u)},p(o,u){u&2048&&a!==(a=`${o[16](o[11])}%`)&&At(i,"height",a),u&64&&At(i,"width",o[15](o[6][0]))},d(o){o&&Q(i)}}}function y_(l){let i,a=`${l[16](l[11])}%`;return{c(){i=je("div"),this.h()},l(o){i=qe(o,"DIV",{class:!0}),Ye(i).forEach(Q),this.h()},h(){me(i,"class","mask svelte-clbyb4"),At(i,"bottom","0"),At(i,"height",a),At(i,"left",l[15](l[6][1])),At(i,"right","2px")},m(o,u){Fe(o,i,u)},p(o,u){u&2048&&a!==(a=`${o[16](o[11])}%`)&&At(i,"height",a),u&64&&At(i,"left",o[15](o[6][1]))},d(o){o&&Q(i)}}}function v_(l){let i,a,o;return{c(){i=je("small"),a=Ut(l[7]),o=Ut(l[8]),this.h()},l(u){i=qe(u,"SMALL",{class:!0});var f=Ye(i);a=Vt(f,l[7]),o=Vt(f,l[8]),f.forEach(Q),this.h()},h(){me(i,"class","svelte-clbyb4")},m(u,f){Fe(u,i,f),De(i,a),De(i,o)},p(u,f){f&128&&Ci(a,u[7]),f&256&&Ci(o,u[8])},d(u){u&&Q(i)}}}function b_(l){let i,a;return{c(){i=je("small"),a=Ut(l[9]),this.h()},l(o){i=qe(o,"SMALL",{class:!0});var u=Ye(i);a=Vt(u,l[9]),u.forEach(Q),this.h()},h(){me(i,"class","svelte-clbyb4")},m(o,u){Fe(o,i,u),De(i,a)},p(o,u){u&512&&Ci(a,o[9])},d(o){o&&Q(i)}}}function ik(l){let i,a,o,u=`${l[3]}px`,f,p,n,_=l[5][0]+"",v,S,T,I=l[5][1]+"",z,M,C,R,D=l[10]&&l[13][1]&&h_(l),F=Ni(l[11]),j=[];for(let ne=0;nere.toFixed(1)}=i,{height:z=100}=i,{markerWidth:M=2.5}=i,{minmax:C=["0 years","85+"]}=i,{maskRange:R=null}=i,{base:D=null}=i,{base_ext:F=", 5 year age bands"}=i,{ageShadingNote:j=null}=i,{showLegend:ee=!0}=i;function oe(re,ve){let ze={};for(const be of re)ze[be[ve]]||(ze[be[ve]]={label:be[ve],values:[]}),ze[be[ve]].values.push(be);let nt=[];for(const be in ze)nt.push(ze[be]);return nt}function se(re){return re%1===0?`calc(${re/o.length*100}% - 1px)`:`calc(${Math.floor(re)/o.length*100}% + (${1/o.length*100}% - 2px) * ${re%1})`}function ne(re){return Math.max(...re.map(ve=>Math.max(...ve.values.map(ze=>p(ze[S])))))}return l.$$set=re=>{"data"in re&&a(17,_=re.data),"xKey"in re&&a(0,v=re.xKey),"yKey"in re&&a(1,S=re.yKey),"zKey"in re&&a(18,T=re.zKey),"formatTick"in re&&a(2,I=re.formatTick),"height"in re&&a(3,z=re.height),"markerWidth"in re&&a(4,M=re.markerWidth),"minmax"in re&&a(5,C=re.minmax),"maskRange"in re&&a(6,R=re.maskRange),"base"in re&&a(7,D=re.base),"base_ext"in re&&a(8,F=re.base_ext),"ageShadingNote"in re&&a(9,j=re.ageShadingNote),"showLegend"in re&&a(10,ee=re.showLegend)},l.$$.update=()=>{l.$$.dirty&131073&&a(14,o=_.map(re=>re[v]).filter((re,ve,ze)=>ze.indexOf(re)===ve)),l.$$.dirty&131074&&a(19,u=[0,Math.max(..._.map(re=>re[S]))]),l.$$.dirty&393216&&a(13,f=_.map(re=>re[T]).filter((re,ve,ze)=>ze.indexOf(re)===ve)),l.$$.dirty&524288&&a(12,p=re=>Math.abs(re/u[1])*100),l.$$.dirty&393216&&a(11,n=oe(_,T))},[v,S,I,z,M,C,R,D,F,j,ee,n,p,f,o,se,ne,_,T,u]}class nk extends qi{constructor(i){super(),Zi(this,i,rk,ik,Ui,{data:17,xKey:0,yKey:1,zKey:18,formatTick:2,height:3,markerWidth:4,minmax:5,maskRange:6,base:7,base_ext:8,ageShadingNote:9,showLegend:10})}}function sk(l){let i,a;return i=new nk({props:{data:l[0].selected&&Xu("residents","resident_age_18b",l[0]),zKey:"group",maskRange:fg(l[1]),base:"% of all people",ageShadingNote:l[1].some(x_)?w_:null,showLegend:!1}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.data=o[0].selected&&Xu("residents","resident_age_18b",o[0])),u&2&&(f.maskRange=fg(o[1])),u&2&&(f.ageShadingNote=o[1].some(x_)?w_:null),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function ak(l){let i,a=Cc.nodata+"",o;return{c(){i=je("span"),o=Ut(a),this.h()},l(u){i=qe(u,"SPAN",{class:!0});var f=Ye(i);o=Vt(f,a),f.forEach(Q),this.h()},h(){me(i,"class","num-desc svelte-uj0r62")},m(u,f){Fe(u,i,f),De(i,o)},p:wi,i:wi,o:wi,d(u){u&&Q(i)}}}function ok(l){let i,a=Cc.nodata+"",o;return{c(){i=je("span"),o=Ut(a),this.h()},l(u){i=qe(u,"SPAN",{class:!0});var f=Ye(i);o=Vt(f,a),f.forEach(Q),this.h()},h(){me(i,"class","num-desc svelte-uj0r62")},m(u,f){Fe(u,i,f),De(i,o)},p:wi,i:wi,o:wi,d(u){u&&Q(i)}}}function lk(l){let i,a,o,u;const f=[ok,ak,sk],p=[];function n(_,v){return _[0].selected.residents.resident_age_18b.values==="blocked"?0:_[0].selected.residents.resident_age_18b.values.percent[0]==null?1:2}return i=n(l),a=p[i]=f[i](l),{c(){a.c(),o=ri()},l(_){a.l(_),o=ri()},m(_,v){p[i].m(_,v),Fe(_,o,v),u=!0},p(_,v){let S=i;i=n(_),i===S?p[i].p(_,v):(Vi(),tt(p[S],1,1,()=>{p[S]=null}),$i(),a=p[i],a?a.p(_,v):(a=p[i]=f[i](_),a.c()),Ge(a,1),a.m(o.parentNode,o))},i(_){u||(Ge(a),u=!0)},o(_){tt(a),u=!1},d(_){_&&Q(o),p[i].d(_)}}}function ck(l){let i,a;return i=new Ps({props:{title:"Age profile",$$slots:{default:[lk]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,[u]){const f={};u&7&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}const w_="This chart shows all ages, with the selected age range highlighted.",x_=l=>l.topic==="Age";function uk(l,i,a){let{data:o}=i,{selected:u}=i;return l.$$set=f=>{"data"in f&&a(0,o=f.data),"selected"in f&&a(1,u=f.selected)},[o,u]}class hk extends qi{constructor(i){super(),Zi(this,i,uk,ck,Ui,{data:0,selected:1})}}function fk(l,i,a){const o=l.slice();return o[2]=i[a],o[4]=a,o}function dk(l){let i,a,o,u,f,p;return{c(){i=je("li"),a=je("div"),o=gt(),u=je("span"),f=Ut(l[2]),p=gt(),this.h()},l(n){i=qe(n,"LI",{class:!0});var _=Ye(i);a=qe(_,"DIV",{class:!0}),Ye(a).forEach(Q),o=_t(_),u=qe(_,"SPAN",{class:!0});var v=Ye(u);f=Vt(v,l[2]),v.forEach(Q),p=_t(_),_.forEach(Q),this.h()},h(){me(a,"class","legend-vis "+(l[4]==0?"bar":"marker")+" svelte-ehf2rq"),me(u,"class",Sc(l[4]==0?"bold":"brackets")+" svelte-ehf2rq"),me(i,"class","svelte-ehf2rq"),Zt(i,"ew",l[4]!=0)},m(n,_){Fe(n,i,_),De(i,a),De(i,o),De(i,u),De(u,f),De(i,p)},p:wi,d(n){n&&Q(i)}}}function pk(l){let i,a,o,u;const f=l[1].default,p=Ir(f,l,l[0],null);let n=Ni(["People with the selected characteristics","All people in England and Wales"]),_=[];for(let v=0;v<2;v+=1)_[v]=dk(fk(l,n,v));return{c(){i=je("p"),p&&p.c(),a=gt(),o=je("ul");for(let v=0;v<2;v+=1)_[v].c();this.h()},l(v){i=qe(v,"P",{class:!0});var S=Ye(i);p&&p.l(S),S.forEach(Q),a=_t(v),o=qe(v,"UL",{class:!0});var T=Ye(o);for(let I=0;I<2;I+=1)_[I].l(T);T.forEach(Q),this.h()},h(){me(i,"class","legend-text svelte-ehf2rq"),me(o,"class","legend-block svelte-ehf2rq")},m(v,S){Fe(v,i,S),p&&p.m(i,null),Fe(v,a,S),Fe(v,o,S);for(let T=0;T<2;T+=1)_[T]&&_[T].m(o,null);u=!0},p(v,[S]){p&&p.p&&(!u||S&1)&&Ar(p,f,v,v[0],u?zr(f,v[0],S,null):Pr(v[0]),null)},i(v){u||(Ge(p,v),u=!0)},o(v){tt(p,v),u=!1},d(v){v&&(Q(i),Q(a),Q(o)),p&&p.d(v),Zr(_,v)}}}function mk(l,i,a){let{$$slots:o={},$$scope:u}=i;return l.$$set=f=>{"$$scope"in f&&a(0,u=f.$$scope)},[u,o]}class Uy extends qi{constructor(i){super(),Zi(this,i,mk,pk,Ui,{})}}function gk(l){let i,a,o,u,f=(l[0]?"Close panel":l[1])+"",p,n,_,v,S,T,I;const z=l[3].default,M=Ir(z,l,l[2],null);return{c(){i=je("details"),a=je("summary"),o=je("h3"),u=je("span"),p=Ut(f),_=gt(),v=je("div"),M&&M.c(),this.h()},l(C){i=qe(C,"DETAILS",{class:!0});var R=Ye(i);a=qe(R,"SUMMARY",{class:!0,"data-ga-action":!0});var D=Ye(a);o=qe(D,"H3",{class:!0});var F=Ye(o);u=qe(F,"SPAN",{class:!0});var j=Ye(u);p=Vt(j,f),j.forEach(Q),F.forEach(Q),D.forEach(Q),_=_t(R),v=qe(R,"DIV",{class:!0});var ee=Ye(v);M&&M.l(ee),ee.forEach(Q),R.forEach(Q),this.h()},h(){me(u,"class","ons-btn__inner"),me(o,"class","ons-btn"),Zt(o,"ons-btn--secondary",l[0]),me(a,"class","ons-collapsible__heading ons-js-collapsible-heading svelte-1x2xth5"),me(a,"data-ga-action",n=l[0]?"Close panel":"Open panel"),me(v,"class","ons-collapsible__content ons-js-collapsible-content svelte-1x2xth5"),me(i,"class","ons-collapsible ons-js-collapsible svelte-1x2xth5")},m(C,R){Fe(C,i,R),De(i,a),De(a,o),De(o,u),De(u,p),De(i,_),De(i,v),M&&M.m(v,null),i.open=l[0],S=!0,T||(I=Ms(i,"toggle",l[4]),T=!0)},p(C,[R]){(!S||R&3)&&f!==(f=(C[0]?"Close panel":C[1])+"")&&Ci(p,f),(!S||R&1)&&Zt(o,"ons-btn--secondary",C[0]),(!S||R&1&&n!==(n=C[0]?"Close panel":"Open panel"))&&me(a,"data-ga-action",n),M&&M.p&&(!S||R&4)&&Ar(M,z,C,C[2],S?zr(z,C[2],R,null):Pr(C[2]),null),R&1&&(i.open=C[0])},i(C){S||(Ge(M,C),S=!0)},o(C){tt(M,C),S=!1},d(C){C&&Q(i),M&&M.d(C),T=!1,I()}}}function _k(l,i,a){let{$$slots:o={},$$scope:u}=i,{title:f="Title"}=i,{open:p=!1}=i;function n(){p=this.open,a(0,p)}return l.$$set=_=>{"title"in _&&a(1,f=_.title),"open"in _&&a(0,p=_.open),"$$scope"in _&&a(2,u=_.$$scope)},[p,f,u,o,n]}class yk extends qi{constructor(i){super(),Zi(this,i,_k,gk,Ui,{title:1,open:0})}}function vk(l){let i,a,o,u,f;o=new ch({props:{type:"error"}});const p=l[1].default,n=Ir(p,l,l[0],null);return{c(){i=je("div"),a=je("div"),ei(o.$$.fragment),u=gt(),n&&n.c(),this.h()},l(_){i=qe(_,"DIV",{class:!0});var v=Ye(i);a=qe(v,"DIV",{class:!0});var S=Ye(a);si(o.$$.fragment,S),S.forEach(Q),u=_t(v),n&&n.l(v),v.forEach(Q),this.h()},h(){me(a,"class","notice-icon svelte-1404fgr"),me(i,"class","notice-container svelte-1404fgr")},m(_,v){Fe(_,i,v),De(i,a),ti(o,a,null),De(i,u),n&&n.m(i,null),f=!0},p(_,[v]){n&&n.p&&(!f||v&1)&&Ar(n,p,_,_[0],f?zr(p,_[0],v,null):Pr(_[0]),null)},i(_){f||(Ge(o.$$.fragment,_),Ge(n,_),f=!0)},o(_){tt(o.$$.fragment,_),tt(n,_),f=!1},d(_){_&&Q(i),ii(o),n&&n.d(_)}}}function bk(l,i,a){let{$$slots:o={},$$scope:u}=i;return l.$$set=f=>{"$$scope"in f&&a(0,u=f.$$scope)},[u,o]}class wk extends qi{constructor(i){super(),Zi(this,i,bk,vk,Ui,{})}}function Nu(l){throw new Error('Could not dynamically require "'+l+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Vy={exports:{}};/*! + `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){v.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(y,t,c){this._canvas.width=Math.floor(c*y),this._canvas.height=Math.floor(c*t),this._canvas.style.width=`${y}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const y={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let t=null;this._canvas.addEventListener("webglcontextcreationerror",d=>{t={requestedAttributes:y},d&&(t.statusMessage=d.statusMessage,t.type=d.type)},{once:!0});const c=this._canvas.getContext("webgl2",y)||this._canvas.getContext("webgl",y);if(!c){const d="Failed to initialize WebGL";throw t?(t.message=d,new Error(JSON.stringify(t))):new Error(d)}this.painter=new hr(c,this.transform),E.testSupport(c)}_onCooperativeGesture(y,t,c){return!t&&c<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(y){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||y,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(y){return this._update(),this._renderTaskQueue.add(y)}_cancelRenderFrame(y){this._renderTaskQueue.remove(y)}_render(y){const t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(y),this._removed)return;let c=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const g=this.transform.zoom,w=n.browser.now();this.style.zoomHistory.update(g,w);const T=new n.EvaluationParameters(g,{now:w,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),A=T.crossFadingFactor();A===1&&A===this._crossFadingFactor||(c=!0,this._crossFadingFactor=A),this.style.update(T)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),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 n.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,n.PerformanceUtils.mark(n.PerformanceMarkers.load),this.fire(new n.Event("load"))),this.style&&(this.style.hasTransitions()||c)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new n.Event("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,n.PerformanceUtils.mark(n.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var y;this._hash&&this._hash.remove();for(const c of this._controls)c.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),L.removeThrottleControl(this._imageQueueHandle),(y=this._resizeObserver)===null||y===void 0||y.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),v.remove(this._canvasContainer),v.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),n.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new n.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=n.browser.frame(y=>{n.PerformanceUtils.frame(y),this._frame=null,this._render(y)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(y){this._showTileBoundaries!==y&&(this._showTileBoundaries=y,this._update())}get showPadding(){return!!this._showPadding}set showPadding(y){this._showPadding!==y&&(this._showPadding=y,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(y){this._showCollisionBoxes!==y&&(this._showCollisionBoxes=y,y?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(y){this._showOverdrawInspector!==y&&(this._showOverdrawInspector=y,this._update())}get repaint(){return!!this._repaint}set repaint(y){this._repaint!==y&&(this._repaint=y,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(y){this._vertices=y,this._update()}get version(){return To}getCameraTargetElevation(){return this.transform.elevation}},ji.NavigationControl=class{constructor(y){this._updateZoomButtons=()=>{const t=this._map.getZoom(),c=t===this._map.getMaxZoom(),d=t===this._map.getMinZoom();this._zoomInButton.disabled=c,this._zoomOutButton.disabled=d,this._zoomInButton.setAttribute("aria-disabled",c.toString()),this._zoomOutButton.setAttribute("aria-disabled",d.toString())},this._rotateCompassArrow=()=>{const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=t},this._setButtonTitle=(t,c)=>{const d=this._map._getUIString(`NavigationControl.${c}`);t.title=d,t.setAttribute("aria-label",d)},this.options=n.extend({},Co,y),this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),v.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})),v.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=v.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(y){return this._map=y,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 Zl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){v.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(y,t){const c=v.create("button",y,this._container);return c.type="button",c.addEventListener("click",t),c}},ji.GeolocateControl=class extends n.Evented{constructor(y){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new n.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),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(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new n.Event("geolocate",t)),this._finish()}},this._updateCamera=t=>{const c=new n.LngLat(t.coords.longitude,t.coords.latitude),d=t.coords.accuracy,g=this._map.getBearing(),w=n.extend({bearing:g},this.options.fitBoundsOptions),T=De.fromLngLat(c,d);this._map.fitBounds(T,w,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const c=new n.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(c).addTo(this._map),this._userLocationDotMarker.setLngLat(c).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.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 c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=c,this._geolocateButton.setAttribute("aria-label",c),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&ir)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new n.Event("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",c=>c.preventDefault()),this._geolocateButton=v.create("button","maplibregl-ctrl-geolocate",this._container),v.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){n.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const c=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=c,this._geolocateButton.setAttribute("aria-label",c)}else{const c=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=c,this._geolocateButton.setAttribute("aria-label",c)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=v.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Gl({element:this._dotElement}),this._circleElement=v.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Gl({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",c=>{c.geolocateSource||this._watchState!=="ACTIVE_LOCK"||c.originalEvent&&c.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 n.Event("trackuserlocationend")))})}},this.options=n.extend({},Ba,y)}onAdd(y){return this._map=y,this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(t,c=!1){Xn===void 0||c?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(d=>{Xn=d.state!=="denied",t(Xn)}).catch(()=>{Xn=!!window.navigator.geolocation,t(Xn)}):(Xn=!!window.navigator.geolocation,t(Xn)):t(Xn)}(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(),v.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Yi=0,ir=!1}_isOutOfMapMaxBounds(y){const t=this._map.getMaxBounds(),c=y.coords;return t&&(c.longitudet.getEast()||c.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}`)}}_updateCircleRadius(){const y=this._map.getBounds(),t=y.getSouthEast(),c=y.getNorthEast(),d=t.distanceTo(c),g=Math.ceil(this._accuracy/(d/this._map._container.clientHeight)*2);this._circleElement.style.width=`${g}px`,this._circleElement.style.height=`${g}px`}trigger(){if(!this._setup)return n.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 n.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Yi--,ir=!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 n.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 n.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 y;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Yi++,Yi>1?(y={maximumAge:6e5,timeout:0},ir=!0):(y=this.options.positionOptions,ir=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,y)}}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)}},ji.AttributionControl=jl,ji.LogoControl=Sn,ji.ScaleControl=class{constructor(y){this._onMove=()=>{sa(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,sa(this._map,this._container,this.options)},this.options=n.extend({},lu,y)}getDefaultPosition(){return"bottom-left"}onAdd(y){return this._map=y,this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-scale",y.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){v.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},ji.FullscreenControl=class extends n.Evented{constructor(y={}){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,y&&y.container&&(y.container instanceof HTMLElement?this._container=y.container:n.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(y){return this._map=y,this._container||(this._container=this._map.getContainer()),this._controlContainer=v.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){v.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const y=this._fullscreenButton=v.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);v.create("span","maplibregl-ctrl-icon",y).setAttribute("aria-hidden","true"),y.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const y=this._getTitle();this._fullscreenButton.setAttribute("aria-label",y),this._fullscreenButton.title=y}_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 n.Event("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new n.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()}},ji.TerrainControl=class{constructor(y){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=y}onAdd(y){return this._map=y,this._container=v.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=v.create("button","maplibregl-ctrl-terrain",this._container),v.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(){v.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},ji.Popup=class extends n.Evented{constructor(y){super(),this.remove=()=>(this._content&&v.remove(this._content),this._container&&(v.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 n.Event("close")),this),this._onMouseUp=t=>{this._update(t.point)},this._onMouseMove=t=>{this._update(t.point)},this._onDrag=t=>{this._update(t.point)},this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=v.create("div","maplibregl-popup",this._map.getContainer()),this._tip=v.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const T of this.options.className.split(" "))this._container.classList.add(T);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=en(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!t)return;const c=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);let d=this.options.anchor;const g=Ao(this.options.offset);if(!d){const T=this._container.offsetWidth,A=this._container.offsetHeight;let R;R=c.y+g.bottom.ythis._map.transform.height-A?["bottom"]:[],c.xthis._map.transform.width-T/2&&R.push("right"),d=R.length===0?"bottom":R.join("-")}const w=c.add(g[d]).round();v.setTransform(this._container,`${Io[d]} translate(${w.x}px,${w.y}px)`),$n(this._container,d,"popup")},this._onClose=()=>{this.remove()},this.options=n.extend(Object.create(Wl),y)}addTo(y){return this._map&&this.remove(),this._map=y,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 n.Event("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(y){return this._lngLat=n.LngLat.convert(y),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(y){return this.setDOMContent(document.createTextNode(y))}setHTML(y){const t=document.createDocumentFragment(),c=document.createElement("body");let d;for(c.innerHTML=y;d=c.firstChild,d;)t.appendChild(d);return this.setDOMContent(t)}getMaxWidth(){var y;return(y=this._container)===null||y===void 0?void 0:y.style.maxWidth}setMaxWidth(y){return this.options.maxWidth=y,this._update(),this}setDOMContent(y){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=v.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(y),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(y){this._container&&this._container.classList.add(y)}removeClassName(y){this._container&&this._container.classList.remove(y)}setOffset(y){return this.options.offset=y,this._update(),this}toggleClassName(y){if(this._container)return this._container.classList.toggle(y)}_createCloseButton(){this.options.closeButton&&(this._closeButton=v.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))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const y=this._container.querySelector(Hl);y&&y.focus()}},ji.Marker=Gl,ji.Style=kr,ji.LngLat=n.LngLat,ji.LngLatBounds=De,ji.Point=n.Point,ji.MercatorCoordinate=n.MercatorCoordinate,ji.Evented=n.Evented,ji.AJAXError=n.AJAXError,ji.config=n.config,ji.CanvasSource=gt,ji.GeoJSONSource=vt,ji.ImageSource=Nt,ji.RasterDEMTileSource=wt,ji.RasterTileSource=Qe,ji.VectorTileSource=ue,ji.VideoSource=fi,ji.setRTLTextPlugin=n.setRTLTextPlugin,ji.getRTLTextPluginStatus=n.getRTLTextPluginStatus,ji.prewarm=function(){Ti().acquire(kt)},ji.clearPrewarmedResources=function(){const y=Ii;y&&(y.isPreloaded()&&y.numActive()===1?(y.release(kt),Ii=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()"))},Oa.extend(ji,{isSafari:n.isSafari,getPerformanceMetrics:n.PerformanceUtils.getPerformanceMetrics}),ji});var p=u;return p})})($y);var rS=$y.exports;const _c=rh(rS);const{document:Gg}=ry;function Wg(l){let i;const a=l[19].default,o=Ir(a,l,l[18],null);return{c(){o&&o.c()},l(u){o&&o.l(u)},m(u,f){o&&o.m(u,f),i=!0},p(u,f){o&&o.p&&(!i||f&262144)&&Ar(o,a,u,u[18],i?zr(a,u[18],f,null):Pr(u[18]),null)},i(u){i||(Ke(o,u),i=!0)},o(u){st(o,u),i=!1},d(u){o&&o.d(u)}}}function nS(l){let i,a,o,u,f,p=l[3]&&Wg(l);return{c(){i=Be("link"),o=ut(),u=Be("div"),p&&p.c(),this.h()},l(n){const _=ey("svelte-12hmray",Gg.head);i=Oe(_,"LINK",{rel:!0,href:!0}),_.forEach(X),o=ht(n),u=Oe(n,"DIV",{id:!0,class:!0});var v=Je(u);p&&p.l(v),v.forEach(X),this.h()},h(){pe(i,"rel","stylesheet"),pe(i,"href",a=l[1]?l[1]:"https://unpkg.com/maplibre-gl@3.3.1/dist/maplibre-gl.css"),pe(u,"id",l[0]),pe(u,"class","map svelte-1tna482")},m(n,_){Te(Gg.head,i),Fe(n,o,_),Fe(n,u,_),p&&p.m(u,null),l[20](u),f=!0},p(n,[_]){(!f||_&2&&a!==(a=n[1]?n[1]:"https://unpkg.com/maplibre-gl@3.3.1/dist/maplibre-gl.css"))&&pe(i,"href",a),n[3]?p?(p.p(n,_),_&8&&Ke(p,1)):(p=Wg(n),p.c(),Ke(p,1),p.m(u,null)):p&&(Vi(),st(p,1,1,()=>{p=null}),$i()),(!f||_&1)&&pe(u,"id",n[0])},i(n){f||(Ke(p),f=!0)},o(n){st(p),f=!1},d(n){n&&(X(o),X(u)),X(i),p&&p.d(),l[20](null)}}}function sS(l=1e3){return new Promise(i=>setTimeout(i,l))}function aS(l,i,a){let{$$slots:o={},$$scope:u}=i;const f=$f();let{map:p}=i,{id:n="map"}=i,{location:_={lng:15,lat:45,zoom:1}}=i,{style:v={version:8,sources:{},layers:[{id:"background",type:"background",paint:{"background-color":"lightgrey"}}]}}=i,{css:E=null}=i,{options:S={}}=i,{minzoom:C=0}=i,{maxzoom:z=14}=i,{controls:P=!1}=i,{tabbable:I=!1}=i,{zoom:L=null}=i,{center:D=null}=i,{pitch:F=null}=i,{bearing:V=null}=i,{interactive:ee=!0}=i,{attribution:se=!0}=i,ne,le={},ge=!1;Ka("map",{getMap:()=>p}),_.bounds?le.bounds=_.bounds:_.lng&&_.lat&&(le.center=[+_.lng,+_.lat],_.zoom&&(le.zoom=+_.zoom),_.pitch&&(le.pitch=+_.pitch),_.bearing&&(le.bearing=+_.bearing)),se||(le.attributionControl=!1),le={...le,...S},th(()=>{a(4,p=new _c.Map({container:ne,style:v,minZoom:C,maxZoom:z,interactive:ee,...le})),P&&!Array.isArray(P)?p.addControl(new _c.NavigationControl({showCompass:!1})):Array.isArray(P)&&P!=["locate"]&&p.addControl(new _c.NavigationControl({showCompass:P.includes("compass"),visualizePitch:P.includes("pitch")})),Array.isArray(P)&&P.includes("locate")&&p.addControl(new _c.GeolocateControl),p.on("load",et=>{a(5,L=p.getZoom()),a(6,D=p.getCenter()),a(7,F=p.getPitch()),a(8,V=p.getBearing()),a(3,ge=!0),!I&&document.querySelector(`#${n} canvas`)&&(document.querySelector(`#${n} canvas`).tabIndex="-1"),f("load",{event:et})}),p.on("moveend",()=>{a(5,L=p.getZoom()),a(6,D=p.getCenter()),a(7,F=p.getPitch()),a(8,V=p.getBearing())})}),ih(async()=>{await sS(250),p&&p.remove(),a(4,p=null)});function ce(et){p&&p.setStyle(et),f("style",{style:et})}function Me(et){Ja[et?"unshift":"push"](()=>{ne=et,a(2,ne)})}return l.$$set=et=>{"map"in et&&a(4,p=et.map),"id"in et&&a(0,n=et.id),"location"in et&&a(9,_=et.location),"style"in et&&a(10,v=et.style),"css"in et&&a(1,E=et.css),"options"in et&&a(11,S=et.options),"minzoom"in et&&a(12,C=et.minzoom),"maxzoom"in et&&a(13,z=et.maxzoom),"controls"in et&&a(14,P=et.controls),"tabbable"in et&&a(15,I=et.tabbable),"zoom"in et&&a(5,L=et.zoom),"center"in et&&a(6,D=et.center),"pitch"in et&&a(7,F=et.pitch),"bearing"in et&&a(8,V=et.bearing),"interactive"in et&&a(16,ee=et.interactive),"attribution"in et&&a(17,se=et.attribution),"$$scope"in et&&a(18,u=et.$$scope)},l.$$.update=()=>{l.$$.dirty&1024&&ce(v)},[n,E,ne,ge,p,L,D,F,V,_,v,S,C,z,P,I,ee,se,u,o,Me]}let oS=class extends qi{constructor(i){super(),Zi(this,i,aS,nS,Ui,{map:4,id:0,location:9,style:10,css:1,options:11,minzoom:12,maxzoom:13,controls:14,tabbable:15,zoom:5,center:6,pitch:7,bearing:8,interactive:16,attribution:17})}};function Hg(l){let i;const a=l[12].default,o=Ir(a,l,l[11],null);return{c(){o&&o.c()},l(u){o&&o.l(u)},m(u,f){o&&o.m(u,f),i=!0},p(u,f){o&&o.p&&(!i||f&2048)&&Ar(o,a,u,u[11],i?zr(a,u[11],f,null):Pr(u[11]),null)},i(u){i||(Ke(o,u),i=!0)},o(u){st(o,u),i=!1},d(u){o&&o.d(u)}}}function lS(l){let i,a,o=l[0]&&Hg(l);return{c(){o&&o.c(),i=ri()},l(u){o&&o.l(u),i=ri()},m(u,f){o&&o.m(u,f),Fe(u,i,f),a=!0},p(u,[f]){u[0]?o?(o.p(u,f),f&1&&Ke(o,1)):(o=Hg(u),o.c(),Ke(o,1),o.m(i.parentNode,i)):o&&(Vi(),st(o,1,1,()=>{o=null}),$i())},i(u){a||(Ke(o),a=!0)},o(u){st(o),a=!1},d(u){u&&X(i),o&&o.d(u)}}}function cS(l=1e3){return new Promise(i=>setTimeout(i,l))}function uS(l,i,a){let{$$slots:o={},$$scope:u}=i,{id:f}=i,{type:p}=i,{url:n=null}=i,{props:_={}}=i,{data:v=null}=i,{layer:E=null}=i,{promoteId:S=null}=i,{minzoom:C=null}=i,{maxzoom:z=null}=i,{tilesize:P=256}=i,I=!1,L=n;const{getMap:D}=Xa("map"),F=D();Ka("source",{source:f,layer:E,promoteId:S}),F.getSource(f)&&F.removeSource(f);async function V(){await cS(100),F.isSourceLoaded(f)?(a(0,I=!0),console.debug(f+" map source loaded!")):(console.debug("..."),V())}C&&(_.minzoom=C),z&&(_.maxzoom=z),E&&S?(_.promoteId={},_.promoteId[E]=S):S&&(_.promoteId=S);function ee(){console.debug(f+" map source loading...");let ge;p=="geojson"?v?ge={type:p,data:v,..._}:n&&(ge={type:p,data:n,..._}):p=="vector"?ge={type:p,tiles:[n],..._}:p=="raster"?ge={type:p,tiles:[n],tileSize:P,..._}:p=="raster-dem"&&(ge={type:p,tiles:[n],tileSize:P,..._}),ge&&(F.addSource(f,ge),V())}function se(ge){let ce=F.getSource(f);ce&&ce.setData(ge)}function ne(ge){if(ge!==L){let ce=F.getSource(f);ce&&ce.setTiles([ge]),L=ge}}function le(ge){ge!==L&&(F.getSource(f).tiles=[ge],F.style.sourceCaches[f].clearTiles(),F.style.sourceCaches[f].update(F.transform),F.triggerRepaint(),L=ge)}return th(ee),ih(async()=>{F&&F.getSource(f)&&(F.getStyle().layers.filter(ce=>ce.source==f).forEach(ce=>{F.removeLayer(ce.id)}),F.removeSource(f))}),l.$$set=ge=>{"id"in ge&&a(2,f=ge.id),"type"in ge&&a(3,p=ge.type),"url"in ge&&a(4,n=ge.url),"props"in ge&&a(1,_=ge.props),"data"in ge&&a(5,v=ge.data),"layer"in ge&&a(6,E=ge.layer),"promoteId"in ge&&a(7,S=ge.promoteId),"minzoom"in ge&&a(8,C=ge.minzoom),"maxzoom"in ge&&a(9,z=ge.maxzoom),"tilesize"in ge&&a(10,P=ge.tilesize),"$$scope"in ge&&a(11,u=ge.$$scope)},l.$$.update=()=>{l.$$.dirty&41&&p=="geojson"&&I&&se(v),l.$$.dirty&25&&p=="vector"&&I&&ne(n),l.$$.dirty&25&&p=="raster"&&I&&le(n)},[I,_,f,p,n,v,E,S,C,z,P,u,o]}class hS extends qi{constructor(i){super(),Zi(this,i,uS,lS,Ui,{id:2,type:3,url:4,props:1,data:5,layer:6,promoteId:7,minzoom:8,maxzoom:9,tilesize:10})}}const fS=l=>({hovered:l[0]&1}),Kg=l=>({hovered:l[0]});function dS(l){let i;const a=l[30].default,o=Ir(a,l,l[29],Kg);return{c(){o&&o.c()},l(u){o&&o.l(u)},m(u,f){o&&o.m(u,f),i=!0},p(u,f){o&&o.p&&(!i||f[0]&536870913)&&Ar(o,a,u,u[29],i?zr(a,u[29],f,fS):Pr(u[29]),Kg)},i(u){i||(Ke(o,u),i=!0)},o(u){st(o,u),i=!1},d(u){o&&o.d(u)}}}function pS(l,i,a){let o,{$$slots:u={},$$scope:f}=i;const p=$f();let{id:n}=i,{type:_}=i,{filter:v=null}=i,{layout:E={}}=i,{paint:S={}}=i,{data:C=null}=i,{colorKey:z="color"}=i,{nameKey:P=null}=i,{valueKey:I=null}=i,{idKey:L=null}=i,{select:D=!1}=i,{clickIgnore:F=!1}=i,{clickCenter:V=!1}=i,{selected:ee=null}=i,{hover:se=!1}=i,{hovered:ne=null}=i,{highlight:le=!1}=i,{highlightKey:ge="highlighted"}=i,{highlighted:ce=[]}=i,{order:Me=null}=i,{maxzoom:et=null}=i,{minzoom:ye=null}=i,{sourceLayer:Ge=null}=i,{visible:q=!0}=i;const{source:We,layer:Tt,promoteId:it}=Xa("source"),{getMap:Bt}=Xa("map"),Ne=Bt();Ka("layer",{layer:n});const Xe=ty({id:null,feature:null,event:null});eh(l,Xe,gt=>a(34,o=gt)),Ka("hover",Xe),L=L||it,Ge=Ge||Tt;let ie=null,ve=null,De=[],Y={...E};E.visibility||(Y.visibility=q?"visible":"none");let ue={id:n,type:_,source:We,paint:S,layout:Y};v&&(ue.filter=v),Ge&&(ue["source-layer"]=Ge),et&&(ue.maxzoom=et),ye&&(ue.minzoom=ye),th(()=>{Ne.getLayer(n)&&Ne.removeLayer(n),Ne.addLayer(ue,Me)});let Qe=[];function wt(gt,_i=z){console.debug("updating colors...");for(const Z of Qe)Ne.setFeatureState({source:We,sourceLayer:Ge,id:Z},{color:null,value:null});Qe=[];for(const Z of gt)Ne.setFeatureState({source:We,sourceLayer:Ge,id:Z[L]},{color:_i?Z[_i]:null,value:I?Z[I]:null,name:P?Z[P]:null}),Qe.push(Z[L])}function vt(gt){Ne.getLayer(n)&&Ne.setFilter(n,gt)}function It(gt){if(Ne.getLayer(n))for(const _i in gt)Ne.setLayoutProperty(n,_i,gt[_i])}function Nt(gt){if(Ne.getLayer(n))for(const _i in gt)Ne.setPaintProperty(n,_i,gt[_i])}function fi(gt){!E.visibility&&Ne.getLayer(n)&&Ne.setLayoutProperty(n,"visibility",gt?"visible":"none")}return D&&Ne.on("click",n,gt=>{if(gt.features.length>0&&!F){let _i=gt.features[0];if(a(2,ee=_i.id),p("select",{id:ee,feature:_i,event:gt}),ie&&Ne.setFeatureState({source:We,sourceLayer:Ge,id:ie},{selected:!1}),Ne.setFeatureState({source:We,sourceLayer:Ge,id:ee},{selected:!0}),V){let Z=centroid(gt.features[0].toJSON().geometry);Ne.flyTo({center:Z.geometry.coordinates})}a(26,ie=ee)}}),se&&(Ne.on("mousemove",n,gt=>{if(gt.features.length>0){ne&&Ne.setFeatureState({source:We,sourceLayer:Ge,id:ne},{hovered:!1});let _i=gt.features[0];a(0,ne=a(27,ve=_i.id)),Xe.set({id:ne,feature:_i,event:gt}),p("hover",o),Ne.setFeatureState({source:We,sourceLayer:Ge,id:ne},{hovered:!0}),Ne.getCanvas().style.cursor="pointer"}}),Ne.on("mouseleave",n,gt=>{ne&&Ne.setFeatureState({source:We,sourceLayer:Ge,id:ne},{hovered:!1}),a(0,ne=a(27,ve=null)),Xe.set({id:null,feature:null,event:gt}),p("hover",o),Ne.getCanvas().style.cursor=""})),ih(async()=>{Ne&&Ne.getLayer(n)&&Ne.removeLayer(n)}),l.$$set=gt=>{"id"in gt&&a(5,n=gt.id),"type"in gt&&a(6,_=gt.type),"filter"in gt&&a(7,v=gt.filter),"layout"in gt&&a(8,E=gt.layout),"paint"in gt&&a(9,S=gt.paint),"data"in gt&&a(10,C=gt.data),"colorKey"in gt&&a(11,z=gt.colorKey),"nameKey"in gt&&a(12,P=gt.nameKey),"valueKey"in gt&&a(13,I=gt.valueKey),"idKey"in gt&&a(4,L=gt.idKey),"select"in gt&&a(14,D=gt.select),"clickIgnore"in gt&&a(15,F=gt.clickIgnore),"clickCenter"in gt&&a(16,V=gt.clickCenter),"selected"in gt&&a(2,ee=gt.selected),"hover"in gt&&a(17,se=gt.hover),"hovered"in gt&&a(0,ne=gt.hovered),"highlight"in gt&&a(18,le=gt.highlight),"highlightKey"in gt&&a(19,ge=gt.highlightKey),"highlighted"in gt&&a(20,ce=gt.highlighted),"order"in gt&&a(21,Me=gt.order),"maxzoom"in gt&&a(22,et=gt.maxzoom),"minzoom"in gt&&a(23,ye=gt.minzoom),"sourceLayer"in gt&&a(3,Ge=gt.sourceLayer),"visible"in gt&&a(24,q=gt.visible),"$$scope"in gt&&a(29,f=gt.$$scope)},l.$$.update=()=>{if(l.$$.dirty[0]&3072&&C&&wt(C,z),l.$$.dirty[0]&128&&vt(v),l.$$.dirty[0]&256&&It(E),l.$$.dirty[0]&512&&Nt(S),l.$$.dirty[0]&16777216&&fi(q),l.$$.dirty[0]&270270472&&le&&ce!=De){if(De[0])for(const gt of De){let _i={};_i[ge]=!1,Ne.setFeatureState({source:We,sourceLayer:Ge,id:gt},_i)}if(a(28,De=ce),ce[0])for(const gt of ce){let _i={};_i[ge]=!0,Ne.setFeatureState({source:We,sourceLayer:Ge,id:gt},_i)}}l.$$.dirty[0]&67125260&&D&&ee!=ie&&(ie&&Ne.setFeatureState({source:We,sourceLayer:Ge,id:ie},{selected:!1}),ee&&Ne.setFeatureState({source:We,sourceLayer:Ge,id:ee},{selected:!0}),a(26,ie=ee)),l.$$.dirty[0]&134348809&&se&&ne!=ve&&(ve&&Ne.setFeatureState({source:We,sourceLayer:Ge,id:ve},{hovered:!1}),ne&&Ne.setFeatureState({source:We,sourceLayer:Ge,id:ne},{hovered:!0}),a(27,ve=ne))},[ne,Xe,ee,Ge,L,n,_,v,E,S,C,z,P,I,D,F,V,se,le,ge,ce,Me,et,ye,q,wt,ie,ve,De,f,u]}class Af extends qi{constructor(i){super(),Zi(this,i,pS,dS,Ui,{id:5,type:6,filter:7,layout:8,paint:9,data:10,colorKey:11,nameKey:12,valueKey:13,idKey:4,select:14,clickIgnore:15,clickCenter:16,selected:2,hover:17,hovered:0,highlight:18,highlightKey:19,highlighted:20,order:21,maxzoom:22,minzoom:23,sourceLayer:3,visible:24,updateColors:25},null,[-1,-1])}get updateColors(){return this.$$.ctx[25]}}function mS(l,i,a){let o,{content:u}=i;const f=new _c.Popup({closeButton:!1,closeOnClick:!1}),{getMap:p}=Xa("map"),n=p(),_=Xa("hover");eh(l,_,E=>a(2,o=E));function v(E,S){E.id?f.setLngLat(E.event.lngLat).setHTML(S||E.code).addTo(n):f.remove()}return ih(()=>f.remove()),l.$$set=E=>{"content"in E&&a(1,u=E.content)},l.$$.update=()=>{l.$$.dirty&6&&v(o,u)},[_,u,o]}class gS extends qi{constructor(i){super(),Zi(this,i,mS,null,Ui,{content:1})}}function Xg(l,i,a){const o=l.slice();return o[9]=i[a],o[11]=a,o}function Jg(l){let i,a,o,u,f,p=l[4](l[2][l[11]])+"",n;return{c(){i=Be("div"),a=ut(),o=Be("div"),u=ut(),f=Be("div"),n=Ot(p),this.h()},l(_){i=Oe(_,"DIV",{class:!0,style:!0}),Je(i).forEach(X),a=ht(_),o=Oe(_,"DIV",{class:!0,style:!0}),Je(o).forEach(X),u=ht(_),f=Oe(_,"DIV",{class:!0,style:!0});var v=Je(f);n=Ft(v,p),v.forEach(X),this.h()},h(){pe(i,"class","block svelte-4k2wr9"),Pt(i,"width",100/(l[2].length-1)+"%"),Pt(i,"left",l[11]*(100/(l[2].length-1))+"%"),Pt(i,"background-color",l[3][l[11]]),pe(o,"class","line svelte-4k2wr9"),Pt(o,"left",l[11]*(100/(l[2].length-1))+"%"),pe(f,"class","tick svelte-4k2wr9"),Pt(f,"left",l[11]*(100/(l[2].length-1))+"%"),Gt(f,"tick-start",l[11]==0)},m(_,v){Fe(_,i,v),Fe(_,a,v),Fe(_,o,v),Fe(_,u,v),Fe(_,f,v),Te(f,n)},p(_,v){v&4&&Pt(i,"width",100/(_[2].length-1)+"%"),v&4&&Pt(i,"left",_[11]*(100/(_[2].length-1))+"%"),v&8&&Pt(i,"background-color",_[3][_[11]]),v&4&&Pt(o,"left",_[11]*(100/(_[2].length-1))+"%"),v&20&&p!==(p=_[4](_[2][_[11]])+"")&&vi(n,p),v&4&&Pt(f,"left",_[11]*(100/(_[2].length-1))+"%")},d(_){_&&(X(i),X(a),X(o),X(u),X(f))}}}function Yg(l){let i,a=`${l[7](l[0],l[2])}%`,o,u,f=l[5](l[0])+"",p,n;return{c(){i=Be("div"),o=ut(),u=Be("div"),p=Ot(f),n=Ot(l[6]),this.h()},l(_){i=Oe(_,"DIV",{class:!0}),Je(i).forEach(X),o=ht(_),u=Oe(_,"DIV",{class:!0,style:!0});var v=Je(u);p=Ft(v,f),n=Ft(v,l[6]),v.forEach(X),this.h()},h(){pe(i,"class","marker svelte-4k2wr9"),Pt(i,"left",a),pe(u,"class","value svelte-4k2wr9"),Pt(u,"left",l[7](l[0],l[2])+"%")},m(_,v){Fe(_,i,v),Fe(_,o,v),Fe(_,u,v),Te(u,p),Te(u,n)},p(_,v){v&5&&a!==(a=`${_[7](_[0],_[2])}%`)&&Pt(i,"left",a),v&33&&f!==(f=_[5](_[0])+"")&&vi(p,f),v&64&&vi(n,_[6]),v&5&&Pt(u,"left",_[7](_[0],_[2])+"%")},d(_){_&&(X(i),X(o),X(u))}}}function _S(l){let i,a,o,u,f,p=l[4](l[2][l[2].length-1])+"",n,_,v,E=Mi(l[2].slice(1)),S=[];for(let z=0;zC.toFixed(1)}=i,{formatVal:v=C=>C.toFixed(1)}=i,{suffix:E="%"}=i;const S=(C,z)=>{let P=0;for(;C>z[P+1];)P+=1;let I=100/(z.length-1),L=(C-z[P])/(z[P+1]-z[P]);return(P+L)*I};return l.$$set=C=>{"hovered"in C&&a(0,o=C.hovered),"lineWidth"in C&&a(8,u=C.lineWidth),"height"in C&&a(1,f=C.height),"breaks"in C&&a(2,p=C.breaks),"colors"in C&&a(3,n=C.colors),"formatTick"in C&&a(4,_=C.formatTick),"formatVal"in C&&a(5,v=C.formatVal),"suffix"in C&&a(6,E=C.suffix)},[o,f,p,n,_,v,E,S,u]}class vS extends qi{constructor(i){super(),Zi(this,i,yS,_S,Ui,{hovered:0,lineWidth:8,height:1,breaks:2,colors:3,formatTick:4,formatVal:5,suffix:6})}}function Qg(l,i,a){const o=l.slice();return o[2]=i[a],o[4]=a,o}function e_(l){let i,a,o,u=l[2].name+"",f,p,n,_=l[2].value.toFixed(1)+"",v,E,S;return{c(){i=Be("tr"),a=Be("td"),o=Be("strong"),f=Ot(u),p=ut(),n=Be("td"),v=Ot(_),E=Ot("%"),S=ut(),this.h()},l(C){i=Oe(C,"TR",{});var z=Je(i);a=Oe(z,"TD",{class:!0});var P=Je(a);o=Oe(P,"STRONG",{});var I=Je(o);f=Ft(I,u),I.forEach(X),P.forEach(X),p=ht(z),n=Oe(z,"TD",{class:!0});var L=Je(n);v=Ft(L,_),E=Ft(L,"%"),L.forEach(X),S=ht(z),z.forEach(X),this.h()},h(){pe(a,"class","svelte-1i52e02"),pe(n,"class","text-right svelte-1i52e02")},m(C,z){Fe(C,i,z),Te(i,a),Te(a,o),Te(o,f),Te(i,p),Te(i,n),Te(n,v),Te(n,E),Te(i,S)},p(C,z){z&1&&u!==(u=C[2].name+"")&&vi(f,u),z&1&&_!==(_=C[2].value.toFixed(1)+"")&&vi(v,_)},d(C){C&&X(i)}}}function bS(l){let i,a,o=Mi(l[0]),u=[];for(let f=0;f{"data"in f&&a(0,o=f.data),"offset"in f&&a(1,u=f.offset)},[o,u]}class qy extends qi{constructor(i){super(),Zi(this,i,wS,bS,Ui,{data:0,offset:1})}}function xS(l){let i,a,o,u,f="No data";return{c(){i=Be("div"),a=Be("div"),o=ut(),u=Be("div"),u.textContent=f,this.h()},l(p){i=Oe(p,"DIV",{class:!0,style:!0});var n=Je(i);a=Oe(n,"DIV",{class:!0,style:!0}),Je(a).forEach(X),o=ht(n),u=Oe(n,"DIV",{class:!0,"data-svelte-h":!0}),dr(u)!=="svelte-1n9tqdn"&&(u.textContent=f),n.forEach(X),this.h()},h(){pe(a,"class","block svelte-b1cp2z"),Pt(a,"width","100%"),Pt(a,"background-color",l[1]),pe(u,"class","tick svelte-b1cp2z"),pe(i,"class","container svelte-b1cp2z"),Pt(i,"height",l[0]+"px")},m(p,n){Fe(p,i,n),Te(i,a),Te(i,o),Te(i,u)},p(p,[n]){n&2&&Pt(a,"background-color",p[1]),n&1&&Pt(i,"height",p[0]+"px")},i:xi,o:xi,d(p){p&&X(i)}}}function ES(l,i,a){let{height:o=15}=i,{color:u="lightgrey"}=i;return l.$$set=f=>{"height"in f&&a(0,o=f.height),"color"in f&&a(1,u=f.color)},[o,u]}class SS extends qi{constructor(i){super(),Zi(this,i,ES,xS,Ui,{height:0,color:1})}}function kS(l){let i,a=`People with the selected characteristics as a proportion of the whole + population in each area.`;return{c(){i=Be("p"),i.textContent=a,this.h()},l(o){i=Oe(o,"P",{class:!0,"data-svelte-h":!0}),dr(i)!=="svelte-16szk9e"&&(i.textContent=a),this.h()},h(){pe(i,"class","subtitle svelte-xikkwp")},m(o,u){Fe(o,i,u)},p:xi,d(o){o&&X(i)}}}function t_(l){let i,a;return i=new hS({props:{id:"lad",type:"geojson",data:l[0].geojson,promoteId:l[2].code,$$slots:{default:[CS]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.data=o[0].geojson),u&4&&(f.promoteId=o[2].code),u&8321&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function TS(l){let i,a;return i=new gS({props:{content:l[8](l[7])}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&128&&(f.content=o[8](o[7])),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function CS(l){let i,a,o,u,f,p,n;function _(E){l[9](E)}let v={id:"lad-fill",data:l[0].geoPerc,idKey:"code",nameKey:"name",valueKey:"value",hover:!0,tooltip:!0,type:"fill",paint:{"fill-color":["case",["!=",["feature-state","color"],null],["feature-state","color"],"rgba(255, 255, 255, 0)"],"fill-opacity":.8},order:"place_other",$$slots:{default:[TS]},$$scope:{ctx:l}};return l[7]!==void 0&&(v.hovered=l[7]),i=new Af({props:v}),Ja.push(()=>Qo(i,"hovered",_)),u=new Af({props:{id:"lad-line",type:"line",paint:{"line-color":"white","line-width":.3},order:"place_other"}}),p=new Af({props:{id:"lad-hover",type:"line",paint:{"line-color":"black","line-width":2,"line-opacity":["case",["==",["feature-state","hovered"],!0],1,0]},order:"place_other"}}),{c(){ei(i.$$.fragment),o=ut(),ei(u.$$.fragment),f=ut(),ei(p.$$.fragment)},l(E){si(i.$$.fragment,E),o=ht(E),si(u.$$.fragment,E),f=ht(E),si(p.$$.fragment,E)},m(E,S){ti(i,E,S),Fe(E,o,S),ti(u,E,S),Fe(E,f,S),ti(p,E,S),n=!0},p(E,S){const C={};S&1&&(C.data=E[0].geoPerc),S&8320&&(C.$$scope={dirty:S,ctx:E}),!a&&S&128&&(a=!0,C.hovered=E[7],Yo(()=>a=!1)),i.$set(C)},i(E){n||(Ke(i.$$.fragment,E),Ke(u.$$.fragment,E),Ke(p.$$.fragment,E),n=!0)},o(E){st(i.$$.fragment,E),st(u.$$.fragment,E),st(p.$$.fragment,E),n=!1},d(E){E&&(X(o),X(f)),ii(i,E),ii(u,E),ii(p,E)}}}function IS(l){let i,a,o=l[0].geojson&&l[0].geoPerc&&t_(l);return{c(){o&&o.c(),i=ri()},l(u){o&&o.l(u),i=ri()},m(u,f){o&&o.m(u,f),Fe(u,i,f),a=!0},p(u,f){u[0].geojson&&u[0].geoPerc?o?(o.p(u,f),f&1&&Ke(o,1)):(o=t_(u),o.c(),Ke(o,1),o.m(i.parentNode,i)):o&&(Vi(),st(o,1,1,()=>{o=null}),$i())},i(u){a||(Ke(o),a=!0)},o(u){st(o),a=!1},d(u){u&&X(i),o&&o.d(u)}}}function i_(l){let i,a,o,u,f=l[0].geoPerc.some(n_),p;o=new vS({props:{breaks:l[0].geoBreaks,hovered:l[7]&&l[0].geoPerc.find(l[10])?l[0].geoPerc.find(l[11]).value:null,colors:l[0].geoBreaks[1]==100?[l[6].seq[4]]:l[6].seq}});let n=f&&r_();return{c(){i=Be("div"),a=Be("div"),ei(o.$$.fragment),u=ut(),n&&n.c(),this.h()},l(_){i=Oe(_,"DIV",{class:!0});var v=Je(i);a=Oe(v,"DIV",{class:!0});var E=Je(a);si(o.$$.fragment,E),E.forEach(X),u=ht(v),n&&n.l(v),v.forEach(X),this.h()},h(){pe(a,"class","map-legend-breaks svelte-xikkwp"),pe(i,"class","map-legend svelte-xikkwp")},m(_,v){Fe(_,i,v),Te(i,a),ti(o,a,null),Te(i,u),n&&n.m(i,null),p=!0},p(_,v){const E={};v&1&&(E.breaks=_[0].geoBreaks),v&129&&(E.hovered=_[7]&&_[0].geoPerc.find(_[10])?_[0].geoPerc.find(_[11]).value:null),v&65&&(E.colors=_[0].geoBreaks[1]==100?[_[6].seq[4]]:_[6].seq),o.$set(E),v&1&&(f=_[0].geoPerc.some(n_)),f?n?v&1&&Ke(n,1):(n=r_(),n.c(),Ke(n,1),n.m(i,null)):n&&(Vi(),st(n,1,1,()=>{n=null}),$i())},i(_){p||(Ke(o.$$.fragment,_),Ke(n),p=!0)},o(_){st(o.$$.fragment,_),st(n),p=!1},d(_){_&&X(i),ii(o),n&&n.d()}}}function r_(l){let i,a,o;return a=new SS({}),{c(){i=Be("div"),ei(a.$$.fragment),this.h()},l(u){i=Oe(u,"DIV",{class:!0});var f=Je(i);si(a.$$.fragment,f),f.forEach(X),this.h()},h(){pe(i,"class","map-legend-nodata svelte-xikkwp")},m(u,f){Fe(u,i,f),ti(a,i,null),o=!0},i(u){o||(Ke(a.$$.fragment,u),o=!0)},o(u){st(a.$$.fragment,u),o=!1},d(u){u&&X(i),ii(a)}}}function AS(l){let i,a,o,u,f;a=new oS({props:{css:Xo+"/css/maplibre-gl.css",style:l[1],location:{bounds:l[3]},options:{maxBounds:l[4],preserveDrawingBuffer:!0,cooperativeGestures:!0},maxzoom:10,controls:!0,$$slots:{default:[IS]},$$scope:{ctx:l}}});let p=l[0].geoBreaks&&l[0].geoPerc&&i_(l);return{c(){i=Be("div"),ei(a.$$.fragment),o=ut(),p&&p.c(),u=ri(),this.h()},l(n){i=Oe(n,"DIV",{});var _=Je(i);si(a.$$.fragment,_),_.forEach(X),o=ht(n),p&&p.l(n),u=ri(),this.h()},h(){Pt(i,"height","450px")},m(n,_){Fe(n,i,_),ti(a,i,null),Fe(n,o,_),p&&p.m(n,_),Fe(n,u,_),f=!0},p(n,_){const v={};_&2&&(v.style=n[1]),_&8&&(v.location={bounds:n[3]}),_&16&&(v.options={maxBounds:n[4],preserveDrawingBuffer:!0,cooperativeGestures:!0}),_&8325&&(v.$$scope={dirty:_,ctx:n}),a.$set(v),n[0].geoBreaks&&n[0].geoPerc?p?(p.p(n,_),_&1&&Ke(p,1)):(p=i_(n),p.c(),Ke(p,1),p.m(u.parentNode,u)):p&&(Vi(),st(p,1,1,()=>{p=null}),$i())},i(n){f||(Ke(a.$$.fragment,n),Ke(p),f=!0)},o(n){st(a.$$.fragment,n),st(p),f=!1},d(n){n&&(X(i),X(o),X(u)),ii(a),p&&p.d(n)}}}function PS(l){let i,a="Make a selection to see rankings.";return{c(){i=Be("span"),i.textContent=a,this.h()},l(o){i=Oe(o,"SPAN",{class:!0,"data-svelte-h":!0}),dr(i)!=="svelte-14ggolm"&&(i.textContent=a),this.h()},h(){pe(i,"class","muted svelte-xikkwp")},m(o,u){Fe(o,i,u)},p:xi,i:xi,o:xi,d(o){o&&X(i)}}}function zS(l){let i,a;return i=new qy({props:{data:[...l[0].geoPerc].filter(s_).sort(a_).slice(0,5)}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.data=[...o[0].geoPerc].filter(s_).sort(a_).slice(0,5)),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function MS(l){let i,a,o,u;const f=[zS,PS],p=[];function n(_,v){return _[0].geoPerc&&_[5][0]?0:1}return i=n(l),a=p[i]=f[i](l),{c(){a.c(),o=ri()},l(_){a.l(_),o=ri()},m(_,v){p[i].m(_,v),Fe(_,o,v),u=!0},p(_,v){let E=i;i=n(_),i===E?p[i].p(_,v):(Vi(),st(p[E],1,1,()=>{p[E]=null}),$i(),a=p[i],a?a.p(_,v):(a=p[i]=f[i](_),a.c()),Ke(a,1),a.m(o.parentNode,o))},i(_){u||(Ke(a),u=!0)},o(_){st(a),u=!1},d(_){_&&X(o),p[i].d(_)}}}function DS(l){let i,a="Make a selection to see rankings.";return{c(){i=Be("span"),i.textContent=a,this.h()},l(o){i=Oe(o,"SPAN",{class:!0,"data-svelte-h":!0}),dr(i)!=="svelte-14ggolm"&&(i.textContent=a),this.h()},h(){pe(i,"class","muted svelte-xikkwp")},m(o,u){Fe(o,i,u)},p:xi,i:xi,o:xi,d(o){o&&X(i)}}}function LS(l){let i,a;return i=new qy({props:{data:l[0].geoPerc.filter(o_).sort(l_).slice(-5),offset:l[0].geoPerc.filter(c_).length-4}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.data=o[0].geoPerc.filter(o_).sort(l_).slice(-5)),u&1&&(f.offset=o[0].geoPerc.filter(c_).length-4),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function RS(l){let i,a,o,u;const f=[LS,DS],p=[];function n(_,v){return _[0].geoPerc&&_[5][0]?0:1}return i=n(l),a=p[i]=f[i](l),{c(){a.c(),o=ri()},l(_){a.l(_),o=ri()},m(_,v){p[i].m(_,v),Fe(_,o,v),u=!0},p(_,v){let E=i;i=n(_),i===E?p[i].p(_,v):(Vi(),st(p[E],1,1,()=>{p[E]=null}),$i(),a=p[i],a?a.p(_,v):(a=p[i]=f[i](_),a.c()),Ke(a,1),a.m(o.parentNode,o))},i(_){u||(Ke(a),u=!0)},o(_){st(a),u=!1},d(_){_&&X(o),p[i].d(_)}}}function BS(l){let i,a,o,u,f,p,n,_;return i=new Ps({props:{colspan:3,rowspan:1,noBackground:!0,$$slots:{default:[kS]},$$scope:{ctx:l}}}),o=new Ps({props:{colspan:2,rowspan:2,noBackground:!0,$$slots:{default:[AS]},$$scope:{ctx:l}}}),f=new Ps({props:{title:"Areas with high %",$$slots:{default:[MS]},$$scope:{ctx:l}}}),n=new Ps({props:{title:"Areas with low %",$$slots:{default:[RS]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment),a=ut(),ei(o.$$.fragment),u=ut(),ei(f.$$.fragment),p=ut(),ei(n.$$.fragment)},l(v){si(i.$$.fragment,v),a=ht(v),si(o.$$.fragment,v),u=ht(v),si(f.$$.fragment,v),p=ht(v),si(n.$$.fragment,v)},m(v,E){ti(i,v,E),Fe(v,a,E),ti(o,v,E),Fe(v,u,E),ti(f,v,E),Fe(v,p,E),ti(n,v,E),_=!0},p(v,E){const S={};E&8192&&(S.$$scope={dirty:E,ctx:v}),i.$set(S);const C={};E&8415&&(C.$$scope={dirty:E,ctx:v}),o.$set(C);const z={};E&8225&&(z.$$scope={dirty:E,ctx:v}),f.$set(z);const P={};E&8225&&(P.$$scope={dirty:E,ctx:v}),n.$set(P)},i(v){_||(Ke(i.$$.fragment,v),Ke(o.$$.fragment,v),Ke(f.$$.fragment,v),Ke(n.$$.fragment,v),_=!0)},o(v){st(i.$$.fragment,v),st(o.$$.fragment,v),st(f.$$.fragment,v),st(n.$$.fragment,v),_=!1},d(v){v&&(X(a),X(u),X(p)),ii(i,v),ii(o,v),ii(f,v),ii(n,v)}}}function OS(l){let i,a;return i=new jf({props:{title:"Population by area",height:"auto",cls:"ons-cards pgp-map-tiles",$$slots:{default:[BS]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,[u]){const f={};u&8447&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}const n_=l=>l.value===null,s_=l=>l.value!=null,a_=(l,i)=>i.value-l.value,o_=l=>l.value!=null,l_=(l,i)=>i.value-l.value,c_=l=>l.value!=null;function FS(l,i,a){let o,{data:u}=i,{mapStyle:f}=i,{ladBounds:p}=i,{mapBounds:n}=i,{maxBounds:_}=i,{selected:v}=i,{colors:E}=i,S;const C=L=>{var F;let D="";if(L){D=`${u.geoCodesLookup[S].name}
`;const V=(F=o==null?void 0:o[L])==null?void 0:F.value;D+=V!=null?`${V}%`:"No data"}return D};function z(L){S=L,a(7,S)}const P=L=>L.code==S,I=L=>L.code==S;return l.$$set=L=>{"data"in L&&a(0,u=L.data),"mapStyle"in L&&a(1,f=L.mapStyle),"ladBounds"in L&&a(2,p=L.ladBounds),"mapBounds"in L&&a(3,n=L.mapBounds),"maxBounds"in L&&a(4,_=L.maxBounds),"selected"in L&&a(5,v=L.selected),"colors"in L&&a(6,E=L.colors)},l.$$.update=()=>{l.$$.dirty&1&&(o=(L=>{const D={};return console.log("data",L),Array.isArray(L)&&L.forEach(F=>D[F.code]=F),D})(u.geoPerc))},[u,f,p,n,_,v,E,S,C,z,P,I]}class NS extends qi{constructor(i){super(),Zi(this,i,FS,OS,Ui,{data:0,mapStyle:1,ladBounds:2,mapBounds:3,maxBounds:4,selected:5,colors:6})}}function u_(l){let i,a;return i=new Ps({props:{title:l[0],$$slots:{default:[jS]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.title=o[0]),u&30&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function US(l){let i,a,o;var u=l[3];function f(p,n){return{props:{data:p[2].selected&&Xu("residents",p[1].code,p[2]),showLegend:!1}}}return u&&(i=fm(u,f(l))),{c(){i&&ei(i.$$.fragment),a=ri()},l(p){i&&si(i.$$.fragment,p),a=ri()},m(p,n){i&&ti(i,p,n),Fe(p,a,n),o=!0},p(p,n){if(n&8&&u!==(u=p[3])){if(i){Vi();const _=i;st(_.$$.fragment,1,0,()=>{ii(_,1)}),$i()}u?(i=fm(u,f(p)),ei(i.$$.fragment),Ke(i.$$.fragment,1),ti(i,a.parentNode,a)):i=null}else if(u){const _={};n&6&&(_.data=p[2].selected&&Xu("residents",p[1].code,p[2])),i.$set(_)}},i(p){o||(i&&Ke(i.$$.fragment,p),o=!0)},o(p){i&&st(i.$$.fragment,p),o=!1},d(p){p&&X(a),i&&ii(i,p)}}}function VS(l){let i,a=Cc.nodata+"",o;return{c(){i=Be("span"),o=Ot(a),this.h()},l(u){i=Oe(u,"SPAN",{class:!0});var f=Je(i);o=Ft(f,a),f.forEach(X),this.h()},h(){pe(i,"class","num-desc svelte-1yn8adz")},m(u,f){Fe(u,i,f),Te(i,o)},p:xi,i:xi,o:xi,d(u){u&&X(i)}}}function $S(l){let i,a=Cc.blocked+"",o;return{c(){i=Be("span"),o=Ot(a),this.h()},l(u){i=Oe(u,"SPAN",{class:!0});var f=Je(i);o=Ft(f,a),f.forEach(X),this.h()},h(){pe(i,"class","num-desc svelte-1yn8adz")},m(u,f){Fe(u,i,f),Te(i,o)},p:xi,i:xi,o:xi,d(u){u&&X(i)}}}function jS(l){let i,a,o,u,f,p=um[l[1].code]+"",n,_;const v=[$S,VS,US],E=[];function S(C,z){return C[2].selected.residents[C[1].code].values==="blocked"?0:C[2].selected.residents[C[1].code].values.percent[0]==null?1:2}return i=S(l),a=E[i]=v[i](l),{c(){a.c(),o=ut(),u=Be("span"),f=Ot("% of "),n=Ot(p),this.h()},l(C){a.l(C),o=ht(C),u=Oe(C,"SPAN",{class:!0});var z=Je(u);f=Ft(z,"% of "),n=Ft(z,p),z.forEach(X),this.h()},h(){pe(u,"class","num-desc svelte-1yn8adz")},m(C,z){E[i].m(C,z),Fe(C,o,z),Fe(C,u,z),Te(u,f),Te(u,n),_=!0},p(C,z){let P=i;i=S(C),i===P?E[i].p(C,z):(Vi(),st(E[P],1,1,()=>{E[P]=null}),$i(),a=E[i],a?a.p(C,z):(a=E[i]=v[i](C),a.c()),Ke(a,1),a.m(o.parentNode,o)),(!_||z&2)&&p!==(p=um[C[1].code]+"")&&vi(n,p)},i(C){_||(Ke(a),_=!0)},o(C){st(a),_=!1},d(C){C&&(X(o),X(u)),E[i].d(C)}}}function qS(l){var u,f;let i,a,o=((f=(u=l[2].selected.residents)==null?void 0:u[l[1].code])==null?void 0:f.values)&&u_(l);return{c(){o&&o.c(),i=ri()},l(p){o&&o.l(p),i=ri()},m(p,n){o&&o.m(p,n),Fe(p,i,n),a=!0},p(p,[n]){var _,v;(v=(_=p[2].selected.residents)==null?void 0:_[p[1].code])!=null&&v.values?o?(o.p(p,n),n&6&&Ke(o,1)):(o=u_(p),o.c(),Ke(o,1),o.m(i.parentNode,i)):o&&(Vi(),st(o,1,1,()=>{o=null}),$i())},i(p){a||(Ke(o),a=!0)},o(p){st(o),a=!1},d(p){p&&X(i),o&&o.d(p)}}}function ZS(l,i,a){let{title:o}=i,{table:u}=i,{data:f}=i,{chart_type:p}=i;return l.$$set=n=>{"title"in n&&a(0,o=n.title),"table"in n&&a(1,u=n.table),"data"in n&&a(2,f=n.data),"chart_type"in n&&a(3,p=n.chart_type)},[o,u,f,p]}class Zy extends qi{constructor(i){super(),Zi(this,i,ZS,qS,Ui,{title:0,table:1,data:2,chart_type:3})}}function GS(l){let i,a;const o=l[5].default,u=Ir(o,l,l[4],null);return{c(){i=Be("mark"),u&&u.c(),this.h()},l(f){i=Oe(f,"MARK",{class:!0,style:!0,role:!0});var p=Je(i);u&&u.l(p),p.forEach(X),this.h()},h(){pe(i,"class","em svelte-1602h77"),Pt(i,"background-color",l[0]),Pt(i,"color",l[2]),pe(i,"role","presentation"),Gt(i,"nowrap",l[1])},m(f,p){Fe(f,i,p),u&&u.m(i,null),a=!0},p(f,[p]){u&&u.p&&(!a||p&16)&&Ar(u,o,f,f[4],a?zr(o,f[4],p,null):Pr(f[4]),null),(!a||p&1)&&Pt(i,"background-color",f[0]),(!a||p&4)&&Pt(i,"color",f[2]),(!a||p&2)&&Gt(i,"nowrap",f[1])},i(f){a||(Ke(u,f),a=!0)},o(f){st(u,f),a=!1},d(f){f&&X(i),u&&u.d(f)}}}function WS(l,i,a){let o,{$$slots:u={},$$scope:f}=i,{color:p="lightgrey"}=i,{nowrap:n=!0}=i;function _(E){return(E[0]*299+E[1]*587+E[2]*114)/1e3>125?"black":"white"}let v="black";return l.$$set=E=>{"color"in E&&a(0,p=E.color),"nowrap"in E&&a(1,n=E.nowrap),"$$scope"in E&&a(4,f=E.$$scope)},l.$$.update=()=>{l.$$.dirty&1&&a(3,o=Jv(p).rgb),l.$$.dirty&8&&o&&a(2,v=_(o))},[p,n,v,o,f,u]}class HS extends qi{constructor(i){super(),Zi(this,i,WS,GS,Ui,{color:0,nowrap:1})}}function KS(l){let i,a=l[0].selected.total_pop.count.toLocaleString()+"",o,u,f,p="people",n,_,v,E,S;return v=new HS({props:{color:"lightgrey",$$slots:{default:[JS]},$$scope:{ctx:l}}}),{c(){i=Be("div"),o=Ot(a),u=ut(),f=Be("div"),f.textContent=p,n=ut(),_=Be("div"),ei(v.$$.fragment),E=Ot(" of the total population of England and Wales"),this.h()},l(C){i=Oe(C,"DIV",{class:!0});var z=Je(i);o=Ft(z,a),z.forEach(X),u=ht(C),f=Oe(C,"DIV",{class:!0,"data-svelte-h":!0}),dr(f)!=="svelte-hz5rwm"&&(f.textContent=p),n=ht(C),_=Oe(C,"DIV",{class:!0});var P=Je(_);si(v.$$.fragment,P),E=Ft(P," of the total population of England and Wales"),P.forEach(X),this.h()},h(){pe(i,"class","num-big svelte-c46qp4"),pe(f,"class","num-suffix svelte-c46qp4"),pe(_,"class","num-desc svelte-c46qp4")},m(C,z){Fe(C,i,z),Te(i,o),Fe(C,u,z),Fe(C,f,z),Fe(C,n,z),Fe(C,_,z),ti(v,_,null),Te(_,E),S=!0},p(C,z){(!S||z&1)&&a!==(a=C[0].selected.total_pop.count.toLocaleString()+"")&&vi(o,a);const P={};z&3&&(P.$$scope={dirty:z,ctx:C}),v.$set(P)},i(C){S||(Ke(v.$$.fragment,C),S=!0)},o(C){st(v.$$.fragment,C),S=!1},d(C){C&&(X(i),X(u),X(f),X(n),X(_)),ii(v)}}}function XS(l){let i,a=Cc.nodata+"",o;return{c(){i=Be("div"),o=Ot(a),this.h()},l(u){i=Oe(u,"DIV",{class:!0});var f=Je(i);o=Ft(f,a),f.forEach(X),this.h()},h(){pe(i,"class","num-desc svelte-c46qp4")},m(u,f){Fe(u,i,f),Te(i,o)},p:xi,i:xi,o:xi,d(u){u&&X(i)}}}function JS(l){let i=dg(l[0].selected.total_pop.percent)+"",a,o;return{c(){a=Ot(i),o=Ot("%")},l(u){a=Ft(u,i),o=Ft(u,"%")},m(u,f){Fe(u,a,f),Fe(u,o,f)},p(u,f){f&1&&i!==(i=dg(u[0].selected.total_pop.percent)+"")&&vi(a,i)},d(u){u&&(X(a),X(o))}}}function YS(l){let i,a,o,u;const f=[XS,KS],p=[];function n(_,v){return _[0].selected.total_pop.count==null?0:1}return i=n(l),a=p[i]=f[i](l),{c(){a.c(),o=ri()},l(_){a.l(_),o=ri()},m(_,v){p[i].m(_,v),Fe(_,o,v),u=!0},p(_,v){let E=i;i=n(_),i===E?p[i].p(_,v):(Vi(),st(p[E],1,1,()=>{p[E]=null}),$i(),a=p[i],a?a.p(_,v):(a=p[i]=f[i](_),a.c()),Ke(a,1),a.m(o.parentNode,o))},i(_){u||(Ke(a),u=!0)},o(_){st(a),u=!1},d(_){_&&X(o),p[i].d(_)}}}function QS(l){let i,a;return i=new Ps({props:{title:"Population",$$slots:{default:[YS]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,[u]){const f={};u&3&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function ek(l,i,a){let{data:o}=i;return l.$$set=u=>{"data"in u&&a(0,o=u.data)},[o]}class tk extends qi{constructor(i){super(),Zi(this,i,ek,QS,Ui,{data:0})}}function ik(l){let i,a,o,u,f=`translateX(${l[3]/l[1]+(l[1]-l[4])}px)`,p,n=`${l[2]}px`,_=`${l[4]}px`;return{c(){i=Be("div"),a=Ot(l[0]),o=ut(),u=Be("div"),this.h()},l(v){i=Oe(v,"DIV",{class:!0});var E=Je(i);a=Ft(E,l[0]),o=ht(E),u=Oe(E,"DIV",{class:!0}),Je(u).forEach(X),E.forEach(X),this.h()},h(){pe(u,"class","caret svelte-1491tb3"),Pt(u,"transform",f),pe(i,"class","tooltip svelte-1491tb3"),X_(()=>l[6].call(i)),Pt(i,"top",n),Pt(i,"left",_)},m(v,E){Fe(v,i,E),Te(i,a),Te(i,o),Te(i,u),p=J_(i,l[6].bind(i))},p(v,[E]){E&1&&vi(a,v[0]),E&26&&f!==(f=`translateX(${v[3]/v[1]+(v[1]-v[4])}px)`)&&Pt(u,"transform",f),E&4&&n!==(n=`${v[2]}px`)&&Pt(i,"top",n),E&16&&_!==(_=`${v[4]}px`)&&Pt(i,"left",_)},i:xi,o:xi,d(v){v&&X(i),p()}}}const Fu=4;function rk(l,i,a){let o,{title:u}=i,{x:f}=i,{y:p}=i,{width:n}=i,_;function v(){_=this.clientWidth,a(3,_)}return l.$$set=E=>{"title"in E&&a(0,u=E.title),"x"in E&&a(1,f=E.x),"y"in E&&a(2,p=E.y),"width"in E&&a(5,n=E.width)},l.$$.update=()=>{l.$$.dirty&42&&a(4,o=_&&f+_/2>n-Fu?n-_/2-Fu:_&&f-_/2<0+Fu?_/2+Fu:f)},[u,f,p,_,o,n,v]}class nk extends qi{constructor(i){super(),Zi(this,i,rk,ik,Ui,{title:0,x:1,y:2,width:5})}}function sk(l){let i,a;function o(f){i=l.getAttribute("title"),l.removeAttribute("title");let p=document.body.getBoundingClientRect(),n=l.getBoundingClientRect(),_=n.bottom,v=(n.left+n.right)/2;a=new nk({props:{title:i,x:v,y:_-p.y,width:p.width},target:document.body})}function u(){a.$destroy(),l.setAttribute("title",i)}return l.addEventListener("mouseover",o),l.addEventListener("mouseout",u),{destroy(){a&&a.$destroy(),l.removeEventListener("mouseover",o),l.removeEventListener("mouseout",u)}}}function h_(l,i,a){const o=l.slice();return o[22]=i[a],o[24]=a,o}function f_(l,i,a){const o=l.slice();return o[25]=i[a],o[27]=a,o}function d_(l,i,a){const o=l.slice();return o[25]=i[a],o[27]=a,o}function p_(l,i,a){const o=l.slice();return o[29]=i[a],o[24]=a,o}function m_(l,i,a){const o=l.slice();return o[31]=i[a],o}function g_(l){let i,a,o=l[31].category+"",u,f,p,n=l[31].selected_value+"",_,v,E,S=l[31].all_value+"",C,z;return{c(){i=Be("tr"),a=Be("td"),u=Ot(o),f=ut(),p=Be("td"),_=Ot(n),v=ut(),E=Be("td"),C=Ot(S),z=ut()},l(P){i=Oe(P,"TR",{});var I=Je(i);a=Oe(I,"TD",{});var L=Je(a);u=Ft(L,o),L.forEach(X),f=ht(I),p=Oe(I,"TD",{});var D=Je(p);_=Ft(D,n),D.forEach(X),v=ht(I),E=Oe(I,"TD",{});var F=Je(E);C=Ft(F,S),F.forEach(X),z=ht(I),I.forEach(X)},m(P,I){Fe(P,i,I),Te(i,a),Te(a,u),Te(i,f),Te(i,p),Te(p,_),Te(i,v),Te(i,E),Te(E,C),Te(i,z)},p(P,I){I[0]&8192&&o!==(o=P[31].category+"")&&vi(u,o),I[0]&8192&&n!==(n=P[31].selected_value+"")&&vi(_,n),I[0]&8192&&S!==(S=P[31].all_value+"")&&vi(C,S)},d(P){P&&X(i)}}}function __(l){let i,a=Mi(l[15]),o=[];for(let u=0;u1?` (${l[3](l[12][l[24]+1].values[l[27]][l[2]])}%)`:"")),pe(i,"class","bar svelte-clbyb4"),Pt(i,"bottom","0"),Pt(i,"height",o),Pt(i,"left",u),Pt(i,"width",f)},m(_,v){Fe(_,i,v),p||(n=Q_(sk.call(null,i)),p=!0)},p(_,v){v[0]&4110&&a!==(a=`${_[25][_[1]]}: ${_[3](_[25][_[2]])}%`+(_[12].length>1?` (${_[3](_[12][_[24]+1].values[_[27]][_[2]])}%)`:""))&&pe(i,"title",a),v[0]&20484&&o!==(o=`${_[14](_[25][_[2]])}%`)&&Pt(i,"height",o),v[0]&65536&&u!==(u=`calc(${_[27]/_[16].length*100}%)`)&&Pt(i,"left",u),v[0]&65536&&f!==(f=`calc(${1/_[16].length*100}% - 2px)`)&&Pt(i,"width",f)},d(_){_&&X(i),p=!1,n()}}}function w_(l){let i;function a(f,p){return f[24]==0?ok:ak}let u=a(l)(l);return{c(){u.c(),i=ri()},l(f){u.l(f),i=ri()},m(f,p){u.m(f,p),Fe(f,i,p)},p(f,p){u.p(f,p)},d(f){f&&X(i),u.d(f)}}}function x_(l){let i,a,o=l[7][0]!=0&&E_(l),u=l[7][1]!=18&&S_(l);return{c(){o&&o.c(),i=ut(),u&&u.c(),a=ri()},l(f){o&&o.l(f),i=ht(f),u&&u.l(f),a=ri()},m(f,p){o&&o.m(f,p),Fe(f,i,p),u&&u.m(f,p),Fe(f,a,p)},p(f,p){f[7][0]!=0?o?o.p(f,p):(o=E_(f),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null),f[7][1]!=18?u?u.p(f,p):(u=S_(f),u.c(),u.m(a.parentNode,a)):u&&(u.d(1),u=null)},d(f){f&&(X(i),X(a)),o&&o.d(f),u&&u.d(f)}}}function E_(l){let i,a=`${l[18](l[12])}%`;return{c(){i=Be("div"),this.h()},l(o){i=Oe(o,"DIV",{class:!0}),Je(i).forEach(X),this.h()},h(){pe(i,"class","mask svelte-clbyb4"),Pt(i,"bottom","0"),Pt(i,"height",a),Pt(i,"left","0"),Pt(i,"width",l[17](l[7][0]))},m(o,u){Fe(o,i,u)},p(o,u){u[0]&4096&&a!==(a=`${o[18](o[12])}%`)&&Pt(i,"height",a),u[0]&128&&Pt(i,"width",o[17](o[7][0]))},d(o){o&&X(i)}}}function S_(l){let i,a=`${l[18](l[12])}%`;return{c(){i=Be("div"),this.h()},l(o){i=Oe(o,"DIV",{class:!0}),Je(i).forEach(X),this.h()},h(){pe(i,"class","mask svelte-clbyb4"),Pt(i,"bottom","0"),Pt(i,"height",a),Pt(i,"left",l[17](l[7][1])),Pt(i,"right","2px")},m(o,u){Fe(o,i,u)},p(o,u){u[0]&4096&&a!==(a=`${o[18](o[12])}%`)&&Pt(i,"height",a),u[0]&128&&Pt(i,"left",o[17](o[7][1]))},d(o){o&&X(i)}}}function k_(l){let i,a,o;return{c(){i=Be("small"),a=Ot(l[8]),o=Ot(l[9]),this.h()},l(u){i=Oe(u,"SMALL",{class:!0});var f=Je(i);a=Ft(f,l[8]),o=Ft(f,l[9]),f.forEach(X),this.h()},h(){pe(i,"class","svelte-clbyb4")},m(u,f){Fe(u,i,f),Te(i,a),Te(i,o)},p(u,f){f[0]&256&&vi(a,u[8]),f[0]&512&&vi(o,u[9])},d(u){u&&X(i)}}}function T_(l){let i,a;return{c(){i=Be("small"),a=Ot(l[10]),this.h()},l(o){i=Oe(o,"SMALL",{class:!0});var u=Je(i);a=Ft(u,l[10]),u.forEach(X),this.h()},h(){pe(i,"class","svelte-clbyb4")},m(o,u){Fe(o,i,u),Te(i,a)},p(o,u){u[0]&1024&&vi(a,o[10])},d(o){o&&X(i)}}}function lk(l){let i,a=console.log(l[0])+"",o,u,f,p="Age groupProportion of selected groupProportion of whole population",n,_,v,E,S,C,z,P=`${l[4]}px`,I,L,D,F=l[6][0]+"",V,ee,se,ne=l[6][1]+"",le,ge,ce,Me,et=Mi(l[13]||[]),ye=[];for(let Ne=0;Nece.toFixed(1)}=i,{height:P=100}=i,{markerWidth:I=2.5}=i,{minmax:L=["0 years","85+"]}=i,{maskRange:D=null}=i,{base:F=null}=i,{base_ext:V=", 5 year age bands"}=i,{ageShadingNote:ee=null}=i,{showLegend:se=!0}=i;function ne(ce,Me){let et={};for(const Ge of ce)et[Ge[Me]]||(et[Ge[Me]]={label:Ge[Me],values:[]}),et[Ge[Me]].values.push(Ge);let ye=[];for(const Ge in et)ye.push(et[Ge]);return ye}function le(ce){return ce%1===0?`calc(${ce/o.length*100}% - 1px)`:`calc(${Math.floor(ce)/o.length*100}% + (${1/o.length*100}% - 2px) * ${ce%1})`}function ge(ce){return Math.max(...ce.map(Me=>Math.max(...Me.values.map(et=>p(et[S])))))}return l.$$set=ce=>{"data"in ce&&a(0,v=ce.data),"xKey"in ce&&a(1,E=ce.xKey),"yKey"in ce&&a(2,S=ce.yKey),"zKey"in ce&&a(19,C=ce.zKey),"formatTick"in ce&&a(3,z=ce.formatTick),"height"in ce&&a(4,P=ce.height),"markerWidth"in ce&&a(5,I=ce.markerWidth),"minmax"in ce&&a(6,L=ce.minmax),"maskRange"in ce&&a(7,D=ce.maskRange),"base"in ce&&a(8,F=ce.base),"base_ext"in ce&&a(9,V=ce.base_ext),"ageShadingNote"in ce&&a(10,ee=ce.ageShadingNote),"showLegend"in ce&&a(11,se=ce.showLegend)},l.$$.update=()=>{l.$$.dirty[0]&3&&a(16,o=v.map(ce=>ce[E]).filter((ce,Me,et)=>et.indexOf(ce)===Me)),l.$$.dirty[0]&5&&a(20,u=[0,Math.max(...v.map(ce=>ce[S]))]),l.$$.dirty[0]&524289&&a(15,f=v.map(ce=>ce[C]).filter((ce,Me,et)=>et.indexOf(ce)===Me)),l.$$.dirty[0]&1048576&&a(14,p=ce=>Math.abs(ce/u[1])*100),l.$$.dirty[0]&524289&&a(12,n=ne(v,C)),l.$$.dirty[0]&4096&&a(13,_=(ce=>ce[0].values.map((Me,et)=>({category:Me.category,selected_value:Me.value,all_value:ce[1].values[et].value})))(n))},[v,E,S,z,P,I,L,D,F,V,ee,se,n,_,p,f,o,le,ge,C,u]}class uk extends qi{constructor(i){super(),Zi(this,i,ck,lk,Ui,{data:0,xKey:1,yKey:2,zKey:19,formatTick:3,height:4,markerWidth:5,minmax:6,maskRange:7,base:8,base_ext:9,ageShadingNote:10,showLegend:11},null,[-1,-1])}}function hk(l){let i,a;return i=new uk({props:{data:l[0].selected&&Xu("residents","resident_age_18b",l[0]),zKey:"group",maskRange:fg(l[1]),base:"% of all people",ageShadingNote:l[1].some(I_)?C_:null,showLegend:!1}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u&1&&(f.data=o[0].selected&&Xu("residents","resident_age_18b",o[0])),u&2&&(f.maskRange=fg(o[1])),u&2&&(f.ageShadingNote=o[1].some(I_)?C_:null),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function fk(l){let i,a=Cc.nodata+"",o;return{c(){i=Be("span"),o=Ot(a),this.h()},l(u){i=Oe(u,"SPAN",{class:!0});var f=Je(i);o=Ft(f,a),f.forEach(X),this.h()},h(){pe(i,"class","num-desc svelte-uj0r62")},m(u,f){Fe(u,i,f),Te(i,o)},p:xi,i:xi,o:xi,d(u){u&&X(i)}}}function dk(l){let i,a=Cc.nodata+"",o;return{c(){i=Be("span"),o=Ot(a),this.h()},l(u){i=Oe(u,"SPAN",{class:!0});var f=Je(i);o=Ft(f,a),f.forEach(X),this.h()},h(){pe(i,"class","num-desc svelte-uj0r62")},m(u,f){Fe(u,i,f),Te(i,o)},p:xi,i:xi,o:xi,d(u){u&&X(i)}}}function pk(l){let i,a,o,u;const f=[dk,fk,hk],p=[];function n(_,v){return _[0].selected.residents.resident_age_18b.values==="blocked"?0:_[0].selected.residents.resident_age_18b.values.percent[0]==null?1:2}return i=n(l),a=p[i]=f[i](l),{c(){a.c(),o=ri()},l(_){a.l(_),o=ri()},m(_,v){p[i].m(_,v),Fe(_,o,v),u=!0},p(_,v){let E=i;i=n(_),i===E?p[i].p(_,v):(Vi(),st(p[E],1,1,()=>{p[E]=null}),$i(),a=p[i],a?a.p(_,v):(a=p[i]=f[i](_),a.c()),Ke(a,1),a.m(o.parentNode,o))},i(_){u||(Ke(a),u=!0)},o(_){st(a),u=!1},d(_){_&&X(o),p[i].d(_)}}}function mk(l){let i,a;return i=new Ps({props:{title:"Age profile",$$slots:{default:[pk]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,[u]){const f={};u&7&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}const C_="This chart shows all ages, with the selected age range highlighted.",I_=l=>l.topic==="Age";function gk(l,i,a){let{data:o}=i,{selected:u}=i;return l.$$set=f=>{"data"in f&&a(0,o=f.data),"selected"in f&&a(1,u=f.selected)},[o,u]}class _k extends qi{constructor(i){super(),Zi(this,i,gk,mk,Ui,{data:0,selected:1})}}function yk(l,i,a){const o=l.slice();return o[2]=i[a],o[4]=a,o}function vk(l){let i,a,o,u,f,p;return{c(){i=Be("li"),a=Be("div"),o=ut(),u=Be("span"),f=Ot(l[2]),p=ut(),this.h()},l(n){i=Oe(n,"LI",{class:!0});var _=Je(i);a=Oe(_,"DIV",{class:!0}),Je(a).forEach(X),o=ht(_),u=Oe(_,"SPAN",{class:!0});var v=Je(u);f=Ft(v,l[2]),v.forEach(X),p=ht(_),_.forEach(X),this.h()},h(){pe(a,"class","legend-vis "+(l[4]==0?"bar":"marker")+" svelte-ehf2rq"),pe(u,"class",Ec(l[4]==0?"bold":"brackets")+" svelte-ehf2rq"),pe(i,"class","svelte-ehf2rq"),Gt(i,"ew",l[4]!=0)},m(n,_){Fe(n,i,_),Te(i,a),Te(i,o),Te(i,u),Te(u,f),Te(i,p)},p:xi,d(n){n&&X(i)}}}function bk(l){let i,a,o,u;const f=l[1].default,p=Ir(f,l,l[0],null);let n=Mi(["People with the selected characteristics","All people in England and Wales"]),_=[];for(let v=0;v<2;v+=1)_[v]=vk(yk(l,n,v));return{c(){i=Be("p"),p&&p.c(),a=ut(),o=Be("ul");for(let v=0;v<2;v+=1)_[v].c();this.h()},l(v){i=Oe(v,"P",{class:!0});var E=Je(i);p&&p.l(E),E.forEach(X),a=ht(v),o=Oe(v,"UL",{"aria-hidden":!0,class:!0});var S=Je(o);for(let C=0;C<2;C+=1)_[C].l(S);S.forEach(X),this.h()},h(){pe(i,"class","legend-text svelte-ehf2rq"),pe(o,"aria-hidden","true"),pe(o,"class","legend-block svelte-ehf2rq")},m(v,E){Fe(v,i,E),p&&p.m(i,null),Fe(v,a,E),Fe(v,o,E);for(let S=0;S<2;S+=1)_[S]&&_[S].m(o,null);u=!0},p(v,[E]){p&&p.p&&(!u||E&1)&&Ar(p,f,v,v[0],u?zr(f,v[0],E,null):Pr(v[0]),null)},i(v){u||(Ke(p,v),u=!0)},o(v){st(p,v),u=!1},d(v){v&&(X(i),X(a),X(o)),p&&p.d(v),Mr(_,v)}}}function wk(l,i,a){let{$$slots:o={},$$scope:u}=i;return l.$$set=f=>{"$$scope"in f&&a(0,u=f.$$scope)},[u,o]}class Gy extends qi{constructor(i){super(),Zi(this,i,wk,bk,Ui,{})}}function xk(l){let i,a,o,u,f=(l[0]?"Close panel":l[1])+"",p,n,_,v,E,S,C;const z=l[3].default,P=Ir(z,l,l[2],null);return{c(){i=Be("details"),a=Be("summary"),o=Be("h3"),u=Be("span"),p=Ot(f),_=ut(),v=Be("div"),P&&P.c(),this.h()},l(I){i=Oe(I,"DETAILS",{class:!0});var L=Je(i);a=Oe(L,"SUMMARY",{class:!0,"data-ga-action":!0});var D=Je(a);o=Oe(D,"H3",{class:!0});var F=Je(o);u=Oe(F,"SPAN",{class:!0});var V=Je(u);p=Ft(V,f),V.forEach(X),F.forEach(X),D.forEach(X),_=ht(L),v=Oe(L,"DIV",{class:!0});var ee=Je(v);P&&P.l(ee),ee.forEach(X),L.forEach(X),this.h()},h(){pe(u,"class","ons-btn__inner"),pe(o,"class","ons-btn"),Gt(o,"ons-btn--secondary",l[0]),pe(a,"class","ons-collapsible__heading ons-js-collapsible-heading svelte-1x2xth5"),pe(a,"data-ga-action",n=l[0]?"Close panel":"Open panel"),pe(v,"class","ons-collapsible__content ons-js-collapsible-content svelte-1x2xth5"),pe(i,"class","ons-collapsible ons-js-collapsible svelte-1x2xth5")},m(I,L){Fe(I,i,L),Te(i,a),Te(a,o),Te(o,u),Te(u,p),Te(i,_),Te(i,v),P&&P.m(v,null),i.open=l[0],E=!0,S||(C=Ms(i,"toggle",l[4]),S=!0)},p(I,[L]){(!E||L&3)&&f!==(f=(I[0]?"Close panel":I[1])+"")&&vi(p,f),(!E||L&1)&&Gt(o,"ons-btn--secondary",I[0]),(!E||L&1&&n!==(n=I[0]?"Close panel":"Open panel"))&&pe(a,"data-ga-action",n),P&&P.p&&(!E||L&4)&&Ar(P,z,I,I[2],E?zr(z,I[2],L,null):Pr(I[2]),null),L&1&&(i.open=I[0])},i(I){E||(Ke(P,I),E=!0)},o(I){st(P,I),E=!1},d(I){I&&X(i),P&&P.d(I),S=!1,C()}}}function Ek(l,i,a){let{$$slots:o={},$$scope:u}=i,{title:f="Title"}=i,{open:p=!1}=i;function n(){p=this.open,a(0,p)}return l.$$set=_=>{"title"in _&&a(1,f=_.title),"open"in _&&a(0,p=_.open),"$$scope"in _&&a(2,u=_.$$scope)},[p,f,u,o,n]}class Sk extends qi{constructor(i){super(),Zi(this,i,Ek,xk,Ui,{title:1,open:0})}}function kk(l){let i,a,o,u,f;o=new ch({props:{type:"error"}});const p=l[1].default,n=Ir(p,l,l[0],null);return{c(){i=Be("div"),a=Be("div"),ei(o.$$.fragment),u=ut(),n&&n.c(),this.h()},l(_){i=Oe(_,"DIV",{class:!0});var v=Je(i);a=Oe(v,"DIV",{class:!0});var E=Je(a);si(o.$$.fragment,E),E.forEach(X),u=ht(v),n&&n.l(v),v.forEach(X),this.h()},h(){pe(a,"class","notice-icon svelte-1404fgr"),pe(i,"class","notice-container svelte-1404fgr")},m(_,v){Fe(_,i,v),Te(i,a),ti(o,a,null),Te(i,u),n&&n.m(i,null),f=!0},p(_,[v]){n&&n.p&&(!f||v&1)&&Ar(n,p,_,_[0],f?zr(p,_[0],v,null):Pr(_[0]),null)},i(_){f||(Ke(o.$$.fragment,_),Ke(n,_),f=!0)},o(_){st(o.$$.fragment,_),st(n,_),f=!1},d(_){_&&X(i),ii(o),n&&n.d(_)}}}function Tk(l,i,a){let{$$slots:o={},$$scope:u}=i;return l.$$set=f=>{"$$scope"in f&&a(0,u=f.$$scope)},[u,o]}class Ck extends qi{constructor(i){super(),Zi(this,i,Tk,kk,Ui,{})}}function Nu(l){throw new Error('Could not dynamically require "'+l+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Wy={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -1037,23 +1037,23 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(l,i){(function(a){l.exports=a()})(function(){return function a(o,u,f){function p(v,S){if(!u[v]){if(!o[v]){var T=typeof Nu=="function"&Νif(!S&&T)return T(v,!0);if(n)return n(v,!0);var I=new Error("Cannot find module '"+v+"'");throw I.code="MODULE_NOT_FOUND",I}var z=u[v]={exports:{}};o[v][0].call(z.exports,function(M){var C=o[v][1][M];return p(C||M)},z,z.exports,a,o,u,f)}return u[v].exports}for(var n=typeof Nu=="function"&&Nu,_=0;_>2,z=(3&v)<<4|S>>4,M=1>6:64,C=2>4,S=(15&I)<<4|(z=n.indexOf(_.charAt(C++)))>>2,T=(3&z)<<6|(M=n.indexOf(_.charAt(C++))),F[R++]=v,z!==64&&(F[R++]=S),M!==64&&(F[R++]=T);return F}},{"./support":30,"./utils":32}],2:[function(a,o,u){var f=a("./external"),p=a("./stream/DataWorker"),n=a("./stream/Crc32Probe"),_=a("./stream/DataLengthProbe");function v(S,T,I,z,M){this.compressedSize=S,this.uncompressedSize=T,this.crc32=I,this.compression=z,this.compressedContent=M}v.prototype={getContentWorker:function(){var S=new p(f.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new _("data_length")),T=this;return S.on("end",function(){if(this.streamInfo.data_length!==T.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),S},getCompressedWorker:function(){return new p(f.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},v.createWorkerFrom=function(S,T,I){return S.pipe(new n).pipe(new _("uncompressedSize")).pipe(T.compressWorker(I)).pipe(new _("compressedSize")).withStreamInfo("compression",T)},o.exports=v},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(a,o,u){var f=a("./stream/GenericWorker");u.STORE={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},u.DEFLATE=a("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(a,o,u){var f=a("./utils"),p=function(){for(var n,_=[],v=0;v<256;v++){n=v;for(var S=0;S<8;S++)n=1&n?3988292384^n>>>1:n>>>1;_[v]=n}return _}();o.exports=function(n,_){return n!==void 0&&n.length?f.getTypeOf(n)!=="string"?function(v,S,T,I){var z=p,M=I+T;v^=-1;for(var C=I;C>>8^z[255&(v^S[C])];return-1^v}(0|_,n,n.length,0):function(v,S,T,I){var z=p,M=I+T;v^=-1;for(var C=I;C>>8^z[255&(v^S.charCodeAt(C))];return-1^v}(0|_,n,n.length,0):0}},{"./utils":32}],5:[function(a,o,u){u.base64=!1,u.binary=!1,u.dir=!1,u.createFolders=!0,u.date=null,u.compression=null,u.compressionOptions=null,u.comment=null,u.unixPermissions=null,u.dosPermissions=null},{}],6:[function(a,o,u){var f=null;f=typeof Promise<"u"?Promise:a("lie"),o.exports={Promise:f}},{lie:37}],7:[function(a,o,u){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",p=a("pako"),n=a("./utils"),_=a("./stream/GenericWorker"),v=f?"uint8array":"array";function S(T,I){_.call(this,"FlateWorker/"+T),this._pako=null,this._pakoAction=T,this._pakoOptions=I,this.meta={}}u.magic="\b\0",n.inherits(S,_),S.prototype.processChunk=function(T){this.meta=T.meta,this._pako===null&&this._createPako(),this._pako.push(n.transformTo(v,T.data),!1)},S.prototype.flush=function(){_.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},S.prototype.cleanUp=function(){_.prototype.cleanUp.call(this),this._pako=null},S.prototype._createPako=function(){this._pako=new p[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var T=this;this._pako.onData=function(I){T.push({data:I,meta:T.meta})}},u.compressWorker=function(T){return new S("Deflate",T)},u.uncompressWorker=function(){return new S("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(a,o,u){function f(z,M){var C,R="";for(C=0;C>>=8;return R}function p(z,M,C,R,D,F){var j,ee,oe=z.file,se=z.compression,ne=F!==v.utf8encode,re=n.transformTo("string",F(oe.name)),ve=n.transformTo("string",v.utf8encode(oe.name)),ze=oe.comment,nt=n.transformTo("string",F(ze)),be=n.transformTo("string",v.utf8encode(ze)),Ke=ve.length!==oe.name.length,q=be.length!==ze.length,He="",Rt="",at="",Wt=oe.dir,ot=oe.date,st={crc32:0,compressedSize:0,uncompressedSize:0};M&&!C||(st.crc32=z.crc32,st.compressedSize=z.compressedSize,st.uncompressedSize=z.uncompressedSize);var ae=0;M&&(ae|=8),ne||!Ke&&!q||(ae|=2048);var xe=0,Me=0;Wt&&(xe|=16),D==="UNIX"?(Me=798,xe|=function(he,Je){var kt=he;return he||(kt=Je?16893:33204),(65535&kt)<<16}(oe.unixPermissions,Wt)):(Me=20,xe|=function(he){return 63&(he||0)}(oe.dosPermissions)),j=ot.getUTCHours(),j<<=6,j|=ot.getUTCMinutes(),j<<=5,j|=ot.getUTCSeconds()/2,ee=ot.getUTCFullYear()-1980,ee<<=4,ee|=ot.getUTCMonth()+1,ee<<=5,ee|=ot.getUTCDate(),Ke&&(Rt=f(1,1)+f(S(re),4)+ve,He+="up"+f(Rt.length,2)+Rt),q&&(at=f(1,1)+f(S(nt),4)+be,He+="uc"+f(at.length,2)+at);var Y="";return Y+=` -\0`,Y+=f(ae,2),Y+=se.magic,Y+=f(j,2),Y+=f(ee,2),Y+=f(st.crc32,4),Y+=f(st.compressedSize,4),Y+=f(st.uncompressedSize,4),Y+=f(re.length,2),Y+=f(He.length,2),{fileRecord:T.LOCAL_FILE_HEADER+Y+re+He,dirRecord:T.CENTRAL_FILE_HEADER+f(Me,2)+Y+f(nt.length,2)+"\0\0\0\0"+f(xe,4)+f(R,4)+re+He+nt}}var n=a("../utils"),_=a("../stream/GenericWorker"),v=a("../utf8"),S=a("../crc32"),T=a("../signature");function I(z,M,C,R){_.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=M,this.zipPlatform=C,this.encodeFileName=R,this.streamFiles=z,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}n.inherits(I,_),I.prototype.push=function(z){var M=z.meta.percent||0,C=this.entriesCount,R=this._sources.length;this.accumulate?this.contentBuffer.push(z):(this.bytesWritten+=z.data.length,_.prototype.push.call(this,{data:z.data,meta:{currentFile:this.currentFile,percent:C?(M+100*(C-R-1))/C:100}}))},I.prototype.openedSource=function(z){this.currentSourceOffset=this.bytesWritten,this.currentFile=z.file.name;var M=this.streamFiles&&!z.file.dir;if(M){var C=p(z,M,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:C.fileRecord,meta:{percent:0}})}else this.accumulate=!0},I.prototype.closedSource=function(z){this.accumulate=!1;var M=this.streamFiles&&!z.file.dir,C=p(z,M,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(C.dirRecord),M)this.push({data:function(R){return T.DATA_DESCRIPTOR+f(R.crc32,4)+f(R.compressedSize,4)+f(R.uncompressedSize,4)}(z),meta:{percent:100}});else for(this.push({data:C.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},I.prototype.flush=function(){for(var z=this.bytesWritten,M=0;M=this.index;_--)v=(v<<8)+this.byteAt(_);return this.index+=n,v},readString:function(n){return f.transformTo("string",this.readData(n))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var n=this.readInt(4);return new Date(Date.UTC(1980+(n>>25&127),(n>>21&15)-1,n>>16&31,n>>11&31,n>>5&63,(31&n)<<1))}},o.exports=p},{"../utils":32}],19:[function(a,o,u){var f=a("./Uint8ArrayReader");function p(n){f.call(this,n)}a("../utils").inherits(p,f),p.prototype.readData=function(n){this.checkOffset(n);var _=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,_},o.exports=p},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(a,o,u){var f=a("./DataReader");function p(n){f.call(this,n)}a("../utils").inherits(p,f),p.prototype.byteAt=function(n){return this.data.charCodeAt(this.zero+n)},p.prototype.lastIndexOfSignature=function(n){return this.data.lastIndexOf(n)-this.zero},p.prototype.readAndCheckSignature=function(n){return n===this.readData(4)},p.prototype.readData=function(n){this.checkOffset(n);var _=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,_},o.exports=p},{"../utils":32,"./DataReader":18}],21:[function(a,o,u){var f=a("./ArrayReader");function p(n){f.call(this,n)}a("../utils").inherits(p,f),p.prototype.readData=function(n){if(this.checkOffset(n),n===0)return new Uint8Array(0);var _=this.data.subarray(this.zero+this.index,this.zero+this.index+n);return this.index+=n,_},o.exports=p},{"../utils":32,"./ArrayReader":17}],22:[function(a,o,u){var f=a("../utils"),p=a("../support"),n=a("./ArrayReader"),_=a("./StringReader"),v=a("./NodeBufferReader"),S=a("./Uint8ArrayReader");o.exports=function(T){var I=f.getTypeOf(T);return f.checkSupport(I),I!=="string"||p.uint8array?I==="nodebuffer"?new v(T):p.uint8array?new S(f.transformTo("uint8array",T)):new n(f.transformTo("array",T)):new _(T)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(a,o,u){u.LOCAL_FILE_HEADER="PK",u.CENTRAL_FILE_HEADER="PK",u.CENTRAL_DIRECTORY_END="PK",u.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",u.ZIP64_CENTRAL_DIRECTORY_END="PK",u.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(a,o,u){var f=a("./GenericWorker"),p=a("../utils");function n(_){f.call(this,"ConvertWorker to "+_),this.destType=_}p.inherits(n,f),n.prototype.processChunk=function(_){this.push({data:p.transformTo(this.destType,_.data),meta:_.meta})},o.exports=n},{"../utils":32,"./GenericWorker":28}],25:[function(a,o,u){var f=a("./GenericWorker"),p=a("../crc32");function n(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}a("../utils").inherits(n,f),n.prototype.processChunk=function(_){this.streamInfo.crc32=p(_.data,this.streamInfo.crc32||0),this.push(_)},o.exports=n},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(a,o,u){var f=a("../utils"),p=a("./GenericWorker");function n(_){p.call(this,"DataLengthProbe for "+_),this.propName=_,this.withStreamInfo(_,0)}f.inherits(n,p),n.prototype.processChunk=function(_){if(_){var v=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=v+_.data.length}p.prototype.processChunk.call(this,_)},o.exports=n},{"../utils":32,"./GenericWorker":28}],27:[function(a,o,u){var f=a("../utils"),p=a("./GenericWorker");function n(_){p.call(this,"DataWorker");var v=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,_.then(function(S){v.dataIsReady=!0,v.data=S,v.max=S&&S.length||0,v.type=f.getTypeOf(S),v.isPaused||v._tickAndRepeat()},function(S){v.error(S)})}f.inherits(n,p),n.prototype.cleanUp=function(){p.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return!!p.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var _=null,v=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":_=this.data.substring(this.index,v);break;case"uint8array":_=this.data.subarray(this.index,v);break;case"array":case"nodebuffer":_=this.data.slice(this.index,v)}return this.index=v,this.push({data:_,meta:{percent:this.max?this.index/this.max*100:0}})},o.exports=n},{"../utils":32,"./GenericWorker":28}],28:[function(a,o,u){function f(p){this.name=p||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}f.prototype={push:function(p){this.emit("data",p)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(p){this.emit("error",p)}return!0},error:function(p){return!this.isFinished&&(this.isPaused?this.generatedError=p:(this.isFinished=!0,this.emit("error",p),this.previous&&this.previous.error(p),this.cleanUp()),!0)},on:function(p,n){return this._listeners[p].push(n),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(p,n){if(this._listeners[p])for(var _=0;_ "+p:p}},o.exports=f},{}],29:[function(a,o,u){var f=a("../utils"),p=a("./ConvertWorker"),n=a("./GenericWorker"),_=a("../base64"),v=a("../support"),S=a("../external"),T=null;if(v.nodestream)try{T=a("../nodejs/NodejsStreamOutputAdapter")}catch{}function I(M,C){return new S.Promise(function(R,D){var F=[],j=M._internalType,ee=M._outputType,oe=M._mimeType;M.on("data",function(se,ne){F.push(se),C&&C(ne)}).on("error",function(se){F=[],D(se)}).on("end",function(){try{var se=function(ne,re,ve){switch(ne){case"blob":return f.newBlob(f.transformTo("arraybuffer",re),ve);case"base64":return _.encode(re);default:return f.transformTo(ne,re)}}(ee,function(ne,re){var ve,ze=0,nt=null,be=0;for(ve=0;ve"u")u.blob=!1;else{var f=new ArrayBuffer(0);try{u.blob=new Blob([f],{type:"application/zip"}).size===0}catch{try{var p=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);p.append(f),u.blob=p.getBlob("application/zip").size===0}catch{u.blob=!1}}}try{u.nodestream=!!a("readable-stream").Readable}catch{u.nodestream=!1}},{"readable-stream":16}],31:[function(a,o,u){for(var f=a("./utils"),p=a("./support"),n=a("./nodejsUtils"),_=a("./stream/GenericWorker"),v=new Array(256),S=0;S<256;S++)v[S]=252<=S?6:248<=S?5:240<=S?4:224<=S?3:192<=S?2:1;v[254]=v[254]=1;function T(){_.call(this,"utf-8 decode"),this.leftOver=null}function I(){_.call(this,"utf-8 encode")}u.utf8encode=function(z){return p.nodebuffer?n.newBufferFrom(z,"utf-8"):function(M){var C,R,D,F,j,ee=M.length,oe=0;for(F=0;F>>6:(R<65536?C[j++]=224|R>>>12:(C[j++]=240|R>>>18,C[j++]=128|R>>>12&63),C[j++]=128|R>>>6&63),C[j++]=128|63&R);return C}(z)},u.utf8decode=function(z){return p.nodebuffer?f.transformTo("nodebuffer",z).toString("utf-8"):function(M){var C,R,D,F,j=M.length,ee=new Array(2*j);for(C=R=0;C>10&1023,ee[R++]=56320|1023&D)}return ee.length!==R&&(ee.subarray?ee=ee.subarray(0,R):ee.length=R),f.applyFromCharCode(ee)}(z=f.transformTo(p.uint8array?"uint8array":"array",z))},f.inherits(T,_),T.prototype.processChunk=function(z){var M=f.transformTo(p.uint8array?"uint8array":"array",z.data);if(this.leftOver&&this.leftOver.length){if(p.uint8array){var C=M;(M=new Uint8Array(C.length+this.leftOver.length)).set(this.leftOver,0),M.set(C,this.leftOver.length)}else M=this.leftOver.concat(M);this.leftOver=null}var R=function(F,j){var ee;for((j=j||F.length)>F.length&&(j=F.length),ee=j-1;0<=ee&&(192&F[ee])==128;)ee--;return ee<0||ee===0?j:ee+v[F[ee]]>j?ee:j}(M),D=M;R!==M.length&&(p.uint8array?(D=M.subarray(0,R),this.leftOver=M.subarray(R,M.length)):(D=M.slice(0,R),this.leftOver=M.slice(R,M.length))),this.push({data:u.utf8decode(D),meta:z.meta})},T.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:u.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},u.Utf8DecodeWorker=T,f.inherits(I,_),I.prototype.processChunk=function(z){this.push({data:u.utf8encode(z.data),meta:z.meta})},u.Utf8EncodeWorker=I},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(a,o,u){var f=a("./support"),p=a("./base64"),n=a("./nodejsUtils"),_=a("./external");function v(C){return C}function S(C,R){for(var D=0;D>8;this.dir=!!(16&this.externalFileAttributes),z==0&&(this.dosPermissions=63&this.externalFileAttributes),z==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var z=f(this.extraFields[1].value);this.uncompressedSize===p.MAX_VALUE_32BITS&&(this.uncompressedSize=z.readInt(8)),this.compressedSize===p.MAX_VALUE_32BITS&&(this.compressedSize=z.readInt(8)),this.localHeaderOffset===p.MAX_VALUE_32BITS&&(this.localHeaderOffset=z.readInt(8)),this.diskNumberStart===p.MAX_VALUE_32BITS&&(this.diskNumberStart=z.readInt(4))}},readExtraFields:function(z){var M,C,R,D=z.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});z.index+4>>6:(z<65536?I[R++]=224|z>>>12:(I[R++]=240|z>>>18,I[R++]=128|z>>>12&63),I[R++]=128|z>>>6&63),I[R++]=128|63&z);return I},u.buf2binstring=function(T){return S(T,T.length)},u.binstring2buf=function(T){for(var I=new f.Buf8(T.length),z=0,M=I.length;z>10&1023,F[M++]=56320|1023&C)}return S(F,M)},u.utf8border=function(T,I){var z;for((I=I||T.length)>T.length&&(I=T.length),z=I-1;0<=z&&(192&T[z])==128;)z--;return z<0||z===0?I:z+_[T[z]]>I?z:I}},{"./common":41}],43:[function(a,o,u){o.exports=function(f,p,n,_){for(var v=65535&f|0,S=f>>>16&65535|0,T=0;n!==0;){for(n-=T=2e3>>1:p>>>1;n[_]=p}return n}();o.exports=function(p,n,_,v){var S=f,T=v+_;p^=-1;for(var I=v;I>>8^S[255&(p^n[I])];return-1^p}},{}],46:[function(a,o,u){var f,p=a("../utils/common"),n=a("./trees"),_=a("./adler32"),v=a("./crc32"),S=a("./messages"),T=0,I=4,z=0,M=-2,C=-1,R=4,D=2,F=8,j=9,ee=286,oe=30,se=19,ne=2*ee+1,re=15,ve=3,ze=258,nt=ze+ve+1,be=42,Ke=113,q=1,He=2,Rt=3,at=4;function Wt(Z,lt){return Z.msg=S[lt],lt}function ot(Z){return(Z<<1)-(4Z.avail_out&&(et=Z.avail_out),et!==0&&(p.arraySet(Z.output,lt.pending_buf,lt.pending_out,et,Z.next_out),Z.next_out+=et,lt.pending_out+=et,Z.total_out+=et,Z.avail_out-=et,lt.pending-=et,lt.pending===0&&(lt.pending_out=0))}function xe(Z,lt){n._tr_flush_block(Z,0<=Z.block_start?Z.block_start:-1,Z.strstart-Z.block_start,lt),Z.block_start=Z.strstart,ae(Z.strm)}function Me(Z,lt){Z.pending_buf[Z.pending++]=lt}function Y(Z,lt){Z.pending_buf[Z.pending++]=lt>>>8&255,Z.pending_buf[Z.pending++]=255<}function he(Z,lt){var et,Se,ge=Z.max_chain_length,$e=Z.strstart,ft=Z.prev_length,Ie=Z.nice_match,We=Z.strstart>Z.w_size-nt?Z.strstart-(Z.w_size-nt):0,wt=Z.window,Et=Z.w_mask,ct=Z.prev,Xt=Z.strstart+ze,Ii=wt[$e+ft-1],ki=wt[$e+ft];Z.prev_length>=Z.good_match&&(ge>>=2),Ie>Z.lookahead&&(Ie=Z.lookahead);do if(wt[(et=lt)+ft]===ki&&wt[et+ft-1]===Ii&&wt[et]===wt[$e]&&wt[++et]===wt[$e+1]){$e+=2,et++;do;while(wt[++$e]===wt[++et]&&wt[++$e]===wt[++et]&&wt[++$e]===wt[++et]&&wt[++$e]===wt[++et]&&wt[++$e]===wt[++et]&&wt[++$e]===wt[++et]&&wt[++$e]===wt[++et]&&wt[++$e]===wt[++et]&&$eWe&&--ge!=0);return ft<=Z.lookahead?ft:Z.lookahead}function Je(Z){var lt,et,Se,ge,$e,ft,Ie,We,wt,Et,ct=Z.w_size;do{if(ge=Z.window_size-Z.lookahead-Z.strstart,Z.strstart>=ct+(ct-nt)){for(p.arraySet(Z.window,Z.window,ct,ct,0),Z.match_start-=ct,Z.strstart-=ct,Z.block_start-=ct,lt=et=Z.hash_size;Se=Z.head[--lt],Z.head[lt]=ct<=Se?Se-ct:0,--et;);for(lt=et=ct;Se=Z.prev[--lt],Z.prev[lt]=ct<=Se?Se-ct:0,--et;);ge+=ct}if(Z.strm.avail_in===0)break;if(ft=Z.strm,Ie=Z.window,We=Z.strstart+Z.lookahead,wt=ge,Et=void 0,Et=ft.avail_in,wt=ve)for($e=Z.strstart-Z.insert,Z.ins_h=Z.window[$e],Z.ins_h=(Z.ins_h<=ve&&(Z.ins_h=(Z.ins_h<=ve)if(Se=n._tr_tally(Z,Z.strstart-Z.match_start,Z.match_length-ve),Z.lookahead-=Z.match_length,Z.match_length<=Z.max_lazy_match&&Z.lookahead>=ve){for(Z.match_length--;Z.strstart++,Z.ins_h=(Z.ins_h<=ve&&(Z.ins_h=(Z.ins_h<=ve&&Z.match_length<=Z.prev_length){for(ge=Z.strstart+Z.lookahead-ve,Se=n._tr_tally(Z,Z.strstart-1-Z.prev_match,Z.prev_length-ve),Z.lookahead-=Z.prev_length-1,Z.prev_length-=2;++Z.strstart<=ge&&(Z.ins_h=(Z.ins_h<Z.pending_buf_size-5&&(et=Z.pending_buf_size-5);;){if(Z.lookahead<=1){if(Je(Z),Z.lookahead===0&<===T)return q;if(Z.lookahead===0)break}Z.strstart+=Z.lookahead,Z.lookahead=0;var Se=Z.block_start+et;if((Z.strstart===0||Z.strstart>=Se)&&(Z.lookahead=Z.strstart-Se,Z.strstart=Se,xe(Z,!1),Z.strm.avail_out===0)||Z.strstart-Z.block_start>=Z.w_size-nt&&(xe(Z,!1),Z.strm.avail_out===0))return q}return Z.insert=0,lt===I?(xe(Z,!0),Z.strm.avail_out===0?Rt:at):(Z.strstart>Z.block_start&&(xe(Z,!1),Z.strm.avail_out),q)}),new Ct(4,4,8,4,kt),new Ct(4,5,16,8,kt),new Ct(4,6,32,32,kt),new Ct(4,4,16,16,vt),new Ct(8,16,32,32,vt),new Ct(8,16,128,128,vt),new Ct(8,32,128,256,vt),new Ct(32,128,258,1024,vt),new Ct(32,258,258,4096,vt)],u.deflateInit=function(Z,lt){return _i(Z,lt,F,15,8,0)},u.deflateInit2=_i,u.deflateReset=pt,u.deflateResetKeep=fi,u.deflateSetHeader=function(Z,lt){return Z&&Z.state?Z.state.wrap!==2?M:(Z.state.gzhead=lt,z):M},u.deflate=function(Z,lt){var et,Se,ge,$e;if(!Z||!Z.state||5>8&255),Me(Se,Se.gzhead.time>>16&255),Me(Se,Se.gzhead.time>>24&255),Me(Se,Se.level===9?2:2<=Se.strategy||Se.level<2?4:0),Me(Se,255&Se.gzhead.os),Se.gzhead.extra&&Se.gzhead.extra.length&&(Me(Se,255&Se.gzhead.extra.length),Me(Se,Se.gzhead.extra.length>>8&255)),Se.gzhead.hcrc&&(Z.adler=v(Z.adler,Se.pending_buf,Se.pending,0)),Se.gzindex=0,Se.status=69):(Me(Se,0),Me(Se,0),Me(Se,0),Me(Se,0),Me(Se,0),Me(Se,Se.level===9?2:2<=Se.strategy||Se.level<2?4:0),Me(Se,3),Se.status=Ke);else{var ft=F+(Se.w_bits-8<<4)<<8;ft|=(2<=Se.strategy||Se.level<2?0:Se.level<6?1:Se.level===6?2:3)<<6,Se.strstart!==0&&(ft|=32),ft+=31-ft%31,Se.status=Ke,Y(Se,ft),Se.strstart!==0&&(Y(Se,Z.adler>>>16),Y(Se,65535&Z.adler)),Z.adler=1}if(Se.status===69)if(Se.gzhead.extra){for(ge=Se.pending;Se.gzindex<(65535&Se.gzhead.extra.length)&&(Se.pending!==Se.pending_buf_size||(Se.gzhead.hcrc&&Se.pending>ge&&(Z.adler=v(Z.adler,Se.pending_buf,Se.pending-ge,ge)),ae(Z),ge=Se.pending,Se.pending!==Se.pending_buf_size));)Me(Se,255&Se.gzhead.extra[Se.gzindex]),Se.gzindex++;Se.gzhead.hcrc&&Se.pending>ge&&(Z.adler=v(Z.adler,Se.pending_buf,Se.pending-ge,ge)),Se.gzindex===Se.gzhead.extra.length&&(Se.gzindex=0,Se.status=73)}else Se.status=73;if(Se.status===73)if(Se.gzhead.name){ge=Se.pending;do{if(Se.pending===Se.pending_buf_size&&(Se.gzhead.hcrc&&Se.pending>ge&&(Z.adler=v(Z.adler,Se.pending_buf,Se.pending-ge,ge)),ae(Z),ge=Se.pending,Se.pending===Se.pending_buf_size)){$e=1;break}$e=Se.gzindexge&&(Z.adler=v(Z.adler,Se.pending_buf,Se.pending-ge,ge)),$e===0&&(Se.gzindex=0,Se.status=91)}else Se.status=91;if(Se.status===91)if(Se.gzhead.comment){ge=Se.pending;do{if(Se.pending===Se.pending_buf_size&&(Se.gzhead.hcrc&&Se.pending>ge&&(Z.adler=v(Z.adler,Se.pending_buf,Se.pending-ge,ge)),ae(Z),ge=Se.pending,Se.pending===Se.pending_buf_size)){$e=1;break}$e=Se.gzindexge&&(Z.adler=v(Z.adler,Se.pending_buf,Se.pending-ge,ge)),$e===0&&(Se.status=103)}else Se.status=103;if(Se.status===103&&(Se.gzhead.hcrc?(Se.pending+2>Se.pending_buf_size&&ae(Z),Se.pending+2<=Se.pending_buf_size&&(Me(Se,255&Z.adler),Me(Se,Z.adler>>8&255),Z.adler=0,Se.status=Ke)):Se.status=Ke),Se.pending!==0){if(ae(Z),Z.avail_out===0)return Se.last_flush=-1,z}else if(Z.avail_in===0&&ot(lt)<=ot(et)&<!==I)return Wt(Z,-5);if(Se.status===666&&Z.avail_in!==0)return Wt(Z,-5);if(Z.avail_in!==0||Se.lookahead!==0||lt!==T&&Se.status!==666){var Ie=Se.strategy===2?function(We,wt){for(var Et;;){if(We.lookahead===0&&(Je(We),We.lookahead===0)){if(wt===T)return q;break}if(We.match_length=0,Et=n._tr_tally(We,0,We.window[We.strstart]),We.lookahead--,We.strstart++,Et&&(xe(We,!1),We.strm.avail_out===0))return q}return We.insert=0,wt===I?(xe(We,!0),We.strm.avail_out===0?Rt:at):We.last_lit&&(xe(We,!1),We.strm.avail_out===0)?q:He}(Se,lt):Se.strategy===3?function(We,wt){for(var Et,ct,Xt,Ii,ki=We.window;;){if(We.lookahead<=ze){if(Je(We),We.lookahead<=ze&&wt===T)return q;if(We.lookahead===0)break}if(We.match_length=0,We.lookahead>=ve&&0We.lookahead&&(We.match_length=We.lookahead)}if(We.match_length>=ve?(Et=n._tr_tally(We,1,We.match_length-ve),We.lookahead-=We.match_length,We.strstart+=We.match_length,We.match_length=0):(Et=n._tr_tally(We,0,We.window[We.strstart]),We.lookahead--,We.strstart++),Et&&(xe(We,!1),We.strm.avail_out===0))return q}return We.insert=0,wt===I?(xe(We,!0),We.strm.avail_out===0?Rt:at):We.last_lit&&(xe(We,!1),We.strm.avail_out===0)?q:He}(Se,lt):f[Se.level].func(Se,lt);if(Ie!==Rt&&Ie!==at||(Se.status=666),Ie===q||Ie===Rt)return Z.avail_out===0&&(Se.last_flush=-1),z;if(Ie===He&&(lt===1?n._tr_align(Se):lt!==5&&(n._tr_stored_block(Se,0,0,!1),lt===3&&(st(Se.head),Se.lookahead===0&&(Se.strstart=0,Se.block_start=0,Se.insert=0))),ae(Z),Z.avail_out===0))return Se.last_flush=-1,z}return lt!==I?z:Se.wrap<=0?1:(Se.wrap===2?(Me(Se,255&Z.adler),Me(Se,Z.adler>>8&255),Me(Se,Z.adler>>16&255),Me(Se,Z.adler>>24&255),Me(Se,255&Z.total_in),Me(Se,Z.total_in>>8&255),Me(Se,Z.total_in>>16&255),Me(Se,Z.total_in>>24&255)):(Y(Se,Z.adler>>>16),Y(Se,65535&Z.adler)),ae(Z),0=et.w_size&&($e===0&&(st(et.head),et.strstart=0,et.block_start=0,et.insert=0),wt=new p.Buf8(et.w_size),p.arraySet(wt,lt,Et-et.w_size,et.w_size,0),lt=wt,Et=et.w_size),ft=Z.avail_in,Ie=Z.next_in,We=Z.input,Z.avail_in=Et,Z.next_in=0,Z.input=lt,Je(et);et.lookahead>=ve;){for(Se=et.strstart,ge=et.lookahead-(ve-1);et.ins_h=(et.ins_h<>>=ve=re>>>24,j-=ve,(ve=re>>>16&255)===0)He[S++]=65535&re;else{if(!(16&ve)){if(!(64&ve)){re=ee[(65535&re)+(F&(1<>>=ve,j-=ve),j<15&&(F+=q[_++]<>>=ve=re>>>24,j-=ve,!(16&(ve=re>>>16&255))){if(!(64&ve)){re=oe[(65535&re)+(F&(1<>>=ve,j-=ve,(ve=S-T)>3,F&=(1<<(j-=ze<<3))-1,f.next_in=_,f.next_out=S,f.avail_in=_>>24&255)+(be>>>8&65280)+((65280&be)<<8)+((255&be)<<24)}function F(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function j(be){var Ke;return be&&be.state?(Ke=be.state,be.total_in=be.total_out=Ke.total=0,be.msg="",Ke.wrap&&(be.adler=1&Ke.wrap),Ke.mode=M,Ke.last=0,Ke.havedict=0,Ke.dmax=32768,Ke.head=null,Ke.hold=0,Ke.bits=0,Ke.lencode=Ke.lendyn=new f.Buf32(C),Ke.distcode=Ke.distdyn=new f.Buf32(R),Ke.sane=1,Ke.back=-1,I):z}function ee(be){var Ke;return be&&be.state?((Ke=be.state).wsize=0,Ke.whave=0,Ke.wnext=0,j(be)):z}function oe(be,Ke){var q,He;return be&&be.state?(He=be.state,Ke<0?(q=0,Ke=-Ke):(q=1+(Ke>>4),Ke<48&&(Ke&=15)),Ke&&(Ke<8||15=at.wsize?(f.arraySet(at.window,Ke,q-at.wsize,at.wsize,0),at.wnext=0,at.whave=at.wsize):(He<(Rt=at.wsize-at.wnext)&&(Rt=He),f.arraySet(at.window,Ke,q-He,Rt,at.wnext),(He-=Rt)?(f.arraySet(at.window,Ke,q-He,He,0),at.wnext=He,at.whave=at.wsize):(at.wnext+=Rt,at.wnext===at.wsize&&(at.wnext=0),at.whave>>8&255,q.check=n(q.check,$e,2,0),xe=ae=0,q.mode=2;break}if(q.flags=0,q.head&&(q.head.done=!1),!(1&q.wrap)||(((255&ae)<<8)+(ae>>8))%31){be.msg="incorrect header check",q.mode=30;break}if((15&ae)!=8){be.msg="unknown compression method",q.mode=30;break}if(xe-=4,Z=8+(15&(ae>>>=4)),q.wbits===0)q.wbits=Z;else if(Z>q.wbits){be.msg="invalid window size",q.mode=30;break}q.dmax=1<>8&1),512&q.flags&&($e[0]=255&ae,$e[1]=ae>>>8&255,q.check=n(q.check,$e,2,0)),xe=ae=0,q.mode=3;case 3:for(;xe<32;){if(ot===0)break e;ot--,ae+=He[at++]<>>8&255,$e[2]=ae>>>16&255,$e[3]=ae>>>24&255,q.check=n(q.check,$e,4,0)),xe=ae=0,q.mode=4;case 4:for(;xe<16;){if(ot===0)break e;ot--,ae+=He[at++]<>8),512&q.flags&&($e[0]=255&ae,$e[1]=ae>>>8&255,q.check=n(q.check,$e,2,0)),xe=ae=0,q.mode=5;case 5:if(1024&q.flags){for(;xe<16;){if(ot===0)break e;ot--,ae+=He[at++]<>>8&255,q.check=n(q.check,$e,2,0)),xe=ae=0}else q.head&&(q.head.extra=null);q.mode=6;case 6:if(1024&q.flags&&(ot<(he=q.length)&&(he=ot),he&&(q.head&&(Z=q.head.extra_len-q.length,q.head.extra||(q.head.extra=new Array(q.head.extra_len)),f.arraySet(q.head.extra,He,at,he,Z)),512&q.flags&&(q.check=n(q.check,He,he,at)),ot-=he,at+=he,q.length-=he),q.length))break e;q.length=0,q.mode=7;case 7:if(2048&q.flags){if(ot===0)break e;for(he=0;Z=He[at+he++],q.head&&Z&&q.length<65536&&(q.head.name+=String.fromCharCode(Z)),Z&&he>9&1,q.head.done=!0),be.adler=q.check=0,q.mode=12;break;case 10:for(;xe<32;){if(ot===0)break e;ot--,ae+=He[at++]<>>=7&xe,xe-=7&xe,q.mode=27;break}for(;xe<3;){if(ot===0)break e;ot--,ae+=He[at++]<>>=1)){case 0:q.mode=14;break;case 1:if(ze(q),q.mode=20,Ke!==6)break;ae>>>=2,xe-=2;break e;case 2:q.mode=17;break;case 3:be.msg="invalid block type",q.mode=30}ae>>>=2,xe-=2;break;case 14:for(ae>>>=7&xe,xe-=7&xe;xe<32;){if(ot===0)break e;ot--,ae+=He[at++]<>>16^65535)){be.msg="invalid stored block lengths",q.mode=30;break}if(q.length=65535&ae,xe=ae=0,q.mode=15,Ke===6)break e;case 15:q.mode=16;case 16:if(he=q.length){if(ot>>=5,xe-=5,q.ndist=1+(31&ae),ae>>>=5,xe-=5,q.ncode=4+(15&ae),ae>>>=4,xe-=4,286>>=3,xe-=3}for(;q.have<19;)q.lens[ft[q.have++]]=0;if(q.lencode=q.lendyn,q.lenbits=7,et={bits:q.lenbits},lt=v(0,q.lens,0,19,q.lencode,0,q.work,et),q.lenbits=et.bits,lt){be.msg="invalid code lengths set",q.mode=30;break}q.have=0,q.mode=19;case 19:for(;q.have>>16&255,Bt=65535&ge,!((vt=ge>>>24)<=xe);){if(ot===0)break e;ot--,ae+=He[at++]<>>=vt,xe-=vt,q.lens[q.have++]=Bt;else{if(Bt===16){for(Se=vt+2;xe>>=vt,xe-=vt,q.have===0){be.msg="invalid bit length repeat",q.mode=30;break}Z=q.lens[q.have-1],he=3+(3&ae),ae>>>=2,xe-=2}else if(Bt===17){for(Se=vt+3;xe>>=vt)),ae>>>=3,xe-=3}else{for(Se=vt+7;xe>>=vt)),ae>>>=7,xe-=7}if(q.have+he>q.nlen+q.ndist){be.msg="invalid bit length repeat",q.mode=30;break}for(;he--;)q.lens[q.have++]=Z}}if(q.mode===30)break;if(q.lens[256]===0){be.msg="invalid code -- missing end-of-block",q.mode=30;break}if(q.lenbits=9,et={bits:q.lenbits},lt=v(S,q.lens,0,q.nlen,q.lencode,0,q.work,et),q.lenbits=et.bits,lt){be.msg="invalid literal/lengths set",q.mode=30;break}if(q.distbits=6,q.distcode=q.distdyn,et={bits:q.distbits},lt=v(T,q.lens,q.nlen,q.ndist,q.distcode,0,q.work,et),q.distbits=et.bits,lt){be.msg="invalid distances set",q.mode=30;break}if(q.mode=20,Ke===6)break e;case 20:q.mode=21;case 21:if(6<=ot&&258<=st){be.next_out=Wt,be.avail_out=st,be.next_in=at,be.avail_in=ot,q.hold=ae,q.bits=xe,_(be,Y),Wt=be.next_out,Rt=be.output,st=be.avail_out,at=be.next_in,He=be.input,ot=be.avail_in,ae=q.hold,xe=q.bits,q.mode===12&&(q.back=-1);break}for(q.back=0;Ct=(ge=q.lencode[ae&(1<>>16&255,Bt=65535&ge,!((vt=ge>>>24)<=xe);){if(ot===0)break e;ot--,ae+=He[at++]<>fi)])>>>16&255,Bt=65535&ge,!(fi+(vt=ge>>>24)<=xe);){if(ot===0)break e;ot--,ae+=He[at++]<>>=fi,xe-=fi,q.back+=fi}if(ae>>>=vt,xe-=vt,q.back+=vt,q.length=Bt,Ct===0){q.mode=26;break}if(32&Ct){q.back=-1,q.mode=12;break}if(64&Ct){be.msg="invalid literal/length code",q.mode=30;break}q.extra=15&Ct,q.mode=22;case 22:if(q.extra){for(Se=q.extra;xe>>=q.extra,xe-=q.extra,q.back+=q.extra}q.was=q.length,q.mode=23;case 23:for(;Ct=(ge=q.distcode[ae&(1<>>16&255,Bt=65535&ge,!((vt=ge>>>24)<=xe);){if(ot===0)break e;ot--,ae+=He[at++]<>fi)])>>>16&255,Bt=65535&ge,!(fi+(vt=ge>>>24)<=xe);){if(ot===0)break e;ot--,ae+=He[at++]<>>=fi,xe-=fi,q.back+=fi}if(ae>>>=vt,xe-=vt,q.back+=vt,64&Ct){be.msg="invalid distance code",q.mode=30;break}q.offset=Bt,q.extra=15&Ct,q.mode=24;case 24:if(q.extra){for(Se=q.extra;xe>>=q.extra,xe-=q.extra,q.back+=q.extra}if(q.offset>q.dmax){be.msg="invalid distance too far back",q.mode=30;break}q.mode=25;case 25:if(st===0)break e;if(he=Y-st,q.offset>he){if((he=q.offset-he)>q.whave&&q.sane){be.msg="invalid distance too far back",q.mode=30;break}Je=he>q.wnext?(he-=q.wnext,q.wsize-he):q.wnext-he,he>q.length&&(he=q.length),kt=q.window}else kt=Rt,Je=Wt-q.offset,he=q.length;for(stne?(ve=Je[kt+R[Ke]],xe[Me+R[Ke]]):(ve=96,0),F=1<>Wt)+(j-=F)]=re<<24|ve<<16|ze|0,j!==0;);for(F=1<>=1;if(F!==0?(ae&=F-1,ae+=F):ae=0,Ke++,--Y[be]==0){if(be===He)break;be=T[I+R[Ke]]}if(Rt>>7)]}function Me(ge,$e){ge.pending_buf[ge.pending++]=255&$e,ge.pending_buf[ge.pending++]=$e>>>8&255}function Y(ge,$e,ft){ge.bi_valid>D-ft?(ge.bi_buf|=$e<>D-ge.bi_valid,ge.bi_valid+=ft-D):(ge.bi_buf|=$e<>>=1,ft<<=1,0<--$e;);return ft>>>1}function kt(ge,$e,ft){var Ie,We,wt=new Array(R+1),Et=0;for(Ie=1;Ie<=R;Ie++)wt[Ie]=Et=Et+ft[Ie-1]<<1;for(We=0;We<=$e;We++){var ct=ge[2*We+1];ct!==0&&(ge[2*We]=Je(wt[ct]++,ct))}}function vt(ge){var $e;for($e=0;$e>1;1<=ft;ft--)fi(ge,wt,ft);for(We=Xt;ft=ge.heap[1],ge.heap[1]=ge.heap[ge.heap_len--],fi(ge,wt,1),Ie=ge.heap[1],ge.heap[--ge.heap_max]=ft,ge.heap[--ge.heap_max]=Ie,wt[2*We]=wt[2*ft]+wt[2*Ie],ge.depth[We]=(ge.depth[ft]>=ge.depth[Ie]?ge.depth[ft]:ge.depth[Ie])+1,wt[2*ft+1]=wt[2*Ie+1]=We,ge.heap[1]=We++,fi(ge,wt,1),2<=ge.heap_len;);ge.heap[--ge.heap_max]=ge.heap[1],function(ki,Wi){var ar,dr,Gr,mt,Ji,wr,xr=Wi.dyn_tree,or=Wi.max_code,Pt=Wi.stat_desc.static_tree,vi=Wi.stat_desc.has_stree,bi=Wi.stat_desc.extra_bits,Sr=Wi.stat_desc.extra_base,Vr=Wi.stat_desc.max_length,pi=0;for(mt=0;mt<=R;mt++)ki.bl_count[mt]=0;for(xr[2*ki.heap[ki.heap_max]+1]=0,ar=ki.heap_max+1;ar>=7;We>>=1)if(1&Ii&&ct.dyn_ltree[2*Xt]!==0)return p;if(ct.dyn_ltree[18]!==0||ct.dyn_ltree[20]!==0||ct.dyn_ltree[26]!==0)return n;for(Xt=32;Xt>>3,(wt=ge.static_len+3+7>>>3)<=We&&(We=wt)):We=wt=ft+5,ft+4<=We&&$e!==-1?Se(ge,$e,ft,Ie):ge.strategy===4||wt===We?(Y(ge,2+(Ie?1:0),3),pt(ge,nt,be)):(Y(ge,4+(Ie?1:0),3),function(ct,Xt,Ii,ki){var Wi;for(Y(ct,Xt-257,5),Y(ct,Ii-1,5),Y(ct,ki-4,4),Wi=0;Wi>>8&255,ge.pending_buf[ge.d_buf+2*ge.last_lit+1]=255&$e,ge.pending_buf[ge.l_buf+ge.last_lit]=255&ft,ge.last_lit++,$e===0?ge.dyn_ltree[2*ft]++:(ge.matches++,$e--,ge.dyn_ltree[2*(q[ft]+T+1)]++,ge.dyn_dtree[2*xe($e)]++),ge.last_lit===ge.lit_bufsize-1},u._tr_align=function(ge){Y(ge,2,3),he(ge,j,nt),function($e){$e.bi_valid===16?(Me($e,$e.bi_buf),$e.bi_buf=0,$e.bi_valid=0):8<=$e.bi_valid&&($e.pending_buf[$e.pending++]=255&$e.bi_buf,$e.bi_buf>>=8,$e.bi_valid-=8)}(ge)}},{"../utils/common":41}],53:[function(a,o,u){o.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(a,o,u){(function(f){(function(p,n){if(!p.setImmediate){var _,v,S,T,I=1,z={},M=!1,C=p.document,R=Object.getPrototypeOf&&Object.getPrototypeOf(p);R=R&&R.setTimeout?R:p,_={}.toString.call(p.process)==="[object process]"?function(ee){process.nextTick(function(){F(ee)})}:function(){if(p.postMessage&&!p.importScripts){var ee=!0,oe=p.onmessage;return p.onmessage=function(){ee=!1},p.postMessage("","*"),p.onmessage=oe,ee}}()?(T="setImmediate$"+Math.random()+"$",p.addEventListener?p.addEventListener("message",j,!1):p.attachEvent("onmessage",j),function(ee){p.postMessage(T+ee,"*")}):p.MessageChannel?((S=new MessageChannel).port1.onmessage=function(ee){F(ee.data)},function(ee){S.port2.postMessage(ee)}):C&&"onreadystatechange"in C.createElement("script")?(v=C.documentElement,function(ee){var oe=C.createElement("script");oe.onreadystatechange=function(){F(ee),oe.onreadystatechange=null,v.removeChild(oe),oe=null},v.appendChild(oe)}):function(ee){setTimeout(F,0,ee)},R.setImmediate=function(ee){typeof ee!="function"&&(ee=new Function(""+ee));for(var oe=new Array(arguments.length-1),se=0;se"u"?f===void 0?this:f:self)}).call(this,typeof Ho<"u"?Ho:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Vy);var xk=Vy.exports;const Sk=rh(xk);const{document:ms}=J_;function S_(l,i,a){const o=l.slice();return o[30]=i[a],o}function E_(l,i,a){const o=l.slice();return o[33]=i[a],o}function k_(l,i,a){const o=l.slice();return o[36]=i[a],o}function T_(l){let i,a,o=l[14](l[0]),u,f,p;i=new Y_({props:{mode:l[3]=="failed"?"error":"info",$$slots:{default:[Pk]},$$scope:{ctx:l}}});let n=o&&P_(l);return{c(){ei(i.$$.fragment),a=gt(),n&&n.c(),u=gt(),f=je("div"),this.h()},l(_){si(i.$$.fragment,_),a=_t(_),n&&n.l(_),u=_t(_),f=qe(_,"DIV",{}),Ye(f).forEach(Q),this.h()},h(){At(f,"height","24px")},m(_,v){ti(i,_,v),Fe(_,a,v),n&&n.m(_,v),Fe(_,u,v),Fe(_,f,v),p=!0},p(_,v){const S={};v[0]&8&&(S.mode=_[3]=="failed"?"error":"info"),v[0]&10|v[1]&256&&(S.$$scope={dirty:v,ctx:_}),i.$set(S),v[0]&1&&(o=_[14](_[0])),o?n?(n.p(_,v),v[0]&1&&Ge(n,1)):(n=P_(_),n.c(),Ge(n,1),n.m(u.parentNode,u)):n&&(Vi(),tt(n,1,1,()=>{n=null}),$i())},i(_){p||(Ge(i.$$.fragment,_),Ge(n),p=!0)},o(_){tt(i.$$.fragment,_),tt(n),p=!1},d(_){_&&(Q(a),Q(u),Q(f)),ii(i,_),n&&n.d(_)}}}function C_(l){let i;function a(f,p){return f[1].length===1?kk:Ek}let o=a(l),u=o(l);return{c(){i=je("p"),u.c()},l(f){i=qe(f,"P",{});var p=Ye(i);u.l(p),p.forEach(Q)},m(f,p){Fe(f,i,p),u.m(i,null)},p(f,p){o===(o=a(f))&&u?u.p(f,p):(u.d(1),u=o(f),u&&(u.c(),u.m(i,null)))},d(f){f&&Q(i),u.d()}}}function Ek(l){let i,a;function o(p,n){return p[1].length===2?Ck:Tk}let u=o(l),f=u(l);return{c(){i=Ut("The profile below is for people who share "),f.c(),a=Ut(` - of the following characteristics:`)},l(p){i=Vt(p,"The profile below is for people who share "),f.l(p),a=Vt(p,` - of the following characteristics:`)},m(p,n){Fe(p,i,n),f.m(p,n),Fe(p,a,n)},p(p,n){u!==(u=o(p))&&(f.d(1),f=u(p),f&&(f.c(),f.m(a.parentNode,a)))},d(p){p&&(Q(i),Q(a)),f.d(p)}}}function kk(l){let i;return{c(){i=Ut(`The profile below is for people who share the following - characteristic:`)},l(a){i=Vt(a,`The profile below is for people who share the following - characteristic:`)},m(a,o){Fe(a,i,o)},p:wi,d(a){a&&Q(i)}}}function Tk(l){let i;return{c(){i=Ut("all")},l(a){i=Vt(a,"all")},m(a,o){Fe(a,i,o)},d(a){a&&Q(i)}}}function Ck(l){let i;return{c(){i=Ut("both")},l(a){i=Vt(a,"both")},m(a,o){Fe(a,i,o)},d(a){a&&Q(i)}}}function Ik(l){let i,a,o=ga(l[36].topic)+"",u,f,p=ga(eo(l[36].label))+"",n,_,v,S,T;function I(){return l[16](l[36])}return{c(){i=je("button"),a=je("span"),u=Ut(o),f=Ut(": "),n=Ut(p),_=gt(),v=je("span"),this.h()},l(z){i=qe(z,"BUTTON",{class:!0});var M=Ye(i);a=qe(M,"SPAN",{class:!0});var C=Ye(a);u=Vt(C,o),f=Vt(C,": "),n=Vt(C,p),C.forEach(Q),_=_t(M),v=qe(M,"SPAN",{class:!0}),Ye(v).forEach(Q),M.forEach(Q),this.h()},h(){me(a,"class","chip-text svelte-1e3ffsh"),me(v,"class","chip-ready svelte-1e3ffsh"),me(i,"class","chip svelte-1e3ffsh")},m(z,M){Fe(z,i,M),De(i,a),De(a,u),De(a,f),De(a,n),De(i,_),De(i,v),S||(T=Ms(i,"click",I),S=!0)},p(z,M){l=z,M[0]&2&&o!==(o=ga(l[36].topic)+"")&&Ci(u,o),M[0]&2&&p!==(p=ga(eo(l[36].label))+"")&&Ci(n,p)},d(z){z&&Q(i),S=!1,T()}}}function Ak(l){let i,a,o=ga(l[36].topic)+"",u,f,p=ga(eo(l[36].label))+"",n,_,v;return{c(){i=je("div"),a=je("span"),u=Ut(o),f=Ut(": "),n=Ut(p),_=gt(),v=je("div"),this.h()},l(S){i=qe(S,"DIV",{class:!0});var T=Ye(i);a=qe(T,"SPAN",{class:!0});var I=Ye(a);u=Vt(I,o),f=Vt(I,": "),n=Vt(I,p),I.forEach(Q),_=_t(T),v=qe(T,"DIV",{class:!0}),Ye(v).forEach(Q),T.forEach(Q),this.h()},h(){me(a,"class","chip-text svelte-1e3ffsh"),me(v,"class","chip-loader svelte-1e3ffsh"),me(i,"class","chip chip-pending svelte-1e3ffsh")},m(S,T){Fe(S,i,T),De(i,a),De(a,u),De(a,f),De(a,n),De(i,_),De(i,v)},p(S,T){T[0]&2&&o!==(o=ga(S[36].topic)+"")&&Ci(u,o),T[0]&2&&p!==(p=ga(eo(S[36].label))+"")&&Ci(n,p)},d(S){S&&Q(i)}}}function I_(l){let i;function a(f,p){return f[3]=="loading"?Ak:Ik}let o=a(l),u=o(l);return{c(){u.c(),i=ri()},l(f){u.l(f),i=ri()},m(f,p){u.m(f,p),Fe(f,i,p)},p(f,p){o===(o=a(f))&&u?u.p(f,p):(u.d(1),u=o(f),u&&(u.c(),u.m(i.parentNode,i)))},d(f){f&&Q(i),u.d(f)}}}function A_(l){let i,a=`No data is available for the selected variables. Try removing a - variable to see more datasets.`;return{c(){i=je("p"),i.textContent=a,this.h()},l(o){i=qe(o,"P",{"data-svelte-h":!0}),Cr(i)!=="svelte-1vmdqji"&&(i.textContent=a),this.h()},h(){At(i,"margin","1rem 0 0")},m(o,u){Fe(o,i,u)},d(o){o&&Q(i)}}}function Pk(l){let i,a,o,u=l[3]!="failed"&&C_(l),f=Ni(l[1]),p=[];for(let _=0;_>2,z=(3&v)<<4|E>>4,P=1>6:64,I=2>4,E=(15&C)<<4|(z=n.indexOf(_.charAt(I++)))>>2,S=(3&z)<<6|(P=n.indexOf(_.charAt(I++))),F[L++]=v,z!==64&&(F[L++]=E),P!==64&&(F[L++]=S);return F}},{"./support":30,"./utils":32}],2:[function(a,o,u){var f=a("./external"),p=a("./stream/DataWorker"),n=a("./stream/Crc32Probe"),_=a("./stream/DataLengthProbe");function v(E,S,C,z,P){this.compressedSize=E,this.uncompressedSize=S,this.crc32=C,this.compression=z,this.compressedContent=P}v.prototype={getContentWorker:function(){var E=new p(f.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new _("data_length")),S=this;return E.on("end",function(){if(this.streamInfo.data_length!==S.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),E},getCompressedWorker:function(){return new p(f.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},v.createWorkerFrom=function(E,S,C){return E.pipe(new n).pipe(new _("uncompressedSize")).pipe(S.compressWorker(C)).pipe(new _("compressedSize")).withStreamInfo("compression",S)},o.exports=v},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(a,o,u){var f=a("./stream/GenericWorker");u.STORE={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},u.DEFLATE=a("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(a,o,u){var f=a("./utils"),p=function(){for(var n,_=[],v=0;v<256;v++){n=v;for(var E=0;E<8;E++)n=1&n?3988292384^n>>>1:n>>>1;_[v]=n}return _}();o.exports=function(n,_){return n!==void 0&&n.length?f.getTypeOf(n)!=="string"?function(v,E,S,C){var z=p,P=C+S;v^=-1;for(var I=C;I>>8^z[255&(v^E[I])];return-1^v}(0|_,n,n.length,0):function(v,E,S,C){var z=p,P=C+S;v^=-1;for(var I=C;I>>8^z[255&(v^E.charCodeAt(I))];return-1^v}(0|_,n,n.length,0):0}},{"./utils":32}],5:[function(a,o,u){u.base64=!1,u.binary=!1,u.dir=!1,u.createFolders=!0,u.date=null,u.compression=null,u.compressionOptions=null,u.comment=null,u.unixPermissions=null,u.dosPermissions=null},{}],6:[function(a,o,u){var f=null;f=typeof Promise<"u"?Promise:a("lie"),o.exports={Promise:f}},{lie:37}],7:[function(a,o,u){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",p=a("pako"),n=a("./utils"),_=a("./stream/GenericWorker"),v=f?"uint8array":"array";function E(S,C){_.call(this,"FlateWorker/"+S),this._pako=null,this._pakoAction=S,this._pakoOptions=C,this.meta={}}u.magic="\b\0",n.inherits(E,_),E.prototype.processChunk=function(S){this.meta=S.meta,this._pako===null&&this._createPako(),this._pako.push(n.transformTo(v,S.data),!1)},E.prototype.flush=function(){_.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},E.prototype.cleanUp=function(){_.prototype.cleanUp.call(this),this._pako=null},E.prototype._createPako=function(){this._pako=new p[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var S=this;this._pako.onData=function(C){S.push({data:C,meta:S.meta})}},u.compressWorker=function(S){return new E("Deflate",S)},u.uncompressWorker=function(){return new E("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(a,o,u){function f(z,P){var I,L="";for(I=0;I>>=8;return L}function p(z,P,I,L,D,F){var V,ee,se=z.file,ne=z.compression,le=F!==v.utf8encode,ge=n.transformTo("string",F(se.name)),ce=n.transformTo("string",v.utf8encode(se.name)),Me=se.comment,et=n.transformTo("string",F(Me)),ye=n.transformTo("string",v.utf8encode(Me)),Ge=ce.length!==se.name.length,q=ye.length!==Me.length,We="",Tt="",it="",Bt=se.dir,Ne=se.date,Xe={crc32:0,compressedSize:0,uncompressedSize:0};P&&!I||(Xe.crc32=z.crc32,Xe.compressedSize=z.compressedSize,Xe.uncompressedSize=z.uncompressedSize);var ie=0;P&&(ie|=8),le||!Ge&&!q||(ie|=2048);var ve=0,De=0;Bt&&(ve|=16),D==="UNIX"?(De=798,ve|=function(ue,Qe){var wt=ue;return ue||(wt=Qe?16893:33204),(65535&wt)<<16}(se.unixPermissions,Bt)):(De=20,ve|=function(ue){return 63&(ue||0)}(se.dosPermissions)),V=Ne.getUTCHours(),V<<=6,V|=Ne.getUTCMinutes(),V<<=5,V|=Ne.getUTCSeconds()/2,ee=Ne.getUTCFullYear()-1980,ee<<=4,ee|=Ne.getUTCMonth()+1,ee<<=5,ee|=Ne.getUTCDate(),Ge&&(Tt=f(1,1)+f(E(ge),4)+ce,We+="up"+f(Tt.length,2)+Tt),q&&(it=f(1,1)+f(E(et),4)+ye,We+="uc"+f(it.length,2)+it);var Y="";return Y+=` +\0`,Y+=f(ie,2),Y+=ne.magic,Y+=f(V,2),Y+=f(ee,2),Y+=f(Xe.crc32,4),Y+=f(Xe.compressedSize,4),Y+=f(Xe.uncompressedSize,4),Y+=f(ge.length,2),Y+=f(We.length,2),{fileRecord:S.LOCAL_FILE_HEADER+Y+ge+We,dirRecord:S.CENTRAL_FILE_HEADER+f(De,2)+Y+f(et.length,2)+"\0\0\0\0"+f(ve,4)+f(L,4)+ge+We+et}}var n=a("../utils"),_=a("../stream/GenericWorker"),v=a("../utf8"),E=a("../crc32"),S=a("../signature");function C(z,P,I,L){_.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=P,this.zipPlatform=I,this.encodeFileName=L,this.streamFiles=z,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}n.inherits(C,_),C.prototype.push=function(z){var P=z.meta.percent||0,I=this.entriesCount,L=this._sources.length;this.accumulate?this.contentBuffer.push(z):(this.bytesWritten+=z.data.length,_.prototype.push.call(this,{data:z.data,meta:{currentFile:this.currentFile,percent:I?(P+100*(I-L-1))/I:100}}))},C.prototype.openedSource=function(z){this.currentSourceOffset=this.bytesWritten,this.currentFile=z.file.name;var P=this.streamFiles&&!z.file.dir;if(P){var I=p(z,P,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:I.fileRecord,meta:{percent:0}})}else this.accumulate=!0},C.prototype.closedSource=function(z){this.accumulate=!1;var P=this.streamFiles&&!z.file.dir,I=p(z,P,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(I.dirRecord),P)this.push({data:function(L){return S.DATA_DESCRIPTOR+f(L.crc32,4)+f(L.compressedSize,4)+f(L.uncompressedSize,4)}(z),meta:{percent:100}});else for(this.push({data:I.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},C.prototype.flush=function(){for(var z=this.bytesWritten,P=0;P=this.index;_--)v=(v<<8)+this.byteAt(_);return this.index+=n,v},readString:function(n){return f.transformTo("string",this.readData(n))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var n=this.readInt(4);return new Date(Date.UTC(1980+(n>>25&127),(n>>21&15)-1,n>>16&31,n>>11&31,n>>5&63,(31&n)<<1))}},o.exports=p},{"../utils":32}],19:[function(a,o,u){var f=a("./Uint8ArrayReader");function p(n){f.call(this,n)}a("../utils").inherits(p,f),p.prototype.readData=function(n){this.checkOffset(n);var _=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,_},o.exports=p},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(a,o,u){var f=a("./DataReader");function p(n){f.call(this,n)}a("../utils").inherits(p,f),p.prototype.byteAt=function(n){return this.data.charCodeAt(this.zero+n)},p.prototype.lastIndexOfSignature=function(n){return this.data.lastIndexOf(n)-this.zero},p.prototype.readAndCheckSignature=function(n){return n===this.readData(4)},p.prototype.readData=function(n){this.checkOffset(n);var _=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,_},o.exports=p},{"../utils":32,"./DataReader":18}],21:[function(a,o,u){var f=a("./ArrayReader");function p(n){f.call(this,n)}a("../utils").inherits(p,f),p.prototype.readData=function(n){if(this.checkOffset(n),n===0)return new Uint8Array(0);var _=this.data.subarray(this.zero+this.index,this.zero+this.index+n);return this.index+=n,_},o.exports=p},{"../utils":32,"./ArrayReader":17}],22:[function(a,o,u){var f=a("../utils"),p=a("../support"),n=a("./ArrayReader"),_=a("./StringReader"),v=a("./NodeBufferReader"),E=a("./Uint8ArrayReader");o.exports=function(S){var C=f.getTypeOf(S);return f.checkSupport(C),C!=="string"||p.uint8array?C==="nodebuffer"?new v(S):p.uint8array?new E(f.transformTo("uint8array",S)):new n(f.transformTo("array",S)):new _(S)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(a,o,u){u.LOCAL_FILE_HEADER="PK",u.CENTRAL_FILE_HEADER="PK",u.CENTRAL_DIRECTORY_END="PK",u.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",u.ZIP64_CENTRAL_DIRECTORY_END="PK",u.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(a,o,u){var f=a("./GenericWorker"),p=a("../utils");function n(_){f.call(this,"ConvertWorker to "+_),this.destType=_}p.inherits(n,f),n.prototype.processChunk=function(_){this.push({data:p.transformTo(this.destType,_.data),meta:_.meta})},o.exports=n},{"../utils":32,"./GenericWorker":28}],25:[function(a,o,u){var f=a("./GenericWorker"),p=a("../crc32");function n(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}a("../utils").inherits(n,f),n.prototype.processChunk=function(_){this.streamInfo.crc32=p(_.data,this.streamInfo.crc32||0),this.push(_)},o.exports=n},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(a,o,u){var f=a("../utils"),p=a("./GenericWorker");function n(_){p.call(this,"DataLengthProbe for "+_),this.propName=_,this.withStreamInfo(_,0)}f.inherits(n,p),n.prototype.processChunk=function(_){if(_){var v=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=v+_.data.length}p.prototype.processChunk.call(this,_)},o.exports=n},{"../utils":32,"./GenericWorker":28}],27:[function(a,o,u){var f=a("../utils"),p=a("./GenericWorker");function n(_){p.call(this,"DataWorker");var v=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,_.then(function(E){v.dataIsReady=!0,v.data=E,v.max=E&&E.length||0,v.type=f.getTypeOf(E),v.isPaused||v._tickAndRepeat()},function(E){v.error(E)})}f.inherits(n,p),n.prototype.cleanUp=function(){p.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return!!p.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var _=null,v=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":_=this.data.substring(this.index,v);break;case"uint8array":_=this.data.subarray(this.index,v);break;case"array":case"nodebuffer":_=this.data.slice(this.index,v)}return this.index=v,this.push({data:_,meta:{percent:this.max?this.index/this.max*100:0}})},o.exports=n},{"../utils":32,"./GenericWorker":28}],28:[function(a,o,u){function f(p){this.name=p||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}f.prototype={push:function(p){this.emit("data",p)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(p){this.emit("error",p)}return!0},error:function(p){return!this.isFinished&&(this.isPaused?this.generatedError=p:(this.isFinished=!0,this.emit("error",p),this.previous&&this.previous.error(p),this.cleanUp()),!0)},on:function(p,n){return this._listeners[p].push(n),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(p,n){if(this._listeners[p])for(var _=0;_ "+p:p}},o.exports=f},{}],29:[function(a,o,u){var f=a("../utils"),p=a("./ConvertWorker"),n=a("./GenericWorker"),_=a("../base64"),v=a("../support"),E=a("../external"),S=null;if(v.nodestream)try{S=a("../nodejs/NodejsStreamOutputAdapter")}catch{}function C(P,I){return new E.Promise(function(L,D){var F=[],V=P._internalType,ee=P._outputType,se=P._mimeType;P.on("data",function(ne,le){F.push(ne),I&&I(le)}).on("error",function(ne){F=[],D(ne)}).on("end",function(){try{var ne=function(le,ge,ce){switch(le){case"blob":return f.newBlob(f.transformTo("arraybuffer",ge),ce);case"base64":return _.encode(ge);default:return f.transformTo(le,ge)}}(ee,function(le,ge){var ce,Me=0,et=null,ye=0;for(ce=0;ce"u")u.blob=!1;else{var f=new ArrayBuffer(0);try{u.blob=new Blob([f],{type:"application/zip"}).size===0}catch{try{var p=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);p.append(f),u.blob=p.getBlob("application/zip").size===0}catch{u.blob=!1}}}try{u.nodestream=!!a("readable-stream").Readable}catch{u.nodestream=!1}},{"readable-stream":16}],31:[function(a,o,u){for(var f=a("./utils"),p=a("./support"),n=a("./nodejsUtils"),_=a("./stream/GenericWorker"),v=new Array(256),E=0;E<256;E++)v[E]=252<=E?6:248<=E?5:240<=E?4:224<=E?3:192<=E?2:1;v[254]=v[254]=1;function S(){_.call(this,"utf-8 decode"),this.leftOver=null}function C(){_.call(this,"utf-8 encode")}u.utf8encode=function(z){return p.nodebuffer?n.newBufferFrom(z,"utf-8"):function(P){var I,L,D,F,V,ee=P.length,se=0;for(F=0;F>>6:(L<65536?I[V++]=224|L>>>12:(I[V++]=240|L>>>18,I[V++]=128|L>>>12&63),I[V++]=128|L>>>6&63),I[V++]=128|63&L);return I}(z)},u.utf8decode=function(z){return p.nodebuffer?f.transformTo("nodebuffer",z).toString("utf-8"):function(P){var I,L,D,F,V=P.length,ee=new Array(2*V);for(I=L=0;I>10&1023,ee[L++]=56320|1023&D)}return ee.length!==L&&(ee.subarray?ee=ee.subarray(0,L):ee.length=L),f.applyFromCharCode(ee)}(z=f.transformTo(p.uint8array?"uint8array":"array",z))},f.inherits(S,_),S.prototype.processChunk=function(z){var P=f.transformTo(p.uint8array?"uint8array":"array",z.data);if(this.leftOver&&this.leftOver.length){if(p.uint8array){var I=P;(P=new Uint8Array(I.length+this.leftOver.length)).set(this.leftOver,0),P.set(I,this.leftOver.length)}else P=this.leftOver.concat(P);this.leftOver=null}var L=function(F,V){var ee;for((V=V||F.length)>F.length&&(V=F.length),ee=V-1;0<=ee&&(192&F[ee])==128;)ee--;return ee<0||ee===0?V:ee+v[F[ee]]>V?ee:V}(P),D=P;L!==P.length&&(p.uint8array?(D=P.subarray(0,L),this.leftOver=P.subarray(L,P.length)):(D=P.slice(0,L),this.leftOver=P.slice(L,P.length))),this.push({data:u.utf8decode(D),meta:z.meta})},S.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:u.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},u.Utf8DecodeWorker=S,f.inherits(C,_),C.prototype.processChunk=function(z){this.push({data:u.utf8encode(z.data),meta:z.meta})},u.Utf8EncodeWorker=C},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(a,o,u){var f=a("./support"),p=a("./base64"),n=a("./nodejsUtils"),_=a("./external");function v(I){return I}function E(I,L){for(var D=0;D>8;this.dir=!!(16&this.externalFileAttributes),z==0&&(this.dosPermissions=63&this.externalFileAttributes),z==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var z=f(this.extraFields[1].value);this.uncompressedSize===p.MAX_VALUE_32BITS&&(this.uncompressedSize=z.readInt(8)),this.compressedSize===p.MAX_VALUE_32BITS&&(this.compressedSize=z.readInt(8)),this.localHeaderOffset===p.MAX_VALUE_32BITS&&(this.localHeaderOffset=z.readInt(8)),this.diskNumberStart===p.MAX_VALUE_32BITS&&(this.diskNumberStart=z.readInt(4))}},readExtraFields:function(z){var P,I,L,D=z.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});z.index+4>>6:(z<65536?C[L++]=224|z>>>12:(C[L++]=240|z>>>18,C[L++]=128|z>>>12&63),C[L++]=128|z>>>6&63),C[L++]=128|63&z);return C},u.buf2binstring=function(S){return E(S,S.length)},u.binstring2buf=function(S){for(var C=new f.Buf8(S.length),z=0,P=C.length;z>10&1023,F[P++]=56320|1023&I)}return E(F,P)},u.utf8border=function(S,C){var z;for((C=C||S.length)>S.length&&(C=S.length),z=C-1;0<=z&&(192&S[z])==128;)z--;return z<0||z===0?C:z+_[S[z]]>C?z:C}},{"./common":41}],43:[function(a,o,u){o.exports=function(f,p,n,_){for(var v=65535&f|0,E=f>>>16&65535|0,S=0;n!==0;){for(n-=S=2e3>>1:p>>>1;n[_]=p}return n}();o.exports=function(p,n,_,v){var E=f,S=v+_;p^=-1;for(var C=v;C>>8^E[255&(p^n[C])];return-1^p}},{}],46:[function(a,o,u){var f,p=a("../utils/common"),n=a("./trees"),_=a("./adler32"),v=a("./crc32"),E=a("./messages"),S=0,C=4,z=0,P=-2,I=-1,L=4,D=2,F=8,V=9,ee=286,se=30,ne=19,le=2*ee+1,ge=15,ce=3,Me=258,et=Me+ce+1,ye=42,Ge=113,q=1,We=2,Tt=3,it=4;function Bt(Z,lt){return Z.msg=E[lt],lt}function Ne(Z){return(Z<<1)-(4Z.avail_out&&(nt=Z.avail_out),nt!==0&&(p.arraySet(Z.output,lt.pending_buf,lt.pending_out,nt,Z.next_out),Z.next_out+=nt,lt.pending_out+=nt,Z.total_out+=nt,Z.avail_out-=nt,lt.pending-=nt,lt.pending===0&&(lt.pending_out=0))}function ve(Z,lt){n._tr_flush_block(Z,0<=Z.block_start?Z.block_start:-1,Z.strstart-Z.block_start,lt),Z.block_start=Z.strstart,ie(Z.strm)}function De(Z,lt){Z.pending_buf[Z.pending++]=lt}function Y(Z,lt){Z.pending_buf[Z.pending++]=lt>>>8&255,Z.pending_buf[Z.pending++]=255<}function ue(Z,lt){var nt,Ee,_e=Z.max_chain_length,Ze=Z.strstart,pt=Z.prev_length,Ae=Z.nice_match,Ye=Z.strstart>Z.w_size-et?Z.strstart-(Z.w_size-et):0,xt=Z.window,kt=Z.w_mask,ct=Z.prev,Xt=Z.strstart+Me,Ii=xt[Ze+pt-1],Ti=xt[Ze+pt];Z.prev_length>=Z.good_match&&(_e>>=2),Ae>Z.lookahead&&(Ae=Z.lookahead);do if(xt[(nt=lt)+pt]===Ti&&xt[nt+pt-1]===Ii&&xt[nt]===xt[Ze]&&xt[++nt]===xt[Ze+1]){Ze+=2,nt++;do;while(xt[++Ze]===xt[++nt]&&xt[++Ze]===xt[++nt]&&xt[++Ze]===xt[++nt]&&xt[++Ze]===xt[++nt]&&xt[++Ze]===xt[++nt]&&xt[++Ze]===xt[++nt]&&xt[++Ze]===xt[++nt]&&xt[++Ze]===xt[++nt]&&ZeYe&&--_e!=0);return pt<=Z.lookahead?pt:Z.lookahead}function Qe(Z){var lt,nt,Ee,_e,Ze,pt,Ae,Ye,xt,kt,ct=Z.w_size;do{if(_e=Z.window_size-Z.lookahead-Z.strstart,Z.strstart>=ct+(ct-et)){for(p.arraySet(Z.window,Z.window,ct,ct,0),Z.match_start-=ct,Z.strstart-=ct,Z.block_start-=ct,lt=nt=Z.hash_size;Ee=Z.head[--lt],Z.head[lt]=ct<=Ee?Ee-ct:0,--nt;);for(lt=nt=ct;Ee=Z.prev[--lt],Z.prev[lt]=ct<=Ee?Ee-ct:0,--nt;);_e+=ct}if(Z.strm.avail_in===0)break;if(pt=Z.strm,Ae=Z.window,Ye=Z.strstart+Z.lookahead,xt=_e,kt=void 0,kt=pt.avail_in,xt=ce)for(Ze=Z.strstart-Z.insert,Z.ins_h=Z.window[Ze],Z.ins_h=(Z.ins_h<=ce&&(Z.ins_h=(Z.ins_h<=ce)if(Ee=n._tr_tally(Z,Z.strstart-Z.match_start,Z.match_length-ce),Z.lookahead-=Z.match_length,Z.match_length<=Z.max_lazy_match&&Z.lookahead>=ce){for(Z.match_length--;Z.strstart++,Z.ins_h=(Z.ins_h<=ce&&(Z.ins_h=(Z.ins_h<=ce&&Z.match_length<=Z.prev_length){for(_e=Z.strstart+Z.lookahead-ce,Ee=n._tr_tally(Z,Z.strstart-1-Z.prev_match,Z.prev_length-ce),Z.lookahead-=Z.prev_length-1,Z.prev_length-=2;++Z.strstart<=_e&&(Z.ins_h=(Z.ins_h<Z.pending_buf_size-5&&(nt=Z.pending_buf_size-5);;){if(Z.lookahead<=1){if(Qe(Z),Z.lookahead===0&<===S)return q;if(Z.lookahead===0)break}Z.strstart+=Z.lookahead,Z.lookahead=0;var Ee=Z.block_start+nt;if((Z.strstart===0||Z.strstart>=Ee)&&(Z.lookahead=Z.strstart-Ee,Z.strstart=Ee,ve(Z,!1),Z.strm.avail_out===0)||Z.strstart-Z.block_start>=Z.w_size-et&&(ve(Z,!1),Z.strm.avail_out===0))return q}return Z.insert=0,lt===C?(ve(Z,!0),Z.strm.avail_out===0?Tt:it):(Z.strstart>Z.block_start&&(ve(Z,!1),Z.strm.avail_out),q)}),new It(4,4,8,4,wt),new It(4,5,16,8,wt),new It(4,6,32,32,wt),new It(4,4,16,16,vt),new It(8,16,32,32,vt),new It(8,16,128,128,vt),new It(8,32,128,256,vt),new It(32,128,258,1024,vt),new It(32,258,258,4096,vt)],u.deflateInit=function(Z,lt){return _i(Z,lt,F,15,8,0)},u.deflateInit2=_i,u.deflateReset=gt,u.deflateResetKeep=fi,u.deflateSetHeader=function(Z,lt){return Z&&Z.state?Z.state.wrap!==2?P:(Z.state.gzhead=lt,z):P},u.deflate=function(Z,lt){var nt,Ee,_e,Ze;if(!Z||!Z.state||5>8&255),De(Ee,Ee.gzhead.time>>16&255),De(Ee,Ee.gzhead.time>>24&255),De(Ee,Ee.level===9?2:2<=Ee.strategy||Ee.level<2?4:0),De(Ee,255&Ee.gzhead.os),Ee.gzhead.extra&&Ee.gzhead.extra.length&&(De(Ee,255&Ee.gzhead.extra.length),De(Ee,Ee.gzhead.extra.length>>8&255)),Ee.gzhead.hcrc&&(Z.adler=v(Z.adler,Ee.pending_buf,Ee.pending,0)),Ee.gzindex=0,Ee.status=69):(De(Ee,0),De(Ee,0),De(Ee,0),De(Ee,0),De(Ee,0),De(Ee,Ee.level===9?2:2<=Ee.strategy||Ee.level<2?4:0),De(Ee,3),Ee.status=Ge);else{var pt=F+(Ee.w_bits-8<<4)<<8;pt|=(2<=Ee.strategy||Ee.level<2?0:Ee.level<6?1:Ee.level===6?2:3)<<6,Ee.strstart!==0&&(pt|=32),pt+=31-pt%31,Ee.status=Ge,Y(Ee,pt),Ee.strstart!==0&&(Y(Ee,Z.adler>>>16),Y(Ee,65535&Z.adler)),Z.adler=1}if(Ee.status===69)if(Ee.gzhead.extra){for(_e=Ee.pending;Ee.gzindex<(65535&Ee.gzhead.extra.length)&&(Ee.pending!==Ee.pending_buf_size||(Ee.gzhead.hcrc&&Ee.pending>_e&&(Z.adler=v(Z.adler,Ee.pending_buf,Ee.pending-_e,_e)),ie(Z),_e=Ee.pending,Ee.pending!==Ee.pending_buf_size));)De(Ee,255&Ee.gzhead.extra[Ee.gzindex]),Ee.gzindex++;Ee.gzhead.hcrc&&Ee.pending>_e&&(Z.adler=v(Z.adler,Ee.pending_buf,Ee.pending-_e,_e)),Ee.gzindex===Ee.gzhead.extra.length&&(Ee.gzindex=0,Ee.status=73)}else Ee.status=73;if(Ee.status===73)if(Ee.gzhead.name){_e=Ee.pending;do{if(Ee.pending===Ee.pending_buf_size&&(Ee.gzhead.hcrc&&Ee.pending>_e&&(Z.adler=v(Z.adler,Ee.pending_buf,Ee.pending-_e,_e)),ie(Z),_e=Ee.pending,Ee.pending===Ee.pending_buf_size)){Ze=1;break}Ze=Ee.gzindex_e&&(Z.adler=v(Z.adler,Ee.pending_buf,Ee.pending-_e,_e)),Ze===0&&(Ee.gzindex=0,Ee.status=91)}else Ee.status=91;if(Ee.status===91)if(Ee.gzhead.comment){_e=Ee.pending;do{if(Ee.pending===Ee.pending_buf_size&&(Ee.gzhead.hcrc&&Ee.pending>_e&&(Z.adler=v(Z.adler,Ee.pending_buf,Ee.pending-_e,_e)),ie(Z),_e=Ee.pending,Ee.pending===Ee.pending_buf_size)){Ze=1;break}Ze=Ee.gzindex_e&&(Z.adler=v(Z.adler,Ee.pending_buf,Ee.pending-_e,_e)),Ze===0&&(Ee.status=103)}else Ee.status=103;if(Ee.status===103&&(Ee.gzhead.hcrc?(Ee.pending+2>Ee.pending_buf_size&&ie(Z),Ee.pending+2<=Ee.pending_buf_size&&(De(Ee,255&Z.adler),De(Ee,Z.adler>>8&255),Z.adler=0,Ee.status=Ge)):Ee.status=Ge),Ee.pending!==0){if(ie(Z),Z.avail_out===0)return Ee.last_flush=-1,z}else if(Z.avail_in===0&&Ne(lt)<=Ne(nt)&<!==C)return Bt(Z,-5);if(Ee.status===666&&Z.avail_in!==0)return Bt(Z,-5);if(Z.avail_in!==0||Ee.lookahead!==0||lt!==S&&Ee.status!==666){var Ae=Ee.strategy===2?function(Ye,xt){for(var kt;;){if(Ye.lookahead===0&&(Qe(Ye),Ye.lookahead===0)){if(xt===S)return q;break}if(Ye.match_length=0,kt=n._tr_tally(Ye,0,Ye.window[Ye.strstart]),Ye.lookahead--,Ye.strstart++,kt&&(ve(Ye,!1),Ye.strm.avail_out===0))return q}return Ye.insert=0,xt===C?(ve(Ye,!0),Ye.strm.avail_out===0?Tt:it):Ye.last_lit&&(ve(Ye,!1),Ye.strm.avail_out===0)?q:We}(Ee,lt):Ee.strategy===3?function(Ye,xt){for(var kt,ct,Xt,Ii,Ti=Ye.window;;){if(Ye.lookahead<=Me){if(Qe(Ye),Ye.lookahead<=Me&&xt===S)return q;if(Ye.lookahead===0)break}if(Ye.match_length=0,Ye.lookahead>=ce&&0Ye.lookahead&&(Ye.match_length=Ye.lookahead)}if(Ye.match_length>=ce?(kt=n._tr_tally(Ye,1,Ye.match_length-ce),Ye.lookahead-=Ye.match_length,Ye.strstart+=Ye.match_length,Ye.match_length=0):(kt=n._tr_tally(Ye,0,Ye.window[Ye.strstart]),Ye.lookahead--,Ye.strstart++),kt&&(ve(Ye,!1),Ye.strm.avail_out===0))return q}return Ye.insert=0,xt===C?(ve(Ye,!0),Ye.strm.avail_out===0?Tt:it):Ye.last_lit&&(ve(Ye,!1),Ye.strm.avail_out===0)?q:We}(Ee,lt):f[Ee.level].func(Ee,lt);if(Ae!==Tt&&Ae!==it||(Ee.status=666),Ae===q||Ae===Tt)return Z.avail_out===0&&(Ee.last_flush=-1),z;if(Ae===We&&(lt===1?n._tr_align(Ee):lt!==5&&(n._tr_stored_block(Ee,0,0,!1),lt===3&&(Xe(Ee.head),Ee.lookahead===0&&(Ee.strstart=0,Ee.block_start=0,Ee.insert=0))),ie(Z),Z.avail_out===0))return Ee.last_flush=-1,z}return lt!==C?z:Ee.wrap<=0?1:(Ee.wrap===2?(De(Ee,255&Z.adler),De(Ee,Z.adler>>8&255),De(Ee,Z.adler>>16&255),De(Ee,Z.adler>>24&255),De(Ee,255&Z.total_in),De(Ee,Z.total_in>>8&255),De(Ee,Z.total_in>>16&255),De(Ee,Z.total_in>>24&255)):(Y(Ee,Z.adler>>>16),Y(Ee,65535&Z.adler)),ie(Z),0=nt.w_size&&(Ze===0&&(Xe(nt.head),nt.strstart=0,nt.block_start=0,nt.insert=0),xt=new p.Buf8(nt.w_size),p.arraySet(xt,lt,kt-nt.w_size,nt.w_size,0),lt=xt,kt=nt.w_size),pt=Z.avail_in,Ae=Z.next_in,Ye=Z.input,Z.avail_in=kt,Z.next_in=0,Z.input=lt,Qe(nt);nt.lookahead>=ce;){for(Ee=nt.strstart,_e=nt.lookahead-(ce-1);nt.ins_h=(nt.ins_h<>>=ce=ge>>>24,V-=ce,(ce=ge>>>16&255)===0)We[E++]=65535≥else{if(!(16&ce)){if(!(64&ce)){ge=ee[(65535&ge)+(F&(1<>>=ce,V-=ce),V<15&&(F+=q[_++]<>>=ce=ge>>>24,V-=ce,!(16&(ce=ge>>>16&255))){if(!(64&ce)){ge=se[(65535&ge)+(F&(1<>>=ce,V-=ce,(ce=E-S)>3,F&=(1<<(V-=Me<<3))-1,f.next_in=_,f.next_out=E,f.avail_in=_>>24&255)+(ye>>>8&65280)+((65280&ye)<<8)+((255&ye)<<24)}function F(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function V(ye){var Ge;return ye&&ye.state?(Ge=ye.state,ye.total_in=ye.total_out=Ge.total=0,ye.msg="",Ge.wrap&&(ye.adler=1&Ge.wrap),Ge.mode=P,Ge.last=0,Ge.havedict=0,Ge.dmax=32768,Ge.head=null,Ge.hold=0,Ge.bits=0,Ge.lencode=Ge.lendyn=new f.Buf32(I),Ge.distcode=Ge.distdyn=new f.Buf32(L),Ge.sane=1,Ge.back=-1,C):z}function ee(ye){var Ge;return ye&&ye.state?((Ge=ye.state).wsize=0,Ge.whave=0,Ge.wnext=0,V(ye)):z}function se(ye,Ge){var q,We;return ye&&ye.state?(We=ye.state,Ge<0?(q=0,Ge=-Ge):(q=1+(Ge>>4),Ge<48&&(Ge&=15)),Ge&&(Ge<8||15=it.wsize?(f.arraySet(it.window,Ge,q-it.wsize,it.wsize,0),it.wnext=0,it.whave=it.wsize):(We<(Tt=it.wsize-it.wnext)&&(Tt=We),f.arraySet(it.window,Ge,q-We,Tt,it.wnext),(We-=Tt)?(f.arraySet(it.window,Ge,q-We,We,0),it.wnext=We,it.whave=it.wsize):(it.wnext+=Tt,it.wnext===it.wsize&&(it.wnext=0),it.whave>>8&255,q.check=n(q.check,Ze,2,0),ve=ie=0,q.mode=2;break}if(q.flags=0,q.head&&(q.head.done=!1),!(1&q.wrap)||(((255&ie)<<8)+(ie>>8))%31){ye.msg="incorrect header check",q.mode=30;break}if((15&ie)!=8){ye.msg="unknown compression method",q.mode=30;break}if(ve-=4,Z=8+(15&(ie>>>=4)),q.wbits===0)q.wbits=Z;else if(Z>q.wbits){ye.msg="invalid window size",q.mode=30;break}q.dmax=1<>8&1),512&q.flags&&(Ze[0]=255&ie,Ze[1]=ie>>>8&255,q.check=n(q.check,Ze,2,0)),ve=ie=0,q.mode=3;case 3:for(;ve<32;){if(Ne===0)break e;Ne--,ie+=We[it++]<>>8&255,Ze[2]=ie>>>16&255,Ze[3]=ie>>>24&255,q.check=n(q.check,Ze,4,0)),ve=ie=0,q.mode=4;case 4:for(;ve<16;){if(Ne===0)break e;Ne--,ie+=We[it++]<>8),512&q.flags&&(Ze[0]=255&ie,Ze[1]=ie>>>8&255,q.check=n(q.check,Ze,2,0)),ve=ie=0,q.mode=5;case 5:if(1024&q.flags){for(;ve<16;){if(Ne===0)break e;Ne--,ie+=We[it++]<>>8&255,q.check=n(q.check,Ze,2,0)),ve=ie=0}else q.head&&(q.head.extra=null);q.mode=6;case 6:if(1024&q.flags&&(Ne<(ue=q.length)&&(ue=Ne),ue&&(q.head&&(Z=q.head.extra_len-q.length,q.head.extra||(q.head.extra=new Array(q.head.extra_len)),f.arraySet(q.head.extra,We,it,ue,Z)),512&q.flags&&(q.check=n(q.check,We,ue,it)),Ne-=ue,it+=ue,q.length-=ue),q.length))break e;q.length=0,q.mode=7;case 7:if(2048&q.flags){if(Ne===0)break e;for(ue=0;Z=We[it+ue++],q.head&&Z&&q.length<65536&&(q.head.name+=String.fromCharCode(Z)),Z&&ue>9&1,q.head.done=!0),ye.adler=q.check=0,q.mode=12;break;case 10:for(;ve<32;){if(Ne===0)break e;Ne--,ie+=We[it++]<>>=7&ve,ve-=7&ve,q.mode=27;break}for(;ve<3;){if(Ne===0)break e;Ne--,ie+=We[it++]<>>=1)){case 0:q.mode=14;break;case 1:if(Me(q),q.mode=20,Ge!==6)break;ie>>>=2,ve-=2;break e;case 2:q.mode=17;break;case 3:ye.msg="invalid block type",q.mode=30}ie>>>=2,ve-=2;break;case 14:for(ie>>>=7&ve,ve-=7&ve;ve<32;){if(Ne===0)break e;Ne--,ie+=We[it++]<>>16^65535)){ye.msg="invalid stored block lengths",q.mode=30;break}if(q.length=65535&ie,ve=ie=0,q.mode=15,Ge===6)break e;case 15:q.mode=16;case 16:if(ue=q.length){if(Ne>>=5,ve-=5,q.ndist=1+(31&ie),ie>>>=5,ve-=5,q.ncode=4+(15&ie),ie>>>=4,ve-=4,286>>=3,ve-=3}for(;q.have<19;)q.lens[pt[q.have++]]=0;if(q.lencode=q.lendyn,q.lenbits=7,nt={bits:q.lenbits},lt=v(0,q.lens,0,19,q.lencode,0,q.work,nt),q.lenbits=nt.bits,lt){ye.msg="invalid code lengths set",q.mode=30;break}q.have=0,q.mode=19;case 19:for(;q.have>>16&255,Nt=65535&_e,!((vt=_e>>>24)<=ve);){if(Ne===0)break e;Ne--,ie+=We[it++]<>>=vt,ve-=vt,q.lens[q.have++]=Nt;else{if(Nt===16){for(Ee=vt+2;ve>>=vt,ve-=vt,q.have===0){ye.msg="invalid bit length repeat",q.mode=30;break}Z=q.lens[q.have-1],ue=3+(3&ie),ie>>>=2,ve-=2}else if(Nt===17){for(Ee=vt+3;ve>>=vt)),ie>>>=3,ve-=3}else{for(Ee=vt+7;ve>>=vt)),ie>>>=7,ve-=7}if(q.have+ue>q.nlen+q.ndist){ye.msg="invalid bit length repeat",q.mode=30;break}for(;ue--;)q.lens[q.have++]=Z}}if(q.mode===30)break;if(q.lens[256]===0){ye.msg="invalid code -- missing end-of-block",q.mode=30;break}if(q.lenbits=9,nt={bits:q.lenbits},lt=v(E,q.lens,0,q.nlen,q.lencode,0,q.work,nt),q.lenbits=nt.bits,lt){ye.msg="invalid literal/lengths set",q.mode=30;break}if(q.distbits=6,q.distcode=q.distdyn,nt={bits:q.distbits},lt=v(S,q.lens,q.nlen,q.ndist,q.distcode,0,q.work,nt),q.distbits=nt.bits,lt){ye.msg="invalid distances set",q.mode=30;break}if(q.mode=20,Ge===6)break e;case 20:q.mode=21;case 21:if(6<=Ne&&258<=Xe){ye.next_out=Bt,ye.avail_out=Xe,ye.next_in=it,ye.avail_in=Ne,q.hold=ie,q.bits=ve,_(ye,Y),Bt=ye.next_out,Tt=ye.output,Xe=ye.avail_out,it=ye.next_in,We=ye.input,Ne=ye.avail_in,ie=q.hold,ve=q.bits,q.mode===12&&(q.back=-1);break}for(q.back=0;It=(_e=q.lencode[ie&(1<>>16&255,Nt=65535&_e,!((vt=_e>>>24)<=ve);){if(Ne===0)break e;Ne--,ie+=We[it++]<>fi)])>>>16&255,Nt=65535&_e,!(fi+(vt=_e>>>24)<=ve);){if(Ne===0)break e;Ne--,ie+=We[it++]<>>=fi,ve-=fi,q.back+=fi}if(ie>>>=vt,ve-=vt,q.back+=vt,q.length=Nt,It===0){q.mode=26;break}if(32&It){q.back=-1,q.mode=12;break}if(64&It){ye.msg="invalid literal/length code",q.mode=30;break}q.extra=15&It,q.mode=22;case 22:if(q.extra){for(Ee=q.extra;ve>>=q.extra,ve-=q.extra,q.back+=q.extra}q.was=q.length,q.mode=23;case 23:for(;It=(_e=q.distcode[ie&(1<>>16&255,Nt=65535&_e,!((vt=_e>>>24)<=ve);){if(Ne===0)break e;Ne--,ie+=We[it++]<>fi)])>>>16&255,Nt=65535&_e,!(fi+(vt=_e>>>24)<=ve);){if(Ne===0)break e;Ne--,ie+=We[it++]<>>=fi,ve-=fi,q.back+=fi}if(ie>>>=vt,ve-=vt,q.back+=vt,64&It){ye.msg="invalid distance code",q.mode=30;break}q.offset=Nt,q.extra=15&It,q.mode=24;case 24:if(q.extra){for(Ee=q.extra;ve>>=q.extra,ve-=q.extra,q.back+=q.extra}if(q.offset>q.dmax){ye.msg="invalid distance too far back",q.mode=30;break}q.mode=25;case 25:if(Xe===0)break e;if(ue=Y-Xe,q.offset>ue){if((ue=q.offset-ue)>q.whave&&q.sane){ye.msg="invalid distance too far back",q.mode=30;break}Qe=ue>q.wnext?(ue-=q.wnext,q.wsize-ue):q.wnext-ue,ue>q.length&&(ue=q.length),wt=q.window}else wt=Tt,Qe=Bt-q.offset,ue=q.length;for(Xele?(ce=Qe[wt+L[Ge]],ve[De+L[Ge]]):(ce=96,0),F=1<>Bt)+(V-=F)]=ge<<24|ce<<16|Me|0,V!==0;);for(F=1<>=1;if(F!==0?(ie&=F-1,ie+=F):ie=0,Ge++,--Y[ye]==0){if(ye===We)break;ye=S[C+L[Ge]]}if(Tt>>7)]}function De(_e,Ze){_e.pending_buf[_e.pending++]=255&Ze,_e.pending_buf[_e.pending++]=Ze>>>8&255}function Y(_e,Ze,pt){_e.bi_valid>D-pt?(_e.bi_buf|=Ze<<_e.bi_valid&65535,De(_e,_e.bi_buf),_e.bi_buf=Ze>>D-_e.bi_valid,_e.bi_valid+=pt-D):(_e.bi_buf|=Ze<<_e.bi_valid&65535,_e.bi_valid+=pt)}function ue(_e,Ze,pt){Y(_e,pt[2*Ze],pt[2*Ze+1])}function Qe(_e,Ze){for(var pt=0;pt|=1&_e,_e>>>=1,pt<<=1,0<--Ze;);return pt>>>1}function wt(_e,Ze,pt){var Ae,Ye,xt=new Array(L+1),kt=0;for(Ae=1;Ae<=L;Ae++)xt[Ae]=kt=kt+pt[Ae-1]<<1;for(Ye=0;Ye<=Ze;Ye++){var ct=_e[2*Ye+1];ct!==0&&(_e[2*Ye]=Qe(xt[ct]++,ct))}}function vt(_e){var Ze;for(Ze=0;Ze>1;1<=pt;pt--)fi(_e,xt,pt);for(Ye=Xt;pt=_e.heap[1],_e.heap[1]=_e.heap[_e.heap_len--],fi(_e,xt,1),Ae=_e.heap[1],_e.heap[--_e.heap_max]=pt,_e.heap[--_e.heap_max]=Ae,xt[2*Ye]=xt[2*pt]+xt[2*Ae],_e.depth[Ye]=(_e.depth[pt]>=_e.depth[Ae]?_e.depth[pt]:_e.depth[Ae])+1,xt[2*pt+1]=xt[2*Ae+1]=Ye,_e.heap[1]=Ye++,fi(_e,xt,1),2<=_e.heap_len;);_e.heap[--_e.heap_max]=_e.heap[1],function(Ti,Wi){var ar,pr,Gr,_t,Ji,xr,Er=Wi.dyn_tree,or=Wi.max_code,zt=Wi.stat_desc.static_tree,bi=Wi.stat_desc.has_stree,wi=Wi.stat_desc.extra_bits,Sr=Wi.stat_desc.extra_base,$r=Wi.stat_desc.max_length,pi=0;for(_t=0;_t<=L;_t++)Ti.bl_count[_t]=0;for(Er[2*Ti.heap[Ti.heap_max]+1]=0,ar=Ti.heap_max+1;ar>=7;Ye>>=1)if(1&Ii&&ct.dyn_ltree[2*Xt]!==0)return p;if(ct.dyn_ltree[18]!==0||ct.dyn_ltree[20]!==0||ct.dyn_ltree[26]!==0)return n;for(Xt=32;Xt>>3,(xt=_e.static_len+3+7>>>3)<=Ye&&(Ye=xt)):Ye=xt=pt+5,pt+4<=Ye&&Ze!==-1?Ee(_e,Ze,pt,Ae):_e.strategy===4||xt===Ye?(Y(_e,2+(Ae?1:0),3),gt(_e,et,ye)):(Y(_e,4+(Ae?1:0),3),function(ct,Xt,Ii,Ti){var Wi;for(Y(ct,Xt-257,5),Y(ct,Ii-1,5),Y(ct,Ti-4,4),Wi=0;Wi>>8&255,_e.pending_buf[_e.d_buf+2*_e.last_lit+1]=255&Ze,_e.pending_buf[_e.l_buf+_e.last_lit]=255&pt,_e.last_lit++,Ze===0?_e.dyn_ltree[2*pt]++:(_e.matches++,Ze--,_e.dyn_ltree[2*(q[pt]+S+1)]++,_e.dyn_dtree[2*ve(Ze)]++),_e.last_lit===_e.lit_bufsize-1},u._tr_align=function(_e){Y(_e,2,3),ue(_e,V,et),function(Ze){Ze.bi_valid===16?(De(Ze,Ze.bi_buf),Ze.bi_buf=0,Ze.bi_valid=0):8<=Ze.bi_valid&&(Ze.pending_buf[Ze.pending++]=255&Ze.bi_buf,Ze.bi_buf>>=8,Ze.bi_valid-=8)}(_e)}},{"../utils/common":41}],53:[function(a,o,u){o.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(a,o,u){(function(f){(function(p,n){if(!p.setImmediate){var _,v,E,S,C=1,z={},P=!1,I=p.document,L=Object.getPrototypeOf&&Object.getPrototypeOf(p);L=L&&L.setTimeout?L:p,_={}.toString.call(p.process)==="[object process]"?function(ee){process.nextTick(function(){F(ee)})}:function(){if(p.postMessage&&!p.importScripts){var ee=!0,se=p.onmessage;return p.onmessage=function(){ee=!1},p.postMessage("","*"),p.onmessage=se,ee}}()?(S="setImmediate$"+Math.random()+"$",p.addEventListener?p.addEventListener("message",V,!1):p.attachEvent("onmessage",V),function(ee){p.postMessage(S+ee,"*")}):p.MessageChannel?((E=new MessageChannel).port1.onmessage=function(ee){F(ee.data)},function(ee){E.port2.postMessage(ee)}):I&&"onreadystatechange"in I.createElement("script")?(v=I.documentElement,function(ee){var se=I.createElement("script");se.onreadystatechange=function(){F(ee),se.onreadystatechange=null,v.removeChild(se),se=null},v.appendChild(se)}):function(ee){setTimeout(F,0,ee)},L.setImmediate=function(ee){typeof ee!="function"&&(ee=new Function(""+ee));for(var se=new Array(arguments.length-1),ne=0;ne"u"?f===void 0?this:f:self)}).call(this,typeof Ho<"u"?Ho:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(Wy);var Ik=Wy.exports;const Ak=rh(Ik);const{document:ms}=ry;function A_(l,i,a){const o=l.slice();return o[30]=i[a],o}function P_(l,i,a){const o=l.slice();return o[33]=i[a],o}function z_(l,i,a){const o=l.slice();return o[36]=i[a],o}function M_(l){let i,a,o=l[14](l[0]),u,f,p;i=new ny({props:{mode:l[3]=="failed"?"error":"info",$$slots:{default:[Bk]},$$scope:{ctx:l}}});let n=o&&B_(l);return{c(){ei(i.$$.fragment),a=ut(),n&&n.c(),u=ut(),f=Be("div"),this.h()},l(_){si(i.$$.fragment,_),a=ht(_),n&&n.l(_),u=ht(_),f=Oe(_,"DIV",{}),Je(f).forEach(X),this.h()},h(){Pt(f,"height","24px")},m(_,v){ti(i,_,v),Fe(_,a,v),n&&n.m(_,v),Fe(_,u,v),Fe(_,f,v),p=!0},p(_,v){const E={};v[0]&8&&(E.mode=_[3]=="failed"?"error":"info"),v[0]&10|v[1]&256&&(E.$$scope={dirty:v,ctx:_}),i.$set(E),v[0]&1&&(o=_[14](_[0])),o?n?(n.p(_,v),v[0]&1&&Ke(n,1)):(n=B_(_),n.c(),Ke(n,1),n.m(u.parentNode,u)):n&&(Vi(),st(n,1,1,()=>{n=null}),$i())},i(_){p||(Ke(i.$$.fragment,_),Ke(n),p=!0)},o(_){st(i.$$.fragment,_),st(n),p=!1},d(_){_&&(X(a),X(u),X(f)),ii(i,_),n&&n.d(_)}}}function D_(l){let i;function a(f,p){return f[1].length===1?zk:Pk}let o=a(l),u=o(l);return{c(){i=Be("p"),u.c()},l(f){i=Oe(f,"P",{});var p=Je(i);u.l(p),p.forEach(X)},m(f,p){Fe(f,i,p),u.m(i,null)},p(f,p){o===(o=a(f))&&u?u.p(f,p):(u.d(1),u=o(f),u&&(u.c(),u.m(i,null)))},d(f){f&&X(i),u.d()}}}function Pk(l){let i,a;function o(p,n){return p[1].length===2?Dk:Mk}let u=o(l),f=u(l);return{c(){i=Ot("The profile below is for people who share "),f.c(),a=Ot(` + of the following characteristics:`)},l(p){i=Ft(p,"The profile below is for people who share "),f.l(p),a=Ft(p,` + of the following characteristics:`)},m(p,n){Fe(p,i,n),f.m(p,n),Fe(p,a,n)},p(p,n){u!==(u=o(p))&&(f.d(1),f=u(p),f&&(f.c(),f.m(a.parentNode,a)))},d(p){p&&(X(i),X(a)),f.d(p)}}}function zk(l){let i;return{c(){i=Ot(`The profile below is for people who share the following + characteristic:`)},l(a){i=Ft(a,`The profile below is for people who share the following + characteristic:`)},m(a,o){Fe(a,i,o)},p:xi,d(a){a&&X(i)}}}function Mk(l){let i;return{c(){i=Ot("all")},l(a){i=Ft(a,"all")},m(a,o){Fe(a,i,o)},d(a){a&&X(i)}}}function Dk(l){let i;return{c(){i=Ot("both")},l(a){i=Ft(a,"both")},m(a,o){Fe(a,i,o)},d(a){a&&X(i)}}}function Lk(l){let i,a,o=ga(l[36].topic)+"",u,f,p=ga(eo(l[36].label))+"",n,_,v,E,S;function C(){return l[16](l[36])}return{c(){i=Be("button"),a=Be("span"),u=Ot(o),f=Ot(": "),n=Ot(p),_=ut(),v=Be("span"),this.h()},l(z){i=Oe(z,"BUTTON",{class:!0});var P=Je(i);a=Oe(P,"SPAN",{class:!0});var I=Je(a);u=Ft(I,o),f=Ft(I,": "),n=Ft(I,p),I.forEach(X),_=ht(P),v=Oe(P,"SPAN",{class:!0}),Je(v).forEach(X),P.forEach(X),this.h()},h(){pe(a,"class","chip-text svelte-1e3ffsh"),pe(v,"class","chip-ready svelte-1e3ffsh"),pe(i,"class","chip svelte-1e3ffsh")},m(z,P){Fe(z,i,P),Te(i,a),Te(a,u),Te(a,f),Te(a,n),Te(i,_),Te(i,v),E||(S=Ms(i,"click",C),E=!0)},p(z,P){l=z,P[0]&2&&o!==(o=ga(l[36].topic)+"")&&vi(u,o),P[0]&2&&p!==(p=ga(eo(l[36].label))+"")&&vi(n,p)},d(z){z&&X(i),E=!1,S()}}}function Rk(l){let i,a,o=ga(l[36].topic)+"",u,f,p=ga(eo(l[36].label))+"",n,_,v;return{c(){i=Be("div"),a=Be("span"),u=Ot(o),f=Ot(": "),n=Ot(p),_=ut(),v=Be("div"),this.h()},l(E){i=Oe(E,"DIV",{class:!0});var S=Je(i);a=Oe(S,"SPAN",{class:!0});var C=Je(a);u=Ft(C,o),f=Ft(C,": "),n=Ft(C,p),C.forEach(X),_=ht(S),v=Oe(S,"DIV",{class:!0}),Je(v).forEach(X),S.forEach(X),this.h()},h(){pe(a,"class","chip-text svelte-1e3ffsh"),pe(v,"class","chip-loader svelte-1e3ffsh"),pe(i,"class","chip chip-pending svelte-1e3ffsh")},m(E,S){Fe(E,i,S),Te(i,a),Te(a,u),Te(a,f),Te(a,n),Te(i,_),Te(i,v)},p(E,S){S[0]&2&&o!==(o=ga(E[36].topic)+"")&&vi(u,o),S[0]&2&&p!==(p=ga(eo(E[36].label))+"")&&vi(n,p)},d(E){E&&X(i)}}}function L_(l){let i;function a(f,p){return f[3]=="loading"?Rk:Lk}let o=a(l),u=o(l);return{c(){u.c(),i=ri()},l(f){u.l(f),i=ri()},m(f,p){u.m(f,p),Fe(f,i,p)},p(f,p){o===(o=a(f))&&u?u.p(f,p):(u.d(1),u=o(f),u&&(u.c(),u.m(i.parentNode,i)))},d(f){f&&X(i),u.d(f)}}}function R_(l){let i,a=`No data is available for the selected variables. Try removing a + variable to see more datasets.`;return{c(){i=Be("p"),i.textContent=a,this.h()},l(o){i=Oe(o,"P",{"data-svelte-h":!0}),dr(i)!=="svelte-1vmdqji"&&(i.textContent=a),this.h()},h(){Pt(i,"margin","1rem 0 0")},m(o,u){Fe(o,i,u)},d(o){o&&X(i)}}}function Bk(l){let i,a,o,u=l[3]!="failed"&&D_(l),f=Mi(l[1]),p=[];for(let _=0;_0,S,T=l[4]&&l[11](l[0]).missingAgeUnder16>0,I,z=v&&z_(),M=T&&M_();return{c(){i=je("strong"),o=Ut(a),u=Ut(` - of `),p=Ut(f),n=Ut(" charts available."),_=gt(),z&&z.c(),S=gt(),M&&M.c(),I=ri()},l(C){i=qe(C,"STRONG",{});var R=Ye(i);o=Vt(R,a),u=Vt(R,` - of `),p=Vt(R,f),n=Vt(R," charts available."),R.forEach(Q),_=_t(C),z&&z.l(C),S=_t(C),M&&M.l(C),I=ri()},m(C,R){Fe(C,i,R),De(i,o),De(i,u),De(i,p),De(i,n),Fe(C,_,R),z&&z.m(C,R),Fe(C,S,R),M&&M.m(C,R),Fe(C,I,R)},p(C,R){R[0]&1&&a!==(a=C[11](C[0]).available+"")&&Ci(o,a),R[0]&1&&f!==(f=C[11](C[0]).total+"")&&Ci(p,f),R[0]&1&&(v=C[11](C[0]).missingBecauseDisclosive>0),v?z||(z=z_(),z.c(),z.m(S.parentNode,S)):z&&(z.d(1),z=null),R[0]&17&&(T=C[4]&&C[11](C[0]).missingAgeUnder16>0),T?M||(M=M_(),M.c(),M.m(I.parentNode,I)):M&&(M.d(1),M=null)},d(C){C&&(Q(i),Q(_),Q(S),Q(I)),z&&z.d(C),M&&M.d(C)}}}function Mk(l){let i,a,o,u;function f(_){l[17](_)}function p(_){l[18](_)}let n={options:$1,clickCallback:l[8],removeCatCallback:l[9],globalSelectedCategories:l[1],disabled:l[3]==="loading"};return l[5]!==void 0&&(n.activeColumn=l[5]),l[6]!==void 0&&(n.activeCategory=l[6]),i=new XS({props:n}),Ja.push(()=>Qo(i,"activeColumn",f)),Ja.push(()=>Qo(i,"activeCategory",p)),{c(){ei(i.$$.fragment)},l(_){si(i.$$.fragment,_)},m(_,v){ti(i,_,v),u=!0},p(_,v){const S={};v[0]&2&&(S.globalSelectedCategories=_[1]),v[0]&8&&(S.disabled=_[3]==="loading"),!a&&v[0]&32&&(a=!0,S.activeColumn=_[5],Yo(()=>a=!1)),!o&&v[0]&64&&(o=!0,S.activeCategory=_[6],Yo(()=>o=!1)),i.$set(S)},i(_){u||(Ge(i.$$.fragment,_),u=!0)},o(_){tt(i.$$.fragment,_),u=!1},d(_){ii(i,_)}}}function Dk(l){let i,a,o=`Select one or more identity characteristics to define a population group, + for ages 0 to 15.`)},m(o,u){Fe(o,i,u),Fe(o,a,u)},d(o){o&&(X(i),X(a))}}}function Ok(l){let i,a=l[11](l[0]).available+"",o,u,f=l[11](l[0]).total+"",p,n,_,v=l[11](l[0]).missingBecauseDisclosive>0,E,S=l[4]&&l[11](l[0]).missingAgeUnder16>0,C,z=v&&O_(),P=S&&F_();return{c(){i=Be("strong"),o=Ot(a),u=Ot(` + of `),p=Ot(f),n=Ot(" charts available."),_=ut(),z&&z.c(),E=ut(),P&&P.c(),C=ri()},l(I){i=Oe(I,"STRONG",{});var L=Je(i);o=Ft(L,a),u=Ft(L,` + of `),p=Ft(L,f),n=Ft(L," charts available."),L.forEach(X),_=ht(I),z&&z.l(I),E=ht(I),P&&P.l(I),C=ri()},m(I,L){Fe(I,i,L),Te(i,o),Te(i,u),Te(i,p),Te(i,n),Fe(I,_,L),z&&z.m(I,L),Fe(I,E,L),P&&P.m(I,L),Fe(I,C,L)},p(I,L){L[0]&1&&a!==(a=I[11](I[0]).available+"")&&vi(o,a),L[0]&1&&f!==(f=I[11](I[0]).total+"")&&vi(p,f),L[0]&1&&(v=I[11](I[0]).missingBecauseDisclosive>0),v?z||(z=O_(),z.c(),z.m(E.parentNode,E)):z&&(z.d(1),z=null),L[0]&17&&(S=I[4]&&I[11](I[0]).missingAgeUnder16>0),S?P||(P=F_(),P.c(),P.m(C.parentNode,C)):P&&(P.d(1),P=null)},d(I){I&&(X(i),X(_),X(E),X(C)),z&&z.d(I),P&&P.d(I)}}}function Fk(l){let i,a,o,u;function f(_){l[17](_)}function p(_){l[18](_)}let n={options:H1,clickCallback:l[8],removeCatCallback:l[9],globalSelectedCategories:l[1],disabled:l[3]==="loading"};return l[5]!==void 0&&(n.activeColumn=l[5]),l[6]!==void 0&&(n.activeCategory=l[6]),i=new iS({props:n}),Ja.push(()=>Qo(i,"activeColumn",f)),Ja.push(()=>Qo(i,"activeCategory",p)),{c(){ei(i.$$.fragment)},l(_){si(i.$$.fragment,_)},m(_,v){ti(i,_,v),u=!0},p(_,v){const E={};v[0]&2&&(E.globalSelectedCategories=_[1]),v[0]&8&&(E.disabled=_[3]==="loading"),!a&&v[0]&32&&(a=!0,E.activeColumn=_[5],Yo(()=>a=!1)),!o&&v[0]&64&&(o=!0,E.activeCategory=_[6],Yo(()=>o=!1)),i.$set(E)},i(_){u||(Ke(i.$$.fragment,_),u=!0)},o(_){st(i.$$.fragment,_),u=!1},d(_){ii(i,_)}}}function Nk(l){let i,a,o=`Select one or more identity characteristics to define a population group, for example people whose main language is Spanish or people born in the UK who are disabled under the Equality Act. Once selected, you will see how your selected group compares to the - whole population of England and Wales, based on Census 2021 data.`,u,f,p,n,_,v=l[1][0]&&T_(l);function S(I){l[19](I)}let T={title:l[1][0]?l[1][2]?"Change selected characteristics":"Add another characteristic":"Start creating profile",$$slots:{default:[Mk]},$$scope:{ctx:l}};return l[2]!==void 0&&(T.open=l[2]),p=new yk({props:T}),Ja.push(()=>Qo(p,"open",S)),{c(){i=je("div"),a=je("p"),a.innerHTML=o,u=gt(),v&&v.c(),f=gt(),ei(p.$$.fragment),this.h()},l(I){i=qe(I,"DIV",{slot:!0});var z=Ye(i);a=qe(z,"P",{class:!0,"data-svelte-h":!0}),Cr(a)!=="svelte-4suibz"&&(a.innerHTML=o),u=_t(z),v&&v.l(z),f=_t(z),si(p.$$.fragment,z),z.forEach(Q),this.h()},h(){me(a,"class","subtitle svelte-1e3ffsh"),me(i,"slot","after")},m(I,z){Fe(I,i,z),De(i,a),De(i,u),v&&v.m(i,null),De(i,f),ti(p,i,null),_=!0},p(I,z){I[1][0]?v?(v.p(I,z),z[0]&2&&Ge(v,1)):(v=T_(I),v.c(),Ge(v,1),v.m(i,f)):v&&(Vi(),tt(v,1,1,()=>{v=null}),$i());const M={};z[0]&2&&(M.title=I[1][0]?I[1][2]?"Change selected characteristics":"Add another characteristic":"Start creating profile"),z[0]&106|z[1]&256&&(M.$$scope={dirty:z,ctx:I}),!n&&z[0]&4&&(n=!0,M.open=I[2],Yo(()=>n=!1)),p.$set(M)},i(I){_||(Ge(v),Ge(p.$$.fragment,I),_=!0)},o(I){tt(v),tt(p.$$.fragment,I),_=!1},d(I){I&&Q(i),v&&v.d(),ii(p)}}}function D_(l){let i,a,o=Tc(l[0]),u,f,p,n,_,v;i=new jf({props:{title:"Demographics",height:"auto",$$slots:{default:[Bk]},$$scope:{ctx:l}}});let S=o&&R_(l);return p=new wv({props:{$$slots:{default:[Zk]},$$scope:{ctx:l}}}),_=new kv({props:{title:"Share this profile"}}),{c(){ei(i.$$.fragment),a=gt(),S&&S.c(),u=gt(),f=je("div"),ei(p.$$.fragment),n=gt(),ei(_.$$.fragment),this.h()},l(T){si(i.$$.fragment,T),a=_t(T),S&&S.l(T),u=_t(T),f=qe(T,"DIV",{class:!0});var I=Ye(f);si(p.$$.fragment,I),n=_t(I),si(_.$$.fragment,I),I.forEach(Q),this.h()},h(){me(f,"class","hide-when-printing svelte-1e3ffsh")},m(T,I){ti(i,T,I),Fe(T,a,I),S&&S.m(T,I),Fe(T,u,I),Fe(T,f,I),ti(p,f,null),De(f,n),ti(_,f,null),v=!0},p(T,I){const z={};I[0]&3|I[1]&256&&(z.$$scope={dirty:I,ctx:T}),i.$set(z),I[0]&1&&(o=Tc(T[0])),o?S?(S.p(T,I),I[0]&1&&Ge(S,1)):(S=R_(T),S.c(),Ge(S,1),S.m(u.parentNode,u)):S&&(Vi(),tt(S,1,1,()=>{S=null}),$i());const M={};I[0]&1|I[1]&256&&(M.$$scope={dirty:I,ctx:T}),p.$set(M)},i(T){v||(Ge(i.$$.fragment,T),Ge(S),Ge(p.$$.fragment,T),Ge(_.$$.fragment,T),v=!0)},o(T){tt(i.$$.fragment,T),tt(S),tt(p.$$.fragment,T),tt(_.$$.fragment,T),v=!1},d(T){T&&(Q(a),Q(u),Q(f)),ii(i,T),S&&S.d(T),ii(p),ii(_)}}}function Lk(l){let i;return{c(){i=Ut("Number of people, age and sex compared to the population as a whole.")},l(a){i=Vt(a,"Number of people, age and sex compared to the population as a whole.")},m(a,o){Fe(a,i,o)},d(a){a&&Q(i)}}}function Rk(l){let i,a;return i=new Uy({props:{$$slots:{default:[Lk]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u[1]&256&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function L_(l){let i,a;return i=new Ny({props:{title:"Sex",table:{code:"sex",key:"Sex"},data:l[0],chart_type:l[7]}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u[0]&1&&(f.data=o[0]),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function Bk(l){let i,a,o,u,f,p,n=!l[1].map(V_).includes("sex")&&l[0].selected.residents.sex.values!=="blocked",_,v;i=new Ps({props:{colspan:3,noBackground:!0,$$slots:{default:[Rk]},$$scope:{ctx:l}}}),o=new KE({props:{data:l[0]}}),f=new hk({props:{data:l[0],selected:l[1]}});let S=n&&L_(l);return{c(){ei(i.$$.fragment),a=gt(),ei(o.$$.fragment),u=gt(),ei(f.$$.fragment),p=gt(),S&&S.c(),_=ri()},l(T){si(i.$$.fragment,T),a=_t(T),si(o.$$.fragment,T),u=_t(T),si(f.$$.fragment,T),p=_t(T),S&&S.l(T),_=ri()},m(T,I){ti(i,T,I),Fe(T,a,I),ti(o,T,I),Fe(T,u,I),ti(f,T,I),Fe(T,p,I),S&&S.m(T,I),Fe(T,_,I),v=!0},p(T,I){const z={};I[1]&256&&(z.$$scope={dirty:I,ctx:T}),i.$set(z);const M={};I[0]&1&&(M.data=T[0]),o.$set(M);const C={};I[0]&1&&(C.data=T[0]),I[0]&2&&(C.selected=T[1]),f.$set(C),I[0]&3&&(n=!T[1].map(V_).includes("sex")&&T[0].selected.residents.sex.values!=="blocked"),n?S?(S.p(T,I),I[0]&3&&Ge(S,1)):(S=L_(T),S.c(),Ge(S,1),S.m(_.parentNode,_)):S&&(Vi(),tt(S,1,1,()=>{S=null}),$i())},i(T){v||(Ge(i.$$.fragment,T),Ge(o.$$.fragment,T),Ge(f.$$.fragment,T),Ge(S),v=!0)},o(T){tt(i.$$.fragment,T),tt(o.$$.fragment,T),tt(f.$$.fragment,T),tt(S),v=!1},d(T){T&&(Q(a),Q(u),Q(p),Q(_)),ii(i,T),ii(o,T),ii(f,T),S&&S.d(T)}}}function R_(l){let i,a,o,u;i=new DE({props:{data:l[0],mapStyle:O1,mapBounds:F1,maxBounds:N1,ladBounds:mc,selected:l[1],colors:Wo}});let f=Ni(Ko[0].tablesCategorised),p=[];for(let _=0;_tt(p[_],1,1,()=>{p[_]=null});return{c(){ei(i.$$.fragment),a=gt();for(let _=0;_tt(_[S],1,1,()=>{_[S]=null});return{c(){ei(i.$$.fragment),a=gt(),p&&p.c(),o=gt();for(let S=0;S<_.length;S+=1)_[S].c();u=gt()},l(S){si(i.$$.fragment,S),a=_t(S),p&&p.l(S),o=_t(S);for(let T=0;T<_.length;T+=1)_[T].l(S);u=_t(S)},m(S,T){ti(i,S,T),Fe(S,a,T),p&&p.m(S,T),Fe(S,o,T);for(let I=0;I<_.length;I+=1)_[I]&&_[I].m(S,T);Fe(S,u,T),f=!0},p(S,T){const I={};if(T[1]&256&&(I.$$scope={dirty:T,ctx:S}),i.$set(I),T[0]&129){n=Ni(S[30].tables.filter(S[20]));let z;for(z=0;z{u=null}),$i())},i(f){o||(Ge(u),o=!0)},o(f){tt(u),o=!1},d(f){f&&Q(a),u&&u.d(f)}}}function jk(l){let i;return{c(){i=Ut("Print profile")},l(a){i=Vt(a,"Print profile")},m(a,o){Fe(a,i,o)},d(a){a&&Q(i)}}}function N_(l){let i,a;return i=new qf({props:{variant:"secondary",icon:"download",$$slots:{default:[qk]},$$scope:{ctx:l}}}),i.$on("click",l[21]),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u[1]&256&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ge(i.$$.fragment,o),a=!0)},o(o){tt(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function qk(l){let i;return{c(){i=Ut("Download data (ODS, <100 kB)")},l(a){i=Vt(a,"Download data (ODS, <100 kB)")},m(a,o){Fe(a,i,o)},d(a){a&&Q(i)}}}function Zk(l){let i,a="Use this profile",o,u,f,p,n=Tc(l[0]),_;f=new qf({props:{variant:"secondary",icon:"print",$$slots:{default:[jk]},$$scope:{ctx:l}}}),f.$on("click",l[13]);let v=n&&N_(l);return{c(){i=je("h2"),i.textContent=a,o=gt(),u=je("div"),ei(f.$$.fragment),p=gt(),v&&v.c(),this.h()},l(S){i=qe(S,"H2",{class:!0,"data-svelte-h":!0}),Cr(i)!=="svelte-1in0clm"&&(i.textContent=a),o=_t(S),u=qe(S,"DIV",{class:!0});var T=Ye(u);si(f.$$.fragment,T),p=_t(T),v&&v.l(T),T.forEach(Q),this.h()},h(){me(i,"class","ons-u-fs-r--b ons-u-mb-xs"),me(u,"class","use-this-profile-buttons")},m(S,T){Fe(S,i,T),Fe(S,o,T),Fe(S,u,T),ti(f,u,null),De(u,p),v&&v.m(u,null),_=!0},p(S,T){const I={};T[1]&256&&(I.$$scope={dirty:T,ctx:S}),f.$set(I),T[0]&1&&(n=Tc(S[0])),n?v?(v.p(S,T),T[0]&1&&Ge(v,1)):(v=N_(S),v.c(),Ge(v,1),v.m(u,null)):v&&(Vi(),tt(v,1,1,()=>{v=null}),$i())},i(S){_||(Ge(f.$$.fragment,S),Ge(v),_=!0)},o(S){tt(f.$$.fragment,S),tt(v),_=!1},d(S){S&&(Q(i),Q(o),Q(u)),ii(f),v&&v.d()}}}function Gk(l){let i,a,o,u,f,p,n,_,v,S,T,I,z,M,C,R;T=new iv({props:{links:[{label:"Census",href:"/census"},{label:"Create a population group profile"}]}}),z=new Ov({props:{title:"Create a population group profile",$$slots:{after:[Dk]},$$scope:{ctx:l}}});let D=l[3]=="success"&&l[1].length>0&&D_(l);return{c(){i=je("meta"),a=je("meta"),o=je("meta"),u=je("meta"),f=je("meta"),p=je("meta"),n=je("meta"),_=je("meta"),v=je("link"),S=gt(),ei(T.$$.fragment),I=gt(),ei(z.$$.fragment),M=gt(),D&&D.c(),C=ri(),this.h()},l(F){const j=H_("svelte-w3mxea",ms.head);i=qe(j,"META",{property:!0,content:!0}),a=qe(j,"META",{property:!0,content:!0}),o=qe(j,"META",{property:!0,content:!0}),u=qe(j,"META",{property:!0,content:!0}),f=qe(j,"META",{name:!0,content:!0}),p=qe(j,"META",{property:!0,content:!0}),n=qe(j,"META",{name:!0,content:!0}),_=qe(j,"META",{property:!0,content:!0}),v=qe(j,"LINK",{rel:!0,href:!0}),j.forEach(Q),S=_t(F),si(T.$$.fragment,F),I=_t(F),si(z.$$.fragment,F),M=_t(F),D&&D.l(F),C=ri(),this.h()},h(){ms.title="Create a population group profile - Census 2021 - ONS",me(i,"property","og:title"),me(i,"content","Create a population group profile - Census 2021"),me(a,"property","og:type"),me(a,"content","website"),me(o,"property","og:image"),me(o,"content","https://www.ons.gov.uk"+Xo+"/img/og.png"),me(u,"property","og:image:type"),me(u,"content","image/png"),me(f,"name","twitter:card"),me(f,"content","summary_large_image"),me(p,"property","og:description"),me(p,"content","Select multiple datasets to define a population group based on Census 2021 England and Wales data."),me(n,"name","description"),me(n,"content","Select multiple datasets to define a population group based on Census 2021 England and Wales data."),me(_,"property","og:url"),me(_,"content","https://www.ons.gov.uk"+Xo),me(v,"rel","canonical"),me(v,"href","https://www.ons.gov.uk"+Xo)},m(F,j){De(ms.head,i),De(ms.head,a),De(ms.head,o),De(ms.head,u),De(ms.head,f),De(ms.head,p),De(ms.head,n),De(ms.head,_),De(ms.head,v),Fe(F,S,j),ti(T,F,j),Fe(F,I,j),ti(z,F,j),Fe(F,M,j),D&&D.m(F,j),Fe(F,C,j),R=!0},p(F,j){const ee={};j[0]&127|j[1]&256&&(ee.$$scope={dirty:j,ctx:F}),z.$set(ee),F[3]=="success"&&F[1].length>0?D?(D.p(F,j),j[0]&10&&Ge(D,1)):(D=D_(F),D.c(),Ge(D,1),D.m(C.parentNode,C)):D&&(Vi(),tt(D,1,1,()=>{D=null}),$i())},i(F){R||(Ge(T.$$.fragment,F),Ge(z.$$.fragment,F),Ge(D),R=!0)},o(F){tt(T.$$.fragment,F),tt(z.$$.fragment,F),tt(D),R=!1},d(F){F&&(Q(S),Q(I),Q(M),Q(C)),Q(i),Q(a),Q(o),Q(u),Q(f),Q(p),Q(n),Q(_),Q(v),ii(T,F),ii(z,F),D&&D.d(F)}}}let Wk="light";function Hk(l){let i=[];l.forEach(o=>i.push(o[0]));const a=l.flat().pop();return(l.length===1||a!=i[i.length-1])&&i.push(a),i}function U_(l,i,a){for(const o of i){const u=l.selected.residents[o].values;u===void 0||(u==="blocked"?++a.missingBecauseDisclosive:u.percent[0]==null?++a.missingAgeUnder16:++a.available)}}function Tc(l){return l.selected.total_pop.count!=null&&l.selected.total_pop.count>=100}const V_=l=>l.key;function Kk(l,i,a){let o;eh(l,q1,q=>a(23,o=q));let{data:u}=i;Ka("theme",U1[Wk]);let f=[],p=!1,n="success",_=!1,v=PS,S=null,T=null;function I(){bS(`${Xo}?${f.map(q=>`${q.key}=${q.code}`).join("&")}`,{noScroll:!0,keepFocus:!0})}function z(q,He){a(1,f=[...f.filter(Rt=>Rt.topic!==q.shortLabel),{topic:q.shortLabel,key:q.key,...He}]),vf({event:"variableSelect",variable:q.shortLabel,category:He.label,count:f.length}),I()}function M(q){a(1,f=f.filter(He=>He.topic!==q.shortLabel)),I()}function C(q){a(1,f=f.filter(He=>He.topic!=q)),I()}function R(q){let He={available:0,missingBecauseDisclosive:0,missingAgeUnder16:0};for(const Rt of Ko[0].tablesCategorised)U_(q,Rt.tables.map(at=>at.code),He);return U_(q,["sex","resident_age_18b"],He),He.total=He.available+He.missingAgeUnder16+He.missingBecauseDisclosive,He}function D(q){vf({event:"fileDownload",fileExtension:"ods",selection:f.map(at=>`${at.topic}: ${at.label}`)});let He=yS(q,Ko,f);const Rt=new Sk;for(let{filename:at,contents:Wt}of He)Rt.file(at,Wt,{compression:at==="mimetype"?"STORE":"DEFLATE"});Rt.generateAsync({type:"blob"}).then(at=>{let Wt=new Blob([at],{type:"application/vnd.oasis.opendocument.spreadsheet"}),st=(window.URL||window.webkitURL||window).createObjectURL(Wt),ae=document.createElement("a");ae.download="population-profile-"+f.map(xe=>`${xe.key}-${xe.code}`).join("-")+".ods",ae.href=st,ae.style.display="none",document.body.appendChild(ae),ae.click(),document.body.removeChild(ae)})}function F(){vf({event:"pagePrint",selection:f.map(q=>`${q.topic}: ${q.label}`)}),print()}function j(q){a(0,u.selected=q.data,u),a(0,u.selected.total_pop=q.total_pop,u),a(0,u.geoPerc=[],u);let He;u.geoCodesAndNames.forEach(({code:at,name:Wt})=>{let ot=f.length===0?100:q.mapData[at]!=null?q.mapData[at][1]:null,st=f.length===0?-1:q.mapData[at]!=null?q.mapData[at][0]:null;u.geoPerc.push({code:at,name:Wt,value:ot,count:st})});let Rt=u.geoPerc.map(at=>at.value).filter(at=>at!=null);if(He=Rt.length===0?null:kS(Rt,Math.min(5,Rt.length)),!He)u.geoPerc.forEach(at=>at.color=Wo.nodata),a(0,u.geoBreaks=[0,100],u);else if(f.length===0)u.geoPerc.forEach(at=>at.color=Wo.seq[4]),a(0,u.geoBreaks=[100,100],u);else{let at=Hk(He);u.geoPerc.forEach(Wt=>Wt.color=Wt.value!=null?pS(Wt.value,at,Wo.seq):Wo.nodata),a(0,u.geoBreaks=at,u)}f.length,a(3,n=u.selected.total_pop.count==null?"failed":"success")}function ee(){a(3,n="loading"),a(4,_=f&&f.some(q=>["Aged 4 years and under","Aged 5 to 9 years","Aged 10 to 14 years","Aged 15 years and under"].includes(q.label))),Ly(Ko,f).then(j)}function oe(){a(1,f=[]);for(let q of o.url.searchParams.entries()){let He=V1.find(at=>at.key==q[0]);if(!He)continue;let Rt=He.cats.find(at=>at.code==q[1]);Rt&&f.push({topic:He.shortLabel,key:He.key,...Rt})}ee()}function se(q){return q.selected!=null&&R(q).available!=R(q).total&&Tc(q)}wS(()=>{oe(),a(2,p=!1),a(5,S=null),a(6,T=null)});const ne=q=>Nf(q.code,u),re=q=>C(q.topic);function ve(q){S=q,a(5,S)}function ze(q){T=q,a(6,T)}function nt(q){p=q,a(2,p)}const be=q=>Nf(q.code,u),Ke=()=>D(u);return l.$$set=q=>{"data"in q&&a(0,u=q.data)},l.$$.update=()=>{l.$$.dirty[0]&2&&console.log("selected",f)},[u,f,p,n,_,S,T,v,z,M,C,R,D,F,se,ne,re,ve,ze,nt,be,Ke]}class sT extends qi{constructor(i){super(),Zi(this,i,Kk,Gk,Ui,{data:0},null,[-1,-1])}}export{sT as component,rT as universal}; + whole population of England and Wales, based on Census 2021 data.`,u,f,p,n,_,v=l[1][0]&&M_(l);function E(C){l[19](C)}let S={title:l[1][0]?l[1][2]?"Change selected characteristics":"Add another characteristic":"Start creating profile",$$slots:{default:[Fk]},$$scope:{ctx:l}};return l[2]!==void 0&&(S.open=l[2]),p=new Sk({props:S}),Ja.push(()=>Qo(p,"open",E)),{c(){i=Be("div"),a=Be("p"),a.innerHTML=o,u=ut(),v&&v.c(),f=ut(),ei(p.$$.fragment),this.h()},l(C){i=Oe(C,"DIV",{slot:!0});var z=Je(i);a=Oe(z,"P",{class:!0,"data-svelte-h":!0}),dr(a)!=="svelte-4suibz"&&(a.innerHTML=o),u=ht(z),v&&v.l(z),f=ht(z),si(p.$$.fragment,z),z.forEach(X),this.h()},h(){pe(a,"class","subtitle svelte-1e3ffsh"),pe(i,"slot","after")},m(C,z){Fe(C,i,z),Te(i,a),Te(i,u),v&&v.m(i,null),Te(i,f),ti(p,i,null),_=!0},p(C,z){C[1][0]?v?(v.p(C,z),z[0]&2&&Ke(v,1)):(v=M_(C),v.c(),Ke(v,1),v.m(i,f)):v&&(Vi(),st(v,1,1,()=>{v=null}),$i());const P={};z[0]&2&&(P.title=C[1][0]?C[1][2]?"Change selected characteristics":"Add another characteristic":"Start creating profile"),z[0]&106|z[1]&256&&(P.$$scope={dirty:z,ctx:C}),!n&&z[0]&4&&(n=!0,P.open=C[2],Yo(()=>n=!1)),p.$set(P)},i(C){_||(Ke(v),Ke(p.$$.fragment,C),_=!0)},o(C){st(v),st(p.$$.fragment,C),_=!1},d(C){C&&X(i),v&&v.d(),ii(p)}}}function N_(l){let i,a,o=Tc(l[0]),u,f,p,n,_,v;i=new jf({props:{title:"Demographics",height:"auto",$$slots:{default:[$k]},$$scope:{ctx:l}}});let E=o&&V_(l);return p=new Cv({props:{$$slots:{default:[Jk]},$$scope:{ctx:l}}}),_=new zv({props:{title:"Share this profile"}}),{c(){ei(i.$$.fragment),a=ut(),E&&E.c(),u=ut(),f=Be("div"),ei(p.$$.fragment),n=ut(),ei(_.$$.fragment),this.h()},l(S){si(i.$$.fragment,S),a=ht(S),E&&E.l(S),u=ht(S),f=Oe(S,"DIV",{class:!0});var C=Je(f);si(p.$$.fragment,C),n=ht(C),si(_.$$.fragment,C),C.forEach(X),this.h()},h(){pe(f,"class","hide-when-printing svelte-1e3ffsh")},m(S,C){ti(i,S,C),Fe(S,a,C),E&&E.m(S,C),Fe(S,u,C),Fe(S,f,C),ti(p,f,null),Te(f,n),ti(_,f,null),v=!0},p(S,C){const z={};C[0]&3|C[1]&256&&(z.$$scope={dirty:C,ctx:S}),i.$set(z),C[0]&1&&(o=Tc(S[0])),o?E?(E.p(S,C),C[0]&1&&Ke(E,1)):(E=V_(S),E.c(),Ke(E,1),E.m(u.parentNode,u)):E&&(Vi(),st(E,1,1,()=>{E=null}),$i());const P={};C[0]&1|C[1]&256&&(P.$$scope={dirty:C,ctx:S}),p.$set(P)},i(S){v||(Ke(i.$$.fragment,S),Ke(E),Ke(p.$$.fragment,S),Ke(_.$$.fragment,S),v=!0)},o(S){st(i.$$.fragment,S),st(E),st(p.$$.fragment,S),st(_.$$.fragment,S),v=!1},d(S){S&&(X(a),X(u),X(f)),ii(i,S),E&&E.d(S),ii(p),ii(_)}}}function Uk(l){let i;return{c(){i=Ot("Number of people, age and sex compared to the population as a whole.")},l(a){i=Ft(a,"Number of people, age and sex compared to the population as a whole.")},m(a,o){Fe(a,i,o)},d(a){a&&X(i)}}}function Vk(l){let i,a;return i=new Gy({props:{$$slots:{default:[Uk]},$$scope:{ctx:l}}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u[1]&256&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function U_(l){let i,a;return i=new Zy({props:{title:"Sex",table:{code:"sex",key:"Sex"},data:l[0],chart_type:l[7]}}),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u[0]&1&&(f.data=o[0]),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function $k(l){let i,a,o,u,f,p,n=!l[1].map(W_).includes("sex")&&l[0].selected.residents.sex.values!=="blocked",_,v;i=new Ps({props:{colspan:3,noBackground:!0,$$slots:{default:[Vk]},$$scope:{ctx:l}}}),o=new tk({props:{data:l[0]}}),f=new _k({props:{data:l[0],selected:l[1]}});let E=n&&U_(l);return{c(){ei(i.$$.fragment),a=ut(),ei(o.$$.fragment),u=ut(),ei(f.$$.fragment),p=ut(),E&&E.c(),_=ri()},l(S){si(i.$$.fragment,S),a=ht(S),si(o.$$.fragment,S),u=ht(S),si(f.$$.fragment,S),p=ht(S),E&&E.l(S),_=ri()},m(S,C){ti(i,S,C),Fe(S,a,C),ti(o,S,C),Fe(S,u,C),ti(f,S,C),Fe(S,p,C),E&&E.m(S,C),Fe(S,_,C),v=!0},p(S,C){const z={};C[1]&256&&(z.$$scope={dirty:C,ctx:S}),i.$set(z);const P={};C[0]&1&&(P.data=S[0]),o.$set(P);const I={};C[0]&1&&(I.data=S[0]),C[0]&2&&(I.selected=S[1]),f.$set(I),C[0]&3&&(n=!S[1].map(W_).includes("sex")&&S[0].selected.residents.sex.values!=="blocked"),n?E?(E.p(S,C),C[0]&3&&Ke(E,1)):(E=U_(S),E.c(),Ke(E,1),E.m(_.parentNode,_)):E&&(Vi(),st(E,1,1,()=>{E=null}),$i())},i(S){v||(Ke(i.$$.fragment,S),Ke(o.$$.fragment,S),Ke(f.$$.fragment,S),Ke(E),v=!0)},o(S){st(i.$$.fragment,S),st(o.$$.fragment,S),st(f.$$.fragment,S),st(E),v=!1},d(S){S&&(X(a),X(u),X(p),X(_)),ii(i,S),ii(o,S),ii(f,S),E&&E.d(S)}}}function V_(l){let i,a,o,u;i=new NS({props:{data:l[0],mapStyle:j1,mapBounds:q1,maxBounds:Z1,ladBounds:mc,selected:l[1],colors:Wo}});let f=Mi(Ko[0].tablesCategorised),p=[];for(let _=0;_st(p[_],1,1,()=>{p[_]=null});return{c(){ei(i.$$.fragment),a=ut();for(let _=0;_st(_[E],1,1,()=>{_[E]=null});return{c(){ei(i.$$.fragment),a=ut(),p&&p.c(),o=ut();for(let E=0;E<_.length;E+=1)_[E].c();u=ut()},l(E){si(i.$$.fragment,E),a=ht(E),p&&p.l(E),o=ht(E);for(let S=0;S<_.length;S+=1)_[S].l(E);u=ht(E)},m(E,S){ti(i,E,S),Fe(E,a,S),p&&p.m(E,S),Fe(E,o,S);for(let C=0;C<_.length;C+=1)_[C]&&_[C].m(E,S);Fe(E,u,S),f=!0},p(E,S){const C={};if(S[1]&256&&(C.$$scope={dirty:S,ctx:E}),i.$set(C),S[0]&129){n=Mi(E[30].tables.filter(E[20]));let z;for(z=0;z{u=null}),$i())},i(f){o||(Ke(u),o=!0)},o(f){st(u),o=!1},d(f){f&&X(a),u&&u.d(f)}}}function Kk(l){let i;return{c(){i=Ot("Print profile")},l(a){i=Ft(a,"Print profile")},m(a,o){Fe(a,i,o)},d(a){a&&X(i)}}}function Z_(l){let i,a;return i=new qf({props:{variant:"secondary",icon:"download",$$slots:{default:[Xk]},$$scope:{ctx:l}}}),i.$on("click",l[21]),{c(){ei(i.$$.fragment)},l(o){si(i.$$.fragment,o)},m(o,u){ti(i,o,u),a=!0},p(o,u){const f={};u[1]&256&&(f.$$scope={dirty:u,ctx:o}),i.$set(f)},i(o){a||(Ke(i.$$.fragment,o),a=!0)},o(o){st(i.$$.fragment,o),a=!1},d(o){ii(i,o)}}}function Xk(l){let i;return{c(){i=Ot("Download data (ODS, <100 kB)")},l(a){i=Ft(a,"Download data (ODS, <100 kB)")},m(a,o){Fe(a,i,o)},d(a){a&&X(i)}}}function Jk(l){let i,a="Use this profile",o,u,f,p,n=Tc(l[0]),_;f=new qf({props:{variant:"secondary",icon:"print",$$slots:{default:[Kk]},$$scope:{ctx:l}}}),f.$on("click",l[13]);let v=n&&Z_(l);return{c(){i=Be("h2"),i.textContent=a,o=ut(),u=Be("div"),ei(f.$$.fragment),p=ut(),v&&v.c(),this.h()},l(E){i=Oe(E,"H2",{class:!0,"data-svelte-h":!0}),dr(i)!=="svelte-1in0clm"&&(i.textContent=a),o=ht(E),u=Oe(E,"DIV",{class:!0});var S=Je(u);si(f.$$.fragment,S),p=ht(S),v&&v.l(S),S.forEach(X),this.h()},h(){pe(i,"class","ons-u-fs-r--b ons-u-mb-xs"),pe(u,"class","use-this-profile-buttons")},m(E,S){Fe(E,i,S),Fe(E,o,S),Fe(E,u,S),ti(f,u,null),Te(u,p),v&&v.m(u,null),_=!0},p(E,S){const C={};S[1]&256&&(C.$$scope={dirty:S,ctx:E}),f.$set(C),S[0]&1&&(n=Tc(E[0])),n?v?(v.p(E,S),S[0]&1&&Ke(v,1)):(v=Z_(E),v.c(),Ke(v,1),v.m(u,null)):v&&(Vi(),st(v,1,1,()=>{v=null}),$i())},i(E){_||(Ke(f.$$.fragment,E),Ke(v),_=!0)},o(E){st(f.$$.fragment,E),st(v),_=!1},d(E){E&&(X(i),X(o),X(u)),ii(f),v&&v.d()}}}function Yk(l){let i,a,o,u,f,p,n,_,v,E,S,C,z,P,I,L;S=new lv({props:{links:[{label:"Census",href:"/census"},{label:"Create a population group profile"}]}}),z=new jv({props:{title:"Create a population group profile",$$slots:{after:[Nk]},$$scope:{ctx:l}}});let D=l[3]=="success"&&l[1].length>0&&N_(l);return{c(){i=Be("meta"),a=Be("meta"),o=Be("meta"),u=Be("meta"),f=Be("meta"),p=Be("meta"),n=Be("meta"),_=Be("meta"),v=Be("link"),E=ut(),ei(S.$$.fragment),C=ut(),ei(z.$$.fragment),P=ut(),D&&D.c(),I=ri(),this.h()},l(F){const V=ey("svelte-w3mxea",ms.head);i=Oe(V,"META",{property:!0,content:!0}),a=Oe(V,"META",{property:!0,content:!0}),o=Oe(V,"META",{property:!0,content:!0}),u=Oe(V,"META",{property:!0,content:!0}),f=Oe(V,"META",{name:!0,content:!0}),p=Oe(V,"META",{property:!0,content:!0}),n=Oe(V,"META",{name:!0,content:!0}),_=Oe(V,"META",{property:!0,content:!0}),v=Oe(V,"LINK",{rel:!0,href:!0}),V.forEach(X),E=ht(F),si(S.$$.fragment,F),C=ht(F),si(z.$$.fragment,F),P=ht(F),D&&D.l(F),I=ri(),this.h()},h(){ms.title="Create a population group profile - Census 2021 - ONS",pe(i,"property","og:title"),pe(i,"content","Create a population group profile - Census 2021"),pe(a,"property","og:type"),pe(a,"content","website"),pe(o,"property","og:image"),pe(o,"content","https://www.ons.gov.uk"+Xo+"/img/og.png"),pe(u,"property","og:image:type"),pe(u,"content","image/png"),pe(f,"name","twitter:card"),pe(f,"content","summary_large_image"),pe(p,"property","og:description"),pe(p,"content","Select multiple datasets to define a population group based on Census 2021 England and Wales data."),pe(n,"name","description"),pe(n,"content","Select multiple datasets to define a population group based on Census 2021 England and Wales data."),pe(_,"property","og:url"),pe(_,"content","https://www.ons.gov.uk"+Xo),pe(v,"rel","canonical"),pe(v,"href","https://www.ons.gov.uk"+Xo)},m(F,V){Te(ms.head,i),Te(ms.head,a),Te(ms.head,o),Te(ms.head,u),Te(ms.head,f),Te(ms.head,p),Te(ms.head,n),Te(ms.head,_),Te(ms.head,v),Fe(F,E,V),ti(S,F,V),Fe(F,C,V),ti(z,F,V),Fe(F,P,V),D&&D.m(F,V),Fe(F,I,V),L=!0},p(F,V){const ee={};V[0]&127|V[1]&256&&(ee.$$scope={dirty:V,ctx:F}),z.$set(ee),F[3]=="success"&&F[1].length>0?D?(D.p(F,V),V[0]&10&&Ke(D,1)):(D=N_(F),D.c(),Ke(D,1),D.m(I.parentNode,I)):D&&(Vi(),st(D,1,1,()=>{D=null}),$i())},i(F){L||(Ke(S.$$.fragment,F),Ke(z.$$.fragment,F),Ke(D),L=!0)},o(F){st(S.$$.fragment,F),st(z.$$.fragment,F),st(D),L=!1},d(F){F&&(X(E),X(C),X(P),X(I)),X(i),X(a),X(o),X(u),X(f),X(p),X(n),X(_),X(v),ii(S,F),ii(z,F),D&&D.d(F)}}}let Qk="light";function eT(l){let i=[];l.forEach(o=>i.push(o[0]));const a=l.flat().pop();return(l.length===1||a!=i[i.length-1])&&i.push(a),i}function G_(l,i,a){for(const o of i){const u=l.selected.residents[o].values;u===void 0||(u==="blocked"?++a.missingBecauseDisclosive:u.percent[0]==null?++a.missingAgeUnder16:++a.available)}}function Tc(l){return l.selected.total_pop.count!=null&&l.selected.total_pop.count>=100}const W_=l=>l.key;function tT(l,i,a){let o;eh(l,X1,q=>a(23,o=q));let{data:u}=i;Ka("theme",G1[Qk]);let f=[],p=!1,n="success",_=!1,v=BE,E=null,S=null;function C(){TE(`${Xo}?${f.map(q=>`${q.key}=${q.code}`).join("&")}`,{noScroll:!0,keepFocus:!0})}function z(q,We){a(1,f=[...f.filter(Tt=>Tt.topic!==q.shortLabel),{topic:q.shortLabel,key:q.key,...We}]),vf({event:"variableSelect",variable:q.shortLabel,category:We.label,count:f.length}),C()}function P(q){a(1,f=f.filter(We=>We.topic!==q.shortLabel)),C()}function I(q){a(1,f=f.filter(We=>We.topic!=q)),C()}function L(q){let We={available:0,missingBecauseDisclosive:0,missingAgeUnder16:0};for(const Tt of Ko[0].tablesCategorised)G_(q,Tt.tables.map(it=>it.code),We);return G_(q,["sex","resident_age_18b"],We),We.total=We.available+We.missingAgeUnder16+We.missingBecauseDisclosive,We}function D(q){vf({event:"fileDownload",fileExtension:"ods",selection:f.map(it=>`${it.topic}: ${it.label}`)});let We=SE(q,Ko,f);const Tt=new Ak;for(let{filename:it,contents:Bt}of We)Tt.file(it,Bt,{compression:it==="mimetype"?"STORE":"DEFLATE"});Tt.generateAsync({type:"blob"}).then(it=>{let Bt=new Blob([it],{type:"application/vnd.oasis.opendocument.spreadsheet"}),Xe=(window.URL||window.webkitURL||window).createObjectURL(Bt),ie=document.createElement("a");ie.download="population-profile-"+f.map(ve=>`${ve.key}-${ve.code}`).join("-")+".ods",ie.href=Xe,ie.style.display="none",document.body.appendChild(ie),ie.click(),document.body.removeChild(ie)})}function F(){vf({event:"pagePrint",selection:f.map(q=>`${q.topic}: ${q.label}`)}),print()}function V(q){a(0,u.selected=q.data,u),a(0,u.selected.total_pop=q.total_pop,u),a(0,u.geoPerc=[],u);let We;u.geoCodesAndNames.forEach(({code:it,name:Bt})=>{let Ne=f.length===0?100:q.mapData[it]!=null?q.mapData[it][1]:null,Xe=f.length===0?-1:q.mapData[it]!=null?q.mapData[it][0]:null;u.geoPerc.push({code:it,name:Bt,value:Ne,count:Xe})});let Tt=u.geoPerc.map(it=>it.value).filter(it=>it!=null);if(We=Tt.length===0?null:zE(Tt,Math.min(5,Tt.length)),!We)u.geoPerc.forEach(it=>it.color=Wo.nodata),a(0,u.geoBreaks=[0,100],u);else if(f.length===0)u.geoPerc.forEach(it=>it.color=Wo.seq[4]),a(0,u.geoBreaks=[100,100],u);else{let it=eT(We);u.geoPerc.forEach(Bt=>Bt.color=Bt.value!=null?bE(Bt.value,it,Wo.seq):Wo.nodata),a(0,u.geoBreaks=it,u)}f.length,a(3,n=u.selected.total_pop.count==null?"failed":"success")}function ee(){a(3,n="loading"),a(4,_=f&&f.some(q=>["Aged 4 years and under","Aged 5 to 9 years","Aged 10 to 14 years","Aged 15 years and under"].includes(q.label))),Uy(Ko,f).then(V)}function se(){a(1,f=[]);for(let q of o.url.searchParams.entries()){let We=W1.find(it=>it.key==q[0]);if(!We)continue;let Tt=We.cats.find(it=>it.code==q[1]);Tt&&f.push({topic:We.shortLabel,key:We.key,...Tt})}ee()}function ne(q){return q.selected!=null&&L(q).available!=L(q).total&&Tc(q)}CE(()=>{se(),a(2,p=!1),a(5,E=null),a(6,S=null)});const le=q=>Nf(q.code,u),ge=q=>I(q.topic);function ce(q){E=q,a(5,E)}function Me(q){S=q,a(6,S)}function et(q){p=q,a(2,p)}const ye=q=>Nf(q.code,u),Ge=()=>D(u);return l.$$set=q=>{"data"in q&&a(0,u=q.data)},l.$$.update=()=>{l.$$.dirty[0]&2&&console.log("selected",f)},[u,f,p,n,_,E,S,v,z,P,I,L,D,F,ne,le,ge,ce,Me,et,ye,Ge]}class hT extends qi{constructor(i){super(),Zi(this,i,tT,Yk,Ui,{data:0},null,[-1,-1])}}export{hT as component,cT as universal}; diff --git a/_app/version.json b/_app/version.json index 735495c..6db8ff9 100644 --- a/_app/version.json +++ b/_app/version.json @@ -1 +1 @@ -{"version":"1697807927928"} \ No newline at end of file +{"version":"1697815070257"} \ No newline at end of file diff --git a/index.html b/index.html index 8f1827b..1bb980d 100644 --- a/index.html +++ b/index.html @@ -7,16 +7,16 @@ - + - - - + + + - + - - Create a population group profile - Census 2021 - ONS + + Create a population group profile - Census 2021 - ONS
prototype
This is a prototype – your feedback will help us improve it.