@opengis/admin 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,11 +33,11 @@ Use slot props instead:
33
33
  - Location:`,Se),he({});let Ze;if(Se.path!=null)process.env.NODE_ENV!=="production"&&"params"in Se&&!("name"in Se)&&Object.keys(Se.params).length&&Nt(`Path "${Se.path}" was passed with params but they will be ignored. Use a named route alongside params instead.`),Ze=ii({},Se,{path:Ld(o,Se.path,He.path).path});else{const vt=ii({},Se.params);for(const ri in vt)vt[ri]==null&&delete vt[ri];Ze=ii({},Se,{params:R(vt)}),He.params=R(He.params)}const lt=i.resolve(Ze,He),Vt=Se.hash||"";process.env.NODE_ENV!=="production"&&Vt&&!Vt.startsWith("#")&&Nt(`A \`hash\` should always start with the character "#". Replace "${Vt}" with "#${Vt}".`),lt.params=A(z(lt.params));const Qt=s1(c,ii({},Se,{hash:Qb(Vt),path:lt.path})),Et=p.createHref(Qt);return process.env.NODE_ENV!=="production"&&(Et.startsWith("//")?Nt(`Location "${Se}" resolved to "${Et}". A resolved location cannot start with multiple slashes.`):lt.matched.length||Nt(`No match found for location with path "${Se.path!=null?Se.path:Se}"`)),ii({fullPath:Qt,hash:Vt,query:c===dg?V1(Se.query):Se.query||{}},lt,{redirectedFrom:void 0,href:Et})}function be(Se){return typeof Se=="string"?Ld(o,Se,M.value.path):ii({},Se)}function _e(Se,He){if(D!==Se)return Pa(8,{from:He,to:Se})}function Ie(Se){return Be(Se)}function ot(Se){return Ie(ii(be(Se),{replace:!0}))}function Qe(Se){const He=Se.matched[Se.matched.length-1];if(He&&He.redirect){const{redirect:Ze}=He;let lt=typeof Ze=="function"?Ze(Se):Ze;if(typeof lt=="string"&&(lt=lt.includes("?")||lt.includes("#")?lt=be(lt):{path:lt},lt.params={}),process.env.NODE_ENV!=="production"&&lt.path==null&&!("name"in lt))throw Nt(`Invalid redirect found:
34
34
  ${JSON.stringify(lt,null,2)}
35
35
  when navigating to "${Se.fullPath}". A redirect must contain a name or path. This will break in production.`),new Error("Invalid redirect");return ii({query:Se.query,hash:Se.hash,params:lt.path!=null?{}:Se.params},lt)}}function Be(Se,He){const Ze=D=he(Se),lt=M.value,Vt=Se.state,Qt=Se.force,Et=Se.replace===!0,vt=Qe(Ze);if(vt)return Be(ii(be(vt),{state:typeof vt=="object"?ii({},Vt,vt.state):Vt,force:Qt,replace:Et}),He||Ze);const ri=Ze;ri.redirectedFrom=He;let xe;return!Qt&&Km(c,lt,Ze)&&(xe=Pa(16,{to:ri,from:lt}),Hi(lt,lt,!0,!1)),(xe?Promise.resolve(xe):Dt(ri,lt)).catch(wi=>fs(wi)?fs(wi,2)?wi:Sn(wi):kr(wi,ri,lt)).then(wi=>{if(wi){if(fs(wi,2))return process.env.NODE_ENV!=="production"&&Km(c,he(wi.to),ri)&&He&&(He._count=He._count?He._count+1:1)>30?(Nt(`Detected a possibly infinite redirection in a navigation guard when going from "${lt.fullPath}" to "${ri.fullPath}". Aborting to avoid a Stack Overflow.
36
- Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.`),Promise.reject(new Error("Infinite redirect in navigation guard"))):Be(ii({replace:Et},be(wi.to),{state:typeof wi.to=="object"?ii({},Vt,wi.to.state):Vt,force:Qt}),He||ri)}else wi=kn(ri,lt,!0,Et,Vt);return Mt(ri,lt,wi),wi})}function St(Se,He){const Ze=_e(Se,He);return Ze?Promise.reject(Ze):Promise.resolve()}function rt(Se){const He=En.values().next().value;return He&&typeof He.runWithContext=="function"?He.runWithContext(Se):Se()}function Dt(Se,He){let Ze;const[lt,Vt,Qt]=av(Se,He);Ze=$d(lt.reverse(),"beforeRouteLeave",Se,He);for(const vt of lt)vt.leaveGuards.forEach(ri=>{Ze.push(Ws(ri,Se,He))});const Et=St.bind(null,Se,He);return Ze.push(Et),Cn(Ze).then(()=>{Ze=[];for(const vt of b.list())Ze.push(Ws(vt,Se,He));return Ze.push(Et),Cn(Ze)}).then(()=>{Ze=$d(Vt,"beforeRouteUpdate",Se,He);for(const vt of Vt)vt.updateGuards.forEach(ri=>{Ze.push(Ws(ri,Se,He))});return Ze.push(Et),Cn(Ze)}).then(()=>{Ze=[];for(const vt of Qt)if(vt.beforeEnter)if(Qn(vt.beforeEnter))for(const ri of vt.beforeEnter)Ze.push(Ws(ri,Se,He));else Ze.push(Ws(vt.beforeEnter,Se,He));return Ze.push(Et),Cn(Ze)}).then(()=>(Se.matched.forEach(vt=>vt.enterCallbacks={}),Ze=$d(Qt,"beforeRouteEnter",Se,He,rt),Ze.push(Et),Cn(Ze))).then(()=>{Ze=[];for(const vt of y.list())Ze.push(Ws(vt,Se,He));return Ze.push(Et),Cn(Ze)}).catch(vt=>fs(vt,8)?vt:Promise.reject(vt))}function Mt(Se,He,Ze){h.list().forEach(lt=>rt(()=>lt(Se,He,Ze)))}function kn(Se,He,Ze,lt,Vt){const Qt=_e(Se,He);if(Qt)return Qt;const Et=He===Zs,vt=ps?history.state:{};Ze&&(lt||Et?p.replace(Se.fullPath,ii({scroll:Et&&vt&&vt.scroll},Vt)):p.push(Se.fullPath,Vt)),M.value=Se,Hi(Se,He,Ze,Et),Sn()}let Rt;function pi(){Rt||(Rt=p.listen((Se,He,Ze)=>{if(!Tn.listening)return;const lt=he(Se),Vt=Qe(lt);if(Vt){Be(ii(Vt,{replace:!0}),lt).catch(Ul);return}D=lt;const Qt=M.value;ps&&p1(eg(Qt.fullPath,Ze.delta),Th()),Dt(lt,Qt).catch(Et=>fs(Et,12)?Et:fs(Et,2)?(Be(Et.to,lt).then(vt=>{fs(vt,20)&&!Ze.delta&&Ze.type===Hl.pop&&p.go(-1,!1)}).catch(Ul),Promise.reject()):(Ze.delta&&p.go(-Ze.delta,!1),kr(Et,lt,Qt))).then(Et=>{Et=Et||kn(lt,Qt,!1),Et&&(Ze.delta&&!fs(Et,8)?p.go(-Ze.delta,!1):Ze.type===Hl.pop&&fs(Et,20)&&p.go(-1,!1)),Mt(lt,Qt,Et)}).catch(Ul)}))}let rn=Zl(),tr=Zl(),Ui;function kr(Se,He,Ze){Sn(Se);const lt=tr.list();return lt.length?lt.forEach(Vt=>Vt(Se,He,Ze)):(process.env.NODE_ENV!=="production"&&Nt("uncaught error during route navigation:"),console.error(Se)),Promise.reject(Se)}function jn(){return Ui&&M.value!==Zs?Promise.resolve():new Promise((Se,He)=>{rn.add([Se,He])})}function Sn(Se){return Ui||(Ui=!Se,pi(),rn.list().forEach(([He,Ze])=>Se?Ze(Se):He()),rn.reset()),Se}function Hi(Se,He,Ze,lt){const{scrollBehavior:Vt}=n;if(!ps||!Vt)return Promise.resolve();const Qt=!Ze&&f1(eg(Se.fullPath,0))||(lt||!Ze)&&history.state&&history.state.scroll||null;return w.nextTick().then(()=>Vt(Se,He,Qt)).then(Et=>Et&&d1(Et)).catch(Et=>kr(Et,Se,He))}const sn=Se=>p.go(Se);let Sr;const En=new Set,Tn={currentRoute:M,listening:!0,addRoute:N,removeRoute:Y,clearRoutes:i.clearRoutes,hasRoute:ae,getRoutes:te,resolve:he,options:n,push:Ie,replace:ot,go:sn,back:()=>sn(-1),forward:()=>sn(1),beforeEach:b.add,beforeResolve:y.add,afterEach:h.add,onError:tr.add,isReady:jn,install(Se){const He=this;Se.component("RouterLink",U1),Se.component("RouterView",W1),Se.config.globalProperties.$router=He,Object.defineProperty(Se.config.globalProperties,"$route",{enumerable:!0,get:()=>w.unref(M)}),ps&&!Sr&&M.value===Zs&&(Sr=!0,Ie(p.location).catch(Vt=>{process.env.NODE_ENV!=="production"&&Nt("Unexpected error when starting the router:",Vt)}));const Ze={};for(const Vt in Zs)Object.defineProperty(Ze,Vt,{get:()=>M.value[Vt],enumerable:!0});Se.provide(Nd,He),Se.provide(fg,w.shallowReactive(Ze)),Se.provide(Vd,M);const lt=Se.unmount;En.add(Se),Se.unmount=function(){En.delete(Se),En.size<1&&(D=Zs,Rt&&Rt(),Rt=null,M.value=Zs,Sr=!1,Ui=!1),lt()},process.env.NODE_ENV!=="production"&&ps&&X1(Se,He,i)}};function Cn(Se){return Se.reduce((He,Ze)=>He.then(()=>rt(Ze)),Promise.resolve())}return Tn}function av(n,i){const o=[],c=[],p=[],b=Math.max(i.matched.length,n.matched.length);for(let y=0;y<b;y++){const h=i.matched[y];h&&(n.matched.find(D=>qs(D,h))?c.push(h):o.push(h));const M=n.matched[y];M&&(i.matched.find(D=>qs(D,M))||p.push(M))}return[o,c,p]}const lv=[{name:"edit",path:"/edit",component:()=>Promise.resolve().then(()=>eC)},{name:"add",path:"/add",component:()=>Promise.resolve().then(()=>lC)},{name:"card-view",path:"/card",component:()=>Promise.resolve().then(()=>S0),children:[{name:"table",path:":table",component:()=>Promise.resolve().then(()=>S0),children:[{name:"card",path:":id",component:()=>Promise.resolve().then(()=>zC)}]}]}],cv={},hv={class:"bg-gray-200 w-full px-16 md:px-0 h-screen flex items-center justify-center"},uv={class:"bg-white border border-gray-200 flex flex-col items-center justify-center px-4 md:px-8 lg:px-24 py-8 rounded-lg shadow-2xl"};function dv(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",hv,[w.createElementVNode("div",uv,[i[2]||(i[2]=w.createElementVNode("p",{class:"text-6xl md:text-7xl lg:text-9xl font-bold tracking-wider text-gray-300"}," 404 ",-1)),i[3]||(i[3]=w.createElementVNode("p",{class:"text-2xl md:text-3xl lg:text-5xl font-bold tracking-wider text-gray-500 mt-4"}," Сторінку не знайдено ",-1)),i[4]||(i[4]=w.createElementVNode("p",{class:"text-gray-500 mt-4 pb-4 border-b-2 text-center"}," Вибачте, така сторінка не існує ",-1)),w.createElementVNode("div",{onClick:i[0]||(i[0]=y=>n.$router.push("/")),class:"flex cursor-pointer items-center space-x-2 bg-blue-600 hover:bg-blue-700 text-gray-100 px-4 py-2 mt-6 rounded transition duration-150",title:"Return Home"},i[1]||(i[1]=[w.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[w.createElementVNode("path",{"fill-rule":"evenodd",d:"M9.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L7.414 9H15a1 1 0 110 2H7.414l2.293 2.293a1 1 0 010 1.414z","clip-rule":"evenodd"})],-1),w.createElementVNode("span",null,"Повернутись на головну",-1)]))])])}const pv=kt(cv,[["render",dv]]),fv=n=>{const i=lv.map(c=>({...c}));return{router:ov({history:_1(),routes:[{path:"/404",name:"404",component:pv},{path:"/",name:"global",component:()=>Promise.resolve().then(()=>wM),children:[...i,...n,{path:"/:catchAll(.*)",component:()=>Promise.resolve().then(()=>nI)}]}]}),routerData:i}},mv={props:{value:{type:[String,Number,Array,Boolean],default:()=>""}},data(){return{}}};function gv(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",null,w.toDisplayString(o.value),1)}const Tg=kt(mv,[["render",gv]]),yv={props:{value:{type:[String,Number],default:()=>""},data:Object,name:String},computed:{getData(){var n;return(n=this.data)==null?void 0:n[this.name+"_data"]}},methods:{getBGColor(n){if(n!=null&&n.includes("#")){let i;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(n))return i=n.substring(1).split(""),i.length==3&&(i=[i[0],i[0],i[1],i[1],i[2],i[2]]),i="0x"+i.join(""),"rgba("+[i>>16&255,i>>8&255,i&255].join(",")+",0.2)";throw new Error("Bad Hex")}else if(typeof n=="string"){const i=document.createElement("div");i.style.color=n,document.body.appendChild(i);const o=getComputedStyle(i).color;return document.body.removeChild(i),o.replace("rgb","rgba").replace(")",", 0.2)")}else throw new Error("Invalid color format")}}},_v={class:"w-full flex justify-center"},xv={key:1};function bv(n,i,o,c,p,b){var y,h,M;return w.openBlock(),w.createElementBlock("div",_v,[b.getData?(w.openBlock(),w.createElementBlock("div",{key:0,class:"p-2 ps-1.5 px-2 inline-flex items-center gap-x-1.5 text-xs font-medium text-black rounded-md",style:w.normalizeStyle({backgroundColor:b.getBGColor((y=b.getData)==null?void 0:y.color),color:(h=b.getData)==null?void 0:h.color})},w.toDisplayString((M=b.getData)==null?void 0:M.text),5)):(w.openBlock(),w.createElementBlock("div",xv,"-"))])}const vv=kt(yv,[["render",bv]]),wv={},kv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function Sv(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",kv,i[0]||(i[0]=[w.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),w.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const Ev={components:{IconCheck:kt(wv,[["render",Sv]])},props:{value:Boolean}},Tv={class:"px-[20px]"},Cv={key:1};function Mv(n,i,o,c,p,b){const y=w.resolveComponent("IconCheck");return w.openBlock(),w.createElementBlock("div",Tv,[o.value?(w.openBlock(),w.createBlock(y,{key:0,height:"24",width:"24",class:"text-blue-500"})):(w.openBlock(),w.createElementBlock("div",Cv))])}const Cg=kt(Ev,[["render",Mv]]),Pv={props:{data:Object,name:String},computed:{getData(){var n,i,o;return((i=(n=this.data)==null?void 0:n[this.name+"_data"])==null?void 0:i.text)||((o=this.data)==null?void 0:o[this.name+"_text"])}}},Iv={class:""},Av={key:0},Dv={key:1},zv={key:1};function Rv(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",Iv,[b.getData?(w.openBlock(),w.createElementBlock("div",Av,[typeof b.getData=="object"?(w.openBlock(!0),w.createElementBlock(w.Fragment,{key:0},w.renderList(b.getData,(y,h)=>(w.openBlock(),w.createElementBlock("div",{key:h},w.toDisplayString(y),1))),128)):(w.openBlock(),w.createElementBlock("div",Dv,w.toDisplayString(b.getData),1))])):(w.openBlock(),w.createElementBlock("div",zv,"-"))])}const Lv={"table-format-text":Tg,"table-format-select":kt(Pv,[["render",Rv]]),"table-format-badge":vv,"table-format-swetch":Cg,"table-format-check":Cg,"table-format-html":Tg},Mg=n=>{const i=[];return n.forEach(o=>{o.menu?i.push(...Mg(o.menu)):i.push(o)}),i};function Pg(n,i,o){if(n!==null)for(var c,p,b,y,h,M,D,A=0,R=0,z,N=n.type,Y=N==="FeatureCollection",te=N==="Feature",ae=Y?n.features.length:1,he=0;he<ae;he++){D=Y?n.features[he].geometry:te?n.geometry:n,z=D?D.type==="GeometryCollection":!1,h=z?D.geometries.length:1;for(var be=0;be<h;be++){var _e=0,Ie=0;if(y=z?D.geometries[be]:D,y!==null){M=y.coordinates;var ot=y.type;switch(A=0,ot){case null:break;case"Point":if(i(M,R,he,_e,Ie)===!1)return!1;R++,_e++;break;case"LineString":case"MultiPoint":for(c=0;c<M.length;c++){if(i(M[c],R,he,_e,Ie)===!1)return!1;R++,ot==="MultiPoint"&&_e++}ot==="LineString"&&_e++;break;case"Polygon":case"MultiLineString":for(c=0;c<M.length;c++){for(p=0;p<M[c].length-A;p++){if(i(M[c][p],R,he,_e,Ie)===!1)return!1;R++}ot==="MultiLineString"&&_e++,ot==="Polygon"&&Ie++}ot==="Polygon"&&_e++;break;case"MultiPolygon":for(c=0;c<M.length;c++){for(Ie=0,p=0;p<M[c].length;p++){for(b=0;b<M[c][p].length-A;b++){if(i(M[c][p][b],R,he,_e,Ie)===!1)return!1;R++}Ie++}_e++}break;case"GeometryCollection":for(c=0;c<y.geometries.length;c++)if(Pg(y.geometries[c],i)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Ig(n,i={}){if(n.bbox!=null&&i.recompute!==!0)return n.bbox;const o=[1/0,1/0,-1/0,-1/0];return Pg(n,c=>{o[0]>c[0]&&(o[0]=c[0]),o[1]>c[1]&&(o[1]=c[1]),o[2]<c[0]&&(o[2]=c[0]),o[3]<c[1]&&(o[3]=c[1])}),o}var Ov=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Fv(n,i,o={}){const c={type:"Feature"};return(o.id===0||o.id)&&(c.id=o.id),o.bbox&&(c.bbox=o.bbox),c.properties={},c.geometry=n,c}function Ag(n,i={}){const o={type:"FeatureCollection"};return i.id&&(o.id=i.id),i.bbox&&(o.bbox=i.bbox),o.features=n,o}var Dg={exports:{}};/**
36
+ Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.`),Promise.reject(new Error("Infinite redirect in navigation guard"))):Be(ii({replace:Et},be(wi.to),{state:typeof wi.to=="object"?ii({},Vt,wi.to.state):Vt,force:Qt}),He||ri)}else wi=kn(ri,lt,!0,Et,Vt);return Mt(ri,lt,wi),wi})}function St(Se,He){const Ze=_e(Se,He);return Ze?Promise.reject(Ze):Promise.resolve()}function rt(Se){const He=En.values().next().value;return He&&typeof He.runWithContext=="function"?He.runWithContext(Se):Se()}function Dt(Se,He){let Ze;const[lt,Vt,Qt]=av(Se,He);Ze=$d(lt.reverse(),"beforeRouteLeave",Se,He);for(const vt of lt)vt.leaveGuards.forEach(ri=>{Ze.push(Ws(ri,Se,He))});const Et=St.bind(null,Se,He);return Ze.push(Et),Cn(Ze).then(()=>{Ze=[];for(const vt of b.list())Ze.push(Ws(vt,Se,He));return Ze.push(Et),Cn(Ze)}).then(()=>{Ze=$d(Vt,"beforeRouteUpdate",Se,He);for(const vt of Vt)vt.updateGuards.forEach(ri=>{Ze.push(Ws(ri,Se,He))});return Ze.push(Et),Cn(Ze)}).then(()=>{Ze=[];for(const vt of Qt)if(vt.beforeEnter)if(Qn(vt.beforeEnter))for(const ri of vt.beforeEnter)Ze.push(Ws(ri,Se,He));else Ze.push(Ws(vt.beforeEnter,Se,He));return Ze.push(Et),Cn(Ze)}).then(()=>(Se.matched.forEach(vt=>vt.enterCallbacks={}),Ze=$d(Qt,"beforeRouteEnter",Se,He,rt),Ze.push(Et),Cn(Ze))).then(()=>{Ze=[];for(const vt of y.list())Ze.push(Ws(vt,Se,He));return Ze.push(Et),Cn(Ze)}).catch(vt=>fs(vt,8)?vt:Promise.reject(vt))}function Mt(Se,He,Ze){h.list().forEach(lt=>rt(()=>lt(Se,He,Ze)))}function kn(Se,He,Ze,lt,Vt){const Qt=_e(Se,He);if(Qt)return Qt;const Et=He===Zs,vt=ps?history.state:{};Ze&&(lt||Et?p.replace(Se.fullPath,ii({scroll:Et&&vt&&vt.scroll},Vt)):p.push(Se.fullPath,Vt)),M.value=Se,Hi(Se,He,Ze,Et),Sn()}let Rt;function pi(){Rt||(Rt=p.listen((Se,He,Ze)=>{if(!Tn.listening)return;const lt=he(Se),Vt=Qe(lt);if(Vt){Be(ii(Vt,{replace:!0}),lt).catch(Ul);return}D=lt;const Qt=M.value;ps&&p1(eg(Qt.fullPath,Ze.delta),Th()),Dt(lt,Qt).catch(Et=>fs(Et,12)?Et:fs(Et,2)?(Be(Et.to,lt).then(vt=>{fs(vt,20)&&!Ze.delta&&Ze.type===Hl.pop&&p.go(-1,!1)}).catch(Ul),Promise.reject()):(Ze.delta&&p.go(-Ze.delta,!1),kr(Et,lt,Qt))).then(Et=>{Et=Et||kn(lt,Qt,!1),Et&&(Ze.delta&&!fs(Et,8)?p.go(-Ze.delta,!1):Ze.type===Hl.pop&&fs(Et,20)&&p.go(-1,!1)),Mt(lt,Qt,Et)}).catch(Ul)}))}let rn=Zl(),tr=Zl(),Ui;function kr(Se,He,Ze){Sn(Se);const lt=tr.list();return lt.length?lt.forEach(Vt=>Vt(Se,He,Ze)):(process.env.NODE_ENV!=="production"&&Nt("uncaught error during route navigation:"),console.error(Se)),Promise.reject(Se)}function jn(){return Ui&&M.value!==Zs?Promise.resolve():new Promise((Se,He)=>{rn.add([Se,He])})}function Sn(Se){return Ui||(Ui=!Se,pi(),rn.list().forEach(([He,Ze])=>Se?Ze(Se):He()),rn.reset()),Se}function Hi(Se,He,Ze,lt){const{scrollBehavior:Vt}=n;if(!ps||!Vt)return Promise.resolve();const Qt=!Ze&&f1(eg(Se.fullPath,0))||(lt||!Ze)&&history.state&&history.state.scroll||null;return w.nextTick().then(()=>Vt(Se,He,Qt)).then(Et=>Et&&d1(Et)).catch(Et=>kr(Et,Se,He))}const sn=Se=>p.go(Se);let Sr;const En=new Set,Tn={currentRoute:M,listening:!0,addRoute:N,removeRoute:Y,clearRoutes:i.clearRoutes,hasRoute:ae,getRoutes:te,resolve:he,options:n,push:Ie,replace:ot,go:sn,back:()=>sn(-1),forward:()=>sn(1),beforeEach:b.add,beforeResolve:y.add,afterEach:h.add,onError:tr.add,isReady:jn,install(Se){const He=this;Se.component("RouterLink",U1),Se.component("RouterView",W1),Se.config.globalProperties.$router=He,Object.defineProperty(Se.config.globalProperties,"$route",{enumerable:!0,get:()=>w.unref(M)}),ps&&!Sr&&M.value===Zs&&(Sr=!0,Ie(p.location).catch(Vt=>{process.env.NODE_ENV!=="production"&&Nt("Unexpected error when starting the router:",Vt)}));const Ze={};for(const Vt in Zs)Object.defineProperty(Ze,Vt,{get:()=>M.value[Vt],enumerable:!0});Se.provide(Nd,He),Se.provide(fg,w.shallowReactive(Ze)),Se.provide(Vd,M);const lt=Se.unmount;En.add(Se),Se.unmount=function(){En.delete(Se),En.size<1&&(D=Zs,Rt&&Rt(),Rt=null,M.value=Zs,Sr=!1,Ui=!1),lt()},process.env.NODE_ENV!=="production"&&ps&&X1(Se,He,i)}};function Cn(Se){return Se.reduce((He,Ze)=>He.then(()=>rt(Ze)),Promise.resolve())}return Tn}function av(n,i){const o=[],c=[],p=[],b=Math.max(i.matched.length,n.matched.length);for(let y=0;y<b;y++){const h=i.matched[y];h&&(n.matched.find(D=>qs(D,h))?c.push(h):o.push(h));const M=n.matched[y];M&&(i.matched.find(D=>qs(D,M))||p.push(M))}return[o,c,p]}const lv=[{name:"edit",path:"/edit",component:()=>Promise.resolve().then(()=>eC)},{name:"add",path:"/add",component:()=>Promise.resolve().then(()=>lC)},{name:"card-view",path:"/card",component:()=>Promise.resolve().then(()=>S0),children:[{name:"table",path:":table",component:()=>Promise.resolve().then(()=>S0),children:[{name:"card",path:":id",component:()=>Promise.resolve().then(()=>zC)}]}]}],cv={},hv={class:"bg-gray-200 w-full px-16 md:px-0 h-screen flex items-center justify-center"},uv={class:"bg-white border border-gray-200 flex flex-col items-center justify-center px-4 md:px-8 lg:px-24 py-8 rounded-lg shadow-2xl"};function dv(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",hv,[w.createElementVNode("div",uv,[i[2]||(i[2]=w.createElementVNode("p",{class:"text-6xl md:text-7xl lg:text-9xl font-bold tracking-wider text-gray-300"}," 404 ",-1)),i[3]||(i[3]=w.createElementVNode("p",{class:"text-2xl md:text-3xl lg:text-5xl font-bold tracking-wider text-gray-500 mt-4"}," Сторінку не знайдено ",-1)),i[4]||(i[4]=w.createElementVNode("p",{class:"text-gray-500 mt-4 pb-4 border-b-2 text-center"}," Вибачте, така сторінка не існує ",-1)),w.createElementVNode("div",{onClick:i[0]||(i[0]=y=>n.$router.push("/")),class:"flex cursor-pointer items-center space-x-2 bg-blue-600 hover:bg-blue-700 text-gray-100 px-4 py-2 mt-6 rounded transition duration-150",title:"Return Home"},i[1]||(i[1]=[w.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[w.createElementVNode("path",{"fill-rule":"evenodd",d:"M9.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L7.414 9H15a1 1 0 110 2H7.414l2.293 2.293a1 1 0 010 1.414z","clip-rule":"evenodd"})],-1),w.createElementVNode("span",null,"Повернутись на головну",-1)]))])])}const pv=kt(cv,[["render",dv]]),fv=n=>{const i=lv.map(c=>({...c}));return{router:ov({history:_1(),routes:[{path:"/404",name:"404",component:pv},{path:"/",name:"global",component:()=>Promise.resolve().then(()=>wM),children:[...i,...n,{path:"/:catchAll(.*)",component:()=>Promise.resolve().then(()=>rI)}]}]}),routerData:i}},mv={props:{value:{type:[String,Number,Array,Boolean],default:()=>""}},data(){return{}}};function gv(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",null,w.toDisplayString(o.value),1)}const Tg=kt(mv,[["render",gv]]),yv={props:{value:{type:[String,Number],default:()=>""},data:Object,name:String},computed:{getData(){var n;return(n=this.data)==null?void 0:n[this.name+"_data"]}},methods:{getBGColor(n){if(n!=null&&n.includes("#")){let i;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(n))return i=n.substring(1).split(""),i.length==3&&(i=[i[0],i[0],i[1],i[1],i[2],i[2]]),i="0x"+i.join(""),"rgba("+[i>>16&255,i>>8&255,i&255].join(",")+",0.2)";throw new Error("Bad Hex")}else if(typeof n=="string"){const i=document.createElement("div");i.style.color=n,document.body.appendChild(i);const o=getComputedStyle(i).color;return document.body.removeChild(i),o.replace("rgb","rgba").replace(")",", 0.2)")}else throw new Error("Invalid color format")}}},_v={class:"w-full flex justify-center"},xv={key:1};function bv(n,i,o,c,p,b){var y,h,M;return w.openBlock(),w.createElementBlock("div",_v,[b.getData?(w.openBlock(),w.createElementBlock("div",{key:0,class:"p-2 ps-1.5 px-2 inline-flex items-center gap-x-1.5 text-xs font-medium text-black rounded-md",style:w.normalizeStyle({backgroundColor:b.getBGColor((y=b.getData)==null?void 0:y.color),color:(h=b.getData)==null?void 0:h.color})},w.toDisplayString((M=b.getData)==null?void 0:M.text),5)):(w.openBlock(),w.createElementBlock("div",xv,"-"))])}const vv=kt(yv,[["render",bv]]),wv={},kv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function Sv(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",kv,i[0]||(i[0]=[w.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),w.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const Ev={components:{IconCheck:kt(wv,[["render",Sv]])},props:{value:Boolean}},Tv={class:"px-[20px]"},Cv={key:1};function Mv(n,i,o,c,p,b){const y=w.resolveComponent("IconCheck");return w.openBlock(),w.createElementBlock("div",Tv,[o.value?(w.openBlock(),w.createBlock(y,{key:0,height:"24",width:"24",class:"text-blue-500"})):(w.openBlock(),w.createElementBlock("div",Cv))])}const Cg=kt(Ev,[["render",Mv]]),Pv={props:{data:Object,name:String},computed:{getData(){var n,i,o;return((i=(n=this.data)==null?void 0:n[this.name+"_data"])==null?void 0:i.text)||((o=this.data)==null?void 0:o[this.name+"_text"])}}},Iv={class:""},Av={key:0},Dv={key:1},zv={key:1};function Rv(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",Iv,[b.getData?(w.openBlock(),w.createElementBlock("div",Av,[typeof b.getData=="object"?(w.openBlock(!0),w.createElementBlock(w.Fragment,{key:0},w.renderList(b.getData,(y,h)=>(w.openBlock(),w.createElementBlock("div",{key:h},w.toDisplayString(y),1))),128)):(w.openBlock(),w.createElementBlock("div",Dv,w.toDisplayString(b.getData),1))])):(w.openBlock(),w.createElementBlock("div",zv,"-"))])}const Lv={"table-format-text":Tg,"table-format-select":kt(Pv,[["render",Rv]]),"table-format-badge":vv,"table-format-swetch":Cg,"table-format-check":Cg,"table-format-html":Tg},Mg=n=>{const i=[];return n.forEach(o=>{o.menu?i.push(...Mg(o.menu)):i.push(o)}),i};function Pg(n,i,o){if(n!==null)for(var c,p,b,y,h,M,D,A=0,R=0,z,N=n.type,Y=N==="FeatureCollection",te=N==="Feature",ae=Y?n.features.length:1,he=0;he<ae;he++){D=Y?n.features[he].geometry:te?n.geometry:n,z=D?D.type==="GeometryCollection":!1,h=z?D.geometries.length:1;for(var be=0;be<h;be++){var _e=0,Ie=0;if(y=z?D.geometries[be]:D,y!==null){M=y.coordinates;var ot=y.type;switch(A=0,ot){case null:break;case"Point":if(i(M,R,he,_e,Ie)===!1)return!1;R++,_e++;break;case"LineString":case"MultiPoint":for(c=0;c<M.length;c++){if(i(M[c],R,he,_e,Ie)===!1)return!1;R++,ot==="MultiPoint"&&_e++}ot==="LineString"&&_e++;break;case"Polygon":case"MultiLineString":for(c=0;c<M.length;c++){for(p=0;p<M[c].length-A;p++){if(i(M[c][p],R,he,_e,Ie)===!1)return!1;R++}ot==="MultiLineString"&&_e++,ot==="Polygon"&&Ie++}ot==="Polygon"&&_e++;break;case"MultiPolygon":for(c=0;c<M.length;c++){for(Ie=0,p=0;p<M[c].length;p++){for(b=0;b<M[c][p].length-A;b++){if(i(M[c][p][b],R,he,_e,Ie)===!1)return!1;R++}Ie++}_e++}break;case"GeometryCollection":for(c=0;c<y.geometries.length;c++)if(Pg(y.geometries[c],i)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Ig(n,i={}){if(n.bbox!=null&&i.recompute!==!0)return n.bbox;const o=[1/0,1/0,-1/0,-1/0];return Pg(n,c=>{o[0]>c[0]&&(o[0]=c[0]),o[1]>c[1]&&(o[1]=c[1]),o[2]<c[0]&&(o[2]=c[0]),o[3]<c[1]&&(o[3]=c[1])}),o}var Ov=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bv(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Fv(n,i,o={}){const c={type:"Feature"};return(o.id===0||o.id)&&(c.id=o.id),o.bbox&&(c.bbox=o.bbox),c.properties={},c.geometry=n,c}function Ag(n,i={}){const o={type:"FeatureCollection"};return i.id&&(o.id=i.id),i.bbox&&(o.bbox=i.bbox),o.features=n,o}var Dg={exports:{}};/**
37
37
  * MapLibre GL JS
38
38
  * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.0/LICENSE.txt
39
39
  */(function(n,i){(function(o,c){n.exports=c()})(Ov,function(){var o={},c={};function p(y,h,M){if(c[y]=M,y==="index"){var D="var sharedModule = {}; ("+c.shared+")(sharedModule); ("+c.worker+")(sharedModule);",A={};return c.shared(A),c.index(o,A),typeof window<"u"&&o.setWorkerUrl(window.URL.createObjectURL(new Blob([D],{type:"text/javascript"}))),o}}p("shared",["exports"],function(y){function h(r,t,s,l){return new(s||(s=Promise))(function(f,_){function x(C){try{S(l.next(C))}catch(P){_(P)}}function v(C){try{S(l.throw(C))}catch(P){_(P)}}function S(C){var P;C.done?f(C.value):(P=C.value,P instanceof s?P:new s(function(L){L(P)})).then(x,v)}S((l=l.apply(r,t||[])).next())})}function M(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}typeof SuppressedError=="function"&&SuppressedError;var D=A;function A(r,t){this.x=r,this.y=t}A.prototype={clone:function(){return new A(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,t){return this.clone()._rotateAround(r,t)},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 t=r.x-this.x,s=r.y-this.y;return t*t+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,t){return Math.atan2(this.x*t-this.y*r,this.x*r+this.y*t)},_matMult:function(r){var t=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=t,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 t=Math.cos(r),s=Math.sin(r),l=s*this.x+t*this.y;return this.x=t*this.x-s*this.y,this.y=l,this},_rotateAround:function(r,t){var s=Math.cos(r),l=Math.sin(r),f=t.y+l*(this.x-t.x)+s*(this.y-t.y);return this.x=t.x+s*(this.x-t.x)-l*(this.y-t.y),this.y=f,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},A.convert=function(r){return r instanceof A?r:Array.isArray(r)?new A(r[0],r[1]):r};var R=M(D),z=N;function N(r,t,s,l){this.cx=3*r,this.bx=3*(s-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(l-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=t,this.p2x=s,this.p2y=l}N.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,t){if(t===void 0&&(t=1e-6),r<0)return 0;if(r>1)return 1;for(var s=r,l=0;l<8;l++){var f=this.sampleCurveX(s)-r;if(Math.abs(f)<t)return s;var _=this.sampleCurveDerivativeX(s);if(Math.abs(_)<1e-6)break;s-=f/_}var x=0,v=1;for(s=r,l=0;l<20&&(f=this.sampleCurveX(s),!(Math.abs(f-r)<t));l++)r>f?x=s:v=s,s=.5*(v-x)+x;return s},solve:function(r,t){return this.sampleCurveY(this.solveCurveX(r,t))}};var Y=M(z);let te,ae;function he(){return te==null&&(te=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),te}function be(){if(ae==null&&(ae=!1,he())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let l=0;l<5*5;l++){const f=4*l;t.fillStyle=`rgb(${f},${f+1},${f+2})`,t.fillRect(l%5,Math.floor(l/5),1,1)}const s=t.getImageData(0,0,5,5).data;for(let l=0;l<5*5*4;l++)if(l%4!=3&&s[l]!==l){ae=!0;break}}}return ae||!1}function _e(r,t,s,l){const f=new Y(r,t,s,l);return _=>f.solve(_)}const Ie=_e(.25,.1,.25,1);function ot(r,t,s){return Math.min(s,Math.max(t,r))}function Qe(r,t,s){const l=s-t,f=((r-t)%l+l)%l+t;return f===t?s:f}function Be(r,...t){for(const s of t)for(const l in s)r[l]=s[l];return r}let St=1;function rt(r,t,s){const l={};for(const f in r)l[f]=t.call(this,r[f],f,r);return l}function Dt(r,t,s){const l={};for(const f in r)t.call(this,r[f],f,r)&&(l[f]=r[f]);return l}function Mt(r){return Array.isArray(r)?r.map(Mt):typeof r=="object"&&r?rt(r,Mt):r}const kn={};function Rt(r){kn[r]||(typeof console<"u"&&console.warn(r),kn[r]=!0)}function pi(r,t,s){return(s.y-r.y)*(t.x-r.x)>(t.y-r.y)*(s.x-r.x)}function rn(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let tr=null;function Ui(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const kr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function jn(r,t,s,l,f){return h(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const _=new VideoFrame(r,{timestamp:0});try{const x=_==null?void 0:_.format;if(!x||!x.startsWith("BGR")&&!x.startsWith("RGB"))throw new Error(`Unrecognized format ${x}`);const v=x.startsWith("BGR"),S=new Uint8ClampedArray(l*f*4);if(yield _.copyTo(S,function(C,P,L,F,j){const H=4*Math.max(-P,0),q=(Math.max(0,L)-L)*F*4+H,K=4*F,ie=Math.max(0,P),ge=Math.max(0,L);return{rect:{x:ie,y:ge,width:Math.min(C.width,P+F)-ie,height:Math.min(C.height,L+j)-ge},layout:[{offset:q,stride:K}]}}(r,t,s,l,f)),v)for(let C=0;C<S.length;C+=4){const P=S[C];S[C]=S[C+2],S[C+2]=P}return S}finally{_.close()}})}let Sn,Hi;const sn="AbortError";function Sr(){return new Error(sn)}const En={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Tn(r){return En.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const Cn="global-dispatcher";class Se extends Error{constructor(t,s,l,f){super(`AJAXError: ${s} (${t}): ${l}`),this.status=t,this.statusText=s,this.url=l,this.body=f}}const He=()=>rn(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Ze=function(r,t){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const l=Tn(r.url);if(l)return l(r,t);if(rn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Cn},t)}if(!(/^file:/.test(s=r.url)||/^file:/.test(He())&&!/^\w+:/.test(s))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(l,f){return h(this,void 0,void 0,function*(){const _=new Request(l.url,{method:l.method||"GET",body:l.body,credentials:l.credentials,headers:l.headers,cache:l.cache,referrer:He(),signal:f.signal});l.type!=="json"||_.headers.has("Accept")||_.headers.set("Accept","application/json");const x=yield fetch(_);if(!x.ok){const C=yield x.blob();throw new Se(x.status,x.statusText,l.url,C)}let v;v=l.type==="arrayBuffer"||l.type==="image"?x.arrayBuffer():l.type==="json"?x.json():x.text();const S=yield v;if(f.signal.aborted)throw Sr();return{data:S,cacheControl:x.headers.get("Cache-Control"),expires:x.headers.get("Expires")}})}(r,t);if(rn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Cn},t)}var s;return function(l,f){return new Promise((_,x)=>{var v;const S=new XMLHttpRequest;S.open(l.method||"GET",l.url,!0),l.type!=="arrayBuffer"&&l.type!=="image"||(S.responseType="arraybuffer");for(const C in l.headers)S.setRequestHeader(C,l.headers[C]);l.type==="json"&&(S.responseType="text",!((v=l.headers)===null||v===void 0)&&v.Accept||S.setRequestHeader("Accept","application/json")),S.withCredentials=l.credentials==="include",S.onerror=()=>{x(new Error(S.statusText))},S.onload=()=>{if(!f.signal.aborted)if((S.status>=200&&S.status<300||S.status===0)&&S.response!==null){let C=S.response;if(l.type==="json")try{C=JSON.parse(S.response)}catch(P){return void x(P)}_({data:C,cacheControl:S.getResponseHeader("Cache-Control"),expires:S.getResponseHeader("Expires")})}else{const C=new Blob([S.response],{type:S.getResponseHeader("Content-Type")});x(new Se(S.status,S.statusText,l.url,C))}},f.signal.addEventListener("abort",()=>{S.abort(),x(Sr())}),S.send(l.body)})}(r,t)};function lt(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const t=new URL(r),s=window.location;return t.protocol===s.protocol&&t.host===s.host}function Vt(r,t,s){s[r]&&s[r].indexOf(t)!==-1||(s[r]=s[r]||[],s[r].push(t))}function Qt(r,t,s){if(s&&s[r]){const l=s[r].indexOf(t);l!==-1&&s[r].splice(l,1)}}class Et{constructor(t,s={}){Be(this,s),this.type=t}}class vt extends Et{constructor(t,s={}){super("error",Be({error:t},s))}}class ri{on(t,s){return this._listeners=this._listeners||{},Vt(t,s,this._listeners),this}off(t,s){return Qt(t,s,this._listeners),Qt(t,s,this._oneTimeListeners),this}once(t,s){return s?(this._oneTimeListeners=this._oneTimeListeners||{},Vt(t,s,this._oneTimeListeners),this):new Promise(l=>this.once(t,l))}fire(t,s){typeof t=="string"&&(t=new Et(t,s||{}));const l=t.type;if(this.listens(l)){t.target=this;const f=this._listeners&&this._listeners[l]?this._listeners[l].slice():[];for(const v of f)v.call(this,t);const _=this._oneTimeListeners&&this._oneTimeListeners[l]?this._oneTimeListeners[l].slice():[];for(const v of _)Qt(l,v,this._oneTimeListeners),v.call(this,t);const x=this._eventedParent;x&&(Be(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),x.fire(t))}else t instanceof vt&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,s){return this._eventedParent=t,this._eventedParentData=s,this}}var xe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const wi=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Go(r,t){const s={};for(const l in r)l!=="ref"&&(s[l]=r[l]);return wi.forEach(l=>{l in t&&(s[l]=t[l])}),s}function Zt(r,t){if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let s=0;s<r.length;s++)if(!Zt(r[s],t[s]))return!1;return!0}if(typeof r=="object"&&r!==null&&t!==null){if(typeof t!="object"||Object.keys(r).length!==Object.keys(t).length)return!1;for(const s in r)if(!Zt(r[s],t[s]))return!1;return!0}return r===t}function ki(r,t){r.push(t)}function Yo(r,t,s){ki(s,{command:"addSource",args:[r,t[r]]})}function is(r,t,s){ki(t,{command:"removeSource",args:[r]}),s[r]=!0}function $r(r,t,s,l){is(r,s,l),Yo(r,t,s)}function Js(r,t,s){let l;for(l in r[s])if(Object.prototype.hasOwnProperty.call(r[s],l)&&l!=="data"&&!Zt(r[s][l],t[s][l]))return!1;for(l in t[s])if(Object.prototype.hasOwnProperty.call(t[s],l)&&l!=="data"&&!Zt(r[s][l],t[s][l]))return!1;return!0}function Un(r,t,s,l,f,_){r=r||{},t=t||{};for(const x in r)Object.prototype.hasOwnProperty.call(r,x)&&(Zt(r[x],t[x])||s.push({command:_,args:[l,x,t[x],f]}));for(const x in t)Object.prototype.hasOwnProperty.call(t,x)&&!Object.prototype.hasOwnProperty.call(r,x)&&(Zt(r[x],t[x])||s.push({command:_,args:[l,x,t[x],f]}))}function Xo(r){return r.id}function Ko(r,t){return r[t.id]=t,r}class De{constructor(t,s,l,f){this.message=(t?`${t}: `:"")+l,f&&(this.identifier=f),s!=null&&s.__line__&&(this.line=s.__line__)}}function Er(r,...t){for(const s of t)for(const l in s)r[l]=s[l];return r}class on extends Error{constructor(t,s){super(s),this.message=s,this.key=t}}class Tr{constructor(t,s=[]){this.parent=t,this.bindings={};for(const[l,f]of s)this.bindings[l]=f}concat(t){return new Tr(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const ns={kind:"null"},Fe={kind:"number"},Ct={kind:"string"},mt={kind:"boolean"},fn={kind:"color"},ir={kind:"object"},bt={kind:"value"},Cr={kind:"collator"},jr={kind:"formatted"},rs={kind:"padding"},Mr={kind:"resolvedImage"},ee={kind:"variableAnchorOffsetCollection"};function $(r,t){return{kind:"array",itemType:r,N:t}}function V(r){if(r.kind==="array"){const t=V(r.itemType);return typeof r.N=="number"?`array<${t}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${t}>`}return r.kind}const W=[ns,Fe,Ct,mt,fn,jr,ir,$(bt),rs,Mr,ee];function J(r,t){if(t.kind==="error")return null;if(r.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!J(r.itemType,t.itemType))&&(typeof r.N!="number"||r.N===t.N))return null}else{if(r.kind===t.kind)return null;if(r.kind==="value"){for(const s of W)if(!J(s,t))return null}}return`Expected ${V(r)} but found ${V(t)} instead.`}function ce(r,t){return t.some(s=>s.kind===r.kind)}function de(r,t){return t.some(s=>s==="null"?r===null:s==="array"?Array.isArray(r):s==="object"?r&&!Array.isArray(r)&&typeof r=="object":s===typeof r)}function me(r,t){return r.kind==="array"&&t.kind==="array"?r.itemType.kind===t.itemType.kind&&typeof r.N=="number":r.kind===t.kind}const se=.96422,ke=.82521,Me=4/29,ve=6/29,Re=3*ve*ve,ct=ve*ve*ve,ht=Math.PI/180,$t=180/Math.PI;function wt(r){return(r%=360)<0&&(r+=360),r}function jt([r,t,s,l]){let f,_;const x=Di((.2225045*(r=Lt(r))+.7168786*(t=Lt(t))+.0606169*(s=Lt(s)))/1);r===t&&t===s?f=_=x:(f=Di((.4360747*r+.3850649*t+.1430804*s)/se),_=Di((.0139322*r+.0971045*t+.7141733*s)/ke));const v=116*x-16;return[v<0?0:v,500*(f-x),200*(x-_),l]}function Lt(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Di(r){return r>ct?Math.pow(r,1/3):r/Re+Me}function Si([r,t,s,l]){let f=(r+16)/116,_=isNaN(t)?f:f+t/500,x=isNaN(s)?f:f-s/200;return f=1*ei(f),_=se*ei(_),x=ke*ei(x),[Pt(3.1338561*_-1.6168667*f-.4906146*x),Pt(-.9787684*_+1.9161415*f+.033454*x),Pt(.0719453*_-.2289914*f+1.4052427*x),l]}function Pt(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function ei(r){return r>ve?r*r*r:Re*(r-Me)}function xi(r){return parseInt(r.padEnd(2,r),16)/255}function Fi(r,t){return qi(t?r/100:r,0,1)}function qi(r,t,s){return Math.min(Math.max(t,r),s)}function an(r){return!r.some(Number.isNaN)}const Qs={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 ti{constructor(t,s,l,f=1,_=!0){this.r=t,this.g=s,this.b=l,this.a=f,_||(this.r*=f,this.g*=f,this.b*=f,f||this.overwriteGetter("rgb",[t,s,l,f]))}static parse(t){if(t instanceof ti)return t;if(typeof t!="string")return;const s=function(l){if((l=l.toLowerCase().trim())==="transparent")return[0,0,0,0];const f=Qs[l];if(f){const[x,v,S]=f;return[x/255,v/255,S/255,1]}if(l.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(l)){const x=l.length<6?1:2;let v=1;return[xi(l.slice(v,v+=x)),xi(l.slice(v,v+=x)),xi(l.slice(v,v+=x)),xi(l.slice(v,v+x)||"ff")]}if(l.startsWith("rgb")){const x=l.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(x){const[v,S,C,P,L,F,j,H,q,K,ie,ge]=x,le=[P||" ",j||" ",K].join("");if(le===" "||le===" /"||le===",,"||le===",,,"){const fe=[C,F,q].join(""),we=fe==="%%%"?100:fe===""?255:0;if(we){const Pe=[qi(+S/we,0,1),qi(+L/we,0,1),qi(+H/we,0,1),ie?Fi(+ie,ge):1];if(an(Pe))return Pe}}return}}const _=l.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(_){const[x,v,S,C,P,L,F,j,H]=_,q=[S||" ",P||" ",F].join("");if(q===" "||q===" /"||q===",,"||q===",,,"){const K=[+v,qi(+C,0,100),qi(+L,0,100),j?Fi(+j,H):1];if(an(K))return function([ie,ge,le,fe]){function we(Pe){const qe=(Pe+ie/30)%12,ut=ge*Math.min(le,1-le);return le-ut*Math.max(-1,Math.min(qe-3,9-qe,1))}return ie=wt(ie),ge/=100,le/=100,[we(0),we(8),we(4),fe]}(K)}}}(t);return s?new ti(...s,!1):void 0}get rgb(){const{r:t,g:s,b:l,a:f}=this,_=f||1/0;return this.overwriteGetter("rgb",[t/_,s/_,l/_,f])}get hcl(){return this.overwriteGetter("hcl",function(t){const[s,l,f,_]=jt(t),x=Math.sqrt(l*l+f*f);return[Math.round(1e4*x)?wt(Math.atan2(f,l)*$t):NaN,x,s,_]}(this.rgb))}get lab(){return this.overwriteGetter("lab",jt(this.rgb))}overwriteGetter(t,s){return Object.defineProperty(this,t,{value:s}),s}toString(){const[t,s,l,f]=this.rgb;return`rgba(${[t,s,l].map(_=>Math.round(255*_)).join(",")},${f})`}}ti.black=new ti(0,0,0,1),ti.white=new ti(1,1,1,1),ti.transparent=new ti(0,0,0,0),ti.red=new ti(1,0,0,1);class cc{constructor(t,s,l){this.sensitivity=t?s?"variant":"case":s?"accent":"base",this.locale=l,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,s){return this.collator.compare(t,s)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class hc{constructor(t,s,l,f,_){this.text=t,this.image=s,this.scale=l,this.fontStack=f,this.textColor=_}}class Mn{constructor(t){this.sections=t}static fromString(t){return new Mn([new hc(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Mn?t:Mn.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class Pn{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Pn)return t;if(typeof t=="number")return new Pn([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const s of t)if(typeof s!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Pn(t)}}toString(){return JSON.stringify(this.values)}}const Hp=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Hn{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Hn)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let s=0;s<t.length;s+=2){const l=t[s],f=t[s+1];if(typeof l!="string"||!Hp.has(l)||!Array.isArray(f)||f.length!==2||typeof f[0]!="number"||typeof f[1]!="number")return}return new Hn(t)}}toString(){return JSON.stringify(this.values)}}class In{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new In({name:t,available:!1}):null}}function eo(r,t,s,l){return typeof r=="number"&&r>=0&&r<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof s=="number"&&s>=0&&s<=255?l===void 0||typeof l=="number"&&l>=0&&l<=1?null:`Invalid rgba value [${[r,t,s,l].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof l=="number"?[r,t,s,l]:[r,t,s]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Cs(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof ti||r instanceof cc||r instanceof Mn||r instanceof Pn||r instanceof Hn||r instanceof In)return!0;if(Array.isArray(r)){for(const t of r)if(!Cs(t))return!1;return!0}if(typeof r=="object"){for(const t in r)if(!Cs(r[t]))return!1;return!0}return!1}function zi(r){if(r===null)return ns;if(typeof r=="string")return Ct;if(typeof r=="boolean")return mt;if(typeof r=="number")return Fe;if(r instanceof ti)return fn;if(r instanceof cc)return Cr;if(r instanceof Mn)return jr;if(r instanceof Pn)return rs;if(r instanceof Hn)return ee;if(r instanceof In)return Mr;if(Array.isArray(r)){const t=r.length;let s;for(const l of r){const f=zi(l);if(s){if(s===f)continue;s=bt;break}s=f}return $(s||bt,t)}return ir}function Jo(r){const t=typeof r;return r===null?"":t==="string"||t==="number"||t==="boolean"?String(r):r instanceof ti||r instanceof Mn||r instanceof Pn||r instanceof Hn||r instanceof In?r.toString():JSON.stringify(r)}class nr{constructor(t,s){this.type=t,this.value=s}static parse(t,s){if(t.length!==2)return s.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Cs(t[1]))return s.error("invalid value");const l=t[1];let f=zi(l);const _=s.expectedType;return f.kind!=="array"||f.N!==0||!_||_.kind!=="array"||typeof _.N=="number"&&_.N!==0||(f=_),new nr(f,l)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Ii{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const qa={string:Ct,number:Fe,boolean:mt,object:ir};class rr{constructor(t,s){this.type=t,this.args=s}static parse(t,s){if(t.length<2)return s.error("Expected at least one argument.");let l,f=1;const _=t[0];if(_==="array"){let v,S;if(t.length>2){const C=t[1];if(typeof C!="string"||!(C in qa)||C==="object")return s.error('The item type argument of "array" must be one of string, number, boolean',1);v=qa[C],f++}else v=bt;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return s.error('The length argument to "array" must be a positive integer literal',2);S=t[2],f++}l=$(v,S)}else{if(!qa[_])throw new Error(`Types doesn't contain name = ${_}`);l=qa[_]}const x=[];for(;f<t.length;f++){const v=s.parse(t[f],f,bt);if(!v)return null;x.push(v)}return new rr(l,x)}evaluate(t){for(let s=0;s<this.args.length;s++){const l=this.args[s].evaluate(t);if(!J(this.type,zi(l)))return l;if(s===this.args.length-1)throw new Ii(`Expected value to be of type ${V(this.type)}, but found ${V(zi(l))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const uc={"to-boolean":mt,"to-color":fn,"to-number":Fe,"to-string":Ct};class sr{constructor(t,s){this.type=t,this.args=s}static parse(t,s){if(t.length<2)return s.error("Expected at least one argument.");const l=t[0];if(!uc[l])throw new Error(`Can't parse ${l} as it is not part of the known types`);if((l==="to-boolean"||l==="to-string")&&t.length!==2)return s.error("Expected one argument.");const f=uc[l],_=[];for(let x=1;x<t.length;x++){const v=s.parse(t[x],x,bt);if(!v)return null;_.push(v)}return new sr(f,_)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let s,l;for(const f of this.args){if(s=f.evaluate(t),l=null,s instanceof ti)return s;if(typeof s=="string"){const _=t.parseColor(s);if(_)return _}else if(Array.isArray(s)&&(l=s.length<3||s.length>4?`Invalid rbga value ${JSON.stringify(s)}: expected an array containing either three or four numeric values.`:eo(s[0],s[1],s[2],s[3]),!l))return new ti(s[0]/255,s[1]/255,s[2]/255,s[3])}throw new Ii(l||`Could not parse color from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"padding":{let s;for(const l of this.args){s=l.evaluate(t);const f=Pn.parse(s);if(f)return f}throw new Ii(`Could not parse padding from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"variableAnchorOffsetCollection":{let s;for(const l of this.args){s=l.evaluate(t);const f=Hn.parse(s);if(f)return f}throw new Ii(`Could not parse variableAnchorOffsetCollection from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}case"number":{let s=null;for(const l of this.args){if(s=l.evaluate(t),s===null)return 0;const f=Number(s);if(!isNaN(f))return f}throw new Ii(`Could not convert ${JSON.stringify(s)} to number.`)}case"formatted":return Mn.fromString(Jo(this.args[0].evaluate(t)));case"resolvedImage":return In.fromString(Jo(this.args[0].evaluate(t)));default:return Jo(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const qp=["Unknown","Point","LineString","Polygon"];class Za{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"?qp[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let s=this._parseColorCache[t];return s||(s=this._parseColorCache[t]=ti.parse(t)),s}}class Ms{constructor(t,s,l=[],f,_=new Tr,x=[]){this.registry=t,this.path=l,this.key=l.map(v=>`[${v}]`).join(""),this.scope=_,this.errors=x,this.expectedType=f,this._isConstant=s}parse(t,s,l,f,_={}){return s?this.concat(s,l,f)._parse(t,_):this._parse(t,_)}_parse(t,s){function l(f,_,x){return x==="assert"?new rr(_,[f]):x==="coerce"?new sr(_,[f]):f}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const f=t[0];if(typeof f!="string")return this.error(`Expression name must be a string, but found ${typeof f} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const _=this.registry[f];if(_){let x=_.parse(t,this);if(!x)return null;if(this.expectedType){const v=this.expectedType,S=x.type;if(v.kind!=="string"&&v.kind!=="number"&&v.kind!=="boolean"&&v.kind!=="object"&&v.kind!=="array"||S.kind!=="value")if(v.kind!=="color"&&v.kind!=="formatted"&&v.kind!=="resolvedImage"||S.kind!=="value"&&S.kind!=="string")if(v.kind!=="padding"||S.kind!=="value"&&S.kind!=="number"&&S.kind!=="array")if(v.kind!=="variableAnchorOffsetCollection"||S.kind!=="value"&&S.kind!=="array"){if(this.checkSubtype(v,S))return null}else x=l(x,v,s.typeAnnotation||"coerce");else x=l(x,v,s.typeAnnotation||"coerce");else x=l(x,v,s.typeAnnotation||"coerce");else x=l(x,v,s.typeAnnotation||"assert")}if(!(x instanceof nr)&&x.type.kind!=="resolvedImage"&&this._isConstant(x)){const v=new Za;try{x=new nr(x.type,x.evaluate(v))}catch(S){return this.error(S.message),null}}return x}return this.error(`Unknown expression "${f}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,s,l){const f=typeof t=="number"?this.path.concat(t):this.path,_=l?this.scope.concat(l):this.scope;return new Ms(this.registry,this._isConstant,f,s||null,_,this.errors)}error(t,...s){const l=`${this.key}${s.map(f=>`[${f}]`).join("")}`;this.errors.push(new on(l,t))}checkSubtype(t,s){const l=J(t,s);return l&&this.error(l),l}}class ss{constructor(t,s){this.type=s.type,this.bindings=[].concat(t),this.result=s}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const s of this.bindings)t(s[1]);t(this.result)}static parse(t,s){if(t.length<4)return s.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const l=[];for(let _=1;_<t.length-1;_+=2){const x=t[_];if(typeof x!="string")return s.error(`Expected string, but found ${typeof x} instead.`,_);if(/[^a-zA-Z0-9_]/.test(x))return s.error("Variable names must contain only alphanumeric characters or '_'.",_);const v=s.parse(t[_+1],_+1);if(!v)return null;l.push([x,v])}const f=s.parse(t[t.length-1],t.length-1,s.expectedType,l);return f?new ss(l,f):null}outputDefined(){return this.result.outputDefined()}}class Wt{constructor(t,s){this.type=s.type,this.name=t,this.boundExpression=s}static parse(t,s){if(t.length!==2||typeof t[1]!="string")return s.error("'var' expression requires exactly one string literal argument.");const l=t[1];return s.scope.has(l)?new Wt(l,s.scope.get(l)):s.error(`Unknown variable "${l}". Make sure "${l}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class dc{constructor(t,s,l){this.type=t,this.index=s,this.input=l}static parse(t,s){if(t.length!==3)return s.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const l=s.parse(t[1],1,Fe),f=s.parse(t[2],2,$(s.expectedType||bt));return l&&f?new dc(f.type.itemType,l,f):null}evaluate(t){const s=this.index.evaluate(t),l=this.input.evaluate(t);if(s<0)throw new Ii(`Array index out of bounds: ${s} < 0.`);if(s>=l.length)throw new Ii(`Array index out of bounds: ${s} > ${l.length-1}.`);if(s!==Math.floor(s))throw new Ii(`Array index must be an integer, but found ${s} instead.`);return l[s]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class pc{constructor(t,s){this.type=mt,this.needle=t,this.haystack=s}static parse(t,s){if(t.length!==3)return s.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const l=s.parse(t[1],1,bt),f=s.parse(t[2],2,bt);return l&&f?ce(l.type,[mt,Ct,Fe,ns,bt])?new pc(l,f):s.error(`Expected first argument to be of type boolean, string, number or null, but found ${V(l.type)} instead`):null}evaluate(t){const s=this.needle.evaluate(t),l=this.haystack.evaluate(t);if(!l)return!1;if(!de(s,["boolean","string","number","null"]))throw new Ii(`Expected first argument to be of type boolean, string, number or null, but found ${V(zi(s))} instead.`);if(!de(l,["string","array"]))throw new Ii(`Expected second argument to be of type array or string, but found ${V(zi(l))} instead.`);return l.indexOf(s)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class to{constructor(t,s,l){this.type=Fe,this.needle=t,this.haystack=s,this.fromIndex=l}static parse(t,s){if(t.length<=2||t.length>=5)return s.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const l=s.parse(t[1],1,bt),f=s.parse(t[2],2,bt);if(!l||!f)return null;if(!ce(l.type,[mt,Ct,Fe,ns,bt]))return s.error(`Expected first argument to be of type boolean, string, number or null, but found ${V(l.type)} instead`);if(t.length===4){const _=s.parse(t[3],3,Fe);return _?new to(l,f,_):null}return new to(l,f)}evaluate(t){const s=this.needle.evaluate(t),l=this.haystack.evaluate(t);if(!de(s,["boolean","string","number","null"]))throw new Ii(`Expected first argument to be of type boolean, string, number or null, but found ${V(zi(s))} instead.`);let f;if(this.fromIndex&&(f=this.fromIndex.evaluate(t)),de(l,["string"])){const _=l.indexOf(s,f);return _===-1?-1:[...l.slice(0,_)].length}if(de(l,["array"]))return l.indexOf(s,f);throw new Ii(`Expected second argument to be of type array or string, but found ${V(zi(l))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class fc{constructor(t,s,l,f,_,x){this.inputType=t,this.type=s,this.input=l,this.cases=f,this.outputs=_,this.otherwise=x}static parse(t,s){if(t.length<5)return s.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return s.error("Expected an even number of arguments.");let l,f;s.expectedType&&s.expectedType.kind!=="value"&&(f=s.expectedType);const _={},x=[];for(let C=2;C<t.length-1;C+=2){let P=t[C];const L=t[C+1];Array.isArray(P)||(P=[P]);const F=s.concat(C);if(P.length===0)return F.error("Expected at least one branch label.");for(const H of P){if(typeof H!="number"&&typeof H!="string")return F.error("Branch labels must be numbers or strings.");if(typeof H=="number"&&Math.abs(H)>Number.MAX_SAFE_INTEGER)return F.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof H=="number"&&Math.floor(H)!==H)return F.error("Numeric branch labels must be integer values.");if(l){if(F.checkSubtype(l,zi(H)))return null}else l=zi(H);if(_[String(H)]!==void 0)return F.error("Branch labels must be unique.");_[String(H)]=x.length}const j=s.parse(L,C,f);if(!j)return null;f=f||j.type,x.push(j)}const v=s.parse(t[1],1,bt);if(!v)return null;const S=s.parse(t[t.length-1],t.length-1,f);return S?v.type.kind!=="value"&&s.concat(1).checkSubtype(l,v.type)?null:new fc(l,f,v,_,x,S):null}evaluate(t){const s=this.input.evaluate(t);return(zi(s)===this.inputType&&this.outputs[this.cases[s]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Wa{constructor(t,s,l){this.type=t,this.branches=s,this.otherwise=l}static parse(t,s){if(t.length<4)return s.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return s.error("Expected an odd number of arguments.");let l;s.expectedType&&s.expectedType.kind!=="value"&&(l=s.expectedType);const f=[];for(let x=1;x<t.length-1;x+=2){const v=s.parse(t[x],x,mt);if(!v)return null;const S=s.parse(t[x+1],x+1,l);if(!S)return null;f.push([v,S]),l=l||S.type}const _=s.parse(t[t.length-1],t.length-1,l);if(!_)return null;if(!l)throw new Error("Can't infer output type");return new Wa(l,f,_)}evaluate(t){for(const[s,l]of this.branches)if(s.evaluate(t))return l.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[s,l]of this.branches)t(s),t(l);t(this.otherwise)}outputDefined(){return this.branches.every(([t,s])=>s.outputDefined())&&this.otherwise.outputDefined()}}class Qo{constructor(t,s,l,f){this.type=t,this.input=s,this.beginIndex=l,this.endIndex=f}static parse(t,s){if(t.length<=2||t.length>=5)return s.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const l=s.parse(t[1],1,bt),f=s.parse(t[2],2,Fe);if(!l||!f)return null;if(!ce(l.type,[$(bt),Ct,bt]))return s.error(`Expected first argument to be of type array or string, but found ${V(l.type)} instead`);if(t.length===4){const _=s.parse(t[3],3,Fe);return _?new Qo(l.type,l,f,_):null}return new Qo(l.type,l,f)}evaluate(t){const s=this.input.evaluate(t),l=this.beginIndex.evaluate(t);let f;if(this.endIndex&&(f=this.endIndex.evaluate(t)),de(s,["string"]))return[...s].slice(l,f).join("");if(de(s,["array"]))return s.slice(l,f);throw new Ii(`Expected first argument to be of type array or string, but found ${V(zi(s))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Ga(r,t){const s=r.length-1;let l,f,_=0,x=s,v=0;for(;_<=x;)if(v=Math.floor((_+x)/2),l=r[v],f=r[v+1],l<=t){if(v===s||t<f)return v;_=v+1}else{if(!(l>t))throw new Ii("Input is not a number.");x=v-1}return 0}class io{constructor(t,s,l){this.type=t,this.input=s,this.labels=[],this.outputs=[];for(const[f,_]of l)this.labels.push(f),this.outputs.push(_)}static parse(t,s){if(t.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return s.error("Expected an even number of arguments.");const l=s.parse(t[1],1,Fe);if(!l)return null;const f=[];let _=null;s.expectedType&&s.expectedType.kind!=="value"&&(_=s.expectedType);for(let x=1;x<t.length;x+=2){const v=x===1?-1/0:t[x],S=t[x+1],C=x,P=x+1;if(typeof v!="number")return s.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',C);if(f.length&&f[f.length-1][0]>=v)return s.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',C);const L=s.parse(S,P,_);if(!L)return null;_=_||L.type,f.push([v,L])}return new io(_,l,f)}evaluate(t){const s=this.labels,l=this.outputs;if(s.length===1)return l[0].evaluate(t);const f=this.input.evaluate(t);if(f<=s[0])return l[0].evaluate(t);const _=s.length;return f>=s[_-1]?l[_-1].evaluate(t):l[Ga(s,f)].evaluate(t)}eachChild(t){t(this.input);for(const s of this.outputs)t(s)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function pu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Zp=fu;function fu(r,t,s,l){this.cx=3*r,this.bx=3*(s-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(l-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=t,this.p2x=s,this.p2y=l}fu.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,t){if(t===void 0&&(t=1e-6),r<0)return 0;if(r>1)return 1;for(var s=r,l=0;l<8;l++){var f=this.sampleCurveX(s)-r;if(Math.abs(f)<t)return s;var _=this.sampleCurveDerivativeX(s);if(Math.abs(_)<1e-6)break;s-=f/_}var x=0,v=1;for(s=r,l=0;l<20&&(f=this.sampleCurveX(s),!(Math.abs(f-r)<t));l++)r>f?x=s:v=s,s=.5*(v-x)+x;return s},solve:function(r,t){return this.sampleCurveY(this.solveCurveX(r,t))}};var Wp=pu(Zp);function Ps(r,t,s){return r+s*(t-r)}function ea(r,t,s){return r.map((l,f)=>Ps(l,t[f],s))}const mn={number:Ps,color:function(r,t,s,l="rgb"){switch(l){case"rgb":{const[f,_,x,v]=ea(r.rgb,t.rgb,s);return new ti(f,_,x,v,!1)}case"hcl":{const[f,_,x,v]=r.hcl,[S,C,P,L]=t.hcl;let F,j;if(isNaN(f)||isNaN(S))isNaN(f)?isNaN(S)?F=NaN:(F=S,x!==1&&x!==0||(j=C)):(F=f,P!==1&&P!==0||(j=_));else{let ge=S-f;S>f&&ge>180?ge-=360:S<f&&f-S>180&&(ge+=360),F=f+s*ge}const[H,q,K,ie]=function([ge,le,fe,we]){return ge=isNaN(ge)?0:ge*ht,Si([fe,Math.cos(ge)*le,Math.sin(ge)*le,we])}([F,j??Ps(_,C,s),Ps(x,P,s),Ps(v,L,s)]);return new ti(H,q,K,ie,!1)}case"lab":{const[f,_,x,v]=Si(ea(r.lab,t.lab,s));return new ti(f,_,x,v,!1)}}},array:ea,padding:function(r,t,s){return new Pn(ea(r.values,t.values,s))},variableAnchorOffsetCollection:function(r,t,s){const l=r.values,f=t.values;if(l.length!==f.length)throw new Ii(`Cannot interpolate values of different length. from: ${r.toString()}, to: ${t.toString()}`);const _=[];for(let x=0;x<l.length;x+=2){if(l[x]!==f[x])throw new Ii(`Cannot interpolate values containing mismatched anchors. from[${x}]: ${l[x]}, to[${x}]: ${f[x]}`);_.push(l[x]);const[v,S]=l[x+1],[C,P]=f[x+1];_.push([Ps(v,C,s),Ps(S,P,s)])}return new Hn(_)}};class gn{constructor(t,s,l,f,_){this.type=t,this.operator=s,this.interpolation=l,this.input=f,this.labels=[],this.outputs=[];for(const[x,v]of _)this.labels.push(x),this.outputs.push(v)}static interpolationFactor(t,s,l,f){let _=0;if(t.name==="exponential")_=Ya(s,t.base,l,f);else if(t.name==="linear")_=Ya(s,1,l,f);else if(t.name==="cubic-bezier"){const x=t.controlPoints;_=new Wp(x[0],x[1],x[2],x[3]).solve(Ya(s,1,l,f))}return _}static parse(t,s){let[l,f,_,...x]=t;if(!Array.isArray(f)||f.length===0)return s.error("Expected an interpolation type expression.",1);if(f[0]==="linear")f={name:"linear"};else if(f[0]==="exponential"){const C=f[1];if(typeof C!="number")return s.error("Exponential interpolation requires a numeric base.",1,1);f={name:"exponential",base:C}}else{if(f[0]!=="cubic-bezier")return s.error(`Unknown interpolation type ${String(f[0])}`,1,0);{const C=f.slice(1);if(C.length!==4||C.some(P=>typeof P!="number"||P<0||P>1))return s.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);f={name:"cubic-bezier",controlPoints:C}}}if(t.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return s.error("Expected an even number of arguments.");if(_=s.parse(_,2,Fe),!_)return null;const v=[];let S=null;l==="interpolate-hcl"||l==="interpolate-lab"?S=fn:s.expectedType&&s.expectedType.kind!=="value"&&(S=s.expectedType);for(let C=0;C<x.length;C+=2){const P=x[C],L=x[C+1],F=C+3,j=C+4;if(typeof P!="number")return s.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',F);if(v.length&&v[v.length-1][0]>=P)return s.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',F);const H=s.parse(L,j,S);if(!H)return null;S=S||H.type,v.push([P,H])}return me(S,Fe)||me(S,fn)||me(S,rs)||me(S,ee)||me(S,$(Fe))?new gn(S,l,f,_,v):s.error(`Type ${V(S)} is not interpolatable.`)}evaluate(t){const s=this.labels,l=this.outputs;if(s.length===1)return l[0].evaluate(t);const f=this.input.evaluate(t);if(f<=s[0])return l[0].evaluate(t);const _=s.length;if(f>=s[_-1])return l[_-1].evaluate(t);const x=Ga(s,f),v=gn.interpolationFactor(this.interpolation,f,s[x],s[x+1]),S=l[x].evaluate(t),C=l[x+1].evaluate(t);switch(this.operator){case"interpolate":return mn[this.type.kind](S,C,v);case"interpolate-hcl":return mn.color(S,C,v,"hcl");case"interpolate-lab":return mn.color(S,C,v,"lab")}}eachChild(t){t(this.input);for(const s of this.outputs)t(s)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Ya(r,t,s,l){const f=l-s,_=r-s;return f===0?0:t===1?_/f:(Math.pow(t,_)-1)/(Math.pow(t,f)-1)}class Xa{constructor(t,s){this.type=t,this.args=s}static parse(t,s){if(t.length<2)return s.error("Expectected at least one argument.");let l=null;const f=s.expectedType;f&&f.kind!=="value"&&(l=f);const _=[];for(const v of t.slice(1)){const S=s.parse(v,1+_.length,l,void 0,{typeAnnotation:"omit"});if(!S)return null;l=l||S.type,_.push(S)}if(!l)throw new Error("No output type");const x=f&&_.some(v=>J(f,v.type));return new Xa(x?bt:l,_)}evaluate(t){let s,l=null,f=0;for(const _ of this.args)if(f++,l=_.evaluate(t),l&&l instanceof In&&!l.available&&(s||(s=l.name),l=null,f===this.args.length&&(l=s)),l!==null)break;return l}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Ka(r,t){return r==="=="||r==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function mu(r,t,s,l){return l.compare(t,s)===0}function no(r,t,s){const l=r!=="=="&&r!=="!=";return class lx{constructor(_,x,v){this.type=mt,this.lhs=_,this.rhs=x,this.collator=v,this.hasUntypedArgument=_.type.kind==="value"||x.type.kind==="value"}static parse(_,x){if(_.length!==3&&_.length!==4)return x.error("Expected two or three arguments.");const v=_[0];let S=x.parse(_[1],1,bt);if(!S)return null;if(!Ka(v,S.type))return x.concat(1).error(`"${v}" comparisons are not supported for type '${V(S.type)}'.`);let C=x.parse(_[2],2,bt);if(!C)return null;if(!Ka(v,C.type))return x.concat(2).error(`"${v}" comparisons are not supported for type '${V(C.type)}'.`);if(S.type.kind!==C.type.kind&&S.type.kind!=="value"&&C.type.kind!=="value")return x.error(`Cannot compare types '${V(S.type)}' and '${V(C.type)}'.`);l&&(S.type.kind==="value"&&C.type.kind!=="value"?S=new rr(C.type,[S]):S.type.kind!=="value"&&C.type.kind==="value"&&(C=new rr(S.type,[C])));let P=null;if(_.length===4){if(S.type.kind!=="string"&&C.type.kind!=="string"&&S.type.kind!=="value"&&C.type.kind!=="value")return x.error("Cannot use collator to compare non-string types.");if(P=x.parse(_[3],3,Cr),!P)return null}return new lx(S,C,P)}evaluate(_){const x=this.lhs.evaluate(_),v=this.rhs.evaluate(_);if(l&&this.hasUntypedArgument){const S=zi(x),C=zi(v);if(S.kind!==C.kind||S.kind!=="string"&&S.kind!=="number")throw new Ii(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${S.kind}, ${C.kind}) instead.`)}if(this.collator&&!l&&this.hasUntypedArgument){const S=zi(x),C=zi(v);if(S.kind!=="string"||C.kind!=="string")return t(_,x,v)}return this.collator?s(_,x,v,this.collator.evaluate(_)):t(_,x,v)}eachChild(_){_(this.lhs),_(this.rhs),this.collator&&_(this.collator)}outputDefined(){return!0}}}const Gp=no("==",function(r,t,s){return t===s},mu),gu=no("!=",function(r,t,s){return t!==s},function(r,t,s,l){return!mu(0,t,s,l)}),yu=no("<",function(r,t,s){return t<s},function(r,t,s,l){return l.compare(t,s)<0}),Yp=no(">",function(r,t,s){return t>s},function(r,t,s,l){return l.compare(t,s)>0}),Xp=no("<=",function(r,t,s){return t<=s},function(r,t,s,l){return l.compare(t,s)<=0}),_u=no(">=",function(r,t,s){return t>=s},function(r,t,s,l){return l.compare(t,s)>=0});class ta{constructor(t,s,l){this.type=Cr,this.locale=l,this.caseSensitive=t,this.diacriticSensitive=s}static parse(t,s){if(t.length!==2)return s.error("Expected one argument.");const l=t[1];if(typeof l!="object"||Array.isArray(l))return s.error("Collator options argument must be an object.");const f=s.parse(l["case-sensitive"]!==void 0&&l["case-sensitive"],1,mt);if(!f)return null;const _=s.parse(l["diacritic-sensitive"]!==void 0&&l["diacritic-sensitive"],1,mt);if(!_)return null;let x=null;return l.locale&&(x=s.parse(l.locale,1,Ct),!x)?null:new ta(f,_,x)}evaluate(t){return new cc(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class mc{constructor(t,s,l,f,_){this.type=Ct,this.number=t,this.locale=s,this.currency=l,this.minFractionDigits=f,this.maxFractionDigits=_}static parse(t,s){if(t.length!==3)return s.error("Expected two arguments.");const l=s.parse(t[1],1,Fe);if(!l)return null;const f=t[2];if(typeof f!="object"||Array.isArray(f))return s.error("NumberFormat options argument must be an object.");let _=null;if(f.locale&&(_=s.parse(f.locale,1,Ct),!_))return null;let x=null;if(f.currency&&(x=s.parse(f.currency,1,Ct),!x))return null;let v=null;if(f["min-fraction-digits"]&&(v=s.parse(f["min-fraction-digits"],1,Fe),!v))return null;let S=null;return f["max-fraction-digits"]&&(S=s.parse(f["max-fraction-digits"],1,Fe),!S)?null:new mc(l,_,x,v,S)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Ja{constructor(t){this.type=jr,this.sections=t}static parse(t,s){if(t.length<2)return s.error("Expected at least one argument.");const l=t[1];if(!Array.isArray(l)&&typeof l=="object")return s.error("First argument must be an image or text section.");const f=[];let _=!1;for(let x=1;x<=t.length-1;++x){const v=t[x];if(_&&typeof v=="object"&&!Array.isArray(v)){_=!1;let S=null;if(v["font-scale"]&&(S=s.parse(v["font-scale"],1,Fe),!S))return null;let C=null;if(v["text-font"]&&(C=s.parse(v["text-font"],1,$(Ct)),!C))return null;let P=null;if(v["text-color"]&&(P=s.parse(v["text-color"],1,fn),!P))return null;const L=f[f.length-1];L.scale=S,L.font=C,L.textColor=P}else{const S=s.parse(t[x],1,bt);if(!S)return null;const C=S.type.kind;if(C!=="string"&&C!=="value"&&C!=="null"&&C!=="resolvedImage")return s.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");_=!0,f.push({content:S,scale:null,font:null,textColor:null})}}return new Ja(f)}evaluate(t){return new Mn(this.sections.map(s=>{const l=s.content.evaluate(t);return zi(l)===Mr?new hc("",l,null,null,null):new hc(Jo(l),null,s.scale?s.scale.evaluate(t):null,s.font?s.font.evaluate(t).join(","):null,s.textColor?s.textColor.evaluate(t):null)}))}eachChild(t){for(const s of this.sections)t(s.content),s.scale&&t(s.scale),s.font&&t(s.font),s.textColor&&t(s.textColor)}outputDefined(){return!1}}class gc{constructor(t){this.type=Mr,this.input=t}static parse(t,s){if(t.length!==2)return s.error("Expected two arguments.");const l=s.parse(t[1],1,Ct);return l?new gc(l):s.error("No image name provided.")}evaluate(t){const s=this.input.evaluate(t),l=In.fromString(s);return l&&t.availableImages&&(l.available=t.availableImages.indexOf(s)>-1),l}eachChild(t){t(this.input)}outputDefined(){return!1}}class yc{constructor(t){this.type=Fe,this.input=t}static parse(t,s){if(t.length!==2)return s.error(`Expected 1 argument, but found ${t.length-1} instead.`);const l=s.parse(t[1],1);return l?l.type.kind!=="array"&&l.type.kind!=="string"&&l.type.kind!=="value"?s.error(`Expected argument of type string or array, but found ${V(l.type)} instead.`):new yc(l):null}evaluate(t){const s=this.input.evaluate(t);if(typeof s=="string")return[...s].length;if(Array.isArray(s))return s.length;throw new Ii(`Expected value to be of type string or array, but found ${V(zi(s))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const Pr=8192;function Kp(r,t){const s=(180+r[0])/360,l=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,f=Math.pow(2,t.z);return[Math.round(s*f*Pr),Math.round(l*f*Pr)]}function _c(r,t){const s=Math.pow(2,t.z);return[(f=(r[0]/Pr+t.x)/s,360*f-180),(l=(r[1]/Pr+t.y)/s,360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180))-90)];var l,f}function Is(r,t){r[0]=Math.min(r[0],t[0]),r[1]=Math.min(r[1],t[1]),r[2]=Math.max(r[2],t[0]),r[3]=Math.max(r[3],t[1])}function os(r,t){return!(r[0]<=t[0]||r[2]>=t[2]||r[1]<=t[1]||r[3]>=t[3])}function Yt(r,t,s){const l=r[0]-t[0],f=r[1]-t[1],_=r[0]-s[0],x=r[1]-s[1];return l*x-_*f==0&&l*_<=0&&f*x<=0}function Qa(r,t,s,l){return(f=[l[0]-s[0],l[1]-s[1]])[0]*(_=[t[0]-r[0],t[1]-r[1]])[1]-f[1]*_[0]!=0&&!(!bu(r,t,s,l)||!bu(s,l,r,t));var f,_}function Jp(r,t,s){for(const l of s)for(let f=0;f<l.length-1;++f)if(Qa(r,t,l[f],l[f+1]))return!0;return!1}function ro(r,t,s=!1){let l=!1;for(const v of t)for(let S=0;S<v.length-1;S++){if(Yt(r,v[S],v[S+1]))return s;(_=v[S])[1]>(f=r)[1]!=(x=v[S+1])[1]>f[1]&&f[0]<(x[0]-_[0])*(f[1]-_[1])/(x[1]-_[1])+_[0]&&(l=!l)}var f,_,x;return l}function Qp(r,t){for(const s of t)if(ro(r,s))return!0;return!1}function xu(r,t){for(const s of r)if(!ro(s,t))return!1;for(let s=0;s<r.length-1;++s)if(Jp(r[s],r[s+1],t))return!1;return!0}function ef(r,t){for(const s of t)if(xu(r,s))return!0;return!1}function bu(r,t,s,l){const f=l[0]-s[0],_=l[1]-s[1],x=(r[0]-s[0])*_-f*(r[1]-s[1]),v=(t[0]-s[0])*_-f*(t[1]-s[1]);return x>0&&v<0||x<0&&v>0}function xc(r,t,s){const l=[];for(let f=0;f<r.length;f++){const _=[];for(let x=0;x<r[f].length;x++){const v=Kp(r[f][x],s);Is(t,v),_.push(v)}l.push(_)}return l}function vu(r,t,s){const l=[];for(let f=0;f<r.length;f++){const _=xc(r[f],t,s);l.push(_)}return l}function wu(r,t,s,l){if(r[0]<s[0]||r[0]>s[2]){const f=.5*l;let _=r[0]-s[0]>f?-l:s[0]-r[0]>f?l:0;_===0&&(_=r[0]-s[2]>f?-l:s[2]-r[0]>f?l:0),r[0]+=_}Is(t,r)}function ku(r,t,s,l){const f=Math.pow(2,l.z)*Pr,_=[l.x*Pr,l.y*Pr],x=[];for(const v of r)for(const S of v){const C=[S.x+_[0],S.y+_[1]];wu(C,t,s,f),x.push(C)}return x}function Su(r,t,s,l){const f=Math.pow(2,l.z)*Pr,_=[l.x*Pr,l.y*Pr],x=[];for(const S of r){const C=[];for(const P of S){const L=[P.x+_[0],P.y+_[1]];Is(t,L),C.push(L)}x.push(C)}if(t[2]-t[0]<=f/2){(v=t)[0]=v[1]=1/0,v[2]=v[3]=-1/0;for(const S of x)for(const C of S)wu(C,t,s,f)}var v;return x}class As{constructor(t,s){this.type=mt,this.geojson=t,this.geometries=s}static parse(t,s){if(t.length!==2)return s.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Cs(t[1])){const l=t[1];if(l.type==="FeatureCollection"){const f=[];for(const _ of l.features){const{type:x,coordinates:v}=_.geometry;x==="Polygon"&&f.push(v),x==="MultiPolygon"&&f.push(...v)}if(f.length)return new As(l,{type:"MultiPolygon",coordinates:f})}else if(l.type==="Feature"){const f=l.geometry.type;if(f==="Polygon"||f==="MultiPolygon")return new As(l,l.geometry)}else if(l.type==="Polygon"||l.type==="MultiPolygon")return new As(l,l)}return s.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(s,l){const f=[1/0,1/0,-1/0,-1/0],_=[1/0,1/0,-1/0,-1/0],x=s.canonicalID();if(l.type==="Polygon"){const v=xc(l.coordinates,_,x),S=ku(s.geometry(),f,_,x);if(!os(f,_))return!1;for(const C of S)if(!ro(C,v))return!1}if(l.type==="MultiPolygon"){const v=vu(l.coordinates,_,x),S=ku(s.geometry(),f,_,x);if(!os(f,_))return!1;for(const C of S)if(!Qp(C,v))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(s,l){const f=[1/0,1/0,-1/0,-1/0],_=[1/0,1/0,-1/0,-1/0],x=s.canonicalID();if(l.type==="Polygon"){const v=xc(l.coordinates,_,x),S=Su(s.geometry(),f,_,x);if(!os(f,_))return!1;for(const C of S)if(!xu(C,v))return!1}if(l.type==="MultiPolygon"){const v=vu(l.coordinates,_,x),S=Su(s.geometry(),f,_,x);if(!os(f,_))return!1;for(const C of S)if(!ef(C,v))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Eu=class{constructor(r=[],t=(s,l)=>s<l?-1:s>l?1:0){if(this.data=r,this.length=this.data.length,this.compare=t,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:t,compare:s}=this,l=t[r];for(;r>0;){const f=r-1>>1,_=t[f];if(s(l,_)>=0)break;t[r]=_,r=f}t[r]=l}_down(r){const{data:t,compare:s}=this,l=this.length>>1,f=t[r];for(;r<l;){let _=1+(r<<1);const x=_+1;if(x<this.length&&s(t[x],t[_])<0&&(_=x),s(t[_],f)>=0)break;t[r]=t[_],r=_}t[r]=f}};function tf(r,t,s,l,f){Tu(r,t,s,l||r.length-1,f||nf)}function Tu(r,t,s,l,f){for(;l>s;){if(l-s>600){var _=l-s+1,x=t-s+1,v=Math.log(_),S=.5*Math.exp(2*v/3),C=.5*Math.sqrt(v*S*(_-S)/_)*(x-_/2<0?-1:1);Tu(r,t,Math.max(s,Math.floor(t-x*S/_+C)),Math.min(l,Math.floor(t+(_-x)*S/_+C)),f)}var P=r[t],L=s,F=l;for(ia(r,s,t),f(r[l],P)>0&&ia(r,s,l);L<F;){for(ia(r,L,F),L++,F--;f(r[L],P)<0;)L++;for(;f(r[F],P)>0;)F--}f(r[s],P)===0?ia(r,s,F):ia(r,++F,l),F<=t&&(s=F+1),t<=F&&(l=F-1)}}function ia(r,t,s){var l=r[t];r[t]=r[s],r[s]=l}function nf(r,t){return r<t?-1:r>t?1:0}function el(r,t){if(r.length<=1)return[r];const s=[];let l,f;for(const _ of r){const x=sf(_);x!==0&&(_.area=Math.abs(x),f===void 0&&(f=x<0),f===x<0?(l&&s.push(l),l=[_]):l.push(_))}if(l&&s.push(l),t>1)for(let _=0;_<s.length;_++)s[_].length<=t||(tf(s[_],t,1,s[_].length-1,rf),s[_]=s[_].slice(0,t));return s}function rf(r,t){return t.area-r.area}function sf(r){let t=0;for(let s,l,f=0,_=r.length,x=_-1;f<_;x=f++)s=r[f],l=r[x],t+=(l.x-s.x)*(s.y+l.y);return t}const Cu=1/298.257223563,Mu=Cu*(2-Cu),Pu=Math.PI/180;class bc{constructor(t){const s=6378.137*Pu*1e3,l=Math.cos(t*Pu),f=1/(1-Mu*(1-l*l)),_=Math.sqrt(f);this.kx=s*_*l,this.ky=s*_*f*(1-Mu)}distance(t,s){const l=this.wrap(t[0]-s[0])*this.kx,f=(t[1]-s[1])*this.ky;return Math.sqrt(l*l+f*f)}pointOnLine(t,s){let l,f,_,x,v=1/0;for(let S=0;S<t.length-1;S++){let C=t[S][0],P=t[S][1],L=this.wrap(t[S+1][0]-C)*this.kx,F=(t[S+1][1]-P)*this.ky,j=0;L===0&&F===0||(j=(this.wrap(s[0]-C)*this.kx*L+(s[1]-P)*this.ky*F)/(L*L+F*F),j>1?(C=t[S+1][0],P=t[S+1][1]):j>0&&(C+=L/this.kx*j,P+=F/this.ky*j)),L=this.wrap(s[0]-C)*this.kx,F=(s[1]-P)*this.ky;const H=L*L+F*F;H<v&&(v=H,l=C,f=P,_=S,x=j)}return{point:[l,f],index:_,t:Math.max(0,Math.min(1,x))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function Iu(r,t){return t[0]-r[0]}function tl(r){return r[1]-r[0]+1}function Ur(r,t){return r[1]>=r[0]&&r[1]<t}function vc(r,t){if(r[0]>r[1])return[null,null];const s=tl(r);if(t){if(s===2)return[r,null];const f=Math.floor(s/2);return[[r[0],r[0]+f],[r[0]+f,r[1]]]}if(s===1)return[r,null];const l=Math.floor(s/2)-1;return[[r[0],r[0]+l],[r[0]+l+1,r[1]]]}function wc(r,t){if(!Ur(t,r.length))return[1/0,1/0,-1/0,-1/0];const s=[1/0,1/0,-1/0,-1/0];for(let l=t[0];l<=t[1];++l)Is(s,r[l]);return s}function kc(r){const t=[1/0,1/0,-1/0,-1/0];for(const s of r)for(const l of s)Is(t,l);return t}function il(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function Sc(r,t,s){if(!il(r)||!il(t))return NaN;let l=0,f=0;return r[2]<t[0]&&(l=t[0]-r[2]),r[0]>t[2]&&(l=r[0]-t[2]),r[1]>t[3]&&(f=r[1]-t[3]),r[3]<t[1]&&(f=t[1]-r[3]),s.distance([0,0],[l,f])}function Ds(r,t,s){const l=s.pointOnLine(t,r);return s.distance(r,l.point)}function Ec(r,t,s,l,f){const _=Math.min(Ds(r,[s,l],f),Ds(t,[s,l],f)),x=Math.min(Ds(s,[r,t],f),Ds(l,[r,t],f));return Math.min(_,x)}function of(r,t,s,l,f){if(!Ur(t,r.length)||!Ur(l,s.length))return 1/0;let _=1/0;for(let x=t[0];x<t[1];++x){const v=r[x],S=r[x+1];for(let C=l[0];C<l[1];++C){const P=s[C],L=s[C+1];if(Qa(v,S,P,L))return 0;_=Math.min(_,Ec(v,S,P,L,f))}}return _}function Ci(r,t,s,l,f){if(!Ur(t,r.length)||!Ur(l,s.length))return NaN;let _=1/0;for(let x=t[0];x<=t[1];++x)for(let v=l[0];v<=l[1];++v)if(_=Math.min(_,f.distance(r[x],s[v])),_===0)return _;return _}function af(r,t,s){if(ro(r,t,!0))return 0;let l=1/0;for(const f of t){const _=f[0],x=f[f.length-1];if(_!==x&&(l=Math.min(l,Ds(r,[x,_],s)),l===0))return l;const v=s.pointOnLine(f,r);if(l=Math.min(l,s.distance(r,v.point)),l===0)return l}return l}function It(r,t,s,l){if(!Ur(t,r.length))return NaN;for(let _=t[0];_<=t[1];++_)if(ro(r[_],s,!0))return 0;let f=1/0;for(let _=t[0];_<t[1];++_){const x=r[_],v=r[_+1];for(const S of s)for(let C=0,P=S.length,L=P-1;C<P;L=C++){const F=S[L],j=S[C];if(Qa(x,v,F,j))return 0;f=Math.min(f,Ec(x,v,F,j,l))}}return f}function nl(r,t){for(const s of r)for(const l of s)if(ro(l,t,!0))return!0;return!1}function hi(r,t,s,l=1/0){const f=kc(r),_=kc(t);if(l!==1/0&&Sc(f,_,s)>=l)return l;if(os(f,_)){if(nl(r,t))return 0}else if(nl(t,r))return 0;let x=1/0;for(const v of r)for(let S=0,C=v.length,P=C-1;S<C;P=S++){const L=v[P],F=v[S];for(const j of t)for(let H=0,q=j.length,K=q-1;H<q;K=H++){const ie=j[K],ge=j[H];if(Qa(L,F,ie,ge))return 0;x=Math.min(x,Ec(L,F,ie,ge,s))}}return x}function si(r,t,s,l,f,_){if(!_)return;const x=Sc(wc(l,_),f,s);x<t&&r.push([x,_,[0,0]])}function zs(r,t,s,l,f,_,x){if(!_||!x)return;const v=Sc(wc(l,_),wc(f,x),s);v<t&&r.push([v,_,x])}function na(r,t,s,l,f=1/0){let _=Math.min(l.distance(r[0],s[0][0]),f);if(_===0)return _;const x=new Eu([[0,[0,r.length-1],[0,0]]],Iu),v=kc(s);for(;x.length>0;){const S=x.pop();if(S[0]>=_)continue;const C=S[1],P=t?50:100;if(tl(C)<=P){if(!Ur(C,r.length))return NaN;if(t){const L=It(r,C,s,l);if(isNaN(L)||L===0)return L;_=Math.min(_,L)}else for(let L=C[0];L<=C[1];++L){const F=af(r[L],s,l);if(_=Math.min(_,F),_===0)return 0}}else{const L=vc(C,t);si(x,_,l,r,v,L[0]),si(x,_,l,r,v,L[1])}}return _}function ra(r,t,s,l,f,_=1/0){let x=Math.min(_,f.distance(r[0],s[0]));if(x===0)return x;const v=new Eu([[0,[0,r.length-1],[0,s.length-1]]],Iu);for(;v.length>0;){const S=v.pop();if(S[0]>=x)continue;const C=S[1],P=S[2],L=t?50:100,F=l?50:100;if(tl(C)<=L&&tl(P)<=F){if(!Ur(C,r.length)&&Ur(P,s.length))return NaN;let j;if(t&&l)j=of(r,C,s,P,f),x=Math.min(x,j);else if(t&&!l){const H=r.slice(C[0],C[1]+1);for(let q=P[0];q<=P[1];++q)if(j=Ds(s[q],H,f),x=Math.min(x,j),x===0)return x}else if(!t&&l){const H=s.slice(P[0],P[1]+1);for(let q=C[0];q<=C[1];++q)if(j=Ds(r[q],H,f),x=Math.min(x,j),x===0)return x}else j=Ci(r,C,s,P,f),x=Math.min(x,j)}else{const j=vc(C,t),H=vc(P,l);zs(v,x,f,r,s,j[0],H[0]),zs(v,x,f,r,s,j[0],H[1]),zs(v,x,f,r,s,j[1],H[0]),zs(v,x,f,r,s,j[1],H[1])}}return x}function Tc(r){return r.type==="MultiPolygon"?r.coordinates.map(t=>({type:"Polygon",coordinates:t})):r.type==="MultiLineString"?r.coordinates.map(t=>({type:"LineString",coordinates:t})):r.type==="MultiPoint"?r.coordinates.map(t=>({type:"Point",coordinates:t})):[r]}class Rs{constructor(t,s){this.type=Fe,this.geojson=t,this.geometries=s}static parse(t,s){if(t.length!==2)return s.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Cs(t[1])){const l=t[1];if(l.type==="FeatureCollection")return new Rs(l,l.features.map(f=>Tc(f.geometry)).flat());if(l.type==="Feature")return new Rs(l,Tc(l.geometry));if("type"in l&&"coordinates"in l)return new Rs(l,Tc(l))}return s.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(s,l){const f=s.geometry(),_=f.flat().map(S=>_c([S.x,S.y],s.canonical));if(f.length===0)return NaN;const x=new bc(_[0][1]);let v=1/0;for(const S of l){switch(S.type){case"Point":v=Math.min(v,ra(_,!1,[S.coordinates],!1,x,v));break;case"LineString":v=Math.min(v,ra(_,!1,S.coordinates,!0,x,v));break;case"Polygon":v=Math.min(v,na(_,!1,S.coordinates,x,v))}if(v===0)return v}return v}(t,this.geometries);if(t.geometryType()==="LineString")return function(s,l){const f=s.geometry(),_=f.flat().map(S=>_c([S.x,S.y],s.canonical));if(f.length===0)return NaN;const x=new bc(_[0][1]);let v=1/0;for(const S of l){switch(S.type){case"Point":v=Math.min(v,ra(_,!0,[S.coordinates],!1,x,v));break;case"LineString":v=Math.min(v,ra(_,!0,S.coordinates,!0,x,v));break;case"Polygon":v=Math.min(v,na(_,!0,S.coordinates,x,v))}if(v===0)return v}return v}(t,this.geometries);if(t.geometryType()==="Polygon")return function(s,l){const f=s.geometry();if(f.length===0||f[0].length===0)return NaN;const _=el(f,0).map(S=>S.map(C=>C.map(P=>_c([P.x,P.y],s.canonical)))),x=new bc(_[0][0][0][1]);let v=1/0;for(const S of l)for(const C of _){switch(S.type){case"Point":v=Math.min(v,na([S.coordinates],!1,C,x,v));break;case"LineString":v=Math.min(v,na(S.coordinates,!0,C,x,v));break;case"Polygon":v=Math.min(v,hi(C,S.coordinates,x,v))}if(v===0)return v}return v}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const so={"==":Gp,"!=":gu,">":Yp,"<":yu,">=":_u,"<=":Xp,array:rr,at:dc,boolean:rr,case:Wa,coalesce:Xa,collator:ta,format:Ja,image:gc,in:pc,"index-of":to,interpolate:gn,"interpolate-hcl":gn,"interpolate-lab":gn,length:yc,let:ss,literal:nr,match:fc,number:rr,"number-format":mc,object:rr,slice:Qo,step:io,string:rr,"to-boolean":sr,"to-color":sr,"to-number":sr,"to-string":sr,var:Wt,within:As,distance:Rs};class qn{constructor(t,s,l,f){this.name=t,this.type=s,this._evaluate=l,this.args=f}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,s){const l=t[0],f=qn.definitions[l];if(!f)return s.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0);const _=Array.isArray(f)?f[0]:f.type,x=Array.isArray(f)?[[f[1],f[2]]]:f.overloads,v=x.filter(([C])=>!Array.isArray(C)||C.length===t.length-1);let S=null;for(const[C,P]of v){S=new Ms(s.registry,sa,s.path,null,s.scope);const L=[];let F=!1;for(let j=1;j<t.length;j++){const H=t[j],q=Array.isArray(C)?C[j-1]:C.type,K=S.parse(H,1+L.length,q);if(!K){F=!0;break}L.push(K)}if(!F)if(Array.isArray(C)&&C.length!==L.length)S.error(`Expected ${C.length} arguments, but found ${L.length} instead.`);else{for(let j=0;j<L.length;j++){const H=Array.isArray(C)?C[j]:C.type,q=L[j];S.concat(j+1).checkSubtype(H,q.type)}if(S.errors.length===0)return new qn(l,_,P,L)}}if(v.length===1)s.errors.push(...S.errors);else{const C=(v.length?v:x).map(([L])=>{return F=L,Array.isArray(F)?`(${F.map(V).join(", ")})`:`(${V(F.type)}...)`;var F}).join(" | "),P=[];for(let L=1;L<t.length;L++){const F=s.parse(t[L],1+P.length);if(!F)return null;P.push(V(F.type))}s.error(`Expected arguments of type ${C}, but found (${P.join(", ")}) instead.`)}return null}static register(t,s){qn.definitions=s;for(const l in s)t[l]=qn}}function Cc(r,[t,s,l,f]){t=t.evaluate(r),s=s.evaluate(r),l=l.evaluate(r);const _=f?f.evaluate(r):1,x=eo(t,s,l,_);if(x)throw new Ii(x);return new ti(t/255,s/255,l/255,_,!1)}function Mc(r,t){return r in t}function Pc(r,t){const s=t[r];return s===void 0?null:s}function Ls(r){return{type:r}}function sa(r){if(r instanceof Wt)return sa(r.boundExpression);if(r instanceof qn&&r.name==="error"||r instanceof ta||r instanceof As||r instanceof Rs)return!1;const t=r instanceof sr||r instanceof rr;let s=!0;return r.eachChild(l=>{s=t?s&&sa(l):s&&l instanceof nr}),!!s&&oa(r)&&aa(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function oa(r){if(r instanceof qn&&(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 As||r instanceof Rs)return!1;let t=!0;return r.eachChild(s=>{t&&!oa(s)&&(t=!1)}),t}function oo(r){if(r instanceof qn&&r.name==="feature-state")return!1;let t=!0;return r.eachChild(s=>{t&&!oo(s)&&(t=!1)}),t}function aa(r,t){if(r instanceof qn&&t.indexOf(r.name)>=0)return!1;let s=!0;return r.eachChild(l=>{s&&!aa(l,t)&&(s=!1)}),s}function rl(r){return{result:"success",value:r}}function ao(r){return{result:"error",value:r}}function lo(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Au(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function Ic(r){return!!r.expression&&r.expression.interpolated}function Ht(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function sl(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function lf(r){return r}function Du(r,t){const s=t.type==="color",l=r.stops&&typeof r.stops[0][0]=="object",f=l||!(l||r.property!==void 0),_=r.type||(Ic(t)?"exponential":"interval");if(s||t.type==="padding"){const P=s?ti.parse:Pn.parse;(r=Er({},r)).stops&&(r.stops=r.stops.map(L=>[L[0],P(L[1])])),r.default=P(r.default?r.default:t.default)}if(r.colorSpace&&(x=r.colorSpace)!=="rgb"&&x!=="hcl"&&x!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var x;let v,S,C;if(_==="exponential")v=Ru;else if(_==="interval")v=ol;else if(_==="categorical"){v=zu,S=Object.create(null);for(const P of r.stops)S[P[0]]=P[1];C=typeof r.stops[0][0]}else{if(_!=="identity")throw new Error(`Unknown function type "${_}"`);v=Lu}if(l){const P={},L=[];for(let H=0;H<r.stops.length;H++){const q=r.stops[H],K=q[0].zoom;P[K]===void 0&&(P[K]={zoom:K,type:r.type,property:r.property,default:r.default,stops:[]},L.push(K)),P[K].stops.push([q[0].value,q[1]])}const F=[];for(const H of L)F.push([P[H].zoom,Du(P[H],t)]);const j={name:"linear"};return{kind:"composite",interpolationType:j,interpolationFactor:gn.interpolationFactor.bind(void 0,j),zoomStops:F.map(H=>H[0]),evaluate:({zoom:H},q)=>Ru({stops:F,base:r.base},t,H).evaluate(H,q)}}if(f){const P=_==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:P,interpolationFactor:gn.interpolationFactor.bind(void 0,P),zoomStops:r.stops.map(L=>L[0]),evaluate:({zoom:L})=>v(r,t,L,S,C)}}return{kind:"source",evaluate(P,L){const F=L&&L.properties?L.properties[r.property]:void 0;return F===void 0?co(r.default,t.default):v(r,t,F,S,C)}}}function co(r,t,s){return r!==void 0?r:t!==void 0?t:s!==void 0?s:void 0}function zu(r,t,s,l,f){return co(typeof s===f?l[s]:void 0,r.default,t.default)}function ol(r,t,s){if(Ht(s)!=="number")return co(r.default,t.default);const l=r.stops.length;if(l===1||s<=r.stops[0][0])return r.stops[0][1];if(s>=r.stops[l-1][0])return r.stops[l-1][1];const f=Ga(r.stops.map(_=>_[0]),s);return r.stops[f][1]}function Ru(r,t,s){const l=r.base!==void 0?r.base:1;if(Ht(s)!=="number")return co(r.default,t.default);const f=r.stops.length;if(f===1||s<=r.stops[0][0])return r.stops[0][1];if(s>=r.stops[f-1][0])return r.stops[f-1][1];const _=Ga(r.stops.map(P=>P[0]),s),x=function(P,L,F,j){const H=j-F,q=P-F;return H===0?0:L===1?q/H:(Math.pow(L,q)-1)/(Math.pow(L,H)-1)}(s,l,r.stops[_][0],r.stops[_+1][0]),v=r.stops[_][1],S=r.stops[_+1][1],C=mn[t.type]||lf;return typeof v.evaluate=="function"?{evaluate(...P){const L=v.evaluate.apply(void 0,P),F=S.evaluate.apply(void 0,P);if(L!==void 0&&F!==void 0)return C(L,F,x,r.colorSpace)}}:C(v,S,x,r.colorSpace)}function Lu(r,t,s){switch(t.type){case"color":s=ti.parse(s);break;case"formatted":s=Mn.fromString(s.toString());break;case"resolvedImage":s=In.fromString(s.toString());break;case"padding":s=Pn.parse(s);break;default:Ht(s)===t.type||t.type==="enum"&&t.values[s]||(s=void 0)}return co(s,r.default,t.default)}qn.register(so,{error:[{kind:"error"},[Ct],(r,[t])=>{throw new Ii(t.evaluate(r))}],typeof:[Ct,[bt],(r,[t])=>V(zi(t.evaluate(r)))],"to-rgba":[$(Fe,4),[fn],(r,[t])=>{const[s,l,f,_]=t.evaluate(r).rgb;return[255*s,255*l,255*f,_]}],rgb:[fn,[Fe,Fe,Fe],Cc],rgba:[fn,[Fe,Fe,Fe,Fe],Cc],has:{type:mt,overloads:[[[Ct],(r,[t])=>Mc(t.evaluate(r),r.properties())],[[Ct,ir],(r,[t,s])=>Mc(t.evaluate(r),s.evaluate(r))]]},get:{type:bt,overloads:[[[Ct],(r,[t])=>Pc(t.evaluate(r),r.properties())],[[Ct,ir],(r,[t,s])=>Pc(t.evaluate(r),s.evaluate(r))]]},"feature-state":[bt,[Ct],(r,[t])=>Pc(t.evaluate(r),r.featureState||{})],properties:[ir,[],r=>r.properties()],"geometry-type":[Ct,[],r=>r.geometryType()],id:[bt,[],r=>r.id()],zoom:[Fe,[],r=>r.globals.zoom],"heatmap-density":[Fe,[],r=>r.globals.heatmapDensity||0],"line-progress":[Fe,[],r=>r.globals.lineProgress||0],accumulated:[bt,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Fe,Ls(Fe),(r,t)=>{let s=0;for(const l of t)s+=l.evaluate(r);return s}],"*":[Fe,Ls(Fe),(r,t)=>{let s=1;for(const l of t)s*=l.evaluate(r);return s}],"-":{type:Fe,overloads:[[[Fe,Fe],(r,[t,s])=>t.evaluate(r)-s.evaluate(r)],[[Fe],(r,[t])=>-t.evaluate(r)]]},"/":[Fe,[Fe,Fe],(r,[t,s])=>t.evaluate(r)/s.evaluate(r)],"%":[Fe,[Fe,Fe],(r,[t,s])=>t.evaluate(r)%s.evaluate(r)],ln2:[Fe,[],()=>Math.LN2],pi:[Fe,[],()=>Math.PI],e:[Fe,[],()=>Math.E],"^":[Fe,[Fe,Fe],(r,[t,s])=>Math.pow(t.evaluate(r),s.evaluate(r))],sqrt:[Fe,[Fe],(r,[t])=>Math.sqrt(t.evaluate(r))],log10:[Fe,[Fe],(r,[t])=>Math.log(t.evaluate(r))/Math.LN10],ln:[Fe,[Fe],(r,[t])=>Math.log(t.evaluate(r))],log2:[Fe,[Fe],(r,[t])=>Math.log(t.evaluate(r))/Math.LN2],sin:[Fe,[Fe],(r,[t])=>Math.sin(t.evaluate(r))],cos:[Fe,[Fe],(r,[t])=>Math.cos(t.evaluate(r))],tan:[Fe,[Fe],(r,[t])=>Math.tan(t.evaluate(r))],asin:[Fe,[Fe],(r,[t])=>Math.asin(t.evaluate(r))],acos:[Fe,[Fe],(r,[t])=>Math.acos(t.evaluate(r))],atan:[Fe,[Fe],(r,[t])=>Math.atan(t.evaluate(r))],min:[Fe,Ls(Fe),(r,t)=>Math.min(...t.map(s=>s.evaluate(r)))],max:[Fe,Ls(Fe),(r,t)=>Math.max(...t.map(s=>s.evaluate(r)))],abs:[Fe,[Fe],(r,[t])=>Math.abs(t.evaluate(r))],round:[Fe,[Fe],(r,[t])=>{const s=t.evaluate(r);return s<0?-Math.round(-s):Math.round(s)}],floor:[Fe,[Fe],(r,[t])=>Math.floor(t.evaluate(r))],ceil:[Fe,[Fe],(r,[t])=>Math.ceil(t.evaluate(r))],"filter-==":[mt,[Ct,bt],(r,[t,s])=>r.properties()[t.value]===s.value],"filter-id-==":[mt,[bt],(r,[t])=>r.id()===t.value],"filter-type-==":[mt,[Ct],(r,[t])=>r.geometryType()===t.value],"filter-<":[mt,[Ct,bt],(r,[t,s])=>{const l=r.properties()[t.value],f=s.value;return typeof l==typeof f&&l<f}],"filter-id-<":[mt,[bt],(r,[t])=>{const s=r.id(),l=t.value;return typeof s==typeof l&&s<l}],"filter->":[mt,[Ct,bt],(r,[t,s])=>{const l=r.properties()[t.value],f=s.value;return typeof l==typeof f&&l>f}],"filter-id->":[mt,[bt],(r,[t])=>{const s=r.id(),l=t.value;return typeof s==typeof l&&s>l}],"filter-<=":[mt,[Ct,bt],(r,[t,s])=>{const l=r.properties()[t.value],f=s.value;return typeof l==typeof f&&l<=f}],"filter-id-<=":[mt,[bt],(r,[t])=>{const s=r.id(),l=t.value;return typeof s==typeof l&&s<=l}],"filter->=":[mt,[Ct,bt],(r,[t,s])=>{const l=r.properties()[t.value],f=s.value;return typeof l==typeof f&&l>=f}],"filter-id->=":[mt,[bt],(r,[t])=>{const s=r.id(),l=t.value;return typeof s==typeof l&&s>=l}],"filter-has":[mt,[bt],(r,[t])=>t.value in r.properties()],"filter-has-id":[mt,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[mt,[$(Ct)],(r,[t])=>t.value.indexOf(r.geometryType())>=0],"filter-id-in":[mt,[$(bt)],(r,[t])=>t.value.indexOf(r.id())>=0],"filter-in-small":[mt,[Ct,$(bt)],(r,[t,s])=>s.value.indexOf(r.properties()[t.value])>=0],"filter-in-large":[mt,[Ct,$(bt)],(r,[t,s])=>function(l,f,_,x){for(;_<=x;){const v=_+x>>1;if(f[v]===l)return!0;f[v]>l?x=v-1:_=v+1}return!1}(r.properties()[t.value],s.value,0,s.value.length-1)],all:{type:mt,overloads:[[[mt,mt],(r,[t,s])=>t.evaluate(r)&&s.evaluate(r)],[Ls(mt),(r,t)=>{for(const s of t)if(!s.evaluate(r))return!1;return!0}]]},any:{type:mt,overloads:[[[mt,mt],(r,[t,s])=>t.evaluate(r)||s.evaluate(r)],[Ls(mt),(r,t)=>{for(const s of t)if(s.evaluate(r))return!0;return!1}]]},"!":[mt,[mt],(r,[t])=>!t.evaluate(r)],"is-supported-script":[mt,[Ct],(r,[t])=>{const s=r.globals&&r.globals.isSupportedScript;return!s||s(t.evaluate(r))}],upcase:[Ct,[Ct],(r,[t])=>t.evaluate(r).toUpperCase()],downcase:[Ct,[Ct],(r,[t])=>t.evaluate(r).toLowerCase()],concat:[Ct,Ls(bt),(r,t)=>t.map(s=>Jo(s.evaluate(r))).join("")],"resolved-locale":[Ct,[Cr],(r,[t])=>t.evaluate(r).resolvedLocale()]});class al{constructor(t,s){var l;this.expression=t,this._warningHistory={},this._evaluator=new Za,this._defaultValue=s?(l=s).type==="color"&&sl(l.default)?new ti(0,0,0,0):l.type==="color"?ti.parse(l.default)||null:l.type==="padding"?Pn.parse(l.default)||null:l.type==="variableAnchorOffsetCollection"?Hn.parse(l.default)||null:l.default===void 0?null:l.default:null,this._enumValues=s&&s.type==="enum"?s.values:null}evaluateWithoutErrorHandling(t,s,l,f,_,x){return this._evaluator.globals=t,this._evaluator.feature=s,this._evaluator.featureState=l,this._evaluator.canonical=f,this._evaluator.availableImages=_||null,this._evaluator.formattedSection=x,this.expression.evaluate(this._evaluator)}evaluate(t,s,l,f,_,x){this._evaluator.globals=t,this._evaluator.feature=s||null,this._evaluator.featureState=l||null,this._evaluator.canonical=f,this._evaluator.availableImages=_||null,this._evaluator.formattedSection=x||null;try{const v=this.expression.evaluate(this._evaluator);if(v==null||typeof v=="number"&&v!=v)return this._defaultValue;if(this._enumValues&&!(v in this._enumValues))throw new Ii(`Expected value to be one of ${Object.keys(this._enumValues).map(S=>JSON.stringify(S)).join(", ")}, but found ${JSON.stringify(v)} instead.`);return v}catch(v){return this._warningHistory[v.message]||(this._warningHistory[v.message]=!0,typeof console<"u"&&console.warn(v.message)),this._defaultValue}}}function ll(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in so}function ho(r,t){const s=new Ms(so,sa,[],t?function(f){const _={color:fn,string:Ct,number:Fe,enum:Ct,boolean:mt,formatted:jr,padding:rs,resolvedImage:Mr,variableAnchorOffsetCollection:ee};return f.type==="array"?$(_[f.value]||bt,f.length):_[f.type]}(t):void 0),l=s.parse(r,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return l?rl(new al(l,t)):ao(s.errors)}class uo{constructor(t,s){this.kind=t,this._styleExpression=s,this.isStateDependent=t!=="constant"&&!oo(s.expression)}evaluateWithoutErrorHandling(t,s,l,f,_,x){return this._styleExpression.evaluateWithoutErrorHandling(t,s,l,f,_,x)}evaluate(t,s,l,f,_,x){return this._styleExpression.evaluate(t,s,l,f,_,x)}}class po{constructor(t,s,l,f){this.kind=t,this.zoomStops=l,this._styleExpression=s,this.isStateDependent=t!=="camera"&&!oo(s.expression),this.interpolationType=f}evaluateWithoutErrorHandling(t,s,l,f,_,x){return this._styleExpression.evaluateWithoutErrorHandling(t,s,l,f,_,x)}evaluate(t,s,l,f,_,x){return this._styleExpression.evaluate(t,s,l,f,_,x)}interpolationFactor(t,s,l){return this.interpolationType?gn.interpolationFactor(this.interpolationType,t,s,l):0}}function Ac(r,t){const s=ho(r,t);if(s.result==="error")return s;const l=s.value.expression,f=oa(l);if(!f&&!lo(t))return ao([new on("","data expressions not supported")]);const _=aa(l,["zoom"]);if(!_&&!Au(t))return ao([new on("","zoom expressions not supported")]);const x=la(l);return x||_?x instanceof on?ao([x]):x instanceof gn&&!Ic(t)?ao([new on("",'"interpolate" expressions cannot be used with this property')]):rl(x?new po(f?"camera":"composite",s.value,x.labels,x instanceof gn?x.interpolation:void 0):new uo(f?"constant":"source",s.value)):ao([new on("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class fo{constructor(t,s){this._parameters=t,this._specification=s,Er(this,Du(this._parameters,this._specification))}static deserialize(t){return new fo(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function la(r){let t=null;if(r instanceof ss)t=la(r.result);else if(r instanceof Xa){for(const s of r.args)if(t=la(s),t)break}else(r instanceof io||r instanceof gn)&&r.input instanceof qn&&r.input.name==="zoom"&&(t=r);return t instanceof on||r.eachChild(s=>{const l=la(s);l instanceof on?t=l:!t&&l?t=new on("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&l&&t!==l&&(t=new on("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function cl(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 t of r.slice(1))if(!cl(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const hl={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Dc(r){if(r==null)return{filter:()=>!0,needGeometry:!1};cl(r)||(r=ul(r));const t=ho(r,hl);if(t.result==="error")throw new Error(t.value.map(s=>`${s.key}: ${s.message}`).join(", "));return{filter:(s,l,f)=>t.value.evaluate(s,l,{},f),needGeometry:Ou(r)}}function cf(r,t){return r<t?-1:r>t?1:0}function Ou(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let t=1;t<r.length;t++)if(Ou(r[t]))return!0;return!1}function ul(r){if(!r)return!0;const t=r[0];return r.length<=1?t!=="any":t==="=="?zc(r[1],r[2],"=="):t==="!="?Yi(zc(r[1],r[2],"==")):t==="<"||t===">"||t==="<="||t===">="?zc(r[1],r[2],t):t==="any"?(s=r.slice(1),["any"].concat(s.map(ul))):t==="all"?["all"].concat(r.slice(1).map(ul)):t==="none"?["all"].concat(r.slice(1).map(ul).map(Yi)):t==="in"?ca(r[1],r.slice(2)):t==="!in"?Yi(ca(r[1],r.slice(2))):t==="has"?ha(r[1]):t!=="!has"||Yi(ha(r[1]));var s}function zc(r,t,s){switch(r){case"$type":return[`filter-type-${s}`,t];case"$id":return[`filter-id-${s}`,t];default:return[`filter-${s}`,r,t]}}function ca(r,t){if(t.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(s=>typeof s!=typeof t[0])?["filter-in-large",r,["literal",t.sort(cf)]]:["filter-in-small",r,["literal",t]]}}function ha(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Yi(r){return["!",r]}function Os(r){const t=typeof r;if(t==="number"||t==="boolean"||t==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let f="[";for(const _ of r)f+=`${Os(_)},`;return`${f}]`}const s=Object.keys(r).sort();let l="{";for(let f=0;f<s.length;f++)l+=`${JSON.stringify(s[f])}:${Os(r[s[f]])},`;return`${l}}`}function Bu(r){let t="";for(const s of wi)t+=`/${Os(r[s])}`;return t}function Fu(r){const t=r.value;return t?[new De(r.key,t,"constants have been deprecated as of v8")]:[]}function Mi(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function or(r){if(Array.isArray(r))return r.map(or);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const t={};for(const s in r)t[s]=or(r[s]);return t}return Mi(r)}function An(r){const t=r.key,s=r.value,l=r.valueSpec||{},f=r.objectElementValidators||{},_=r.style,x=r.styleSpec,v=r.validateSpec;let S=[];const C=Ht(s);if(C!=="object")return[new De(t,s,`object expected, ${C} found`)];for(const P in s){const L=P.split(".")[0],F=l[L]||l["*"];let j;if(f[L])j=f[L];else if(l[L])j=v;else if(f["*"])j=f["*"];else{if(!l["*"]){S.push(new De(t,s[P],`unknown property "${P}"`));continue}j=v}S=S.concat(j({key:(t&&`${t}.`)+P,value:s[P],valueSpec:F,style:_,styleSpec:x,object:s,objectKey:P,validateSpec:v},s))}for(const P in l)f[P]||l[P].required&&l[P].default===void 0&&s[P]===void 0&&S.push(new De(t,s,`missing required property "${P}"`));return S}function ua(r){const t=r.value,s=r.valueSpec,l=r.style,f=r.styleSpec,_=r.key,x=r.arrayElementValidator||r.validateSpec;if(Ht(t)!=="array")return[new De(_,t,`array expected, ${Ht(t)} found`)];if(s.length&&t.length!==s.length)return[new De(_,t,`array length ${s.length} expected, length ${t.length} found`)];if(s["min-length"]&&t.length<s["min-length"])return[new De(_,t,`array length at least ${s["min-length"]} expected, length ${t.length} found`)];let v={type:s.value,values:s.values};f.$version<7&&(v.function=s.function),Ht(s.value)==="object"&&(v=s.value);let S=[];for(let C=0;C<t.length;C++)S=S.concat(x({array:t,arrayIndex:C,value:t[C],valueSpec:v,validateSpec:r.validateSpec,style:l,styleSpec:f,key:`${_}[${C}]`}));return S}function Rc(r){const t=r.key,s=r.value,l=r.valueSpec;let f=Ht(s);return f==="number"&&s!=s&&(f="NaN"),f!=="number"?[new De(t,s,`number expected, ${f} found`)]:"minimum"in l&&s<l.minimum?[new De(t,s,`${s} is less than the minimum value ${l.minimum}`)]:"maximum"in l&&s>l.maximum?[new De(t,s,`${s} is greater than the maximum value ${l.maximum}`)]:[]}function dl(r){const t=r.valueSpec,s=Mi(r.value.type);let l,f,_,x={};const v=s!=="categorical"&&r.value.property===void 0,S=!v,C=Ht(r.value.stops)==="array"&&Ht(r.value.stops[0])==="array"&&Ht(r.value.stops[0][0])==="object",P=An({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(j){if(s==="identity")return[new De(j.key,j.value,'identity function may not have a "stops" property')];let H=[];const q=j.value;return H=H.concat(ua({key:j.key,value:q,valueSpec:j.valueSpec,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec,arrayElementValidator:L})),Ht(q)==="array"&&q.length===0&&H.push(new De(j.key,q,"array must have at least one stop")),H},default:function(j){return j.validateSpec({key:j.key,value:j.value,valueSpec:t,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec})}}});return s==="identity"&&v&&P.push(new De(r.key,r.value,'missing required property "property"')),s==="identity"||r.value.stops||P.push(new De(r.key,r.value,'missing required property "stops"')),s==="exponential"&&r.valueSpec.expression&&!Ic(r.valueSpec)&&P.push(new De(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(S&&!lo(r.valueSpec)?P.push(new De(r.key,r.value,"property functions not supported")):v&&!Au(r.valueSpec)&&P.push(new De(r.key,r.value,"zoom functions not supported"))),s!=="categorical"&&!C||r.value.property!==void 0||P.push(new De(r.key,r.value,'"property" property is required')),P;function L(j){let H=[];const q=j.value,K=j.key;if(Ht(q)!=="array")return[new De(K,q,`array expected, ${Ht(q)} found`)];if(q.length!==2)return[new De(K,q,`array length 2 expected, length ${q.length} found`)];if(C){if(Ht(q[0])!=="object")return[new De(K,q,`object expected, ${Ht(q[0])} found`)];if(q[0].zoom===void 0)return[new De(K,q,"object stop key must have zoom")];if(q[0].value===void 0)return[new De(K,q,"object stop key must have value")];if(_&&_>Mi(q[0].zoom))return[new De(K,q[0].zoom,"stop zoom values must appear in ascending order")];Mi(q[0].zoom)!==_&&(_=Mi(q[0].zoom),f=void 0,x={}),H=H.concat(An({key:`${K}[0]`,value:q[0],valueSpec:{zoom:{}},validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec,objectElementValidators:{zoom:Rc,value:F}}))}else H=H.concat(F({key:`${K}[0]`,value:q[0],valueSpec:{},validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec},q));return ll(or(q[1]))?H.concat([new De(`${K}[1]`,q[1],"expressions are not allowed in function stops.")]):H.concat(j.validateSpec({key:`${K}[1]`,value:q[1],valueSpec:t,validateSpec:j.validateSpec,style:j.style,styleSpec:j.styleSpec}))}function F(j,H){const q=Ht(j.value),K=Mi(j.value),ie=j.value!==null?j.value:H;if(l){if(q!==l)return[new De(j.key,ie,`${q} stop domain type must match previous stop domain type ${l}`)]}else l=q;if(q!=="number"&&q!=="string"&&q!=="boolean")return[new De(j.key,ie,"stop domain value must be a number, string, or boolean")];if(q!=="number"&&s!=="categorical"){let ge=`number expected, ${q} found`;return lo(t)&&s===void 0&&(ge+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new De(j.key,ie,ge)]}return s!=="categorical"||q!=="number"||isFinite(K)&&Math.floor(K)===K?s!=="categorical"&&q==="number"&&f!==void 0&&K<f?[new De(j.key,ie,"stop domain values must appear in ascending order")]:(f=K,s==="categorical"&&K in x?[new De(j.key,ie,"stop domain values must be unique")]:(x[K]=!0,[])):[new De(j.key,ie,`integer expected, found ${K}`)]}}function mo(r){const t=(r.expressionContext==="property"?Ac:ho)(or(r.value),r.valueSpec);if(t.result==="error")return t.value.map(l=>new De(`${r.key}${l.key}`,r.value,l.message));const s=t.value.expression||t.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!s.outputDefined())return[new De(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"&&!oo(s))return[new De(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!oo(s))return[new De(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!aa(s,["zoom","feature-state"]))return[new De(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!oa(s))return[new De(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Hr(r){const t=r.key,s=r.value,l=r.valueSpec,f=[];return Array.isArray(l.values)?l.values.indexOf(Mi(s))===-1&&f.push(new De(t,s,`expected one of [${l.values.join(", ")}], ${JSON.stringify(s)} found`)):Object.keys(l.values).indexOf(Mi(s))===-1&&f.push(new De(t,s,`expected one of [${Object.keys(l.values).join(", ")}], ${JSON.stringify(s)} found`)),f}function Lc(r){return cl(or(r.value))?mo(Er({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):pl(r)}function pl(r){const t=r.value,s=r.key;if(Ht(t)!=="array")return[new De(s,t,`array expected, ${Ht(t)} found`)];const l=r.styleSpec;let f,_=[];if(t.length<1)return[new De(s,t,"filter array must have at least 1 element")];switch(_=_.concat(Hr({key:`${s}[0]`,value:t[0],valueSpec:l.filter_operator,style:r.style,styleSpec:r.styleSpec})),Mi(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Mi(t[1])==="$type"&&_.push(new De(s,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&_.push(new De(s,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(f=Ht(t[1]),f!=="string"&&_.push(new De(`${s}[1]`,t[1],`string expected, ${f} found`)));for(let x=2;x<t.length;x++)f=Ht(t[x]),Mi(t[1])==="$type"?_=_.concat(Hr({key:`${s}[${x}]`,value:t[x],valueSpec:l.geometry_type,style:r.style,styleSpec:r.styleSpec})):f!=="string"&&f!=="number"&&f!=="boolean"&&_.push(new De(`${s}[${x}]`,t[x],`string, number, or boolean expected, ${f} found`));break;case"any":case"all":case"none":for(let x=1;x<t.length;x++)_=_.concat(pl({key:`${s}[${x}]`,value:t[x],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":f=Ht(t[1]),t.length!==2?_.push(new De(s,t,`filter array for "${t[0]}" operator must have 2 elements`)):f!=="string"&&_.push(new De(`${s}[1]`,t[1],`string expected, ${f} found`))}return _}function Oc(r,t){const s=r.key,l=r.validateSpec,f=r.style,_=r.styleSpec,x=r.value,v=r.objectKey,S=_[`${t}_${r.layerType}`];if(!S)return[];const C=v.match(/^(.*)-transition$/);if(t==="paint"&&C&&S[C[1]]&&S[C[1]].transition)return l({key:s,value:x,valueSpec:_.transition,style:f,styleSpec:_});const P=r.valueSpec||S[v];if(!P)return[new De(s,x,`unknown property "${v}"`)];let L;if(Ht(x)==="string"&&lo(P)&&!P.tokens&&(L=/^{([^}]+)}$/.exec(x)))return[new De(s,x,`"${v}" does not support interpolation syntax
40
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(L[1])} }\`.`)];const F=[];return r.layerType==="symbol"&&(v==="text-field"&&f&&!f.glyphs&&F.push(new De(s,x,'use of "text-field" requires a style "glyphs" property')),v==="text-font"&&sl(or(x))&&Mi(x.type)==="identity"&&F.push(new De(s,x,'"text-font" does not support identity functions'))),F.concat(l({key:r.key,value:x,valueSpec:P,style:f,styleSpec:_,expressionContext:"property",propertyType:t,propertyKey:v}))}function fl(r){return Oc(r,"paint")}function Bc(r){return Oc(r,"layout")}function Fc(r){let t=[];const s=r.value,l=r.key,f=r.style,_=r.styleSpec;s.type||s.ref||t.push(new De(l,s,'either "type" or "ref" is required'));let x=Mi(s.type);const v=Mi(s.ref);if(s.id){const S=Mi(s.id);for(let C=0;C<r.arrayIndex;C++){const P=f.layers[C];Mi(P.id)===S&&t.push(new De(l,s.id,`duplicate layer id "${s.id}", previously used at line ${P.id.__line__}`))}}if("ref"in s){let S;["type","source","source-layer","filter","layout"].forEach(C=>{C in s&&t.push(new De(l,s[C],`"${C}" is prohibited for ref layers`))}),f.layers.forEach(C=>{Mi(C.id)===v&&(S=C)}),S?S.ref?t.push(new De(l,s.ref,"ref cannot reference another ref layer")):x=Mi(S.type):t.push(new De(l,s.ref,`ref layer "${v}" not found`))}else if(x!=="background")if(s.source){const S=f.sources&&f.sources[s.source],C=S&&Mi(S.type);S?C==="vector"&&x==="raster"?t.push(new De(l,s.source,`layer "${s.id}" requires a raster source`)):C!=="raster-dem"&&x==="hillshade"?t.push(new De(l,s.source,`layer "${s.id}" requires a raster-dem source`)):C==="raster"&&x!=="raster"?t.push(new De(l,s.source,`layer "${s.id}" requires a vector source`)):C!=="vector"||s["source-layer"]?C==="raster-dem"&&x!=="hillshade"?t.push(new De(l,s.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!s.paint||!s.paint["line-gradient"]||C==="geojson"&&S.lineMetrics||t.push(new De(l,s,`layer "${s.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new De(l,s,`layer "${s.id}" must specify a "source-layer"`)):t.push(new De(l,s.source,`source "${s.source}" not found`))}else t.push(new De(l,s,'missing required property "source"'));return t=t.concat(An({key:l,value:s,valueSpec:_.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${l}.type`,value:s.type,valueSpec:_.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:s,objectKey:"type"}),filter:Lc,layout:S=>An({layer:s,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":C=>Bc(Er({layerType:x},C))}}),paint:S=>An({layer:s,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":C=>fl(Er({layerType:x},C))}})}})),t}function Bs(r){const t=r.value,s=r.key,l=Ht(t);return l!=="string"?[new De(s,t,`string expected, ${l} found`)]:[]}const ml={promoteId:function({key:r,value:t}){if(Ht(t)==="string")return Bs({key:r,value:t});{const s=[];for(const l in t)s.push(...Bs({key:`${r}.${l}`,value:t[l]}));return s}}};function da(r){const t=r.value,s=r.key,l=r.styleSpec,f=r.style,_=r.validateSpec;if(!t.type)return[new De(s,t,'"type" is required')];const x=Mi(t.type);let v;switch(x){case"vector":case"raster":return v=An({key:s,value:t,valueSpec:l[`source_${x.replace("-","_")}`],style:r.style,styleSpec:l,objectElementValidators:ml,validateSpec:_}),v;case"raster-dem":return v=function(S){var C;const P=(C=S.sourceName)!==null&&C!==void 0?C:"",L=S.value,F=S.styleSpec,j=F.source_raster_dem,H=S.style;let q=[];const K=Ht(L);if(L===void 0)return q;if(K!=="object")return q.push(new De("source_raster_dem",L,`object expected, ${K} found`)),q;const ie=Mi(L.encoding)==="custom",ge=["redFactor","greenFactor","blueFactor","baseShift"],le=S.value.encoding?`"${S.value.encoding}"`:"Default";for(const fe in L)!ie&&ge.includes(fe)?q.push(new De(fe,L[fe],`In "${P}": "${fe}" is only valid when "encoding" is set to "custom". ${le} encoding found`)):j[fe]?q=q.concat(S.validateSpec({key:fe,value:L[fe],valueSpec:j[fe],validateSpec:S.validateSpec,style:H,styleSpec:F})):q.push(new De(fe,L[fe],`unknown property "${fe}"`));return q}({sourceName:s,value:t,style:r.style,styleSpec:l,validateSpec:_}),v;case"geojson":if(v=An({key:s,value:t,valueSpec:l.source_geojson,style:f,styleSpec:l,validateSpec:_,objectElementValidators:ml}),t.cluster)for(const S in t.clusterProperties){const[C,P]=t.clusterProperties[S],L=typeof C=="string"?[C,["accumulated"],["get",S]]:C;v.push(...mo({key:`${s}.${S}.map`,value:P,validateSpec:_,expressionContext:"cluster-map"})),v.push(...mo({key:`${s}.${S}.reduce`,value:L,validateSpec:_,expressionContext:"cluster-reduce"}))}return v;case"video":return An({key:s,value:t,valueSpec:l.source_video,style:f,validateSpec:_,styleSpec:l});case"image":return An({key:s,value:t,valueSpec:l.source_image,style:f,validateSpec:_,styleSpec:l});case"canvas":return[new De(s,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Hr({key:`${s}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:f,validateSpec:_,styleSpec:l})}}function Nc(r){const t=r.value,s=r.styleSpec,l=s.light,f=r.style;let _=[];const x=Ht(t);if(t===void 0)return _;if(x!=="object")return _=_.concat([new De("light",t,`object expected, ${x} found`)]),_;for(const v in t){const S=v.match(/^(.*)-transition$/);_=_.concat(S&&l[S[1]]&&l[S[1]].transition?r.validateSpec({key:v,value:t[v],valueSpec:s.transition,validateSpec:r.validateSpec,style:f,styleSpec:s}):l[v]?r.validateSpec({key:v,value:t[v],valueSpec:l[v],validateSpec:r.validateSpec,style:f,styleSpec:s}):[new De(v,t[v],`unknown property "${v}"`)])}return _}function Vc(r){const t=r.value,s=r.styleSpec,l=s.sky,f=r.style,_=Ht(t);if(t===void 0)return[];if(_!=="object")return[new De("sky",t,`object expected, ${_} found`)];let x=[];for(const v in t)x=x.concat(l[v]?r.validateSpec({key:v,value:t[v],valueSpec:l[v],style:f,styleSpec:s}):[new De(v,t[v],`unknown property "${v}"`)]);return x}function $c(r){const t=r.value,s=r.styleSpec,l=s.terrain,f=r.style;let _=[];const x=Ht(t);if(t===void 0)return _;if(x!=="object")return _=_.concat([new De("terrain",t,`object expected, ${x} found`)]),_;for(const v in t)_=_.concat(l[v]?r.validateSpec({key:v,value:t[v],valueSpec:l[v],validateSpec:r.validateSpec,style:f,styleSpec:s}):[new De(v,t[v],`unknown property "${v}"`)]);return _}function jc(r){let t=[];const s=r.value,l=r.key;if(Array.isArray(s)){const f=[],_=[];for(const x in s)s[x].id&&f.includes(s[x].id)&&t.push(new De(l,s,`all the sprites' ids must be unique, but ${s[x].id} is duplicated`)),f.push(s[x].id),s[x].url&&_.includes(s[x].url)&&t.push(new De(l,s,`all the sprites' URLs must be unique, but ${s[x].url} is duplicated`)),_.push(s[x].url),t=t.concat(An({key:`${l}[${x}]`,value:s[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return t}return Bs({key:l,value:s})}const gl={"*":()=>[],array:ua,boolean:function(r){const t=r.value,s=r.key,l=Ht(t);return l!=="boolean"?[new De(s,t,`boolean expected, ${l} found`)]:[]},number:Rc,color:function(r){const t=r.key,s=r.value,l=Ht(s);return l!=="string"?[new De(t,s,`color expected, ${l} found`)]:ti.parse(String(s))?[]:[new De(t,s,`color expected, "${s}" found`)]},constants:Fu,enum:Hr,filter:Lc,function:dl,layer:Fc,object:An,source:da,light:Nc,sky:Vc,terrain:$c,projection:function(r){const t=r.value,s=r.styleSpec,l=s.projection,f=r.style,_=Ht(t);if(t===void 0)return[];if(_!=="object")return[new De("projection",t,`object expected, ${_} found`)];let x=[];for(const v in t)x=x.concat(l[v]?r.validateSpec({key:v,value:t[v],valueSpec:l[v],style:f,styleSpec:s}):[new De(v,t[v],`unknown property "${v}"`)]);return x},string:Bs,formatted:function(r){return Bs(r).length===0?[]:mo(r)},resolvedImage:function(r){return Bs(r).length===0?[]:mo(r)},padding:function(r){const t=r.key,s=r.value;if(Ht(s)==="array"){if(s.length<1||s.length>4)return[new De(t,s,`padding requires 1 to 4 values; ${s.length} values found`)];const l={type:"number"};let f=[];for(let _=0;_<s.length;_++)f=f.concat(r.validateSpec({key:`${t}[${_}]`,value:s[_],validateSpec:r.validateSpec,valueSpec:l}));return f}return Rc({key:t,value:s,valueSpec:{}})},variableAnchorOffsetCollection:function(r){const t=r.key,s=r.value,l=Ht(s),f=r.styleSpec;if(l!=="array"||s.length<1||s.length%2!=0)return[new De(t,s,"variableAnchorOffsetCollection requires a non-empty array of even length")];let _=[];for(let x=0;x<s.length;x+=2)_=_.concat(Hr({key:`${t}[${x}]`,value:s[x],valueSpec:f.layout_symbol["text-anchor"]})),_=_.concat(ua({key:`${t}[${x+1}]`,value:s[x+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:f}));return _},sprite:jc};function go(r){const t=r.value,s=r.valueSpec,l=r.styleSpec;return r.validateSpec=go,s.expression&&sl(Mi(t))?dl(r):s.expression&&ll(or(t))?mo(r):s.type&&gl[s.type]?gl[s.type](r):An(Er({},r,{valueSpec:s.type?l[s.type]:s}))}function Nu(r){const t=r.value,s=r.key,l=Bs(r);return l.length||(t.indexOf("{fontstack}")===-1&&l.push(new De(s,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&l.push(new De(s,t,'"glyphs" url must include a "{range}" token'))),l}function Zn(r,t=xe){let s=[];return s=s.concat(go({key:"",value:r,valueSpec:t.$root,styleSpec:t,style:r,validateSpec:go,objectElementValidators:{glyphs:Nu,"*":()=>[]}})),r.constants&&(s=s.concat(Fu({key:"constants",value:r.constants,style:r,styleSpec:t,validateSpec:go}))),Uc(s)}function Ir(r){return function(t){return r({...t,validateSpec:go})}}function Uc(r){return[].concat(r).sort((t,s)=>t.line-s.line)}function ar(r){return function(...t){return Uc(r.apply(this,t))}}Zn.source=ar(Ir(da)),Zn.sprite=ar(Ir(jc)),Zn.glyphs=ar(Ir(Nu)),Zn.light=ar(Ir(Nc)),Zn.sky=ar(Ir(Vc)),Zn.terrain=ar(Ir($c)),Zn.layer=ar(Ir(Fc)),Zn.filter=ar(Ir(Lc)),Zn.paintProperty=ar(Ir(fl)),Zn.layoutProperty=ar(Ir(Bc));const Fs=Zn,hf=Fs.light,uf=Fs.sky,Vu=Fs.paintProperty,$u=Fs.layoutProperty;function Hc(r,t){let s=!1;if(t&&t.length)for(const l of t)r.fire(new vt(new Error(l.message))),s=!0;return s}class yo{constructor(t,s,l){const f=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const x=new Int32Array(this.arrayBuffer);t=x[0],this.d=(s=x[1])+2*(l=x[2]);for(let S=0;S<this.d*this.d;S++){const C=x[3+S],P=x[3+S+1];f.push(C===P?null:x.subarray(C,P))}const v=x[3+f.length+1];this.keys=x.subarray(x[3+f.length],v),this.bboxes=x.subarray(v),this.insert=this._insertReadonly}else{this.d=s+2*l;for(let x=0;x<this.d*this.d;x++)f.push([]);this.keys=[],this.bboxes=[]}this.n=s,this.extent=t,this.padding=l,this.scale=s/t,this.uid=0;const _=l/s*t;this.min=-_,this.max=t+_}insert(t,s,l,f,_){this._forEachCell(s,l,f,_,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(f),this.bboxes.push(_)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,s,l,f,_,x){this.cells[_].push(x)}query(t,s,l,f,_){const x=this.min,v=this.max;if(t<=x&&s<=x&&v<=l&&v<=f&&!_)return Array.prototype.slice.call(this.keys);{const S=[];return this._forEachCell(t,s,l,f,this._queryCell,S,{},_),S}}_queryCell(t,s,l,f,_,x,v,S){const C=this.cells[_];if(C!==null){const P=this.keys,L=this.bboxes;for(let F=0;F<C.length;F++){const j=C[F];if(v[j]===void 0){const H=4*j;(S?S(L[H+0],L[H+1],L[H+2],L[H+3]):t<=L[H+2]&&s<=L[H+3]&&l>=L[H+0]&&f>=L[H+1])?(v[j]=!0,x.push(P[j])):v[j]=!1}}}}_forEachCell(t,s,l,f,_,x,v,S){const C=this._convertToCellCoord(t),P=this._convertToCellCoord(s),L=this._convertToCellCoord(l),F=this._convertToCellCoord(f);for(let j=C;j<=L;j++)for(let H=P;H<=F;H++){const q=this.d*H+j;if((!S||S(this._convertFromCellCoord(j),this._convertFromCellCoord(H),this._convertFromCellCoord(j+1),this._convertFromCellCoord(H+1)))&&_.call(this,t,s,l,f,q,x,v,S))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,s=3+this.cells.length+1+1;let l=0;for(let x=0;x<this.cells.length;x++)l+=this.cells[x].length;const f=new Int32Array(s+l+this.keys.length+this.bboxes.length);f[0]=this.extent,f[1]=this.n,f[2]=this.padding;let _=s;for(let x=0;x<t.length;x++){const v=t[x];f[3+x]=_,f.set(v,_),_+=v.length}return f[3+t.length]=_,f.set(this.keys,_),_+=this.keys.length,f[3+t.length+1]=_,f.set(this.bboxes,_),_+=this.bboxes.length,f.buffer}static serialize(t,s){const l=t.toArrayBuffer();return s&&s.push(l),{buffer:l}}static deserialize(t){return new yo(t.buffer)}}const Wn={};function Xe(r,t,s={}){if(Wn[r])throw new Error(`${r} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:r,writeable:!1}),Wn[r]={klass:t,omit:s.omit||[],shallow:s.shallow||[]}}Xe("Object",Object),Xe("TransferableGridIndex",yo),Xe("Color",ti),Xe("Error",Error),Xe("AJAXError",Se),Xe("ResolvedImage",In),Xe("StylePropertyFunction",fo),Xe("StyleExpression",al,{omit:["_evaluator"]}),Xe("ZoomDependentExpression",po),Xe("ZoomConstantExpression",uo),Xe("CompoundExpression",qn,{omit:["_evaluate"]});for(const r in so)so[r]._classRegistryKey||Xe(`Expression_${r}`,so[r]);function yl(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function qc(r){return r.$name||r.constructor._classRegistryKey}function ju(r){return!function(t){if(t===null||typeof t!="object")return!1;const s=qc(t);return!(!s||s==="Object")}(r)&&(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||r instanceof Error||yl(r)||Ui(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function _o(r,t){if(ju(r))return(yl(r)||Ui(r))&&t&&t.push(r),ArrayBuffer.isView(r)&&t&&t.push(r.buffer),r instanceof ImageData&&t&&t.push(r.data.buffer),r;if(Array.isArray(r)){const _=[];for(const x of r)_.push(_o(x,t));return _}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const s=qc(r);if(!s)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!Wn[s])throw new Error(`${s} is not registered.`);const{klass:l}=Wn[s],f=l.serialize?l.serialize(r,t):{};if(l.serialize){if(t&&f===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const _ in r){if(!r.hasOwnProperty(_)||Wn[s].omit.indexOf(_)>=0)continue;const x=r[_];f[_]=Wn[s].shallow.indexOf(_)>=0?x:_o(x,t)}r instanceof Error&&(f.message=r.message)}if(f.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(f.$name=s),f}function xo(r){if(ju(r))return r;if(Array.isArray(r))return r.map(xo);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const t=qc(r)||"Object";if(!Wn[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:s}=Wn[t];if(!s)throw new Error(`can't deserialize unregistered class ${t}`);if(s.deserialize)return s.deserialize(r);const l=Object.create(s.prototype);for(const f of Object.keys(r)){if(f==="$name")continue;const _=r[f];l[f]=Wn[t].shallow.indexOf(f)>=0?_:xo(_)}return l}class Zc{constructor(){this.first=!0}update(t,s){const l=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=l,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=l,!0):(this.lastFloorZoom>l?(this.lastIntegerZoom=l+1,this.lastIntegerZoomTime=s):this.lastFloorZoom<l&&(this.lastIntegerZoom=l,this.lastIntegerZoomTime=s),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=l,!0))}}const Bt={"Latin-1 Supplement":r=>r>=128&&r<=255,"Hangul Jamo":r=>r>=4352&&r<=4607,Khmer:r=>r>=6016&&r<=6143,"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,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Katakana:r=>r>=12448&&r<=12543,Kanbun:r=>r>=12688&&r<=12703,"CJK Strokes":r=>r>=12736&&r<=12783,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"Private Use Area":r=>r>=57344&&r<=63743,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519};function Wc(r){for(const t of r)if(Yc(t.charCodeAt(0)))return!0;return!1}function df(r){for(const t of r)if(!bo(t.charCodeAt(0)))return!1;return!0}function Gc(r){const t=r.map(s=>{try{return new RegExp(`\\p{sc=${s}}`,"u").source}catch{return null}}).filter(s=>s);return new RegExp(t.join("|"),"u")}const pf=Gc(["Arab","Dupl","Mong","Ougr","Syrc"]);function bo(r){return!pf.test(String.fromCodePoint(r))}const Uu=Gc(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Yc(r){return!(r!==746&&r!==747&&(r<4352||!(Bt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||Bt["CJK Compatibility"](r)||Bt["CJK Strokes"](r)||!(!Bt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||Bt["Enclosed CJK Letters and Months"](r)||Bt["Ideographic Description Characters"](r)||Bt.Kanbun(r)||Bt.Katakana(r)&&r!==12540||!(!Bt["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)||!(!Bt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||Bt["Vertical Forms"](r)||Bt["Yijing Hexagram Symbols"](r)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(r))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(r))||Uu.test(String.fromCodePoint(r)))))}function Hu(r){return!(Yc(r)||function(t){return!!(Bt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Bt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||Bt["Letterlike Symbols"](t)||Bt["Number Forms"](t)||Bt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||Bt["Control Pictures"](t)&&t!==9251||Bt["Optical Character Recognition"](t)||Bt["Enclosed Alphanumerics"](t)||Bt["Geometric Shapes"](t)||Bt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Bt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Bt["CJK Symbols and Punctuation"](t)||Bt.Katakana(t)||Bt["Private Use Area"](t)||Bt["CJK Compatibility Forms"](t)||Bt["Small Form Variants"](t)||Bt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(r))}const ff=Gc(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Xc(r){return ff.test(String.fromCodePoint(r))}function mf(r,t){return!(!t&&Xc(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||Bt.Khmer(r))}function gf(r){for(const t of r)if(Xc(t.charCodeAt(0)))return!0;return!1}const Dn=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class fi{constructor(t,s){this.zoom=t,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 Zc,this.transition={})}isSupportedScript(t){return function(s,l){for(const f of s)if(!mf(f.charCodeAt(0),l))return!1;return!0}(t,Dn.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,s=t-Math.floor(t),l=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:s+(1-s)*l}:{fromScale:.5,toScale:1,t:1-(1-l)*s}}}class vo{constructor(t,s){this.property=t,this.value=s,this.expression=function(l,f){if(sl(l))return new fo(l,f);if(ll(l)){const _=Ac(l,f);if(_.result==="error")throw new Error(_.value.map(x=>`${x.key}: ${x.message}`).join(", "));return _.value}{let _=l;return f.type==="color"&&typeof l=="string"?_=ti.parse(l):f.type!=="padding"||typeof l!="number"&&!Array.isArray(l)?f.type==="variableAnchorOffsetCollection"&&Array.isArray(l)&&(_=Hn.parse(l)):_=Pn.parse(l),{kind:"constant",evaluate:()=>_}}}(s===void 0?t.specification.default:s,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,s,l){return this.property.possiblyEvaluate(this,t,s,l)}}class _l{constructor(t){this.property=t,this.value=new vo(t,void 0)}transitioned(t,s){return new qu(this.property,this.value,s,Be({},t.transition,this.transition),t.now)}untransitioned(){return new qu(this.property,this.value,null,{},0)}}class xl{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Mt(this._values[t].value.value)}setValue(t,s){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new _l(this._values[t].property)),this._values[t].value=new vo(this._values[t].property,s===null?void 0:Mt(s))}getTransition(t){return Mt(this._values[t].transition)}setTransition(t,s){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new _l(this._values[t].property)),this._values[t].transition=Mt(s)||void 0}serialize(){const t={};for(const s of Object.keys(this._values)){const l=this.getValue(s);l!==void 0&&(t[s]=l);const f=this.getTransition(s);f!==void 0&&(t[`${s}-transition`]=f)}return t}transitioned(t,s){const l=new pa(this._properties);for(const f of Object.keys(this._values))l._values[f]=this._values[f].transitioned(t,s._values[f]);return l}untransitioned(){const t=new pa(this._properties);for(const s of Object.keys(this._values))t._values[s]=this._values[s].untransitioned();return t}}class qu{constructor(t,s,l,f,_){this.property=t,this.value=s,this.begin=_+f.delay||0,this.end=this.begin+f.duration||0,t.specification.transition&&(f.delay||f.duration)&&(this.prior=l)}possiblyEvaluate(t,s,l){const f=t.now||0,_=this.value.possiblyEvaluate(t,s,l),x=this.prior;if(x){if(f>this.end)return this.prior=null,_;if(this.value.isDataDriven())return this.prior=null,_;if(f<this.begin)return x.possiblyEvaluate(t,s,l);{const v=(f-this.begin)/(this.end-this.begin);return this.property.interpolate(x.possiblyEvaluate(t,s,l),_,function(S){if(S<=0)return 0;if(S>=1)return 1;const C=S*S,P=C*S;return 4*(S<.5?P:3*(S-C)+P-.75)}(v))}}return _}}class pa{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,s,l){const f=new ma(this._properties);for(const _ of Object.keys(this._values))f._values[_]=this._values[_].possiblyEvaluate(t,s,l);return f}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class fa{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Mt(this._values[t].value)}setValue(t,s){this._values[t]=new vo(this._values[t].property,s===null?void 0:Mt(s))}serialize(){const t={};for(const s of Object.keys(this._values)){const l=this.getValue(s);l!==void 0&&(t[s]=l)}return t}possiblyEvaluate(t,s,l){const f=new ma(this._properties);for(const _ of Object.keys(this._values))f._values[_]=this._values[_].possiblyEvaluate(t,s,l);return f}}class Ar{constructor(t,s,l){this.property=t,this.value=s,this.parameters=l}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,s,l,f){return this.property.evaluate(this.value,this.parameters,t,s,l,f)}}class ma{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class et{constructor(t){this.specification=t}possiblyEvaluate(t,s){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(s)}interpolate(t,s,l){const f=mn[this.specification.type];return f?f(t,s,l):t}}class dt{constructor(t,s){this.specification=t,this.overrides=s}possiblyEvaluate(t,s,l,f){return new Ar(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(s,null,{},l,f)}:t.expression,s)}interpolate(t,s,l){if(t.value.kind!=="constant"||s.value.kind!=="constant")return t;if(t.value.value===void 0||s.value.value===void 0)return new Ar(this,{kind:"constant",value:void 0},t.parameters);const f=mn[this.specification.type];if(f){const _=f(t.value.value,s.value.value,l);return new Ar(this,{kind:"constant",value:_},t.parameters)}return t}evaluate(t,s,l,f,_,x){return t.kind==="constant"?t.value:t.evaluate(s,l,f,_,x)}}class bl extends dt{possiblyEvaluate(t,s,l,f){if(t.value===void 0)return new Ar(this,{kind:"constant",value:void 0},s);if(t.expression.kind==="constant"){const _=t.expression.evaluate(s,null,{},l,f),x=t.property.specification.type==="resolvedImage"&&typeof _!="string"?_.name:_,v=this._calculate(x,x,x,s);return new Ar(this,{kind:"constant",value:v},s)}if(t.expression.kind==="camera"){const _=this._calculate(t.expression.evaluate({zoom:s.zoom-1}),t.expression.evaluate({zoom:s.zoom}),t.expression.evaluate({zoom:s.zoom+1}),s);return new Ar(this,{kind:"constant",value:_},s)}return new Ar(this,t.expression,s)}evaluate(t,s,l,f,_,x){if(t.kind==="source"){const v=t.evaluate(s,l,f,_,x);return this._calculate(v,v,v,s)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(s.zoom)-1},l,f),t.evaluate({zoom:Math.floor(s.zoom)},l,f),t.evaluate({zoom:Math.floor(s.zoom)+1},l,f),s):t.value}_calculate(t,s,l,f){return f.zoom>f.zoomHistory.lastIntegerZoom?{from:t,to:s}:{from:l,to:s}}interpolate(t){return t}}class vl{constructor(t){this.specification=t}possiblyEvaluate(t,s,l,f){if(t.value!==void 0){if(t.expression.kind==="constant"){const _=t.expression.evaluate(s,null,{},l,f);return this._calculate(_,_,_,s)}return this._calculate(t.expression.evaluate(new fi(Math.floor(s.zoom-1),s)),t.expression.evaluate(new fi(Math.floor(s.zoom),s)),t.expression.evaluate(new fi(Math.floor(s.zoom+1),s)),s)}}_calculate(t,s,l,f){return f.zoom>f.zoomHistory.lastIntegerZoom?{from:t,to:s}:{from:l,to:s}}interpolate(t){return t}}class Kc{constructor(t){this.specification=t}possiblyEvaluate(t,s,l,f){return!!t.expression.evaluate(s,null,{},l,f)}interpolate(){return!1}}class g{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const s in t){const l=t[s];l.specification.overridable&&this.overridableProperties.push(s);const f=this.defaultPropertyValues[s]=new vo(l,void 0),_=this.defaultTransitionablePropertyValues[s]=new _l(l);this.defaultTransitioningPropertyValues[s]=_.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=f.possiblyEvaluate({})}}}Xe("DataDrivenProperty",dt),Xe("DataConstantProperty",et),Xe("CrossFadedDataDrivenProperty",bl),Xe("CrossFadedProperty",vl),Xe("ColorRampProperty",Kc);const e="-transition";class a extends ri{constructor(t,s){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),s.layout&&(this._unevaluatedLayout=new fa(s.layout)),s.paint)){this._transitionablePaint=new xl(s.paint);for(const l in t.paint)this.setPaintProperty(l,t.paint[l],{validate:!1});for(const l in t.layout)this.setLayoutProperty(l,t.layout[l],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ma(s.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,s,l={}){s!=null&&this._validate($u,`layers.${this.id}.layout.${t}`,t,s,l)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,s):this.visibility=s)}getPaintProperty(t){return t.endsWith(e)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,s,l={}){if(s!=null&&this._validate(Vu,`layers.${this.id}.paint.${t}`,t,s,l))return!1;if(t.endsWith(e))return this._transitionablePaint.setTransition(t.slice(0,-11),s||void 0),!1;{const f=this._transitionablePaint._values[t],_=f.property.specification["property-type"]==="cross-faded-data-driven",x=f.value.isDataDriven(),v=f.value;this._transitionablePaint.setValue(t,s),this._handleSpecialPaintPropertyUpdate(t);const S=this._transitionablePaint._values[t].value;return S.isDataDriven()||x||_||this._handleOverridablePaintPropertyUpdate(t,v,S)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,s,l){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,s){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,s)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,s)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Dt(t,(s,l)=>!(s===void 0||l==="layout"&&!Object.keys(s).length||l==="paint"&&!Object.keys(s).length))}_validate(t,s,l,f,_={}){return(!_||_.validate!==!1)&&Hc(this,t.call(Fs,{key:s,layerType:this.type,objectKey:l,value:f,styleSpec:xe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const s=this.paint.get(t);if(s instanceof Ar&&lo(s.property.specification)&&(s.value.kind==="source"||s.value.kind==="composite")&&s.value.isStateDependent)return!0}return!1}}const u={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class d{constructor(t,s){this._structArray=t,this._pos1=s*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class m{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,s){return t._trim(),s&&(t.isTransferred=!0,s.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const s=Object.create(this.prototype);return s.arrayBuffer=t.arrayBuffer,s.length=t.length,s.capacity=t.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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const s=this.uint8;this._refreshViews(),s&&this.uint8.set(s)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function k(r,t=1){let s=0,l=0;return{members:r.map(f=>{const _=u[f.type].BYTES_PER_ELEMENT,x=s=E(s,Math.max(t,_)),v=f.components||1;return l=Math.max(l,_),s+=_*v,{name:f.name,type:f.type,components:v,offset:x}}),size:E(s,Math.max(l,t)),alignment:t}}function E(r,t){return Math.ceil(r/t)*t}class T extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,s)}emplace(t,s,l){const f=2*t;return this.int16[f+0]=s,this.int16[f+1]=l,t}}T.prototype.bytesPerElement=4,Xe("StructArrayLayout2i4",T);class I extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l){const f=this.length;return this.resize(f+1),this.emplace(f,t,s,l)}emplace(t,s,l,f){const _=3*t;return this.int16[_+0]=s,this.int16[_+1]=l,this.int16[_+2]=f,t}}I.prototype.bytesPerElement=6,Xe("StructArrayLayout3i6",I);class O extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f){const _=this.length;return this.resize(_+1),this.emplace(_,t,s,l,f)}emplace(t,s,l,f,_){const x=4*t;return this.int16[x+0]=s,this.int16[x+1]=l,this.int16[x+2]=f,this.int16[x+3]=_,t}}O.prototype.bytesPerElement=8,Xe("StructArrayLayout4i8",O);class B extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x){const v=this.length;return this.resize(v+1),this.emplace(v,t,s,l,f,_,x)}emplace(t,s,l,f,_,x,v){const S=6*t;return this.int16[S+0]=s,this.int16[S+1]=l,this.int16[S+2]=f,this.int16[S+3]=_,this.int16[S+4]=x,this.int16[S+5]=v,t}}B.prototype.bytesPerElement=12,Xe("StructArrayLayout2i4i12",B);class U extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x){const v=this.length;return this.resize(v+1),this.emplace(v,t,s,l,f,_,x)}emplace(t,s,l,f,_,x,v){const S=4*t,C=8*t;return this.int16[S+0]=s,this.int16[S+1]=l,this.uint8[C+4]=f,this.uint8[C+5]=_,this.uint8[C+6]=x,this.uint8[C+7]=v,t}}U.prototype.bytesPerElement=8,Xe("StructArrayLayout2i4ub8",U);class Z extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,s)}emplace(t,s,l){const f=2*t;return this.float32[f+0]=s,this.float32[f+1]=l,t}}Z.prototype.bytesPerElement=8,Xe("StructArrayLayout2f8",Z);class G extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x,v,S,C,P){const L=this.length;return this.resize(L+1),this.emplace(L,t,s,l,f,_,x,v,S,C,P)}emplace(t,s,l,f,_,x,v,S,C,P,L){const F=10*t;return this.uint16[F+0]=s,this.uint16[F+1]=l,this.uint16[F+2]=f,this.uint16[F+3]=_,this.uint16[F+4]=x,this.uint16[F+5]=v,this.uint16[F+6]=S,this.uint16[F+7]=C,this.uint16[F+8]=P,this.uint16[F+9]=L,t}}G.prototype.bytesPerElement=20,Xe("StructArrayLayout10ui20",G);class Q extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x,v,S,C,P,L,F){const j=this.length;return this.resize(j+1),this.emplace(j,t,s,l,f,_,x,v,S,C,P,L,F)}emplace(t,s,l,f,_,x,v,S,C,P,L,F,j){const H=12*t;return this.int16[H+0]=s,this.int16[H+1]=l,this.int16[H+2]=f,this.int16[H+3]=_,this.uint16[H+4]=x,this.uint16[H+5]=v,this.uint16[H+6]=S,this.uint16[H+7]=C,this.int16[H+8]=P,this.int16[H+9]=L,this.int16[H+10]=F,this.int16[H+11]=j,t}}Q.prototype.bytesPerElement=24,Xe("StructArrayLayout4i4ui4i24",Q);class ne extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s,l){const f=this.length;return this.resize(f+1),this.emplace(f,t,s,l)}emplace(t,s,l,f){const _=3*t;return this.float32[_+0]=s,this.float32[_+1]=l,this.float32[_+2]=f,t}}ne.prototype.bytesPerElement=12,Xe("StructArrayLayout3f12",ne);class re extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const s=this.length;return this.resize(s+1),this.emplace(s,t)}emplace(t,s){return this.uint32[1*t+0]=s,t}}re.prototype.bytesPerElement=4,Xe("StructArrayLayout1ul4",re);class oe extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x,v,S,C){const P=this.length;return this.resize(P+1),this.emplace(P,t,s,l,f,_,x,v,S,C)}emplace(t,s,l,f,_,x,v,S,C,P){const L=10*t,F=5*t;return this.int16[L+0]=s,this.int16[L+1]=l,this.int16[L+2]=f,this.int16[L+3]=_,this.int16[L+4]=x,this.int16[L+5]=v,this.uint32[F+3]=S,this.uint16[L+8]=C,this.uint16[L+9]=P,t}}oe.prototype.bytesPerElement=20,Xe("StructArrayLayout6i1ul2ui20",oe);class X extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x){const v=this.length;return this.resize(v+1),this.emplace(v,t,s,l,f,_,x)}emplace(t,s,l,f,_,x,v){const S=6*t;return this.int16[S+0]=s,this.int16[S+1]=l,this.int16[S+2]=f,this.int16[S+3]=_,this.int16[S+4]=x,this.int16[S+5]=v,t}}X.prototype.bytesPerElement=12,Xe("StructArrayLayout2i2i2i12",X);class ue extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_){const x=this.length;return this.resize(x+1),this.emplace(x,t,s,l,f,_)}emplace(t,s,l,f,_,x){const v=4*t,S=8*t;return this.float32[v+0]=s,this.float32[v+1]=l,this.float32[v+2]=f,this.int16[S+6]=_,this.int16[S+7]=x,t}}ue.prototype.bytesPerElement=16,Xe("StructArrayLayout2f1f2i16",ue);class pe extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x){const v=this.length;return this.resize(v+1),this.emplace(v,t,s,l,f,_,x)}emplace(t,s,l,f,_,x,v){const S=16*t,C=4*t,P=8*t;return this.uint8[S+0]=s,this.uint8[S+1]=l,this.float32[C+1]=f,this.float32[C+2]=_,this.int16[P+6]=x,this.int16[P+7]=v,t}}pe.prototype.bytesPerElement=16,Xe("StructArrayLayout2ub2f2i16",pe);class ye extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s,l){const f=this.length;return this.resize(f+1),this.emplace(f,t,s,l)}emplace(t,s,l,f){const _=3*t;return this.uint16[_+0]=s,this.uint16[_+1]=l,this.uint16[_+2]=f,t}}ye.prototype.bytesPerElement=6,Xe("StructArrayLayout3ui6",ye);class Ce extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie){const ge=this.length;return this.resize(ge+1),this.emplace(ge,t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie)}emplace(t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie,ge){const le=24*t,fe=12*t,we=48*t;return this.int16[le+0]=s,this.int16[le+1]=l,this.uint16[le+2]=f,this.uint16[le+3]=_,this.uint32[fe+2]=x,this.uint32[fe+3]=v,this.uint32[fe+4]=S,this.uint16[le+10]=C,this.uint16[le+11]=P,this.uint16[le+12]=L,this.float32[fe+7]=F,this.float32[fe+8]=j,this.uint8[we+36]=H,this.uint8[we+37]=q,this.uint8[we+38]=K,this.uint32[fe+10]=ie,this.int16[le+22]=ge,t}}Ce.prototype.bytesPerElement=48,Xe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ce);class Ae extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie,ge,le,fe,we,Pe,qe,ut,je,Ve,nt,Ke){const Ge=this.length;return this.resize(Ge+1),this.emplace(Ge,t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie,ge,le,fe,we,Pe,qe,ut,je,Ve,nt,Ke)}emplace(t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie,ge,le,fe,we,Pe,qe,ut,je,Ve,nt,Ke,Ge){const Te=32*t,at=16*t;return this.int16[Te+0]=s,this.int16[Te+1]=l,this.int16[Te+2]=f,this.int16[Te+3]=_,this.int16[Te+4]=x,this.int16[Te+5]=v,this.int16[Te+6]=S,this.int16[Te+7]=C,this.uint16[Te+8]=P,this.uint16[Te+9]=L,this.uint16[Te+10]=F,this.uint16[Te+11]=j,this.uint16[Te+12]=H,this.uint16[Te+13]=q,this.uint16[Te+14]=K,this.uint16[Te+15]=ie,this.uint16[Te+16]=ge,this.uint16[Te+17]=le,this.uint16[Te+18]=fe,this.uint16[Te+19]=we,this.uint16[Te+20]=Pe,this.uint16[Te+21]=qe,this.uint16[Te+22]=ut,this.uint32[at+12]=je,this.float32[at+13]=Ve,this.float32[at+14]=nt,this.uint16[Te+30]=Ke,this.uint16[Te+31]=Ge,t}}Ae.prototype.bytesPerElement=64,Xe("StructArrayLayout8i15ui1ul2f2ui64",Ae);class $e extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const s=this.length;return this.resize(s+1),this.emplace(s,t)}emplace(t,s){return this.float32[1*t+0]=s,t}}$e.prototype.bytesPerElement=4,Xe("StructArrayLayout1f4",$e);class We extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s,l){const f=this.length;return this.resize(f+1),this.emplace(f,t,s,l)}emplace(t,s,l,f){const _=3*t;return this.uint16[6*t+0]=s,this.float32[_+1]=l,this.float32[_+2]=f,t}}We.prototype.bytesPerElement=12,Xe("StructArrayLayout1ui2f12",We);class Oe extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s,l){const f=this.length;return this.resize(f+1),this.emplace(f,t,s,l)}emplace(t,s,l,f){const _=4*t;return this.uint32[2*t+0]=s,this.uint16[_+2]=l,this.uint16[_+3]=f,t}}Oe.prototype.bytesPerElement=8,Xe("StructArrayLayout1ul2ui8",Oe);class Le extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,s)}emplace(t,s,l){const f=2*t;return this.uint16[f+0]=s,this.uint16[f+1]=l,t}}Le.prototype.bytesPerElement=4,Xe("StructArrayLayout2ui4",Le);class tt extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const s=this.length;return this.resize(s+1),this.emplace(s,t)}emplace(t,s){return this.uint16[1*t+0]=s,t}}tt.prototype.bytesPerElement=2,Xe("StructArrayLayout1ui2",tt);class xt extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s,l,f){const _=this.length;return this.resize(_+1),this.emplace(_,t,s,l,f)}emplace(t,s,l,f,_){const x=4*t;return this.float32[x+0]=s,this.float32[x+1]=l,this.float32[x+2]=f,this.float32[x+3]=_,t}}xt.prototype.bytesPerElement=16,Xe("StructArrayLayout4f16",xt);class Ne extends d{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 R(this.anchorPointX,this.anchorPointY)}}Ne.prototype.size=20;class Ue extends oe{get(t){return new Ne(this,t)}}Xe("CollisionBoxArray",Ue);class yt extends d{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}yt.prototype.size=48;class mi extends Ce{get(t){return new yt(this,t)}}Xe("PlacedSymbolArray",mi);class Tt extends d{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Tt.prototype.size=64;class Ot extends Ae{get(t){return new Tt(this,t)}}Xe("SymbolInstanceArray",Ot);class gi extends $e{getoffsetX(t){return this.float32[1*t+0]}}Xe("GlyphOffsetArray",gi);class Xi extends I{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Xe("SymbolLineVertexArray",Xi);class lr extends d{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]}}lr.prototype.size=12;class yi extends We{get(t){return new lr(this,t)}}Xe("TextAnchorOffsetArray",yi);class yn extends d{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]}}yn.prototype.size=8;class ln extends Oe{get(t){return new yn(this,t)}}Xe("FeatureIndexArray",ln);class Ki extends T{}class cn extends T{}class Dr extends T{}class wo extends B{}class wl extends U{}class ko extends Z{}class Gn extends G{}class kl extends Q{}class Jc extends ne{}class Yn extends re{}class Xn extends X{}class as extends pe{}class cr extends ye{}class Zi extends Le{}const Ji=k([{name:"a_pos",components:2,type:"Int16"}],4),{members:zn}=Ji;class Ft{constructor(t=[]){this.segments=t}prepareSegment(t,s,l,f){let _=this.segments[this.segments.length-1];return t>Ft.MAX_VERTEX_ARRAY_LENGTH&&Rt(`Max vertices per segment is ${Ft.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!_||_.vertexLength+t>Ft.MAX_VERTEX_ARRAY_LENGTH||_.sortKey!==f)&&(_={vertexOffset:s.length,primitiveOffset:l.length,vertexLength:0,primitiveLength:0},f!==void 0&&(_.sortKey=f),this.segments.push(_)),_}get(){return this.segments}destroy(){for(const t of this.segments)for(const s in t.vaos)t.vaos[s].destroy()}static simpleSegment(t,s,l,f){return new Ft([{vertexOffset:t,primitiveOffset:s,vertexLength:l,primitiveLength:f,vaos:{},sortKey:0}])}}function Ns(r,t){return 256*(r=ot(Math.floor(r),0,255))+ot(Math.floor(t),0,255)}Ft.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Xe("SegmentVector",Ft);const So=k([{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 Eo={exports:{}},Zu={exports:{}};Zu.exports=function(r,t){var s,l,f,_,x,v,S,C;for(l=r.length-(s=3&r.length),f=t,x=3432918353,v=461845907,C=0;C<l;)S=255&r.charCodeAt(C)|(255&r.charCodeAt(++C))<<8|(255&r.charCodeAt(++C))<<16|(255&r.charCodeAt(++C))<<24,++C,f=27492+(65535&(_=5*(65535&(f=(f^=S=(65535&(S=(S=(65535&S)*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*v+(((S>>>16)*v&65535)<<16)&4294967295)<<13|f>>>19))+((5*(f>>>16)&65535)<<16)&4294967295))+((58964+(_>>>16)&65535)<<16);switch(S=0,s){case 3:S^=(255&r.charCodeAt(C+2))<<16;case 2:S^=(255&r.charCodeAt(C+1))<<8;case 1:f^=S=(65535&(S=(S=(65535&(S^=255&r.charCodeAt(C)))*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*v+(((S>>>16)*v&65535)<<16)&4294967295}return f^=r.length,f=2246822507*(65535&(f^=f>>>16))+((2246822507*(f>>>16)&65535)<<16)&4294967295,f=3266489909*(65535&(f^=f>>>13))+((3266489909*(f>>>16)&65535)<<16)&4294967295,(f^=f>>>16)>>>0};var yf=Zu.exports,Wu={exports:{}};Wu.exports=function(r,t){for(var s,l=r.length,f=t^l,_=0;l>=4;)s=1540483477*(65535&(s=255&r.charCodeAt(_)|(255&r.charCodeAt(++_))<<8|(255&r.charCodeAt(++_))<<16|(255&r.charCodeAt(++_))<<24))+((1540483477*(s>>>16)&65535)<<16),f=1540483477*(65535&f)+((1540483477*(f>>>16)&65535)<<16)^(s=1540483477*(65535&(s^=s>>>24))+((1540483477*(s>>>16)&65535)<<16)),l-=4,++_;switch(l){case 3:f^=(255&r.charCodeAt(_+2))<<16;case 2:f^=(255&r.charCodeAt(_+1))<<8;case 1:f=1540483477*(65535&(f^=255&r.charCodeAt(_)))+((1540483477*(f>>>16)&65535)<<16)}return f=1540483477*(65535&(f^=f>>>13))+((1540483477*(f>>>16)&65535)<<16),(f^=f>>>15)>>>0};var ls=yf,Gu=Wu.exports;Eo.exports=ls,Eo.exports.murmur3=ls,Eo.exports.murmur2=Gu;var Sl=M(Eo.exports);class ga{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,s,l,f){this.ids.push(El(t)),this.positions.push(s,l,f)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const s=El(t);let l=0,f=this.ids.length-1;for(;l<f;){const x=l+f>>1;this.ids[x]>=s?f=x:l=x+1}const _=[];for(;this.ids[l]===s;)_.push({index:this.positions[3*l],start:this.positions[3*l+1],end:this.positions[3*l+2]}),l++;return _}static serialize(t,s){const l=new Float64Array(t.ids),f=new Uint32Array(t.positions);return Tl(l,f,0,l.length-1),s&&s.push(l.buffer,f.buffer),{ids:l,positions:f}}static deserialize(t){const s=new ga;return s.ids=t.ids,s.positions=t.positions,s.indexed=!0,s}}function El(r){const t=+r;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Sl(String(r))}function Tl(r,t,s,l){for(;s<l;){const f=r[s+l>>1];let _=s-1,x=l+1;for(;;){do _++;while(r[_]<f);do x--;while(r[x]>f);if(_>=x)break;To(r,_,x),To(t,3*_,3*x),To(t,3*_+1,3*x+1),To(t,3*_+2,3*x+2)}x-s<l-x?(Tl(r,t,s,x),s=x+1):(Tl(r,t,x+1,l),l=x)}}function To(r,t,s){const l=r[t];r[t]=r[s],r[s]=l}Xe("FeaturePositionMap",ga);class ya{constructor(t,s){this.gl=t.gl,this.location=s}}class Yu extends ya{constructor(t,s){super(t,s),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class E0 extends ya{constructor(t,s){super(t,s),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class T0 extends ya{constructor(t,s){super(t,s),this.current=ti.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const rI=new Float32Array(16);function _f(r){return[Ns(255*r.r,255*r.g),Ns(255*r.b,255*r.a)]}class Qc{constructor(t,s,l){this.value=t,this.uniformNames=s.map(f=>`u_${f}`),this.type=l}setUniform(t,s,l){t.set(l.constantOr(this.value))}getBinding(t,s,l){return this.type==="color"?new T0(t,s):new Yu(t,s)}}class Cl{constructor(t,s){this.uniformNames=s.map(l=>`u_${l}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,s){this.pixelRatioFrom=s.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=s.tlbr,this.patternTo=t.tlbr}setUniform(t,s,l,f){const _=f==="u_pattern_to"?this.patternTo:f==="u_pattern_from"?this.patternFrom:f==="u_pixel_ratio_to"?this.pixelRatioTo:f==="u_pixel_ratio_from"?this.pixelRatioFrom:null;_&&t.set(_)}getBinding(t,s,l){return l.substr(0,9)==="u_pattern"?new E0(t,s):new Yu(t,s)}}class Vs{constructor(t,s,l,f){this.expression=t,this.type=l,this.maxValue=0,this.paintVertexAttributes=s.map(_=>({name:`a_${_}`,type:"Float32",components:l==="color"?2:1,offset:0})),this.paintVertexArray=new f}populatePaintArray(t,s,l,f,_){const x=this.paintVertexArray.length,v=this.expression.evaluate(new fi(0),s,{},f,[],_);this.paintVertexArray.resize(t),this._setPaintValue(x,t,v)}updatePaintArray(t,s,l,f){const _=this.expression.evaluate({zoom:0},l,f);this._setPaintValue(t,s,_)}_setPaintValue(t,s,l){if(this.type==="color"){const f=_f(l);for(let _=t;_<s;_++)this.paintVertexArray.emplace(_,f[0],f[1])}else{for(let f=t;f<s;f++)this.paintVertexArray.emplace(f,l);this.maxValue=Math.max(this.maxValue,Math.abs(l))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class qr{constructor(t,s,l,f,_,x){this.expression=t,this.uniformNames=s.map(v=>`u_${v}_t`),this.type=l,this.useIntegerZoom=f,this.zoom=_,this.maxValue=0,this.paintVertexAttributes=s.map(v=>({name:`a_${v}`,type:"Float32",components:l==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(t,s,l,f,_){const x=this.expression.evaluate(new fi(this.zoom),s,{},f,[],_),v=this.expression.evaluate(new fi(this.zoom+1),s,{},f,[],_),S=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(S,t,x,v)}updatePaintArray(t,s,l,f){const _=this.expression.evaluate({zoom:this.zoom},l,f),x=this.expression.evaluate({zoom:this.zoom+1},l,f);this._setPaintValue(t,s,_,x)}_setPaintValue(t,s,l,f){if(this.type==="color"){const _=_f(l),x=_f(f);for(let v=t;v<s;v++)this.paintVertexArray.emplace(v,_[0],_[1],x[0],x[1])}else{for(let _=t;_<s;_++)this.paintVertexArray.emplace(_,l,f);this.maxValue=Math.max(this.maxValue,Math.abs(l),Math.abs(f))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,s){const l=this.useIntegerZoom?Math.floor(s.zoom):s.zoom,f=ot(this.expression.interpolationFactor(l,this.zoom,this.zoom+1),0,1);t.set(f)}getBinding(t,s,l){return new Yu(t,s)}}class Co{constructor(t,s,l,f,_,x){this.expression=t,this.type=s,this.useIntegerZoom=l,this.zoom=f,this.layerId=x,this.zoomInPaintVertexArray=new _,this.zoomOutPaintVertexArray=new _}populatePaintArray(t,s,l){const f=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(f,t,s.patterns&&s.patterns[this.layerId],l)}updatePaintArray(t,s,l,f,_){this._setPaintValues(t,s,l.patterns&&l.patterns[this.layerId],_)}_setPaintValues(t,s,l,f){if(!f||!l)return;const{min:_,mid:x,max:v}=l,S=f[_],C=f[x],P=f[v];if(S&&C&&P)for(let L=t;L<s;L++)this.zoomInPaintVertexArray.emplace(L,C.tl[0],C.tl[1],C.br[0],C.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],C.pixelRatio,S.pixelRatio),this.zoomOutPaintVertexArray.emplace(L,C.tl[0],C.tl[1],C.br[0],C.br[1],P.tl[0],P.tl[1],P.br[0],P.br[1],C.pixelRatio,P.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,So.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,So.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class C0{constructor(t,s,l){this.binders={},this._buffers=[];const f=[];for(const _ in t.paint._values){if(!l(_))continue;const x=t.paint.get(_);if(!(x instanceof Ar&&lo(x.property.specification)))continue;const v=sI(_,t.type),S=x.value,C=x.property.specification.type,P=x.property.useIntegerZoom,L=x.property.specification["property-type"],F=L==="cross-faded"||L==="cross-faded-data-driven";if(S.kind==="constant")this.binders[_]=F?new Cl(S.value,v):new Qc(S.value,v,C),f.push(`/u_${_}`);else if(S.kind==="source"||F){const j=M0(_,C,"source");this.binders[_]=F?new Co(S,C,P,s,j,t.id):new Vs(S,v,C,j),f.push(`/a_${_}`)}else{const j=M0(_,C,"composite");this.binders[_]=new qr(S,v,C,P,s,j),f.push(`/z_${_}`)}}this.cacheKey=f.sort().join("")}getMaxValue(t){const s=this.binders[t];return s instanceof Vs||s instanceof qr?s.maxValue:0}populatePaintArrays(t,s,l,f,_){for(const x in this.binders){const v=this.binders[x];(v instanceof Vs||v instanceof qr||v instanceof Co)&&v.populatePaintArray(t,s,l,f,_)}}setConstantPatternPositions(t,s){for(const l in this.binders){const f=this.binders[l];f instanceof Cl&&f.setConstantPatternPositions(t,s)}}updatePaintArrays(t,s,l,f,_){let x=!1;for(const v in t){const S=s.getPositions(v);for(const C of S){const P=l.feature(C.index);for(const L in this.binders){const F=this.binders[L];if((F instanceof Vs||F instanceof qr||F instanceof Co)&&F.expression.isStateDependent===!0){const j=f.paint.get(L);F.expression=j.value,F.updatePaintArray(C.start,C.end,P,t[v],_),x=!0}}}}return x}defines(){const t=[];for(const s in this.binders){const l=this.binders[s];(l instanceof Qc||l instanceof Cl)&&t.push(...l.uniformNames.map(f=>`#define HAS_UNIFORM_${f}`))}return t}getBinderAttributes(){const t=[];for(const s in this.binders){const l=this.binders[s];if(l instanceof Vs||l instanceof qr)for(let f=0;f<l.paintVertexAttributes.length;f++)t.push(l.paintVertexAttributes[f].name);else if(l instanceof Co)for(let f=0;f<So.members.length;f++)t.push(So.members[f].name)}return t}getBinderUniforms(){const t=[];for(const s in this.binders){const l=this.binders[s];if(l instanceof Qc||l instanceof Cl||l instanceof qr)for(const f of l.uniformNames)t.push(f)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,s){const l=[];for(const f in this.binders){const _=this.binders[f];if(_ instanceof Qc||_ instanceof Cl||_ instanceof qr){for(const x of _.uniformNames)if(s[x]){const v=_.getBinding(t,s[x],x);l.push({name:x,property:f,binding:v})}}}return l}setUniforms(t,s,l,f){for(const{name:_,property:x,binding:v}of s)this.binders[x].setUniform(v,f,l.get(x),_)}updatePaintBuffers(t){this._buffers=[];for(const s in this.binders){const l=this.binders[s];if(t&&l instanceof Co){const f=t.fromScale===2?l.zoomInPaintVertexBuffer:l.zoomOutPaintVertexBuffer;f&&this._buffers.push(f)}else(l instanceof Vs||l instanceof qr)&&l.paintVertexBuffer&&this._buffers.push(l.paintVertexBuffer)}}upload(t){for(const s in this.binders){const l=this.binders[s];(l instanceof Vs||l instanceof qr||l instanceof Co)&&l.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const s=this.binders[t];(s instanceof Vs||s instanceof qr||s instanceof Co)&&s.destroy()}}}class _a{constructor(t,s,l=()=>!0){this.programConfigurations={};for(const f of t)this.programConfigurations[f.id]=new C0(f,s,l);this.needsUpload=!1,this._featureMap=new ga,this._bufferOffset=0}populatePaintArrays(t,s,l,f,_,x){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(t,s,f,_,x);s.id!==void 0&&this._featureMap.add(s.id,l,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,s,l,f){for(const _ of l)this.needsUpload=this.programConfigurations[_.id].updatePaintArrays(t,this._featureMap,s,_,f)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const s in this.programConfigurations)this.programConfigurations[s].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function sI(r,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace(`${t}-`,"").replace(/-/g,"_")]}function M0(r,t,s){const l={color:{source:Z,composite:xt},number:{source:$e,composite:Z}},f=function(_){return{"line-pattern":{source:Gn,composite:Gn},"fill-pattern":{source:Gn,composite:Gn},"fill-extrusion-pattern":{source:Gn,composite:Gn}}[_]}(r);return f&&f[s]||l[t][s]}Xe("ConstantBinder",Qc),Xe("CrossFadedConstantBinder",Cl),Xe("SourceExpressionBinder",Vs),Xe("CrossFadedCompositeBinder",Co),Xe("CompositeExpressionBinder",qr),Xe("ProgramConfiguration",C0,{omit:["_buffers"]}),Xe("ProgramConfigurationSet",_a);const Ri=8192,xf=Math.pow(2,14)-1,P0=-xf-1;function xa(r){const t=Ri/r.extent,s=r.loadGeometry();for(let l=0;l<s.length;l++){const f=s[l];for(let _=0;_<f.length;_++){const x=f[_],v=Math.round(x.x*t),S=Math.round(x.y*t);x.x=ot(v,P0,xf),x.y=ot(S,P0,xf),(v<x.x||v>x.x+1||S<x.y||S>x.y+1)&&Rt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return s}function ba(r,t){return{type:r.type,id:r.id,properties:r.properties,geometry:t?xa(r):[]}}function Xu(r,t,s,l,f){r.emplaceBack(2*t+(l+1)/2,2*s+(f+1)/2)}class bf{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new cn,this.indexArray=new cr,this.segments=new Ft,this.programConfigurations=new _a(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(t,s,l){const f=this.layers[0],_=[];let x=null,v=!1;f.type==="circle"&&(x=f.layout.get("circle-sort-key"),v=!x.isConstant());for(const{feature:S,id:C,index:P,sourceLayerIndex:L}of t){const F=this.layers[0]._featureFilter.needGeometry,j=ba(S,F);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),j,l))continue;const H=v?x.evaluate(j,{},l):void 0,q={id:C,properties:S.properties,type:S.type,sourceLayerIndex:L,index:P,geometry:F?j.geometry:xa(S),patterns:{},sortKey:H};_.push(q)}v&&_.sort((S,C)=>S.sortKey-C.sortKey);for(const S of _){const{geometry:C,index:P,sourceLayerIndex:L}=S,F=t[P].feature;this.addFeature(S,C,P,l),s.featureIndex.insert(F,C,P,L,this.index)}}update(t,s,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,s,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,zn),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,s,l,f){for(const _ of s)for(const x of _){const v=x.x,S=x.y;if(v<0||v>=Ri||S<0||S>=Ri)continue;const C=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),P=C.vertexLength;Xu(this.layoutVertexArray,v,S,-1,-1),Xu(this.layoutVertexArray,v,S,1,-1),Xu(this.layoutVertexArray,v,S,1,1),Xu(this.layoutVertexArray,v,S,-1,1),this.indexArray.emplaceBack(P,P+1,P+2),this.indexArray.emplaceBack(P,P+3,P+2),C.vertexLength+=4,C.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,{},f)}}function I0(r,t){for(let s=0;s<r.length;s++)if(Ml(t,r[s]))return!0;for(let s=0;s<t.length;s++)if(Ml(r,t[s]))return!0;return!!vf(r,t)}function oI(r,t,s){return!!Ml(r,t)||!!wf(t,r,s)}function A0(r,t){if(r.length===1)return z0(t,r[0]);for(let s=0;s<t.length;s++){const l=t[s];for(let f=0;f<l.length;f++)if(Ml(r,l[f]))return!0}for(let s=0;s<r.length;s++)if(z0(t,r[s]))return!0;for(let s=0;s<t.length;s++)if(vf(r,t[s]))return!0;return!1}function aI(r,t,s){if(r.length>1){if(vf(r,t))return!0;for(let l=0;l<t.length;l++)if(wf(t[l],r,s))return!0}for(let l=0;l<r.length;l++)if(wf(r[l],t,s))return!0;return!1}function vf(r,t){if(r.length===0||t.length===0)return!1;for(let s=0;s<r.length-1;s++){const l=r[s],f=r[s+1];for(let _=0;_<t.length-1;_++)if(lI(l,f,t[_],t[_+1]))return!0}return!1}function lI(r,t,s,l){return pi(r,s,l)!==pi(t,s,l)&&pi(r,t,s)!==pi(r,t,l)}function wf(r,t,s){const l=s*s;if(t.length===1)return r.distSqr(t[0])<l;for(let f=1;f<t.length;f++)if(D0(r,t[f-1],t[f])<l)return!0;return!1}function D0(r,t,s){const l=t.distSqr(s);if(l===0)return r.distSqr(t);const f=((r.x-t.x)*(s.x-t.x)+(r.y-t.y)*(s.y-t.y))/l;return r.distSqr(f<0?t:f>1?s:s.sub(t)._mult(f)._add(t))}function z0(r,t){let s,l,f,_=!1;for(let x=0;x<r.length;x++){s=r[x];for(let v=0,S=s.length-1;v<s.length;S=v++)l=s[v],f=s[S],l.y>t.y!=f.y>t.y&&t.x<(f.x-l.x)*(t.y-l.y)/(f.y-l.y)+l.x&&(_=!_)}return _}function Ml(r,t){let s=!1;for(let l=0,f=r.length-1;l<r.length;f=l++){const _=r[l],x=r[f];_.y>t.y!=x.y>t.y&&t.x<(x.x-_.x)*(t.y-_.y)/(x.y-_.y)+_.x&&(s=!s)}return s}function cI(r,t,s){const l=s[0],f=s[2];if(r.x<l.x&&t.x<l.x||r.x>f.x&&t.x>f.x||r.y<l.y&&t.y<l.y||r.y>f.y&&t.y>f.y)return!1;const _=pi(r,t,s[0]);return _!==pi(r,t,s[1])||_!==pi(r,t,s[2])||_!==pi(r,t,s[3])}function eh(r,t,s){const l=t.paint.get(r).value;return l.kind==="constant"?l.value:s.programConfigurations.get(t.id).getMaxValue(r)}function Ku(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Ju(r,t,s,l,f){if(!t[0]&&!t[1])return r;const _=R.convert(t)._mult(f);s==="viewport"&&_._rotate(-l);const x=[];for(let v=0;v<r.length;v++)x.push(r[v].sub(_));return x}let R0,L0;Xe("CircleBucket",bf,{omit:["layers"]});var hI={get paint(){return L0=L0||new g({"circle-radius":new dt(xe.paint_circle["circle-radius"]),"circle-color":new dt(xe.paint_circle["circle-color"]),"circle-blur":new dt(xe.paint_circle["circle-blur"]),"circle-opacity":new dt(xe.paint_circle["circle-opacity"]),"circle-translate":new et(xe.paint_circle["circle-translate"]),"circle-translate-anchor":new et(xe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new et(xe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new et(xe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new dt(xe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new dt(xe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new dt(xe.paint_circle["circle-stroke-opacity"])})},get layout(){return R0=R0||new g({"circle-sort-key":new dt(xe.layout_circle["circle-sort-key"])})}},_n=1e-6,Pl=typeof Float32Array<"u"?Float32Array:Array;function kf(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function O0(r,t,s){var l=t[0],f=t[1],_=t[2],x=t[3],v=t[4],S=t[5],C=t[6],P=t[7],L=t[8],F=t[9],j=t[10],H=t[11],q=t[12],K=t[13],ie=t[14],ge=t[15],le=s[0],fe=s[1],we=s[2],Pe=s[3];return r[0]=le*l+fe*v+we*L+Pe*q,r[1]=le*f+fe*S+we*F+Pe*K,r[2]=le*_+fe*C+we*j+Pe*ie,r[3]=le*x+fe*P+we*H+Pe*ge,r[4]=(le=s[4])*l+(fe=s[5])*v+(we=s[6])*L+(Pe=s[7])*q,r[5]=le*f+fe*S+we*F+Pe*K,r[6]=le*_+fe*C+we*j+Pe*ie,r[7]=le*x+fe*P+we*H+Pe*ge,r[8]=(le=s[8])*l+(fe=s[9])*v+(we=s[10])*L+(Pe=s[11])*q,r[9]=le*f+fe*S+we*F+Pe*K,r[10]=le*_+fe*C+we*j+Pe*ie,r[11]=le*x+fe*P+we*H+Pe*ge,r[12]=(le=s[12])*l+(fe=s[13])*v+(we=s[14])*L+(Pe=s[15])*q,r[13]=le*f+fe*S+we*F+Pe*K,r[14]=le*_+fe*C+we*j+Pe*ie,r[15]=le*x+fe*P+we*H+Pe*ge,r}Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)});var th,uI=O0;function Qu(r,t,s){var l=t[0],f=t[1],_=t[2],x=t[3];return r[0]=s[0]*l+s[4]*f+s[8]*_+s[12]*x,r[1]=s[1]*l+s[5]*f+s[9]*_+s[13]*x,r[2]=s[2]*l+s[6]*f+s[10]*_+s[14]*x,r[3]=s[3]*l+s[7]*f+s[11]*_+s[15]*x,r}th=new Pl(4),Pl!=Float32Array&&(th[0]=0,th[1]=0,th[2]=0,th[3]=0);class dI extends a{constructor(t){super(t,hI)}createBucket(t){return new bf(t)}queryRadius(t){const s=t;return eh("circle-radius",this,s)+eh("circle-stroke-width",this,s)+Ku(this.paint.get("circle-translate"))}queryIntersectsFeature(t,s,l,f,_,x,v,S){const C=Ju(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),x.angle,v),P=this.paint.get("circle-radius").evaluate(s,l)+this.paint.get("circle-stroke-width").evaluate(s,l),L=this.paint.get("circle-pitch-alignment")==="map",F=L?C:function(H,q){return H.map(K=>B0(K,q))}(C,S),j=L?P*v:P;for(const H of f)for(const q of H){const K=L?q:B0(q,S);let ie=j;const ge=Qu([],[q.x,q.y,0,1],S);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ie*=ge[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ie*=x.cameraToCenterDistance/ge[3]),oI(F,K,ie))return!0}return!1}}function B0(r,t){const s=Qu([],[r.x,r.y,0,1],t);return new R(s[0]/s[3],s[1]/s[3])}class F0 extends bf{}let N0;Xe("HeatmapBucket",F0,{omit:["layers"]});var pI={get paint(){return N0=N0||new g({"heatmap-radius":new dt(xe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new dt(xe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new et(xe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Kc(xe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new et(xe.paint_heatmap["heatmap-opacity"])})}};function Sf(r,{width:t,height:s},l,f){if(f){if(f instanceof Uint8ClampedArray)f=new Uint8Array(f.buffer);else if(f.length!==t*s*l)throw new RangeError(`mismatched image size. expected: ${f.length} but got: ${t*s*l}`)}else f=new Uint8Array(t*s*l);return r.width=t,r.height=s,r.data=f,r}function V0(r,{width:t,height:s},l){if(t===r.width&&s===r.height)return;const f=Sf({},{width:t,height:s},l);Ef(r,f,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,t),height:Math.min(r.height,s)},l),r.width=t,r.height=s,r.data=f.data}function Ef(r,t,s,l,f,_){if(f.width===0||f.height===0)return t;if(f.width>r.width||f.height>r.height||s.x>r.width-f.width||s.y>r.height-f.height)throw new RangeError("out of range source coordinates for image copy");if(f.width>t.width||f.height>t.height||l.x>t.width-f.width||l.y>t.height-f.height)throw new RangeError("out of range destination coordinates for image copy");const x=r.data,v=t.data;if(x===v)throw new Error("srcData equals dstData, so image is already copied");for(let S=0;S<f.height;S++){const C=((s.y+S)*r.width+s.x)*_,P=((l.y+S)*t.width+l.x)*_;for(let L=0;L<f.width*_;L++)v[P+L]=x[C+L]}return t}class ih{constructor(t,s){Sf(this,t,1,s)}resize(t){V0(this,t,1)}clone(){return new ih({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,s,l,f,_){Ef(t,s,l,f,_,1)}}class hr{constructor(t,s){Sf(this,t,4,s)}resize(t){V0(this,t,4)}replace(t,s){s?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new hr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,s,l,f,_){Ef(t,s,l,f,_,4)}}function $0(r){const t={},s=r.resolution||256,l=r.clips?r.clips.length:1,f=r.image||new hr({width:s,height:l});if(Math.log(s)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${s}`);const _=(x,v,S)=>{t[r.evaluationKey]=S;const C=r.expression.evaluate(t);f.data[x+v+0]=Math.floor(255*C.r/C.a),f.data[x+v+1]=Math.floor(255*C.g/C.a),f.data[x+v+2]=Math.floor(255*C.b/C.a),f.data[x+v+3]=Math.floor(255*C.a)};if(r.clips)for(let x=0,v=0;x<l;++x,v+=4*s)for(let S=0,C=0;S<s;S++,C+=4){const P=S/(s-1),{start:L,end:F}=r.clips[x];_(v,C,L*(1-P)+F*P)}else for(let x=0,v=0;x<s;x++,v+=4)_(0,v,x/(s-1));return f}Xe("AlphaImage",ih),Xe("RGBAImage",hr);const Tf="big-fb";class fI extends a{createBucket(t){return new F0(t)}constructor(t){super(t,pI),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=$0({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Tf)&&this.heatmapFbos.delete(Tf)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let j0;var mI={get paint(){return j0=j0||new g({"hillshade-illumination-direction":new et(xe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new et(xe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new et(xe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new et(xe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new et(xe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new et(xe.paint_hillshade["hillshade-accent-color"])})}};class gI extends a{constructor(t){super(t,mI)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const yI=k([{name:"a_pos",components:2,type:"Int16"}],4),{members:_I}=yI;function U0(r,t,s=2){const l=t&&t.length,f=l?t[0]*s:r.length;let _=H0(r,0,f,s,!0);const x=[];if(!_||_.next===_.prev)return x;let v,S,C;if(l&&(_=function(P,L,F,j){const H=[];for(let q=0,K=L.length;q<K;q++){const ie=H0(P,L[q]*j,q<K-1?L[q+1]*j:P.length,j,!1);ie===ie.next&&(ie.steiner=!0),H.push(TI(ie))}H.sort(kI);for(let q=0;q<H.length;q++)F=SI(H[q],F);return F}(r,t,_,s)),r.length>80*s){v=1/0,S=1/0;let P=-1/0,L=-1/0;for(let F=s;F<f;F+=s){const j=r[F],H=r[F+1];j<v&&(v=j),H<S&&(S=H),j>P&&(P=j),H>L&&(L=H)}C=Math.max(P-v,L-S),C=C!==0?32767/C:0}return nh(_,x,s,v,S,C,0),x}function H0(r,t,s,l,f){let _;if(f===function(x,v,S,C){let P=0;for(let L=v,F=S-C;L<S;L+=C)P+=(x[F]-x[L])*(x[L+1]+x[F+1]),F=L;return P}(r,t,s,l)>0)for(let x=t;x<s;x+=l)_=W0(x/l|0,r[x],r[x+1],_);else for(let x=s-l;x>=t;x-=l)_=W0(x/l|0,r[x],r[x+1],_);return _&&ed(_,_.next)&&(sh(_),_=_.next),_}function va(r,t){if(!r)return r;t||(t=r);let s,l=r;do if(s=!1,l.steiner||!ed(l,l.next)&&Ai(l.prev,l,l.next)!==0)l=l.next;else{if(sh(l),l=t=l.prev,l===l.next)break;s=!0}while(s||l!==t);return t}function nh(r,t,s,l,f,_,x){if(!r)return;!x&&_&&function(S,C,P,L){let F=S;do F.z===0&&(F.z=Cf(F.x,F.y,C,P,L)),F.prevZ=F.prev,F.nextZ=F.next,F=F.next;while(F!==S);F.prevZ.nextZ=null,F.prevZ=null,function(j){let H,q=1;do{let K,ie=j;j=null;let ge=null;for(H=0;ie;){H++;let le=ie,fe=0;for(let Pe=0;Pe<q&&(fe++,le=le.nextZ,le);Pe++);let we=q;for(;fe>0||we>0&&le;)fe!==0&&(we===0||!le||ie.z<=le.z)?(K=ie,ie=ie.nextZ,fe--):(K=le,le=le.nextZ,we--),ge?ge.nextZ=K:j=K,K.prevZ=ge,ge=K;ie=le}ge.nextZ=null,q*=2}while(H>1)}(F)}(r,l,f,_);let v=r;for(;r.prev!==r.next;){const S=r.prev,C=r.next;if(_?bI(r,l,f,_):xI(r))t.push(S.i,r.i,C.i),sh(r),r=C.next,v=C.next;else if((r=C)===v){x?x===1?nh(r=vI(va(r),t),t,s,l,f,_,2):x===2&&wI(r,t,s,l,f,_):nh(va(r),t,s,l,f,_,1);break}}}function xI(r){const t=r.prev,s=r,l=r.next;if(Ai(t,s,l)>=0)return!1;const f=t.x,_=s.x,x=l.x,v=t.y,S=s.y,C=l.y,P=f<_?f<x?f:x:_<x?_:x,L=v<S?v<C?v:C:S<C?S:C,F=f>_?f>x?f:x:_>x?_:x,j=v>S?v>C?v:C:S>C?S:C;let H=l.next;for(;H!==t;){if(H.x>=P&&H.x<=F&&H.y>=L&&H.y<=j&&Il(f,v,_,S,x,C,H.x,H.y)&&Ai(H.prev,H,H.next)>=0)return!1;H=H.next}return!0}function bI(r,t,s,l){const f=r.prev,_=r,x=r.next;if(Ai(f,_,x)>=0)return!1;const v=f.x,S=_.x,C=x.x,P=f.y,L=_.y,F=x.y,j=v<S?v<C?v:C:S<C?S:C,H=P<L?P<F?P:F:L<F?L:F,q=v>S?v>C?v:C:S>C?S:C,K=P>L?P>F?P:F:L>F?L:F,ie=Cf(j,H,t,s,l),ge=Cf(q,K,t,s,l);let le=r.prevZ,fe=r.nextZ;for(;le&&le.z>=ie&&fe&&fe.z<=ge;){if(le.x>=j&&le.x<=q&&le.y>=H&&le.y<=K&&le!==f&&le!==x&&Il(v,P,S,L,C,F,le.x,le.y)&&Ai(le.prev,le,le.next)>=0||(le=le.prevZ,fe.x>=j&&fe.x<=q&&fe.y>=H&&fe.y<=K&&fe!==f&&fe!==x&&Il(v,P,S,L,C,F,fe.x,fe.y)&&Ai(fe.prev,fe,fe.next)>=0))return!1;fe=fe.nextZ}for(;le&&le.z>=ie;){if(le.x>=j&&le.x<=q&&le.y>=H&&le.y<=K&&le!==f&&le!==x&&Il(v,P,S,L,C,F,le.x,le.y)&&Ai(le.prev,le,le.next)>=0)return!1;le=le.prevZ}for(;fe&&fe.z<=ge;){if(fe.x>=j&&fe.x<=q&&fe.y>=H&&fe.y<=K&&fe!==f&&fe!==x&&Il(v,P,S,L,C,F,fe.x,fe.y)&&Ai(fe.prev,fe,fe.next)>=0)return!1;fe=fe.nextZ}return!0}function vI(r,t){let s=r;do{const l=s.prev,f=s.next.next;!ed(l,f)&&q0(l,s,s.next,f)&&rh(l,f)&&rh(f,l)&&(t.push(l.i,s.i,f.i),sh(s),sh(s.next),s=r=f),s=s.next}while(s!==r);return va(s)}function wI(r,t,s,l,f,_){let x=r;do{let v=x.next.next;for(;v!==x.prev;){if(x.i!==v.i&&CI(x,v)){let S=Z0(x,v);return x=va(x,x.next),S=va(S,S.next),nh(x,t,s,l,f,_,0),void nh(S,t,s,l,f,_,0)}v=v.next}x=x.next}while(x!==r)}function kI(r,t){return r.x-t.x}function SI(r,t){const s=function(f,_){let x=_;const v=f.x,S=f.y;let C,P=-1/0;do{if(S<=x.y&&S>=x.next.y&&x.next.y!==x.y){const q=x.x+(S-x.y)*(x.next.x-x.x)/(x.next.y-x.y);if(q<=v&&q>P&&(P=q,C=x.x<x.next.x?x:x.next,q===v))return C}x=x.next}while(x!==_);if(!C)return null;const L=C,F=C.x,j=C.y;let H=1/0;x=C;do{if(v>=x.x&&x.x>=F&&v!==x.x&&Il(S<j?v:P,S,F,j,S<j?P:v,S,x.x,x.y)){const q=Math.abs(S-x.y)/(v-x.x);rh(x,f)&&(q<H||q===H&&(x.x>C.x||x.x===C.x&&EI(C,x)))&&(C=x,H=q)}x=x.next}while(x!==L);return C}(r,t);if(!s)return t;const l=Z0(s,r);return va(l,l.next),va(s,s.next)}function EI(r,t){return Ai(r.prev,r,t.prev)<0&&Ai(t.next,r,r.next)<0}function Cf(r,t,s,l,f){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-s)*f|0)|r<<8))|r<<4))|r<<2))|r<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-l)*f|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function TI(r){let t=r,s=r;do(t.x<s.x||t.x===s.x&&t.y<s.y)&&(s=t),t=t.next;while(t!==r);return s}function Il(r,t,s,l,f,_,x,v){return(f-x)*(t-v)>=(r-x)*(_-v)&&(r-x)*(l-v)>=(s-x)*(t-v)&&(s-x)*(_-v)>=(f-x)*(l-v)}function CI(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!function(s,l){let f=s;do{if(f.i!==s.i&&f.next.i!==s.i&&f.i!==l.i&&f.next.i!==l.i&&q0(f,f.next,s,l))return!0;f=f.next}while(f!==s);return!1}(r,t)&&(rh(r,t)&&rh(t,r)&&function(s,l){let f=s,_=!1;const x=(s.x+l.x)/2,v=(s.y+l.y)/2;do f.y>v!=f.next.y>v&&f.next.y!==f.y&&x<(f.next.x-f.x)*(v-f.y)/(f.next.y-f.y)+f.x&&(_=!_),f=f.next;while(f!==s);return _}(r,t)&&(Ai(r.prev,r,t.prev)||Ai(r,t.prev,t))||ed(r,t)&&Ai(r.prev,r,r.next)>0&&Ai(t.prev,t,t.next)>0)}function Ai(r,t,s){return(t.y-r.y)*(s.x-t.x)-(t.x-r.x)*(s.y-t.y)}function ed(r,t){return r.x===t.x&&r.y===t.y}function q0(r,t,s,l){const f=id(Ai(r,t,s)),_=id(Ai(r,t,l)),x=id(Ai(s,l,r)),v=id(Ai(s,l,t));return f!==_&&x!==v||!(f!==0||!td(r,s,t))||!(_!==0||!td(r,l,t))||!(x!==0||!td(s,r,l))||!(v!==0||!td(s,t,l))}function td(r,t,s){return t.x<=Math.max(r.x,s.x)&&t.x>=Math.min(r.x,s.x)&&t.y<=Math.max(r.y,s.y)&&t.y>=Math.min(r.y,s.y)}function id(r){return r>0?1:r<0?-1:0}function rh(r,t){return Ai(r.prev,r,r.next)<0?Ai(r,t,r.next)>=0&&Ai(r,r.prev,t)>=0:Ai(r,t,r.prev)<0||Ai(r,r.next,t)<0}function Z0(r,t){const s=Mf(r.i,r.x,r.y),l=Mf(t.i,t.x,t.y),f=r.next,_=t.prev;return r.next=t,t.prev=r,s.next=f,f.prev=s,l.next=s,s.prev=l,_.next=l,l.prev=_,l}function W0(r,t,s,l){const f=Mf(r,t,s);return l?(f.next=l.next,f.prev=l,l.next.prev=f,l.next=f):(f.prev=f,f.next=f),f}function sh(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 Mf(r,t,s){return{i:r,x:t,y:s,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Pf(r,t,s){const l=s.patternDependencies;let f=!1;for(const _ of t){const x=_.paint.get(`${r}-pattern`);x.isConstant()||(f=!0);const v=x.constantOr(null);v&&(f=!0,l[v.to]=!0,l[v.from]=!0)}return f}function If(r,t,s,l,f){const _=f.patternDependencies;for(const x of t){const v=x.paint.get(`${r}-pattern`).value;if(v.kind!=="constant"){let S=v.evaluate({zoom:l-1},s,{},f.availableImages),C=v.evaluate({zoom:l},s,{},f.availableImages),P=v.evaluate({zoom:l+1},s,{},f.availableImages);S=S&&S.name?S.name:S,C=C&&C.name?C.name:C,P=P&&P.name?P.name:P,_[S]=!0,_[C]=!0,_[P]=!0,s.patterns[x.id]={min:S,mid:C,max:P}}}return s}class Af{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Dr,this.indexArray=new cr,this.indexArray2=new Zi,this.programConfigurations=new _a(t.layers,t.zoom),this.segments=new Ft,this.segments2=new Ft,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(t,s,l){this.hasPattern=Pf("fill",this.layers,s);const f=this.layers[0].layout.get("fill-sort-key"),_=!f.isConstant(),x=[];for(const{feature:v,id:S,index:C,sourceLayerIndex:P}of t){const L=this.layers[0]._featureFilter.needGeometry,F=ba(v,L);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),F,l))continue;const j=_?f.evaluate(F,{},l,s.availableImages):void 0,H={id:S,properties:v.properties,type:v.type,sourceLayerIndex:P,index:C,geometry:L?F.geometry:xa(v),patterns:{},sortKey:j};x.push(H)}_&&x.sort((v,S)=>v.sortKey-S.sortKey);for(const v of x){const{geometry:S,index:C,sourceLayerIndex:P}=v;if(this.hasPattern){const L=If("fill",this.layers,v,this.zoom,s);this.patternFeatures.push(L)}else this.addFeature(v,S,C,l,{});s.featureIndex.insert(t[C].feature,S,C,P,this.index)}}update(t,s,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,s,this.stateDependentLayers,l)}addFeatures(t,s,l){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,s,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,_I),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,s,l,f,_){for(const x of el(s,500)){let v=0;for(const j of x)v+=j.length;const S=this.segments.prepareSegment(v,this.layoutVertexArray,this.indexArray),C=S.vertexLength,P=[],L=[];for(const j of x){if(j.length===0)continue;j!==x[0]&&L.push(P.length/2);const H=this.segments2.prepareSegment(j.length,this.layoutVertexArray,this.indexArray2),q=H.vertexLength;this.layoutVertexArray.emplaceBack(j[0].x,j[0].y),this.indexArray2.emplaceBack(q+j.length-1,q),P.push(j[0].x),P.push(j[0].y);for(let K=1;K<j.length;K++)this.layoutVertexArray.emplaceBack(j[K].x,j[K].y),this.indexArray2.emplaceBack(q+K-1,q+K),P.push(j[K].x),P.push(j[K].y);H.vertexLength+=j.length,H.primitiveLength+=j.length}const F=U0(P,L);for(let j=0;j<F.length;j+=3)this.indexArray.emplaceBack(C+F[j],C+F[j+1],C+F[j+2]);S.vertexLength+=v,S.primitiveLength+=F.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,_,f)}}let G0,Y0;Xe("FillBucket",Af,{omit:["layers","patternFeatures"]});var MI={get paint(){return Y0=Y0||new g({"fill-antialias":new et(xe.paint_fill["fill-antialias"]),"fill-opacity":new dt(xe.paint_fill["fill-opacity"]),"fill-color":new dt(xe.paint_fill["fill-color"]),"fill-outline-color":new dt(xe.paint_fill["fill-outline-color"]),"fill-translate":new et(xe.paint_fill["fill-translate"]),"fill-translate-anchor":new et(xe.paint_fill["fill-translate-anchor"]),"fill-pattern":new bl(xe.paint_fill["fill-pattern"])})},get layout(){return G0=G0||new g({"fill-sort-key":new dt(xe.layout_fill["fill-sort-key"])})}};class PI extends a{constructor(t){super(t,MI)}recalculate(t,s){super.recalculate(t,s);const l=this.paint._values["fill-outline-color"];l.value.kind==="constant"&&l.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Af(t)}queryRadius(){return Ku(this.paint.get("fill-translate"))}queryIntersectsFeature(t,s,l,f,_,x,v){return A0(Ju(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),x.angle,v),f)}isTileClipped(){return!0}}const II=k([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),AI=k([{name:"a_centroid",components:2,type:"Int16"}],4),{members:DI}=II;var Mo={},zI=D,X0=Al;function Al(r,t,s,l,f){this.properties={},this.extent=s,this.type=0,this._pbf=r,this._geometry=-1,this._keys=l,this._values=f,r.readFields(RI,this,t)}function RI(r,t,s){r==1?t.id=s.readVarint():r==2?function(l,f){for(var _=l.readVarint()+l.pos;l.pos<_;){var x=f._keys[l.readVarint()],v=f._values[l.readVarint()];f.properties[x]=v}}(s,t):r==3?t.type=s.readVarint():r==4&&(t._geometry=s.pos)}function LI(r){for(var t,s,l=0,f=0,_=r.length,x=_-1;f<_;x=f++)l+=((s=r[x]).x-(t=r[f]).x)*(t.y+s.y);return l}Al.types=["Unknown","Point","LineString","Polygon"],Al.prototype.loadGeometry=function(){var r=this._pbf;r.pos=this._geometry;for(var t,s=r.readVarint()+r.pos,l=1,f=0,_=0,x=0,v=[];r.pos<s;){if(f<=0){var S=r.readVarint();l=7&S,f=S>>3}if(f--,l===1||l===2)_+=r.readSVarint(),x+=r.readSVarint(),l===1&&(t&&v.push(t),t=[]),t.push(new zI(_,x));else{if(l!==7)throw new Error("unknown command "+l);t&&t.push(t[0].clone())}}return t&&v.push(t),v},Al.prototype.bbox=function(){var r=this._pbf;r.pos=this._geometry;for(var t=r.readVarint()+r.pos,s=1,l=0,f=0,_=0,x=1/0,v=-1/0,S=1/0,C=-1/0;r.pos<t;){if(l<=0){var P=r.readVarint();s=7&P,l=P>>3}if(l--,s===1||s===2)(f+=r.readSVarint())<x&&(x=f),f>v&&(v=f),(_+=r.readSVarint())<S&&(S=_),_>C&&(C=_);else if(s!==7)throw new Error("unknown command "+s)}return[x,S,v,C]},Al.prototype.toGeoJSON=function(r,t,s){var l,f,_=this.extent*Math.pow(2,s),x=this.extent*r,v=this.extent*t,S=this.loadGeometry(),C=Al.types[this.type];function P(j){for(var H=0;H<j.length;H++){var q=j[H];j[H]=[360*(q.x+x)/_-180,360/Math.PI*Math.atan(Math.exp((180-360*(q.y+v)/_)*Math.PI/180))-90]}}switch(this.type){case 1:var L=[];for(l=0;l<S.length;l++)L[l]=S[l][0];P(S=L);break;case 2:for(l=0;l<S.length;l++)P(S[l]);break;case 3:for(S=function(j){var H=j.length;if(H<=1)return[j];for(var q,K,ie=[],ge=0;ge<H;ge++){var le=LI(j[ge]);le!==0&&(K===void 0&&(K=le<0),K===le<0?(q&&ie.push(q),q=[j[ge]]):q.push(j[ge]))}return q&&ie.push(q),ie}(S),l=0;l<S.length;l++)for(f=0;f<S[l].length;f++)P(S[l][f])}S.length===1?S=S[0]:C="Multi"+C;var F={type:"Feature",geometry:{type:C,coordinates:S},properties:this.properties};return"id"in this&&(F.id=this.id),F};var OI=X0,K0=J0;function J0(r,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=r,this._keys=[],this._values=[],this._features=[],r.readFields(BI,this,t),this.length=this._features.length}function BI(r,t,s){r===15?t.version=s.readVarint():r===1?t.name=s.readString():r===5?t.extent=s.readVarint():r===2?t._features.push(s.pos):r===3?t._keys.push(s.readString()):r===4&&t._values.push(function(l){for(var f=null,_=l.readVarint()+l.pos;l.pos<_;){var x=l.readVarint()>>3;f=x===1?l.readString():x===2?l.readFloat():x===3?l.readDouble():x===4?l.readVarint64():x===5?l.readVarint():x===6?l.readSVarint():x===7?l.readBoolean():null}return f}(s))}J0.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 t=this._pbf.readVarint()+this._pbf.pos;return new OI(this._pbf,t,this.extent,this._keys,this._values)};var FI=K0;function NI(r,t,s){if(r===3){var l=new FI(s,s.readVarint()+s.pos);l.length&&(t[l.name]=l)}}Mo.VectorTile=function(r,t){this.layers=r.readFields(NI,{},t)},Mo.VectorTileFeature=X0,Mo.VectorTileLayer=K0;const VI=Mo.VectorTileFeature.types,Df=Math.pow(2,13);function oh(r,t,s,l,f,_,x,v){r.emplaceBack(t,s,2*Math.floor(l*Df)+x,f*Df*2,_*Df*2,Math.round(v))}class zf{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new wo,this.centroidVertexArray=new Ki,this.indexArray=new cr,this.programConfigurations=new _a(t.layers,t.zoom),this.segments=new Ft,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(t,s,l){this.features=[],this.hasPattern=Pf("fill-extrusion",this.layers,s);for(const{feature:f,id:_,index:x,sourceLayerIndex:v}of t){const S=this.layers[0]._featureFilter.needGeometry,C=ba(f,S);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),C,l))continue;const P={id:_,sourceLayerIndex:v,index:x,geometry:S?C.geometry:xa(f),properties:f.properties,type:f.type,patterns:{}};this.hasPattern?this.features.push(If("fill-extrusion",this.layers,P,this.zoom,s)):this.addFeature(P,P.geometry,x,l,{}),s.featureIndex.insert(f,P.geometry,x,v,this.index,!0)}}addFeatures(t,s,l){for(const f of this.features){const{geometry:_}=f;this.addFeature(f,_,f.index,s,l)}}update(t,s,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,s,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,DI),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,AI.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,s,l,f,_){for(const x of el(s,500)){const v={x:0,y:0,vertexCount:0};let S=0;for(const H of x)S+=H.length;let C=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const H of x){if(H.length===0||jI(H))continue;let q=0;for(let K=0;K<H.length;K++){const ie=H[K];if(K>=1){const ge=H[K-1];if(!$I(ie,ge)){C.vertexLength+4>Ft.MAX_VERTEX_ARRAY_LENGTH&&(C=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const le=ie.sub(ge)._perp()._unit(),fe=ge.dist(ie);q+fe>32768&&(q=0),oh(this.layoutVertexArray,ie.x,ie.y,le.x,le.y,0,0,q),oh(this.layoutVertexArray,ie.x,ie.y,le.x,le.y,0,1,q),v.x+=2*ie.x,v.y+=2*ie.y,v.vertexCount+=2,q+=fe,oh(this.layoutVertexArray,ge.x,ge.y,le.x,le.y,0,0,q),oh(this.layoutVertexArray,ge.x,ge.y,le.x,le.y,0,1,q),v.x+=2*ge.x,v.y+=2*ge.y,v.vertexCount+=2;const we=C.vertexLength;this.indexArray.emplaceBack(we,we+2,we+1),this.indexArray.emplaceBack(we+1,we+2,we+3),C.vertexLength+=4,C.primitiveLength+=2}}}}if(C.vertexLength+S>Ft.MAX_VERTEX_ARRAY_LENGTH&&(C=this.segments.prepareSegment(S,this.layoutVertexArray,this.indexArray)),VI[t.type]!=="Polygon")continue;const P=[],L=[],F=C.vertexLength;for(const H of x)if(H.length!==0){H!==x[0]&&L.push(P.length/2);for(let q=0;q<H.length;q++){const K=H[q];oh(this.layoutVertexArray,K.x,K.y,0,0,1,1,0),v.x+=K.x,v.y+=K.y,v.vertexCount+=1,P.push(K.x),P.push(K.y)}}const j=U0(P,L);for(let H=0;H<j.length;H+=3)this.indexArray.emplaceBack(F+j[H],F+j[H+2],F+j[H+1]);C.primitiveLength+=j.length/3,C.vertexLength+=S;for(let H=0;H<v.vertexCount;H++){const q=Math.floor(v.x/v.vertexCount),K=Math.floor(v.y/v.vertexCount);this.centroidVertexArray.emplaceBack(q,K)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,_,f)}}function $I(r,t){return r.x===t.x&&(r.x<0||r.x>Ri)||r.y===t.y&&(r.y<0||r.y>Ri)}function jI(r){return r.every(t=>t.x<0)||r.every(t=>t.x>Ri)||r.every(t=>t.y<0)||r.every(t=>t.y>Ri)}let Q0;Xe("FillExtrusionBucket",zf,{omit:["layers","features"]});var UI={get paint(){return Q0=Q0||new g({"fill-extrusion-opacity":new et(xe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new dt(xe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new et(xe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new et(xe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new bl(xe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new dt(xe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new dt(xe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new et(xe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class HI extends a{constructor(t){super(t,UI)}createBucket(t){return new zf(t)}queryRadius(){return Ku(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,s,l,f,_,x,v,S){const C=Ju(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,v),P=this.paint.get("fill-extrusion-height").evaluate(s,l),L=this.paint.get("fill-extrusion-base").evaluate(s,l),F=function(H,q,K,ie){const ge=[];for(const le of H){const fe=[le.x,le.y,0,1];Qu(fe,fe,q),ge.push(new R(fe[0]/fe[3],fe[1]/fe[3]))}return ge}(C,S),j=function(H,q,K,ie){const ge=[],le=[],fe=ie[8]*q,we=ie[9]*q,Pe=ie[10]*q,qe=ie[11]*q,ut=ie[8]*K,je=ie[9]*K,Ve=ie[10]*K,nt=ie[11]*K;for(const Ke of H){const Ge=[],Te=[];for(const at of Ke){const it=at.x,_t=at.y,ci=ie[0]*it+ie[4]*_t+ie[12],ai=ie[1]*it+ie[5]*_t+ie[13],Ni=ie[2]*it+ie[6]*_t+ie[14],zr=ie[3]*it+ie[7]*_t+ie[15],en=Ni+Pe,Vi=zr+qe,xn=ci+ut,bn=ai+je,vn=Ni+Ve,Pi=zr+nt,$i=new R((ci+fe)/Vi,(ai+we)/Vi);$i.z=en/Vi,Ge.push($i);const hn=new R(xn/Pi,bn/Pi);hn.z=vn/Pi,Te.push(hn)}ge.push(Ge),le.push(Te)}return[ge,le]}(f,L,P,S);return function(H,q,K){let ie=1/0;A0(K,q)&&(ie=e_(K,q[0]));for(let ge=0;ge<q.length;ge++){const le=q[ge],fe=H[ge];for(let we=0;we<le.length-1;we++){const Pe=le[we],qe=[Pe,le[we+1],fe[we+1],fe[we],Pe];I0(K,qe)&&(ie=Math.min(ie,e_(K,qe)))}}return ie!==1/0&&ie}(j[0],j[1],F)}}function ah(r,t){return r.x*t.x+r.y*t.y}function e_(r,t){if(r.length===1){let s=0;const l=t[s++];let f;for(;!f||l.equals(f);)if(f=t[s++],!f)return 1/0;for(;s<t.length;s++){const _=t[s],x=r[0],v=f.sub(l),S=_.sub(l),C=x.sub(l),P=ah(v,v),L=ah(v,S),F=ah(S,S),j=ah(C,v),H=ah(C,S),q=P*F-L*L,K=(F*j-L*H)/q,ie=(P*H-L*j)/q,ge=l.z*(1-K-ie)+f.z*K+_.z*ie;if(isFinite(ge))return ge}return 1/0}{let s=1/0;for(const l of t)s=Math.min(s,l.z);return s}}const qI=k([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ZI}=qI,WI=k([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:GI}=WI,YI=Mo.VectorTileFeature.types,XI=Math.cos(Math.PI/180*37.5),t_=Math.pow(2,14)/.5;class Rf{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(s=>{this.gradients[s.id]={}}),this.layoutVertexArray=new wl,this.layoutVertexArray2=new ko,this.indexArray=new cr,this.programConfigurations=new _a(t.layers,t.zoom),this.segments=new Ft,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(t,s,l){this.hasPattern=Pf("line",this.layers,s);const f=this.layers[0].layout.get("line-sort-key"),_=!f.isConstant(),x=[];for(const{feature:v,id:S,index:C,sourceLayerIndex:P}of t){const L=this.layers[0]._featureFilter.needGeometry,F=ba(v,L);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),F,l))continue;const j=_?f.evaluate(F,{},l):void 0,H={id:S,properties:v.properties,type:v.type,sourceLayerIndex:P,index:C,geometry:L?F.geometry:xa(v),patterns:{},sortKey:j};x.push(H)}_&&x.sort((v,S)=>v.sortKey-S.sortKey);for(const v of x){const{geometry:S,index:C,sourceLayerIndex:P}=v;if(this.hasPattern){const L=If("line",this.layers,v,this.zoom,s);this.patternFeatures.push(L)}else this.addFeature(v,S,C,l,{});s.featureIndex.insert(t[C].feature,S,C,P,this.index)}}update(t,s,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,s,this.stateDependentLayers,l)}addFeatures(t,s,l){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,s,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,GI)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ZI),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,s,l,f,_){const x=this.layers[0].layout,v=x.get("line-join").evaluate(t,{}),S=x.get("line-cap"),C=x.get("line-miter-limit"),P=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const L of s)this.addLine(L,t,v,S,C,P);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,_,f)}addLine(t,s,l,f,_,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ie=0;ie<t.length-1;ie++)this.totalDistance+=t[ie].dist(t[ie+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const v=YI[s.type]==="Polygon";let S=t.length;for(;S>=2&&t[S-1].equals(t[S-2]);)S--;let C=0;for(;C<S-1&&t[C].equals(t[C+1]);)C++;if(S<(v?3:2))return;l==="bevel"&&(_=1.05);const P=this.overscaling<=16?15*Ri/(512*this.overscaling):0,L=this.segments.prepareSegment(10*S,this.layoutVertexArray,this.indexArray);let F,j,H,q,K;this.e1=this.e2=-1,v&&(F=t[S-2],K=t[C].sub(F)._unit()._perp());for(let ie=C;ie<S;ie++){if(H=ie===S-1?v?t[C+1]:void 0:t[ie+1],H&&t[ie].equals(H))continue;K&&(q=K),F&&(j=F),F=t[ie],K=H?H.sub(F)._unit()._perp():q,q=q||K;let ge=q.add(K);ge.x===0&&ge.y===0||ge._unit();const le=q.x*K.x+q.y*K.y,fe=ge.x*K.x+ge.y*K.y,we=fe!==0?1/fe:1/0,Pe=2*Math.sqrt(2-2*fe),qe=fe<XI&&j&&H,ut=q.x*K.y-q.y*K.x>0;if(qe&&ie>C){const nt=F.dist(j);if(nt>2*P){const Ke=F.sub(F.sub(j)._mult(P/nt)._round());this.updateDistance(j,Ke),this.addCurrentVertex(Ke,q,0,0,L),j=Ke}}const je=j&&H;let Ve=je?l:v?"butt":f;if(je&&Ve==="round"&&(we<x?Ve="miter":we<=2&&(Ve="fakeround")),Ve==="miter"&&we>_&&(Ve="bevel"),Ve==="bevel"&&(we>2&&(Ve="flipbevel"),we<_&&(Ve="miter")),j&&this.updateDistance(j,F),Ve==="miter")ge._mult(we),this.addCurrentVertex(F,ge,0,0,L);else if(Ve==="flipbevel"){if(we>100)ge=K.mult(-1);else{const nt=we*q.add(K).mag()/q.sub(K).mag();ge._perp()._mult(nt*(ut?-1:1))}this.addCurrentVertex(F,ge,0,0,L),this.addCurrentVertex(F,ge.mult(-1),0,0,L)}else if(Ve==="bevel"||Ve==="fakeround"){const nt=-Math.sqrt(we*we-1),Ke=ut?nt:0,Ge=ut?0:nt;if(j&&this.addCurrentVertex(F,q,Ke,Ge,L),Ve==="fakeround"){const Te=Math.round(180*Pe/Math.PI/20);for(let at=1;at<Te;at++){let it=at/Te;if(it!==.5){const ci=it-.5;it+=it*ci*(it-1)*((1.0904+le*(le*(3.55645-1.43519*le)-3.2452))*ci*ci+(.848013+le*(.215638*le-1.06021)))}const _t=K.sub(q)._mult(it)._add(q)._unit()._mult(ut?-1:1);this.addHalfVertex(F,_t.x,_t.y,!1,ut,0,L)}}H&&this.addCurrentVertex(F,K,-Ke,-Ge,L)}else if(Ve==="butt")this.addCurrentVertex(F,ge,0,0,L);else if(Ve==="square"){const nt=j?1:-1;this.addCurrentVertex(F,ge,nt,nt,L)}else Ve==="round"&&(j&&(this.addCurrentVertex(F,q,0,0,L),this.addCurrentVertex(F,q,1,1,L,!0)),H&&(this.addCurrentVertex(F,K,-1,-1,L,!0),this.addCurrentVertex(F,K,0,0,L)));if(qe&&ie<S-1){const nt=F.dist(H);if(nt>2*P){const Ke=F.add(H.sub(F)._mult(P/nt)._round());this.updateDistance(F,Ke),this.addCurrentVertex(Ke,K,0,0,L),F=Ke}}}}addCurrentVertex(t,s,l,f,_,x=!1){const v=s.y*f-s.x,S=-s.y-s.x*f;this.addHalfVertex(t,s.x+s.y*l,s.y-s.x*l,x,!1,l,_),this.addHalfVertex(t,v,S,x,!0,-f,_),this.distance>t_/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,s,l,f,_,x))}addHalfVertex({x:t,y:s},l,f,_,x,v,S){const C=.5*(this.lineClips?this.scaledDistance*(t_-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(_?1:0),(s<<1)+(x?1:0),Math.round(63*l)+128,Math.round(63*f)+128,1+(v===0?0:v<0?-1:1)|(63&C)<<2,C>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const P=S.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,P),S.primitiveLength++),x?this.e2=P:this.e1=P}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,s){this.distance+=t.dist(s),this.updateScaledDistance()}}let i_,n_;Xe("LineBucket",Rf,{omit:["layers","patternFeatures"]});var r_={get paint(){return n_=n_||new g({"line-opacity":new dt(xe.paint_line["line-opacity"]),"line-color":new dt(xe.paint_line["line-color"]),"line-translate":new et(xe.paint_line["line-translate"]),"line-translate-anchor":new et(xe.paint_line["line-translate-anchor"]),"line-width":new dt(xe.paint_line["line-width"]),"line-gap-width":new dt(xe.paint_line["line-gap-width"]),"line-offset":new dt(xe.paint_line["line-offset"]),"line-blur":new dt(xe.paint_line["line-blur"]),"line-dasharray":new vl(xe.paint_line["line-dasharray"]),"line-pattern":new bl(xe.paint_line["line-pattern"]),"line-gradient":new Kc(xe.paint_line["line-gradient"])})},get layout(){return i_=i_||new g({"line-cap":new et(xe.layout_line["line-cap"]),"line-join":new dt(xe.layout_line["line-join"]),"line-miter-limit":new et(xe.layout_line["line-miter-limit"]),"line-round-limit":new et(xe.layout_line["line-round-limit"]),"line-sort-key":new dt(xe.layout_line["line-sort-key"])})}};class KI extends dt{possiblyEvaluate(t,s){return s=new fi(Math.floor(s.zoom),{now:s.now,fadeDuration:s.fadeDuration,zoomHistory:s.zoomHistory,transition:s.transition}),super.possiblyEvaluate(t,s)}evaluate(t,s,l,f){return s=Be({},s,{zoom:Math.floor(s.zoom)}),super.evaluate(t,s,l,f)}}let nd;class JI extends a{constructor(t){super(t,r_),this.gradientVersion=0,nd||(nd=new KI(r_.paint.properties["line-width"].specification),nd.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const s=this.gradientExpression();this.stepInterpolant=!!function(l){return l._styleExpression!==void 0}(s)&&s._styleExpression.expression instanceof io,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,s){super.recalculate(t,s),this.paint._values["line-floorwidth"]=nd.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Rf(t)}queryRadius(t){const s=t,l=s_(eh("line-width",this,s),eh("line-gap-width",this,s)),f=eh("line-offset",this,s);return l/2+Math.abs(f)+Ku(this.paint.get("line-translate"))}queryIntersectsFeature(t,s,l,f,_,x,v){const S=Ju(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,v),C=v/2*s_(this.paint.get("line-width").evaluate(s,l),this.paint.get("line-gap-width").evaluate(s,l)),P=this.paint.get("line-offset").evaluate(s,l);return P&&(f=function(L,F){const j=[];for(let H=0;H<L.length;H++){const q=L[H],K=[];for(let ie=0;ie<q.length;ie++){const ge=q[ie-1],le=q[ie],fe=q[ie+1],we=ie===0?new R(0,0):le.sub(ge)._unit()._perp(),Pe=ie===q.length-1?new R(0,0):fe.sub(le)._unit()._perp(),qe=we._add(Pe)._unit(),ut=qe.x*Pe.x+qe.y*Pe.y;ut!==0&&qe._mult(1/ut),K.push(qe._mult(F)._add(le))}j.push(K)}return j}(f,P*v)),function(L,F,j){for(let H=0;H<F.length;H++){const q=F[H];if(L.length>=3){for(let K=0;K<q.length;K++)if(Ml(L,q[K]))return!0}if(aI(L,q,j))return!0}return!1}(S,f,C)}isTileClipped(){return!0}}function s_(r,t){return t>0?t+2*r:r}const QI=k([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),eA=k([{name:"a_projected_pos",components:3,type:"Float32"}],4);k([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const tA=k([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);k([{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 o_=k([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),iA=k([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function nA(r,t,s){return r.sections.forEach(l=>{l.text=function(f,_,x){const v=_.layout.get("text-transform").evaluate(x,{});return v==="uppercase"?f=f.toLocaleUpperCase():v==="lowercase"&&(f=f.toLocaleLowerCase()),Dn.applyArabicShaping&&(f=Dn.applyArabicShaping(f)),f}(l.text,t,s)}),r}k([{name:"triangle",components:3,type:"Uint16"}]),k([{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"}]),k([{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"}]),k([{type:"Float32",name:"offsetX"}]),k([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),k([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const lh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Oi=24,a_=oi,l_=function(r,t,s,l,f){var _,x,v=8*f-l-1,S=(1<<v)-1,C=S>>1,P=-7,L=f-1,F=-1,j=r[t+L];for(L+=F,_=j&(1<<-P)-1,j>>=-P,P+=v;P>0;_=256*_+r[t+L],L+=F,P-=8);for(x=_&(1<<-P)-1,_>>=-P,P+=l;P>0;x=256*x+r[t+L],L+=F,P-=8);if(_===0)_=1-C;else{if(_===S)return x?NaN:1/0*(j?-1:1);x+=Math.pow(2,l),_-=C}return(j?-1:1)*x*Math.pow(2,_-l)},c_=function(r,t,s,l,f,_){var x,v,S,C=8*_-f-1,P=(1<<C)-1,L=P>>1,F=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,j=0,H=1,q=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(v=isNaN(t)?1:0,x=P):(x=Math.floor(Math.log(t)/Math.LN2),t*(S=Math.pow(2,-x))<1&&(x--,S*=2),(t+=x+L>=1?F/S:F*Math.pow(2,1-L))*S>=2&&(x++,S/=2),x+L>=P?(v=0,x=P):x+L>=1?(v=(t*S-1)*Math.pow(2,f),x+=L):(v=t*Math.pow(2,L-1)*Math.pow(2,f),x=0));f>=8;r[s+j]=255&v,j+=H,v/=256,f-=8);for(x=x<<f|v,C+=f;C>0;r[s+j]=255&x,j+=H,x/=256,C-=8);r[s+j-H]|=128*q};function oi(r){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(r)?r:new Uint8Array(r||0),this.pos=0,this.type=0,this.length=this.buf.length}oi.Varint=0,oi.Fixed64=1,oi.Bytes=2,oi.Fixed32=5;var Lf=4294967296,h_=1/Lf,u_=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function $s(r){return r.type===oi.Bytes?r.readVarint()+r.pos:r.pos+1}function Dl(r,t,s){return s?4294967296*t+(r>>>0):4294967296*(t>>>0)+(r>>>0)}function d_(r,t,s){var l=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));s.realloc(l);for(var f=s.pos-1;f>=r;f--)s.buf[f+l]=s.buf[f]}function rA(r,t){for(var s=0;s<r.length;s++)t.writeVarint(r[s])}function sA(r,t){for(var s=0;s<r.length;s++)t.writeSVarint(r[s])}function oA(r,t){for(var s=0;s<r.length;s++)t.writeFloat(r[s])}function aA(r,t){for(var s=0;s<r.length;s++)t.writeDouble(r[s])}function lA(r,t){for(var s=0;s<r.length;s++)t.writeBoolean(r[s])}function cA(r,t){for(var s=0;s<r.length;s++)t.writeFixed32(r[s])}function hA(r,t){for(var s=0;s<r.length;s++)t.writeSFixed32(r[s])}function uA(r,t){for(var s=0;s<r.length;s++)t.writeFixed64(r[s])}function dA(r,t){for(var s=0;s<r.length;s++)t.writeSFixed64(r[s])}function rd(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16)+16777216*r[t+3]}function zl(r,t,s){r[s]=t,r[s+1]=t>>>8,r[s+2]=t>>>16,r[s+3]=t>>>24}function p_(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16)+(r[t+3]<<24)}oi.prototype={destroy:function(){this.buf=null},readFields:function(r,t,s){for(s=s||this.length;this.pos<s;){var l=this.readVarint(),f=l>>3,_=this.pos;this.type=7&l,r(f,t,this),this.pos===_&&this.skip(l)}return t},readMessage:function(r,t){return this.readFields(r,t,this.readVarint()+this.pos)},readFixed32:function(){var r=rd(this.buf,this.pos);return this.pos+=4,r},readSFixed32:function(){var r=p_(this.buf,this.pos);return this.pos+=4,r},readFixed64:function(){var r=rd(this.buf,this.pos)+rd(this.buf,this.pos+4)*Lf;return this.pos+=8,r},readSFixed64:function(){var r=rd(this.buf,this.pos)+p_(this.buf,this.pos+4)*Lf;return this.pos+=8,r},readFloat:function(){var r=l_(this.buf,this.pos,!0,23,4);return this.pos+=4,r},readDouble:function(){var r=l_(this.buf,this.pos,!0,52,8);return this.pos+=8,r},readVarint:function(r){var t,s,l=this.buf;return t=127&(s=l[this.pos++]),s<128?t:(t|=(127&(s=l[this.pos++]))<<7,s<128?t:(t|=(127&(s=l[this.pos++]))<<14,s<128?t:(t|=(127&(s=l[this.pos++]))<<21,s<128?t:function(f,_,x){var v,S,C=x.buf;if(v=(112&(S=C[x.pos++]))>>4,S<128||(v|=(127&(S=C[x.pos++]))<<3,S<128)||(v|=(127&(S=C[x.pos++]))<<10,S<128)||(v|=(127&(S=C[x.pos++]))<<17,S<128)||(v|=(127&(S=C[x.pos++]))<<24,S<128)||(v|=(1&(S=C[x.pos++]))<<31,S<128))return Dl(f,v,_);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(s=l[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,t=this.pos;return this.pos=r,r-t>=12&&u_?function(s,l,f){return u_.decode(s.subarray(l,f))}(this.buf,t,r):function(s,l,f){for(var _="",x=l;x<f;){var v,S,C,P=s[x],L=null,F=P>239?4:P>223?3:P>191?2:1;if(x+F>f)break;F===1?P<128&&(L=P):F===2?(192&(v=s[x+1]))==128&&(L=(31&P)<<6|63&v)<=127&&(L=null):F===3?(S=s[x+2],(192&(v=s[x+1]))==128&&(192&S)==128&&((L=(15&P)<<12|(63&v)<<6|63&S)<=2047||L>=55296&&L<=57343)&&(L=null)):F===4&&(S=s[x+2],C=s[x+3],(192&(v=s[x+1]))==128&&(192&S)==128&&(192&C)==128&&((L=(15&P)<<18|(63&v)<<12|(63&S)<<6|63&C)<=65535||L>=1114112)&&(L=null)),L===null?(L=65533,F=1):L>65535&&(L-=65536,_+=String.fromCharCode(L>>>10&1023|55296),L=56320|1023&L),_+=String.fromCharCode(L),x+=F}return _}(this.buf,t,r)},readBytes:function(){var r=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,r);return this.pos=r,t},readPackedVarint:function(r,t){if(this.type!==oi.Bytes)return r.push(this.readVarint(t));var s=$s(this);for(r=r||[];this.pos<s;)r.push(this.readVarint(t));return r},readPackedSVarint:function(r){if(this.type!==oi.Bytes)return r.push(this.readSVarint());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readSVarint());return r},readPackedBoolean:function(r){if(this.type!==oi.Bytes)return r.push(this.readBoolean());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readBoolean());return r},readPackedFloat:function(r){if(this.type!==oi.Bytes)return r.push(this.readFloat());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readFloat());return r},readPackedDouble:function(r){if(this.type!==oi.Bytes)return r.push(this.readDouble());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readDouble());return r},readPackedFixed32:function(r){if(this.type!==oi.Bytes)return r.push(this.readFixed32());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readFixed32());return r},readPackedSFixed32:function(r){if(this.type!==oi.Bytes)return r.push(this.readSFixed32());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readSFixed32());return r},readPackedFixed64:function(r){if(this.type!==oi.Bytes)return r.push(this.readFixed64());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readFixed64());return r},readPackedSFixed64:function(r){if(this.type!==oi.Bytes)return r.push(this.readSFixed64());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readSFixed64());return r},skip:function(r){var t=7&r;if(t===oi.Varint)for(;this.buf[this.pos++]>127;);else if(t===oi.Bytes)this.pos=this.readVarint()+this.pos;else if(t===oi.Fixed32)this.pos+=4;else{if(t!==oi.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(r,t){this.writeVarint(r<<3|t)},realloc:function(r){for(var t=this.length||16;t<this.pos+r;)t*=2;if(t!==this.length){var s=new Uint8Array(t);s.set(this.buf),this.buf=s,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(r){this.realloc(4),zl(this.buf,r,this.pos),this.pos+=4},writeSFixed32:function(r){this.realloc(4),zl(this.buf,r,this.pos),this.pos+=4},writeFixed64:function(r){this.realloc(8),zl(this.buf,-1&r,this.pos),zl(this.buf,Math.floor(r*h_),this.pos+4),this.pos+=8},writeSFixed64:function(r){this.realloc(8),zl(this.buf,-1&r,this.pos),zl(this.buf,Math.floor(r*h_),this.pos+4),this.pos+=8},writeVarint:function(r){(r=+r||0)>268435455||r<0?function(t,s){var l,f;if(t>=0?(l=t%4294967296|0,f=t/4294967296|0):(f=~(-t/4294967296),4294967295^(l=~(-t%4294967296))?l=l+1|0:(l=0,f=f+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),function(_,x,v){v.buf[v.pos++]=127&_|128,_>>>=7,v.buf[v.pos++]=127&_|128,_>>>=7,v.buf[v.pos++]=127&_|128,_>>>=7,v.buf[v.pos++]=127&_|128,v.buf[v.pos]=127&(_>>>=7)}(l,0,s),function(_,x){var v=(7&_)<<4;x.buf[x.pos++]|=v|((_>>>=3)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_)))))}(f,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 t=this.pos;this.pos=function(l,f,_){for(var x,v,S=0;S<f.length;S++){if((x=f.charCodeAt(S))>55295&&x<57344){if(!v){x>56319||S+1===f.length?(l[_++]=239,l[_++]=191,l[_++]=189):v=x;continue}if(x<56320){l[_++]=239,l[_++]=191,l[_++]=189,v=x;continue}x=v-55296<<10|x-56320|65536,v=null}else v&&(l[_++]=239,l[_++]=191,l[_++]=189,v=null);x<128?l[_++]=x:(x<2048?l[_++]=x>>6|192:(x<65536?l[_++]=x>>12|224:(l[_++]=x>>18|240,l[_++]=x>>12&63|128),l[_++]=x>>6&63|128),l[_++]=63&x|128)}return _}(this.buf,r,this.pos);var s=this.pos-t;s>=128&&d_(t,s,this),this.pos=t-1,this.writeVarint(s),this.pos+=s},writeFloat:function(r){this.realloc(4),c_(this.buf,r,this.pos,!0,23,4),this.pos+=4},writeDouble:function(r){this.realloc(8),c_(this.buf,r,this.pos,!0,52,8),this.pos+=8},writeBytes:function(r){var t=r.length;this.writeVarint(t),this.realloc(t);for(var s=0;s<t;s++)this.buf[this.pos++]=r[s]},writeRawMessage:function(r,t){this.pos++;var s=this.pos;r(t,this);var l=this.pos-s;l>=128&&d_(s,l,this),this.pos=s-1,this.writeVarint(l),this.pos+=l},writeMessage:function(r,t,s){this.writeTag(r,oi.Bytes),this.writeRawMessage(t,s)},writePackedVarint:function(r,t){t.length&&this.writeMessage(r,rA,t)},writePackedSVarint:function(r,t){t.length&&this.writeMessage(r,sA,t)},writePackedBoolean:function(r,t){t.length&&this.writeMessage(r,lA,t)},writePackedFloat:function(r,t){t.length&&this.writeMessage(r,oA,t)},writePackedDouble:function(r,t){t.length&&this.writeMessage(r,aA,t)},writePackedFixed32:function(r,t){t.length&&this.writeMessage(r,cA,t)},writePackedSFixed32:function(r,t){t.length&&this.writeMessage(r,hA,t)},writePackedFixed64:function(r,t){t.length&&this.writeMessage(r,uA,t)},writePackedSFixed64:function(r,t){t.length&&this.writeMessage(r,dA,t)},writeBytesField:function(r,t){this.writeTag(r,oi.Bytes),this.writeBytes(t)},writeFixed32Field:function(r,t){this.writeTag(r,oi.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(r,t){this.writeTag(r,oi.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(r,t){this.writeTag(r,oi.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(r,t){this.writeTag(r,oi.Fixed64),this.writeSFixed64(t)},writeVarintField:function(r,t){this.writeTag(r,oi.Varint),this.writeVarint(t)},writeSVarintField:function(r,t){this.writeTag(r,oi.Varint),this.writeSVarint(t)},writeStringField:function(r,t){this.writeTag(r,oi.Bytes),this.writeString(t)},writeFloatField:function(r,t){this.writeTag(r,oi.Fixed32),this.writeFloat(t)},writeDoubleField:function(r,t){this.writeTag(r,oi.Fixed64),this.writeDouble(t)},writeBooleanField:function(r,t){this.writeVarintField(r,!!t)}};var Of=M(a_);const Bf=3;function pA(r,t,s){r===1&&s.readMessage(fA,t)}function fA(r,t,s){if(r===3){const{id:l,bitmap:f,width:_,height:x,left:v,top:S,advance:C}=s.readMessage(mA,{});t.push({id:l,bitmap:new ih({width:_+2*Bf,height:x+2*Bf},f),metrics:{width:_,height:x,left:v,top:S,advance:C}})}}function mA(r,t,s){r===1?t.id=s.readVarint():r===2?t.bitmap=s.readBytes():r===3?t.width=s.readVarint():r===4?t.height=s.readVarint():r===5?t.left=s.readSVarint():r===6?t.top=s.readSVarint():r===7&&(t.advance=s.readVarint())}const f_=Bf;function m_(r){let t=0,s=0;for(const x of r)t+=x.w*x.h,s=Math.max(s,x.w);r.sort((x,v)=>v.h-x.h);const l=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),s),h:1/0}];let f=0,_=0;for(const x of r)for(let v=l.length-1;v>=0;v--){const S=l[v];if(!(x.w>S.w||x.h>S.h)){if(x.x=S.x,x.y=S.y,_=Math.max(_,x.y+x.h),f=Math.max(f,x.x+x.w),x.w===S.w&&x.h===S.h){const C=l.pop();v<l.length&&(l[v]=C)}else x.h===S.h?(S.x+=x.w,S.w-=x.w):x.w===S.w?(S.y+=x.h,S.h-=x.h):(l.push({x:S.x+x.w,y:S.y,w:S.w-x.w,h:x.h}),S.y+=x.h,S.h-=x.h);break}}return{w:f,h:_,fill:t/(f*_)||0}}const Rn=1;class Ff{constructor(t,{pixelRatio:s,version:l,stretchX:f,stretchY:_,content:x,textFitWidth:v,textFitHeight:S}){this.paddedRect=t,this.pixelRatio=s,this.stretchX=f,this.stretchY=_,this.content=x,this.version=l,this.textFitWidth=v,this.textFitHeight=S}get tl(){return[this.paddedRect.x+Rn,this.paddedRect.y+Rn]}get br(){return[this.paddedRect.x+this.paddedRect.w-Rn,this.paddedRect.y+this.paddedRect.h-Rn]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Rn)/this.pixelRatio,(this.paddedRect.h-2*Rn)/this.pixelRatio]}}class g_{constructor(t,s){const l={},f={};this.haveRenderCallbacks=[];const _=[];this.addImages(t,l,_),this.addImages(s,f,_);const{w:x,h:v}=m_(_),S=new hr({width:x||1,height:v||1});for(const C in t){const P=t[C],L=l[C].paddedRect;hr.copy(P.data,S,{x:0,y:0},{x:L.x+Rn,y:L.y+Rn},P.data)}for(const C in s){const P=s[C],L=f[C].paddedRect,F=L.x+Rn,j=L.y+Rn,H=P.data.width,q=P.data.height;hr.copy(P.data,S,{x:0,y:0},{x:F,y:j},P.data),hr.copy(P.data,S,{x:0,y:q-1},{x:F,y:j-1},{width:H,height:1}),hr.copy(P.data,S,{x:0,y:0},{x:F,y:j+q},{width:H,height:1}),hr.copy(P.data,S,{x:H-1,y:0},{x:F-1,y:j},{width:1,height:q}),hr.copy(P.data,S,{x:0,y:0},{x:F+H,y:j},{width:1,height:q})}this.image=S,this.iconPositions=l,this.patternPositions=f}addImages(t,s,l){for(const f in t){const _=t[f],x={x:0,y:0,w:_.data.width+2*Rn,h:_.data.height+2*Rn};l.push(x),s[f]=new Ff(x,_),_.hasRenderCallback&&this.haveRenderCallbacks.push(f)}}patchUpdatedImages(t,s){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const l in t.updatedImages)this.patchUpdatedImage(this.iconPositions[l],t.getImage(l),s),this.patchUpdatedImage(this.patternPositions[l],t.getImage(l),s)}patchUpdatedImage(t,s,l){if(!t||!s||t.version===s.version)return;t.version=s.version;const[f,_]=t.tl;l.update(s.data,void 0,{x:f,y:_})}}var Po;Xe("ImagePosition",Ff),Xe("ImageAtlas",g_),y.ah=void 0,(Po=y.ah||(y.ah={}))[Po.none=0]="none",Po[Po.horizontal=1]="horizontal",Po[Po.vertical=2]="vertical",Po[Po.horizontalOnly=3]="horizontalOnly";const ch=-17;class hh{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,s){const l=new hh;return l.scale=t||1,l.fontStack=s,l}static forImage(t){const s=new hh;return s.imageName=t,s}}class Rl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,s){const l=new Rl;for(let f=0;f<t.sections.length;f++){const _=t.sections[f];_.image?l.addImageSection(_):l.addTextSection(_,s)}return l}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let s="";for(let l=0;l<t.length;l++){const f=t.charCodeAt(l+1)||null,_=t.charCodeAt(l-1)||null;s+=f&&Hu(f)&&!lh[t[l+1]]||_&&Hu(_)&&!lh[t[l-1]]||!lh[t[l]]?t[l]:lh[t[l]]}return s}(this.text)}trim(){let t=0;for(let l=0;l<this.text.length&&od[this.text.charCodeAt(l)];l++)t++;let s=this.text.length;for(let l=this.text.length-1;l>=0&&l>=t&&od[this.text.charCodeAt(l)];l--)s--;this.text=this.text.substring(t,s),this.sectionIndex=this.sectionIndex.slice(t,s)}substring(t,s){const l=new Rl;return l.text=this.text.substring(t,s),l.sectionIndex=this.sectionIndex.slice(t,s),l.sections=this.sections,l}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,s)=>Math.max(t,this.sections[s].scale),0)}addTextSection(t,s){this.text+=t.text,this.sections.push(hh.forText(t.scale,t.fontStack||s));const l=this.sections.length-1;for(let f=0;f<t.text.length;++f)this.sectionIndex.push(l)}addImageSection(t){const s=t.image?t.image.name:"";if(s.length===0)return void Rt("Can't add FormattedSection with an empty image.");const l=this.getNextImageSectionCharCode();l?(this.text+=String.fromCharCode(l),this.sections.push(hh.forImage(s)),this.sectionIndex.push(this.sections.length-1)):Rt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function sd(r,t,s,l,f,_,x,v,S,C,P,L,F,j,H){const q=Rl.fromFeature(r,f);let K;L===y.ah.vertical&&q.verticalizePunctuation();const{processBidirectionalText:ie,processStyledBidirectionalText:ge}=Dn;if(ie&&q.sections.length===1){K=[];const we=ie(q.toString(),Nf(q,C,_,t,l,j));for(const Pe of we){const qe=new Rl;qe.text=Pe,qe.sections=q.sections;for(let ut=0;ut<Pe.length;ut++)qe.sectionIndex.push(0);K.push(qe)}}else if(ge){K=[];const we=ge(q.text,q.sectionIndex,Nf(q,C,_,t,l,j));for(const Pe of we){const qe=new Rl;qe.text=Pe[0],qe.sectionIndex=Pe[1],qe.sections=q.sections,K.push(qe)}}else K=function(we,Pe){const qe=[],ut=we.text;let je=0;for(const Ve of Pe)qe.push(we.substring(je,Ve)),je=Ve;return je<ut.length&&qe.push(we.substring(je,ut.length)),qe}(q,Nf(q,C,_,t,l,j));const le=[],fe={positionedLines:le,text:q.toString(),top:P[1],bottom:P[1],left:P[0],right:P[0],writingMode:L,iconsInText:!1,verticalizable:!1};return function(we,Pe,qe,ut,je,Ve,nt,Ke,Ge,Te,at,it){let _t=0,ci=ch,ai=0,Ni=0;const zr=Ke==="right"?1:Ke==="left"?0:.5;let en=0;for(const Pi of je){Pi.trim();const $i=Pi.getMaxScale(),hn=($i-1)*Oi,tn={positionedGlyphs:[],lineOffset:0};we.positionedLines[en]=tn;const wn=tn.positionedGlyphs;let nn=0;if(!Pi.length()){ci+=Ve,++en;continue}for(let Ln=0;Ln<Pi.length();Ln++){const qt=Pi.getSection(Ln),ui=Pi.getSectionIndex(Ln),_i=Pi.getCharCode(Ln);let Kn=0,Ei=null,Fl=null,hs=null,us=Oi;const Rr=!(Ge===y.ah.horizontal||!at&&!Yc(_i)||at&&(od[_i]||(Vi=_i,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(Vi)))));if(qt.imageName){const pr=ut[qt.imageName];if(!pr)continue;hs=qt.imageName,we.iconsInText=we.iconsInText||!0,Fl=pr.paddedRect;const Wi=pr.displaySize;qt.scale=qt.scale*Oi/it,Ei={width:Wi[0],height:Wi[1],left:Rn,top:-f_,advance:Rr?Wi[1]:Wi[0]},Kn=hn+(Oi-Wi[1]*qt.scale),us=Ei.advance;const js=Rr?Wi[0]*qt.scale-Oi*$i:Wi[1]*qt.scale-Oi*$i;js>0&&js>nn&&(nn=js)}else{const pr=qe[qt.fontStack],Wi=pr&&pr[_i];if(Wi&&Wi.rect)Fl=Wi.rect,Ei=Wi.metrics;else{const js=Pe[qt.fontStack],gh=js&&js[_i];if(!gh)continue;Ei=gh.metrics}Kn=($i-qt.scale)*Oi}Rr?(we.verticalizable=!0,wn.push({glyph:_i,imageName:hs,x:_t,y:ci+Kn,vertical:Rr,scale:qt.scale,fontStack:qt.fontStack,sectionIndex:ui,metrics:Ei,rect:Fl}),_t+=us*qt.scale+Te):(wn.push({glyph:_i,imageName:hs,x:_t,y:ci+Kn,vertical:Rr,scale:qt.scale,fontStack:qt.fontStack,sectionIndex:ui,metrics:Ei,rect:Fl}),_t+=Ei.advance*qt.scale+Te)}wn.length!==0&&(ai=Math.max(_t-Te,ai),xA(wn,0,wn.length-1,zr,nn)),_t=0;const dr=Ve*$i+nn;tn.lineOffset=Math.max(nn,hn),ci+=dr,Ni=Math.max(dr,Ni),++en}var Vi;const xn=ci-ch,{horizontalAlign:bn,verticalAlign:vn}=Vf(nt);(function(Pi,$i,hn,tn,wn,nn,dr,Ln,qt){const ui=($i-hn)*wn;let _i=0;_i=nn!==dr?-Ln*tn-ch:(-tn*qt+.5)*dr;for(const Kn of Pi)for(const Ei of Kn.positionedGlyphs)Ei.x+=ui,Ei.y+=_i})(we.positionedLines,zr,bn,vn,ai,Ni,Ve,xn,je.length),we.top+=-vn*xn,we.bottom=we.top+xn,we.left+=-bn*ai,we.right=we.left+ai}(fe,t,s,l,K,x,v,S,L,C,F,H),!function(we){for(const Pe of we)if(Pe.positionedGlyphs.length!==0)return!1;return!0}(le)&&fe}const od={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},gA={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},yA={40:!0};function y_(r,t,s,l,f,_){if(t.imageName){const x=l[t.imageName];return x?x.displaySize[0]*t.scale*Oi/_+f:0}{const x=s[t.fontStack],v=x&&x[r];return v?v.metrics.advance*t.scale+f:0}}function __(r,t,s,l){const f=Math.pow(r-t,2);return l?r<t?f/2:2*f:f+Math.abs(s)*s}function _A(r,t,s){let l=0;return r===10&&(l-=1e4),s&&(l+=150),r!==40&&r!==65288||(l+=50),t!==41&&t!==65289||(l+=50),l}function x_(r,t,s,l,f,_){let x=null,v=__(t,s,f,_);for(const S of l){const C=__(t-S.x,s,f,_)+S.badness;C<=v&&(x=S,v=C)}return{index:r,x:t,priorBreak:x,badness:v}}function b_(r){return r?b_(r.priorBreak).concat(r.index):[]}function Nf(r,t,s,l,f,_){if(!r)return[];const x=[],v=function(L,F,j,H,q,K){let ie=0;for(let ge=0;ge<L.length();ge++){const le=L.getSection(ge);ie+=y_(L.getCharCode(ge),le,H,q,F,K)}return ie/Math.max(1,Math.ceil(ie/j))}(r,t,s,l,f,_),S=r.text.indexOf("​")>=0;let C=0;for(let L=0;L<r.length();L++){const F=r.getSection(L),j=r.getCharCode(L);if(od[j]||(C+=y_(j,F,l,f,t,_)),L<r.length()-1){const H=!((P=j)<11904)&&(!!Bt["CJK Compatibility Forms"](P)||!!Bt["CJK Compatibility"](P)||!!Bt["CJK Strokes"](P)||!!Bt["CJK Symbols and Punctuation"](P)||!!Bt["Enclosed CJK Letters and Months"](P)||!!Bt["Halfwidth and Fullwidth Forms"](P)||!!Bt["Ideographic Description Characters"](P)||!!Bt["Vertical Forms"](P)||Uu.test(String.fromCodePoint(P)));(gA[j]||H||F.imageName||L!==r.length()-2&&yA[r.getCharCode(L+1)])&&x.push(x_(L+1,C,v,x,_A(j,r.getCharCode(L+1),H&&S),!1))}}var P;return b_(x_(r.length(),C,v,x,0,!0))}function Vf(r){let t=.5,s=.5;switch(r){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":s=1;break;case"top":case"top-right":case"top-left":s=0}return{horizontalAlign:t,verticalAlign:s}}function xA(r,t,s,l,f){if(!l&&!f)return;const _=r[s],x=(r[s].x+_.metrics.advance*_.scale)*l;for(let v=t;v<=s;v++)r[v].x-=x,r[v].y+=f}function bA(r,t,s){const{horizontalAlign:l,verticalAlign:f}=Vf(s),_=t[0]-r.displaySize[0]*l,x=t[1]-r.displaySize[1]*f;return{image:r,top:x,bottom:x+r.displaySize[1],left:_,right:_+r.displaySize[0]}}function v_(r){var t,s;let l=r.left,f=r.top,_=r.right-l,x=r.bottom-f;const v=(t=r.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",S=(s=r.image.textFitHeight)!==null&&s!==void 0?s:"stretchOrShrink",C=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(S==="proportional"){if(v==="stretchOnly"&&_/x<C||v==="proportional"){const P=Math.ceil(x*C);l*=P/_,_=P}}else if(v==="proportional"&&S==="stretchOnly"&&C!==0&&_/x>C){const P=Math.ceil(_/C);f*=P/x,x=P}return{x1:l,y1:f,x2:l+_,y2:f+x}}function w_(r,t,s,l,f,_){const x=r.image;let v;if(x.content){const K=x.content,ie=x.pixelRatio||1;v=[K[0]/ie,K[1]/ie,x.displaySize[0]-K[2]/ie,x.displaySize[1]-K[3]/ie]}const S=t.left*_,C=t.right*_;let P,L,F,j;s==="width"||s==="both"?(j=f[0]+S-l[3],L=f[0]+C+l[1]):(j=f[0]+(S+C-x.displaySize[0])/2,L=j+x.displaySize[0]);const H=t.top*_,q=t.bottom*_;return s==="height"||s==="both"?(P=f[1]+H-l[0],F=f[1]+q+l[2]):(P=f[1]+(H+q-x.displaySize[1])/2,F=P+x.displaySize[1]),{image:x,top:P,right:L,bottom:F,left:j,collisionPadding:v}}const uh=255,cs=128,Io=uh*cs;function k_(r,t){const{expression:s}=t;if(s.kind==="constant")return{kind:"constant",layoutSize:s.evaluate(new fi(r+1))};if(s.kind==="source")return{kind:"source"};{const{zoomStops:l,interpolationType:f}=s;let _=0;for(;_<l.length&&l[_]<=r;)_++;_=Math.max(0,_-1);let x=_;for(;x<l.length&&l[x]<r+1;)x++;x=Math.min(l.length-1,x);const v=l[_],S=l[x];return s.kind==="composite"?{kind:"composite",minZoom:v,maxZoom:S,interpolationType:f}:{kind:"camera",minZoom:v,maxZoom:S,minSize:s.evaluate(new fi(v)),maxSize:s.evaluate(new fi(S)),interpolationType:f}}}function $f(r,t,s){let l="never";const f=r.get(t);return f?l=f:r.get(s)&&(l="always"),l}const vA=Mo.VectorTileFeature.types,wA=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ad(r,t,s,l,f,_,x,v,S,C,P,L,F){const j=v?Math.min(Io,Math.round(v[0])):0,H=v?Math.min(Io,Math.round(v[1])):0;r.emplaceBack(t,s,Math.round(32*l),Math.round(32*f),_,x,(j<<1)+(S?1:0),H,16*C,16*P,256*L,256*F)}function jf(r,t,s){r.emplaceBack(t.x,t.y,s),r.emplaceBack(t.x,t.y,s),r.emplaceBack(t.x,t.y,s),r.emplaceBack(t.x,t.y,s)}function kA(r){for(const t of r.sections)if(gf(t.text))return!0;return!1}class Uf{constructor(t){this.layoutVertexArray=new kl,this.indexArray=new cr,this.programConfigurations=t,this.segments=new Ft,this.dynamicLayoutVertexArray=new Jc,this.opacityVertexArray=new Yn,this.hasVisibleVertices=!1,this.placedSymbolArray=new mi}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,s,l,f){this.isEmpty()||(l&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,QI.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,s),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,eA.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,wA,!0),this.opacityVertexBuffer.itemSize=1),(l||f)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Xe("SymbolBuffers",Uf);class Hf{constructor(t,s,l){this.layoutVertexArray=new t,this.layoutAttributes=s,this.indexArray=new l,this.segments=new Ft,this.collisionVertexArray=new as}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,tA.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Xe("CollisionBuffers",Hf);class Ll{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(x=>x.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=kf([]),this.placementViewportMatrix=kf([]);const s=this.layers[0]._unevaluatedLayout._values;this.textSizeData=k_(this.zoom,s["text-size"]),this.iconSizeData=k_(this.zoom,s["icon-size"]);const l=this.layers[0].layout,f=l.get("symbol-sort-key"),_=l.get("symbol-z-order");this.canOverlap=$f(l,"text-overlap","text-allow-overlap")!=="never"||$f(l,"icon-overlap","icon-allow-overlap")!=="never"||l.get("text-ignore-placement")||l.get("icon-ignore-placement"),this.sortFeaturesByKey=_!=="viewport-y"&&!f.isConstant(),this.sortFeaturesByY=(_==="viewport-y"||_==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,l.get("symbol-placement")==="point"&&(this.writingModes=l.get("text-writing-mode").map(x=>y.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=t.sourceID}createArrays(){this.text=new Uf(new _a(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Uf(new _a(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new gi,this.lineVertexArray=new Xi,this.symbolInstances=new Ot,this.textAnchorOffsets=new yi}calculateGlyphDependencies(t,s,l,f,_){for(let x=0;x<t.length;x++)if(s[t.charCodeAt(x)]=!0,(l||f)&&_){const v=lh[t.charAt(x)];v&&(s[v.charCodeAt(0)]=!0)}}populate(t,s,l){const f=this.layers[0],_=f.layout,x=_.get("text-font"),v=_.get("text-field"),S=_.get("icon-image"),C=(v.value.kind!=="constant"||v.value.value instanceof Mn&&!v.value.value.isEmpty()||v.value.value.toString().length>0)&&(x.value.kind!=="constant"||x.value.value.length>0),P=S.value.kind!=="constant"||!!S.value.value||Object.keys(S.parameters).length>0,L=_.get("symbol-sort-key");if(this.features=[],!C&&!P)return;const F=s.iconDependencies,j=s.glyphDependencies,H=s.availableImages,q=new fi(this.zoom);for(const{feature:K,id:ie,index:ge,sourceLayerIndex:le}of t){const fe=f._featureFilter.needGeometry,we=ba(K,fe);if(!f._featureFilter.filter(q,we,l))continue;let Pe,qe;if(fe||(we.geometry=xa(K)),C){const je=f.getValueAndResolveTokens("text-field",we,l,H),Ve=Mn.factory(je),nt=this.hasRTLText=this.hasRTLText||kA(Ve);(!nt||Dn.getRTLTextPluginStatus()==="unavailable"||nt&&Dn.isParsed())&&(Pe=nA(Ve,f,we))}if(P){const je=f.getValueAndResolveTokens("icon-image",we,l,H);qe=je instanceof In?je:In.fromString(je)}if(!Pe&&!qe)continue;const ut=this.sortFeaturesByKey?L.evaluate(we,{},l):void 0;if(this.features.push({id:ie,text:Pe,icon:qe,index:ge,sourceLayerIndex:le,geometry:we.geometry,properties:K.properties,type:vA[K.type],sortKey:ut}),qe&&(F[qe.name]=!0),Pe){const je=x.evaluate(we,{},l).join(","),Ve=_.get("text-rotation-alignment")!=="viewport"&&_.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(y.ah.vertical)>=0;for(const nt of Pe.sections)if(nt.image)F[nt.image.name]=!0;else{const Ke=Wc(Pe.toString()),Ge=nt.fontStack||je,Te=j[Ge]=j[Ge]||{};this.calculateGlyphDependencies(nt.text,Te,Ve,this.allowVerticalPlacement,Ke)}}}_.get("symbol-placement")==="line"&&(this.features=function(K){const ie={},ge={},le=[];let fe=0;function we(je){le.push(K[je]),fe++}function Pe(je,Ve,nt){const Ke=ge[je];return delete ge[je],ge[Ve]=Ke,le[Ke].geometry[0].pop(),le[Ke].geometry[0]=le[Ke].geometry[0].concat(nt[0]),Ke}function qe(je,Ve,nt){const Ke=ie[Ve];return delete ie[Ve],ie[je]=Ke,le[Ke].geometry[0].shift(),le[Ke].geometry[0]=nt[0].concat(le[Ke].geometry[0]),Ke}function ut(je,Ve,nt){const Ke=nt?Ve[0][Ve[0].length-1]:Ve[0][0];return`${je}:${Ke.x}:${Ke.y}`}for(let je=0;je<K.length;je++){const Ve=K[je],nt=Ve.geometry,Ke=Ve.text?Ve.text.toString():null;if(!Ke){we(je);continue}const Ge=ut(Ke,nt),Te=ut(Ke,nt,!0);if(Ge in ge&&Te in ie&&ge[Ge]!==ie[Te]){const at=qe(Ge,Te,nt),it=Pe(Ge,Te,le[at].geometry);delete ie[Ge],delete ge[Te],ge[ut(Ke,le[it].geometry,!0)]=it,le[at].geometry=null}else Ge in ge?Pe(Ge,Te,nt):Te in ie?qe(Ge,Te,nt):(we(je),ie[Ge]=fe-1,ge[Te]=fe-1)}return le.filter(je=>je.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((K,ie)=>K.sortKey-ie.sortKey)}update(t,s,l){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,s,this.layers,l),this.icon.programConfigurations.updatePaintArrays(t,s,this.layers,l))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,s){const l=this.lineVertexArray.length;if(t.segment!==void 0){let f=t.dist(s[t.segment+1]),_=t.dist(s[t.segment]);const x={};for(let v=t.segment+1;v<s.length;v++)x[v]={x:s[v].x,y:s[v].y,tileUnitDistanceFromAnchor:f},v<s.length-1&&(f+=s[v+1].dist(s[v]));for(let v=t.segment||0;v>=0;v--)x[v]={x:s[v].x,y:s[v].y,tileUnitDistanceFromAnchor:_},v>0&&(_+=s[v-1].dist(s[v]));for(let v=0;v<s.length;v++){const S=x[v];this.lineVertexArray.emplaceBack(S.x,S.y,S.tileUnitDistanceFromAnchor)}}return{lineStartIndex:l,lineLength:this.lineVertexArray.length-l}}addSymbols(t,s,l,f,_,x,v,S,C,P,L,F){const j=t.indexArray,H=t.layoutVertexArray,q=t.segments.prepareSegment(4*s.length,H,j,this.canOverlap?x.sortKey:void 0),K=this.glyphOffsetArray.length,ie=q.vertexLength,ge=this.allowVerticalPlacement&&v===y.ah.vertical?Math.PI/2:0,le=x.text&&x.text.sections;for(let fe=0;fe<s.length;fe++){const{tl:we,tr:Pe,bl:qe,br:ut,tex:je,pixelOffsetTL:Ve,pixelOffsetBR:nt,minFontScaleX:Ke,minFontScaleY:Ge,glyphOffset:Te,isSDF:at,sectionIndex:it}=s[fe],_t=q.vertexLength,ci=Te[1];ad(H,S.x,S.y,we.x,ci+we.y,je.x,je.y,l,at,Ve.x,Ve.y,Ke,Ge),ad(H,S.x,S.y,Pe.x,ci+Pe.y,je.x+je.w,je.y,l,at,nt.x,Ve.y,Ke,Ge),ad(H,S.x,S.y,qe.x,ci+qe.y,je.x,je.y+je.h,l,at,Ve.x,nt.y,Ke,Ge),ad(H,S.x,S.y,ut.x,ci+ut.y,je.x+je.w,je.y+je.h,l,at,nt.x,nt.y,Ke,Ge),jf(t.dynamicLayoutVertexArray,S,ge),j.emplaceBack(_t,_t+1,_t+2),j.emplaceBack(_t+1,_t+2,_t+3),q.vertexLength+=4,q.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Te[0]),fe!==s.length-1&&it===s[fe+1].sectionIndex||t.programConfigurations.populatePaintArrays(H.length,x,x.index,{},F,le&&le[it])}t.placedSymbolArray.emplaceBack(S.x,S.y,K,this.glyphOffsetArray.length-K,ie,C,P,S.segment,l?l[0]:0,l?l[1]:0,f[0],f[1],v,0,!1,0,L)}_addCollisionDebugVertex(t,s,l,f,_,x){return s.emplaceBack(0,0),t.emplaceBack(l.x,l.y,f,_,Math.round(x.x),Math.round(x.y))}addCollisionDebugVertices(t,s,l,f,_,x,v){const S=_.segments.prepareSegment(4,_.layoutVertexArray,_.indexArray),C=S.vertexLength,P=_.layoutVertexArray,L=_.collisionVertexArray,F=v.anchorX,j=v.anchorY;this._addCollisionDebugVertex(P,L,x,F,j,new R(t,s)),this._addCollisionDebugVertex(P,L,x,F,j,new R(l,s)),this._addCollisionDebugVertex(P,L,x,F,j,new R(l,f)),this._addCollisionDebugVertex(P,L,x,F,j,new R(t,f)),S.vertexLength+=4;const H=_.indexArray;H.emplaceBack(C,C+1),H.emplaceBack(C+1,C+2),H.emplaceBack(C+2,C+3),H.emplaceBack(C+3,C),S.primitiveLength+=4}addDebugCollisionBoxes(t,s,l,f){for(let _=t;_<s;_++){const x=this.collisionBoxArray.get(_);this.addCollisionDebugVertices(x.x1,x.y1,x.x2,x.y2,f?this.textCollisionBox:this.iconCollisionBox,x.anchorPoint,l)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Hf(Xn,o_.members,Zi),this.iconCollisionBox=new Hf(Xn,o_.members,Zi);for(let t=0;t<this.symbolInstances.length;t++){const s=this.symbolInstances.get(t);this.addDebugCollisionBoxes(s.textBoxStartIndex,s.textBoxEndIndex,s,!0),this.addDebugCollisionBoxes(s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s,!0),this.addDebugCollisionBoxes(s.iconBoxStartIndex,s.iconBoxEndIndex,s,!1),this.addDebugCollisionBoxes(s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s,!1)}}_deserializeCollisionBoxesForSymbol(t,s,l,f,_,x,v,S,C){const P={};for(let L=s;L<l;L++){const F=t.get(L);P.textBox={x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2,anchorPointX:F.anchorPointX,anchorPointY:F.anchorPointY},P.textFeatureIndex=F.featureIndex;break}for(let L=f;L<_;L++){const F=t.get(L);P.verticalTextBox={x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2,anchorPointX:F.anchorPointX,anchorPointY:F.anchorPointY},P.verticalTextFeatureIndex=F.featureIndex;break}for(let L=x;L<v;L++){const F=t.get(L);P.iconBox={x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2,anchorPointX:F.anchorPointX,anchorPointY:F.anchorPointY},P.iconFeatureIndex=F.featureIndex;break}for(let L=S;L<C;L++){const F=t.get(L);P.verticalIconBox={x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2,anchorPointX:F.anchorPointX,anchorPointY:F.anchorPointY},P.verticalIconFeatureIndex=F.featureIndex;break}return P}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let s=0;s<this.symbolInstances.length;s++){const l=this.symbolInstances.get(s);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,l.textBoxStartIndex,l.textBoxEndIndex,l.verticalTextBoxStartIndex,l.verticalTextBoxEndIndex,l.iconBoxStartIndex,l.iconBoxEndIndex,l.verticalIconBoxStartIndex,l.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,s){const l=t.placedSymbolArray.get(s),f=l.vertexStartIndex+4*l.numGlyphs;for(let _=l.vertexStartIndex;_<f;_+=4)t.indexArray.emplaceBack(_,_+1,_+2),t.indexArray.emplaceBack(_+1,_+2,_+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const s=Math.sin(t),l=Math.cos(t),f=[],_=[],x=[];for(let v=0;v<this.symbolInstances.length;++v){x.push(v);const S=this.symbolInstances.get(v);f.push(0|Math.round(s*S.anchorX+l*S.anchorY)),_.push(S.featureIndex)}return x.sort((v,S)=>f[v]-f[S]||_[S]-_[v]),x}addToSortKeyRanges(t,s){const l=this.sortKeyRanges[this.sortKeyRanges.length-1];l&&l.sortKey===s?l.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:s,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const s of this.symbolInstanceIndexes){const l=this.symbolInstances.get(s);this.featureSortOrder.push(l.featureIndex),[l.rightJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.leftJustifiedTextSymbolIndex].forEach((f,_,x)=>{f>=0&&x.indexOf(f)===_&&this.addIndicesForPlacedSymbol(this.text,f)}),l.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,l.verticalPlacedTextSymbolIndex),l.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.placedIconSymbolIndex),l.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let S_,E_;Xe("SymbolBucket",Ll,{omit:["layers","collisionBoxArray","features","compareText"]}),Ll.MAX_GLYPHS=65535,Ll.addDynamicAttributes=jf;var qf={get paint(){return E_=E_||new g({"icon-opacity":new dt(xe.paint_symbol["icon-opacity"]),"icon-color":new dt(xe.paint_symbol["icon-color"]),"icon-halo-color":new dt(xe.paint_symbol["icon-halo-color"]),"icon-halo-width":new dt(xe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new dt(xe.paint_symbol["icon-halo-blur"]),"icon-translate":new et(xe.paint_symbol["icon-translate"]),"icon-translate-anchor":new et(xe.paint_symbol["icon-translate-anchor"]),"text-opacity":new dt(xe.paint_symbol["text-opacity"]),"text-color":new dt(xe.paint_symbol["text-color"],{runtimeType:fn,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new dt(xe.paint_symbol["text-halo-color"]),"text-halo-width":new dt(xe.paint_symbol["text-halo-width"]),"text-halo-blur":new dt(xe.paint_symbol["text-halo-blur"]),"text-translate":new et(xe.paint_symbol["text-translate"]),"text-translate-anchor":new et(xe.paint_symbol["text-translate-anchor"])})},get layout(){return S_=S_||new g({"symbol-placement":new et(xe.layout_symbol["symbol-placement"]),"symbol-spacing":new et(xe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new et(xe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new dt(xe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new et(xe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new et(xe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new et(xe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new et(xe.layout_symbol["icon-ignore-placement"]),"icon-optional":new et(xe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new et(xe.layout_symbol["icon-rotation-alignment"]),"icon-size":new dt(xe.layout_symbol["icon-size"]),"icon-text-fit":new et(xe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new et(xe.layout_symbol["icon-text-fit-padding"]),"icon-image":new dt(xe.layout_symbol["icon-image"]),"icon-rotate":new dt(xe.layout_symbol["icon-rotate"]),"icon-padding":new dt(xe.layout_symbol["icon-padding"]),"icon-keep-upright":new et(xe.layout_symbol["icon-keep-upright"]),"icon-offset":new dt(xe.layout_symbol["icon-offset"]),"icon-anchor":new dt(xe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new et(xe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new et(xe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new et(xe.layout_symbol["text-rotation-alignment"]),"text-field":new dt(xe.layout_symbol["text-field"]),"text-font":new dt(xe.layout_symbol["text-font"]),"text-size":new dt(xe.layout_symbol["text-size"]),"text-max-width":new dt(xe.layout_symbol["text-max-width"]),"text-line-height":new et(xe.layout_symbol["text-line-height"]),"text-letter-spacing":new dt(xe.layout_symbol["text-letter-spacing"]),"text-justify":new dt(xe.layout_symbol["text-justify"]),"text-radial-offset":new dt(xe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new et(xe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new dt(xe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new dt(xe.layout_symbol["text-anchor"]),"text-max-angle":new et(xe.layout_symbol["text-max-angle"]),"text-writing-mode":new et(xe.layout_symbol["text-writing-mode"]),"text-rotate":new dt(xe.layout_symbol["text-rotate"]),"text-padding":new et(xe.layout_symbol["text-padding"]),"text-keep-upright":new et(xe.layout_symbol["text-keep-upright"]),"text-transform":new dt(xe.layout_symbol["text-transform"]),"text-offset":new dt(xe.layout_symbol["text-offset"]),"text-allow-overlap":new et(xe.layout_symbol["text-allow-overlap"]),"text-overlap":new et(xe.layout_symbol["text-overlap"]),"text-ignore-placement":new et(xe.layout_symbol["text-ignore-placement"]),"text-optional":new et(xe.layout_symbol["text-optional"])})}};class T_{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:ns,this.defaultValue=t}evaluate(t){if(t.formattedSection){const s=this.defaultValue.property.overrides;if(s&&s.hasOverride(t.formattedSection))return s.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Xe("FormatSectionOverride",T_,{omit:["defaultValue"]});class ld extends a{constructor(t){super(t,qf)}recalculate(t,s){if(super.recalculate(t,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 l=this.layout.get("text-writing-mode");if(l){const f=[];for(const _ of l)f.indexOf(_)<0&&f.push(_);this.layout._values["text-writing-mode"]=f}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,s,l,f){const _=this.layout.get(t).evaluate(s,{},l,f),x=this._unevaluatedLayout._values[t];return x.isDataDriven()||ll(x.value)||!_?_:function(v,S){return S.replace(/{([^{}]+)}/g,(C,P)=>v&&P in v?String(v[P]):"")}(s.properties,_)}createBucket(t){return new Ll(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of qf.paint.overridableProperties){if(!ld.hasPaintOverride(this.layout,t))continue;const s=this.paint.get(t),l=new T_(s),f=new al(l,s.property.specification);let _=null;_=s.value.kind==="constant"||s.value.kind==="source"?new uo("source",f):new po("composite",f,s.value.zoomStops),this.paint._values[t]=new Ar(s.property,_,s.parameters)}}_handleOverridablePaintPropertyUpdate(t,s,l){return!(!this.layout||s.isDataDriven()||l.isDataDriven())&&ld.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,s){const l=t.get("text-field"),f=qf.paint.properties[s];let _=!1;const x=v=>{for(const S of v)if(f.overrides&&f.overrides.hasOverride(S))return void(_=!0)};if(l.value.kind==="constant"&&l.value.value instanceof Mn)x(l.value.value.sections);else if(l.value.kind==="source"){const v=C=>{_||(C instanceof nr&&zi(C.value)===jr?x(C.value.sections):C instanceof Ja?x(C.sections):C.eachChild(v))},S=l.value;S._styleExpression&&v(S._styleExpression.expression)}return _}}let C_;var SA={get paint(){return C_=C_||new g({"background-color":new et(xe.paint_background["background-color"]),"background-pattern":new vl(xe.paint_background["background-pattern"]),"background-opacity":new et(xe.paint_background["background-opacity"])})}};class EA extends a{constructor(t){super(t,SA)}}let M_;var TA={get paint(){return M_=M_||new g({"raster-opacity":new et(xe.paint_raster["raster-opacity"]),"raster-hue-rotate":new et(xe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new et(xe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new et(xe.paint_raster["raster-brightness-max"]),"raster-saturation":new et(xe.paint_raster["raster-saturation"]),"raster-contrast":new et(xe.paint_raster["raster-contrast"]),"raster-resampling":new et(xe.paint_raster["raster-resampling"]),"raster-fade-duration":new et(xe.paint_raster["raster-fade-duration"])})}};class CA extends a{constructor(t){super(t,TA)}}class MA extends a{constructor(t){super(t,{}),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=t}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 PA{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Zf=63710088e-1;class Ao{constructor(t,s){if(isNaN(t)||isNaN(s))throw new Error(`Invalid LngLat object: (${t}, ${s})`);if(this.lng=+t,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 Ao(Qe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const s=Math.PI/180,l=this.lat*s,f=t.lat*s,_=Math.sin(l)*Math.sin(f)+Math.cos(l)*Math.cos(f)*Math.cos((t.lng-this.lng)*s);return Zf*Math.acos(Math.min(_,1))}static convert(t){if(t instanceof Ao)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Ao(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Ao(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const P_=2*Math.PI*Zf;function I_(r){return P_*Math.cos(r*Math.PI/180)}function A_(r){return(180+r)/360}function D_(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function z_(r,t){return r/I_(t)}function Wf(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}class dh{constructor(t,s,l=0){this.x=+t,this.y=+s,this.z=+l}static fromLngLat(t,s=0){const l=Ao.convert(t);return new dh(A_(l.lng),D_(l.lat),z_(s,l.lat))}toLngLat(){return new Ao(360*this.x-180,Wf(this.y))}toAltitude(){return this.z*I_(Wf(this.y))}meterInMercatorCoordinateUnits(){return 1/P_*(t=Wf(this.y),1/Math.cos(t*Math.PI/180));var t}}function R_(r,t,s){var l=2*Math.PI*6378137/256/Math.pow(2,s);return[r*l-2*Math.PI*6378137/2,t*l-2*Math.PI*6378137/2]}class Gf{constructor(t,s,l){if(!function(f,_,x){return!(f<0||f>25||x<0||x>=Math.pow(2,f)||_<0||_>=Math.pow(2,f))}(t,s,l))throw new Error(`x=${s}, y=${l}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=s,this.y=l,this.key=ph(0,t,t,s,l)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,s,l){const f=(x=this.y,v=this.z,S=R_(256*(_=this.x),256*(x=Math.pow(2,v)-x-1),v),C=R_(256*(_+1),256*(x+1),v),S[0]+","+S[1]+","+C[0]+","+C[1]);var _,x,v,S,C;const P=function(L,F,j){let H,q="";for(let K=L;K>0;K--)H=1<<K-1,q+=(F&H?1:0)+(j&H?2:0);return q}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(l==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,s>1?"@2x":"").replace(/{quadkey}/g,P).replace(/{bbox-epsg-3857}/g,f)}isChildOf(t){const s=this.z-t.z;return s>0&&t.x===this.x>>s&&t.y===this.y>>s}getTilePoint(t){const s=Math.pow(2,this.z);return new R((t.x*s-this.x)*Ri,(t.y*s-this.y)*Ri)}toString(){return`${this.z}/${this.x}/${this.y}`}}class L_{constructor(t,s){this.wrap=t,this.canonical=s,this.key=ph(t,s.z,s.z,s.x,s.y)}}class ur{constructor(t,s,l,f,_){if(t<l)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${l}`);this.overscaledZ=t,this.wrap=s,this.canonical=new Gf(l,+f,+_),this.key=ph(s,t,l,f,_)}clone(){return new ur(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-t;return t>this.canonical.z?new ur(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ur(t,this.wrap,t,this.canonical.x>>s,this.canonical.y>>s)}calculateScaledKey(t,s){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const l=this.canonical.z-t;return t>this.canonical.z?ph(this.wrap*+s,t,this.canonical.z,this.canonical.x,this.canonical.y):ph(this.wrap*+s,t,t,this.canonical.x>>l,this.canonical.y>>l)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const s=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>s&&t.canonical.y===this.canonical.y>>s}children(t){if(this.overscaledZ>=t)return[new ur(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const s=this.canonical.z+1,l=2*this.canonical.x,f=2*this.canonical.y;return[new ur(s,this.wrap,s,l,f),new ur(s,this.wrap,s,l+1,f),new ur(s,this.wrap,s,l,f+1),new ur(s,this.wrap,s,l+1,f+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new ur(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new ur(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new L_(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new dh(t.x-this.wrap,t.y))}}function ph(r,t,s,l,f){(r*=2)<0&&(r=-1*r-1);const _=1<<s;return(_*_*r+_*f+l).toString(36)+s.toString(36)+t.toString(36)}Xe("CanonicalTileID",Gf),Xe("OverscaledTileID",ur,{omit:["posMatrix"]});class O_{constructor(t,s,l,f=1,_=1,x=1,v=0){if(this.uid=t,s.height!==s.width)throw new RangeError("DEM tiles must be square");if(l&&!["mapbox","terrarium","custom"].includes(l))return void Rt(`"${l}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=s.height;const S=this.dim=s.height-2;switch(this.data=new Uint32Array(s.data.buffer),l){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=f,this.greenFactor=_,this.blueFactor=x,this.baseShift=v;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let C=0;C<S;C++)this.data[this._idx(-1,C)]=this.data[this._idx(0,C)],this.data[this._idx(S,C)]=this.data[this._idx(S-1,C)],this.data[this._idx(C,-1)]=this.data[this._idx(C,0)],this.data[this._idx(C,S)]=this.data[this._idx(C,S-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(S,-1)]=this.data[this._idx(S-1,0)],this.data[this._idx(-1,S)]=this.data[this._idx(0,S-1)],this.data[this._idx(S,S)]=this.data[this._idx(S-1,S-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let C=0;C<S;C++)for(let P=0;P<S;P++){const L=this.get(C,P);L>this.max&&(this.max=L),L<this.min&&(this.min=L)}}get(t,s){const l=new Uint8Array(this.data.buffer),f=4*this._idx(t,s);return this.unpack(l[f],l[f+1],l[f+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,s){if(t<-1||t>=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+(t+1)}unpack(t,s,l){return t*this.redFactor+s*this.greenFactor+l*this.blueFactor-this.baseShift}getPixels(){return new hr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,s,l){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let f=s*this.dim,_=s*this.dim+this.dim,x=l*this.dim,v=l*this.dim+this.dim;switch(s){case-1:f=_-1;break;case 1:_=f+1}switch(l){case-1:x=v-1;break;case 1:v=x+1}const S=-s*this.dim,C=-l*this.dim;for(let P=x;P<v;P++)for(let L=f;L<_;L++)this.data[this._idx(L,P)]=t.data[this._idx(L+S,P+C)]}}Xe("DEMData",O_);class B_{constructor(t){this._stringToNumber={},this._numberToString=[];for(let s=0;s<t.length;s++){const l=t[s];this._stringToNumber[l]=s,this._numberToString[s]=l}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class F_{constructor(t,s,l,f,_){this.type="Feature",this._vectorTileFeature=t,t._z=s,t._x=l,t._y=f,this.properties=t.properties,this.id=_}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(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const s in this)s!=="_geometry"&&s!=="_vectorTileFeature"&&(t[s]=this[s]);return t}}class N_{constructor(t,s){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new yo(Ri,16,0),this.grid3D=new yo(Ri,16,0),this.featureIndexArray=new ln,this.promoteId=s}insert(t,s,l,f,_,x){const v=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(l,f,_);const S=x?this.grid3D:this.grid;for(let C=0;C<s.length;C++){const P=s[C],L=[1/0,1/0,-1/0,-1/0];for(let F=0;F<P.length;F++){const j=P[F];L[0]=Math.min(L[0],j.x),L[1]=Math.min(L[1],j.y),L[2]=Math.max(L[2],j.x),L[3]=Math.max(L[3],j.y)}L[0]<Ri&&L[1]<Ri&&L[2]>=0&&L[3]>=0&&S.insert(v,L[0],L[1],L[2],L[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Mo.VectorTile(new Of(this.rawTileData)).layers,this.sourceLayerCoder=new B_(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,s,l,f){this.loadVTLayers();const _=t.params||{},x=Ri/t.tileSize/t.scale,v=Dc(_.filter),S=t.queryGeometry,C=t.queryPadding*x,P=$_(S),L=this.grid.query(P.minX-C,P.minY-C,P.maxX+C,P.maxY+C),F=$_(t.cameraQueryGeometry),j=this.grid3D.query(F.minX-C,F.minY-C,F.maxX+C,F.maxY+C,(K,ie,ge,le)=>function(fe,we,Pe,qe,ut){for(const Ve of fe)if(we<=Ve.x&&Pe<=Ve.y&&qe>=Ve.x&&ut>=Ve.y)return!0;const je=[new R(we,Pe),new R(we,ut),new R(qe,ut),new R(qe,Pe)];if(fe.length>2){for(const Ve of je)if(Ml(fe,Ve))return!0}for(let Ve=0;Ve<fe.length-1;Ve++)if(cI(fe[Ve],fe[Ve+1],je))return!0;return!1}(t.cameraQueryGeometry,K-C,ie-C,ge+C,le+C));for(const K of j)L.push(K);L.sort(IA);const H={};let q;for(let K=0;K<L.length;K++){const ie=L[K];if(ie===q)continue;q=ie;const ge=this.featureIndexArray.get(ie);let le=null;this.loadMatchingFeature(H,ge.bucketIndex,ge.sourceLayerIndex,ge.featureIndex,v,_.layers,_.availableImages,s,l,f,(fe,we,Pe)=>(le||(le=xa(fe)),we.queryIntersectsFeature(S,fe,Pe,le,this.z,t.transform,x,t.pixelPosMatrix)))}return H}loadMatchingFeature(t,s,l,f,_,x,v,S,C,P,L){const F=this.bucketLayerIDs[s];if(x&&!function(K,ie){for(let ge=0;ge<K.length;ge++)if(ie.indexOf(K[ge])>=0)return!0;return!1}(x,F))return;const j=this.sourceLayerCoder.decode(l),H=this.vtLayers[j].feature(f);if(_.needGeometry){const K=ba(H,!0);if(!_.filter(new fi(this.tileID.overscaledZ),K,this.tileID.canonical))return}else if(!_.filter(new fi(this.tileID.overscaledZ),H))return;const q=this.getId(H,j);for(let K=0;K<F.length;K++){const ie=F[K];if(x&&x.indexOf(ie)<0)continue;const ge=S[ie];if(!ge)continue;let le={};q&&P&&(le=P.getState(ge.sourceLayer||"_geojsonTileLayer",q));const fe=Be({},C[ie]);fe.paint=V_(fe.paint,ge.paint,H,le,v),fe.layout=V_(fe.layout,ge.layout,H,le,v);const we=!L||L(H,ge,le);if(!we)continue;const Pe=new F_(H,this.z,this.x,this.y,q);Pe.layer=fe;let qe=t[ie];qe===void 0&&(qe=t[ie]=[]),qe.push({featureIndex:f,feature:Pe,intersectionZ:we})}}lookupSymbolFeatures(t,s,l,f,_,x,v,S){const C={};this.loadVTLayers();const P=Dc(_);for(const L of t)this.loadMatchingFeature(C,l,f,L,P,x,v,S,s);return C}hasLayer(t){for(const s of this.bucketLayerIDs)for(const l of s)if(t===l)return!0;return!1}getId(t,s){let l=t.id;return this.promoteId&&(l=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[s]],typeof l=="boolean"&&(l=Number(l))),l}}function V_(r,t,s,l,f){return rt(r,(_,x)=>{const v=t instanceof ma?t.get(x):null;return v&&v.evaluate?v.evaluate(s,l,f):v})}function $_(r){let t=1/0,s=1/0,l=-1/0,f=-1/0;for(const _ of r)t=Math.min(t,_.x),s=Math.min(s,_.y),l=Math.max(l,_.x),f=Math.max(f,_.y);return{minX:t,minY:s,maxX:l,maxY:f}}function IA(r,t){return t-r}function j_(r,t,s,l,f){const _=[];for(let x=0;x<r.length;x++){const v=r[x];let S;for(let C=0;C<v.length-1;C++){let P=v[C],L=v[C+1];P.x<t&&L.x<t||(P.x<t?P=new R(t,P.y+(t-P.x)/(L.x-P.x)*(L.y-P.y))._round():L.x<t&&(L=new R(t,P.y+(t-P.x)/(L.x-P.x)*(L.y-P.y))._round()),P.y<s&&L.y<s||(P.y<s?P=new R(P.x+(s-P.y)/(L.y-P.y)*(L.x-P.x),s)._round():L.y<s&&(L=new R(P.x+(s-P.y)/(L.y-P.y)*(L.x-P.x),s)._round()),P.x>=l&&L.x>=l||(P.x>=l?P=new R(l,P.y+(l-P.x)/(L.x-P.x)*(L.y-P.y))._round():L.x>=l&&(L=new R(l,P.y+(l-P.x)/(L.x-P.x)*(L.y-P.y))._round()),P.y>=f&&L.y>=f||(P.y>=f?P=new R(P.x+(f-P.y)/(L.y-P.y)*(L.x-P.x),f)._round():L.y>=f&&(L=new R(P.x+(f-P.y)/(L.y-P.y)*(L.x-P.x),f)._round()),S&&P.equals(S[S.length-1])||(S=[P],_.push(S)),S.push(L)))))}}return _}Xe("FeatureIndex",N_,{omit:["rawTileData","sourceLayerCoder"]});class Do extends R{constructor(t,s,l,f){super(t,s),this.angle=l,f!==void 0&&(this.segment=f)}clone(){return new Do(this.x,this.y,this.angle,this.segment)}}function U_(r,t,s,l,f){if(t.segment===void 0||s===0)return!0;let _=t,x=t.segment+1,v=0;for(;v>-s/2;){if(x--,x<0)return!1;v-=r[x].dist(_),_=r[x]}v+=r[x].dist(r[x+1]),x++;const S=[];let C=0;for(;v<s/2;){const P=r[x],L=r[x+1];if(!L)return!1;let F=r[x-1].angleTo(P)-P.angleTo(L);for(F=Math.abs((F+3*Math.PI)%(2*Math.PI)-Math.PI),S.push({distance:v,angleDelta:F}),C+=F;v-S[0].distance>l;)C-=S.shift().angleDelta;if(C>f)return!1;x++,v+=P.dist(L)}return!0}function H_(r){let t=0;for(let s=0;s<r.length-1;s++)t+=r[s].dist(r[s+1]);return t}function q_(r,t,s){return r?.6*t*s:0}function Z_(r,t){return Math.max(r?r.right-r.left:0,t?t.right-t.left:0)}function AA(r,t,s,l,f,_){const x=q_(s,f,_),v=Z_(s,l)*_;let S=0;const C=H_(r)/2;for(let P=0;P<r.length-1;P++){const L=r[P],F=r[P+1],j=L.dist(F);if(S+j>C){const H=(C-S)/j,q=mn.number(L.x,F.x,H),K=mn.number(L.y,F.y,H),ie=new Do(q,K,F.angleTo(L),P);return ie._round(),!x||U_(r,ie,v,x,t)?ie:void 0}S+=j}}function DA(r,t,s,l,f,_,x,v,S){const C=q_(l,_,x),P=Z_(l,f),L=P*x,F=r[0].x===0||r[0].x===S||r[0].y===0||r[0].y===S;return t-L<t/4&&(t=L+t/4),W_(r,F?t/2*v%t:(P/2+2*_)*x*v%t,t,C,s,L,F,!1,S)}function W_(r,t,s,l,f,_,x,v,S){const C=_/2,P=H_(r);let L=0,F=t-s,j=[];for(let H=0;H<r.length-1;H++){const q=r[H],K=r[H+1],ie=q.dist(K),ge=K.angleTo(q);for(;F+s<L+ie;){F+=s;const le=(F-L)/ie,fe=mn.number(q.x,K.x,le),we=mn.number(q.y,K.y,le);if(fe>=0&&fe<S&&we>=0&&we<S&&F-C>=0&&F+C<=P){const Pe=new Do(fe,we,ge,H);Pe._round(),l&&!U_(r,Pe,_,l,f)||j.push(Pe)}}L+=ie}return v||j.length||x||(j=W_(r,L/2,s,l,f,_,x,!0,S)),j}Xe("Anchor",Do);const Ol=Rn;function G_(r,t,s,l){const f=[],_=r.image,x=_.pixelRatio,v=_.paddedRect.w-2*Ol,S=_.paddedRect.h-2*Ol;let C={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const P=_.stretchX||[[0,v]],L=_.stretchY||[[0,S]],F=(Te,at)=>Te+at[1]-at[0],j=P.reduce(F,0),H=L.reduce(F,0),q=v-j,K=S-H;let ie=0,ge=j,le=0,fe=H,we=0,Pe=q,qe=0,ut=K;if(_.content&&l){const Te=_.content,at=Te[2]-Te[0],it=Te[3]-Te[1];(_.textFitWidth||_.textFitHeight)&&(C=v_(r)),ie=cd(P,0,Te[0]),le=cd(L,0,Te[1]),ge=cd(P,Te[0],Te[2]),fe=cd(L,Te[1],Te[3]),we=Te[0]-ie,qe=Te[1]-le,Pe=at-ge,ut=it-fe}const je=C.x1,Ve=C.y1,nt=C.x2-je,Ke=C.y2-Ve,Ge=(Te,at,it,_t)=>{const ci=hd(Te.stretch-ie,ge,nt,je),ai=ud(Te.fixed-we,Pe,Te.stretch,j),Ni=hd(at.stretch-le,fe,Ke,Ve),zr=ud(at.fixed-qe,ut,at.stretch,H),en=hd(it.stretch-ie,ge,nt,je),Vi=ud(it.fixed-we,Pe,it.stretch,j),xn=hd(_t.stretch-le,fe,Ke,Ve),bn=ud(_t.fixed-qe,ut,_t.stretch,H),vn=new R(ci,Ni),Pi=new R(en,Ni),$i=new R(en,xn),hn=new R(ci,xn),tn=new R(ai/x,zr/x),wn=new R(Vi/x,bn/x),nn=t*Math.PI/180;if(nn){const qt=Math.sin(nn),ui=Math.cos(nn),_i=[ui,-qt,qt,ui];vn._matMult(_i),Pi._matMult(_i),hn._matMult(_i),$i._matMult(_i)}const dr=Te.stretch+Te.fixed,Ln=at.stretch+at.fixed;return{tl:vn,tr:Pi,bl:hn,br:$i,tex:{x:_.paddedRect.x+Ol+dr,y:_.paddedRect.y+Ol+Ln,w:it.stretch+it.fixed-dr,h:_t.stretch+_t.fixed-Ln},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:tn,pixelOffsetBR:wn,minFontScaleX:Pe/x/nt,minFontScaleY:ut/x/Ke,isSDF:s}};if(l&&(_.stretchX||_.stretchY)){const Te=Y_(P,q,j),at=Y_(L,K,H);for(let it=0;it<Te.length-1;it++){const _t=Te[it],ci=Te[it+1];for(let ai=0;ai<at.length-1;ai++)f.push(Ge(_t,at[ai],ci,at[ai+1]))}}else f.push(Ge({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:v+1},{fixed:0,stretch:S+1}));return f}function cd(r,t,s){let l=0;for(const f of r)l+=Math.max(t,Math.min(s,f[1]))-Math.max(t,Math.min(s,f[0]));return l}function Y_(r,t,s){const l=[{fixed:-Ol,stretch:0}];for(const[f,_]of r){const x=l[l.length-1];l.push({fixed:f-x.stretch,stretch:x.stretch}),l.push({fixed:f-x.stretch,stretch:x.stretch+(_-f)})}return l.push({fixed:t+Ol,stretch:s}),l}function hd(r,t,s,l){return r/t*s+l}function ud(r,t,s,l){return r-t*s/l}class dd{constructor(t,s,l,f,_,x,v,S,C,P){var L;if(this.boxStartIndex=t.length,C){let F=x.top,j=x.bottom;const H=x.collisionPadding;H&&(F-=H[1],j+=H[3]);let q=j-F;q>0&&(q=Math.max(10,q),this.circleDiameter=q)}else{const F=!((L=x.image)===null||L===void 0)&&L.content&&(x.image.textFitWidth||x.image.textFitHeight)?v_(x):{x1:x.left,y1:x.top,x2:x.right,y2:x.bottom};F.y1=F.y1*v-S[0],F.y2=F.y2*v+S[2],F.x1=F.x1*v-S[3],F.x2=F.x2*v+S[1];const j=x.collisionPadding;if(j&&(F.x1-=j[0]*v,F.y1-=j[1]*v,F.x2+=j[2]*v,F.y2+=j[3]*v),P){const H=new R(F.x1,F.y1),q=new R(F.x2,F.y1),K=new R(F.x1,F.y2),ie=new R(F.x2,F.y2),ge=P*Math.PI/180;H._rotate(ge),q._rotate(ge),K._rotate(ge),ie._rotate(ge),F.x1=Math.min(H.x,q.x,K.x,ie.x),F.x2=Math.max(H.x,q.x,K.x,ie.x),F.y1=Math.min(H.y,q.y,K.y,ie.y),F.y2=Math.max(H.y,q.y,K.y,ie.y)}t.emplaceBack(s.x,s.y,F.x1,F.y1,F.x2,F.y2,l,f,_)}this.boxEndIndex=t.length}}class zA{constructor(t=[],s=(l,f)=>l<f?-1:l>f?1:0){if(this.data=t,this.length=this.data.length,this.compare=s,this.length>0)for(let l=(this.length>>1)-1;l>=0;l--)this._down(l)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],s=this.data.pop();return--this.length>0&&(this.data[0]=s,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:s,compare:l}=this,f=s[t];for(;t>0;){const _=t-1>>1,x=s[_];if(l(f,x)>=0)break;s[t]=x,t=_}s[t]=f}_down(t){const{data:s,compare:l}=this,f=this.length>>1,_=s[t];for(;t<f;){let x=1+(t<<1);const v=x+1;if(v<this.length&&l(s[v],s[x])<0&&(x=v),l(s[x],_)>=0)break;s[t]=s[x],t=x}s[t]=_}}function RA(r,t=1,s=!1){let l=1/0,f=1/0,_=-1/0,x=-1/0;const v=r[0];for(let j=0;j<v.length;j++){const H=v[j];(!j||H.x<l)&&(l=H.x),(!j||H.y<f)&&(f=H.y),(!j||H.x>_)&&(_=H.x),(!j||H.y>x)&&(x=H.y)}const S=Math.min(_-l,x-f);let C=S/2;const P=new zA([],LA);if(S===0)return new R(l,f);for(let j=l;j<_;j+=S)for(let H=f;H<x;H+=S)P.push(new Bl(j+C,H+C,C,r));let L=function(j){let H=0,q=0,K=0;const ie=j[0];for(let ge=0,le=ie.length,fe=le-1;ge<le;fe=ge++){const we=ie[ge],Pe=ie[fe],qe=we.x*Pe.y-Pe.x*we.y;q+=(we.x+Pe.x)*qe,K+=(we.y+Pe.y)*qe,H+=3*qe}return new Bl(q/H,K/H,0,j)}(r),F=P.length;for(;P.length;){const j=P.pop();(j.d>L.d||!L.d)&&(L=j,s&&console.log("found best %d after %d probes",Math.round(1e4*j.d)/1e4,F)),j.max-L.d<=t||(C=j.h/2,P.push(new Bl(j.p.x-C,j.p.y-C,C,r)),P.push(new Bl(j.p.x+C,j.p.y-C,C,r)),P.push(new Bl(j.p.x-C,j.p.y+C,C,r)),P.push(new Bl(j.p.x+C,j.p.y+C,C,r)),F+=4)}return s&&(console.log(`num probes: ${F}`),console.log(`best distance: ${L.d}`)),L.p}function LA(r,t){return t.max-r.max}function Bl(r,t,s,l){this.p=new R(r,t),this.h=s,this.d=function(f,_){let x=!1,v=1/0;for(let S=0;S<_.length;S++){const C=_[S];for(let P=0,L=C.length,F=L-1;P<L;F=P++){const j=C[P],H=C[F];j.y>f.y!=H.y>f.y&&f.x<(H.x-j.x)*(f.y-j.y)/(H.y-j.y)+j.x&&(x=!x),v=Math.min(v,D0(f,j,H))}}return(x?1:-1)*Math.sqrt(v)}(this.p,l),this.max=this.d+this.h*Math.SQRT2}var Qi;y.aq=void 0,(Qi=y.aq||(y.aq={}))[Qi.center=1]="center",Qi[Qi.left=2]="left",Qi[Qi.right=3]="right",Qi[Qi.top=4]="top",Qi[Qi.bottom=5]="bottom",Qi[Qi["top-left"]=6]="top-left",Qi[Qi["top-right"]=7]="top-right",Qi[Qi["bottom-left"]=8]="bottom-left",Qi[Qi["bottom-right"]=9]="bottom-right";const zo=7,Yf=Number.POSITIVE_INFINITY;function X_(r,t){return t[1]!==Yf?function(s,l,f){let _=0,x=0;switch(l=Math.abs(l),f=Math.abs(f),s){case"top-right":case"top-left":case"top":x=f-zo;break;case"bottom-right":case"bottom-left":case"bottom":x=-f+zo}switch(s){case"top-right":case"bottom-right":case"right":_=-l;break;case"top-left":case"bottom-left":case"left":_=l}return[_,x]}(r,t[0],t[1]):function(s,l){let f=0,_=0;l<0&&(l=0);const x=l/Math.SQRT2;switch(s){case"top-right":case"top-left":_=x-zo;break;case"bottom-right":case"bottom-left":_=-x+zo;break;case"bottom":_=-l+zo;break;case"top":_=l-zo}switch(s){case"top-right":case"bottom-right":f=-x;break;case"top-left":case"bottom-left":f=x;break;case"left":f=l;break;case"right":f=-l}return[f,_]}(r,t[0])}function K_(r,t,s){var l;const f=r.layout,_=(l=f.get("text-variable-anchor-offset"))===null||l===void 0?void 0:l.evaluate(t,{},s);if(_){const v=_.values,S=[];for(let C=0;C<v.length;C+=2){const P=S[C]=v[C],L=v[C+1].map(F=>F*Oi);P.startsWith("top")?L[1]-=zo:P.startsWith("bottom")&&(L[1]+=zo),S[C+1]=L}return new Hn(S)}const x=f.get("text-variable-anchor");if(x){let v;v=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[f.get("text-radial-offset").evaluate(t,{},s)*Oi,Yf]:f.get("text-offset").evaluate(t,{},s).map(C=>C*Oi);const S=[];for(const C of x)S.push(C,X_(C,v));return new Hn(S)}return null}function Xf(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 OA(r,t,s,l,f,_,x,v,S,C,P){let L=_.textMaxSize.evaluate(t,{});L===void 0&&(L=x);const F=r.layers[0].layout,j=F.get("icon-offset").evaluate(t,{},P),H=Q_(s.horizontal),q=x/24,K=r.tilePixelRatio*q,ie=r.tilePixelRatio*L/24,ge=r.tilePixelRatio*v,le=r.tilePixelRatio*F.get("symbol-spacing"),fe=F.get("text-padding")*r.tilePixelRatio,we=function(Te,at,it,_t=1){const ci=Te.get("icon-padding").evaluate(at,{},it),ai=ci&&ci.values;return[ai[0]*_t,ai[1]*_t,ai[2]*_t,ai[3]*_t]}(F,t,P,r.tilePixelRatio),Pe=F.get("text-max-angle")/180*Math.PI,qe=F.get("text-rotation-alignment")!=="viewport"&&F.get("symbol-placement")!=="point",ut=F.get("icon-rotation-alignment")==="map"&&F.get("symbol-placement")!=="point",je=F.get("symbol-placement"),Ve=le/2,nt=F.get("icon-text-fit");let Ke;l&&nt!=="none"&&(r.allowVerticalPlacement&&s.vertical&&(Ke=w_(l,s.vertical,nt,F.get("icon-text-fit-padding"),j,q)),H&&(l=w_(l,H,nt,F.get("icon-text-fit-padding"),j,q)));const Ge=(Te,at)=>{at.x<0||at.x>=Ri||at.y<0||at.y>=Ri||function(it,_t,ci,ai,Ni,zr,en,Vi,xn,bn,vn,Pi,$i,hn,tn,wn,nn,dr,Ln,qt,ui,_i,Kn,Ei,Fl){const hs=it.addToLineVertexArray(_t,ci);let us,Rr,pr,Wi,js=0,gh=0,nx=0,rx=0,rm=-1,sm=-1;const Us={};let sx=Sl("");if(it.allowVerticalPlacement&&ai.vertical){const un=Vi.layout.get("text-rotate").evaluate(ui,{},Ei)+90;pr=new dd(xn,_t,bn,vn,Pi,ai.vertical,$i,hn,tn,un),en&&(Wi=new dd(xn,_t,bn,vn,Pi,en,nn,dr,tn,un))}if(Ni){const un=Vi.layout.get("icon-rotate").evaluate(ui,{}),fr=Vi.layout.get("icon-text-fit")!=="none",wa=G_(Ni,un,Kn,fr),Wr=en?G_(en,un,Kn,fr):void 0;Rr=new dd(xn,_t,bn,vn,Pi,Ni,nn,dr,!1,un),js=4*wa.length;const ka=it.iconSizeData;let ds=null;ka.kind==="source"?(ds=[cs*Vi.layout.get("icon-size").evaluate(ui,{})],ds[0]>Io&&Rt(`${it.layerIds[0]}: Value for "icon-size" is >= ${uh}. Reduce your "icon-size".`)):ka.kind==="composite"&&(ds=[cs*_i.compositeIconSizes[0].evaluate(ui,{},Ei),cs*_i.compositeIconSizes[1].evaluate(ui,{},Ei)],(ds[0]>Io||ds[1]>Io)&&Rt(`${it.layerIds[0]}: Value for "icon-size" is >= ${uh}. Reduce your "icon-size".`)),it.addSymbols(it.icon,wa,ds,qt,Ln,ui,y.ah.none,_t,hs.lineStartIndex,hs.lineLength,-1,Ei),rm=it.icon.placedSymbolArray.length-1,Wr&&(gh=4*Wr.length,it.addSymbols(it.icon,Wr,ds,qt,Ln,ui,y.ah.vertical,_t,hs.lineStartIndex,hs.lineLength,-1,Ei),sm=it.icon.placedSymbolArray.length-1)}const ox=Object.keys(ai.horizontal);for(const un of ox){const fr=ai.horizontal[un];if(!us){sx=Sl(fr.text);const Wr=Vi.layout.get("text-rotate").evaluate(ui,{},Ei);us=new dd(xn,_t,bn,vn,Pi,fr,$i,hn,tn,Wr)}const wa=fr.positionedLines.length===1;if(nx+=J_(it,_t,fr,zr,Vi,tn,ui,wn,hs,ai.vertical?y.ah.horizontal:y.ah.horizontalOnly,wa?ox:[un],Us,rm,_i,Ei),wa)break}ai.vertical&&(rx+=J_(it,_t,ai.vertical,zr,Vi,tn,ui,wn,hs,y.ah.vertical,["vertical"],Us,sm,_i,Ei));const NA=us?us.boxStartIndex:it.collisionBoxArray.length,VA=us?us.boxEndIndex:it.collisionBoxArray.length,$A=pr?pr.boxStartIndex:it.collisionBoxArray.length,jA=pr?pr.boxEndIndex:it.collisionBoxArray.length,UA=Rr?Rr.boxStartIndex:it.collisionBoxArray.length,HA=Rr?Rr.boxEndIndex:it.collisionBoxArray.length,qA=Wi?Wi.boxStartIndex:it.collisionBoxArray.length,ZA=Wi?Wi.boxEndIndex:it.collisionBoxArray.length;let Zr=-1;const fd=(un,fr)=>un&&un.circleDiameter?Math.max(un.circleDiameter,fr):fr;Zr=fd(us,Zr),Zr=fd(pr,Zr),Zr=fd(Rr,Zr),Zr=fd(Wi,Zr);const ax=Zr>-1?1:0;ax&&(Zr*=Fl/Oi),it.glyphOffsetArray.length>=Ll.MAX_GLYPHS&&Rt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ui.sortKey!==void 0&&it.addToSortKeyRanges(it.symbolInstances.length,ui.sortKey);const WA=K_(Vi,ui,Ei),[GA,YA]=function(un,fr){const wa=un.length,Wr=fr==null?void 0:fr.values;if((Wr==null?void 0:Wr.length)>0)for(let ka=0;ka<Wr.length;ka+=2){const ds=Wr[ka+1];un.emplaceBack(y.aq[Wr[ka]],ds[0],ds[1])}return[wa,un.length]}(it.textAnchorOffsets,WA);it.symbolInstances.emplaceBack(_t.x,_t.y,Us.right>=0?Us.right:-1,Us.center>=0?Us.center:-1,Us.left>=0?Us.left:-1,Us.vertical||-1,rm,sm,sx,NA,VA,$A,jA,UA,HA,qA,ZA,bn,nx,rx,js,gh,ax,0,$i,Zr,GA,YA)}(r,at,Te,s,l,f,Ke,r.layers[0],r.collisionBoxArray,t.index,t.sourceLayerIndex,r.index,K,[fe,fe,fe,fe],qe,S,ge,we,ut,j,t,_,C,P,x)};if(je==="line")for(const Te of j_(t.geometry,0,0,Ri,Ri)){const at=DA(Te,le,Pe,s.vertical||H,l,24,ie,r.overscaling,Ri);for(const it of at)H&&BA(r,H.text,Ve,it)||Ge(Te,it)}else if(je==="line-center"){for(const Te of t.geometry)if(Te.length>1){const at=AA(Te,Pe,s.vertical||H,l,24,ie);at&&Ge(Te,at)}}else if(t.type==="Polygon")for(const Te of el(t.geometry,0)){const at=RA(Te,16);Ge(Te[0],new Do(at.x,at.y,0))}else if(t.type==="LineString")for(const Te of t.geometry)Ge(Te,new Do(Te[0].x,Te[0].y,0));else if(t.type==="Point")for(const Te of t.geometry)for(const at of Te)Ge([at],new Do(at.x,at.y,0))}function J_(r,t,s,l,f,_,x,v,S,C,P,L,F,j,H){const q=function(ge,le,fe,we,Pe,qe,ut,je){const Ve=we.layout.get("text-rotate").evaluate(qe,{})*Math.PI/180,nt=[];for(const Ke of le.positionedLines)for(const Ge of Ke.positionedGlyphs){if(!Ge.rect)continue;const Te=Ge.rect||{};let at=f_+1,it=!0,_t=1,ci=0;const ai=(Pe||je)&&Ge.vertical,Ni=Ge.metrics.advance*Ge.scale/2;if(je&&le.verticalizable&&(ci=Ke.lineOffset/2-(Ge.imageName?-(Oi-Ge.metrics.width*Ge.scale)/2:(Ge.scale-1)*Oi)),Ge.imageName){const qt=ut[Ge.imageName];it=qt.sdf,_t=qt.pixelRatio,at=Rn/_t}const zr=Pe?[Ge.x+Ni,Ge.y]:[0,0];let en=Pe?[0,0]:[Ge.x+Ni+fe[0],Ge.y+fe[1]-ci],Vi=[0,0];ai&&(Vi=en,en=[0,0]);const xn=Ge.metrics.isDoubleResolution?2:1,bn=(Ge.metrics.left-at)*Ge.scale-Ni+en[0],vn=(-Ge.metrics.top-at)*Ge.scale+en[1],Pi=bn+Te.w/xn*Ge.scale/_t,$i=vn+Te.h/xn*Ge.scale/_t,hn=new R(bn,vn),tn=new R(Pi,vn),wn=new R(bn,$i),nn=new R(Pi,$i);if(ai){const qt=new R(-Ni,Ni-ch),ui=-Math.PI/2,_i=Oi/2-Ni,Kn=new R(5-ch-_i,-(Ge.imageName?_i:0)),Ei=new R(...Vi);hn._rotateAround(ui,qt)._add(Kn)._add(Ei),tn._rotateAround(ui,qt)._add(Kn)._add(Ei),wn._rotateAround(ui,qt)._add(Kn)._add(Ei),nn._rotateAround(ui,qt)._add(Kn)._add(Ei)}if(Ve){const qt=Math.sin(Ve),ui=Math.cos(Ve),_i=[ui,-qt,qt,ui];hn._matMult(_i),tn._matMult(_i),wn._matMult(_i),nn._matMult(_i)}const dr=new R(0,0),Ln=new R(0,0);nt.push({tl:hn,tr:tn,bl:wn,br:nn,tex:Te,writingMode:le.writingMode,glyphOffset:zr,sectionIndex:Ge.sectionIndex,isSDF:it,pixelOffsetTL:dr,pixelOffsetBR:Ln,minFontScaleX:0,minFontScaleY:0})}return nt}(0,s,v,f,_,x,l,r.allowVerticalPlacement),K=r.textSizeData;let ie=null;K.kind==="source"?(ie=[cs*f.layout.get("text-size").evaluate(x,{})],ie[0]>Io&&Rt(`${r.layerIds[0]}: Value for "text-size" is >= ${uh}. Reduce your "text-size".`)):K.kind==="composite"&&(ie=[cs*j.compositeTextSizes[0].evaluate(x,{},H),cs*j.compositeTextSizes[1].evaluate(x,{},H)],(ie[0]>Io||ie[1]>Io)&&Rt(`${r.layerIds[0]}: Value for "text-size" is >= ${uh}. Reduce your "text-size".`)),r.addSymbols(r.text,q,ie,v,_,x,C,t,S.lineStartIndex,S.lineLength,F,H);for(const ge of P)L[ge]=r.text.placedSymbolArray.length-1;return 4*q.length}function Q_(r){for(const t in r)return r[t];return null}function BA(r,t,s,l){const f=r.compareText;if(t in f){const _=f[t];for(let x=_.length-1;x>=0;x--)if(l.dist(_[x])<s)return!0}else f[t]=[];return f[t].push(l),!1}const ex=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Kf{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[s,l]=new Uint8Array(t,0,2);if(s!==219)throw new Error("Data does not appear to be in a KDBush format.");const f=l>>4;if(f!==1)throw new Error(`Got v${f} data when expected v1.`);const _=ex[15&l];if(!_)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(t,2,1),[v]=new Uint32Array(t,4,1);return new Kf(v,x,_,t)}constructor(t,s=64,l=Float64Array,f){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+s,2),65535),this.ArrayType=l,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const _=ex.indexOf(this.ArrayType),x=2*t*this.ArrayType.BYTES_PER_ELEMENT,v=t*this.IndexArrayType.BYTES_PER_ELEMENT,S=(8-v%8)%8;if(_<0)throw new Error(`Unexpected typed array class: ${l}.`);f&&f instanceof ArrayBuffer?(this.data=f,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+v+S,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+x+v+S),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+v+S,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+_]),new Uint16Array(this.data,2,1)[0]=s,new Uint32Array(this.data,4,1)[0]=t)}add(t,s){const l=this._pos>>1;return this.ids[l]=l,this.coords[this._pos++]=t,this.coords[this._pos++]=s,l}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Jf(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,s,l,f){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:x,nodeSize:v}=this,S=[0,_.length-1,0],C=[];for(;S.length;){const P=S.pop()||0,L=S.pop()||0,F=S.pop()||0;if(L-F<=v){for(let K=F;K<=L;K++){const ie=x[2*K],ge=x[2*K+1];ie>=t&&ie<=l&&ge>=s&&ge<=f&&C.push(_[K])}continue}const j=F+L>>1,H=x[2*j],q=x[2*j+1];H>=t&&H<=l&&q>=s&&q<=f&&C.push(_[j]),(P===0?t<=H:s<=q)&&(S.push(F),S.push(j-1),S.push(1-P)),(P===0?l>=H:f>=q)&&(S.push(j+1),S.push(L),S.push(1-P))}return C}within(t,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:f,coords:_,nodeSize:x}=this,v=[0,f.length-1,0],S=[],C=l*l;for(;v.length;){const P=v.pop()||0,L=v.pop()||0,F=v.pop()||0;if(L-F<=x){for(let K=F;K<=L;K++)ix(_[2*K],_[2*K+1],t,s)<=C&&S.push(f[K]);continue}const j=F+L>>1,H=_[2*j],q=_[2*j+1];ix(H,q,t,s)<=C&&S.push(f[j]),(P===0?t-l<=H:s-l<=q)&&(v.push(F),v.push(j-1),v.push(1-P)),(P===0?t+l>=H:s+l>=q)&&(v.push(j+1),v.push(L),v.push(1-P))}return S}}function Jf(r,t,s,l,f,_){if(f-l<=s)return;const x=l+f>>1;tx(r,t,x,l,f,_),Jf(r,t,s,l,x-1,1-_),Jf(r,t,s,x+1,f,1-_)}function tx(r,t,s,l,f,_){for(;f>l;){if(f-l>600){const C=f-l+1,P=s-l+1,L=Math.log(C),F=.5*Math.exp(2*L/3),j=.5*Math.sqrt(L*F*(C-F)/C)*(P-C/2<0?-1:1);tx(r,t,s,Math.max(l,Math.floor(s-P*F/C+j)),Math.min(f,Math.floor(s+(C-P)*F/C+j)),_)}const x=t[2*s+_];let v=l,S=f;for(fh(r,t,l,s),t[2*f+_]>x&&fh(r,t,l,f);v<S;){for(fh(r,t,v,S),v++,S--;t[2*v+_]<x;)v++;for(;t[2*S+_]>x;)S--}t[2*l+_]===x?fh(r,t,l,S):(S++,fh(r,t,S,f)),S<=s&&(l=S+1),s<=S&&(f=S-1)}}function fh(r,t,s,l){Qf(r,s,l),Qf(t,2*s,2*l),Qf(t,2*s+1,2*l+1)}function Qf(r,t,s){const l=r[t];r[t]=r[s],r[s]=l}function ix(r,t,s,l){const f=r-s,_=t-l;return f*f+_*_}var em;y.bg=void 0,(em=y.bg||(y.bg={})).create="create",em.load="load",em.fullLoad="fullLoad";let pd=null,mh=[];const tm=1e3/60,im="loadTime",nm="fullLoadTime",FA={mark(r){performance.mark(r)},frame(r){const t=r;pd!=null&&mh.push(t-pd),pd=t},clearMetrics(){pd=null,mh=[],performance.clearMeasures(im),performance.clearMeasures(nm);for(const r in y.bg)performance.clearMarks(y.bg[r])},getPerformanceMetrics(){performance.measure(im,y.bg.create,y.bg.load),performance.measure(nm,y.bg.create,y.bg.fullLoad);const r=performance.getEntriesByName(im)[0].duration,t=performance.getEntriesByName(nm)[0].duration,s=mh.length,l=1/(mh.reduce((_,x)=>_+x,0)/s/1e3),f=mh.filter(_=>_>tm).reduce((_,x)=>_+(x-tm)/tm,0);return{loadTime:r,fullLoadTime:t,fps:l,percentDroppedFrames:f/(s+f)*100,totalFrames:s}}};y.$=class extends O{},y.A=Pl,y.B=uf,y.C=function(r){if(tr==null){const t=r.navigator?r.navigator.userAgent:null;tr=!!r.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return tr},y.D=et,y.E=ri,y.F=class{constructor(r,t){this.target=r,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new PA(()=>this.process()),this.subscription=function(s,l,f,_){return s.addEventListener(l,f,!1),{unsubscribe:()=>{s.removeEventListener(l,f,!1)}}}(this.target,"message",s=>this.receive(s)),this.globalScope=rn(self)?r:window}registerMessageHandler(r,t){this.messageHandlers[r]=t}sendAsync(r,t){return new Promise((s,l)=>{const f=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[f]={resolve:s,reject:l},t&&t.signal.addEventListener("abort",()=>{delete this.resolveRejects[f];const v={id:f,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(v)},{once:!0});const _=[],x=Object.assign(Object.assign({},r),{id:f,sourceMapId:this.mapId,origin:location.origin,data:_o(r.data,_)});this.target.postMessage(x,{transfer:_})})}receive(r){const t=r.data,s=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[s];const l=this.abortControllers[s];return delete this.abortControllers[s],void(l&&l.abort())}if(rn(self)||t.mustQueue)return this.tasks[s]=t,this.taskQueue.push(s),void this.invoker.trigger();this.processTask(s,t)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),t=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(r,t)}processTask(r,t){return h(this,void 0,void 0,function*(){if(t.type==="<response>"){const f=this.resolveRejects[r];return delete this.resolveRejects[r],f?void(t.error?f.reject(xo(t.error)):f.resolve(xo(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const s=xo(t.data),l=new AbortController;this.abortControllers[r]=l;try{const f=yield this.messageHandlers[t.type](t.sourceMapId,s,l);this.completeTask(r,null,f)}catch(f){this.completeTask(r,f)}})}completeTask(r,t,s){const l=[];delete this.abortControllers[r];const f={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?_o(t):null,data:_o(s,l)};this.target.postMessage(f,{transfer:l})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},y.G=Cn,y.H=function(){var r=new Pl(16);return Pl!=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},y.I=Ff,y.J=function(r,t,s){var l,f,_,x,v,S,C,P,L,F,j,H,q=s[0],K=s[1],ie=s[2];return t===r?(r[12]=t[0]*q+t[4]*K+t[8]*ie+t[12],r[13]=t[1]*q+t[5]*K+t[9]*ie+t[13],r[14]=t[2]*q+t[6]*K+t[10]*ie+t[14],r[15]=t[3]*q+t[7]*K+t[11]*ie+t[15]):(f=t[1],_=t[2],x=t[3],v=t[4],S=t[5],C=t[6],P=t[7],L=t[8],F=t[9],j=t[10],H=t[11],r[0]=l=t[0],r[1]=f,r[2]=_,r[3]=x,r[4]=v,r[5]=S,r[6]=C,r[7]=P,r[8]=L,r[9]=F,r[10]=j,r[11]=H,r[12]=l*q+v*K+L*ie+t[12],r[13]=f*q+S*K+F*ie+t[13],r[14]=_*q+C*K+j*ie+t[14],r[15]=x*q+P*K+H*ie+t[15]),r},y.K=function(r,t,s){var l=s[0],f=s[1],_=s[2];return r[0]=t[0]*l,r[1]=t[1]*l,r[2]=t[2]*l,r[3]=t[3]*l,r[4]=t[4]*f,r[5]=t[5]*f,r[6]=t[6]*f,r[7]=t[7]*f,r[8]=t[8]*_,r[9]=t[9]*_,r[10]=t[10]*_,r[11]=t[11]*_,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},y.L=O0,y.M=function(r,t){const s={};for(let l=0;l<t.length;l++){const f=t[l];f in r&&(s[f]=r[f])}return s},y.N=Ao,y.O=A_,y.P=R,y.Q=D_,y.R=hr,y.S=ur,y.T=xl,y.U=he,y.V=be,y.W=jn,y.X=Ri,y.Y=k,y.Z=dh,y._=h,y.a=En,y.a$=function(r,t){var s=r[0],l=r[1],f=r[2],_=r[3],x=r[4],v=r[5],S=r[6],C=r[7],P=r[8],L=r[9],F=r[10],j=r[11],H=r[12],q=r[13],K=r[14],ie=r[15],ge=t[0],le=t[1],fe=t[2],we=t[3],Pe=t[4],qe=t[5],ut=t[6],je=t[7],Ve=t[8],nt=t[9],Ke=t[10],Ge=t[11],Te=t[12],at=t[13],it=t[14],_t=t[15];return Math.abs(s-ge)<=_n*Math.max(1,Math.abs(s),Math.abs(ge))&&Math.abs(l-le)<=_n*Math.max(1,Math.abs(l),Math.abs(le))&&Math.abs(f-fe)<=_n*Math.max(1,Math.abs(f),Math.abs(fe))&&Math.abs(_-we)<=_n*Math.max(1,Math.abs(_),Math.abs(we))&&Math.abs(x-Pe)<=_n*Math.max(1,Math.abs(x),Math.abs(Pe))&&Math.abs(v-qe)<=_n*Math.max(1,Math.abs(v),Math.abs(qe))&&Math.abs(S-ut)<=_n*Math.max(1,Math.abs(S),Math.abs(ut))&&Math.abs(C-je)<=_n*Math.max(1,Math.abs(C),Math.abs(je))&&Math.abs(P-Ve)<=_n*Math.max(1,Math.abs(P),Math.abs(Ve))&&Math.abs(L-nt)<=_n*Math.max(1,Math.abs(L),Math.abs(nt))&&Math.abs(F-Ke)<=_n*Math.max(1,Math.abs(F),Math.abs(Ke))&&Math.abs(j-Ge)<=_n*Math.max(1,Math.abs(j),Math.abs(Ge))&&Math.abs(H-Te)<=_n*Math.max(1,Math.abs(H),Math.abs(Te))&&Math.abs(q-at)<=_n*Math.max(1,Math.abs(q),Math.abs(at))&&Math.abs(K-it)<=_n*Math.max(1,Math.abs(K),Math.abs(it))&&Math.abs(ie-_t)<=_n*Math.max(1,Math.abs(ie),Math.abs(_t))},y.a0=Ft,y.a1=Gf,y.a2=De,y.a3=r=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(s=>{t.onloadstart=()=>{s(t)};for(const l of r){const f=window.document.createElement("source");lt(l)||(t.crossOrigin="Anonymous"),f.src=l,t.appendChild(f)}})},y.a4=function(){return St++},y.a5=Ue,y.a6=Ll,y.a7=Dc,y.a8=ba,y.a9=F_,y.aA=function(r){if(r.type==="custom")return new MA(r);switch(r.type){case"background":return new EA(r);case"circle":return new dI(r);case"fill":return new PI(r);case"fill-extrusion":return new HI(r);case"heatmap":return new fI(r);case"hillshade":return new gI(r);case"line":return new JI(r);case"raster":return new CA(r);case"symbol":return new ld(r)}},y.aB=Mt,y.aC=function(r,t){if(!r)return[{command:"setStyle",args:[t]}];let s=[];try{if(!Zt(r.version,t.version))return[{command:"setStyle",args:[t]}];Zt(r.center,t.center)||s.push({command:"setCenter",args:[t.center]}),Zt(r.zoom,t.zoom)||s.push({command:"setZoom",args:[t.zoom]}),Zt(r.bearing,t.bearing)||s.push({command:"setBearing",args:[t.bearing]}),Zt(r.pitch,t.pitch)||s.push({command:"setPitch",args:[t.pitch]}),Zt(r.sprite,t.sprite)||s.push({command:"setSprite",args:[t.sprite]}),Zt(r.glyphs,t.glyphs)||s.push({command:"setGlyphs",args:[t.glyphs]}),Zt(r.transition,t.transition)||s.push({command:"setTransition",args:[t.transition]}),Zt(r.light,t.light)||s.push({command:"setLight",args:[t.light]}),Zt(r.terrain,t.terrain)||s.push({command:"setTerrain",args:[t.terrain]}),Zt(r.sky,t.sky)||s.push({command:"setSky",args:[t.sky]}),Zt(r.projection,t.projection)||s.push({command:"setProjection",args:[t.projection]});const l={},f=[];(function(x,v,S,C){let P;for(P in v=v||{},x=x||{})Object.prototype.hasOwnProperty.call(x,P)&&(Object.prototype.hasOwnProperty.call(v,P)||is(P,S,C));for(P in v)Object.prototype.hasOwnProperty.call(v,P)&&(Object.prototype.hasOwnProperty.call(x,P)?Zt(x[P],v[P])||(x[P].type==="geojson"&&v[P].type==="geojson"&&Js(x,v,P)?ki(S,{command:"setGeoJSONSourceData",args:[P,v[P].data]}):$r(P,v,S,C)):Yo(P,v,S))})(r.sources,t.sources,f,l);const _=[];r.layers&&r.layers.forEach(x=>{"source"in x&&l[x.source]?s.push({command:"removeLayer",args:[x.id]}):_.push(x)}),s=s.concat(f),function(x,v,S){v=v||[];const C=(x=x||[]).map(Xo),P=v.map(Xo),L=x.reduce(Ko,{}),F=v.reduce(Ko,{}),j=C.slice(),H=Object.create(null);let q,K,ie,ge,le;for(let fe=0,we=0;fe<C.length;fe++)q=C[fe],Object.prototype.hasOwnProperty.call(F,q)?we++:(ki(S,{command:"removeLayer",args:[q]}),j.splice(j.indexOf(q,we),1));for(let fe=0,we=0;fe<P.length;fe++)q=P[P.length-1-fe],j[j.length-1-fe]!==q&&(Object.prototype.hasOwnProperty.call(L,q)?(ki(S,{command:"removeLayer",args:[q]}),j.splice(j.lastIndexOf(q,j.length-we),1)):we++,ge=j[j.length-fe],ki(S,{command:"addLayer",args:[F[q],ge]}),j.splice(j.length-fe,0,q),H[q]=!0);for(let fe=0;fe<P.length;fe++)if(q=P[fe],K=L[q],ie=F[q],!H[q]&&!Zt(K,ie))if(Zt(K.source,ie.source)&&Zt(K["source-layer"],ie["source-layer"])&&Zt(K.type,ie.type)){for(le in Un(K.layout,ie.layout,S,q,null,"setLayoutProperty"),Un(K.paint,ie.paint,S,q,null,"setPaintProperty"),Zt(K.filter,ie.filter)||ki(S,{command:"setFilter",args:[q,ie.filter]}),Zt(K.minzoom,ie.minzoom)&&Zt(K.maxzoom,ie.maxzoom)||ki(S,{command:"setLayerZoomRange",args:[q,ie.minzoom,ie.maxzoom]}),K)Object.prototype.hasOwnProperty.call(K,le)&&le!=="layout"&&le!=="paint"&&le!=="filter"&&le!=="metadata"&&le!=="minzoom"&&le!=="maxzoom"&&(le.indexOf("paint.")===0?Un(K[le],ie[le],S,q,le.slice(6),"setPaintProperty"):Zt(K[le],ie[le])||ki(S,{command:"setLayerProperty",args:[q,le,ie[le]]}));for(le in ie)Object.prototype.hasOwnProperty.call(ie,le)&&!Object.prototype.hasOwnProperty.call(K,le)&&le!=="layout"&&le!=="paint"&&le!=="filter"&&le!=="metadata"&&le!=="minzoom"&&le!=="maxzoom"&&(le.indexOf("paint.")===0?Un(K[le],ie[le],S,q,le.slice(6),"setPaintProperty"):Zt(K[le],ie[le])||ki(S,{command:"setLayerProperty",args:[q,le,ie[le]]}))}else ki(S,{command:"removeLayer",args:[q]}),ge=j[j.lastIndexOf(q)+1],ki(S,{command:"addLayer",args:[ie,ge]})}(_,t.layers,s)}catch(l){console.warn("Unable to compute style diff:",l),s=[{command:"setStyle",args:[t]}]}return s},y.aD=function(r){const t=[],s=r.id;return s===void 0&&t.push({message:`layers.${s}: missing required property "id"`}),r.render===void 0&&t.push({message:`layers.${s}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&t.push({message:`layers.${s}: property "renderingMode" must be either "2d" or "3d"`}),t},y.aE=function r(t,s){if(Array.isArray(t)){if(!Array.isArray(s)||t.length!==s.length)return!1;for(let l=0;l<t.length;l++)if(!r(t[l],s[l]))return!1;return!0}if(typeof t=="object"&&t!==null&&s!==null){if(typeof s!="object"||Object.keys(t).length!==Object.keys(s).length)return!1;for(const l in t)if(!r(t[l],s[l]))return!1;return!0}return t===s},y.aF=rt,y.aG=Dt,y.aH=class extends ya{constructor(r,t){super(r,t),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},y.aI=Yu,y.aJ=class extends ya{constructor(r,t){super(r,t),this.current=rI}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 t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},y.aK=E0,y.aL=T0,y.aM=ti,y.aN=class extends ya{constructor(r,t){super(r,t),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]))}},y.aO=class extends ya{constructor(r,t){super(r,t),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]))}},y.aP=function(r,t,s,l,f,_,x){var v=1/(t-s),S=1/(l-f),C=1/(_-x);return r[0]=-2*v,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*S,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*C,r[11]=0,r[12]=(t+s)*v,r[13]=(f+l)*S,r[14]=(x+_)*C,r[15]=1,r},y.aQ=uI,y.aR=class extends ue{},y.aS=iA,y.aT=class extends ye{},y.aU=Tf,y.aV=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},y.aW=$0,y.aX=Ki,y.aY=cr,y.aZ=class extends tt{},y.a_=function(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]},y.aa=function(r){const t={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(s,l,f,_)=>{const x=f||_;return t[l]=!x||x.toLowerCase(),""}),t["max-age"]){const s=parseInt(t["max-age"],10);isNaN(s)?delete t["max-age"]:t["max-age"]=s}return t},y.ab=function(r,t){const s=[];for(const l in r)l in t||s.push(l);return s},y.ac=ot,y.ad=function(r,t,s){var l=Math.sin(s),f=Math.cos(s),_=t[0],x=t[1],v=t[2],S=t[3],C=t[4],P=t[5],L=t[6],F=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=_*f+C*l,r[1]=x*f+P*l,r[2]=v*f+L*l,r[3]=S*f+F*l,r[4]=C*f-_*l,r[5]=P*f-x*l,r[6]=L*f-v*l,r[7]=F*f-S*l,r},y.ae=function(r){var t=new Pl(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},y.af=Qu,y.ag=function(r,t){let s=0,l=0;if(r.kind==="constant")l=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:f,minZoom:_,maxZoom:x}=r,v=f?ot(gn.interpolationFactor(f,t,_,x),0,1):0;r.kind==="camera"?l=mn.number(r.minSize,r.maxSize,v):s=v}return{uSizeT:s,uSize:l}},y.ai=function(r,{uSize:t,uSizeT:s},{lowerSize:l,upperSize:f}){return r.kind==="source"?l/cs:r.kind==="composite"?mn.number(l/cs,f/cs,s):t},y.aj=jf,y.ak=function(r,t,s,l){const f=t.y-r.y,_=t.x-r.x,x=l.y-s.y,v=l.x-s.x,S=x*_-v*f;if(S===0)return null;const C=(v*(r.y-s.y)-x*(r.x-s.x))/S;return new R(r.x+C*_,r.y+C*f)},y.al=j_,y.am=I0,y.an=kf,y.ao=function(r){let t=1/0,s=1/0,l=-1/0,f=-1/0;for(const _ of r)t=Math.min(t,_.x),s=Math.min(s,_.y),l=Math.max(l,_.x),f=Math.max(f,_.y);return[t,s,l,f]},y.ap=Oi,y.ar=$f,y.as=function(r,t){var s=t[0],l=t[1],f=t[2],_=t[3],x=t[4],v=t[5],S=t[6],C=t[7],P=t[8],L=t[9],F=t[10],j=t[11],H=t[12],q=t[13],K=t[14],ie=t[15],ge=s*v-l*x,le=s*S-f*x,fe=s*C-_*x,we=l*S-f*v,Pe=l*C-_*v,qe=f*C-_*S,ut=P*q-L*H,je=P*K-F*H,Ve=P*ie-j*H,nt=L*K-F*q,Ke=L*ie-j*q,Ge=F*ie-j*K,Te=ge*Ge-le*Ke+fe*nt+we*Ve-Pe*je+qe*ut;return Te?(r[0]=(v*Ge-S*Ke+C*nt)*(Te=1/Te),r[1]=(f*Ke-l*Ge-_*nt)*Te,r[2]=(q*qe-K*Pe+ie*we)*Te,r[3]=(F*Pe-L*qe-j*we)*Te,r[4]=(S*Ve-x*Ge-C*je)*Te,r[5]=(s*Ge-f*Ve+_*je)*Te,r[6]=(K*fe-H*qe-ie*le)*Te,r[7]=(P*qe-F*fe+j*le)*Te,r[8]=(x*Ke-v*Ve+C*ut)*Te,r[9]=(l*Ve-s*Ke-_*ut)*Te,r[10]=(H*Pe-q*fe+ie*ge)*Te,r[11]=(L*fe-P*Pe-j*ge)*Te,r[12]=(v*je-x*nt-S*ut)*Te,r[13]=(s*nt-l*je+f*ut)*Te,r[14]=(q*le-H*we-K*ge)*Te,r[15]=(P*we-L*le+F*ge)*Te,r):null},y.at=Xf,y.au=Vf,y.av=Kf,y.aw=function(){const r={},t=xe.$version;for(const s in xe.$root){const l=xe.$root[s];if(l.required){let f=null;f=s==="version"?t:l.type==="array"?[]:{},f!=null&&(r[s]=f)}}return r},y.ax=Zc,y.ay=He,y.az=function(r){r=r.slice();const t=Object.create(null);for(let s=0;s<r.length;s++)t[r[s].id]=r[s];for(let s=0;s<r.length;s++)"ref"in r[s]&&(r[s]=Go(r[s],t[r[s].ref]));return r},y.b=Ui,y.b0=function(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},y.b1=function(r,t,s){return r[0]=t[0]*s[0],r[1]=t[1]*s[1],r[2]=t[2]*s[2],r[3]=t[3]*s[3],r},y.b2=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]*t[3]},y.b3=Qe,y.b4=L_,y.b5=z_,y.b6=function(r,t,s,l,f){var _,x=1/Math.tan(t/2);return r[0]=x/s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=x,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,f!=null&&f!==1/0?(r[10]=(f+l)*(_=1/(l-f)),r[14]=2*f*l*_):(r[10]=-1,r[14]=-2*l),r},y.b7=function(r,t,s){var l=Math.sin(s),f=Math.cos(s),_=t[4],x=t[5],v=t[6],S=t[7],C=t[8],P=t[9],L=t[10],F=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=_*f+C*l,r[5]=x*f+P*l,r[6]=v*f+L*l,r[7]=S*f+F*l,r[8]=C*f-_*l,r[9]=P*f-x*l,r[10]=L*f-v*l,r[11]=F*f-S*l,r},y.b8=_e,y.b9=Ie,y.bA=a_,y.bB=function(r){return r.message===sn},y.bC=ho,y.bD=Dn,y.ba=function(r){return r*Math.PI/180},y.bb=function(r,t){const{x:s,y:l}=dh.fromLngLat(t);return!(r<0||r>25||l<0||l>=1||s<0||s>=1)},y.bc=function(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},y.bd=class extends I{},y.be=Zf,y.bf=FA,y.bh=Se,y.bi=function(r,t){En.REGISTERED_PROTOCOLS[r]=t},y.bj=function(r){delete En.REGISTERED_PROTOCOLS[r]},y.bk=function(r,t){const s={};for(let f=0;f<r.length;f++){const _=t&&t[r[f].id]||Bu(r[f]);t&&(t[r[f].id]=_);let x=s[_];x||(x=s[_]=[]),x.push(r[f])}const l=[];for(const f in s)l.push(s[f]);return l},y.bl=Xe,y.bm=B_,y.bn=N_,y.bo=g_,y.bp=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=Ri/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const t=r.bucket.layers[0],s=t.layout,l=t._unevaluatedLayout._values,f={layoutIconSize:l["icon-size"].possiblyEvaluate(new fi(r.bucket.zoom+1),r.canonical),layoutTextSize:l["text-size"].possiblyEvaluate(new fi(r.bucket.zoom+1),r.canonical),textMaxSize:l["text-size"].possiblyEvaluate(new fi(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:C,maxZoom:P}=r.bucket.textSizeData;f.compositeTextSizes=[l["text-size"].possiblyEvaluate(new fi(C),r.canonical),l["text-size"].possiblyEvaluate(new fi(P),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:C,maxZoom:P}=r.bucket.iconSizeData;f.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new fi(C),r.canonical),l["icon-size"].possiblyEvaluate(new fi(P),r.canonical)]}const _=s.get("text-line-height")*Oi,x=s.get("text-rotation-alignment")!=="viewport"&&s.get("symbol-placement")!=="point",v=s.get("text-keep-upright"),S=s.get("text-size");for(const C of r.bucket.features){const P=s.get("text-font").evaluate(C,{},r.canonical).join(","),L=S.evaluate(C,{},r.canonical),F=f.layoutTextSize.evaluate(C,{},r.canonical),j=f.layoutIconSize.evaluate(C,{},r.canonical),H={horizontal:{},vertical:void 0},q=C.text;let K,ie=[0,0];if(q){const fe=q.toString(),we=s.get("text-letter-spacing").evaluate(C,{},r.canonical)*Oi,Pe=df(fe)?we:0,qe=s.get("text-anchor").evaluate(C,{},r.canonical),ut=K_(t,C,r.canonical);if(!ut){const Ke=s.get("text-radial-offset").evaluate(C,{},r.canonical);ie=Ke?X_(qe,[Ke*Oi,Yf]):s.get("text-offset").evaluate(C,{},r.canonical).map(Ge=>Ge*Oi)}let je=x?"center":s.get("text-justify").evaluate(C,{},r.canonical);const Ve=s.get("symbol-placement")==="point"?s.get("text-max-width").evaluate(C,{},r.canonical)*Oi:1/0,nt=()=>{r.bucket.allowVerticalPlacement&&Wc(fe)&&(H.vertical=sd(q,r.glyphMap,r.glyphPositions,r.imagePositions,P,Ve,_,qe,"left",Pe,ie,y.ah.vertical,!0,F,L))};if(!x&&ut){const Ke=new Set;if(je==="auto")for(let Te=0;Te<ut.values.length;Te+=2)Ke.add(Xf(ut.values[Te]));else Ke.add(je);let Ge=!1;for(const Te of Ke)if(!H.horizontal[Te])if(Ge)H.horizontal[Te]=H.horizontal[0];else{const at=sd(q,r.glyphMap,r.glyphPositions,r.imagePositions,P,Ve,_,"center",Te,Pe,ie,y.ah.horizontal,!1,F,L);at&&(H.horizontal[Te]=at,Ge=at.positionedLines.length===1)}nt()}else{je==="auto"&&(je=Xf(qe));const Ke=sd(q,r.glyphMap,r.glyphPositions,r.imagePositions,P,Ve,_,qe,je,Pe,ie,y.ah.horizontal,!1,F,L);Ke&&(H.horizontal[je]=Ke),nt(),Wc(fe)&&x&&v&&(H.vertical=sd(q,r.glyphMap,r.glyphPositions,r.imagePositions,P,Ve,_,qe,je,Pe,ie,y.ah.vertical,!1,F,L))}}let ge=!1;if(C.icon&&C.icon.name){const fe=r.imageMap[C.icon.name];fe&&(K=bA(r.imagePositions[C.icon.name],s.get("icon-offset").evaluate(C,{},r.canonical),s.get("icon-anchor").evaluate(C,{},r.canonical)),ge=!!fe.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=ge:r.bucket.sdfIcons!==ge&&Rt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(fe.pixelRatio!==r.bucket.pixelRatio||s.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const le=Q_(H.horizontal)||H.vertical;r.bucket.iconsInText=!!le&&le.iconsInText,(le||K)&&OA(r.bucket,C,H,K,r.imageMap,f,F,j,ie,ge,r.canonical)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},y.bq=Rf,y.br=Af,y.bs=zf,y.bt=Mo,y.bu=Of,y.bv=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}},y.bw=function(r,t,s,l,f){return h(this,void 0,void 0,function*(){if(be())try{return yield jn(r,t,s,l,f)}catch{}return function(_,x,v,S,C){const P=_.width,L=_.height;Sn&&Hi||(Sn=new OffscreenCanvas(P,L),Hi=Sn.getContext("2d",{willReadFrequently:!0})),Sn.width=P,Sn.height=L,Hi.drawImage(_,0,0,P,L);const F=Hi.getImageData(x,v,S,C);return Hi.clearRect(0,0,P,L),F.data}(r,t,s,l,f)})},y.bx=O_,y.by=M,y.bz=D,y.c=Sr,y.d=r=>h(void 0,void 0,void 0,function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(t)}catch(s){throw new Error(`Could not load image because of ${s.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),y.e=Be,y.f=r=>new Promise((t,s)=>{const l=new Image;l.onload=()=>{t(l),URL.revokeObjectURL(l.src),l.onload=null,window.requestAnimationFrame(()=>{l.src=kr})},l.onerror=()=>s(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const f=new Blob([new Uint8Array(r)],{type:"image/png"});l.src=r.byteLength?URL.createObjectURL(f):kr}),y.g=Tn,y.h=(r,t)=>Ze(Be(r,{type:"json"}),t),y.i=rn,y.j=vt,y.k=Et,y.l=(r,t)=>Ze(Be(r,{type:"arrayBuffer"}),t),y.m=Ze,y.n=function(r){return new Of(r).readFields(pA,[])},y.o=ih,y.p=m_,y.q=g,y.r=hf,y.s=lt,y.t=Hc,y.u=Fs,y.v=xe,y.w=Rt,y.x=function([r,t,s]){return t+=90,t*=Math.PI/180,s*=Math.PI/180,{x:r*Math.cos(t)*Math.sin(s),y:r*Math.sin(t)*Math.sin(s),z:r*Math.cos(s)}},y.y=mn,y.z=fi}),p("worker",["./shared"],function(y){class h{constructor($){this.keyCache={},$&&this.replace($)}replace($){this._layerConfigs={},this._layers={},this.update($,[])}update($,V){for(const J of $){this._layerConfigs[J.id]=J;const ce=this._layers[J.id]=y.aA(J);ce._featureFilter=y.a7(ce.filter),this.keyCache[J.id]&&delete this.keyCache[J.id]}for(const J of V)delete this.keyCache[J],delete this._layerConfigs[J],delete this._layers[J];this.familiesBySource={};const W=y.bk(Object.values(this._layerConfigs),this.keyCache);for(const J of W){const ce=J.map(ve=>this._layers[ve.id]),de=ce[0];if(de.visibility==="none")continue;const me=de.source||"";let se=this.familiesBySource[me];se||(se=this.familiesBySource[me]={});const ke=de.sourceLayer||"_geojsonTileLayer";let Me=se[ke];Me||(Me=se[ke]=[]),Me.push(ce)}}}class M{constructor($){const V={},W=[];for(const me in $){const se=$[me],ke=V[me]={};for(const Me in se){const ve=se[+Me];if(!ve||ve.bitmap.width===0||ve.bitmap.height===0)continue;const Re={x:0,y:0,w:ve.bitmap.width+2,h:ve.bitmap.height+2};W.push(Re),ke[Me]={rect:Re,metrics:ve.metrics}}}const{w:J,h:ce}=y.p(W),de=new y.o({width:J||1,height:ce||1});for(const me in $){const se=$[me];for(const ke in se){const Me=se[+ke];if(!Me||Me.bitmap.width===0||Me.bitmap.height===0)continue;const ve=V[me][ke].rect;y.o.copy(Me.bitmap,de,{x:0,y:0},{x:ve.x+1,y:ve.y+1},Me.bitmap)}}this.image=de,this.positions=V}}y.bl("GlyphAtlas",M);class D{constructor($){this.tileID=new y.S($.tileID.overscaledZ,$.tileID.wrap,$.tileID.canonical.z,$.tileID.canonical.x,$.tileID.canonical.y),this.uid=$.uid,this.zoom=$.zoom,this.pixelRatio=$.pixelRatio,this.tileSize=$.tileSize,this.source=$.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=$.showCollisionBoxes,this.collectResourceTiming=!!$.collectResourceTiming,this.returnDependencies=!!$.returnDependencies,this.promoteId=$.promoteId,this.inFlightDependencies=[]}parse($,V,W,J){return y._(this,void 0,void 0,function*(){this.status="parsing",this.data=$,this.collisionBoxArray=new y.a5;const ce=new y.bm(Object.keys($.layers).sort()),de=new y.bn(this.tileID,this.promoteId);de.bucketLayerIDs=[];const me={},se={featureIndex:de,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:W},ke=V.familiesBySource[this.source];for(const Pt in ke){const ei=$.layers[Pt];if(!ei)continue;ei.version===1&&y.w(`Vector tile source "${this.source}" layer "${Pt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const xi=ce.encode(Pt),Fi=[];for(let qi=0;qi<ei.length;qi++){const an=ei.feature(qi),Qs=de.getId(an,Pt);Fi.push({feature:an,id:Qs,index:qi,sourceLayerIndex:xi})}for(const qi of ke[Pt]){const an=qi[0];an.source!==this.source&&y.w(`layer.source = ${an.source} does not equal this.source = ${this.source}`),an.minzoom&&this.zoom<Math.floor(an.minzoom)||an.maxzoom&&this.zoom>=an.maxzoom||an.visibility!=="none"&&(A(qi,this.zoom,W),(me[an.id]=an.createBucket({index:de.bucketLayerIDs.length,layers:qi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:xi,sourceID:this.source})).populate(Fi,se,this.tileID.canonical),de.bucketLayerIDs.push(qi.map(Qs=>Qs.id)))}}const Me=y.aF(se.glyphDependencies,Pt=>Object.keys(Pt).map(Number));this.inFlightDependencies.forEach(Pt=>Pt==null?void 0:Pt.abort()),this.inFlightDependencies=[];let ve=Promise.resolve({});if(Object.keys(Me).length){const Pt=new AbortController;this.inFlightDependencies.push(Pt),ve=J.sendAsync({type:"GG",data:{stacks:Me,source:this.source,tileID:this.tileID,type:"glyphs"}},Pt)}const Re=Object.keys(se.iconDependencies);let ct=Promise.resolve({});if(Re.length){const Pt=new AbortController;this.inFlightDependencies.push(Pt),ct=J.sendAsync({type:"GI",data:{icons:Re,source:this.source,tileID:this.tileID,type:"icons"}},Pt)}const ht=Object.keys(se.patternDependencies);let $t=Promise.resolve({});if(ht.length){const Pt=new AbortController;this.inFlightDependencies.push(Pt),$t=J.sendAsync({type:"GI",data:{icons:ht,source:this.source,tileID:this.tileID,type:"patterns"}},Pt)}const[wt,jt,Lt]=yield Promise.all([ve,ct,$t]),Di=new M(wt),Si=new y.bo(jt,Lt);for(const Pt in me){const ei=me[Pt];ei instanceof y.a6?(A(ei.layers,this.zoom,W),y.bp({bucket:ei,glyphMap:wt,glyphPositions:Di.positions,imageMap:jt,imagePositions:Si.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ei.hasPattern&&(ei instanceof y.bq||ei instanceof y.br||ei instanceof y.bs)&&(A(ei.layers,this.zoom,W),ei.addFeatures(se,this.tileID.canonical,Si.patternPositions))}return this.status="done",{buckets:Object.values(me).filter(Pt=>!Pt.isEmpty()),featureIndex:de,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Di.image,imageAtlas:Si,glyphMap:this.returnDependencies?wt:null,iconMap:this.returnDependencies?jt:null,glyphPositions:this.returnDependencies?Di.positions:null}})}}function A(ee,$,V){const W=new y.z($);for(const J of ee)J.recalculate(W,V)}class R{constructor($,V,W){this.actor=$,this.layerIndex=V,this.availableImages=W,this.fetching={},this.loading={},this.loaded={}}loadVectorTile($,V){return y._(this,void 0,void 0,function*(){const W=yield y.l($.request,V);try{return{vectorTile:new y.bt.VectorTile(new y.bu(W.data)),rawData:W.data,cacheControl:W.cacheControl,expires:W.expires}}catch(J){const ce=new Uint8Array(W.data);let de=`Unable to parse the tile at ${$.request.url}, `;throw de+=ce[0]===31&&ce[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${J.message}`,new Error(de)}})}loadTile($){return y._(this,void 0,void 0,function*(){const V=$.uid,W=!!($&&$.request&&$.request.collectResourceTiming)&&new y.bv($.request),J=new D($);this.loading[V]=J;const ce=new AbortController;J.abort=ce;try{const de=yield this.loadVectorTile($,ce);if(delete this.loading[V],!de)return null;const me=de.rawData,se={};de.expires&&(se.expires=de.expires),de.cacheControl&&(se.cacheControl=de.cacheControl);const ke={};if(W){const ve=W.finish();ve&&(ke.resourceTiming=JSON.parse(JSON.stringify(ve)))}J.vectorTile=de.vectorTile;const Me=J.parse(de.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[V]=J,this.fetching[V]={rawTileData:me,cacheControl:se,resourceTiming:ke};try{const ve=yield Me;return y.e({rawTileData:me.slice(0)},ve,se,ke)}finally{delete this.fetching[V]}}catch(de){throw delete this.loading[V],J.status="done",this.loaded[V]=J,de}})}reloadTile($){return y._(this,void 0,void 0,function*(){const V=$.uid;if(!this.loaded||!this.loaded[V])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const W=this.loaded[V];if(W.showCollisionBoxes=$.showCollisionBoxes,W.status==="parsing"){const J=yield W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor);let ce;if(this.fetching[V]){const{rawTileData:de,cacheControl:me,resourceTiming:se}=this.fetching[V];delete this.fetching[V],ce=y.e({rawTileData:de.slice(0)},J,me,se)}else ce=J;return ce}if(W.status==="done"&&W.vectorTile)return W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile($){return y._(this,void 0,void 0,function*(){const V=this.loading,W=$.uid;V&&V[W]&&V[W].abort&&(V[W].abort.abort(),delete V[W])})}removeTile($){return y._(this,void 0,void 0,function*(){this.loaded&&this.loaded[$.uid]&&delete this.loaded[$.uid]})}}class z{constructor(){this.loaded={}}loadTile($){return y._(this,void 0,void 0,function*(){const{uid:V,encoding:W,rawImageData:J,redFactor:ce,greenFactor:de,blueFactor:me,baseShift:se}=$,ke=J.width+2,Me=J.height+2,ve=y.b(J)?new y.R({width:ke,height:Me},yield y.bw(J,-1,-1,ke,Me)):J,Re=new y.bx(V,ve,W,ce,de,me,se);return this.loaded=this.loaded||{},this.loaded[V]=Re,Re})}removeTile($){const V=this.loaded,W=$.uid;V&&V[W]&&delete V[W]}}function N(ee,$){if(ee.length!==0){Y(ee[0],$);for(var V=1;V<ee.length;V++)Y(ee[V],!$)}}function Y(ee,$){for(var V=0,W=0,J=0,ce=ee.length,de=ce-1;J<ce;de=J++){var me=(ee[J][0]-ee[de][0])*(ee[de][1]+ee[J][1]),se=V+me;W+=Math.abs(V)>=Math.abs(me)?V-se+me:me-se+V,V=se}V+W>=0!=!!$&&ee.reverse()}var te=y.by(function ee($,V){var W,J=$&&$.type;if(J==="FeatureCollection")for(W=0;W<$.features.length;W++)ee($.features[W],V);else if(J==="GeometryCollection")for(W=0;W<$.geometries.length;W++)ee($.geometries[W],V);else if(J==="Feature")ee($.geometry,V);else if(J==="Polygon")N($.coordinates,V);else if(J==="MultiPolygon")for(W=0;W<$.coordinates.length;W++)N($.coordinates[W],V);return $});const ae=y.bt.VectorTileFeature.prototype.toGeoJSON;var he={exports:{}},be=y.bz,_e=y.bt.VectorTileFeature,Ie=ot;function ot(ee,$){this.options=$||{},this.features=ee,this.length=ee.length}function Qe(ee,$){this.id=typeof ee.id=="number"?ee.id:void 0,this.type=ee.type,this.rawGeometry=ee.type===1?[ee.geometry]:ee.geometry,this.properties=ee.tags,this.extent=$||4096}ot.prototype.feature=function(ee){return new Qe(this.features[ee],this.options.extent)},Qe.prototype.loadGeometry=function(){var ee=this.rawGeometry;this.geometry=[];for(var $=0;$<ee.length;$++){for(var V=ee[$],W=[],J=0;J<V.length;J++)W.push(new be(V[J][0],V[J][1]));this.geometry.push(W)}return this.geometry},Qe.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var ee=this.geometry,$=1/0,V=-1/0,W=1/0,J=-1/0,ce=0;ce<ee.length;ce++)for(var de=ee[ce],me=0;me<de.length;me++){var se=de[me];$=Math.min($,se.x),V=Math.max(V,se.x),W=Math.min(W,se.y),J=Math.max(J,se.y)}return[$,W,V,J]},Qe.prototype.toGeoJSON=_e.prototype.toGeoJSON;var Be=y.bA,St=Ie;function rt(ee){var $=new Be;return function(V,W){for(var J in V.layers)W.writeMessage(3,Dt,V.layers[J])}(ee,$),$.finish()}function Dt(ee,$){var V;$.writeVarintField(15,ee.version||1),$.writeStringField(1,ee.name||""),$.writeVarintField(5,ee.extent||4096);var W={keys:[],values:[],keycache:{},valuecache:{}};for(V=0;V<ee.length;V++)W.feature=ee.feature(V),$.writeMessage(2,Mt,W);var J=W.keys;for(V=0;V<J.length;V++)$.writeStringField(3,J[V]);var ce=W.values;for(V=0;V<ce.length;V++)$.writeMessage(4,tr,ce[V])}function Mt(ee,$){var V=ee.feature;V.id!==void 0&&$.writeVarintField(1,V.id),$.writeMessage(2,kn,ee),$.writeVarintField(3,V.type),$.writeMessage(4,rn,V)}function kn(ee,$){var V=ee.feature,W=ee.keys,J=ee.values,ce=ee.keycache,de=ee.valuecache;for(var me in V.properties){var se=V.properties[me],ke=ce[me];if(se!==null){ke===void 0&&(W.push(me),ce[me]=ke=W.length-1),$.writeVarint(ke);var Me=typeof se;Me!=="string"&&Me!=="boolean"&&Me!=="number"&&(se=JSON.stringify(se));var ve=Me+":"+se,Re=de[ve];Re===void 0&&(J.push(se),de[ve]=Re=J.length-1),$.writeVarint(Re)}}}function Rt(ee,$){return($<<3)+(7&ee)}function pi(ee){return ee<<1^ee>>31}function rn(ee,$){for(var V=ee.loadGeometry(),W=ee.type,J=0,ce=0,de=V.length,me=0;me<de;me++){var se=V[me],ke=1;W===1&&(ke=se.length),$.writeVarint(Rt(1,ke));for(var Me=W===3?se.length-1:se.length,ve=0;ve<Me;ve++){ve===1&&W!==1&&$.writeVarint(Rt(2,Me-1));var Re=se[ve].x-J,ct=se[ve].y-ce;$.writeVarint(pi(Re)),$.writeVarint(pi(ct)),J+=Re,ce+=ct}W===3&&$.writeVarint(Rt(7,1))}}function tr(ee,$){var V=typeof ee;V==="string"?$.writeStringField(1,ee):V==="boolean"?$.writeBooleanField(7,ee):V==="number"&&(ee%1!=0?$.writeDoubleField(3,ee):ee<0?$.writeSVarintField(6,ee):$.writeVarintField(5,ee))}he.exports=rt,he.exports.fromVectorTileJs=rt,he.exports.fromGeojsonVt=function(ee,$){$=$||{};var V={};for(var W in ee)V[W]=new St(ee[W].features,$),V[W].name=W,V[W].version=$.version,V[W].extent=$.extent;return rt({layers:V})},he.exports.GeoJSONWrapper=St;var Ui=y.by(he.exports);const kr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ee=>ee},jn=Math.fround||(Sn=new Float32Array(1),ee=>(Sn[0]=+ee,Sn[0]));var Sn;const Hi=3,sn=5,Sr=6;class En{constructor($){this.options=Object.assign(Object.create(kr),$),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load($){const{log:V,minZoom:W,maxZoom:J}=this.options;V&&console.time("total time");const ce=`prepare ${$.length} points`;V&&console.time(ce),this.points=$;const de=[];for(let se=0;se<$.length;se++){const ke=$[se];if(!ke.geometry)continue;const[Me,ve]=ke.geometry.coordinates,Re=jn(Se(Me)),ct=jn(He(ve));de.push(Re,ct,1/0,se,-1,1),this.options.reduce&&de.push(0)}let me=this.trees[J+1]=this._createTree(de);V&&console.timeEnd(ce);for(let se=J;se>=W;se--){const ke=+Date.now();me=this.trees[se]=this._createTree(this._cluster(me,se)),V&&console.log("z%d: %d clusters in %dms",se,me.numItems,+Date.now()-ke)}return V&&console.timeEnd("total time"),this}getClusters($,V){let W=(($[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,$[1]));let ce=$[2]===180?180:(($[2]+180)%360+360)%360-180;const de=Math.max(-90,Math.min(90,$[3]));if($[2]-$[0]>=360)W=-180,ce=180;else if(W>ce){const ve=this.getClusters([W,J,180,de],V),Re=this.getClusters([-180,J,ce,de],V);return ve.concat(Re)}const me=this.trees[this._limitZoom(V)],se=me.range(Se(W),He(de),Se(ce),He(J)),ke=me.data,Me=[];for(const ve of se){const Re=this.stride*ve;Me.push(ke[Re+sn]>1?Tn(ke,Re,this.clusterProps):this.points[ke[Re+Hi]])}return Me}getChildren($){const V=this._getOriginId($),W=this._getOriginZoom($),J="No cluster with the specified id.",ce=this.trees[W];if(!ce)throw new Error(J);const de=ce.data;if(V*this.stride>=de.length)throw new Error(J);const me=this.options.radius/(this.options.extent*Math.pow(2,W-1)),se=ce.within(de[V*this.stride],de[V*this.stride+1],me),ke=[];for(const Me of se){const ve=Me*this.stride;de[ve+4]===$&&ke.push(de[ve+sn]>1?Tn(de,ve,this.clusterProps):this.points[de[ve+Hi]])}if(ke.length===0)throw new Error(J);return ke}getLeaves($,V,W){const J=[];return this._appendLeaves(J,$,V=V||10,W=W||0,0),J}getTile($,V,W){const J=this.trees[this._limitZoom($)],ce=Math.pow(2,$),{extent:de,radius:me}=this.options,se=me/de,ke=(W-se)/ce,Me=(W+1+se)/ce,ve={features:[]};return this._addTileFeatures(J.range((V-se)/ce,ke,(V+1+se)/ce,Me),J.data,V,W,ce,ve),V===0&&this._addTileFeatures(J.range(1-se/ce,ke,1,Me),J.data,ce,W,ce,ve),V===ce-1&&this._addTileFeatures(J.range(0,ke,se/ce,Me),J.data,-1,W,ce,ve),ve.features.length?ve:null}getClusterExpansionZoom($){let V=this._getOriginZoom($)-1;for(;V<=this.options.maxZoom;){const W=this.getChildren($);if(V++,W.length!==1)break;$=W[0].properties.cluster_id}return V}_appendLeaves($,V,W,J,ce){const de=this.getChildren(V);for(const me of de){const se=me.properties;if(se&&se.cluster?ce+se.point_count<=J?ce+=se.point_count:ce=this._appendLeaves($,se.cluster_id,W,J,ce):ce<J?ce++:$.push(me),$.length===W)break}return ce}_createTree($){const V=new y.av($.length/this.stride|0,this.options.nodeSize,Float32Array);for(let W=0;W<$.length;W+=this.stride)V.add($[W],$[W+1]);return V.finish(),V.data=$,V}_addTileFeatures($,V,W,J,ce,de){for(const me of $){const se=me*this.stride,ke=V[se+sn]>1;let Me,ve,Re;if(ke)Me=Cn(V,se,this.clusterProps),ve=V[se],Re=V[se+1];else{const $t=this.points[V[se+Hi]];Me=$t.properties;const[wt,jt]=$t.geometry.coordinates;ve=Se(wt),Re=He(jt)}const ct={type:1,geometry:[[Math.round(this.options.extent*(ve*ce-W)),Math.round(this.options.extent*(Re*ce-J))]],tags:Me};let ht;ht=ke||this.options.generateId?V[se+Hi]:this.points[V[se+Hi]].id,ht!==void 0&&(ct.id=ht),de.features.push(ct)}}_limitZoom($){return Math.max(this.options.minZoom,Math.min(Math.floor(+$),this.options.maxZoom+1))}_cluster($,V){const{radius:W,extent:J,reduce:ce,minPoints:de}=this.options,me=W/(J*Math.pow(2,V)),se=$.data,ke=[],Me=this.stride;for(let ve=0;ve<se.length;ve+=Me){if(se[ve+2]<=V)continue;se[ve+2]=V;const Re=se[ve],ct=se[ve+1],ht=$.within(se[ve],se[ve+1],me),$t=se[ve+sn];let wt=$t;for(const jt of ht){const Lt=jt*Me;se[Lt+2]>V&&(wt+=se[Lt+sn])}if(wt>$t&&wt>=de){let jt,Lt=Re*$t,Di=ct*$t,Si=-1;const Pt=((ve/Me|0)<<5)+(V+1)+this.points.length;for(const ei of ht){const xi=ei*Me;if(se[xi+2]<=V)continue;se[xi+2]=V;const Fi=se[xi+sn];Lt+=se[xi]*Fi,Di+=se[xi+1]*Fi,se[xi+4]=Pt,ce&&(jt||(jt=this._map(se,ve,!0),Si=this.clusterProps.length,this.clusterProps.push(jt)),ce(jt,this._map(se,xi)))}se[ve+4]=Pt,ke.push(Lt/wt,Di/wt,1/0,Pt,-1,wt),ce&&ke.push(Si)}else{for(let jt=0;jt<Me;jt++)ke.push(se[ve+jt]);if(wt>1)for(const jt of ht){const Lt=jt*Me;if(!(se[Lt+2]<=V)){se[Lt+2]=V;for(let Di=0;Di<Me;Di++)ke.push(se[Lt+Di])}}}}return ke}_getOriginId($){return $-this.points.length>>5}_getOriginZoom($){return($-this.points.length)%32}_map($,V,W){if($[V+sn]>1){const de=this.clusterProps[$[V+Sr]];return W?Object.assign({},de):de}const J=this.points[$[V+Hi]].properties,ce=this.options.map(J);return W&&ce===J?Object.assign({},ce):ce}}function Tn(ee,$,V){return{type:"Feature",id:ee[$+Hi],properties:Cn(ee,$,V),geometry:{type:"Point",coordinates:[(W=ee[$],360*(W-.5)),Ze(ee[$+1])]}};var W}function Cn(ee,$,V){const W=ee[$+sn],J=W>=1e4?`${Math.round(W/1e3)}k`:W>=1e3?Math.round(W/100)/10+"k":W,ce=ee[$+Sr],de=ce===-1?{}:Object.assign({},V[ce]);return Object.assign(de,{cluster:!0,cluster_id:ee[$+Hi],point_count:W,point_count_abbreviated:J})}function Se(ee){return ee/360+.5}function He(ee){const $=Math.sin(ee*Math.PI/180),V=.5-.25*Math.log((1+$)/(1-$))/Math.PI;return V<0?0:V>1?1:V}function Ze(ee){const $=(180-360*ee)*Math.PI/180;return 360*Math.atan(Math.exp($))/Math.PI-90}function lt(ee,$,V,W){let J=W;const ce=$+(V-$>>1);let de,me=V-$;const se=ee[$],ke=ee[$+1],Me=ee[V],ve=ee[V+1];for(let Re=$+3;Re<V;Re+=3){const ct=Vt(ee[Re],ee[Re+1],se,ke,Me,ve);if(ct>J)de=Re,J=ct;else if(ct===J){const ht=Math.abs(Re-ce);ht<me&&(de=Re,me=ht)}}J>W&&(de-$>3&&lt(ee,$,de,W),ee[de+2]=J,V-de>3&&lt(ee,de,V,W))}function Vt(ee,$,V,W,J,ce){let de=J-V,me=ce-W;if(de!==0||me!==0){const se=((ee-V)*de+($-W)*me)/(de*de+me*me);se>1?(V=J,W=ce):se>0&&(V+=de*se,W+=me*se)}return de=ee-V,me=$-W,de*de+me*me}function Qt(ee,$,V,W){const J={id:ee??null,type:$,geometry:V,tags:W,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if($==="Point"||$==="MultiPoint"||$==="LineString")Et(J,V);else if($==="Polygon")Et(J,V[0]);else if($==="MultiLineString")for(const ce of V)Et(J,ce);else if($==="MultiPolygon")for(const ce of V)Et(J,ce[0]);return J}function Et(ee,$){for(let V=0;V<$.length;V+=3)ee.minX=Math.min(ee.minX,$[V]),ee.minY=Math.min(ee.minY,$[V+1]),ee.maxX=Math.max(ee.maxX,$[V]),ee.maxY=Math.max(ee.maxY,$[V+1])}function vt(ee,$,V,W){if(!$.geometry)return;const J=$.geometry.coordinates;if(J&&J.length===0)return;const ce=$.geometry.type,de=Math.pow(V.tolerance/((1<<V.maxZoom)*V.extent),2);let me=[],se=$.id;if(V.promoteId?se=$.properties[V.promoteId]:V.generateId&&(se=W||0),ce==="Point")ri(J,me);else if(ce==="MultiPoint")for(const ke of J)ri(ke,me);else if(ce==="LineString")xe(J,me,de,!1);else if(ce==="MultiLineString"){if(V.lineMetrics){for(const ke of J)me=[],xe(ke,me,de,!1),ee.push(Qt(se,"LineString",me,$.properties));return}wi(J,me,de,!1)}else if(ce==="Polygon")wi(J,me,de,!0);else{if(ce!=="MultiPolygon"){if(ce==="GeometryCollection"){for(const ke of $.geometry.geometries)vt(ee,{id:se,geometry:ke,properties:$.properties},V,W);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ke of J){const Me=[];wi(ke,Me,de,!0),me.push(Me)}}ee.push(Qt(se,ce,me,$.properties))}function ri(ee,$){$.push(Go(ee[0]),Zt(ee[1]),0)}function xe(ee,$,V,W){let J,ce,de=0;for(let se=0;se<ee.length;se++){const ke=Go(ee[se][0]),Me=Zt(ee[se][1]);$.push(ke,Me,0),se>0&&(de+=W?(J*Me-ke*ce)/2:Math.sqrt(Math.pow(ke-J,2)+Math.pow(Me-ce,2))),J=ke,ce=Me}const me=$.length-3;$[2]=1,lt($,0,me,V),$[me+2]=1,$.size=Math.abs(de),$.start=0,$.end=$.size}function wi(ee,$,V,W){for(let J=0;J<ee.length;J++){const ce=[];xe(ee[J],ce,V,W),$.push(ce)}}function Go(ee){return ee/360+.5}function Zt(ee){const $=Math.sin(ee*Math.PI/180),V=.5-.25*Math.log((1+$)/(1-$))/Math.PI;return V<0?0:V>1?1:V}function ki(ee,$,V,W,J,ce,de,me){if(W/=$,ce>=(V/=$)&&de<W)return ee;if(de<V||ce>=W)return null;const se=[];for(const ke of ee){const Me=ke.geometry;let ve=ke.type;const Re=J===0?ke.minX:ke.minY,ct=J===0?ke.maxX:ke.maxY;if(Re>=V&&ct<W){se.push(ke);continue}if(ct<V||Re>=W)continue;let ht=[];if(ve==="Point"||ve==="MultiPoint")Yo(Me,ht,V,W,J);else if(ve==="LineString")is(Me,ht,V,W,J,!1,me.lineMetrics);else if(ve==="MultiLineString")Js(Me,ht,V,W,J,!1);else if(ve==="Polygon")Js(Me,ht,V,W,J,!0);else if(ve==="MultiPolygon")for(const $t of Me){const wt=[];Js($t,wt,V,W,J,!0),wt.length&&ht.push(wt)}if(ht.length){if(me.lineMetrics&&ve==="LineString"){for(const $t of ht)se.push(Qt(ke.id,ve,$t,ke.tags));continue}ve!=="LineString"&&ve!=="MultiLineString"||(ht.length===1?(ve="LineString",ht=ht[0]):ve="MultiLineString"),ve!=="Point"&&ve!=="MultiPoint"||(ve=ht.length===3?"Point":"MultiPoint"),se.push(Qt(ke.id,ve,ht,ke.tags))}}return se.length?se:null}function Yo(ee,$,V,W,J){for(let ce=0;ce<ee.length;ce+=3){const de=ee[ce+J];de>=V&&de<=W&&Un($,ee[ce],ee[ce+1],ee[ce+2])}}function is(ee,$,V,W,J,ce,de){let me=$r(ee);const se=J===0?Xo:Ko;let ke,Me,ve=ee.start;for(let wt=0;wt<ee.length-3;wt+=3){const jt=ee[wt],Lt=ee[wt+1],Di=ee[wt+2],Si=ee[wt+3],Pt=ee[wt+4],ei=J===0?jt:Lt,xi=J===0?Si:Pt;let Fi=!1;de&&(ke=Math.sqrt(Math.pow(jt-Si,2)+Math.pow(Lt-Pt,2))),ei<V?xi>V&&(Me=se(me,jt,Lt,Si,Pt,V),de&&(me.start=ve+ke*Me)):ei>W?xi<W&&(Me=se(me,jt,Lt,Si,Pt,W),de&&(me.start=ve+ke*Me)):Un(me,jt,Lt,Di),xi<V&&ei>=V&&(Me=se(me,jt,Lt,Si,Pt,V),Fi=!0),xi>W&&ei<=W&&(Me=se(me,jt,Lt,Si,Pt,W),Fi=!0),!ce&&Fi&&(de&&(me.end=ve+ke*Me),$.push(me),me=$r(ee)),de&&(ve+=ke)}let Re=ee.length-3;const ct=ee[Re],ht=ee[Re+1],$t=J===0?ct:ht;$t>=V&&$t<=W&&Un(me,ct,ht,ee[Re+2]),Re=me.length-3,ce&&Re>=3&&(me[Re]!==me[0]||me[Re+1]!==me[1])&&Un(me,me[0],me[1],me[2]),me.length&&$.push(me)}function $r(ee){const $=[];return $.size=ee.size,$.start=ee.start,$.end=ee.end,$}function Js(ee,$,V,W,J,ce){for(const de of ee)is(de,$,V,W,J,ce,!1)}function Un(ee,$,V,W){ee.push($,V,W)}function Xo(ee,$,V,W,J,ce){const de=(ce-$)/(W-$);return Un(ee,ce,V+(J-V)*de,1),de}function Ko(ee,$,V,W,J,ce){const de=(ce-V)/(J-V);return Un(ee,$+(W-$)*de,ce,1),de}function De(ee,$){const V=[];for(let W=0;W<ee.length;W++){const J=ee[W],ce=J.type;let de;if(ce==="Point"||ce==="MultiPoint"||ce==="LineString")de=Er(J.geometry,$);else if(ce==="MultiLineString"||ce==="Polygon"){de=[];for(const me of J.geometry)de.push(Er(me,$))}else if(ce==="MultiPolygon"){de=[];for(const me of J.geometry){const se=[];for(const ke of me)se.push(Er(ke,$));de.push(se)}}V.push(Qt(J.id,ce,de,J.tags))}return V}function Er(ee,$){const V=[];V.size=ee.size,ee.start!==void 0&&(V.start=ee.start,V.end=ee.end);for(let W=0;W<ee.length;W+=3)V.push(ee[W]+$,ee[W+1],ee[W+2]);return V}function on(ee,$){if(ee.transformed)return ee;const V=1<<ee.z,W=ee.x,J=ee.y;for(const ce of ee.features){const de=ce.geometry,me=ce.type;if(ce.geometry=[],me===1)for(let se=0;se<de.length;se+=2)ce.geometry.push(Tr(de[se],de[se+1],$,V,W,J));else for(let se=0;se<de.length;se++){const ke=[];for(let Me=0;Me<de[se].length;Me+=2)ke.push(Tr(de[se][Me],de[se][Me+1],$,V,W,J));ce.geometry.push(ke)}}return ee.transformed=!0,ee}function Tr(ee,$,V,W,J,ce){return[Math.round(V*(ee*W-J)),Math.round(V*($*W-ce))]}function ns(ee,$,V,W,J){const ce=$===J.maxZoom?0:J.tolerance/((1<<$)*J.extent),de={features:[],numPoints:0,numSimplified:0,numFeatures:ee.length,source:null,x:V,y:W,z:$,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const me of ee)Fe(de,me,ce,J);return de}function Fe(ee,$,V,W){const J=$.geometry,ce=$.type,de=[];if(ee.minX=Math.min(ee.minX,$.minX),ee.minY=Math.min(ee.minY,$.minY),ee.maxX=Math.max(ee.maxX,$.maxX),ee.maxY=Math.max(ee.maxY,$.maxY),ce==="Point"||ce==="MultiPoint")for(let me=0;me<J.length;me+=3)de.push(J[me],J[me+1]),ee.numPoints++,ee.numSimplified++;else if(ce==="LineString")Ct(de,J,ee,V,!1,!1);else if(ce==="MultiLineString"||ce==="Polygon")for(let me=0;me<J.length;me++)Ct(de,J[me],ee,V,ce==="Polygon",me===0);else if(ce==="MultiPolygon")for(let me=0;me<J.length;me++){const se=J[me];for(let ke=0;ke<se.length;ke++)Ct(de,se[ke],ee,V,!0,ke===0)}if(de.length){let me=$.tags||null;if(ce==="LineString"&&W.lineMetrics){me={};for(const ke in $.tags)me[ke]=$.tags[ke];me.mapbox_clip_start=J.start/J.size,me.mapbox_clip_end=J.end/J.size}const se={geometry:de,type:ce==="Polygon"||ce==="MultiPolygon"?3:ce==="LineString"||ce==="MultiLineString"?2:1,tags:me};$.id!==null&&(se.id=$.id),ee.features.push(se)}}function Ct(ee,$,V,W,J,ce){const de=W*W;if(W>0&&$.size<(J?de:W))return void(V.numPoints+=$.length/3);const me=[];for(let se=0;se<$.length;se+=3)(W===0||$[se+2]>de)&&(V.numSimplified++,me.push($[se],$[se+1])),V.numPoints++;J&&function(se,ke){let Me=0;for(let ve=0,Re=se.length,ct=Re-2;ve<Re;ct=ve,ve+=2)Me+=(se[ve]-se[ct])*(se[ve+1]+se[ct+1]);if(Me>0===ke)for(let ve=0,Re=se.length;ve<Re/2;ve+=2){const ct=se[ve],ht=se[ve+1];se[ve]=se[Re-2-ve],se[ve+1]=se[Re-1-ve],se[Re-2-ve]=ct,se[Re-1-ve]=ht}}(me,ce),ee.push(me)}const mt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class fn{constructor($,V){const W=(V=this.options=function(ce,de){for(const me in de)ce[me]=de[me];return ce}(Object.create(mt),V)).debug;if(W&&console.time("preprocess data"),V.maxZoom<0||V.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(ce,de){const me=[];if(ce.type==="FeatureCollection")for(let se=0;se<ce.features.length;se++)vt(me,ce.features[se],de,se);else vt(me,ce.type==="Feature"?ce:{geometry:ce},de);return me}($,V);this.tiles={},this.tileCoords=[],W&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",V.indexMaxZoom,V.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(ce,de){const me=de.buffer/de.extent;let se=ce;const ke=ki(ce,1,-1-me,me,0,-1,2,de),Me=ki(ce,1,1-me,2+me,0,-1,2,de);return(ke||Me)&&(se=ki(ce,1,-me,1+me,0,-1,2,de)||[],ke&&(se=De(ke,1).concat(se)),Me&&(se=se.concat(De(Me,-1)))),se}(J,V),J.length&&this.splitTile(J,0,0,0),W&&(J.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile($,V,W,J,ce,de,me){const se=[$,V,W,J],ke=this.options,Me=ke.debug;for(;se.length;){J=se.pop(),W=se.pop(),V=se.pop(),$=se.pop();const ve=1<<V,Re=ir(V,W,J);let ct=this.tiles[Re];if(!ct&&(Me>1&&console.time("creation"),ct=this.tiles[Re]=ns($,V,W,J,ke),this.tileCoords.push({z:V,x:W,y:J}),Me)){Me>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,W,J,ct.numFeatures,ct.numPoints,ct.numSimplified),console.timeEnd("creation"));const Fi=`z${V}`;this.stats[Fi]=(this.stats[Fi]||0)+1,this.total++}if(ct.source=$,ce==null){if(V===ke.indexMaxZoom||ct.numPoints<=ke.indexMaxPoints)continue}else{if(V===ke.maxZoom||V===ce)continue;if(ce!=null){const Fi=ce-V;if(W!==de>>Fi||J!==me>>Fi)continue}}if(ct.source=null,$.length===0)continue;Me>1&&console.time("clipping");const ht=.5*ke.buffer/ke.extent,$t=.5-ht,wt=.5+ht,jt=1+ht;let Lt=null,Di=null,Si=null,Pt=null,ei=ki($,ve,W-ht,W+wt,0,ct.minX,ct.maxX,ke),xi=ki($,ve,W+$t,W+jt,0,ct.minX,ct.maxX,ke);$=null,ei&&(Lt=ki(ei,ve,J-ht,J+wt,1,ct.minY,ct.maxY,ke),Di=ki(ei,ve,J+$t,J+jt,1,ct.minY,ct.maxY,ke),ei=null),xi&&(Si=ki(xi,ve,J-ht,J+wt,1,ct.minY,ct.maxY,ke),Pt=ki(xi,ve,J+$t,J+jt,1,ct.minY,ct.maxY,ke),xi=null),Me>1&&console.timeEnd("clipping"),se.push(Lt||[],V+1,2*W,2*J),se.push(Di||[],V+1,2*W,2*J+1),se.push(Si||[],V+1,2*W+1,2*J),se.push(Pt||[],V+1,2*W+1,2*J+1)}}getTile($,V,W){$=+$,V=+V,W=+W;const J=this.options,{extent:ce,debug:de}=J;if($<0||$>24)return null;const me=1<<$,se=ir($,V=V+me&me-1,W);if(this.tiles[se])return on(this.tiles[se],ce);de>1&&console.log("drilling down to z%d-%d-%d",$,V,W);let ke,Me=$,ve=V,Re=W;for(;!ke&&Me>0;)Me--,ve>>=1,Re>>=1,ke=this.tiles[ir(Me,ve,Re)];return ke&&ke.source?(de>1&&(console.log("found parent tile z%d-%d-%d",Me,ve,Re),console.time("drilling down")),this.splitTile(ke.source,Me,ve,Re,$,V,W),de>1&&console.timeEnd("drilling down"),this.tiles[se]?on(this.tiles[se],ce):null):null}}function ir(ee,$,V){return 32*((1<<ee)*V+$)+ee}function bt(ee,$){return $?ee.properties[$]:ee.id}function Cr(ee,$){if(ee==null)return!0;if(ee.type==="Feature")return bt(ee,$)!=null;if(ee.type==="FeatureCollection"){const V=new Set;for(const W of ee.features){const J=bt(W,$);if(J==null||V.has(J))return!1;V.add(J)}return!0}return!1}function jr(ee,$){const V=new Map;if(ee!=null)if(ee.type==="Feature")V.set(bt(ee,$),ee);else for(const W of ee.features)V.set(bt(W,$),W);return V}class rs extends R{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile($,V){return y._(this,void 0,void 0,function*(){const W=$.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile(W.z,W.x,W.y);if(!J)return null;const ce=new class{constructor(me){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=y.X,this.length=me.length,this._features=me}feature(me){return new class{constructor(se){this._feature=se,this.extent=y.X,this.type=se.type,this.properties=se.tags,"id"in se&&!isNaN(se.id)&&(this.id=parseInt(se.id,10))}loadGeometry(){if(this._feature.type===1){const se=[];for(const ke of this._feature.geometry)se.push([new y.P(ke[0],ke[1])]);return se}{const se=[];for(const ke of this._feature.geometry){const Me=[];for(const ve of ke)Me.push(new y.P(ve[0],ve[1]));se.push(Me)}return se}}toGeoJSON(se,ke,Me){return ae.call(this,se,ke,Me)}}(this._features[me])}}(J.features);let de=Ui(ce);return de.byteOffset===0&&de.byteLength===de.buffer.byteLength||(de=new Uint8Array(de)),{vectorTile:ce,rawData:de.buffer}})}loadData($){return y._(this,void 0,void 0,function*(){var V;(V=this._pendingRequest)===null||V===void 0||V.abort();const W=!!($&&$.request&&$.request.collectResourceTiming)&&new y.bv($.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON($,this._pendingRequest),this._geoJSONIndex=$.cluster?new En(function({superclusterOptions:de,clusterProperties:me}){if(!me||!de)return de;const se={},ke={},Me={accumulated:null,zoom:0},ve={properties:null},Re=Object.keys(me);for(const ct of Re){const[ht,$t]=me[ct],wt=y.bC($t),jt=y.bC(typeof ht=="string"?[ht,["accumulated"],["get",ct]]:ht);se[ct]=wt.value,ke[ct]=jt.value}return de.map=ct=>{ve.properties=ct;const ht={};for(const $t of Re)ht[$t]=se[$t].evaluate(Me,ve);return ht},de.reduce=(ct,ht)=>{ve.properties=ht;for(const $t of Re)Me.accumulated=ct[$t],ct[$t]=ke[$t].evaluate(Me,ve)},de}($)).load((yield this._pendingData).features):(J=yield this._pendingData,new fn(J,$.geojsonVtOptions)),this.loaded={};const ce={};if(W){const de=W.finish();de&&(ce.resourceTiming={},ce.resourceTiming[$.source]=JSON.parse(JSON.stringify(de)))}return ce}catch(ce){if(delete this._pendingRequest,y.bB(ce))return{abandoned:!0};throw ce}var J})}getData(){return y._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile($){const V=this.loaded;return V&&V[$.uid]?super.reloadTile($):this.loadTile($)}loadAndProcessGeoJSON($,V){return y._(this,void 0,void 0,function*(){let W=yield this.loadGeoJSON($,V);if(delete this._pendingRequest,typeof W!="object")throw new Error(`Input data given to '${$.source}' is not a valid GeoJSON object.`);if(te(W,!0),$.filter){const J=y.bC($.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(de=>`${de.key}: ${de.message}`).join(", "));W={type:"FeatureCollection",features:W.features.filter(de=>J.value.evaluate({zoom:0},de))}}return W})}loadGeoJSON($,V){return y._(this,void 0,void 0,function*(){const{promoteId:W}=$;if($.request){const J=yield y.h($.request,V);return this._dataUpdateable=Cr(J.data,W)?jr(J.data,W):void 0,J.data}if(typeof $.data=="string")try{const J=JSON.parse($.data);return this._dataUpdateable=Cr(J,W)?jr(J,W):void 0,J}catch{throw new Error(`Input data given to '${$.source}' is not a valid GeoJSON object.`)}if(!$.dataDiff)throw new Error(`Input data given to '${$.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${$.source}`);return function(J,ce,de){var me,se,ke,Me;if(ce.removeAll&&J.clear(),ce.remove)for(const ve of ce.remove)J.delete(ve);if(ce.add)for(const ve of ce.add){const Re=bt(ve,de);Re!=null&&J.set(Re,ve)}if(ce.update)for(const ve of ce.update){let Re=J.get(ve.id);if(Re==null)continue;const ct=!ve.removeAllProperties&&(((me=ve.removeProperties)===null||me===void 0?void 0:me.length)>0||((se=ve.addOrUpdateProperties)===null||se===void 0?void 0:se.length)>0);if((ve.newGeometry||ve.removeAllProperties||ct)&&(Re=Object.assign({},Re),J.set(ve.id,Re),ct&&(Re.properties=Object.assign({},Re.properties))),ve.newGeometry&&(Re.geometry=ve.newGeometry),ve.removeAllProperties)Re.properties={};else if(((ke=ve.removeProperties)===null||ke===void 0?void 0:ke.length)>0)for(const ht of ve.removeProperties)Object.prototype.hasOwnProperty.call(Re.properties,ht)&&delete Re.properties[ht];if(((Me=ve.addOrUpdateProperties)===null||Me===void 0?void 0:Me.length)>0)for(const{key:ht,value:$t}of ve.addOrUpdateProperties)Re.properties[ht]=$t}}(this._dataUpdateable,$.dataDiff,W),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource($){return y._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom($){return this._geoJSONIndex.getClusterExpansionZoom($.clusterId)}getClusterChildren($){return this._geoJSONIndex.getChildren($.clusterId)}getClusterLeaves($){return this._geoJSONIndex.getLeaves($.clusterId,$.limit,$.offset)}}class Mr{constructor($){this.self=$,this.actor=new y.F($),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(V,W)=>{if(this.externalWorkerSourceTypes[V])throw new Error(`Worker source with name "${V}" already registered.`);this.externalWorkerSourceTypes[V]=W},this.self.addProtocol=y.bi,this.self.removeProtocol=y.bj,this.self.registerRTLTextPlugin=V=>{if(y.bD.isParsed())throw new Error("RTL text plugin already registered.");y.bD.setMethods(V)},this.actor.registerMessageHandler("LDT",(V,W)=>this._getDEMWorkerSource(V,W.source).loadTile(W)),this.actor.registerMessageHandler("RDT",(V,W)=>y._(this,void 0,void 0,function*(){this._getDEMWorkerSource(V,W.source).removeTile(W)})),this.actor.registerMessageHandler("GCEZ",(V,W)=>y._(this,void 0,void 0,function*(){return this._getWorkerSource(V,W.type,W.source).getClusterExpansionZoom(W)})),this.actor.registerMessageHandler("GCC",(V,W)=>y._(this,void 0,void 0,function*(){return this._getWorkerSource(V,W.type,W.source).getClusterChildren(W)})),this.actor.registerMessageHandler("GCL",(V,W)=>y._(this,void 0,void 0,function*(){return this._getWorkerSource(V,W.type,W.source).getClusterLeaves(W)})),this.actor.registerMessageHandler("LD",(V,W)=>this._getWorkerSource(V,W.type,W.source).loadData(W)),this.actor.registerMessageHandler("GD",(V,W)=>this._getWorkerSource(V,W.type,W.source).getData()),this.actor.registerMessageHandler("LT",(V,W)=>this._getWorkerSource(V,W.type,W.source).loadTile(W)),this.actor.registerMessageHandler("RT",(V,W)=>this._getWorkerSource(V,W.type,W.source).reloadTile(W)),this.actor.registerMessageHandler("AT",(V,W)=>this._getWorkerSource(V,W.type,W.source).abortTile(W)),this.actor.registerMessageHandler("RMT",(V,W)=>this._getWorkerSource(V,W.type,W.source).removeTile(W)),this.actor.registerMessageHandler("RS",(V,W)=>y._(this,void 0,void 0,function*(){if(!this.workerSources[V]||!this.workerSources[V][W.type]||!this.workerSources[V][W.type][W.source])return;const J=this.workerSources[V][W.type][W.source];delete this.workerSources[V][W.type][W.source],J.removeSource!==void 0&&J.removeSource(W)})),this.actor.registerMessageHandler("RM",V=>y._(this,void 0,void 0,function*(){delete this.layerIndexes[V],delete this.availableImages[V],delete this.workerSources[V],delete this.demWorkerSources[V]})),this.actor.registerMessageHandler("SR",(V,W)=>y._(this,void 0,void 0,function*(){this.referrer=W})),this.actor.registerMessageHandler("SRPS",(V,W)=>this._syncRTLPluginState(V,W)),this.actor.registerMessageHandler("IS",(V,W)=>y._(this,void 0,void 0,function*(){this.self.importScripts(W)})),this.actor.registerMessageHandler("SI",(V,W)=>this._setImages(V,W)),this.actor.registerMessageHandler("UL",(V,W)=>y._(this,void 0,void 0,function*(){this._getLayerIndex(V).update(W.layers,W.removedIds)})),this.actor.registerMessageHandler("SL",(V,W)=>y._(this,void 0,void 0,function*(){this._getLayerIndex(V).replace(W)}))}_setImages($,V){return y._(this,void 0,void 0,function*(){this.availableImages[$]=V;for(const W in this.workerSources[$]){const J=this.workerSources[$][W];for(const ce in J)J[ce].availableImages=V}})}_syncRTLPluginState($,V){return y._(this,void 0,void 0,function*(){if(y.bD.isParsed())return y.bD.getState();if(V.pluginStatus!=="loading")return y.bD.setState(V),V;const W=V.pluginURL;if(this.self.importScripts(W),y.bD.isParsed()){const J={pluginStatus:"loaded",pluginURL:W};return y.bD.setState(J),J}throw y.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${W}`)})}_getAvailableImages($){let V=this.availableImages[$];return V||(V=[]),V}_getLayerIndex($){let V=this.layerIndexes[$];return V||(V=this.layerIndexes[$]=new h),V}_getWorkerSource($,V,W){if(this.workerSources[$]||(this.workerSources[$]={}),this.workerSources[$][V]||(this.workerSources[$][V]={}),!this.workerSources[$][V][W]){const J={sendAsync:(ce,de)=>(ce.targetMapId=$,this.actor.sendAsync(ce,de))};switch(V){case"vector":this.workerSources[$][V][W]=new R(J,this._getLayerIndex($),this._getAvailableImages($));break;case"geojson":this.workerSources[$][V][W]=new rs(J,this._getLayerIndex($),this._getAvailableImages($));break;default:this.workerSources[$][V][W]=new this.externalWorkerSourceTypes[V](J,this._getLayerIndex($),this._getAvailableImages($))}}return this.workerSources[$][V][W]}_getDEMWorkerSource($,V){return this.demWorkerSources[$]||(this.demWorkerSources[$]={}),this.demWorkerSources[$][V]||(this.demWorkerSources[$][V]=new z),this.demWorkerSources[$][V]}}return y.i(self)&&(self.worker=new Mr(self)),Mr}),p("index",["exports","./shared"],function(y,h){var M="4.7.0";let D,A;const R={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:g=>new Promise((e,a)=>{const u=requestAnimationFrame(e);g.signal.addEventListener("abort",()=>{cancelAnimationFrame(u),a(h.c())})}),getImageData(g,e=0){return this.getImageCanvasContext(g).getImageData(-e,-e,g.width+2*e,g.height+2*e)},getImageCanvasContext(g){const e=window.document.createElement("canvas"),a=e.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return e.width=g.width,e.height=g.height,a.drawImage(g,0,0,g.width,g.height),a},resolveURL:g=>(D||(D=document.createElement("a")),D.href=g,D.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(A==null&&(A=matchMedia("(prefers-reduced-motion: reduce)")),A.matches)}};class z{static testProp(e){if(!z.docStyle)return e[0];for(let a=0;a<e.length;a++)if(e[a]in z.docStyle)return e[a];return e[0]}static create(e,a,u){const d=window.document.createElement(e);return a!==void 0&&(d.className=a),u&&u.appendChild(d),d}static createNS(e,a){return window.document.createElementNS(e,a)}static disableDrag(){z.docStyle&&z.selectProp&&(z.userSelect=z.docStyle[z.selectProp],z.docStyle[z.selectProp]="none")}static enableDrag(){z.docStyle&&z.selectProp&&(z.docStyle[z.selectProp]=z.userSelect)}static setTransform(e,a){e.style[z.transformProp]=a}static addEventListener(e,a,u,d={}){e.addEventListener(a,u,"passive"in d?d:d.capture)}static removeEventListener(e,a,u,d={}){e.removeEventListener(a,u,"passive"in d?d:d.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",z.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",z.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",z.suppressClickInternal,!0)},0)}static getScale(e){const a=e.getBoundingClientRect();return{x:a.width/e.offsetWidth||1,y:a.height/e.offsetHeight||1,boundingClientRect:a}}static getPoint(e,a,u){const d=a.boundingClientRect;return new h.P((u.clientX-d.left)/a.x-e.clientLeft,(u.clientY-d.top)/a.y-e.clientTop)}static mousePos(e,a){const u=z.getScale(e);return z.getPoint(e,u,a)}static touchPos(e,a){const u=[],d=z.getScale(e);for(let m=0;m<a.length;m++)u.push(z.getPoint(e,d,a[m]));return u}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}z.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,z.selectProp=z.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),z.transformProp=z.testProp(["transform","WebkitTransform"]);const N={supported:!1,testSupport:function(g){!ae&&te&&(he?be(g):Y=g)}};let Y,te,ae=!1,he=!1;function be(g){const e=g.createTexture();g.bindTexture(g.TEXTURE_2D,e);try{if(g.texImage2D(g.TEXTURE_2D,0,g.RGBA,g.RGBA,g.UNSIGNED_BYTE,te),g.isContextLost())return;N.supported=!0}catch{}g.deleteTexture(e),ae=!0}var _e;typeof document<"u"&&(te=document.createElement("img"),te.onload=()=>{Y&&be(Y),Y=null,he=!0},te.onerror=()=>{ae=!0,Y=null},te.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(g){let e,a,u,d;g.resetRequestQueue=()=>{e=[],a=0,u=0,d={}},g.addThrottleControl=T=>{const I=u++;return d[I]=T,I},g.removeThrottleControl=T=>{delete d[T],k()},g.getImage=(T,I,O=!0)=>new Promise((B,U)=>{N.supported&&(T.headers||(T.headers={}),T.headers.accept="image/webp,*/*"),h.e(T,{type:"image"}),e.push({abortController:I,requestParameters:T,supportImageRefresh:O,state:"queued",onError:Z=>{U(Z)},onSuccess:Z=>{B(Z)}}),k()});const m=T=>h._(this,void 0,void 0,function*(){T.state="running";const{requestParameters:I,supportImageRefresh:O,onError:B,onSuccess:U,abortController:Z}=T,G=O===!1&&!h.i(self)&&!h.g(I.url)&&(!I.headers||Object.keys(I.headers).reduce((re,oe)=>re&&oe==="accept",!0));a++;const Q=G?E(I,Z):h.m(I,Z);try{const re=yield Q;delete T.abortController,T.state="completed",re.data instanceof HTMLImageElement||h.b(re.data)?U(re):re.data&&U({data:yield(ne=re.data,typeof createImageBitmap=="function"?h.d(ne):h.f(ne)),cacheControl:re.cacheControl,expires:re.expires})}catch(re){delete T.abortController,B(re)}finally{a--,k()}var ne}),k=()=>{const T=(()=>{for(const I of Object.keys(d))if(d[I]())return!0;return!1})()?h.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:h.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let I=a;I<T&&e.length>0;I++){const O=e.shift();O.abortController.signal.aborted?I--:m(O)}},E=(T,I)=>new Promise((O,B)=>{const U=new Image,Z=T.url,G=T.credentials;G&&G==="include"?U.crossOrigin="use-credentials":(G&&G==="same-origin"||!h.s(Z))&&(U.crossOrigin="anonymous"),I.signal.addEventListener("abort",()=>{U.src="",B(h.c())}),U.fetchPriority="high",U.onload=()=>{U.onerror=U.onload=null,O({data:U})},U.onerror=()=>{U.onerror=U.onload=null,I.signal.aborted||B(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},U.src=Z})}(_e||(_e={})),_e.resetRequestQueue();class Ie{constructor(e){this._transformRequestFn=e}transformRequest(e,a){return this._transformRequestFn&&this._transformRequestFn(e,a)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function ot(g){var e=new h.A(3);return e[0]=g[0],e[1]=g[1],e[2]=g[2],e}var Qe,Be=function(g,e,a){return g[0]=e[0]-a[0],g[1]=e[1]-a[1],g[2]=e[2]-a[2],g};Qe=new h.A(3),h.A!=Float32Array&&(Qe[0]=0,Qe[1]=0,Qe[2]=0);var St=function(g){var e=g[0],a=g[1];return e*e+a*a};function rt(g){const e=[];if(typeof g=="string")e.push({id:"default",url:g});else if(g&&g.length>0){const a=[];for(const{id:u,url:d}of g){const m=`${u}${d}`;a.indexOf(m)===-1&&(a.push(m),e.push({id:u,url:d}))}}return e}function Dt(g,e,a){const u=g.split("?");return u[0]+=`${e}${a}`,u.join("?")}(function(){var g=new h.A(2);h.A!=Float32Array&&(g[0]=0,g[1]=0)})();class Mt{constructor(e,a,u,d){this.context=e,this.format=u,this.texture=e.gl.createTexture(),this.update(a,d)}update(e,a,u){const{width:d,height:m}=e,k=!(this.size&&this.size[0]===d&&this.size[1]===m||u),{context:E}=this,{gl:T}=E;if(this.useMipmap=!!(a&&a.useMipmap),T.bindTexture(T.TEXTURE_2D,this.texture),E.pixelStoreUnpackFlipY.set(!1),E.pixelStoreUnpack.set(1),E.pixelStoreUnpackPremultiplyAlpha.set(this.format===T.RGBA&&(!a||a.premultiply!==!1)),k)this.size=[d,m],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||h.b(e)?T.texImage2D(T.TEXTURE_2D,0,this.format,this.format,T.UNSIGNED_BYTE,e):T.texImage2D(T.TEXTURE_2D,0,this.format,d,m,0,this.format,T.UNSIGNED_BYTE,e.data);else{const{x:I,y:O}=u||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||h.b(e)?T.texSubImage2D(T.TEXTURE_2D,0,I,O,T.RGBA,T.UNSIGNED_BYTE,e):T.texSubImage2D(T.TEXTURE_2D,0,I,O,d,m,T.RGBA,T.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&T.generateMipmap(T.TEXTURE_2D)}bind(e,a,u){const{context:d}=this,{gl:m}=d;m.bindTexture(m.TEXTURE_2D,this.texture),u!==m.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(u=m.LINEAR),e!==this.filter&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,e),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,u||e),this.filter=e),a!==this.wrap&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,a),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,a),this.wrap=a)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function kn(g){const{userImage:e}=g;return!!(e&&e.render&&e.render())&&(g.data.replace(new Uint8Array(e.data.buffer)),!0)}class Rt extends h.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new h.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:a,promiseResolve:u}of this.requestors)u(this._getImagesForIds(a));this.requestors=[]}}getImage(e){const a=this.images[e];if(a&&!a.data&&a.spriteData){const u=a.spriteData;a.data=new h.R({width:u.width,height:u.height},u.context.getImageData(u.x,u.y,u.width,u.height).data),a.spriteData=null}return a}addImage(e,a){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,a)&&(this.images[e]=a)}_validate(e,a){let u=!0;const d=a.data||a.spriteData;return this._validateStretch(a.stretchX,d&&d.width)||(this.fire(new h.j(new Error(`Image "${e}" has invalid "stretchX" value`))),u=!1),this._validateStretch(a.stretchY,d&&d.height)||(this.fire(new h.j(new Error(`Image "${e}" has invalid "stretchY" value`))),u=!1),this._validateContent(a.content,a)||(this.fire(new h.j(new Error(`Image "${e}" has invalid "content" value`))),u=!1),u}_validateStretch(e,a){if(!e)return!0;let u=0;for(const d of e){if(d[0]<u||d[1]<d[0]||a<d[1])return!1;u=d[1]}return!0}_validateContent(e,a){if(!e)return!0;if(e.length!==4)return!1;const u=a.spriteData,d=u&&u.width||a.data.width,m=u&&u.height||a.data.height;return!(e[0]<0||d<e[0]||e[1]<0||m<e[1]||e[2]<0||d<e[2]||e[3]<0||m<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,a,u=!0){const d=this.getImage(e);if(u&&(d.data.width!==a.data.width||d.data.height!==a.data.height))throw new Error(`size mismatch between old image (${d.data.width}x${d.data.height}) and new image (${a.data.width}x${a.data.height}).`);a.version=d.version+1,this.images[e]=a,this.updatedImages[e]=!0}removeImage(e){const a=this.images[e];delete this.images[e],delete this.patterns[e],a.userImage&&a.userImage.onRemove&&a.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((a,u)=>{let d=!0;if(!this.isLoaded())for(const m of e)this.images[m]||(d=!1);this.isLoaded()||d?a(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:a})})}_getImagesForIds(e){const a={};for(const u of e){let d=this.getImage(u);d||(this.fire(new h.k("styleimagemissing",{id:u})),d=this.getImage(u)),d?a[u]={data:d.data.clone(),pixelRatio:d.pixelRatio,sdf:d.sdf,version:d.version,stretchX:d.stretchX,stretchY:d.stretchY,content:d.content,textFitWidth:d.textFitWidth,textFitHeight:d.textFitHeight,hasRenderCallback:!!(d.userImage&&d.userImage.render)}:h.w(`Image "${u}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return a}getPixelSize(){const{width:e,height:a}=this.atlasImage;return{width:e,height:a}}getPattern(e){const a=this.patterns[e],u=this.getImage(e);if(!u)return null;if(a&&a.position.version===u.version)return a.position;if(a)a.position.version=u.version;else{const d={w:u.data.width+2,h:u.data.height+2,x:0,y:0},m=new h.I(d,u);this.patterns[e]={bin:d,position:m}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const a=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Mt(e,this.atlasImage,a.RGBA),this.atlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const m in this.patterns)e.push(this.patterns[m].bin);const{w:a,h:u}=h.p(e),d=this.atlasImage;d.resize({width:a||1,height:u||1});for(const m in this.patterns){const{bin:k}=this.patterns[m],E=k.x+1,T=k.y+1,I=this.getImage(m).data,O=I.width,B=I.height;h.R.copy(I,d,{x:0,y:0},{x:E,y:T},{width:O,height:B}),h.R.copy(I,d,{x:0,y:B-1},{x:E,y:T-1},{width:O,height:1}),h.R.copy(I,d,{x:0,y:0},{x:E,y:T+B},{width:O,height:1}),h.R.copy(I,d,{x:O-1,y:0},{x:E-1,y:T},{width:1,height:B}),h.R.copy(I,d,{x:0,y:0},{x:E+O,y:T},{width:1,height:B})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const a of e){if(this.callbackDispatchedThisFrame[a])continue;this.callbackDispatchedThisFrame[a]=!0;const u=this.getImage(a);u||h.w(`Image with ID: "${a}" was not found`),kn(u)&&this.updateImage(a,u)}}}const pi=1e20;function rn(g,e,a,u,d,m,k,E,T){for(let I=e;I<e+u;I++)tr(g,a*m+I,m,d,k,E,T);for(let I=a;I<a+d;I++)tr(g,I*m+e,1,u,k,E,T)}function tr(g,e,a,u,d,m,k){m[0]=0,k[0]=-pi,k[1]=pi,d[0]=g[e];for(let E=1,T=0,I=0;E<u;E++){d[E]=g[e+E*a];const O=E*E;do{const B=m[T];I=(d[E]-d[B]+O-B*B)/(E-B)/2}while(I<=k[T]&&--T>-1);T++,m[T]=E,k[T]=I,k[T+1]=pi}for(let E=0,T=0;E<u;E++){for(;k[T+1]<E;)T++;const I=m[T],O=E-I;g[e+E*a]=d[I]+O*O}}class Ui{constructor(e,a){this.requestManager=e,this.localIdeographFontFamily=a,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return h._(this,void 0,void 0,function*(){const a=[];for(const m in e)for(const k of e[m])a.push(this._getAndCacheGlyphsPromise(m,k));const u=yield Promise.all(a),d={};for(const{stack:m,id:k,glyph:E}of u)d[m]||(d[m]={}),d[m][k]=E&&{id:E.id,bitmap:E.bitmap.clone(),metrics:E.metrics};return d})}_getAndCacheGlyphsPromise(e,a){return h._(this,void 0,void 0,function*(){let u=this.entries[e];u||(u=this.entries[e]={glyphs:{},requests:{},ranges:{}});let d=u.glyphs[a];if(d!==void 0)return{stack:e,id:a,glyph:d};if(d=this._tinySDF(u,e,a),d)return u.glyphs[a]=d,{stack:e,id:a,glyph:d};const m=Math.floor(a/256);if(256*m>65535)throw new Error("glyphs > 65535 not supported");if(u.ranges[m])return{stack:e,id:a,glyph:d};if(!this.url)throw new Error("glyphsUrl is not set");if(!u.requests[m]){const E=Ui.loadGlyphRange(e,m,this.url,this.requestManager);u.requests[m]=E}const k=yield u.requests[m];for(const E in k)this._doesCharSupportLocalGlyph(+E)||(u.glyphs[+E]=k[+E]);return u.ranges[m]=!0,{stack:e,id:a,glyph:k[a]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))}_tinySDF(e,a,u){const d=this.localIdeographFontFamily;if(!d||!this._doesCharSupportLocalGlyph(u))return;let m=e.tinySDF;if(!m){let E="400";/bold/i.test(a)?E="900":/medium/i.test(a)?E="500":/light/i.test(a)&&(E="200"),m=e.tinySDF=new Ui.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:d,fontWeight:E})}const k=m.draw(String.fromCharCode(u));return{id:u,bitmap:new h.o({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}}}}Ui.loadGlyphRange=function(g,e,a,u){return h._(this,void 0,void 0,function*(){const d=256*e,m=d+255,k=u.transformRequest(a.replace("{fontstack}",g).replace("{range}",`${d}-${m}`),"Glyphs"),E=yield h.l(k,new AbortController);if(!E||!E.data)throw new Error(`Could not load glyph range. range: ${e}, ${d}-${m}`);const T={};for(const I of h.n(E.data))T[I.id]=I;return T})},Ui.TinySDF=class{constructor({fontSize:g=24,buffer:e=3,radius:a=8,cutoff:u=.25,fontFamily:d="sans-serif",fontWeight:m="normal",fontStyle:k="normal"}={}){this.buffer=e,this.cutoff=u,this.radius=a;const E=this.size=g+4*e,T=this._createCanvas(E),I=this.ctx=T.getContext("2d",{willReadFrequently:!0});I.font=`${k} ${m} ${g}px ${d}`,I.textBaseline="alphabetic",I.textAlign="left",I.fillStyle="black",this.gridOuter=new Float64Array(E*E),this.gridInner=new Float64Array(E*E),this.f=new Float64Array(E),this.z=new Float64Array(E+1),this.v=new Uint16Array(E)}_createCanvas(g){const e=document.createElement("canvas");return e.width=e.height=g,e}draw(g){const{width:e,actualBoundingBoxAscent:a,actualBoundingBoxDescent:u,actualBoundingBoxLeft:d,actualBoundingBoxRight:m}=this.ctx.measureText(g),k=Math.ceil(a),E=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(m-d))),T=Math.min(this.size-this.buffer,k+Math.ceil(u)),I=E+2*this.buffer,O=T+2*this.buffer,B=Math.max(I*O,0),U=new Uint8ClampedArray(B),Z={data:U,width:I,height:O,glyphWidth:E,glyphHeight:T,glyphTop:k,glyphLeft:0,glyphAdvance:e};if(E===0||T===0)return Z;const{ctx:G,buffer:Q,gridInner:ne,gridOuter:re}=this;G.clearRect(Q,Q,E,T),G.fillText(g,Q,Q+k);const oe=G.getImageData(Q,Q,E,T);re.fill(pi,0,B),ne.fill(0,0,B);for(let X=0;X<T;X++)for(let ue=0;ue<E;ue++){const pe=oe.data[4*(X*E+ue)+3]/255;if(pe===0)continue;const ye=(X+Q)*I+ue+Q;if(pe===1)re[ye]=0,ne[ye]=pi;else{const Ce=.5-pe;re[ye]=Ce>0?Ce*Ce:0,ne[ye]=Ce<0?Ce*Ce:0}}rn(re,0,0,I,O,I,this.f,this.v,this.z),rn(ne,Q,Q,E,T,I,this.f,this.v,this.z);for(let X=0;X<B;X++){const ue=Math.sqrt(re[X])-Math.sqrt(ne[X]);U[X]=Math.round(255-255*(ue/this.radius+this.cutoff))}return Z}};class kr{constructor(){this.specification=h.v.light.position}possiblyEvaluate(e,a){return h.x(e.expression.evaluate(a))}interpolate(e,a,u){return{x:h.y.number(e.x,a.x,u),y:h.y.number(e.y,a.y,u),z:h.y.number(e.z,a.z,u)}}}let jn;class Sn extends h.E{constructor(e){super(),jn=jn||new h.q({anchor:new h.D(h.v.light.anchor),position:new kr,color:new h.D(h.v.light.color),intensity:new h.D(h.v.light.intensity)}),this._transitionable=new h.T(jn),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,a={}){if(!this._validate(h.r,e,a))for(const u in e){const d=e[u];u.endsWith("-transition")?this._transitionable.setTransition(u.slice(0,-11),d):this._transitionable.setValue(u,d)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,a,u){return(!u||u.validate!==!1)&&h.t(this,e.call(h.u,{value:a,style:{glyphs:!0,sprite:!0},styleSpec:h.v}))}}const Hi=new h.q({"sky-color":new h.D(h.v.sky["sky-color"]),"horizon-color":new h.D(h.v.sky["horizon-color"]),"fog-color":new h.D(h.v.sky["fog-color"]),"fog-ground-blend":new h.D(h.v.sky["fog-ground-blend"]),"horizon-fog-blend":new h.D(h.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new h.D(h.v.sky["sky-horizon-blend"]),"atmosphere-blend":new h.D(h.v.sky["atmosphere-blend"])});class sn extends h.E{constructor(e){super(),this._transitionable=new h.T(Hi),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new h.z(0))}setSky(e,a={}){if(!this._validate(h.B,e,a)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const u in e){const d=e[u];u.endsWith("-transition")?this._transitionable.setTransition(u.slice(0,-11),d):this._transitionable.setValue(u,d)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,a,u={}){return(u==null?void 0:u.validate)!==!1&&h.t(this,e.call(h.u,h.e({value:a,style:{glyphs:!0,sprite:!0},styleSpec:h.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class Sr{constructor(e,a){this.width=e,this.height=a,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,a){const u=e.join(",")+String(a);return this.dashEntry[u]||(this.dashEntry[u]=this.addDash(e,a)),this.dashEntry[u]}getDashRanges(e,a,u){const d=[];let m=e.length%2==1?-e[e.length-1]*u:0,k=e[0]*u,E=!0;d.push({left:m,right:k,isDash:E,zeroLength:e[0]===0});let T=e[0];for(let I=1;I<e.length;I++){E=!E;const O=e[I];m=T*u,T+=O,k=T*u,d.push({left:m,right:k,isDash:E,zeroLength:O===0})}return d}addRoundDash(e,a,u){const d=a/2;for(let m=-u;m<=u;m++){const k=this.width*(this.nextRow+u+m);let E=0,T=e[E];for(let I=0;I<this.width;I++){I/T.right>1&&(T=e[++E]);const O=Math.abs(I-T.left),B=Math.abs(I-T.right),U=Math.min(O,B);let Z;const G=m/u*(d+1);if(T.isDash){const Q=d-Math.abs(G);Z=Math.sqrt(U*U+Q*Q)}else Z=d-Math.sqrt(U*U+G*G);this.data[k+I]=Math.max(0,Math.min(255,Z+128))}}}addRegularDash(e){for(let E=e.length-1;E>=0;--E){const T=e[E],I=e[E+1];T.zeroLength?e.splice(E,1):I&&I.isDash===T.isDash&&(I.left=T.left,e.splice(E,1))}const a=e[0],u=e[e.length-1];a.isDash===u.isDash&&(a.left=u.left-this.width,u.right=a.right+this.width);const d=this.width*this.nextRow;let m=0,k=e[m];for(let E=0;E<this.width;E++){E/k.right>1&&(k=e[++m]);const T=Math.abs(E-k.left),I=Math.abs(E-k.right),O=Math.min(T,I);this.data[d+E]=Math.max(0,Math.min(255,(k.isDash?O:-O)+128))}}addDash(e,a){const u=a?7:0,d=2*u+1;if(this.nextRow+d>this.height)return h.w("LineAtlas out of space"),null;let m=0;for(let E=0;E<e.length;E++)m+=e[E];if(m!==0){const E=this.width/m,T=this.getDashRanges(e,this.width,E);a?this.addRoundDash(T,E,u):this.addRegularDash(T)}const k={y:(this.nextRow+u+.5)/this.height,height:2*u/this.height,width:m};return this.nextRow+=d,this.dirty=!0,k}bind(e){const a=e.gl;this.texture?(a.bindTexture(a.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,a.texSubImage2D(a.TEXTURE_2D,0,0,0,this.width,this.height,a.ALPHA,a.UNSIGNED_BYTE,this.data))):(this.texture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.texture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.REPEAT),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.REPEAT),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texImage2D(a.TEXTURE_2D,0,a.ALPHA,this.width,this.height,0,a.ALPHA,a.UNSIGNED_BYTE,this.data))}}const En="maplibre_preloaded_worker_pool";class Tn{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Tn.workerCount;)this.workers.push(new Worker(h.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(a=>{a.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[En]}numActive(){return Object.keys(this.active).length}}const Cn=Math.floor(R.hardwareConcurrency/2);let Se,He;function Ze(){return Se||(Se=new Tn),Se}Tn.workerCount=h.C(globalThis)?Math.max(Math.min(Cn,3),1):1;class lt{constructor(e,a){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=a;const u=this.workerPool.acquire(a);for(let d=0;d<u.length;d++){const m=new h.F(u[d],a);m.name=`Worker ${d}`,this.actors.push(m)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,a){const u=[];for(const d of this.actors)u.push(d.sendAsync({type:e,data:a}));return Promise.all(u)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(a=>{a.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,a){for(const u of this.actors)u.registerMessageHandler(e,a)}}function Vt(){return He||(He=new lt(Ze(),h.G),He.registerMessageHandler("GR",(g,e,a)=>h.m(e,a))),He}function Qt(g,e){const a=h.H();return h.J(a,a,[1,1,0]),h.K(a,a,[.5*g.width,.5*g.height,1]),h.L(a,a,g.calculatePosMatrix(e.toUnwrapped()))}function Et(g,e,a,u,d,m){const k=function(B,U,Z){if(B)for(const G of B){const Q=U[G];if(Q&&Q.source===Z&&Q.type==="fill-extrusion")return!0}else for(const G in U){const Q=U[G];if(Q.source===Z&&Q.type==="fill-extrusion")return!0}return!1}(d&&d.layers,e,g.id),E=m.maxPitchScaleFactor(),T=g.tilesIn(u,E,k);T.sort(vt);const I=[];for(const B of T)I.push({wrappedTileID:B.tileID.wrapped().key,queryResults:B.tile.queryRenderedFeatures(e,a,g._state,B.queryGeometry,B.cameraQueryGeometry,B.scale,d,m,E,Qt(g.transform,B.tileID))});const O=function(B){const U={},Z={};for(const G of B){const Q=G.queryResults,ne=G.wrappedTileID,re=Z[ne]=Z[ne]||{};for(const oe in Q){const X=Q[oe],ue=re[oe]=re[oe]||{},pe=U[oe]=U[oe]||[];for(const ye of X)ue[ye.featureIndex]||(ue[ye.featureIndex]=!0,pe.push(ye))}}return U}(I);for(const B in O)O[B].forEach(U=>{const Z=U.feature,G=g.getFeatureState(Z.layer["source-layer"],Z.id);Z.source=Z.layer.source,Z.layer["source-layer"]&&(Z.sourceLayer=Z.layer["source-layer"]),Z.state=G});return O}function vt(g,e){const a=g.tileID,u=e.tileID;return a.overscaledZ-u.overscaledZ||a.canonical.y-u.canonical.y||a.wrap-u.wrap||a.canonical.x-u.canonical.x}function ri(g,e,a){return h._(this,void 0,void 0,function*(){let u=g;if(g.url?u=(yield h.h(e.transformRequest(g.url,"Source"),a)).data:yield R.frameAsync(a),!u)return null;const d=h.M(h.e(u,g),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in u&&u.vector_layers&&(d.vectorLayerIds=u.vector_layers.map(m=>m.id)),d})}class xe{constructor(e,a){e&&(a?this.setSouthWest(e).setNorthEast(a):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof h.N?new h.N(e.lng,e.lat):h.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof h.N?new h.N(e.lng,e.lat):h.N.convert(e),this}extend(e){const a=this._sw,u=this._ne;let d,m;if(e instanceof h.N)d=e,m=e;else{if(!(e instanceof xe))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(xe.convert(e)):this.extend(h.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(h.N.convert(e)):this;if(d=e._sw,m=e._ne,!d||!m)return this}return a||u?(a.lng=Math.min(d.lng,a.lng),a.lat=Math.min(d.lat,a.lat),u.lng=Math.max(m.lng,u.lng),u.lat=Math.max(m.lat,u.lat)):(this._sw=new h.N(d.lng,d.lat),this._ne=new h.N(m.lng,m.lat)),this}getCenter(){return new h.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new h.N(this.getWest(),this.getNorth())}getSouthEast(){return new h.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:a,lat:u}=h.N.convert(e);let d=this._sw.lng<=a&&a<=this._ne.lng;return this._sw.lng>this._ne.lng&&(d=this._sw.lng>=a&&a>=this._ne.lng),this._sw.lat<=u&&u<=this._ne.lat&&d}static convert(e){return e instanceof xe?e:e&&new xe(e)}static fromLngLat(e,a=0){const u=360*a/40075017,d=u/Math.cos(Math.PI/180*e.lat);return new xe(new h.N(e.lng-d,e.lat-u),new h.N(e.lng+d,e.lat+u))}adjustAntiMeridian(){const e=new h.N(this._sw.lng,this._sw.lat),a=new h.N(this._ne.lng,this._ne.lat);return new xe(e,e.lng>a.lng?new h.N(a.lng+360,a.lat):a)}}class wi{constructor(e,a,u){this.bounds=xe.convert(this.validateBounds(e)),this.minzoom=a||0,this.maxzoom=u||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const a=Math.pow(2,e.z),u=Math.floor(h.O(this.bounds.getWest())*a),d=Math.floor(h.Q(this.bounds.getNorth())*a),m=Math.ceil(h.O(this.bounds.getEast())*a),k=Math.ceil(h.Q(this.bounds.getSouth())*a);return e.x>=u&&e.x<m&&e.y>=d&&e.y<k}}class Go extends h.E{constructor(e,a,u,d){if(super(),this.id=e,this.dispatcher=u,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,h.e(this,h.M(a,["url","scheme","tileSize","promoteId"])),this._options=h.e({type:"vector"},a),this._collectResourceTiming=a.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d)}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield ri(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(h.e(this,e),e.bounds&&(this.tileBounds=new wi(e.bounds,this.minzoom,this.maxzoom)),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new h.j(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return h.e({},this._options)}loadTile(e){return h._(this,void 0,void 0,function*(){const a=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(a,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};u.request.collectResourceTiming=this._collectResourceTiming;let d="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((m,k)=>{e.reloadPromise={resolve:m,reject:k}})}else e.actor=this.dispatcher.getActor(),d="LT";e.abortController=new AbortController;try{const m=yield e.actor.sendAsync({type:d,data:u},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,m)}catch(m){if(delete e.abortController,e.aborted)return;if(m&&m.status!==404)throw m;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,a){if(a&&a.resourceTiming&&(e.resourceTiming=a.resourceTiming),a&&this.map._refreshExpiredTiles&&e.setExpiryData(a),e.loadVectorData(a,this.map.painter),e.reloadPromise){const u=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(u.resolve).catch(u.reject)}}abortTile(e){return h._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return h._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Zt extends h.E{constructor(e,a,u,d){super(),this.id=e,this.dispatcher=u,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=h.e({type:"raster"},a),h.e(this,h.M(a,["url","scheme","tileSize"]))}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield ri(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(h.e(this,e),e.bounds&&(this.tileBounds=new wi(e.bounds,this.minzoom,this.maxzoom)),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new h.j(e))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return h.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return h._(this,void 0,void 0,function*(){const a=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const u=yield _e.getImage(this.map._requestManager.transformRequest(a,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(u&&u.data){this.map._refreshExpiredTiles&&u.cacheControl&&u.expires&&e.setExpiryData({cacheControl:u.cacheControl,expires:u.expires});const d=this.map.painter.context,m=d.gl,k=u.data;e.texture=this.map.painter.getTileTexture(k.width),e.texture?e.texture.update(k,{useMipmap:!0}):(e.texture=new Mt(d,k,m.RGBA,{useMipmap:!0}),e.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(u){if(delete e.abortController,e.aborted)e.state="unloaded";else if(u)throw e.state="errored",u}})}abortTile(e){return h._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return h._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class ki extends Zt{constructor(e,a,u,d){super(e,a,u,d),this.type="raster-dem",this.maxzoom=22,this._options=h.e({type:"raster-dem"},a),this.encoding=a.encoding||"mapbox",this.redFactor=a.redFactor,this.greenFactor=a.greenFactor,this.blueFactor=a.blueFactor,this.baseShift=a.baseShift}loadTile(e){return h._(this,void 0,void 0,function*(){const a=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u=this.map._requestManager.transformRequest(a,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const d=yield _e.getImage(u,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(d&&d.data){const m=d.data;this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&e.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const k=h.b(m)&&h.U()?m:yield this.readImageNow(m),E={type:this.type,uid:e.uid,source:this.id,rawImageData:k,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const T=yield e.actor.sendAsync({type:"LDT",data:E});e.dem=T,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(d){if(delete e.abortController,e.aborted)e.state="unloaded";else if(d)throw e.state="errored",d}})}readImageNow(e){return h._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&h.V()){const a=e.width+2,u=e.height+2;try{return new h.R({width:a,height:u},yield h.W(e,-1,-1,a,u))}catch{}}return R.getImageData(e,1)})}_getNeighboringTiles(e){const a=e.canonical,u=Math.pow(2,a.z),d=(a.x-1+u)%u,m=a.x===0?e.wrap-1:e.wrap,k=(a.x+1+u)%u,E=a.x+1===u?e.wrap+1:e.wrap,T={};return T[new h.S(e.overscaledZ,m,a.z,d,a.y).key]={backfilled:!1},T[new h.S(e.overscaledZ,E,a.z,k,a.y).key]={backfilled:!1},a.y>0&&(T[new h.S(e.overscaledZ,m,a.z,d,a.y-1).key]={backfilled:!1},T[new h.S(e.overscaledZ,e.wrap,a.z,a.x,a.y-1).key]={backfilled:!1},T[new h.S(e.overscaledZ,E,a.z,k,a.y-1).key]={backfilled:!1}),a.y+1<u&&(T[new h.S(e.overscaledZ,m,a.z,d,a.y+1).key]={backfilled:!1},T[new h.S(e.overscaledZ,e.wrap,a.z,a.x,a.y+1).key]={backfilled:!1},T[new h.S(e.overscaledZ,E,a.z,k,a.y+1).key]={backfilled:!1}),T}unloadTile(e){return h._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class Yo extends h.E{constructor(e,a,u,d){super(),this.id=e,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=u.getActor(),this.setEventedParent(d),this._data=a.data,this._options=h.e({},a),this._collectResourceTiming=a.collectResourceTiming,a.maxzoom!==void 0&&(this.maxzoom=a.maxzoom),a.type&&(this.type=a.type),a.attribution&&(this.attribution=a.attribution),this.promoteId=a.promoteId;const m=h.X/this.tileSize;a.clusterMaxZoom!==void 0&&this.maxzoom<=a.clusterMaxZoom&&h.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${a.clusterMaxZoom}".`),this.workerOptions=h.e({source:this.id,cluster:a.cluster||!1,geojsonVtOptions:{buffer:(a.buffer!==void 0?a.buffer:128)*m,tolerance:(a.tolerance!==void 0?a.tolerance:.375)*m,extent:h.X,maxZoom:this.maxzoom,lineMetrics:a.lineMetrics||!1,generateId:a.generateId||!1},superclusterOptions:{maxZoom:a.clusterMaxZoom!==void 0?a.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,a.clusterMinPoints||2),extent:h.X,radius:(a.clusterRadius||50)*m,log:!1,generateId:a.generateId||!1},clusterProperties:a.clusterProperties,filter:a.filter},a.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return h._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return h._(this,void 0,void 0,function*(){const e=h.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,a,u){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:a,offset:u}})}_updateWorkerData(e){return h._(this,void 0,void 0,function*(){const a=h.e({type:this.type},this.workerOptions);e?a.dataDiff=e:typeof this._data=="string"?(a.request=this.map._requestManager.transformRequest(R.resolveURL(this._data),"Source"),a.request.collectResourceTiming=this._collectResourceTiming):a.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new h.k("dataloading",{dataType:"source"}));try{const u=yield this.actor.sendAsync({type:"LD",data:a});if(this._pendingLoads--,this._removed||u.abandoned)return void this.fire(new h.k("dataabort",{dataType:"source"}));let d=null;u.resourceTiming&&u.resourceTiming[this.id]&&(d=u.resourceTiming[this.id].slice(0));const m={dataType:"source"};this._collectResourceTiming&&d&&d.length>0&&h.e(m,{resourceTiming:d}),this.fire(new h.k("data",Object.assign(Object.assign({},m),{sourceDataType:"metadata"}))),this.fire(new h.k("data",Object.assign(Object.assign({},m),{sourceDataType:"content"})))}catch(u){if(this._pendingLoads--,this._removed)return void this.fire(new h.k("dataabort",{dataType:"source"}));this.fire(new h.j(u))}})}loaded(){return this._pendingLoads===0}loadTile(e){return h._(this,void 0,void 0,function*(){const a=e.actor?"RT":"LT";e.actor=this.actor;const u={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;const d=yield this.actor.sendAsync({type:a,data:u},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(d,this.map.painter,a==="RT")})}abortTile(e){return h._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return h._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return h.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var is=h.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class $r extends h.E{constructor(e,a,u,d){super(),this.id=e,this.dispatcher=u,this.coordinates=a.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=a}load(e){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const a=yield _e.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,a&&a.data&&(this.image=a.data,e&&(this.coordinates=e),this._finishLoading())}catch(a){this._request=null,this._loaded=!0,this.fire(new h.j(a))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const a=e.map(h.Z.fromLngLat);this.tileID=function(d){let m=1/0,k=1/0,E=-1/0,T=-1/0;for(const U of d)m=Math.min(m,U.x),k=Math.min(k,U.y),E=Math.max(E,U.x),T=Math.max(T,U.y);const I=Math.max(E-m,T-k),O=Math.max(0,Math.floor(-Math.log(I)/Math.LN2)),B=Math.pow(2,O);return new h.a1(O,Math.floor((m+E)/2*B),Math.floor((k+T)/2*B))}(a),this.minzoom=this.maxzoom=this.tileID.z;const u=a.map(d=>this.tileID.getTilePoint(d)._round());return this._boundsArray=new h.$,this._boundsArray.emplaceBack(u[0].x,u[0].y,0,0),this._boundsArray.emplaceBack(u[1].x,u[1].y,h.X,0),this._boundsArray.emplaceBack(u[3].x,u[3].y,0,h.X),this._boundsArray.emplaceBack(u[2].x,u[2].y,h.X,h.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,a=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,is.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Mt(e,this.image,a.RGBA),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let u=!1;for(const d in this.tiles){const m=this.tiles[d];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,u=!0)}u&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return h._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Js extends $r{constructor(e,a,u,d){super(e,a,u,d),this.roundZoom=!0,this.type="video",this.options=a}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const a of e.urls)this.urls.push(this.map._requestManager.transformRequest(a,"Source").url);try{const a=yield h.a3(this.urls);if(this._loaded=!0,!a)return;this.video=a,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(a){this.fire(new h.j(a))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const a=this.video.seekable;e<a.start(0)||e>a.end(0)?this.fire(new h.j(new h.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${a.start(0)} and ${a.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,a=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,is.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,this.video)):(this.texture=new Mt(e,this.video,a.RGBA),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let u=!1;for(const d in this.tiles){const m=this.tiles[d];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,u=!0)}u&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Un extends $r{constructor(e,a,u,d){super(e,a,u,d),a.coordinates?Array.isArray(a.coordinates)&&a.coordinates.length===4&&!a.coordinates.some(m=>!Array.isArray(m)||m.length!==2||m.some(k=>typeof k!="number"))||this.fire(new h.j(new h.a2(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.j(new h.a2(`sources.${e}`,null,'missing required property "coordinates"'))),a.animate&&typeof a.animate!="boolean"&&this.fire(new h.j(new h.a2(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),a.canvas?typeof a.canvas=="string"||a.canvas instanceof HTMLCanvasElement||this.fire(new h.j(new h.a2(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new h.j(new h.a2(`sources.${e}`,null,'missing required property "canvas"'))),this.options=a,this.animate=a.animate===void 0||a.animate}load(){return h._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new h.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const a=this.map.painter.context,u=a.gl;this.boundsBuffer||(this.boundsBuffer=a.createVertexBuffer(this._boundsArray,is.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Mt(a,this.canvas,u.RGBA,{premultiply:!0});let d=!1;for(const m in this.tiles){const k=this.tiles[m];k.state!=="loaded"&&(k.state="loaded",k.texture=this.texture,d=!0)}d&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const Xo={},Ko=g=>{switch(g){case"geojson":return Yo;case"image":return $r;case"raster":return Zt;case"raster-dem":return ki;case"vector":return Go;case"video":return Js;case"canvas":return Un}return Xo[g]},De="RTLPluginLoaded";class Er extends h.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Vt()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(a=>{throw this.status="error",a})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return h._(this,arguments,void 0,function*(a,u=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=R.resolveURL(a),!this.url)throw new Error(`requested url ${a} is invalid`);if(this.status==="unavailable"){if(!u)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return h._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new h.k(De))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let on=null;function Tr(){return on||(on=new Er),on}class ns{constructor(e,a){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=h.a4(),this.uses=0,this.tileSize=a,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(e){const a=e+this.timeAdded;a<this.fadeEndTime||(this.fadeEndTime=a)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,a,u){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(d,m){const k={};if(!m)return k;for(const E of d){const T=E.layerIds.map(I=>m.getLayer(I)).filter(Boolean);if(T.length!==0){E.layers=T,E.stateDependentLayerIds&&(E.stateDependentLayers=E.stateDependentLayerIds.map(I=>T.filter(O=>O.id===I)[0]));for(const I of T)k[I.id]=E}}return k}(e.buckets,a.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const m=this.buckets[d];if(m instanceof h.a6){if(this.hasSymbolBuckets=!0,!u)break;m.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const m=this.buckets[d];if(m instanceof h.a6&&m.hasRTLText){this.hasRTLText=!0,Tr().lazyLoad();break}}this.queryPadding=0;for(const d in this.buckets){const m=this.buckets[d];this.queryPadding=Math.max(this.queryPadding,a.style.getLayer(d).queryRadius(m))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new h.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const u in this.buckets){const d=this.buckets[u];d.uploadPending()&&d.upload(e)}const a=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Mt(e,this.imageAtlas.image,a.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Mt(e,this.glyphAtlasImage,a.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,a,u,d,m,k,E,T,I,O){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:d,cameraQueryGeometry:m,scale:k,tileSize:this.tileSize,pixelPosMatrix:O,transform:T,params:E,queryPadding:this.queryPadding*I},e,a,u):{}}querySourceFeatures(e,a){const u=this.latestFeatureIndex;if(!u||!u.rawTileData)return;const d=u.loadVTLayers(),m=a&&a.sourceLayer?a.sourceLayer:"",k=d._geojsonTileLayer||d[m];if(!k)return;const E=h.a7(a&&a.filter),{z:T,x:I,y:O}=this.tileID.canonical,B={z:T,x:I,y:O};for(let U=0;U<k.length;U++){const Z=k.feature(U);if(E.needGeometry){const ne=h.a8(Z,!0);if(!E.filter(new h.z(this.tileID.overscaledZ),ne,this.tileID.canonical))continue}else if(!E.filter(new h.z(this.tileID.overscaledZ),Z))continue;const G=u.getId(Z,m),Q=new h.a9(Z,T,I,O,G);Q.tile=B,e.push(Q)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const a=this.expirationTime;if(e.cacheControl){const u=h.aa(e.cacheControl);u["max-age"]&&(this.expirationTime=Date.now()+1e3*u["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const u=Date.now();let d=!1;if(this.expirationTime>u)d=!1;else if(a)if(this.expirationTime<a)d=!0;else{const m=this.expirationTime-a;m?this.expirationTime=u+Math.max(m,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,a){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const u=this.latestFeatureIndex.loadVTLayers();for(const d in this.buckets){if(!a.style.hasLayer(d))continue;const m=this.buckets[d],k=m.layers[0].sourceLayer||"_geojsonTileLayer",E=u[k],T=e[k];if(!E||!T||Object.keys(T).length===0)continue;m.update(T,E,this.imageAtlas&&this.imageAtlas.patternPositions||{});const I=a&&a.style&&a.style.getLayer(d);I&&(this.queryPadding=Math.max(this.queryPadding,I.queryRadius(m)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<R.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=R.now()+e}setDependencies(e,a){const u={};for(const d of a)u[d]=!0;this.dependencies[e]=u}hasDependency(e,a){for(const u of e){const d=this.dependencies[u];if(d){for(const m of a)if(d[m])return!0}}return!1}}class Fe{constructor(e,a){this.max=e,this.onRemove=a,this.reset()}reset(){for(const e in this.data)for(const a of this.data[e])a.timeout&&clearTimeout(a.timeout),this.onRemove(a.value);return this.data={},this.order=[],this}add(e,a,u){const d=e.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const m={value:a,timeout:void 0};if(u!==void 0&&(m.timeout=setTimeout(()=>{this.remove(e,m)},u)),this.data[d].push(m),this.order.push(d),this.order.length>this.max){const k=this._getAndRemoveByKey(this.order[0]);k&&this.onRemove(k)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const a=this.data[e].shift();return a.timeout&&clearTimeout(a.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),a.value}getByKey(e){const a=this.data[e];return a?a[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,a){if(!this.has(e))return this;const u=e.wrapped().key,d=a===void 0?0:this.data[u].indexOf(a),m=this.data[u][d];return this.data[u].splice(d,1),m.timeout&&clearTimeout(m.timeout),this.data[u].length===0&&delete this.data[u],this.onRemove(m.value),this.order.splice(this.order.indexOf(u),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}filter(e){const a=[];for(const u in this.data)for(const d of this.data[u])e(d.value)||a.push(d);for(const u of a)this.remove(u.value.tileID,u)}}class Ct{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,a,u){const d=String(a);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][d]=this.stateChanges[e][d]||{},h.e(this.stateChanges[e][d],u),this.deletedStates[e]===null){this.deletedStates[e]={};for(const m in this.state[e])m!==d&&(this.deletedStates[e][m]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][d]===null){this.deletedStates[e][d]={};for(const m in this.state[e][d])u[m]||(this.deletedStates[e][d][m]=null)}else for(const m in u)this.deletedStates[e]&&this.deletedStates[e][d]&&this.deletedStates[e][d][m]===null&&delete this.deletedStates[e][d][m]}removeFeatureState(e,a,u){if(this.deletedStates[e]===null)return;const d=String(a);if(this.deletedStates[e]=this.deletedStates[e]||{},u&&a!==void 0)this.deletedStates[e][d]!==null&&(this.deletedStates[e][d]=this.deletedStates[e][d]||{},this.deletedStates[e][d][u]=null);else if(a!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][d])for(u in this.deletedStates[e][d]={},this.stateChanges[e][d])this.deletedStates[e][d][u]=null;else this.deletedStates[e][d]=null;else this.deletedStates[e]=null}getState(e,a){const u=String(a),d=h.e({},(this.state[e]||{})[u],(this.stateChanges[e]||{})[u]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const m=this.deletedStates[e][a];if(m===null)return{};for(const k in m)delete d[k]}return d}initializeTileState(e,a){e.setFeatureState(this.state,a)}coalesceChanges(e,a){const u={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const m={};for(const k in this.stateChanges[d])this.state[d][k]||(this.state[d][k]={}),h.e(this.state[d][k],this.stateChanges[d][k]),m[k]=this.state[d][k];u[d]=m}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const m={};if(this.deletedStates[d]===null)for(const k in this.state[d])m[k]={},this.state[d][k]={};else for(const k in this.deletedStates[d]){if(this.deletedStates[d][k]===null)this.state[d][k]={};else for(const E of Object.keys(this.deletedStates[d][k]))delete this.state[d][k][E];m[k]=this.state[d][k]}u[d]=u[d]||{},h.e(u[d],m)}if(this.stateChanges={},this.deletedStates={},Object.keys(u).length!==0)for(const d in e)e[d].setFeatureState(u,a)}}class mt extends h.E{constructor(e,a,u){super(),this.id=e,this.dispatcher=u,this.on("data",d=>this._dataHandler(d)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((d,m,k,E)=>{const T=new(Ko(m.type))(d,m,k,E);if(T.id!==d)throw new Error(`Expected Source id to be ${d} instead of ${T.id}`);return T})(e,a,u,this),this._tiles={},this._cache=new Fe(0,d=>this._unloadTile(d)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ct,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!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 e in this._tiles){const a=this._tiles[e];if(a.state!=="loaded"&&a.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,a,u){return h._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,a,u)}catch(d){e.state="errored",d.status!==404?this._source.fire(new h.j(d,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new h.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const a in this._tiles){const u=this._tiles[a];u.upload(e),u.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(fn).map(e=>e.key)}getRenderableIds(e){const a=[];for(const u in this._tiles)this._isIdRenderable(u,e)&&a.push(this._tiles[u]);return e?a.sort((u,d)=>{const m=u.tileID,k=d.tileID,E=new h.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),T=new h.P(k.canonical.x,k.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-k.overscaledZ||T.y-E.y||T.x-E.x}).map(u=>u.tileID.key):a.map(u=>u.tileID).sort(fn).map(u=>u.key)}hasRenderableParent(e){const a=this.findLoadedParent(e,0);return!!a&&this._isIdRenderable(a.tileID.key)}_isIdRenderable(e,a){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(a||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,a){return h._(this,void 0,void 0,function*(){const u=this._tiles[e];u&&(u.state!=="loading"&&(u.state=a),yield this._loadTile(u,e,a))})}_tileLoaded(e,a,u){e.timeAdded=R.now(),u==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(a,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new h.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const a=this.getRenderableIds();for(let d=0;d<a.length;d++){const m=a[d];if(e.neighboringTiles&&e.neighboringTiles[m]){const k=this.getTileByID(m);u(e,k),u(k,e)}}function u(d,m){d.needsHillshadePrepare=!0,d.needsTerrainPrepare=!0;let k=m.tileID.canonical.x-d.tileID.canonical.x;const E=m.tileID.canonical.y-d.tileID.canonical.y,T=Math.pow(2,d.tileID.canonical.z),I=m.tileID.key;k===0&&E===0||Math.abs(E)>1||(Math.abs(k)>1&&(Math.abs(k+T)===1?k+=T:Math.abs(k-T)===1&&(k-=T)),m.dem&&d.dem&&(d.dem.backfillBorder(m.dem,k,E),d.neighboringTiles&&d.neighboringTiles[I]&&(d.neighboringTiles[I].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,a,u,d){for(const m in this._tiles){let k=this._tiles[m];if(d[m]||!k.hasData()||k.tileID.overscaledZ<=a||k.tileID.overscaledZ>u)continue;let E=k.tileID;for(;k&&k.tileID.overscaledZ>a+1;){const I=k.tileID.scaledTo(k.tileID.overscaledZ-1);k=this._tiles[I.key],k&&k.hasData()&&(E=I)}let T=E;for(;T.overscaledZ>a;)if(T=T.scaledTo(T.overscaledZ-1),e[T.key]){d[E.key]=E;break}}}findLoadedParent(e,a){if(e.key in this._loadedParentTiles){const u=this._loadedParentTiles[e.key];return u&&u.tileID.overscaledZ>=a?u:null}for(let u=e.overscaledZ-1;u>=a;u--){const d=e.scaledTo(u),m=this._getLoadedTile(d);if(m)return m}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const a=this._tiles[e.key];return a&&a.hasData()?a:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const a=Math.ceil(e.width/this._source.tileSize)+1,u=Math.ceil(e.height/this._source.tileSize)+1,d=Math.floor(a*u*(this._maxTileCacheZoomLevels===null?h.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),m=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(m)}handleWrapJump(e){const a=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,a){const u={};for(const d in this._tiles){const m=this._tiles[d];m.tileID=m.tileID.unwrapTo(m.tileID.wrap+a),u[m.tileID.key]=m}this._tiles=u;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(d,this._tiles[d])}}_updateCoveredAndRetainedTiles(e,a,u,d,m,k){const E={},T={},I=Object.keys(e),O=R.now();for(const B of I){const U=e[B],Z=this._tiles[B];if(!Z||Z.fadeEndTime!==0&&Z.fadeEndTime<=O)continue;const G=this.findLoadedParent(U,a),Q=this.findLoadedSibling(U),ne=G||Q||null;ne&&(this._addTile(ne.tileID),E[ne.tileID.key]=ne.tileID),T[B]=U}this._retainLoadedChildren(T,d,u,e);for(const B in E)e[B]||(this._coveredTiles[B]=!0,e[B]=E[B]);if(k){const B={},U={};for(const Z of m)this._tiles[Z.key].hasData()?B[Z.key]=Z:U[Z.key]=Z;for(const Z in U){const G=U[Z].children(this._source.maxzoom);this._tiles[G[0].key]&&this._tiles[G[1].key]&&this._tiles[G[2].key]&&this._tiles[G[3].key]&&(B[G[0].key]=e[G[0].key]=G[0],B[G[1].key]=e[G[1].key]=G[1],B[G[2].key]=e[G[2].key]=G[2],B[G[3].key]=e[G[3].key]=G[3],delete U[Z])}for(const Z in U){const G=U[Z],Q=this.findLoadedParent(G,this._source.minzoom),ne=this.findLoadedSibling(G),re=Q||ne||null;if(re){B[re.tileID.key]=e[re.tileID.key]=re.tileID;for(const oe in B)B[oe].isChildOf(re.tileID)&&delete B[oe]}}for(const Z in this._tiles)B[Z]||(this._coveredTiles[Z]=!0)}}update(e,a){if(!this._sourceLoaded||this._paused)return;let u;this.transform=e,this.terrain=a,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?u=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(O=>new h.S(O.canonical.z,O.wrap,O.canonical.z,O.canonical.x,O.canonical.y)):(u=e.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:a}),this._source.hasTile&&(u=u.filter(O=>this._source.hasTile(O)))):u=[];const d=e.coveringZoomLevel(this._source),m=Math.max(d-mt.maxOverzooming,this._source.minzoom),k=Math.max(d+mt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const O={};for(const B of u)if(B.canonical.z>this._source.minzoom){const U=B.scaledTo(B.canonical.z-1);O[U.key]=U;const Z=B.scaledTo(Math.max(this._source.minzoom,Math.min(B.canonical.z,5)));O[Z.key]=Z}u=u.concat(Object.values(O))}const E=u.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,E&&this.fire(new h.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const T=this._updateRetainedTiles(u,d);ir(this._source.type)&&this._updateCoveredAndRetainedTiles(T,m,k,d,u,a);for(const O in T)this._tiles[O].clearFadeHold();const I=h.ab(this._tiles,T);for(const O of I){const B=this._tiles[O];B.hasSymbolBuckets&&!B.holdingForFade()?B.setHoldDuration(this.map._fadeDuration):B.hasSymbolBuckets&&!B.symbolFadeFinished()||this._removeTile(O)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,a){var u;const d={},m={},k=Math.max(a-mt.maxOverzooming,this._source.minzoom),E=Math.max(a+mt.maxUnderzooming,this._source.minzoom),T={};for(const I of e){const O=this._addTile(I);d[I.key]=I,O.hasData()||a<this._source.maxzoom&&(T[I.key]=I)}this._retainLoadedChildren(T,a,E,d);for(const I of e){let O=this._tiles[I.key];if(O.hasData())continue;if(a+1>this._source.maxzoom){const U=I.children(this._source.maxzoom)[0],Z=this.getTile(U);if(Z&&Z.hasData()){d[U.key]=U;continue}}else{const U=I.children(this._source.maxzoom);if(d[U[0].key]&&d[U[1].key]&&d[U[2].key]&&d[U[3].key])continue}let B=O.wasRequested();for(let U=I.overscaledZ-1;U>=k;--U){const Z=I.scaledTo(U);if(m[Z.key])break;if(m[Z.key]=!0,O=this.getTile(Z),!O&&B&&(O=this._addTile(Z)),O){const G=O.hasData();if((G||!(!((u=this.map)===null||u===void 0)&&u.cancelPendingTileRequestsWhileZooming)||B)&&(d[Z.key]=Z),B=O.wasRequested(),G)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const a=[];let u,d=this._tiles[e].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){u=this._loadedParentTiles[d.key];break}a.push(d.key);const m=d.scaledTo(d.overscaledZ-1);if(u=this._getLoadedTile(m),u)break;d=m}for(const m of a)this._loadedParentTiles[m]=u}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const a=this._tiles[e].tileID,u=this._getLoadedTile(a);this._loadedSiblingTiles[a.key]=u}}_addTile(e){let a=this._tiles[e.key];if(a)return a;a=this._cache.getAndRemove(e),a&&(this._setTileReloadTimer(e.key,a),a.tileID=e,this._state.initializeTileState(a,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,a)));const u=a;return a||(a=new ns(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(a,e.key,a.state)),a.uses++,this._tiles[e.key]=a,u||this._source.fire(new h.k("dataloading",{tile:a,coord:a.tileID,dataType:"source"})),a}_setTileReloadTimer(e,a){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const u=a.getExpiryTimeout();u&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},u))}_removeTile(e){const a=this._tiles[e];a&&(a.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),a.uses>0||(a.hasData()&&a.state!=="reloading"?this._cache.add(a.tileID,a,a.getExpiryTimeout()):(a.aborted=!0,this._abortTile(a),this._unloadTile(a))))}_dataHandler(e){const a=e.sourceDataType;e.dataType==="source"&&a==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&a==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,a,u){const d=[],m=this.transform;if(!m)return d;const k=u?m.getCameraQueryGeometry(e):e,E=e.map(G=>m.pointCoordinate(G,this.terrain)),T=k.map(G=>m.pointCoordinate(G,this.terrain)),I=this.getIds();let O=1/0,B=1/0,U=-1/0,Z=-1/0;for(const G of T)O=Math.min(O,G.x),B=Math.min(B,G.y),U=Math.max(U,G.x),Z=Math.max(Z,G.y);for(let G=0;G<I.length;G++){const Q=this._tiles[I[G]];if(Q.holdingForFade())continue;const ne=Q.tileID,re=Math.pow(2,m.zoom-Q.tileID.overscaledZ),oe=a*Q.queryPadding*h.X/Q.tileSize/re,X=[ne.getTilePoint(new h.Z(O,B)),ne.getTilePoint(new h.Z(U,Z))];if(X[0].x-oe<h.X&&X[0].y-oe<h.X&&X[1].x+oe>=0&&X[1].y+oe>=0){const ue=E.map(ye=>ne.getTilePoint(ye)),pe=T.map(ye=>ne.getTilePoint(ye));d.push({tile:Q,tileID:ne,queryGeometry:ue,cameraQueryGeometry:pe,scale:re})}}return d}getVisibleCoordinates(e){const a=this.getRenderableIds(e).map(u=>this._tiles[u].tileID);for(const u of a)u.posMatrix=this.transform.calculatePosMatrix(u.toUnwrapped());return a}hasTransition(){if(this._source.hasTransition())return!0;if(ir(this._source.type)){const e=R.now();for(const a in this._tiles)if(this._tiles[a].fadeEndTime>=e)return!0}return!1}setFeatureState(e,a,u){this._state.updateState(e=e||"_geojsonTileLayer",a,u)}removeFeatureState(e,a,u){this._state.removeFeatureState(e=e||"_geojsonTileLayer",a,u)}getFeatureState(e,a){return this._state.getState(e=e||"_geojsonTileLayer",a)}setDependencies(e,a,u){const d=this._tiles[e];d&&d.setDependencies(a,u)}reloadTilesForDependencies(e,a){for(const u in this._tiles)this._tiles[u].hasDependency(e,a)&&this._reloadTile(u,"reloading");this._cache.filter(u=>!u.hasDependency(e,a))}}function fn(g,e){const a=Math.abs(2*g.wrap)-+(g.wrap<0),u=Math.abs(2*e.wrap)-+(e.wrap<0);return g.overscaledZ-e.overscaledZ||u-a||e.canonical.y-g.canonical.y||e.canonical.x-g.canonical.x}function ir(g){return g==="raster"||g==="image"||g==="video"}mt.maxOverzooming=10,mt.maxUnderzooming=3;class bt{constructor(e,a){this.reset(e,a)}reset(e,a){this.points=e||[],this._distances=[0];for(let u=1;u<this.points.length;u++)this._distances[u]=this._distances[u-1]+this.points[u].dist(this.points[u-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(a||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=h.ac(e,0,1);let a=1,u=this._distances[a];const d=e*this.paddedLength+this.padding;for(;u<d&&a<this._distances.length;)u=this._distances[++a];const m=a-1,k=this._distances[m],E=u-k,T=E>0?(d-k)/E:0;return this.points[m].mult(1-T).add(this.points[a].mult(T))}}function Cr(g,e){let a=!0;return g==="always"||g!=="never"&&e!=="never"||(a=!1),a}class jr{constructor(e,a,u){const d=this.boxCells=[],m=this.circleCells=[];this.xCellCount=Math.ceil(e/u),this.yCellCount=Math.ceil(a/u);for(let k=0;k<this.xCellCount*this.yCellCount;k++)d.push([]),m.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=a,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/a,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,a,u,d,m){this._forEachCell(a,u,d,m,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(a),this.bboxes.push(u),this.bboxes.push(d),this.bboxes.push(m)}insertCircle(e,a,u,d){this._forEachCell(a-d,u-d,a+d,u+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(a),this.circles.push(u),this.circles.push(d)}_insertBoxCell(e,a,u,d,m,k){this.boxCells[m].push(k)}_insertCircleCell(e,a,u,d,m,k){this.circleCells[m].push(k)}_query(e,a,u,d,m,k,E){if(u<0||e>this.width||d<0||a>this.height)return[];const T=[];if(e<=0&&a<=0&&this.width<=u&&this.height<=d){if(m)return[{key:null,x1:e,y1:a,x2:u,y2:d}];for(let I=0;I<this.boxKeys.length;I++)T.push({key:this.boxKeys[I],x1:this.bboxes[4*I],y1:this.bboxes[4*I+1],x2:this.bboxes[4*I+2],y2:this.bboxes[4*I+3]});for(let I=0;I<this.circleKeys.length;I++){const O=this.circles[3*I],B=this.circles[3*I+1],U=this.circles[3*I+2];T.push({key:this.circleKeys[I],x1:O-U,y1:B-U,x2:O+U,y2:B+U})}}else this._forEachCell(e,a,u,d,this._queryCell,T,{hitTest:m,overlapMode:k,seenUids:{box:{},circle:{}}},E);return T}query(e,a,u,d){return this._query(e,a,u,d,!1,null)}hitTest(e,a,u,d,m,k){return this._query(e,a,u,d,!0,m,k).length>0}hitTestCircle(e,a,u,d,m){const k=e-u,E=e+u,T=a-u,I=a+u;if(E<0||k>this.width||I<0||T>this.height)return!1;const O=[];return this._forEachCell(k,T,E,I,this._queryCellCircle,O,{hitTest:!0,overlapMode:d,circle:{x:e,y:a,radius:u},seenUids:{box:{},circle:{}}},m),O.length>0}_queryCell(e,a,u,d,m,k,E,T){const{seenUids:I,hitTest:O,overlapMode:B}=E,U=this.boxCells[m];if(U!==null){const G=this.bboxes;for(const Q of U)if(!I.box[Q]){I.box[Q]=!0;const ne=4*Q,re=this.boxKeys[Q];if(e<=G[ne+2]&&a<=G[ne+3]&&u>=G[ne+0]&&d>=G[ne+1]&&(!T||T(re))&&(!O||!Cr(B,re.overlapMode))&&(k.push({key:re,x1:G[ne],y1:G[ne+1],x2:G[ne+2],y2:G[ne+3]}),O))return!0}}const Z=this.circleCells[m];if(Z!==null){const G=this.circles;for(const Q of Z)if(!I.circle[Q]){I.circle[Q]=!0;const ne=3*Q,re=this.circleKeys[Q];if(this._circleAndRectCollide(G[ne],G[ne+1],G[ne+2],e,a,u,d)&&(!T||T(re))&&(!O||!Cr(B,re.overlapMode))){const oe=G[ne],X=G[ne+1],ue=G[ne+2];if(k.push({key:re,x1:oe-ue,y1:X-ue,x2:oe+ue,y2:X+ue}),O)return!0}}}return!1}_queryCellCircle(e,a,u,d,m,k,E,T){const{circle:I,seenUids:O,overlapMode:B}=E,U=this.boxCells[m];if(U!==null){const G=this.bboxes;for(const Q of U)if(!O.box[Q]){O.box[Q]=!0;const ne=4*Q,re=this.boxKeys[Q];if(this._circleAndRectCollide(I.x,I.y,I.radius,G[ne+0],G[ne+1],G[ne+2],G[ne+3])&&(!T||T(re))&&!Cr(B,re.overlapMode))return k.push(!0),!0}}const Z=this.circleCells[m];if(Z!==null){const G=this.circles;for(const Q of Z)if(!O.circle[Q]){O.circle[Q]=!0;const ne=3*Q,re=this.circleKeys[Q];if(this._circlesCollide(G[ne],G[ne+1],G[ne+2],I.x,I.y,I.radius)&&(!T||T(re))&&!Cr(B,re.overlapMode))return k.push(!0),!0}}}_forEachCell(e,a,u,d,m,k,E,T){const I=this._convertToXCellCoord(e),O=this._convertToYCellCoord(a),B=this._convertToXCellCoord(u),U=this._convertToYCellCoord(d);for(let Z=I;Z<=B;Z++)for(let G=O;G<=U;G++)if(m.call(this,e,a,u,d,this.xCellCount*G+Z,k,E,T))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,a,u,d,m,k){const E=d-e,T=m-a,I=u+k;return I*I>E*E+T*T}_circleAndRectCollide(e,a,u,d,m,k,E){const T=(k-d)/2,I=Math.abs(e-(d+T));if(I>T+u)return!1;const O=(E-m)/2,B=Math.abs(a-(m+O));if(B>O+u)return!1;if(I<=T||B<=O)return!0;const U=I-T,Z=B-O;return U*U+Z*Z<=u*u}}function rs(g,e,a,u,d){const m=h.H();return e?(h.K(m,m,[1/d,1/d,1]),a||h.ad(m,m,u.angle)):h.L(m,u.labelPlaneMatrix,g),m}function Mr(g,e,a,u,d){if(e){const m=h.ae(g);return h.K(m,m,[d,d,1]),a||h.ad(m,m,-u.angle),m}return u.glCoordMatrix}function ee(g,e,a,u){let d;u?(d=[g,e,u(g,e),1],h.af(d,d,a)):(d=[g,e,0,1],$t(d,d,a));const m=d[3];return{point:new h.P(d[0]/m,d[1]/m),signedDistanceFromCamera:m,isOccluded:!1}}function $(g,e){return .5+g/e*.5}function V(g,e){return g.x>=-e[0]&&g.x<=e[0]&&g.y>=-e[1]&&g.y<=e[1]}function W(g,e,a,u,d,m,k,E,T,I,O,B,U,Z,G){const Q=u?g.textSizeData:g.iconSizeData,ne=h.ag(Q,a.transform.zoom),re=[256/a.width*2+1,256/a.height*2+1],oe=u?g.text.dynamicLayoutVertexArray:g.icon.dynamicLayoutVertexArray;oe.clear();const X=g.lineVertexArray,ue=u?g.text.placedSymbolArray:g.icon.placedSymbolArray,pe=a.transform.width/a.transform.height;let ye=!1;for(let Ce=0;Ce<ue.length;Ce++){const Ae=ue.get(Ce);if(Ae.hidden||Ae.writingMode===h.ah.vertical&&!ye){ht(Ae.numGlyphs,oe);continue}ye=!1;const $e=ee(Ae.anchorX,Ae.anchorY,e,G);if(!V($e.point,re)){ht(Ae.numGlyphs,oe);continue}const We=$(a.transform.cameraToCenterDistance,$e.signedDistanceFromCamera),Oe=h.ai(Q,ne,Ae),Le=k?Oe/We:Oe*We,tt={getElevation:G,labelPlaneMatrix:d,lineVertexArray:X,pitchWithMap:k,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:I,tileAnchorPoint:new h.P(Ae.anchorX,Ae.anchorY),unwrappedTileID:O,width:B,height:U,translation:Z},xt=de(tt,Ae,Le,!1,E,e,m,g.glyphOffsetArray,oe,pe,T);ye=xt.useVertical,(xt.notEnoughRoom||ye||xt.needsFlipping&&de(tt,Ae,Le,!0,E,e,m,g.glyphOffsetArray,oe,pe,T).notEnoughRoom)&&ht(Ae.numGlyphs,oe)}u?g.text.dynamicLayoutVertexBuffer.updateData(oe):g.icon.dynamicLayoutVertexBuffer.updateData(oe)}function J(g,e,a,u,d,m,k,E){const T=m.glyphStartIndex+m.numGlyphs,I=m.lineStartIndex,O=m.lineStartIndex+m.lineLength,B=e.getoffsetX(m.glyphStartIndex),U=e.getoffsetX(T-1),Z=Re(g*B,a,u,d,m.segment,I,O,E,k);if(!Z)return null;const G=Re(g*U,a,u,d,m.segment,I,O,E,k);return G?E.projectionCache.anyProjectionOccluded?null:{first:Z,last:G}:null}function ce(g,e,a,u){return g===h.ah.horizontal&&Math.abs(a.y-e.y)>Math.abs(a.x-e.x)*u?{useVertical:!0}:(g===h.ah.vertical?e.y<a.y:e.x>a.x)?{needsFlipping:!0}:null}function de(g,e,a,u,d,m,k,E,T,I,O){const B=a/24,U=e.lineOffsetX*B,Z=e.lineOffsetY*B;let G;if(e.numGlyphs>1){const Q=e.glyphStartIndex+e.numGlyphs,ne=e.lineStartIndex,re=e.lineStartIndex+e.lineLength,oe=J(B,E,U,Z,u,e,O,g);if(!oe)return{notEnoughRoom:!0};const X=ee(oe.first.point.x,oe.first.point.y,k,g.getElevation).point,ue=ee(oe.last.point.x,oe.last.point.y,k,g.getElevation).point;if(d&&!u){const pe=ce(e.writingMode,X,ue,I);if(pe)return pe}G=[oe.first];for(let pe=e.glyphStartIndex+1;pe<Q-1;pe++)G.push(Re(B*E.getoffsetX(pe),U,Z,u,e.segment,ne,re,g,O));G.push(oe.last)}else{if(d&&!u){const ne=ee(g.tileAnchorPoint.x,g.tileAnchorPoint.y,m,g.getElevation).point,re=e.lineStartIndex+e.segment+1,oe=new h.P(g.lineVertexArray.getx(re),g.lineVertexArray.gety(re)),X=ee(oe.x,oe.y,m,g.getElevation),ue=X.signedDistanceFromCamera>0?X.point:function(ye,Ce,Ae,$e,We,Oe){return me(ye,Ce,Ae,1,We,Oe)}(g.tileAnchorPoint,oe,ne,0,m,g),pe=ce(e.writingMode,ne,ue,I);if(pe)return pe}const Q=Re(B*E.getoffsetX(e.glyphStartIndex),U,Z,u,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,g,O);if(!Q||g.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};G=[Q]}for(const Q of G)h.aj(T,Q.point,Q.angle);return{}}function me(g,e,a,u,d,m){const k=g.add(g.sub(e)._unit()),E=d!==void 0?ee(k.x,k.y,d,m.getElevation).point:ke(k.x,k.y,m).point,T=a.sub(E);return a.add(T._mult(u/T.mag()))}function se(g,e,a){const u=e.projectionCache;if(u.projections[g])return u.projections[g];const d=new h.P(e.lineVertexArray.getx(g),e.lineVertexArray.gety(g)),m=ke(d.x,d.y,e);if(m.signedDistanceFromCamera>0)return u.projections[g]=m.point,u.anyProjectionOccluded=u.anyProjectionOccluded||m.isOccluded,m.point;const k=g-a.direction;return function(E,T,I,O,B){return me(E,T,I,O,void 0,B)}(a.distanceFromAnchor===0?e.tileAnchorPoint:new h.P(e.lineVertexArray.getx(k),e.lineVertexArray.gety(k)),d,a.previousVertex,a.absOffsetX-a.distanceFromAnchor+1,e)}function ke(g,e,a){const u=g+a.translation[0],d=e+a.translation[1];let m;return!a.pitchWithMap&&a.projection.useSpecialProjectionForSymbols?(m=a.projection.projectTileCoordinates(u,d,a.unwrappedTileID,a.getElevation),m.point.x=(.5*m.point.x+.5)*a.width,m.point.y=(.5*-m.point.y+.5)*a.height):(m=ee(u,d,a.labelPlaneMatrix,a.getElevation),m.isOccluded=!1),m}function Me(g,e,a){return g._unit()._perp()._mult(e*a)}function ve(g,e,a,u,d,m,k,E,T){if(E.projectionCache.offsets[g])return E.projectionCache.offsets[g];const I=a.add(e);if(g+T.direction<u||g+T.direction>=d)return E.projectionCache.offsets[g]=I,I;const O=se(g+T.direction,E,T),B=Me(O.sub(a),k,T.direction),U=a.add(B),Z=O.add(B);return E.projectionCache.offsets[g]=h.ak(m,I,U,Z)||I,E.projectionCache.offsets[g]}function Re(g,e,a,u,d,m,k,E,T){const I=u?g-e:g+e;let O=I>0?1:-1,B=0;u&&(O*=-1,B=Math.PI),O<0&&(B+=Math.PI);let U,Z=O>0?m+d:m+d+1;E.projectionCache.cachedAnchorPoint?U=E.projectionCache.cachedAnchorPoint:(U=ke(E.tileAnchorPoint.x,E.tileAnchorPoint.y,E).point,E.projectionCache.cachedAnchorPoint=U);let G,Q,ne=U,re=U,oe=0,X=0;const ue=Math.abs(I),pe=[];let ye;for(;oe+X<=ue;){if(Z+=O,Z<m||Z>=k)return null;oe+=X,re=ne,Q=G;const $e={absOffsetX:ue,direction:O,distanceFromAnchor:oe,previousVertex:re};if(ne=se(Z,E,$e),a===0)pe.push(re),ye=ne.sub(re);else{let We;const Oe=ne.sub(re);We=Oe.mag()===0?Me(se(Z+O,E,$e).sub(ne),a,O):Me(Oe,a,O),Q||(Q=re.add(We)),G=ve(Z,We,ne,m,k,Q,a,E,$e),pe.push(Q),ye=G.sub(Q)}X=ye.mag()}const Ce=ye._mult((ue-oe)/X)._add(Q||re),Ae=B+Math.atan2(ne.y-re.y,ne.x-re.x);return pe.push(Ce),{point:Ce,angle:T?Ae:0,path:pe}}const ct=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ht(g,e){for(let a=0;a<g;a++){const u=e.length;e.resize(u+4),e.float32.set(ct,3*u)}}function $t(g,e,a){const u=e[0],d=e[1];return g[0]=a[0]*u+a[4]*d+a[12],g[1]=a[1]*u+a[5]*d+a[13],g[3]=a[3]*u+a[7]*d+a[15],g}const wt=100;class jt{constructor(e,a,u=new jr(e.width+200,e.height+200,25),d=new jr(e.width+200,e.height+200,25)){this.transform=e,this.mapProjection=a,this.grid=u,this.ignoredGrid=d,this.pitchFactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+wt,this.screenBottomBoundary=e.height+wt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,a,u,d,m,k,E,T,I,O,B){const U=e.anchorPointX+T[0],Z=e.anchorPointY+T[1],G=this.projectAndGetPerspectiveRatio(d,U,Z,m,O),Q=u*G.perspectiveRatio;let ne;if(k||E)ne=this._projectCollisionBox(e,Q,d,m,k,E,T,G,O,B);else{const pe=G.point.x+(B?B.x*Q:0),ye=G.point.y+(B?B.y*Q:0);ne={allPointsOccluded:!1,box:[pe+e.x1*Q,ye+e.y1*Q,pe+e.x2*Q,ye+e.y2*Q]}}const[re,oe,X,ue]=ne.box;return this.mapProjection.useSpecialProjectionForSymbols&&(k?ne.allPointsOccluded:this.mapProjection.isOccluded(U,Z,m))||G.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(re,oe,X,ue)||a!=="always"&&this.grid.hitTest(re,oe,X,ue,a,I)?{box:[re,oe,X,ue],placeable:!1,offscreen:!1}:{box:[re,oe,X,ue],placeable:!0,offscreen:this.isOffscreen(re,oe,X,ue)}}placeCollisionCircles(e,a,u,d,m,k,E,T,I,O,B,U,Z,G,Q,ne){const re=[],oe=new h.P(a.anchorX,a.anchorY),X=this.getPerspectiveRatio(k,oe.x,oe.y,E,ne),ue=(B?m/X:m*X)/h.ap,pe={getElevation:ne,labelPlaneMatrix:T,lineVertexArray:u,pitchWithMap:B,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:oe,unwrappedTileID:E,width:this.transform.width,height:this.transform.height,translation:Q},ye=J(ue,d,a.lineOffsetX*ue,a.lineOffsetY*ue,!1,a,!1,pe);let Ce=!1,Ae=!1,$e=!0;if(ye){const We=.5*Z*X+G,Oe=new h.P(-100,-100),Le=new h.P(this.screenRightBoundary,this.screenBottomBoundary),tt=new bt,xt=ye.first,Ne=ye.last;let Ue=[];for(let Tt=xt.path.length-1;Tt>=1;Tt--)Ue.push(xt.path[Tt]);for(let Tt=1;Tt<Ne.path.length;Tt++)Ue.push(Ne.path[Tt]);const yt=2.5*We;if(I){const Tt=this.projectPathToScreenSpace(Ue,pe,I);Ue=Tt.some(Ot=>Ot.signedDistanceFromCamera<=0)?[]:Tt.map(Ot=>Ot.point)}let mi=[];if(Ue.length>0){const Tt=Ue[0].clone(),Ot=Ue[0].clone();for(let gi=1;gi<Ue.length;gi++)Tt.x=Math.min(Tt.x,Ue[gi].x),Tt.y=Math.min(Tt.y,Ue[gi].y),Ot.x=Math.max(Ot.x,Ue[gi].x),Ot.y=Math.max(Ot.y,Ue[gi].y);mi=Tt.x>=Oe.x&&Ot.x<=Le.x&&Tt.y>=Oe.y&&Ot.y<=Le.y?[Ue]:Ot.x<Oe.x||Tt.x>Le.x||Ot.y<Oe.y||Tt.y>Le.y?[]:h.al([Ue],Oe.x,Oe.y,Le.x,Le.y)}for(const Tt of mi){tt.reset(Tt,.25*We);let Ot=0;Ot=tt.length<=.5*We?1:Math.ceil(tt.paddedLength/yt)+1;for(let gi=0;gi<Ot;gi++){const Xi=gi/Math.max(Ot-1,1),lr=tt.lerp(Xi),yi=lr.x+wt,yn=lr.y+wt;re.push(yi,yn,We,0);const ln=yi-We,Ki=yn-We,cn=yi+We,Dr=yn+We;if($e=$e&&this.isOffscreen(ln,Ki,cn,Dr),Ae=Ae||this.isInsideGrid(ln,Ki,cn,Dr),e!=="always"&&this.grid.hitTestCircle(yi,yn,We,e,U)&&(Ce=!0,!O))return{circles:[],offscreen:!1,collisionDetected:Ce}}}}return{circles:!O&&Ce||!Ae||X<this.perspectiveRatioCutoff?[]:re,offscreen:$e,collisionDetected:Ce}}projectPathToScreenSpace(e,a,u){return e.map(d=>ee(d.x,d.y,u,a.getElevation))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const a=[];let u=1/0,d=1/0,m=-1/0,k=-1/0;for(const O of e){const B=new h.P(O.x+wt,O.y+wt);u=Math.min(u,B.x),d=Math.min(d,B.y),m=Math.max(m,B.x),k=Math.max(k,B.y),a.push(B)}const E=this.grid.query(u,d,m,k).concat(this.ignoredGrid.query(u,d,m,k)),T={},I={};for(const O of E){const B=O.key;if(T[B.bucketInstanceId]===void 0&&(T[B.bucketInstanceId]={}),T[B.bucketInstanceId][B.featureIndex])continue;const U=[new h.P(O.x1,O.y1),new h.P(O.x2,O.y1),new h.P(O.x2,O.y2),new h.P(O.x1,O.y2)];h.am(a,U)&&(T[B.bucketInstanceId][B.featureIndex]=!0,I[B.bucketInstanceId]===void 0&&(I[B.bucketInstanceId]=[]),I[B.bucketInstanceId].push(B.featureIndex))}return I}insertCollisionBox(e,a,u,d,m,k){(u?this.ignoredGrid:this.grid).insert({bucketInstanceId:d,featureIndex:m,collisionGroupID:k,overlapMode:a},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,a,u,d,m,k){const E=u?this.ignoredGrid:this.grid,T={bucketInstanceId:d,featureIndex:m,collisionGroupID:k,overlapMode:a};for(let I=0;I<e.length;I+=4)E.insertCircle(T,e[I],e[I+1],e[I+2])}projectAndGetPerspectiveRatio(e,a,u,d,m){let k;m?(k=[a,u,m(a,u),1],h.af(k,k,e)):(k=[a,u,0,1],$t(k,k,e));const E=k[3];return{point:new h.P((k[0]/E+1)/2*this.transform.width+wt,(-k[1]/E+1)/2*this.transform.height+wt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/E*.5,isOccluded:!1,signedDistanceFromCamera:E}}getPerspectiveRatio(e,a,u,d,m){const k=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(a,u,d,m):ee(a,u,e,m);return .5+this.transform.cameraToCenterDistance/k.signedDistanceFromCamera*.5}isOffscreen(e,a,u,d){return u<wt||e>=this.screenRightBoundary||d<wt||a>this.screenBottomBoundary}isInsideGrid(e,a,u,d){return u>=0&&e<this.gridRightBoundary&&d>=0&&a<this.gridBottomBoundary}getViewportMatrix(){const e=h.an([]);return h.J(e,e,[-100,-100,0]),e}_projectCollisionBox(e,a,u,d,m,k,E,T,I,O){let B=new h.P(1,0),U=new h.P(0,1);const Z=new h.P(e.anchorPointX+E[0],e.anchorPointY+E[1]);if(k&&!m){const $e=this.projectAndGetPerspectiveRatio(u,Z.x+1,Z.y,d,I).point.sub(T.point).unit(),We=Math.atan($e.y/$e.x)+($e.x<0?Math.PI:0),Oe=Math.sin(We),Le=Math.cos(We);B=new h.P(Le,Oe),U=new h.P(-Oe,Le)}else if(!k&&m){const $e=-this.transform.angle,We=Math.sin($e),Oe=Math.cos($e);B=new h.P(Oe,We),U=new h.P(-We,Oe)}let G=T.point,Q=a;if(m){G=Z;const $e=this.transform.zoom-Math.floor(this.transform.zoom);Q=Math.pow(2,-$e),Q*=this.mapProjection.getPitchedTextCorrection(this.transform,Z,d),O||(Q*=h.ac(.5+T.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}O&&(G=G.add(B.mult(O.x*Q)).add(U.mult(O.y*Q)));const ne=e.x1*Q,re=e.x2*Q,oe=(ne+re)/2,X=e.y1*Q,ue=e.y2*Q,pe=(X+ue)/2,ye=[{offsetX:ne,offsetY:X},{offsetX:oe,offsetY:X},{offsetX:re,offsetY:X},{offsetX:re,offsetY:pe},{offsetX:re,offsetY:ue},{offsetX:oe,offsetY:ue},{offsetX:ne,offsetY:ue},{offsetX:ne,offsetY:pe}];let Ce=[];for(const{offsetX:$e,offsetY:We}of ye)Ce.push(new h.P(G.x+B.x*$e+U.x*We,G.y+B.y*$e+U.y*We));let Ae=!1;if(m){const $e=Ce.map(We=>this.projectAndGetPerspectiveRatio(u,We.x,We.y,d,I));Ae=$e.some(We=>!We.isOccluded),Ce=$e.map(We=>We.point)}else Ae=!0;return{box:h.ao(Ce),allPointsOccluded:!Ae}}}function Lt(g,e,a){return e*(h.X/(g.tileSize*Math.pow(2,a-g.tileID.overscaledZ)))}class Di{constructor(e,a,u,d){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?a:-a))):d&&u?1:0,this.placed=u}isHidden(){return this.opacity===0&&!this.placed}}class Si{constructor(e,a,u,d,m){this.text=new Di(e?e.text:null,a,u,m),this.icon=new Di(e?e.icon:null,a,d,m)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Pt{constructor(e,a,u){this.text=e,this.icon=a,this.skipFade=u}}class ei{constructor(){this.invProjMatrix=h.H(),this.viewportMatrix=h.H(),this.circles=[]}}class xi{constructor(e,a,u,d,m){this.bucketInstanceId=e,this.featureIndex=a,this.sourceLayerIndex=u,this.bucketIndex=d,this.tileID=m}}class Fi{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const a=++this.maxGroupID;this.collisionGroups[e]={ID:a,predicate:u=>u.collisionGroupID===a}}return this.collisionGroups[e]}}function qi(g,e,a,u,d){const{horizontalAlign:m,verticalAlign:k}=h.au(g);return new h.P(-(m-.5)*e+u[0]*d,-(k-.5)*a+u[1]*d)}class an{constructor(e,a,u,d,m,k){this.transform=e.clone(),this.terrain=u,this.collisionIndex=new jt(this.transform,a),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Fi(m),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=k,k&&(k.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const a=this.terrain;return a?(u,d)=>a.getElevation(e,u,d):null}getBucketParts(e,a,u,d){const m=u.getBucket(a),k=u.latestFeatureIndex;if(!m||!k||a.id!==m.layerIds[0])return;const E=u.collisionBoxArray,T=m.layers[0].layout,I=m.layers[0].paint,O=Math.pow(2,this.transform.zoom-u.tileID.overscaledZ),B=u.tileSize/h.X,U=u.tileID.toUnwrapped(),Z=this.transform.calculatePosMatrix(U),G=T.get("text-pitch-alignment")==="map",Q=T.get("text-rotation-alignment")==="map",ne=Lt(u,1,this.transform.zoom),re=this.collisionIndex.mapProjection.translatePosition(this.transform,u,I.get("text-translate"),I.get("text-translate-anchor")),oe=this.collisionIndex.mapProjection.translatePosition(this.transform,u,I.get("icon-translate"),I.get("icon-translate-anchor")),X=rs(Z,G,Q,this.transform,ne);let ue=null;if(G){const ye=Mr(Z,G,Q,this.transform,ne);ue=h.L([],this.transform.labelPlaneMatrix,ye)}this.retainedQueryData[m.bucketInstanceId]=new xi(m.bucketInstanceId,k,m.sourceLayerIndex,m.index,u.tileID);const pe={bucket:m,layout:T,translationText:re,translationIcon:oe,posMatrix:Z,unwrappedTileID:U,textLabelPlaneMatrix:X,labelToScreenMatrix:ue,scale:O,textPixelRatio:B,holdingForFade:u.holdingForFade(),collisionBoxArray:E,partiallyEvaluatedTextSize:h.ag(m.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(m.sourceID)};if(d)for(const ye of m.sortKeyRanges){const{sortKey:Ce,symbolInstanceStart:Ae,symbolInstanceEnd:$e}=ye;e.push({sortKey:Ce,symbolInstanceStart:Ae,symbolInstanceEnd:$e,parameters:pe})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:pe})}attemptAnchorPlacement(e,a,u,d,m,k,E,T,I,O,B,U,Z,G,Q,ne,re,oe,X){const ue=h.aq[e.textAnchor],pe=[e.textOffset0,e.textOffset1],ye=qi(ue,u,d,pe,m),Ce=this.collisionIndex.placeCollisionBox(a,U,T,I,O,E,k,ne,B.predicate,X,ye);if((!oe||this.collisionIndex.placeCollisionBox(oe,U,T,I,O,E,k,re,B.predicate,X,ye).placeable)&&Ce.placeable){let Ae;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID].text&&(Ae=this.prevPlacement.variableOffsets[Z.crossTileID].anchor),Z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Z.crossTileID]={textOffset:pe,width:u,height:d,anchor:ue,textBoxScale:m,prevAnchor:Ae},this.markUsedJustification(G,ue,Z,Q),G.allowVerticalPlacement&&(this.markUsedOrientation(G,Q,Z),this.placedOrientations[Z.crossTileID]=Q),{shift:ye,placedGlyphBoxes:Ce}}}placeLayerBucketPart(e,a,u){const{bucket:d,layout:m,translationText:k,translationIcon:E,posMatrix:T,unwrappedTileID:I,textLabelPlaneMatrix:O,labelToScreenMatrix:B,textPixelRatio:U,holdingForFade:Z,collisionBoxArray:G,partiallyEvaluatedTextSize:Q,collisionGroup:ne}=e.parameters,re=m.get("text-optional"),oe=m.get("icon-optional"),X=h.ar(m,"text-overlap","text-allow-overlap"),ue=X==="always",pe=h.ar(m,"icon-overlap","icon-allow-overlap"),ye=pe==="always",Ce=m.get("text-rotation-alignment")==="map",Ae=m.get("text-pitch-alignment")==="map",$e=m.get("icon-text-fit")!=="none",We=m.get("symbol-z-order")==="viewport-y",Oe=ue&&(ye||!d.hasIconData()||oe),Le=ye&&(ue||!d.hasTextData()||re);!d.collisionArrays&&G&&d.deserializeCollisionBoxes(G);const tt=this._getTerrainElevationFunc(this.retainedQueryData[d.bucketInstanceId].tileID),xt=(Ne,Ue,yt)=>{var mi,Tt;if(a[Ne.crossTileID])return;if(Z)return void(this.placements[Ne.crossTileID]=new Pt(!1,!1,!1));let Ot=!1,gi=!1,Xi=!0,lr=null,yi={box:null,placeable:!1,offscreen:null},yn={box:null,placeable:!1,offscreen:null},ln=null,Ki=null,cn=null,Dr=0,wo=0,wl=0;Ue.textFeatureIndex?Dr=Ue.textFeatureIndex:Ne.useRuntimeCollisionCircles&&(Dr=Ne.featureIndex),Ue.verticalTextFeatureIndex&&(wo=Ue.verticalTextFeatureIndex);const ko=Ue.textBox;if(ko){const Yn=Zi=>{let Ji=h.ah.horizontal;if(d.allowVerticalPlacement&&!Zi&&this.prevPlacement){const zn=this.prevPlacement.placedOrientations[Ne.crossTileID];zn&&(this.placedOrientations[Ne.crossTileID]=zn,Ji=zn,this.markUsedOrientation(d,Ji,Ne))}return Ji},Xn=(Zi,Ji)=>{if(d.allowVerticalPlacement&&Ne.numVerticalGlyphVertices>0&&Ue.verticalTextBox){for(const zn of d.writingModes)if(zn===h.ah.vertical?(yi=Ji(),yn=yi):yi=Zi(),yi&&yi.placeable)break}else yi=Zi()},as=Ne.textAnchorOffsetStartIndex,cr=Ne.textAnchorOffsetEndIndex;if(cr===as){const Zi=(Ji,zn)=>{const Ft=this.collisionIndex.placeCollisionBox(Ji,X,U,T,I,Ae,Ce,k,ne.predicate,tt);return Ft&&Ft.placeable&&(this.markUsedOrientation(d,zn,Ne),this.placedOrientations[Ne.crossTileID]=zn),Ft};Xn(()=>Zi(ko,h.ah.horizontal),()=>{const Ji=Ue.verticalTextBox;return d.allowVerticalPlacement&&Ne.numVerticalGlyphVertices>0&&Ji?Zi(Ji,h.ah.vertical):{box:null,offscreen:null}}),Yn(yi&&yi.placeable)}else{let Zi=h.aq[(Tt=(mi=this.prevPlacement)===null||mi===void 0?void 0:mi.variableOffsets[Ne.crossTileID])===null||Tt===void 0?void 0:Tt.anchor];const Ji=(Ft,Ns,So)=>{const Eo=Ft.x2-Ft.x1,Zu=Ft.y2-Ft.y1,yf=Ne.textBoxScale,Wu=$e&&pe==="never"?Ns:null;let ls=null,Gu=X==="never"?1:2,Sl="never";Zi&&Gu++;for(let ga=0;ga<Gu;ga++){for(let El=as;El<cr;El++){const Tl=d.textAnchorOffsets.get(El);if(Zi&&Tl.textAnchor!==Zi)continue;const To=this.attemptAnchorPlacement(Tl,Ft,Eo,Zu,yf,Ce,Ae,U,T,I,ne,Sl,Ne,d,So,k,E,Wu,tt);if(To&&(ls=To.placedGlyphBoxes,ls&&ls.placeable))return Ot=!0,lr=To.shift,ls}Zi?Zi=null:Sl=X}return u&&!ls&&(ls={box:this.collisionIndex.placeCollisionBox(ko,"always",U,T,I,Ae,Ce,k,ne.predicate,tt,new h.P(0,0)).box,offscreen:!1,placeable:!1}),ls};Xn(()=>Ji(ko,Ue.iconBox,h.ah.horizontal),()=>{const Ft=Ue.verticalTextBox;return d.allowVerticalPlacement&&(!yi||!yi.placeable)&&Ne.numVerticalGlyphVertices>0&&Ft?Ji(Ft,Ue.verticalIconBox,h.ah.vertical):{box:null,occluded:!0,offscreen:null}}),yi&&(Ot=yi.placeable,Xi=yi.offscreen);const zn=Yn(yi&&yi.placeable);if(!Ot&&this.prevPlacement){const Ft=this.prevPlacement.variableOffsets[Ne.crossTileID];Ft&&(this.variableOffsets[Ne.crossTileID]=Ft,this.markUsedJustification(d,Ft.anchor,Ne,zn))}}}if(ln=yi,Ot=ln&&ln.placeable,Xi=ln&&ln.offscreen,Ne.useRuntimeCollisionCircles){const Yn=d.text.placedSymbolArray.get(Ne.centerJustifiedTextSymbolIndex),Xn=h.ai(d.textSizeData,Q,Yn),as=m.get("text-padding");Ki=this.collisionIndex.placeCollisionCircles(X,Yn,d.lineVertexArray,d.glyphOffsetArray,Xn,T,I,O,B,u,Ae,ne.predicate,Ne.collisionCircleDiameter,as,k,tt),Ki.circles.length&&Ki.collisionDetected&&!u&&h.w("Collisions detected, but collision boxes are not shown"),Ot=ue||Ki.circles.length>0&&!Ki.collisionDetected,Xi=Xi&&Ki.offscreen}if(Ue.iconFeatureIndex&&(wl=Ue.iconFeatureIndex),Ue.iconBox){const Yn=Xn=>this.collisionIndex.placeCollisionBox(Xn,pe,U,T,I,Ae,Ce,E,ne.predicate,tt,$e&&lr?lr:void 0);yn&&yn.placeable&&Ue.verticalIconBox?(cn=Yn(Ue.verticalIconBox),gi=cn.placeable):(cn=Yn(Ue.iconBox),gi=cn.placeable),Xi=Xi&&cn.offscreen}const Gn=re||Ne.numHorizontalGlyphVertices===0&&Ne.numVerticalGlyphVertices===0,kl=oe||Ne.numIconVertices===0;Gn||kl?kl?Gn||(gi=gi&&Ot):Ot=gi&&Ot:gi=Ot=gi&&Ot;const Jc=gi&&cn.placeable;if(Ot&&ln.placeable&&this.collisionIndex.insertCollisionBox(ln.box,X,m.get("text-ignore-placement"),d.bucketInstanceId,yn&&yn.placeable&&wo?wo:Dr,ne.ID),Jc&&this.collisionIndex.insertCollisionBox(cn.box,pe,m.get("icon-ignore-placement"),d.bucketInstanceId,wl,ne.ID),Ki&&Ot&&this.collisionIndex.insertCollisionCircles(Ki.circles,X,m.get("text-ignore-placement"),d.bucketInstanceId,Dr,ne.ID),u&&this.storeCollisionData(d.bucketInstanceId,yt,Ue,ln,cn,Ki),Ne.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(d.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ne.crossTileID]=new Pt(Ot||Oe,gi||Le,Xi||d.justReloaded),a[Ne.crossTileID]=!0};if(We){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ne=d.getSortedSymbolIndexes(this.transform.angle);for(let Ue=Ne.length-1;Ue>=0;--Ue){const yt=Ne[Ue];xt(d.symbolInstances.get(yt),d.collisionArrays[yt],yt)}}else for(let Ne=e.symbolInstanceStart;Ne<e.symbolInstanceEnd;Ne++)xt(d.symbolInstances.get(Ne),d.collisionArrays[Ne],Ne);if(u&&d.bucketInstanceId in this.collisionCircleArrays){const Ne=this.collisionCircleArrays[d.bucketInstanceId];h.as(Ne.invProjMatrix,T),Ne.viewportMatrix=this.collisionIndex.getViewportMatrix()}d.justReloaded=!1}storeCollisionData(e,a,u,d,m,k){if(u.textBox||u.iconBox){let E,T;this.collisionBoxArrays.has(e)?E=this.collisionBoxArrays.get(e):(E=new Map,this.collisionBoxArrays.set(e,E)),E.has(a)?T=E.get(a):(T={text:null,icon:null},E.set(a,T)),u.textBox&&(T.text=d.box),u.iconBox&&(T.icon=m.box)}if(k){let E=this.collisionCircleArrays[e];E===void 0&&(E=this.collisionCircleArrays[e]=new ei);for(let T=0;T<k.circles.length;T+=4)E.circles.push(k.circles[T+0]),E.circles.push(k.circles[T+1]),E.circles.push(k.circles[T+2]),E.circles.push(k.collisionDetected?1:0)}}markUsedJustification(e,a,u,d){let m;m=d===h.ah.vertical?u.verticalPlacedTextSymbolIndex:{left:u.leftJustifiedTextSymbolIndex,center:u.centerJustifiedTextSymbolIndex,right:u.rightJustifiedTextSymbolIndex}[h.at(a)];const k=[u.leftJustifiedTextSymbolIndex,u.centerJustifiedTextSymbolIndex,u.rightJustifiedTextSymbolIndex,u.verticalPlacedTextSymbolIndex];for(const E of k)E>=0&&(e.text.placedSymbolArray.get(E).crossTileID=m>=0&&E!==m?0:u.crossTileID)}markUsedOrientation(e,a,u){const d=a===h.ah.horizontal||a===h.ah.horizontalOnly?a:0,m=a===h.ah.vertical?a:0,k=[u.leftJustifiedTextSymbolIndex,u.centerJustifiedTextSymbolIndex,u.rightJustifiedTextSymbolIndex];for(const E of k)e.text.placedSymbolArray.get(E).placedOrientation=d;u.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(u.verticalPlacedTextSymbolIndex).placedOrientation=m)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const a=this.prevPlacement;let u=!1;this.prevZoomAdjustment=a?a.zoomAdjustment(this.transform.zoom):0;const d=a?a.symbolFadeChange(e):1,m=a?a.opacities:{},k=a?a.variableOffsets:{},E=a?a.placedOrientations:{};for(const T in this.placements){const I=this.placements[T],O=m[T];O?(this.opacities[T]=new Si(O,d,I.text,I.icon),u=u||I.text!==O.text.placed||I.icon!==O.icon.placed):(this.opacities[T]=new Si(null,d,I.text,I.icon,I.skipFade),u=u||I.text||I.icon)}for(const T in m){const I=m[T];if(!this.opacities[T]){const O=new Si(I,d,!1,!1);O.isHidden()||(this.opacities[T]=O,u=u||I.text.placed||I.icon.placed)}}for(const T in k)this.variableOffsets[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.variableOffsets[T]=k[T]);for(const T in E)this.placedOrientations[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.placedOrientations[T]=E[T]);if(a&&a.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");u?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=a?a.lastPlacementChangeTime:e)}updateLayerOpacities(e,a){const u={};for(const d of a){const m=d.getBucket(e);m&&d.latestFeatureIndex&&e.id===m.layerIds[0]&&this.updateBucketOpacities(m,d.tileID,u,d.collisionBoxArray)}}updateBucketOpacities(e,a,u,d){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const m=e.layers[0],k=m.layout,E=new Si(null,0,!1,!1,!0),T=k.get("text-allow-overlap"),I=k.get("icon-allow-overlap"),O=m._unevaluatedLayout.hasValue("text-variable-anchor")||m._unevaluatedLayout.hasValue("text-variable-anchor-offset"),B=k.get("text-rotation-alignment")==="map",U=k.get("text-pitch-alignment")==="map",Z=k.get("icon-text-fit")!=="none",G=new Si(null,0,T&&(I||!e.hasIconData()||k.get("icon-optional")),I&&(T||!e.hasTextData()||k.get("text-optional")),!0);!e.collisionArrays&&d&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(d);const Q=(re,oe,X)=>{for(let ue=0;ue<oe/4;ue++)re.opacityVertexArray.emplaceBack(X);re.hasVisibleVertices=re.hasVisibleVertices||X!==eo},ne=this.collisionBoxArrays.get(e.bucketInstanceId);for(let re=0;re<e.symbolInstances.length;re++){const oe=e.symbolInstances.get(re),{numHorizontalGlyphVertices:X,numVerticalGlyphVertices:ue,crossTileID:pe}=oe;let ye=this.opacities[pe];u[pe]?ye=E:ye||(ye=G,this.opacities[pe]=ye),u[pe]=!0;const Ce=oe.numIconVertices>0,Ae=this.placedOrientations[oe.crossTileID],$e=Ae===h.ah.vertical,We=Ae===h.ah.horizontal||Ae===h.ah.horizontalOnly;if(X>0||ue>0){const Le=In(ye.text);Q(e.text,X,$e?eo:Le),Q(e.text,ue,We?eo:Le);const tt=ye.text.isHidden();[oe.rightJustifiedTextSymbolIndex,oe.centerJustifiedTextSymbolIndex,oe.leftJustifiedTextSymbolIndex].forEach(Ue=>{Ue>=0&&(e.text.placedSymbolArray.get(Ue).hidden=tt||$e?1:0)}),oe.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(oe.verticalPlacedTextSymbolIndex).hidden=tt||We?1:0);const xt=this.variableOffsets[oe.crossTileID];xt&&this.markUsedJustification(e,xt.anchor,oe,Ae);const Ne=this.placedOrientations[oe.crossTileID];Ne&&(this.markUsedJustification(e,"left",oe,Ne),this.markUsedOrientation(e,Ne,oe))}if(Ce){const Le=In(ye.icon),tt=!(Z&&oe.verticalPlacedIconSymbolIndex&&$e);oe.placedIconSymbolIndex>=0&&(Q(e.icon,oe.numIconVertices,tt?Le:eo),e.icon.placedSymbolArray.get(oe.placedIconSymbolIndex).hidden=ye.icon.isHidden()),oe.verticalPlacedIconSymbolIndex>=0&&(Q(e.icon,oe.numVerticalIconVertices,tt?eo:Le),e.icon.placedSymbolArray.get(oe.verticalPlacedIconSymbolIndex).hidden=ye.icon.isHidden())}const Oe=ne&&ne.has(re)?ne.get(re):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const Le=e.collisionArrays[re];if(Le){let tt=new h.P(0,0);if(Le.textBox||Le.verticalTextBox){let xt=!0;if(O){const Ne=this.variableOffsets[pe];Ne?(tt=qi(Ne.anchor,Ne.width,Ne.height,Ne.textOffset,Ne.textBoxScale),B&&tt._rotate(U?this.transform.angle:-this.transform.angle)):xt=!1}if(Le.textBox||Le.verticalTextBox){let Ne;Le.textBox&&(Ne=$e),Le.verticalTextBox&&(Ne=We),Qs(e.textCollisionBox.collisionVertexArray,ye.text.placed,!xt||Ne,Oe.text,tt.x,tt.y)}}if(Le.iconBox||Le.verticalIconBox){const xt=!!(!We&&Le.verticalIconBox);let Ne;Le.iconBox&&(Ne=xt),Le.verticalIconBox&&(Ne=!xt),Qs(e.iconCollisionBox.collisionVertexArray,ye.icon.placed,Ne,Oe.icon,Z?tt.x:0,Z?tt.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const re=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=re.invProjMatrix,e.placementViewportMatrix=re.viewportMatrix,e.collisionCircleArray=re.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,a){const u=this.zoomAtLastRecencyCheck===a?1-this.zoomAdjustment(a):1;return this.zoomAtLastRecencyCheck=a,this.commitTime+this.fadeDuration*u>e}setStale(){this.stale=!0}}function Qs(g,e,a,u,d,m){u&&u.length!==0||(u=[0,0,0,0]);const k=u[0]-wt,E=u[1]-wt,T=u[2]-wt,I=u[3]-wt;g.emplaceBack(e?1:0,a?1:0,d||0,m||0,k,E),g.emplaceBack(e?1:0,a?1:0,d||0,m||0,T,E),g.emplaceBack(e?1:0,a?1:0,d||0,m||0,T,I),g.emplaceBack(e?1:0,a?1:0,d||0,m||0,k,I)}const ti=Math.pow(2,25),cc=Math.pow(2,24),hc=Math.pow(2,17),Mn=Math.pow(2,16),Pn=Math.pow(2,9),Hp=Math.pow(2,8),Hn=Math.pow(2,1);function In(g){if(g.opacity===0&&!g.placed)return 0;if(g.opacity===1&&g.placed)return 4294967295;const e=g.placed?1:0,a=Math.floor(127*g.opacity);return a*ti+e*cc+a*hc+e*Mn+a*Pn+e*Hp+a*Hn+e}const eo=0;function Cs(){return{isOccluded:(g,e,a)=>!1,getPitchedTextCorrection:(g,e,a)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(g,e,a,u){throw new Error("Not implemented.")},translatePosition:(g,e,a,u)=>function(d,m,k,E,T=!1){if(!k[0]&&!k[1])return[0,0];const I=T?E==="map"?d.angle:0:E==="viewport"?-d.angle:0;if(I){const O=Math.sin(I),B=Math.cos(I);k=[k[0]*B-k[1]*O,k[0]*O+k[1]*B]}return[T?k[0]:Lt(m,k[0],d.zoom),T?k[1]:Lt(m,k[1],d.zoom)]}(g,e,a,u),getCircleRadiusCorrection:g=>1}}class zi{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,a,u,d,m){const k=this._bucketParts;for(;this._currentTileIndex<e.length;)if(a.getBucketParts(k,d,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,m())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,k.sort((E,T)=>E.sortKey-T.sortKey));this._currentPartIndex<k.length;)if(a.placeLayerBucketPart(k[this._currentPartIndex],this._seenCrossTileIDs,u),this._currentPartIndex++,m())return!0;return!1}}class Jo{constructor(e,a,u,d,m,k,E,T){this.placement=new an(e,Cs(),a,k,E,T),this._currentPlacementIndex=u.length-1,this._forceFullPlacement=d,this._showCollisionBoxes=m,this._done=!1}isDone(){return this._done}continuePlacement(e,a,u){const d=R.now(),m=()=>!this._forceFullPlacement&&R.now()-d>2;for(;this._currentPlacementIndex>=0;){const k=a[e[this._currentPlacementIndex]],E=this.placement.collisionIndex.transform.zoom;if(k.type==="symbol"&&(!k.minzoom||k.minzoom<=E)&&(!k.maxzoom||k.maxzoom>E)){if(this._inProgressLayer||(this._inProgressLayer=new zi(k)),this._inProgressLayer.continuePlacement(u[k.source],this.placement,this._showCollisionBoxes,k,m))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const nr=512/h.X/2;class Ii{constructor(e,a,u){this.tileID=e,this.bucketInstanceId=u,this._symbolsByKey={};const d=new Map;for(let m=0;m<a.length;m++){const k=a.get(m),E=k.key,T=d.get(E);T?T.push(k):d.set(E,[k])}for(const[m,k]of d){const E={positions:k.map(T=>({x:Math.floor(T.anchorX*nr),y:Math.floor(T.anchorY*nr)})),crossTileIDs:k.map(T=>T.crossTileID)};if(E.positions.length>128){const T=new h.av(E.positions.length,16,Uint16Array);for(const{x:I,y:O}of E.positions)T.add(I,O);T.finish(),delete E.positions,E.index=T}this._symbolsByKey[m]=E}}getScaledCoordinates(e,a){const{x:u,y:d,z:m}=this.tileID.canonical,{x:k,y:E,z:T}=a.canonical,I=nr/Math.pow(2,T-m),O=(E*h.X+e.anchorY)*I,B=d*h.X*nr;return{x:Math.floor((k*h.X+e.anchorX)*I-u*h.X*nr),y:Math.floor(O-B)}}findMatches(e,a,u){const d=this.tileID.canonical.z<a.canonical.z?1:Math.pow(2,this.tileID.canonical.z-a.canonical.z);for(let m=0;m<e.length;m++){const k=e.get(m);if(k.crossTileID)continue;const E=this._symbolsByKey[k.key];if(!E)continue;const T=this.getScaledCoordinates(k,a);if(E.index){const I=E.index.range(T.x-d,T.y-d,T.x+d,T.y+d).sort();for(const O of I){const B=E.crossTileIDs[O];if(!u[B]){u[B]=!0,k.crossTileID=B;break}}}else if(E.positions)for(let I=0;I<E.positions.length;I++){const O=E.positions[I],B=E.crossTileIDs[I];if(Math.abs(O.x-T.x)<=d&&Math.abs(O.y-T.y)<=d&&!u[B]){u[B]=!0,k.crossTileID=B;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class qa{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class rr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const a=Math.round((e-this.lng)/360);if(a!==0)for(const u in this.indexes){const d=this.indexes[u],m={};for(const k in d){const E=d[k];E.tileID=E.tileID.unwrapTo(E.tileID.wrap+a),m[E.tileID.key]=E}this.indexes[u]=m}this.lng=e}addBucket(e,a,u){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===a.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let m=0;m<a.symbolInstances.length;m++)a.symbolInstances.get(m).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const d=this.usedCrossTileIDs[e.overscaledZ];for(const m in this.indexes){const k=this.indexes[m];if(Number(m)>e.overscaledZ)for(const E in k){const T=k[E];T.tileID.isChildOf(e)&&T.findMatches(a.symbolInstances,e,d)}else{const E=k[e.scaledTo(Number(m)).key];E&&E.findMatches(a.symbolInstances,e,d)}}for(let m=0;m<a.symbolInstances.length;m++){const k=a.symbolInstances.get(m);k.crossTileID||(k.crossTileID=u.generate(),d[k.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ii(e,a.symbolInstances,a.bucketInstanceId),!0}removeBucketCrossTileIDs(e,a){for(const u of a.getCrossTileIDsLists())for(const d of u)delete this.usedCrossTileIDs[e][d]}removeStaleBuckets(e){let a=!1;for(const u in this.indexes){const d=this.indexes[u];for(const m in d)e[d[m].bucketInstanceId]||(this.removeBucketCrossTileIDs(u,d[m]),delete d[m],a=!0)}return a}}class uc{constructor(){this.layerIndexes={},this.crossTileIDs=new qa,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,a,u){let d=this.layerIndexes[e.id];d===void 0&&(d=this.layerIndexes[e.id]=new rr);let m=!1;const k={};d.handleWrapJump(u);for(const E of a){const T=E.getBucket(e);T&&e.id===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),d.addBucket(E.tileID,T,this.crossTileIDs)&&(m=!0),k[T.bucketInstanceId]=!0)}return d.removeStaleBuckets(k)&&(m=!0),m}pruneUnusedLayers(e){const a={};e.forEach(u=>{a[u]=!0});for(const u in this.layerIndexes)a[u]||delete this.layerIndexes[u]}}const sr=(g,e)=>h.t(g,e&&e.filter(a=>a.identifier!=="source.canvas")),qp=h.aw();class Za extends h.E{constructor(e,a={}){super(),this._rtlPluginLoaded=()=>{for(const u in this.sourceCaches){const d=this.sourceCaches[u].getSource().type;d!=="vector"&&d!=="geojson"||this.sourceCaches[u].reload()}},this.map=e,this.dispatcher=new lt(Ze(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(u,d)=>this.getGlyphs(u,d)),this.dispatcher.registerMessageHandler("GI",(u,d)=>this.getImages(u,d)),this.imageManager=new Rt,this.imageManager.setEventedParent(this),this.glyphManager=new Ui(e._requestManager,a.localIdeographFontFamily),this.lineAtlas=new Sr(256,512),this.crossTileSymbolIndex=new uc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new h.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",h.ay()),Tr().on(De,this._rtlPluginLoaded),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const d=this.sourceCaches[u.sourceId];if(!d)return;const m=d.getSource();if(m&&m.vectorLayerIds)for(const k in this._layers){const E=this._layers[k];E.source===m.id&&this._validateLayer(E)}})}loadURL(e,a={},u){this.fire(new h.k("dataloading",{dataType:"style"})),a.validate=typeof a.validate!="boolean"||a.validate;const d=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const m=this._loadStyleRequest;h.h(d,this._loadStyleRequest).then(k=>{this._loadStyleRequest=null,this._load(k.data,a,u)}).catch(k=>{this._loadStyleRequest=null,k&&!m.signal.aborted&&this.fire(new h.j(k))})}loadJSON(e,a={},u){this.fire(new h.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,R.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,a.validate=a.validate!==!1,this._load(e,a,u)}).catch(()=>{})}loadEmpty(){this.fire(new h.k("dataloading",{dataType:"style"})),this._load(qp,{validate:!1})}_load(e,a,u){var d;const m=a.transformStyle?a.transformStyle(u,e):e;if(!a.validate||!sr(this,h.u(m))){this._loaded=!0,this.stylesheet=m;for(const k in m.sources)this.addSource(k,m.sources[k],{validate:!1});m.sprite?this._loadSprite(m.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(m.glyphs),this._createLayers(),this.light=new Sn(this.stylesheet.light),this.sky=new sn(this.stylesheet.sky),this.map.setTerrain((d=this.stylesheet.terrain)!==null&&d!==void 0?d:null),this.fire(new h.k("data",{dataType:"style"})),this.fire(new h.k("style.load"))}}_createLayers(){const e=h.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(a=>a.id),this._layers={},this._serializedLayers=null;for(const a of e){const u=h.aA(a);u.setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=u}}_loadSprite(e,a=!1,u=void 0){let d;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(m,k,E,T){return h._(this,void 0,void 0,function*(){const I=rt(m),O=E>1?"@2x":"",B={},U={};for(const{id:Z,url:G}of I){const Q=k.transformRequest(Dt(G,O,".json"),"SpriteJSON");B[Z]=h.h(Q,T);const ne=k.transformRequest(Dt(G,O,".png"),"SpriteImage");U[Z]=_e.getImage(ne,T)}return yield Promise.all([...Object.values(B),...Object.values(U)]),function(Z,G){return h._(this,void 0,void 0,function*(){const Q={};for(const ne in Z){Q[ne]={};const re=R.getImageCanvasContext((yield G[ne]).data),oe=(yield Z[ne]).data;for(const X in oe){const{width:ue,height:pe,x:ye,y:Ce,sdf:Ae,pixelRatio:$e,stretchX:We,stretchY:Oe,content:Le,textFitWidth:tt,textFitHeight:xt}=oe[X];Q[ne][X]={data:null,pixelRatio:$e,sdf:Ae,stretchX:We,stretchY:Oe,content:Le,textFitWidth:tt,textFitHeight:xt,spriteData:{width:ue,height:pe,x:ye,y:Ce,context:re}}}}return Q})}(B,U)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(m=>{if(this._spriteRequest=null,m)for(const k in m){this._spritesImagesIds[k]=[];const E=this._spritesImagesIds[k]?this._spritesImagesIds[k].filter(T=>!(T in m)):[];for(const T of E)this.imageManager.removeImage(T),this._changedImages[T]=!0;for(const T in m[k]){const I=k==="default"?T:`${k}:${T}`;this._spritesImagesIds[k].push(I),I in this.imageManager.images?this.imageManager.updateImage(I,m[k][T],!1):this.imageManager.addImage(I,m[k][T]),a&&(this._changedImages[I]=!0)}}}).catch(m=>{this._spriteRequest=null,d=m,this.fire(new h.j(d))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),a&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"})),u&&u(d)})}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}_validateLayer(e){const a=this.sourceCaches[e.source];if(!a)return;const u=e.sourceLayer;if(!u)return;const d=a.getSource();(d.type==="geojson"||d.vectorLayerIds&&d.vectorLayerIds.indexOf(u)===-1)&&this.fire(new h.j(new Error(`Source layer "${u}" does not exist on source "${d.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,a=!1){const u=this._serializedAllLayers();if(!e||e.length===0)return Object.values(a?h.aB(u):u);const d=[];for(const m of e)if(u[m]){const k=a?h.aB(u[m]):u[m];d.push(k)}return d}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const a=Object.keys(this._layers);for(const u of a){const d=this._layers[u];d.type!=="custom"&&(e[u]=d.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const a=this._changed;if(a){const d=Object.keys(this._updatedLayers),m=Object.keys(this._removedLayers);(d.length||m.length)&&this._updateWorkerLayers(d,m);for(const k in this._updatedSources){const E=this._updatedSources[k];if(E==="reload")this._reloadSource(k);else{if(E!=="clear")throw new Error(`Invalid action ${E}`);this._clearSource(k)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const k in this._updatedPaintProps)this._layers[k].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const u={};for(const d in this.sourceCaches){const m=this.sourceCaches[d];u[d]=m.used,m.used=!1}for(const d of this._order){const m=this._layers[d];m.recalculate(e,this._availableImages),!m.isHidden(e.zoom)&&m.source&&(this.sourceCaches[m.source].used=!0)}for(const d in u){const m=this.sourceCaches[d];!!u[d]!=!!m.used&&m.fire(new h.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,a&&this.fire(new h.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const a in this.sourceCaches)this.sourceCaches[a].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,a){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:a})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,a={}){var u;this._checkLoaded();const d=this.serialize();if(e=a.transformStyle?a.transformStyle(d,e):e,((u=a.validate)===null||u===void 0||u)&&sr(this,h.u(e)))return!1;(e=h.aB(e)).layers=h.az(e.layers);const m=h.aC(d,e),k=this._getOperationsToPerform(m);if(k.unimplemented.length>0)throw new Error(`Unimplemented: ${k.unimplemented.join(", ")}.`);if(k.operations.length===0)return!1;for(const E of k.operations)E();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const a=[],u=[];for(const d of e)switch(d.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":a.push(()=>this.addLayer.apply(this,d.args));break;case"removeLayer":a.push(()=>this.removeLayer.apply(this,d.args));break;case"setPaintProperty":a.push(()=>this.setPaintProperty.apply(this,d.args));break;case"setLayoutProperty":a.push(()=>this.setLayoutProperty.apply(this,d.args));break;case"setFilter":a.push(()=>this.setFilter.apply(this,d.args));break;case"addSource":a.push(()=>this.addSource.apply(this,d.args));break;case"removeSource":a.push(()=>this.removeSource.apply(this,d.args));break;case"setLayerZoomRange":a.push(()=>this.setLayerZoomRange.apply(this,d.args));break;case"setLight":a.push(()=>this.setLight.apply(this,d.args));break;case"setGeoJSONSourceData":a.push(()=>this.setGeoJSONSourceData.apply(this,d.args));break;case"setGlyphs":a.push(()=>this.setGlyphs.apply(this,d.args));break;case"setSprite":a.push(()=>this.setSprite.apply(this,d.args));break;case"setSky":a.push(()=>this.setSky.apply(this,d.args));break;case"setTerrain":a.push(()=>this.map.setTerrain.apply(this,d.args));break;case"setTransition":a.push(()=>{});break;default:u.push(d.command)}return{operations:a,unimplemented:u}}addImage(e,a){if(this.getImage(e))return this.fire(new h.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,a),this._afterImageUpdated(e)}updateImage(e,a){this.imageManager.updateImage(e,a)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new h.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,a,u={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!a.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(a).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(a.type)>=0&&this._validate(h.u.source,`sources.${e}`,a,null,u))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);const d=this.sourceCaches[e]=new mt(e,a,this.dispatcher);d.style=this,d.setEventedParent(this,()=>({isSourceLoaded:d.loaded(),source:d.serialize(),sourceId:e})),d.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(const u in this._layers)if(this._layers[u].source===e)return this.fire(new h.j(new Error(`Source "${e}" cannot be removed while layer "${u}" is using it.`)));const a=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],a.fire(new h.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),a.setEventedParent(null),a.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,a){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const u=this.sourceCaches[e].getSource();if(u.type!=="geojson")throw new Error(`geojsonSource.type is ${u.type}, which is !== 'geojson`);u.setData(a),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,a,u={}){this._checkLoaded();const d=e.id;if(this.getLayer(d))return void this.fire(new h.j(new Error(`Layer "${d}" already exists on this map.`)));let m;if(e.type==="custom"){if(sr(this,h.aD(e)))return;m=h.aA(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(d,e.source),e=h.aB(e),e=h.e(e,{source:d})),this._validate(h.u.layer,`layers.${d}`,e,{arrayIndex:-1},u))return;m=h.aA(e),this._validateLayer(m),m.setEventedParent(this,{layer:{id:d}})}const k=a?this._order.indexOf(a):this._order.length;if(a&&k===-1)this.fire(new h.j(new Error(`Cannot add layer "${d}" before non-existing layer "${a}".`)));else{if(this._order.splice(k,0,d),this._layerOrderChanged=!0,this._layers[d]=m,this._removedLayers[d]&&m.source&&m.type!=="custom"){const E=this._removedLayers[d];delete this._removedLayers[d],E.type!==m.type?this._updatedSources[m.source]="clear":(this._updatedSources[m.source]="reload",this.sourceCaches[m.source].pause())}this._updateLayer(m),m.onAdd&&m.onAdd(this.map)}}moveLayer(e,a){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new h.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===a)return;const u=this._order.indexOf(e);this._order.splice(u,1);const d=a?this._order.indexOf(a):this._order.length;a&&d===-1?this.fire(new h.j(new Error(`Cannot move layer "${e}" before non-existing layer "${a}".`))):(this._order.splice(d,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const a=this._layers[e];if(!a)return void this.fire(new h.j(new Error(`Cannot remove non-existing layer "${e}".`)));a.setEventedParent(null);const u=this._order.indexOf(e);this._order.splice(u,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=a,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],a.onRemove&&a.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,a,u){this._checkLoaded();const d=this.getLayer(e);d?d.minzoom===a&&d.maxzoom===u||(a!=null&&(d.minzoom=a),u!=null&&(d.maxzoom=u),this._updateLayer(d)):this.fire(new h.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,a,u={}){this._checkLoaded();const d=this.getLayer(e);if(d){if(!h.aE(d.filter,a))return a==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(h.u.filter,`layers.${d.id}.filter`,a,null,u)||(d.filter=h.aB(a),this._updateLayer(d)))}else this.fire(new h.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return h.aB(this.getLayer(e).filter)}setLayoutProperty(e,a,u,d={}){this._checkLoaded();const m=this.getLayer(e);m?h.aE(m.getLayoutProperty(a),u)||(m.setLayoutProperty(a,u,d),this._updateLayer(m)):this.fire(new h.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,a){const u=this.getLayer(e);if(u)return u.getLayoutProperty(a);this.fire(new h.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,a,u,d={}){this._checkLoaded();const m=this.getLayer(e);m?h.aE(m.getPaintProperty(a),u)||(m.setPaintProperty(a,u,d)&&this._updateLayer(m),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new h.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,a){return this.getLayer(e).getPaintProperty(a)}setFeatureState(e,a){this._checkLoaded();const u=e.source,d=e.sourceLayer,m=this.sourceCaches[u];if(m===void 0)return void this.fire(new h.j(new Error(`The source '${u}' does not exist in the map's style.`)));const k=m.getSource().type;k==="geojson"&&d?this.fire(new h.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):k!=="vector"||d?(e.id===void 0&&this.fire(new h.j(new Error("The feature id parameter must be provided."))),m.setFeatureState(d,e.id,a)):this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,a){this._checkLoaded();const u=e.source,d=this.sourceCaches[u];if(d===void 0)return void this.fire(new h.j(new Error(`The source '${u}' does not exist in the map's style.`)));const m=d.getSource().type,k=m==="vector"?e.sourceLayer:void 0;m!=="vector"||k?a&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new h.j(new Error("A feature id is required to remove its specific state property."))):d.removeFeatureState(k,e.id,a):this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const a=e.source,u=e.sourceLayer,d=this.sourceCaches[a];if(d!==void 0)return d.getSource().type!=="vector"||u?(e.id===void 0&&this.fire(new h.j(new Error("The feature id parameter must be provided."))),d.getFeatureState(u,e.id)):void this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.j(new Error(`The source '${a}' does not exist in the map's style.`)))}getTransition(){return h.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=h.aF(this.sourceCaches,m=>m.serialize()),a=this._serializeByIds(this._order,!0),u=this.map.getTerrain()||void 0,d=this.stylesheet;return h.aG({version:d.version,name:d.name,metadata:d.metadata,light:d.light,sky:d.sky,center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch,sprite:d.sprite,glyphs:d.glyphs,transition:d.transition,sources:e,layers:a,terrain:u},m=>m!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const a=k=>this._layers[k].type==="fill-extrusion",u={},d=[];for(let k=this._order.length-1;k>=0;k--){const E=this._order[k];if(a(E)){u[E]=k;for(const T of e){const I=T[E];if(I)for(const O of I)d.push(O)}}}d.sort((k,E)=>E.intersectionZ-k.intersectionZ);const m=[];for(let k=this._order.length-1;k>=0;k--){const E=this._order[k];if(a(E))for(let T=d.length-1;T>=0;T--){const I=d[T].feature;if(u[I.layer.id]<k)break;m.push(I),d.pop()}else for(const T of e){const I=T[E];if(I)for(const O of I)m.push(O.feature)}}return m}queryRenderedFeatures(e,a,u){a&&a.filter&&this._validate(h.u.filter,"queryRenderedFeatures.filter",a.filter,null,a);const d={};if(a&&a.layers){if(!Array.isArray(a.layers))return this.fire(new h.j(new Error("parameters.layers must be an Array."))),[];for(const E of a.layers){const T=this._layers[E];if(!T)return this.fire(new h.j(new Error(`The layer '${E}' does not exist in the map's style and cannot be queried for features.`))),[];d[T.source]=!0}}const m=[];a.availableImages=this._availableImages;const k=this._serializedAllLayers();for(const E in this.sourceCaches)a.layers&&!d[E]||m.push(Et(this.sourceCaches[E],this._layers,k,e,a,u));return this.placement&&m.push(function(E,T,I,O,B,U,Z){const G={},Q=U.queryRenderedSymbols(O),ne=[];for(const re of Object.keys(Q).map(Number))ne.push(Z[re]);ne.sort(vt);for(const re of ne){const oe=re.featureIndex.lookupSymbolFeatures(Q[re.bucketInstanceId],T,re.bucketIndex,re.sourceLayerIndex,B.filter,B.layers,B.availableImages,E);for(const X in oe){const ue=G[X]=G[X]||[],pe=oe[X];pe.sort((ye,Ce)=>{const Ae=re.featureSortOrder;if(Ae){const $e=Ae.indexOf(ye.featureIndex);return Ae.indexOf(Ce.featureIndex)-$e}return Ce.featureIndex-ye.featureIndex});for(const ye of pe)ue.push(ye)}}for(const re in G)G[re].forEach(oe=>{const X=oe.feature,ue=I[E[re].source].getFeatureState(X.layer["source-layer"],X.id);X.source=X.layer.source,X.layer["source-layer"]&&(X.sourceLayer=X.layer["source-layer"]),X.state=ue});return G}(this._layers,k,this.sourceCaches,e,a,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(m)}querySourceFeatures(e,a){a&&a.filter&&this._validate(h.u.filter,"querySourceFeatures.filter",a.filter,null,a);const u=this.sourceCaches[e];return u?function(d,m){const k=d.getRenderableIds().map(I=>d.getTileByID(I)),E=[],T={};for(let I=0;I<k.length;I++){const O=k[I],B=O.tileID.canonical.key;T[B]||(T[B]=!0,O.querySourceFeatures(E,m))}return E}(u,a):[]}getLight(){return this.light.getLight()}setLight(e,a={}){this._checkLoaded();const u=this.light.getLight();let d=!1;for(const k in e)if(!h.aE(e[k],u[k])){d=!0;break}if(!d)return;const m={now:R.now(),transition:h.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,a),this.light.updateTransitions(m)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,a={}){const u=this.getSky();let d=!1;if(!e&&!u)return;if(e&&!u)d=!0;else if(!e&&u)d=!0;else for(const k in e)if(!h.aE(e[k],u[k])){d=!0;break}if(!d)return;const m={now:R.now(),transition:h.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,a),this.sky.updateTransitions(m)}_validate(e,a,u,d,m={}){return(!m||m.validate!==!1)&&sr(this,e.call(h.u,h.e({key:a,style:this.serialize(),value:u,styleSpec:h.v},d)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Tr().off(De,this._rtlPluginLoaded);for(const a in this._layers)this._layers[a].setEventedParent(null);for(const a in this.sourceCaches){const u=this.sourceCaches[a];u.setEventedParent(null),u.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const a in this.sourceCaches)this.sourceCaches[a].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,a,u,d,m=!1){let k=!1,E=!1;const T={};for(const I of this._order){const O=this._layers[I];if(O.type!=="symbol")continue;if(!T[O.source]){const U=this.sourceCaches[O.source];T[O.source]=U.getRenderableIds(!0).map(Z=>U.getTileByID(Z)).sort((Z,G)=>G.tileID.overscaledZ-Z.tileID.overscaledZ||(Z.tileID.isLessThan(G.tileID)?-1:1))}const B=this.crossTileSymbolIndex.addLayer(O,T[O.source],e.center.lng);k=k||B}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((m=m||this._layerOrderChanged||u===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(R.now(),e.zoom))&&(this.pauseablePlacement=new Jo(e,this.map.terrain,this._order,m,a,u,d,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,T),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(R.now()),E=!0),k&&this.pauseablePlacement.placement.setStale()),E||k)for(const I of this._order){const O=this._layers[I];O.type==="symbol"&&this.placement.updateLayerOpacities(O,T[O.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(R.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,a){return h._(this,void 0,void 0,function*(){const u=yield this.imageManager.getImages(a.icons);this._updateTilesForChangedImages();const d=this.sourceCaches[a.source];return d&&d.setDependencies(a.tileID.key,a.type,a.icons),u})}getGlyphs(e,a){return h._(this,void 0,void 0,function*(){const u=yield this.glyphManager.getGlyphs(a.stacks),d=this.sourceCaches[a.source];return d&&d.setDependencies(a.tileID.key,a.type,[""]),u})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,a={}){this._checkLoaded(),e&&this._validate(h.u.glyphs,"glyphs",e,null,a)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,a,u={},d){this._checkLoaded();const m=[{id:e,url:a}],k=[...rt(this.stylesheet.sprite),...m];this._validate(h.u.sprite,"sprite",k,null,u)||(this.stylesheet.sprite=k,this._loadSprite(m,!0,d))}removeSprite(e){this._checkLoaded();const a=rt(this.stylesheet.sprite);if(a.find(u=>u.id===e)){if(this._spritesImagesIds[e])for(const u of this._spritesImagesIds[e])this.imageManager.removeImage(u),this._changedImages[u]=!0;a.splice(a.findIndex(u=>u.id===e),1),this.stylesheet.sprite=a.length>0?a:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}else this.fire(new h.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return rt(this.stylesheet.sprite)}setSprite(e,a={},u){this._checkLoaded(),e&&this._validate(h.u.sprite,"sprite",e,null,a)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,u):(this._unloadSprite(),u&&u(null)))}}var Ms=h.Y([{name:"a_pos",type:"Int16",components:2}]);const ss={prelude:Wt(`#ifdef GL_ES
40
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(L[1])} }\`.`)];const F=[];return r.layerType==="symbol"&&(v==="text-field"&&f&&!f.glyphs&&F.push(new De(s,x,'use of "text-field" requires a style "glyphs" property')),v==="text-font"&&sl(or(x))&&Mi(x.type)==="identity"&&F.push(new De(s,x,'"text-font" does not support identity functions'))),F.concat(l({key:r.key,value:x,valueSpec:P,style:f,styleSpec:_,expressionContext:"property",propertyType:t,propertyKey:v}))}function fl(r){return Oc(r,"paint")}function Bc(r){return Oc(r,"layout")}function Fc(r){let t=[];const s=r.value,l=r.key,f=r.style,_=r.styleSpec;s.type||s.ref||t.push(new De(l,s,'either "type" or "ref" is required'));let x=Mi(s.type);const v=Mi(s.ref);if(s.id){const S=Mi(s.id);for(let C=0;C<r.arrayIndex;C++){const P=f.layers[C];Mi(P.id)===S&&t.push(new De(l,s.id,`duplicate layer id "${s.id}", previously used at line ${P.id.__line__}`))}}if("ref"in s){let S;["type","source","source-layer","filter","layout"].forEach(C=>{C in s&&t.push(new De(l,s[C],`"${C}" is prohibited for ref layers`))}),f.layers.forEach(C=>{Mi(C.id)===v&&(S=C)}),S?S.ref?t.push(new De(l,s.ref,"ref cannot reference another ref layer")):x=Mi(S.type):t.push(new De(l,s.ref,`ref layer "${v}" not found`))}else if(x!=="background")if(s.source){const S=f.sources&&f.sources[s.source],C=S&&Mi(S.type);S?C==="vector"&&x==="raster"?t.push(new De(l,s.source,`layer "${s.id}" requires a raster source`)):C!=="raster-dem"&&x==="hillshade"?t.push(new De(l,s.source,`layer "${s.id}" requires a raster-dem source`)):C==="raster"&&x!=="raster"?t.push(new De(l,s.source,`layer "${s.id}" requires a vector source`)):C!=="vector"||s["source-layer"]?C==="raster-dem"&&x!=="hillshade"?t.push(new De(l,s.source,"raster-dem source can only be used with layer type 'hillshade'.")):x!=="line"||!s.paint||!s.paint["line-gradient"]||C==="geojson"&&S.lineMetrics||t.push(new De(l,s,`layer "${s.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new De(l,s,`layer "${s.id}" must specify a "source-layer"`)):t.push(new De(l,s.source,`source "${s.source}" not found`))}else t.push(new De(l,s,'missing required property "source"'));return t=t.concat(An({key:l,value:s,valueSpec:_.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${l}.type`,value:s.type,valueSpec:_.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:s,objectKey:"type"}),filter:Lc,layout:S=>An({layer:s,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":C=>Bc(Er({layerType:x},C))}}),paint:S=>An({layer:s,key:S.key,value:S.value,style:S.style,styleSpec:S.styleSpec,validateSpec:S.validateSpec,objectElementValidators:{"*":C=>fl(Er({layerType:x},C))}})}})),t}function Bs(r){const t=r.value,s=r.key,l=Ht(t);return l!=="string"?[new De(s,t,`string expected, ${l} found`)]:[]}const ml={promoteId:function({key:r,value:t}){if(Ht(t)==="string")return Bs({key:r,value:t});{const s=[];for(const l in t)s.push(...Bs({key:`${r}.${l}`,value:t[l]}));return s}}};function da(r){const t=r.value,s=r.key,l=r.styleSpec,f=r.style,_=r.validateSpec;if(!t.type)return[new De(s,t,'"type" is required')];const x=Mi(t.type);let v;switch(x){case"vector":case"raster":return v=An({key:s,value:t,valueSpec:l[`source_${x.replace("-","_")}`],style:r.style,styleSpec:l,objectElementValidators:ml,validateSpec:_}),v;case"raster-dem":return v=function(S){var C;const P=(C=S.sourceName)!==null&&C!==void 0?C:"",L=S.value,F=S.styleSpec,j=F.source_raster_dem,H=S.style;let q=[];const K=Ht(L);if(L===void 0)return q;if(K!=="object")return q.push(new De("source_raster_dem",L,`object expected, ${K} found`)),q;const ie=Mi(L.encoding)==="custom",ge=["redFactor","greenFactor","blueFactor","baseShift"],le=S.value.encoding?`"${S.value.encoding}"`:"Default";for(const fe in L)!ie&&ge.includes(fe)?q.push(new De(fe,L[fe],`In "${P}": "${fe}" is only valid when "encoding" is set to "custom". ${le} encoding found`)):j[fe]?q=q.concat(S.validateSpec({key:fe,value:L[fe],valueSpec:j[fe],validateSpec:S.validateSpec,style:H,styleSpec:F})):q.push(new De(fe,L[fe],`unknown property "${fe}"`));return q}({sourceName:s,value:t,style:r.style,styleSpec:l,validateSpec:_}),v;case"geojson":if(v=An({key:s,value:t,valueSpec:l.source_geojson,style:f,styleSpec:l,validateSpec:_,objectElementValidators:ml}),t.cluster)for(const S in t.clusterProperties){const[C,P]=t.clusterProperties[S],L=typeof C=="string"?[C,["accumulated"],["get",S]]:C;v.push(...mo({key:`${s}.${S}.map`,value:P,validateSpec:_,expressionContext:"cluster-map"})),v.push(...mo({key:`${s}.${S}.reduce`,value:L,validateSpec:_,expressionContext:"cluster-reduce"}))}return v;case"video":return An({key:s,value:t,valueSpec:l.source_video,style:f,validateSpec:_,styleSpec:l});case"image":return An({key:s,value:t,valueSpec:l.source_image,style:f,validateSpec:_,styleSpec:l});case"canvas":return[new De(s,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Hr({key:`${s}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:f,validateSpec:_,styleSpec:l})}}function Nc(r){const t=r.value,s=r.styleSpec,l=s.light,f=r.style;let _=[];const x=Ht(t);if(t===void 0)return _;if(x!=="object")return _=_.concat([new De("light",t,`object expected, ${x} found`)]),_;for(const v in t){const S=v.match(/^(.*)-transition$/);_=_.concat(S&&l[S[1]]&&l[S[1]].transition?r.validateSpec({key:v,value:t[v],valueSpec:s.transition,validateSpec:r.validateSpec,style:f,styleSpec:s}):l[v]?r.validateSpec({key:v,value:t[v],valueSpec:l[v],validateSpec:r.validateSpec,style:f,styleSpec:s}):[new De(v,t[v],`unknown property "${v}"`)])}return _}function Vc(r){const t=r.value,s=r.styleSpec,l=s.sky,f=r.style,_=Ht(t);if(t===void 0)return[];if(_!=="object")return[new De("sky",t,`object expected, ${_} found`)];let x=[];for(const v in t)x=x.concat(l[v]?r.validateSpec({key:v,value:t[v],valueSpec:l[v],style:f,styleSpec:s}):[new De(v,t[v],`unknown property "${v}"`)]);return x}function $c(r){const t=r.value,s=r.styleSpec,l=s.terrain,f=r.style;let _=[];const x=Ht(t);if(t===void 0)return _;if(x!=="object")return _=_.concat([new De("terrain",t,`object expected, ${x} found`)]),_;for(const v in t)_=_.concat(l[v]?r.validateSpec({key:v,value:t[v],valueSpec:l[v],validateSpec:r.validateSpec,style:f,styleSpec:s}):[new De(v,t[v],`unknown property "${v}"`)]);return _}function jc(r){let t=[];const s=r.value,l=r.key;if(Array.isArray(s)){const f=[],_=[];for(const x in s)s[x].id&&f.includes(s[x].id)&&t.push(new De(l,s,`all the sprites' ids must be unique, but ${s[x].id} is duplicated`)),f.push(s[x].id),s[x].url&&_.includes(s[x].url)&&t.push(new De(l,s,`all the sprites' URLs must be unique, but ${s[x].url} is duplicated`)),_.push(s[x].url),t=t.concat(An({key:`${l}[${x}]`,value:s[x],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return t}return Bs({key:l,value:s})}const gl={"*":()=>[],array:ua,boolean:function(r){const t=r.value,s=r.key,l=Ht(t);return l!=="boolean"?[new De(s,t,`boolean expected, ${l} found`)]:[]},number:Rc,color:function(r){const t=r.key,s=r.value,l=Ht(s);return l!=="string"?[new De(t,s,`color expected, ${l} found`)]:ti.parse(String(s))?[]:[new De(t,s,`color expected, "${s}" found`)]},constants:Fu,enum:Hr,filter:Lc,function:dl,layer:Fc,object:An,source:da,light:Nc,sky:Vc,terrain:$c,projection:function(r){const t=r.value,s=r.styleSpec,l=s.projection,f=r.style,_=Ht(t);if(t===void 0)return[];if(_!=="object")return[new De("projection",t,`object expected, ${_} found`)];let x=[];for(const v in t)x=x.concat(l[v]?r.validateSpec({key:v,value:t[v],valueSpec:l[v],style:f,styleSpec:s}):[new De(v,t[v],`unknown property "${v}"`)]);return x},string:Bs,formatted:function(r){return Bs(r).length===0?[]:mo(r)},resolvedImage:function(r){return Bs(r).length===0?[]:mo(r)},padding:function(r){const t=r.key,s=r.value;if(Ht(s)==="array"){if(s.length<1||s.length>4)return[new De(t,s,`padding requires 1 to 4 values; ${s.length} values found`)];const l={type:"number"};let f=[];for(let _=0;_<s.length;_++)f=f.concat(r.validateSpec({key:`${t}[${_}]`,value:s[_],validateSpec:r.validateSpec,valueSpec:l}));return f}return Rc({key:t,value:s,valueSpec:{}})},variableAnchorOffsetCollection:function(r){const t=r.key,s=r.value,l=Ht(s),f=r.styleSpec;if(l!=="array"||s.length<1||s.length%2!=0)return[new De(t,s,"variableAnchorOffsetCollection requires a non-empty array of even length")];let _=[];for(let x=0;x<s.length;x+=2)_=_.concat(Hr({key:`${t}[${x}]`,value:s[x],valueSpec:f.layout_symbol["text-anchor"]})),_=_.concat(ua({key:`${t}[${x+1}]`,value:s[x+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:f}));return _},sprite:jc};function go(r){const t=r.value,s=r.valueSpec,l=r.styleSpec;return r.validateSpec=go,s.expression&&sl(Mi(t))?dl(r):s.expression&&ll(or(t))?mo(r):s.type&&gl[s.type]?gl[s.type](r):An(Er({},r,{valueSpec:s.type?l[s.type]:s}))}function Nu(r){const t=r.value,s=r.key,l=Bs(r);return l.length||(t.indexOf("{fontstack}")===-1&&l.push(new De(s,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&l.push(new De(s,t,'"glyphs" url must include a "{range}" token'))),l}function Zn(r,t=xe){let s=[];return s=s.concat(go({key:"",value:r,valueSpec:t.$root,styleSpec:t,style:r,validateSpec:go,objectElementValidators:{glyphs:Nu,"*":()=>[]}})),r.constants&&(s=s.concat(Fu({key:"constants",value:r.constants,style:r,styleSpec:t,validateSpec:go}))),Uc(s)}function Ir(r){return function(t){return r({...t,validateSpec:go})}}function Uc(r){return[].concat(r).sort((t,s)=>t.line-s.line)}function ar(r){return function(...t){return Uc(r.apply(this,t))}}Zn.source=ar(Ir(da)),Zn.sprite=ar(Ir(jc)),Zn.glyphs=ar(Ir(Nu)),Zn.light=ar(Ir(Nc)),Zn.sky=ar(Ir(Vc)),Zn.terrain=ar(Ir($c)),Zn.layer=ar(Ir(Fc)),Zn.filter=ar(Ir(Lc)),Zn.paintProperty=ar(Ir(fl)),Zn.layoutProperty=ar(Ir(Bc));const Fs=Zn,hf=Fs.light,uf=Fs.sky,Vu=Fs.paintProperty,$u=Fs.layoutProperty;function Hc(r,t){let s=!1;if(t&&t.length)for(const l of t)r.fire(new vt(new Error(l.message))),s=!0;return s}class yo{constructor(t,s,l){const f=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const x=new Int32Array(this.arrayBuffer);t=x[0],this.d=(s=x[1])+2*(l=x[2]);for(let S=0;S<this.d*this.d;S++){const C=x[3+S],P=x[3+S+1];f.push(C===P?null:x.subarray(C,P))}const v=x[3+f.length+1];this.keys=x.subarray(x[3+f.length],v),this.bboxes=x.subarray(v),this.insert=this._insertReadonly}else{this.d=s+2*l;for(let x=0;x<this.d*this.d;x++)f.push([]);this.keys=[],this.bboxes=[]}this.n=s,this.extent=t,this.padding=l,this.scale=s/t,this.uid=0;const _=l/s*t;this.min=-_,this.max=t+_}insert(t,s,l,f,_){this._forEachCell(s,l,f,_,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(f),this.bboxes.push(_)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,s,l,f,_,x){this.cells[_].push(x)}query(t,s,l,f,_){const x=this.min,v=this.max;if(t<=x&&s<=x&&v<=l&&v<=f&&!_)return Array.prototype.slice.call(this.keys);{const S=[];return this._forEachCell(t,s,l,f,this._queryCell,S,{},_),S}}_queryCell(t,s,l,f,_,x,v,S){const C=this.cells[_];if(C!==null){const P=this.keys,L=this.bboxes;for(let F=0;F<C.length;F++){const j=C[F];if(v[j]===void 0){const H=4*j;(S?S(L[H+0],L[H+1],L[H+2],L[H+3]):t<=L[H+2]&&s<=L[H+3]&&l>=L[H+0]&&f>=L[H+1])?(v[j]=!0,x.push(P[j])):v[j]=!1}}}}_forEachCell(t,s,l,f,_,x,v,S){const C=this._convertToCellCoord(t),P=this._convertToCellCoord(s),L=this._convertToCellCoord(l),F=this._convertToCellCoord(f);for(let j=C;j<=L;j++)for(let H=P;H<=F;H++){const q=this.d*H+j;if((!S||S(this._convertFromCellCoord(j),this._convertFromCellCoord(H),this._convertFromCellCoord(j+1),this._convertFromCellCoord(H+1)))&&_.call(this,t,s,l,f,q,x,v,S))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,s=3+this.cells.length+1+1;let l=0;for(let x=0;x<this.cells.length;x++)l+=this.cells[x].length;const f=new Int32Array(s+l+this.keys.length+this.bboxes.length);f[0]=this.extent,f[1]=this.n,f[2]=this.padding;let _=s;for(let x=0;x<t.length;x++){const v=t[x];f[3+x]=_,f.set(v,_),_+=v.length}return f[3+t.length]=_,f.set(this.keys,_),_+=this.keys.length,f[3+t.length+1]=_,f.set(this.bboxes,_),_+=this.bboxes.length,f.buffer}static serialize(t,s){const l=t.toArrayBuffer();return s&&s.push(l),{buffer:l}}static deserialize(t){return new yo(t.buffer)}}const Wn={};function Xe(r,t,s={}){if(Wn[r])throw new Error(`${r} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:r,writeable:!1}),Wn[r]={klass:t,omit:s.omit||[],shallow:s.shallow||[]}}Xe("Object",Object),Xe("TransferableGridIndex",yo),Xe("Color",ti),Xe("Error",Error),Xe("AJAXError",Se),Xe("ResolvedImage",In),Xe("StylePropertyFunction",fo),Xe("StyleExpression",al,{omit:["_evaluator"]}),Xe("ZoomDependentExpression",po),Xe("ZoomConstantExpression",uo),Xe("CompoundExpression",qn,{omit:["_evaluate"]});for(const r in so)so[r]._classRegistryKey||Xe(`Expression_${r}`,so[r]);function yl(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function qc(r){return r.$name||r.constructor._classRegistryKey}function ju(r){return!function(t){if(t===null||typeof t!="object")return!1;const s=qc(t);return!(!s||s==="Object")}(r)&&(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||r instanceof Error||yl(r)||Ui(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function _o(r,t){if(ju(r))return(yl(r)||Ui(r))&&t&&t.push(r),ArrayBuffer.isView(r)&&t&&t.push(r.buffer),r instanceof ImageData&&t&&t.push(r.data.buffer),r;if(Array.isArray(r)){const _=[];for(const x of r)_.push(_o(x,t));return _}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const s=qc(r);if(!s)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!Wn[s])throw new Error(`${s} is not registered.`);const{klass:l}=Wn[s],f=l.serialize?l.serialize(r,t):{};if(l.serialize){if(t&&f===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const _ in r){if(!r.hasOwnProperty(_)||Wn[s].omit.indexOf(_)>=0)continue;const x=r[_];f[_]=Wn[s].shallow.indexOf(_)>=0?x:_o(x,t)}r instanceof Error&&(f.message=r.message)}if(f.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(f.$name=s),f}function xo(r){if(ju(r))return r;if(Array.isArray(r))return r.map(xo);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const t=qc(r)||"Object";if(!Wn[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:s}=Wn[t];if(!s)throw new Error(`can't deserialize unregistered class ${t}`);if(s.deserialize)return s.deserialize(r);const l=Object.create(s.prototype);for(const f of Object.keys(r)){if(f==="$name")continue;const _=r[f];l[f]=Wn[t].shallow.indexOf(f)>=0?_:xo(_)}return l}class Zc{constructor(){this.first=!0}update(t,s){const l=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=l,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=l,!0):(this.lastFloorZoom>l?(this.lastIntegerZoom=l+1,this.lastIntegerZoomTime=s):this.lastFloorZoom<l&&(this.lastIntegerZoom=l,this.lastIntegerZoomTime=s),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=l,!0))}}const Bt={"Latin-1 Supplement":r=>r>=128&&r<=255,"Hangul Jamo":r=>r>=4352&&r<=4607,Khmer:r=>r>=6016&&r<=6143,"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,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Katakana:r=>r>=12448&&r<=12543,Kanbun:r=>r>=12688&&r<=12703,"CJK Strokes":r=>r>=12736&&r<=12783,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"Private Use Area":r=>r>=57344&&r<=63743,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519};function Wc(r){for(const t of r)if(Yc(t.charCodeAt(0)))return!0;return!1}function df(r){for(const t of r)if(!bo(t.charCodeAt(0)))return!1;return!0}function Gc(r){const t=r.map(s=>{try{return new RegExp(`\\p{sc=${s}}`,"u").source}catch{return null}}).filter(s=>s);return new RegExp(t.join("|"),"u")}const pf=Gc(["Arab","Dupl","Mong","Ougr","Syrc"]);function bo(r){return!pf.test(String.fromCodePoint(r))}const Uu=Gc(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function Yc(r){return!(r!==746&&r!==747&&(r<4352||!(Bt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||Bt["CJK Compatibility"](r)||Bt["CJK Strokes"](r)||!(!Bt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||Bt["Enclosed CJK Letters and Months"](r)||Bt["Ideographic Description Characters"](r)||Bt.Kanbun(r)||Bt.Katakana(r)&&r!==12540||!(!Bt["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)||!(!Bt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||Bt["Vertical Forms"](r)||Bt["Yijing Hexagram Symbols"](r)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(r))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(r))||Uu.test(String.fromCodePoint(r)))))}function Hu(r){return!(Yc(r)||function(t){return!!(Bt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||Bt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||Bt["Letterlike Symbols"](t)||Bt["Number Forms"](t)||Bt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||Bt["Control Pictures"](t)&&t!==9251||Bt["Optical Character Recognition"](t)||Bt["Enclosed Alphanumerics"](t)||Bt["Geometric Shapes"](t)||Bt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Bt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Bt["CJK Symbols and Punctuation"](t)||Bt.Katakana(t)||Bt["Private Use Area"](t)||Bt["CJK Compatibility Forms"](t)||Bt["Small Form Variants"](t)||Bt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(r))}const ff=Gc(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Xc(r){return ff.test(String.fromCodePoint(r))}function mf(r,t){return!(!t&&Xc(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||Bt.Khmer(r))}function gf(r){for(const t of r)if(Xc(t.charCodeAt(0)))return!0;return!1}const Dn=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class fi{constructor(t,s){this.zoom=t,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 Zc,this.transition={})}isSupportedScript(t){return function(s,l){for(const f of s)if(!mf(f.charCodeAt(0),l))return!1;return!0}(t,Dn.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,s=t-Math.floor(t),l=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:s+(1-s)*l}:{fromScale:.5,toScale:1,t:1-(1-l)*s}}}class vo{constructor(t,s){this.property=t,this.value=s,this.expression=function(l,f){if(sl(l))return new fo(l,f);if(ll(l)){const _=Ac(l,f);if(_.result==="error")throw new Error(_.value.map(x=>`${x.key}: ${x.message}`).join(", "));return _.value}{let _=l;return f.type==="color"&&typeof l=="string"?_=ti.parse(l):f.type!=="padding"||typeof l!="number"&&!Array.isArray(l)?f.type==="variableAnchorOffsetCollection"&&Array.isArray(l)&&(_=Hn.parse(l)):_=Pn.parse(l),{kind:"constant",evaluate:()=>_}}}(s===void 0?t.specification.default:s,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,s,l){return this.property.possiblyEvaluate(this,t,s,l)}}class _l{constructor(t){this.property=t,this.value=new vo(t,void 0)}transitioned(t,s){return new qu(this.property,this.value,s,Be({},t.transition,this.transition),t.now)}untransitioned(){return new qu(this.property,this.value,null,{},0)}}class xl{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Mt(this._values[t].value.value)}setValue(t,s){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new _l(this._values[t].property)),this._values[t].value=new vo(this._values[t].property,s===null?void 0:Mt(s))}getTransition(t){return Mt(this._values[t].transition)}setTransition(t,s){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new _l(this._values[t].property)),this._values[t].transition=Mt(s)||void 0}serialize(){const t={};for(const s of Object.keys(this._values)){const l=this.getValue(s);l!==void 0&&(t[s]=l);const f=this.getTransition(s);f!==void 0&&(t[`${s}-transition`]=f)}return t}transitioned(t,s){const l=new pa(this._properties);for(const f of Object.keys(this._values))l._values[f]=this._values[f].transitioned(t,s._values[f]);return l}untransitioned(){const t=new pa(this._properties);for(const s of Object.keys(this._values))t._values[s]=this._values[s].untransitioned();return t}}class qu{constructor(t,s,l,f,_){this.property=t,this.value=s,this.begin=_+f.delay||0,this.end=this.begin+f.duration||0,t.specification.transition&&(f.delay||f.duration)&&(this.prior=l)}possiblyEvaluate(t,s,l){const f=t.now||0,_=this.value.possiblyEvaluate(t,s,l),x=this.prior;if(x){if(f>this.end)return this.prior=null,_;if(this.value.isDataDriven())return this.prior=null,_;if(f<this.begin)return x.possiblyEvaluate(t,s,l);{const v=(f-this.begin)/(this.end-this.begin);return this.property.interpolate(x.possiblyEvaluate(t,s,l),_,function(S){if(S<=0)return 0;if(S>=1)return 1;const C=S*S,P=C*S;return 4*(S<.5?P:3*(S-C)+P-.75)}(v))}}return _}}class pa{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,s,l){const f=new ma(this._properties);for(const _ of Object.keys(this._values))f._values[_]=this._values[_].possiblyEvaluate(t,s,l);return f}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class fa{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Mt(this._values[t].value)}setValue(t,s){this._values[t]=new vo(this._values[t].property,s===null?void 0:Mt(s))}serialize(){const t={};for(const s of Object.keys(this._values)){const l=this.getValue(s);l!==void 0&&(t[s]=l)}return t}possiblyEvaluate(t,s,l){const f=new ma(this._properties);for(const _ of Object.keys(this._values))f._values[_]=this._values[_].possiblyEvaluate(t,s,l);return f}}class Ar{constructor(t,s,l){this.property=t,this.value=s,this.parameters=l}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,s,l,f){return this.property.evaluate(this.value,this.parameters,t,s,l,f)}}class ma{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class et{constructor(t){this.specification=t}possiblyEvaluate(t,s){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(s)}interpolate(t,s,l){const f=mn[this.specification.type];return f?f(t,s,l):t}}class dt{constructor(t,s){this.specification=t,this.overrides=s}possiblyEvaluate(t,s,l,f){return new Ar(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(s,null,{},l,f)}:t.expression,s)}interpolate(t,s,l){if(t.value.kind!=="constant"||s.value.kind!=="constant")return t;if(t.value.value===void 0||s.value.value===void 0)return new Ar(this,{kind:"constant",value:void 0},t.parameters);const f=mn[this.specification.type];if(f){const _=f(t.value.value,s.value.value,l);return new Ar(this,{kind:"constant",value:_},t.parameters)}return t}evaluate(t,s,l,f,_,x){return t.kind==="constant"?t.value:t.evaluate(s,l,f,_,x)}}class bl extends dt{possiblyEvaluate(t,s,l,f){if(t.value===void 0)return new Ar(this,{kind:"constant",value:void 0},s);if(t.expression.kind==="constant"){const _=t.expression.evaluate(s,null,{},l,f),x=t.property.specification.type==="resolvedImage"&&typeof _!="string"?_.name:_,v=this._calculate(x,x,x,s);return new Ar(this,{kind:"constant",value:v},s)}if(t.expression.kind==="camera"){const _=this._calculate(t.expression.evaluate({zoom:s.zoom-1}),t.expression.evaluate({zoom:s.zoom}),t.expression.evaluate({zoom:s.zoom+1}),s);return new Ar(this,{kind:"constant",value:_},s)}return new Ar(this,t.expression,s)}evaluate(t,s,l,f,_,x){if(t.kind==="source"){const v=t.evaluate(s,l,f,_,x);return this._calculate(v,v,v,s)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(s.zoom)-1},l,f),t.evaluate({zoom:Math.floor(s.zoom)},l,f),t.evaluate({zoom:Math.floor(s.zoom)+1},l,f),s):t.value}_calculate(t,s,l,f){return f.zoom>f.zoomHistory.lastIntegerZoom?{from:t,to:s}:{from:l,to:s}}interpolate(t){return t}}class vl{constructor(t){this.specification=t}possiblyEvaluate(t,s,l,f){if(t.value!==void 0){if(t.expression.kind==="constant"){const _=t.expression.evaluate(s,null,{},l,f);return this._calculate(_,_,_,s)}return this._calculate(t.expression.evaluate(new fi(Math.floor(s.zoom-1),s)),t.expression.evaluate(new fi(Math.floor(s.zoom),s)),t.expression.evaluate(new fi(Math.floor(s.zoom+1),s)),s)}}_calculate(t,s,l,f){return f.zoom>f.zoomHistory.lastIntegerZoom?{from:t,to:s}:{from:l,to:s}}interpolate(t){return t}}class Kc{constructor(t){this.specification=t}possiblyEvaluate(t,s,l,f){return!!t.expression.evaluate(s,null,{},l,f)}interpolate(){return!1}}class g{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const s in t){const l=t[s];l.specification.overridable&&this.overridableProperties.push(s);const f=this.defaultPropertyValues[s]=new vo(l,void 0),_=this.defaultTransitionablePropertyValues[s]=new _l(l);this.defaultTransitioningPropertyValues[s]=_.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=f.possiblyEvaluate({})}}}Xe("DataDrivenProperty",dt),Xe("DataConstantProperty",et),Xe("CrossFadedDataDrivenProperty",bl),Xe("CrossFadedProperty",vl),Xe("ColorRampProperty",Kc);const e="-transition";class a extends ri{constructor(t,s){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),s.layout&&(this._unevaluatedLayout=new fa(s.layout)),s.paint)){this._transitionablePaint=new xl(s.paint);for(const l in t.paint)this.setPaintProperty(l,t.paint[l],{validate:!1});for(const l in t.layout)this.setLayoutProperty(l,t.layout[l],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ma(s.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,s,l={}){s!=null&&this._validate($u,`layers.${this.id}.layout.${t}`,t,s,l)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,s):this.visibility=s)}getPaintProperty(t){return t.endsWith(e)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,s,l={}){if(s!=null&&this._validate(Vu,`layers.${this.id}.paint.${t}`,t,s,l))return!1;if(t.endsWith(e))return this._transitionablePaint.setTransition(t.slice(0,-11),s||void 0),!1;{const f=this._transitionablePaint._values[t],_=f.property.specification["property-type"]==="cross-faded-data-driven",x=f.value.isDataDriven(),v=f.value;this._transitionablePaint.setValue(t,s),this._handleSpecialPaintPropertyUpdate(t);const S=this._transitionablePaint._values[t].value;return S.isDataDriven()||x||_||this._handleOverridablePaintPropertyUpdate(t,v,S)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,s,l){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,s){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,s)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,s)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Dt(t,(s,l)=>!(s===void 0||l==="layout"&&!Object.keys(s).length||l==="paint"&&!Object.keys(s).length))}_validate(t,s,l,f,_={}){return(!_||_.validate!==!1)&&Hc(this,t.call(Fs,{key:s,layerType:this.type,objectKey:l,value:f,styleSpec:xe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const s=this.paint.get(t);if(s instanceof Ar&&lo(s.property.specification)&&(s.value.kind==="source"||s.value.kind==="composite")&&s.value.isStateDependent)return!0}return!1}}const u={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class d{constructor(t,s){this._structArray=t,this._pos1=s*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class m{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,s){return t._trim(),s&&(t.isTransferred=!0,s.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const s=Object.create(this.prototype);return s.arrayBuffer=t.arrayBuffer,s.length=t.length,s.capacity=t.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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const s=this.uint8;this._refreshViews(),s&&this.uint8.set(s)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function k(r,t=1){let s=0,l=0;return{members:r.map(f=>{const _=u[f.type].BYTES_PER_ELEMENT,x=s=E(s,Math.max(t,_)),v=f.components||1;return l=Math.max(l,_),s+=_*v,{name:f.name,type:f.type,components:v,offset:x}}),size:E(s,Math.max(l,t)),alignment:t}}function E(r,t){return Math.ceil(r/t)*t}class T extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,s)}emplace(t,s,l){const f=2*t;return this.int16[f+0]=s,this.int16[f+1]=l,t}}T.prototype.bytesPerElement=4,Xe("StructArrayLayout2i4",T);class I extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l){const f=this.length;return this.resize(f+1),this.emplace(f,t,s,l)}emplace(t,s,l,f){const _=3*t;return this.int16[_+0]=s,this.int16[_+1]=l,this.int16[_+2]=f,t}}I.prototype.bytesPerElement=6,Xe("StructArrayLayout3i6",I);class O extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f){const _=this.length;return this.resize(_+1),this.emplace(_,t,s,l,f)}emplace(t,s,l,f,_){const x=4*t;return this.int16[x+0]=s,this.int16[x+1]=l,this.int16[x+2]=f,this.int16[x+3]=_,t}}O.prototype.bytesPerElement=8,Xe("StructArrayLayout4i8",O);class B extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x){const v=this.length;return this.resize(v+1),this.emplace(v,t,s,l,f,_,x)}emplace(t,s,l,f,_,x,v){const S=6*t;return this.int16[S+0]=s,this.int16[S+1]=l,this.int16[S+2]=f,this.int16[S+3]=_,this.int16[S+4]=x,this.int16[S+5]=v,t}}B.prototype.bytesPerElement=12,Xe("StructArrayLayout2i4i12",B);class U extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x){const v=this.length;return this.resize(v+1),this.emplace(v,t,s,l,f,_,x)}emplace(t,s,l,f,_,x,v){const S=4*t,C=8*t;return this.int16[S+0]=s,this.int16[S+1]=l,this.uint8[C+4]=f,this.uint8[C+5]=_,this.uint8[C+6]=x,this.uint8[C+7]=v,t}}U.prototype.bytesPerElement=8,Xe("StructArrayLayout2i4ub8",U);class Z extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,s)}emplace(t,s,l){const f=2*t;return this.float32[f+0]=s,this.float32[f+1]=l,t}}Z.prototype.bytesPerElement=8,Xe("StructArrayLayout2f8",Z);class G extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x,v,S,C,P){const L=this.length;return this.resize(L+1),this.emplace(L,t,s,l,f,_,x,v,S,C,P)}emplace(t,s,l,f,_,x,v,S,C,P,L){const F=10*t;return this.uint16[F+0]=s,this.uint16[F+1]=l,this.uint16[F+2]=f,this.uint16[F+3]=_,this.uint16[F+4]=x,this.uint16[F+5]=v,this.uint16[F+6]=S,this.uint16[F+7]=C,this.uint16[F+8]=P,this.uint16[F+9]=L,t}}G.prototype.bytesPerElement=20,Xe("StructArrayLayout10ui20",G);class Q extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x,v,S,C,P,L,F){const j=this.length;return this.resize(j+1),this.emplace(j,t,s,l,f,_,x,v,S,C,P,L,F)}emplace(t,s,l,f,_,x,v,S,C,P,L,F,j){const H=12*t;return this.int16[H+0]=s,this.int16[H+1]=l,this.int16[H+2]=f,this.int16[H+3]=_,this.uint16[H+4]=x,this.uint16[H+5]=v,this.uint16[H+6]=S,this.uint16[H+7]=C,this.int16[H+8]=P,this.int16[H+9]=L,this.int16[H+10]=F,this.int16[H+11]=j,t}}Q.prototype.bytesPerElement=24,Xe("StructArrayLayout4i4ui4i24",Q);class ne extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s,l){const f=this.length;return this.resize(f+1),this.emplace(f,t,s,l)}emplace(t,s,l,f){const _=3*t;return this.float32[_+0]=s,this.float32[_+1]=l,this.float32[_+2]=f,t}}ne.prototype.bytesPerElement=12,Xe("StructArrayLayout3f12",ne);class re extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const s=this.length;return this.resize(s+1),this.emplace(s,t)}emplace(t,s){return this.uint32[1*t+0]=s,t}}re.prototype.bytesPerElement=4,Xe("StructArrayLayout1ul4",re);class oe extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x,v,S,C){const P=this.length;return this.resize(P+1),this.emplace(P,t,s,l,f,_,x,v,S,C)}emplace(t,s,l,f,_,x,v,S,C,P){const L=10*t,F=5*t;return this.int16[L+0]=s,this.int16[L+1]=l,this.int16[L+2]=f,this.int16[L+3]=_,this.int16[L+4]=x,this.int16[L+5]=v,this.uint32[F+3]=S,this.uint16[L+8]=C,this.uint16[L+9]=P,t}}oe.prototype.bytesPerElement=20,Xe("StructArrayLayout6i1ul2ui20",oe);class X extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x){const v=this.length;return this.resize(v+1),this.emplace(v,t,s,l,f,_,x)}emplace(t,s,l,f,_,x,v){const S=6*t;return this.int16[S+0]=s,this.int16[S+1]=l,this.int16[S+2]=f,this.int16[S+3]=_,this.int16[S+4]=x,this.int16[S+5]=v,t}}X.prototype.bytesPerElement=12,Xe("StructArrayLayout2i2i2i12",X);class ue extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_){const x=this.length;return this.resize(x+1),this.emplace(x,t,s,l,f,_)}emplace(t,s,l,f,_,x){const v=4*t,S=8*t;return this.float32[v+0]=s,this.float32[v+1]=l,this.float32[v+2]=f,this.int16[S+6]=_,this.int16[S+7]=x,t}}ue.prototype.bytesPerElement=16,Xe("StructArrayLayout2f1f2i16",ue);class pe extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x){const v=this.length;return this.resize(v+1),this.emplace(v,t,s,l,f,_,x)}emplace(t,s,l,f,_,x,v){const S=16*t,C=4*t,P=8*t;return this.uint8[S+0]=s,this.uint8[S+1]=l,this.float32[C+1]=f,this.float32[C+2]=_,this.int16[P+6]=x,this.int16[P+7]=v,t}}pe.prototype.bytesPerElement=16,Xe("StructArrayLayout2ub2f2i16",pe);class ye extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s,l){const f=this.length;return this.resize(f+1),this.emplace(f,t,s,l)}emplace(t,s,l,f){const _=3*t;return this.uint16[_+0]=s,this.uint16[_+1]=l,this.uint16[_+2]=f,t}}ye.prototype.bytesPerElement=6,Xe("StructArrayLayout3ui6",ye);class Ce extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie){const ge=this.length;return this.resize(ge+1),this.emplace(ge,t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie)}emplace(t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie,ge){const le=24*t,fe=12*t,we=48*t;return this.int16[le+0]=s,this.int16[le+1]=l,this.uint16[le+2]=f,this.uint16[le+3]=_,this.uint32[fe+2]=x,this.uint32[fe+3]=v,this.uint32[fe+4]=S,this.uint16[le+10]=C,this.uint16[le+11]=P,this.uint16[le+12]=L,this.float32[fe+7]=F,this.float32[fe+8]=j,this.uint8[we+36]=H,this.uint8[we+37]=q,this.uint8[we+38]=K,this.uint32[fe+10]=ie,this.int16[le+22]=ge,t}}Ce.prototype.bytesPerElement=48,Xe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ce);class Ae extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie,ge,le,fe,we,Pe,qe,ut,je,Ve,nt,Ke){const Ge=this.length;return this.resize(Ge+1),this.emplace(Ge,t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie,ge,le,fe,we,Pe,qe,ut,je,Ve,nt,Ke)}emplace(t,s,l,f,_,x,v,S,C,P,L,F,j,H,q,K,ie,ge,le,fe,we,Pe,qe,ut,je,Ve,nt,Ke,Ge){const Te=32*t,at=16*t;return this.int16[Te+0]=s,this.int16[Te+1]=l,this.int16[Te+2]=f,this.int16[Te+3]=_,this.int16[Te+4]=x,this.int16[Te+5]=v,this.int16[Te+6]=S,this.int16[Te+7]=C,this.uint16[Te+8]=P,this.uint16[Te+9]=L,this.uint16[Te+10]=F,this.uint16[Te+11]=j,this.uint16[Te+12]=H,this.uint16[Te+13]=q,this.uint16[Te+14]=K,this.uint16[Te+15]=ie,this.uint16[Te+16]=ge,this.uint16[Te+17]=le,this.uint16[Te+18]=fe,this.uint16[Te+19]=we,this.uint16[Te+20]=Pe,this.uint16[Te+21]=qe,this.uint16[Te+22]=ut,this.uint32[at+12]=je,this.float32[at+13]=Ve,this.float32[at+14]=nt,this.uint16[Te+30]=Ke,this.uint16[Te+31]=Ge,t}}Ae.prototype.bytesPerElement=64,Xe("StructArrayLayout8i15ui1ul2f2ui64",Ae);class $e extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const s=this.length;return this.resize(s+1),this.emplace(s,t)}emplace(t,s){return this.float32[1*t+0]=s,t}}$e.prototype.bytesPerElement=4,Xe("StructArrayLayout1f4",$e);class We extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s,l){const f=this.length;return this.resize(f+1),this.emplace(f,t,s,l)}emplace(t,s,l,f){const _=3*t;return this.uint16[6*t+0]=s,this.float32[_+1]=l,this.float32[_+2]=f,t}}We.prototype.bytesPerElement=12,Xe("StructArrayLayout1ui2f12",We);class Oe extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s,l){const f=this.length;return this.resize(f+1),this.emplace(f,t,s,l)}emplace(t,s,l,f){const _=4*t;return this.uint32[2*t+0]=s,this.uint16[_+2]=l,this.uint16[_+3]=f,t}}Oe.prototype.bytesPerElement=8,Xe("StructArrayLayout1ul2ui8",Oe);class Le extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,s){const l=this.length;return this.resize(l+1),this.emplace(l,t,s)}emplace(t,s,l){const f=2*t;return this.uint16[f+0]=s,this.uint16[f+1]=l,t}}Le.prototype.bytesPerElement=4,Xe("StructArrayLayout2ui4",Le);class tt extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const s=this.length;return this.resize(s+1),this.emplace(s,t)}emplace(t,s){return this.uint16[1*t+0]=s,t}}tt.prototype.bytesPerElement=2,Xe("StructArrayLayout1ui2",tt);class xt extends m{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,s,l,f){const _=this.length;return this.resize(_+1),this.emplace(_,t,s,l,f)}emplace(t,s,l,f,_){const x=4*t;return this.float32[x+0]=s,this.float32[x+1]=l,this.float32[x+2]=f,this.float32[x+3]=_,t}}xt.prototype.bytesPerElement=16,Xe("StructArrayLayout4f16",xt);class Ne extends d{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 R(this.anchorPointX,this.anchorPointY)}}Ne.prototype.size=20;class Ue extends oe{get(t){return new Ne(this,t)}}Xe("CollisionBoxArray",Ue);class yt extends d{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}yt.prototype.size=48;class mi extends Ce{get(t){return new yt(this,t)}}Xe("PlacedSymbolArray",mi);class Tt extends d{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Tt.prototype.size=64;class Ot extends Ae{get(t){return new Tt(this,t)}}Xe("SymbolInstanceArray",Ot);class gi extends $e{getoffsetX(t){return this.float32[1*t+0]}}Xe("GlyphOffsetArray",gi);class Xi extends I{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Xe("SymbolLineVertexArray",Xi);class lr extends d{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]}}lr.prototype.size=12;class yi extends We{get(t){return new lr(this,t)}}Xe("TextAnchorOffsetArray",yi);class yn extends d{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]}}yn.prototype.size=8;class ln extends Oe{get(t){return new yn(this,t)}}Xe("FeatureIndexArray",ln);class Ki extends T{}class cn extends T{}class Dr extends T{}class wo extends B{}class wl extends U{}class ko extends Z{}class Gn extends G{}class kl extends Q{}class Jc extends ne{}class Yn extends re{}class Xn extends X{}class as extends pe{}class cr extends ye{}class Zi extends Le{}const Ji=k([{name:"a_pos",components:2,type:"Int16"}],4),{members:zn}=Ji;class Ft{constructor(t=[]){this.segments=t}prepareSegment(t,s,l,f){let _=this.segments[this.segments.length-1];return t>Ft.MAX_VERTEX_ARRAY_LENGTH&&Rt(`Max vertices per segment is ${Ft.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!_||_.vertexLength+t>Ft.MAX_VERTEX_ARRAY_LENGTH||_.sortKey!==f)&&(_={vertexOffset:s.length,primitiveOffset:l.length,vertexLength:0,primitiveLength:0},f!==void 0&&(_.sortKey=f),this.segments.push(_)),_}get(){return this.segments}destroy(){for(const t of this.segments)for(const s in t.vaos)t.vaos[s].destroy()}static simpleSegment(t,s,l,f){return new Ft([{vertexOffset:t,primitiveOffset:s,vertexLength:l,primitiveLength:f,vaos:{},sortKey:0}])}}function Ns(r,t){return 256*(r=ot(Math.floor(r),0,255))+ot(Math.floor(t),0,255)}Ft.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Xe("SegmentVector",Ft);const So=k([{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 Eo={exports:{}},Zu={exports:{}};Zu.exports=function(r,t){var s,l,f,_,x,v,S,C;for(l=r.length-(s=3&r.length),f=t,x=3432918353,v=461845907,C=0;C<l;)S=255&r.charCodeAt(C)|(255&r.charCodeAt(++C))<<8|(255&r.charCodeAt(++C))<<16|(255&r.charCodeAt(++C))<<24,++C,f=27492+(65535&(_=5*(65535&(f=(f^=S=(65535&(S=(S=(65535&S)*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*v+(((S>>>16)*v&65535)<<16)&4294967295)<<13|f>>>19))+((5*(f>>>16)&65535)<<16)&4294967295))+((58964+(_>>>16)&65535)<<16);switch(S=0,s){case 3:S^=(255&r.charCodeAt(C+2))<<16;case 2:S^=(255&r.charCodeAt(C+1))<<8;case 1:f^=S=(65535&(S=(S=(65535&(S^=255&r.charCodeAt(C)))*x+(((S>>>16)*x&65535)<<16)&4294967295)<<15|S>>>17))*v+(((S>>>16)*v&65535)<<16)&4294967295}return f^=r.length,f=2246822507*(65535&(f^=f>>>16))+((2246822507*(f>>>16)&65535)<<16)&4294967295,f=3266489909*(65535&(f^=f>>>13))+((3266489909*(f>>>16)&65535)<<16)&4294967295,(f^=f>>>16)>>>0};var yf=Zu.exports,Wu={exports:{}};Wu.exports=function(r,t){for(var s,l=r.length,f=t^l,_=0;l>=4;)s=1540483477*(65535&(s=255&r.charCodeAt(_)|(255&r.charCodeAt(++_))<<8|(255&r.charCodeAt(++_))<<16|(255&r.charCodeAt(++_))<<24))+((1540483477*(s>>>16)&65535)<<16),f=1540483477*(65535&f)+((1540483477*(f>>>16)&65535)<<16)^(s=1540483477*(65535&(s^=s>>>24))+((1540483477*(s>>>16)&65535)<<16)),l-=4,++_;switch(l){case 3:f^=(255&r.charCodeAt(_+2))<<16;case 2:f^=(255&r.charCodeAt(_+1))<<8;case 1:f=1540483477*(65535&(f^=255&r.charCodeAt(_)))+((1540483477*(f>>>16)&65535)<<16)}return f=1540483477*(65535&(f^=f>>>13))+((1540483477*(f>>>16)&65535)<<16),(f^=f>>>15)>>>0};var ls=yf,Gu=Wu.exports;Eo.exports=ls,Eo.exports.murmur3=ls,Eo.exports.murmur2=Gu;var Sl=M(Eo.exports);class ga{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,s,l,f){this.ids.push(El(t)),this.positions.push(s,l,f)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const s=El(t);let l=0,f=this.ids.length-1;for(;l<f;){const x=l+f>>1;this.ids[x]>=s?f=x:l=x+1}const _=[];for(;this.ids[l]===s;)_.push({index:this.positions[3*l],start:this.positions[3*l+1],end:this.positions[3*l+2]}),l++;return _}static serialize(t,s){const l=new Float64Array(t.ids),f=new Uint32Array(t.positions);return Tl(l,f,0,l.length-1),s&&s.push(l.buffer,f.buffer),{ids:l,positions:f}}static deserialize(t){const s=new ga;return s.ids=t.ids,s.positions=t.positions,s.indexed=!0,s}}function El(r){const t=+r;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Sl(String(r))}function Tl(r,t,s,l){for(;s<l;){const f=r[s+l>>1];let _=s-1,x=l+1;for(;;){do _++;while(r[_]<f);do x--;while(r[x]>f);if(_>=x)break;To(r,_,x),To(t,3*_,3*x),To(t,3*_+1,3*x+1),To(t,3*_+2,3*x+2)}x-s<l-x?(Tl(r,t,s,x),s=x+1):(Tl(r,t,x+1,l),l=x)}}function To(r,t,s){const l=r[t];r[t]=r[s],r[s]=l}Xe("FeaturePositionMap",ga);class ya{constructor(t,s){this.gl=t.gl,this.location=s}}class Yu extends ya{constructor(t,s){super(t,s),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class E0 extends ya{constructor(t,s){super(t,s),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class T0 extends ya{constructor(t,s){super(t,s),this.current=ti.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const sI=new Float32Array(16);function _f(r){return[Ns(255*r.r,255*r.g),Ns(255*r.b,255*r.a)]}class Qc{constructor(t,s,l){this.value=t,this.uniformNames=s.map(f=>`u_${f}`),this.type=l}setUniform(t,s,l){t.set(l.constantOr(this.value))}getBinding(t,s,l){return this.type==="color"?new T0(t,s):new Yu(t,s)}}class Cl{constructor(t,s){this.uniformNames=s.map(l=>`u_${l}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,s){this.pixelRatioFrom=s.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=s.tlbr,this.patternTo=t.tlbr}setUniform(t,s,l,f){const _=f==="u_pattern_to"?this.patternTo:f==="u_pattern_from"?this.patternFrom:f==="u_pixel_ratio_to"?this.pixelRatioTo:f==="u_pixel_ratio_from"?this.pixelRatioFrom:null;_&&t.set(_)}getBinding(t,s,l){return l.substr(0,9)==="u_pattern"?new E0(t,s):new Yu(t,s)}}class Vs{constructor(t,s,l,f){this.expression=t,this.type=l,this.maxValue=0,this.paintVertexAttributes=s.map(_=>({name:`a_${_}`,type:"Float32",components:l==="color"?2:1,offset:0})),this.paintVertexArray=new f}populatePaintArray(t,s,l,f,_){const x=this.paintVertexArray.length,v=this.expression.evaluate(new fi(0),s,{},f,[],_);this.paintVertexArray.resize(t),this._setPaintValue(x,t,v)}updatePaintArray(t,s,l,f){const _=this.expression.evaluate({zoom:0},l,f);this._setPaintValue(t,s,_)}_setPaintValue(t,s,l){if(this.type==="color"){const f=_f(l);for(let _=t;_<s;_++)this.paintVertexArray.emplace(_,f[0],f[1])}else{for(let f=t;f<s;f++)this.paintVertexArray.emplace(f,l);this.maxValue=Math.max(this.maxValue,Math.abs(l))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class qr{constructor(t,s,l,f,_,x){this.expression=t,this.uniformNames=s.map(v=>`u_${v}_t`),this.type=l,this.useIntegerZoom=f,this.zoom=_,this.maxValue=0,this.paintVertexAttributes=s.map(v=>({name:`a_${v}`,type:"Float32",components:l==="color"?4:2,offset:0})),this.paintVertexArray=new x}populatePaintArray(t,s,l,f,_){const x=this.expression.evaluate(new fi(this.zoom),s,{},f,[],_),v=this.expression.evaluate(new fi(this.zoom+1),s,{},f,[],_),S=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(S,t,x,v)}updatePaintArray(t,s,l,f){const _=this.expression.evaluate({zoom:this.zoom},l,f),x=this.expression.evaluate({zoom:this.zoom+1},l,f);this._setPaintValue(t,s,_,x)}_setPaintValue(t,s,l,f){if(this.type==="color"){const _=_f(l),x=_f(f);for(let v=t;v<s;v++)this.paintVertexArray.emplace(v,_[0],_[1],x[0],x[1])}else{for(let _=t;_<s;_++)this.paintVertexArray.emplace(_,l,f);this.maxValue=Math.max(this.maxValue,Math.abs(l),Math.abs(f))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,s){const l=this.useIntegerZoom?Math.floor(s.zoom):s.zoom,f=ot(this.expression.interpolationFactor(l,this.zoom,this.zoom+1),0,1);t.set(f)}getBinding(t,s,l){return new Yu(t,s)}}class Co{constructor(t,s,l,f,_,x){this.expression=t,this.type=s,this.useIntegerZoom=l,this.zoom=f,this.layerId=x,this.zoomInPaintVertexArray=new _,this.zoomOutPaintVertexArray=new _}populatePaintArray(t,s,l){const f=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(f,t,s.patterns&&s.patterns[this.layerId],l)}updatePaintArray(t,s,l,f,_){this._setPaintValues(t,s,l.patterns&&l.patterns[this.layerId],_)}_setPaintValues(t,s,l,f){if(!f||!l)return;const{min:_,mid:x,max:v}=l,S=f[_],C=f[x],P=f[v];if(S&&C&&P)for(let L=t;L<s;L++)this.zoomInPaintVertexArray.emplace(L,C.tl[0],C.tl[1],C.br[0],C.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],C.pixelRatio,S.pixelRatio),this.zoomOutPaintVertexArray.emplace(L,C.tl[0],C.tl[1],C.br[0],C.br[1],P.tl[0],P.tl[1],P.br[0],P.br[1],C.pixelRatio,P.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,So.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,So.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class C0{constructor(t,s,l){this.binders={},this._buffers=[];const f=[];for(const _ in t.paint._values){if(!l(_))continue;const x=t.paint.get(_);if(!(x instanceof Ar&&lo(x.property.specification)))continue;const v=oI(_,t.type),S=x.value,C=x.property.specification.type,P=x.property.useIntegerZoom,L=x.property.specification["property-type"],F=L==="cross-faded"||L==="cross-faded-data-driven";if(S.kind==="constant")this.binders[_]=F?new Cl(S.value,v):new Qc(S.value,v,C),f.push(`/u_${_}`);else if(S.kind==="source"||F){const j=M0(_,C,"source");this.binders[_]=F?new Co(S,C,P,s,j,t.id):new Vs(S,v,C,j),f.push(`/a_${_}`)}else{const j=M0(_,C,"composite");this.binders[_]=new qr(S,v,C,P,s,j),f.push(`/z_${_}`)}}this.cacheKey=f.sort().join("")}getMaxValue(t){const s=this.binders[t];return s instanceof Vs||s instanceof qr?s.maxValue:0}populatePaintArrays(t,s,l,f,_){for(const x in this.binders){const v=this.binders[x];(v instanceof Vs||v instanceof qr||v instanceof Co)&&v.populatePaintArray(t,s,l,f,_)}}setConstantPatternPositions(t,s){for(const l in this.binders){const f=this.binders[l];f instanceof Cl&&f.setConstantPatternPositions(t,s)}}updatePaintArrays(t,s,l,f,_){let x=!1;for(const v in t){const S=s.getPositions(v);for(const C of S){const P=l.feature(C.index);for(const L in this.binders){const F=this.binders[L];if((F instanceof Vs||F instanceof qr||F instanceof Co)&&F.expression.isStateDependent===!0){const j=f.paint.get(L);F.expression=j.value,F.updatePaintArray(C.start,C.end,P,t[v],_),x=!0}}}}return x}defines(){const t=[];for(const s in this.binders){const l=this.binders[s];(l instanceof Qc||l instanceof Cl)&&t.push(...l.uniformNames.map(f=>`#define HAS_UNIFORM_${f}`))}return t}getBinderAttributes(){const t=[];for(const s in this.binders){const l=this.binders[s];if(l instanceof Vs||l instanceof qr)for(let f=0;f<l.paintVertexAttributes.length;f++)t.push(l.paintVertexAttributes[f].name);else if(l instanceof Co)for(let f=0;f<So.members.length;f++)t.push(So.members[f].name)}return t}getBinderUniforms(){const t=[];for(const s in this.binders){const l=this.binders[s];if(l instanceof Qc||l instanceof Cl||l instanceof qr)for(const f of l.uniformNames)t.push(f)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,s){const l=[];for(const f in this.binders){const _=this.binders[f];if(_ instanceof Qc||_ instanceof Cl||_ instanceof qr){for(const x of _.uniformNames)if(s[x]){const v=_.getBinding(t,s[x],x);l.push({name:x,property:f,binding:v})}}}return l}setUniforms(t,s,l,f){for(const{name:_,property:x,binding:v}of s)this.binders[x].setUniform(v,f,l.get(x),_)}updatePaintBuffers(t){this._buffers=[];for(const s in this.binders){const l=this.binders[s];if(t&&l instanceof Co){const f=t.fromScale===2?l.zoomInPaintVertexBuffer:l.zoomOutPaintVertexBuffer;f&&this._buffers.push(f)}else(l instanceof Vs||l instanceof qr)&&l.paintVertexBuffer&&this._buffers.push(l.paintVertexBuffer)}}upload(t){for(const s in this.binders){const l=this.binders[s];(l instanceof Vs||l instanceof qr||l instanceof Co)&&l.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const s=this.binders[t];(s instanceof Vs||s instanceof qr||s instanceof Co)&&s.destroy()}}}class _a{constructor(t,s,l=()=>!0){this.programConfigurations={};for(const f of t)this.programConfigurations[f.id]=new C0(f,s,l);this.needsUpload=!1,this._featureMap=new ga,this._bufferOffset=0}populatePaintArrays(t,s,l,f,_,x){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(t,s,f,_,x);s.id!==void 0&&this._featureMap.add(s.id,l,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,s,l,f){for(const _ of l)this.needsUpload=this.programConfigurations[_.id].updatePaintArrays(t,this._featureMap,s,_,f)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const s in this.programConfigurations)this.programConfigurations[s].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function oI(r,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace(`${t}-`,"").replace(/-/g,"_")]}function M0(r,t,s){const l={color:{source:Z,composite:xt},number:{source:$e,composite:Z}},f=function(_){return{"line-pattern":{source:Gn,composite:Gn},"fill-pattern":{source:Gn,composite:Gn},"fill-extrusion-pattern":{source:Gn,composite:Gn}}[_]}(r);return f&&f[s]||l[t][s]}Xe("ConstantBinder",Qc),Xe("CrossFadedConstantBinder",Cl),Xe("SourceExpressionBinder",Vs),Xe("CrossFadedCompositeBinder",Co),Xe("CompositeExpressionBinder",qr),Xe("ProgramConfiguration",C0,{omit:["_buffers"]}),Xe("ProgramConfigurationSet",_a);const Ri=8192,xf=Math.pow(2,14)-1,P0=-xf-1;function xa(r){const t=Ri/r.extent,s=r.loadGeometry();for(let l=0;l<s.length;l++){const f=s[l];for(let _=0;_<f.length;_++){const x=f[_],v=Math.round(x.x*t),S=Math.round(x.y*t);x.x=ot(v,P0,xf),x.y=ot(S,P0,xf),(v<x.x||v>x.x+1||S<x.y||S>x.y+1)&&Rt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return s}function ba(r,t){return{type:r.type,id:r.id,properties:r.properties,geometry:t?xa(r):[]}}function Xu(r,t,s,l,f){r.emplaceBack(2*t+(l+1)/2,2*s+(f+1)/2)}class bf{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new cn,this.indexArray=new cr,this.segments=new Ft,this.programConfigurations=new _a(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(t,s,l){const f=this.layers[0],_=[];let x=null,v=!1;f.type==="circle"&&(x=f.layout.get("circle-sort-key"),v=!x.isConstant());for(const{feature:S,id:C,index:P,sourceLayerIndex:L}of t){const F=this.layers[0]._featureFilter.needGeometry,j=ba(S,F);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),j,l))continue;const H=v?x.evaluate(j,{},l):void 0,q={id:C,properties:S.properties,type:S.type,sourceLayerIndex:L,index:P,geometry:F?j.geometry:xa(S),patterns:{},sortKey:H};_.push(q)}v&&_.sort((S,C)=>S.sortKey-C.sortKey);for(const S of _){const{geometry:C,index:P,sourceLayerIndex:L}=S,F=t[P].feature;this.addFeature(S,C,P,l),s.featureIndex.insert(F,C,P,L,this.index)}}update(t,s,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,s,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,zn),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,s,l,f){for(const _ of s)for(const x of _){const v=x.x,S=x.y;if(v<0||v>=Ri||S<0||S>=Ri)continue;const C=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),P=C.vertexLength;Xu(this.layoutVertexArray,v,S,-1,-1),Xu(this.layoutVertexArray,v,S,1,-1),Xu(this.layoutVertexArray,v,S,1,1),Xu(this.layoutVertexArray,v,S,-1,1),this.indexArray.emplaceBack(P,P+1,P+2),this.indexArray.emplaceBack(P,P+3,P+2),C.vertexLength+=4,C.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,{},f)}}function I0(r,t){for(let s=0;s<r.length;s++)if(Ml(t,r[s]))return!0;for(let s=0;s<t.length;s++)if(Ml(r,t[s]))return!0;return!!vf(r,t)}function aI(r,t,s){return!!Ml(r,t)||!!wf(t,r,s)}function A0(r,t){if(r.length===1)return z0(t,r[0]);for(let s=0;s<t.length;s++){const l=t[s];for(let f=0;f<l.length;f++)if(Ml(r,l[f]))return!0}for(let s=0;s<r.length;s++)if(z0(t,r[s]))return!0;for(let s=0;s<t.length;s++)if(vf(r,t[s]))return!0;return!1}function lI(r,t,s){if(r.length>1){if(vf(r,t))return!0;for(let l=0;l<t.length;l++)if(wf(t[l],r,s))return!0}for(let l=0;l<r.length;l++)if(wf(r[l],t,s))return!0;return!1}function vf(r,t){if(r.length===0||t.length===0)return!1;for(let s=0;s<r.length-1;s++){const l=r[s],f=r[s+1];for(let _=0;_<t.length-1;_++)if(cI(l,f,t[_],t[_+1]))return!0}return!1}function cI(r,t,s,l){return pi(r,s,l)!==pi(t,s,l)&&pi(r,t,s)!==pi(r,t,l)}function wf(r,t,s){const l=s*s;if(t.length===1)return r.distSqr(t[0])<l;for(let f=1;f<t.length;f++)if(D0(r,t[f-1],t[f])<l)return!0;return!1}function D0(r,t,s){const l=t.distSqr(s);if(l===0)return r.distSqr(t);const f=((r.x-t.x)*(s.x-t.x)+(r.y-t.y)*(s.y-t.y))/l;return r.distSqr(f<0?t:f>1?s:s.sub(t)._mult(f)._add(t))}function z0(r,t){let s,l,f,_=!1;for(let x=0;x<r.length;x++){s=r[x];for(let v=0,S=s.length-1;v<s.length;S=v++)l=s[v],f=s[S],l.y>t.y!=f.y>t.y&&t.x<(f.x-l.x)*(t.y-l.y)/(f.y-l.y)+l.x&&(_=!_)}return _}function Ml(r,t){let s=!1;for(let l=0,f=r.length-1;l<r.length;f=l++){const _=r[l],x=r[f];_.y>t.y!=x.y>t.y&&t.x<(x.x-_.x)*(t.y-_.y)/(x.y-_.y)+_.x&&(s=!s)}return s}function hI(r,t,s){const l=s[0],f=s[2];if(r.x<l.x&&t.x<l.x||r.x>f.x&&t.x>f.x||r.y<l.y&&t.y<l.y||r.y>f.y&&t.y>f.y)return!1;const _=pi(r,t,s[0]);return _!==pi(r,t,s[1])||_!==pi(r,t,s[2])||_!==pi(r,t,s[3])}function eh(r,t,s){const l=t.paint.get(r).value;return l.kind==="constant"?l.value:s.programConfigurations.get(t.id).getMaxValue(r)}function Ku(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Ju(r,t,s,l,f){if(!t[0]&&!t[1])return r;const _=R.convert(t)._mult(f);s==="viewport"&&_._rotate(-l);const x=[];for(let v=0;v<r.length;v++)x.push(r[v].sub(_));return x}let R0,L0;Xe("CircleBucket",bf,{omit:["layers"]});var uI={get paint(){return L0=L0||new g({"circle-radius":new dt(xe.paint_circle["circle-radius"]),"circle-color":new dt(xe.paint_circle["circle-color"]),"circle-blur":new dt(xe.paint_circle["circle-blur"]),"circle-opacity":new dt(xe.paint_circle["circle-opacity"]),"circle-translate":new et(xe.paint_circle["circle-translate"]),"circle-translate-anchor":new et(xe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new et(xe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new et(xe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new dt(xe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new dt(xe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new dt(xe.paint_circle["circle-stroke-opacity"])})},get layout(){return R0=R0||new g({"circle-sort-key":new dt(xe.layout_circle["circle-sort-key"])})}},_n=1e-6,Pl=typeof Float32Array<"u"?Float32Array:Array;function kf(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function O0(r,t,s){var l=t[0],f=t[1],_=t[2],x=t[3],v=t[4],S=t[5],C=t[6],P=t[7],L=t[8],F=t[9],j=t[10],H=t[11],q=t[12],K=t[13],ie=t[14],ge=t[15],le=s[0],fe=s[1],we=s[2],Pe=s[3];return r[0]=le*l+fe*v+we*L+Pe*q,r[1]=le*f+fe*S+we*F+Pe*K,r[2]=le*_+fe*C+we*j+Pe*ie,r[3]=le*x+fe*P+we*H+Pe*ge,r[4]=(le=s[4])*l+(fe=s[5])*v+(we=s[6])*L+(Pe=s[7])*q,r[5]=le*f+fe*S+we*F+Pe*K,r[6]=le*_+fe*C+we*j+Pe*ie,r[7]=le*x+fe*P+we*H+Pe*ge,r[8]=(le=s[8])*l+(fe=s[9])*v+(we=s[10])*L+(Pe=s[11])*q,r[9]=le*f+fe*S+we*F+Pe*K,r[10]=le*_+fe*C+we*j+Pe*ie,r[11]=le*x+fe*P+we*H+Pe*ge,r[12]=(le=s[12])*l+(fe=s[13])*v+(we=s[14])*L+(Pe=s[15])*q,r[13]=le*f+fe*S+we*F+Pe*K,r[14]=le*_+fe*C+we*j+Pe*ie,r[15]=le*x+fe*P+we*H+Pe*ge,r}Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)});var th,dI=O0;function Qu(r,t,s){var l=t[0],f=t[1],_=t[2],x=t[3];return r[0]=s[0]*l+s[4]*f+s[8]*_+s[12]*x,r[1]=s[1]*l+s[5]*f+s[9]*_+s[13]*x,r[2]=s[2]*l+s[6]*f+s[10]*_+s[14]*x,r[3]=s[3]*l+s[7]*f+s[11]*_+s[15]*x,r}th=new Pl(4),Pl!=Float32Array&&(th[0]=0,th[1]=0,th[2]=0,th[3]=0);class pI extends a{constructor(t){super(t,uI)}createBucket(t){return new bf(t)}queryRadius(t){const s=t;return eh("circle-radius",this,s)+eh("circle-stroke-width",this,s)+Ku(this.paint.get("circle-translate"))}queryIntersectsFeature(t,s,l,f,_,x,v,S){const C=Ju(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),x.angle,v),P=this.paint.get("circle-radius").evaluate(s,l)+this.paint.get("circle-stroke-width").evaluate(s,l),L=this.paint.get("circle-pitch-alignment")==="map",F=L?C:function(H,q){return H.map(K=>B0(K,q))}(C,S),j=L?P*v:P;for(const H of f)for(const q of H){const K=L?q:B0(q,S);let ie=j;const ge=Qu([],[q.x,q.y,0,1],S);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ie*=ge[3]/x.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ie*=x.cameraToCenterDistance/ge[3]),aI(F,K,ie))return!0}return!1}}function B0(r,t){const s=Qu([],[r.x,r.y,0,1],t);return new R(s[0]/s[3],s[1]/s[3])}class F0 extends bf{}let N0;Xe("HeatmapBucket",F0,{omit:["layers"]});var fI={get paint(){return N0=N0||new g({"heatmap-radius":new dt(xe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new dt(xe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new et(xe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Kc(xe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new et(xe.paint_heatmap["heatmap-opacity"])})}};function Sf(r,{width:t,height:s},l,f){if(f){if(f instanceof Uint8ClampedArray)f=new Uint8Array(f.buffer);else if(f.length!==t*s*l)throw new RangeError(`mismatched image size. expected: ${f.length} but got: ${t*s*l}`)}else f=new Uint8Array(t*s*l);return r.width=t,r.height=s,r.data=f,r}function V0(r,{width:t,height:s},l){if(t===r.width&&s===r.height)return;const f=Sf({},{width:t,height:s},l);Ef(r,f,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,t),height:Math.min(r.height,s)},l),r.width=t,r.height=s,r.data=f.data}function Ef(r,t,s,l,f,_){if(f.width===0||f.height===0)return t;if(f.width>r.width||f.height>r.height||s.x>r.width-f.width||s.y>r.height-f.height)throw new RangeError("out of range source coordinates for image copy");if(f.width>t.width||f.height>t.height||l.x>t.width-f.width||l.y>t.height-f.height)throw new RangeError("out of range destination coordinates for image copy");const x=r.data,v=t.data;if(x===v)throw new Error("srcData equals dstData, so image is already copied");for(let S=0;S<f.height;S++){const C=((s.y+S)*r.width+s.x)*_,P=((l.y+S)*t.width+l.x)*_;for(let L=0;L<f.width*_;L++)v[P+L]=x[C+L]}return t}class ih{constructor(t,s){Sf(this,t,1,s)}resize(t){V0(this,t,1)}clone(){return new ih({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,s,l,f,_){Ef(t,s,l,f,_,1)}}class hr{constructor(t,s){Sf(this,t,4,s)}resize(t){V0(this,t,4)}replace(t,s){s?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new hr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,s,l,f,_){Ef(t,s,l,f,_,4)}}function $0(r){const t={},s=r.resolution||256,l=r.clips?r.clips.length:1,f=r.image||new hr({width:s,height:l});if(Math.log(s)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${s}`);const _=(x,v,S)=>{t[r.evaluationKey]=S;const C=r.expression.evaluate(t);f.data[x+v+0]=Math.floor(255*C.r/C.a),f.data[x+v+1]=Math.floor(255*C.g/C.a),f.data[x+v+2]=Math.floor(255*C.b/C.a),f.data[x+v+3]=Math.floor(255*C.a)};if(r.clips)for(let x=0,v=0;x<l;++x,v+=4*s)for(let S=0,C=0;S<s;S++,C+=4){const P=S/(s-1),{start:L,end:F}=r.clips[x];_(v,C,L*(1-P)+F*P)}else for(let x=0,v=0;x<s;x++,v+=4)_(0,v,x/(s-1));return f}Xe("AlphaImage",ih),Xe("RGBAImage",hr);const Tf="big-fb";class mI extends a{createBucket(t){return new F0(t)}constructor(t){super(t,fI),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=$0({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Tf)&&this.heatmapFbos.delete(Tf)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let j0;var gI={get paint(){return j0=j0||new g({"hillshade-illumination-direction":new et(xe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new et(xe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new et(xe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new et(xe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new et(xe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new et(xe.paint_hillshade["hillshade-accent-color"])})}};class yI extends a{constructor(t){super(t,gI)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const _I=k([{name:"a_pos",components:2,type:"Int16"}],4),{members:xI}=_I;function U0(r,t,s=2){const l=t&&t.length,f=l?t[0]*s:r.length;let _=H0(r,0,f,s,!0);const x=[];if(!_||_.next===_.prev)return x;let v,S,C;if(l&&(_=function(P,L,F,j){const H=[];for(let q=0,K=L.length;q<K;q++){const ie=H0(P,L[q]*j,q<K-1?L[q+1]*j:P.length,j,!1);ie===ie.next&&(ie.steiner=!0),H.push(CI(ie))}H.sort(SI);for(let q=0;q<H.length;q++)F=EI(H[q],F);return F}(r,t,_,s)),r.length>80*s){v=1/0,S=1/0;let P=-1/0,L=-1/0;for(let F=s;F<f;F+=s){const j=r[F],H=r[F+1];j<v&&(v=j),H<S&&(S=H),j>P&&(P=j),H>L&&(L=H)}C=Math.max(P-v,L-S),C=C!==0?32767/C:0}return nh(_,x,s,v,S,C,0),x}function H0(r,t,s,l,f){let _;if(f===function(x,v,S,C){let P=0;for(let L=v,F=S-C;L<S;L+=C)P+=(x[F]-x[L])*(x[L+1]+x[F+1]),F=L;return P}(r,t,s,l)>0)for(let x=t;x<s;x+=l)_=W0(x/l|0,r[x],r[x+1],_);else for(let x=s-l;x>=t;x-=l)_=W0(x/l|0,r[x],r[x+1],_);return _&&ed(_,_.next)&&(sh(_),_=_.next),_}function va(r,t){if(!r)return r;t||(t=r);let s,l=r;do if(s=!1,l.steiner||!ed(l,l.next)&&Ai(l.prev,l,l.next)!==0)l=l.next;else{if(sh(l),l=t=l.prev,l===l.next)break;s=!0}while(s||l!==t);return t}function nh(r,t,s,l,f,_,x){if(!r)return;!x&&_&&function(S,C,P,L){let F=S;do F.z===0&&(F.z=Cf(F.x,F.y,C,P,L)),F.prevZ=F.prev,F.nextZ=F.next,F=F.next;while(F!==S);F.prevZ.nextZ=null,F.prevZ=null,function(j){let H,q=1;do{let K,ie=j;j=null;let ge=null;for(H=0;ie;){H++;let le=ie,fe=0;for(let Pe=0;Pe<q&&(fe++,le=le.nextZ,le);Pe++);let we=q;for(;fe>0||we>0&&le;)fe!==0&&(we===0||!le||ie.z<=le.z)?(K=ie,ie=ie.nextZ,fe--):(K=le,le=le.nextZ,we--),ge?ge.nextZ=K:j=K,K.prevZ=ge,ge=K;ie=le}ge.nextZ=null,q*=2}while(H>1)}(F)}(r,l,f,_);let v=r;for(;r.prev!==r.next;){const S=r.prev,C=r.next;if(_?vI(r,l,f,_):bI(r))t.push(S.i,r.i,C.i),sh(r),r=C.next,v=C.next;else if((r=C)===v){x?x===1?nh(r=wI(va(r),t),t,s,l,f,_,2):x===2&&kI(r,t,s,l,f,_):nh(va(r),t,s,l,f,_,1);break}}}function bI(r){const t=r.prev,s=r,l=r.next;if(Ai(t,s,l)>=0)return!1;const f=t.x,_=s.x,x=l.x,v=t.y,S=s.y,C=l.y,P=f<_?f<x?f:x:_<x?_:x,L=v<S?v<C?v:C:S<C?S:C,F=f>_?f>x?f:x:_>x?_:x,j=v>S?v>C?v:C:S>C?S:C;let H=l.next;for(;H!==t;){if(H.x>=P&&H.x<=F&&H.y>=L&&H.y<=j&&Il(f,v,_,S,x,C,H.x,H.y)&&Ai(H.prev,H,H.next)>=0)return!1;H=H.next}return!0}function vI(r,t,s,l){const f=r.prev,_=r,x=r.next;if(Ai(f,_,x)>=0)return!1;const v=f.x,S=_.x,C=x.x,P=f.y,L=_.y,F=x.y,j=v<S?v<C?v:C:S<C?S:C,H=P<L?P<F?P:F:L<F?L:F,q=v>S?v>C?v:C:S>C?S:C,K=P>L?P>F?P:F:L>F?L:F,ie=Cf(j,H,t,s,l),ge=Cf(q,K,t,s,l);let le=r.prevZ,fe=r.nextZ;for(;le&&le.z>=ie&&fe&&fe.z<=ge;){if(le.x>=j&&le.x<=q&&le.y>=H&&le.y<=K&&le!==f&&le!==x&&Il(v,P,S,L,C,F,le.x,le.y)&&Ai(le.prev,le,le.next)>=0||(le=le.prevZ,fe.x>=j&&fe.x<=q&&fe.y>=H&&fe.y<=K&&fe!==f&&fe!==x&&Il(v,P,S,L,C,F,fe.x,fe.y)&&Ai(fe.prev,fe,fe.next)>=0))return!1;fe=fe.nextZ}for(;le&&le.z>=ie;){if(le.x>=j&&le.x<=q&&le.y>=H&&le.y<=K&&le!==f&&le!==x&&Il(v,P,S,L,C,F,le.x,le.y)&&Ai(le.prev,le,le.next)>=0)return!1;le=le.prevZ}for(;fe&&fe.z<=ge;){if(fe.x>=j&&fe.x<=q&&fe.y>=H&&fe.y<=K&&fe!==f&&fe!==x&&Il(v,P,S,L,C,F,fe.x,fe.y)&&Ai(fe.prev,fe,fe.next)>=0)return!1;fe=fe.nextZ}return!0}function wI(r,t){let s=r;do{const l=s.prev,f=s.next.next;!ed(l,f)&&q0(l,s,s.next,f)&&rh(l,f)&&rh(f,l)&&(t.push(l.i,s.i,f.i),sh(s),sh(s.next),s=r=f),s=s.next}while(s!==r);return va(s)}function kI(r,t,s,l,f,_){let x=r;do{let v=x.next.next;for(;v!==x.prev;){if(x.i!==v.i&&MI(x,v)){let S=Z0(x,v);return x=va(x,x.next),S=va(S,S.next),nh(x,t,s,l,f,_,0),void nh(S,t,s,l,f,_,0)}v=v.next}x=x.next}while(x!==r)}function SI(r,t){return r.x-t.x}function EI(r,t){const s=function(f,_){let x=_;const v=f.x,S=f.y;let C,P=-1/0;do{if(S<=x.y&&S>=x.next.y&&x.next.y!==x.y){const q=x.x+(S-x.y)*(x.next.x-x.x)/(x.next.y-x.y);if(q<=v&&q>P&&(P=q,C=x.x<x.next.x?x:x.next,q===v))return C}x=x.next}while(x!==_);if(!C)return null;const L=C,F=C.x,j=C.y;let H=1/0;x=C;do{if(v>=x.x&&x.x>=F&&v!==x.x&&Il(S<j?v:P,S,F,j,S<j?P:v,S,x.x,x.y)){const q=Math.abs(S-x.y)/(v-x.x);rh(x,f)&&(q<H||q===H&&(x.x>C.x||x.x===C.x&&TI(C,x)))&&(C=x,H=q)}x=x.next}while(x!==L);return C}(r,t);if(!s)return t;const l=Z0(s,r);return va(l,l.next),va(s,s.next)}function TI(r,t){return Ai(r.prev,r,t.prev)<0&&Ai(t.next,r,r.next)<0}function Cf(r,t,s,l,f){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-s)*f|0)|r<<8))|r<<4))|r<<2))|r<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-l)*f|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function CI(r){let t=r,s=r;do(t.x<s.x||t.x===s.x&&t.y<s.y)&&(s=t),t=t.next;while(t!==r);return s}function Il(r,t,s,l,f,_,x,v){return(f-x)*(t-v)>=(r-x)*(_-v)&&(r-x)*(l-v)>=(s-x)*(t-v)&&(s-x)*(_-v)>=(f-x)*(l-v)}function MI(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!function(s,l){let f=s;do{if(f.i!==s.i&&f.next.i!==s.i&&f.i!==l.i&&f.next.i!==l.i&&q0(f,f.next,s,l))return!0;f=f.next}while(f!==s);return!1}(r,t)&&(rh(r,t)&&rh(t,r)&&function(s,l){let f=s,_=!1;const x=(s.x+l.x)/2,v=(s.y+l.y)/2;do f.y>v!=f.next.y>v&&f.next.y!==f.y&&x<(f.next.x-f.x)*(v-f.y)/(f.next.y-f.y)+f.x&&(_=!_),f=f.next;while(f!==s);return _}(r,t)&&(Ai(r.prev,r,t.prev)||Ai(r,t.prev,t))||ed(r,t)&&Ai(r.prev,r,r.next)>0&&Ai(t.prev,t,t.next)>0)}function Ai(r,t,s){return(t.y-r.y)*(s.x-t.x)-(t.x-r.x)*(s.y-t.y)}function ed(r,t){return r.x===t.x&&r.y===t.y}function q0(r,t,s,l){const f=id(Ai(r,t,s)),_=id(Ai(r,t,l)),x=id(Ai(s,l,r)),v=id(Ai(s,l,t));return f!==_&&x!==v||!(f!==0||!td(r,s,t))||!(_!==0||!td(r,l,t))||!(x!==0||!td(s,r,l))||!(v!==0||!td(s,t,l))}function td(r,t,s){return t.x<=Math.max(r.x,s.x)&&t.x>=Math.min(r.x,s.x)&&t.y<=Math.max(r.y,s.y)&&t.y>=Math.min(r.y,s.y)}function id(r){return r>0?1:r<0?-1:0}function rh(r,t){return Ai(r.prev,r,r.next)<0?Ai(r,t,r.next)>=0&&Ai(r,r.prev,t)>=0:Ai(r,t,r.prev)<0||Ai(r,r.next,t)<0}function Z0(r,t){const s=Mf(r.i,r.x,r.y),l=Mf(t.i,t.x,t.y),f=r.next,_=t.prev;return r.next=t,t.prev=r,s.next=f,f.prev=s,l.next=s,s.prev=l,_.next=l,l.prev=_,l}function W0(r,t,s,l){const f=Mf(r,t,s);return l?(f.next=l.next,f.prev=l,l.next.prev=f,l.next=f):(f.prev=f,f.next=f),f}function sh(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 Mf(r,t,s){return{i:r,x:t,y:s,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Pf(r,t,s){const l=s.patternDependencies;let f=!1;for(const _ of t){const x=_.paint.get(`${r}-pattern`);x.isConstant()||(f=!0);const v=x.constantOr(null);v&&(f=!0,l[v.to]=!0,l[v.from]=!0)}return f}function If(r,t,s,l,f){const _=f.patternDependencies;for(const x of t){const v=x.paint.get(`${r}-pattern`).value;if(v.kind!=="constant"){let S=v.evaluate({zoom:l-1},s,{},f.availableImages),C=v.evaluate({zoom:l},s,{},f.availableImages),P=v.evaluate({zoom:l+1},s,{},f.availableImages);S=S&&S.name?S.name:S,C=C&&C.name?C.name:C,P=P&&P.name?P.name:P,_[S]=!0,_[C]=!0,_[P]=!0,s.patterns[x.id]={min:S,mid:C,max:P}}}return s}class Af{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Dr,this.indexArray=new cr,this.indexArray2=new Zi,this.programConfigurations=new _a(t.layers,t.zoom),this.segments=new Ft,this.segments2=new Ft,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(t,s,l){this.hasPattern=Pf("fill",this.layers,s);const f=this.layers[0].layout.get("fill-sort-key"),_=!f.isConstant(),x=[];for(const{feature:v,id:S,index:C,sourceLayerIndex:P}of t){const L=this.layers[0]._featureFilter.needGeometry,F=ba(v,L);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),F,l))continue;const j=_?f.evaluate(F,{},l,s.availableImages):void 0,H={id:S,properties:v.properties,type:v.type,sourceLayerIndex:P,index:C,geometry:L?F.geometry:xa(v),patterns:{},sortKey:j};x.push(H)}_&&x.sort((v,S)=>v.sortKey-S.sortKey);for(const v of x){const{geometry:S,index:C,sourceLayerIndex:P}=v;if(this.hasPattern){const L=If("fill",this.layers,v,this.zoom,s);this.patternFeatures.push(L)}else this.addFeature(v,S,C,l,{});s.featureIndex.insert(t[C].feature,S,C,P,this.index)}}update(t,s,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,s,this.stateDependentLayers,l)}addFeatures(t,s,l){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,s,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,xI),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,s,l,f,_){for(const x of el(s,500)){let v=0;for(const j of x)v+=j.length;const S=this.segments.prepareSegment(v,this.layoutVertexArray,this.indexArray),C=S.vertexLength,P=[],L=[];for(const j of x){if(j.length===0)continue;j!==x[0]&&L.push(P.length/2);const H=this.segments2.prepareSegment(j.length,this.layoutVertexArray,this.indexArray2),q=H.vertexLength;this.layoutVertexArray.emplaceBack(j[0].x,j[0].y),this.indexArray2.emplaceBack(q+j.length-1,q),P.push(j[0].x),P.push(j[0].y);for(let K=1;K<j.length;K++)this.layoutVertexArray.emplaceBack(j[K].x,j[K].y),this.indexArray2.emplaceBack(q+K-1,q+K),P.push(j[K].x),P.push(j[K].y);H.vertexLength+=j.length,H.primitiveLength+=j.length}const F=U0(P,L);for(let j=0;j<F.length;j+=3)this.indexArray.emplaceBack(C+F[j],C+F[j+1],C+F[j+2]);S.vertexLength+=v,S.primitiveLength+=F.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,_,f)}}let G0,Y0;Xe("FillBucket",Af,{omit:["layers","patternFeatures"]});var PI={get paint(){return Y0=Y0||new g({"fill-antialias":new et(xe.paint_fill["fill-antialias"]),"fill-opacity":new dt(xe.paint_fill["fill-opacity"]),"fill-color":new dt(xe.paint_fill["fill-color"]),"fill-outline-color":new dt(xe.paint_fill["fill-outline-color"]),"fill-translate":new et(xe.paint_fill["fill-translate"]),"fill-translate-anchor":new et(xe.paint_fill["fill-translate-anchor"]),"fill-pattern":new bl(xe.paint_fill["fill-pattern"])})},get layout(){return G0=G0||new g({"fill-sort-key":new dt(xe.layout_fill["fill-sort-key"])})}};class II extends a{constructor(t){super(t,PI)}recalculate(t,s){super.recalculate(t,s);const l=this.paint._values["fill-outline-color"];l.value.kind==="constant"&&l.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new Af(t)}queryRadius(){return Ku(this.paint.get("fill-translate"))}queryIntersectsFeature(t,s,l,f,_,x,v){return A0(Ju(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),x.angle,v),f)}isTileClipped(){return!0}}const AI=k([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),DI=k([{name:"a_centroid",components:2,type:"Int16"}],4),{members:zI}=AI;var Mo={},RI=D,X0=Al;function Al(r,t,s,l,f){this.properties={},this.extent=s,this.type=0,this._pbf=r,this._geometry=-1,this._keys=l,this._values=f,r.readFields(LI,this,t)}function LI(r,t,s){r==1?t.id=s.readVarint():r==2?function(l,f){for(var _=l.readVarint()+l.pos;l.pos<_;){var x=f._keys[l.readVarint()],v=f._values[l.readVarint()];f.properties[x]=v}}(s,t):r==3?t.type=s.readVarint():r==4&&(t._geometry=s.pos)}function OI(r){for(var t,s,l=0,f=0,_=r.length,x=_-1;f<_;x=f++)l+=((s=r[x]).x-(t=r[f]).x)*(t.y+s.y);return l}Al.types=["Unknown","Point","LineString","Polygon"],Al.prototype.loadGeometry=function(){var r=this._pbf;r.pos=this._geometry;for(var t,s=r.readVarint()+r.pos,l=1,f=0,_=0,x=0,v=[];r.pos<s;){if(f<=0){var S=r.readVarint();l=7&S,f=S>>3}if(f--,l===1||l===2)_+=r.readSVarint(),x+=r.readSVarint(),l===1&&(t&&v.push(t),t=[]),t.push(new RI(_,x));else{if(l!==7)throw new Error("unknown command "+l);t&&t.push(t[0].clone())}}return t&&v.push(t),v},Al.prototype.bbox=function(){var r=this._pbf;r.pos=this._geometry;for(var t=r.readVarint()+r.pos,s=1,l=0,f=0,_=0,x=1/0,v=-1/0,S=1/0,C=-1/0;r.pos<t;){if(l<=0){var P=r.readVarint();s=7&P,l=P>>3}if(l--,s===1||s===2)(f+=r.readSVarint())<x&&(x=f),f>v&&(v=f),(_+=r.readSVarint())<S&&(S=_),_>C&&(C=_);else if(s!==7)throw new Error("unknown command "+s)}return[x,S,v,C]},Al.prototype.toGeoJSON=function(r,t,s){var l,f,_=this.extent*Math.pow(2,s),x=this.extent*r,v=this.extent*t,S=this.loadGeometry(),C=Al.types[this.type];function P(j){for(var H=0;H<j.length;H++){var q=j[H];j[H]=[360*(q.x+x)/_-180,360/Math.PI*Math.atan(Math.exp((180-360*(q.y+v)/_)*Math.PI/180))-90]}}switch(this.type){case 1:var L=[];for(l=0;l<S.length;l++)L[l]=S[l][0];P(S=L);break;case 2:for(l=0;l<S.length;l++)P(S[l]);break;case 3:for(S=function(j){var H=j.length;if(H<=1)return[j];for(var q,K,ie=[],ge=0;ge<H;ge++){var le=OI(j[ge]);le!==0&&(K===void 0&&(K=le<0),K===le<0?(q&&ie.push(q),q=[j[ge]]):q.push(j[ge]))}return q&&ie.push(q),ie}(S),l=0;l<S.length;l++)for(f=0;f<S[l].length;f++)P(S[l][f])}S.length===1?S=S[0]:C="Multi"+C;var F={type:"Feature",geometry:{type:C,coordinates:S},properties:this.properties};return"id"in this&&(F.id=this.id),F};var BI=X0,K0=J0;function J0(r,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=r,this._keys=[],this._values=[],this._features=[],r.readFields(FI,this,t),this.length=this._features.length}function FI(r,t,s){r===15?t.version=s.readVarint():r===1?t.name=s.readString():r===5?t.extent=s.readVarint():r===2?t._features.push(s.pos):r===3?t._keys.push(s.readString()):r===4&&t._values.push(function(l){for(var f=null,_=l.readVarint()+l.pos;l.pos<_;){var x=l.readVarint()>>3;f=x===1?l.readString():x===2?l.readFloat():x===3?l.readDouble():x===4?l.readVarint64():x===5?l.readVarint():x===6?l.readSVarint():x===7?l.readBoolean():null}return f}(s))}J0.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 t=this._pbf.readVarint()+this._pbf.pos;return new BI(this._pbf,t,this.extent,this._keys,this._values)};var NI=K0;function VI(r,t,s){if(r===3){var l=new NI(s,s.readVarint()+s.pos);l.length&&(t[l.name]=l)}}Mo.VectorTile=function(r,t){this.layers=r.readFields(VI,{},t)},Mo.VectorTileFeature=X0,Mo.VectorTileLayer=K0;const $I=Mo.VectorTileFeature.types,Df=Math.pow(2,13);function oh(r,t,s,l,f,_,x,v){r.emplaceBack(t,s,2*Math.floor(l*Df)+x,f*Df*2,_*Df*2,Math.round(v))}class zf{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new wo,this.centroidVertexArray=new Ki,this.indexArray=new cr,this.programConfigurations=new _a(t.layers,t.zoom),this.segments=new Ft,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(t,s,l){this.features=[],this.hasPattern=Pf("fill-extrusion",this.layers,s);for(const{feature:f,id:_,index:x,sourceLayerIndex:v}of t){const S=this.layers[0]._featureFilter.needGeometry,C=ba(f,S);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),C,l))continue;const P={id:_,sourceLayerIndex:v,index:x,geometry:S?C.geometry:xa(f),properties:f.properties,type:f.type,patterns:{}};this.hasPattern?this.features.push(If("fill-extrusion",this.layers,P,this.zoom,s)):this.addFeature(P,P.geometry,x,l,{}),s.featureIndex.insert(f,P.geometry,x,v,this.index,!0)}}addFeatures(t,s,l){for(const f of this.features){const{geometry:_}=f;this.addFeature(f,_,f.index,s,l)}}update(t,s,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,s,this.stateDependentLayers,l)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,zI),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,DI.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,s,l,f,_){for(const x of el(s,500)){const v={x:0,y:0,vertexCount:0};let S=0;for(const H of x)S+=H.length;let C=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const H of x){if(H.length===0||UI(H))continue;let q=0;for(let K=0;K<H.length;K++){const ie=H[K];if(K>=1){const ge=H[K-1];if(!jI(ie,ge)){C.vertexLength+4>Ft.MAX_VERTEX_ARRAY_LENGTH&&(C=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const le=ie.sub(ge)._perp()._unit(),fe=ge.dist(ie);q+fe>32768&&(q=0),oh(this.layoutVertexArray,ie.x,ie.y,le.x,le.y,0,0,q),oh(this.layoutVertexArray,ie.x,ie.y,le.x,le.y,0,1,q),v.x+=2*ie.x,v.y+=2*ie.y,v.vertexCount+=2,q+=fe,oh(this.layoutVertexArray,ge.x,ge.y,le.x,le.y,0,0,q),oh(this.layoutVertexArray,ge.x,ge.y,le.x,le.y,0,1,q),v.x+=2*ge.x,v.y+=2*ge.y,v.vertexCount+=2;const we=C.vertexLength;this.indexArray.emplaceBack(we,we+2,we+1),this.indexArray.emplaceBack(we+1,we+2,we+3),C.vertexLength+=4,C.primitiveLength+=2}}}}if(C.vertexLength+S>Ft.MAX_VERTEX_ARRAY_LENGTH&&(C=this.segments.prepareSegment(S,this.layoutVertexArray,this.indexArray)),$I[t.type]!=="Polygon")continue;const P=[],L=[],F=C.vertexLength;for(const H of x)if(H.length!==0){H!==x[0]&&L.push(P.length/2);for(let q=0;q<H.length;q++){const K=H[q];oh(this.layoutVertexArray,K.x,K.y,0,0,1,1,0),v.x+=K.x,v.y+=K.y,v.vertexCount+=1,P.push(K.x),P.push(K.y)}}const j=U0(P,L);for(let H=0;H<j.length;H+=3)this.indexArray.emplaceBack(F+j[H],F+j[H+2],F+j[H+1]);C.primitiveLength+=j.length/3,C.vertexLength+=S;for(let H=0;H<v.vertexCount;H++){const q=Math.floor(v.x/v.vertexCount),K=Math.floor(v.y/v.vertexCount);this.centroidVertexArray.emplaceBack(q,K)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,_,f)}}function jI(r,t){return r.x===t.x&&(r.x<0||r.x>Ri)||r.y===t.y&&(r.y<0||r.y>Ri)}function UI(r){return r.every(t=>t.x<0)||r.every(t=>t.x>Ri)||r.every(t=>t.y<0)||r.every(t=>t.y>Ri)}let Q0;Xe("FillExtrusionBucket",zf,{omit:["layers","features"]});var HI={get paint(){return Q0=Q0||new g({"fill-extrusion-opacity":new et(xe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new dt(xe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new et(xe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new et(xe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new bl(xe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new dt(xe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new dt(xe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new et(xe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class qI extends a{constructor(t){super(t,HI)}createBucket(t){return new zf(t)}queryRadius(){return Ku(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,s,l,f,_,x,v,S){const C=Ju(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),x.angle,v),P=this.paint.get("fill-extrusion-height").evaluate(s,l),L=this.paint.get("fill-extrusion-base").evaluate(s,l),F=function(H,q,K,ie){const ge=[];for(const le of H){const fe=[le.x,le.y,0,1];Qu(fe,fe,q),ge.push(new R(fe[0]/fe[3],fe[1]/fe[3]))}return ge}(C,S),j=function(H,q,K,ie){const ge=[],le=[],fe=ie[8]*q,we=ie[9]*q,Pe=ie[10]*q,qe=ie[11]*q,ut=ie[8]*K,je=ie[9]*K,Ve=ie[10]*K,nt=ie[11]*K;for(const Ke of H){const Ge=[],Te=[];for(const at of Ke){const it=at.x,_t=at.y,ci=ie[0]*it+ie[4]*_t+ie[12],ai=ie[1]*it+ie[5]*_t+ie[13],Ni=ie[2]*it+ie[6]*_t+ie[14],zr=ie[3]*it+ie[7]*_t+ie[15],en=Ni+Pe,Vi=zr+qe,xn=ci+ut,bn=ai+je,vn=Ni+Ve,Pi=zr+nt,$i=new R((ci+fe)/Vi,(ai+we)/Vi);$i.z=en/Vi,Ge.push($i);const hn=new R(xn/Pi,bn/Pi);hn.z=vn/Pi,Te.push(hn)}ge.push(Ge),le.push(Te)}return[ge,le]}(f,L,P,S);return function(H,q,K){let ie=1/0;A0(K,q)&&(ie=e_(K,q[0]));for(let ge=0;ge<q.length;ge++){const le=q[ge],fe=H[ge];for(let we=0;we<le.length-1;we++){const Pe=le[we],qe=[Pe,le[we+1],fe[we+1],fe[we],Pe];I0(K,qe)&&(ie=Math.min(ie,e_(K,qe)))}}return ie!==1/0&&ie}(j[0],j[1],F)}}function ah(r,t){return r.x*t.x+r.y*t.y}function e_(r,t){if(r.length===1){let s=0;const l=t[s++];let f;for(;!f||l.equals(f);)if(f=t[s++],!f)return 1/0;for(;s<t.length;s++){const _=t[s],x=r[0],v=f.sub(l),S=_.sub(l),C=x.sub(l),P=ah(v,v),L=ah(v,S),F=ah(S,S),j=ah(C,v),H=ah(C,S),q=P*F-L*L,K=(F*j-L*H)/q,ie=(P*H-L*j)/q,ge=l.z*(1-K-ie)+f.z*K+_.z*ie;if(isFinite(ge))return ge}return 1/0}{let s=1/0;for(const l of t)s=Math.min(s,l.z);return s}}const ZI=k([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:WI}=ZI,GI=k([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:YI}=GI,XI=Mo.VectorTileFeature.types,KI=Math.cos(Math.PI/180*37.5),t_=Math.pow(2,14)/.5;class Rf{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(s=>{this.gradients[s.id]={}}),this.layoutVertexArray=new wl,this.layoutVertexArray2=new ko,this.indexArray=new cr,this.programConfigurations=new _a(t.layers,t.zoom),this.segments=new Ft,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(t,s,l){this.hasPattern=Pf("line",this.layers,s);const f=this.layers[0].layout.get("line-sort-key"),_=!f.isConstant(),x=[];for(const{feature:v,id:S,index:C,sourceLayerIndex:P}of t){const L=this.layers[0]._featureFilter.needGeometry,F=ba(v,L);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),F,l))continue;const j=_?f.evaluate(F,{},l):void 0,H={id:S,properties:v.properties,type:v.type,sourceLayerIndex:P,index:C,geometry:L?F.geometry:xa(v),patterns:{},sortKey:j};x.push(H)}_&&x.sort((v,S)=>v.sortKey-S.sortKey);for(const v of x){const{geometry:S,index:C,sourceLayerIndex:P}=v;if(this.hasPattern){const L=If("line",this.layers,v,this.zoom,s);this.patternFeatures.push(L)}else this.addFeature(v,S,C,l,{});s.featureIndex.insert(t[C].feature,S,C,P,this.index)}}update(t,s,l){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,s,this.stateDependentLayers,l)}addFeatures(t,s,l){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,s,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,YI)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,WI),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,s,l,f,_){const x=this.layers[0].layout,v=x.get("line-join").evaluate(t,{}),S=x.get("line-cap"),C=x.get("line-miter-limit"),P=x.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const L of s)this.addLine(L,t,v,S,C,P);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,l,_,f)}addLine(t,s,l,f,_,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ie=0;ie<t.length-1;ie++)this.totalDistance+=t[ie].dist(t[ie+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const v=XI[s.type]==="Polygon";let S=t.length;for(;S>=2&&t[S-1].equals(t[S-2]);)S--;let C=0;for(;C<S-1&&t[C].equals(t[C+1]);)C++;if(S<(v?3:2))return;l==="bevel"&&(_=1.05);const P=this.overscaling<=16?15*Ri/(512*this.overscaling):0,L=this.segments.prepareSegment(10*S,this.layoutVertexArray,this.indexArray);let F,j,H,q,K;this.e1=this.e2=-1,v&&(F=t[S-2],K=t[C].sub(F)._unit()._perp());for(let ie=C;ie<S;ie++){if(H=ie===S-1?v?t[C+1]:void 0:t[ie+1],H&&t[ie].equals(H))continue;K&&(q=K),F&&(j=F),F=t[ie],K=H?H.sub(F)._unit()._perp():q,q=q||K;let ge=q.add(K);ge.x===0&&ge.y===0||ge._unit();const le=q.x*K.x+q.y*K.y,fe=ge.x*K.x+ge.y*K.y,we=fe!==0?1/fe:1/0,Pe=2*Math.sqrt(2-2*fe),qe=fe<KI&&j&&H,ut=q.x*K.y-q.y*K.x>0;if(qe&&ie>C){const nt=F.dist(j);if(nt>2*P){const Ke=F.sub(F.sub(j)._mult(P/nt)._round());this.updateDistance(j,Ke),this.addCurrentVertex(Ke,q,0,0,L),j=Ke}}const je=j&&H;let Ve=je?l:v?"butt":f;if(je&&Ve==="round"&&(we<x?Ve="miter":we<=2&&(Ve="fakeround")),Ve==="miter"&&we>_&&(Ve="bevel"),Ve==="bevel"&&(we>2&&(Ve="flipbevel"),we<_&&(Ve="miter")),j&&this.updateDistance(j,F),Ve==="miter")ge._mult(we),this.addCurrentVertex(F,ge,0,0,L);else if(Ve==="flipbevel"){if(we>100)ge=K.mult(-1);else{const nt=we*q.add(K).mag()/q.sub(K).mag();ge._perp()._mult(nt*(ut?-1:1))}this.addCurrentVertex(F,ge,0,0,L),this.addCurrentVertex(F,ge.mult(-1),0,0,L)}else if(Ve==="bevel"||Ve==="fakeround"){const nt=-Math.sqrt(we*we-1),Ke=ut?nt:0,Ge=ut?0:nt;if(j&&this.addCurrentVertex(F,q,Ke,Ge,L),Ve==="fakeround"){const Te=Math.round(180*Pe/Math.PI/20);for(let at=1;at<Te;at++){let it=at/Te;if(it!==.5){const ci=it-.5;it+=it*ci*(it-1)*((1.0904+le*(le*(3.55645-1.43519*le)-3.2452))*ci*ci+(.848013+le*(.215638*le-1.06021)))}const _t=K.sub(q)._mult(it)._add(q)._unit()._mult(ut?-1:1);this.addHalfVertex(F,_t.x,_t.y,!1,ut,0,L)}}H&&this.addCurrentVertex(F,K,-Ke,-Ge,L)}else if(Ve==="butt")this.addCurrentVertex(F,ge,0,0,L);else if(Ve==="square"){const nt=j?1:-1;this.addCurrentVertex(F,ge,nt,nt,L)}else Ve==="round"&&(j&&(this.addCurrentVertex(F,q,0,0,L),this.addCurrentVertex(F,q,1,1,L,!0)),H&&(this.addCurrentVertex(F,K,-1,-1,L,!0),this.addCurrentVertex(F,K,0,0,L)));if(qe&&ie<S-1){const nt=F.dist(H);if(nt>2*P){const Ke=F.add(H.sub(F)._mult(P/nt)._round());this.updateDistance(F,Ke),this.addCurrentVertex(Ke,K,0,0,L),F=Ke}}}}addCurrentVertex(t,s,l,f,_,x=!1){const v=s.y*f-s.x,S=-s.y-s.x*f;this.addHalfVertex(t,s.x+s.y*l,s.y-s.x*l,x,!1,l,_),this.addHalfVertex(t,v,S,x,!0,-f,_),this.distance>t_/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,s,l,f,_,x))}addHalfVertex({x:t,y:s},l,f,_,x,v,S){const C=.5*(this.lineClips?this.scaledDistance*(t_-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(_?1:0),(s<<1)+(x?1:0),Math.round(63*l)+128,Math.round(63*f)+128,1+(v===0?0:v<0?-1:1)|(63&C)<<2,C>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const P=S.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,P),S.primitiveLength++),x?this.e2=P:this.e1=P}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,s){this.distance+=t.dist(s),this.updateScaledDistance()}}let i_,n_;Xe("LineBucket",Rf,{omit:["layers","patternFeatures"]});var r_={get paint(){return n_=n_||new g({"line-opacity":new dt(xe.paint_line["line-opacity"]),"line-color":new dt(xe.paint_line["line-color"]),"line-translate":new et(xe.paint_line["line-translate"]),"line-translate-anchor":new et(xe.paint_line["line-translate-anchor"]),"line-width":new dt(xe.paint_line["line-width"]),"line-gap-width":new dt(xe.paint_line["line-gap-width"]),"line-offset":new dt(xe.paint_line["line-offset"]),"line-blur":new dt(xe.paint_line["line-blur"]),"line-dasharray":new vl(xe.paint_line["line-dasharray"]),"line-pattern":new bl(xe.paint_line["line-pattern"]),"line-gradient":new Kc(xe.paint_line["line-gradient"])})},get layout(){return i_=i_||new g({"line-cap":new et(xe.layout_line["line-cap"]),"line-join":new dt(xe.layout_line["line-join"]),"line-miter-limit":new et(xe.layout_line["line-miter-limit"]),"line-round-limit":new et(xe.layout_line["line-round-limit"]),"line-sort-key":new dt(xe.layout_line["line-sort-key"])})}};class JI extends dt{possiblyEvaluate(t,s){return s=new fi(Math.floor(s.zoom),{now:s.now,fadeDuration:s.fadeDuration,zoomHistory:s.zoomHistory,transition:s.transition}),super.possiblyEvaluate(t,s)}evaluate(t,s,l,f){return s=Be({},s,{zoom:Math.floor(s.zoom)}),super.evaluate(t,s,l,f)}}let nd;class QI extends a{constructor(t){super(t,r_),this.gradientVersion=0,nd||(nd=new JI(r_.paint.properties["line-width"].specification),nd.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const s=this.gradientExpression();this.stepInterpolant=!!function(l){return l._styleExpression!==void 0}(s)&&s._styleExpression.expression instanceof io,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,s){super.recalculate(t,s),this.paint._values["line-floorwidth"]=nd.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Rf(t)}queryRadius(t){const s=t,l=s_(eh("line-width",this,s),eh("line-gap-width",this,s)),f=eh("line-offset",this,s);return l/2+Math.abs(f)+Ku(this.paint.get("line-translate"))}queryIntersectsFeature(t,s,l,f,_,x,v){const S=Ju(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),x.angle,v),C=v/2*s_(this.paint.get("line-width").evaluate(s,l),this.paint.get("line-gap-width").evaluate(s,l)),P=this.paint.get("line-offset").evaluate(s,l);return P&&(f=function(L,F){const j=[];for(let H=0;H<L.length;H++){const q=L[H],K=[];for(let ie=0;ie<q.length;ie++){const ge=q[ie-1],le=q[ie],fe=q[ie+1],we=ie===0?new R(0,0):le.sub(ge)._unit()._perp(),Pe=ie===q.length-1?new R(0,0):fe.sub(le)._unit()._perp(),qe=we._add(Pe)._unit(),ut=qe.x*Pe.x+qe.y*Pe.y;ut!==0&&qe._mult(1/ut),K.push(qe._mult(F)._add(le))}j.push(K)}return j}(f,P*v)),function(L,F,j){for(let H=0;H<F.length;H++){const q=F[H];if(L.length>=3){for(let K=0;K<q.length;K++)if(Ml(L,q[K]))return!0}if(lI(L,q,j))return!0}return!1}(S,f,C)}isTileClipped(){return!0}}function s_(r,t){return t>0?t+2*r:r}const eA=k([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),tA=k([{name:"a_projected_pos",components:3,type:"Float32"}],4);k([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const iA=k([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);k([{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 o_=k([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),nA=k([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function rA(r,t,s){return r.sections.forEach(l=>{l.text=function(f,_,x){const v=_.layout.get("text-transform").evaluate(x,{});return v==="uppercase"?f=f.toLocaleUpperCase():v==="lowercase"&&(f=f.toLocaleLowerCase()),Dn.applyArabicShaping&&(f=Dn.applyArabicShaping(f)),f}(l.text,t,s)}),r}k([{name:"triangle",components:3,type:"Uint16"}]),k([{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"}]),k([{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"}]),k([{type:"Float32",name:"offsetX"}]),k([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),k([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const lh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Oi=24,a_=oi,l_=function(r,t,s,l,f){var _,x,v=8*f-l-1,S=(1<<v)-1,C=S>>1,P=-7,L=f-1,F=-1,j=r[t+L];for(L+=F,_=j&(1<<-P)-1,j>>=-P,P+=v;P>0;_=256*_+r[t+L],L+=F,P-=8);for(x=_&(1<<-P)-1,_>>=-P,P+=l;P>0;x=256*x+r[t+L],L+=F,P-=8);if(_===0)_=1-C;else{if(_===S)return x?NaN:1/0*(j?-1:1);x+=Math.pow(2,l),_-=C}return(j?-1:1)*x*Math.pow(2,_-l)},c_=function(r,t,s,l,f,_){var x,v,S,C=8*_-f-1,P=(1<<C)-1,L=P>>1,F=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,j=0,H=1,q=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(v=isNaN(t)?1:0,x=P):(x=Math.floor(Math.log(t)/Math.LN2),t*(S=Math.pow(2,-x))<1&&(x--,S*=2),(t+=x+L>=1?F/S:F*Math.pow(2,1-L))*S>=2&&(x++,S/=2),x+L>=P?(v=0,x=P):x+L>=1?(v=(t*S-1)*Math.pow(2,f),x+=L):(v=t*Math.pow(2,L-1)*Math.pow(2,f),x=0));f>=8;r[s+j]=255&v,j+=H,v/=256,f-=8);for(x=x<<f|v,C+=f;C>0;r[s+j]=255&x,j+=H,x/=256,C-=8);r[s+j-H]|=128*q};function oi(r){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(r)?r:new Uint8Array(r||0),this.pos=0,this.type=0,this.length=this.buf.length}oi.Varint=0,oi.Fixed64=1,oi.Bytes=2,oi.Fixed32=5;var Lf=4294967296,h_=1/Lf,u_=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function $s(r){return r.type===oi.Bytes?r.readVarint()+r.pos:r.pos+1}function Dl(r,t,s){return s?4294967296*t+(r>>>0):4294967296*(t>>>0)+(r>>>0)}function d_(r,t,s){var l=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));s.realloc(l);for(var f=s.pos-1;f>=r;f--)s.buf[f+l]=s.buf[f]}function sA(r,t){for(var s=0;s<r.length;s++)t.writeVarint(r[s])}function oA(r,t){for(var s=0;s<r.length;s++)t.writeSVarint(r[s])}function aA(r,t){for(var s=0;s<r.length;s++)t.writeFloat(r[s])}function lA(r,t){for(var s=0;s<r.length;s++)t.writeDouble(r[s])}function cA(r,t){for(var s=0;s<r.length;s++)t.writeBoolean(r[s])}function hA(r,t){for(var s=0;s<r.length;s++)t.writeFixed32(r[s])}function uA(r,t){for(var s=0;s<r.length;s++)t.writeSFixed32(r[s])}function dA(r,t){for(var s=0;s<r.length;s++)t.writeFixed64(r[s])}function pA(r,t){for(var s=0;s<r.length;s++)t.writeSFixed64(r[s])}function rd(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16)+16777216*r[t+3]}function zl(r,t,s){r[s]=t,r[s+1]=t>>>8,r[s+2]=t>>>16,r[s+3]=t>>>24}function p_(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16)+(r[t+3]<<24)}oi.prototype={destroy:function(){this.buf=null},readFields:function(r,t,s){for(s=s||this.length;this.pos<s;){var l=this.readVarint(),f=l>>3,_=this.pos;this.type=7&l,r(f,t,this),this.pos===_&&this.skip(l)}return t},readMessage:function(r,t){return this.readFields(r,t,this.readVarint()+this.pos)},readFixed32:function(){var r=rd(this.buf,this.pos);return this.pos+=4,r},readSFixed32:function(){var r=p_(this.buf,this.pos);return this.pos+=4,r},readFixed64:function(){var r=rd(this.buf,this.pos)+rd(this.buf,this.pos+4)*Lf;return this.pos+=8,r},readSFixed64:function(){var r=rd(this.buf,this.pos)+p_(this.buf,this.pos+4)*Lf;return this.pos+=8,r},readFloat:function(){var r=l_(this.buf,this.pos,!0,23,4);return this.pos+=4,r},readDouble:function(){var r=l_(this.buf,this.pos,!0,52,8);return this.pos+=8,r},readVarint:function(r){var t,s,l=this.buf;return t=127&(s=l[this.pos++]),s<128?t:(t|=(127&(s=l[this.pos++]))<<7,s<128?t:(t|=(127&(s=l[this.pos++]))<<14,s<128?t:(t|=(127&(s=l[this.pos++]))<<21,s<128?t:function(f,_,x){var v,S,C=x.buf;if(v=(112&(S=C[x.pos++]))>>4,S<128||(v|=(127&(S=C[x.pos++]))<<3,S<128)||(v|=(127&(S=C[x.pos++]))<<10,S<128)||(v|=(127&(S=C[x.pos++]))<<17,S<128)||(v|=(127&(S=C[x.pos++]))<<24,S<128)||(v|=(1&(S=C[x.pos++]))<<31,S<128))return Dl(f,v,_);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(s=l[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,t=this.pos;return this.pos=r,r-t>=12&&u_?function(s,l,f){return u_.decode(s.subarray(l,f))}(this.buf,t,r):function(s,l,f){for(var _="",x=l;x<f;){var v,S,C,P=s[x],L=null,F=P>239?4:P>223?3:P>191?2:1;if(x+F>f)break;F===1?P<128&&(L=P):F===2?(192&(v=s[x+1]))==128&&(L=(31&P)<<6|63&v)<=127&&(L=null):F===3?(S=s[x+2],(192&(v=s[x+1]))==128&&(192&S)==128&&((L=(15&P)<<12|(63&v)<<6|63&S)<=2047||L>=55296&&L<=57343)&&(L=null)):F===4&&(S=s[x+2],C=s[x+3],(192&(v=s[x+1]))==128&&(192&S)==128&&(192&C)==128&&((L=(15&P)<<18|(63&v)<<12|(63&S)<<6|63&C)<=65535||L>=1114112)&&(L=null)),L===null?(L=65533,F=1):L>65535&&(L-=65536,_+=String.fromCharCode(L>>>10&1023|55296),L=56320|1023&L),_+=String.fromCharCode(L),x+=F}return _}(this.buf,t,r)},readBytes:function(){var r=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,r);return this.pos=r,t},readPackedVarint:function(r,t){if(this.type!==oi.Bytes)return r.push(this.readVarint(t));var s=$s(this);for(r=r||[];this.pos<s;)r.push(this.readVarint(t));return r},readPackedSVarint:function(r){if(this.type!==oi.Bytes)return r.push(this.readSVarint());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readSVarint());return r},readPackedBoolean:function(r){if(this.type!==oi.Bytes)return r.push(this.readBoolean());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readBoolean());return r},readPackedFloat:function(r){if(this.type!==oi.Bytes)return r.push(this.readFloat());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readFloat());return r},readPackedDouble:function(r){if(this.type!==oi.Bytes)return r.push(this.readDouble());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readDouble());return r},readPackedFixed32:function(r){if(this.type!==oi.Bytes)return r.push(this.readFixed32());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readFixed32());return r},readPackedSFixed32:function(r){if(this.type!==oi.Bytes)return r.push(this.readSFixed32());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readSFixed32());return r},readPackedFixed64:function(r){if(this.type!==oi.Bytes)return r.push(this.readFixed64());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readFixed64());return r},readPackedSFixed64:function(r){if(this.type!==oi.Bytes)return r.push(this.readSFixed64());var t=$s(this);for(r=r||[];this.pos<t;)r.push(this.readSFixed64());return r},skip:function(r){var t=7&r;if(t===oi.Varint)for(;this.buf[this.pos++]>127;);else if(t===oi.Bytes)this.pos=this.readVarint()+this.pos;else if(t===oi.Fixed32)this.pos+=4;else{if(t!==oi.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(r,t){this.writeVarint(r<<3|t)},realloc:function(r){for(var t=this.length||16;t<this.pos+r;)t*=2;if(t!==this.length){var s=new Uint8Array(t);s.set(this.buf),this.buf=s,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(r){this.realloc(4),zl(this.buf,r,this.pos),this.pos+=4},writeSFixed32:function(r){this.realloc(4),zl(this.buf,r,this.pos),this.pos+=4},writeFixed64:function(r){this.realloc(8),zl(this.buf,-1&r,this.pos),zl(this.buf,Math.floor(r*h_),this.pos+4),this.pos+=8},writeSFixed64:function(r){this.realloc(8),zl(this.buf,-1&r,this.pos),zl(this.buf,Math.floor(r*h_),this.pos+4),this.pos+=8},writeVarint:function(r){(r=+r||0)>268435455||r<0?function(t,s){var l,f;if(t>=0?(l=t%4294967296|0,f=t/4294967296|0):(f=~(-t/4294967296),4294967295^(l=~(-t%4294967296))?l=l+1|0:(l=0,f=f+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),function(_,x,v){v.buf[v.pos++]=127&_|128,_>>>=7,v.buf[v.pos++]=127&_|128,_>>>=7,v.buf[v.pos++]=127&_|128,_>>>=7,v.buf[v.pos++]=127&_|128,v.buf[v.pos]=127&(_>>>=7)}(l,0,s),function(_,x){var v=(7&_)<<4;x.buf[x.pos++]|=v|((_>>>=3)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_|((_>>>=7)?128:0),_&&(x.buf[x.pos++]=127&_)))))}(f,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 t=this.pos;this.pos=function(l,f,_){for(var x,v,S=0;S<f.length;S++){if((x=f.charCodeAt(S))>55295&&x<57344){if(!v){x>56319||S+1===f.length?(l[_++]=239,l[_++]=191,l[_++]=189):v=x;continue}if(x<56320){l[_++]=239,l[_++]=191,l[_++]=189,v=x;continue}x=v-55296<<10|x-56320|65536,v=null}else v&&(l[_++]=239,l[_++]=191,l[_++]=189,v=null);x<128?l[_++]=x:(x<2048?l[_++]=x>>6|192:(x<65536?l[_++]=x>>12|224:(l[_++]=x>>18|240,l[_++]=x>>12&63|128),l[_++]=x>>6&63|128),l[_++]=63&x|128)}return _}(this.buf,r,this.pos);var s=this.pos-t;s>=128&&d_(t,s,this),this.pos=t-1,this.writeVarint(s),this.pos+=s},writeFloat:function(r){this.realloc(4),c_(this.buf,r,this.pos,!0,23,4),this.pos+=4},writeDouble:function(r){this.realloc(8),c_(this.buf,r,this.pos,!0,52,8),this.pos+=8},writeBytes:function(r){var t=r.length;this.writeVarint(t),this.realloc(t);for(var s=0;s<t;s++)this.buf[this.pos++]=r[s]},writeRawMessage:function(r,t){this.pos++;var s=this.pos;r(t,this);var l=this.pos-s;l>=128&&d_(s,l,this),this.pos=s-1,this.writeVarint(l),this.pos+=l},writeMessage:function(r,t,s){this.writeTag(r,oi.Bytes),this.writeRawMessage(t,s)},writePackedVarint:function(r,t){t.length&&this.writeMessage(r,sA,t)},writePackedSVarint:function(r,t){t.length&&this.writeMessage(r,oA,t)},writePackedBoolean:function(r,t){t.length&&this.writeMessage(r,cA,t)},writePackedFloat:function(r,t){t.length&&this.writeMessage(r,aA,t)},writePackedDouble:function(r,t){t.length&&this.writeMessage(r,lA,t)},writePackedFixed32:function(r,t){t.length&&this.writeMessage(r,hA,t)},writePackedSFixed32:function(r,t){t.length&&this.writeMessage(r,uA,t)},writePackedFixed64:function(r,t){t.length&&this.writeMessage(r,dA,t)},writePackedSFixed64:function(r,t){t.length&&this.writeMessage(r,pA,t)},writeBytesField:function(r,t){this.writeTag(r,oi.Bytes),this.writeBytes(t)},writeFixed32Field:function(r,t){this.writeTag(r,oi.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(r,t){this.writeTag(r,oi.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(r,t){this.writeTag(r,oi.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(r,t){this.writeTag(r,oi.Fixed64),this.writeSFixed64(t)},writeVarintField:function(r,t){this.writeTag(r,oi.Varint),this.writeVarint(t)},writeSVarintField:function(r,t){this.writeTag(r,oi.Varint),this.writeSVarint(t)},writeStringField:function(r,t){this.writeTag(r,oi.Bytes),this.writeString(t)},writeFloatField:function(r,t){this.writeTag(r,oi.Fixed32),this.writeFloat(t)},writeDoubleField:function(r,t){this.writeTag(r,oi.Fixed64),this.writeDouble(t)},writeBooleanField:function(r,t){this.writeVarintField(r,!!t)}};var Of=M(a_);const Bf=3;function fA(r,t,s){r===1&&s.readMessage(mA,t)}function mA(r,t,s){if(r===3){const{id:l,bitmap:f,width:_,height:x,left:v,top:S,advance:C}=s.readMessage(gA,{});t.push({id:l,bitmap:new ih({width:_+2*Bf,height:x+2*Bf},f),metrics:{width:_,height:x,left:v,top:S,advance:C}})}}function gA(r,t,s){r===1?t.id=s.readVarint():r===2?t.bitmap=s.readBytes():r===3?t.width=s.readVarint():r===4?t.height=s.readVarint():r===5?t.left=s.readSVarint():r===6?t.top=s.readSVarint():r===7&&(t.advance=s.readVarint())}const f_=Bf;function m_(r){let t=0,s=0;for(const x of r)t+=x.w*x.h,s=Math.max(s,x.w);r.sort((x,v)=>v.h-x.h);const l=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),s),h:1/0}];let f=0,_=0;for(const x of r)for(let v=l.length-1;v>=0;v--){const S=l[v];if(!(x.w>S.w||x.h>S.h)){if(x.x=S.x,x.y=S.y,_=Math.max(_,x.y+x.h),f=Math.max(f,x.x+x.w),x.w===S.w&&x.h===S.h){const C=l.pop();v<l.length&&(l[v]=C)}else x.h===S.h?(S.x+=x.w,S.w-=x.w):x.w===S.w?(S.y+=x.h,S.h-=x.h):(l.push({x:S.x+x.w,y:S.y,w:S.w-x.w,h:x.h}),S.y+=x.h,S.h-=x.h);break}}return{w:f,h:_,fill:t/(f*_)||0}}const Rn=1;class Ff{constructor(t,{pixelRatio:s,version:l,stretchX:f,stretchY:_,content:x,textFitWidth:v,textFitHeight:S}){this.paddedRect=t,this.pixelRatio=s,this.stretchX=f,this.stretchY=_,this.content=x,this.version=l,this.textFitWidth=v,this.textFitHeight=S}get tl(){return[this.paddedRect.x+Rn,this.paddedRect.y+Rn]}get br(){return[this.paddedRect.x+this.paddedRect.w-Rn,this.paddedRect.y+this.paddedRect.h-Rn]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Rn)/this.pixelRatio,(this.paddedRect.h-2*Rn)/this.pixelRatio]}}class g_{constructor(t,s){const l={},f={};this.haveRenderCallbacks=[];const _=[];this.addImages(t,l,_),this.addImages(s,f,_);const{w:x,h:v}=m_(_),S=new hr({width:x||1,height:v||1});for(const C in t){const P=t[C],L=l[C].paddedRect;hr.copy(P.data,S,{x:0,y:0},{x:L.x+Rn,y:L.y+Rn},P.data)}for(const C in s){const P=s[C],L=f[C].paddedRect,F=L.x+Rn,j=L.y+Rn,H=P.data.width,q=P.data.height;hr.copy(P.data,S,{x:0,y:0},{x:F,y:j},P.data),hr.copy(P.data,S,{x:0,y:q-1},{x:F,y:j-1},{width:H,height:1}),hr.copy(P.data,S,{x:0,y:0},{x:F,y:j+q},{width:H,height:1}),hr.copy(P.data,S,{x:H-1,y:0},{x:F-1,y:j},{width:1,height:q}),hr.copy(P.data,S,{x:0,y:0},{x:F+H,y:j},{width:1,height:q})}this.image=S,this.iconPositions=l,this.patternPositions=f}addImages(t,s,l){for(const f in t){const _=t[f],x={x:0,y:0,w:_.data.width+2*Rn,h:_.data.height+2*Rn};l.push(x),s[f]=new Ff(x,_),_.hasRenderCallback&&this.haveRenderCallbacks.push(f)}}patchUpdatedImages(t,s){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const l in t.updatedImages)this.patchUpdatedImage(this.iconPositions[l],t.getImage(l),s),this.patchUpdatedImage(this.patternPositions[l],t.getImage(l),s)}patchUpdatedImage(t,s,l){if(!t||!s||t.version===s.version)return;t.version=s.version;const[f,_]=t.tl;l.update(s.data,void 0,{x:f,y:_})}}var Po;Xe("ImagePosition",Ff),Xe("ImageAtlas",g_),y.ah=void 0,(Po=y.ah||(y.ah={}))[Po.none=0]="none",Po[Po.horizontal=1]="horizontal",Po[Po.vertical=2]="vertical",Po[Po.horizontalOnly=3]="horizontalOnly";const ch=-17;class hh{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,s){const l=new hh;return l.scale=t||1,l.fontStack=s,l}static forImage(t){const s=new hh;return s.imageName=t,s}}class Rl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,s){const l=new Rl;for(let f=0;f<t.sections.length;f++){const _=t.sections[f];_.image?l.addImageSection(_):l.addTextSection(_,s)}return l}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let s="";for(let l=0;l<t.length;l++){const f=t.charCodeAt(l+1)||null,_=t.charCodeAt(l-1)||null;s+=f&&Hu(f)&&!lh[t[l+1]]||_&&Hu(_)&&!lh[t[l-1]]||!lh[t[l]]?t[l]:lh[t[l]]}return s}(this.text)}trim(){let t=0;for(let l=0;l<this.text.length&&od[this.text.charCodeAt(l)];l++)t++;let s=this.text.length;for(let l=this.text.length-1;l>=0&&l>=t&&od[this.text.charCodeAt(l)];l--)s--;this.text=this.text.substring(t,s),this.sectionIndex=this.sectionIndex.slice(t,s)}substring(t,s){const l=new Rl;return l.text=this.text.substring(t,s),l.sectionIndex=this.sectionIndex.slice(t,s),l.sections=this.sections,l}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,s)=>Math.max(t,this.sections[s].scale),0)}addTextSection(t,s){this.text+=t.text,this.sections.push(hh.forText(t.scale,t.fontStack||s));const l=this.sections.length-1;for(let f=0;f<t.text.length;++f)this.sectionIndex.push(l)}addImageSection(t){const s=t.image?t.image.name:"";if(s.length===0)return void Rt("Can't add FormattedSection with an empty image.");const l=this.getNextImageSectionCharCode();l?(this.text+=String.fromCharCode(l),this.sections.push(hh.forImage(s)),this.sectionIndex.push(this.sections.length-1)):Rt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function sd(r,t,s,l,f,_,x,v,S,C,P,L,F,j,H){const q=Rl.fromFeature(r,f);let K;L===y.ah.vertical&&q.verticalizePunctuation();const{processBidirectionalText:ie,processStyledBidirectionalText:ge}=Dn;if(ie&&q.sections.length===1){K=[];const we=ie(q.toString(),Nf(q,C,_,t,l,j));for(const Pe of we){const qe=new Rl;qe.text=Pe,qe.sections=q.sections;for(let ut=0;ut<Pe.length;ut++)qe.sectionIndex.push(0);K.push(qe)}}else if(ge){K=[];const we=ge(q.text,q.sectionIndex,Nf(q,C,_,t,l,j));for(const Pe of we){const qe=new Rl;qe.text=Pe[0],qe.sectionIndex=Pe[1],qe.sections=q.sections,K.push(qe)}}else K=function(we,Pe){const qe=[],ut=we.text;let je=0;for(const Ve of Pe)qe.push(we.substring(je,Ve)),je=Ve;return je<ut.length&&qe.push(we.substring(je,ut.length)),qe}(q,Nf(q,C,_,t,l,j));const le=[],fe={positionedLines:le,text:q.toString(),top:P[1],bottom:P[1],left:P[0],right:P[0],writingMode:L,iconsInText:!1,verticalizable:!1};return function(we,Pe,qe,ut,je,Ve,nt,Ke,Ge,Te,at,it){let _t=0,ci=ch,ai=0,Ni=0;const zr=Ke==="right"?1:Ke==="left"?0:.5;let en=0;for(const Pi of je){Pi.trim();const $i=Pi.getMaxScale(),hn=($i-1)*Oi,tn={positionedGlyphs:[],lineOffset:0};we.positionedLines[en]=tn;const wn=tn.positionedGlyphs;let nn=0;if(!Pi.length()){ci+=Ve,++en;continue}for(let Ln=0;Ln<Pi.length();Ln++){const qt=Pi.getSection(Ln),ui=Pi.getSectionIndex(Ln),_i=Pi.getCharCode(Ln);let Kn=0,Ei=null,Fl=null,hs=null,us=Oi;const Rr=!(Ge===y.ah.horizontal||!at&&!Yc(_i)||at&&(od[_i]||(Vi=_i,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(Vi)))));if(qt.imageName){const pr=ut[qt.imageName];if(!pr)continue;hs=qt.imageName,we.iconsInText=we.iconsInText||!0,Fl=pr.paddedRect;const Wi=pr.displaySize;qt.scale=qt.scale*Oi/it,Ei={width:Wi[0],height:Wi[1],left:Rn,top:-f_,advance:Rr?Wi[1]:Wi[0]},Kn=hn+(Oi-Wi[1]*qt.scale),us=Ei.advance;const js=Rr?Wi[0]*qt.scale-Oi*$i:Wi[1]*qt.scale-Oi*$i;js>0&&js>nn&&(nn=js)}else{const pr=qe[qt.fontStack],Wi=pr&&pr[_i];if(Wi&&Wi.rect)Fl=Wi.rect,Ei=Wi.metrics;else{const js=Pe[qt.fontStack],gh=js&&js[_i];if(!gh)continue;Ei=gh.metrics}Kn=($i-qt.scale)*Oi}Rr?(we.verticalizable=!0,wn.push({glyph:_i,imageName:hs,x:_t,y:ci+Kn,vertical:Rr,scale:qt.scale,fontStack:qt.fontStack,sectionIndex:ui,metrics:Ei,rect:Fl}),_t+=us*qt.scale+Te):(wn.push({glyph:_i,imageName:hs,x:_t,y:ci+Kn,vertical:Rr,scale:qt.scale,fontStack:qt.fontStack,sectionIndex:ui,metrics:Ei,rect:Fl}),_t+=Ei.advance*qt.scale+Te)}wn.length!==0&&(ai=Math.max(_t-Te,ai),bA(wn,0,wn.length-1,zr,nn)),_t=0;const dr=Ve*$i+nn;tn.lineOffset=Math.max(nn,hn),ci+=dr,Ni=Math.max(dr,Ni),++en}var Vi;const xn=ci-ch,{horizontalAlign:bn,verticalAlign:vn}=Vf(nt);(function(Pi,$i,hn,tn,wn,nn,dr,Ln,qt){const ui=($i-hn)*wn;let _i=0;_i=nn!==dr?-Ln*tn-ch:(-tn*qt+.5)*dr;for(const Kn of Pi)for(const Ei of Kn.positionedGlyphs)Ei.x+=ui,Ei.y+=_i})(we.positionedLines,zr,bn,vn,ai,Ni,Ve,xn,je.length),we.top+=-vn*xn,we.bottom=we.top+xn,we.left+=-bn*ai,we.right=we.left+ai}(fe,t,s,l,K,x,v,S,L,C,F,H),!function(we){for(const Pe of we)if(Pe.positionedGlyphs.length!==0)return!1;return!0}(le)&&fe}const od={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},yA={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},_A={40:!0};function y_(r,t,s,l,f,_){if(t.imageName){const x=l[t.imageName];return x?x.displaySize[0]*t.scale*Oi/_+f:0}{const x=s[t.fontStack],v=x&&x[r];return v?v.metrics.advance*t.scale+f:0}}function __(r,t,s,l){const f=Math.pow(r-t,2);return l?r<t?f/2:2*f:f+Math.abs(s)*s}function xA(r,t,s){let l=0;return r===10&&(l-=1e4),s&&(l+=150),r!==40&&r!==65288||(l+=50),t!==41&&t!==65289||(l+=50),l}function x_(r,t,s,l,f,_){let x=null,v=__(t,s,f,_);for(const S of l){const C=__(t-S.x,s,f,_)+S.badness;C<=v&&(x=S,v=C)}return{index:r,x:t,priorBreak:x,badness:v}}function b_(r){return r?b_(r.priorBreak).concat(r.index):[]}function Nf(r,t,s,l,f,_){if(!r)return[];const x=[],v=function(L,F,j,H,q,K){let ie=0;for(let ge=0;ge<L.length();ge++){const le=L.getSection(ge);ie+=y_(L.getCharCode(ge),le,H,q,F,K)}return ie/Math.max(1,Math.ceil(ie/j))}(r,t,s,l,f,_),S=r.text.indexOf("​")>=0;let C=0;for(let L=0;L<r.length();L++){const F=r.getSection(L),j=r.getCharCode(L);if(od[j]||(C+=y_(j,F,l,f,t,_)),L<r.length()-1){const H=!((P=j)<11904)&&(!!Bt["CJK Compatibility Forms"](P)||!!Bt["CJK Compatibility"](P)||!!Bt["CJK Strokes"](P)||!!Bt["CJK Symbols and Punctuation"](P)||!!Bt["Enclosed CJK Letters and Months"](P)||!!Bt["Halfwidth and Fullwidth Forms"](P)||!!Bt["Ideographic Description Characters"](P)||!!Bt["Vertical Forms"](P)||Uu.test(String.fromCodePoint(P)));(yA[j]||H||F.imageName||L!==r.length()-2&&_A[r.getCharCode(L+1)])&&x.push(x_(L+1,C,v,x,xA(j,r.getCharCode(L+1),H&&S),!1))}}var P;return b_(x_(r.length(),C,v,x,0,!0))}function Vf(r){let t=.5,s=.5;switch(r){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":s=1;break;case"top":case"top-right":case"top-left":s=0}return{horizontalAlign:t,verticalAlign:s}}function bA(r,t,s,l,f){if(!l&&!f)return;const _=r[s],x=(r[s].x+_.metrics.advance*_.scale)*l;for(let v=t;v<=s;v++)r[v].x-=x,r[v].y+=f}function vA(r,t,s){const{horizontalAlign:l,verticalAlign:f}=Vf(s),_=t[0]-r.displaySize[0]*l,x=t[1]-r.displaySize[1]*f;return{image:r,top:x,bottom:x+r.displaySize[1],left:_,right:_+r.displaySize[0]}}function v_(r){var t,s;let l=r.left,f=r.top,_=r.right-l,x=r.bottom-f;const v=(t=r.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",S=(s=r.image.textFitHeight)!==null&&s!==void 0?s:"stretchOrShrink",C=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(S==="proportional"){if(v==="stretchOnly"&&_/x<C||v==="proportional"){const P=Math.ceil(x*C);l*=P/_,_=P}}else if(v==="proportional"&&S==="stretchOnly"&&C!==0&&_/x>C){const P=Math.ceil(_/C);f*=P/x,x=P}return{x1:l,y1:f,x2:l+_,y2:f+x}}function w_(r,t,s,l,f,_){const x=r.image;let v;if(x.content){const K=x.content,ie=x.pixelRatio||1;v=[K[0]/ie,K[1]/ie,x.displaySize[0]-K[2]/ie,x.displaySize[1]-K[3]/ie]}const S=t.left*_,C=t.right*_;let P,L,F,j;s==="width"||s==="both"?(j=f[0]+S-l[3],L=f[0]+C+l[1]):(j=f[0]+(S+C-x.displaySize[0])/2,L=j+x.displaySize[0]);const H=t.top*_,q=t.bottom*_;return s==="height"||s==="both"?(P=f[1]+H-l[0],F=f[1]+q+l[2]):(P=f[1]+(H+q-x.displaySize[1])/2,F=P+x.displaySize[1]),{image:x,top:P,right:L,bottom:F,left:j,collisionPadding:v}}const uh=255,cs=128,Io=uh*cs;function k_(r,t){const{expression:s}=t;if(s.kind==="constant")return{kind:"constant",layoutSize:s.evaluate(new fi(r+1))};if(s.kind==="source")return{kind:"source"};{const{zoomStops:l,interpolationType:f}=s;let _=0;for(;_<l.length&&l[_]<=r;)_++;_=Math.max(0,_-1);let x=_;for(;x<l.length&&l[x]<r+1;)x++;x=Math.min(l.length-1,x);const v=l[_],S=l[x];return s.kind==="composite"?{kind:"composite",minZoom:v,maxZoom:S,interpolationType:f}:{kind:"camera",minZoom:v,maxZoom:S,minSize:s.evaluate(new fi(v)),maxSize:s.evaluate(new fi(S)),interpolationType:f}}}function $f(r,t,s){let l="never";const f=r.get(t);return f?l=f:r.get(s)&&(l="always"),l}const wA=Mo.VectorTileFeature.types,kA=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ad(r,t,s,l,f,_,x,v,S,C,P,L,F){const j=v?Math.min(Io,Math.round(v[0])):0,H=v?Math.min(Io,Math.round(v[1])):0;r.emplaceBack(t,s,Math.round(32*l),Math.round(32*f),_,x,(j<<1)+(S?1:0),H,16*C,16*P,256*L,256*F)}function jf(r,t,s){r.emplaceBack(t.x,t.y,s),r.emplaceBack(t.x,t.y,s),r.emplaceBack(t.x,t.y,s),r.emplaceBack(t.x,t.y,s)}function SA(r){for(const t of r.sections)if(gf(t.text))return!0;return!1}class Uf{constructor(t){this.layoutVertexArray=new kl,this.indexArray=new cr,this.programConfigurations=t,this.segments=new Ft,this.dynamicLayoutVertexArray=new Jc,this.opacityVertexArray=new Yn,this.hasVisibleVertices=!1,this.placedSymbolArray=new mi}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,s,l,f){this.isEmpty()||(l&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,eA.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,s),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,tA.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,kA,!0),this.opacityVertexBuffer.itemSize=1),(l||f)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Xe("SymbolBuffers",Uf);class Hf{constructor(t,s,l){this.layoutVertexArray=new t,this.layoutAttributes=s,this.indexArray=new l,this.segments=new Ft,this.collisionVertexArray=new as}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,iA.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Xe("CollisionBuffers",Hf);class Ll{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(x=>x.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=kf([]),this.placementViewportMatrix=kf([]);const s=this.layers[0]._unevaluatedLayout._values;this.textSizeData=k_(this.zoom,s["text-size"]),this.iconSizeData=k_(this.zoom,s["icon-size"]);const l=this.layers[0].layout,f=l.get("symbol-sort-key"),_=l.get("symbol-z-order");this.canOverlap=$f(l,"text-overlap","text-allow-overlap")!=="never"||$f(l,"icon-overlap","icon-allow-overlap")!=="never"||l.get("text-ignore-placement")||l.get("icon-ignore-placement"),this.sortFeaturesByKey=_!=="viewport-y"&&!f.isConstant(),this.sortFeaturesByY=(_==="viewport-y"||_==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,l.get("symbol-placement")==="point"&&(this.writingModes=l.get("text-writing-mode").map(x=>y.ah[x])),this.stateDependentLayerIds=this.layers.filter(x=>x.isStateDependent()).map(x=>x.id),this.sourceID=t.sourceID}createArrays(){this.text=new Uf(new _a(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Uf(new _a(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new gi,this.lineVertexArray=new Xi,this.symbolInstances=new Ot,this.textAnchorOffsets=new yi}calculateGlyphDependencies(t,s,l,f,_){for(let x=0;x<t.length;x++)if(s[t.charCodeAt(x)]=!0,(l||f)&&_){const v=lh[t.charAt(x)];v&&(s[v.charCodeAt(0)]=!0)}}populate(t,s,l){const f=this.layers[0],_=f.layout,x=_.get("text-font"),v=_.get("text-field"),S=_.get("icon-image"),C=(v.value.kind!=="constant"||v.value.value instanceof Mn&&!v.value.value.isEmpty()||v.value.value.toString().length>0)&&(x.value.kind!=="constant"||x.value.value.length>0),P=S.value.kind!=="constant"||!!S.value.value||Object.keys(S.parameters).length>0,L=_.get("symbol-sort-key");if(this.features=[],!C&&!P)return;const F=s.iconDependencies,j=s.glyphDependencies,H=s.availableImages,q=new fi(this.zoom);for(const{feature:K,id:ie,index:ge,sourceLayerIndex:le}of t){const fe=f._featureFilter.needGeometry,we=ba(K,fe);if(!f._featureFilter.filter(q,we,l))continue;let Pe,qe;if(fe||(we.geometry=xa(K)),C){const je=f.getValueAndResolveTokens("text-field",we,l,H),Ve=Mn.factory(je),nt=this.hasRTLText=this.hasRTLText||SA(Ve);(!nt||Dn.getRTLTextPluginStatus()==="unavailable"||nt&&Dn.isParsed())&&(Pe=rA(Ve,f,we))}if(P){const je=f.getValueAndResolveTokens("icon-image",we,l,H);qe=je instanceof In?je:In.fromString(je)}if(!Pe&&!qe)continue;const ut=this.sortFeaturesByKey?L.evaluate(we,{},l):void 0;if(this.features.push({id:ie,text:Pe,icon:qe,index:ge,sourceLayerIndex:le,geometry:we.geometry,properties:K.properties,type:wA[K.type],sortKey:ut}),qe&&(F[qe.name]=!0),Pe){const je=x.evaluate(we,{},l).join(","),Ve=_.get("text-rotation-alignment")!=="viewport"&&_.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(y.ah.vertical)>=0;for(const nt of Pe.sections)if(nt.image)F[nt.image.name]=!0;else{const Ke=Wc(Pe.toString()),Ge=nt.fontStack||je,Te=j[Ge]=j[Ge]||{};this.calculateGlyphDependencies(nt.text,Te,Ve,this.allowVerticalPlacement,Ke)}}}_.get("symbol-placement")==="line"&&(this.features=function(K){const ie={},ge={},le=[];let fe=0;function we(je){le.push(K[je]),fe++}function Pe(je,Ve,nt){const Ke=ge[je];return delete ge[je],ge[Ve]=Ke,le[Ke].geometry[0].pop(),le[Ke].geometry[0]=le[Ke].geometry[0].concat(nt[0]),Ke}function qe(je,Ve,nt){const Ke=ie[Ve];return delete ie[Ve],ie[je]=Ke,le[Ke].geometry[0].shift(),le[Ke].geometry[0]=nt[0].concat(le[Ke].geometry[0]),Ke}function ut(je,Ve,nt){const Ke=nt?Ve[0][Ve[0].length-1]:Ve[0][0];return`${je}:${Ke.x}:${Ke.y}`}for(let je=0;je<K.length;je++){const Ve=K[je],nt=Ve.geometry,Ke=Ve.text?Ve.text.toString():null;if(!Ke){we(je);continue}const Ge=ut(Ke,nt),Te=ut(Ke,nt,!0);if(Ge in ge&&Te in ie&&ge[Ge]!==ie[Te]){const at=qe(Ge,Te,nt),it=Pe(Ge,Te,le[at].geometry);delete ie[Ge],delete ge[Te],ge[ut(Ke,le[it].geometry,!0)]=it,le[at].geometry=null}else Ge in ge?Pe(Ge,Te,nt):Te in ie?qe(Ge,Te,nt):(we(je),ie[Ge]=fe-1,ge[Te]=fe-1)}return le.filter(je=>je.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((K,ie)=>K.sortKey-ie.sortKey)}update(t,s,l){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,s,this.layers,l),this.icon.programConfigurations.updatePaintArrays(t,s,this.layers,l))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,s){const l=this.lineVertexArray.length;if(t.segment!==void 0){let f=t.dist(s[t.segment+1]),_=t.dist(s[t.segment]);const x={};for(let v=t.segment+1;v<s.length;v++)x[v]={x:s[v].x,y:s[v].y,tileUnitDistanceFromAnchor:f},v<s.length-1&&(f+=s[v+1].dist(s[v]));for(let v=t.segment||0;v>=0;v--)x[v]={x:s[v].x,y:s[v].y,tileUnitDistanceFromAnchor:_},v>0&&(_+=s[v-1].dist(s[v]));for(let v=0;v<s.length;v++){const S=x[v];this.lineVertexArray.emplaceBack(S.x,S.y,S.tileUnitDistanceFromAnchor)}}return{lineStartIndex:l,lineLength:this.lineVertexArray.length-l}}addSymbols(t,s,l,f,_,x,v,S,C,P,L,F){const j=t.indexArray,H=t.layoutVertexArray,q=t.segments.prepareSegment(4*s.length,H,j,this.canOverlap?x.sortKey:void 0),K=this.glyphOffsetArray.length,ie=q.vertexLength,ge=this.allowVerticalPlacement&&v===y.ah.vertical?Math.PI/2:0,le=x.text&&x.text.sections;for(let fe=0;fe<s.length;fe++){const{tl:we,tr:Pe,bl:qe,br:ut,tex:je,pixelOffsetTL:Ve,pixelOffsetBR:nt,minFontScaleX:Ke,minFontScaleY:Ge,glyphOffset:Te,isSDF:at,sectionIndex:it}=s[fe],_t=q.vertexLength,ci=Te[1];ad(H,S.x,S.y,we.x,ci+we.y,je.x,je.y,l,at,Ve.x,Ve.y,Ke,Ge),ad(H,S.x,S.y,Pe.x,ci+Pe.y,je.x+je.w,je.y,l,at,nt.x,Ve.y,Ke,Ge),ad(H,S.x,S.y,qe.x,ci+qe.y,je.x,je.y+je.h,l,at,Ve.x,nt.y,Ke,Ge),ad(H,S.x,S.y,ut.x,ci+ut.y,je.x+je.w,je.y+je.h,l,at,nt.x,nt.y,Ke,Ge),jf(t.dynamicLayoutVertexArray,S,ge),j.emplaceBack(_t,_t+1,_t+2),j.emplaceBack(_t+1,_t+2,_t+3),q.vertexLength+=4,q.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Te[0]),fe!==s.length-1&&it===s[fe+1].sectionIndex||t.programConfigurations.populatePaintArrays(H.length,x,x.index,{},F,le&&le[it])}t.placedSymbolArray.emplaceBack(S.x,S.y,K,this.glyphOffsetArray.length-K,ie,C,P,S.segment,l?l[0]:0,l?l[1]:0,f[0],f[1],v,0,!1,0,L)}_addCollisionDebugVertex(t,s,l,f,_,x){return s.emplaceBack(0,0),t.emplaceBack(l.x,l.y,f,_,Math.round(x.x),Math.round(x.y))}addCollisionDebugVertices(t,s,l,f,_,x,v){const S=_.segments.prepareSegment(4,_.layoutVertexArray,_.indexArray),C=S.vertexLength,P=_.layoutVertexArray,L=_.collisionVertexArray,F=v.anchorX,j=v.anchorY;this._addCollisionDebugVertex(P,L,x,F,j,new R(t,s)),this._addCollisionDebugVertex(P,L,x,F,j,new R(l,s)),this._addCollisionDebugVertex(P,L,x,F,j,new R(l,f)),this._addCollisionDebugVertex(P,L,x,F,j,new R(t,f)),S.vertexLength+=4;const H=_.indexArray;H.emplaceBack(C,C+1),H.emplaceBack(C+1,C+2),H.emplaceBack(C+2,C+3),H.emplaceBack(C+3,C),S.primitiveLength+=4}addDebugCollisionBoxes(t,s,l,f){for(let _=t;_<s;_++){const x=this.collisionBoxArray.get(_);this.addCollisionDebugVertices(x.x1,x.y1,x.x2,x.y2,f?this.textCollisionBox:this.iconCollisionBox,x.anchorPoint,l)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Hf(Xn,o_.members,Zi),this.iconCollisionBox=new Hf(Xn,o_.members,Zi);for(let t=0;t<this.symbolInstances.length;t++){const s=this.symbolInstances.get(t);this.addDebugCollisionBoxes(s.textBoxStartIndex,s.textBoxEndIndex,s,!0),this.addDebugCollisionBoxes(s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s,!0),this.addDebugCollisionBoxes(s.iconBoxStartIndex,s.iconBoxEndIndex,s,!1),this.addDebugCollisionBoxes(s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s,!1)}}_deserializeCollisionBoxesForSymbol(t,s,l,f,_,x,v,S,C){const P={};for(let L=s;L<l;L++){const F=t.get(L);P.textBox={x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2,anchorPointX:F.anchorPointX,anchorPointY:F.anchorPointY},P.textFeatureIndex=F.featureIndex;break}for(let L=f;L<_;L++){const F=t.get(L);P.verticalTextBox={x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2,anchorPointX:F.anchorPointX,anchorPointY:F.anchorPointY},P.verticalTextFeatureIndex=F.featureIndex;break}for(let L=x;L<v;L++){const F=t.get(L);P.iconBox={x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2,anchorPointX:F.anchorPointX,anchorPointY:F.anchorPointY},P.iconFeatureIndex=F.featureIndex;break}for(let L=S;L<C;L++){const F=t.get(L);P.verticalIconBox={x1:F.x1,y1:F.y1,x2:F.x2,y2:F.y2,anchorPointX:F.anchorPointX,anchorPointY:F.anchorPointY},P.verticalIconFeatureIndex=F.featureIndex;break}return P}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let s=0;s<this.symbolInstances.length;s++){const l=this.symbolInstances.get(s);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,l.textBoxStartIndex,l.textBoxEndIndex,l.verticalTextBoxStartIndex,l.verticalTextBoxEndIndex,l.iconBoxStartIndex,l.iconBoxEndIndex,l.verticalIconBoxStartIndex,l.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,s){const l=t.placedSymbolArray.get(s),f=l.vertexStartIndex+4*l.numGlyphs;for(let _=l.vertexStartIndex;_<f;_+=4)t.indexArray.emplaceBack(_,_+1,_+2),t.indexArray.emplaceBack(_+1,_+2,_+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const s=Math.sin(t),l=Math.cos(t),f=[],_=[],x=[];for(let v=0;v<this.symbolInstances.length;++v){x.push(v);const S=this.symbolInstances.get(v);f.push(0|Math.round(s*S.anchorX+l*S.anchorY)),_.push(S.featureIndex)}return x.sort((v,S)=>f[v]-f[S]||_[S]-_[v]),x}addToSortKeyRanges(t,s){const l=this.sortKeyRanges[this.sortKeyRanges.length-1];l&&l.sortKey===s?l.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:s,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const s of this.symbolInstanceIndexes){const l=this.symbolInstances.get(s);this.featureSortOrder.push(l.featureIndex),[l.rightJustifiedTextSymbolIndex,l.centerJustifiedTextSymbolIndex,l.leftJustifiedTextSymbolIndex].forEach((f,_,x)=>{f>=0&&x.indexOf(f)===_&&this.addIndicesForPlacedSymbol(this.text,f)}),l.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,l.verticalPlacedTextSymbolIndex),l.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.placedIconSymbolIndex),l.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,l.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let S_,E_;Xe("SymbolBucket",Ll,{omit:["layers","collisionBoxArray","features","compareText"]}),Ll.MAX_GLYPHS=65535,Ll.addDynamicAttributes=jf;var qf={get paint(){return E_=E_||new g({"icon-opacity":new dt(xe.paint_symbol["icon-opacity"]),"icon-color":new dt(xe.paint_symbol["icon-color"]),"icon-halo-color":new dt(xe.paint_symbol["icon-halo-color"]),"icon-halo-width":new dt(xe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new dt(xe.paint_symbol["icon-halo-blur"]),"icon-translate":new et(xe.paint_symbol["icon-translate"]),"icon-translate-anchor":new et(xe.paint_symbol["icon-translate-anchor"]),"text-opacity":new dt(xe.paint_symbol["text-opacity"]),"text-color":new dt(xe.paint_symbol["text-color"],{runtimeType:fn,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new dt(xe.paint_symbol["text-halo-color"]),"text-halo-width":new dt(xe.paint_symbol["text-halo-width"]),"text-halo-blur":new dt(xe.paint_symbol["text-halo-blur"]),"text-translate":new et(xe.paint_symbol["text-translate"]),"text-translate-anchor":new et(xe.paint_symbol["text-translate-anchor"])})},get layout(){return S_=S_||new g({"symbol-placement":new et(xe.layout_symbol["symbol-placement"]),"symbol-spacing":new et(xe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new et(xe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new dt(xe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new et(xe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new et(xe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new et(xe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new et(xe.layout_symbol["icon-ignore-placement"]),"icon-optional":new et(xe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new et(xe.layout_symbol["icon-rotation-alignment"]),"icon-size":new dt(xe.layout_symbol["icon-size"]),"icon-text-fit":new et(xe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new et(xe.layout_symbol["icon-text-fit-padding"]),"icon-image":new dt(xe.layout_symbol["icon-image"]),"icon-rotate":new dt(xe.layout_symbol["icon-rotate"]),"icon-padding":new dt(xe.layout_symbol["icon-padding"]),"icon-keep-upright":new et(xe.layout_symbol["icon-keep-upright"]),"icon-offset":new dt(xe.layout_symbol["icon-offset"]),"icon-anchor":new dt(xe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new et(xe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new et(xe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new et(xe.layout_symbol["text-rotation-alignment"]),"text-field":new dt(xe.layout_symbol["text-field"]),"text-font":new dt(xe.layout_symbol["text-font"]),"text-size":new dt(xe.layout_symbol["text-size"]),"text-max-width":new dt(xe.layout_symbol["text-max-width"]),"text-line-height":new et(xe.layout_symbol["text-line-height"]),"text-letter-spacing":new dt(xe.layout_symbol["text-letter-spacing"]),"text-justify":new dt(xe.layout_symbol["text-justify"]),"text-radial-offset":new dt(xe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new et(xe.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new dt(xe.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new dt(xe.layout_symbol["text-anchor"]),"text-max-angle":new et(xe.layout_symbol["text-max-angle"]),"text-writing-mode":new et(xe.layout_symbol["text-writing-mode"]),"text-rotate":new dt(xe.layout_symbol["text-rotate"]),"text-padding":new et(xe.layout_symbol["text-padding"]),"text-keep-upright":new et(xe.layout_symbol["text-keep-upright"]),"text-transform":new dt(xe.layout_symbol["text-transform"]),"text-offset":new dt(xe.layout_symbol["text-offset"]),"text-allow-overlap":new et(xe.layout_symbol["text-allow-overlap"]),"text-overlap":new et(xe.layout_symbol["text-overlap"]),"text-ignore-placement":new et(xe.layout_symbol["text-ignore-placement"]),"text-optional":new et(xe.layout_symbol["text-optional"])})}};class T_{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:ns,this.defaultValue=t}evaluate(t){if(t.formattedSection){const s=this.defaultValue.property.overrides;if(s&&s.hasOverride(t.formattedSection))return s.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Xe("FormatSectionOverride",T_,{omit:["defaultValue"]});class ld extends a{constructor(t){super(t,qf)}recalculate(t,s){if(super.recalculate(t,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 l=this.layout.get("text-writing-mode");if(l){const f=[];for(const _ of l)f.indexOf(_)<0&&f.push(_);this.layout._values["text-writing-mode"]=f}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,s,l,f){const _=this.layout.get(t).evaluate(s,{},l,f),x=this._unevaluatedLayout._values[t];return x.isDataDriven()||ll(x.value)||!_?_:function(v,S){return S.replace(/{([^{}]+)}/g,(C,P)=>v&&P in v?String(v[P]):"")}(s.properties,_)}createBucket(t){return new Ll(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of qf.paint.overridableProperties){if(!ld.hasPaintOverride(this.layout,t))continue;const s=this.paint.get(t),l=new T_(s),f=new al(l,s.property.specification);let _=null;_=s.value.kind==="constant"||s.value.kind==="source"?new uo("source",f):new po("composite",f,s.value.zoomStops),this.paint._values[t]=new Ar(s.property,_,s.parameters)}}_handleOverridablePaintPropertyUpdate(t,s,l){return!(!this.layout||s.isDataDriven()||l.isDataDriven())&&ld.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,s){const l=t.get("text-field"),f=qf.paint.properties[s];let _=!1;const x=v=>{for(const S of v)if(f.overrides&&f.overrides.hasOverride(S))return void(_=!0)};if(l.value.kind==="constant"&&l.value.value instanceof Mn)x(l.value.value.sections);else if(l.value.kind==="source"){const v=C=>{_||(C instanceof nr&&zi(C.value)===jr?x(C.value.sections):C instanceof Ja?x(C.sections):C.eachChild(v))},S=l.value;S._styleExpression&&v(S._styleExpression.expression)}return _}}let C_;var EA={get paint(){return C_=C_||new g({"background-color":new et(xe.paint_background["background-color"]),"background-pattern":new vl(xe.paint_background["background-pattern"]),"background-opacity":new et(xe.paint_background["background-opacity"])})}};class TA extends a{constructor(t){super(t,EA)}}let M_;var CA={get paint(){return M_=M_||new g({"raster-opacity":new et(xe.paint_raster["raster-opacity"]),"raster-hue-rotate":new et(xe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new et(xe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new et(xe.paint_raster["raster-brightness-max"]),"raster-saturation":new et(xe.paint_raster["raster-saturation"]),"raster-contrast":new et(xe.paint_raster["raster-contrast"]),"raster-resampling":new et(xe.paint_raster["raster-resampling"]),"raster-fade-duration":new et(xe.paint_raster["raster-fade-duration"])})}};class MA extends a{constructor(t){super(t,CA)}}class PA extends a{constructor(t){super(t,{}),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=t}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 IA{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Zf=63710088e-1;class Ao{constructor(t,s){if(isNaN(t)||isNaN(s))throw new Error(`Invalid LngLat object: (${t}, ${s})`);if(this.lng=+t,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 Ao(Qe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const s=Math.PI/180,l=this.lat*s,f=t.lat*s,_=Math.sin(l)*Math.sin(f)+Math.cos(l)*Math.cos(f)*Math.cos((t.lng-this.lng)*s);return Zf*Math.acos(Math.min(_,1))}static convert(t){if(t instanceof Ao)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Ao(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Ao(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const P_=2*Math.PI*Zf;function I_(r){return P_*Math.cos(r*Math.PI/180)}function A_(r){return(180+r)/360}function D_(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function z_(r,t){return r/I_(t)}function Wf(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}class dh{constructor(t,s,l=0){this.x=+t,this.y=+s,this.z=+l}static fromLngLat(t,s=0){const l=Ao.convert(t);return new dh(A_(l.lng),D_(l.lat),z_(s,l.lat))}toLngLat(){return new Ao(360*this.x-180,Wf(this.y))}toAltitude(){return this.z*I_(Wf(this.y))}meterInMercatorCoordinateUnits(){return 1/P_*(t=Wf(this.y),1/Math.cos(t*Math.PI/180));var t}}function R_(r,t,s){var l=2*Math.PI*6378137/256/Math.pow(2,s);return[r*l-2*Math.PI*6378137/2,t*l-2*Math.PI*6378137/2]}class Gf{constructor(t,s,l){if(!function(f,_,x){return!(f<0||f>25||x<0||x>=Math.pow(2,f)||_<0||_>=Math.pow(2,f))}(t,s,l))throw new Error(`x=${s}, y=${l}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=s,this.y=l,this.key=ph(0,t,t,s,l)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,s,l){const f=(x=this.y,v=this.z,S=R_(256*(_=this.x),256*(x=Math.pow(2,v)-x-1),v),C=R_(256*(_+1),256*(x+1),v),S[0]+","+S[1]+","+C[0]+","+C[1]);var _,x,v,S,C;const P=function(L,F,j){let H,q="";for(let K=L;K>0;K--)H=1<<K-1,q+=(F&H?1:0)+(j&H?2:0);return q}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(l==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,s>1?"@2x":"").replace(/{quadkey}/g,P).replace(/{bbox-epsg-3857}/g,f)}isChildOf(t){const s=this.z-t.z;return s>0&&t.x===this.x>>s&&t.y===this.y>>s}getTilePoint(t){const s=Math.pow(2,this.z);return new R((t.x*s-this.x)*Ri,(t.y*s-this.y)*Ri)}toString(){return`${this.z}/${this.x}/${this.y}`}}class L_{constructor(t,s){this.wrap=t,this.canonical=s,this.key=ph(t,s.z,s.z,s.x,s.y)}}class ur{constructor(t,s,l,f,_){if(t<l)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${l}`);this.overscaledZ=t,this.wrap=s,this.canonical=new Gf(l,+f,+_),this.key=ph(s,t,l,f,_)}clone(){return new ur(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-t;return t>this.canonical.z?new ur(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ur(t,this.wrap,t,this.canonical.x>>s,this.canonical.y>>s)}calculateScaledKey(t,s){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const l=this.canonical.z-t;return t>this.canonical.z?ph(this.wrap*+s,t,this.canonical.z,this.canonical.x,this.canonical.y):ph(this.wrap*+s,t,t,this.canonical.x>>l,this.canonical.y>>l)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const s=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>s&&t.canonical.y===this.canonical.y>>s}children(t){if(this.overscaledZ>=t)return[new ur(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const s=this.canonical.z+1,l=2*this.canonical.x,f=2*this.canonical.y;return[new ur(s,this.wrap,s,l,f),new ur(s,this.wrap,s,l+1,f),new ur(s,this.wrap,s,l,f+1),new ur(s,this.wrap,s,l+1,f+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new ur(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new ur(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new L_(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new dh(t.x-this.wrap,t.y))}}function ph(r,t,s,l,f){(r*=2)<0&&(r=-1*r-1);const _=1<<s;return(_*_*r+_*f+l).toString(36)+s.toString(36)+t.toString(36)}Xe("CanonicalTileID",Gf),Xe("OverscaledTileID",ur,{omit:["posMatrix"]});class O_{constructor(t,s,l,f=1,_=1,x=1,v=0){if(this.uid=t,s.height!==s.width)throw new RangeError("DEM tiles must be square");if(l&&!["mapbox","terrarium","custom"].includes(l))return void Rt(`"${l}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=s.height;const S=this.dim=s.height-2;switch(this.data=new Uint32Array(s.data.buffer),l){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=f,this.greenFactor=_,this.blueFactor=x,this.baseShift=v;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let C=0;C<S;C++)this.data[this._idx(-1,C)]=this.data[this._idx(0,C)],this.data[this._idx(S,C)]=this.data[this._idx(S-1,C)],this.data[this._idx(C,-1)]=this.data[this._idx(C,0)],this.data[this._idx(C,S)]=this.data[this._idx(C,S-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(S,-1)]=this.data[this._idx(S-1,0)],this.data[this._idx(-1,S)]=this.data[this._idx(0,S-1)],this.data[this._idx(S,S)]=this.data[this._idx(S-1,S-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let C=0;C<S;C++)for(let P=0;P<S;P++){const L=this.get(C,P);L>this.max&&(this.max=L),L<this.min&&(this.min=L)}}get(t,s){const l=new Uint8Array(this.data.buffer),f=4*this._idx(t,s);return this.unpack(l[f],l[f+1],l[f+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,s){if(t<-1||t>=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+(t+1)}unpack(t,s,l){return t*this.redFactor+s*this.greenFactor+l*this.blueFactor-this.baseShift}getPixels(){return new hr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,s,l){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let f=s*this.dim,_=s*this.dim+this.dim,x=l*this.dim,v=l*this.dim+this.dim;switch(s){case-1:f=_-1;break;case 1:_=f+1}switch(l){case-1:x=v-1;break;case 1:v=x+1}const S=-s*this.dim,C=-l*this.dim;for(let P=x;P<v;P++)for(let L=f;L<_;L++)this.data[this._idx(L,P)]=t.data[this._idx(L+S,P+C)]}}Xe("DEMData",O_);class B_{constructor(t){this._stringToNumber={},this._numberToString=[];for(let s=0;s<t.length;s++){const l=t[s];this._stringToNumber[l]=s,this._numberToString[s]=l}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class F_{constructor(t,s,l,f,_){this.type="Feature",this._vectorTileFeature=t,t._z=s,t._x=l,t._y=f,this.properties=t.properties,this.id=_}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(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const s in this)s!=="_geometry"&&s!=="_vectorTileFeature"&&(t[s]=this[s]);return t}}class N_{constructor(t,s){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new yo(Ri,16,0),this.grid3D=new yo(Ri,16,0),this.featureIndexArray=new ln,this.promoteId=s}insert(t,s,l,f,_,x){const v=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(l,f,_);const S=x?this.grid3D:this.grid;for(let C=0;C<s.length;C++){const P=s[C],L=[1/0,1/0,-1/0,-1/0];for(let F=0;F<P.length;F++){const j=P[F];L[0]=Math.min(L[0],j.x),L[1]=Math.min(L[1],j.y),L[2]=Math.max(L[2],j.x),L[3]=Math.max(L[3],j.y)}L[0]<Ri&&L[1]<Ri&&L[2]>=0&&L[3]>=0&&S.insert(v,L[0],L[1],L[2],L[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Mo.VectorTile(new Of(this.rawTileData)).layers,this.sourceLayerCoder=new B_(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,s,l,f){this.loadVTLayers();const _=t.params||{},x=Ri/t.tileSize/t.scale,v=Dc(_.filter),S=t.queryGeometry,C=t.queryPadding*x,P=$_(S),L=this.grid.query(P.minX-C,P.minY-C,P.maxX+C,P.maxY+C),F=$_(t.cameraQueryGeometry),j=this.grid3D.query(F.minX-C,F.minY-C,F.maxX+C,F.maxY+C,(K,ie,ge,le)=>function(fe,we,Pe,qe,ut){for(const Ve of fe)if(we<=Ve.x&&Pe<=Ve.y&&qe>=Ve.x&&ut>=Ve.y)return!0;const je=[new R(we,Pe),new R(we,ut),new R(qe,ut),new R(qe,Pe)];if(fe.length>2){for(const Ve of je)if(Ml(fe,Ve))return!0}for(let Ve=0;Ve<fe.length-1;Ve++)if(hI(fe[Ve],fe[Ve+1],je))return!0;return!1}(t.cameraQueryGeometry,K-C,ie-C,ge+C,le+C));for(const K of j)L.push(K);L.sort(AA);const H={};let q;for(let K=0;K<L.length;K++){const ie=L[K];if(ie===q)continue;q=ie;const ge=this.featureIndexArray.get(ie);let le=null;this.loadMatchingFeature(H,ge.bucketIndex,ge.sourceLayerIndex,ge.featureIndex,v,_.layers,_.availableImages,s,l,f,(fe,we,Pe)=>(le||(le=xa(fe)),we.queryIntersectsFeature(S,fe,Pe,le,this.z,t.transform,x,t.pixelPosMatrix)))}return H}loadMatchingFeature(t,s,l,f,_,x,v,S,C,P,L){const F=this.bucketLayerIDs[s];if(x&&!function(K,ie){for(let ge=0;ge<K.length;ge++)if(ie.indexOf(K[ge])>=0)return!0;return!1}(x,F))return;const j=this.sourceLayerCoder.decode(l),H=this.vtLayers[j].feature(f);if(_.needGeometry){const K=ba(H,!0);if(!_.filter(new fi(this.tileID.overscaledZ),K,this.tileID.canonical))return}else if(!_.filter(new fi(this.tileID.overscaledZ),H))return;const q=this.getId(H,j);for(let K=0;K<F.length;K++){const ie=F[K];if(x&&x.indexOf(ie)<0)continue;const ge=S[ie];if(!ge)continue;let le={};q&&P&&(le=P.getState(ge.sourceLayer||"_geojsonTileLayer",q));const fe=Be({},C[ie]);fe.paint=V_(fe.paint,ge.paint,H,le,v),fe.layout=V_(fe.layout,ge.layout,H,le,v);const we=!L||L(H,ge,le);if(!we)continue;const Pe=new F_(H,this.z,this.x,this.y,q);Pe.layer=fe;let qe=t[ie];qe===void 0&&(qe=t[ie]=[]),qe.push({featureIndex:f,feature:Pe,intersectionZ:we})}}lookupSymbolFeatures(t,s,l,f,_,x,v,S){const C={};this.loadVTLayers();const P=Dc(_);for(const L of t)this.loadMatchingFeature(C,l,f,L,P,x,v,S,s);return C}hasLayer(t){for(const s of this.bucketLayerIDs)for(const l of s)if(t===l)return!0;return!1}getId(t,s){let l=t.id;return this.promoteId&&(l=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[s]],typeof l=="boolean"&&(l=Number(l))),l}}function V_(r,t,s,l,f){return rt(r,(_,x)=>{const v=t instanceof ma?t.get(x):null;return v&&v.evaluate?v.evaluate(s,l,f):v})}function $_(r){let t=1/0,s=1/0,l=-1/0,f=-1/0;for(const _ of r)t=Math.min(t,_.x),s=Math.min(s,_.y),l=Math.max(l,_.x),f=Math.max(f,_.y);return{minX:t,minY:s,maxX:l,maxY:f}}function AA(r,t){return t-r}function j_(r,t,s,l,f){const _=[];for(let x=0;x<r.length;x++){const v=r[x];let S;for(let C=0;C<v.length-1;C++){let P=v[C],L=v[C+1];P.x<t&&L.x<t||(P.x<t?P=new R(t,P.y+(t-P.x)/(L.x-P.x)*(L.y-P.y))._round():L.x<t&&(L=new R(t,P.y+(t-P.x)/(L.x-P.x)*(L.y-P.y))._round()),P.y<s&&L.y<s||(P.y<s?P=new R(P.x+(s-P.y)/(L.y-P.y)*(L.x-P.x),s)._round():L.y<s&&(L=new R(P.x+(s-P.y)/(L.y-P.y)*(L.x-P.x),s)._round()),P.x>=l&&L.x>=l||(P.x>=l?P=new R(l,P.y+(l-P.x)/(L.x-P.x)*(L.y-P.y))._round():L.x>=l&&(L=new R(l,P.y+(l-P.x)/(L.x-P.x)*(L.y-P.y))._round()),P.y>=f&&L.y>=f||(P.y>=f?P=new R(P.x+(f-P.y)/(L.y-P.y)*(L.x-P.x),f)._round():L.y>=f&&(L=new R(P.x+(f-P.y)/(L.y-P.y)*(L.x-P.x),f)._round()),S&&P.equals(S[S.length-1])||(S=[P],_.push(S)),S.push(L)))))}}return _}Xe("FeatureIndex",N_,{omit:["rawTileData","sourceLayerCoder"]});class Do extends R{constructor(t,s,l,f){super(t,s),this.angle=l,f!==void 0&&(this.segment=f)}clone(){return new Do(this.x,this.y,this.angle,this.segment)}}function U_(r,t,s,l,f){if(t.segment===void 0||s===0)return!0;let _=t,x=t.segment+1,v=0;for(;v>-s/2;){if(x--,x<0)return!1;v-=r[x].dist(_),_=r[x]}v+=r[x].dist(r[x+1]),x++;const S=[];let C=0;for(;v<s/2;){const P=r[x],L=r[x+1];if(!L)return!1;let F=r[x-1].angleTo(P)-P.angleTo(L);for(F=Math.abs((F+3*Math.PI)%(2*Math.PI)-Math.PI),S.push({distance:v,angleDelta:F}),C+=F;v-S[0].distance>l;)C-=S.shift().angleDelta;if(C>f)return!1;x++,v+=P.dist(L)}return!0}function H_(r){let t=0;for(let s=0;s<r.length-1;s++)t+=r[s].dist(r[s+1]);return t}function q_(r,t,s){return r?.6*t*s:0}function Z_(r,t){return Math.max(r?r.right-r.left:0,t?t.right-t.left:0)}function DA(r,t,s,l,f,_){const x=q_(s,f,_),v=Z_(s,l)*_;let S=0;const C=H_(r)/2;for(let P=0;P<r.length-1;P++){const L=r[P],F=r[P+1],j=L.dist(F);if(S+j>C){const H=(C-S)/j,q=mn.number(L.x,F.x,H),K=mn.number(L.y,F.y,H),ie=new Do(q,K,F.angleTo(L),P);return ie._round(),!x||U_(r,ie,v,x,t)?ie:void 0}S+=j}}function zA(r,t,s,l,f,_,x,v,S){const C=q_(l,_,x),P=Z_(l,f),L=P*x,F=r[0].x===0||r[0].x===S||r[0].y===0||r[0].y===S;return t-L<t/4&&(t=L+t/4),W_(r,F?t/2*v%t:(P/2+2*_)*x*v%t,t,C,s,L,F,!1,S)}function W_(r,t,s,l,f,_,x,v,S){const C=_/2,P=H_(r);let L=0,F=t-s,j=[];for(let H=0;H<r.length-1;H++){const q=r[H],K=r[H+1],ie=q.dist(K),ge=K.angleTo(q);for(;F+s<L+ie;){F+=s;const le=(F-L)/ie,fe=mn.number(q.x,K.x,le),we=mn.number(q.y,K.y,le);if(fe>=0&&fe<S&&we>=0&&we<S&&F-C>=0&&F+C<=P){const Pe=new Do(fe,we,ge,H);Pe._round(),l&&!U_(r,Pe,_,l,f)||j.push(Pe)}}L+=ie}return v||j.length||x||(j=W_(r,L/2,s,l,f,_,x,!0,S)),j}Xe("Anchor",Do);const Ol=Rn;function G_(r,t,s,l){const f=[],_=r.image,x=_.pixelRatio,v=_.paddedRect.w-2*Ol,S=_.paddedRect.h-2*Ol;let C={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const P=_.stretchX||[[0,v]],L=_.stretchY||[[0,S]],F=(Te,at)=>Te+at[1]-at[0],j=P.reduce(F,0),H=L.reduce(F,0),q=v-j,K=S-H;let ie=0,ge=j,le=0,fe=H,we=0,Pe=q,qe=0,ut=K;if(_.content&&l){const Te=_.content,at=Te[2]-Te[0],it=Te[3]-Te[1];(_.textFitWidth||_.textFitHeight)&&(C=v_(r)),ie=cd(P,0,Te[0]),le=cd(L,0,Te[1]),ge=cd(P,Te[0],Te[2]),fe=cd(L,Te[1],Te[3]),we=Te[0]-ie,qe=Te[1]-le,Pe=at-ge,ut=it-fe}const je=C.x1,Ve=C.y1,nt=C.x2-je,Ke=C.y2-Ve,Ge=(Te,at,it,_t)=>{const ci=hd(Te.stretch-ie,ge,nt,je),ai=ud(Te.fixed-we,Pe,Te.stretch,j),Ni=hd(at.stretch-le,fe,Ke,Ve),zr=ud(at.fixed-qe,ut,at.stretch,H),en=hd(it.stretch-ie,ge,nt,je),Vi=ud(it.fixed-we,Pe,it.stretch,j),xn=hd(_t.stretch-le,fe,Ke,Ve),bn=ud(_t.fixed-qe,ut,_t.stretch,H),vn=new R(ci,Ni),Pi=new R(en,Ni),$i=new R(en,xn),hn=new R(ci,xn),tn=new R(ai/x,zr/x),wn=new R(Vi/x,bn/x),nn=t*Math.PI/180;if(nn){const qt=Math.sin(nn),ui=Math.cos(nn),_i=[ui,-qt,qt,ui];vn._matMult(_i),Pi._matMult(_i),hn._matMult(_i),$i._matMult(_i)}const dr=Te.stretch+Te.fixed,Ln=at.stretch+at.fixed;return{tl:vn,tr:Pi,bl:hn,br:$i,tex:{x:_.paddedRect.x+Ol+dr,y:_.paddedRect.y+Ol+Ln,w:it.stretch+it.fixed-dr,h:_t.stretch+_t.fixed-Ln},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:tn,pixelOffsetBR:wn,minFontScaleX:Pe/x/nt,minFontScaleY:ut/x/Ke,isSDF:s}};if(l&&(_.stretchX||_.stretchY)){const Te=Y_(P,q,j),at=Y_(L,K,H);for(let it=0;it<Te.length-1;it++){const _t=Te[it],ci=Te[it+1];for(let ai=0;ai<at.length-1;ai++)f.push(Ge(_t,at[ai],ci,at[ai+1]))}}else f.push(Ge({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:v+1},{fixed:0,stretch:S+1}));return f}function cd(r,t,s){let l=0;for(const f of r)l+=Math.max(t,Math.min(s,f[1]))-Math.max(t,Math.min(s,f[0]));return l}function Y_(r,t,s){const l=[{fixed:-Ol,stretch:0}];for(const[f,_]of r){const x=l[l.length-1];l.push({fixed:f-x.stretch,stretch:x.stretch}),l.push({fixed:f-x.stretch,stretch:x.stretch+(_-f)})}return l.push({fixed:t+Ol,stretch:s}),l}function hd(r,t,s,l){return r/t*s+l}function ud(r,t,s,l){return r-t*s/l}class dd{constructor(t,s,l,f,_,x,v,S,C,P){var L;if(this.boxStartIndex=t.length,C){let F=x.top,j=x.bottom;const H=x.collisionPadding;H&&(F-=H[1],j+=H[3]);let q=j-F;q>0&&(q=Math.max(10,q),this.circleDiameter=q)}else{const F=!((L=x.image)===null||L===void 0)&&L.content&&(x.image.textFitWidth||x.image.textFitHeight)?v_(x):{x1:x.left,y1:x.top,x2:x.right,y2:x.bottom};F.y1=F.y1*v-S[0],F.y2=F.y2*v+S[2],F.x1=F.x1*v-S[3],F.x2=F.x2*v+S[1];const j=x.collisionPadding;if(j&&(F.x1-=j[0]*v,F.y1-=j[1]*v,F.x2+=j[2]*v,F.y2+=j[3]*v),P){const H=new R(F.x1,F.y1),q=new R(F.x2,F.y1),K=new R(F.x1,F.y2),ie=new R(F.x2,F.y2),ge=P*Math.PI/180;H._rotate(ge),q._rotate(ge),K._rotate(ge),ie._rotate(ge),F.x1=Math.min(H.x,q.x,K.x,ie.x),F.x2=Math.max(H.x,q.x,K.x,ie.x),F.y1=Math.min(H.y,q.y,K.y,ie.y),F.y2=Math.max(H.y,q.y,K.y,ie.y)}t.emplaceBack(s.x,s.y,F.x1,F.y1,F.x2,F.y2,l,f,_)}this.boxEndIndex=t.length}}class RA{constructor(t=[],s=(l,f)=>l<f?-1:l>f?1:0){if(this.data=t,this.length=this.data.length,this.compare=s,this.length>0)for(let l=(this.length>>1)-1;l>=0;l--)this._down(l)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],s=this.data.pop();return--this.length>0&&(this.data[0]=s,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:s,compare:l}=this,f=s[t];for(;t>0;){const _=t-1>>1,x=s[_];if(l(f,x)>=0)break;s[t]=x,t=_}s[t]=f}_down(t){const{data:s,compare:l}=this,f=this.length>>1,_=s[t];for(;t<f;){let x=1+(t<<1);const v=x+1;if(v<this.length&&l(s[v],s[x])<0&&(x=v),l(s[x],_)>=0)break;s[t]=s[x],t=x}s[t]=_}}function LA(r,t=1,s=!1){let l=1/0,f=1/0,_=-1/0,x=-1/0;const v=r[0];for(let j=0;j<v.length;j++){const H=v[j];(!j||H.x<l)&&(l=H.x),(!j||H.y<f)&&(f=H.y),(!j||H.x>_)&&(_=H.x),(!j||H.y>x)&&(x=H.y)}const S=Math.min(_-l,x-f);let C=S/2;const P=new RA([],OA);if(S===0)return new R(l,f);for(let j=l;j<_;j+=S)for(let H=f;H<x;H+=S)P.push(new Bl(j+C,H+C,C,r));let L=function(j){let H=0,q=0,K=0;const ie=j[0];for(let ge=0,le=ie.length,fe=le-1;ge<le;fe=ge++){const we=ie[ge],Pe=ie[fe],qe=we.x*Pe.y-Pe.x*we.y;q+=(we.x+Pe.x)*qe,K+=(we.y+Pe.y)*qe,H+=3*qe}return new Bl(q/H,K/H,0,j)}(r),F=P.length;for(;P.length;){const j=P.pop();(j.d>L.d||!L.d)&&(L=j,s&&console.log("found best %d after %d probes",Math.round(1e4*j.d)/1e4,F)),j.max-L.d<=t||(C=j.h/2,P.push(new Bl(j.p.x-C,j.p.y-C,C,r)),P.push(new Bl(j.p.x+C,j.p.y-C,C,r)),P.push(new Bl(j.p.x-C,j.p.y+C,C,r)),P.push(new Bl(j.p.x+C,j.p.y+C,C,r)),F+=4)}return s&&(console.log(`num probes: ${F}`),console.log(`best distance: ${L.d}`)),L.p}function OA(r,t){return t.max-r.max}function Bl(r,t,s,l){this.p=new R(r,t),this.h=s,this.d=function(f,_){let x=!1,v=1/0;for(let S=0;S<_.length;S++){const C=_[S];for(let P=0,L=C.length,F=L-1;P<L;F=P++){const j=C[P],H=C[F];j.y>f.y!=H.y>f.y&&f.x<(H.x-j.x)*(f.y-j.y)/(H.y-j.y)+j.x&&(x=!x),v=Math.min(v,D0(f,j,H))}}return(x?1:-1)*Math.sqrt(v)}(this.p,l),this.max=this.d+this.h*Math.SQRT2}var Qi;y.aq=void 0,(Qi=y.aq||(y.aq={}))[Qi.center=1]="center",Qi[Qi.left=2]="left",Qi[Qi.right=3]="right",Qi[Qi.top=4]="top",Qi[Qi.bottom=5]="bottom",Qi[Qi["top-left"]=6]="top-left",Qi[Qi["top-right"]=7]="top-right",Qi[Qi["bottom-left"]=8]="bottom-left",Qi[Qi["bottom-right"]=9]="bottom-right";const zo=7,Yf=Number.POSITIVE_INFINITY;function X_(r,t){return t[1]!==Yf?function(s,l,f){let _=0,x=0;switch(l=Math.abs(l),f=Math.abs(f),s){case"top-right":case"top-left":case"top":x=f-zo;break;case"bottom-right":case"bottom-left":case"bottom":x=-f+zo}switch(s){case"top-right":case"bottom-right":case"right":_=-l;break;case"top-left":case"bottom-left":case"left":_=l}return[_,x]}(r,t[0],t[1]):function(s,l){let f=0,_=0;l<0&&(l=0);const x=l/Math.SQRT2;switch(s){case"top-right":case"top-left":_=x-zo;break;case"bottom-right":case"bottom-left":_=-x+zo;break;case"bottom":_=-l+zo;break;case"top":_=l-zo}switch(s){case"top-right":case"bottom-right":f=-x;break;case"top-left":case"bottom-left":f=x;break;case"left":f=l;break;case"right":f=-l}return[f,_]}(r,t[0])}function K_(r,t,s){var l;const f=r.layout,_=(l=f.get("text-variable-anchor-offset"))===null||l===void 0?void 0:l.evaluate(t,{},s);if(_){const v=_.values,S=[];for(let C=0;C<v.length;C+=2){const P=S[C]=v[C],L=v[C+1].map(F=>F*Oi);P.startsWith("top")?L[1]-=zo:P.startsWith("bottom")&&(L[1]+=zo),S[C+1]=L}return new Hn(S)}const x=f.get("text-variable-anchor");if(x){let v;v=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[f.get("text-radial-offset").evaluate(t,{},s)*Oi,Yf]:f.get("text-offset").evaluate(t,{},s).map(C=>C*Oi);const S=[];for(const C of x)S.push(C,X_(C,v));return new Hn(S)}return null}function Xf(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 BA(r,t,s,l,f,_,x,v,S,C,P){let L=_.textMaxSize.evaluate(t,{});L===void 0&&(L=x);const F=r.layers[0].layout,j=F.get("icon-offset").evaluate(t,{},P),H=Q_(s.horizontal),q=x/24,K=r.tilePixelRatio*q,ie=r.tilePixelRatio*L/24,ge=r.tilePixelRatio*v,le=r.tilePixelRatio*F.get("symbol-spacing"),fe=F.get("text-padding")*r.tilePixelRatio,we=function(Te,at,it,_t=1){const ci=Te.get("icon-padding").evaluate(at,{},it),ai=ci&&ci.values;return[ai[0]*_t,ai[1]*_t,ai[2]*_t,ai[3]*_t]}(F,t,P,r.tilePixelRatio),Pe=F.get("text-max-angle")/180*Math.PI,qe=F.get("text-rotation-alignment")!=="viewport"&&F.get("symbol-placement")!=="point",ut=F.get("icon-rotation-alignment")==="map"&&F.get("symbol-placement")!=="point",je=F.get("symbol-placement"),Ve=le/2,nt=F.get("icon-text-fit");let Ke;l&&nt!=="none"&&(r.allowVerticalPlacement&&s.vertical&&(Ke=w_(l,s.vertical,nt,F.get("icon-text-fit-padding"),j,q)),H&&(l=w_(l,H,nt,F.get("icon-text-fit-padding"),j,q)));const Ge=(Te,at)=>{at.x<0||at.x>=Ri||at.y<0||at.y>=Ri||function(it,_t,ci,ai,Ni,zr,en,Vi,xn,bn,vn,Pi,$i,hn,tn,wn,nn,dr,Ln,qt,ui,_i,Kn,Ei,Fl){const hs=it.addToLineVertexArray(_t,ci);let us,Rr,pr,Wi,js=0,gh=0,nx=0,rx=0,rm=-1,sm=-1;const Us={};let sx=Sl("");if(it.allowVerticalPlacement&&ai.vertical){const un=Vi.layout.get("text-rotate").evaluate(ui,{},Ei)+90;pr=new dd(xn,_t,bn,vn,Pi,ai.vertical,$i,hn,tn,un),en&&(Wi=new dd(xn,_t,bn,vn,Pi,en,nn,dr,tn,un))}if(Ni){const un=Vi.layout.get("icon-rotate").evaluate(ui,{}),fr=Vi.layout.get("icon-text-fit")!=="none",wa=G_(Ni,un,Kn,fr),Wr=en?G_(en,un,Kn,fr):void 0;Rr=new dd(xn,_t,bn,vn,Pi,Ni,nn,dr,!1,un),js=4*wa.length;const ka=it.iconSizeData;let ds=null;ka.kind==="source"?(ds=[cs*Vi.layout.get("icon-size").evaluate(ui,{})],ds[0]>Io&&Rt(`${it.layerIds[0]}: Value for "icon-size" is >= ${uh}. Reduce your "icon-size".`)):ka.kind==="composite"&&(ds=[cs*_i.compositeIconSizes[0].evaluate(ui,{},Ei),cs*_i.compositeIconSizes[1].evaluate(ui,{},Ei)],(ds[0]>Io||ds[1]>Io)&&Rt(`${it.layerIds[0]}: Value for "icon-size" is >= ${uh}. Reduce your "icon-size".`)),it.addSymbols(it.icon,wa,ds,qt,Ln,ui,y.ah.none,_t,hs.lineStartIndex,hs.lineLength,-1,Ei),rm=it.icon.placedSymbolArray.length-1,Wr&&(gh=4*Wr.length,it.addSymbols(it.icon,Wr,ds,qt,Ln,ui,y.ah.vertical,_t,hs.lineStartIndex,hs.lineLength,-1,Ei),sm=it.icon.placedSymbolArray.length-1)}const ox=Object.keys(ai.horizontal);for(const un of ox){const fr=ai.horizontal[un];if(!us){sx=Sl(fr.text);const Wr=Vi.layout.get("text-rotate").evaluate(ui,{},Ei);us=new dd(xn,_t,bn,vn,Pi,fr,$i,hn,tn,Wr)}const wa=fr.positionedLines.length===1;if(nx+=J_(it,_t,fr,zr,Vi,tn,ui,wn,hs,ai.vertical?y.ah.horizontal:y.ah.horizontalOnly,wa?ox:[un],Us,rm,_i,Ei),wa)break}ai.vertical&&(rx+=J_(it,_t,ai.vertical,zr,Vi,tn,ui,wn,hs,y.ah.vertical,["vertical"],Us,sm,_i,Ei));const VA=us?us.boxStartIndex:it.collisionBoxArray.length,$A=us?us.boxEndIndex:it.collisionBoxArray.length,jA=pr?pr.boxStartIndex:it.collisionBoxArray.length,UA=pr?pr.boxEndIndex:it.collisionBoxArray.length,HA=Rr?Rr.boxStartIndex:it.collisionBoxArray.length,qA=Rr?Rr.boxEndIndex:it.collisionBoxArray.length,ZA=Wi?Wi.boxStartIndex:it.collisionBoxArray.length,WA=Wi?Wi.boxEndIndex:it.collisionBoxArray.length;let Zr=-1;const fd=(un,fr)=>un&&un.circleDiameter?Math.max(un.circleDiameter,fr):fr;Zr=fd(us,Zr),Zr=fd(pr,Zr),Zr=fd(Rr,Zr),Zr=fd(Wi,Zr);const ax=Zr>-1?1:0;ax&&(Zr*=Fl/Oi),it.glyphOffsetArray.length>=Ll.MAX_GLYPHS&&Rt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ui.sortKey!==void 0&&it.addToSortKeyRanges(it.symbolInstances.length,ui.sortKey);const GA=K_(Vi,ui,Ei),[YA,XA]=function(un,fr){const wa=un.length,Wr=fr==null?void 0:fr.values;if((Wr==null?void 0:Wr.length)>0)for(let ka=0;ka<Wr.length;ka+=2){const ds=Wr[ka+1];un.emplaceBack(y.aq[Wr[ka]],ds[0],ds[1])}return[wa,un.length]}(it.textAnchorOffsets,GA);it.symbolInstances.emplaceBack(_t.x,_t.y,Us.right>=0?Us.right:-1,Us.center>=0?Us.center:-1,Us.left>=0?Us.left:-1,Us.vertical||-1,rm,sm,sx,VA,$A,jA,UA,HA,qA,ZA,WA,bn,nx,rx,js,gh,ax,0,$i,Zr,YA,XA)}(r,at,Te,s,l,f,Ke,r.layers[0],r.collisionBoxArray,t.index,t.sourceLayerIndex,r.index,K,[fe,fe,fe,fe],qe,S,ge,we,ut,j,t,_,C,P,x)};if(je==="line")for(const Te of j_(t.geometry,0,0,Ri,Ri)){const at=zA(Te,le,Pe,s.vertical||H,l,24,ie,r.overscaling,Ri);for(const it of at)H&&FA(r,H.text,Ve,it)||Ge(Te,it)}else if(je==="line-center"){for(const Te of t.geometry)if(Te.length>1){const at=DA(Te,Pe,s.vertical||H,l,24,ie);at&&Ge(Te,at)}}else if(t.type==="Polygon")for(const Te of el(t.geometry,0)){const at=LA(Te,16);Ge(Te[0],new Do(at.x,at.y,0))}else if(t.type==="LineString")for(const Te of t.geometry)Ge(Te,new Do(Te[0].x,Te[0].y,0));else if(t.type==="Point")for(const Te of t.geometry)for(const at of Te)Ge([at],new Do(at.x,at.y,0))}function J_(r,t,s,l,f,_,x,v,S,C,P,L,F,j,H){const q=function(ge,le,fe,we,Pe,qe,ut,je){const Ve=we.layout.get("text-rotate").evaluate(qe,{})*Math.PI/180,nt=[];for(const Ke of le.positionedLines)for(const Ge of Ke.positionedGlyphs){if(!Ge.rect)continue;const Te=Ge.rect||{};let at=f_+1,it=!0,_t=1,ci=0;const ai=(Pe||je)&&Ge.vertical,Ni=Ge.metrics.advance*Ge.scale/2;if(je&&le.verticalizable&&(ci=Ke.lineOffset/2-(Ge.imageName?-(Oi-Ge.metrics.width*Ge.scale)/2:(Ge.scale-1)*Oi)),Ge.imageName){const qt=ut[Ge.imageName];it=qt.sdf,_t=qt.pixelRatio,at=Rn/_t}const zr=Pe?[Ge.x+Ni,Ge.y]:[0,0];let en=Pe?[0,0]:[Ge.x+Ni+fe[0],Ge.y+fe[1]-ci],Vi=[0,0];ai&&(Vi=en,en=[0,0]);const xn=Ge.metrics.isDoubleResolution?2:1,bn=(Ge.metrics.left-at)*Ge.scale-Ni+en[0],vn=(-Ge.metrics.top-at)*Ge.scale+en[1],Pi=bn+Te.w/xn*Ge.scale/_t,$i=vn+Te.h/xn*Ge.scale/_t,hn=new R(bn,vn),tn=new R(Pi,vn),wn=new R(bn,$i),nn=new R(Pi,$i);if(ai){const qt=new R(-Ni,Ni-ch),ui=-Math.PI/2,_i=Oi/2-Ni,Kn=new R(5-ch-_i,-(Ge.imageName?_i:0)),Ei=new R(...Vi);hn._rotateAround(ui,qt)._add(Kn)._add(Ei),tn._rotateAround(ui,qt)._add(Kn)._add(Ei),wn._rotateAround(ui,qt)._add(Kn)._add(Ei),nn._rotateAround(ui,qt)._add(Kn)._add(Ei)}if(Ve){const qt=Math.sin(Ve),ui=Math.cos(Ve),_i=[ui,-qt,qt,ui];hn._matMult(_i),tn._matMult(_i),wn._matMult(_i),nn._matMult(_i)}const dr=new R(0,0),Ln=new R(0,0);nt.push({tl:hn,tr:tn,bl:wn,br:nn,tex:Te,writingMode:le.writingMode,glyphOffset:zr,sectionIndex:Ge.sectionIndex,isSDF:it,pixelOffsetTL:dr,pixelOffsetBR:Ln,minFontScaleX:0,minFontScaleY:0})}return nt}(0,s,v,f,_,x,l,r.allowVerticalPlacement),K=r.textSizeData;let ie=null;K.kind==="source"?(ie=[cs*f.layout.get("text-size").evaluate(x,{})],ie[0]>Io&&Rt(`${r.layerIds[0]}: Value for "text-size" is >= ${uh}. Reduce your "text-size".`)):K.kind==="composite"&&(ie=[cs*j.compositeTextSizes[0].evaluate(x,{},H),cs*j.compositeTextSizes[1].evaluate(x,{},H)],(ie[0]>Io||ie[1]>Io)&&Rt(`${r.layerIds[0]}: Value for "text-size" is >= ${uh}. Reduce your "text-size".`)),r.addSymbols(r.text,q,ie,v,_,x,C,t,S.lineStartIndex,S.lineLength,F,H);for(const ge of P)L[ge]=r.text.placedSymbolArray.length-1;return 4*q.length}function Q_(r){for(const t in r)return r[t];return null}function FA(r,t,s,l){const f=r.compareText;if(t in f){const _=f[t];for(let x=_.length-1;x>=0;x--)if(l.dist(_[x])<s)return!0}else f[t]=[];return f[t].push(l),!1}const ex=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Kf{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[s,l]=new Uint8Array(t,0,2);if(s!==219)throw new Error("Data does not appear to be in a KDBush format.");const f=l>>4;if(f!==1)throw new Error(`Got v${f} data when expected v1.`);const _=ex[15&l];if(!_)throw new Error("Unrecognized array type.");const[x]=new Uint16Array(t,2,1),[v]=new Uint32Array(t,4,1);return new Kf(v,x,_,t)}constructor(t,s=64,l=Float64Array,f){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+s,2),65535),this.ArrayType=l,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const _=ex.indexOf(this.ArrayType),x=2*t*this.ArrayType.BYTES_PER_ELEMENT,v=t*this.IndexArrayType.BYTES_PER_ELEMENT,S=(8-v%8)%8;if(_<0)throw new Error(`Unexpected typed array class: ${l}.`);f&&f instanceof ArrayBuffer?(this.data=f,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+v+S,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+x+v+S),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+v+S,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+_]),new Uint16Array(this.data,2,1)[0]=s,new Uint32Array(this.data,4,1)[0]=t)}add(t,s){const l=this._pos>>1;return this.ids[l]=l,this.coords[this._pos++]=t,this.coords[this._pos++]=s,l}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Jf(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,s,l,f){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:x,nodeSize:v}=this,S=[0,_.length-1,0],C=[];for(;S.length;){const P=S.pop()||0,L=S.pop()||0,F=S.pop()||0;if(L-F<=v){for(let K=F;K<=L;K++){const ie=x[2*K],ge=x[2*K+1];ie>=t&&ie<=l&&ge>=s&&ge<=f&&C.push(_[K])}continue}const j=F+L>>1,H=x[2*j],q=x[2*j+1];H>=t&&H<=l&&q>=s&&q<=f&&C.push(_[j]),(P===0?t<=H:s<=q)&&(S.push(F),S.push(j-1),S.push(1-P)),(P===0?l>=H:f>=q)&&(S.push(j+1),S.push(L),S.push(1-P))}return C}within(t,s,l){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:f,coords:_,nodeSize:x}=this,v=[0,f.length-1,0],S=[],C=l*l;for(;v.length;){const P=v.pop()||0,L=v.pop()||0,F=v.pop()||0;if(L-F<=x){for(let K=F;K<=L;K++)ix(_[2*K],_[2*K+1],t,s)<=C&&S.push(f[K]);continue}const j=F+L>>1,H=_[2*j],q=_[2*j+1];ix(H,q,t,s)<=C&&S.push(f[j]),(P===0?t-l<=H:s-l<=q)&&(v.push(F),v.push(j-1),v.push(1-P)),(P===0?t+l>=H:s+l>=q)&&(v.push(j+1),v.push(L),v.push(1-P))}return S}}function Jf(r,t,s,l,f,_){if(f-l<=s)return;const x=l+f>>1;tx(r,t,x,l,f,_),Jf(r,t,s,l,x-1,1-_),Jf(r,t,s,x+1,f,1-_)}function tx(r,t,s,l,f,_){for(;f>l;){if(f-l>600){const C=f-l+1,P=s-l+1,L=Math.log(C),F=.5*Math.exp(2*L/3),j=.5*Math.sqrt(L*F*(C-F)/C)*(P-C/2<0?-1:1);tx(r,t,s,Math.max(l,Math.floor(s-P*F/C+j)),Math.min(f,Math.floor(s+(C-P)*F/C+j)),_)}const x=t[2*s+_];let v=l,S=f;for(fh(r,t,l,s),t[2*f+_]>x&&fh(r,t,l,f);v<S;){for(fh(r,t,v,S),v++,S--;t[2*v+_]<x;)v++;for(;t[2*S+_]>x;)S--}t[2*l+_]===x?fh(r,t,l,S):(S++,fh(r,t,S,f)),S<=s&&(l=S+1),s<=S&&(f=S-1)}}function fh(r,t,s,l){Qf(r,s,l),Qf(t,2*s,2*l),Qf(t,2*s+1,2*l+1)}function Qf(r,t,s){const l=r[t];r[t]=r[s],r[s]=l}function ix(r,t,s,l){const f=r-s,_=t-l;return f*f+_*_}var em;y.bg=void 0,(em=y.bg||(y.bg={})).create="create",em.load="load",em.fullLoad="fullLoad";let pd=null,mh=[];const tm=1e3/60,im="loadTime",nm="fullLoadTime",NA={mark(r){performance.mark(r)},frame(r){const t=r;pd!=null&&mh.push(t-pd),pd=t},clearMetrics(){pd=null,mh=[],performance.clearMeasures(im),performance.clearMeasures(nm);for(const r in y.bg)performance.clearMarks(y.bg[r])},getPerformanceMetrics(){performance.measure(im,y.bg.create,y.bg.load),performance.measure(nm,y.bg.create,y.bg.fullLoad);const r=performance.getEntriesByName(im)[0].duration,t=performance.getEntriesByName(nm)[0].duration,s=mh.length,l=1/(mh.reduce((_,x)=>_+x,0)/s/1e3),f=mh.filter(_=>_>tm).reduce((_,x)=>_+(x-tm)/tm,0);return{loadTime:r,fullLoadTime:t,fps:l,percentDroppedFrames:f/(s+f)*100,totalFrames:s}}};y.$=class extends O{},y.A=Pl,y.B=uf,y.C=function(r){if(tr==null){const t=r.navigator?r.navigator.userAgent:null;tr=!!r.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return tr},y.D=et,y.E=ri,y.F=class{constructor(r,t){this.target=r,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new IA(()=>this.process()),this.subscription=function(s,l,f,_){return s.addEventListener(l,f,!1),{unsubscribe:()=>{s.removeEventListener(l,f,!1)}}}(this.target,"message",s=>this.receive(s)),this.globalScope=rn(self)?r:window}registerMessageHandler(r,t){this.messageHandlers[r]=t}sendAsync(r,t){return new Promise((s,l)=>{const f=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[f]={resolve:s,reject:l},t&&t.signal.addEventListener("abort",()=>{delete this.resolveRejects[f];const v={id:f,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(v)},{once:!0});const _=[],x=Object.assign(Object.assign({},r),{id:f,sourceMapId:this.mapId,origin:location.origin,data:_o(r.data,_)});this.target.postMessage(x,{transfer:_})})}receive(r){const t=r.data,s=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[s];const l=this.abortControllers[s];return delete this.abortControllers[s],void(l&&l.abort())}if(rn(self)||t.mustQueue)return this.tasks[s]=t,this.taskQueue.push(s),void this.invoker.trigger();this.processTask(s,t)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),t=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(r,t)}processTask(r,t){return h(this,void 0,void 0,function*(){if(t.type==="<response>"){const f=this.resolveRejects[r];return delete this.resolveRejects[r],f?void(t.error?f.reject(xo(t.error)):f.resolve(xo(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const s=xo(t.data),l=new AbortController;this.abortControllers[r]=l;try{const f=yield this.messageHandlers[t.type](t.sourceMapId,s,l);this.completeTask(r,null,f)}catch(f){this.completeTask(r,f)}})}completeTask(r,t,s){const l=[];delete this.abortControllers[r];const f={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?_o(t):null,data:_o(s,l)};this.target.postMessage(f,{transfer:l})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},y.G=Cn,y.H=function(){var r=new Pl(16);return Pl!=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},y.I=Ff,y.J=function(r,t,s){var l,f,_,x,v,S,C,P,L,F,j,H,q=s[0],K=s[1],ie=s[2];return t===r?(r[12]=t[0]*q+t[4]*K+t[8]*ie+t[12],r[13]=t[1]*q+t[5]*K+t[9]*ie+t[13],r[14]=t[2]*q+t[6]*K+t[10]*ie+t[14],r[15]=t[3]*q+t[7]*K+t[11]*ie+t[15]):(f=t[1],_=t[2],x=t[3],v=t[4],S=t[5],C=t[6],P=t[7],L=t[8],F=t[9],j=t[10],H=t[11],r[0]=l=t[0],r[1]=f,r[2]=_,r[3]=x,r[4]=v,r[5]=S,r[6]=C,r[7]=P,r[8]=L,r[9]=F,r[10]=j,r[11]=H,r[12]=l*q+v*K+L*ie+t[12],r[13]=f*q+S*K+F*ie+t[13],r[14]=_*q+C*K+j*ie+t[14],r[15]=x*q+P*K+H*ie+t[15]),r},y.K=function(r,t,s){var l=s[0],f=s[1],_=s[2];return r[0]=t[0]*l,r[1]=t[1]*l,r[2]=t[2]*l,r[3]=t[3]*l,r[4]=t[4]*f,r[5]=t[5]*f,r[6]=t[6]*f,r[7]=t[7]*f,r[8]=t[8]*_,r[9]=t[9]*_,r[10]=t[10]*_,r[11]=t[11]*_,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},y.L=O0,y.M=function(r,t){const s={};for(let l=0;l<t.length;l++){const f=t[l];f in r&&(s[f]=r[f])}return s},y.N=Ao,y.O=A_,y.P=R,y.Q=D_,y.R=hr,y.S=ur,y.T=xl,y.U=he,y.V=be,y.W=jn,y.X=Ri,y.Y=k,y.Z=dh,y._=h,y.a=En,y.a$=function(r,t){var s=r[0],l=r[1],f=r[2],_=r[3],x=r[4],v=r[5],S=r[6],C=r[7],P=r[8],L=r[9],F=r[10],j=r[11],H=r[12],q=r[13],K=r[14],ie=r[15],ge=t[0],le=t[1],fe=t[2],we=t[3],Pe=t[4],qe=t[5],ut=t[6],je=t[7],Ve=t[8],nt=t[9],Ke=t[10],Ge=t[11],Te=t[12],at=t[13],it=t[14],_t=t[15];return Math.abs(s-ge)<=_n*Math.max(1,Math.abs(s),Math.abs(ge))&&Math.abs(l-le)<=_n*Math.max(1,Math.abs(l),Math.abs(le))&&Math.abs(f-fe)<=_n*Math.max(1,Math.abs(f),Math.abs(fe))&&Math.abs(_-we)<=_n*Math.max(1,Math.abs(_),Math.abs(we))&&Math.abs(x-Pe)<=_n*Math.max(1,Math.abs(x),Math.abs(Pe))&&Math.abs(v-qe)<=_n*Math.max(1,Math.abs(v),Math.abs(qe))&&Math.abs(S-ut)<=_n*Math.max(1,Math.abs(S),Math.abs(ut))&&Math.abs(C-je)<=_n*Math.max(1,Math.abs(C),Math.abs(je))&&Math.abs(P-Ve)<=_n*Math.max(1,Math.abs(P),Math.abs(Ve))&&Math.abs(L-nt)<=_n*Math.max(1,Math.abs(L),Math.abs(nt))&&Math.abs(F-Ke)<=_n*Math.max(1,Math.abs(F),Math.abs(Ke))&&Math.abs(j-Ge)<=_n*Math.max(1,Math.abs(j),Math.abs(Ge))&&Math.abs(H-Te)<=_n*Math.max(1,Math.abs(H),Math.abs(Te))&&Math.abs(q-at)<=_n*Math.max(1,Math.abs(q),Math.abs(at))&&Math.abs(K-it)<=_n*Math.max(1,Math.abs(K),Math.abs(it))&&Math.abs(ie-_t)<=_n*Math.max(1,Math.abs(ie),Math.abs(_t))},y.a0=Ft,y.a1=Gf,y.a2=De,y.a3=r=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(s=>{t.onloadstart=()=>{s(t)};for(const l of r){const f=window.document.createElement("source");lt(l)||(t.crossOrigin="Anonymous"),f.src=l,t.appendChild(f)}})},y.a4=function(){return St++},y.a5=Ue,y.a6=Ll,y.a7=Dc,y.a8=ba,y.a9=F_,y.aA=function(r){if(r.type==="custom")return new PA(r);switch(r.type){case"background":return new TA(r);case"circle":return new pI(r);case"fill":return new II(r);case"fill-extrusion":return new qI(r);case"heatmap":return new mI(r);case"hillshade":return new yI(r);case"line":return new QI(r);case"raster":return new MA(r);case"symbol":return new ld(r)}},y.aB=Mt,y.aC=function(r,t){if(!r)return[{command:"setStyle",args:[t]}];let s=[];try{if(!Zt(r.version,t.version))return[{command:"setStyle",args:[t]}];Zt(r.center,t.center)||s.push({command:"setCenter",args:[t.center]}),Zt(r.zoom,t.zoom)||s.push({command:"setZoom",args:[t.zoom]}),Zt(r.bearing,t.bearing)||s.push({command:"setBearing",args:[t.bearing]}),Zt(r.pitch,t.pitch)||s.push({command:"setPitch",args:[t.pitch]}),Zt(r.sprite,t.sprite)||s.push({command:"setSprite",args:[t.sprite]}),Zt(r.glyphs,t.glyphs)||s.push({command:"setGlyphs",args:[t.glyphs]}),Zt(r.transition,t.transition)||s.push({command:"setTransition",args:[t.transition]}),Zt(r.light,t.light)||s.push({command:"setLight",args:[t.light]}),Zt(r.terrain,t.terrain)||s.push({command:"setTerrain",args:[t.terrain]}),Zt(r.sky,t.sky)||s.push({command:"setSky",args:[t.sky]}),Zt(r.projection,t.projection)||s.push({command:"setProjection",args:[t.projection]});const l={},f=[];(function(x,v,S,C){let P;for(P in v=v||{},x=x||{})Object.prototype.hasOwnProperty.call(x,P)&&(Object.prototype.hasOwnProperty.call(v,P)||is(P,S,C));for(P in v)Object.prototype.hasOwnProperty.call(v,P)&&(Object.prototype.hasOwnProperty.call(x,P)?Zt(x[P],v[P])||(x[P].type==="geojson"&&v[P].type==="geojson"&&Js(x,v,P)?ki(S,{command:"setGeoJSONSourceData",args:[P,v[P].data]}):$r(P,v,S,C)):Yo(P,v,S))})(r.sources,t.sources,f,l);const _=[];r.layers&&r.layers.forEach(x=>{"source"in x&&l[x.source]?s.push({command:"removeLayer",args:[x.id]}):_.push(x)}),s=s.concat(f),function(x,v,S){v=v||[];const C=(x=x||[]).map(Xo),P=v.map(Xo),L=x.reduce(Ko,{}),F=v.reduce(Ko,{}),j=C.slice(),H=Object.create(null);let q,K,ie,ge,le;for(let fe=0,we=0;fe<C.length;fe++)q=C[fe],Object.prototype.hasOwnProperty.call(F,q)?we++:(ki(S,{command:"removeLayer",args:[q]}),j.splice(j.indexOf(q,we),1));for(let fe=0,we=0;fe<P.length;fe++)q=P[P.length-1-fe],j[j.length-1-fe]!==q&&(Object.prototype.hasOwnProperty.call(L,q)?(ki(S,{command:"removeLayer",args:[q]}),j.splice(j.lastIndexOf(q,j.length-we),1)):we++,ge=j[j.length-fe],ki(S,{command:"addLayer",args:[F[q],ge]}),j.splice(j.length-fe,0,q),H[q]=!0);for(let fe=0;fe<P.length;fe++)if(q=P[fe],K=L[q],ie=F[q],!H[q]&&!Zt(K,ie))if(Zt(K.source,ie.source)&&Zt(K["source-layer"],ie["source-layer"])&&Zt(K.type,ie.type)){for(le in Un(K.layout,ie.layout,S,q,null,"setLayoutProperty"),Un(K.paint,ie.paint,S,q,null,"setPaintProperty"),Zt(K.filter,ie.filter)||ki(S,{command:"setFilter",args:[q,ie.filter]}),Zt(K.minzoom,ie.minzoom)&&Zt(K.maxzoom,ie.maxzoom)||ki(S,{command:"setLayerZoomRange",args:[q,ie.minzoom,ie.maxzoom]}),K)Object.prototype.hasOwnProperty.call(K,le)&&le!=="layout"&&le!=="paint"&&le!=="filter"&&le!=="metadata"&&le!=="minzoom"&&le!=="maxzoom"&&(le.indexOf("paint.")===0?Un(K[le],ie[le],S,q,le.slice(6),"setPaintProperty"):Zt(K[le],ie[le])||ki(S,{command:"setLayerProperty",args:[q,le,ie[le]]}));for(le in ie)Object.prototype.hasOwnProperty.call(ie,le)&&!Object.prototype.hasOwnProperty.call(K,le)&&le!=="layout"&&le!=="paint"&&le!=="filter"&&le!=="metadata"&&le!=="minzoom"&&le!=="maxzoom"&&(le.indexOf("paint.")===0?Un(K[le],ie[le],S,q,le.slice(6),"setPaintProperty"):Zt(K[le],ie[le])||ki(S,{command:"setLayerProperty",args:[q,le,ie[le]]}))}else ki(S,{command:"removeLayer",args:[q]}),ge=j[j.lastIndexOf(q)+1],ki(S,{command:"addLayer",args:[ie,ge]})}(_,t.layers,s)}catch(l){console.warn("Unable to compute style diff:",l),s=[{command:"setStyle",args:[t]}]}return s},y.aD=function(r){const t=[],s=r.id;return s===void 0&&t.push({message:`layers.${s}: missing required property "id"`}),r.render===void 0&&t.push({message:`layers.${s}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&t.push({message:`layers.${s}: property "renderingMode" must be either "2d" or "3d"`}),t},y.aE=function r(t,s){if(Array.isArray(t)){if(!Array.isArray(s)||t.length!==s.length)return!1;for(let l=0;l<t.length;l++)if(!r(t[l],s[l]))return!1;return!0}if(typeof t=="object"&&t!==null&&s!==null){if(typeof s!="object"||Object.keys(t).length!==Object.keys(s).length)return!1;for(const l in t)if(!r(t[l],s[l]))return!1;return!0}return t===s},y.aF=rt,y.aG=Dt,y.aH=class extends ya{constructor(r,t){super(r,t),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},y.aI=Yu,y.aJ=class extends ya{constructor(r,t){super(r,t),this.current=sI}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 t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},y.aK=E0,y.aL=T0,y.aM=ti,y.aN=class extends ya{constructor(r,t){super(r,t),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]))}},y.aO=class extends ya{constructor(r,t){super(r,t),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]))}},y.aP=function(r,t,s,l,f,_,x){var v=1/(t-s),S=1/(l-f),C=1/(_-x);return r[0]=-2*v,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*S,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*C,r[11]=0,r[12]=(t+s)*v,r[13]=(f+l)*S,r[14]=(x+_)*C,r[15]=1,r},y.aQ=dI,y.aR=class extends ue{},y.aS=nA,y.aT=class extends ye{},y.aU=Tf,y.aV=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},y.aW=$0,y.aX=Ki,y.aY=cr,y.aZ=class extends tt{},y.a_=function(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]},y.aa=function(r){const t={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(s,l,f,_)=>{const x=f||_;return t[l]=!x||x.toLowerCase(),""}),t["max-age"]){const s=parseInt(t["max-age"],10);isNaN(s)?delete t["max-age"]:t["max-age"]=s}return t},y.ab=function(r,t){const s=[];for(const l in r)l in t||s.push(l);return s},y.ac=ot,y.ad=function(r,t,s){var l=Math.sin(s),f=Math.cos(s),_=t[0],x=t[1],v=t[2],S=t[3],C=t[4],P=t[5],L=t[6],F=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=_*f+C*l,r[1]=x*f+P*l,r[2]=v*f+L*l,r[3]=S*f+F*l,r[4]=C*f-_*l,r[5]=P*f-x*l,r[6]=L*f-v*l,r[7]=F*f-S*l,r},y.ae=function(r){var t=new Pl(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},y.af=Qu,y.ag=function(r,t){let s=0,l=0;if(r.kind==="constant")l=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:f,minZoom:_,maxZoom:x}=r,v=f?ot(gn.interpolationFactor(f,t,_,x),0,1):0;r.kind==="camera"?l=mn.number(r.minSize,r.maxSize,v):s=v}return{uSizeT:s,uSize:l}},y.ai=function(r,{uSize:t,uSizeT:s},{lowerSize:l,upperSize:f}){return r.kind==="source"?l/cs:r.kind==="composite"?mn.number(l/cs,f/cs,s):t},y.aj=jf,y.ak=function(r,t,s,l){const f=t.y-r.y,_=t.x-r.x,x=l.y-s.y,v=l.x-s.x,S=x*_-v*f;if(S===0)return null;const C=(v*(r.y-s.y)-x*(r.x-s.x))/S;return new R(r.x+C*_,r.y+C*f)},y.al=j_,y.am=I0,y.an=kf,y.ao=function(r){let t=1/0,s=1/0,l=-1/0,f=-1/0;for(const _ of r)t=Math.min(t,_.x),s=Math.min(s,_.y),l=Math.max(l,_.x),f=Math.max(f,_.y);return[t,s,l,f]},y.ap=Oi,y.ar=$f,y.as=function(r,t){var s=t[0],l=t[1],f=t[2],_=t[3],x=t[4],v=t[5],S=t[6],C=t[7],P=t[8],L=t[9],F=t[10],j=t[11],H=t[12],q=t[13],K=t[14],ie=t[15],ge=s*v-l*x,le=s*S-f*x,fe=s*C-_*x,we=l*S-f*v,Pe=l*C-_*v,qe=f*C-_*S,ut=P*q-L*H,je=P*K-F*H,Ve=P*ie-j*H,nt=L*K-F*q,Ke=L*ie-j*q,Ge=F*ie-j*K,Te=ge*Ge-le*Ke+fe*nt+we*Ve-Pe*je+qe*ut;return Te?(r[0]=(v*Ge-S*Ke+C*nt)*(Te=1/Te),r[1]=(f*Ke-l*Ge-_*nt)*Te,r[2]=(q*qe-K*Pe+ie*we)*Te,r[3]=(F*Pe-L*qe-j*we)*Te,r[4]=(S*Ve-x*Ge-C*je)*Te,r[5]=(s*Ge-f*Ve+_*je)*Te,r[6]=(K*fe-H*qe-ie*le)*Te,r[7]=(P*qe-F*fe+j*le)*Te,r[8]=(x*Ke-v*Ve+C*ut)*Te,r[9]=(l*Ve-s*Ke-_*ut)*Te,r[10]=(H*Pe-q*fe+ie*ge)*Te,r[11]=(L*fe-P*Pe-j*ge)*Te,r[12]=(v*je-x*nt-S*ut)*Te,r[13]=(s*nt-l*je+f*ut)*Te,r[14]=(q*le-H*we-K*ge)*Te,r[15]=(P*we-L*le+F*ge)*Te,r):null},y.at=Xf,y.au=Vf,y.av=Kf,y.aw=function(){const r={},t=xe.$version;for(const s in xe.$root){const l=xe.$root[s];if(l.required){let f=null;f=s==="version"?t:l.type==="array"?[]:{},f!=null&&(r[s]=f)}}return r},y.ax=Zc,y.ay=He,y.az=function(r){r=r.slice();const t=Object.create(null);for(let s=0;s<r.length;s++)t[r[s].id]=r[s];for(let s=0;s<r.length;s++)"ref"in r[s]&&(r[s]=Go(r[s],t[r[s].ref]));return r},y.b=Ui,y.b0=function(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},y.b1=function(r,t,s){return r[0]=t[0]*s[0],r[1]=t[1]*s[1],r[2]=t[2]*s[2],r[3]=t[3]*s[3],r},y.b2=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]*t[3]},y.b3=Qe,y.b4=L_,y.b5=z_,y.b6=function(r,t,s,l,f){var _,x=1/Math.tan(t/2);return r[0]=x/s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=x,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,f!=null&&f!==1/0?(r[10]=(f+l)*(_=1/(l-f)),r[14]=2*f*l*_):(r[10]=-1,r[14]=-2*l),r},y.b7=function(r,t,s){var l=Math.sin(s),f=Math.cos(s),_=t[4],x=t[5],v=t[6],S=t[7],C=t[8],P=t[9],L=t[10],F=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=_*f+C*l,r[5]=x*f+P*l,r[6]=v*f+L*l,r[7]=S*f+F*l,r[8]=C*f-_*l,r[9]=P*f-x*l,r[10]=L*f-v*l,r[11]=F*f-S*l,r},y.b8=_e,y.b9=Ie,y.bA=a_,y.bB=function(r){return r.message===sn},y.bC=ho,y.bD=Dn,y.ba=function(r){return r*Math.PI/180},y.bb=function(r,t){const{x:s,y:l}=dh.fromLngLat(t);return!(r<0||r>25||l<0||l>=1||s<0||s>=1)},y.bc=function(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},y.bd=class extends I{},y.be=Zf,y.bf=NA,y.bh=Se,y.bi=function(r,t){En.REGISTERED_PROTOCOLS[r]=t},y.bj=function(r){delete En.REGISTERED_PROTOCOLS[r]},y.bk=function(r,t){const s={};for(let f=0;f<r.length;f++){const _=t&&t[r[f].id]||Bu(r[f]);t&&(t[r[f].id]=_);let x=s[_];x||(x=s[_]=[]),x.push(r[f])}const l=[];for(const f in s)l.push(s[f]);return l},y.bl=Xe,y.bm=B_,y.bn=N_,y.bo=g_,y.bp=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=Ri/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const t=r.bucket.layers[0],s=t.layout,l=t._unevaluatedLayout._values,f={layoutIconSize:l["icon-size"].possiblyEvaluate(new fi(r.bucket.zoom+1),r.canonical),layoutTextSize:l["text-size"].possiblyEvaluate(new fi(r.bucket.zoom+1),r.canonical),textMaxSize:l["text-size"].possiblyEvaluate(new fi(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:C,maxZoom:P}=r.bucket.textSizeData;f.compositeTextSizes=[l["text-size"].possiblyEvaluate(new fi(C),r.canonical),l["text-size"].possiblyEvaluate(new fi(P),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:C,maxZoom:P}=r.bucket.iconSizeData;f.compositeIconSizes=[l["icon-size"].possiblyEvaluate(new fi(C),r.canonical),l["icon-size"].possiblyEvaluate(new fi(P),r.canonical)]}const _=s.get("text-line-height")*Oi,x=s.get("text-rotation-alignment")!=="viewport"&&s.get("symbol-placement")!=="point",v=s.get("text-keep-upright"),S=s.get("text-size");for(const C of r.bucket.features){const P=s.get("text-font").evaluate(C,{},r.canonical).join(","),L=S.evaluate(C,{},r.canonical),F=f.layoutTextSize.evaluate(C,{},r.canonical),j=f.layoutIconSize.evaluate(C,{},r.canonical),H={horizontal:{},vertical:void 0},q=C.text;let K,ie=[0,0];if(q){const fe=q.toString(),we=s.get("text-letter-spacing").evaluate(C,{},r.canonical)*Oi,Pe=df(fe)?we:0,qe=s.get("text-anchor").evaluate(C,{},r.canonical),ut=K_(t,C,r.canonical);if(!ut){const Ke=s.get("text-radial-offset").evaluate(C,{},r.canonical);ie=Ke?X_(qe,[Ke*Oi,Yf]):s.get("text-offset").evaluate(C,{},r.canonical).map(Ge=>Ge*Oi)}let je=x?"center":s.get("text-justify").evaluate(C,{},r.canonical);const Ve=s.get("symbol-placement")==="point"?s.get("text-max-width").evaluate(C,{},r.canonical)*Oi:1/0,nt=()=>{r.bucket.allowVerticalPlacement&&Wc(fe)&&(H.vertical=sd(q,r.glyphMap,r.glyphPositions,r.imagePositions,P,Ve,_,qe,"left",Pe,ie,y.ah.vertical,!0,F,L))};if(!x&&ut){const Ke=new Set;if(je==="auto")for(let Te=0;Te<ut.values.length;Te+=2)Ke.add(Xf(ut.values[Te]));else Ke.add(je);let Ge=!1;for(const Te of Ke)if(!H.horizontal[Te])if(Ge)H.horizontal[Te]=H.horizontal[0];else{const at=sd(q,r.glyphMap,r.glyphPositions,r.imagePositions,P,Ve,_,"center",Te,Pe,ie,y.ah.horizontal,!1,F,L);at&&(H.horizontal[Te]=at,Ge=at.positionedLines.length===1)}nt()}else{je==="auto"&&(je=Xf(qe));const Ke=sd(q,r.glyphMap,r.glyphPositions,r.imagePositions,P,Ve,_,qe,je,Pe,ie,y.ah.horizontal,!1,F,L);Ke&&(H.horizontal[je]=Ke),nt(),Wc(fe)&&x&&v&&(H.vertical=sd(q,r.glyphMap,r.glyphPositions,r.imagePositions,P,Ve,_,qe,je,Pe,ie,y.ah.vertical,!1,F,L))}}let ge=!1;if(C.icon&&C.icon.name){const fe=r.imageMap[C.icon.name];fe&&(K=vA(r.imagePositions[C.icon.name],s.get("icon-offset").evaluate(C,{},r.canonical),s.get("icon-anchor").evaluate(C,{},r.canonical)),ge=!!fe.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=ge:r.bucket.sdfIcons!==ge&&Rt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(fe.pixelRatio!==r.bucket.pixelRatio||s.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const le=Q_(H.horizontal)||H.vertical;r.bucket.iconsInText=!!le&&le.iconsInText,(le||K)&&BA(r.bucket,C,H,K,r.imageMap,f,F,j,ie,ge,r.canonical)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},y.bq=Rf,y.br=Af,y.bs=zf,y.bt=Mo,y.bu=Of,y.bv=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}},y.bw=function(r,t,s,l,f){return h(this,void 0,void 0,function*(){if(be())try{return yield jn(r,t,s,l,f)}catch{}return function(_,x,v,S,C){const P=_.width,L=_.height;Sn&&Hi||(Sn=new OffscreenCanvas(P,L),Hi=Sn.getContext("2d",{willReadFrequently:!0})),Sn.width=P,Sn.height=L,Hi.drawImage(_,0,0,P,L);const F=Hi.getImageData(x,v,S,C);return Hi.clearRect(0,0,P,L),F.data}(r,t,s,l,f)})},y.bx=O_,y.by=M,y.bz=D,y.c=Sr,y.d=r=>h(void 0,void 0,void 0,function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(t)}catch(s){throw new Error(`Could not load image because of ${s.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),y.e=Be,y.f=r=>new Promise((t,s)=>{const l=new Image;l.onload=()=>{t(l),URL.revokeObjectURL(l.src),l.onload=null,window.requestAnimationFrame(()=>{l.src=kr})},l.onerror=()=>s(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const f=new Blob([new Uint8Array(r)],{type:"image/png"});l.src=r.byteLength?URL.createObjectURL(f):kr}),y.g=Tn,y.h=(r,t)=>Ze(Be(r,{type:"json"}),t),y.i=rn,y.j=vt,y.k=Et,y.l=(r,t)=>Ze(Be(r,{type:"arrayBuffer"}),t),y.m=Ze,y.n=function(r){return new Of(r).readFields(fA,[])},y.o=ih,y.p=m_,y.q=g,y.r=hf,y.s=lt,y.t=Hc,y.u=Fs,y.v=xe,y.w=Rt,y.x=function([r,t,s]){return t+=90,t*=Math.PI/180,s*=Math.PI/180,{x:r*Math.cos(t)*Math.sin(s),y:r*Math.sin(t)*Math.sin(s),z:r*Math.cos(s)}},y.y=mn,y.z=fi}),p("worker",["./shared"],function(y){class h{constructor($){this.keyCache={},$&&this.replace($)}replace($){this._layerConfigs={},this._layers={},this.update($,[])}update($,V){for(const J of $){this._layerConfigs[J.id]=J;const ce=this._layers[J.id]=y.aA(J);ce._featureFilter=y.a7(ce.filter),this.keyCache[J.id]&&delete this.keyCache[J.id]}for(const J of V)delete this.keyCache[J],delete this._layerConfigs[J],delete this._layers[J];this.familiesBySource={};const W=y.bk(Object.values(this._layerConfigs),this.keyCache);for(const J of W){const ce=J.map(ve=>this._layers[ve.id]),de=ce[0];if(de.visibility==="none")continue;const me=de.source||"";let se=this.familiesBySource[me];se||(se=this.familiesBySource[me]={});const ke=de.sourceLayer||"_geojsonTileLayer";let Me=se[ke];Me||(Me=se[ke]=[]),Me.push(ce)}}}class M{constructor($){const V={},W=[];for(const me in $){const se=$[me],ke=V[me]={};for(const Me in se){const ve=se[+Me];if(!ve||ve.bitmap.width===0||ve.bitmap.height===0)continue;const Re={x:0,y:0,w:ve.bitmap.width+2,h:ve.bitmap.height+2};W.push(Re),ke[Me]={rect:Re,metrics:ve.metrics}}}const{w:J,h:ce}=y.p(W),de=new y.o({width:J||1,height:ce||1});for(const me in $){const se=$[me];for(const ke in se){const Me=se[+ke];if(!Me||Me.bitmap.width===0||Me.bitmap.height===0)continue;const ve=V[me][ke].rect;y.o.copy(Me.bitmap,de,{x:0,y:0},{x:ve.x+1,y:ve.y+1},Me.bitmap)}}this.image=de,this.positions=V}}y.bl("GlyphAtlas",M);class D{constructor($){this.tileID=new y.S($.tileID.overscaledZ,$.tileID.wrap,$.tileID.canonical.z,$.tileID.canonical.x,$.tileID.canonical.y),this.uid=$.uid,this.zoom=$.zoom,this.pixelRatio=$.pixelRatio,this.tileSize=$.tileSize,this.source=$.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=$.showCollisionBoxes,this.collectResourceTiming=!!$.collectResourceTiming,this.returnDependencies=!!$.returnDependencies,this.promoteId=$.promoteId,this.inFlightDependencies=[]}parse($,V,W,J){return y._(this,void 0,void 0,function*(){this.status="parsing",this.data=$,this.collisionBoxArray=new y.a5;const ce=new y.bm(Object.keys($.layers).sort()),de=new y.bn(this.tileID,this.promoteId);de.bucketLayerIDs=[];const me={},se={featureIndex:de,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:W},ke=V.familiesBySource[this.source];for(const Pt in ke){const ei=$.layers[Pt];if(!ei)continue;ei.version===1&&y.w(`Vector tile source "${this.source}" layer "${Pt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const xi=ce.encode(Pt),Fi=[];for(let qi=0;qi<ei.length;qi++){const an=ei.feature(qi),Qs=de.getId(an,Pt);Fi.push({feature:an,id:Qs,index:qi,sourceLayerIndex:xi})}for(const qi of ke[Pt]){const an=qi[0];an.source!==this.source&&y.w(`layer.source = ${an.source} does not equal this.source = ${this.source}`),an.minzoom&&this.zoom<Math.floor(an.minzoom)||an.maxzoom&&this.zoom>=an.maxzoom||an.visibility!=="none"&&(A(qi,this.zoom,W),(me[an.id]=an.createBucket({index:de.bucketLayerIDs.length,layers:qi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:xi,sourceID:this.source})).populate(Fi,se,this.tileID.canonical),de.bucketLayerIDs.push(qi.map(Qs=>Qs.id)))}}const Me=y.aF(se.glyphDependencies,Pt=>Object.keys(Pt).map(Number));this.inFlightDependencies.forEach(Pt=>Pt==null?void 0:Pt.abort()),this.inFlightDependencies=[];let ve=Promise.resolve({});if(Object.keys(Me).length){const Pt=new AbortController;this.inFlightDependencies.push(Pt),ve=J.sendAsync({type:"GG",data:{stacks:Me,source:this.source,tileID:this.tileID,type:"glyphs"}},Pt)}const Re=Object.keys(se.iconDependencies);let ct=Promise.resolve({});if(Re.length){const Pt=new AbortController;this.inFlightDependencies.push(Pt),ct=J.sendAsync({type:"GI",data:{icons:Re,source:this.source,tileID:this.tileID,type:"icons"}},Pt)}const ht=Object.keys(se.patternDependencies);let $t=Promise.resolve({});if(ht.length){const Pt=new AbortController;this.inFlightDependencies.push(Pt),$t=J.sendAsync({type:"GI",data:{icons:ht,source:this.source,tileID:this.tileID,type:"patterns"}},Pt)}const[wt,jt,Lt]=yield Promise.all([ve,ct,$t]),Di=new M(wt),Si=new y.bo(jt,Lt);for(const Pt in me){const ei=me[Pt];ei instanceof y.a6?(A(ei.layers,this.zoom,W),y.bp({bucket:ei,glyphMap:wt,glyphPositions:Di.positions,imageMap:jt,imagePositions:Si.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ei.hasPattern&&(ei instanceof y.bq||ei instanceof y.br||ei instanceof y.bs)&&(A(ei.layers,this.zoom,W),ei.addFeatures(se,this.tileID.canonical,Si.patternPositions))}return this.status="done",{buckets:Object.values(me).filter(Pt=>!Pt.isEmpty()),featureIndex:de,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Di.image,imageAtlas:Si,glyphMap:this.returnDependencies?wt:null,iconMap:this.returnDependencies?jt:null,glyphPositions:this.returnDependencies?Di.positions:null}})}}function A(ee,$,V){const W=new y.z($);for(const J of ee)J.recalculate(W,V)}class R{constructor($,V,W){this.actor=$,this.layerIndex=V,this.availableImages=W,this.fetching={},this.loading={},this.loaded={}}loadVectorTile($,V){return y._(this,void 0,void 0,function*(){const W=yield y.l($.request,V);try{return{vectorTile:new y.bt.VectorTile(new y.bu(W.data)),rawData:W.data,cacheControl:W.cacheControl,expires:W.expires}}catch(J){const ce=new Uint8Array(W.data);let de=`Unable to parse the tile at ${$.request.url}, `;throw de+=ce[0]===31&&ce[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${J.message}`,new Error(de)}})}loadTile($){return y._(this,void 0,void 0,function*(){const V=$.uid,W=!!($&&$.request&&$.request.collectResourceTiming)&&new y.bv($.request),J=new D($);this.loading[V]=J;const ce=new AbortController;J.abort=ce;try{const de=yield this.loadVectorTile($,ce);if(delete this.loading[V],!de)return null;const me=de.rawData,se={};de.expires&&(se.expires=de.expires),de.cacheControl&&(se.cacheControl=de.cacheControl);const ke={};if(W){const ve=W.finish();ve&&(ke.resourceTiming=JSON.parse(JSON.stringify(ve)))}J.vectorTile=de.vectorTile;const Me=J.parse(de.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[V]=J,this.fetching[V]={rawTileData:me,cacheControl:se,resourceTiming:ke};try{const ve=yield Me;return y.e({rawTileData:me.slice(0)},ve,se,ke)}finally{delete this.fetching[V]}}catch(de){throw delete this.loading[V],J.status="done",this.loaded[V]=J,de}})}reloadTile($){return y._(this,void 0,void 0,function*(){const V=$.uid;if(!this.loaded||!this.loaded[V])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const W=this.loaded[V];if(W.showCollisionBoxes=$.showCollisionBoxes,W.status==="parsing"){const J=yield W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor);let ce;if(this.fetching[V]){const{rawTileData:de,cacheControl:me,resourceTiming:se}=this.fetching[V];delete this.fetching[V],ce=y.e({rawTileData:de.slice(0)},J,me,se)}else ce=J;return ce}if(W.status==="done"&&W.vectorTile)return W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile($){return y._(this,void 0,void 0,function*(){const V=this.loading,W=$.uid;V&&V[W]&&V[W].abort&&(V[W].abort.abort(),delete V[W])})}removeTile($){return y._(this,void 0,void 0,function*(){this.loaded&&this.loaded[$.uid]&&delete this.loaded[$.uid]})}}class z{constructor(){this.loaded={}}loadTile($){return y._(this,void 0,void 0,function*(){const{uid:V,encoding:W,rawImageData:J,redFactor:ce,greenFactor:de,blueFactor:me,baseShift:se}=$,ke=J.width+2,Me=J.height+2,ve=y.b(J)?new y.R({width:ke,height:Me},yield y.bw(J,-1,-1,ke,Me)):J,Re=new y.bx(V,ve,W,ce,de,me,se);return this.loaded=this.loaded||{},this.loaded[V]=Re,Re})}removeTile($){const V=this.loaded,W=$.uid;V&&V[W]&&delete V[W]}}function N(ee,$){if(ee.length!==0){Y(ee[0],$);for(var V=1;V<ee.length;V++)Y(ee[V],!$)}}function Y(ee,$){for(var V=0,W=0,J=0,ce=ee.length,de=ce-1;J<ce;de=J++){var me=(ee[J][0]-ee[de][0])*(ee[de][1]+ee[J][1]),se=V+me;W+=Math.abs(V)>=Math.abs(me)?V-se+me:me-se+V,V=se}V+W>=0!=!!$&&ee.reverse()}var te=y.by(function ee($,V){var W,J=$&&$.type;if(J==="FeatureCollection")for(W=0;W<$.features.length;W++)ee($.features[W],V);else if(J==="GeometryCollection")for(W=0;W<$.geometries.length;W++)ee($.geometries[W],V);else if(J==="Feature")ee($.geometry,V);else if(J==="Polygon")N($.coordinates,V);else if(J==="MultiPolygon")for(W=0;W<$.coordinates.length;W++)N($.coordinates[W],V);return $});const ae=y.bt.VectorTileFeature.prototype.toGeoJSON;var he={exports:{}},be=y.bz,_e=y.bt.VectorTileFeature,Ie=ot;function ot(ee,$){this.options=$||{},this.features=ee,this.length=ee.length}function Qe(ee,$){this.id=typeof ee.id=="number"?ee.id:void 0,this.type=ee.type,this.rawGeometry=ee.type===1?[ee.geometry]:ee.geometry,this.properties=ee.tags,this.extent=$||4096}ot.prototype.feature=function(ee){return new Qe(this.features[ee],this.options.extent)},Qe.prototype.loadGeometry=function(){var ee=this.rawGeometry;this.geometry=[];for(var $=0;$<ee.length;$++){for(var V=ee[$],W=[],J=0;J<V.length;J++)W.push(new be(V[J][0],V[J][1]));this.geometry.push(W)}return this.geometry},Qe.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var ee=this.geometry,$=1/0,V=-1/0,W=1/0,J=-1/0,ce=0;ce<ee.length;ce++)for(var de=ee[ce],me=0;me<de.length;me++){var se=de[me];$=Math.min($,se.x),V=Math.max(V,se.x),W=Math.min(W,se.y),J=Math.max(J,se.y)}return[$,W,V,J]},Qe.prototype.toGeoJSON=_e.prototype.toGeoJSON;var Be=y.bA,St=Ie;function rt(ee){var $=new Be;return function(V,W){for(var J in V.layers)W.writeMessage(3,Dt,V.layers[J])}(ee,$),$.finish()}function Dt(ee,$){var V;$.writeVarintField(15,ee.version||1),$.writeStringField(1,ee.name||""),$.writeVarintField(5,ee.extent||4096);var W={keys:[],values:[],keycache:{},valuecache:{}};for(V=0;V<ee.length;V++)W.feature=ee.feature(V),$.writeMessage(2,Mt,W);var J=W.keys;for(V=0;V<J.length;V++)$.writeStringField(3,J[V]);var ce=W.values;for(V=0;V<ce.length;V++)$.writeMessage(4,tr,ce[V])}function Mt(ee,$){var V=ee.feature;V.id!==void 0&&$.writeVarintField(1,V.id),$.writeMessage(2,kn,ee),$.writeVarintField(3,V.type),$.writeMessage(4,rn,V)}function kn(ee,$){var V=ee.feature,W=ee.keys,J=ee.values,ce=ee.keycache,de=ee.valuecache;for(var me in V.properties){var se=V.properties[me],ke=ce[me];if(se!==null){ke===void 0&&(W.push(me),ce[me]=ke=W.length-1),$.writeVarint(ke);var Me=typeof se;Me!=="string"&&Me!=="boolean"&&Me!=="number"&&(se=JSON.stringify(se));var ve=Me+":"+se,Re=de[ve];Re===void 0&&(J.push(se),de[ve]=Re=J.length-1),$.writeVarint(Re)}}}function Rt(ee,$){return($<<3)+(7&ee)}function pi(ee){return ee<<1^ee>>31}function rn(ee,$){for(var V=ee.loadGeometry(),W=ee.type,J=0,ce=0,de=V.length,me=0;me<de;me++){var se=V[me],ke=1;W===1&&(ke=se.length),$.writeVarint(Rt(1,ke));for(var Me=W===3?se.length-1:se.length,ve=0;ve<Me;ve++){ve===1&&W!==1&&$.writeVarint(Rt(2,Me-1));var Re=se[ve].x-J,ct=se[ve].y-ce;$.writeVarint(pi(Re)),$.writeVarint(pi(ct)),J+=Re,ce+=ct}W===3&&$.writeVarint(Rt(7,1))}}function tr(ee,$){var V=typeof ee;V==="string"?$.writeStringField(1,ee):V==="boolean"?$.writeBooleanField(7,ee):V==="number"&&(ee%1!=0?$.writeDoubleField(3,ee):ee<0?$.writeSVarintField(6,ee):$.writeVarintField(5,ee))}he.exports=rt,he.exports.fromVectorTileJs=rt,he.exports.fromGeojsonVt=function(ee,$){$=$||{};var V={};for(var W in ee)V[W]=new St(ee[W].features,$),V[W].name=W,V[W].version=$.version,V[W].extent=$.extent;return rt({layers:V})},he.exports.GeoJSONWrapper=St;var Ui=y.by(he.exports);const kr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ee=>ee},jn=Math.fround||(Sn=new Float32Array(1),ee=>(Sn[0]=+ee,Sn[0]));var Sn;const Hi=3,sn=5,Sr=6;class En{constructor($){this.options=Object.assign(Object.create(kr),$),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load($){const{log:V,minZoom:W,maxZoom:J}=this.options;V&&console.time("total time");const ce=`prepare ${$.length} points`;V&&console.time(ce),this.points=$;const de=[];for(let se=0;se<$.length;se++){const ke=$[se];if(!ke.geometry)continue;const[Me,ve]=ke.geometry.coordinates,Re=jn(Se(Me)),ct=jn(He(ve));de.push(Re,ct,1/0,se,-1,1),this.options.reduce&&de.push(0)}let me=this.trees[J+1]=this._createTree(de);V&&console.timeEnd(ce);for(let se=J;se>=W;se--){const ke=+Date.now();me=this.trees[se]=this._createTree(this._cluster(me,se)),V&&console.log("z%d: %d clusters in %dms",se,me.numItems,+Date.now()-ke)}return V&&console.timeEnd("total time"),this}getClusters($,V){let W=(($[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,$[1]));let ce=$[2]===180?180:(($[2]+180)%360+360)%360-180;const de=Math.max(-90,Math.min(90,$[3]));if($[2]-$[0]>=360)W=-180,ce=180;else if(W>ce){const ve=this.getClusters([W,J,180,de],V),Re=this.getClusters([-180,J,ce,de],V);return ve.concat(Re)}const me=this.trees[this._limitZoom(V)],se=me.range(Se(W),He(de),Se(ce),He(J)),ke=me.data,Me=[];for(const ve of se){const Re=this.stride*ve;Me.push(ke[Re+sn]>1?Tn(ke,Re,this.clusterProps):this.points[ke[Re+Hi]])}return Me}getChildren($){const V=this._getOriginId($),W=this._getOriginZoom($),J="No cluster with the specified id.",ce=this.trees[W];if(!ce)throw new Error(J);const de=ce.data;if(V*this.stride>=de.length)throw new Error(J);const me=this.options.radius/(this.options.extent*Math.pow(2,W-1)),se=ce.within(de[V*this.stride],de[V*this.stride+1],me),ke=[];for(const Me of se){const ve=Me*this.stride;de[ve+4]===$&&ke.push(de[ve+sn]>1?Tn(de,ve,this.clusterProps):this.points[de[ve+Hi]])}if(ke.length===0)throw new Error(J);return ke}getLeaves($,V,W){const J=[];return this._appendLeaves(J,$,V=V||10,W=W||0,0),J}getTile($,V,W){const J=this.trees[this._limitZoom($)],ce=Math.pow(2,$),{extent:de,radius:me}=this.options,se=me/de,ke=(W-se)/ce,Me=(W+1+se)/ce,ve={features:[]};return this._addTileFeatures(J.range((V-se)/ce,ke,(V+1+se)/ce,Me),J.data,V,W,ce,ve),V===0&&this._addTileFeatures(J.range(1-se/ce,ke,1,Me),J.data,ce,W,ce,ve),V===ce-1&&this._addTileFeatures(J.range(0,ke,se/ce,Me),J.data,-1,W,ce,ve),ve.features.length?ve:null}getClusterExpansionZoom($){let V=this._getOriginZoom($)-1;for(;V<=this.options.maxZoom;){const W=this.getChildren($);if(V++,W.length!==1)break;$=W[0].properties.cluster_id}return V}_appendLeaves($,V,W,J,ce){const de=this.getChildren(V);for(const me of de){const se=me.properties;if(se&&se.cluster?ce+se.point_count<=J?ce+=se.point_count:ce=this._appendLeaves($,se.cluster_id,W,J,ce):ce<J?ce++:$.push(me),$.length===W)break}return ce}_createTree($){const V=new y.av($.length/this.stride|0,this.options.nodeSize,Float32Array);for(let W=0;W<$.length;W+=this.stride)V.add($[W],$[W+1]);return V.finish(),V.data=$,V}_addTileFeatures($,V,W,J,ce,de){for(const me of $){const se=me*this.stride,ke=V[se+sn]>1;let Me,ve,Re;if(ke)Me=Cn(V,se,this.clusterProps),ve=V[se],Re=V[se+1];else{const $t=this.points[V[se+Hi]];Me=$t.properties;const[wt,jt]=$t.geometry.coordinates;ve=Se(wt),Re=He(jt)}const ct={type:1,geometry:[[Math.round(this.options.extent*(ve*ce-W)),Math.round(this.options.extent*(Re*ce-J))]],tags:Me};let ht;ht=ke||this.options.generateId?V[se+Hi]:this.points[V[se+Hi]].id,ht!==void 0&&(ct.id=ht),de.features.push(ct)}}_limitZoom($){return Math.max(this.options.minZoom,Math.min(Math.floor(+$),this.options.maxZoom+1))}_cluster($,V){const{radius:W,extent:J,reduce:ce,minPoints:de}=this.options,me=W/(J*Math.pow(2,V)),se=$.data,ke=[],Me=this.stride;for(let ve=0;ve<se.length;ve+=Me){if(se[ve+2]<=V)continue;se[ve+2]=V;const Re=se[ve],ct=se[ve+1],ht=$.within(se[ve],se[ve+1],me),$t=se[ve+sn];let wt=$t;for(const jt of ht){const Lt=jt*Me;se[Lt+2]>V&&(wt+=se[Lt+sn])}if(wt>$t&&wt>=de){let jt,Lt=Re*$t,Di=ct*$t,Si=-1;const Pt=((ve/Me|0)<<5)+(V+1)+this.points.length;for(const ei of ht){const xi=ei*Me;if(se[xi+2]<=V)continue;se[xi+2]=V;const Fi=se[xi+sn];Lt+=se[xi]*Fi,Di+=se[xi+1]*Fi,se[xi+4]=Pt,ce&&(jt||(jt=this._map(se,ve,!0),Si=this.clusterProps.length,this.clusterProps.push(jt)),ce(jt,this._map(se,xi)))}se[ve+4]=Pt,ke.push(Lt/wt,Di/wt,1/0,Pt,-1,wt),ce&&ke.push(Si)}else{for(let jt=0;jt<Me;jt++)ke.push(se[ve+jt]);if(wt>1)for(const jt of ht){const Lt=jt*Me;if(!(se[Lt+2]<=V)){se[Lt+2]=V;for(let Di=0;Di<Me;Di++)ke.push(se[Lt+Di])}}}}return ke}_getOriginId($){return $-this.points.length>>5}_getOriginZoom($){return($-this.points.length)%32}_map($,V,W){if($[V+sn]>1){const de=this.clusterProps[$[V+Sr]];return W?Object.assign({},de):de}const J=this.points[$[V+Hi]].properties,ce=this.options.map(J);return W&&ce===J?Object.assign({},ce):ce}}function Tn(ee,$,V){return{type:"Feature",id:ee[$+Hi],properties:Cn(ee,$,V),geometry:{type:"Point",coordinates:[(W=ee[$],360*(W-.5)),Ze(ee[$+1])]}};var W}function Cn(ee,$,V){const W=ee[$+sn],J=W>=1e4?`${Math.round(W/1e3)}k`:W>=1e3?Math.round(W/100)/10+"k":W,ce=ee[$+Sr],de=ce===-1?{}:Object.assign({},V[ce]);return Object.assign(de,{cluster:!0,cluster_id:ee[$+Hi],point_count:W,point_count_abbreviated:J})}function Se(ee){return ee/360+.5}function He(ee){const $=Math.sin(ee*Math.PI/180),V=.5-.25*Math.log((1+$)/(1-$))/Math.PI;return V<0?0:V>1?1:V}function Ze(ee){const $=(180-360*ee)*Math.PI/180;return 360*Math.atan(Math.exp($))/Math.PI-90}function lt(ee,$,V,W){let J=W;const ce=$+(V-$>>1);let de,me=V-$;const se=ee[$],ke=ee[$+1],Me=ee[V],ve=ee[V+1];for(let Re=$+3;Re<V;Re+=3){const ct=Vt(ee[Re],ee[Re+1],se,ke,Me,ve);if(ct>J)de=Re,J=ct;else if(ct===J){const ht=Math.abs(Re-ce);ht<me&&(de=Re,me=ht)}}J>W&&(de-$>3&&lt(ee,$,de,W),ee[de+2]=J,V-de>3&&lt(ee,de,V,W))}function Vt(ee,$,V,W,J,ce){let de=J-V,me=ce-W;if(de!==0||me!==0){const se=((ee-V)*de+($-W)*me)/(de*de+me*me);se>1?(V=J,W=ce):se>0&&(V+=de*se,W+=me*se)}return de=ee-V,me=$-W,de*de+me*me}function Qt(ee,$,V,W){const J={id:ee??null,type:$,geometry:V,tags:W,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if($==="Point"||$==="MultiPoint"||$==="LineString")Et(J,V);else if($==="Polygon")Et(J,V[0]);else if($==="MultiLineString")for(const ce of V)Et(J,ce);else if($==="MultiPolygon")for(const ce of V)Et(J,ce[0]);return J}function Et(ee,$){for(let V=0;V<$.length;V+=3)ee.minX=Math.min(ee.minX,$[V]),ee.minY=Math.min(ee.minY,$[V+1]),ee.maxX=Math.max(ee.maxX,$[V]),ee.maxY=Math.max(ee.maxY,$[V+1])}function vt(ee,$,V,W){if(!$.geometry)return;const J=$.geometry.coordinates;if(J&&J.length===0)return;const ce=$.geometry.type,de=Math.pow(V.tolerance/((1<<V.maxZoom)*V.extent),2);let me=[],se=$.id;if(V.promoteId?se=$.properties[V.promoteId]:V.generateId&&(se=W||0),ce==="Point")ri(J,me);else if(ce==="MultiPoint")for(const ke of J)ri(ke,me);else if(ce==="LineString")xe(J,me,de,!1);else if(ce==="MultiLineString"){if(V.lineMetrics){for(const ke of J)me=[],xe(ke,me,de,!1),ee.push(Qt(se,"LineString",me,$.properties));return}wi(J,me,de,!1)}else if(ce==="Polygon")wi(J,me,de,!0);else{if(ce!=="MultiPolygon"){if(ce==="GeometryCollection"){for(const ke of $.geometry.geometries)vt(ee,{id:se,geometry:ke,properties:$.properties},V,W);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ke of J){const Me=[];wi(ke,Me,de,!0),me.push(Me)}}ee.push(Qt(se,ce,me,$.properties))}function ri(ee,$){$.push(Go(ee[0]),Zt(ee[1]),0)}function xe(ee,$,V,W){let J,ce,de=0;for(let se=0;se<ee.length;se++){const ke=Go(ee[se][0]),Me=Zt(ee[se][1]);$.push(ke,Me,0),se>0&&(de+=W?(J*Me-ke*ce)/2:Math.sqrt(Math.pow(ke-J,2)+Math.pow(Me-ce,2))),J=ke,ce=Me}const me=$.length-3;$[2]=1,lt($,0,me,V),$[me+2]=1,$.size=Math.abs(de),$.start=0,$.end=$.size}function wi(ee,$,V,W){for(let J=0;J<ee.length;J++){const ce=[];xe(ee[J],ce,V,W),$.push(ce)}}function Go(ee){return ee/360+.5}function Zt(ee){const $=Math.sin(ee*Math.PI/180),V=.5-.25*Math.log((1+$)/(1-$))/Math.PI;return V<0?0:V>1?1:V}function ki(ee,$,V,W,J,ce,de,me){if(W/=$,ce>=(V/=$)&&de<W)return ee;if(de<V||ce>=W)return null;const se=[];for(const ke of ee){const Me=ke.geometry;let ve=ke.type;const Re=J===0?ke.minX:ke.minY,ct=J===0?ke.maxX:ke.maxY;if(Re>=V&&ct<W){se.push(ke);continue}if(ct<V||Re>=W)continue;let ht=[];if(ve==="Point"||ve==="MultiPoint")Yo(Me,ht,V,W,J);else if(ve==="LineString")is(Me,ht,V,W,J,!1,me.lineMetrics);else if(ve==="MultiLineString")Js(Me,ht,V,W,J,!1);else if(ve==="Polygon")Js(Me,ht,V,W,J,!0);else if(ve==="MultiPolygon")for(const $t of Me){const wt=[];Js($t,wt,V,W,J,!0),wt.length&&ht.push(wt)}if(ht.length){if(me.lineMetrics&&ve==="LineString"){for(const $t of ht)se.push(Qt(ke.id,ve,$t,ke.tags));continue}ve!=="LineString"&&ve!=="MultiLineString"||(ht.length===1?(ve="LineString",ht=ht[0]):ve="MultiLineString"),ve!=="Point"&&ve!=="MultiPoint"||(ve=ht.length===3?"Point":"MultiPoint"),se.push(Qt(ke.id,ve,ht,ke.tags))}}return se.length?se:null}function Yo(ee,$,V,W,J){for(let ce=0;ce<ee.length;ce+=3){const de=ee[ce+J];de>=V&&de<=W&&Un($,ee[ce],ee[ce+1],ee[ce+2])}}function is(ee,$,V,W,J,ce,de){let me=$r(ee);const se=J===0?Xo:Ko;let ke,Me,ve=ee.start;for(let wt=0;wt<ee.length-3;wt+=3){const jt=ee[wt],Lt=ee[wt+1],Di=ee[wt+2],Si=ee[wt+3],Pt=ee[wt+4],ei=J===0?jt:Lt,xi=J===0?Si:Pt;let Fi=!1;de&&(ke=Math.sqrt(Math.pow(jt-Si,2)+Math.pow(Lt-Pt,2))),ei<V?xi>V&&(Me=se(me,jt,Lt,Si,Pt,V),de&&(me.start=ve+ke*Me)):ei>W?xi<W&&(Me=se(me,jt,Lt,Si,Pt,W),de&&(me.start=ve+ke*Me)):Un(me,jt,Lt,Di),xi<V&&ei>=V&&(Me=se(me,jt,Lt,Si,Pt,V),Fi=!0),xi>W&&ei<=W&&(Me=se(me,jt,Lt,Si,Pt,W),Fi=!0),!ce&&Fi&&(de&&(me.end=ve+ke*Me),$.push(me),me=$r(ee)),de&&(ve+=ke)}let Re=ee.length-3;const ct=ee[Re],ht=ee[Re+1],$t=J===0?ct:ht;$t>=V&&$t<=W&&Un(me,ct,ht,ee[Re+2]),Re=me.length-3,ce&&Re>=3&&(me[Re]!==me[0]||me[Re+1]!==me[1])&&Un(me,me[0],me[1],me[2]),me.length&&$.push(me)}function $r(ee){const $=[];return $.size=ee.size,$.start=ee.start,$.end=ee.end,$}function Js(ee,$,V,W,J,ce){for(const de of ee)is(de,$,V,W,J,ce,!1)}function Un(ee,$,V,W){ee.push($,V,W)}function Xo(ee,$,V,W,J,ce){const de=(ce-$)/(W-$);return Un(ee,ce,V+(J-V)*de,1),de}function Ko(ee,$,V,W,J,ce){const de=(ce-V)/(J-V);return Un(ee,$+(W-$)*de,ce,1),de}function De(ee,$){const V=[];for(let W=0;W<ee.length;W++){const J=ee[W],ce=J.type;let de;if(ce==="Point"||ce==="MultiPoint"||ce==="LineString")de=Er(J.geometry,$);else if(ce==="MultiLineString"||ce==="Polygon"){de=[];for(const me of J.geometry)de.push(Er(me,$))}else if(ce==="MultiPolygon"){de=[];for(const me of J.geometry){const se=[];for(const ke of me)se.push(Er(ke,$));de.push(se)}}V.push(Qt(J.id,ce,de,J.tags))}return V}function Er(ee,$){const V=[];V.size=ee.size,ee.start!==void 0&&(V.start=ee.start,V.end=ee.end);for(let W=0;W<ee.length;W+=3)V.push(ee[W]+$,ee[W+1],ee[W+2]);return V}function on(ee,$){if(ee.transformed)return ee;const V=1<<ee.z,W=ee.x,J=ee.y;for(const ce of ee.features){const de=ce.geometry,me=ce.type;if(ce.geometry=[],me===1)for(let se=0;se<de.length;se+=2)ce.geometry.push(Tr(de[se],de[se+1],$,V,W,J));else for(let se=0;se<de.length;se++){const ke=[];for(let Me=0;Me<de[se].length;Me+=2)ke.push(Tr(de[se][Me],de[se][Me+1],$,V,W,J));ce.geometry.push(ke)}}return ee.transformed=!0,ee}function Tr(ee,$,V,W,J,ce){return[Math.round(V*(ee*W-J)),Math.round(V*($*W-ce))]}function ns(ee,$,V,W,J){const ce=$===J.maxZoom?0:J.tolerance/((1<<$)*J.extent),de={features:[],numPoints:0,numSimplified:0,numFeatures:ee.length,source:null,x:V,y:W,z:$,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const me of ee)Fe(de,me,ce,J);return de}function Fe(ee,$,V,W){const J=$.geometry,ce=$.type,de=[];if(ee.minX=Math.min(ee.minX,$.minX),ee.minY=Math.min(ee.minY,$.minY),ee.maxX=Math.max(ee.maxX,$.maxX),ee.maxY=Math.max(ee.maxY,$.maxY),ce==="Point"||ce==="MultiPoint")for(let me=0;me<J.length;me+=3)de.push(J[me],J[me+1]),ee.numPoints++,ee.numSimplified++;else if(ce==="LineString")Ct(de,J,ee,V,!1,!1);else if(ce==="MultiLineString"||ce==="Polygon")for(let me=0;me<J.length;me++)Ct(de,J[me],ee,V,ce==="Polygon",me===0);else if(ce==="MultiPolygon")for(let me=0;me<J.length;me++){const se=J[me];for(let ke=0;ke<se.length;ke++)Ct(de,se[ke],ee,V,!0,ke===0)}if(de.length){let me=$.tags||null;if(ce==="LineString"&&W.lineMetrics){me={};for(const ke in $.tags)me[ke]=$.tags[ke];me.mapbox_clip_start=J.start/J.size,me.mapbox_clip_end=J.end/J.size}const se={geometry:de,type:ce==="Polygon"||ce==="MultiPolygon"?3:ce==="LineString"||ce==="MultiLineString"?2:1,tags:me};$.id!==null&&(se.id=$.id),ee.features.push(se)}}function Ct(ee,$,V,W,J,ce){const de=W*W;if(W>0&&$.size<(J?de:W))return void(V.numPoints+=$.length/3);const me=[];for(let se=0;se<$.length;se+=3)(W===0||$[se+2]>de)&&(V.numSimplified++,me.push($[se],$[se+1])),V.numPoints++;J&&function(se,ke){let Me=0;for(let ve=0,Re=se.length,ct=Re-2;ve<Re;ct=ve,ve+=2)Me+=(se[ve]-se[ct])*(se[ve+1]+se[ct+1]);if(Me>0===ke)for(let ve=0,Re=se.length;ve<Re/2;ve+=2){const ct=se[ve],ht=se[ve+1];se[ve]=se[Re-2-ve],se[ve+1]=se[Re-1-ve],se[Re-2-ve]=ct,se[Re-1-ve]=ht}}(me,ce),ee.push(me)}const mt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class fn{constructor($,V){const W=(V=this.options=function(ce,de){for(const me in de)ce[me]=de[me];return ce}(Object.create(mt),V)).debug;if(W&&console.time("preprocess data"),V.maxZoom<0||V.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(ce,de){const me=[];if(ce.type==="FeatureCollection")for(let se=0;se<ce.features.length;se++)vt(me,ce.features[se],de,se);else vt(me,ce.type==="Feature"?ce:{geometry:ce},de);return me}($,V);this.tiles={},this.tileCoords=[],W&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",V.indexMaxZoom,V.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(ce,de){const me=de.buffer/de.extent;let se=ce;const ke=ki(ce,1,-1-me,me,0,-1,2,de),Me=ki(ce,1,1-me,2+me,0,-1,2,de);return(ke||Me)&&(se=ki(ce,1,-me,1+me,0,-1,2,de)||[],ke&&(se=De(ke,1).concat(se)),Me&&(se=se.concat(De(Me,-1)))),se}(J,V),J.length&&this.splitTile(J,0,0,0),W&&(J.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile($,V,W,J,ce,de,me){const se=[$,V,W,J],ke=this.options,Me=ke.debug;for(;se.length;){J=se.pop(),W=se.pop(),V=se.pop(),$=se.pop();const ve=1<<V,Re=ir(V,W,J);let ct=this.tiles[Re];if(!ct&&(Me>1&&console.time("creation"),ct=this.tiles[Re]=ns($,V,W,J,ke),this.tileCoords.push({z:V,x:W,y:J}),Me)){Me>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,W,J,ct.numFeatures,ct.numPoints,ct.numSimplified),console.timeEnd("creation"));const Fi=`z${V}`;this.stats[Fi]=(this.stats[Fi]||0)+1,this.total++}if(ct.source=$,ce==null){if(V===ke.indexMaxZoom||ct.numPoints<=ke.indexMaxPoints)continue}else{if(V===ke.maxZoom||V===ce)continue;if(ce!=null){const Fi=ce-V;if(W!==de>>Fi||J!==me>>Fi)continue}}if(ct.source=null,$.length===0)continue;Me>1&&console.time("clipping");const ht=.5*ke.buffer/ke.extent,$t=.5-ht,wt=.5+ht,jt=1+ht;let Lt=null,Di=null,Si=null,Pt=null,ei=ki($,ve,W-ht,W+wt,0,ct.minX,ct.maxX,ke),xi=ki($,ve,W+$t,W+jt,0,ct.minX,ct.maxX,ke);$=null,ei&&(Lt=ki(ei,ve,J-ht,J+wt,1,ct.minY,ct.maxY,ke),Di=ki(ei,ve,J+$t,J+jt,1,ct.minY,ct.maxY,ke),ei=null),xi&&(Si=ki(xi,ve,J-ht,J+wt,1,ct.minY,ct.maxY,ke),Pt=ki(xi,ve,J+$t,J+jt,1,ct.minY,ct.maxY,ke),xi=null),Me>1&&console.timeEnd("clipping"),se.push(Lt||[],V+1,2*W,2*J),se.push(Di||[],V+1,2*W,2*J+1),se.push(Si||[],V+1,2*W+1,2*J),se.push(Pt||[],V+1,2*W+1,2*J+1)}}getTile($,V,W){$=+$,V=+V,W=+W;const J=this.options,{extent:ce,debug:de}=J;if($<0||$>24)return null;const me=1<<$,se=ir($,V=V+me&me-1,W);if(this.tiles[se])return on(this.tiles[se],ce);de>1&&console.log("drilling down to z%d-%d-%d",$,V,W);let ke,Me=$,ve=V,Re=W;for(;!ke&&Me>0;)Me--,ve>>=1,Re>>=1,ke=this.tiles[ir(Me,ve,Re)];return ke&&ke.source?(de>1&&(console.log("found parent tile z%d-%d-%d",Me,ve,Re),console.time("drilling down")),this.splitTile(ke.source,Me,ve,Re,$,V,W),de>1&&console.timeEnd("drilling down"),this.tiles[se]?on(this.tiles[se],ce):null):null}}function ir(ee,$,V){return 32*((1<<ee)*V+$)+ee}function bt(ee,$){return $?ee.properties[$]:ee.id}function Cr(ee,$){if(ee==null)return!0;if(ee.type==="Feature")return bt(ee,$)!=null;if(ee.type==="FeatureCollection"){const V=new Set;for(const W of ee.features){const J=bt(W,$);if(J==null||V.has(J))return!1;V.add(J)}return!0}return!1}function jr(ee,$){const V=new Map;if(ee!=null)if(ee.type==="Feature")V.set(bt(ee,$),ee);else for(const W of ee.features)V.set(bt(W,$),W);return V}class rs extends R{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile($,V){return y._(this,void 0,void 0,function*(){const W=$.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile(W.z,W.x,W.y);if(!J)return null;const ce=new class{constructor(me){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=y.X,this.length=me.length,this._features=me}feature(me){return new class{constructor(se){this._feature=se,this.extent=y.X,this.type=se.type,this.properties=se.tags,"id"in se&&!isNaN(se.id)&&(this.id=parseInt(se.id,10))}loadGeometry(){if(this._feature.type===1){const se=[];for(const ke of this._feature.geometry)se.push([new y.P(ke[0],ke[1])]);return se}{const se=[];for(const ke of this._feature.geometry){const Me=[];for(const ve of ke)Me.push(new y.P(ve[0],ve[1]));se.push(Me)}return se}}toGeoJSON(se,ke,Me){return ae.call(this,se,ke,Me)}}(this._features[me])}}(J.features);let de=Ui(ce);return de.byteOffset===0&&de.byteLength===de.buffer.byteLength||(de=new Uint8Array(de)),{vectorTile:ce,rawData:de.buffer}})}loadData($){return y._(this,void 0,void 0,function*(){var V;(V=this._pendingRequest)===null||V===void 0||V.abort();const W=!!($&&$.request&&$.request.collectResourceTiming)&&new y.bv($.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON($,this._pendingRequest),this._geoJSONIndex=$.cluster?new En(function({superclusterOptions:de,clusterProperties:me}){if(!me||!de)return de;const se={},ke={},Me={accumulated:null,zoom:0},ve={properties:null},Re=Object.keys(me);for(const ct of Re){const[ht,$t]=me[ct],wt=y.bC($t),jt=y.bC(typeof ht=="string"?[ht,["accumulated"],["get",ct]]:ht);se[ct]=wt.value,ke[ct]=jt.value}return de.map=ct=>{ve.properties=ct;const ht={};for(const $t of Re)ht[$t]=se[$t].evaluate(Me,ve);return ht},de.reduce=(ct,ht)=>{ve.properties=ht;for(const $t of Re)Me.accumulated=ct[$t],ct[$t]=ke[$t].evaluate(Me,ve)},de}($)).load((yield this._pendingData).features):(J=yield this._pendingData,new fn(J,$.geojsonVtOptions)),this.loaded={};const ce={};if(W){const de=W.finish();de&&(ce.resourceTiming={},ce.resourceTiming[$.source]=JSON.parse(JSON.stringify(de)))}return ce}catch(ce){if(delete this._pendingRequest,y.bB(ce))return{abandoned:!0};throw ce}var J})}getData(){return y._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile($){const V=this.loaded;return V&&V[$.uid]?super.reloadTile($):this.loadTile($)}loadAndProcessGeoJSON($,V){return y._(this,void 0,void 0,function*(){let W=yield this.loadGeoJSON($,V);if(delete this._pendingRequest,typeof W!="object")throw new Error(`Input data given to '${$.source}' is not a valid GeoJSON object.`);if(te(W,!0),$.filter){const J=y.bC($.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(de=>`${de.key}: ${de.message}`).join(", "));W={type:"FeatureCollection",features:W.features.filter(de=>J.value.evaluate({zoom:0},de))}}return W})}loadGeoJSON($,V){return y._(this,void 0,void 0,function*(){const{promoteId:W}=$;if($.request){const J=yield y.h($.request,V);return this._dataUpdateable=Cr(J.data,W)?jr(J.data,W):void 0,J.data}if(typeof $.data=="string")try{const J=JSON.parse($.data);return this._dataUpdateable=Cr(J,W)?jr(J,W):void 0,J}catch{throw new Error(`Input data given to '${$.source}' is not a valid GeoJSON object.`)}if(!$.dataDiff)throw new Error(`Input data given to '${$.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${$.source}`);return function(J,ce,de){var me,se,ke,Me;if(ce.removeAll&&J.clear(),ce.remove)for(const ve of ce.remove)J.delete(ve);if(ce.add)for(const ve of ce.add){const Re=bt(ve,de);Re!=null&&J.set(Re,ve)}if(ce.update)for(const ve of ce.update){let Re=J.get(ve.id);if(Re==null)continue;const ct=!ve.removeAllProperties&&(((me=ve.removeProperties)===null||me===void 0?void 0:me.length)>0||((se=ve.addOrUpdateProperties)===null||se===void 0?void 0:se.length)>0);if((ve.newGeometry||ve.removeAllProperties||ct)&&(Re=Object.assign({},Re),J.set(ve.id,Re),ct&&(Re.properties=Object.assign({},Re.properties))),ve.newGeometry&&(Re.geometry=ve.newGeometry),ve.removeAllProperties)Re.properties={};else if(((ke=ve.removeProperties)===null||ke===void 0?void 0:ke.length)>0)for(const ht of ve.removeProperties)Object.prototype.hasOwnProperty.call(Re.properties,ht)&&delete Re.properties[ht];if(((Me=ve.addOrUpdateProperties)===null||Me===void 0?void 0:Me.length)>0)for(const{key:ht,value:$t}of ve.addOrUpdateProperties)Re.properties[ht]=$t}}(this._dataUpdateable,$.dataDiff,W),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource($){return y._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom($){return this._geoJSONIndex.getClusterExpansionZoom($.clusterId)}getClusterChildren($){return this._geoJSONIndex.getChildren($.clusterId)}getClusterLeaves($){return this._geoJSONIndex.getLeaves($.clusterId,$.limit,$.offset)}}class Mr{constructor($){this.self=$,this.actor=new y.F($),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(V,W)=>{if(this.externalWorkerSourceTypes[V])throw new Error(`Worker source with name "${V}" already registered.`);this.externalWorkerSourceTypes[V]=W},this.self.addProtocol=y.bi,this.self.removeProtocol=y.bj,this.self.registerRTLTextPlugin=V=>{if(y.bD.isParsed())throw new Error("RTL text plugin already registered.");y.bD.setMethods(V)},this.actor.registerMessageHandler("LDT",(V,W)=>this._getDEMWorkerSource(V,W.source).loadTile(W)),this.actor.registerMessageHandler("RDT",(V,W)=>y._(this,void 0,void 0,function*(){this._getDEMWorkerSource(V,W.source).removeTile(W)})),this.actor.registerMessageHandler("GCEZ",(V,W)=>y._(this,void 0,void 0,function*(){return this._getWorkerSource(V,W.type,W.source).getClusterExpansionZoom(W)})),this.actor.registerMessageHandler("GCC",(V,W)=>y._(this,void 0,void 0,function*(){return this._getWorkerSource(V,W.type,W.source).getClusterChildren(W)})),this.actor.registerMessageHandler("GCL",(V,W)=>y._(this,void 0,void 0,function*(){return this._getWorkerSource(V,W.type,W.source).getClusterLeaves(W)})),this.actor.registerMessageHandler("LD",(V,W)=>this._getWorkerSource(V,W.type,W.source).loadData(W)),this.actor.registerMessageHandler("GD",(V,W)=>this._getWorkerSource(V,W.type,W.source).getData()),this.actor.registerMessageHandler("LT",(V,W)=>this._getWorkerSource(V,W.type,W.source).loadTile(W)),this.actor.registerMessageHandler("RT",(V,W)=>this._getWorkerSource(V,W.type,W.source).reloadTile(W)),this.actor.registerMessageHandler("AT",(V,W)=>this._getWorkerSource(V,W.type,W.source).abortTile(W)),this.actor.registerMessageHandler("RMT",(V,W)=>this._getWorkerSource(V,W.type,W.source).removeTile(W)),this.actor.registerMessageHandler("RS",(V,W)=>y._(this,void 0,void 0,function*(){if(!this.workerSources[V]||!this.workerSources[V][W.type]||!this.workerSources[V][W.type][W.source])return;const J=this.workerSources[V][W.type][W.source];delete this.workerSources[V][W.type][W.source],J.removeSource!==void 0&&J.removeSource(W)})),this.actor.registerMessageHandler("RM",V=>y._(this,void 0,void 0,function*(){delete this.layerIndexes[V],delete this.availableImages[V],delete this.workerSources[V],delete this.demWorkerSources[V]})),this.actor.registerMessageHandler("SR",(V,W)=>y._(this,void 0,void 0,function*(){this.referrer=W})),this.actor.registerMessageHandler("SRPS",(V,W)=>this._syncRTLPluginState(V,W)),this.actor.registerMessageHandler("IS",(V,W)=>y._(this,void 0,void 0,function*(){this.self.importScripts(W)})),this.actor.registerMessageHandler("SI",(V,W)=>this._setImages(V,W)),this.actor.registerMessageHandler("UL",(V,W)=>y._(this,void 0,void 0,function*(){this._getLayerIndex(V).update(W.layers,W.removedIds)})),this.actor.registerMessageHandler("SL",(V,W)=>y._(this,void 0,void 0,function*(){this._getLayerIndex(V).replace(W)}))}_setImages($,V){return y._(this,void 0,void 0,function*(){this.availableImages[$]=V;for(const W in this.workerSources[$]){const J=this.workerSources[$][W];for(const ce in J)J[ce].availableImages=V}})}_syncRTLPluginState($,V){return y._(this,void 0,void 0,function*(){if(y.bD.isParsed())return y.bD.getState();if(V.pluginStatus!=="loading")return y.bD.setState(V),V;const W=V.pluginURL;if(this.self.importScripts(W),y.bD.isParsed()){const J={pluginStatus:"loaded",pluginURL:W};return y.bD.setState(J),J}throw y.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${W}`)})}_getAvailableImages($){let V=this.availableImages[$];return V||(V=[]),V}_getLayerIndex($){let V=this.layerIndexes[$];return V||(V=this.layerIndexes[$]=new h),V}_getWorkerSource($,V,W){if(this.workerSources[$]||(this.workerSources[$]={}),this.workerSources[$][V]||(this.workerSources[$][V]={}),!this.workerSources[$][V][W]){const J={sendAsync:(ce,de)=>(ce.targetMapId=$,this.actor.sendAsync(ce,de))};switch(V){case"vector":this.workerSources[$][V][W]=new R(J,this._getLayerIndex($),this._getAvailableImages($));break;case"geojson":this.workerSources[$][V][W]=new rs(J,this._getLayerIndex($),this._getAvailableImages($));break;default:this.workerSources[$][V][W]=new this.externalWorkerSourceTypes[V](J,this._getLayerIndex($),this._getAvailableImages($))}}return this.workerSources[$][V][W]}_getDEMWorkerSource($,V){return this.demWorkerSources[$]||(this.demWorkerSources[$]={}),this.demWorkerSources[$][V]||(this.demWorkerSources[$][V]=new z),this.demWorkerSources[$][V]}}return y.i(self)&&(self.worker=new Mr(self)),Mr}),p("index",["exports","./shared"],function(y,h){var M="4.7.0";let D,A;const R={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:g=>new Promise((e,a)=>{const u=requestAnimationFrame(e);g.signal.addEventListener("abort",()=>{cancelAnimationFrame(u),a(h.c())})}),getImageData(g,e=0){return this.getImageCanvasContext(g).getImageData(-e,-e,g.width+2*e,g.height+2*e)},getImageCanvasContext(g){const e=window.document.createElement("canvas"),a=e.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return e.width=g.width,e.height=g.height,a.drawImage(g,0,0,g.width,g.height),a},resolveURL:g=>(D||(D=document.createElement("a")),D.href=g,D.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(A==null&&(A=matchMedia("(prefers-reduced-motion: reduce)")),A.matches)}};class z{static testProp(e){if(!z.docStyle)return e[0];for(let a=0;a<e.length;a++)if(e[a]in z.docStyle)return e[a];return e[0]}static create(e,a,u){const d=window.document.createElement(e);return a!==void 0&&(d.className=a),u&&u.appendChild(d),d}static createNS(e,a){return window.document.createElementNS(e,a)}static disableDrag(){z.docStyle&&z.selectProp&&(z.userSelect=z.docStyle[z.selectProp],z.docStyle[z.selectProp]="none")}static enableDrag(){z.docStyle&&z.selectProp&&(z.docStyle[z.selectProp]=z.userSelect)}static setTransform(e,a){e.style[z.transformProp]=a}static addEventListener(e,a,u,d={}){e.addEventListener(a,u,"passive"in d?d:d.capture)}static removeEventListener(e,a,u,d={}){e.removeEventListener(a,u,"passive"in d?d:d.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",z.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",z.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",z.suppressClickInternal,!0)},0)}static getScale(e){const a=e.getBoundingClientRect();return{x:a.width/e.offsetWidth||1,y:a.height/e.offsetHeight||1,boundingClientRect:a}}static getPoint(e,a,u){const d=a.boundingClientRect;return new h.P((u.clientX-d.left)/a.x-e.clientLeft,(u.clientY-d.top)/a.y-e.clientTop)}static mousePos(e,a){const u=z.getScale(e);return z.getPoint(e,u,a)}static touchPos(e,a){const u=[],d=z.getScale(e);for(let m=0;m<a.length;m++)u.push(z.getPoint(e,d,a[m]));return u}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}}z.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,z.selectProp=z.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),z.transformProp=z.testProp(["transform","WebkitTransform"]);const N={supported:!1,testSupport:function(g){!ae&&te&&(he?be(g):Y=g)}};let Y,te,ae=!1,he=!1;function be(g){const e=g.createTexture();g.bindTexture(g.TEXTURE_2D,e);try{if(g.texImage2D(g.TEXTURE_2D,0,g.RGBA,g.RGBA,g.UNSIGNED_BYTE,te),g.isContextLost())return;N.supported=!0}catch{}g.deleteTexture(e),ae=!0}var _e;typeof document<"u"&&(te=document.createElement("img"),te.onload=()=>{Y&&be(Y),Y=null,he=!0},te.onerror=()=>{ae=!0,Y=null},te.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(g){let e,a,u,d;g.resetRequestQueue=()=>{e=[],a=0,u=0,d={}},g.addThrottleControl=T=>{const I=u++;return d[I]=T,I},g.removeThrottleControl=T=>{delete d[T],k()},g.getImage=(T,I,O=!0)=>new Promise((B,U)=>{N.supported&&(T.headers||(T.headers={}),T.headers.accept="image/webp,*/*"),h.e(T,{type:"image"}),e.push({abortController:I,requestParameters:T,supportImageRefresh:O,state:"queued",onError:Z=>{U(Z)},onSuccess:Z=>{B(Z)}}),k()});const m=T=>h._(this,void 0,void 0,function*(){T.state="running";const{requestParameters:I,supportImageRefresh:O,onError:B,onSuccess:U,abortController:Z}=T,G=O===!1&&!h.i(self)&&!h.g(I.url)&&(!I.headers||Object.keys(I.headers).reduce((re,oe)=>re&&oe==="accept",!0));a++;const Q=G?E(I,Z):h.m(I,Z);try{const re=yield Q;delete T.abortController,T.state="completed",re.data instanceof HTMLImageElement||h.b(re.data)?U(re):re.data&&U({data:yield(ne=re.data,typeof createImageBitmap=="function"?h.d(ne):h.f(ne)),cacheControl:re.cacheControl,expires:re.expires})}catch(re){delete T.abortController,B(re)}finally{a--,k()}var ne}),k=()=>{const T=(()=>{for(const I of Object.keys(d))if(d[I]())return!0;return!1})()?h.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:h.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let I=a;I<T&&e.length>0;I++){const O=e.shift();O.abortController.signal.aborted?I--:m(O)}},E=(T,I)=>new Promise((O,B)=>{const U=new Image,Z=T.url,G=T.credentials;G&&G==="include"?U.crossOrigin="use-credentials":(G&&G==="same-origin"||!h.s(Z))&&(U.crossOrigin="anonymous"),I.signal.addEventListener("abort",()=>{U.src="",B(h.c())}),U.fetchPriority="high",U.onload=()=>{U.onerror=U.onload=null,O({data:U})},U.onerror=()=>{U.onerror=U.onload=null,I.signal.aborted||B(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},U.src=Z})}(_e||(_e={})),_e.resetRequestQueue();class Ie{constructor(e){this._transformRequestFn=e}transformRequest(e,a){return this._transformRequestFn&&this._transformRequestFn(e,a)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function ot(g){var e=new h.A(3);return e[0]=g[0],e[1]=g[1],e[2]=g[2],e}var Qe,Be=function(g,e,a){return g[0]=e[0]-a[0],g[1]=e[1]-a[1],g[2]=e[2]-a[2],g};Qe=new h.A(3),h.A!=Float32Array&&(Qe[0]=0,Qe[1]=0,Qe[2]=0);var St=function(g){var e=g[0],a=g[1];return e*e+a*a};function rt(g){const e=[];if(typeof g=="string")e.push({id:"default",url:g});else if(g&&g.length>0){const a=[];for(const{id:u,url:d}of g){const m=`${u}${d}`;a.indexOf(m)===-1&&(a.push(m),e.push({id:u,url:d}))}}return e}function Dt(g,e,a){const u=g.split("?");return u[0]+=`${e}${a}`,u.join("?")}(function(){var g=new h.A(2);h.A!=Float32Array&&(g[0]=0,g[1]=0)})();class Mt{constructor(e,a,u,d){this.context=e,this.format=u,this.texture=e.gl.createTexture(),this.update(a,d)}update(e,a,u){const{width:d,height:m}=e,k=!(this.size&&this.size[0]===d&&this.size[1]===m||u),{context:E}=this,{gl:T}=E;if(this.useMipmap=!!(a&&a.useMipmap),T.bindTexture(T.TEXTURE_2D,this.texture),E.pixelStoreUnpackFlipY.set(!1),E.pixelStoreUnpack.set(1),E.pixelStoreUnpackPremultiplyAlpha.set(this.format===T.RGBA&&(!a||a.premultiply!==!1)),k)this.size=[d,m],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||h.b(e)?T.texImage2D(T.TEXTURE_2D,0,this.format,this.format,T.UNSIGNED_BYTE,e):T.texImage2D(T.TEXTURE_2D,0,this.format,d,m,0,this.format,T.UNSIGNED_BYTE,e.data);else{const{x:I,y:O}=u||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||h.b(e)?T.texSubImage2D(T.TEXTURE_2D,0,I,O,T.RGBA,T.UNSIGNED_BYTE,e):T.texSubImage2D(T.TEXTURE_2D,0,I,O,d,m,T.RGBA,T.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&T.generateMipmap(T.TEXTURE_2D)}bind(e,a,u){const{context:d}=this,{gl:m}=d;m.bindTexture(m.TEXTURE_2D,this.texture),u!==m.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(u=m.LINEAR),e!==this.filter&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,e),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,u||e),this.filter=e),a!==this.wrap&&(m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,a),m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,a),this.wrap=a)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function kn(g){const{userImage:e}=g;return!!(e&&e.render&&e.render())&&(g.data.replace(new Uint8Array(e.data.buffer)),!0)}class Rt extends h.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new h.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:a,promiseResolve:u}of this.requestors)u(this._getImagesForIds(a));this.requestors=[]}}getImage(e){const a=this.images[e];if(a&&!a.data&&a.spriteData){const u=a.spriteData;a.data=new h.R({width:u.width,height:u.height},u.context.getImageData(u.x,u.y,u.width,u.height).data),a.spriteData=null}return a}addImage(e,a){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,a)&&(this.images[e]=a)}_validate(e,a){let u=!0;const d=a.data||a.spriteData;return this._validateStretch(a.stretchX,d&&d.width)||(this.fire(new h.j(new Error(`Image "${e}" has invalid "stretchX" value`))),u=!1),this._validateStretch(a.stretchY,d&&d.height)||(this.fire(new h.j(new Error(`Image "${e}" has invalid "stretchY" value`))),u=!1),this._validateContent(a.content,a)||(this.fire(new h.j(new Error(`Image "${e}" has invalid "content" value`))),u=!1),u}_validateStretch(e,a){if(!e)return!0;let u=0;for(const d of e){if(d[0]<u||d[1]<d[0]||a<d[1])return!1;u=d[1]}return!0}_validateContent(e,a){if(!e)return!0;if(e.length!==4)return!1;const u=a.spriteData,d=u&&u.width||a.data.width,m=u&&u.height||a.data.height;return!(e[0]<0||d<e[0]||e[1]<0||m<e[1]||e[2]<0||d<e[2]||e[3]<0||m<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,a,u=!0){const d=this.getImage(e);if(u&&(d.data.width!==a.data.width||d.data.height!==a.data.height))throw new Error(`size mismatch between old image (${d.data.width}x${d.data.height}) and new image (${a.data.width}x${a.data.height}).`);a.version=d.version+1,this.images[e]=a,this.updatedImages[e]=!0}removeImage(e){const a=this.images[e];delete this.images[e],delete this.patterns[e],a.userImage&&a.userImage.onRemove&&a.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((a,u)=>{let d=!0;if(!this.isLoaded())for(const m of e)this.images[m]||(d=!1);this.isLoaded()||d?a(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:a})})}_getImagesForIds(e){const a={};for(const u of e){let d=this.getImage(u);d||(this.fire(new h.k("styleimagemissing",{id:u})),d=this.getImage(u)),d?a[u]={data:d.data.clone(),pixelRatio:d.pixelRatio,sdf:d.sdf,version:d.version,stretchX:d.stretchX,stretchY:d.stretchY,content:d.content,textFitWidth:d.textFitWidth,textFitHeight:d.textFitHeight,hasRenderCallback:!!(d.userImage&&d.userImage.render)}:h.w(`Image "${u}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return a}getPixelSize(){const{width:e,height:a}=this.atlasImage;return{width:e,height:a}}getPattern(e){const a=this.patterns[e],u=this.getImage(e);if(!u)return null;if(a&&a.position.version===u.version)return a.position;if(a)a.position.version=u.version;else{const d={w:u.data.width+2,h:u.data.height+2,x:0,y:0},m=new h.I(d,u);this.patterns[e]={bin:d,position:m}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const a=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Mt(e,this.atlasImage,a.RGBA),this.atlasTexture.bind(a.LINEAR,a.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const m in this.patterns)e.push(this.patterns[m].bin);const{w:a,h:u}=h.p(e),d=this.atlasImage;d.resize({width:a||1,height:u||1});for(const m in this.patterns){const{bin:k}=this.patterns[m],E=k.x+1,T=k.y+1,I=this.getImage(m).data,O=I.width,B=I.height;h.R.copy(I,d,{x:0,y:0},{x:E,y:T},{width:O,height:B}),h.R.copy(I,d,{x:0,y:B-1},{x:E,y:T-1},{width:O,height:1}),h.R.copy(I,d,{x:0,y:0},{x:E,y:T+B},{width:O,height:1}),h.R.copy(I,d,{x:O-1,y:0},{x:E-1,y:T},{width:1,height:B}),h.R.copy(I,d,{x:0,y:0},{x:E+O,y:T},{width:1,height:B})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const a of e){if(this.callbackDispatchedThisFrame[a])continue;this.callbackDispatchedThisFrame[a]=!0;const u=this.getImage(a);u||h.w(`Image with ID: "${a}" was not found`),kn(u)&&this.updateImage(a,u)}}}const pi=1e20;function rn(g,e,a,u,d,m,k,E,T){for(let I=e;I<e+u;I++)tr(g,a*m+I,m,d,k,E,T);for(let I=a;I<a+d;I++)tr(g,I*m+e,1,u,k,E,T)}function tr(g,e,a,u,d,m,k){m[0]=0,k[0]=-pi,k[1]=pi,d[0]=g[e];for(let E=1,T=0,I=0;E<u;E++){d[E]=g[e+E*a];const O=E*E;do{const B=m[T];I=(d[E]-d[B]+O-B*B)/(E-B)/2}while(I<=k[T]&&--T>-1);T++,m[T]=E,k[T]=I,k[T+1]=pi}for(let E=0,T=0;E<u;E++){for(;k[T+1]<E;)T++;const I=m[T],O=E-I;g[e+E*a]=d[I]+O*O}}class Ui{constructor(e,a){this.requestManager=e,this.localIdeographFontFamily=a,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return h._(this,void 0,void 0,function*(){const a=[];for(const m in e)for(const k of e[m])a.push(this._getAndCacheGlyphsPromise(m,k));const u=yield Promise.all(a),d={};for(const{stack:m,id:k,glyph:E}of u)d[m]||(d[m]={}),d[m][k]=E&&{id:E.id,bitmap:E.bitmap.clone(),metrics:E.metrics};return d})}_getAndCacheGlyphsPromise(e,a){return h._(this,void 0,void 0,function*(){let u=this.entries[e];u||(u=this.entries[e]={glyphs:{},requests:{},ranges:{}});let d=u.glyphs[a];if(d!==void 0)return{stack:e,id:a,glyph:d};if(d=this._tinySDF(u,e,a),d)return u.glyphs[a]=d,{stack:e,id:a,glyph:d};const m=Math.floor(a/256);if(256*m>65535)throw new Error("glyphs > 65535 not supported");if(u.ranges[m])return{stack:e,id:a,glyph:d};if(!this.url)throw new Error("glyphsUrl is not set");if(!u.requests[m]){const E=Ui.loadGlyphRange(e,m,this.url,this.requestManager);u.requests[m]=E}const k=yield u.requests[m];for(const E in k)this._doesCharSupportLocalGlyph(+E)||(u.glyphs[+E]=k[+E]);return u.ranges[m]=!0,{stack:e,id:a,glyph:k[a]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))}_tinySDF(e,a,u){const d=this.localIdeographFontFamily;if(!d||!this._doesCharSupportLocalGlyph(u))return;let m=e.tinySDF;if(!m){let E="400";/bold/i.test(a)?E="900":/medium/i.test(a)?E="500":/light/i.test(a)&&(E="200"),m=e.tinySDF=new Ui.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:d,fontWeight:E})}const k=m.draw(String.fromCharCode(u));return{id:u,bitmap:new h.o({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}}}}Ui.loadGlyphRange=function(g,e,a,u){return h._(this,void 0,void 0,function*(){const d=256*e,m=d+255,k=u.transformRequest(a.replace("{fontstack}",g).replace("{range}",`${d}-${m}`),"Glyphs"),E=yield h.l(k,new AbortController);if(!E||!E.data)throw new Error(`Could not load glyph range. range: ${e}, ${d}-${m}`);const T={};for(const I of h.n(E.data))T[I.id]=I;return T})},Ui.TinySDF=class{constructor({fontSize:g=24,buffer:e=3,radius:a=8,cutoff:u=.25,fontFamily:d="sans-serif",fontWeight:m="normal",fontStyle:k="normal"}={}){this.buffer=e,this.cutoff=u,this.radius=a;const E=this.size=g+4*e,T=this._createCanvas(E),I=this.ctx=T.getContext("2d",{willReadFrequently:!0});I.font=`${k} ${m} ${g}px ${d}`,I.textBaseline="alphabetic",I.textAlign="left",I.fillStyle="black",this.gridOuter=new Float64Array(E*E),this.gridInner=new Float64Array(E*E),this.f=new Float64Array(E),this.z=new Float64Array(E+1),this.v=new Uint16Array(E)}_createCanvas(g){const e=document.createElement("canvas");return e.width=e.height=g,e}draw(g){const{width:e,actualBoundingBoxAscent:a,actualBoundingBoxDescent:u,actualBoundingBoxLeft:d,actualBoundingBoxRight:m}=this.ctx.measureText(g),k=Math.ceil(a),E=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(m-d))),T=Math.min(this.size-this.buffer,k+Math.ceil(u)),I=E+2*this.buffer,O=T+2*this.buffer,B=Math.max(I*O,0),U=new Uint8ClampedArray(B),Z={data:U,width:I,height:O,glyphWidth:E,glyphHeight:T,glyphTop:k,glyphLeft:0,glyphAdvance:e};if(E===0||T===0)return Z;const{ctx:G,buffer:Q,gridInner:ne,gridOuter:re}=this;G.clearRect(Q,Q,E,T),G.fillText(g,Q,Q+k);const oe=G.getImageData(Q,Q,E,T);re.fill(pi,0,B),ne.fill(0,0,B);for(let X=0;X<T;X++)for(let ue=0;ue<E;ue++){const pe=oe.data[4*(X*E+ue)+3]/255;if(pe===0)continue;const ye=(X+Q)*I+ue+Q;if(pe===1)re[ye]=0,ne[ye]=pi;else{const Ce=.5-pe;re[ye]=Ce>0?Ce*Ce:0,ne[ye]=Ce<0?Ce*Ce:0}}rn(re,0,0,I,O,I,this.f,this.v,this.z),rn(ne,Q,Q,E,T,I,this.f,this.v,this.z);for(let X=0;X<B;X++){const ue=Math.sqrt(re[X])-Math.sqrt(ne[X]);U[X]=Math.round(255-255*(ue/this.radius+this.cutoff))}return Z}};class kr{constructor(){this.specification=h.v.light.position}possiblyEvaluate(e,a){return h.x(e.expression.evaluate(a))}interpolate(e,a,u){return{x:h.y.number(e.x,a.x,u),y:h.y.number(e.y,a.y,u),z:h.y.number(e.z,a.z,u)}}}let jn;class Sn extends h.E{constructor(e){super(),jn=jn||new h.q({anchor:new h.D(h.v.light.anchor),position:new kr,color:new h.D(h.v.light.color),intensity:new h.D(h.v.light.intensity)}),this._transitionable=new h.T(jn),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,a={}){if(!this._validate(h.r,e,a))for(const u in e){const d=e[u];u.endsWith("-transition")?this._transitionable.setTransition(u.slice(0,-11),d):this._transitionable.setValue(u,d)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,a,u){return(!u||u.validate!==!1)&&h.t(this,e.call(h.u,{value:a,style:{glyphs:!0,sprite:!0},styleSpec:h.v}))}}const Hi=new h.q({"sky-color":new h.D(h.v.sky["sky-color"]),"horizon-color":new h.D(h.v.sky["horizon-color"]),"fog-color":new h.D(h.v.sky["fog-color"]),"fog-ground-blend":new h.D(h.v.sky["fog-ground-blend"]),"horizon-fog-blend":new h.D(h.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new h.D(h.v.sky["sky-horizon-blend"]),"atmosphere-blend":new h.D(h.v.sky["atmosphere-blend"])});class sn extends h.E{constructor(e){super(),this._transitionable=new h.T(Hi),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new h.z(0))}setSky(e,a={}){if(!this._validate(h.B,e,a)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const u in e){const d=e[u];u.endsWith("-transition")?this._transitionable.setTransition(u.slice(0,-11),d):this._transitionable.setValue(u,d)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,a,u={}){return(u==null?void 0:u.validate)!==!1&&h.t(this,e.call(h.u,h.e({value:a,style:{glyphs:!0,sprite:!0},styleSpec:h.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class Sr{constructor(e,a){this.width=e,this.height=a,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,a){const u=e.join(",")+String(a);return this.dashEntry[u]||(this.dashEntry[u]=this.addDash(e,a)),this.dashEntry[u]}getDashRanges(e,a,u){const d=[];let m=e.length%2==1?-e[e.length-1]*u:0,k=e[0]*u,E=!0;d.push({left:m,right:k,isDash:E,zeroLength:e[0]===0});let T=e[0];for(let I=1;I<e.length;I++){E=!E;const O=e[I];m=T*u,T+=O,k=T*u,d.push({left:m,right:k,isDash:E,zeroLength:O===0})}return d}addRoundDash(e,a,u){const d=a/2;for(let m=-u;m<=u;m++){const k=this.width*(this.nextRow+u+m);let E=0,T=e[E];for(let I=0;I<this.width;I++){I/T.right>1&&(T=e[++E]);const O=Math.abs(I-T.left),B=Math.abs(I-T.right),U=Math.min(O,B);let Z;const G=m/u*(d+1);if(T.isDash){const Q=d-Math.abs(G);Z=Math.sqrt(U*U+Q*Q)}else Z=d-Math.sqrt(U*U+G*G);this.data[k+I]=Math.max(0,Math.min(255,Z+128))}}}addRegularDash(e){for(let E=e.length-1;E>=0;--E){const T=e[E],I=e[E+1];T.zeroLength?e.splice(E,1):I&&I.isDash===T.isDash&&(I.left=T.left,e.splice(E,1))}const a=e[0],u=e[e.length-1];a.isDash===u.isDash&&(a.left=u.left-this.width,u.right=a.right+this.width);const d=this.width*this.nextRow;let m=0,k=e[m];for(let E=0;E<this.width;E++){E/k.right>1&&(k=e[++m]);const T=Math.abs(E-k.left),I=Math.abs(E-k.right),O=Math.min(T,I);this.data[d+E]=Math.max(0,Math.min(255,(k.isDash?O:-O)+128))}}addDash(e,a){const u=a?7:0,d=2*u+1;if(this.nextRow+d>this.height)return h.w("LineAtlas out of space"),null;let m=0;for(let E=0;E<e.length;E++)m+=e[E];if(m!==0){const E=this.width/m,T=this.getDashRanges(e,this.width,E);a?this.addRoundDash(T,E,u):this.addRegularDash(T)}const k={y:(this.nextRow+u+.5)/this.height,height:2*u/this.height,width:m};return this.nextRow+=d,this.dirty=!0,k}bind(e){const a=e.gl;this.texture?(a.bindTexture(a.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,a.texSubImage2D(a.TEXTURE_2D,0,0,0,this.width,this.height,a.ALPHA,a.UNSIGNED_BYTE,this.data))):(this.texture=a.createTexture(),a.bindTexture(a.TEXTURE_2D,this.texture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.REPEAT),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.REPEAT),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texImage2D(a.TEXTURE_2D,0,a.ALPHA,this.width,this.height,0,a.ALPHA,a.UNSIGNED_BYTE,this.data))}}const En="maplibre_preloaded_worker_pool";class Tn{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Tn.workerCount;)this.workers.push(new Worker(h.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(a=>{a.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[En]}numActive(){return Object.keys(this.active).length}}const Cn=Math.floor(R.hardwareConcurrency/2);let Se,He;function Ze(){return Se||(Se=new Tn),Se}Tn.workerCount=h.C(globalThis)?Math.max(Math.min(Cn,3),1):1;class lt{constructor(e,a){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=a;const u=this.workerPool.acquire(a);for(let d=0;d<u.length;d++){const m=new h.F(u[d],a);m.name=`Worker ${d}`,this.actors.push(m)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,a){const u=[];for(const d of this.actors)u.push(d.sendAsync({type:e,data:a}));return Promise.all(u)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(a=>{a.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,a){for(const u of this.actors)u.registerMessageHandler(e,a)}}function Vt(){return He||(He=new lt(Ze(),h.G),He.registerMessageHandler("GR",(g,e,a)=>h.m(e,a))),He}function Qt(g,e){const a=h.H();return h.J(a,a,[1,1,0]),h.K(a,a,[.5*g.width,.5*g.height,1]),h.L(a,a,g.calculatePosMatrix(e.toUnwrapped()))}function Et(g,e,a,u,d,m){const k=function(B,U,Z){if(B)for(const G of B){const Q=U[G];if(Q&&Q.source===Z&&Q.type==="fill-extrusion")return!0}else for(const G in U){const Q=U[G];if(Q.source===Z&&Q.type==="fill-extrusion")return!0}return!1}(d&&d.layers,e,g.id),E=m.maxPitchScaleFactor(),T=g.tilesIn(u,E,k);T.sort(vt);const I=[];for(const B of T)I.push({wrappedTileID:B.tileID.wrapped().key,queryResults:B.tile.queryRenderedFeatures(e,a,g._state,B.queryGeometry,B.cameraQueryGeometry,B.scale,d,m,E,Qt(g.transform,B.tileID))});const O=function(B){const U={},Z={};for(const G of B){const Q=G.queryResults,ne=G.wrappedTileID,re=Z[ne]=Z[ne]||{};for(const oe in Q){const X=Q[oe],ue=re[oe]=re[oe]||{},pe=U[oe]=U[oe]||[];for(const ye of X)ue[ye.featureIndex]||(ue[ye.featureIndex]=!0,pe.push(ye))}}return U}(I);for(const B in O)O[B].forEach(U=>{const Z=U.feature,G=g.getFeatureState(Z.layer["source-layer"],Z.id);Z.source=Z.layer.source,Z.layer["source-layer"]&&(Z.sourceLayer=Z.layer["source-layer"]),Z.state=G});return O}function vt(g,e){const a=g.tileID,u=e.tileID;return a.overscaledZ-u.overscaledZ||a.canonical.y-u.canonical.y||a.wrap-u.wrap||a.canonical.x-u.canonical.x}function ri(g,e,a){return h._(this,void 0,void 0,function*(){let u=g;if(g.url?u=(yield h.h(e.transformRequest(g.url,"Source"),a)).data:yield R.frameAsync(a),!u)return null;const d=h.M(h.e(u,g),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in u&&u.vector_layers&&(d.vectorLayerIds=u.vector_layers.map(m=>m.id)),d})}class xe{constructor(e,a){e&&(a?this.setSouthWest(e).setNorthEast(a):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof h.N?new h.N(e.lng,e.lat):h.N.convert(e),this}setSouthWest(e){return this._sw=e instanceof h.N?new h.N(e.lng,e.lat):h.N.convert(e),this}extend(e){const a=this._sw,u=this._ne;let d,m;if(e instanceof h.N)d=e,m=e;else{if(!(e instanceof xe))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(xe.convert(e)):this.extend(h.N.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(h.N.convert(e)):this;if(d=e._sw,m=e._ne,!d||!m)return this}return a||u?(a.lng=Math.min(d.lng,a.lng),a.lat=Math.min(d.lat,a.lat),u.lng=Math.max(m.lng,u.lng),u.lat=Math.max(m.lat,u.lat)):(this._sw=new h.N(d.lng,d.lat),this._ne=new h.N(m.lng,m.lat)),this}getCenter(){return new h.N((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new h.N(this.getWest(),this.getNorth())}getSouthEast(){return new h.N(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:a,lat:u}=h.N.convert(e);let d=this._sw.lng<=a&&a<=this._ne.lng;return this._sw.lng>this._ne.lng&&(d=this._sw.lng>=a&&a>=this._ne.lng),this._sw.lat<=u&&u<=this._ne.lat&&d}static convert(e){return e instanceof xe?e:e&&new xe(e)}static fromLngLat(e,a=0){const u=360*a/40075017,d=u/Math.cos(Math.PI/180*e.lat);return new xe(new h.N(e.lng-d,e.lat-u),new h.N(e.lng+d,e.lat+u))}adjustAntiMeridian(){const e=new h.N(this._sw.lng,this._sw.lat),a=new h.N(this._ne.lng,this._ne.lat);return new xe(e,e.lng>a.lng?new h.N(a.lng+360,a.lat):a)}}class wi{constructor(e,a,u){this.bounds=xe.convert(this.validateBounds(e)),this.minzoom=a||0,this.maxzoom=u||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const a=Math.pow(2,e.z),u=Math.floor(h.O(this.bounds.getWest())*a),d=Math.floor(h.Q(this.bounds.getNorth())*a),m=Math.ceil(h.O(this.bounds.getEast())*a),k=Math.ceil(h.Q(this.bounds.getSouth())*a);return e.x>=u&&e.x<m&&e.y>=d&&e.y<k}}class Go extends h.E{constructor(e,a,u,d){if(super(),this.id=e,this.dispatcher=u,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,h.e(this,h.M(a,["url","scheme","tileSize","promoteId"])),this._options=h.e({type:"vector"},a),this._collectResourceTiming=a.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d)}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield ri(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(h.e(this,e),e.bounds&&(this.tileBounds=new wi(e.bounds,this.minzoom,this.maxzoom)),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new h.j(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return h.e({},this._options)}loadTile(e){return h._(this,void 0,void 0,function*(){const a=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(a,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};u.request.collectResourceTiming=this._collectResourceTiming;let d="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((m,k)=>{e.reloadPromise={resolve:m,reject:k}})}else e.actor=this.dispatcher.getActor(),d="LT";e.abortController=new AbortController;try{const m=yield e.actor.sendAsync({type:d,data:u},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,m)}catch(m){if(delete e.abortController,e.aborted)return;if(m&&m.status!==404)throw m;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,a){if(a&&a.resourceTiming&&(e.resourceTiming=a.resourceTiming),a&&this.map._refreshExpiredTiles&&e.setExpiryData(a),e.loadVectorData(a,this.map.painter),e.reloadPromise){const u=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(u.resolve).catch(u.reject)}}abortTile(e){return h._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return h._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Zt extends h.E{constructor(e,a,u,d){super(),this.id=e,this.dispatcher=u,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=h.e({type:"raster"},a),h.e(this,h.M(a,["url","scheme","tileSize"]))}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield ri(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(h.e(this,e),e.bounds&&(this.tileBounds=new wi(e.bounds,this.minzoom,this.maxzoom)),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new h.j(e))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return h.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return h._(this,void 0,void 0,function*(){const a=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const u=yield _e.getImage(this.map._requestManager.transformRequest(a,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(u&&u.data){this.map._refreshExpiredTiles&&u.cacheControl&&u.expires&&e.setExpiryData({cacheControl:u.cacheControl,expires:u.expires});const d=this.map.painter.context,m=d.gl,k=u.data;e.texture=this.map.painter.getTileTexture(k.width),e.texture?e.texture.update(k,{useMipmap:!0}):(e.texture=new Mt(d,k,m.RGBA,{useMipmap:!0}),e.texture.bind(m.LINEAR,m.CLAMP_TO_EDGE,m.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(u){if(delete e.abortController,e.aborted)e.state="unloaded";else if(u)throw e.state="errored",u}})}abortTile(e){return h._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return h._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class ki extends Zt{constructor(e,a,u,d){super(e,a,u,d),this.type="raster-dem",this.maxzoom=22,this._options=h.e({type:"raster-dem"},a),this.encoding=a.encoding||"mapbox",this.redFactor=a.redFactor,this.greenFactor=a.greenFactor,this.blueFactor=a.blueFactor,this.baseShift=a.baseShift}loadTile(e){return h._(this,void 0,void 0,function*(){const a=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u=this.map._requestManager.transformRequest(a,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const d=yield _e.getImage(u,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(d&&d.data){const m=d.data;this.map._refreshExpiredTiles&&d.cacheControl&&d.expires&&e.setExpiryData({cacheControl:d.cacheControl,expires:d.expires});const k=h.b(m)&&h.U()?m:yield this.readImageNow(m),E={type:this.type,uid:e.uid,source:this.id,rawImageData:k,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const T=yield e.actor.sendAsync({type:"LDT",data:E});e.dem=T,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(d){if(delete e.abortController,e.aborted)e.state="unloaded";else if(d)throw e.state="errored",d}})}readImageNow(e){return h._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&h.V()){const a=e.width+2,u=e.height+2;try{return new h.R({width:a,height:u},yield h.W(e,-1,-1,a,u))}catch{}}return R.getImageData(e,1)})}_getNeighboringTiles(e){const a=e.canonical,u=Math.pow(2,a.z),d=(a.x-1+u)%u,m=a.x===0?e.wrap-1:e.wrap,k=(a.x+1+u)%u,E=a.x+1===u?e.wrap+1:e.wrap,T={};return T[new h.S(e.overscaledZ,m,a.z,d,a.y).key]={backfilled:!1},T[new h.S(e.overscaledZ,E,a.z,k,a.y).key]={backfilled:!1},a.y>0&&(T[new h.S(e.overscaledZ,m,a.z,d,a.y-1).key]={backfilled:!1},T[new h.S(e.overscaledZ,e.wrap,a.z,a.x,a.y-1).key]={backfilled:!1},T[new h.S(e.overscaledZ,E,a.z,k,a.y-1).key]={backfilled:!1}),a.y+1<u&&(T[new h.S(e.overscaledZ,m,a.z,d,a.y+1).key]={backfilled:!1},T[new h.S(e.overscaledZ,e.wrap,a.z,a.x,a.y+1).key]={backfilled:!1},T[new h.S(e.overscaledZ,E,a.z,k,a.y+1).key]={backfilled:!1}),T}unloadTile(e){return h._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class Yo extends h.E{constructor(e,a,u,d){super(),this.id=e,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=u.getActor(),this.setEventedParent(d),this._data=a.data,this._options=h.e({},a),this._collectResourceTiming=a.collectResourceTiming,a.maxzoom!==void 0&&(this.maxzoom=a.maxzoom),a.type&&(this.type=a.type),a.attribution&&(this.attribution=a.attribution),this.promoteId=a.promoteId;const m=h.X/this.tileSize;a.clusterMaxZoom!==void 0&&this.maxzoom<=a.clusterMaxZoom&&h.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${a.clusterMaxZoom}".`),this.workerOptions=h.e({source:this.id,cluster:a.cluster||!1,geojsonVtOptions:{buffer:(a.buffer!==void 0?a.buffer:128)*m,tolerance:(a.tolerance!==void 0?a.tolerance:.375)*m,extent:h.X,maxZoom:this.maxzoom,lineMetrics:a.lineMetrics||!1,generateId:a.generateId||!1},superclusterOptions:{maxZoom:a.clusterMaxZoom!==void 0?a.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,a.clusterMinPoints||2),extent:h.X,radius:(a.clusterRadius||50)*m,log:!1,generateId:a.generateId||!1},clusterProperties:a.clusterProperties,filter:a.filter},a.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return h._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return h._(this,void 0,void 0,function*(){const e=h.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,a,u){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:a,offset:u}})}_updateWorkerData(e){return h._(this,void 0,void 0,function*(){const a=h.e({type:this.type},this.workerOptions);e?a.dataDiff=e:typeof this._data=="string"?(a.request=this.map._requestManager.transformRequest(R.resolveURL(this._data),"Source"),a.request.collectResourceTiming=this._collectResourceTiming):a.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new h.k("dataloading",{dataType:"source"}));try{const u=yield this.actor.sendAsync({type:"LD",data:a});if(this._pendingLoads--,this._removed||u.abandoned)return void this.fire(new h.k("dataabort",{dataType:"source"}));let d=null;u.resourceTiming&&u.resourceTiming[this.id]&&(d=u.resourceTiming[this.id].slice(0));const m={dataType:"source"};this._collectResourceTiming&&d&&d.length>0&&h.e(m,{resourceTiming:d}),this.fire(new h.k("data",Object.assign(Object.assign({},m),{sourceDataType:"metadata"}))),this.fire(new h.k("data",Object.assign(Object.assign({},m),{sourceDataType:"content"})))}catch(u){if(this._pendingLoads--,this._removed)return void this.fire(new h.k("dataabort",{dataType:"source"}));this.fire(new h.j(u))}})}loaded(){return this._pendingLoads===0}loadTile(e){return h._(this,void 0,void 0,function*(){const a=e.actor?"RT":"LT";e.actor=this.actor;const u={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.abortController=new AbortController;const d=yield this.actor.sendAsync({type:a,data:u},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(d,this.map.painter,a==="RT")})}abortTile(e){return h._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return h._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return h.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var is=h.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class $r extends h.E{constructor(e,a,u,d){super(),this.id=e,this.dispatcher=u,this.coordinates=a.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(d),this.options=a}load(e){return h._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const a=yield _e.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,a&&a.data&&(this.image=a.data,e&&(this.coordinates=e),this._finishLoading())}catch(a){this._request=null,this._loaded=!0,this.fire(new h.j(a))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const a=e.map(h.Z.fromLngLat);this.tileID=function(d){let m=1/0,k=1/0,E=-1/0,T=-1/0;for(const U of d)m=Math.min(m,U.x),k=Math.min(k,U.y),E=Math.max(E,U.x),T=Math.max(T,U.y);const I=Math.max(E-m,T-k),O=Math.max(0,Math.floor(-Math.log(I)/Math.LN2)),B=Math.pow(2,O);return new h.a1(O,Math.floor((m+E)/2*B),Math.floor((k+T)/2*B))}(a),this.minzoom=this.maxzoom=this.tileID.z;const u=a.map(d=>this.tileID.getTilePoint(d)._round());return this._boundsArray=new h.$,this._boundsArray.emplaceBack(u[0].x,u[0].y,0,0),this._boundsArray.emplaceBack(u[1].x,u[1].y,h.X,0),this._boundsArray.emplaceBack(u[3].x,u[3].y,0,h.X),this._boundsArray.emplaceBack(u[2].x,u[2].y,h.X,h.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,a=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,is.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Mt(e,this.image,a.RGBA),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let u=!1;for(const d in this.tiles){const m=this.tiles[d];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,u=!0)}u&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return h._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Js extends $r{constructor(e,a,u,d){super(e,a,u,d),this.roundZoom=!0,this.type="video",this.options=a}load(){return h._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const a of e.urls)this.urls.push(this.map._requestManager.transformRequest(a,"Source").url);try{const a=yield h.a3(this.urls);if(this._loaded=!0,!a)return;this.video=a,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(a){this.fire(new h.j(a))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const a=this.video.seekable;e<a.start(0)||e>a.end(0)?this.fire(new h.j(new h.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${a.start(0)} and ${a.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,a=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,is.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,this.video)):(this.texture=new Mt(e,this.video,a.RGBA),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let u=!1;for(const d in this.tiles){const m=this.tiles[d];m.state!=="loaded"&&(m.state="loaded",m.texture=this.texture,u=!0)}u&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Un extends $r{constructor(e,a,u,d){super(e,a,u,d),a.coordinates?Array.isArray(a.coordinates)&&a.coordinates.length===4&&!a.coordinates.some(m=>!Array.isArray(m)||m.length!==2||m.some(k=>typeof k!="number"))||this.fire(new h.j(new h.a2(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.j(new h.a2(`sources.${e}`,null,'missing required property "coordinates"'))),a.animate&&typeof a.animate!="boolean"&&this.fire(new h.j(new h.a2(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),a.canvas?typeof a.canvas=="string"||a.canvas instanceof HTMLCanvasElement||this.fire(new h.j(new h.a2(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new h.j(new h.a2(`sources.${e}`,null,'missing required property "canvas"'))),this.options=a,this.animate=a.animate===void 0||a.animate}load(){return h._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new h.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const a=this.map.painter.context,u=a.gl;this.boundsBuffer||(this.boundsBuffer=a.createVertexBuffer(this._boundsArray,is.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Mt(a,this.canvas,u.RGBA,{premultiply:!0});let d=!1;for(const m in this.tiles){const k=this.tiles[m];k.state!=="loaded"&&(k.state="loaded",k.texture=this.texture,d=!0)}d&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const Xo={},Ko=g=>{switch(g){case"geojson":return Yo;case"image":return $r;case"raster":return Zt;case"raster-dem":return ki;case"vector":return Go;case"video":return Js;case"canvas":return Un}return Xo[g]},De="RTLPluginLoaded";class Er extends h.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Vt()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(a=>{throw this.status="error",a})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return h._(this,arguments,void 0,function*(a,u=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=R.resolveURL(a),!this.url)throw new Error(`requested url ${a} is invalid`);if(this.status==="unavailable"){if(!u)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return h._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new h.k(De))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let on=null;function Tr(){return on||(on=new Er),on}class ns{constructor(e,a){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=h.a4(),this.uses=0,this.tileSize=a,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(e){const a=e+this.timeAdded;a<this.fadeEndTime||(this.fadeEndTime=a)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,a,u){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(d,m){const k={};if(!m)return k;for(const E of d){const T=E.layerIds.map(I=>m.getLayer(I)).filter(Boolean);if(T.length!==0){E.layers=T,E.stateDependentLayerIds&&(E.stateDependentLayers=E.stateDependentLayerIds.map(I=>T.filter(O=>O.id===I)[0]));for(const I of T)k[I.id]=E}}return k}(e.buckets,a.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const m=this.buckets[d];if(m instanceof h.a6){if(this.hasSymbolBuckets=!0,!u)break;m.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const m=this.buckets[d];if(m instanceof h.a6&&m.hasRTLText){this.hasRTLText=!0,Tr().lazyLoad();break}}this.queryPadding=0;for(const d in this.buckets){const m=this.buckets[d];this.queryPadding=Math.max(this.queryPadding,a.style.getLayer(d).queryRadius(m))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new h.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const u in this.buckets){const d=this.buckets[u];d.uploadPending()&&d.upload(e)}const a=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Mt(e,this.imageAtlas.image,a.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Mt(e,this.glyphAtlasImage,a.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,a,u,d,m,k,E,T,I,O){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:d,cameraQueryGeometry:m,scale:k,tileSize:this.tileSize,pixelPosMatrix:O,transform:T,params:E,queryPadding:this.queryPadding*I},e,a,u):{}}querySourceFeatures(e,a){const u=this.latestFeatureIndex;if(!u||!u.rawTileData)return;const d=u.loadVTLayers(),m=a&&a.sourceLayer?a.sourceLayer:"",k=d._geojsonTileLayer||d[m];if(!k)return;const E=h.a7(a&&a.filter),{z:T,x:I,y:O}=this.tileID.canonical,B={z:T,x:I,y:O};for(let U=0;U<k.length;U++){const Z=k.feature(U);if(E.needGeometry){const ne=h.a8(Z,!0);if(!E.filter(new h.z(this.tileID.overscaledZ),ne,this.tileID.canonical))continue}else if(!E.filter(new h.z(this.tileID.overscaledZ),Z))continue;const G=u.getId(Z,m),Q=new h.a9(Z,T,I,O,G);Q.tile=B,e.push(Q)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const a=this.expirationTime;if(e.cacheControl){const u=h.aa(e.cacheControl);u["max-age"]&&(this.expirationTime=Date.now()+1e3*u["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const u=Date.now();let d=!1;if(this.expirationTime>u)d=!1;else if(a)if(this.expirationTime<a)d=!0;else{const m=this.expirationTime-a;m?this.expirationTime=u+Math.max(m,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,a){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const u=this.latestFeatureIndex.loadVTLayers();for(const d in this.buckets){if(!a.style.hasLayer(d))continue;const m=this.buckets[d],k=m.layers[0].sourceLayer||"_geojsonTileLayer",E=u[k],T=e[k];if(!E||!T||Object.keys(T).length===0)continue;m.update(T,E,this.imageAtlas&&this.imageAtlas.patternPositions||{});const I=a&&a.style&&a.style.getLayer(d);I&&(this.queryPadding=Math.max(this.queryPadding,I.queryRadius(m)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<R.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=R.now()+e}setDependencies(e,a){const u={};for(const d of a)u[d]=!0;this.dependencies[e]=u}hasDependency(e,a){for(const u of e){const d=this.dependencies[u];if(d){for(const m of a)if(d[m])return!0}}return!1}}class Fe{constructor(e,a){this.max=e,this.onRemove=a,this.reset()}reset(){for(const e in this.data)for(const a of this.data[e])a.timeout&&clearTimeout(a.timeout),this.onRemove(a.value);return this.data={},this.order=[],this}add(e,a,u){const d=e.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const m={value:a,timeout:void 0};if(u!==void 0&&(m.timeout=setTimeout(()=>{this.remove(e,m)},u)),this.data[d].push(m),this.order.push(d),this.order.length>this.max){const k=this._getAndRemoveByKey(this.order[0]);k&&this.onRemove(k)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const a=this.data[e].shift();return a.timeout&&clearTimeout(a.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),a.value}getByKey(e){const a=this.data[e];return a?a[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,a){if(!this.has(e))return this;const u=e.wrapped().key,d=a===void 0?0:this.data[u].indexOf(a),m=this.data[u][d];return this.data[u].splice(d,1),m.timeout&&clearTimeout(m.timeout),this.data[u].length===0&&delete this.data[u],this.onRemove(m.value),this.order.splice(this.order.indexOf(u),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}filter(e){const a=[];for(const u in this.data)for(const d of this.data[u])e(d.value)||a.push(d);for(const u of a)this.remove(u.value.tileID,u)}}class Ct{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,a,u){const d=String(a);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][d]=this.stateChanges[e][d]||{},h.e(this.stateChanges[e][d],u),this.deletedStates[e]===null){this.deletedStates[e]={};for(const m in this.state[e])m!==d&&(this.deletedStates[e][m]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][d]===null){this.deletedStates[e][d]={};for(const m in this.state[e][d])u[m]||(this.deletedStates[e][d][m]=null)}else for(const m in u)this.deletedStates[e]&&this.deletedStates[e][d]&&this.deletedStates[e][d][m]===null&&delete this.deletedStates[e][d][m]}removeFeatureState(e,a,u){if(this.deletedStates[e]===null)return;const d=String(a);if(this.deletedStates[e]=this.deletedStates[e]||{},u&&a!==void 0)this.deletedStates[e][d]!==null&&(this.deletedStates[e][d]=this.deletedStates[e][d]||{},this.deletedStates[e][d][u]=null);else if(a!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][d])for(u in this.deletedStates[e][d]={},this.stateChanges[e][d])this.deletedStates[e][d][u]=null;else this.deletedStates[e][d]=null;else this.deletedStates[e]=null}getState(e,a){const u=String(a),d=h.e({},(this.state[e]||{})[u],(this.stateChanges[e]||{})[u]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const m=this.deletedStates[e][a];if(m===null)return{};for(const k in m)delete d[k]}return d}initializeTileState(e,a){e.setFeatureState(this.state,a)}coalesceChanges(e,a){const u={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const m={};for(const k in this.stateChanges[d])this.state[d][k]||(this.state[d][k]={}),h.e(this.state[d][k],this.stateChanges[d][k]),m[k]=this.state[d][k];u[d]=m}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const m={};if(this.deletedStates[d]===null)for(const k in this.state[d])m[k]={},this.state[d][k]={};else for(const k in this.deletedStates[d]){if(this.deletedStates[d][k]===null)this.state[d][k]={};else for(const E of Object.keys(this.deletedStates[d][k]))delete this.state[d][k][E];m[k]=this.state[d][k]}u[d]=u[d]||{},h.e(u[d],m)}if(this.stateChanges={},this.deletedStates={},Object.keys(u).length!==0)for(const d in e)e[d].setFeatureState(u,a)}}class mt extends h.E{constructor(e,a,u){super(),this.id=e,this.dispatcher=u,this.on("data",d=>this._dataHandler(d)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((d,m,k,E)=>{const T=new(Ko(m.type))(d,m,k,E);if(T.id!==d)throw new Error(`Expected Source id to be ${d} instead of ${T.id}`);return T})(e,a,u,this),this._tiles={},this._cache=new Fe(0,d=>this._unloadTile(d)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ct,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!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 e in this._tiles){const a=this._tiles[e];if(a.state!=="loaded"&&a.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,a,u){return h._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,a,u)}catch(d){e.state="errored",d.status!==404?this._source.fire(new h.j(d,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new h.k("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const a in this._tiles){const u=this._tiles[a];u.upload(e),u.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(fn).map(e=>e.key)}getRenderableIds(e){const a=[];for(const u in this._tiles)this._isIdRenderable(u,e)&&a.push(this._tiles[u]);return e?a.sort((u,d)=>{const m=u.tileID,k=d.tileID,E=new h.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),T=new h.P(k.canonical.x,k.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-k.overscaledZ||T.y-E.y||T.x-E.x}).map(u=>u.tileID.key):a.map(u=>u.tileID).sort(fn).map(u=>u.key)}hasRenderableParent(e){const a=this.findLoadedParent(e,0);return!!a&&this._isIdRenderable(a.tileID.key)}_isIdRenderable(e,a){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(a||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}}_reloadTile(e,a){return h._(this,void 0,void 0,function*(){const u=this._tiles[e];u&&(u.state!=="loading"&&(u.state=a),yield this._loadTile(u,e,a))})}_tileLoaded(e,a,u){e.timeAdded=R.now(),u==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(a,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new h.k("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const a=this.getRenderableIds();for(let d=0;d<a.length;d++){const m=a[d];if(e.neighboringTiles&&e.neighboringTiles[m]){const k=this.getTileByID(m);u(e,k),u(k,e)}}function u(d,m){d.needsHillshadePrepare=!0,d.needsTerrainPrepare=!0;let k=m.tileID.canonical.x-d.tileID.canonical.x;const E=m.tileID.canonical.y-d.tileID.canonical.y,T=Math.pow(2,d.tileID.canonical.z),I=m.tileID.key;k===0&&E===0||Math.abs(E)>1||(Math.abs(k)>1&&(Math.abs(k+T)===1?k+=T:Math.abs(k-T)===1&&(k-=T)),m.dem&&d.dem&&(d.dem.backfillBorder(m.dem,k,E),d.neighboringTiles&&d.neighboringTiles[I]&&(d.neighboringTiles[I].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,a,u,d){for(const m in this._tiles){let k=this._tiles[m];if(d[m]||!k.hasData()||k.tileID.overscaledZ<=a||k.tileID.overscaledZ>u)continue;let E=k.tileID;for(;k&&k.tileID.overscaledZ>a+1;){const I=k.tileID.scaledTo(k.tileID.overscaledZ-1);k=this._tiles[I.key],k&&k.hasData()&&(E=I)}let T=E;for(;T.overscaledZ>a;)if(T=T.scaledTo(T.overscaledZ-1),e[T.key]){d[E.key]=E;break}}}findLoadedParent(e,a){if(e.key in this._loadedParentTiles){const u=this._loadedParentTiles[e.key];return u&&u.tileID.overscaledZ>=a?u:null}for(let u=e.overscaledZ-1;u>=a;u--){const d=e.scaledTo(u),m=this._getLoadedTile(d);if(m)return m}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const a=this._tiles[e.key];return a&&a.hasData()?a:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const a=Math.ceil(e.width/this._source.tileSize)+1,u=Math.ceil(e.height/this._source.tileSize)+1,d=Math.floor(a*u*(this._maxTileCacheZoomLevels===null?h.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),m=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,d):d;this._cache.setMaxSize(m)}handleWrapJump(e){const a=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,a){const u={};for(const d in this._tiles){const m=this._tiles[d];m.tileID=m.tileID.unwrapTo(m.tileID.wrap+a),u[m.tileID.key]=m}this._tiles=u;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(d,this._tiles[d])}}_updateCoveredAndRetainedTiles(e,a,u,d,m,k){const E={},T={},I=Object.keys(e),O=R.now();for(const B of I){const U=e[B],Z=this._tiles[B];if(!Z||Z.fadeEndTime!==0&&Z.fadeEndTime<=O)continue;const G=this.findLoadedParent(U,a),Q=this.findLoadedSibling(U),ne=G||Q||null;ne&&(this._addTile(ne.tileID),E[ne.tileID.key]=ne.tileID),T[B]=U}this._retainLoadedChildren(T,d,u,e);for(const B in E)e[B]||(this._coveredTiles[B]=!0,e[B]=E[B]);if(k){const B={},U={};for(const Z of m)this._tiles[Z.key].hasData()?B[Z.key]=Z:U[Z.key]=Z;for(const Z in U){const G=U[Z].children(this._source.maxzoom);this._tiles[G[0].key]&&this._tiles[G[1].key]&&this._tiles[G[2].key]&&this._tiles[G[3].key]&&(B[G[0].key]=e[G[0].key]=G[0],B[G[1].key]=e[G[1].key]=G[1],B[G[2].key]=e[G[2].key]=G[2],B[G[3].key]=e[G[3].key]=G[3],delete U[Z])}for(const Z in U){const G=U[Z],Q=this.findLoadedParent(G,this._source.minzoom),ne=this.findLoadedSibling(G),re=Q||ne||null;if(re){B[re.tileID.key]=e[re.tileID.key]=re.tileID;for(const oe in B)B[oe].isChildOf(re.tileID)&&delete B[oe]}}for(const Z in this._tiles)B[Z]||(this._coveredTiles[Z]=!0)}}update(e,a){if(!this._sourceLoaded||this._paused)return;let u;this.transform=e,this.terrain=a,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?u=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(O=>new h.S(O.canonical.z,O.wrap,O.canonical.z,O.canonical.x,O.canonical.y)):(u=e.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:a}),this._source.hasTile&&(u=u.filter(O=>this._source.hasTile(O)))):u=[];const d=e.coveringZoomLevel(this._source),m=Math.max(d-mt.maxOverzooming,this._source.minzoom),k=Math.max(d+mt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const O={};for(const B of u)if(B.canonical.z>this._source.minzoom){const U=B.scaledTo(B.canonical.z-1);O[U.key]=U;const Z=B.scaledTo(Math.max(this._source.minzoom,Math.min(B.canonical.z,5)));O[Z.key]=Z}u=u.concat(Object.values(O))}const E=u.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,E&&this.fire(new h.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const T=this._updateRetainedTiles(u,d);ir(this._source.type)&&this._updateCoveredAndRetainedTiles(T,m,k,d,u,a);for(const O in T)this._tiles[O].clearFadeHold();const I=h.ab(this._tiles,T);for(const O of I){const B=this._tiles[O];B.hasSymbolBuckets&&!B.holdingForFade()?B.setHoldDuration(this.map._fadeDuration):B.hasSymbolBuckets&&!B.symbolFadeFinished()||this._removeTile(O)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,a){var u;const d={},m={},k=Math.max(a-mt.maxOverzooming,this._source.minzoom),E=Math.max(a+mt.maxUnderzooming,this._source.minzoom),T={};for(const I of e){const O=this._addTile(I);d[I.key]=I,O.hasData()||a<this._source.maxzoom&&(T[I.key]=I)}this._retainLoadedChildren(T,a,E,d);for(const I of e){let O=this._tiles[I.key];if(O.hasData())continue;if(a+1>this._source.maxzoom){const U=I.children(this._source.maxzoom)[0],Z=this.getTile(U);if(Z&&Z.hasData()){d[U.key]=U;continue}}else{const U=I.children(this._source.maxzoom);if(d[U[0].key]&&d[U[1].key]&&d[U[2].key]&&d[U[3].key])continue}let B=O.wasRequested();for(let U=I.overscaledZ-1;U>=k;--U){const Z=I.scaledTo(U);if(m[Z.key])break;if(m[Z.key]=!0,O=this.getTile(Z),!O&&B&&(O=this._addTile(Z)),O){const G=O.hasData();if((G||!(!((u=this.map)===null||u===void 0)&&u.cancelPendingTileRequestsWhileZooming)||B)&&(d[Z.key]=Z),B=O.wasRequested(),G)break}}}return d}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const a=[];let u,d=this._tiles[e].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){u=this._loadedParentTiles[d.key];break}a.push(d.key);const m=d.scaledTo(d.overscaledZ-1);if(u=this._getLoadedTile(m),u)break;d=m}for(const m of a)this._loadedParentTiles[m]=u}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const a=this._tiles[e].tileID,u=this._getLoadedTile(a);this._loadedSiblingTiles[a.key]=u}}_addTile(e){let a=this._tiles[e.key];if(a)return a;a=this._cache.getAndRemove(e),a&&(this._setTileReloadTimer(e.key,a),a.tileID=e,this._state.initializeTileState(a,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,a)));const u=a;return a||(a=new ns(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(a,e.key,a.state)),a.uses++,this._tiles[e.key]=a,u||this._source.fire(new h.k("dataloading",{tile:a,coord:a.tileID,dataType:"source"})),a}_setTileReloadTimer(e,a){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const u=a.getExpiryTimeout();u&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},u))}_removeTile(e){const a=this._tiles[e];a&&(a.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),a.uses>0||(a.hasData()&&a.state!=="reloading"?this._cache.add(a.tileID,a,a.getExpiryTimeout()):(a.aborted=!0,this._abortTile(a),this._unloadTile(a))))}_dataHandler(e){const a=e.sourceDataType;e.dataType==="source"&&a==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&a==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,a,u){const d=[],m=this.transform;if(!m)return d;const k=u?m.getCameraQueryGeometry(e):e,E=e.map(G=>m.pointCoordinate(G,this.terrain)),T=k.map(G=>m.pointCoordinate(G,this.terrain)),I=this.getIds();let O=1/0,B=1/0,U=-1/0,Z=-1/0;for(const G of T)O=Math.min(O,G.x),B=Math.min(B,G.y),U=Math.max(U,G.x),Z=Math.max(Z,G.y);for(let G=0;G<I.length;G++){const Q=this._tiles[I[G]];if(Q.holdingForFade())continue;const ne=Q.tileID,re=Math.pow(2,m.zoom-Q.tileID.overscaledZ),oe=a*Q.queryPadding*h.X/Q.tileSize/re,X=[ne.getTilePoint(new h.Z(O,B)),ne.getTilePoint(new h.Z(U,Z))];if(X[0].x-oe<h.X&&X[0].y-oe<h.X&&X[1].x+oe>=0&&X[1].y+oe>=0){const ue=E.map(ye=>ne.getTilePoint(ye)),pe=T.map(ye=>ne.getTilePoint(ye));d.push({tile:Q,tileID:ne,queryGeometry:ue,cameraQueryGeometry:pe,scale:re})}}return d}getVisibleCoordinates(e){const a=this.getRenderableIds(e).map(u=>this._tiles[u].tileID);for(const u of a)u.posMatrix=this.transform.calculatePosMatrix(u.toUnwrapped());return a}hasTransition(){if(this._source.hasTransition())return!0;if(ir(this._source.type)){const e=R.now();for(const a in this._tiles)if(this._tiles[a].fadeEndTime>=e)return!0}return!1}setFeatureState(e,a,u){this._state.updateState(e=e||"_geojsonTileLayer",a,u)}removeFeatureState(e,a,u){this._state.removeFeatureState(e=e||"_geojsonTileLayer",a,u)}getFeatureState(e,a){return this._state.getState(e=e||"_geojsonTileLayer",a)}setDependencies(e,a,u){const d=this._tiles[e];d&&d.setDependencies(a,u)}reloadTilesForDependencies(e,a){for(const u in this._tiles)this._tiles[u].hasDependency(e,a)&&this._reloadTile(u,"reloading");this._cache.filter(u=>!u.hasDependency(e,a))}}function fn(g,e){const a=Math.abs(2*g.wrap)-+(g.wrap<0),u=Math.abs(2*e.wrap)-+(e.wrap<0);return g.overscaledZ-e.overscaledZ||u-a||e.canonical.y-g.canonical.y||e.canonical.x-g.canonical.x}function ir(g){return g==="raster"||g==="image"||g==="video"}mt.maxOverzooming=10,mt.maxUnderzooming=3;class bt{constructor(e,a){this.reset(e,a)}reset(e,a){this.points=e||[],this._distances=[0];for(let u=1;u<this.points.length;u++)this._distances[u]=this._distances[u-1]+this.points[u].dist(this.points[u-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(a||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=h.ac(e,0,1);let a=1,u=this._distances[a];const d=e*this.paddedLength+this.padding;for(;u<d&&a<this._distances.length;)u=this._distances[++a];const m=a-1,k=this._distances[m],E=u-k,T=E>0?(d-k)/E:0;return this.points[m].mult(1-T).add(this.points[a].mult(T))}}function Cr(g,e){let a=!0;return g==="always"||g!=="never"&&e!=="never"||(a=!1),a}class jr{constructor(e,a,u){const d=this.boxCells=[],m=this.circleCells=[];this.xCellCount=Math.ceil(e/u),this.yCellCount=Math.ceil(a/u);for(let k=0;k<this.xCellCount*this.yCellCount;k++)d.push([]),m.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=a,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/a,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,a,u,d,m){this._forEachCell(a,u,d,m,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(a),this.bboxes.push(u),this.bboxes.push(d),this.bboxes.push(m)}insertCircle(e,a,u,d){this._forEachCell(a-d,u-d,a+d,u+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(a),this.circles.push(u),this.circles.push(d)}_insertBoxCell(e,a,u,d,m,k){this.boxCells[m].push(k)}_insertCircleCell(e,a,u,d,m,k){this.circleCells[m].push(k)}_query(e,a,u,d,m,k,E){if(u<0||e>this.width||d<0||a>this.height)return[];const T=[];if(e<=0&&a<=0&&this.width<=u&&this.height<=d){if(m)return[{key:null,x1:e,y1:a,x2:u,y2:d}];for(let I=0;I<this.boxKeys.length;I++)T.push({key:this.boxKeys[I],x1:this.bboxes[4*I],y1:this.bboxes[4*I+1],x2:this.bboxes[4*I+2],y2:this.bboxes[4*I+3]});for(let I=0;I<this.circleKeys.length;I++){const O=this.circles[3*I],B=this.circles[3*I+1],U=this.circles[3*I+2];T.push({key:this.circleKeys[I],x1:O-U,y1:B-U,x2:O+U,y2:B+U})}}else this._forEachCell(e,a,u,d,this._queryCell,T,{hitTest:m,overlapMode:k,seenUids:{box:{},circle:{}}},E);return T}query(e,a,u,d){return this._query(e,a,u,d,!1,null)}hitTest(e,a,u,d,m,k){return this._query(e,a,u,d,!0,m,k).length>0}hitTestCircle(e,a,u,d,m){const k=e-u,E=e+u,T=a-u,I=a+u;if(E<0||k>this.width||I<0||T>this.height)return!1;const O=[];return this._forEachCell(k,T,E,I,this._queryCellCircle,O,{hitTest:!0,overlapMode:d,circle:{x:e,y:a,radius:u},seenUids:{box:{},circle:{}}},m),O.length>0}_queryCell(e,a,u,d,m,k,E,T){const{seenUids:I,hitTest:O,overlapMode:B}=E,U=this.boxCells[m];if(U!==null){const G=this.bboxes;for(const Q of U)if(!I.box[Q]){I.box[Q]=!0;const ne=4*Q,re=this.boxKeys[Q];if(e<=G[ne+2]&&a<=G[ne+3]&&u>=G[ne+0]&&d>=G[ne+1]&&(!T||T(re))&&(!O||!Cr(B,re.overlapMode))&&(k.push({key:re,x1:G[ne],y1:G[ne+1],x2:G[ne+2],y2:G[ne+3]}),O))return!0}}const Z=this.circleCells[m];if(Z!==null){const G=this.circles;for(const Q of Z)if(!I.circle[Q]){I.circle[Q]=!0;const ne=3*Q,re=this.circleKeys[Q];if(this._circleAndRectCollide(G[ne],G[ne+1],G[ne+2],e,a,u,d)&&(!T||T(re))&&(!O||!Cr(B,re.overlapMode))){const oe=G[ne],X=G[ne+1],ue=G[ne+2];if(k.push({key:re,x1:oe-ue,y1:X-ue,x2:oe+ue,y2:X+ue}),O)return!0}}}return!1}_queryCellCircle(e,a,u,d,m,k,E,T){const{circle:I,seenUids:O,overlapMode:B}=E,U=this.boxCells[m];if(U!==null){const G=this.bboxes;for(const Q of U)if(!O.box[Q]){O.box[Q]=!0;const ne=4*Q,re=this.boxKeys[Q];if(this._circleAndRectCollide(I.x,I.y,I.radius,G[ne+0],G[ne+1],G[ne+2],G[ne+3])&&(!T||T(re))&&!Cr(B,re.overlapMode))return k.push(!0),!0}}const Z=this.circleCells[m];if(Z!==null){const G=this.circles;for(const Q of Z)if(!O.circle[Q]){O.circle[Q]=!0;const ne=3*Q,re=this.circleKeys[Q];if(this._circlesCollide(G[ne],G[ne+1],G[ne+2],I.x,I.y,I.radius)&&(!T||T(re))&&!Cr(B,re.overlapMode))return k.push(!0),!0}}}_forEachCell(e,a,u,d,m,k,E,T){const I=this._convertToXCellCoord(e),O=this._convertToYCellCoord(a),B=this._convertToXCellCoord(u),U=this._convertToYCellCoord(d);for(let Z=I;Z<=B;Z++)for(let G=O;G<=U;G++)if(m.call(this,e,a,u,d,this.xCellCount*G+Z,k,E,T))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,a,u,d,m,k){const E=d-e,T=m-a,I=u+k;return I*I>E*E+T*T}_circleAndRectCollide(e,a,u,d,m,k,E){const T=(k-d)/2,I=Math.abs(e-(d+T));if(I>T+u)return!1;const O=(E-m)/2,B=Math.abs(a-(m+O));if(B>O+u)return!1;if(I<=T||B<=O)return!0;const U=I-T,Z=B-O;return U*U+Z*Z<=u*u}}function rs(g,e,a,u,d){const m=h.H();return e?(h.K(m,m,[1/d,1/d,1]),a||h.ad(m,m,u.angle)):h.L(m,u.labelPlaneMatrix,g),m}function Mr(g,e,a,u,d){if(e){const m=h.ae(g);return h.K(m,m,[d,d,1]),a||h.ad(m,m,-u.angle),m}return u.glCoordMatrix}function ee(g,e,a,u){let d;u?(d=[g,e,u(g,e),1],h.af(d,d,a)):(d=[g,e,0,1],$t(d,d,a));const m=d[3];return{point:new h.P(d[0]/m,d[1]/m),signedDistanceFromCamera:m,isOccluded:!1}}function $(g,e){return .5+g/e*.5}function V(g,e){return g.x>=-e[0]&&g.x<=e[0]&&g.y>=-e[1]&&g.y<=e[1]}function W(g,e,a,u,d,m,k,E,T,I,O,B,U,Z,G){const Q=u?g.textSizeData:g.iconSizeData,ne=h.ag(Q,a.transform.zoom),re=[256/a.width*2+1,256/a.height*2+1],oe=u?g.text.dynamicLayoutVertexArray:g.icon.dynamicLayoutVertexArray;oe.clear();const X=g.lineVertexArray,ue=u?g.text.placedSymbolArray:g.icon.placedSymbolArray,pe=a.transform.width/a.transform.height;let ye=!1;for(let Ce=0;Ce<ue.length;Ce++){const Ae=ue.get(Ce);if(Ae.hidden||Ae.writingMode===h.ah.vertical&&!ye){ht(Ae.numGlyphs,oe);continue}ye=!1;const $e=ee(Ae.anchorX,Ae.anchorY,e,G);if(!V($e.point,re)){ht(Ae.numGlyphs,oe);continue}const We=$(a.transform.cameraToCenterDistance,$e.signedDistanceFromCamera),Oe=h.ai(Q,ne,Ae),Le=k?Oe/We:Oe*We,tt={getElevation:G,labelPlaneMatrix:d,lineVertexArray:X,pitchWithMap:k,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:I,tileAnchorPoint:new h.P(Ae.anchorX,Ae.anchorY),unwrappedTileID:O,width:B,height:U,translation:Z},xt=de(tt,Ae,Le,!1,E,e,m,g.glyphOffsetArray,oe,pe,T);ye=xt.useVertical,(xt.notEnoughRoom||ye||xt.needsFlipping&&de(tt,Ae,Le,!0,E,e,m,g.glyphOffsetArray,oe,pe,T).notEnoughRoom)&&ht(Ae.numGlyphs,oe)}u?g.text.dynamicLayoutVertexBuffer.updateData(oe):g.icon.dynamicLayoutVertexBuffer.updateData(oe)}function J(g,e,a,u,d,m,k,E){const T=m.glyphStartIndex+m.numGlyphs,I=m.lineStartIndex,O=m.lineStartIndex+m.lineLength,B=e.getoffsetX(m.glyphStartIndex),U=e.getoffsetX(T-1),Z=Re(g*B,a,u,d,m.segment,I,O,E,k);if(!Z)return null;const G=Re(g*U,a,u,d,m.segment,I,O,E,k);return G?E.projectionCache.anyProjectionOccluded?null:{first:Z,last:G}:null}function ce(g,e,a,u){return g===h.ah.horizontal&&Math.abs(a.y-e.y)>Math.abs(a.x-e.x)*u?{useVertical:!0}:(g===h.ah.vertical?e.y<a.y:e.x>a.x)?{needsFlipping:!0}:null}function de(g,e,a,u,d,m,k,E,T,I,O){const B=a/24,U=e.lineOffsetX*B,Z=e.lineOffsetY*B;let G;if(e.numGlyphs>1){const Q=e.glyphStartIndex+e.numGlyphs,ne=e.lineStartIndex,re=e.lineStartIndex+e.lineLength,oe=J(B,E,U,Z,u,e,O,g);if(!oe)return{notEnoughRoom:!0};const X=ee(oe.first.point.x,oe.first.point.y,k,g.getElevation).point,ue=ee(oe.last.point.x,oe.last.point.y,k,g.getElevation).point;if(d&&!u){const pe=ce(e.writingMode,X,ue,I);if(pe)return pe}G=[oe.first];for(let pe=e.glyphStartIndex+1;pe<Q-1;pe++)G.push(Re(B*E.getoffsetX(pe),U,Z,u,e.segment,ne,re,g,O));G.push(oe.last)}else{if(d&&!u){const ne=ee(g.tileAnchorPoint.x,g.tileAnchorPoint.y,m,g.getElevation).point,re=e.lineStartIndex+e.segment+1,oe=new h.P(g.lineVertexArray.getx(re),g.lineVertexArray.gety(re)),X=ee(oe.x,oe.y,m,g.getElevation),ue=X.signedDistanceFromCamera>0?X.point:function(ye,Ce,Ae,$e,We,Oe){return me(ye,Ce,Ae,1,We,Oe)}(g.tileAnchorPoint,oe,ne,0,m,g),pe=ce(e.writingMode,ne,ue,I);if(pe)return pe}const Q=Re(B*E.getoffsetX(e.glyphStartIndex),U,Z,u,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,g,O);if(!Q||g.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};G=[Q]}for(const Q of G)h.aj(T,Q.point,Q.angle);return{}}function me(g,e,a,u,d,m){const k=g.add(g.sub(e)._unit()),E=d!==void 0?ee(k.x,k.y,d,m.getElevation).point:ke(k.x,k.y,m).point,T=a.sub(E);return a.add(T._mult(u/T.mag()))}function se(g,e,a){const u=e.projectionCache;if(u.projections[g])return u.projections[g];const d=new h.P(e.lineVertexArray.getx(g),e.lineVertexArray.gety(g)),m=ke(d.x,d.y,e);if(m.signedDistanceFromCamera>0)return u.projections[g]=m.point,u.anyProjectionOccluded=u.anyProjectionOccluded||m.isOccluded,m.point;const k=g-a.direction;return function(E,T,I,O,B){return me(E,T,I,O,void 0,B)}(a.distanceFromAnchor===0?e.tileAnchorPoint:new h.P(e.lineVertexArray.getx(k),e.lineVertexArray.gety(k)),d,a.previousVertex,a.absOffsetX-a.distanceFromAnchor+1,e)}function ke(g,e,a){const u=g+a.translation[0],d=e+a.translation[1];let m;return!a.pitchWithMap&&a.projection.useSpecialProjectionForSymbols?(m=a.projection.projectTileCoordinates(u,d,a.unwrappedTileID,a.getElevation),m.point.x=(.5*m.point.x+.5)*a.width,m.point.y=(.5*-m.point.y+.5)*a.height):(m=ee(u,d,a.labelPlaneMatrix,a.getElevation),m.isOccluded=!1),m}function Me(g,e,a){return g._unit()._perp()._mult(e*a)}function ve(g,e,a,u,d,m,k,E,T){if(E.projectionCache.offsets[g])return E.projectionCache.offsets[g];const I=a.add(e);if(g+T.direction<u||g+T.direction>=d)return E.projectionCache.offsets[g]=I,I;const O=se(g+T.direction,E,T),B=Me(O.sub(a),k,T.direction),U=a.add(B),Z=O.add(B);return E.projectionCache.offsets[g]=h.ak(m,I,U,Z)||I,E.projectionCache.offsets[g]}function Re(g,e,a,u,d,m,k,E,T){const I=u?g-e:g+e;let O=I>0?1:-1,B=0;u&&(O*=-1,B=Math.PI),O<0&&(B+=Math.PI);let U,Z=O>0?m+d:m+d+1;E.projectionCache.cachedAnchorPoint?U=E.projectionCache.cachedAnchorPoint:(U=ke(E.tileAnchorPoint.x,E.tileAnchorPoint.y,E).point,E.projectionCache.cachedAnchorPoint=U);let G,Q,ne=U,re=U,oe=0,X=0;const ue=Math.abs(I),pe=[];let ye;for(;oe+X<=ue;){if(Z+=O,Z<m||Z>=k)return null;oe+=X,re=ne,Q=G;const $e={absOffsetX:ue,direction:O,distanceFromAnchor:oe,previousVertex:re};if(ne=se(Z,E,$e),a===0)pe.push(re),ye=ne.sub(re);else{let We;const Oe=ne.sub(re);We=Oe.mag()===0?Me(se(Z+O,E,$e).sub(ne),a,O):Me(Oe,a,O),Q||(Q=re.add(We)),G=ve(Z,We,ne,m,k,Q,a,E,$e),pe.push(Q),ye=G.sub(Q)}X=ye.mag()}const Ce=ye._mult((ue-oe)/X)._add(Q||re),Ae=B+Math.atan2(ne.y-re.y,ne.x-re.x);return pe.push(Ce),{point:Ce,angle:T?Ae:0,path:pe}}const ct=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ht(g,e){for(let a=0;a<g;a++){const u=e.length;e.resize(u+4),e.float32.set(ct,3*u)}}function $t(g,e,a){const u=e[0],d=e[1];return g[0]=a[0]*u+a[4]*d+a[12],g[1]=a[1]*u+a[5]*d+a[13],g[3]=a[3]*u+a[7]*d+a[15],g}const wt=100;class jt{constructor(e,a,u=new jr(e.width+200,e.height+200,25),d=new jr(e.width+200,e.height+200,25)){this.transform=e,this.mapProjection=a,this.grid=u,this.ignoredGrid=d,this.pitchFactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+wt,this.screenBottomBoundary=e.height+wt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,a,u,d,m,k,E,T,I,O,B){const U=e.anchorPointX+T[0],Z=e.anchorPointY+T[1],G=this.projectAndGetPerspectiveRatio(d,U,Z,m,O),Q=u*G.perspectiveRatio;let ne;if(k||E)ne=this._projectCollisionBox(e,Q,d,m,k,E,T,G,O,B);else{const pe=G.point.x+(B?B.x*Q:0),ye=G.point.y+(B?B.y*Q:0);ne={allPointsOccluded:!1,box:[pe+e.x1*Q,ye+e.y1*Q,pe+e.x2*Q,ye+e.y2*Q]}}const[re,oe,X,ue]=ne.box;return this.mapProjection.useSpecialProjectionForSymbols&&(k?ne.allPointsOccluded:this.mapProjection.isOccluded(U,Z,m))||G.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(re,oe,X,ue)||a!=="always"&&this.grid.hitTest(re,oe,X,ue,a,I)?{box:[re,oe,X,ue],placeable:!1,offscreen:!1}:{box:[re,oe,X,ue],placeable:!0,offscreen:this.isOffscreen(re,oe,X,ue)}}placeCollisionCircles(e,a,u,d,m,k,E,T,I,O,B,U,Z,G,Q,ne){const re=[],oe=new h.P(a.anchorX,a.anchorY),X=this.getPerspectiveRatio(k,oe.x,oe.y,E,ne),ue=(B?m/X:m*X)/h.ap,pe={getElevation:ne,labelPlaneMatrix:T,lineVertexArray:u,pitchWithMap:B,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:oe,unwrappedTileID:E,width:this.transform.width,height:this.transform.height,translation:Q},ye=J(ue,d,a.lineOffsetX*ue,a.lineOffsetY*ue,!1,a,!1,pe);let Ce=!1,Ae=!1,$e=!0;if(ye){const We=.5*Z*X+G,Oe=new h.P(-100,-100),Le=new h.P(this.screenRightBoundary,this.screenBottomBoundary),tt=new bt,xt=ye.first,Ne=ye.last;let Ue=[];for(let Tt=xt.path.length-1;Tt>=1;Tt--)Ue.push(xt.path[Tt]);for(let Tt=1;Tt<Ne.path.length;Tt++)Ue.push(Ne.path[Tt]);const yt=2.5*We;if(I){const Tt=this.projectPathToScreenSpace(Ue,pe,I);Ue=Tt.some(Ot=>Ot.signedDistanceFromCamera<=0)?[]:Tt.map(Ot=>Ot.point)}let mi=[];if(Ue.length>0){const Tt=Ue[0].clone(),Ot=Ue[0].clone();for(let gi=1;gi<Ue.length;gi++)Tt.x=Math.min(Tt.x,Ue[gi].x),Tt.y=Math.min(Tt.y,Ue[gi].y),Ot.x=Math.max(Ot.x,Ue[gi].x),Ot.y=Math.max(Ot.y,Ue[gi].y);mi=Tt.x>=Oe.x&&Ot.x<=Le.x&&Tt.y>=Oe.y&&Ot.y<=Le.y?[Ue]:Ot.x<Oe.x||Tt.x>Le.x||Ot.y<Oe.y||Tt.y>Le.y?[]:h.al([Ue],Oe.x,Oe.y,Le.x,Le.y)}for(const Tt of mi){tt.reset(Tt,.25*We);let Ot=0;Ot=tt.length<=.5*We?1:Math.ceil(tt.paddedLength/yt)+1;for(let gi=0;gi<Ot;gi++){const Xi=gi/Math.max(Ot-1,1),lr=tt.lerp(Xi),yi=lr.x+wt,yn=lr.y+wt;re.push(yi,yn,We,0);const ln=yi-We,Ki=yn-We,cn=yi+We,Dr=yn+We;if($e=$e&&this.isOffscreen(ln,Ki,cn,Dr),Ae=Ae||this.isInsideGrid(ln,Ki,cn,Dr),e!=="always"&&this.grid.hitTestCircle(yi,yn,We,e,U)&&(Ce=!0,!O))return{circles:[],offscreen:!1,collisionDetected:Ce}}}}return{circles:!O&&Ce||!Ae||X<this.perspectiveRatioCutoff?[]:re,offscreen:$e,collisionDetected:Ce}}projectPathToScreenSpace(e,a,u){return e.map(d=>ee(d.x,d.y,u,a.getElevation))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const a=[];let u=1/0,d=1/0,m=-1/0,k=-1/0;for(const O of e){const B=new h.P(O.x+wt,O.y+wt);u=Math.min(u,B.x),d=Math.min(d,B.y),m=Math.max(m,B.x),k=Math.max(k,B.y),a.push(B)}const E=this.grid.query(u,d,m,k).concat(this.ignoredGrid.query(u,d,m,k)),T={},I={};for(const O of E){const B=O.key;if(T[B.bucketInstanceId]===void 0&&(T[B.bucketInstanceId]={}),T[B.bucketInstanceId][B.featureIndex])continue;const U=[new h.P(O.x1,O.y1),new h.P(O.x2,O.y1),new h.P(O.x2,O.y2),new h.P(O.x1,O.y2)];h.am(a,U)&&(T[B.bucketInstanceId][B.featureIndex]=!0,I[B.bucketInstanceId]===void 0&&(I[B.bucketInstanceId]=[]),I[B.bucketInstanceId].push(B.featureIndex))}return I}insertCollisionBox(e,a,u,d,m,k){(u?this.ignoredGrid:this.grid).insert({bucketInstanceId:d,featureIndex:m,collisionGroupID:k,overlapMode:a},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,a,u,d,m,k){const E=u?this.ignoredGrid:this.grid,T={bucketInstanceId:d,featureIndex:m,collisionGroupID:k,overlapMode:a};for(let I=0;I<e.length;I+=4)E.insertCircle(T,e[I],e[I+1],e[I+2])}projectAndGetPerspectiveRatio(e,a,u,d,m){let k;m?(k=[a,u,m(a,u),1],h.af(k,k,e)):(k=[a,u,0,1],$t(k,k,e));const E=k[3];return{point:new h.P((k[0]/E+1)/2*this.transform.width+wt,(-k[1]/E+1)/2*this.transform.height+wt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/E*.5,isOccluded:!1,signedDistanceFromCamera:E}}getPerspectiveRatio(e,a,u,d,m){const k=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(a,u,d,m):ee(a,u,e,m);return .5+this.transform.cameraToCenterDistance/k.signedDistanceFromCamera*.5}isOffscreen(e,a,u,d){return u<wt||e>=this.screenRightBoundary||d<wt||a>this.screenBottomBoundary}isInsideGrid(e,a,u,d){return u>=0&&e<this.gridRightBoundary&&d>=0&&a<this.gridBottomBoundary}getViewportMatrix(){const e=h.an([]);return h.J(e,e,[-100,-100,0]),e}_projectCollisionBox(e,a,u,d,m,k,E,T,I,O){let B=new h.P(1,0),U=new h.P(0,1);const Z=new h.P(e.anchorPointX+E[0],e.anchorPointY+E[1]);if(k&&!m){const $e=this.projectAndGetPerspectiveRatio(u,Z.x+1,Z.y,d,I).point.sub(T.point).unit(),We=Math.atan($e.y/$e.x)+($e.x<0?Math.PI:0),Oe=Math.sin(We),Le=Math.cos(We);B=new h.P(Le,Oe),U=new h.P(-Oe,Le)}else if(!k&&m){const $e=-this.transform.angle,We=Math.sin($e),Oe=Math.cos($e);B=new h.P(Oe,We),U=new h.P(-We,Oe)}let G=T.point,Q=a;if(m){G=Z;const $e=this.transform.zoom-Math.floor(this.transform.zoom);Q=Math.pow(2,-$e),Q*=this.mapProjection.getPitchedTextCorrection(this.transform,Z,d),O||(Q*=h.ac(.5+T.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}O&&(G=G.add(B.mult(O.x*Q)).add(U.mult(O.y*Q)));const ne=e.x1*Q,re=e.x2*Q,oe=(ne+re)/2,X=e.y1*Q,ue=e.y2*Q,pe=(X+ue)/2,ye=[{offsetX:ne,offsetY:X},{offsetX:oe,offsetY:X},{offsetX:re,offsetY:X},{offsetX:re,offsetY:pe},{offsetX:re,offsetY:ue},{offsetX:oe,offsetY:ue},{offsetX:ne,offsetY:ue},{offsetX:ne,offsetY:pe}];let Ce=[];for(const{offsetX:$e,offsetY:We}of ye)Ce.push(new h.P(G.x+B.x*$e+U.x*We,G.y+B.y*$e+U.y*We));let Ae=!1;if(m){const $e=Ce.map(We=>this.projectAndGetPerspectiveRatio(u,We.x,We.y,d,I));Ae=$e.some(We=>!We.isOccluded),Ce=$e.map(We=>We.point)}else Ae=!0;return{box:h.ao(Ce),allPointsOccluded:!Ae}}}function Lt(g,e,a){return e*(h.X/(g.tileSize*Math.pow(2,a-g.tileID.overscaledZ)))}class Di{constructor(e,a,u,d){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?a:-a))):d&&u?1:0,this.placed=u}isHidden(){return this.opacity===0&&!this.placed}}class Si{constructor(e,a,u,d,m){this.text=new Di(e?e.text:null,a,u,m),this.icon=new Di(e?e.icon:null,a,d,m)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Pt{constructor(e,a,u){this.text=e,this.icon=a,this.skipFade=u}}class ei{constructor(){this.invProjMatrix=h.H(),this.viewportMatrix=h.H(),this.circles=[]}}class xi{constructor(e,a,u,d,m){this.bucketInstanceId=e,this.featureIndex=a,this.sourceLayerIndex=u,this.bucketIndex=d,this.tileID=m}}class Fi{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const a=++this.maxGroupID;this.collisionGroups[e]={ID:a,predicate:u=>u.collisionGroupID===a}}return this.collisionGroups[e]}}function qi(g,e,a,u,d){const{horizontalAlign:m,verticalAlign:k}=h.au(g);return new h.P(-(m-.5)*e+u[0]*d,-(k-.5)*a+u[1]*d)}class an{constructor(e,a,u,d,m,k){this.transform=e.clone(),this.terrain=u,this.collisionIndex=new jt(this.transform,a),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=d,this.retainedQueryData={},this.collisionGroups=new Fi(m),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=k,k&&(k.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const a=this.terrain;return a?(u,d)=>a.getElevation(e,u,d):null}getBucketParts(e,a,u,d){const m=u.getBucket(a),k=u.latestFeatureIndex;if(!m||!k||a.id!==m.layerIds[0])return;const E=u.collisionBoxArray,T=m.layers[0].layout,I=m.layers[0].paint,O=Math.pow(2,this.transform.zoom-u.tileID.overscaledZ),B=u.tileSize/h.X,U=u.tileID.toUnwrapped(),Z=this.transform.calculatePosMatrix(U),G=T.get("text-pitch-alignment")==="map",Q=T.get("text-rotation-alignment")==="map",ne=Lt(u,1,this.transform.zoom),re=this.collisionIndex.mapProjection.translatePosition(this.transform,u,I.get("text-translate"),I.get("text-translate-anchor")),oe=this.collisionIndex.mapProjection.translatePosition(this.transform,u,I.get("icon-translate"),I.get("icon-translate-anchor")),X=rs(Z,G,Q,this.transform,ne);let ue=null;if(G){const ye=Mr(Z,G,Q,this.transform,ne);ue=h.L([],this.transform.labelPlaneMatrix,ye)}this.retainedQueryData[m.bucketInstanceId]=new xi(m.bucketInstanceId,k,m.sourceLayerIndex,m.index,u.tileID);const pe={bucket:m,layout:T,translationText:re,translationIcon:oe,posMatrix:Z,unwrappedTileID:U,textLabelPlaneMatrix:X,labelToScreenMatrix:ue,scale:O,textPixelRatio:B,holdingForFade:u.holdingForFade(),collisionBoxArray:E,partiallyEvaluatedTextSize:h.ag(m.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(m.sourceID)};if(d)for(const ye of m.sortKeyRanges){const{sortKey:Ce,symbolInstanceStart:Ae,symbolInstanceEnd:$e}=ye;e.push({sortKey:Ce,symbolInstanceStart:Ae,symbolInstanceEnd:$e,parameters:pe})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:pe})}attemptAnchorPlacement(e,a,u,d,m,k,E,T,I,O,B,U,Z,G,Q,ne,re,oe,X){const ue=h.aq[e.textAnchor],pe=[e.textOffset0,e.textOffset1],ye=qi(ue,u,d,pe,m),Ce=this.collisionIndex.placeCollisionBox(a,U,T,I,O,E,k,ne,B.predicate,X,ye);if((!oe||this.collisionIndex.placeCollisionBox(oe,U,T,I,O,E,k,re,B.predicate,X,ye).placeable)&&Ce.placeable){let Ae;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID]&&this.prevPlacement.placements[Z.crossTileID].text&&(Ae=this.prevPlacement.variableOffsets[Z.crossTileID].anchor),Z.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[Z.crossTileID]={textOffset:pe,width:u,height:d,anchor:ue,textBoxScale:m,prevAnchor:Ae},this.markUsedJustification(G,ue,Z,Q),G.allowVerticalPlacement&&(this.markUsedOrientation(G,Q,Z),this.placedOrientations[Z.crossTileID]=Q),{shift:ye,placedGlyphBoxes:Ce}}}placeLayerBucketPart(e,a,u){const{bucket:d,layout:m,translationText:k,translationIcon:E,posMatrix:T,unwrappedTileID:I,textLabelPlaneMatrix:O,labelToScreenMatrix:B,textPixelRatio:U,holdingForFade:Z,collisionBoxArray:G,partiallyEvaluatedTextSize:Q,collisionGroup:ne}=e.parameters,re=m.get("text-optional"),oe=m.get("icon-optional"),X=h.ar(m,"text-overlap","text-allow-overlap"),ue=X==="always",pe=h.ar(m,"icon-overlap","icon-allow-overlap"),ye=pe==="always",Ce=m.get("text-rotation-alignment")==="map",Ae=m.get("text-pitch-alignment")==="map",$e=m.get("icon-text-fit")!=="none",We=m.get("symbol-z-order")==="viewport-y",Oe=ue&&(ye||!d.hasIconData()||oe),Le=ye&&(ue||!d.hasTextData()||re);!d.collisionArrays&&G&&d.deserializeCollisionBoxes(G);const tt=this._getTerrainElevationFunc(this.retainedQueryData[d.bucketInstanceId].tileID),xt=(Ne,Ue,yt)=>{var mi,Tt;if(a[Ne.crossTileID])return;if(Z)return void(this.placements[Ne.crossTileID]=new Pt(!1,!1,!1));let Ot=!1,gi=!1,Xi=!0,lr=null,yi={box:null,placeable:!1,offscreen:null},yn={box:null,placeable:!1,offscreen:null},ln=null,Ki=null,cn=null,Dr=0,wo=0,wl=0;Ue.textFeatureIndex?Dr=Ue.textFeatureIndex:Ne.useRuntimeCollisionCircles&&(Dr=Ne.featureIndex),Ue.verticalTextFeatureIndex&&(wo=Ue.verticalTextFeatureIndex);const ko=Ue.textBox;if(ko){const Yn=Zi=>{let Ji=h.ah.horizontal;if(d.allowVerticalPlacement&&!Zi&&this.prevPlacement){const zn=this.prevPlacement.placedOrientations[Ne.crossTileID];zn&&(this.placedOrientations[Ne.crossTileID]=zn,Ji=zn,this.markUsedOrientation(d,Ji,Ne))}return Ji},Xn=(Zi,Ji)=>{if(d.allowVerticalPlacement&&Ne.numVerticalGlyphVertices>0&&Ue.verticalTextBox){for(const zn of d.writingModes)if(zn===h.ah.vertical?(yi=Ji(),yn=yi):yi=Zi(),yi&&yi.placeable)break}else yi=Zi()},as=Ne.textAnchorOffsetStartIndex,cr=Ne.textAnchorOffsetEndIndex;if(cr===as){const Zi=(Ji,zn)=>{const Ft=this.collisionIndex.placeCollisionBox(Ji,X,U,T,I,Ae,Ce,k,ne.predicate,tt);return Ft&&Ft.placeable&&(this.markUsedOrientation(d,zn,Ne),this.placedOrientations[Ne.crossTileID]=zn),Ft};Xn(()=>Zi(ko,h.ah.horizontal),()=>{const Ji=Ue.verticalTextBox;return d.allowVerticalPlacement&&Ne.numVerticalGlyphVertices>0&&Ji?Zi(Ji,h.ah.vertical):{box:null,offscreen:null}}),Yn(yi&&yi.placeable)}else{let Zi=h.aq[(Tt=(mi=this.prevPlacement)===null||mi===void 0?void 0:mi.variableOffsets[Ne.crossTileID])===null||Tt===void 0?void 0:Tt.anchor];const Ji=(Ft,Ns,So)=>{const Eo=Ft.x2-Ft.x1,Zu=Ft.y2-Ft.y1,yf=Ne.textBoxScale,Wu=$e&&pe==="never"?Ns:null;let ls=null,Gu=X==="never"?1:2,Sl="never";Zi&&Gu++;for(let ga=0;ga<Gu;ga++){for(let El=as;El<cr;El++){const Tl=d.textAnchorOffsets.get(El);if(Zi&&Tl.textAnchor!==Zi)continue;const To=this.attemptAnchorPlacement(Tl,Ft,Eo,Zu,yf,Ce,Ae,U,T,I,ne,Sl,Ne,d,So,k,E,Wu,tt);if(To&&(ls=To.placedGlyphBoxes,ls&&ls.placeable))return Ot=!0,lr=To.shift,ls}Zi?Zi=null:Sl=X}return u&&!ls&&(ls={box:this.collisionIndex.placeCollisionBox(ko,"always",U,T,I,Ae,Ce,k,ne.predicate,tt,new h.P(0,0)).box,offscreen:!1,placeable:!1}),ls};Xn(()=>Ji(ko,Ue.iconBox,h.ah.horizontal),()=>{const Ft=Ue.verticalTextBox;return d.allowVerticalPlacement&&(!yi||!yi.placeable)&&Ne.numVerticalGlyphVertices>0&&Ft?Ji(Ft,Ue.verticalIconBox,h.ah.vertical):{box:null,occluded:!0,offscreen:null}}),yi&&(Ot=yi.placeable,Xi=yi.offscreen);const zn=Yn(yi&&yi.placeable);if(!Ot&&this.prevPlacement){const Ft=this.prevPlacement.variableOffsets[Ne.crossTileID];Ft&&(this.variableOffsets[Ne.crossTileID]=Ft,this.markUsedJustification(d,Ft.anchor,Ne,zn))}}}if(ln=yi,Ot=ln&&ln.placeable,Xi=ln&&ln.offscreen,Ne.useRuntimeCollisionCircles){const Yn=d.text.placedSymbolArray.get(Ne.centerJustifiedTextSymbolIndex),Xn=h.ai(d.textSizeData,Q,Yn),as=m.get("text-padding");Ki=this.collisionIndex.placeCollisionCircles(X,Yn,d.lineVertexArray,d.glyphOffsetArray,Xn,T,I,O,B,u,Ae,ne.predicate,Ne.collisionCircleDiameter,as,k,tt),Ki.circles.length&&Ki.collisionDetected&&!u&&h.w("Collisions detected, but collision boxes are not shown"),Ot=ue||Ki.circles.length>0&&!Ki.collisionDetected,Xi=Xi&&Ki.offscreen}if(Ue.iconFeatureIndex&&(wl=Ue.iconFeatureIndex),Ue.iconBox){const Yn=Xn=>this.collisionIndex.placeCollisionBox(Xn,pe,U,T,I,Ae,Ce,E,ne.predicate,tt,$e&&lr?lr:void 0);yn&&yn.placeable&&Ue.verticalIconBox?(cn=Yn(Ue.verticalIconBox),gi=cn.placeable):(cn=Yn(Ue.iconBox),gi=cn.placeable),Xi=Xi&&cn.offscreen}const Gn=re||Ne.numHorizontalGlyphVertices===0&&Ne.numVerticalGlyphVertices===0,kl=oe||Ne.numIconVertices===0;Gn||kl?kl?Gn||(gi=gi&&Ot):Ot=gi&&Ot:gi=Ot=gi&&Ot;const Jc=gi&&cn.placeable;if(Ot&&ln.placeable&&this.collisionIndex.insertCollisionBox(ln.box,X,m.get("text-ignore-placement"),d.bucketInstanceId,yn&&yn.placeable&&wo?wo:Dr,ne.ID),Jc&&this.collisionIndex.insertCollisionBox(cn.box,pe,m.get("icon-ignore-placement"),d.bucketInstanceId,wl,ne.ID),Ki&&Ot&&this.collisionIndex.insertCollisionCircles(Ki.circles,X,m.get("text-ignore-placement"),d.bucketInstanceId,Dr,ne.ID),u&&this.storeCollisionData(d.bucketInstanceId,yt,Ue,ln,cn,Ki),Ne.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(d.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ne.crossTileID]=new Pt(Ot||Oe,gi||Le,Xi||d.justReloaded),a[Ne.crossTileID]=!0};if(We){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ne=d.getSortedSymbolIndexes(this.transform.angle);for(let Ue=Ne.length-1;Ue>=0;--Ue){const yt=Ne[Ue];xt(d.symbolInstances.get(yt),d.collisionArrays[yt],yt)}}else for(let Ne=e.symbolInstanceStart;Ne<e.symbolInstanceEnd;Ne++)xt(d.symbolInstances.get(Ne),d.collisionArrays[Ne],Ne);if(u&&d.bucketInstanceId in this.collisionCircleArrays){const Ne=this.collisionCircleArrays[d.bucketInstanceId];h.as(Ne.invProjMatrix,T),Ne.viewportMatrix=this.collisionIndex.getViewportMatrix()}d.justReloaded=!1}storeCollisionData(e,a,u,d,m,k){if(u.textBox||u.iconBox){let E,T;this.collisionBoxArrays.has(e)?E=this.collisionBoxArrays.get(e):(E=new Map,this.collisionBoxArrays.set(e,E)),E.has(a)?T=E.get(a):(T={text:null,icon:null},E.set(a,T)),u.textBox&&(T.text=d.box),u.iconBox&&(T.icon=m.box)}if(k){let E=this.collisionCircleArrays[e];E===void 0&&(E=this.collisionCircleArrays[e]=new ei);for(let T=0;T<k.circles.length;T+=4)E.circles.push(k.circles[T+0]),E.circles.push(k.circles[T+1]),E.circles.push(k.circles[T+2]),E.circles.push(k.collisionDetected?1:0)}}markUsedJustification(e,a,u,d){let m;m=d===h.ah.vertical?u.verticalPlacedTextSymbolIndex:{left:u.leftJustifiedTextSymbolIndex,center:u.centerJustifiedTextSymbolIndex,right:u.rightJustifiedTextSymbolIndex}[h.at(a)];const k=[u.leftJustifiedTextSymbolIndex,u.centerJustifiedTextSymbolIndex,u.rightJustifiedTextSymbolIndex,u.verticalPlacedTextSymbolIndex];for(const E of k)E>=0&&(e.text.placedSymbolArray.get(E).crossTileID=m>=0&&E!==m?0:u.crossTileID)}markUsedOrientation(e,a,u){const d=a===h.ah.horizontal||a===h.ah.horizontalOnly?a:0,m=a===h.ah.vertical?a:0,k=[u.leftJustifiedTextSymbolIndex,u.centerJustifiedTextSymbolIndex,u.rightJustifiedTextSymbolIndex];for(const E of k)e.text.placedSymbolArray.get(E).placedOrientation=d;u.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(u.verticalPlacedTextSymbolIndex).placedOrientation=m)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const a=this.prevPlacement;let u=!1;this.prevZoomAdjustment=a?a.zoomAdjustment(this.transform.zoom):0;const d=a?a.symbolFadeChange(e):1,m=a?a.opacities:{},k=a?a.variableOffsets:{},E=a?a.placedOrientations:{};for(const T in this.placements){const I=this.placements[T],O=m[T];O?(this.opacities[T]=new Si(O,d,I.text,I.icon),u=u||I.text!==O.text.placed||I.icon!==O.icon.placed):(this.opacities[T]=new Si(null,d,I.text,I.icon,I.skipFade),u=u||I.text||I.icon)}for(const T in m){const I=m[T];if(!this.opacities[T]){const O=new Si(I,d,!1,!1);O.isHidden()||(this.opacities[T]=O,u=u||I.text.placed||I.icon.placed)}}for(const T in k)this.variableOffsets[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.variableOffsets[T]=k[T]);for(const T in E)this.placedOrientations[T]||!this.opacities[T]||this.opacities[T].isHidden()||(this.placedOrientations[T]=E[T]);if(a&&a.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");u?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=a?a.lastPlacementChangeTime:e)}updateLayerOpacities(e,a){const u={};for(const d of a){const m=d.getBucket(e);m&&d.latestFeatureIndex&&e.id===m.layerIds[0]&&this.updateBucketOpacities(m,d.tileID,u,d.collisionBoxArray)}}updateBucketOpacities(e,a,u,d){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const m=e.layers[0],k=m.layout,E=new Si(null,0,!1,!1,!0),T=k.get("text-allow-overlap"),I=k.get("icon-allow-overlap"),O=m._unevaluatedLayout.hasValue("text-variable-anchor")||m._unevaluatedLayout.hasValue("text-variable-anchor-offset"),B=k.get("text-rotation-alignment")==="map",U=k.get("text-pitch-alignment")==="map",Z=k.get("icon-text-fit")!=="none",G=new Si(null,0,T&&(I||!e.hasIconData()||k.get("icon-optional")),I&&(T||!e.hasTextData()||k.get("text-optional")),!0);!e.collisionArrays&&d&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(d);const Q=(re,oe,X)=>{for(let ue=0;ue<oe/4;ue++)re.opacityVertexArray.emplaceBack(X);re.hasVisibleVertices=re.hasVisibleVertices||X!==eo},ne=this.collisionBoxArrays.get(e.bucketInstanceId);for(let re=0;re<e.symbolInstances.length;re++){const oe=e.symbolInstances.get(re),{numHorizontalGlyphVertices:X,numVerticalGlyphVertices:ue,crossTileID:pe}=oe;let ye=this.opacities[pe];u[pe]?ye=E:ye||(ye=G,this.opacities[pe]=ye),u[pe]=!0;const Ce=oe.numIconVertices>0,Ae=this.placedOrientations[oe.crossTileID],$e=Ae===h.ah.vertical,We=Ae===h.ah.horizontal||Ae===h.ah.horizontalOnly;if(X>0||ue>0){const Le=In(ye.text);Q(e.text,X,$e?eo:Le),Q(e.text,ue,We?eo:Le);const tt=ye.text.isHidden();[oe.rightJustifiedTextSymbolIndex,oe.centerJustifiedTextSymbolIndex,oe.leftJustifiedTextSymbolIndex].forEach(Ue=>{Ue>=0&&(e.text.placedSymbolArray.get(Ue).hidden=tt||$e?1:0)}),oe.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(oe.verticalPlacedTextSymbolIndex).hidden=tt||We?1:0);const xt=this.variableOffsets[oe.crossTileID];xt&&this.markUsedJustification(e,xt.anchor,oe,Ae);const Ne=this.placedOrientations[oe.crossTileID];Ne&&(this.markUsedJustification(e,"left",oe,Ne),this.markUsedOrientation(e,Ne,oe))}if(Ce){const Le=In(ye.icon),tt=!(Z&&oe.verticalPlacedIconSymbolIndex&&$e);oe.placedIconSymbolIndex>=0&&(Q(e.icon,oe.numIconVertices,tt?Le:eo),e.icon.placedSymbolArray.get(oe.placedIconSymbolIndex).hidden=ye.icon.isHidden()),oe.verticalPlacedIconSymbolIndex>=0&&(Q(e.icon,oe.numVerticalIconVertices,tt?eo:Le),e.icon.placedSymbolArray.get(oe.verticalPlacedIconSymbolIndex).hidden=ye.icon.isHidden())}const Oe=ne&&ne.has(re)?ne.get(re):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const Le=e.collisionArrays[re];if(Le){let tt=new h.P(0,0);if(Le.textBox||Le.verticalTextBox){let xt=!0;if(O){const Ne=this.variableOffsets[pe];Ne?(tt=qi(Ne.anchor,Ne.width,Ne.height,Ne.textOffset,Ne.textBoxScale),B&&tt._rotate(U?this.transform.angle:-this.transform.angle)):xt=!1}if(Le.textBox||Le.verticalTextBox){let Ne;Le.textBox&&(Ne=$e),Le.verticalTextBox&&(Ne=We),Qs(e.textCollisionBox.collisionVertexArray,ye.text.placed,!xt||Ne,Oe.text,tt.x,tt.y)}}if(Le.iconBox||Le.verticalIconBox){const xt=!!(!We&&Le.verticalIconBox);let Ne;Le.iconBox&&(Ne=xt),Le.verticalIconBox&&(Ne=!xt),Qs(e.iconCollisionBox.collisionVertexArray,ye.icon.placed,Ne,Oe.icon,Z?tt.x:0,Z?tt.y:0)}}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){const re=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=re.invProjMatrix,e.placementViewportMatrix=re.viewportMatrix,e.collisionCircleArray=re.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,a){const u=this.zoomAtLastRecencyCheck===a?1-this.zoomAdjustment(a):1;return this.zoomAtLastRecencyCheck=a,this.commitTime+this.fadeDuration*u>e}setStale(){this.stale=!0}}function Qs(g,e,a,u,d,m){u&&u.length!==0||(u=[0,0,0,0]);const k=u[0]-wt,E=u[1]-wt,T=u[2]-wt,I=u[3]-wt;g.emplaceBack(e?1:0,a?1:0,d||0,m||0,k,E),g.emplaceBack(e?1:0,a?1:0,d||0,m||0,T,E),g.emplaceBack(e?1:0,a?1:0,d||0,m||0,T,I),g.emplaceBack(e?1:0,a?1:0,d||0,m||0,k,I)}const ti=Math.pow(2,25),cc=Math.pow(2,24),hc=Math.pow(2,17),Mn=Math.pow(2,16),Pn=Math.pow(2,9),Hp=Math.pow(2,8),Hn=Math.pow(2,1);function In(g){if(g.opacity===0&&!g.placed)return 0;if(g.opacity===1&&g.placed)return 4294967295;const e=g.placed?1:0,a=Math.floor(127*g.opacity);return a*ti+e*cc+a*hc+e*Mn+a*Pn+e*Hp+a*Hn+e}const eo=0;function Cs(){return{isOccluded:(g,e,a)=>!1,getPitchedTextCorrection:(g,e,a)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(g,e,a,u){throw new Error("Not implemented.")},translatePosition:(g,e,a,u)=>function(d,m,k,E,T=!1){if(!k[0]&&!k[1])return[0,0];const I=T?E==="map"?d.angle:0:E==="viewport"?-d.angle:0;if(I){const O=Math.sin(I),B=Math.cos(I);k=[k[0]*B-k[1]*O,k[0]*O+k[1]*B]}return[T?k[0]:Lt(m,k[0],d.zoom),T?k[1]:Lt(m,k[1],d.zoom)]}(g,e,a,u),getCircleRadiusCorrection:g=>1}}class zi{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,a,u,d,m){const k=this._bucketParts;for(;this._currentTileIndex<e.length;)if(a.getBucketParts(k,d,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,m())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,k.sort((E,T)=>E.sortKey-T.sortKey));this._currentPartIndex<k.length;)if(a.placeLayerBucketPart(k[this._currentPartIndex],this._seenCrossTileIDs,u),this._currentPartIndex++,m())return!0;return!1}}class Jo{constructor(e,a,u,d,m,k,E,T){this.placement=new an(e,Cs(),a,k,E,T),this._currentPlacementIndex=u.length-1,this._forceFullPlacement=d,this._showCollisionBoxes=m,this._done=!1}isDone(){return this._done}continuePlacement(e,a,u){const d=R.now(),m=()=>!this._forceFullPlacement&&R.now()-d>2;for(;this._currentPlacementIndex>=0;){const k=a[e[this._currentPlacementIndex]],E=this.placement.collisionIndex.transform.zoom;if(k.type==="symbol"&&(!k.minzoom||k.minzoom<=E)&&(!k.maxzoom||k.maxzoom>E)){if(this._inProgressLayer||(this._inProgressLayer=new zi(k)),this._inProgressLayer.continuePlacement(u[k.source],this.placement,this._showCollisionBoxes,k,m))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const nr=512/h.X/2;class Ii{constructor(e,a,u){this.tileID=e,this.bucketInstanceId=u,this._symbolsByKey={};const d=new Map;for(let m=0;m<a.length;m++){const k=a.get(m),E=k.key,T=d.get(E);T?T.push(k):d.set(E,[k])}for(const[m,k]of d){const E={positions:k.map(T=>({x:Math.floor(T.anchorX*nr),y:Math.floor(T.anchorY*nr)})),crossTileIDs:k.map(T=>T.crossTileID)};if(E.positions.length>128){const T=new h.av(E.positions.length,16,Uint16Array);for(const{x:I,y:O}of E.positions)T.add(I,O);T.finish(),delete E.positions,E.index=T}this._symbolsByKey[m]=E}}getScaledCoordinates(e,a){const{x:u,y:d,z:m}=this.tileID.canonical,{x:k,y:E,z:T}=a.canonical,I=nr/Math.pow(2,T-m),O=(E*h.X+e.anchorY)*I,B=d*h.X*nr;return{x:Math.floor((k*h.X+e.anchorX)*I-u*h.X*nr),y:Math.floor(O-B)}}findMatches(e,a,u){const d=this.tileID.canonical.z<a.canonical.z?1:Math.pow(2,this.tileID.canonical.z-a.canonical.z);for(let m=0;m<e.length;m++){const k=e.get(m);if(k.crossTileID)continue;const E=this._symbolsByKey[k.key];if(!E)continue;const T=this.getScaledCoordinates(k,a);if(E.index){const I=E.index.range(T.x-d,T.y-d,T.x+d,T.y+d).sort();for(const O of I){const B=E.crossTileIDs[O];if(!u[B]){u[B]=!0,k.crossTileID=B;break}}}else if(E.positions)for(let I=0;I<E.positions.length;I++){const O=E.positions[I],B=E.crossTileIDs[I];if(Math.abs(O.x-T.x)<=d&&Math.abs(O.y-T.y)<=d&&!u[B]){u[B]=!0,k.crossTileID=B;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class qa{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class rr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const a=Math.round((e-this.lng)/360);if(a!==0)for(const u in this.indexes){const d=this.indexes[u],m={};for(const k in d){const E=d[k];E.tileID=E.tileID.unwrapTo(E.tileID.wrap+a),m[E.tileID.key]=E}this.indexes[u]=m}this.lng=e}addBucket(e,a,u){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===a.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let m=0;m<a.symbolInstances.length;m++)a.symbolInstances.get(m).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const d=this.usedCrossTileIDs[e.overscaledZ];for(const m in this.indexes){const k=this.indexes[m];if(Number(m)>e.overscaledZ)for(const E in k){const T=k[E];T.tileID.isChildOf(e)&&T.findMatches(a.symbolInstances,e,d)}else{const E=k[e.scaledTo(Number(m)).key];E&&E.findMatches(a.symbolInstances,e,d)}}for(let m=0;m<a.symbolInstances.length;m++){const k=a.symbolInstances.get(m);k.crossTileID||(k.crossTileID=u.generate(),d[k.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ii(e,a.symbolInstances,a.bucketInstanceId),!0}removeBucketCrossTileIDs(e,a){for(const u of a.getCrossTileIDsLists())for(const d of u)delete this.usedCrossTileIDs[e][d]}removeStaleBuckets(e){let a=!1;for(const u in this.indexes){const d=this.indexes[u];for(const m in d)e[d[m].bucketInstanceId]||(this.removeBucketCrossTileIDs(u,d[m]),delete d[m],a=!0)}return a}}class uc{constructor(){this.layerIndexes={},this.crossTileIDs=new qa,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,a,u){let d=this.layerIndexes[e.id];d===void 0&&(d=this.layerIndexes[e.id]=new rr);let m=!1;const k={};d.handleWrapJump(u);for(const E of a){const T=E.getBucket(e);T&&e.id===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),d.addBucket(E.tileID,T,this.crossTileIDs)&&(m=!0),k[T.bucketInstanceId]=!0)}return d.removeStaleBuckets(k)&&(m=!0),m}pruneUnusedLayers(e){const a={};e.forEach(u=>{a[u]=!0});for(const u in this.layerIndexes)a[u]||delete this.layerIndexes[u]}}const sr=(g,e)=>h.t(g,e&&e.filter(a=>a.identifier!=="source.canvas")),qp=h.aw();class Za extends h.E{constructor(e,a={}){super(),this._rtlPluginLoaded=()=>{for(const u in this.sourceCaches){const d=this.sourceCaches[u].getSource().type;d!=="vector"&&d!=="geojson"||this.sourceCaches[u].reload()}},this.map=e,this.dispatcher=new lt(Ze(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(u,d)=>this.getGlyphs(u,d)),this.dispatcher.registerMessageHandler("GI",(u,d)=>this.getImages(u,d)),this.imageManager=new Rt,this.imageManager.setEventedParent(this),this.glyphManager=new Ui(e._requestManager,a.localIdeographFontFamily),this.lineAtlas=new Sr(256,512),this.crossTileSymbolIndex=new uc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new h.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",h.ay()),Tr().on(De,this._rtlPluginLoaded),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const d=this.sourceCaches[u.sourceId];if(!d)return;const m=d.getSource();if(m&&m.vectorLayerIds)for(const k in this._layers){const E=this._layers[k];E.source===m.id&&this._validateLayer(E)}})}loadURL(e,a={},u){this.fire(new h.k("dataloading",{dataType:"style"})),a.validate=typeof a.validate!="boolean"||a.validate;const d=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const m=this._loadStyleRequest;h.h(d,this._loadStyleRequest).then(k=>{this._loadStyleRequest=null,this._load(k.data,a,u)}).catch(k=>{this._loadStyleRequest=null,k&&!m.signal.aborted&&this.fire(new h.j(k))})}loadJSON(e,a={},u){this.fire(new h.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,R.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,a.validate=a.validate!==!1,this._load(e,a,u)}).catch(()=>{})}loadEmpty(){this.fire(new h.k("dataloading",{dataType:"style"})),this._load(qp,{validate:!1})}_load(e,a,u){var d;const m=a.transformStyle?a.transformStyle(u,e):e;if(!a.validate||!sr(this,h.u(m))){this._loaded=!0,this.stylesheet=m;for(const k in m.sources)this.addSource(k,m.sources[k],{validate:!1});m.sprite?this._loadSprite(m.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(m.glyphs),this._createLayers(),this.light=new Sn(this.stylesheet.light),this.sky=new sn(this.stylesheet.sky),this.map.setTerrain((d=this.stylesheet.terrain)!==null&&d!==void 0?d:null),this.fire(new h.k("data",{dataType:"style"})),this.fire(new h.k("style.load"))}}_createLayers(){const e=h.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(a=>a.id),this._layers={},this._serializedLayers=null;for(const a of e){const u=h.aA(a);u.setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=u}}_loadSprite(e,a=!1,u=void 0){let d;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(m,k,E,T){return h._(this,void 0,void 0,function*(){const I=rt(m),O=E>1?"@2x":"",B={},U={};for(const{id:Z,url:G}of I){const Q=k.transformRequest(Dt(G,O,".json"),"SpriteJSON");B[Z]=h.h(Q,T);const ne=k.transformRequest(Dt(G,O,".png"),"SpriteImage");U[Z]=_e.getImage(ne,T)}return yield Promise.all([...Object.values(B),...Object.values(U)]),function(Z,G){return h._(this,void 0,void 0,function*(){const Q={};for(const ne in Z){Q[ne]={};const re=R.getImageCanvasContext((yield G[ne]).data),oe=(yield Z[ne]).data;for(const X in oe){const{width:ue,height:pe,x:ye,y:Ce,sdf:Ae,pixelRatio:$e,stretchX:We,stretchY:Oe,content:Le,textFitWidth:tt,textFitHeight:xt}=oe[X];Q[ne][X]={data:null,pixelRatio:$e,sdf:Ae,stretchX:We,stretchY:Oe,content:Le,textFitWidth:tt,textFitHeight:xt,spriteData:{width:ue,height:pe,x:ye,y:Ce,context:re}}}}return Q})}(B,U)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(m=>{if(this._spriteRequest=null,m)for(const k in m){this._spritesImagesIds[k]=[];const E=this._spritesImagesIds[k]?this._spritesImagesIds[k].filter(T=>!(T in m)):[];for(const T of E)this.imageManager.removeImage(T),this._changedImages[T]=!0;for(const T in m[k]){const I=k==="default"?T:`${k}:${T}`;this._spritesImagesIds[k].push(I),I in this.imageManager.images?this.imageManager.updateImage(I,m[k][T],!1):this.imageManager.addImage(I,m[k][T]),a&&(this._changedImages[I]=!0)}}}).catch(m=>{this._spriteRequest=null,d=m,this.fire(new h.j(d))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),a&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"})),u&&u(d)})}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}_validateLayer(e){const a=this.sourceCaches[e.source];if(!a)return;const u=e.sourceLayer;if(!u)return;const d=a.getSource();(d.type==="geojson"||d.vectorLayerIds&&d.vectorLayerIds.indexOf(u)===-1)&&this.fire(new h.j(new Error(`Source layer "${u}" does not exist on source "${d.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,a=!1){const u=this._serializedAllLayers();if(!e||e.length===0)return Object.values(a?h.aB(u):u);const d=[];for(const m of e)if(u[m]){const k=a?h.aB(u[m]):u[m];d.push(k)}return d}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const a=Object.keys(this._layers);for(const u of a){const d=this._layers[u];d.type!=="custom"&&(e[u]=d.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(const e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const a=this._changed;if(a){const d=Object.keys(this._updatedLayers),m=Object.keys(this._removedLayers);(d.length||m.length)&&this._updateWorkerLayers(d,m);for(const k in this._updatedSources){const E=this._updatedSources[k];if(E==="reload")this._reloadSource(k);else{if(E!=="clear")throw new Error(`Invalid action ${E}`);this._clearSource(k)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const k in this._updatedPaintProps)this._layers[k].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const u={};for(const d in this.sourceCaches){const m=this.sourceCaches[d];u[d]=m.used,m.used=!1}for(const d of this._order){const m=this._layers[d];m.recalculate(e,this._availableImages),!m.isHidden(e.zoom)&&m.source&&(this.sourceCaches[m.source].used=!0)}for(const d in u){const m=this.sourceCaches[d];!!u[d]!=!!m.used&&m.fire(new h.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:d}))}this.light.recalculate(e),this.sky.recalculate(e),this.z=e.zoom,a&&this.fire(new h.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const a in this.sourceCaches)this.sourceCaches[a].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,a){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:a})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,a={}){var u;this._checkLoaded();const d=this.serialize();if(e=a.transformStyle?a.transformStyle(d,e):e,((u=a.validate)===null||u===void 0||u)&&sr(this,h.u(e)))return!1;(e=h.aB(e)).layers=h.az(e.layers);const m=h.aC(d,e),k=this._getOperationsToPerform(m);if(k.unimplemented.length>0)throw new Error(`Unimplemented: ${k.unimplemented.join(", ")}.`);if(k.operations.length===0)return!1;for(const E of k.operations)E();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const a=[],u=[];for(const d of e)switch(d.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":a.push(()=>this.addLayer.apply(this,d.args));break;case"removeLayer":a.push(()=>this.removeLayer.apply(this,d.args));break;case"setPaintProperty":a.push(()=>this.setPaintProperty.apply(this,d.args));break;case"setLayoutProperty":a.push(()=>this.setLayoutProperty.apply(this,d.args));break;case"setFilter":a.push(()=>this.setFilter.apply(this,d.args));break;case"addSource":a.push(()=>this.addSource.apply(this,d.args));break;case"removeSource":a.push(()=>this.removeSource.apply(this,d.args));break;case"setLayerZoomRange":a.push(()=>this.setLayerZoomRange.apply(this,d.args));break;case"setLight":a.push(()=>this.setLight.apply(this,d.args));break;case"setGeoJSONSourceData":a.push(()=>this.setGeoJSONSourceData.apply(this,d.args));break;case"setGlyphs":a.push(()=>this.setGlyphs.apply(this,d.args));break;case"setSprite":a.push(()=>this.setSprite.apply(this,d.args));break;case"setSky":a.push(()=>this.setSky.apply(this,d.args));break;case"setTerrain":a.push(()=>this.map.setTerrain.apply(this,d.args));break;case"setTransition":a.push(()=>{});break;default:u.push(d.command)}return{operations:a,unimplemented:u}}addImage(e,a){if(this.getImage(e))return this.fire(new h.j(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,a),this._afterImageUpdated(e)}updateImage(e,a){this.imageManager.updateImage(e,a)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new h.j(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,a,u={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!a.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(a).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(a.type)>=0&&this._validate(h.u.source,`sources.${e}`,a,null,u))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);const d=this.sourceCaches[e]=new mt(e,a,this.dispatcher);d.style=this,d.setEventedParent(this,()=>({isSourceLoaded:d.loaded(),source:d.serialize(),sourceId:e})),d.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(const u in this._layers)if(this._layers[u].source===e)return this.fire(new h.j(new Error(`Source "${e}" cannot be removed while layer "${u}" is using it.`)));const a=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],a.fire(new h.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),a.setEventedParent(null),a.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,a){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const u=this.sourceCaches[e].getSource();if(u.type!=="geojson")throw new Error(`geojsonSource.type is ${u.type}, which is !== 'geojson`);u.setData(a),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,a,u={}){this._checkLoaded();const d=e.id;if(this.getLayer(d))return void this.fire(new h.j(new Error(`Layer "${d}" already exists on this map.`)));let m;if(e.type==="custom"){if(sr(this,h.aD(e)))return;m=h.aA(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(d,e.source),e=h.aB(e),e=h.e(e,{source:d})),this._validate(h.u.layer,`layers.${d}`,e,{arrayIndex:-1},u))return;m=h.aA(e),this._validateLayer(m),m.setEventedParent(this,{layer:{id:d}})}const k=a?this._order.indexOf(a):this._order.length;if(a&&k===-1)this.fire(new h.j(new Error(`Cannot add layer "${d}" before non-existing layer "${a}".`)));else{if(this._order.splice(k,0,d),this._layerOrderChanged=!0,this._layers[d]=m,this._removedLayers[d]&&m.source&&m.type!=="custom"){const E=this._removedLayers[d];delete this._removedLayers[d],E.type!==m.type?this._updatedSources[m.source]="clear":(this._updatedSources[m.source]="reload",this.sourceCaches[m.source].pause())}this._updateLayer(m),m.onAdd&&m.onAdd(this.map)}}moveLayer(e,a){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new h.j(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===a)return;const u=this._order.indexOf(e);this._order.splice(u,1);const d=a?this._order.indexOf(a):this._order.length;a&&d===-1?this.fire(new h.j(new Error(`Cannot move layer "${e}" before non-existing layer "${a}".`))):(this._order.splice(d,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const a=this._layers[e];if(!a)return void this.fire(new h.j(new Error(`Cannot remove non-existing layer "${e}".`)));a.setEventedParent(null);const u=this._order.indexOf(e);this._order.splice(u,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=a,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],a.onRemove&&a.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,a,u){this._checkLoaded();const d=this.getLayer(e);d?d.minzoom===a&&d.maxzoom===u||(a!=null&&(d.minzoom=a),u!=null&&(d.maxzoom=u),this._updateLayer(d)):this.fire(new h.j(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,a,u={}){this._checkLoaded();const d=this.getLayer(e);if(d){if(!h.aE(d.filter,a))return a==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(h.u.filter,`layers.${d.id}.filter`,a,null,u)||(d.filter=h.aB(a),this._updateLayer(d)))}else this.fire(new h.j(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return h.aB(this.getLayer(e).filter)}setLayoutProperty(e,a,u,d={}){this._checkLoaded();const m=this.getLayer(e);m?h.aE(m.getLayoutProperty(a),u)||(m.setLayoutProperty(a,u,d),this._updateLayer(m)):this.fire(new h.j(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,a){const u=this.getLayer(e);if(u)return u.getLayoutProperty(a);this.fire(new h.j(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,a,u,d={}){this._checkLoaded();const m=this.getLayer(e);m?h.aE(m.getPaintProperty(a),u)||(m.setPaintProperty(a,u,d)&&this._updateLayer(m),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new h.j(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,a){return this.getLayer(e).getPaintProperty(a)}setFeatureState(e,a){this._checkLoaded();const u=e.source,d=e.sourceLayer,m=this.sourceCaches[u];if(m===void 0)return void this.fire(new h.j(new Error(`The source '${u}' does not exist in the map's style.`)));const k=m.getSource().type;k==="geojson"&&d?this.fire(new h.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):k!=="vector"||d?(e.id===void 0&&this.fire(new h.j(new Error("The feature id parameter must be provided."))),m.setFeatureState(d,e.id,a)):this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,a){this._checkLoaded();const u=e.source,d=this.sourceCaches[u];if(d===void 0)return void this.fire(new h.j(new Error(`The source '${u}' does not exist in the map's style.`)));const m=d.getSource().type,k=m==="vector"?e.sourceLayer:void 0;m!=="vector"||k?a&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new h.j(new Error("A feature id is required to remove its specific state property."))):d.removeFeatureState(k,e.id,a):this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const a=e.source,u=e.sourceLayer,d=this.sourceCaches[a];if(d!==void 0)return d.getSource().type!=="vector"||u?(e.id===void 0&&this.fire(new h.j(new Error("The feature id parameter must be provided."))),d.getFeatureState(u,e.id)):void this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.j(new Error(`The source '${a}' does not exist in the map's style.`)))}getTransition(){return h.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=h.aF(this.sourceCaches,m=>m.serialize()),a=this._serializeByIds(this._order,!0),u=this.map.getTerrain()||void 0,d=this.stylesheet;return h.aG({version:d.version,name:d.name,metadata:d.metadata,light:d.light,sky:d.sky,center:d.center,zoom:d.zoom,bearing:d.bearing,pitch:d.pitch,sprite:d.sprite,glyphs:d.glyphs,transition:d.transition,sources:e,layers:a,terrain:u},m=>m!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const a=k=>this._layers[k].type==="fill-extrusion",u={},d=[];for(let k=this._order.length-1;k>=0;k--){const E=this._order[k];if(a(E)){u[E]=k;for(const T of e){const I=T[E];if(I)for(const O of I)d.push(O)}}}d.sort((k,E)=>E.intersectionZ-k.intersectionZ);const m=[];for(let k=this._order.length-1;k>=0;k--){const E=this._order[k];if(a(E))for(let T=d.length-1;T>=0;T--){const I=d[T].feature;if(u[I.layer.id]<k)break;m.push(I),d.pop()}else for(const T of e){const I=T[E];if(I)for(const O of I)m.push(O.feature)}}return m}queryRenderedFeatures(e,a,u){a&&a.filter&&this._validate(h.u.filter,"queryRenderedFeatures.filter",a.filter,null,a);const d={};if(a&&a.layers){if(!Array.isArray(a.layers))return this.fire(new h.j(new Error("parameters.layers must be an Array."))),[];for(const E of a.layers){const T=this._layers[E];if(!T)return this.fire(new h.j(new Error(`The layer '${E}' does not exist in the map's style and cannot be queried for features.`))),[];d[T.source]=!0}}const m=[];a.availableImages=this._availableImages;const k=this._serializedAllLayers();for(const E in this.sourceCaches)a.layers&&!d[E]||m.push(Et(this.sourceCaches[E],this._layers,k,e,a,u));return this.placement&&m.push(function(E,T,I,O,B,U,Z){const G={},Q=U.queryRenderedSymbols(O),ne=[];for(const re of Object.keys(Q).map(Number))ne.push(Z[re]);ne.sort(vt);for(const re of ne){const oe=re.featureIndex.lookupSymbolFeatures(Q[re.bucketInstanceId],T,re.bucketIndex,re.sourceLayerIndex,B.filter,B.layers,B.availableImages,E);for(const X in oe){const ue=G[X]=G[X]||[],pe=oe[X];pe.sort((ye,Ce)=>{const Ae=re.featureSortOrder;if(Ae){const $e=Ae.indexOf(ye.featureIndex);return Ae.indexOf(Ce.featureIndex)-$e}return Ce.featureIndex-ye.featureIndex});for(const ye of pe)ue.push(ye)}}for(const re in G)G[re].forEach(oe=>{const X=oe.feature,ue=I[E[re].source].getFeatureState(X.layer["source-layer"],X.id);X.source=X.layer.source,X.layer["source-layer"]&&(X.sourceLayer=X.layer["source-layer"]),X.state=ue});return G}(this._layers,k,this.sourceCaches,e,a,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(m)}querySourceFeatures(e,a){a&&a.filter&&this._validate(h.u.filter,"querySourceFeatures.filter",a.filter,null,a);const u=this.sourceCaches[e];return u?function(d,m){const k=d.getRenderableIds().map(I=>d.getTileByID(I)),E=[],T={};for(let I=0;I<k.length;I++){const O=k[I],B=O.tileID.canonical.key;T[B]||(T[B]=!0,O.querySourceFeatures(E,m))}return E}(u,a):[]}getLight(){return this.light.getLight()}setLight(e,a={}){this._checkLoaded();const u=this.light.getLight();let d=!1;for(const k in e)if(!h.aE(e[k],u[k])){d=!0;break}if(!d)return;const m={now:R.now(),transition:h.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,a),this.light.updateTransitions(m)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,a={}){const u=this.getSky();let d=!1;if(!e&&!u)return;if(e&&!u)d=!0;else if(!e&&u)d=!0;else for(const k in e)if(!h.aE(e[k],u[k])){d=!0;break}if(!d)return;const m={now:R.now(),transition:h.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,a),this.sky.updateTransitions(m)}_validate(e,a,u,d,m={}){return(!m||m.validate!==!1)&&sr(this,e.call(h.u,h.e({key:a,style:this.serialize(),value:u,styleSpec:h.v},d)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Tr().off(De,this._rtlPluginLoaded);for(const a in this._layers)this._layers[a].setEventedParent(null);for(const a in this.sourceCaches){const u=this.sourceCaches[a];u.setEventedParent(null),u.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const a in this.sourceCaches)this.sourceCaches[a].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,a,u,d,m=!1){let k=!1,E=!1;const T={};for(const I of this._order){const O=this._layers[I];if(O.type!=="symbol")continue;if(!T[O.source]){const U=this.sourceCaches[O.source];T[O.source]=U.getRenderableIds(!0).map(Z=>U.getTileByID(Z)).sort((Z,G)=>G.tileID.overscaledZ-Z.tileID.overscaledZ||(Z.tileID.isLessThan(G.tileID)?-1:1))}const B=this.crossTileSymbolIndex.addLayer(O,T[O.source],e.center.lng);k=k||B}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((m=m||this._layerOrderChanged||u===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(R.now(),e.zoom))&&(this.pauseablePlacement=new Jo(e,this.map.terrain,this._order,m,a,u,d,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,T),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(R.now()),E=!0),k&&this.pauseablePlacement.placement.setStale()),E||k)for(const I of this._order){const O=this._layers[I];O.type==="symbol"&&this.placement.updateLayerOpacities(O,T[O.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(R.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,a){return h._(this,void 0,void 0,function*(){const u=yield this.imageManager.getImages(a.icons);this._updateTilesForChangedImages();const d=this.sourceCaches[a.source];return d&&d.setDependencies(a.tileID.key,a.type,a.icons),u})}getGlyphs(e,a){return h._(this,void 0,void 0,function*(){const u=yield this.glyphManager.getGlyphs(a.stacks),d=this.sourceCaches[a.source];return d&&d.setDependencies(a.tileID.key,a.type,[""]),u})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,a={}){this._checkLoaded(),e&&this._validate(h.u.glyphs,"glyphs",e,null,a)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,a,u={},d){this._checkLoaded();const m=[{id:e,url:a}],k=[...rt(this.stylesheet.sprite),...m];this._validate(h.u.sprite,"sprite",k,null,u)||(this.stylesheet.sprite=k,this._loadSprite(m,!0,d))}removeSprite(e){this._checkLoaded();const a=rt(this.stylesheet.sprite);if(a.find(u=>u.id===e)){if(this._spritesImagesIds[e])for(const u of this._spritesImagesIds[e])this.imageManager.removeImage(u),this._changedImages[u]=!0;a.splice(a.findIndex(u=>u.id===e),1),this.stylesheet.sprite=a.length>0?a:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}else this.fire(new h.j(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return rt(this.stylesheet.sprite)}setSprite(e,a={},u){this._checkLoaded(),e&&this._validate(h.u.sprite,"sprite",e,null,a)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,u):(this._unloadSprite(),u&&u(null)))}}var Ms=h.Y([{name:"a_pos",type:"Int16",components:2}]);const ss={prelude:Wt(`#ifdef GL_ES
41
41
  precision mediump float;
42
42
  #else
43
43
  #if !defined(lowp)
@@ -626,4 +626,4 @@ var Cy;function Je(){return Cy.apply(null,arguments)}function r2(n){Cy=n}functio
626
626
  [`+b+"] ";for(y in arguments[0])Kt(arguments[0],y)&&(p+=y+": "+arguments[0][y]+", ");p=p.slice(0,-2)}else p=arguments[b];c.push(p)}Iy(n+`
627
627
  Arguments: `+Array.prototype.slice.call(c).join("")+`
628
628
  `+new Error().stack),o=!1}return i.apply(this,arguments)},i)}var Ay={};function Dy(n,i){Je.deprecationHandler!=null&&Je.deprecationHandler(n,i),Ay[n]||(Iy(i),Ay[n]=!0)}Je.suppressDeprecationWarnings=!1,Je.deprecationHandler=null;function Qr(n){return typeof Function<"u"&&n instanceof Function||Object.prototype.toString.call(n)==="[object Function]"}function o2(n){var i,o;for(o in n)Kt(n,o)&&(i=n[o],Qr(i)?this[o]=i:this["_"+o]=i);this._config=n,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)}function gp(n,i){var o=Ys({},n),c;for(c in i)Kt(i,c)&&(Ho(n[c])&&Ho(i[c])?(o[c]={},Ys(o[c],n[c]),Ys(o[c],i[c])):i[c]!=null?o[c]=i[c]:delete o[c]);for(c in n)Kt(n,c)&&!Kt(i,c)&&Ho(n[c])&&(o[c]=Ys({},o[c]));return o}function yp(n){n!=null&&this.set(n)}var _p;Object.keys?_p=Object.keys:_p=function(n){var i,o=[];for(i in n)Kt(n,i)&&o.push(i);return o};var a2={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"};function l2(n,i,o){var c=this._calendar[n]||this._calendar.sameElse;return Qr(c)?c.call(i,o):c}function es(n,i,o){var c=""+Math.abs(n),p=i-c.length,b=n>=0;return(b?o?"+":"":"-")+Math.pow(10,Math.max(0,p)).toString().substr(1)+c}var xp=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Wh=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,bp={},Oa={};function ft(n,i,o,c){var p=c;typeof c=="string"&&(p=function(){return this[c]()}),n&&(Oa[n]=p),i&&(Oa[i[0]]=function(){return es(p.apply(this,arguments),i[1],i[2])}),o&&(Oa[o]=function(){return this.localeData().ordinal(p.apply(this,arguments),n)})}function c2(n){return n.match(/\[[\s\S]/)?n.replace(/^\[|\]$/g,""):n.replace(/\\/g,"")}function h2(n){var i=n.match(xp),o,c;for(o=0,c=i.length;o<c;o++)Oa[i[o]]?i[o]=Oa[i[o]]:i[o]=c2(i[o]);return function(p){var b="",y;for(y=0;y<c;y++)b+=Qr(i[y])?i[y].call(p,n):i[y];return b}}function Gh(n,i){return n.isValid()?(i=zy(i,n.localeData()),bp[i]=bp[i]||h2(i),bp[i](n)):n.localeData().invalidDate()}function zy(n,i){var o=5;function c(p){return i.longDateFormat(p)||p}for(Wh.lastIndex=0;o>=0&&Wh.test(n);)n=n.replace(Wh,c),Wh.lastIndex=0,o-=1;return n}var u2={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};function d2(n){var i=this._longDateFormat[n],o=this._longDateFormat[n.toUpperCase()];return i||!o?i:(this._longDateFormat[n]=o.match(xp).map(function(c){return c==="MMMM"||c==="MM"||c==="DD"||c==="dddd"?c.slice(1):c}).join(""),this._longDateFormat[n])}var p2="Invalid date";function f2(){return this._invalidDate}var m2="%d",g2=/\d{1,2}/;function y2(n){return this._ordinal.replace("%d",n)}var _2={future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function x2(n,i,o,c){var p=this._relativeTime[o];return Qr(p)?p(n,i,o,c):p.replace(/%d/i,n)}function b2(n,i){var o=this._relativeTime[n>0?"future":"past"];return Qr(o)?o(i):o.replace(/%s/i,i)}var Ry={D:"date",dates:"date",date:"date",d:"day",days:"day",day:"day",e:"weekday",weekdays:"weekday",weekday:"weekday",E:"isoWeekday",isoweekdays:"isoWeekday",isoweekday:"isoWeekday",DDD:"dayOfYear",dayofyears:"dayOfYear",dayofyear:"dayOfYear",h:"hour",hours:"hour",hour:"hour",ms:"millisecond",milliseconds:"millisecond",millisecond:"millisecond",m:"minute",minutes:"minute",minute:"minute",M:"month",months:"month",month:"month",Q:"quarter",quarters:"quarter",quarter:"quarter",s:"second",seconds:"second",second:"second",gg:"weekYear",weekyears:"weekYear",weekyear:"weekYear",GG:"isoWeekYear",isoweekyears:"isoWeekYear",isoweekyear:"isoWeekYear",w:"week",weeks:"week",week:"week",W:"isoWeek",isoweeks:"isoWeek",isoweek:"isoWeek",y:"year",years:"year",year:"year"};function br(n){return typeof n=="string"?Ry[n]||Ry[n.toLowerCase()]:void 0}function vp(n){var i={},o,c;for(c in n)Kt(n,c)&&(o=br(c),o&&(i[o]=n[c]));return i}var v2={date:9,day:11,weekday:11,isoWeekday:11,dayOfYear:4,hour:13,millisecond:16,minute:14,month:8,quarter:7,second:15,weekYear:1,isoWeekYear:1,week:5,isoWeek:5,year:1};function w2(n){var i=[],o;for(o in n)Kt(n,o)&&i.push({unit:o,priority:v2[o]});return i.sort(function(c,p){return c.priority-p.priority}),i}var Ly=/\d/,er=/\d\d/,Oy=/\d{3}/,wp=/\d{4}/,Yh=/[+-]?\d{6}/,bi=/\d\d?/,By=/\d\d\d\d?/,Fy=/\d\d\d\d\d\d?/,Xh=/\d{1,3}/,kp=/\d{1,4}/,Kh=/[+-]?\d{1,6}/,Ba=/\d+/,Jh=/[+-]?\d+/,k2=/Z|[+-]\d\d:?\d\d/gi,Qh=/Z|[+-]\d\d(?::?\d\d)?/gi,S2=/[+-]?\d+(\.\d{1,3})?/,ec=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,Fa=/^[1-9]\d?/,Sp=/^([1-9]\d|\d)/,eu;eu={};function st(n,i,o){eu[n]=Qr(i)?i:function(c,p){return c&&o?o:i}}function E2(n,i){return Kt(eu,n)?eu[n](i._strict,i._locale):new RegExp(T2(n))}function T2(n){return xs(n.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(i,o,c,p,b){return o||c||p||b}))}function xs(n){return n.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function vr(n){return n<0?Math.ceil(n)||0:Math.floor(n)}function Ut(n){var i=+n,o=0;return i!==0&&isFinite(i)&&(o=vr(i)),o}var Ep={};function di(n,i){var o,c=i,p;for(typeof n=="string"&&(n=[n]),_s(i)&&(c=function(b,y){y[i]=Ut(b)}),p=n.length,o=0;o<p;o++)Ep[n[o]]=c}function tc(n,i){di(n,function(o,c,p,b){p._w=p._w||{},i(o,p._w,p,b)})}function C2(n,i,o){i!=null&&Kt(Ep,n)&&Ep[n](i,o._a,o,n)}function tu(n){return n%4===0&&n%100!==0||n%400===0}var pn=0,bs=1,ts=2,ji=3,Nr=4,vs=5,qo=6,M2=7,P2=8;ft("Y",0,0,function(){var n=this.year();return n<=9999?es(n,4):"+"+n}),ft(0,["YY",2],0,function(){return this.year()%100}),ft(0,["YYYY",4],0,"year"),ft(0,["YYYYY",5],0,"year"),ft(0,["YYYYYY",6,!0],0,"year"),st("Y",Jh),st("YY",bi,er),st("YYYY",kp,wp),st("YYYYY",Kh,Yh),st("YYYYYY",Kh,Yh),di(["YYYYY","YYYYYY"],pn),di("YYYY",function(n,i){i[pn]=n.length===2?Je.parseTwoDigitYear(n):Ut(n)}),di("YY",function(n,i){i[pn]=Je.parseTwoDigitYear(n)}),di("Y",function(n,i){i[pn]=parseInt(n,10)});function ic(n){return tu(n)?366:365}Je.parseTwoDigitYear=function(n){return Ut(n)+(Ut(n)>68?1900:2e3)};var Ny=Na("FullYear",!0);function I2(){return tu(this.year())}function Na(n,i){return function(o){return o!=null?(Vy(this,n,o),Je.updateOffset(this,i),this):nc(this,n)}}function nc(n,i){if(!n.isValid())return NaN;var o=n._d,c=n._isUTC;switch(i){case"Milliseconds":return c?o.getUTCMilliseconds():o.getMilliseconds();case"Seconds":return c?o.getUTCSeconds():o.getSeconds();case"Minutes":return c?o.getUTCMinutes():o.getMinutes();case"Hours":return c?o.getUTCHours():o.getHours();case"Date":return c?o.getUTCDate():o.getDate();case"Day":return c?o.getUTCDay():o.getDay();case"Month":return c?o.getUTCMonth():o.getMonth();case"FullYear":return c?o.getUTCFullYear():o.getFullYear();default:return NaN}}function Vy(n,i,o){var c,p,b,y,h;if(!(!n.isValid()||isNaN(o))){switch(c=n._d,p=n._isUTC,i){case"Milliseconds":return void(p?c.setUTCMilliseconds(o):c.setMilliseconds(o));case"Seconds":return void(p?c.setUTCSeconds(o):c.setSeconds(o));case"Minutes":return void(p?c.setUTCMinutes(o):c.setMinutes(o));case"Hours":return void(p?c.setUTCHours(o):c.setHours(o));case"Date":return void(p?c.setUTCDate(o):c.setDate(o));case"FullYear":break;default:return}b=o,y=n.month(),h=n.date(),h=h===29&&y===1&&!tu(b)?28:h,p?c.setUTCFullYear(b,y,h):c.setFullYear(b,y,h)}}function A2(n){return n=br(n),Qr(this[n])?this[n]():this}function D2(n,i){if(typeof n=="object"){n=vp(n);var o=w2(n),c,p=o.length;for(c=0;c<p;c++)this[o[c].unit](n[o[c].unit])}else if(n=br(n),Qr(this[n]))return this[n](i);return this}function z2(n,i){return(n%i+i)%i}var Li;Array.prototype.indexOf?Li=Array.prototype.indexOf:Li=function(n){var i;for(i=0;i<this.length;++i)if(this[i]===n)return i;return-1};function Tp(n,i){if(isNaN(n)||isNaN(i))return NaN;var o=z2(i,12);return n+=(i-o)/12,o===1?tu(n)?29:28:31-o%7%2}ft("M",["MM",2],"Mo",function(){return this.month()+1}),ft("MMM",0,0,function(n){return this.localeData().monthsShort(this,n)}),ft("MMMM",0,0,function(n){return this.localeData().months(this,n)}),st("M",bi,Fa),st("MM",bi,er),st("MMM",function(n,i){return i.monthsShortRegex(n)}),st("MMMM",function(n,i){return i.monthsRegex(n)}),di(["M","MM"],function(n,i){i[bs]=Ut(n)-1}),di(["MMM","MMMM"],function(n,i,o,c){var p=o._locale.monthsParse(n,c,o._strict);p!=null?i[bs]=p:zt(o).invalidMonth=n});var R2="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),$y="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),jy=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,L2=ec,O2=ec;function B2(n,i){return n?Br(this._months)?this._months[n.month()]:this._months[(this._months.isFormat||jy).test(i)?"format":"standalone"][n.month()]:Br(this._months)?this._months:this._months.standalone}function F2(n,i){return n?Br(this._monthsShort)?this._monthsShort[n.month()]:this._monthsShort[jy.test(i)?"format":"standalone"][n.month()]:Br(this._monthsShort)?this._monthsShort:this._monthsShort.standalone}function N2(n,i,o){var c,p,b,y=n.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],c=0;c<12;++c)b=Jr([2e3,c]),this._shortMonthsParse[c]=this.monthsShort(b,"").toLocaleLowerCase(),this._longMonthsParse[c]=this.months(b,"").toLocaleLowerCase();return o?i==="MMM"?(p=Li.call(this._shortMonthsParse,y),p!==-1?p:null):(p=Li.call(this._longMonthsParse,y),p!==-1?p:null):i==="MMM"?(p=Li.call(this._shortMonthsParse,y),p!==-1?p:(p=Li.call(this._longMonthsParse,y),p!==-1?p:null)):(p=Li.call(this._longMonthsParse,y),p!==-1?p:(p=Li.call(this._shortMonthsParse,y),p!==-1?p:null))}function V2(n,i,o){var c,p,b;if(this._monthsParseExact)return N2.call(this,n,i,o);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),c=0;c<12;c++){if(p=Jr([2e3,c]),o&&!this._longMonthsParse[c]&&(this._longMonthsParse[c]=new RegExp("^"+this.months(p,"").replace(".","")+"$","i"),this._shortMonthsParse[c]=new RegExp("^"+this.monthsShort(p,"").replace(".","")+"$","i")),!o&&!this._monthsParse[c]&&(b="^"+this.months(p,"")+"|^"+this.monthsShort(p,""),this._monthsParse[c]=new RegExp(b.replace(".",""),"i")),o&&i==="MMMM"&&this._longMonthsParse[c].test(n))return c;if(o&&i==="MMM"&&this._shortMonthsParse[c].test(n))return c;if(!o&&this._monthsParse[c].test(n))return c}}function Uy(n,i){if(!n.isValid())return n;if(typeof i=="string"){if(/^\d+$/.test(i))i=Ut(i);else if(i=n.localeData().monthsParse(i),!_s(i))return n}var o=i,c=n.date();return c=c<29?c:Math.min(c,Tp(n.year(),o)),n._isUTC?n._d.setUTCMonth(o,c):n._d.setMonth(o,c),n}function Hy(n){return n!=null?(Uy(this,n),Je.updateOffset(this,!0),this):nc(this,"Month")}function $2(){return Tp(this.year(),this.month())}function j2(n){return this._monthsParseExact?(Kt(this,"_monthsRegex")||qy.call(this),n?this._monthsShortStrictRegex:this._monthsShortRegex):(Kt(this,"_monthsShortRegex")||(this._monthsShortRegex=L2),this._monthsShortStrictRegex&&n?this._monthsShortStrictRegex:this._monthsShortRegex)}function U2(n){return this._monthsParseExact?(Kt(this,"_monthsRegex")||qy.call(this),n?this._monthsStrictRegex:this._monthsRegex):(Kt(this,"_monthsRegex")||(this._monthsRegex=O2),this._monthsStrictRegex&&n?this._monthsStrictRegex:this._monthsRegex)}function qy(){function n(M,D){return D.length-M.length}var i=[],o=[],c=[],p,b,y,h;for(p=0;p<12;p++)b=Jr([2e3,p]),y=xs(this.monthsShort(b,"")),h=xs(this.months(b,"")),i.push(y),o.push(h),c.push(h),c.push(y);i.sort(n),o.sort(n),c.sort(n),this._monthsRegex=new RegExp("^("+c.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+i.join("|")+")","i")}function H2(n,i,o,c,p,b,y){var h;return n<100&&n>=0?(h=new Date(n+400,i,o,c,p,b,y),isFinite(h.getFullYear())&&h.setFullYear(n)):h=new Date(n,i,o,c,p,b,y),h}function rc(n){var i,o;return n<100&&n>=0?(o=Array.prototype.slice.call(arguments),o[0]=n+400,i=new Date(Date.UTC.apply(null,o)),isFinite(i.getUTCFullYear())&&i.setUTCFullYear(n)):i=new Date(Date.UTC.apply(null,arguments)),i}function iu(n,i,o){var c=7+i-o,p=(7+rc(n,0,c).getUTCDay()-i)%7;return-p+c-1}function Zy(n,i,o,c,p){var b=(7+o-c)%7,y=iu(n,c,p),h=1+7*(i-1)+b+y,M,D;return h<=0?(M=n-1,D=ic(M)+h):h>ic(n)?(M=n+1,D=h-ic(n)):(M=n,D=h),{year:M,dayOfYear:D}}function sc(n,i,o){var c=iu(n.year(),i,o),p=Math.floor((n.dayOfYear()-c-1)/7)+1,b,y;return p<1?(y=n.year()-1,b=p+ws(y,i,o)):p>ws(n.year(),i,o)?(b=p-ws(n.year(),i,o),y=n.year()+1):(y=n.year(),b=p),{week:b,year:y}}function ws(n,i,o){var c=iu(n,i,o),p=iu(n+1,i,o);return(ic(n)-c+p)/7}ft("w",["ww",2],"wo","week"),ft("W",["WW",2],"Wo","isoWeek"),st("w",bi,Fa),st("ww",bi,er),st("W",bi,Fa),st("WW",bi,er),tc(["w","ww","W","WW"],function(n,i,o,c){i[c.substr(0,1)]=Ut(n)});function q2(n){return sc(n,this._week.dow,this._week.doy).week}var Z2={dow:0,doy:6};function W2(){return this._week.dow}function G2(){return this._week.doy}function Y2(n){var i=this.localeData().week(this);return n==null?i:this.add((n-i)*7,"d")}function X2(n){var i=sc(this,1,4).week;return n==null?i:this.add((n-i)*7,"d")}ft("d",0,"do","day"),ft("dd",0,0,function(n){return this.localeData().weekdaysMin(this,n)}),ft("ddd",0,0,function(n){return this.localeData().weekdaysShort(this,n)}),ft("dddd",0,0,function(n){return this.localeData().weekdays(this,n)}),ft("e",0,0,"weekday"),ft("E",0,0,"isoWeekday"),st("d",bi),st("e",bi),st("E",bi),st("dd",function(n,i){return i.weekdaysMinRegex(n)}),st("ddd",function(n,i){return i.weekdaysShortRegex(n)}),st("dddd",function(n,i){return i.weekdaysRegex(n)}),tc(["dd","ddd","dddd"],function(n,i,o,c){var p=o._locale.weekdaysParse(n,c,o._strict);p!=null?i.d=p:zt(o).invalidWeekday=n}),tc(["d","e","E"],function(n,i,o,c){i[c]=Ut(n)});function K2(n,i){return typeof n!="string"?n:isNaN(n)?(n=i.weekdaysParse(n),typeof n=="number"?n:null):parseInt(n,10)}function J2(n,i){return typeof n=="string"?i.weekdaysParse(n)%7||7:isNaN(n)?null:n}function Cp(n,i){return n.slice(i,7).concat(n.slice(0,i))}var Q2="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Wy="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),ek="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),tk=ec,ik=ec,nk=ec;function rk(n,i){var o=Br(this._weekdays)?this._weekdays:this._weekdays[n&&n!==!0&&this._weekdays.isFormat.test(i)?"format":"standalone"];return n===!0?Cp(o,this._week.dow):n?o[n.day()]:o}function sk(n){return n===!0?Cp(this._weekdaysShort,this._week.dow):n?this._weekdaysShort[n.day()]:this._weekdaysShort}function ok(n){return n===!0?Cp(this._weekdaysMin,this._week.dow):n?this._weekdaysMin[n.day()]:this._weekdaysMin}function ak(n,i,o){var c,p,b,y=n.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],c=0;c<7;++c)b=Jr([2e3,1]).day(c),this._minWeekdaysParse[c]=this.weekdaysMin(b,"").toLocaleLowerCase(),this._shortWeekdaysParse[c]=this.weekdaysShort(b,"").toLocaleLowerCase(),this._weekdaysParse[c]=this.weekdays(b,"").toLocaleLowerCase();return o?i==="dddd"?(p=Li.call(this._weekdaysParse,y),p!==-1?p:null):i==="ddd"?(p=Li.call(this._shortWeekdaysParse,y),p!==-1?p:null):(p=Li.call(this._minWeekdaysParse,y),p!==-1?p:null):i==="dddd"?(p=Li.call(this._weekdaysParse,y),p!==-1||(p=Li.call(this._shortWeekdaysParse,y),p!==-1)?p:(p=Li.call(this._minWeekdaysParse,y),p!==-1?p:null)):i==="ddd"?(p=Li.call(this._shortWeekdaysParse,y),p!==-1||(p=Li.call(this._weekdaysParse,y),p!==-1)?p:(p=Li.call(this._minWeekdaysParse,y),p!==-1?p:null)):(p=Li.call(this._minWeekdaysParse,y),p!==-1||(p=Li.call(this._weekdaysParse,y),p!==-1)?p:(p=Li.call(this._shortWeekdaysParse,y),p!==-1?p:null))}function lk(n,i,o){var c,p,b;if(this._weekdaysParseExact)return ak.call(this,n,i,o);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),c=0;c<7;c++){if(p=Jr([2e3,1]).day(c),o&&!this._fullWeekdaysParse[c]&&(this._fullWeekdaysParse[c]=new RegExp("^"+this.weekdays(p,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[c]=new RegExp("^"+this.weekdaysShort(p,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[c]=new RegExp("^"+this.weekdaysMin(p,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[c]||(b="^"+this.weekdays(p,"")+"|^"+this.weekdaysShort(p,"")+"|^"+this.weekdaysMin(p,""),this._weekdaysParse[c]=new RegExp(b.replace(".",""),"i")),o&&i==="dddd"&&this._fullWeekdaysParse[c].test(n))return c;if(o&&i==="ddd"&&this._shortWeekdaysParse[c].test(n))return c;if(o&&i==="dd"&&this._minWeekdaysParse[c].test(n))return c;if(!o&&this._weekdaysParse[c].test(n))return c}}function ck(n){if(!this.isValid())return n!=null?this:NaN;var i=nc(this,"Day");return n!=null?(n=K2(n,this.localeData()),this.add(n-i,"d")):i}function hk(n){if(!this.isValid())return n!=null?this:NaN;var i=(this.day()+7-this.localeData()._week.dow)%7;return n==null?i:this.add(n-i,"d")}function uk(n){if(!this.isValid())return n!=null?this:NaN;if(n!=null){var i=J2(n,this.localeData());return this.day(this.day()%7?i:i-7)}else return this.day()||7}function dk(n){return this._weekdaysParseExact?(Kt(this,"_weekdaysRegex")||Mp.call(this),n?this._weekdaysStrictRegex:this._weekdaysRegex):(Kt(this,"_weekdaysRegex")||(this._weekdaysRegex=tk),this._weekdaysStrictRegex&&n?this._weekdaysStrictRegex:this._weekdaysRegex)}function pk(n){return this._weekdaysParseExact?(Kt(this,"_weekdaysRegex")||Mp.call(this),n?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(Kt(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ik),this._weekdaysShortStrictRegex&&n?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function fk(n){return this._weekdaysParseExact?(Kt(this,"_weekdaysRegex")||Mp.call(this),n?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(Kt(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=nk),this._weekdaysMinStrictRegex&&n?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Mp(){function n(A,R){return R.length-A.length}var i=[],o=[],c=[],p=[],b,y,h,M,D;for(b=0;b<7;b++)y=Jr([2e3,1]).day(b),h=xs(this.weekdaysMin(y,"")),M=xs(this.weekdaysShort(y,"")),D=xs(this.weekdays(y,"")),i.push(h),o.push(M),c.push(D),p.push(h),p.push(M),p.push(D);i.sort(n),o.sort(n),c.sort(n),p.sort(n),this._weekdaysRegex=new RegExp("^("+p.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+i.join("|")+")","i")}function Pp(){return this.hours()%12||12}function mk(){return this.hours()||24}ft("H",["HH",2],0,"hour"),ft("h",["hh",2],0,Pp),ft("k",["kk",2],0,mk),ft("hmm",0,0,function(){return""+Pp.apply(this)+es(this.minutes(),2)}),ft("hmmss",0,0,function(){return""+Pp.apply(this)+es(this.minutes(),2)+es(this.seconds(),2)}),ft("Hmm",0,0,function(){return""+this.hours()+es(this.minutes(),2)}),ft("Hmmss",0,0,function(){return""+this.hours()+es(this.minutes(),2)+es(this.seconds(),2)});function Gy(n,i){ft(n,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),i)})}Gy("a",!0),Gy("A",!1);function Yy(n,i){return i._meridiemParse}st("a",Yy),st("A",Yy),st("H",bi,Sp),st("h",bi,Fa),st("k",bi,Fa),st("HH",bi,er),st("hh",bi,er),st("kk",bi,er),st("hmm",By),st("hmmss",Fy),st("Hmm",By),st("Hmmss",Fy),di(["H","HH"],ji),di(["k","kk"],function(n,i,o){var c=Ut(n);i[ji]=c===24?0:c}),di(["a","A"],function(n,i,o){o._isPm=o._locale.isPM(n),o._meridiem=n}),di(["h","hh"],function(n,i,o){i[ji]=Ut(n),zt(o).bigHour=!0}),di("hmm",function(n,i,o){var c=n.length-2;i[ji]=Ut(n.substr(0,c)),i[Nr]=Ut(n.substr(c)),zt(o).bigHour=!0}),di("hmmss",function(n,i,o){var c=n.length-4,p=n.length-2;i[ji]=Ut(n.substr(0,c)),i[Nr]=Ut(n.substr(c,2)),i[vs]=Ut(n.substr(p)),zt(o).bigHour=!0}),di("Hmm",function(n,i,o){var c=n.length-2;i[ji]=Ut(n.substr(0,c)),i[Nr]=Ut(n.substr(c))}),di("Hmmss",function(n,i,o){var c=n.length-4,p=n.length-2;i[ji]=Ut(n.substr(0,c)),i[Nr]=Ut(n.substr(c,2)),i[vs]=Ut(n.substr(p))});function gk(n){return(n+"").toLowerCase().charAt(0)==="p"}var yk=/[ap]\.?m?\.?/i,_k=Na("Hours",!0);function xk(n,i,o){return n>11?o?"pm":"PM":o?"am":"AM"}var Xy={calendar:a2,longDateFormat:u2,invalidDate:p2,ordinal:m2,dayOfMonthOrdinalParse:g2,relativeTime:_2,months:R2,monthsShort:$y,week:Z2,weekdays:Q2,weekdaysMin:ek,weekdaysShort:Wy,meridiemParse:yk},Ti={},oc={},ac;function bk(n,i){var o,c=Math.min(n.length,i.length);for(o=0;o<c;o+=1)if(n[o]!==i[o])return o;return c}function Ky(n){return n&&n.toLowerCase().replace("_","-")}function vk(n){for(var i=0,o,c,p,b;i<n.length;){for(b=Ky(n[i]).split("-"),o=b.length,c=Ky(n[i+1]),c=c?c.split("-"):null;o>0;){if(p=nu(b.slice(0,o).join("-")),p)return p;if(c&&c.length>=o&&bk(b,c)>=o-1)break;o--}i++}return ac}function wk(n){return!!(n&&n.match("^[^/\\\\]*$"))}function nu(n){var i=null,o;if(Ti[n]===void 0&&typeof module<"u"&&module&&module.exports&&wk(n))try{i=ac._abbr,o=require,o("./locale/"+n),Xs(i)}catch{Ti[n]=null}return Ti[n]}function Xs(n,i){var o;return n&&($n(i)?o=ks(n):o=Ip(n,i),o?ac=o:typeof console<"u"&&console.warn&&console.warn("Locale "+n+" not found. Did you forget to load it?")),ac._abbr}function Ip(n,i){if(i!==null){var o,c=Xy;if(i.abbr=n,Ti[n]!=null)Dy("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),c=Ti[n]._config;else if(i.parentLocale!=null)if(Ti[i.parentLocale]!=null)c=Ti[i.parentLocale]._config;else if(o=nu(i.parentLocale),o!=null)c=o._config;else return oc[i.parentLocale]||(oc[i.parentLocale]=[]),oc[i.parentLocale].push({name:n,config:i}),null;return Ti[n]=new yp(gp(c,i)),oc[n]&&oc[n].forEach(function(p){Ip(p.name,p.config)}),Xs(n),Ti[n]}else return delete Ti[n],null}function kk(n,i){if(i!=null){var o,c,p=Xy;Ti[n]!=null&&Ti[n].parentLocale!=null?Ti[n].set(gp(Ti[n]._config,i)):(c=nu(n),c!=null&&(p=c._config),i=gp(p,i),c==null&&(i.abbr=n),o=new yp(i),o.parentLocale=Ti[n],Ti[n]=o),Xs(n)}else Ti[n]!=null&&(Ti[n].parentLocale!=null?(Ti[n]=Ti[n].parentLocale,n===Xs()&&Xs(n)):Ti[n]!=null&&delete Ti[n]);return Ti[n]}function ks(n){var i;if(n&&n._locale&&n._locale._abbr&&(n=n._locale._abbr),!n)return ac;if(!Br(n)){if(i=nu(n),i)return i;n=[n]}return vk(n)}function Sk(){return _p(Ti)}function Ap(n){var i,o=n._a;return o&&zt(n).overflow===-2&&(i=o[bs]<0||o[bs]>11?bs:o[ts]<1||o[ts]>Tp(o[pn],o[bs])?ts:o[ji]<0||o[ji]>24||o[ji]===24&&(o[Nr]!==0||o[vs]!==0||o[qo]!==0)?ji:o[Nr]<0||o[Nr]>59?Nr:o[vs]<0||o[vs]>59?vs:o[qo]<0||o[qo]>999?qo:-1,zt(n)._overflowDayOfYear&&(i<pn||i>ts)&&(i=ts),zt(n)._overflowWeeks&&i===-1&&(i=M2),zt(n)._overflowWeekday&&i===-1&&(i=P2),zt(n).overflow=i),n}var Ek=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Tk=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ck=/Z|[+-]\d\d(?::?\d\d)?/,ru=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],Dp=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Mk=/^\/?Date\((-?\d+)/i,Pk=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Ik={UT:0,GMT:0,EDT:-4*60,EST:-5*60,CDT:-5*60,CST:-6*60,MDT:-6*60,MST:-7*60,PDT:-7*60,PST:-8*60};function Jy(n){var i,o,c=n._i,p=Ek.exec(c)||Tk.exec(c),b,y,h,M,D=ru.length,A=Dp.length;if(p){for(zt(n).iso=!0,i=0,o=D;i<o;i++)if(ru[i][1].exec(p[1])){y=ru[i][0],b=ru[i][2]!==!1;break}if(y==null){n._isValid=!1;return}if(p[3]){for(i=0,o=A;i<o;i++)if(Dp[i][1].exec(p[3])){h=(p[2]||" ")+Dp[i][0];break}if(h==null){n._isValid=!1;return}}if(!b&&h!=null){n._isValid=!1;return}if(p[4])if(Ck.exec(p[4]))M="Z";else{n._isValid=!1;return}n._f=y+(h||"")+(M||""),Rp(n)}else n._isValid=!1}function Ak(n,i,o,c,p,b){var y=[Dk(n),$y.indexOf(i),parseInt(o,10),parseInt(c,10),parseInt(p,10)];return b&&y.push(parseInt(b,10)),y}function Dk(n){var i=parseInt(n,10);return i<=49?2e3+i:i<=999?1900+i:i}function zk(n){return n.replace(/\([^()]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function Rk(n,i,o){if(n){var c=Wy.indexOf(n),p=new Date(i[0],i[1],i[2]).getDay();if(c!==p)return zt(o).weekdayMismatch=!0,o._isValid=!1,!1}return!0}function Lk(n,i,o){if(n)return Ik[n];if(i)return 0;var c=parseInt(o,10),p=c%100,b=(c-p)/100;return b*60+p}function Qy(n){var i=Pk.exec(zk(n._i)),o;if(i){if(o=Ak(i[4],i[3],i[2],i[5],i[6],i[7]),!Rk(i[1],o,n))return;n._a=o,n._tzm=Lk(i[8],i[9],i[10]),n._d=rc.apply(null,n._a),n._d.setUTCMinutes(n._d.getUTCMinutes()-n._tzm),zt(n).rfc2822=!0}else n._isValid=!1}function Ok(n){var i=Mk.exec(n._i);if(i!==null){n._d=new Date(+i[1]);return}if(Jy(n),n._isValid===!1)delete n._isValid;else return;if(Qy(n),n._isValid===!1)delete n._isValid;else return;n._strict?n._isValid=!1:Je.createFromInputFallback(n)}Je.createFromInputFallback=xr("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(n){n._d=new Date(n._i+(n._useUTC?" UTC":""))});function Va(n,i,o){return n??i??o}function Bk(n){var i=new Date(Je.now());return n._useUTC?[i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()]:[i.getFullYear(),i.getMonth(),i.getDate()]}function zp(n){var i,o,c=[],p,b,y;if(!n._d){for(p=Bk(n),n._w&&n._a[ts]==null&&n._a[bs]==null&&Fk(n),n._dayOfYear!=null&&(y=Va(n._a[pn],p[pn]),(n._dayOfYear>ic(y)||n._dayOfYear===0)&&(zt(n)._overflowDayOfYear=!0),o=rc(y,0,n._dayOfYear),n._a[bs]=o.getUTCMonth(),n._a[ts]=o.getUTCDate()),i=0;i<3&&n._a[i]==null;++i)n._a[i]=c[i]=p[i];for(;i<7;i++)n._a[i]=c[i]=n._a[i]==null?i===2?1:0:n._a[i];n._a[ji]===24&&n._a[Nr]===0&&n._a[vs]===0&&n._a[qo]===0&&(n._nextDay=!0,n._a[ji]=0),n._d=(n._useUTC?rc:H2).apply(null,c),b=n._useUTC?n._d.getUTCDay():n._d.getDay(),n._tzm!=null&&n._d.setUTCMinutes(n._d.getUTCMinutes()-n._tzm),n._nextDay&&(n._a[ji]=24),n._w&&typeof n._w.d<"u"&&n._w.d!==b&&(zt(n).weekdayMismatch=!0)}}function Fk(n){var i,o,c,p,b,y,h,M,D;i=n._w,i.GG!=null||i.W!=null||i.E!=null?(b=1,y=4,o=Va(i.GG,n._a[pn],sc(vi(),1,4).year),c=Va(i.W,1),p=Va(i.E,1),(p<1||p>7)&&(M=!0)):(b=n._locale._week.dow,y=n._locale._week.doy,D=sc(vi(),b,y),o=Va(i.gg,n._a[pn],D.year),c=Va(i.w,D.week),i.d!=null?(p=i.d,(p<0||p>6)&&(M=!0)):i.e!=null?(p=i.e+b,(i.e<0||i.e>6)&&(M=!0)):p=b),c<1||c>ws(o,b,y)?zt(n)._overflowWeeks=!0:M!=null?zt(n)._overflowWeekday=!0:(h=Zy(o,c,p,b,y),n._a[pn]=h.year,n._dayOfYear=h.dayOfYear)}Je.ISO_8601=function(){},Je.RFC_2822=function(){};function Rp(n){if(n._f===Je.ISO_8601){Jy(n);return}if(n._f===Je.RFC_2822){Qy(n);return}n._a=[],zt(n).empty=!0;var i=""+n._i,o,c,p,b,y,h=i.length,M=0,D,A;for(p=zy(n._f,n._locale).match(xp)||[],A=p.length,o=0;o<A;o++)b=p[o],c=(i.match(E2(b,n))||[])[0],c&&(y=i.substr(0,i.indexOf(c)),y.length>0&&zt(n).unusedInput.push(y),i=i.slice(i.indexOf(c)+c.length),M+=c.length),Oa[b]?(c?zt(n).empty=!1:zt(n).unusedTokens.push(b),C2(b,c,n)):n._strict&&!c&&zt(n).unusedTokens.push(b);zt(n).charsLeftOver=h-M,i.length>0&&zt(n).unusedInput.push(i),n._a[ji]<=12&&zt(n).bigHour===!0&&n._a[ji]>0&&(zt(n).bigHour=void 0),zt(n).parsedDateParts=n._a.slice(0),zt(n).meridiem=n._meridiem,n._a[ji]=Nk(n._locale,n._a[ji],n._meridiem),D=zt(n).era,D!==null&&(n._a[pn]=n._locale.erasConvertYear(D,n._a[pn])),zp(n),Ap(n)}function Nk(n,i,o){var c;return o==null?i:n.meridiemHour!=null?n.meridiemHour(i,o):(n.isPM!=null&&(c=n.isPM(o),c&&i<12&&(i+=12),!c&&i===12&&(i=0)),i)}function Vk(n){var i,o,c,p,b,y,h=!1,M=n._f.length;if(M===0){zt(n).invalidFormat=!0,n._d=new Date(NaN);return}for(p=0;p<M;p++)b=0,y=!1,i=mp({},n),n._useUTC!=null&&(i._useUTC=n._useUTC),i._f=n._f[p],Rp(i),pp(i)&&(y=!0),b+=zt(i).charsLeftOver,b+=zt(i).unusedTokens.length*10,zt(i).score=b,h?b<c&&(c=b,o=i):(c==null||b<c||y)&&(c=b,o=i,y&&(h=!0));Ys(n,o||i)}function $k(n){if(!n._d){var i=vp(n._i),o=i.day===void 0?i.date:i.day;n._a=My([i.year,i.month,o,i.hour,i.minute,i.second,i.millisecond],function(c){return c&&parseInt(c,10)}),zp(n)}}function jk(n){var i=new Ql(Ap(e0(n)));return i._nextDay&&(i.add(1,"d"),i._nextDay=void 0),i}function e0(n){var i=n._i,o=n._f;return n._locale=n._locale||ks(n._l),i===null||o===void 0&&i===""?Zh({nullInput:!0}):(typeof i=="string"&&(n._i=i=n._locale.preparse(i)),Fr(i)?new Ql(Ap(i)):(Jl(i)?n._d=i:Br(o)?Vk(n):o?Rp(n):Uk(n),pp(n)||(n._d=null),n))}function Uk(n){var i=n._i;$n(i)?n._d=new Date(Je.now()):Jl(i)?n._d=new Date(i.valueOf()):typeof i=="string"?Ok(n):Br(i)?(n._a=My(i.slice(0),function(o){return parseInt(o,10)}),zp(n)):Ho(i)?$k(n):_s(i)?n._d=new Date(i):Je.createFromInputFallback(n)}function t0(n,i,o,c,p){var b={};return(i===!0||i===!1)&&(c=i,i=void 0),(o===!0||o===!1)&&(c=o,o=void 0),(Ho(n)&&up(n)||Br(n)&&n.length===0)&&(n=void 0),b._isAMomentObject=!0,b._useUTC=b._isUTC=p,b._l=o,b._i=n,b._f=i,b._strict=c,jk(b)}function vi(n,i,o,c){return t0(n,i,o,c,!1)}var Hk=xr("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var n=vi.apply(null,arguments);return this.isValid()&&n.isValid()?n<this?this:n:Zh()}),qk=xr("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var n=vi.apply(null,arguments);return this.isValid()&&n.isValid()?n>this?this:n:Zh()});function i0(n,i){var o,c;if(i.length===1&&Br(i[0])&&(i=i[0]),!i.length)return vi();for(o=i[0],c=1;c<i.length;++c)(!i[c].isValid()||i[c][n](o))&&(o=i[c]);return o}function Zk(){var n=[].slice.call(arguments,0);return i0("isBefore",n)}function Wk(){var n=[].slice.call(arguments,0);return i0("isAfter",n)}var Gk=function(){return Date.now?Date.now():+new Date},lc=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Yk(n){var i,o=!1,c,p=lc.length;for(i in n)if(Kt(n,i)&&!(Li.call(lc,i)!==-1&&(n[i]==null||!isNaN(n[i]))))return!1;for(c=0;c<p;++c)if(n[lc[c]]){if(o)return!1;parseFloat(n[lc[c]])!==Ut(n[lc[c]])&&(o=!0)}return!0}function Xk(){return this._isValid}function Kk(){return Vr(NaN)}function su(n){var i=vp(n),o=i.year||0,c=i.quarter||0,p=i.month||0,b=i.week||i.isoWeek||0,y=i.day||0,h=i.hour||0,M=i.minute||0,D=i.second||0,A=i.millisecond||0;this._isValid=Yk(i),this._milliseconds=+A+D*1e3+M*6e4+h*1e3*60*60,this._days=+y+b*7,this._months=+p+c*3+o*12,this._data={},this._locale=ks(),this._bubble()}function ou(n){return n instanceof su}function Lp(n){return n<0?Math.round(-1*n)*-1:Math.round(n)}function Jk(n,i,o){var c=Math.min(n.length,i.length),p=Math.abs(n.length-i.length),b=0,y;for(y=0;y<c;y++)Ut(n[y])!==Ut(i[y])&&b++;return b+p}function n0(n,i){ft(n,0,0,function(){var o=this.utcOffset(),c="+";return o<0&&(o=-o,c="-"),c+es(~~(o/60),2)+i+es(~~o%60,2)})}n0("Z",":"),n0("ZZ",""),st("Z",Qh),st("ZZ",Qh),di(["Z","ZZ"],function(n,i,o){o._useUTC=!0,o._tzm=Op(Qh,n)});var Qk=/([\+\-]|\d\d)/gi;function Op(n,i){var o=(i||"").match(n),c,p,b;return o===null?null:(c=o[o.length-1]||[],p=(c+"").match(Qk)||["-",0,0],b=+(p[1]*60)+Ut(p[2]),b===0?0:p[0]==="+"?b:-b)}function Bp(n,i){var o,c;return i._isUTC?(o=i.clone(),c=(Fr(n)||Jl(n)?n.valueOf():vi(n).valueOf())-o.valueOf(),o._d.setTime(o._d.valueOf()+c),Je.updateOffset(o,!1),o):vi(n).local()}function Fp(n){return-Math.round(n._d.getTimezoneOffset())}Je.updateOffset=function(){};function eS(n,i,o){var c=this._offset||0,p;if(!this.isValid())return n!=null?this:NaN;if(n!=null){if(typeof n=="string"){if(n=Op(Qh,n),n===null)return this}else Math.abs(n)<16&&!o&&(n=n*60);return!this._isUTC&&i&&(p=Fp(this)),this._offset=n,this._isUTC=!0,p!=null&&this.add(p,"m"),c!==n&&(!i||this._changeInProgress?a0(this,Vr(n-c,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,Je.updateOffset(this,!0),this._changeInProgress=null)),this}else return this._isUTC?c:Fp(this)}function tS(n,i){return n!=null?(typeof n!="string"&&(n=-n),this.utcOffset(n,i),this):-this.utcOffset()}function iS(n){return this.utcOffset(0,n)}function nS(n){return this._isUTC&&(this.utcOffset(0,n),this._isUTC=!1,n&&this.subtract(Fp(this),"m")),this}function rS(){if(this._tzm!=null)this.utcOffset(this._tzm,!1,!0);else if(typeof this._i=="string"){var n=Op(k2,this._i);n!=null?this.utcOffset(n):this.utcOffset(0,!0)}return this}function sS(n){return this.isValid()?(n=n?vi(n).utcOffset():0,(this.utcOffset()-n)%60===0):!1}function oS(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function aS(){if(!$n(this._isDSTShifted))return this._isDSTShifted;var n={},i;return mp(n,this),n=e0(n),n._a?(i=n._isUTC?Jr(n._a):vi(n._a),this._isDSTShifted=this.isValid()&&Jk(n._a,i.toArray())>0):this._isDSTShifted=!1,this._isDSTShifted}function lS(){return this.isValid()?!this._isUTC:!1}function cS(){return this.isValid()?this._isUTC:!1}function r0(){return this.isValid()?this._isUTC&&this._offset===0:!1}var hS=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,uS=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Vr(n,i){var o=n,c=null,p,b,y;return ou(n)?o={ms:n._milliseconds,d:n._days,M:n._months}:_s(n)||!isNaN(+n)?(o={},i?o[i]=+n:o.milliseconds=+n):(c=hS.exec(n))?(p=c[1]==="-"?-1:1,o={y:0,d:Ut(c[ts])*p,h:Ut(c[ji])*p,m:Ut(c[Nr])*p,s:Ut(c[vs])*p,ms:Ut(Lp(c[qo]*1e3))*p}):(c=uS.exec(n))?(p=c[1]==="-"?-1:1,o={y:Zo(c[2],p),M:Zo(c[3],p),w:Zo(c[4],p),d:Zo(c[5],p),h:Zo(c[6],p),m:Zo(c[7],p),s:Zo(c[8],p)}):o==null?o={}:typeof o=="object"&&("from"in o||"to"in o)&&(y=dS(vi(o.from),vi(o.to)),o={},o.ms=y.milliseconds,o.M=y.months),b=new su(o),ou(n)&&Kt(n,"_locale")&&(b._locale=n._locale),ou(n)&&Kt(n,"_isValid")&&(b._isValid=n._isValid),b}Vr.fn=su.prototype,Vr.invalid=Kk;function Zo(n,i){var o=n&&parseFloat(n.replace(",","."));return(isNaN(o)?0:o)*i}function s0(n,i){var o={};return o.months=i.month()-n.month()+(i.year()-n.year())*12,n.clone().add(o.months,"M").isAfter(i)&&--o.months,o.milliseconds=+i-+n.clone().add(o.months,"M"),o}function dS(n,i){var o;return n.isValid()&&i.isValid()?(i=Bp(i,n),n.isBefore(i)?o=s0(n,i):(o=s0(i,n),o.milliseconds=-o.milliseconds,o.months=-o.months),o):{milliseconds:0,months:0}}function o0(n,i){return function(o,c){var p,b;return c!==null&&!isNaN(+c)&&(Dy(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),b=o,o=c,c=b),p=Vr(o,c),a0(this,p,n),this}}function a0(n,i,o,c){var p=i._milliseconds,b=Lp(i._days),y=Lp(i._months);n.isValid()&&(c=c??!0,y&&Uy(n,nc(n,"Month")+y*o),b&&Vy(n,"Date",nc(n,"Date")+b*o),p&&n._d.setTime(n._d.valueOf()+p*o),c&&Je.updateOffset(n,b||y))}var pS=o0(1,"add"),fS=o0(-1,"subtract");function l0(n){return typeof n=="string"||n instanceof String}function mS(n){return Fr(n)||Jl(n)||l0(n)||_s(n)||yS(n)||gS(n)||n===null||n===void 0}function gS(n){var i=Ho(n)&&!up(n),o=!1,c=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"],p,b,y=c.length;for(p=0;p<y;p+=1)b=c[p],o=o||Kt(n,b);return i&&o}function yS(n){var i=Br(n),o=!1;return i&&(o=n.filter(function(c){return!_s(c)&&l0(n)}).length===0),i&&o}function _S(n){var i=Ho(n)&&!up(n),o=!1,c=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],p,b;for(p=0;p<c.length;p+=1)b=c[p],o=o||Kt(n,b);return i&&o}function xS(n,i){var o=n.diff(i,"days",!0);return o<-6?"sameElse":o<-1?"lastWeek":o<0?"lastDay":o<1?"sameDay":o<2?"nextDay":o<7?"nextWeek":"sameElse"}function bS(n,i){arguments.length===1&&(arguments[0]?mS(arguments[0])?(n=arguments[0],i=void 0):_S(arguments[0])&&(i=arguments[0],n=void 0):(n=void 0,i=void 0));var o=n||vi(),c=Bp(o,this).startOf("day"),p=Je.calendarFormat(this,c)||"sameElse",b=i&&(Qr(i[p])?i[p].call(this,o):i[p]);return this.format(b||this.localeData().calendar(p,this,vi(o)))}function vS(){return new Ql(this)}function wS(n,i){var o=Fr(n)?n:vi(n);return this.isValid()&&o.isValid()?(i=br(i)||"millisecond",i==="millisecond"?this.valueOf()>o.valueOf():o.valueOf()<this.clone().startOf(i).valueOf()):!1}function kS(n,i){var o=Fr(n)?n:vi(n);return this.isValid()&&o.isValid()?(i=br(i)||"millisecond",i==="millisecond"?this.valueOf()<o.valueOf():this.clone().endOf(i).valueOf()<o.valueOf()):!1}function SS(n,i,o,c){var p=Fr(n)?n:vi(n),b=Fr(i)?i:vi(i);return this.isValid()&&p.isValid()&&b.isValid()?(c=c||"()",(c[0]==="("?this.isAfter(p,o):!this.isBefore(p,o))&&(c[1]===")"?this.isBefore(b,o):!this.isAfter(b,o))):!1}function ES(n,i){var o=Fr(n)?n:vi(n),c;return this.isValid()&&o.isValid()?(i=br(i)||"millisecond",i==="millisecond"?this.valueOf()===o.valueOf():(c=o.valueOf(),this.clone().startOf(i).valueOf()<=c&&c<=this.clone().endOf(i).valueOf())):!1}function TS(n,i){return this.isSame(n,i)||this.isAfter(n,i)}function CS(n,i){return this.isSame(n,i)||this.isBefore(n,i)}function MS(n,i,o){var c,p,b;if(!this.isValid())return NaN;if(c=Bp(n,this),!c.isValid())return NaN;switch(p=(c.utcOffset()-this.utcOffset())*6e4,i=br(i),i){case"year":b=au(this,c)/12;break;case"month":b=au(this,c);break;case"quarter":b=au(this,c)/3;break;case"second":b=(this-c)/1e3;break;case"minute":b=(this-c)/6e4;break;case"hour":b=(this-c)/36e5;break;case"day":b=(this-c-p)/864e5;break;case"week":b=(this-c-p)/6048e5;break;default:b=this-c}return o?b:vr(b)}function au(n,i){if(n.date()<i.date())return-au(i,n);var o=(i.year()-n.year())*12+(i.month()-n.month()),c=n.clone().add(o,"months"),p,b;return i-c<0?(p=n.clone().add(o-1,"months"),b=(i-c)/(c-p)):(p=n.clone().add(o+1,"months"),b=(i-c)/(p-c)),-(o+b)||0}Je.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",Je.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";function PS(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function IS(n){if(!this.isValid())return null;var i=n!==!0,o=i?this.clone().utc():this;return o.year()<0||o.year()>9999?Gh(o,i?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):Qr(Date.prototype.toISOString)?i?this.toDate().toISOString():new Date(this.valueOf()+this.utcOffset()*60*1e3).toISOString().replace("Z",Gh(o,"Z")):Gh(o,i?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")}function AS(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var n="moment",i="",o,c,p,b;return this.isLocal()||(n=this.utcOffset()===0?"moment.utc":"moment.parseZone",i="Z"),o="["+n+'("]',c=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",p="-MM-DD[T]HH:mm:ss.SSS",b=i+'[")]',this.format(o+c+p+b)}function DS(n){n||(n=this.isUtc()?Je.defaultFormatUtc:Je.defaultFormat);var i=Gh(this,n);return this.localeData().postformat(i)}function zS(n,i){return this.isValid()&&(Fr(n)&&n.isValid()||vi(n).isValid())?Vr({to:this,from:n}).locale(this.locale()).humanize(!i):this.localeData().invalidDate()}function RS(n){return this.from(vi(),n)}function LS(n,i){return this.isValid()&&(Fr(n)&&n.isValid()||vi(n).isValid())?Vr({from:this,to:n}).locale(this.locale()).humanize(!i):this.localeData().invalidDate()}function OS(n){return this.to(vi(),n)}function c0(n){var i;return n===void 0?this._locale._abbr:(i=ks(n),i!=null&&(this._locale=i),this)}var h0=xr("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(n){return n===void 0?this.localeData():this.locale(n)});function u0(){return this._locale}var lu=1e3,$a=60*lu,cu=60*$a,d0=(365*400+97)*24*cu;function ja(n,i){return(n%i+i)%i}function p0(n,i,o){return n<100&&n>=0?new Date(n+400,i,o)-d0:new Date(n,i,o).valueOf()}function f0(n,i,o){return n<100&&n>=0?Date.UTC(n+400,i,o)-d0:Date.UTC(n,i,o)}function BS(n){var i,o;if(n=br(n),n===void 0||n==="millisecond"||!this.isValid())return this;switch(o=this._isUTC?f0:p0,n){case"year":i=o(this.year(),0,1);break;case"quarter":i=o(this.year(),this.month()-this.month()%3,1);break;case"month":i=o(this.year(),this.month(),1);break;case"week":i=o(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":i=o(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":i=o(this.year(),this.month(),this.date());break;case"hour":i=this._d.valueOf(),i-=ja(i+(this._isUTC?0:this.utcOffset()*$a),cu);break;case"minute":i=this._d.valueOf(),i-=ja(i,$a);break;case"second":i=this._d.valueOf(),i-=ja(i,lu);break}return this._d.setTime(i),Je.updateOffset(this,!0),this}function FS(n){var i,o;if(n=br(n),n===void 0||n==="millisecond"||!this.isValid())return this;switch(o=this._isUTC?f0:p0,n){case"year":i=o(this.year()+1,0,1)-1;break;case"quarter":i=o(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":i=o(this.year(),this.month()+1,1)-1;break;case"week":i=o(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":i=o(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":i=o(this.year(),this.month(),this.date()+1)-1;break;case"hour":i=this._d.valueOf(),i+=cu-ja(i+(this._isUTC?0:this.utcOffset()*$a),cu)-1;break;case"minute":i=this._d.valueOf(),i+=$a-ja(i,$a)-1;break;case"second":i=this._d.valueOf(),i+=lu-ja(i,lu)-1;break}return this._d.setTime(i),Je.updateOffset(this,!0),this}function NS(){return this._d.valueOf()-(this._offset||0)*6e4}function VS(){return Math.floor(this.valueOf()/1e3)}function $S(){return new Date(this.valueOf())}function jS(){var n=this;return[n.year(),n.month(),n.date(),n.hour(),n.minute(),n.second(),n.millisecond()]}function US(){var n=this;return{years:n.year(),months:n.month(),date:n.date(),hours:n.hours(),minutes:n.minutes(),seconds:n.seconds(),milliseconds:n.milliseconds()}}function HS(){return this.isValid()?this.toISOString():null}function qS(){return pp(this)}function ZS(){return Ys({},zt(this))}function WS(){return zt(this).overflow}function GS(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}ft("N",0,0,"eraAbbr"),ft("NN",0,0,"eraAbbr"),ft("NNN",0,0,"eraAbbr"),ft("NNNN",0,0,"eraName"),ft("NNNNN",0,0,"eraNarrow"),ft("y",["y",1],"yo","eraYear"),ft("y",["yy",2],0,"eraYear"),ft("y",["yyy",3],0,"eraYear"),ft("y",["yyyy",4],0,"eraYear"),st("N",Np),st("NN",Np),st("NNN",Np),st("NNNN",sE),st("NNNNN",oE),di(["N","NN","NNN","NNNN","NNNNN"],function(n,i,o,c){var p=o._locale.erasParse(n,c,o._strict);p?zt(o).era=p:zt(o).invalidEra=n}),st("y",Ba),st("yy",Ba),st("yyy",Ba),st("yyyy",Ba),st("yo",aE),di(["y","yy","yyy","yyyy"],pn),di(["yo"],function(n,i,o,c){var p;o._locale._eraYearOrdinalRegex&&(p=n.match(o._locale._eraYearOrdinalRegex)),o._locale.eraYearOrdinalParse?i[pn]=o._locale.eraYearOrdinalParse(n,p):i[pn]=parseInt(n,10)});function YS(n,i){var o,c,p,b=this._eras||ks("en")._eras;for(o=0,c=b.length;o<c;++o){switch(typeof b[o].since){case"string":p=Je(b[o].since).startOf("day"),b[o].since=p.valueOf();break}switch(typeof b[o].until){case"undefined":b[o].until=1/0;break;case"string":p=Je(b[o].until).startOf("day").valueOf(),b[o].until=p.valueOf();break}}return b}function XS(n,i,o){var c,p,b=this.eras(),y,h,M;for(n=n.toUpperCase(),c=0,p=b.length;c<p;++c)if(y=b[c].name.toUpperCase(),h=b[c].abbr.toUpperCase(),M=b[c].narrow.toUpperCase(),o)switch(i){case"N":case"NN":case"NNN":if(h===n)return b[c];break;case"NNNN":if(y===n)return b[c];break;case"NNNNN":if(M===n)return b[c];break}else if([y,h,M].indexOf(n)>=0)return b[c]}function KS(n,i){var o=n.since<=n.until?1:-1;return i===void 0?Je(n.since).year():Je(n.since).year()+(i-n.offset)*o}function JS(){var n,i,o,c=this.localeData().eras();for(n=0,i=c.length;n<i;++n)if(o=this.clone().startOf("day").valueOf(),c[n].since<=o&&o<=c[n].until||c[n].until<=o&&o<=c[n].since)return c[n].name;return""}function QS(){var n,i,o,c=this.localeData().eras();for(n=0,i=c.length;n<i;++n)if(o=this.clone().startOf("day").valueOf(),c[n].since<=o&&o<=c[n].until||c[n].until<=o&&o<=c[n].since)return c[n].narrow;return""}function eE(){var n,i,o,c=this.localeData().eras();for(n=0,i=c.length;n<i;++n)if(o=this.clone().startOf("day").valueOf(),c[n].since<=o&&o<=c[n].until||c[n].until<=o&&o<=c[n].since)return c[n].abbr;return""}function tE(){var n,i,o,c,p=this.localeData().eras();for(n=0,i=p.length;n<i;++n)if(o=p[n].since<=p[n].until?1:-1,c=this.clone().startOf("day").valueOf(),p[n].since<=c&&c<=p[n].until||p[n].until<=c&&c<=p[n].since)return(this.year()-Je(p[n].since).year())*o+p[n].offset;return this.year()}function iE(n){return Kt(this,"_erasNameRegex")||Vp.call(this),n?this._erasNameRegex:this._erasRegex}function nE(n){return Kt(this,"_erasAbbrRegex")||Vp.call(this),n?this._erasAbbrRegex:this._erasRegex}function rE(n){return Kt(this,"_erasNarrowRegex")||Vp.call(this),n?this._erasNarrowRegex:this._erasRegex}function Np(n,i){return i.erasAbbrRegex(n)}function sE(n,i){return i.erasNameRegex(n)}function oE(n,i){return i.erasNarrowRegex(n)}function aE(n,i){return i._eraYearOrdinalRegex||Ba}function Vp(){var n=[],i=[],o=[],c=[],p,b,y,h,M,D=this.eras();for(p=0,b=D.length;p<b;++p)y=xs(D[p].name),h=xs(D[p].abbr),M=xs(D[p].narrow),i.push(y),n.push(h),o.push(M),c.push(y),c.push(h),c.push(M);this._erasRegex=new RegExp("^("+c.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+i.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+n.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+o.join("|")+")","i")}ft(0,["gg",2],0,function(){return this.weekYear()%100}),ft(0,["GG",2],0,function(){return this.isoWeekYear()%100});function hu(n,i){ft(0,[n,n.length],0,i)}hu("gggg","weekYear"),hu("ggggg","weekYear"),hu("GGGG","isoWeekYear"),hu("GGGGG","isoWeekYear"),st("G",Jh),st("g",Jh),st("GG",bi,er),st("gg",bi,er),st("GGGG",kp,wp),st("gggg",kp,wp),st("GGGGG",Kh,Yh),st("ggggg",Kh,Yh),tc(["gggg","ggggg","GGGG","GGGGG"],function(n,i,o,c){i[c.substr(0,2)]=Ut(n)}),tc(["gg","GG"],function(n,i,o,c){i[c]=Je.parseTwoDigitYear(n)});function lE(n){return m0.call(this,n,this.week(),this.weekday()+this.localeData()._week.dow,this.localeData()._week.dow,this.localeData()._week.doy)}function cE(n){return m0.call(this,n,this.isoWeek(),this.isoWeekday(),1,4)}function hE(){return ws(this.year(),1,4)}function uE(){return ws(this.isoWeekYear(),1,4)}function dE(){var n=this.localeData()._week;return ws(this.year(),n.dow,n.doy)}function pE(){var n=this.localeData()._week;return ws(this.weekYear(),n.dow,n.doy)}function m0(n,i,o,c,p){var b;return n==null?sc(this,c,p).year:(b=ws(n,c,p),i>b&&(i=b),fE.call(this,n,i,o,c,p))}function fE(n,i,o,c,p){var b=Zy(n,i,o,c,p),y=rc(b.year,0,b.dayOfYear);return this.year(y.getUTCFullYear()),this.month(y.getUTCMonth()),this.date(y.getUTCDate()),this}ft("Q",0,"Qo","quarter"),st("Q",Ly),di("Q",function(n,i){i[bs]=(Ut(n)-1)*3});function mE(n){return n==null?Math.ceil((this.month()+1)/3):this.month((n-1)*3+this.month()%3)}ft("D",["DD",2],"Do","date"),st("D",bi,Fa),st("DD",bi,er),st("Do",function(n,i){return n?i._dayOfMonthOrdinalParse||i._ordinalParse:i._dayOfMonthOrdinalParseLenient}),di(["D","DD"],ts),di("Do",function(n,i){i[ts]=Ut(n.match(bi)[0])});var g0=Na("Date",!0);ft("DDD",["DDDD",3],"DDDo","dayOfYear"),st("DDD",Xh),st("DDDD",Oy),di(["DDD","DDDD"],function(n,i,o){o._dayOfYear=Ut(n)});function gE(n){var i=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return n==null?i:this.add(n-i,"d")}ft("m",["mm",2],0,"minute"),st("m",bi,Sp),st("mm",bi,er),di(["m","mm"],Nr);var yE=Na("Minutes",!1);ft("s",["ss",2],0,"second"),st("s",bi,Sp),st("ss",bi,er),di(["s","ss"],vs);var _E=Na("Seconds",!1);ft("S",0,0,function(){return~~(this.millisecond()/100)}),ft(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),ft(0,["SSS",3],0,"millisecond"),ft(0,["SSSS",4],0,function(){return this.millisecond()*10}),ft(0,["SSSSS",5],0,function(){return this.millisecond()*100}),ft(0,["SSSSSS",6],0,function(){return this.millisecond()*1e3}),ft(0,["SSSSSSS",7],0,function(){return this.millisecond()*1e4}),ft(0,["SSSSSSSS",8],0,function(){return this.millisecond()*1e5}),ft(0,["SSSSSSSSS",9],0,function(){return this.millisecond()*1e6}),st("S",Xh,Ly),st("SS",Xh,er),st("SSS",Xh,Oy);var Ks,y0;for(Ks="SSSS";Ks.length<=9;Ks+="S")st(Ks,Ba);function xE(n,i){i[qo]=Ut(("0."+n)*1e3)}for(Ks="S";Ks.length<=9;Ks+="S")di(Ks,xE);y0=Na("Milliseconds",!1),ft("z",0,0,"zoneAbbr"),ft("zz",0,0,"zoneName");function bE(){return this._isUTC?"UTC":""}function vE(){return this._isUTC?"Coordinated Universal Time":""}var ze=Ql.prototype;ze.add=pS,ze.calendar=bS,ze.clone=vS,ze.diff=MS,ze.endOf=FS,ze.format=DS,ze.from=zS,ze.fromNow=RS,ze.to=LS,ze.toNow=OS,ze.get=A2,ze.invalidAt=WS,ze.isAfter=wS,ze.isBefore=kS,ze.isBetween=SS,ze.isSame=ES,ze.isSameOrAfter=TS,ze.isSameOrBefore=CS,ze.isValid=qS,ze.lang=h0,ze.locale=c0,ze.localeData=u0,ze.max=qk,ze.min=Hk,ze.parsingFlags=ZS,ze.set=D2,ze.startOf=BS,ze.subtract=fS,ze.toArray=jS,ze.toObject=US,ze.toDate=$S,ze.toISOString=IS,ze.inspect=AS,typeof Symbol<"u"&&Symbol.for!=null&&(ze[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),ze.toJSON=HS,ze.toString=PS,ze.unix=VS,ze.valueOf=NS,ze.creationData=GS,ze.eraName=JS,ze.eraNarrow=QS,ze.eraAbbr=eE,ze.eraYear=tE,ze.year=Ny,ze.isLeapYear=I2,ze.weekYear=lE,ze.isoWeekYear=cE,ze.quarter=ze.quarters=mE,ze.month=Hy,ze.daysInMonth=$2,ze.week=ze.weeks=Y2,ze.isoWeek=ze.isoWeeks=X2,ze.weeksInYear=dE,ze.weeksInWeekYear=pE,ze.isoWeeksInYear=hE,ze.isoWeeksInISOWeekYear=uE,ze.date=g0,ze.day=ze.days=ck,ze.weekday=hk,ze.isoWeekday=uk,ze.dayOfYear=gE,ze.hour=ze.hours=_k,ze.minute=ze.minutes=yE,ze.second=ze.seconds=_E,ze.millisecond=ze.milliseconds=y0,ze.utcOffset=eS,ze.utc=iS,ze.local=nS,ze.parseZone=rS,ze.hasAlignedHourOffset=sS,ze.isDST=oS,ze.isLocal=lS,ze.isUtcOffset=cS,ze.isUtc=r0,ze.isUTC=r0,ze.zoneAbbr=bE,ze.zoneName=vE,ze.dates=xr("dates accessor is deprecated. Use date instead.",g0),ze.months=xr("months accessor is deprecated. Use month instead",Hy),ze.years=xr("years accessor is deprecated. Use year instead",Ny),ze.zone=xr("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",tS),ze.isDSTShifted=xr("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",aS);function wE(n){return vi(n*1e3)}function kE(){return vi.apply(null,arguments).parseZone()}function _0(n){return n}var Jt=yp.prototype;Jt.calendar=l2,Jt.longDateFormat=d2,Jt.invalidDate=f2,Jt.ordinal=y2,Jt.preparse=_0,Jt.postformat=_0,Jt.relativeTime=x2,Jt.pastFuture=b2,Jt.set=o2,Jt.eras=YS,Jt.erasParse=XS,Jt.erasConvertYear=KS,Jt.erasAbbrRegex=nE,Jt.erasNameRegex=iE,Jt.erasNarrowRegex=rE,Jt.months=B2,Jt.monthsShort=F2,Jt.monthsParse=V2,Jt.monthsRegex=U2,Jt.monthsShortRegex=j2,Jt.week=q2,Jt.firstDayOfYear=G2,Jt.firstDayOfWeek=W2,Jt.weekdays=rk,Jt.weekdaysMin=ok,Jt.weekdaysShort=sk,Jt.weekdaysParse=lk,Jt.weekdaysRegex=dk,Jt.weekdaysShortRegex=pk,Jt.weekdaysMinRegex=fk,Jt.isPM=gk,Jt.meridiem=xk;function uu(n,i,o,c){var p=ks(),b=Jr().set(c,i);return p[o](b,n)}function x0(n,i,o){if(_s(n)&&(i=n,n=void 0),n=n||"",i!=null)return uu(n,i,o,"month");var c,p=[];for(c=0;c<12;c++)p[c]=uu(n,c,o,"month");return p}function $p(n,i,o,c){typeof n=="boolean"?(_s(i)&&(o=i,i=void 0),i=i||""):(i=n,o=i,n=!1,_s(i)&&(o=i,i=void 0),i=i||"");var p=ks(),b=n?p._week.dow:0,y,h=[];if(o!=null)return uu(i,(o+b)%7,c,"day");for(y=0;y<7;y++)h[y]=uu(i,(y+b)%7,c,"day");return h}function SE(n,i){return x0(n,i,"months")}function EE(n,i){return x0(n,i,"monthsShort")}function TE(n,i,o){return $p(n,i,o,"weekdays")}function CE(n,i,o){return $p(n,i,o,"weekdaysShort")}function ME(n,i,o){return $p(n,i,o,"weekdaysMin")}Xs("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(n){var i=n%10,o=Ut(n%100/10)===1?"th":i===1?"st":i===2?"nd":i===3?"rd":"th";return n+o}}),Je.lang=xr("moment.lang is deprecated. Use moment.locale instead.",Xs),Je.langData=xr("moment.langData is deprecated. Use moment.localeData instead.",ks);var Ss=Math.abs;function PE(){var n=this._data;return this._milliseconds=Ss(this._milliseconds),this._days=Ss(this._days),this._months=Ss(this._months),n.milliseconds=Ss(n.milliseconds),n.seconds=Ss(n.seconds),n.minutes=Ss(n.minutes),n.hours=Ss(n.hours),n.months=Ss(n.months),n.years=Ss(n.years),this}function b0(n,i,o,c){var p=Vr(i,o);return n._milliseconds+=c*p._milliseconds,n._days+=c*p._days,n._months+=c*p._months,n._bubble()}function IE(n,i){return b0(this,n,i,1)}function AE(n,i){return b0(this,n,i,-1)}function v0(n){return n<0?Math.floor(n):Math.ceil(n)}function DE(){var n=this._milliseconds,i=this._days,o=this._months,c=this._data,p,b,y,h,M;return n>=0&&i>=0&&o>=0||n<=0&&i<=0&&o<=0||(n+=v0(jp(o)+i)*864e5,i=0,o=0),c.milliseconds=n%1e3,p=vr(n/1e3),c.seconds=p%60,b=vr(p/60),c.minutes=b%60,y=vr(b/60),c.hours=y%24,i+=vr(y/24),M=vr(w0(i)),o+=M,i-=v0(jp(M)),h=vr(o/12),o%=12,c.days=i,c.months=o,c.years=h,this}function w0(n){return n*4800/146097}function jp(n){return n*146097/4800}function zE(n){if(!this.isValid())return NaN;var i,o,c=this._milliseconds;if(n=br(n),n==="month"||n==="quarter"||n==="year")switch(i=this._days+c/864e5,o=this._months+w0(i),n){case"month":return o;case"quarter":return o/3;case"year":return o/12}else switch(i=this._days+Math.round(jp(this._months)),n){case"week":return i/7+c/6048e5;case"day":return i+c/864e5;case"hour":return i*24+c/36e5;case"minute":return i*1440+c/6e4;case"second":return i*86400+c/1e3;case"millisecond":return Math.floor(i*864e5)+c;default:throw new Error("Unknown unit "+n)}}function Es(n){return function(){return this.as(n)}}var k0=Es("ms"),RE=Es("s"),LE=Es("m"),OE=Es("h"),BE=Es("d"),FE=Es("w"),NE=Es("M"),VE=Es("Q"),$E=Es("y"),jE=k0;function UE(){return Vr(this)}function HE(n){return n=br(n),this.isValid()?this[n+"s"]():NaN}function Wo(n){return function(){return this.isValid()?this._data[n]:NaN}}var qE=Wo("milliseconds"),ZE=Wo("seconds"),WE=Wo("minutes"),GE=Wo("hours"),YE=Wo("days"),XE=Wo("months"),KE=Wo("years");function JE(){return vr(this.days()/7)}var Ts=Math.round,Ua={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function QE(n,i,o,c,p){return p.relativeTime(i||1,!!o,n,c)}function eT(n,i,o,c){var p=Vr(n).abs(),b=Ts(p.as("s")),y=Ts(p.as("m")),h=Ts(p.as("h")),M=Ts(p.as("d")),D=Ts(p.as("M")),A=Ts(p.as("w")),R=Ts(p.as("y")),z=b<=o.ss&&["s",b]||b<o.s&&["ss",b]||y<=1&&["m"]||y<o.m&&["mm",y]||h<=1&&["h"]||h<o.h&&["hh",h]||M<=1&&["d"]||M<o.d&&["dd",M];return o.w!=null&&(z=z||A<=1&&["w"]||A<o.w&&["ww",A]),z=z||D<=1&&["M"]||D<o.M&&["MM",D]||R<=1&&["y"]||["yy",R],z[2]=i,z[3]=+n>0,z[4]=c,QE.apply(null,z)}function tT(n){return n===void 0?Ts:typeof n=="function"?(Ts=n,!0):!1}function iT(n,i){return Ua[n]===void 0?!1:i===void 0?Ua[n]:(Ua[n]=i,n==="s"&&(Ua.ss=i-1),!0)}function nT(n,i){if(!this.isValid())return this.localeData().invalidDate();var o=!1,c=Ua,p,b;return typeof n=="object"&&(i=n,n=!1),typeof n=="boolean"&&(o=n),typeof i=="object"&&(c=Object.assign({},Ua,i),i.s!=null&&i.ss==null&&(c.ss=i.s-1)),p=this.localeData(),b=eT(this,!o,c,p),o&&(b=p.pastFuture(+this,b)),p.postformat(b)}var Up=Math.abs;function Ha(n){return(n>0)-(n<0)||+n}function du(){if(!this.isValid())return this.localeData().invalidDate();var n=Up(this._milliseconds)/1e3,i=Up(this._days),o=Up(this._months),c,p,b,y,h=this.asSeconds(),M,D,A,R;return h?(c=vr(n/60),p=vr(c/60),n%=60,c%=60,b=vr(o/12),o%=12,y=n?n.toFixed(3).replace(/\.?0+$/,""):"",M=h<0?"-":"",D=Ha(this._months)!==Ha(h)?"-":"",A=Ha(this._days)!==Ha(h)?"-":"",R=Ha(this._milliseconds)!==Ha(h)?"-":"",M+"P"+(b?D+b+"Y":"")+(o?D+o+"M":"")+(i?A+i+"D":"")+(p||c||n?"T":"")+(p?R+p+"H":"")+(c?R+c+"M":"")+(n?R+y+"S":"")):"P0D"}var Gt=su.prototype;Gt.isValid=Xk,Gt.abs=PE,Gt.add=IE,Gt.subtract=AE,Gt.as=zE,Gt.asMilliseconds=k0,Gt.asSeconds=RE,Gt.asMinutes=LE,Gt.asHours=OE,Gt.asDays=BE,Gt.asWeeks=FE,Gt.asMonths=NE,Gt.asQuarters=VE,Gt.asYears=$E,Gt.valueOf=jE,Gt._bubble=DE,Gt.clone=UE,Gt.get=HE,Gt.milliseconds=qE,Gt.seconds=ZE,Gt.minutes=WE,Gt.hours=GE,Gt.days=YE,Gt.weeks=JE,Gt.months=XE,Gt.years=KE,Gt.humanize=nT,Gt.toISOString=du,Gt.toString=du,Gt.toJSON=du,Gt.locale=c0,Gt.localeData=u0,Gt.toIsoString=xr("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",du),Gt.lang=h0,ft("X",0,0,"unix"),ft("x",0,0,"valueOf"),st("x",Jh),st("X",S2),di("X",function(n,i,o){o._d=new Date(parseFloat(n)*1e3)}),di("x",function(n,i,o){o._d=new Date(Ut(n))});//! moment.js
629
- Je.version="2.30.1",r2(vi),Je.fn=ze,Je.min=Zk,Je.max=Wk,Je.now=Gk,Je.utc=Jr,Je.unix=wE,Je.months=SE,Je.isDate=Jl,Je.locale=Xs,Je.invalid=Zh,Je.duration=Vr,Je.isMoment=Fr,Je.weekdays=TE,Je.parseZone=kE,Je.localeData=ks,Je.isDuration=ou,Je.monthsShort=EE,Je.weekdaysMin=ME,Je.defineLocale=Ip,Je.updateLocale=kk,Je.locales=Sk,Je.weekdaysShort=CE,Je.normalizeUnits=br,Je.relativeTimeRounding=tT,Je.relativeTimeThreshold=iT,Je.calendarFormat=xS,Je.prototype=ze,Je.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const rT=n=>{const i=/(\b\S)?/g,o=n.match(i);return o?o.join("").toUpperCase():""},sT={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return rT(this.name)}}},oT={class:"mr-2"},aT=["src"],lT={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},cT={key:0},hT={key:1,class:"text-sm"};function uT(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",oT,[o.avatar?(w.openBlock(),w.createElementBlock("img",{key:0,src:o.avatar,alt:"avatar",class:"flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full"},null,8,aT)):o.name?(w.openBlock(),w.createElementBlock("div",lT,[b.inItials.length?(w.openBlock(),w.createElementBlock("span",cT,w.toDisplayString(b.inItials),1)):(w.openBlock(),w.createElementBlock("span",hT,i[0]||(i[0]=[w.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):w.createCommentVNode("",!0)])}const dT={components:{VsWidgetCommentsAvatar:kt(sT,[["render",uT]])},props:{comment:{type:Object,default:()=>({})},user:{type:Object,default:()=>({})},id:{type:String,default:""}},data(){return{commentContent:this.comment.body,isCommentActionVisible:!1,isOpen:!1,textareaValue:""}},computed:{isUserAutor(){return this.user.uid===this.comment.uid},createDate(){try{const n=Je(this.comment.cdate,"YYYY-MM-DD");return new Date(n).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},watch:{isOpen(n){n&&(this.textareaValue=this.comment.body)}},methods:{confirnDeleteComment(){document.body.click(),this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей коментар?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteComment,updateListOnConfirm:!0})},async updateComment(){try{await gt.put(`/api/widget/comment/${this.id}/${this.comment.communication_id}`,{body:this.textareaValue}),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async deleteComment(){try{await gt.delete(`/api/widget/comment/${this.id}/${this.comment.communication_id}`),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},toggleCommentAction(){this.isCommentActionVisible=!this.isCommentActionVisible}}},pT={class:"p-6 text-base bg-white dark:bg-gray-900"},fT={class:"flex justify-between items-center mb-2"},mT={class:"flex items-center"},gT={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold capitalize"},yT={class:"text-sm text-gray-600 dark:text-gray-400"},_T={class:"text-gray-500 dark:text-gray-400"},xT={class:"flex items-center gap-[4px]"},bT={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},vT={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function wT(n,i,o,c,p,b){const y=w.resolveComponent("VsWidgetCommentsAvatar"),h=w.resolveComponent("VsDialog");return w.openBlock(),w.createElementBlock(w.Fragment,null,[w.createElementVNode("div",pT,[w.createElementVNode("div",fT,[w.createElementVNode("div",mT,[w.createElementVNode("p",gT,[w.createVNode(y,{name:o.comment.username,avatar:o.comment.avatar},null,8,["name","avatar"]),w.createTextVNode(w.toDisplayString(o.comment.username),1)]),w.createElementVNode("div",yT,w.toDisplayString(b.createDate),1)])]),w.createElementVNode("p",_T,w.toDisplayString(o.comment.body),1),w.createElementVNode("div",xT,[w.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:i[0]||(i[0]=M=>p.isOpen=!0)}," Редагувати "),w.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:i[1]||(i[1]=M=>b.confirnDeleteComment())}," Видалити ")])]),w.createVNode(h,{visible:p.isOpen,"onUpdate:visible":i[5]||(i[5]=M=>p.isOpen=M),title:"Редагувати"},{footer:w.withCtx(()=>[w.createElementVNode("div",vT,[w.createElementVNode("button",{onClick:i[3]||(i[3]=M=>p.isOpen=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Відмінити "),w.createElementVNode("button",{onClick:i[4]||(i[4]=(...M)=>b.updateComment&&b.updateComment(...M)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:w.withCtx(()=>[w.createElementVNode("label",bT,[i[6]||(i[6]=w.createTextVNode(" Коментар ")),w.withDirectives(w.createElementVNode("textarea",{"onUpdate:modelValue":i[2]||(i[2]=M=>p.textareaValue=M),placeholder:"Напишіть коментар...",class:"w-full h-[200px] border rounded-lg outline-none resize-none p-[20px] focus:border-[2px] focus:border-blue-600 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},null,512),[[w.vModelText,p.textareaValue]])])]),_:1},8,["visible"])],64)}const kT={components:{VsWidgetCommentsItem:kt(dT,[["render",wT]])},inject:["activeAddFormEditor"],props:{id:{type:String,default:()=>""},prefilledData:{type:Object,default:null}},data(){return{isLoaded:!1,isLoadFailed:!1,comments:[],user:{},modal:{title:"",message:"",cancel:"",confirm:"",cancelButtonText:"",confirmButtonText:""},isModalVisible:!1}},async created(){await this.getComments()},methods:{async getComments(){if(this.prefilledData){this.comments=this.prefilledData.rows,this.isLoaded=!0;return}try{const{data:n}=await gt.get(`/api/widget/comment/${this.id}`);this.comments=n.rows,this.user=n.user}catch(n){this.isLoadFailed=!0,console.error(n)}this.isLoaded=!0,this.$emit("update-comment-count")},prepareModal(n){const i={...n};return n.cancel||(i.cancel=()=>{this.isModalVisible=!1}),n.updateListOnConfirm&&(i.confirm=async()=>{await n.confirm(),this.isModalVisible=!1}),i},handleOpenModal(n){this.modal=this.prepareModal(n),this.isModalVisible=!0}}},ST={class:"flex flex-col divide-y"},ET={key:0,class:"max-h-[300px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},TT={key:1},CT={class:"p-4"},MT={class:"mt-1 text-gray-500 dark:text-neutral-500"},PT={class:"mt-4 flex justify-end gap-x-3"};function IT(n,i,o,c,p,b){const y=w.resolveComponent("VsErrorOnLoading"),h=w.resolveComponent("VsWidgetCommentsItem"),M=w.resolveComponent("VsLoader"),D=w.resolveComponent("VsDialog");return w.openBlock(),w.createElementBlock("div",ST,[p.isLoaded?(w.openBlock(),w.createElementBlock(w.Fragment,{key:0},[p.isLoadFailed?(w.openBlock(),w.createBlock(y,{key:0})):(w.openBlock(),w.createElementBlock(w.Fragment,{key:1},[p.comments.length?(w.openBlock(),w.createElementBlock("div",ET,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(p.comments,(A,R)=>(w.openBlock(),w.createBlock(h,{key:R,comment:A,user:p.user,index:R,id:o.id,onListUpdate:b.getComments,class:"border-top",onOpenModal:i[0]||(i[0]=z=>b.handleOpenModal(z))},null,8,["comment","user","index","id","onListUpdate"]))),128))])):(w.openBlock(),w.createElementBlock("div",TT,i[4]||(i[4]=[w.createElementVNode("p",{class:"pl-3 text-sm font-medium text-gray-600"},"Коментарі відсутні",-1)])))],64))],64)):(w.openBlock(),w.createBlock(M,{key:1,class:"justify-center",text:"Please wait..."})),w.createVNode(D,{title:p.modal.title,size:"small",visible:p.isModalVisible,"onUpdate:visible":i[3]||(i[3]=A=>p.isModalVisible=A)},{default:w.withCtx(()=>[w.createElementVNode("div",CT,[w.createElementVNode("p",MT,w.toDisplayString(p.modal.message),1),w.createElementVNode("div",PT,[w.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:i[1]||(i[1]=(...A)=>p.modal.cancel&&p.modal.cancel(...A))},w.toDisplayString(p.modal.cancelButtonText),1),w.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:i[2]||(i[2]=(...A)=>p.modal.confirm&&p.modal.confirm(...A))},w.toDisplayString(p.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const AT=kt(kT,[["render",IT]]),DT={props:{id:{type:String,default:()=>""},autofocus:{type:Boolean,default:()=>!0}},data(){return{isEditorOpen:!1,commentContent:""}},methods:{async addNewComment(){if(this.commentContent)try{await gt.post(`/api/widget/comment/${this.id}`,{body:this.commentContent}),this.commentContent="",this.$emit("list-update")}catch(n){console.error(n)}},setNewContent(n){this.commentContent=n}}},zT={class:"w-full widget-comment-form"},RT={class:"mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"};function LT(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",zT,[w.createElementVNode("div",RT,[w.withDirectives(w.createElementVNode("textarea",{"onUpdate:modelValue":i[0]||(i[0]=y=>p.commentContent=y),rows:"6",class:"w-full h-[200px] border rounded-lg outline-none resize-none p-[20px] focus:border-[2px] focus:border-blue-600 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",placeholder:"Напишіть коментар..."},null,512),[[w.vModelText,p.commentContent]])]),w.createElementVNode("button",{ref:"buttonAdd",class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300",onClick:i[1]||(i[1]=(...y)=>b.addNewComment&&b.addNewComment(...y))}," Відправити коментар ",512)])}const OT={components:{VsWidgetCommentsList:AT,VsWidgetCommentsAddForm:kt(DT,[["render",LT]])},props:{id:{type:String,default(){return""}},prefilledData:{type:Object,default:null}},data(){return{activeAddFormEditor:"",comments:[],totalComment:"0"}},mounted(){this.comments=this.$refs.commentListRef.comments},watch:{comments(n){this.$emit("count-change",n.length)}},methods:{listUpdate(){this.$refs.commentListRef.getComments()},updateCommentCount(){this.totalComment=this.$refs.commentListRef.comments.length||"0"}}},BT={class:"bg-white-200"},FT={class:"flex justify-between items-center gap-x-2 mb-4"},NT={class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"},VT={key:0,class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"};function $T(n,i,o,c,p,b){const y=w.resolveComponent("VsWidgetCommentsAddForm"),h=w.resolveComponent("VsWidgetCommentsList");return w.openBlock(),w.createElementBlock("div",BT,[w.createElementVNode("div",FT,[w.createElementVNode("h2",NT,[i[2]||(i[2]=w.createTextVNode("Коментарі ")),p.comments?(w.openBlock(),w.createElementBlock("span",VT,"("+w.toDisplayString(p.totalComment)+")",1)):w.createCommentVNode("",!0)])]),w.createVNode(y,{class:"mb-6",id:o.id,onListUpdate:i[0]||(i[0]=M=>b.listUpdate())},null,8,["id"]),w.createVNode(h,{id:o.id,onUpdateCommentCount:i[1]||(i[1]=M=>b.updateCommentCount()),"prefilled-data":o.prefilledData,ref:"commentListRef"},null,8,["id","prefilled-data"])])}const jT={"vs-widget-map":_w,"vs-widget-gallery":n2,"vs-widget-comments":kt(OT,[["render",$T]])},UT={},HT={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},qT={...jT,...UT,"vs-dashboard":{__name:"vs-dashboard",setup(n){return(i,o)=>(w.openBlock(),w.createElementBlock("div",HT,o[0]||(o[0]=[w.createElementVNode("div",{class:"p-5 md:p-8 bg-white border border-gray-200 shadow-sm rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[w.createElementVNode("div",{class:"mb-4 xl:mb-8"},[w.createElementVNode("h1",{class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"}," Members "),w.createElementVNode("p",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Manage members and users of your workspace and set their access level. ")]),w.createElementVNode("div",{class:"space-y-5"},[w.createElementVNode("div",{class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5"},[w.createElementVNode("div",{class:"relative w-full"},[w.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[w.createElementVNode("svg",{class:"shrink-0 size-4 text-gray-500 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[w.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),w.createElementVNode("path",{d:"m21 21-4.3-4.3"})])]),w.createElementVNode("input",{type:"text",class:"py-2 ps-10 pe-8 block w-full bg-gray-100 border-transparent rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Search by name or email"}),w.createElementVNode("div",{class:"hidden absolute inset-y-0 end-0 flex items-center pointer-events-none z-20 pe-1"},[w.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-6 rounded-full text-gray-500 hover:text-blue-600 focus:outline-none focus:text-blue-600 dark:text-neutral-500 dark:hover:text-blue-500 dark:focus:text-blue-500","aria-label":"Close"},[w.createElementVNode("span",{class:"sr-only"},"Close"),w.createElementVNode("svg",{class:"shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[w.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),w.createElementVNode("path",{d:"m15 9-6 6"}),w.createElementVNode("path",{d:"m9 9 6 6"})])])])]),w.createElementVNode("div",{class:"flex justify-end items-center gap-x-2"},[w.createElementVNode("button",{type:"button",class:"p-2.5 sm:py-2 sm:px-3 inline-flex items-center text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[w.createElementVNode("svg",{class:"shrink-0 sm:me-2 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[w.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),w.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),w.createElementVNode("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]),w.createElementVNode("span",{class:"hidden sm:block"}," Download CSV ")]),w.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-1 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500","data-hs-overlay":"#hs-pro-dshm"},[w.createElementVNode("span",{class:"hidden sm:block"},"Send"),w.createTextVNode("Invite ")])])]),w.createElementVNode("div",{class:"grid sm:grid-cols-2 lg:grid-cols-4 gap-2 xl:gap-4"},[w.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[w.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[w.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}),w.createElementVNode("div",{class:"flex items-center -space-x-2"},[w.createElementVNode("img",{class:"shrink-0 size-7 rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"})])]),w.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Admin")]),w.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[w.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[w.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 5 "),w.createElementVNode("div",{class:"flex items-center -space-x-2"},[w.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),w.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482634023-2c4fda99ac0c?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O ")])]),w.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[w.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Members"),w.createElementVNode("div",{class:"hs-tooltip inline-block"},[w.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[w.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),w.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),w.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(689px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),w.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[w.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[w.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 2 "),w.createElementVNode("div",{class:"flex items-center -space-x-2"},[w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," 0 ")])]),w.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[w.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"}," Limited access members "),w.createElementVNode("div",{class:"hs-tooltip inline-block"},[w.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[w.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),w.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),w.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(1198px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),w.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[w.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[w.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 0 "),w.createElementVNode("div",{class:"flex items-center -space-x-2"})]),w.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Pending invites")])]),w.createElementVNode("div",{class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[w.createElementVNode("div",{class:"min-w-full inline-block align-middle"},[w.createElementVNode("table",{class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},[w.createElementVNode("thead",null,[w.createElementVNode("tr",null,[w.createElementVNode("th",{scope:"col",class:"min-w-[250px]"},[w.createElementVNode("div",{class:"pe-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Member ")]),w.createElementVNode("th",{scope:"col",class:"min-w-48"},[w.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Role ")]),w.createElementVNode("th",{scope:"col"},[w.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Email ")]),w.createElementVNode("th",{scope:"col",class:"min-w-36"},[w.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Last activity ")]),w.createElementVNode("th",{scope:"col"},[w.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Status ")])])]),w.createElementVNode("tbody",{class:"divide-y divide-gray-200 dark:divide-neutral-700"},[w.createElementVNode("tr",null,[w.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[w.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[w.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("div",{class:"grow"},[w.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Admin ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," james@site.com ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[w.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),w.createTextVNode(" Active ")])])]),w.createElementVNode("tr",null,[w.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[w.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),w.createElementVNode("div",{class:"grow"},[w.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," liza@site.com ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 2 days ago ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[w.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),w.createTextVNode(" Inactive ")])])]),w.createElementVNode("tr",null,[w.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[w.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[w.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1601935111741-ae98b2b230b0?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("div",{class:"grow"},[w.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Daniel Hobbs ")])])]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," dhobbs@site.com ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[w.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),w.createTextVNode(" Inactive ")])])]),w.createElementVNode("tr",null,[w.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[w.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[w.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("div",{class:"grow"},[w.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Brian Warner ")])])]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," brian@site.com ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 1 months ago ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[w.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),w.createTextVNode(" Active ")])])]),w.createElementVNode("tr",null,[w.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[w.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O "),w.createElementVNode("div",{class:"grow"},[w.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Ols Shols ")])])]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," olsshols@site.com ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 6 days ago ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[w.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),w.createTextVNode(" Inactive ")])])])])])])])])],-1)])))}}},ZT={install(n,{componentsApp:i={},menu:o=[]}){var b;gt.defaults.baseURL&&(gt.defaults.baseURL=gt.defaults.baseURL);const c=(b=Mg(o))==null?void 0:b.filter(y=>y==null?void 0:y.component).map(y=>({...y,component:i[y==null?void 0:y.component]})),{router:p}=fv(c);Object.entries({...qT,...i}).forEach(([y,h])=>{n.component(y,h)}),n.component("admin",Rb),n.config.globalProperties={...n.config.globalProperties,$componentsConfig:{...Lv,componentsApp:i},$router:p},n.use(p)}},wr=w.ref(null),WT={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(n){const i=[];return n.forEach(o=>{o.menu?i.push(...this.flattenMenu(o.menu)):i.push(o)}),i},async getFormScheme(){var c,p;const n=this.flattenMenu(wr.value);n!=null&&n.length||this.$router.replace("/404");const i=n==null?void 0:n.find(b=>{var y,h;return(b==null?void 0:b.path)==((h=(y=this.$route)==null?void 0:y.query)==null?void 0:h.table)});i||this.$router.replace("/404");const o=i==null?void 0:i.table;this.table=o;try{const{data:{form:b}}=await gt.get(`/api/template/table/${o}`),{data:{rows:y}}=await gt.get(`/api/table-data/${this.table}/${(p=(c=this.$route)==null?void 0:c.query)==null?void 0:p.id}`);this.formValues=y==null?void 0:y[0];const{data:h}=await gt.get(`/api/template/form/${b}`);this.scheme=(h==null?void 0:h.schema)||h}catch{}},async editObject(){var n,i;try{await this.$refs.form.doValidation(),await gt.put(`/api/table/${this.table}/${(i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.id}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},GT={style:{width:"calc(100vw - 260px)"}},YT={class:"h-[58px] bg-gray-50 flex items-center justify-between px-[30px]"},XT={class:"flex items-center gap-[6px]"},KT={style:{height:"calc(100vh - 120px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},JT={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function QT(n,i,o,c,p,b){const y=w.resolveComponent("VsForm");return w.openBlock(),w.createElementBlock("div",GT,[w.createElementVNode("div",YT,[i[3]||(i[3]=w.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),w.createElementVNode("div",XT,[w.createElementVNode("button",{onClick:i[0]||(i[0]=h=>n.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),w.createElementVNode("button",{onClick:i[1]||(i[1]=(...h)=>b.editObject&&b.editObject(...h)),class:"py-2 px-3 flex items-center gap-x-2 text-sm text-white font-medium rounded-lg border-none bg-blue-500 text-gray-800 shadow-sm focus:border-none focus:outline-none hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),w.createElementVNode("div",KT,[w.createElementVNode("div",JT,[p.scheme?(w.openBlock(),w.createBlock(y,{key:0,ref:"form",scheme:p.scheme,modelValue:p.formValues,"onUpdate:modelValue":i[2]||(i[2]=h=>p.formValues=h),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):w.createCommentVNode("",!0)])])])}const eC=Object.freeze(Object.defineProperty({__proto__:null,default:kt(WT,[["render",QT]])},Symbol.toStringTag,{value:"Module"})),tC={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(n){const i=[];return n.forEach(o=>{o.menu?i.push(...this.flattenMenu(o.menu)):i.push(o)}),i},async getFormScheme(){const n=this.flattenMenu(wr.value);n!=null&&n.length||this.$router.replace("/404");const i=n==null?void 0:n.find(c=>{var p,b;return(c==null?void 0:c.path)==((b=(p=this.$route)==null?void 0:p.query)==null?void 0:b.table)});i||this.$router.replace("/404");const o=i==null?void 0:i.table;this.table=o;try{const{data:{form:c}}=await gt.get(`/api/template/table/${o}`),{data:p}=await gt.get(`/api/template/form/${c}`);this.scheme=(p==null?void 0:p.schema)||p}catch{}},async createObject(){try{await this.$refs.form.doValidation(),await gt.post(`/api/table/${this.table}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},iC={style:{width:"calc(100vw - 260px)"}},nC={class:"h-[58px] bg-gray-50 flex items-center justify-between px-[30px]"},rC={class:"flex items-center gap-[6px]"},sC={style:{height:"calc(100vh - 120px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},oC={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function aC(n,i,o,c,p,b){const y=w.resolveComponent("VsForm");return w.openBlock(),w.createElementBlock("div",iC,[w.createElementVNode("div",nC,[i[3]||(i[3]=w.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),w.createElementVNode("div",rC,[w.createElementVNode("button",{onClick:i[0]||(i[0]=h=>n.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),w.createElementVNode("button",{onClick:i[1]||(i[1]=(...h)=>b.createObject&&b.createObject(...h)),class:"py-2 px-3 flex items-center gap-x-2 text-sm text-white font-medium rounded-lg border-none bg-blue-500 text-gray-800 shadow-sm focus:border-none focus:outline-none hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),w.createElementVNode("div",sC,[w.createElementVNode("div",oC,[p.scheme?(w.openBlock(),w.createBlock(y,{key:0,ref:"form",scheme:p.scheme,modelValue:p.formValues,"onUpdate:modelValue":i[2]||(i[2]=h=>p.formValues=h),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):w.createCommentVNode("",!0)])])])}const lC=Object.freeze(Object.defineProperty({__proto__:null,default:kt(tC,[["render",aC]])},Symbol.toStringTag,{value:"Module"})),cC={};function hC(n,i,o,c,p,b){const y=w.resolveComponent("router-view");return w.openBlock(),w.createBlock(y)}const S0=Object.freeze(Object.defineProperty({__proto__:null,default:kt(cC,[["render",hC]])},Symbol.toStringTag,{value:"Module"})),uC={data(){return{objectData:null,component:""}},computed:{getRoute(){const n=this.flattenMenu(wr.value);n!=null&&n.length||this.$router.replace("/404");const i=n==null?void 0:n.find(o=>{var c,p;return(o==null?void 0:o.table)==((p=(c=this.$route)==null?void 0:c.params)==null?void 0:p.table)});return i||this.$router.replace("/404"),i==null?void 0:i.path},getTitle(){var n,i,o,c,p,b,y,h,M,D,A,R,z,N;if((o=(i=(n=this.objectData)==null?void 0:n.rows)==null?void 0:i[0])!=null&&o.name)return((y=(b=(p=(c=this.objectData)==null?void 0:c.rows)==null?void 0:p[0])==null?void 0:b.name)==null?void 0:y.length)<35?(D=(M=(h=this.objectData)==null?void 0:h.rows)==null?void 0:M[0])==null?void 0:D.name:((N=(z=(R=(A=this.objectData)==null?void 0:A.rows)==null?void 0:R[0])==null?void 0:z.name)==null?void 0:N.slice(0,35))+" ..."}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(n){this.$router.replace({...this.$route,query:{tab:n}})}},methods:{async getObjectData(){var o;const{table:n,id:i}=(o=this.$route)==null?void 0:o.params;(!n||!i)&&this.$router.replace("/404");try{const{data:c}=await gt.get(`/api/table-data/${n}/${i}`);this.objectData=c}catch(c){console.error(c)}},getColClass(n){return`col-span-${n||12}`},getGridClass(){return"grid-cols-12"},checkActiveComponent(){var n,i,o,c,p,b,y;if((i=(n=this.$route)==null?void 0:n.query)!=null&&i.tab)this.component=(c=(o=this.$route)==null?void 0:o.query)==null?void 0:c.tab;else{const h=(b=(p=this.objectData)==null?void 0:p.panels)==null?void 0:b.find(M=>M==null?void 0:M.items);if((h==null?void 0:h.type)==="container")return;this.component=(y=h==null?void 0:h.items[0])==null?void 0:y.component}},flattenMenu(n){const i=[];return n.forEach(o=>{o.menu?i.push(...this.flattenMenu(o.menu)):i.push(o)}),i}}},dC={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 overflow-y-auto"},pC={class:"h-[58px] bg-gray-50 flex items-center justify-between px-[30px]"},fC={class:"flex items-center gap-[4px]"},mC={class:"text-xl font-medium text-gray-600"},gC={class:"flex items-center gap-[6px]"},yC={key:0,class:"border rounded-xl bg-white"},_C={class:"p-[10px] pl-[20px] text-xl"},xC=["innerHTML"],bC={key:1},vC={class:"p-[10px] pl-[20px] text-xl"},wC={key:0,class:"p-[20px] border-t"},kC={key:1,class:"p-[20px] border-t"},SC=["innerHTML"],EC={class:"flex space-x-1 w-[1200px] bg-white border rounded-xl h-[60px] items-center pl-[20px]"},TC=["onClick"],CC={key:0,class:"border rounded-xl bg-white mt-[20px]"},MC={class:"p-[10px] pl-[20px] text-xl"},PC={key:0,class:"p-[20px] border-t"},IC={key:1,class:"p-[20px] border-t"},AC=["innerHTML"];function DC(n,i,o,c,p,b){var h,M,D;const y=w.resolveComponent("router-link");return w.openBlock(),w.createElementBlock("div",dC,[w.createElementVNode("div",pC,[w.createElementVNode("div",fC,[w.createElementVNode("button",{onClick:i[0]||(i[0]=A=>n.$router.back()),class:"text-xl font-medium text-gray-600 hover:text-black"}," До таблиці "),i[1]||(i[1]=w.createElementVNode("span",null,"/",-1)),w.createElementVNode("h2",mC,w.toDisplayString(b.getTitle),1)]),w.createElementVNode("div",gC,[w.createVNode(y,{to:`/edit?table=${b.getRoute}&id=${(M=(h=n.$route)==null?void 0:h.params)==null?void 0:M.id}`,class:"py-2 px-3 flex items-center gap-x-2 text-sm text-white font-medium rounded-lg border-none bg-blue-500 text-gray-800 shadow-sm focus:border-none focus:outline-none hover:bg-blue-700 hover:text-white duration-300"},{default:w.withCtx(()=>i[2]||(i[2]=[w.createTextVNode(" Редагувати ")])),_:1},8,["to"])])]),w.createElementVNode("div",{class:w.normalizeClass(["grid gap-[20px]",b.getGridClass()])},[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList((D=p.objectData)==null?void 0:D.panels,(A,R)=>{var z;return w.openBlock(),w.createElementBlock("div",{key:R,class:w.normalizeClass([b.getColClass(A.col),"p-4"])},[A!=null&&A.name?(w.openBlock(),w.createElementBlock("div",yC,[w.createElementVNode("h2",_C,w.toDisplayString((A==null?void 0:A.title)||"Панель"),1),w.createElementVNode("div",{class:"p-[20px] border-t",innerHTML:(z=p.objectData)==null?void 0:z.data[A==null?void 0:A.name]},null,8,xC)])):A.type==="container"?(w.openBlock(),w.createElementBlock("div",bC,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(A.items,(N,Y)=>{var te,ae,he,be,_e;return w.openBlock(),w.createElementBlock("div",{key:Y,class:"border rounded-xl bg-white mb-[20px]"},[w.createElementVNode("h2",vC,w.toDisplayString((N==null?void 0:N.title)||"Панель"),1),N!=null&&N.component?(w.openBlock(),w.createElementBlock("div",wC,[(w.openBlock(),w.createBlock(w.resolveDynamicComponent(N.component),{geometry:(ae=(te=p.objectData)==null?void 0:te.rows[0])==null?void 0:ae.geom,zoom:16,id:(be=(he=n.$route)==null?void 0:he.params)==null?void 0:be.id},null,8,["geometry","id"]))])):w.createCommentVNode("",!0),N!=null&&N.name?(w.openBlock(),w.createElementBlock("div",kC,[w.createElementVNode("div",{innerHTML:(_e=p.objectData)==null?void 0:_e.data[N==null?void 0:N.name]},null,8,SC)])):w.createCommentVNode("",!0)])}),128))])):w.createCommentVNode("",!0),(A==null?void 0:A.type)==="tabs"?(w.openBlock(),w.createElementBlock(w.Fragment,{key:2},[w.createElementVNode("nav",EC,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(A==null?void 0:A.items,N=>(w.openBlock(),w.createElementBlock("button",{onClick:()=>p.component=(N==null?void 0:N.component)||(N==null?void 0:N.name),class:w.normalizeClass(["px-2.5 h-[30px] py-1.5 relative inline-flex items-center gap-x-2 hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm whitespace-nowrap rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 after:absolute after:-bottom-[11px] after:inset-x-2.5 after:z-10 after:h-0.5 after:pointer-events-none dark:text-neutral-500 dark:hover:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 active",{"after:absolute after:bottom-[-14px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:pointer-events-none after:bg-gray-800":p.component===(N==null?void 0:N.component)||(N==null?void 0:N.name)}])},w.toDisplayString(N==null?void 0:N.title),11,TC))),256))]),(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(A.items,(N,Y)=>{var te,ae,he,be,_e;return w.openBlock(),w.createElementBlock(w.Fragment,{key:Y},[p.component===(N==null?void 0:N.component)||N!=null&&N.name?(w.openBlock(),w.createElementBlock("div",CC,[w.createElementVNode("h2",MC,w.toDisplayString((N==null?void 0:N.title)||"Панель"),1),N!=null&&N.component?(w.openBlock(),w.createElementBlock("div",PC,[(w.openBlock(),w.createBlock(w.resolveDynamicComponent(N.component),{geometry:(ae=(te=p.objectData)==null?void 0:te.rows[0])==null?void 0:ae.geom,zoom:16,id:(be=(he=n.$route)==null?void 0:he.params)==null?void 0:be.id},null,8,["geometry","id"]))])):w.createCommentVNode("",!0),N!=null&&N.name?(w.openBlock(),w.createElementBlock("div",IC,[w.createElementVNode("div",{innerHTML:(_e=p.objectData)==null?void 0:_e.data[N==null?void 0:N.name]},null,8,AC)])):w.createCommentVNode("",!0)])):w.createCommentVNode("",!0)],64)}),128))],64)):w.createCommentVNode("",!0)],2)}),128))],2)])}const zC=Object.freeze(Object.defineProperty({__proto__:null,default:kt(uC,[["render",DC],["__scopeId","data-v-5611fa5f"]])},Symbol.toStringTag,{value:"Module"})),RC={},LC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-logout"};function OC(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",LC,i[0]||(i[0]=[w.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),w.createElementVNode("path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"},null,-1),w.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),w.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const BC=kt(RC,[["render",OC]]),FC={},NC={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function VC(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",NC,i[0]||(i[0]=[w.createStaticVNode('<path d="M218.88 96.05C223.55 99.19 228.69 101.56 234.09 103.07V145.42C212.05 151.54 195.83 171.79 195.83 195.75C195.83 200.22 196.41 204.65 197.53 208.94L160.92 230.08C156.82 226.06 152.08 222.73 146.91 220.24V171.62C164.83 163.13 176.59 145.06 176.59 124.48C176.59 123.17 176.54 121.86 176.44 120.56L218.88 96.05ZM220.32 79.09L160.97 113.36C162.04 116.88 162.61 120.61 162.61 124.48C162.61 142.66 149.93 157.87 132.93 161.76V230.05C143.4 232.46 152.23 239.16 157.46 248.21L215 214.99C211.7 209.34 209.81 202.77 209.81 195.75C209.81 174.62 226.94 157.49 248.07 157.49V91.02C237.14 91.02 227.29 86.43 220.32 79.09Z" fill="#CE3936"></path><path d="M161.39 19.13L197.44 39.94C196.39 44.11 195.84 48.42 195.84 52.75C195.84 54.21 195.9 55.65 196.02 57.1L153.9 81.42C145.27 75.5 134.95 72.24 124.36 72.24C113.83 72.24 103.57 75.47 94.96 81.32L52.71 56.93C52.82 55.55 52.88 54.16 52.88 52.76C52.88 48.43 52.34 44.12 51.28 39.95L87.3 19.16C96.98 28.89 110.26 34.58 124.34 34.58C138.42 34.57 151.7 28.87 161.39 19.13ZM157.77 0.919983C151.24 12.66 138.71 20.6 124.33 20.6C109.95 20.6 97.44 12.67 90.9 0.939983L33.9 33.85C37.08 39.43 38.91 45.88 38.91 52.76C38.91 56.71 38.31 60.52 37.2 64.11L96.46 98.32C103.44 90.87 113.36 86.22 124.37 86.22C135.44 86.22 145.41 90.93 152.39 98.44L211.59 64.27C210.45 60.64 209.83 56.78 209.83 52.77C209.83 45.89 211.65 39.44 214.84 33.86L157.77 0.919983Z" fill="#CE3936"></path><path d="M29.97 95.95L72.28 120.38C72.17 121.74 72.12 123.1 72.12 124.47C72.12 145.02 83.86 163.08 101.74 171.58V220.23C96.58 222.71 91.84 226.04 87.75 230.05L51.17 208.93C52.29 204.64 52.87 200.21 52.87 195.74C52.87 171.78 36.65 151.53 14.61 145.41V103.06C20.07 101.55 25.27 99.14 29.97 95.95ZM28.5 78.97C21.52 86.38 11.63 91.02 0.640015 91.02V157.49C21.77 157.49 38.9 174.62 38.9 195.75C38.9 202.77 37 209.33 33.71 214.99L91.2 248.18C96.43 239.14 105.25 232.45 115.71 230.04V161.73C98.74 157.81 86.09 142.62 86.09 124.46C86.09 120.54 86.68 116.75 87.78 113.18L28.5 78.97Z" fill="#CE3936"></path><path d="M498.39 177.5V144.88C498.39 128.55 485.11 115.27 468.78 115.27H343.22C342.69 115.27 342.18 115.32 341.67 115.4H337.19C332.35 115.4 328.42 111.46 328.42 106.63V74C328.42 69.16 332.36 65.23 337.19 65.23H486.33C492.08 65.23 496.75 60.57 496.75 54.81C496.75 49.06 492.08 44.39 486.33 44.39H337.19C320.86 44.39 307.58 57.67 307.58 74V106.62C307.58 122.95 320.86 136.23 337.19 136.23H462.75C463.28 136.23 463.79 136.18 464.3 136.1H468.78C473.62 136.1 477.55 140.04 477.55 144.87V177.49C477.55 182.33 473.61 186.26 468.78 186.26H319.64C313.89 186.26 309.22 190.92 309.22 196.68C309.22 202.43 313.89 207.1 319.64 207.1H468.78C485.11 207.11 498.39 193.83 498.39 177.5Z" fill="#CE3935"></path><path d="M710.7 177.32V75.24C710.7 58.91 697.42 45.63 681.09 45.63H550.05C533.72 45.63 520.44 58.91 520.44 75.24V177.32C520.44 193.65 533.72 206.93 550.05 206.93H681.1C697.42 206.93 710.7 193.65 710.7 177.32ZM541.27 75.24C541.27 70.4 545.21 66.47 550.04 66.47H681.09C685.93 66.47 689.86 70.41 689.86 75.24V177.32C689.86 182.16 685.92 186.09 681.09 186.09H550.05C545.21 186.09 541.28 182.15 541.28 177.32V75.24H541.27Z" fill="#CE3935"></path><path d="M1823 177.32V75.24C1823 58.91 1809.72 45.63 1793.39 45.63H1662.34C1646.01 45.63 1632.73 58.91 1632.73 75.24V177.32C1632.73 193.65 1646.01 206.93 1662.34 206.93H1793.39C1809.72 206.93 1823 193.65 1823 177.32ZM1653.57 75.24C1653.57 70.4 1657.51 66.47 1662.34 66.47H1793.39C1798.23 66.47 1802.16 70.41 1802.16 75.24V177.32C1802.16 182.16 1798.22 186.09 1793.39 186.09H1662.34C1657.5 186.09 1653.57 182.15 1653.57 177.32V75.24Z" fill="#CE3935"></path><path d="M756.76 196.51V152H849.42C855.17 152 859.84 147.34 859.84 141.58C859.84 135.83 855.17 131.16 849.42 131.16H756.76V75.23C756.76 70.39 760.7 66.46 765.53 66.46H893.29C899.04 66.46 903.71 61.8 903.71 56.04C903.71 50.29 899.04 45.62 893.29 45.62H765.53C749.2 45.62 735.92 58.9 735.92 75.23V196.5C735.92 202.25 740.59 206.92 746.34 206.92C752.09 206.93 756.76 202.27 756.76 196.51Z" fill="#CE3935"></path><path d="M933.86 66.47H1006.51V194.32C1006.51 200.07 1011.18 204.74 1016.93 204.74C1022.68 204.74 1027.35 200.07 1027.35 194.32V66.47H1100C1105.75 66.47 1110.42 61.81 1110.42 56.05C1110.42 50.3 1105.76 45.63 1100 45.63H933.86C928.11 45.63 923.44 50.29 923.44 56.05C923.45 61.81 928.11 66.47 933.86 66.47Z" fill="#CE3935"></path><path d="M1218.44 204.19C1224.19 204.19 1228.86 199.53 1228.86 193.77V152H1368.13C1384.46 152 1397.74 138.72 1397.74 122.39V75.24C1397.74 58.91 1384.46 45.63 1368.13 45.63H1237.63C1221.3 45.63 1208.02 58.91 1208.02 75.24V193.77C1208.02 199.53 1212.68 204.19 1218.44 204.19ZM1237.63 66.47H1368.13C1372.97 66.47 1376.9 70.41 1376.9 75.24V122.39C1376.9 127.23 1372.96 131.16 1368.13 131.16H1228.86V75.23C1228.86 70.41 1232.79 66.47 1237.63 66.47Z" fill="#CE3935"></path><path d="M1430.64 204.19C1436.39 204.19 1441.06 199.53 1441.06 193.77V152H1523.95C1524.57 153.18 1525.42 154.26 1526.51 155.17L1581.89 201.23C1583.83 202.85 1586.2 203.64 1588.55 203.64C1591.54 203.64 1594.5 202.36 1596.57 199.88C1600.25 195.46 1599.64 188.89 1595.22 185.21L1555.29 152H1580.33C1596.66 152 1609.94 138.72 1609.94 122.39V75.24C1609.94 58.91 1596.66 45.63 1580.33 45.63H1449.83C1433.5 45.63 1420.22 58.91 1420.22 75.24V193.77C1420.22 199.53 1424.88 204.19 1430.64 204.19ZM1449.83 66.47H1580.33C1585.17 66.47 1589.1 70.41 1589.1 75.24V122.39C1589.1 127.23 1585.17 131.16 1580.33 131.16H1441.06V75.23C1441.05 70.41 1444.99 66.47 1449.83 66.47Z" fill="#CE3935"></path>',10)]))}const $C=kt(FC,[["render",VC]]),jC={},UC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function HC(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",UC,i[0]||(i[0]=[w.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),w.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const qC={components:{IconChevronDown:kt(jC,[["render",HC]])},props:{route:Object},mounted(){var n,i,o;(n=this.route)!=null&&n.menu&&(o=(i=this.route)==null?void 0:i.menu)!=null&&o.some(c=>(c==null?void 0:c.path)===this.$route.path.replace("/",""))&&(this.isOpen=!0)},data(){return{isOpen:!1}}},ZC={key:0,class:""},WC={class:"ml-[30px] before:block before:absolute relative w-[180px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},GC={key:1};function YC(n,i,o,c,p,b){var M,D,A,R;const y=w.resolveComponent("IconChevronDown"),h=w.resolveComponent("router-link");return(M=o.route)!=null&&M.menu?(w.openBlock(),w.createElementBlock("div",ZC,[w.createElementVNode("button",{onClick:i[0]||(i[0]=z=>p.isOpen=!p.isOpen),class:"flex cursor-pointer gap-x-3 py-2 px-3 mb-[6px] text-sm text-gray-800 justify-start w-full border-none focus:outline-none text-gray-800 rounded-lg items-center focus:bg-gray-100 hover:bg-gray-100 duration-300"},[w.createTextVNode(w.toDisplayString((D=o.route)==null?void 0:D.ua)+" ",1),w.createVNode(y,{class:w.normalizeClass([[p.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"16",height:"16"},null,8,["class"])]),w.createVNode(w.Transition,{name:"fade"},{default:w.withCtx(()=>{var z;return[w.withDirectives(w.createElementVNode("ul",WC,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList((z=o.route)==null?void 0:z.menu,(N,Y)=>(w.openBlock(),w.createElementBlock("li",{key:Y,class:"w-full mb-[4px]"},[w.createVNode(h,{to:"/"+(N==null?void 0:N.path),class:w.normalizeClass([[(N==null?void 0:N.path)===n.$route.path.replace("/","")&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:w.withCtx(()=>[w.createTextVNode(w.toDisplayString(N==null?void 0:N.ua),1)]),_:2},1032,["to","class"])]))),128))],512),[[w.vShow,p.isOpen]])]}),_:1})])):(w.openBlock(),w.createElementBlock("div",GC,[w.createVNode(h,{to:(A=o.route)==null?void 0:A.path,class:w.normalizeClass([[((R=o.route)==null?void 0:R.path)===n.$route.path.replace("/","")&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:w.withCtx(()=>{var z;return[w.createTextVNode(w.toDisplayString((z=o.route)==null?void 0:z.ua),1)]}),_:1},8,["to","class"])]))}const XC={components:{IconLogout:BC,NavbarItem:kt(qC,[["render",YC]]),IconLogo:$C},data(){return{activeIndex:null,data:null,searchValue:""}},computed:{data(){var n,i;return(n=this.searchValue)!=null&&n.trim()?(i=this.flattenMenu(wr.value))==null?void 0:i.filter(o=>{var c,p,b;return(b=(c=o==null?void 0:o.ua)==null?void 0:c.toLowerCase())==null?void 0:b.includes((p=this.searchValue)==null?void 0:p.toLowerCase())}):wr.value}},methods:{flattenMenu(n){const i=[];return n.forEach(o=>{o.menu?i.push(...this.flattenMenu(o.menu)):i.push(o)}),i}}},KC={class:"flex flex-col h-[100vh] border-r w-[300px]"},JC={class:"p-[16px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},QC={class:"pb-3 w-full flex flex-col flex-wrap"},eM={key:0,class:"flex flex-col gap-[6px]"},tM={key:1,class:"text-gray-800 text-lg mt-[20px]"};function iM(n,i,o,c,p,b){var M;const y=w.resolveComponent("IconLogo"),h=w.resolveComponent("NavbarItem");return w.openBlock(),w.createElementBlock("div",KC,[w.createVNode(y,{height:"40",width:"200",class:"my-[20px] ml-[20px]"}),w.withDirectives(w.createElementVNode("input",{type:"text","onUpdate:modelValue":i[0]||(i[0]=D=>p.searchValue=D),placeholder:"Пошук по меню",class:"h-[40px] block rounded-lg border mx-[10px] pl-[10px] focus:border-blue-600 focus:border-[2px] outline-none"},null,512),[[w.vModelText,p.searchValue]]),w.createElementVNode("div",JC,[w.createElementVNode("nav",QC,[(M=b.data)!=null&&M.length?(w.openBlock(),w.createElementBlock("ul",eM,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(b.data,(D,A)=>(w.openBlock(),w.createElementBlock("li",{key:A},[w.createVNode(h,{route:D},null,8,["route"])]))),128))])):(w.openBlock(),w.createElementBlock("div",tM,"Не знайдено"))])])])}const nM=kt(XC,[["render",iM]]),rM={},sM={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function oM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",sM,i[0]||(i[0]=[w.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),w.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),w.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const aM=kt(rM,[["render",oM]]),lM={},cM={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function hM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",cM,i[0]||(i[0]=[w.createElementVNode("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"},null,-1),w.createElementVNode("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"},null,-1)]))}const uM={components:{IconQuestion:aM,IconMessage:kt(lM,[["render",hM]])}},dM={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},pM={class:"flex items-center gap-[6px]"},fM={href:"docs-softpro.com",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},mM={class:"hs-tooltip [--placement:bottom] inline-block show"},gM={class:"hs-tooltip-toggle relative size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100"};function yM(n,i,o,c,p,b){const y=w.resolveComponent("IconQuestion"),h=w.resolveComponent("IconMessage");return w.openBlock(),w.createElementBlock("div",dM,[w.createElementVNode("div",pM,[w.createElementVNode("a",fM,[w.createVNode(y,{height:"24",width:"24"})]),w.createElementVNode("div",mM,[w.createElementVNode("button",gM,[w.createVNode(h,{height:"24",width:"24"}),i[0]||(i[0]=w.createElementVNode("span",{class:"flex absolute top-0 end-0 z-10 -mt-1.5 -me-1.5"},[w.createElementVNode("span",{class:"animate-ping absolute inline-flex size-full rounded-full bg-red-400 opacity-75 dark:bg-red-600"}),w.createElementVNode("span",{class:"relative min-w-[18px] min-h-[18px] inline-flex justify-center items-center text-[10px] bg-red-500 text-white rounded-full px-1"}," 1 ")],-1))]),i[1]||(i[1]=w.createElementVNode("span",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded-lg dark:bg-neutral-700 hidden",role:"tooltip","data-popper-placement":"bottom",style:{position:"fixed",inset:"0px auto auto 0px",margin:"0px",transform:"translate(1686px, 53px)"}},null,-1))]),i[2]||(i[2]=w.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),i[3]||(i[3]=w.createElementVNode("img",{class:"flex-shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Image Description"},null,-1))])])}const _M={components:{navbar:nM,AdminHeader:kt(uM,[["render",yM]])},mounted(){this.getMenu()},computed:{isMenu(){return wr.value}},methods:{async getMenu(){try{const{data:n}=await gt.get("/api/user-menu");wr.value=n}catch{}}}},xM={class:"admin-wrapper"},bM={class:"flex flex-col"};function vM(n,i,o,c,p,b){const y=w.resolveComponent("navbar"),h=w.resolveComponent("admin-header"),M=w.resolveComponent("router-view");return w.openBlock(),w.createElementBlock("div",xM,[w.createVNode(y),w.createElementVNode("div",bM,[b.isMenu?(w.openBlock(),w.createElementBlock(w.Fragment,{key:0},[w.createVNode(h),w.createVNode(M)],64)):w.createCommentVNode("",!0)])])}const wM=Object.freeze(Object.defineProperty({__proto__:null,default:kt(_M,[["render",vM],["__scopeId","data-v-3d7ecdff"]])},Symbol.toStringTag,{value:"Module"})),kM={},SM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-adjustments-horizontal"};function EM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",SM,i[0]||(i[0]=[w.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M4 6l8 0"></path><path d="M16 6l4 0"></path><path d="M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M4 12l2 0"></path><path d="M10 12l10 0"></path><path d="M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M4 18l11 0"></path><path d="M19 18l1 0"></path>',10)]))}const TM=kt(kM,[["render",EM]]),CM={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var n,i;return((n=this.data)==null?void 0:n.ua)||((i=this.data)==null?void 0:i.label)||this.data.title||"null"},selectedSortParam(){var n,i;return(i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(n){n!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(n){switch(n){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(n){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(n);const i=this.$route.query,{sort:o,...c}=i,p=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...c,...p&&{sort:p}}})},isValueEqualToSelected(n){return`${this.data.name}-${n}`===this.selectedSortParam}}},MM={scope:"col",class:"min-w-[200px] max-w-[300px] text-start"},PM={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},IM={key:0,d:"m7 15 5 5 5-5"},AM={key:1,d:"m7 9 5-5 5 5"},DM={key:1,class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500"};function zM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("th",MM,[b.getVisibleIcon?(w.openBlock(),w.createElementBlock("button",{key:0,type:"button",class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500 flex items-center gap-[6px]",onClick:i[0]||(i[0]=y=>b.handleClickSortBtn(p.currentSort))},[w.createTextVNode(w.toDisplayString(b.label)+" ",1),(w.openBlock(),w.createElementBlock("svg",PM,[p.currentSort==="asc"||p.currentSort===""?(w.openBlock(),w.createElementBlock("path",IM)):w.createCommentVNode("",!0),p.currentSort==="desc"||p.currentSort===""?(w.openBlock(),w.createElementBlock("path",AM)):w.createCommentVNode("",!0)]))])):(w.openBlock(),w.createElementBlock("p",DM,w.toDisplayString(b.label),1))])}const RM=kt(CM,[["render",zM]]),LM={},OM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function BM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",OM,i[0]||(i[0]=[w.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),w.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),w.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),w.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)]))}const FM=kt(LM,[["render",BM]]),NM={},VM={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function $M(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",VM,i[0]||(i[0]=[w.createStaticVNode('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>',5)]))}const jM=kt(NM,[["render",$M]]),UM={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},HM={style:{display:"none"}},qM=["height","width","fill"];function ZM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock(w.Fragment,null,[(w.openBlock(),w.createElementBlock("svg",HM,i[0]||(i[0]=[w.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[w.createElementVNode("path",{d:"M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z"})],-1)]))),(w.openBlock(),w.createElementBlock("svg",{height:o.height,width:o.width,fill:o.color},i[1]||(i[1]=[w.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,qM))],64)}const WM={components:{IconMore:FM,IconDelete:jM,IconEdit:kt(UM,[["render",ZM]])},emits:["updateTable"],props:{item:Object,table:String},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var n;try{const{data:i}=await gt.get(`/api/table/${this.table}/${(n=this.item)==null?void 0:n.id}`);this.formValue=i}catch(i){console.error(i)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var n;try{gt.delete(`/api/table/${this.table}/${(n=this.item)==null?void 0:n.id}`),this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table"),this.isDeleteConfirm=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},GM={class:"hs-dropdown [--placement:bottom-right] inline-flex"},YM={id:"hs-pro-dupc1",type:"button",class:"gap-x-2 p-2 rounded-lg hover:border-transparent focus:outline-none text-black hover:bg-gray-50"},XM={class:"pt-[7px] pb-[7px] flex flex-col items-start"},KM={class:"p-4"},JM={class:"mt-4 flex justify-end gap-x-3"};function QM(n,i,o,c,p,b){const y=w.resolveComponent("IconMore"),h=w.resolveComponent("IconEdit"),M=w.resolveComponent("router-link"),D=w.resolveComponent("IconDelete"),A=w.resolveComponent("VsPopover"),R=w.resolveComponent("VsDialog");return w.openBlock(),w.createElementBlock(w.Fragment,null,[w.createElementVNode("div",GM,[w.createVNode(A,{trigger:"click",placement:"left"},{reference:w.withCtx(()=>[w.createElementVNode("button",YM,[w.createVNode(y,{height:"16",width:"16"})])]),default:w.withCtx(()=>{var z,N,Y;return[w.createElementVNode("div",XM,[w.createVNode(M,{to:`/edit?table=${(N=(z=n.$route)==null?void 0:z.params)==null?void 0:N.catchAll}&id=${(Y=o.item)==null?void 0:Y.id}`,class:"w-[100px] ml-[2px] flex items-center justify-center gap-x-3 rounded-lg text-[13px] text-gray-800"},{default:w.withCtx(()=>[w.createVNode(h,{color:"#000"}),i[4]||(i[4]=w.createTextVNode(" Редагувати "))]),_:1},8,["to"]),i[6]||(i[6]=w.createElementVNode("div",{class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto mt-[10px] mb-[10px]"},null,-1)),w.createElementVNode("button",{onClick:i[0]||(i[0]=w.withModifiers((...te)=>b.openConfirm&&b.openConfirm(...te),["stop"])),type:"button",class:"w-[100px] flex items-center justify-center gap-x-3 rounded-lg text-[14px] text-red-500"},[w.createVNode(D),i[5]||(i[5]=w.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])])]}),_:1})]),w.createVNode(R,{visible:p.isDeleteConfirm,"onUpdate:visible":i[3]||(i[3]=z=>p.isDeleteConfirm=z),title:"Ви впевнені?"},{default:w.withCtx(()=>[w.createElementVNode("div",KM,[i[7]||(i[7]=w.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),w.createElementVNode("div",JM,[w.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:i[1]||(i[1]=z=>p.isDeleteConfirm=!1)}," Скасувати "),w.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:i[2]||(i[2]=(...z)=>b.deleteElement&&b.deleteElement(...z))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const eP=kt(WM,[["render",QM]]),tP={},iP={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function nP(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",iP,i[0]||(i[0]=[w.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),w.createElementVNode("path",{d:"M7 20V4"},null,-1),w.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),w.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const rP=kt(tP,[["render",nP]]),sP={props:{columns:{type:Object,default:()=>{}},table:{type:String,default:()=>""}},data(){return{tableFormats:["json","csv","xlsx"],format:"",cols:[]}},methods:{async exportTable(){try{const n=await gt.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(",")},responseType:"blob"}),i=new Blob([n.data],{type:"application/octet-stream"}),o=window.URL.createObjectURL(i),c=document.createElement("a");c.href=o,c.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(o),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"})}catch(n){console.error("Ошибка при экспорте файла:",n),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(n){this.format=n}}},oP={class:"p-4"},aP={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},lP={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},cP={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},hP={class:"mt-2 space-y-2"},uP=["id","onChange"],dP=["for"],pP={class:"pb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},fP={class:"text-center"};function mP(n,i,o,c,p,b){const y=w.resolveComponent("VsCheckbox");return w.openBlock(),w.createElementBlock(w.Fragment,null,[i[4]||(i[4]=w.createElementVNode("div",{class:"dark:border-neutral-700"},null,-1)),w.createElementVNode("div",oP,[w.createElementVNode("div",aP,[i[2]||(i[2]=w.createElementVNode("label",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Виберіть стовпці таблиці для експорту: ",-1)),w.createElementVNode("div",lP,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(o.columns,(h,M)=>(w.openBlock(),w.createElementBlock("div",{class:"flex items-center",key:M,style:{width:"calc((100% - 10px) / 2)"}},[w.createVNode(y,{class:"py-0 shrink-0 border-gray-300 rounded text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",modelValue:p.cols,"onUpdate:modelValue":i[0]||(i[0]=D=>p.cols=D),value:h==null?void 0:h.name,label:h==null?void 0:h.ua},null,8,["modelValue","value","label"])]))),128))])]),w.createElementVNode("div",cP,[i[3]||(i[3]=w.createElementVNode("label",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Виберіть формат таблиці: ",-1)),w.createElementVNode("div",hP,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(p.tableFormats,(h,M)=>(w.openBlock(),w.createElementBlock("div",{class:"flex items-center",key:M},[w.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"shrink-0 border-gray-300 rounded-full text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",id:h,onChange:D=>b.selectFormat(h)},null,40,uP),w.createElementVNode("label",{for:h,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+w.toDisplayString(h),9,dP)]))),128))])]),w.createElementVNode("div",pP,[w.createElementVNode("div",fP,[w.createElementVNode("button",{type:"button",class:"p-2 inline-flex items-center gap-x-2 text-xs font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500",onClick:i[1]||(i[1]=(...h)=>b.exportTable&&b.exportTable(...h))}," Завантажити таблицю ")])])])],64)}const gP={components:{IconExport:rP,AdminTableExportForm:kt(sP,[["render",mP]])},props:{table:String,columns:Array},data(){return{isOpen:!1}}};function yP(n,i,o,c,p,b){const y=w.resolveComponent("IconExport"),h=w.resolveComponent("AdminTableExportForm"),M=w.resolveComponent("VsDialog");return w.openBlock(),w.createElementBlock(w.Fragment,null,[w.createElementVNode("button",{onClick:i[0]||(i[0]=D=>p.isOpen=!0),class:"py-2 px-3 relative flex items-center gap-x-2 text-sm border focus:outline-none border-gray-100 font-medium rounded-lg text-gray-800 hover:border-gray-100 focus:border-gray-100 hover:bg-gray-50 shadow-sm duration-300"},[w.createVNode(y,{height:"16",width:"16"}),i[2]||(i[2]=w.createTextVNode(" Експорт "))]),w.createVNode(M,{visible:p.isOpen,"onUpdate:visible":i[1]||(i[1]=D=>p.isOpen=D),title:"Експорт таблиці"},{default:w.withCtx(()=>[w.createVNode(h,{table:o.table,columns:o.columns},null,8,["table","columns"])]),_:1},8,["visible"])],64)}const _P=kt(gP,[["render",yP]]),xP={},bP={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-columns"};function vP(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",bP,i[0]||(i[0]=[w.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l5.5 0"></path><path d="M4 10l5.5 0"></path><path d="M4 14l5.5 0"></path><path d="M4 18l5.5 0"></path><path d="M14.5 6l5.5 0"></path><path d="M14.5 10l5.5 0"></path><path d="M14.5 14l5.5 0"></path><path d="M14.5 18l5.5 0"></path>',9)]))}const wP=kt(xP,[["render",vP]]),kP={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(n){this.$emit("update-column",{...this.column,hidden:!n})}},mounted(){var n;((n=this.column)==null?void 0:n.hidden)!==!0&&(this.value=!0)}},SP={class:"flex w-full gap-[8px] items-centr"};function EP(n,i,o,c,p,b){var y,h;return w.openBlock(),w.createElementBlock("label",SP,[w.withDirectives(w.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=M=>p.value=M),type:"checkbox"},null,512),[[w.vModelCheckbox,p.value]]),w.createTextVNode(" "+w.toDisplayString(((y=o.column)==null?void 0:y.ua)||((h=o.column)==null?void 0:h.title)),1)])}const TP={components:{IconColumns:wP,AdminTableColumnsHiddenItem:kt(kP,[["render",EP]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(n){const i=this.columns.findIndex(c=>(c==null?void 0:c.name)===(n==null?void 0:n.name)),o=this.columns;o[i]=n,this.$emit("update-columns",[...o])}}},CP={class:"py-2 px-3 flex items-center gap-x-2 text-sm border focus:outline-none border-gray-100 font-medium rounded-lg text-gray-800 hover:border-gray-100 focus:border-gray-100 hover:bg-gray-50 shadow-sm duration-300"},MP={class:"flex flex-col gap-[3px] h-[400px] w-[300px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function PP(n,i,o,c,p,b){const y=w.resolveComponent("IconColumns"),h=w.resolveComponent("AdminTableColumnsHiddenItem"),M=w.resolveComponent("VsPopover");return w.openBlock(),w.createBlock(M,{trigger:"click",placement:"bottom"},{reference:w.withCtx(()=>[w.createElementVNode("button",CP,[w.createVNode(y,{height:"20",width:"16"})])]),default:w.withCtx(()=>[w.createElementVNode("div",null,[i[0]||(i[0]=w.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),w.createElementVNode("ul",MP,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(o.columns,(D,A)=>(w.openBlock(),w.createElementBlock("li",{key:A},[w.createVNode(h,{column:D,onUpdateColumn:b.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const IP=kt(TP,[["render",PP]]),AP={},DP={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function zP(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",DP,i[0]||(i[0]=[w.createStaticVNode('<div><div class="p-5 min-h-[500px] flex flex-col justify-center items-center text-center"><svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg><div class="max-w-sm mx-auto mt-6"><p class="font-medium text-gray-800 dark:text-neutral-200"> Дані для відображення відсутні </p><p class="mt-2 text-sm text-gray-500 dark:text-neutral-500"> Змініть параметри пошуку або спробуйте пізніше </p></div></div></div>',1)]))}const RP={props:{table:String},components:{IconFilter:TM,AdminTableControl:eP,AdminTableExport:_P,AdminTableColumnsHidden:IP,AdminTableColumn:RM,AdminNodata:kt(AP,[["render",zP]])},data(){return{tableData:{},isFilters:!1,filterScheme:[],page:1,searchValue:"",limit:20,filters:null,activeColumn:""}},mounted(){var n,i;this.page=((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.page)||1,this.getTableData(),this.getFilters()},computed:{defaultPage(){var n,i;return((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.page)||1},getFilterScheme(){var n;return(n=this.tableData)==null?void 0:n.filters},columns(){var n,i;return(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.filter(o=>(o==null?void 0:o.hidden)!==!0)},isForm(){var n;return(n=this.tableData)==null?void 0:n.form},isNoData(){var n,i;return!((n=this.tableData)!=null&&n.rows)||!((i=this.columns)!=null&&i.length)}},watch:{async table(){await this.getTableData()},searchValue(){this.getTableData()},$route:{handler(n,i){var o,c;((o=n==null?void 0:n.params)==null?void 0:o.catchAll)!==((c=i==null?void 0:i.params)==null?void 0:c.catchAll)&&(this.filterScheme=null,this.getFilters())},deep:!0}},methods:{async getTableData(){var n,i;try{const{data:o}=await gt.get(`/api/template/table/${this.table}`),c=await gt.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.sort)||null}});this.tableData={...o,...(c==null?void 0:c.data)||{}}}catch{}},async getFilters(){var n;try{const{data:i}=await gt.get(`/api/table-filter/${this.table}`);this.filterScheme=(n=i==null?void 0:i.list)==null?void 0:n.map(o=>({...o,label:(o==null?void 0:o.label)||(o==null?void 0:o.ua)}))}catch{}},async handlePageChange(n){const i=this.$route.query;this.page=n,!(!(i!=null&&i.page)&&n===1||i.page===n)&&(await this.$router.replace({query:{...i,page:n}}),await this.getTableData())},async changeLimit(n){this.limit=await n,this.defaultPage=1,await this.getTableData()},closeFilter({target:n}){this.isFilters&&n.classList.contains("filter-container")&&(this.isFilters=!1)},async filterChange({url:n}){this.filters=n,this.page=1,await this.getTableData()},changeActiveColumn(n){this.activeColumn=n,this.getTableData()}}},LP={class:"w-[calc(100vw - 320px)]"},OP={class:"h-[58px] bg-gray-50 flex items-center justify-between px-[30px]"},BP={class:"text-xl font-medium"},FP={style:{height:"calc(100vh - 120px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},NP={class:"bg-white w-full rounded-xl border p-[20px]"},VP={class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px]"},$P={class:"flex gap-[6px] ml-auto"},jP={class:"space-y-5 flex items-start w-full justify-start"},UP={style:{height:"calc(100vh - 310px)"},class:"overflow-x-auto w-full border-t [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},HP={class:"inline-block w-full align-middle"},qP={key:0,class:"divide-y divide-gray-200 min-w-full dark:divide-neutral-700 relative table-fixed"},ZP={class:"sticky top-0 bg-white w-full relative after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},WP={class:"border-stone-200 right-0 z-[1]"},GP={class:"divide-y divide-gray-200"},YP={class:"min-w-[200px] text-start pe-4 py-3 text-sm text-gray-600"},XP={class:"text-center sticky right-0 bg-white w-[80px] px-[10px]"},KP={class:"p-[20px] flex justify-end w-full"},JP={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-[rgba(0,0,0,0.5)] [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function QP(n,i,o,c,p,b){var te,ae,he,be,_e,Ie,ot;const y=w.resolveComponent("router-link"),h=w.resolveComponent("AdminTableColumnsHidden"),M=w.resolveComponent("AdminTableExport"),D=w.resolveComponent("IconFilter"),A=w.resolveComponent("AdminTableColumn"),R=w.resolveComponent("AdminTableControl"),z=w.resolveComponent("AdminNodata"),N=w.resolveComponent("VsPagination"),Y=w.resolveComponent("VsFilter");return w.openBlock(),w.createElementBlock(w.Fragment,null,[w.createElementVNode("div",LP,[w.createElementVNode("div",OP,[w.createElementVNode("h2",BP,w.toDisplayString((te=p.tableData)==null?void 0:te.title),1),b.isForm?(w.openBlock(),w.createBlock(y,{key:0,to:`/add?table=${(he=(ae=n.$route)==null?void 0:ae.params)==null?void 0:he.catchAll}`,class:"py-2 px-3 flex items-center gap-x-2 text-sm text-white font-medium rounded-lg bg-blue-500 text-gray-800 shadow-sm hover:bg-blue-700 hover:text-white duration-300"},{default:w.withCtx(()=>i[5]||(i[5]=[w.createTextVNode(" Додати ")])),_:1},8,["to"])):w.createCommentVNode("",!0)]),w.createElementVNode("div",FP,[w.createElementVNode("div",NP,[w.createElementVNode("div",VP,[w.withDirectives(w.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=Qe=>p.searchValue=Qe),class:"py-2 pl-[15px] h-[38px] w-[400px] block w-full border rounded-lg text-sm focus:border-blue-600 focus:border-[2px] outline-none",placeholder:"Пошук..."},null,512),[[w.vModelText,p.searchValue]]),w.createElementVNode("div",$P,[w.createVNode(h,{columns:(be=p.tableData)==null?void 0:be.columns,onUpdateColumns:i[1]||(i[1]=Qe=>p.tableData.columns=Qe)},null,8,["columns"]),w.createVNode(M,{table:o.table,columns:(_e=p.tableData)==null?void 0:_e.columns},null,8,["table","columns"]),w.createElementVNode("button",{onClick:i[2]||(i[2]=Qe=>p.isFilters=!p.isFilters),class:"py-2 px-3 flex items-center gap-x-2 text-sm border focus:outline-none border-gray-100 font-medium rounded-lg text-gray-800 hover:border-gray-100 focus:border-gray-100 hover:bg-gray-50 shadow-sm duration-300"},[w.createVNode(D,{height:"16",width:"16"}),i[6]||(i[6]=w.createTextVNode(" Фільтри "))])])]),w.createElementVNode("div",jP,[w.createElementVNode("div",UP,[w.createElementVNode("div",HP,[b.isNoData?(w.openBlock(),w.createBlock(z,{key:1})):(w.openBlock(),w.createElementBlock("table",qP,[w.createElementVNode("thead",ZP,[w.createElementVNode("tr",WP,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(b.columns,Qe=>(w.openBlock(),w.createBlock(A,{key:Qe.name,data:Qe,activeColumn:p.activeColumn,onChangeActive:b.changeActiveColumn},null,8,["data","activeColumn","onChangeActive"]))),128)),i[7]||(i[7]=w.createElementVNode("th",{class:"w-[70px] sticky right-0 top-0 bg-white"},null,-1))])]),w.createElementVNode("tbody",GP,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList((Ie=p.tableData)==null?void 0:Ie.rows,(Qe,Be)=>{var St;return w.openBlock(),w.createElementBlock("tr",{key:Be},[w.createElementVNode("td",YP,[w.createVNode(y,{to:`/card/${o.table}/${Qe==null?void 0:Qe.id}`,class:"text-sm text-green-600 decoration-2 hover:underline font-medium focus:outline-none focus:underline hover:text-green-600"},{default:w.withCtx(()=>{var rt;return[w.createTextVNode(w.toDisplayString(Qe==null?void 0:Qe[(rt=b.columns[0])==null?void 0:rt.name]),1)]}),_:2},1032,["to"])]),(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList((St=b.columns)==null?void 0:St.slice(1),rt=>{var Dt;return w.openBlock(),w.createElementBlock("td",{class:"min-w-[300px] w-full text-start px-[4px] py-3 text-sm text-gray-600",key:rt.name},[(w.openBlock(),w.createBlock(w.resolveDynamicComponent((rt==null?void 0:rt.format)==="custom"?rt==null?void 0:rt.component:n.$componentsConfig[`table-format-${((Dt=rt==null?void 0:rt.format)==null?void 0:Dt.toLowerCase())||n.text}`]),{name:rt==null?void 0:rt.name,data:Qe,value:Qe==null?void 0:Qe[rt==null?void 0:rt.name]},null,8,["name","data","value"]))])}),128)),w.createElementVNode("td",XP,[w.createVNode(R,{item:Qe,table:o.table,onUpdateTable:b.getTableData},null,8,["item","table","onUpdateTable"])])])}),128))])]))])])]),w.createElementVNode("div",KP,[w.createVNode(N,{goTo:!1,class:"justify-end","default-page":b.defaultPage,total:((ot=p.tableData)==null?void 0:ot.total)||0,pageSize:p.limit,onPageChange:b.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:b.changeLimit},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])])])])]),w.createVNode(w.Transition,{name:"fade"},{default:w.withCtx(()=>{var Qe;return[w.withDirectives(w.createElementVNode("div",{onClick:i[4]||(i[4]=(...Be)=>b.closeFilter&&b.closeFilter(...Be)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.5)]"},[w.createElementVNode("div",JP,[(Qe=p.filterScheme)!=null&&Qe.length?(w.openBlock(),w.createBlock(Y,{key:0,ref:"filter",scheme:p.filterScheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:b.filterChange,closeFilterBtn:!0,onFilterClose:i[3]||(i[3]=Be=>p.isFilters=!1)},null,8,["scheme","onFilterChange"])):w.createCommentVNode("",!0)])],512),[[w.vShow,p.isFilters]])]}),_:1})],64)}const eI={components:{AdminTable:kt(RP,[["render",QP]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){wr!=null&&wr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(n){n&&(document.title=n)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(n){const i=[];return n.forEach(o=>{o.menu?i.push(...this.flattenMenu(o.menu)):i.push(o)}),i},async getMenu(){try{const{data:n}=await gt.get("/api/user-menu");wr.value=n}catch{}},async checkPageType(){const n=this.flattenMenu(wr.value);n!=null&&n.length||this.$router.replace("/404");const i=n==null?void 0:n.find(c=>{var p,b;return(c==null?void 0:c.path)==((b=(p=this.$route)==null?void 0:p.params)==null?void 0:b.catchAll)});this.title=i==null?void 0:i.ua,i||this.$router.replace("/404");const o=i==null?void 0:i.table;this.table=o||!1,!o&&this.getInterface()},async getInterface(){var n,i;try{const{data:o}=await gt.get(`/api/template/interface/${((i=(n=this.$route)==null?void 0:n.params)==null?void 0:i.catchAll)||""}`);this.interface=o||""}catch{this.interface=""}}}},tI=["innerHTML"];function iI(n,i,o,c,p,b){const y=w.resolveComponent("AdminTable");return p.table?(w.openBlock(),w.createBlock(y,{key:0,table:p.table},null,8,["table"])):(w.openBlock(),w.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:p.interface},null,8,tI))}const nI=Object.freeze(Object.defineProperty({__proto__:null,default:kt(eI,[["render",iI]])},Symbol.toStringTag,{value:"Module"}));return ZT});
629
+ Je.version="2.30.1",r2(vi),Je.fn=ze,Je.min=Zk,Je.max=Wk,Je.now=Gk,Je.utc=Jr,Je.unix=wE,Je.months=SE,Je.isDate=Jl,Je.locale=Xs,Je.invalid=Zh,Je.duration=Vr,Je.isMoment=Fr,Je.weekdays=TE,Je.parseZone=kE,Je.localeData=ks,Je.isDuration=ou,Je.monthsShort=EE,Je.weekdaysMin=ME,Je.defineLocale=Ip,Je.updateLocale=kk,Je.locales=Sk,Je.weekdaysShort=CE,Je.normalizeUnits=br,Je.relativeTimeRounding=tT,Je.relativeTimeThreshold=iT,Je.calendarFormat=xS,Je.prototype=ze,Je.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"};const rT=n=>{const i=/(\b\S)?/g,o=n.match(i);return o?o.join("").toUpperCase():""},sT={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return rT(this.name)}}},oT={class:"mr-2"},aT=["src"],lT={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},cT={key:0},hT={key:1,class:"text-sm"};function uT(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",oT,[o.avatar?(w.openBlock(),w.createElementBlock("img",{key:0,src:o.avatar,alt:"avatar",class:"flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full"},null,8,aT)):o.name?(w.openBlock(),w.createElementBlock("div",lT,[b.inItials.length?(w.openBlock(),w.createElementBlock("span",cT,w.toDisplayString(b.inItials),1)):(w.openBlock(),w.createElementBlock("span",hT,i[0]||(i[0]=[w.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):w.createCommentVNode("",!0)])}const dT={components:{VsWidgetCommentsAvatar:kt(sT,[["render",uT]])},props:{comment:{type:Object,default:()=>({})},user:{type:Object,default:()=>({})},id:{type:String,default:""}},data(){return{commentContent:this.comment.body,isCommentActionVisible:!1,isOpen:!1,textareaValue:""}},computed:{isUserAutor(){return this.user.uid===this.comment.uid},createDate(){try{const n=Je(this.comment.cdate,"YYYY-MM-DD");return new Date(n).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},watch:{isOpen(n){n&&(this.textareaValue=this.comment.body)}},methods:{confirnDeleteComment(){document.body.click(),this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей коментар?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteComment,updateListOnConfirm:!0})},async updateComment(){try{await gt.put(`/api/widget/comment/${this.id}/${this.comment.communication_id}`,{body:this.textareaValue}),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async deleteComment(){try{await gt.delete(`/api/widget/comment/${this.id}/${this.comment.communication_id}`),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},toggleCommentAction(){this.isCommentActionVisible=!this.isCommentActionVisible}}},pT={class:"p-6 text-base bg-white dark:bg-gray-900"},fT={class:"flex justify-between items-center mb-2"},mT={class:"flex items-center"},gT={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold capitalize"},yT={class:"text-sm text-gray-600 dark:text-gray-400"},_T={class:"text-gray-500 dark:text-gray-400"},xT={class:"flex items-center gap-[4px]"},bT={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},vT={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function wT(n,i,o,c,p,b){const y=w.resolveComponent("VsWidgetCommentsAvatar"),h=w.resolveComponent("VsDialog");return w.openBlock(),w.createElementBlock(w.Fragment,null,[w.createElementVNode("div",pT,[w.createElementVNode("div",fT,[w.createElementVNode("div",mT,[w.createElementVNode("p",gT,[w.createVNode(y,{name:o.comment.username,avatar:o.comment.avatar},null,8,["name","avatar"]),w.createTextVNode(w.toDisplayString(o.comment.username),1)]),w.createElementVNode("div",yT,w.toDisplayString(b.createDate),1)])]),w.createElementVNode("p",_T,w.toDisplayString(o.comment.body),1),w.createElementVNode("div",xT,[w.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:i[0]||(i[0]=M=>p.isOpen=!0)}," Редагувати "),w.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:i[1]||(i[1]=M=>b.confirnDeleteComment())}," Видалити ")])]),w.createVNode(h,{visible:p.isOpen,"onUpdate:visible":i[5]||(i[5]=M=>p.isOpen=M),title:"Редагувати"},{footer:w.withCtx(()=>[w.createElementVNode("div",vT,[w.createElementVNode("button",{onClick:i[3]||(i[3]=M=>p.isOpen=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Відмінити "),w.createElementVNode("button",{onClick:i[4]||(i[4]=(...M)=>b.updateComment&&b.updateComment(...M)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:w.withCtx(()=>[w.createElementVNode("label",bT,[i[6]||(i[6]=w.createTextVNode(" Коментар ")),w.withDirectives(w.createElementVNode("textarea",{"onUpdate:modelValue":i[2]||(i[2]=M=>p.textareaValue=M),placeholder:"Напишіть коментар...",class:"w-full h-[200px] border rounded-lg outline-none resize-none p-[20px] focus:border-[2px] focus:border-blue-600 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},null,512),[[w.vModelText,p.textareaValue]])])]),_:1},8,["visible"])],64)}const kT={components:{VsWidgetCommentsItem:kt(dT,[["render",wT]])},inject:["activeAddFormEditor"],props:{id:{type:String,default:()=>""},prefilledData:{type:Object,default:null}},data(){return{isLoaded:!1,isLoadFailed:!1,comments:[],user:{},modal:{title:"",message:"",cancel:"",confirm:"",cancelButtonText:"",confirmButtonText:""},isModalVisible:!1}},async created(){await this.getComments()},methods:{async getComments(){if(this.prefilledData){this.comments=this.prefilledData.rows,this.isLoaded=!0;return}try{const{data:n}=await gt.get(`/api/widget/comment/${this.id}`);this.comments=n.rows,this.user=n.user}catch(n){this.isLoadFailed=!0,console.error(n)}this.isLoaded=!0,this.$emit("update-comment-count")},prepareModal(n){const i={...n};return n.cancel||(i.cancel=()=>{this.isModalVisible=!1}),n.updateListOnConfirm&&(i.confirm=async()=>{await n.confirm(),this.isModalVisible=!1}),i},handleOpenModal(n){this.modal=this.prepareModal(n),this.isModalVisible=!0}}},ST={class:"flex flex-col divide-y"},ET={key:0,class:"max-h-[300px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},TT={key:1},CT={class:"p-4"},MT={class:"mt-1 text-gray-500 dark:text-neutral-500"},PT={class:"mt-4 flex justify-end gap-x-3"};function IT(n,i,o,c,p,b){const y=w.resolveComponent("VsErrorOnLoading"),h=w.resolveComponent("VsWidgetCommentsItem"),M=w.resolveComponent("VsLoader"),D=w.resolveComponent("VsDialog");return w.openBlock(),w.createElementBlock("div",ST,[p.isLoaded?(w.openBlock(),w.createElementBlock(w.Fragment,{key:0},[p.isLoadFailed?(w.openBlock(),w.createBlock(y,{key:0})):(w.openBlock(),w.createElementBlock(w.Fragment,{key:1},[p.comments.length?(w.openBlock(),w.createElementBlock("div",ET,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(p.comments,(A,R)=>(w.openBlock(),w.createBlock(h,{key:R,comment:A,user:p.user,index:R,id:o.id,onListUpdate:b.getComments,class:"border-top",onOpenModal:i[0]||(i[0]=z=>b.handleOpenModal(z))},null,8,["comment","user","index","id","onListUpdate"]))),128))])):(w.openBlock(),w.createElementBlock("div",TT,i[4]||(i[4]=[w.createElementVNode("p",{class:"pl-3 text-sm font-medium text-gray-600"},"Коментарі відсутні",-1)])))],64))],64)):(w.openBlock(),w.createBlock(M,{key:1,class:"justify-center",text:"Please wait..."})),w.createVNode(D,{title:p.modal.title,size:"small",visible:p.isModalVisible,"onUpdate:visible":i[3]||(i[3]=A=>p.isModalVisible=A)},{default:w.withCtx(()=>[w.createElementVNode("div",CT,[w.createElementVNode("p",MT,w.toDisplayString(p.modal.message),1),w.createElementVNode("div",PT,[w.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:i[1]||(i[1]=(...A)=>p.modal.cancel&&p.modal.cancel(...A))},w.toDisplayString(p.modal.cancelButtonText),1),w.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:i[2]||(i[2]=(...A)=>p.modal.confirm&&p.modal.confirm(...A))},w.toDisplayString(p.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const AT=kt(kT,[["render",IT]]),DT={props:{id:{type:String,default:()=>""},autofocus:{type:Boolean,default:()=>!0}},data(){return{isEditorOpen:!1,commentContent:""}},methods:{async addNewComment(){if(this.commentContent)try{await gt.post(`/api/widget/comment/${this.id}`,{body:this.commentContent}),this.commentContent="",this.$emit("list-update")}catch(n){console.error(n)}},setNewContent(n){this.commentContent=n}}},zT={class:"w-full widget-comment-form"},RT={class:"mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"};function LT(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",zT,[w.createElementVNode("div",RT,[w.withDirectives(w.createElementVNode("textarea",{"onUpdate:modelValue":i[0]||(i[0]=y=>p.commentContent=y),rows:"6",class:"w-full h-[200px] border rounded-lg outline-none resize-none p-[20px] focus:border-[2px] focus:border-blue-600 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",placeholder:"Напишіть коментар..."},null,512),[[w.vModelText,p.commentContent]])]),w.createElementVNode("button",{ref:"buttonAdd",class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300",onClick:i[1]||(i[1]=(...y)=>b.addNewComment&&b.addNewComment(...y))}," Відправити коментар ",512)])}const OT={components:{VsWidgetCommentsList:AT,VsWidgetCommentsAddForm:kt(DT,[["render",LT]])},props:{id:{type:String,default(){return""}},prefilledData:{type:Object,default:null}},data(){return{activeAddFormEditor:"",comments:[],totalComment:"0"}},mounted(){this.comments=this.$refs.commentListRef.comments},watch:{comments(n){this.$emit("count-change",n.length)}},methods:{listUpdate(){this.$refs.commentListRef.getComments()},updateCommentCount(){this.totalComment=this.$refs.commentListRef.comments.length||"0"}}},BT={class:"bg-white-200"},FT={class:"flex justify-between items-center gap-x-2 mb-4"},NT={class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"},VT={key:0,class:"inline-block font-semibold text-gray-800 dark:text-neutral-200"};function $T(n,i,o,c,p,b){const y=w.resolveComponent("VsWidgetCommentsAddForm"),h=w.resolveComponent("VsWidgetCommentsList");return w.openBlock(),w.createElementBlock("div",BT,[w.createElementVNode("div",FT,[w.createElementVNode("h2",NT,[i[2]||(i[2]=w.createTextVNode("Коментарі ")),p.comments?(w.openBlock(),w.createElementBlock("span",VT,"("+w.toDisplayString(p.totalComment)+")",1)):w.createCommentVNode("",!0)])]),w.createVNode(y,{class:"mb-6",id:o.id,onListUpdate:i[0]||(i[0]=M=>b.listUpdate())},null,8,["id"]),w.createVNode(h,{id:o.id,onUpdateCommentCount:i[1]||(i[1]=M=>b.updateCommentCount()),"prefilled-data":o.prefilledData,ref:"commentListRef"},null,8,["id","prefilled-data"])])}const jT={"vs-widget-map":_w,"vs-widget-gallery":n2,"vs-widget-comments":kt(OT,[["render",$T]])},UT={},HT={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},qT={...jT,...UT,"vs-dashboard":{__name:"vs-dashboard",setup(n){return(i,o)=>(w.openBlock(),w.createElementBlock("div",HT,o[0]||(o[0]=[w.createElementVNode("div",{class:"p-5 md:p-8 bg-white border border-gray-200 shadow-sm rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[w.createElementVNode("div",{class:"mb-4 xl:mb-8"},[w.createElementVNode("h1",{class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"}," Members "),w.createElementVNode("p",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Manage members and users of your workspace and set their access level. ")]),w.createElementVNode("div",{class:"space-y-5"},[w.createElementVNode("div",{class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5"},[w.createElementVNode("div",{class:"relative w-full"},[w.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[w.createElementVNode("svg",{class:"shrink-0 size-4 text-gray-500 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[w.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),w.createElementVNode("path",{d:"m21 21-4.3-4.3"})])]),w.createElementVNode("input",{type:"text",class:"py-2 ps-10 pe-8 block w-full bg-gray-100 border-transparent rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Search by name or email"}),w.createElementVNode("div",{class:"hidden absolute inset-y-0 end-0 flex items-center pointer-events-none z-20 pe-1"},[w.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-6 rounded-full text-gray-500 hover:text-blue-600 focus:outline-none focus:text-blue-600 dark:text-neutral-500 dark:hover:text-blue-500 dark:focus:text-blue-500","aria-label":"Close"},[w.createElementVNode("span",{class:"sr-only"},"Close"),w.createElementVNode("svg",{class:"shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[w.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),w.createElementVNode("path",{d:"m15 9-6 6"}),w.createElementVNode("path",{d:"m9 9 6 6"})])])])]),w.createElementVNode("div",{class:"flex justify-end items-center gap-x-2"},[w.createElementVNode("button",{type:"button",class:"p-2.5 sm:py-2 sm:px-3 inline-flex items-center text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[w.createElementVNode("svg",{class:"shrink-0 sm:me-2 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[w.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),w.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),w.createElementVNode("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]),w.createElementVNode("span",{class:"hidden sm:block"}," Download CSV ")]),w.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-1 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500","data-hs-overlay":"#hs-pro-dshm"},[w.createElementVNode("span",{class:"hidden sm:block"},"Send"),w.createTextVNode("Invite ")])])]),w.createElementVNode("div",{class:"grid sm:grid-cols-2 lg:grid-cols-4 gap-2 xl:gap-4"},[w.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[w.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[w.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}),w.createElementVNode("div",{class:"flex items-center -space-x-2"},[w.createElementVNode("img",{class:"shrink-0 size-7 rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"})])]),w.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Admin")]),w.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[w.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[w.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 5 "),w.createElementVNode("div",{class:"flex items-center -space-x-2"},[w.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),w.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482634023-2c4fda99ac0c?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O ")])]),w.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[w.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Members"),w.createElementVNode("div",{class:"hs-tooltip inline-block"},[w.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[w.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),w.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),w.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(689px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),w.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[w.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[w.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 2 "),w.createElementVNode("div",{class:"flex items-center -space-x-2"},[w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," 0 ")])]),w.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[w.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"}," Limited access members "),w.createElementVNode("div",{class:"hs-tooltip inline-block"},[w.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[w.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),w.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),w.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(1198px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),w.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[w.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[w.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 0 "),w.createElementVNode("div",{class:"flex items-center -space-x-2"})]),w.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Pending invites")])]),w.createElementVNode("div",{class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[w.createElementVNode("div",{class:"min-w-full inline-block align-middle"},[w.createElementVNode("table",{class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},[w.createElementVNode("thead",null,[w.createElementVNode("tr",null,[w.createElementVNode("th",{scope:"col",class:"min-w-[250px]"},[w.createElementVNode("div",{class:"pe-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Member ")]),w.createElementVNode("th",{scope:"col",class:"min-w-48"},[w.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Role ")]),w.createElementVNode("th",{scope:"col"},[w.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Email ")]),w.createElementVNode("th",{scope:"col",class:"min-w-36"},[w.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Last activity ")]),w.createElementVNode("th",{scope:"col"},[w.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Status ")])])]),w.createElementVNode("tbody",{class:"divide-y divide-gray-200 dark:divide-neutral-700"},[w.createElementVNode("tr",null,[w.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[w.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[w.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("div",{class:"grow"},[w.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Admin ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," james@site.com ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[w.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),w.createTextVNode(" Active ")])])]),w.createElementVNode("tr",null,[w.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[w.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),w.createElementVNode("div",{class:"grow"},[w.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," liza@site.com ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 2 days ago ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[w.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),w.createTextVNode(" Inactive ")])])]),w.createElementVNode("tr",null,[w.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[w.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[w.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1601935111741-ae98b2b230b0?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("div",{class:"grow"},[w.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Daniel Hobbs ")])])]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," dhobbs@site.com ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[w.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),w.createTextVNode(" Inactive ")])])]),w.createElementVNode("tr",null,[w.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[w.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[w.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),w.createElementVNode("div",{class:"grow"},[w.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Brian Warner ")])])]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," brian@site.com ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 1 months ago ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[w.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),w.createTextVNode(" Active ")])])]),w.createElementVNode("tr",null,[w.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[w.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[w.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O "),w.createElementVNode("div",{class:"grow"},[w.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Ols Shols ")])])]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," olsshols@site.com ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 6 days ago ")]),w.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[w.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[w.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),w.createTextVNode(" Inactive ")])])])])])])])])],-1)])))}}},ZT={install(n,{componentsApp:i={},menu:o=[]}){var b;gt.defaults.baseURL&&(gt.defaults.baseURL=gt.defaults.baseURL);const c=(b=Mg(o))==null?void 0:b.filter(y=>y==null?void 0:y.component).map(y=>({...y,component:i[y==null?void 0:y.component]})),{router:p}=fv(c);Object.entries({...qT,...i}).forEach(([y,h])=>{n.component(y,h)}),n.component("admin",Rb),n.config.globalProperties={...n.config.globalProperties,$componentsConfig:{...Lv,componentsApp:i},$router:p},n.use(p)}},wr=w.ref(null),WT={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(n){const i=[];return n.forEach(o=>{o.menu?i.push(...this.flattenMenu(o.menu)):i.push(o)}),i},async getFormScheme(){var c,p;const n=this.flattenMenu(wr.value);n!=null&&n.length||this.$router.replace("/404");const i=n==null?void 0:n.find(b=>{var y,h;return(b==null?void 0:b.path)==((h=(y=this.$route)==null?void 0:y.query)==null?void 0:h.table)});i||this.$router.replace("/404");const o=i==null?void 0:i.table;this.table=o;try{const{data:{form:b}}=await gt.get(`/api/template/table/${o}`),{data:{rows:y}}=await gt.get(`/api/table-data/${this.table}/${(p=(c=this.$route)==null?void 0:c.query)==null?void 0:p.id}`);this.formValues=y==null?void 0:y[0];const{data:h}=await gt.get(`/api/template/form/${b}`);this.scheme=(h==null?void 0:h.schema)||h}catch{}},async editObject(){var n,i;try{await this.$refs.form.doValidation(),await gt.put(`/api/table/${this.table}/${(i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.id}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},GT={style:{width:"calc(100vw - 260px)"}},YT={class:"h-[58px] bg-gray-50 flex items-center justify-between px-[30px]"},XT={class:"flex items-center gap-[6px]"},KT={style:{height:"calc(100vh - 120px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},JT={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function QT(n,i,o,c,p,b){const y=w.resolveComponent("VsForm");return w.openBlock(),w.createElementBlock("div",GT,[w.createElementVNode("div",YT,[i[3]||(i[3]=w.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),w.createElementVNode("div",XT,[w.createElementVNode("button",{onClick:i[0]||(i[0]=h=>n.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),w.createElementVNode("button",{onClick:i[1]||(i[1]=(...h)=>b.editObject&&b.editObject(...h)),class:"py-2 px-3 flex items-center gap-x-2 text-sm text-white font-medium rounded-lg border-none bg-blue-500 text-gray-800 shadow-sm focus:border-none focus:outline-none hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),w.createElementVNode("div",KT,[w.createElementVNode("div",JT,[p.scheme?(w.openBlock(),w.createBlock(y,{key:0,ref:"form",scheme:p.scheme,modelValue:p.formValues,"onUpdate:modelValue":i[2]||(i[2]=h=>p.formValues=h),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):w.createCommentVNode("",!0)])])])}const eC=Object.freeze(Object.defineProperty({__proto__:null,default:kt(WT,[["render",QT]])},Symbol.toStringTag,{value:"Module"})),tC={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(n){const i=[];return n.forEach(o=>{o.menu?i.push(...this.flattenMenu(o.menu)):i.push(o)}),i},async getFormScheme(){const n=this.flattenMenu(wr.value);n!=null&&n.length||this.$router.replace("/404");const i=n==null?void 0:n.find(c=>{var p,b;return(c==null?void 0:c.path)==((b=(p=this.$route)==null?void 0:p.query)==null?void 0:b.table)});i||this.$router.replace("/404");const o=i==null?void 0:i.table;this.table=o;try{const{data:{form:c}}=await gt.get(`/api/template/table/${o}`),{data:p}=await gt.get(`/api/template/form/${c}`);this.scheme=(p==null?void 0:p.schema)||p}catch{}},async createObject(){try{await this.$refs.form.doValidation(),await gt.post(`/api/table/${this.table}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},iC={style:{width:"calc(100vw - 260px)"}},nC={class:"h-[58px] bg-gray-50 flex items-center justify-between px-[30px]"},rC={class:"flex items-center gap-[6px]"},sC={style:{height:"calc(100vh - 120px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},oC={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function aC(n,i,o,c,p,b){const y=w.resolveComponent("VsForm");return w.openBlock(),w.createElementBlock("div",iC,[w.createElementVNode("div",nC,[i[3]||(i[3]=w.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),w.createElementVNode("div",rC,[w.createElementVNode("button",{onClick:i[0]||(i[0]=h=>n.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),w.createElementVNode("button",{onClick:i[1]||(i[1]=(...h)=>b.createObject&&b.createObject(...h)),class:"py-2 px-3 flex items-center gap-x-2 text-sm text-white font-medium rounded-lg border-none bg-blue-500 text-gray-800 shadow-sm focus:border-none focus:outline-none hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),w.createElementVNode("div",sC,[w.createElementVNode("div",oC,[p.scheme?(w.openBlock(),w.createBlock(y,{key:0,ref:"form",scheme:p.scheme,modelValue:p.formValues,"onUpdate:modelValue":i[2]||(i[2]=h=>p.formValues=h),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):w.createCommentVNode("",!0)])])])}const lC=Object.freeze(Object.defineProperty({__proto__:null,default:kt(tC,[["render",aC]])},Symbol.toStringTag,{value:"Module"})),cC={};function hC(n,i,o,c,p,b){const y=w.resolveComponent("router-view");return w.openBlock(),w.createBlock(y)}const S0=Object.freeze(Object.defineProperty({__proto__:null,default:kt(cC,[["render",hC]])},Symbol.toStringTag,{value:"Module"})),uC={data(){return{objectData:null,component:""}},computed:{getRoute(){const n=this.flattenMenu(wr.value);n!=null&&n.length||this.$router.replace("/404");const i=n==null?void 0:n.find(o=>{var c,p;return(o==null?void 0:o.table)==((p=(c=this.$route)==null?void 0:c.params)==null?void 0:p.table)});return i||this.$router.replace("/404"),i==null?void 0:i.path},getTitle(){var n,i,o,c,p,b,y,h,M,D,A,R,z,N;if((o=(i=(n=this.objectData)==null?void 0:n.rows)==null?void 0:i[0])!=null&&o.name)return((y=(b=(p=(c=this.objectData)==null?void 0:c.rows)==null?void 0:p[0])==null?void 0:b.name)==null?void 0:y.length)<35?(D=(M=(h=this.objectData)==null?void 0:h.rows)==null?void 0:M[0])==null?void 0:D.name:((N=(z=(R=(A=this.objectData)==null?void 0:A.rows)==null?void 0:R[0])==null?void 0:z.name)==null?void 0:N.slice(0,35))+" ..."}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(n){this.$router.replace({...this.$route,query:{tab:n}})}},methods:{async getObjectData(){var o;const{table:n,id:i}=(o=this.$route)==null?void 0:o.params;(!n||!i)&&this.$router.replace("/404");try{const{data:c}=await gt.get(`/api/table-data/${n}/${i}`);this.objectData=c}catch(c){console.error(c)}},getColClass(n){return`col-span-${n||12}`},getGridClass(){return"grid-cols-12"},checkActiveComponent(){var n,i,o,c,p,b,y;if((i=(n=this.$route)==null?void 0:n.query)!=null&&i.tab)this.component=(c=(o=this.$route)==null?void 0:o.query)==null?void 0:c.tab;else{const h=(b=(p=this.objectData)==null?void 0:p.panels)==null?void 0:b.find(M=>M==null?void 0:M.items);if((h==null?void 0:h.type)==="container")return;this.component=(y=h==null?void 0:h.items[0])==null?void 0:y.component}},flattenMenu(n){const i=[];return n.forEach(o=>{o.menu?i.push(...this.flattenMenu(o.menu)):i.push(o)}),i}}},dC={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 overflow-y-auto"},pC={class:"h-[58px] bg-gray-50 flex items-center justify-between px-[30px]"},fC={class:"flex items-center gap-[4px]"},mC={class:"text-xl font-medium text-gray-600"},gC={class:"flex items-center gap-[6px]"},yC={key:0,class:"border rounded-xl bg-white"},_C={class:"p-[10px] pl-[20px] text-xl"},xC=["innerHTML"],bC={key:1},vC={class:"p-[10px] pl-[20px] text-xl"},wC={key:0,class:"p-[20px] border-t"},kC={key:1,class:"p-[20px] border-t"},SC=["innerHTML"],EC={class:"flex space-x-1 w-[1200px] bg-white border rounded-xl h-[60px] items-center pl-[20px]"},TC=["onClick"],CC={key:0,class:"border rounded-xl bg-white mt-[20px]"},MC={class:"p-[10px] pl-[20px] text-xl"},PC={key:0,class:"p-[20px] border-t"},IC={key:1,class:"p-[20px] border-t"},AC=["innerHTML"];function DC(n,i,o,c,p,b){var h,M,D;const y=w.resolveComponent("router-link");return w.openBlock(),w.createElementBlock("div",dC,[w.createElementVNode("div",pC,[w.createElementVNode("div",fC,[w.createElementVNode("button",{onClick:i[0]||(i[0]=A=>n.$router.back()),class:"text-xl font-medium text-gray-600 hover:text-black"}," До таблиці "),i[1]||(i[1]=w.createElementVNode("span",null,"/",-1)),w.createElementVNode("h2",mC,w.toDisplayString(b.getTitle),1)]),w.createElementVNode("div",gC,[w.createVNode(y,{to:`/edit?table=${b.getRoute}&id=${(M=(h=n.$route)==null?void 0:h.params)==null?void 0:M.id}`,class:"py-2 px-3 flex items-center gap-x-2 text-sm text-white font-medium rounded-lg border-none bg-blue-500 text-gray-800 shadow-sm focus:border-none focus:outline-none hover:bg-blue-700 hover:text-white duration-300"},{default:w.withCtx(()=>i[2]||(i[2]=[w.createTextVNode(" Редагувати ")])),_:1},8,["to"])])]),w.createElementVNode("div",{class:w.normalizeClass(["grid gap-[20px]",b.getGridClass()])},[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList((D=p.objectData)==null?void 0:D.panels,(A,R)=>{var z;return w.openBlock(),w.createElementBlock("div",{key:R,class:w.normalizeClass([b.getColClass(A.col),"p-4"])},[A!=null&&A.name?(w.openBlock(),w.createElementBlock("div",yC,[w.createElementVNode("h2",_C,w.toDisplayString((A==null?void 0:A.title)||"Панель"),1),w.createElementVNode("div",{class:"p-[20px] border-t",innerHTML:(z=p.objectData)==null?void 0:z.data[A==null?void 0:A.name]},null,8,xC)])):A.type==="container"?(w.openBlock(),w.createElementBlock("div",bC,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(A.items,(N,Y)=>{var te,ae,he,be,_e;return w.openBlock(),w.createElementBlock("div",{key:Y,class:"border rounded-xl bg-white mb-[20px]"},[w.createElementVNode("h2",vC,w.toDisplayString((N==null?void 0:N.title)||"Панель"),1),N!=null&&N.component?(w.openBlock(),w.createElementBlock("div",wC,[(w.openBlock(),w.createBlock(w.resolveDynamicComponent(N.component),{geometry:(ae=(te=p.objectData)==null?void 0:te.rows[0])==null?void 0:ae.geom,zoom:16,id:(be=(he=n.$route)==null?void 0:he.params)==null?void 0:be.id},null,8,["geometry","id"]))])):w.createCommentVNode("",!0),N!=null&&N.name?(w.openBlock(),w.createElementBlock("div",kC,[w.createElementVNode("div",{innerHTML:(_e=p.objectData)==null?void 0:_e.data[N==null?void 0:N.name]},null,8,SC)])):w.createCommentVNode("",!0)])}),128))])):w.createCommentVNode("",!0),(A==null?void 0:A.type)==="tabs"?(w.openBlock(),w.createElementBlock(w.Fragment,{key:2},[w.createElementVNode("nav",EC,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(A==null?void 0:A.items,N=>(w.openBlock(),w.createElementBlock("button",{onClick:()=>p.component=(N==null?void 0:N.component)||(N==null?void 0:N.name),class:w.normalizeClass(["px-2.5 h-[30px] py-1.5 relative inline-flex items-center gap-x-2 hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm whitespace-nowrap rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 after:absolute after:-bottom-[11px] after:inset-x-2.5 after:z-10 after:h-0.5 after:pointer-events-none dark:text-neutral-500 dark:hover:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 active",{"after:absolute after:bottom-[-14px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:pointer-events-none after:bg-gray-800":p.component===(N==null?void 0:N.component)||(N==null?void 0:N.name)}])},w.toDisplayString(N==null?void 0:N.title),11,TC))),256))]),(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(A.items,(N,Y)=>{var te,ae,he,be,_e;return w.openBlock(),w.createElementBlock(w.Fragment,{key:Y},[p.component===(N==null?void 0:N.component)||N!=null&&N.name?(w.openBlock(),w.createElementBlock("div",CC,[w.createElementVNode("h2",MC,w.toDisplayString((N==null?void 0:N.title)||"Панель"),1),N!=null&&N.component?(w.openBlock(),w.createElementBlock("div",PC,[(w.openBlock(),w.createBlock(w.resolveDynamicComponent(N.component),{geometry:(ae=(te=p.objectData)==null?void 0:te.rows[0])==null?void 0:ae.geom,zoom:16,id:(be=(he=n.$route)==null?void 0:he.params)==null?void 0:be.id},null,8,["geometry","id"]))])):w.createCommentVNode("",!0),N!=null&&N.name?(w.openBlock(),w.createElementBlock("div",IC,[w.createElementVNode("div",{innerHTML:(_e=p.objectData)==null?void 0:_e.data[N==null?void 0:N.name]},null,8,AC)])):w.createCommentVNode("",!0)])):w.createCommentVNode("",!0)],64)}),128))],64)):w.createCommentVNode("",!0)],2)}),128))],2)])}const zC=Object.freeze(Object.defineProperty({__proto__:null,default:kt(uC,[["render",DC],["__scopeId","data-v-5611fa5f"]])},Symbol.toStringTag,{value:"Module"})),RC={},LC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-logout"};function OC(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",LC,i[0]||(i[0]=[w.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),w.createElementVNode("path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"},null,-1),w.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),w.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const BC=kt(RC,[["render",OC]]),FC={},NC={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function VC(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",NC,i[0]||(i[0]=[w.createStaticVNode('<path d="M218.88 96.05C223.55 99.19 228.69 101.56 234.09 103.07V145.42C212.05 151.54 195.83 171.79 195.83 195.75C195.83 200.22 196.41 204.65 197.53 208.94L160.92 230.08C156.82 226.06 152.08 222.73 146.91 220.24V171.62C164.83 163.13 176.59 145.06 176.59 124.48C176.59 123.17 176.54 121.86 176.44 120.56L218.88 96.05ZM220.32 79.09L160.97 113.36C162.04 116.88 162.61 120.61 162.61 124.48C162.61 142.66 149.93 157.87 132.93 161.76V230.05C143.4 232.46 152.23 239.16 157.46 248.21L215 214.99C211.7 209.34 209.81 202.77 209.81 195.75C209.81 174.62 226.94 157.49 248.07 157.49V91.02C237.14 91.02 227.29 86.43 220.32 79.09Z" fill="#CE3936"></path><path d="M161.39 19.13L197.44 39.94C196.39 44.11 195.84 48.42 195.84 52.75C195.84 54.21 195.9 55.65 196.02 57.1L153.9 81.42C145.27 75.5 134.95 72.24 124.36 72.24C113.83 72.24 103.57 75.47 94.96 81.32L52.71 56.93C52.82 55.55 52.88 54.16 52.88 52.76C52.88 48.43 52.34 44.12 51.28 39.95L87.3 19.16C96.98 28.89 110.26 34.58 124.34 34.58C138.42 34.57 151.7 28.87 161.39 19.13ZM157.77 0.919983C151.24 12.66 138.71 20.6 124.33 20.6C109.95 20.6 97.44 12.67 90.9 0.939983L33.9 33.85C37.08 39.43 38.91 45.88 38.91 52.76C38.91 56.71 38.31 60.52 37.2 64.11L96.46 98.32C103.44 90.87 113.36 86.22 124.37 86.22C135.44 86.22 145.41 90.93 152.39 98.44L211.59 64.27C210.45 60.64 209.83 56.78 209.83 52.77C209.83 45.89 211.65 39.44 214.84 33.86L157.77 0.919983Z" fill="#CE3936"></path><path d="M29.97 95.95L72.28 120.38C72.17 121.74 72.12 123.1 72.12 124.47C72.12 145.02 83.86 163.08 101.74 171.58V220.23C96.58 222.71 91.84 226.04 87.75 230.05L51.17 208.93C52.29 204.64 52.87 200.21 52.87 195.74C52.87 171.78 36.65 151.53 14.61 145.41V103.06C20.07 101.55 25.27 99.14 29.97 95.95ZM28.5 78.97C21.52 86.38 11.63 91.02 0.640015 91.02V157.49C21.77 157.49 38.9 174.62 38.9 195.75C38.9 202.77 37 209.33 33.71 214.99L91.2 248.18C96.43 239.14 105.25 232.45 115.71 230.04V161.73C98.74 157.81 86.09 142.62 86.09 124.46C86.09 120.54 86.68 116.75 87.78 113.18L28.5 78.97Z" fill="#CE3936"></path><path d="M498.39 177.5V144.88C498.39 128.55 485.11 115.27 468.78 115.27H343.22C342.69 115.27 342.18 115.32 341.67 115.4H337.19C332.35 115.4 328.42 111.46 328.42 106.63V74C328.42 69.16 332.36 65.23 337.19 65.23H486.33C492.08 65.23 496.75 60.57 496.75 54.81C496.75 49.06 492.08 44.39 486.33 44.39H337.19C320.86 44.39 307.58 57.67 307.58 74V106.62C307.58 122.95 320.86 136.23 337.19 136.23H462.75C463.28 136.23 463.79 136.18 464.3 136.1H468.78C473.62 136.1 477.55 140.04 477.55 144.87V177.49C477.55 182.33 473.61 186.26 468.78 186.26H319.64C313.89 186.26 309.22 190.92 309.22 196.68C309.22 202.43 313.89 207.1 319.64 207.1H468.78C485.11 207.11 498.39 193.83 498.39 177.5Z" fill="#CE3935"></path><path d="M710.7 177.32V75.24C710.7 58.91 697.42 45.63 681.09 45.63H550.05C533.72 45.63 520.44 58.91 520.44 75.24V177.32C520.44 193.65 533.72 206.93 550.05 206.93H681.1C697.42 206.93 710.7 193.65 710.7 177.32ZM541.27 75.24C541.27 70.4 545.21 66.47 550.04 66.47H681.09C685.93 66.47 689.86 70.41 689.86 75.24V177.32C689.86 182.16 685.92 186.09 681.09 186.09H550.05C545.21 186.09 541.28 182.15 541.28 177.32V75.24H541.27Z" fill="#CE3935"></path><path d="M1823 177.32V75.24C1823 58.91 1809.72 45.63 1793.39 45.63H1662.34C1646.01 45.63 1632.73 58.91 1632.73 75.24V177.32C1632.73 193.65 1646.01 206.93 1662.34 206.93H1793.39C1809.72 206.93 1823 193.65 1823 177.32ZM1653.57 75.24C1653.57 70.4 1657.51 66.47 1662.34 66.47H1793.39C1798.23 66.47 1802.16 70.41 1802.16 75.24V177.32C1802.16 182.16 1798.22 186.09 1793.39 186.09H1662.34C1657.5 186.09 1653.57 182.15 1653.57 177.32V75.24Z" fill="#CE3935"></path><path d="M756.76 196.51V152H849.42C855.17 152 859.84 147.34 859.84 141.58C859.84 135.83 855.17 131.16 849.42 131.16H756.76V75.23C756.76 70.39 760.7 66.46 765.53 66.46H893.29C899.04 66.46 903.71 61.8 903.71 56.04C903.71 50.29 899.04 45.62 893.29 45.62H765.53C749.2 45.62 735.92 58.9 735.92 75.23V196.5C735.92 202.25 740.59 206.92 746.34 206.92C752.09 206.93 756.76 202.27 756.76 196.51Z" fill="#CE3935"></path><path d="M933.86 66.47H1006.51V194.32C1006.51 200.07 1011.18 204.74 1016.93 204.74C1022.68 204.74 1027.35 200.07 1027.35 194.32V66.47H1100C1105.75 66.47 1110.42 61.81 1110.42 56.05C1110.42 50.3 1105.76 45.63 1100 45.63H933.86C928.11 45.63 923.44 50.29 923.44 56.05C923.45 61.81 928.11 66.47 933.86 66.47Z" fill="#CE3935"></path><path d="M1218.44 204.19C1224.19 204.19 1228.86 199.53 1228.86 193.77V152H1368.13C1384.46 152 1397.74 138.72 1397.74 122.39V75.24C1397.74 58.91 1384.46 45.63 1368.13 45.63H1237.63C1221.3 45.63 1208.02 58.91 1208.02 75.24V193.77C1208.02 199.53 1212.68 204.19 1218.44 204.19ZM1237.63 66.47H1368.13C1372.97 66.47 1376.9 70.41 1376.9 75.24V122.39C1376.9 127.23 1372.96 131.16 1368.13 131.16H1228.86V75.23C1228.86 70.41 1232.79 66.47 1237.63 66.47Z" fill="#CE3935"></path><path d="M1430.64 204.19C1436.39 204.19 1441.06 199.53 1441.06 193.77V152H1523.95C1524.57 153.18 1525.42 154.26 1526.51 155.17L1581.89 201.23C1583.83 202.85 1586.2 203.64 1588.55 203.64C1591.54 203.64 1594.5 202.36 1596.57 199.88C1600.25 195.46 1599.64 188.89 1595.22 185.21L1555.29 152H1580.33C1596.66 152 1609.94 138.72 1609.94 122.39V75.24C1609.94 58.91 1596.66 45.63 1580.33 45.63H1449.83C1433.5 45.63 1420.22 58.91 1420.22 75.24V193.77C1420.22 199.53 1424.88 204.19 1430.64 204.19ZM1449.83 66.47H1580.33C1585.17 66.47 1589.1 70.41 1589.1 75.24V122.39C1589.1 127.23 1585.17 131.16 1580.33 131.16H1441.06V75.23C1441.05 70.41 1444.99 66.47 1449.83 66.47Z" fill="#CE3935"></path>',10)]))}const $C=kt(FC,[["render",VC]]),jC={},UC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function HC(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",UC,i[0]||(i[0]=[w.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),w.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const qC={components:{IconChevronDown:kt(jC,[["render",HC]])},props:{route:Object},mounted(){var n,i,o;(n=this.route)!=null&&n.menu&&(o=(i=this.route)==null?void 0:i.menu)!=null&&o.some(c=>(c==null?void 0:c.path)===this.$route.path.replace("/",""))&&(this.isOpen=!0)},data(){return{isOpen:!1}}},ZC={key:0,class:""},WC={class:"ml-[30px] before:block before:absolute relative w-[180px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},GC={key:1};function YC(n,i,o,c,p,b){var M,D,A,R;const y=w.resolveComponent("IconChevronDown"),h=w.resolveComponent("router-link");return(M=o.route)!=null&&M.menu?(w.openBlock(),w.createElementBlock("div",ZC,[w.createElementVNode("button",{onClick:i[0]||(i[0]=z=>p.isOpen=!p.isOpen),class:"flex cursor-pointer gap-x-3 py-2 px-3 mb-[6px] text-sm text-gray-800 justify-start w-full border-none focus:outline-none text-gray-800 rounded-lg items-center focus:bg-gray-100 hover:bg-gray-100 duration-300"},[w.createTextVNode(w.toDisplayString((D=o.route)==null?void 0:D.ua)+" ",1),w.createVNode(y,{class:w.normalizeClass([[p.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"16",height:"16"},null,8,["class"])]),w.createVNode(w.Transition,{name:"fade"},{default:w.withCtx(()=>{var z;return[w.withDirectives(w.createElementVNode("ul",WC,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList((z=o.route)==null?void 0:z.menu,(N,Y)=>(w.openBlock(),w.createElementBlock("li",{key:Y,class:"w-full mb-[4px]"},[w.createVNode(h,{to:"/"+(N==null?void 0:N.path),class:w.normalizeClass([[(N==null?void 0:N.path)===n.$route.path.replace("/","")&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:w.withCtx(()=>[w.createTextVNode(w.toDisplayString(N==null?void 0:N.ua),1)]),_:2},1032,["to","class"])]))),128))],512),[[w.vShow,p.isOpen]])]}),_:1})])):(w.openBlock(),w.createElementBlock("div",GC,[w.createVNode(h,{to:(A=o.route)==null?void 0:A.path,class:w.normalizeClass([[((R=o.route)==null?void 0:R.path)===n.$route.path.replace("/","")&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:w.withCtx(()=>{var z;return[w.createTextVNode(w.toDisplayString((z=o.route)==null?void 0:z.ua),1)]}),_:1},8,["to","class"])]))}const XC={components:{IconLogout:BC,NavbarItem:kt(qC,[["render",YC]]),IconLogo:$C},data(){return{activeIndex:null,data:null,searchValue:""}},computed:{data(){var n,i;return(n=this.searchValue)!=null&&n.trim()?(i=this.flattenMenu(wr.value))==null?void 0:i.filter(o=>{var c,p,b;return(b=(c=o==null?void 0:o.ua)==null?void 0:c.toLowerCase())==null?void 0:b.includes((p=this.searchValue)==null?void 0:p.toLowerCase())}):wr.value}},methods:{flattenMenu(n){const i=[];return n.forEach(o=>{o.menu?i.push(...this.flattenMenu(o.menu)):i.push(o)}),i}}},KC={class:"flex flex-col h-[100vh] border-r w-[300px]"},JC={class:"p-[16px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},QC={class:"pb-3 w-full flex flex-col flex-wrap"},eM={key:0,class:"flex flex-col gap-[6px]"},tM={key:1,class:"text-gray-800 text-lg mt-[20px]"};function iM(n,i,o,c,p,b){var M;const y=w.resolveComponent("IconLogo"),h=w.resolveComponent("NavbarItem");return w.openBlock(),w.createElementBlock("div",KC,[w.createVNode(y,{height:"40",width:"200",class:"my-[20px] ml-[20px]"}),w.withDirectives(w.createElementVNode("input",{type:"text","onUpdate:modelValue":i[0]||(i[0]=D=>p.searchValue=D),placeholder:"Пошук по меню",class:"h-[40px] block rounded-lg border mx-[10px] pl-[10px] focus:border-blue-600 focus:border-[2px] outline-none"},null,512),[[w.vModelText,p.searchValue]]),w.createElementVNode("div",JC,[w.createElementVNode("nav",QC,[(M=b.data)!=null&&M.length?(w.openBlock(),w.createElementBlock("ul",eM,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(b.data,(D,A)=>(w.openBlock(),w.createElementBlock("li",{key:A},[w.createVNode(h,{route:D},null,8,["route"])]))),128))])):(w.openBlock(),w.createElementBlock("div",tM,"Не знайдено"))])])])}const nM=kt(XC,[["render",iM]]),rM={},sM={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function oM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",sM,i[0]||(i[0]=[w.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),w.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),w.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const aM=kt(rM,[["render",oM]]),lM={},cM={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function hM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",cM,i[0]||(i[0]=[w.createElementVNode("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"},null,-1),w.createElementVNode("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"},null,-1)]))}const uM={components:{IconQuestion:aM,IconMessage:kt(lM,[["render",hM]])}},dM={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},pM={class:"flex items-center gap-[6px]"},fM={href:"docs-softpro.com",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},mM={class:"hs-tooltip [--placement:bottom] inline-block show"},gM={class:"hs-tooltip-toggle relative size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100"};function yM(n,i,o,c,p,b){const y=w.resolveComponent("IconQuestion"),h=w.resolveComponent("IconMessage");return w.openBlock(),w.createElementBlock("div",dM,[w.createElementVNode("div",pM,[w.createElementVNode("a",fM,[w.createVNode(y,{height:"24",width:"24"})]),w.createElementVNode("div",mM,[w.createElementVNode("button",gM,[w.createVNode(h,{height:"24",width:"24"}),i[0]||(i[0]=w.createElementVNode("span",{class:"flex absolute top-0 end-0 z-10 -mt-1.5 -me-1.5"},[w.createElementVNode("span",{class:"animate-ping absolute inline-flex size-full rounded-full bg-red-400 opacity-75 dark:bg-red-600"}),w.createElementVNode("span",{class:"relative min-w-[18px] min-h-[18px] inline-flex justify-center items-center text-[10px] bg-red-500 text-white rounded-full px-1"}," 1 ")],-1))]),i[1]||(i[1]=w.createElementVNode("span",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded-lg dark:bg-neutral-700 hidden",role:"tooltip","data-popper-placement":"bottom",style:{position:"fixed",inset:"0px auto auto 0px",margin:"0px",transform:"translate(1686px, 53px)"}},null,-1))]),i[2]||(i[2]=w.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),i[3]||(i[3]=w.createElementVNode("img",{class:"flex-shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Image Description"},null,-1))])])}const _M={components:{navbar:nM,AdminHeader:kt(uM,[["render",yM]])},mounted(){this.getMenu()},computed:{isMenu(){return wr.value}},methods:{async getMenu(){try{const{data:n}=await gt.get("/api/user-menu");wr.value=n}catch{}}}},xM={class:"admin-wrapper"},bM={class:"flex flex-col"};function vM(n,i,o,c,p,b){const y=w.resolveComponent("navbar"),h=w.resolveComponent("admin-header"),M=w.resolveComponent("router-view");return w.openBlock(),w.createElementBlock("div",xM,[w.createVNode(y),w.createElementVNode("div",bM,[b.isMenu?(w.openBlock(),w.createElementBlock(w.Fragment,{key:0},[w.createVNode(h),w.createVNode(M)],64)):w.createCommentVNode("",!0)])])}const wM=Object.freeze(Object.defineProperty({__proto__:null,default:kt(_M,[["render",vM],["__scopeId","data-v-3d7ecdff"]])},Symbol.toStringTag,{value:"Module"})),kM={},SM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-adjustments-horizontal"};function EM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",SM,i[0]||(i[0]=[w.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M4 6l8 0"></path><path d="M16 6l4 0"></path><path d="M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M4 12l2 0"></path><path d="M10 12l10 0"></path><path d="M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M4 18l11 0"></path><path d="M19 18l1 0"></path>',10)]))}const TM=kt(kM,[["render",EM]]),CM={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var n,i;return((n=this.data)==null?void 0:n.ua)||((i=this.data)==null?void 0:i.label)||this.data.title||"null"},selectedSortParam(){var n,i;return(i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(n){n!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(n){switch(n){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(n){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(n);const i=this.$route.query,{sort:o,...c}=i,p=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...c,...p&&{sort:p}}})},isValueEqualToSelected(n){return`${this.data.name}-${n}`===this.selectedSortParam}}},MM={scope:"col",class:"min-w-[200px] max-w-[300px] text-start"},PM={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},IM={key:0,d:"m7 15 5 5 5-5"},AM={key:1,d:"m7 9 5-5 5 5"},DM={key:1,class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500"};function zM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("th",MM,[b.getVisibleIcon?(w.openBlock(),w.createElementBlock("button",{key:0,type:"button",class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500 flex items-center gap-[6px]",onClick:i[0]||(i[0]=y=>b.handleClickSortBtn(p.currentSort))},[w.createTextVNode(w.toDisplayString(b.label)+" ",1),(w.openBlock(),w.createElementBlock("svg",PM,[p.currentSort==="asc"||p.currentSort===""?(w.openBlock(),w.createElementBlock("path",IM)):w.createCommentVNode("",!0),p.currentSort==="desc"||p.currentSort===""?(w.openBlock(),w.createElementBlock("path",AM)):w.createCommentVNode("",!0)]))])):(w.openBlock(),w.createElementBlock("p",DM,w.toDisplayString(b.label),1))])}const RM=kt(CM,[["render",zM]]),LM={},OM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function BM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",OM,i[0]||(i[0]=[w.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),w.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),w.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),w.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)]))}const FM=kt(LM,[["render",BM]]),NM={},VM={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function $M(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",VM,i[0]||(i[0]=[w.createStaticVNode('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>',5)]))}const jM=kt(NM,[["render",$M]]),UM={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},HM={style:{display:"none"}},qM=["height","width","fill"];function ZM(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock(w.Fragment,null,[(w.openBlock(),w.createElementBlock("svg",HM,i[0]||(i[0]=[w.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[w.createElementVNode("path",{d:"M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z"})],-1)]))),(w.openBlock(),w.createElementBlock("svg",{height:o.height,width:o.width,fill:o.color},i[1]||(i[1]=[w.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,qM))],64)}const WM={components:{IconMore:FM,IconDelete:jM,IconEdit:kt(UM,[["render",ZM]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var n;try{const{data:i}=await gt.get(`/api/table/${this.table}/${(n=this.item)==null?void 0:n.id}`);this.formValue=i}catch(i){console.error(i)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var n;try{gt.delete(`/api/table/${this.table}/${(n=this.item)==null?void 0:n.id}`),this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table"),this.isDeleteConfirm=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},GM={class:"hs-dropdown [--placement:bottom-right] inline-flex"},YM={id:"hs-pro-dupc1",type:"button",class:"gap-x-2 p-2 rounded-lg hover:border-transparent focus:outline-none text-black hover:bg-gray-50"},XM={class:"pt-[7px] pb-[7px] flex flex-col items-start"},KM={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto mt-[10px] mb-[10px]"},JM={class:"p-4"},QM={class:"mt-4 flex justify-end gap-x-3"};function eP(n,i,o,c,p,b){const y=w.resolveComponent("IconMore"),h=w.resolveComponent("IconEdit"),M=w.resolveComponent("router-link"),D=w.resolveComponent("IconDelete"),A=w.resolveComponent("VsPopover"),R=w.resolveComponent("VsDialog");return w.openBlock(),w.createElementBlock(w.Fragment,null,[w.createElementVNode("div",GM,[w.createVNode(A,{trigger:"click",placement:"left"},{reference:w.withCtx(()=>[w.createElementVNode("button",YM,[w.createVNode(y,{height:"16",width:"16"})])]),default:w.withCtx(()=>{var z,N,Y;return[w.createElementVNode("div",XM,[o.isForm?(w.openBlock(),w.createBlock(M,{key:0,to:`/edit?table=${(N=(z=n.$route)==null?void 0:z.params)==null?void 0:N.catchAll}&id=${(Y=o.item)==null?void 0:Y.id}`,class:"w-[100px] ml-[2px] flex items-center justify-center gap-x-3 rounded-lg text-[13px] text-gray-800"},{default:w.withCtx(()=>[w.createVNode(h,{color:"#000"}),i[4]||(i[4]=w.createTextVNode(" Редагувати "))]),_:1},8,["to"])):w.createCommentVNode("",!0),o.isForm?(w.openBlock(),w.createElementBlock("div",KM)):w.createCommentVNode("",!0),w.createElementVNode("button",{onClick:i[0]||(i[0]=w.withModifiers((...te)=>b.openConfirm&&b.openConfirm(...te),["stop"])),type:"button",class:"w-[100px] flex items-center justify-center gap-x-3 rounded-lg text-[14px] text-red-500"},[w.createVNode(D),i[5]||(i[5]=w.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])])]}),_:1})]),w.createVNode(R,{visible:p.isDeleteConfirm,"onUpdate:visible":i[3]||(i[3]=z=>p.isDeleteConfirm=z),title:"Ви впевнені?"},{default:w.withCtx(()=>[w.createElementVNode("div",JM,[i[6]||(i[6]=w.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),w.createElementVNode("div",QM,[w.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:i[1]||(i[1]=z=>p.isDeleteConfirm=!1)}," Скасувати "),w.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:i[2]||(i[2]=(...z)=>b.deleteElement&&b.deleteElement(...z))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const tP=kt(WM,[["render",eP]]),iP={},nP={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function rP(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",nP,i[0]||(i[0]=[w.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),w.createElementVNode("path",{d:"M7 20V4"},null,-1),w.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),w.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const sP=kt(iP,[["render",rP]]),oP={props:{columns:{type:Object,default:()=>{}},table:{type:String,default:()=>""}},data(){return{tableFormats:["json","csv","xlsx"],format:"",cols:[]}},methods:{async exportTable(){try{const n=await gt.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(",")},responseType:"blob"}),i=new Blob([n.data],{type:"application/octet-stream"}),o=window.URL.createObjectURL(i),c=document.createElement("a");c.href=o,c.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(o),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"})}catch(n){console.error("Ошибка при экспорте файла:",n),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(n){this.format=n}}},aP={class:"p-4"},lP={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},cP={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},hP={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},uP={class:"mt-2 space-y-2"},dP=["id","onChange"],pP=["for"],fP={class:"pb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},mP={class:"text-center"};function gP(n,i,o,c,p,b){const y=w.resolveComponent("VsCheckbox");return w.openBlock(),w.createElementBlock(w.Fragment,null,[i[4]||(i[4]=w.createElementVNode("div",{class:"dark:border-neutral-700"},null,-1)),w.createElementVNode("div",aP,[w.createElementVNode("div",lP,[i[2]||(i[2]=w.createElementVNode("label",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Виберіть стовпці таблиці для експорту: ",-1)),w.createElementVNode("div",cP,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(o.columns,(h,M)=>(w.openBlock(),w.createElementBlock("div",{class:"flex items-center",key:M,style:{width:"calc((100% - 10px) / 2)"}},[w.createVNode(y,{class:"py-0 shrink-0 border-gray-300 rounded text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",modelValue:p.cols,"onUpdate:modelValue":i[0]||(i[0]=D=>p.cols=D),value:h==null?void 0:h.name,label:h==null?void 0:h.ua},null,8,["modelValue","value","label"])]))),128))])]),w.createElementVNode("div",hP,[i[3]||(i[3]=w.createElementVNode("label",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Виберіть формат таблиці: ",-1)),w.createElementVNode("div",uP,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(p.tableFormats,(h,M)=>(w.openBlock(),w.createElementBlock("div",{class:"flex items-center",key:M},[w.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"shrink-0 border-gray-300 rounded-full text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",id:h,onChange:D=>b.selectFormat(h)},null,40,dP),w.createElementVNode("label",{for:h,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+w.toDisplayString(h),9,pP)]))),128))])]),w.createElementVNode("div",fP,[w.createElementVNode("div",mP,[w.createElementVNode("button",{type:"button",class:"p-2 inline-flex items-center gap-x-2 text-xs font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500",onClick:i[1]||(i[1]=(...h)=>b.exportTable&&b.exportTable(...h))}," Завантажити таблицю ")])])])],64)}const yP={components:{IconExport:sP,AdminTableExportForm:kt(oP,[["render",gP]])},props:{table:String,columns:Array},data(){return{isOpen:!1}}};function _P(n,i,o,c,p,b){const y=w.resolveComponent("IconExport"),h=w.resolveComponent("AdminTableExportForm"),M=w.resolveComponent("VsDialog");return w.openBlock(),w.createElementBlock(w.Fragment,null,[w.createElementVNode("button",{onClick:i[0]||(i[0]=D=>p.isOpen=!0),class:"py-2 px-3 relative flex items-center gap-x-2 text-sm border focus:outline-none border-gray-100 font-medium rounded-lg text-gray-800 hover:border-gray-100 focus:border-gray-100 hover:bg-gray-50 shadow-sm duration-300"},[w.createVNode(y,{height:"16",width:"16"}),i[2]||(i[2]=w.createTextVNode(" Експорт "))]),w.createVNode(M,{visible:p.isOpen,"onUpdate:visible":i[1]||(i[1]=D=>p.isOpen=D),title:"Експорт таблиці"},{default:w.withCtx(()=>[w.createVNode(h,{table:o.table,columns:o.columns},null,8,["table","columns"])]),_:1},8,["visible"])],64)}const xP=kt(yP,[["render",_P]]),bP={},vP={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-columns"};function wP(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("svg",vP,i[0]||(i[0]=[w.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l5.5 0"></path><path d="M4 10l5.5 0"></path><path d="M4 14l5.5 0"></path><path d="M4 18l5.5 0"></path><path d="M14.5 6l5.5 0"></path><path d="M14.5 10l5.5 0"></path><path d="M14.5 14l5.5 0"></path><path d="M14.5 18l5.5 0"></path>',9)]))}const kP=kt(bP,[["render",wP]]),SP={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(n){this.$emit("update-column",{...this.column,hidden:!n})}},mounted(){var n;((n=this.column)==null?void 0:n.hidden)!==!0&&(this.value=!0)}},EP={class:"flex w-full gap-[8px] items-centr"};function TP(n,i,o,c,p,b){var y,h;return w.openBlock(),w.createElementBlock("label",EP,[w.withDirectives(w.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=M=>p.value=M),type:"checkbox"},null,512),[[w.vModelCheckbox,p.value]]),w.createTextVNode(" "+w.toDisplayString(((y=o.column)==null?void 0:y.ua)||((h=o.column)==null?void 0:h.title)),1)])}const CP={components:{IconColumns:kP,AdminTableColumnsHiddenItem:kt(SP,[["render",TP]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(n){const i=this.columns.findIndex(c=>(c==null?void 0:c.name)===(n==null?void 0:n.name)),o=this.columns;o[i]=n,this.$emit("update-columns",[...o])}}},MP={class:"py-2 px-3 flex items-center gap-x-2 text-sm border focus:outline-none border-gray-100 font-medium rounded-lg text-gray-800 hover:border-gray-100 focus:border-gray-100 hover:bg-gray-50 shadow-sm duration-300"},PP={class:"flex flex-col gap-[3px] h-[400px] w-[300px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function IP(n,i,o,c,p,b){const y=w.resolveComponent("IconColumns"),h=w.resolveComponent("AdminTableColumnsHiddenItem"),M=w.resolveComponent("VsPopover");return w.openBlock(),w.createBlock(M,{trigger:"click",placement:"bottom"},{reference:w.withCtx(()=>[w.createElementVNode("button",MP,[w.createVNode(y,{height:"20",width:"16"})])]),default:w.withCtx(()=>[w.createElementVNode("div",null,[i[0]||(i[0]=w.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),w.createElementVNode("ul",PP,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(o.columns,(D,A)=>(w.openBlock(),w.createElementBlock("li",{key:A},[w.createVNode(h,{column:D,onUpdateColumn:b.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const AP=kt(CP,[["render",IP]]),DP={},zP={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function RP(n,i,o,c,p,b){return w.openBlock(),w.createElementBlock("div",zP,i[0]||(i[0]=[w.createStaticVNode('<div><div class="p-5 min-h-[500px] flex flex-col justify-center items-center text-center"><svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg><div class="max-w-sm mx-auto mt-6"><p class="font-medium text-gray-800 dark:text-neutral-200"> Дані для відображення відсутні </p><p class="mt-2 text-sm text-gray-500 dark:text-neutral-500"> Змініть параметри пошуку або спробуйте пізніше </p></div></div></div>',1)]))}const LP={props:{table:String},components:{IconFilter:TM,AdminTableControl:tP,AdminTableExport:xP,AdminTableColumnsHidden:AP,AdminTableColumn:RM,AdminNodata:kt(DP,[["render",RP]])},data(){return{tableData:{},isFilters:!1,filterScheme:[],page:1,searchValue:"",limit:20,filters:null,activeColumn:""}},mounted(){var n,i;this.page=((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.page)||1,this.getTableData(),this.getFilters()},computed:{defaultPage(){var n,i;return((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.page)||1},getFilterScheme(){var n;return(n=this.tableData)==null?void 0:n.filters},columns(){var n,i;return(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.filter(o=>(o==null?void 0:o.hidden)!==!0)},isForm(){var n;return(n=this.tableData)==null?void 0:n.form},isNoData(){var n,i;return!((n=this.tableData)!=null&&n.rows)||!((i=this.columns)!=null&&i.length)}},watch:{async table(){await this.getTableData()},searchValue(){this.getTableData()},$route:{handler(n,i){var o,c;((o=n==null?void 0:n.params)==null?void 0:o.catchAll)!==((c=i==null?void 0:i.params)==null?void 0:c.catchAll)&&(this.filterScheme=null,this.getFilters())},deep:!0}},methods:{async getTableData(){var n,i;try{const{data:o}=await gt.get(`/api/template/table/${this.table}`),c=await gt.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.sort)||null}});this.tableData={...o,...(c==null?void 0:c.data)||{}}}catch{}},async getFilters(){var n;try{const{data:i}=await gt.get(`/api/table-filter/${this.table}`);this.filterScheme=(n=i==null?void 0:i.list)==null?void 0:n.map(o=>({...o,label:(o==null?void 0:o.label)||(o==null?void 0:o.ua)}))}catch{}},async handlePageChange(n){const i=this.$route.query;this.page=n,!(!(i!=null&&i.page)&&n===1||i.page===n)&&(await this.$router.replace({query:{...i,page:n}}),await this.getTableData())},async changeLimit(n){this.limit=await n,this.defaultPage=1,await this.getTableData()},closeFilter({target:n}){this.isFilters&&n.classList.contains("filter-container")&&(this.isFilters=!1)},async filterChange({url:n}){this.filters=n,this.page=1,await this.getTableData()},changeActiveColumn(n){this.activeColumn=n,this.getTableData()}}},OP={class:"w-[calc(100vw - 320px)]"},BP={class:"h-[58px] bg-gray-50 flex items-center justify-between px-[30px]"},FP={class:"text-xl font-medium"},NP={style:{height:"calc(100vh - 120px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},VP={class:"bg-white w-full rounded-xl border p-[20px]"},$P={class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px]"},jP={class:"flex gap-[6px] ml-auto"},UP={class:"space-y-5 flex items-start w-full justify-start"},HP={style:{height:"calc(100vh - 310px)"},class:"overflow-x-auto w-full border-t [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},qP={class:"inline-block w-full align-middle"},ZP={key:0,class:"divide-y divide-gray-200 min-w-full dark:divide-neutral-700 relative table-fixed"},WP={class:"sticky top-0 bg-white w-full relative after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},GP={class:"border-stone-200 right-0 z-[1]"},YP={class:"divide-y divide-gray-200"},XP={class:"min-w-[200px] text-start pe-4 py-3 text-sm text-gray-600"},KP={class:"text-center sticky right-0 bg-white w-[80px] px-[10px]"},JP={class:"p-[20px] flex justify-end w-full"},QP={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-[rgba(0,0,0,0.5)] [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function eI(n,i,o,c,p,b){var te,ae,he,be,_e,Ie,ot;const y=w.resolveComponent("router-link"),h=w.resolveComponent("AdminTableColumnsHidden"),M=w.resolveComponent("AdminTableExport"),D=w.resolveComponent("IconFilter"),A=w.resolveComponent("AdminTableColumn"),R=w.resolveComponent("AdminTableControl"),z=w.resolveComponent("AdminNodata"),N=w.resolveComponent("VsPagination"),Y=w.resolveComponent("VsFilter");return w.openBlock(),w.createElementBlock(w.Fragment,null,[w.createElementVNode("div",OP,[w.createElementVNode("div",BP,[w.createElementVNode("h2",FP,w.toDisplayString((te=p.tableData)==null?void 0:te.title),1),b.isForm?(w.openBlock(),w.createBlock(y,{key:0,to:`/add?table=${(he=(ae=n.$route)==null?void 0:ae.params)==null?void 0:he.catchAll}`,class:"py-2 px-3 flex items-center gap-x-2 text-sm text-white font-medium rounded-lg bg-blue-500 text-gray-800 shadow-sm hover:bg-blue-700 hover:text-white duration-300"},{default:w.withCtx(()=>i[5]||(i[5]=[w.createTextVNode(" Додати ")])),_:1},8,["to"])):w.createCommentVNode("",!0)]),w.createElementVNode("div",NP,[w.createElementVNode("div",VP,[w.createElementVNode("div",$P,[w.withDirectives(w.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=Qe=>p.searchValue=Qe),class:"py-2 pl-[15px] h-[38px] w-[400px] block w-full border rounded-lg text-sm focus:border-blue-600 focus:border-[2px] outline-none",placeholder:"Пошук..."},null,512),[[w.vModelText,p.searchValue]]),w.createElementVNode("div",jP,[w.createVNode(h,{columns:(be=p.tableData)==null?void 0:be.columns,onUpdateColumns:i[1]||(i[1]=Qe=>p.tableData.columns=Qe)},null,8,["columns"]),w.createVNode(M,{table:o.table,columns:(_e=p.tableData)==null?void 0:_e.columns},null,8,["table","columns"]),w.createElementVNode("button",{onClick:i[2]||(i[2]=Qe=>p.isFilters=!p.isFilters),class:"py-2 px-3 flex items-center gap-x-2 text-sm border focus:outline-none border-gray-100 font-medium rounded-lg text-gray-800 hover:border-gray-100 focus:border-gray-100 hover:bg-gray-50 shadow-sm duration-300"},[w.createVNode(D,{height:"16",width:"16"}),i[6]||(i[6]=w.createTextVNode(" Фільтри "))])])]),w.createElementVNode("div",UP,[w.createElementVNode("div",HP,[w.createElementVNode("div",qP,[b.isNoData?(w.openBlock(),w.createBlock(z,{key:1})):(w.openBlock(),w.createElementBlock("table",ZP,[w.createElementVNode("thead",WP,[w.createElementVNode("tr",GP,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList(b.columns,Qe=>(w.openBlock(),w.createBlock(A,{key:Qe.name,data:Qe,activeColumn:p.activeColumn,onChangeActive:b.changeActiveColumn},null,8,["data","activeColumn","onChangeActive"]))),128)),i[7]||(i[7]=w.createElementVNode("th",{class:"w-[70px] sticky right-0 top-0 bg-white"},null,-1))])]),w.createElementVNode("tbody",YP,[(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList((Ie=p.tableData)==null?void 0:Ie.rows,(Qe,Be)=>{var St;return w.openBlock(),w.createElementBlock("tr",{key:Be},[w.createElementVNode("td",XP,[w.createVNode(y,{to:`/card/${o.table}/${Qe==null?void 0:Qe.id}`,class:"text-sm text-green-600 decoration-2 hover:underline font-medium focus:outline-none focus:underline hover:text-green-600"},{default:w.withCtx(()=>{var rt;return[w.createTextVNode(w.toDisplayString(Qe==null?void 0:Qe[(rt=b.columns[0])==null?void 0:rt.name]),1)]}),_:2},1032,["to"])]),(w.openBlock(!0),w.createElementBlock(w.Fragment,null,w.renderList((St=b.columns)==null?void 0:St.slice(1),rt=>{var Dt;return w.openBlock(),w.createElementBlock("td",{class:"min-w-[300px] w-full text-start px-[4px] py-3 text-sm text-gray-600",key:rt.name},[(w.openBlock(),w.createBlock(w.resolveDynamicComponent((rt==null?void 0:rt.format)==="custom"?rt==null?void 0:rt.component:n.$componentsConfig[`table-format-${((Dt=rt==null?void 0:rt.format)==null?void 0:Dt.toLowerCase())||n.text}`]),{name:rt==null?void 0:rt.name,data:Qe,value:Qe==null?void 0:Qe[rt==null?void 0:rt.name]},null,8,["name","data","value"]))])}),128)),w.createElementVNode("td",KP,[w.createVNode(R,{isForm:b.isForm,item:Qe,table:o.table,onUpdateTable:b.getTableData},null,8,["isForm","item","table","onUpdateTable"])])])}),128))])]))])])]),w.createElementVNode("div",JP,[w.createVNode(N,{goTo:!1,class:"justify-end","default-page":b.defaultPage,total:((ot=p.tableData)==null?void 0:ot.total)||0,pageSize:p.limit,onPageChange:b.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:b.changeLimit},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])])])])]),w.createVNode(w.Transition,{name:"fade"},{default:w.withCtx(()=>{var Qe;return[w.withDirectives(w.createElementVNode("div",{onClick:i[4]||(i[4]=(...Be)=>b.closeFilter&&b.closeFilter(...Be)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.5)]"},[w.createElementVNode("div",QP,[(Qe=p.filterScheme)!=null&&Qe.length?(w.openBlock(),w.createBlock(Y,{key:0,ref:"filter",scheme:p.filterScheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:b.filterChange,closeFilterBtn:!0,onFilterClose:i[3]||(i[3]=Be=>p.isFilters=!1)},null,8,["scheme","onFilterChange"])):w.createCommentVNode("",!0)])],512),[[w.vShow,p.isFilters]])]}),_:1})],64)}const tI={components:{AdminTable:kt(LP,[["render",eI]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){wr!=null&&wr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(n){n&&(document.title=n)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(n){const i=[];return n.forEach(o=>{o.menu?i.push(...this.flattenMenu(o.menu)):i.push(o)}),i},async getMenu(){try{const{data:n}=await gt.get("/api/user-menu");wr.value=n}catch{}},async checkPageType(){const n=this.flattenMenu(wr.value);n!=null&&n.length||this.$router.replace("/404");const i=n==null?void 0:n.find(c=>{var p,b;return(c==null?void 0:c.path)==((b=(p=this.$route)==null?void 0:p.params)==null?void 0:b.catchAll)});this.title=i==null?void 0:i.ua,i||this.$router.replace("/404");const o=i==null?void 0:i.table;this.table=o||!1,!o&&this.getInterface()},async getInterface(){var n,i;try{const{data:o}=await gt.get(`/api/template/interface/${((i=(n=this.$route)==null?void 0:n.params)==null?void 0:i.catchAll)||""}`);this.interface=o||""}catch{this.interface=""}}}},iI=["innerHTML"];function nI(n,i,o,c,p,b){const y=w.resolveComponent("AdminTable");return p.table?(w.openBlock(),w.createBlock(y,{key:0,table:p.table},null,8,["table"])):(w.openBlock(),w.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:p.interface},null,8,iI))}const rI=Object.freeze(Object.defineProperty({__proto__:null,default:kt(tI,[["render",nI]])},Symbol.toStringTag,{value:"Module"}));return ZT});