@opengis/admin 0.2.10 → 0.2.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,7 +33,7 @@ Use slot props instead:
33
33
  - Location:`,Ce),W({});let Ke;if(Ce.path!=null)process.env.NODE_ENV!=="production"&&"params"in Ce&&!("name"in Ce)&&Object.keys(Ce.params).length&&nn(`Path "${Ce.path}" was passed with params but they will be ignored. Use a named route alongside params instead.`),Ke=Sn({},Ce,{path:xg(n,Ce.path,He.path).path});else{const Mt=Sn({},Ce.params);for(const rn in Mt)Mt[rn]==null&&delete Mt[rn];Ke=Sn({},Ce,{params:E(Mt)}),He.params=E(He.params)}const Be=e.resolve(Ke,He),Rt=Ce.hash||"";process.env.NODE_ENV!=="production"&&Rt&&!Rt.startsWith("#")&&nn(`A \`hash\` should always start with the character "#". Replace "${Rt}" with "#${Rt}".`),Be.params=w(C(Be.params));const Qt=EM(i,Sn({},Ce,{hash:bM(Rt),path:Be.path})),At=r.createHref(Qt);return process.env.NODE_ENV!=="production"&&(At.startsWith("//")?nn(`Location "${Ce}" resolved to "${At}". A resolved location cannot start with multiple slashes.`):Be.matched.length||nn(`No match found for location with path "${Ce.path!=null?Ce.path:Ce}"`)),Sn({fullPath:Qt,hash:Rt,query:i===Ox?oA(Ce.query):Ce.query||{}},Be,{redirectedFrom:void 0,href:At})}function te(Ce){return typeof Ce=="string"?xg(n,Ce,g.value.path):Sn({},Ce)}function G(Ce,He){if(b!==Ce)return mc(8,{from:He,to:Ce})}function Q(Ce){return Se(Ce)}function Ie(Ce){return Q(Sn(te(Ce),{replace:!0}))}function ve(Ce){const He=Ce.matched[Ce.matched.length-1];if(He&&He.redirect){const{redirect:Ke}=He;let Be=typeof Ke=="function"?Ke(Ce):Ke;if(typeof Be=="string"&&(Be=Be.includes("?")||Be.includes("#")?Be=te(Be):{path:Be},Be.params={}),process.env.NODE_ENV!=="production"&&Be.path==null&&!("name"in Be))throw nn(`Invalid redirect found:
34
34
  ${JSON.stringify(Be,null,2)}
35
35
  when navigating to "${Ce.fullPath}". A redirect must contain a name or path. This will break in production.`),new Error("Invalid redirect");return Sn({query:Ce.query,hash:Ce.hash,params:Be.path!=null?{}:Ce.params},Be)}}function Se(Ce,He){const Ke=b=W(Ce),Be=g.value,Rt=Ce.state,Qt=Ce.force,At=Ce.replace===!0,Mt=ve(Ke);if(Mt)return Se(Sn(te(Mt),{state:typeof Mt=="object"?Sn({},Rt,Mt.state):Rt,force:Qt,replace:At}),He||Ke);const rn=Ke;rn.redirectedFrom=He;let we;return!Qt&&yx(i,Be,Ke)&&(we=mc(16,{to:rn,from:Be}),vn(Be,Be,!0,!1)),(we?Promise.resolve(we):$e(rn,Be)).catch(yn=>vs(yn)?vs(yn,2)?yn:dn(yn):Ht(yn,rn,Be)).then(yn=>{if(yn){if(vs(yn,2))return process.env.NODE_ENV!=="production"&&yx(i,W(yn.to),rn)&&He&&(He._count=He._count?He._count+1:1)>30?(nn(`Detected a possibly infinite redirection in a navigation guard when going from "${Be.fullPath}" to "${rn.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"))):Se(Sn({replace:At},te(yn.to),{state:typeof yn.to=="object"?Sn({},Rt,yn.to.state):Rt,force:Qt}),He||rn)}else yn=Pt(rn,Be,!0,At,Rt);return Xe(rn,Be,yn),yn})}function Ne(Ce,He){const Ke=G(Ce,He);return Ke?Promise.reject(Ke):Promise.resolve()}function Ae(Ce){const He=Nn.values().next().value;return He&&typeof He.runWithContext=="function"?He.runWithContext(Ce):Ce()}function $e(Ce,He){let Ke;const[Be,Rt,Qt]=CA(Ce,He);Ke=Cg(Be.reverse(),"beforeRouteLeave",Ce,He);for(const Mt of Be)Mt.leaveGuards.forEach(rn=>{Ke.push(aa(rn,Ce,He))});const At=Ne.bind(null,Ce,He);return Ke.push(At),Ln(Ke).then(()=>{Ke=[];for(const Mt of a.list())Ke.push(aa(Mt,Ce,He));return Ke.push(At),Ln(Ke)}).then(()=>{Ke=Cg(Rt,"beforeRouteUpdate",Ce,He);for(const Mt of Rt)Mt.updateGuards.forEach(rn=>{Ke.push(aa(rn,Ce,He))});return Ke.push(At),Ln(Ke)}).then(()=>{Ke=[];for(const Mt of Qt)if(Mt.beforeEnter)if(qr(Mt.beforeEnter))for(const rn of Mt.beforeEnter)Ke.push(aa(rn,Ce,He));else Ke.push(aa(Mt.beforeEnter,Ce,He));return Ke.push(At),Ln(Ke)}).then(()=>(Ce.matched.forEach(Mt=>Mt.enterCallbacks={}),Ke=Cg(Qt,"beforeRouteEnter",Ce,He,Ae),Ke.push(At),Ln(Ke))).then(()=>{Ke=[];for(const Mt of u.list())Ke.push(aa(Mt,Ce,He));return Ke.push(At),Ln(Ke)}).catch(Mt=>vs(Mt,8)?Mt:Promise.reject(Mt))}function Xe(Ce,He,Ke){l.list().forEach(Be=>Ae(()=>Be(Ce,He,Ke)))}function Pt(Ce,He,Ke,Be,Rt){const Qt=G(Ce,He);if(Qt)return Qt;const At=He===sa,Mt=xs?history.state:{};Ke&&(Be||At?r.replace(Ce.fullPath,Sn({scroll:At&&Mt&&Mt.scroll},Rt)):r.push(Ce.fullPath,Rt)),g.value=Ce,vn(Ce,He,Ke,At),dn()}let st;function Tt(){st||(st=r.listen((Ce,He,Ke)=>{if(!Pn.listening)return;const Be=W(Ce),Rt=ve(Be);if(Rt){Se(Sn(Rt,{replace:!0}),Be).catch(Qu);return}b=Be;const Qt=g.value;xs&&OM(xx(Qt.fullPath,Ke.delta),dp()),$e(Be,Qt).catch(At=>vs(At,12)?At:vs(At,2)?(Se(At.to,Be).then(Mt=>{vs(Mt,20)&&!Ke.delta&&Ke.type===eh.pop&&r.go(-1,!1)}).catch(Qu),Promise.reject()):(Ke.delta&&r.go(-Ke.delta,!1),Ht(At,Be,Qt))).then(At=>{At=At||Pt(Be,Qt,!1),At&&(Ke.delta&&!vs(At,8)?r.go(-Ke.delta,!1):Ke.type===eh.pop&&vs(At,20)&&r.go(-1,!1)),Xe(Be,Qt,At)}).catch(Qu)}))}let Nt=nh(),Vt=nh(),Ft;function Ht(Ce,He,Ke){dn(Ce);const Be=Vt.list();return Be.length?Be.forEach(Rt=>Rt(Ce,He,Ke)):(process.env.NODE_ENV!=="production"&&nn("uncaught error during route navigation:"),console.error(Ce)),Promise.reject(Ce)}function Cn(){return Ft&&g.value!==sa?Promise.resolve():new Promise((Ce,He)=>{Nt.add([Ce,He])})}function dn(Ce){return Ft||(Ft=!Ce,Tt(),Nt.list().forEach(([He,Ke])=>Ce?Ke(Ce):He()),Nt.reset()),Ce}function vn(Ce,He,Ke,Be){const{scrollBehavior:Rt}=t;if(!xs||!Rt)return Promise.resolve();const Qt=!Ke&&BM(xx(Ce.fullPath,0))||(Be||!Ke)&&history.state&&history.state.scroll||null;return f.nextTick().then(()=>Rt(Ce,He,Qt)).then(At=>At&&DM(At)).catch(At=>Ht(At,Ce,He))}const pn=Ce=>r.go(Ce);let ti;const Nn=new Set,Pn={currentRoute:g,listening:!0,addRoute:I,removeRoute:D,clearRoutes:e.clearRoutes,hasRoute:$,getRoutes:L,resolve:W,options:t,push:Q,replace:Ie,go:pn,back:()=>pn(-1),forward:()=>pn(1),beforeEach:a.add,beforeResolve:u.add,afterEach:l.add,onError:Vt.add,isReady:Cn,install(Ce){const He=this;Ce.component("RouterLink",lA),Ce.component("RouterView",dA),Ce.config.globalProperties.$router=He,Object.defineProperty(Ce.config.globalProperties,"$route",{enumerable:!0,get:()=>f.unref(g)}),xs&&!ti&&g.value===sa&&(ti=!0,Q(r.location).catch(Rt=>{process.env.NODE_ENV!=="production"&&nn("Unexpected error when starting the router:",Rt)}));const Ke={};for(const Rt in sa)Object.defineProperty(Ke,Rt,{get:()=>g.value[Rt],enumerable:!0});Ce.provide(fp,He),Ce.provide(Sg,f.shallowReactive(Ke)),Ce.provide(Eg,g);const Be=Ce.unmount;Nn.add(Ce),Ce.unmount=function(){Nn.delete(Ce),Nn.size<1&&(b=sa,st&&st(),st=null,g.value=sa,ti=!1,Ft=!1),Be()},process.env.NODE_ENV!=="production"&&xs&&mA(Ce,He,e)}};function Ln(Ce){return Ce.reduce((He,Ke)=>He.then(()=>Ae(Ke)),Promise.resolve())}return Pn}function CA(t,e){const n=[],i=[],r=[],a=Math.max(e.matched.length,t.matched.length);for(let u=0;u<a;u++){const l=e.matched[u];l&&(t.matched.find(b=>oa(b,l))?i.push(l):n.push(l));const g=t.matched[u];g&&(e.matched.find(b=>oa(b,g))||r.push(g))}return[n,i,r]}function TA(){return f.inject(fp)}function MA(t){return f.inject(Sg)}const AA=[{name:"edit",path:"/edit",component:()=>Promise.resolve().then(()=>w9)},{name:"add",path:"/add",component:()=>Promise.resolve().then(()=>I9)},{name:"card-view",path:"/card",component:()=>Promise.resolve().then(()=>jS),children:[{name:"table",path:":table",component:()=>Promise.resolve().then(()=>jS),children:[{name:"card",path:":id",component:()=>Promise.resolve().then(()=>s9)}]}]}],je=(t,e)=>{const n=t.__vccOpts||t;for(const[i,r]of e)n[i]=r;return n},IA={},PA={class:"bg-gray-200 w-full px-16 md:px-0 h-screen flex items-center justify-center"},DA={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 OA(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",PA,[f.createElementVNode("div",DA,[e[2]||(e[2]=f.createElementVNode("p",{class:"text-6xl md:text-7xl lg:text-9xl font-bold tracking-wider text-gray-300"}," 404 ",-1)),e[3]||(e[3]=f.createElementVNode("p",{class:"text-2xl md:text-3xl lg:text-5xl font-bold tracking-wider text-gray-500 mt-4"}," Сторінку не знайдено ",-1)),e[4]||(e[4]=f.createElementVNode("p",{class:"text-gray-500 mt-4 pb-4 border-b-2 text-center"}," Вибачте, така сторінка не існує ",-1)),f.createElementVNode("div",{onClick:e[0]||(e[0]=u=>t.$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"},e[1]||(e[1]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[f.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),f.createElementVNode("span",null,"Повернутись на головну",-1)]))])])}const BA=je(IA,[["render",OA]]),zA=t=>{const e=AA.map(i=>({...i}));return{router:EA({history:RM(),routes:[{path:"/404",name:"404",component:BA},{path:"/",name:"home",component:()=>Promise.resolve().then(()=>EU),children:[...e,...t,{path:"/:catchAll(.*)",component:()=>Promise.resolve().then(()=>lW)}]}]}),routerData:e}},NA={props:{value:{type:null,default:()=>""},data:{type:Object},table:{type:String},name:String,data:Object,edit:{type:null,default:()=>!1},column:Object},methods:{async changeData(t){var e;try{const{data:n}=await rt.get(`/api/table/${this.table}/${(e=this.data)==null?void 0:e.id}`);await rt.put(`/api/table/${n==null?void 0:n.token}`,{...n,[this.name]:t}),await this.$emit("update-table")}catch(n){console.log(n)}}}},LA={key:1,class:"text-start"};function RA(t,e,n,i,r,a){var l,g;const u=f.resolveComponent("VsInlineEdit");return n.edit?(f.openBlock(),f.createBlock(u,{key:0,"model-value":n.value,onUpdateValue:a.changeData,title:((l=n.column)==null?void 0:l.ua)||((g=n.column)==null?void 0:g.text)},{default:f.withCtx(()=>{var b,w;return[f.createElementVNode("button",{class:f.normalizeClass([(b=n.value)!=null&&b.trim()?"underline text-start decoration-dashed":null])},f.toDisplayString((w=n.value)!=null&&w.trim()?n.value:"-"),3)]}),_:1},8,["model-value","onUpdateValue","title"])):(f.openBlock(),f.createElementBlock("div",LA,f.toDisplayString(n.value),1))}const gp=je(NA,[["render",RA]]),VA={},FA={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"};function $A(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",FA,e[0]||(e[0]=[f.createElementVNode("path",{d:"M20 6 9 17l-5-5"},null,-1)]))}const jA=je(VA,[["render",$A]]),UA={class:"w-[170px]"},HA={key:0,class:"p-1 border-b border-gray-200 dark:border-neutral-800"},qA={class:"grid gap-y-0.5 p-1 max-h-[220px] 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"},WA=["value","onChange"],GA={class:"text-sm text-gray-800 ms-2"},ZA={key:0,class:"flex items-center px-3 text-[13px] py-1 rounded-md cursor-pointer group"},Wx={__name:"admin-badge-edit",props:{options:Array,value:[String,Number,Boolean]},emits:["update:value"],setup(t,{emit:e}){const n=e,i=t,r=f.ref(i.value),a=f.ref(""),u=f.ref("popover"),l=f.computed(()=>{var b;return(b=i.options)==null?void 0:b.filter(w=>{var E,C,I;return(I=(E=w==null?void 0:w.text)==null?void 0:E.toLowerCase())==null?void 0:I.includes((C=a.value)==null?void 0:C.toLowerCase())})}),g=b=>{r.value===b?r.value="":r.value=b,n("update:value",r),u.value.togglePopover()};return(b,w)=>{const E=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(E,{ref_key:"popover",ref:u},{reference:f.withCtx(()=>[f.renderSlot(b.$slots,"default")]),default:f.withCtx(()=>{var C,I;return[f.createElementVNode("div",UA,[((C=t.options)==null?void 0:C.length)>6?(f.openBlock(),f.createElementBlock("div",HA,[f.withDirectives(f.createElementVNode("input",{"onUpdate:modelValue":w[0]||(w[0]=D=>a.value=D),type:"text",placeholder:"Пошук",class:"py-1.5 px-3 block w-full bg-gray-100 border-transparent rounded-lg text-sm placeholder:text-gray-500 focus:outline-none focus:border-teal-500 focus:ring-teal-500 focus:bg-white disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600 dark:focus:bg-neutral-900"},null,512),[[f.vModelText,a.value]])])):f.createCommentVNode("",!0),f.createElementVNode("div",qA,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(l.value,D=>(f.openBlock(),f.createElementBlock("label",{key:D==null?void 0:D.id,class:f.normalizeClass(["flex items-center px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100",{"bg-gray-100":r.value===(D==null?void 0:D.id)}])},[f.withDirectives(f.createElementVNode("input",{"onUpdate:modelValue":w[1]||(w[1]=L=>r.value=L),value:D==null?void 0:D.id,type:"checkbox",class:"w-1 h-3 border-0 rounded-full appearance-none shrink-0 checked:bg-none",style:f.normalizeStyle({backgroundColor:(D==null?void 0:D.color)||"#ffffff"}),onChange:L=>g(D==null?void 0:D.id)},null,44,WA),[[f.vModelCheckbox,r.value]]),f.createElementVNode("span",GA,f.toDisplayString(D==null?void 0:D.text),1),r.value===(D==null?void 0:D.id)?(f.openBlock(),f.createBlock(jA,{key:0,class:"ml-auto size-3 shrink-0"})):f.createCommentVNode("",!0)],2))),128)),(I=l.value)!=null&&I.length?f.createCommentVNode("",!0):(f.openBlock(),f.createElementBlock("div",ZA," Нічього не знайдено "))])])]}),_:3},512)}}},YA={components:{AdminBadgeEdit:Wx},props:{data:Object,name:String,table:String,column:Object,edit:{type:null,default:()=>!1}},computed:{getData(){var t;return(t=this.data)==null?void 0:t[this.name+"_data"]}},watch:{value(t){typeof t=="string"&&this.changeData(t)}},data(){var t,e;return{optionsList:[],value:(e=(t=this.data)==null?void 0:t[this.name+"_data"])==null?void 0:e.id}},methods:{async getOptions(){var t;try{const{data:e}=await rt.get(`/api/suggest/${(t=this.column)==null?void 0:t.data}`);this.optionsList=e}catch{}},getBGColor(t){if(t!=null&&t.includes("#")){let e;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(t))return e=t.substring(1).split(""),e.length==3&&(e=[e[0],e[0],e[1],e[1],e[2],e[2]]),e="0x"+e.join(""),"rgba("+[e>>16&255,e>>8&255,e&255].join(",")+",0.2)";this.$notify({type:"error",message:"Невірний формат кольору",title:"Помилка"})}else if(typeof t=="string"){const e=document.createElement("div");e.style.color=t,document.body.appendChild(e);const n=getComputedStyle(e).color;return document.body.removeChild(e),n.replace("rgb","rgba").replace(")",", 0.2)")}else this.$notify({type:"error",message:"Невірний формат кольору",title:"Помилка"})},async changeData(t){var e,n;try{const i=await rt.get(`/api/table/${this.table}/${(e=this.data)==null?void 0:e.id}`);await rt.put(`/api/table/${(n=i==null?void 0:i.data)==null?void 0:n.token}`,{...i==null?void 0:i.data,[this.name]:t}),await this.$emit("update-table")}catch(i){console.log(i)}}}},XA={key:1},KA={key:1,class:"flex justify-start w-full"},JA={key:1};function QA(t,e,n,i,r,a){var l,g,b;const u=f.resolveComponent("AdminBadgeEdit");return n.edit?(f.openBlock(),f.createBlock(u,{key:0,options:r.optionsList,value:r.value,"onUpdate:value":e[1]||(e[1]=w=>r.value=w)},{default:f.withCtx(()=>{var w,E,C;return[f.createElementVNode("div",{class:"flex justify-start w-full cursor-pointer",onClick:e[0]||(e[0]=(...I)=>a.getOptions&&a.getOptions(...I))},[a.getData?(f.openBlock(),f.createElementBlock("div",{key:0,class:"py-1 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium bg-green-100 text-green-800 rounded-full",style:f.normalizeStyle({backgroundColor:a.getBGColor((w=a.getData)==null?void 0:w.color),color:(E=a.getData)==null?void 0:E.color})},f.toDisplayString((C=a.getData)==null?void 0:C.text),5)):(f.openBlock(),f.createElementBlock("div",XA,"-"))])]}),_:1},8,["options","value"])):(f.openBlock(),f.createElementBlock("div",KA,[a.getData?(f.openBlock(),f.createElementBlock("div",{key:0,class:"py-1 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium bg-green-100 text-green-800 rounded-full",style:f.normalizeStyle({backgroundColor:a.getBGColor((l=a.getData)==null?void 0:l.color),color:(g=a.getData)==null?void 0:g.color})},f.toDisplayString((b=a.getData)==null?void 0:b.text),5)):(f.openBlock(),f.createElementBlock("div",JA,"-"))]))}const Gx=je(YA,[["render",QA]]),eI={},tI={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 nI(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",tI,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const Zx=je(eI,[["render",nI]]),iI={components:{IconCheck:Zx},props:{value:Boolean}},rI={class:"px-[20px]"},oI={key:1};function sI(t,e,n,i,r,a){const u=f.resolveComponent("IconCheck");return f.openBlock(),f.createElementBlock("div",rI,[n.value?(f.openBlock(),f.createBlock(u,{key:0,height:"24",width:"24",class:"text-blue-500"})):(f.openBlock(),f.createElementBlock("div",oI))])}const yp=je(iI,[["render",sI]]),aI={components:{AdminBadgeEdit:Wx},props:{data:Object,name:String,column:Object,table:String,edit:{type:Boolean,default:()=>!1}},data(){var t,e;return{optionsList:[],value:(e=(t=this.data)==null?void 0:t[this.name+"_data"])==null?void 0:e.id}},watch:{value(t){typeof t=="string"&&this.changeData(t)}},computed:{getData(){var t,e,n;return((e=(t=this.data)==null?void 0:t[this.name+"_data"])==null?void 0:e.text)||((n=this.data)==null?void 0:n[this.name+"_text"])}},methods:{async getOptions(){var t;try{const{data:e}=await rt.get(`/api/suggest/${(t=this.column)==null?void 0:t.data}`);this.optionsList=e}catch{}},async changeData(t){var e,n;try{const i=await rt.get(`/api/table/${this.table}/${(e=this.data)==null?void 0:e.id}`);await rt.put(`/api/table/${(n=i==null?void 0:i.data)==null?void 0:n.token}`,{...i.data,[this.name]:t}),await this.$emit("update-table")}catch(i){console.log(i)}}}},lI={class:""},cI={key:1,class:"cursor-pointer"},uI={key:1,class:"cursor-pointer"},hI={key:0},dI={key:1},pI={key:1};function fI(t,e,n,i,r,a){const u=f.resolveComponent("AdminBadgeEdit");return f.openBlock(),f.createElementBlock("div",lI,[n.edit?(f.openBlock(),f.createBlock(u,{key:0,options:r.optionsList,value:r.value,"onUpdate:value":e[1]||(e[1]=l=>r.value=l)},{default:f.withCtx(()=>[a.getData?(f.openBlock(),f.createElementBlock("div",{key:0,onClick:e[0]||(e[0]=(...l)=>a.getOptions&&a.getOptions(...l))},[typeof a.getData=="object"?(f.openBlock(!0),f.createElementBlock(f.Fragment,{key:0},f.renderList(a.getData,(l,g)=>(f.openBlock(),f.createElementBlock("div",{key:g,class:"cursor-pointer"},f.toDisplayString(l),1))),128)):(f.openBlock(),f.createElementBlock("div",cI,f.toDisplayString(a.getData),1))])):(f.openBlock(),f.createElementBlock("div",uI,"-"))]),_:1},8,["options","value"])):(f.openBlock(),f.createElementBlock(f.Fragment,{key:1},[a.getData?(f.openBlock(),f.createElementBlock("div",hI,[typeof a.getData=="object"?(f.openBlock(!0),f.createElementBlock(f.Fragment,{key:0},f.renderList(a.getData,(l,g)=>(f.openBlock(),f.createElementBlock("div",{key:g},f.toDisplayString(l),1))),128)):(f.openBlock(),f.createElementBlock("div",dI,f.toDisplayString(a.getData),1))])):(f.openBlock(),f.createElementBlock("div",pI,"-"))],64))])}const Yx=je(aI,[["render",fI]]),mI={props:{value:{type:[String,Number],default:()=>""},data:Object,name:String},computed:{getData(){var t,e;return((t=this.data)==null?void 0:t[this.name])||((e=this.data)==null?void 0:e[this.name+"_data"])}},methods:{}},gI={class:"w-full flex justify-start"},yI={key:0,class:"js-clipboard [--is-toggle-tooltip:false] hs-tooltip p-2 bg-stone-100 text-stone-800 text-xs rounded-md cursor-pointer"},_I={key:1};function bI(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",gI,[a.getData?(f.openBlock(),f.createElementBlock("div",yI,f.toDisplayString(a.getData),1)):(f.openBlock(),f.createElementBlock("div",_I,"-"))])}const Xx=je(mI,[["render",bI]]);//! moment.js
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"))):Se(Sn({replace:At},te(yn.to),{state:typeof yn.to=="object"?Sn({},Rt,yn.to.state):Rt,force:Qt}),He||rn)}else yn=Pt(rn,Be,!0,At,Rt);return Xe(rn,Be,yn),yn})}function Ne(Ce,He){const Ke=G(Ce,He);return Ke?Promise.reject(Ke):Promise.resolve()}function Ae(Ce){const He=Nn.values().next().value;return He&&typeof He.runWithContext=="function"?He.runWithContext(Ce):Ce()}function $e(Ce,He){let Ke;const[Be,Rt,Qt]=CA(Ce,He);Ke=Cg(Be.reverse(),"beforeRouteLeave",Ce,He);for(const Mt of Be)Mt.leaveGuards.forEach(rn=>{Ke.push(aa(rn,Ce,He))});const At=Ne.bind(null,Ce,He);return Ke.push(At),Ln(Ke).then(()=>{Ke=[];for(const Mt of a.list())Ke.push(aa(Mt,Ce,He));return Ke.push(At),Ln(Ke)}).then(()=>{Ke=Cg(Rt,"beforeRouteUpdate",Ce,He);for(const Mt of Rt)Mt.updateGuards.forEach(rn=>{Ke.push(aa(rn,Ce,He))});return Ke.push(At),Ln(Ke)}).then(()=>{Ke=[];for(const Mt of Qt)if(Mt.beforeEnter)if(qr(Mt.beforeEnter))for(const rn of Mt.beforeEnter)Ke.push(aa(rn,Ce,He));else Ke.push(aa(Mt.beforeEnter,Ce,He));return Ke.push(At),Ln(Ke)}).then(()=>(Ce.matched.forEach(Mt=>Mt.enterCallbacks={}),Ke=Cg(Qt,"beforeRouteEnter",Ce,He,Ae),Ke.push(At),Ln(Ke))).then(()=>{Ke=[];for(const Mt of u.list())Ke.push(aa(Mt,Ce,He));return Ke.push(At),Ln(Ke)}).catch(Mt=>vs(Mt,8)?Mt:Promise.reject(Mt))}function Xe(Ce,He,Ke){l.list().forEach(Be=>Ae(()=>Be(Ce,He,Ke)))}function Pt(Ce,He,Ke,Be,Rt){const Qt=G(Ce,He);if(Qt)return Qt;const At=He===sa,Mt=xs?history.state:{};Ke&&(Be||At?r.replace(Ce.fullPath,Sn({scroll:At&&Mt&&Mt.scroll},Rt)):r.push(Ce.fullPath,Rt)),g.value=Ce,vn(Ce,He,Ke,At),dn()}let st;function Tt(){st||(st=r.listen((Ce,He,Ke)=>{if(!Pn.listening)return;const Be=W(Ce),Rt=ve(Be);if(Rt){Se(Sn(Rt,{replace:!0}),Be).catch(Qu);return}b=Be;const Qt=g.value;xs&&OM(xx(Qt.fullPath,Ke.delta),dp()),$e(Be,Qt).catch(At=>vs(At,12)?At:vs(At,2)?(Se(At.to,Be).then(Mt=>{vs(Mt,20)&&!Ke.delta&&Ke.type===eh.pop&&r.go(-1,!1)}).catch(Qu),Promise.reject()):(Ke.delta&&r.go(-Ke.delta,!1),Ht(At,Be,Qt))).then(At=>{At=At||Pt(Be,Qt,!1),At&&(Ke.delta&&!vs(At,8)?r.go(-Ke.delta,!1):Ke.type===eh.pop&&vs(At,20)&&r.go(-1,!1)),Xe(Be,Qt,At)}).catch(Qu)}))}let Nt=nh(),Vt=nh(),Ft;function Ht(Ce,He,Ke){dn(Ce);const Be=Vt.list();return Be.length?Be.forEach(Rt=>Rt(Ce,He,Ke)):(process.env.NODE_ENV!=="production"&&nn("uncaught error during route navigation:"),console.error(Ce)),Promise.reject(Ce)}function Cn(){return Ft&&g.value!==sa?Promise.resolve():new Promise((Ce,He)=>{Nt.add([Ce,He])})}function dn(Ce){return Ft||(Ft=!Ce,Tt(),Nt.list().forEach(([He,Ke])=>Ce?Ke(Ce):He()),Nt.reset()),Ce}function vn(Ce,He,Ke,Be){const{scrollBehavior:Rt}=t;if(!xs||!Rt)return Promise.resolve();const Qt=!Ke&&BM(xx(Ce.fullPath,0))||(Be||!Ke)&&history.state&&history.state.scroll||null;return f.nextTick().then(()=>Rt(Ce,He,Qt)).then(At=>At&&DM(At)).catch(At=>Ht(At,Ce,He))}const pn=Ce=>r.go(Ce);let ti;const Nn=new Set,Pn={currentRoute:g,listening:!0,addRoute:I,removeRoute:D,clearRoutes:e.clearRoutes,hasRoute:$,getRoutes:L,resolve:W,options:t,push:Q,replace:Ie,go:pn,back:()=>pn(-1),forward:()=>pn(1),beforeEach:a.add,beforeResolve:u.add,afterEach:l.add,onError:Vt.add,isReady:Cn,install(Ce){const He=this;Ce.component("RouterLink",lA),Ce.component("RouterView",dA),Ce.config.globalProperties.$router=He,Object.defineProperty(Ce.config.globalProperties,"$route",{enumerable:!0,get:()=>f.unref(g)}),xs&&!ti&&g.value===sa&&(ti=!0,Q(r.location).catch(Rt=>{process.env.NODE_ENV!=="production"&&nn("Unexpected error when starting the router:",Rt)}));const Ke={};for(const Rt in sa)Object.defineProperty(Ke,Rt,{get:()=>g.value[Rt],enumerable:!0});Ce.provide(fp,He),Ce.provide(Sg,f.shallowReactive(Ke)),Ce.provide(Eg,g);const Be=Ce.unmount;Nn.add(Ce),Ce.unmount=function(){Nn.delete(Ce),Nn.size<1&&(b=sa,st&&st(),st=null,g.value=sa,ti=!1,Ft=!1),Be()},process.env.NODE_ENV!=="production"&&xs&&mA(Ce,He,e)}};function Ln(Ce){return Ce.reduce((He,Ke)=>He.then(()=>Ae(Ke)),Promise.resolve())}return Pn}function CA(t,e){const n=[],i=[],r=[],a=Math.max(e.matched.length,t.matched.length);for(let u=0;u<a;u++){const l=e.matched[u];l&&(t.matched.find(b=>oa(b,l))?i.push(l):n.push(l));const g=t.matched[u];g&&(e.matched.find(b=>oa(b,g))||r.push(g))}return[n,i,r]}function TA(){return f.inject(fp)}function MA(t){return f.inject(Sg)}const AA=[{name:"edit",path:"/edit",component:()=>Promise.resolve().then(()=>w9)},{name:"add",path:"/add",component:()=>Promise.resolve().then(()=>I9)},{name:"card-view",path:"/card",component:()=>Promise.resolve().then(()=>jS),children:[{name:"table",path:":table",component:()=>Promise.resolve().then(()=>jS),children:[{name:"card",path:":id",component:()=>Promise.resolve().then(()=>s9)}]}]}],je=(t,e)=>{const n=t.__vccOpts||t;for(const[i,r]of e)n[i]=r;return n},IA={},PA={class:"bg-gray-200 w-full px-16 md:px-0 h-screen flex items-center justify-center"},DA={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 OA(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",PA,[f.createElementVNode("div",DA,[e[2]||(e[2]=f.createElementVNode("p",{class:"text-6xl md:text-7xl lg:text-9xl font-bold tracking-wider text-gray-300"}," 404 ",-1)),e[3]||(e[3]=f.createElementVNode("p",{class:"text-2xl md:text-3xl lg:text-5xl font-bold tracking-wider text-gray-500 mt-4"}," Сторінку не знайдено ",-1)),e[4]||(e[4]=f.createElementVNode("p",{class:"text-gray-500 mt-4 pb-4 border-b-2 text-center"}," Вибачте, така сторінка не існує ",-1)),f.createElementVNode("div",{onClick:e[0]||(e[0]=u=>t.$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"},e[1]||(e[1]=[f.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[f.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),f.createElementVNode("span",null,"Повернутись на головну",-1)]))])])}const BA=je(IA,[["render",OA]]),zA=t=>{const e=AA.map(i=>({...i}));return{router:EA({history:RM(),routes:[{path:"/404",name:"404",component:BA},{path:"/",name:"home",component:()=>Promise.resolve().then(()=>CU),children:[...e,...t,{path:"/:catchAll(.*)",component:()=>Promise.resolve().then(()=>cW)}]}]}),routerData:e}},NA={props:{value:{type:null,default:()=>""},data:{type:Object},table:{type:String},name:String,data:Object,edit:{type:null,default:()=>!1},column:Object},methods:{async changeData(t){var e;try{const{data:n}=await rt.get(`/api/table/${this.table}/${(e=this.data)==null?void 0:e.id}`);await rt.put(`/api/table/${n==null?void 0:n.token}`,{...n,[this.name]:t}),await this.$emit("update-table")}catch(n){console.log(n)}}}},LA={key:1,class:"text-start"};function RA(t,e,n,i,r,a){var l,g;const u=f.resolveComponent("VsInlineEdit");return n.edit?(f.openBlock(),f.createBlock(u,{key:0,"model-value":n.value,onUpdateValue:a.changeData,title:((l=n.column)==null?void 0:l.ua)||((g=n.column)==null?void 0:g.text)},{default:f.withCtx(()=>{var b,w;return[f.createElementVNode("button",{class:f.normalizeClass([(b=n.value)!=null&&b.trim()?"underline text-start decoration-dashed":null])},f.toDisplayString((w=n.value)!=null&&w.trim()?n.value:"-"),3)]}),_:1},8,["model-value","onUpdateValue","title"])):(f.openBlock(),f.createElementBlock("div",LA,f.toDisplayString(n.value),1))}const gp=je(NA,[["render",RA]]),VA={},FA={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round"};function $A(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",FA,e[0]||(e[0]=[f.createElementVNode("path",{d:"M20 6 9 17l-5-5"},null,-1)]))}const jA=je(VA,[["render",$A]]),UA={class:"w-[170px]"},HA={key:0,class:"p-1 border-b border-gray-200 dark:border-neutral-800"},qA={class:"grid gap-y-0.5 p-1 max-h-[220px] 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"},WA=["value","onChange"],GA={class:"text-sm text-gray-800 ms-2"},ZA={key:0,class:"flex items-center px-3 text-[13px] py-1 rounded-md cursor-pointer group"},Wx={__name:"admin-badge-edit",props:{options:Array,value:[String,Number,Boolean]},emits:["update:value"],setup(t,{emit:e}){const n=e,i=t,r=f.ref(i.value),a=f.ref(""),u=f.ref("popover"),l=f.computed(()=>{var b;return(b=i.options)==null?void 0:b.filter(w=>{var E,C,I;return(I=(E=w==null?void 0:w.text)==null?void 0:E.toLowerCase())==null?void 0:I.includes((C=a.value)==null?void 0:C.toLowerCase())})}),g=b=>{r.value===b?r.value="":r.value=b,n("update:value",r),u.value.togglePopover()};return(b,w)=>{const E=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(E,{ref_key:"popover",ref:u},{reference:f.withCtx(()=>[f.renderSlot(b.$slots,"default")]),default:f.withCtx(()=>{var C,I;return[f.createElementVNode("div",UA,[((C=t.options)==null?void 0:C.length)>6?(f.openBlock(),f.createElementBlock("div",HA,[f.withDirectives(f.createElementVNode("input",{"onUpdate:modelValue":w[0]||(w[0]=D=>a.value=D),type:"text",placeholder:"Пошук",class:"py-1.5 px-3 block w-full bg-gray-100 border-transparent rounded-lg text-sm placeholder:text-gray-500 focus:outline-none focus:border-teal-500 focus:ring-teal-500 focus:bg-white disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600 dark:focus:bg-neutral-900"},null,512),[[f.vModelText,a.value]])])):f.createCommentVNode("",!0),f.createElementVNode("div",qA,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(l.value,D=>(f.openBlock(),f.createElementBlock("label",{key:D==null?void 0:D.id,class:f.normalizeClass(["flex items-center px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100",{"bg-gray-100":r.value===(D==null?void 0:D.id)}])},[f.withDirectives(f.createElementVNode("input",{"onUpdate:modelValue":w[1]||(w[1]=L=>r.value=L),value:D==null?void 0:D.id,type:"checkbox",class:"w-1 h-3 border-0 rounded-full appearance-none shrink-0 checked:bg-none",style:f.normalizeStyle({backgroundColor:(D==null?void 0:D.color)||"#ffffff"}),onChange:L=>g(D==null?void 0:D.id)},null,44,WA),[[f.vModelCheckbox,r.value]]),f.createElementVNode("span",GA,f.toDisplayString(D==null?void 0:D.text),1),r.value===(D==null?void 0:D.id)?(f.openBlock(),f.createBlock(jA,{key:0,class:"ml-auto size-3 shrink-0"})):f.createCommentVNode("",!0)],2))),128)),(I=l.value)!=null&&I.length?f.createCommentVNode("",!0):(f.openBlock(),f.createElementBlock("div",ZA," Нічього не знайдено "))])])]}),_:3},512)}}},YA={components:{AdminBadgeEdit:Wx},props:{data:Object,name:String,table:String,column:Object,edit:{type:null,default:()=>!1}},computed:{getData(){var t;return(t=this.data)==null?void 0:t[this.name+"_data"]}},watch:{value(t){typeof t=="string"&&this.changeData(t)}},data(){var t,e;return{optionsList:[],value:(e=(t=this.data)==null?void 0:t[this.name+"_data"])==null?void 0:e.id}},methods:{async getOptions(){var t;try{const{data:e}=await rt.get(`/api/suggest/${(t=this.column)==null?void 0:t.data}`);this.optionsList=e}catch{}},getBGColor(t){if(t!=null&&t.includes("#")){let e;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(t))return e=t.substring(1).split(""),e.length==3&&(e=[e[0],e[0],e[1],e[1],e[2],e[2]]),e="0x"+e.join(""),"rgba("+[e>>16&255,e>>8&255,e&255].join(",")+",0.2)";this.$notify({type:"error",message:"Невірний формат кольору",title:"Помилка"})}else if(typeof t=="string"){const e=document.createElement("div");e.style.color=t,document.body.appendChild(e);const n=getComputedStyle(e).color;return document.body.removeChild(e),n.replace("rgb","rgba").replace(")",", 0.2)")}else this.$notify({type:"error",message:"Невірний формат кольору",title:"Помилка"})},async changeData(t){var e,n;try{const i=await rt.get(`/api/table/${this.table}/${(e=this.data)==null?void 0:e.id}`);await rt.put(`/api/table/${(n=i==null?void 0:i.data)==null?void 0:n.token}`,{...i==null?void 0:i.data,[this.name]:t}),await this.$emit("update-table")}catch(i){console.log(i)}}}},XA={key:1},KA={key:1,class:"flex justify-start w-full"},JA={key:1};function QA(t,e,n,i,r,a){var l,g,b;const u=f.resolveComponent("AdminBadgeEdit");return n.edit?(f.openBlock(),f.createBlock(u,{key:0,options:r.optionsList,value:r.value,"onUpdate:value":e[1]||(e[1]=w=>r.value=w)},{default:f.withCtx(()=>{var w,E,C;return[f.createElementVNode("div",{class:"flex justify-start w-full cursor-pointer",onClick:e[0]||(e[0]=(...I)=>a.getOptions&&a.getOptions(...I))},[a.getData?(f.openBlock(),f.createElementBlock("div",{key:0,class:"py-1 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium bg-green-100 text-green-800 rounded-full",style:f.normalizeStyle({backgroundColor:a.getBGColor((w=a.getData)==null?void 0:w.color),color:(E=a.getData)==null?void 0:E.color})},f.toDisplayString((C=a.getData)==null?void 0:C.text),5)):(f.openBlock(),f.createElementBlock("div",XA,"-"))])]}),_:1},8,["options","value"])):(f.openBlock(),f.createElementBlock("div",KA,[a.getData?(f.openBlock(),f.createElementBlock("div",{key:0,class:"py-1 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium bg-green-100 text-green-800 rounded-full",style:f.normalizeStyle({backgroundColor:a.getBGColor((l=a.getData)==null?void 0:l.color),color:(g=a.getData)==null?void 0:g.color})},f.toDisplayString((b=a.getData)==null?void 0:b.text),5)):(f.openBlock(),f.createElementBlock("div",JA,"-"))]))}const Gx=je(YA,[["render",QA]]),eI={},tI={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 nI(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",tI,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const Zx=je(eI,[["render",nI]]),iI={components:{IconCheck:Zx},props:{value:Boolean}},rI={class:"px-[20px]"},oI={key:1};function sI(t,e,n,i,r,a){const u=f.resolveComponent("IconCheck");return f.openBlock(),f.createElementBlock("div",rI,[n.value?(f.openBlock(),f.createBlock(u,{key:0,height:"24",width:"24",class:"text-blue-500"})):(f.openBlock(),f.createElementBlock("div",oI))])}const yp=je(iI,[["render",sI]]),aI={components:{AdminBadgeEdit:Wx},props:{data:Object,name:String,column:Object,table:String,edit:{type:Boolean,default:()=>!1}},data(){var t,e;return{optionsList:[],value:(e=(t=this.data)==null?void 0:t[this.name+"_data"])==null?void 0:e.id}},watch:{value(t){typeof t=="string"&&this.changeData(t)}},computed:{getData(){var t,e,n;return((e=(t=this.data)==null?void 0:t[this.name+"_data"])==null?void 0:e.text)||((n=this.data)==null?void 0:n[this.name+"_text"])}},methods:{async getOptions(){var t;try{const{data:e}=await rt.get(`/api/suggest/${(t=this.column)==null?void 0:t.data}`);this.optionsList=e}catch{}},async changeData(t){var e,n;try{const i=await rt.get(`/api/table/${this.table}/${(e=this.data)==null?void 0:e.id}`);await rt.put(`/api/table/${(n=i==null?void 0:i.data)==null?void 0:n.token}`,{...i.data,[this.name]:t}),await this.$emit("update-table")}catch(i){console.log(i)}}}},lI={class:""},cI={key:1,class:"cursor-pointer"},uI={key:1,class:"cursor-pointer"},hI={key:0},dI={key:1},pI={key:1};function fI(t,e,n,i,r,a){const u=f.resolveComponent("AdminBadgeEdit");return f.openBlock(),f.createElementBlock("div",lI,[n.edit?(f.openBlock(),f.createBlock(u,{key:0,options:r.optionsList,value:r.value,"onUpdate:value":e[1]||(e[1]=l=>r.value=l)},{default:f.withCtx(()=>[a.getData?(f.openBlock(),f.createElementBlock("div",{key:0,onClick:e[0]||(e[0]=(...l)=>a.getOptions&&a.getOptions(...l))},[typeof a.getData=="object"?(f.openBlock(!0),f.createElementBlock(f.Fragment,{key:0},f.renderList(a.getData,(l,g)=>(f.openBlock(),f.createElementBlock("div",{key:g,class:"cursor-pointer"},f.toDisplayString(l),1))),128)):(f.openBlock(),f.createElementBlock("div",cI,f.toDisplayString(a.getData),1))])):(f.openBlock(),f.createElementBlock("div",uI,"-"))]),_:1},8,["options","value"])):(f.openBlock(),f.createElementBlock(f.Fragment,{key:1},[a.getData?(f.openBlock(),f.createElementBlock("div",hI,[typeof a.getData=="object"?(f.openBlock(!0),f.createElementBlock(f.Fragment,{key:0},f.renderList(a.getData,(l,g)=>(f.openBlock(),f.createElementBlock("div",{key:g},f.toDisplayString(l),1))),128)):(f.openBlock(),f.createElementBlock("div",dI,f.toDisplayString(a.getData),1))])):(f.openBlock(),f.createElementBlock("div",pI,"-"))],64))])}const Yx=je(aI,[["render",fI]]),mI={props:{value:{type:[String,Number],default:()=>""},data:Object,name:String},computed:{getData(){var t,e;return((t=this.data)==null?void 0:t[this.name])||((e=this.data)==null?void 0:e[this.name+"_data"])}},methods:{}},gI={class:"w-full flex justify-start"},yI={key:0,class:"js-clipboard [--is-toggle-tooltip:false] hs-tooltip p-2 bg-stone-100 text-stone-800 text-xs rounded-md cursor-pointer"},_I={key:1};function bI(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("div",gI,[a.getData?(f.openBlock(),f.createElementBlock("div",yI,f.toDisplayString(a.getData),1)):(f.openBlock(),f.createElementBlock("div",_I,"-"))])}const Xx=je(mI,[["render",bI]]);//! moment.js
37
37
  //! version : 2.30.1
38
38
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
39
39
  //! license : MIT
@@ -46,7 +46,7 @@ ht.version="2.30.1",xI(Gn),ht.fn=qe,ht.min=lD,ht.max=cD,ht.now=uD,ht.utc=Yo,ht.u
46
46
  * MapLibre GL JS
47
47
  * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt
48
48
  */(function(t,e){(function(n,i){t.exports=i()})(IB,function(){var n={},i={};function r(u,l,g){if(i[u]=g,u==="index"){var b="var sharedModule = {}; ("+i.shared+")(sharedModule); ("+i.worker+")(sharedModule);",w={};return i.shared(w),i.index(n,w),typeof window<"u"&&n.setWorkerUrl(window.URL.createObjectURL(new Blob([b],{type:"text/javascript"}))),n}}r("shared",["exports"],function(u){function l(c,s,h,p){return new(h||(h=Promise))(function(_,k){function S(B){try{A(p.next(B))}catch(z){k(z)}}function T(B){try{A(p.throw(B))}catch(z){k(z)}}function A(B){var z;B.done?_(B.value):(z=B.value,z instanceof h?z:new h(function(R){R(z)})).then(S,T)}A((p=p.apply(c,s||[])).next())})}function g(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}typeof SuppressedError=="function"&&SuppressedError;var b=w;function w(c,s){this.x=c,this.y=s}w.prototype={clone:function(){return new w(this.x,this.y)},add:function(c){return this.clone()._add(c)},sub:function(c){return this.clone()._sub(c)},multByPoint:function(c){return this.clone()._multByPoint(c)},divByPoint:function(c){return this.clone()._divByPoint(c)},mult:function(c){return this.clone()._mult(c)},div:function(c){return this.clone()._div(c)},rotate:function(c){return this.clone()._rotate(c)},rotateAround:function(c,s){return this.clone()._rotateAround(c,s)},matMult:function(c){return this.clone()._matMult(c)},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(c){return this.x===c.x&&this.y===c.y},dist:function(c){return Math.sqrt(this.distSqr(c))},distSqr:function(c){var s=c.x-this.x,h=c.y-this.y;return s*s+h*h},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(c){return Math.atan2(this.y-c.y,this.x-c.x)},angleWith:function(c){return this.angleWithSep(c.x,c.y)},angleWithSep:function(c,s){return Math.atan2(this.x*s-this.y*c,this.x*c+this.y*s)},_matMult:function(c){var s=c[2]*this.x+c[3]*this.y;return this.x=c[0]*this.x+c[1]*this.y,this.y=s,this},_add:function(c){return this.x+=c.x,this.y+=c.y,this},_sub:function(c){return this.x-=c.x,this.y-=c.y,this},_mult:function(c){return this.x*=c,this.y*=c,this},_div:function(c){return this.x/=c,this.y/=c,this},_multByPoint:function(c){return this.x*=c.x,this.y*=c.y,this},_divByPoint:function(c){return this.x/=c.x,this.y/=c.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var c=this.y;return this.y=this.x,this.x=-c,this},_rotate:function(c){var s=Math.cos(c),h=Math.sin(c),p=h*this.x+s*this.y;return this.x=s*this.x-h*this.y,this.y=p,this},_rotateAround:function(c,s){var h=Math.cos(c),p=Math.sin(c),_=s.y+p*(this.x-s.x)+h*(this.y-s.y);return this.x=s.x+h*(this.x-s.x)-p*(this.y-s.y),this.y=_,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},w.convert=function(c){return c instanceof w?c:Array.isArray(c)?new w(c[0],c[1]):c};var E=g(b),C=I;function I(c,s,h,p){this.cx=3*c,this.bx=3*(h-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*s,this.by=3*(p-s)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=s,this.p2x=h,this.p2y=p}I.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,s){if(s===void 0&&(s=1e-6),c<0)return 0;if(c>1)return 1;for(var h=c,p=0;p<8;p++){var _=this.sampleCurveX(h)-c;if(Math.abs(_)<s)return h;var k=this.sampleCurveDerivativeX(h);if(Math.abs(k)<1e-6)break;h-=_/k}var S=0,T=1;for(h=c,p=0;p<20&&(_=this.sampleCurveX(h),!(Math.abs(_-c)<s));p++)c>_?S=h:T=h,h=.5*(T-S)+S;return h},solve:function(c,s){return this.sampleCurveY(this.solveCurveX(c,s))}};var D=g(C);let L,$;function W(){return L==null&&(L=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),L}function te(){if($==null&&($=!1,W())){const s=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(s){for(let p=0;p<5*5;p++){const _=4*p;s.fillStyle=`rgb(${_},${_+1},${_+2})`,s.fillRect(p%5,Math.floor(p/5),1,1)}const h=s.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&h[p]!==p){$=!0;break}}}return $||!1}function G(c,s,h,p){const _=new D(c,s,h,p);return k=>_.solve(k)}const Q=G(.25,.1,.25,1);function Ie(c,s,h){return Math.min(h,Math.max(s,c))}function ve(c,s,h){const p=h-s,_=((c-s)%p+p)%p+s;return _===s?h:_}function Se(c,...s){for(const h of s)for(const p in h)c[p]=h[p];return c}let Ne=1;function Ae(c,s,h){const p={};for(const _ in c)p[_]=s.call(this,c[_],_,c);return p}function $e(c,s,h){const p={};for(const _ in c)s.call(this,c[_],_,c)&&(p[_]=c[_]);return p}function Xe(c){return Array.isArray(c)?c.map(Xe):typeof c=="object"&&c?Ae(c,Xe):c}const Pt={};function st(c){Pt[c]||(typeof console<"u"&&console.warn(c),Pt[c]=!0)}function Tt(c,s,h){return(h.y-c.y)*(s.x-c.x)>(s.y-c.y)*(h.x-c.x)}function Nt(c){return typeof WorkerGlobalScope<"u"&&c!==void 0&&c instanceof WorkerGlobalScope}let Vt=null;function Ft(c){return typeof ImageBitmap<"u"&&c instanceof ImageBitmap}const Ht="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Cn(c,s,h,p,_){return l(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const k=new VideoFrame(c,{timestamp:0});try{const S=k==null?void 0:k.format;if(!S||!S.startsWith("BGR")&&!S.startsWith("RGB"))throw new Error(`Unrecognized format ${S}`);const T=S.startsWith("BGR"),A=new Uint8ClampedArray(p*_*4);if(yield k.copyTo(A,function(B,z,R,j,q){const Y=4*Math.max(-z,0),K=(Math.max(0,R)-R)*j*4+Y,re=4*j,ae=Math.max(0,z),be=Math.max(0,R);return{rect:{x:ae,y:be,width:Math.min(B.width,z+j)-ae,height:Math.min(B.height,R+q)-be},layout:[{offset:K,stride:re}]}}(c,s,h,p,_)),T)for(let B=0;B<A.length;B+=4){const z=A[B];A[B]=A[B+2],A[B+2]=z}return A}finally{k.close()}})}let dn,vn;const pn="AbortError";function ti(){return new Error(pn)}const Nn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Pn(c){return Nn.REGISTERED_PROTOCOLS[c.substring(0,c.indexOf("://"))]}const Ln="global-dispatcher";class Ce extends Error{constructor(s,h,p,_){super(`AJAXError: ${h} (${s}): ${p}`),this.status=s,this.statusText=h,this.url=p,this.body=_}}const He=()=>Nt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Ke=function(c,s){if(/:\/\//.test(c.url)&&!/^https?:|^file:/.test(c.url)){const p=Pn(c.url);if(p)return p(c,s);if(Nt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:c,targetMapId:Ln},s)}if(!(/^file:/.test(h=c.url)||/^file:/.test(He())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,_){return l(this,void 0,void 0,function*(){const k=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:He(),signal:_.signal});p.type!=="json"||k.headers.has("Accept")||k.headers.set("Accept","application/json");const S=yield fetch(k);if(!S.ok){const B=yield S.blob();throw new Ce(S.status,S.statusText,p.url,B)}let T;T=p.type==="arrayBuffer"||p.type==="image"?S.arrayBuffer():p.type==="json"?S.json():S.text();const A=yield T;if(_.signal.aborted)throw ti();return{data:A,cacheControl:S.headers.get("Cache-Control"),expires:S.headers.get("Expires")}})}(c,s);if(Nt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:c,mustQueue:!0,targetMapId:Ln},s)}var h;return function(p,_){return new Promise((k,S)=>{var T;const A=new XMLHttpRequest;A.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(A.responseType="arraybuffer");for(const B in p.headers)A.setRequestHeader(B,p.headers[B]);p.type==="json"&&(A.responseType="text",!((T=p.headers)===null||T===void 0)&&T.Accept||A.setRequestHeader("Accept","application/json")),A.withCredentials=p.credentials==="include",A.onerror=()=>{S(new Error(A.statusText))},A.onload=()=>{if(!_.signal.aborted)if((A.status>=200&&A.status<300||A.status===0)&&A.response!==null){let B=A.response;if(p.type==="json")try{B=JSON.parse(A.response)}catch(z){return void S(z)}k({data:B,cacheControl:A.getResponseHeader("Cache-Control"),expires:A.getResponseHeader("Expires")})}else{const B=new Blob([A.response],{type:A.getResponseHeader("Content-Type")});S(new Ce(A.status,A.statusText,p.url,B))}},_.signal.addEventListener("abort",()=>{A.abort(),S(ti())}),A.send(p.body)})}(c,s)};function Be(c){if(!c||c.indexOf("://")<=0||c.indexOf("data:image/")===0||c.indexOf("blob:")===0)return!0;const s=new URL(c),h=window.location;return s.protocol===h.protocol&&s.host===h.host}function Rt(c,s,h){h[c]&&h[c].indexOf(s)!==-1||(h[c]=h[c]||[],h[c].push(s))}function Qt(c,s,h){if(h&&h[c]){const p=h[c].indexOf(s);p!==-1&&h[c].splice(p,1)}}class At{constructor(s,h={}){Se(this,h),this.type=s}}class Mt extends At{constructor(s,h={}){super("error",Se({error:s},h))}}class rn{on(s,h){return this._listeners=this._listeners||{},Rt(s,h,this._listeners),this}off(s,h){return Qt(s,h,this._listeners),Qt(s,h,this._oneTimeListeners),this}once(s,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Rt(s,h,this._oneTimeListeners),this):new Promise(p=>this.once(s,p))}fire(s,h){typeof s=="string"&&(s=new At(s,h||{}));const p=s.type;if(this.listens(p)){s.target=this;const _=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const T of _)T.call(this,s);const k=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const T of k)Qt(p,T,this._oneTimeListeners),T.call(this,s);const S=this._eventedParent;S&&(Se(s,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),S.fire(s))}else s instanceof Mt&&console.error(s.error);return this}listens(s){return this._listeners&&this._listeners[s]&&this._listeners[s].length>0||this._oneTimeListeners&&this._oneTimeListeners[s]&&this._oneTimeListeners[s].length>0||this._eventedParent&&this._eventedParent.listens(s)}setEventedParent(s,h){return this._eventedParent=s,this._eventedParentData=h,this}}var we={$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 yn=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function pr(c,s){const h={};for(const p in c)p!=="ref"&&(h[p]=c[p]);return yn.forEach(p=>{p in s&&(h[p]=s[p])}),h}function qt(c,s){if(Array.isArray(c)){if(!Array.isArray(s)||c.length!==s.length)return!1;for(let h=0;h<c.length;h++)if(!qt(c[h],s[h]))return!1;return!0}if(typeof c=="object"&&c!==null&&s!==null){if(typeof s!="object"||Object.keys(c).length!==Object.keys(s).length)return!1;for(const h in c)if(!qt(c[h],s[h]))return!1;return!0}return c===s}function sn(c,s){c.push(s)}function vi(c,s,h){sn(h,{command:"addSource",args:[c,s[c]]})}function ui(c,s,h){sn(s,{command:"removeSource",args:[c]}),h[c]=!0}function mi(c,s,h,p){ui(c,h,p),vi(c,s,h)}function Or(c,s,h){let p;for(p in c[h])if(Object.prototype.hasOwnProperty.call(c[h],p)&&p!=="data"&&!qt(c[h][p],s[h][p]))return!1;for(p in s[h])if(Object.prototype.hasOwnProperty.call(s[h],p)&&p!=="data"&&!qt(c[h][p],s[h][p]))return!1;return!0}function wi(c,s,h,p,_,k){c=c||{},s=s||{};for(const S in c)Object.prototype.hasOwnProperty.call(c,S)&&(qt(c[S],s[S])||h.push({command:k,args:[p,S,s[S],_]}));for(const S in s)Object.prototype.hasOwnProperty.call(s,S)&&!Object.prototype.hasOwnProperty.call(c,S)&&(qt(c[S],s[S])||h.push({command:k,args:[p,S,s[S],_]}))}function Eo(c){return c.id}function Co(c,s){return c[s.id]=s,c}class Ve{constructor(s,h,p,_){this.message=(s?`${s}: `:"")+p,_&&(this.identifier=_),h!=null&&h.__line__&&(this.line=h.__line__)}}function Br(c,...s){for(const h of s)for(const p in h)c[p]=h[p];return c}class ki extends Error{constructor(s,h){super(h),this.message=h,this.key=s}}class zr{constructor(s,h=[]){this.parent=s,this.bindings={};for(const[p,_]of h)this.bindings[p]=_}concat(s){return new zr(this,s)}get(s){if(this.bindings[s])return this.bindings[s];if(this.parent)return this.parent.get(s);throw new Error(`${s} not found in scope.`)}has(s){return!!this.bindings[s]||!!this.parent&&this.parent.has(s)}}const To={kind:"null"},Ze={kind:"number"},ke={kind:"string"},Le={kind:"boolean"},vt={kind:"color"},Wt={kind:"object"},tt={kind:"value"},Rn={kind:"collator"},Kn={kind:"formatted"},qi={kind:"padding"},fr={kind:"resolvedImage"},se={kind:"variableAnchorOffsetCollection"};function H(c,s){return{kind:"array",itemType:c,N:s}}function U(c){if(c.kind==="array"){const s=U(c.itemType);return typeof c.N=="number"?`array<${s}, ${c.N}>`:c.itemType.kind==="value"?"array":`array<${s}>`}return c.kind}const X=[To,Ze,ke,Le,vt,Kn,Wt,H(tt),qi,fr,se];function ie(c,s){if(s.kind==="error")return null;if(c.kind==="array"){if(s.kind==="array"&&(s.N===0&&s.itemType.kind==="value"||!ie(c.itemType,s.itemType))&&(typeof c.N!="number"||c.N===s.N))return null}else{if(c.kind===s.kind)return null;if(c.kind==="value"){for(const h of X)if(!ie(h,s))return null}}return`Expected ${U(c)} but found ${U(s)} instead.`}function de(c,s){return s.some(h=>h.kind===c.kind)}function fe(c,s){return s.some(h=>h==="null"?c===null:h==="array"?Array.isArray(c):h==="object"?c&&!Array.isArray(c)&&typeof c=="object":h===typeof c)}function _e(c,s){return c.kind==="array"&&s.kind==="array"?c.itemType.kind===s.itemType.kind&&typeof c.N=="number":c.kind===s.kind}const ue=.96422,Me=.82521,ze=4/29,Ee=6/29,We=3*Ee*Ee,xt=Ee*Ee*Ee,kt=Math.PI/180,an=180/Math.PI;function Lt(c){return(c%=360)<0&&(c+=360),c}function ln([c,s,h,p]){let _,k;const S=oi((.2225045*(c=Kt(c))+.7168786*(s=Kt(s))+.0606169*(h=Kt(h)))/1);c===s&&s===h?_=k=S:(_=oi((.4360747*c+.3850649*s+.1430804*h)/ue),k=oi((.0139322*c+.0971045*s+.7141733*h)/Me));const T=116*S-16;return[T<0?0:T,500*(_-S),200*(S-k),p]}function Kt(c){return c<=.04045?c/12.92:Math.pow((c+.055)/1.055,2.4)}function oi(c){return c>xt?Math.pow(c,1/3):c/We+ze}function Zn([c,s,h,p]){let _=(c+16)/116,k=isNaN(s)?_:_+s/500,S=isNaN(h)?_:_-h/200;return _=1*wn(_),k=ue*wn(k),S=Me*wn(S),[Ut(3.1338561*k-1.6168667*_-.4906146*S),Ut(-.9787684*k+1.9161415*_+.033454*S),Ut(.0719453*k-.2289914*_+1.4052427*S),p]}function Ut(c){return(c=c<=.00304?12.92*c:1.055*Math.pow(c,1/2.4)-.055)<0?0:c>1?1:c}function wn(c){return c>Ee?c*c*c:We*(c-ze)}function qn(c){return parseInt(c.padEnd(2,c),16)/255}function gi(c,s){return Si(s?c/100:c,0,1)}function Si(c,s,h){return Math.min(Math.max(s,c),h)}function Wi(c){return!c.some(Number.isNaN)}const Aa={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 kn{constructor(s,h,p,_=1,k=!0){this.r=s,this.g=h,this.b=p,this.a=_,k||(this.r*=_,this.g*=_,this.b*=_,_||this.overwriteGetter("rgb",[s,h,p,_]))}static parse(s){if(s instanceof kn)return s;if(typeof s!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const _=Aa[p];if(_){const[S,T,A]=_;return[S/255,T/255,A/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const S=p.length<6?1:2;let T=1;return[qn(p.slice(T,T+=S)),qn(p.slice(T,T+=S)),qn(p.slice(T,T+=S)),qn(p.slice(T,T+S)||"ff")]}if(p.startsWith("rgb")){const S=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(S){const[T,A,B,z,R,j,q,Y,K,re,ae,be]=S,pe=[z||" ",q||" ",re].join("");if(pe===" "||pe===" /"||pe===",,"||pe===",,,"){const ye=[B,j,K].join(""),Te=ye==="%%%"?100:ye===""?255:0;if(Te){const Re=[Si(+A/Te,0,1),Si(+R/Te,0,1),Si(+Y/Te,0,1),ae?gi(+ae,be):1];if(Wi(Re))return Re}}return}}const k=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(k){const[S,T,A,B,z,R,j,q,Y]=k,K=[A||" ",z||" ",j].join("");if(K===" "||K===" /"||K===",,"||K===",,,"){const re=[+T,Si(+B,0,100),Si(+R,0,100),q?gi(+q,Y):1];if(Wi(re))return function([ae,be,pe,ye]){function Te(Re){const ot=(Re+ae/30)%12,St=be*Math.min(pe,1-pe);return pe-St*Math.max(-1,Math.min(ot-3,9-ot,1))}return ae=Lt(ae),be/=100,pe/=100,[Te(0),Te(8),Te(4),ye]}(re)}}}(s);return h?new kn(...h,!1):void 0}get rgb(){const{r:s,g:h,b:p,a:_}=this,k=_||1/0;return this.overwriteGetter("rgb",[s/k,h/k,p/k,_])}get hcl(){return this.overwriteGetter("hcl",function(s){const[h,p,_,k]=ln(s),S=Math.sqrt(p*p+_*_);return[Math.round(1e4*S)?Lt(Math.atan2(_,p)*an):NaN,S,h,k]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ln(this.rgb))}overwriteGetter(s,h){return Object.defineProperty(this,s,{value:h}),h}toString(){const[s,h,p,_]=this.rgb;return`rgba(${[s,h,p].map(k=>Math.round(255*k)).join(",")},${_})`}}kn.black=new kn(0,0,0,1),kn.white=new kn(1,1,1,1),kn.transparent=new kn(0,0,0,0),kn.red=new kn(1,0,0,1);class Yh{constructor(s,h,p){this.sensitivity=s?h?"variant":"case":h?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(s,h){return this.collator.compare(s,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Xh{constructor(s,h,p,_,k){this.text=s,this.image=h,this.scale=p,this.fontStack=_,this.textColor=k}}class mr{constructor(s){this.sections=s}static fromString(s){return new mr([new Xh(s,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(s=>s.text.length!==0||s.image&&s.image.name.length!==0)}static factory(s){return s instanceof mr?s:mr.fromString(s)}toString(){return this.sections.length===0?"":this.sections.map(s=>s.text).join("")}}class gr{constructor(s){this.values=s.slice()}static parse(s){if(s instanceof gr)return s;if(typeof s=="number")return new gr([s,s,s,s]);if(Array.isArray(s)&&!(s.length<1||s.length>4)){for(const h of s)if(typeof h!="number")return;switch(s.length){case 1:s=[s[0],s[0],s[0],s[0]];break;case 2:s=[s[0],s[1],s[0],s[1]];break;case 3:s=[s[0],s[1],s[2],s[1]]}return new gr(s)}}toString(){return JSON.stringify(this.values)}}const a_=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Nr{constructor(s){this.values=s.slice()}static parse(s){if(s instanceof Nr)return s;if(Array.isArray(s)&&!(s.length<1)&&s.length%2==0){for(let h=0;h<s.length;h+=2){const p=s[h],_=s[h+1];if(typeof p!="string"||!a_.has(p)||!Array.isArray(_)||_.length!==2||typeof _[0]!="number"||typeof _[1]!="number")return}return new Nr(s)}}toString(){return JSON.stringify(this.values)}}class yr{constructor(s){this.name=s.name,this.available=s.available}toString(){return this.name}static fromString(s){return s?new yr({name:s,available:!1}):null}}function Ia(c,s,h,p){return typeof c=="number"&&c>=0&&c<=255&&typeof s=="number"&&s>=0&&s<=255&&typeof h=="number"&&h>=0&&h<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[c,s,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[c,s,h,p]:[c,s,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Fs(c){if(c===null||typeof c=="string"||typeof c=="boolean"||typeof c=="number"||c instanceof kn||c instanceof Yh||c instanceof mr||c instanceof gr||c instanceof Nr||c instanceof yr)return!0;if(Array.isArray(c)){for(const s of c)if(!Fs(s))return!1;return!0}if(typeof c=="object"){for(const s in c)if(!Fs(c[s]))return!1;return!0}return!1}function si(c){if(c===null)return To;if(typeof c=="string")return ke;if(typeof c=="boolean")return Le;if(typeof c=="number")return Ze;if(c instanceof kn)return vt;if(c instanceof Yh)return Rn;if(c instanceof mr)return Kn;if(c instanceof gr)return qi;if(c instanceof Nr)return se;if(c instanceof yr)return fr;if(Array.isArray(c)){const s=c.length;let h;for(const p of c){const _=si(p);if(h){if(h===_)continue;h=tt;break}h=_}return H(h||tt,s)}return Wt}function Rl(c){const s=typeof c;return c===null?"":s==="string"||s==="number"||s==="boolean"?String(c):c instanceof kn||c instanceof mr||c instanceof gr||c instanceof Nr||c instanceof yr?c.toString():JSON.stringify(c)}class Jr{constructor(s,h){this.type=s,this.value=h}static parse(s,h){if(s.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${s.length-1} instead.`);if(!Fs(s[1]))return h.error("invalid value");const p=s[1];let _=si(p);const k=h.expectedType;return _.kind!=="array"||_.N!==0||!k||k.kind!=="array"||typeof k.N=="number"&&k.N!==0||(_=k),new Jr(_,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ni{constructor(s){this.name="ExpressionEvaluationError",this.message=s}toJSON(){return this.message}}const tu={string:ke,number:Ze,boolean:Le,object:Wt};class Qr{constructor(s,h){this.type=s,this.args=h}static parse(s,h){if(s.length<2)return h.error("Expected at least one argument.");let p,_=1;const k=s[0];if(k==="array"){let T,A;if(s.length>2){const B=s[1];if(typeof B!="string"||!(B in tu)||B==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);T=tu[B],_++}else T=tt;if(s.length>3){if(s[2]!==null&&(typeof s[2]!="number"||s[2]<0||s[2]!==Math.floor(s[2])))return h.error('The length argument to "array" must be a positive integer literal',2);A=s[2],_++}p=H(T,A)}else{if(!tu[k])throw new Error(`Types doesn't contain name = ${k}`);p=tu[k]}const S=[];for(;_<s.length;_++){const T=h.parse(s[_],_,tt);if(!T)return null;S.push(T)}return new Qr(p,S)}evaluate(s){for(let h=0;h<this.args.length;h++){const p=this.args[h].evaluate(s);if(!ie(this.type,si(p)))return p;if(h===this.args.length-1)throw new ni(`Expected value to be of type ${U(this.type)}, but found ${U(si(p))} instead.`)}throw new Error}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every(s=>s.outputDefined())}}const Kh={"to-boolean":Le,"to-color":vt,"to-number":Ze,"to-string":ke};class eo{constructor(s,h){this.type=s,this.args=h}static parse(s,h){if(s.length<2)return h.error("Expected at least one argument.");const p=s[0];if(!Kh[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&s.length!==2)return h.error("Expected one argument.");const _=Kh[p],k=[];for(let S=1;S<s.length;S++){const T=h.parse(s[S],S,tt);if(!T)return null;k.push(T)}return new eo(_,k)}evaluate(s){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(s);case"color":{let h,p;for(const _ of this.args){if(h=_.evaluate(s),p=null,h instanceof kn)return h;if(typeof h=="string"){const k=s.parseColor(h);if(k)return k}else if(Array.isArray(h)&&(p=h.length<3||h.length>4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:Ia(h[0],h[1],h[2],h[3]),!p))return new kn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new ni(p||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const p of this.args){h=p.evaluate(s);const _=gr.parse(h);if(_)return _}throw new ni(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const p of this.args){h=p.evaluate(s);const _=Nr.parse(h);if(_)return _}throw new ni(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const p of this.args){if(h=p.evaluate(s),h===null)return 0;const _=Number(h);if(!isNaN(_))return _}throw new ni(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return mr.fromString(Rl(this.args[0].evaluate(s)));case"resolvedImage":return yr.fromString(Rl(this.args[0].evaluate(s)));default:return Rl(this.args[0].evaluate(s))}}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every(s=>s.outputDefined())}}const l_=["Unknown","Point","LineString","Polygon"];class nu{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"?l_[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(s){let h=this._parseColorCache[s];return h||(h=this._parseColorCache[s]=kn.parse(s)),h}}class $s{constructor(s,h,p=[],_,k=new zr,S=[]){this.registry=s,this.path=p,this.key=p.map(T=>`[${T}]`).join(""),this.scope=k,this.errors=S,this.expectedType=_,this._isConstant=h}parse(s,h,p,_,k={}){return h?this.concat(h,p,_)._parse(s,k):this._parse(s,k)}_parse(s,h){function p(_,k,S){return S==="assert"?new Qr(k,[_]):S==="coerce"?new eo(k,[_]):_}if(s!==null&&typeof s!="string"&&typeof s!="boolean"&&typeof s!="number"||(s=["literal",s]),Array.isArray(s)){if(s.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const _=s[0];if(typeof _!="string")return this.error(`Expression name must be a string, but found ${typeof _} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const k=this.registry[_];if(k){let S=k.parse(s,this);if(!S)return null;if(this.expectedType){const T=this.expectedType,A=S.type;if(T.kind!=="string"&&T.kind!=="number"&&T.kind!=="boolean"&&T.kind!=="object"&&T.kind!=="array"||A.kind!=="value")if(T.kind!=="color"&&T.kind!=="formatted"&&T.kind!=="resolvedImage"||A.kind!=="value"&&A.kind!=="string")if(T.kind!=="padding"||A.kind!=="value"&&A.kind!=="number"&&A.kind!=="array")if(T.kind!=="variableAnchorOffsetCollection"||A.kind!=="value"&&A.kind!=="array"){if(this.checkSubtype(T,A))return null}else S=p(S,T,h.typeAnnotation||"coerce");else S=p(S,T,h.typeAnnotation||"coerce");else S=p(S,T,h.typeAnnotation||"coerce");else S=p(S,T,h.typeAnnotation||"assert")}if(!(S instanceof Jr)&&S.type.kind!=="resolvedImage"&&this._isConstant(S)){const T=new nu;try{S=new Jr(S.type,S.evaluate(T))}catch(A){return this.error(A.message),null}}return S}return this.error(`Unknown expression "${_}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(s===void 0?"'undefined' value invalid. Use null instead.":typeof s=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof s} instead.`)}concat(s,h,p){const _=typeof s=="number"?this.path.concat(s):this.path,k=p?this.scope.concat(p):this.scope;return new $s(this.registry,this._isConstant,_,h||null,k,this.errors)}error(s,...h){const p=`${this.key}${h.map(_=>`[${_}]`).join("")}`;this.errors.push(new ki(p,s))}checkSubtype(s,h){const p=ie(s,h);return p&&this.error(p),p}}class ds{constructor(s,h){this.type=h.type,this.bindings=[].concat(s),this.result=h}evaluate(s){return this.result.evaluate(s)}eachChild(s){for(const h of this.bindings)s(h[1]);s(this.result)}static parse(s,h){if(s.length<4)return h.error(`Expected at least 3 arguments, but found ${s.length-1} instead.`);const p=[];for(let k=1;k<s.length-1;k+=2){const S=s[k];if(typeof S!="string")return h.error(`Expected string, but found ${typeof S} instead.`,k);if(/[^a-zA-Z0-9_]/.test(S))return h.error("Variable names must contain only alphanumeric characters or '_'.",k);const T=h.parse(s[k+1],k+1);if(!T)return null;p.push([S,T])}const _=h.parse(s[s.length-1],s.length-1,h.expectedType,p);return _?new ds(p,_):null}outputDefined(){return this.result.outputDefined()}}class fn{constructor(s,h){this.type=h.type,this.name=s,this.boundExpression=h}static parse(s,h){if(s.length!==2||typeof s[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const p=s[1];return h.scope.has(p)?new fn(p,h.scope.get(p)):h.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(s){return this.boundExpression.evaluate(s)}eachChild(){}outputDefined(){return!1}}class Jh{constructor(s,h,p){this.type=s,this.index=h,this.input=p}static parse(s,h){if(s.length!==3)return h.error(`Expected 2 arguments, but found ${s.length-1} instead.`);const p=h.parse(s[1],1,Ze),_=h.parse(s[2],2,H(h.expectedType||tt));return p&&_?new Jh(_.type.itemType,p,_):null}evaluate(s){const h=this.index.evaluate(s),p=this.input.evaluate(s);if(h<0)throw new ni(`Array index out of bounds: ${h} < 0.`);if(h>=p.length)throw new ni(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new ni(`Array index must be an integer, but found ${h} instead.`);return p[h]}eachChild(s){s(this.index),s(this.input)}outputDefined(){return!1}}class Qh{constructor(s,h){this.type=Le,this.needle=s,this.haystack=h}static parse(s,h){if(s.length!==3)return h.error(`Expected 2 arguments, but found ${s.length-1} instead.`);const p=h.parse(s[1],1,tt),_=h.parse(s[2],2,tt);return p&&_?de(p.type,[Le,ke,Ze,To,tt])?new Qh(p,_):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${U(p.type)} instead`):null}evaluate(s){const h=this.needle.evaluate(s),p=this.haystack.evaluate(s);if(!p)return!1;if(!fe(h,["boolean","string","number","null"]))throw new ni(`Expected first argument to be of type boolean, string, number or null, but found ${U(si(h))} instead.`);if(!fe(p,["string","array"]))throw new ni(`Expected second argument to be of type array or string, but found ${U(si(p))} instead.`);return p.indexOf(h)>=0}eachChild(s){s(this.needle),s(this.haystack)}outputDefined(){return!0}}class Pa{constructor(s,h,p){this.type=Ze,this.needle=s,this.haystack=h,this.fromIndex=p}static parse(s,h){if(s.length<=2||s.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${s.length-1} instead.`);const p=h.parse(s[1],1,tt),_=h.parse(s[2],2,tt);if(!p||!_)return null;if(!de(p.type,[Le,ke,Ze,To,tt]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${U(p.type)} instead`);if(s.length===4){const k=h.parse(s[3],3,Ze);return k?new Pa(p,_,k):null}return new Pa(p,_)}evaluate(s){const h=this.needle.evaluate(s),p=this.haystack.evaluate(s);if(!fe(h,["boolean","string","number","null"]))throw new ni(`Expected first argument to be of type boolean, string, number or null, but found ${U(si(h))} instead.`);let _;if(this.fromIndex&&(_=this.fromIndex.evaluate(s)),fe(p,["string"])){const k=p.indexOf(h,_);return k===-1?-1:[...p.slice(0,k)].length}if(fe(p,["array"]))return p.indexOf(h,_);throw new ni(`Expected second argument to be of type array or string, but found ${U(si(p))} instead.`)}eachChild(s){s(this.needle),s(this.haystack),this.fromIndex&&s(this.fromIndex)}outputDefined(){return!1}}class ed{constructor(s,h,p,_,k,S){this.inputType=s,this.type=h,this.input=p,this.cases=_,this.outputs=k,this.otherwise=S}static parse(s,h){if(s.length<5)return h.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if(s.length%2!=1)return h.error("Expected an even number of arguments.");let p,_;h.expectedType&&h.expectedType.kind!=="value"&&(_=h.expectedType);const k={},S=[];for(let B=2;B<s.length-1;B+=2){let z=s[B];const R=s[B+1];Array.isArray(z)||(z=[z]);const j=h.concat(B);if(z.length===0)return j.error("Expected at least one branch label.");for(const Y of z){if(typeof Y!="number"&&typeof Y!="string")return j.error("Branch labels must be numbers or strings.");if(typeof Y=="number"&&Math.abs(Y)>Number.MAX_SAFE_INTEGER)return j.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof Y=="number"&&Math.floor(Y)!==Y)return j.error("Numeric branch labels must be integer values.");if(p){if(j.checkSubtype(p,si(Y)))return null}else p=si(Y);if(k[String(Y)]!==void 0)return j.error("Branch labels must be unique.");k[String(Y)]=S.length}const q=h.parse(R,B,_);if(!q)return null;_=_||q.type,S.push(q)}const T=h.parse(s[1],1,tt);if(!T)return null;const A=h.parse(s[s.length-1],s.length-1,_);return A?T.type.kind!=="value"&&h.concat(1).checkSubtype(p,T.type)?null:new ed(p,_,T,k,S,A):null}evaluate(s){const h=this.input.evaluate(s);return(si(h)===this.inputType&&this.outputs[this.cases[h]]||this.otherwise).evaluate(s)}eachChild(s){s(this.input),this.outputs.forEach(s),s(this.otherwise)}outputDefined(){return this.outputs.every(s=>s.outputDefined())&&this.otherwise.outputDefined()}}class iu{constructor(s,h,p){this.type=s,this.branches=h,this.otherwise=p}static parse(s,h){if(s.length<4)return h.error(`Expected at least 3 arguments, but found only ${s.length-1}.`);if(s.length%2!=0)return h.error("Expected an odd number of arguments.");let p;h.expectedType&&h.expectedType.kind!=="value"&&(p=h.expectedType);const _=[];for(let S=1;S<s.length-1;S+=2){const T=h.parse(s[S],S,Le);if(!T)return null;const A=h.parse(s[S+1],S+1,p);if(!A)return null;_.push([T,A]),p=p||A.type}const k=h.parse(s[s.length-1],s.length-1,p);if(!k)return null;if(!p)throw new Error("Can't infer output type");return new iu(p,_,k)}evaluate(s){for(const[h,p]of this.branches)if(h.evaluate(s))return p.evaluate(s);return this.otherwise.evaluate(s)}eachChild(s){for(const[h,p]of this.branches)s(h),s(p);s(this.otherwise)}outputDefined(){return this.branches.every(([s,h])=>h.outputDefined())&&this.otherwise.outputDefined()}}class Vl{constructor(s,h,p,_){this.type=s,this.input=h,this.beginIndex=p,this.endIndex=_}static parse(s,h){if(s.length<=2||s.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${s.length-1} instead.`);const p=h.parse(s[1],1,tt),_=h.parse(s[2],2,Ze);if(!p||!_)return null;if(!de(p.type,[H(tt),ke,tt]))return h.error(`Expected first argument to be of type array or string, but found ${U(p.type)} instead`);if(s.length===4){const k=h.parse(s[3],3,Ze);return k?new Vl(p.type,p,_,k):null}return new Vl(p.type,p,_)}evaluate(s){const h=this.input.evaluate(s),p=this.beginIndex.evaluate(s);let _;if(this.endIndex&&(_=this.endIndex.evaluate(s)),fe(h,["string"]))return[...h].slice(p,_).join("");if(fe(h,["array"]))return h.slice(p,_);throw new ni(`Expected first argument to be of type array or string, but found ${U(si(h))} instead.`)}eachChild(s){s(this.input),s(this.beginIndex),this.endIndex&&s(this.endIndex)}outputDefined(){return!1}}function ru(c,s){const h=c.length-1;let p,_,k=0,S=h,T=0;for(;k<=S;)if(T=Math.floor((k+S)/2),p=c[T],_=c[T+1],p<=s){if(T===h||s<_)return T;k=T+1}else{if(!(p>s))throw new ni("Input is not a number.");S=T-1}return 0}class Da{constructor(s,h,p){this.type=s,this.input=h,this.labels=[],this.outputs=[];for(const[_,k]of p)this.labels.push(_),this.outputs.push(k)}static parse(s,h){if(s.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if((s.length-1)%2!=0)return h.error("Expected an even number of arguments.");const p=h.parse(s[1],1,Ze);if(!p)return null;const _=[];let k=null;h.expectedType&&h.expectedType.kind!=="value"&&(k=h.expectedType);for(let S=1;S<s.length;S+=2){const T=S===1?-1/0:s[S],A=s[S+1],B=S,z=S+1;if(typeof T!="number")return h.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',B);if(_.length&&_[_.length-1][0]>=T)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',B);const R=h.parse(A,z,k);if(!R)return null;k=k||R.type,_.push([T,R])}return new Da(k,p,_)}evaluate(s){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(s);const _=this.input.evaluate(s);if(_<=h[0])return p[0].evaluate(s);const k=h.length;return _>=h[k-1]?p[k-1].evaluate(s):p[ru(h,_)].evaluate(s)}eachChild(s){s(this.input);for(const h of this.outputs)s(h)}outputDefined(){return this.outputs.every(s=>s.outputDefined())}}function Jf(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var c_=Qf;function Qf(c,s,h,p){this.cx=3*c,this.bx=3*(h-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*s,this.by=3*(p-s)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=s,this.p2x=h,this.p2y=p}Qf.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,s){if(s===void 0&&(s=1e-6),c<0)return 0;if(c>1)return 1;for(var h=c,p=0;p<8;p++){var _=this.sampleCurveX(h)-c;if(Math.abs(_)<s)return h;var k=this.sampleCurveDerivativeX(h);if(Math.abs(k)<1e-6)break;h-=_/k}var S=0,T=1;for(h=c,p=0;p<20&&(_=this.sampleCurveX(h),!(Math.abs(_-c)<s));p++)c>_?S=h:T=h,h=.5*(T-S)+S;return h},solve:function(c,s){return this.sampleCurveY(this.solveCurveX(c,s))}};var u_=Jf(c_);function js(c,s,h){return c+h*(s-c)}function Fl(c,s,h){return c.map((p,_)=>js(p,s[_],h))}const nr={number:js,color:function(c,s,h,p="rgb"){switch(p){case"rgb":{const[_,k,S,T]=Fl(c.rgb,s.rgb,h);return new kn(_,k,S,T,!1)}case"hcl":{const[_,k,S,T]=c.hcl,[A,B,z,R]=s.hcl;let j,q;if(isNaN(_)||isNaN(A))isNaN(_)?isNaN(A)?j=NaN:(j=A,S!==1&&S!==0||(q=B)):(j=_,z!==1&&z!==0||(q=k));else{let be=A-_;A>_&&be>180?be-=360:A<_&&_-A>180&&(be+=360),j=_+h*be}const[Y,K,re,ae]=function([be,pe,ye,Te]){return be=isNaN(be)?0:be*kt,Zn([ye,Math.cos(be)*pe,Math.sin(be)*pe,Te])}([j,q??js(k,B,h),js(S,z,h),js(T,R,h)]);return new kn(Y,K,re,ae,!1)}case"lab":{const[_,k,S,T]=Zn(Fl(c.lab,s.lab,h));return new kn(_,k,S,T,!1)}}},array:Fl,padding:function(c,s,h){return new gr(Fl(c.values,s.values,h))},variableAnchorOffsetCollection:function(c,s,h){const p=c.values,_=s.values;if(p.length!==_.length)throw new ni(`Cannot interpolate values of different length. from: ${c.toString()}, to: ${s.toString()}`);const k=[];for(let S=0;S<p.length;S+=2){if(p[S]!==_[S])throw new ni(`Cannot interpolate values containing mismatched anchors. from[${S}]: ${p[S]}, to[${S}]: ${_[S]}`);k.push(p[S]);const[T,A]=p[S+1],[B,z]=_[S+1];k.push([js(T,B,h),js(A,z,h)])}return new Nr(k)}};class ir{constructor(s,h,p,_,k){this.type=s,this.operator=h,this.interpolation=p,this.input=_,this.labels=[],this.outputs=[];for(const[S,T]of k)this.labels.push(S),this.outputs.push(T)}static interpolationFactor(s,h,p,_){let k=0;if(s.name==="exponential")k=ou(h,s.base,p,_);else if(s.name==="linear")k=ou(h,1,p,_);else if(s.name==="cubic-bezier"){const S=s.controlPoints;k=new u_(S[0],S[1],S[2],S[3]).solve(ou(h,1,p,_))}return k}static parse(s,h){let[p,_,k,...S]=s;if(!Array.isArray(_)||_.length===0)return h.error("Expected an interpolation type expression.",1);if(_[0]==="linear")_={name:"linear"};else if(_[0]==="exponential"){const B=_[1];if(typeof B!="number")return h.error("Exponential interpolation requires a numeric base.",1,1);_={name:"exponential",base:B}}else{if(_[0]!=="cubic-bezier")return h.error(`Unknown interpolation type ${String(_[0])}`,1,0);{const B=_.slice(1);if(B.length!==4||B.some(z=>typeof z!="number"||z<0||z>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);_={name:"cubic-bezier",controlPoints:B}}}if(s.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if((s.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(k=h.parse(k,2,Ze),!k)return null;const T=[];let A=null;p==="interpolate-hcl"||p==="interpolate-lab"?A=vt:h.expectedType&&h.expectedType.kind!=="value"&&(A=h.expectedType);for(let B=0;B<S.length;B+=2){const z=S[B],R=S[B+1],j=B+3,q=B+4;if(typeof z!="number")return h.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',j);if(T.length&&T[T.length-1][0]>=z)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',j);const Y=h.parse(R,q,A);if(!Y)return null;A=A||Y.type,T.push([z,Y])}return _e(A,Ze)||_e(A,vt)||_e(A,qi)||_e(A,se)||_e(A,H(Ze))?new ir(A,p,_,k,T):h.error(`Type ${U(A)} is not interpolatable.`)}evaluate(s){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(s);const _=this.input.evaluate(s);if(_<=h[0])return p[0].evaluate(s);const k=h.length;if(_>=h[k-1])return p[k-1].evaluate(s);const S=ru(h,_),T=ir.interpolationFactor(this.interpolation,_,h[S],h[S+1]),A=p[S].evaluate(s),B=p[S+1].evaluate(s);switch(this.operator){case"interpolate":return nr[this.type.kind](A,B,T);case"interpolate-hcl":return nr.color(A,B,T,"hcl");case"interpolate-lab":return nr.color(A,B,T,"lab")}}eachChild(s){s(this.input);for(const h of this.outputs)s(h)}outputDefined(){return this.outputs.every(s=>s.outputDefined())}}function ou(c,s,h,p){const _=p-h,k=c-h;return _===0?0:s===1?k/_:(Math.pow(s,k)-1)/(Math.pow(s,_)-1)}class su{constructor(s,h){this.type=s,this.args=h}static parse(s,h){if(s.length<2)return h.error("Expectected at least one argument.");let p=null;const _=h.expectedType;_&&_.kind!=="value"&&(p=_);const k=[];for(const T of s.slice(1)){const A=h.parse(T,1+k.length,p,void 0,{typeAnnotation:"omit"});if(!A)return null;p=p||A.type,k.push(A)}if(!p)throw new Error("No output type");const S=_&&k.some(T=>ie(_,T.type));return new su(S?tt:p,k)}evaluate(s){let h,p=null,_=0;for(const k of this.args)if(_++,p=k.evaluate(s),p&&p instanceof yr&&!p.available&&(h||(h=p.name),p=null,_===this.args.length&&(p=h)),p!==null)break;return p}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every(s=>s.outputDefined())}}function au(c,s){return c==="=="||c==="!="?s.kind==="boolean"||s.kind==="string"||s.kind==="number"||s.kind==="null"||s.kind==="value":s.kind==="string"||s.kind==="number"||s.kind==="value"}function em(c,s,h,p){return p.compare(s,h)===0}function Oa(c,s,h){const p=c!=="=="&&c!=="!=";return class AC{constructor(k,S,T){this.type=Le,this.lhs=k,this.rhs=S,this.collator=T,this.hasUntypedArgument=k.type.kind==="value"||S.type.kind==="value"}static parse(k,S){if(k.length!==3&&k.length!==4)return S.error("Expected two or three arguments.");const T=k[0];let A=S.parse(k[1],1,tt);if(!A)return null;if(!au(T,A.type))return S.concat(1).error(`"${T}" comparisons are not supported for type '${U(A.type)}'.`);let B=S.parse(k[2],2,tt);if(!B)return null;if(!au(T,B.type))return S.concat(2).error(`"${T}" comparisons are not supported for type '${U(B.type)}'.`);if(A.type.kind!==B.type.kind&&A.type.kind!=="value"&&B.type.kind!=="value")return S.error(`Cannot compare types '${U(A.type)}' and '${U(B.type)}'.`);p&&(A.type.kind==="value"&&B.type.kind!=="value"?A=new Qr(B.type,[A]):A.type.kind!=="value"&&B.type.kind==="value"&&(B=new Qr(A.type,[B])));let z=null;if(k.length===4){if(A.type.kind!=="string"&&B.type.kind!=="string"&&A.type.kind!=="value"&&B.type.kind!=="value")return S.error("Cannot use collator to compare non-string types.");if(z=S.parse(k[3],3,Rn),!z)return null}return new AC(A,B,z)}evaluate(k){const S=this.lhs.evaluate(k),T=this.rhs.evaluate(k);if(p&&this.hasUntypedArgument){const A=si(S),B=si(T);if(A.kind!==B.kind||A.kind!=="string"&&A.kind!=="number")throw new ni(`Expected arguments for "${c}" to be (string, string) or (number, number), but found (${A.kind}, ${B.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const A=si(S),B=si(T);if(A.kind!=="string"||B.kind!=="string")return s(k,S,T)}return this.collator?h(k,S,T,this.collator.evaluate(k)):s(k,S,T)}eachChild(k){k(this.lhs),k(this.rhs),this.collator&&k(this.collator)}outputDefined(){return!0}}}const h_=Oa("==",function(c,s,h){return s===h},em),tm=Oa("!=",function(c,s,h){return s!==h},function(c,s,h,p){return!em(0,s,h,p)}),nm=Oa("<",function(c,s,h){return s<h},function(c,s,h,p){return p.compare(s,h)<0}),d_=Oa(">",function(c,s,h){return s>h},function(c,s,h,p){return p.compare(s,h)>0}),p_=Oa("<=",function(c,s,h){return s<=h},function(c,s,h,p){return p.compare(s,h)<=0}),im=Oa(">=",function(c,s,h){return s>=h},function(c,s,h,p){return p.compare(s,h)>=0});class $l{constructor(s,h,p){this.type=Rn,this.locale=p,this.caseSensitive=s,this.diacriticSensitive=h}static parse(s,h){if(s.length!==2)return h.error("Expected one argument.");const p=s[1];if(typeof p!="object"||Array.isArray(p))return h.error("Collator options argument must be an object.");const _=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Le);if(!_)return null;const k=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Le);if(!k)return null;let S=null;return p.locale&&(S=h.parse(p.locale,1,ke),!S)?null:new $l(_,k,S)}evaluate(s){return new Yh(this.caseSensitive.evaluate(s),this.diacriticSensitive.evaluate(s),this.locale?this.locale.evaluate(s):null)}eachChild(s){s(this.caseSensitive),s(this.diacriticSensitive),this.locale&&s(this.locale)}outputDefined(){return!1}}class td{constructor(s,h,p,_,k){this.type=ke,this.number=s,this.locale=h,this.currency=p,this.minFractionDigits=_,this.maxFractionDigits=k}static parse(s,h){if(s.length!==3)return h.error("Expected two arguments.");const p=h.parse(s[1],1,Ze);if(!p)return null;const _=s[2];if(typeof _!="object"||Array.isArray(_))return h.error("NumberFormat options argument must be an object.");let k=null;if(_.locale&&(k=h.parse(_.locale,1,ke),!k))return null;let S=null;if(_.currency&&(S=h.parse(_.currency,1,ke),!S))return null;let T=null;if(_["min-fraction-digits"]&&(T=h.parse(_["min-fraction-digits"],1,Ze),!T))return null;let A=null;return _["max-fraction-digits"]&&(A=h.parse(_["max-fraction-digits"],1,Ze),!A)?null:new td(p,k,S,T,A)}evaluate(s){return new Intl.NumberFormat(this.locale?this.locale.evaluate(s):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(s):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(s):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(s):void 0}).format(this.number.evaluate(s))}eachChild(s){s(this.number),this.locale&&s(this.locale),this.currency&&s(this.currency),this.minFractionDigits&&s(this.minFractionDigits),this.maxFractionDigits&&s(this.maxFractionDigits)}outputDefined(){return!1}}class lu{constructor(s){this.type=Kn,this.sections=s}static parse(s,h){if(s.length<2)return h.error("Expected at least one argument.");const p=s[1];if(!Array.isArray(p)&&typeof p=="object")return h.error("First argument must be an image or text section.");const _=[];let k=!1;for(let S=1;S<=s.length-1;++S){const T=s[S];if(k&&typeof T=="object"&&!Array.isArray(T)){k=!1;let A=null;if(T["font-scale"]&&(A=h.parse(T["font-scale"],1,Ze),!A))return null;let B=null;if(T["text-font"]&&(B=h.parse(T["text-font"],1,H(ke)),!B))return null;let z=null;if(T["text-color"]&&(z=h.parse(T["text-color"],1,vt),!z))return null;const R=_[_.length-1];R.scale=A,R.font=B,R.textColor=z}else{const A=h.parse(s[S],1,tt);if(!A)return null;const B=A.type.kind;if(B!=="string"&&B!=="value"&&B!=="null"&&B!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");k=!0,_.push({content:A,scale:null,font:null,textColor:null})}}return new lu(_)}evaluate(s){return new mr(this.sections.map(h=>{const p=h.content.evaluate(s);return si(p)===fr?new Xh("",p,null,null,null):new Xh(Rl(p),null,h.scale?h.scale.evaluate(s):null,h.font?h.font.evaluate(s).join(","):null,h.textColor?h.textColor.evaluate(s):null)}))}eachChild(s){for(const h of this.sections)s(h.content),h.scale&&s(h.scale),h.font&&s(h.font),h.textColor&&s(h.textColor)}outputDefined(){return!1}}class nd{constructor(s){this.type=fr,this.input=s}static parse(s,h){if(s.length!==2)return h.error("Expected two arguments.");const p=h.parse(s[1],1,ke);return p?new nd(p):h.error("No image name provided.")}evaluate(s){const h=this.input.evaluate(s),p=yr.fromString(h);return p&&s.availableImages&&(p.available=s.availableImages.indexOf(h)>-1),p}eachChild(s){s(this.input)}outputDefined(){return!1}}class id{constructor(s){this.type=Ze,this.input=s}static parse(s,h){if(s.length!==2)return h.error(`Expected 1 argument, but found ${s.length-1} instead.`);const p=h.parse(s[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${U(p.type)} instead.`):new id(p):null}evaluate(s){const h=this.input.evaluate(s);if(typeof h=="string")return[...h].length;if(Array.isArray(h))return h.length;throw new ni(`Expected value to be of type string or array, but found ${U(si(h))} instead.`)}eachChild(s){s(this.input)}outputDefined(){return!1}}const Mo=8192;function f_(c,s){const h=(180+c[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c[1]*Math.PI/360)))/360,_=Math.pow(2,s.z);return[Math.round(h*_*Mo),Math.round(p*_*Mo)]}function rd(c,s){const h=Math.pow(2,s.z);return[(_=(c[0]/Mo+s.x)/h,360*_-180),(p=(c[1]/Mo+s.y)/h,360/Math.PI*Math.atan(Math.exp((180-360*p)*Math.PI/180))-90)];var p,_}function Us(c,s){c[0]=Math.min(c[0],s[0]),c[1]=Math.min(c[1],s[1]),c[2]=Math.max(c[2],s[0]),c[3]=Math.max(c[3],s[1])}function ps(c,s){return!(c[0]<=s[0]||c[2]>=s[2]||c[1]<=s[1]||c[3]>=s[3])}function _n(c,s,h){const p=c[0]-s[0],_=c[1]-s[1],k=c[0]-h[0],S=c[1]-h[1];return p*S-k*_==0&&p*k<=0&&_*S<=0}function cu(c,s,h,p){return(_=[p[0]-h[0],p[1]-h[1]])[0]*(k=[s[0]-c[0],s[1]-c[1]])[1]-_[1]*k[0]!=0&&!(!om(c,s,h,p)||!om(h,p,c,s));var _,k}function m_(c,s,h){for(const p of h)for(let _=0;_<p.length-1;++_)if(cu(c,s,p[_],p[_+1]))return!0;return!1}function Ba(c,s,h=!1){let p=!1;for(const T of s)for(let A=0;A<T.length-1;A++){if(_n(c,T[A],T[A+1]))return h;(k=T[A])[1]>(_=c)[1]!=(S=T[A+1])[1]>_[1]&&_[0]<(S[0]-k[0])*(_[1]-k[1])/(S[1]-k[1])+k[0]&&(p=!p)}var _,k,S;return p}function g_(c,s){for(const h of s)if(Ba(c,h))return!0;return!1}function rm(c,s){for(const h of c)if(!Ba(h,s))return!1;for(let h=0;h<c.length-1;++h)if(m_(c[h],c[h+1],s))return!1;return!0}function y_(c,s){for(const h of s)if(rm(c,h))return!0;return!1}function om(c,s,h,p){const _=p[0]-h[0],k=p[1]-h[1],S=(c[0]-h[0])*k-_*(c[1]-h[1]),T=(s[0]-h[0])*k-_*(s[1]-h[1]);return S>0&&T<0||S<0&&T>0}function od(c,s,h){const p=[];for(let _=0;_<c.length;_++){const k=[];for(let S=0;S<c[_].length;S++){const T=f_(c[_][S],h);Us(s,T),k.push(T)}p.push(k)}return p}function sm(c,s,h){const p=[];for(let _=0;_<c.length;_++){const k=od(c[_],s,h);p.push(k)}return p}function am(c,s,h,p){if(c[0]<h[0]||c[0]>h[2]){const _=.5*p;let k=c[0]-h[0]>_?-p:h[0]-c[0]>_?p:0;k===0&&(k=c[0]-h[2]>_?-p:h[2]-c[0]>_?p:0),c[0]+=k}Us(s,c)}function lm(c,s,h,p){const _=Math.pow(2,p.z)*Mo,k=[p.x*Mo,p.y*Mo],S=[];for(const T of c)for(const A of T){const B=[A.x+k[0],A.y+k[1]];am(B,s,h,_),S.push(B)}return S}function cm(c,s,h,p){const _=Math.pow(2,p.z)*Mo,k=[p.x*Mo,p.y*Mo],S=[];for(const A of c){const B=[];for(const z of A){const R=[z.x+k[0],z.y+k[1]];Us(s,R),B.push(R)}S.push(B)}if(s[2]-s[0]<=_/2){(T=s)[0]=T[1]=1/0,T[2]=T[3]=-1/0;for(const A of S)for(const B of A)am(B,s,h,_)}var T;return S}class Hs{constructor(s,h){this.type=Le,this.geojson=s,this.geometries=h}static parse(s,h){if(s.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${s.length-1} instead.`);if(Fs(s[1])){const p=s[1];if(p.type==="FeatureCollection"){const _=[];for(const k of p.features){const{type:S,coordinates:T}=k.geometry;S==="Polygon"&&_.push(T),S==="MultiPolygon"&&_.push(...T)}if(_.length)return new Hs(p,{type:"MultiPolygon",coordinates:_})}else if(p.type==="Feature"){const _=p.geometry.type;if(_==="Polygon"||_==="MultiPolygon")return new Hs(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Hs(p,p)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(s){if(s.geometry()!=null&&s.canonicalID()!=null){if(s.geometryType()==="Point")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],k=[1/0,1/0,-1/0,-1/0],S=h.canonicalID();if(p.type==="Polygon"){const T=od(p.coordinates,k,S),A=lm(h.geometry(),_,k,S);if(!ps(_,k))return!1;for(const B of A)if(!Ba(B,T))return!1}if(p.type==="MultiPolygon"){const T=sm(p.coordinates,k,S),A=lm(h.geometry(),_,k,S);if(!ps(_,k))return!1;for(const B of A)if(!g_(B,T))return!1}return!0}(s,this.geometries);if(s.geometryType()==="LineString")return function(h,p){const _=[1/0,1/0,-1/0,-1/0],k=[1/0,1/0,-1/0,-1/0],S=h.canonicalID();if(p.type==="Polygon"){const T=od(p.coordinates,k,S),A=cm(h.geometry(),_,k,S);if(!ps(_,k))return!1;for(const B of A)if(!rm(B,T))return!1}if(p.type==="MultiPolygon"){const T=sm(p.coordinates,k,S),A=cm(h.geometry(),_,k,S);if(!ps(_,k))return!1;for(const B of A)if(!y_(B,T))return!1}return!0}(s,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let um=class{constructor(c=[],s=(h,p)=>h<p?-1:h>p?1:0){if(this.data=c,this.length=this.data.length,this.compare=s,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(c){this.data.push(c),this._up(this.length++)}pop(){if(this.length===0)return;const c=this.data[0],s=this.data.pop();return--this.length>0&&(this.data[0]=s,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:s,compare:h}=this,p=s[c];for(;c>0;){const _=c-1>>1,k=s[_];if(h(p,k)>=0)break;s[c]=k,c=_}s[c]=p}_down(c){const{data:s,compare:h}=this,p=this.length>>1,_=s[c];for(;c<p;){let k=1+(c<<1);const S=k+1;if(S<this.length&&h(s[S],s[k])<0&&(k=S),h(s[k],_)>=0)break;s[c]=s[k],c=k}s[c]=_}};function __(c,s,h,p,_){hm(c,s,h,p||c.length-1,_||b_)}function hm(c,s,h,p,_){for(;p>h;){if(p-h>600){var k=p-h+1,S=s-h+1,T=Math.log(k),A=.5*Math.exp(2*T/3),B=.5*Math.sqrt(T*A*(k-A)/k)*(S-k/2<0?-1:1);hm(c,s,Math.max(h,Math.floor(s-S*A/k+B)),Math.min(p,Math.floor(s+(k-S)*A/k+B)),_)}var z=c[s],R=h,j=p;for(jl(c,h,s),_(c[p],z)>0&&jl(c,h,p);R<j;){for(jl(c,R,j),R++,j--;_(c[R],z)<0;)R++;for(;_(c[j],z)>0;)j--}_(c[h],z)===0?jl(c,h,j):jl(c,++j,p),j<=s&&(h=j+1),s<=j&&(p=j-1)}}function jl(c,s,h){var p=c[s];c[s]=c[h],c[h]=p}function b_(c,s){return c<s?-1:c>s?1:0}function uu(c,s){if(c.length<=1)return[c];const h=[];let p,_;for(const k of c){const S=v_(k);S!==0&&(k.area=Math.abs(S),_===void 0&&(_=S<0),_===S<0?(p&&h.push(p),p=[k]):p.push(k))}if(p&&h.push(p),s>1)for(let k=0;k<h.length;k++)h[k].length<=s||(__(h[k],s,1,h[k].length-1,x_),h[k]=h[k].slice(0,s));return h}function x_(c,s){return s.area-c.area}function v_(c){let s=0;for(let h,p,_=0,k=c.length,S=k-1;_<k;S=_++)h=c[_],p=c[S],s+=(p.x-h.x)*(h.y+p.y);return s}const dm=1/298.257223563,pm=dm*(2-dm),fm=Math.PI/180;class sd{constructor(s){const h=6378.137*fm*1e3,p=Math.cos(s*fm),_=1/(1-pm*(1-p*p)),k=Math.sqrt(_);this.kx=h*k*p,this.ky=h*k*_*(1-pm)}distance(s,h){const p=this.wrap(s[0]-h[0])*this.kx,_=(s[1]-h[1])*this.ky;return Math.sqrt(p*p+_*_)}pointOnLine(s,h){let p,_,k,S,T=1/0;for(let A=0;A<s.length-1;A++){let B=s[A][0],z=s[A][1],R=this.wrap(s[A+1][0]-B)*this.kx,j=(s[A+1][1]-z)*this.ky,q=0;R===0&&j===0||(q=(this.wrap(h[0]-B)*this.kx*R+(h[1]-z)*this.ky*j)/(R*R+j*j),q>1?(B=s[A+1][0],z=s[A+1][1]):q>0&&(B+=R/this.kx*q,z+=j/this.ky*q)),R=this.wrap(h[0]-B)*this.kx,j=(h[1]-z)*this.ky;const Y=R*R+j*j;Y<T&&(T=Y,p=B,_=z,k=A,S=q)}return{point:[p,_],index:k,t:Math.max(0,Math.min(1,S))}}wrap(s){for(;s<-180;)s+=360;for(;s>180;)s-=360;return s}}function mm(c,s){return s[0]-c[0]}function hu(c){return c[1]-c[0]+1}function Ho(c,s){return c[1]>=c[0]&&c[1]<s}function ad(c,s){if(c[0]>c[1])return[null,null];const h=hu(c);if(s){if(h===2)return[c,null];const _=Math.floor(h/2);return[[c[0],c[0]+_],[c[0]+_,c[1]]]}if(h===1)return[c,null];const p=Math.floor(h/2)-1;return[[c[0],c[0]+p],[c[0]+p+1,c[1]]]}function ld(c,s){if(!Ho(s,c.length))return[1/0,1/0,-1/0,-1/0];const h=[1/0,1/0,-1/0,-1/0];for(let p=s[0];p<=s[1];++p)Us(h,c[p]);return h}function cd(c){const s=[1/0,1/0,-1/0,-1/0];for(const h of c)for(const p of h)Us(s,p);return s}function du(c){return c[0]!==-1/0&&c[1]!==-1/0&&c[2]!==1/0&&c[3]!==1/0}function ud(c,s,h){if(!du(c)||!du(s))return NaN;let p=0,_=0;return c[2]<s[0]&&(p=s[0]-c[2]),c[0]>s[2]&&(p=c[0]-s[2]),c[1]>s[3]&&(_=c[1]-s[3]),c[3]<s[1]&&(_=s[1]-c[3]),h.distance([0,0],[p,_])}function qs(c,s,h){const p=h.pointOnLine(s,c);return h.distance(c,p.point)}function hd(c,s,h,p,_){const k=Math.min(qs(c,[h,p],_),qs(s,[h,p],_)),S=Math.min(qs(h,[c,s],_),qs(p,[c,s],_));return Math.min(k,S)}function w_(c,s,h,p,_){if(!Ho(s,c.length)||!Ho(p,h.length))return 1/0;let k=1/0;for(let S=s[0];S<s[1];++S){const T=c[S],A=c[S+1];for(let B=p[0];B<p[1];++B){const z=h[B],R=h[B+1];if(cu(T,A,z,R))return 0;k=Math.min(k,hd(T,A,z,R,_))}}return k}function Jn(c,s,h,p,_){if(!Ho(s,c.length)||!Ho(p,h.length))return NaN;let k=1/0;for(let S=s[0];S<=s[1];++S)for(let T=p[0];T<=p[1];++T)if(k=Math.min(k,_.distance(c[S],h[T])),k===0)return k;return k}function k_(c,s,h){if(Ba(c,s,!0))return 0;let p=1/0;for(const _ of s){const k=_[0],S=_[_.length-1];if(k!==S&&(p=Math.min(p,qs(c,[S,k],h)),p===0))return p;const T=h.pointOnLine(_,c);if(p=Math.min(p,h.distance(c,T.point)),p===0)return p}return p}function Gt(c,s,h,p){if(!Ho(s,c.length))return NaN;for(let k=s[0];k<=s[1];++k)if(Ba(c[k],h,!0))return 0;let _=1/0;for(let k=s[0];k<s[1];++k){const S=c[k],T=c[k+1];for(const A of h)for(let B=0,z=A.length,R=z-1;B<z;R=B++){const j=A[R],q=A[B];if(cu(S,T,j,q))return 0;_=Math.min(_,hd(S,T,j,q,p))}}return _}function pu(c,s){for(const h of c)for(const p of h)if(Ba(p,s,!0))return!0;return!1}function On(c,s,h,p=1/0){const _=cd(c),k=cd(s);if(p!==1/0&&ud(_,k,h)>=p)return p;if(ps(_,k)){if(pu(c,s))return 0}else if(pu(s,c))return 0;let S=1/0;for(const T of c)for(let A=0,B=T.length,z=B-1;A<B;z=A++){const R=T[z],j=T[A];for(const q of s)for(let Y=0,K=q.length,re=K-1;Y<K;re=Y++){const ae=q[re],be=q[Y];if(cu(R,j,ae,be))return 0;S=Math.min(S,hd(R,j,ae,be,h))}}return S}function Tn(c,s,h,p,_,k){if(!k)return;const S=ud(ld(p,k),_,h);S<s&&c.push([S,k,[0,0]])}function Ws(c,s,h,p,_,k,S){if(!k||!S)return;const T=ud(ld(p,k),ld(_,S),h);T<s&&c.push([T,k,S])}function Ul(c,s,h,p,_=1/0){let k=Math.min(p.distance(c[0],h[0][0]),_);if(k===0)return k;const S=new um([[0,[0,c.length-1],[0,0]]],mm),T=cd(h);for(;S.length>0;){const A=S.pop();if(A[0]>=k)continue;const B=A[1],z=s?50:100;if(hu(B)<=z){if(!Ho(B,c.length))return NaN;if(s){const R=Gt(c,B,h,p);if(isNaN(R)||R===0)return R;k=Math.min(k,R)}else for(let R=B[0];R<=B[1];++R){const j=k_(c[R],h,p);if(k=Math.min(k,j),k===0)return 0}}else{const R=ad(B,s);Tn(S,k,p,c,T,R[0]),Tn(S,k,p,c,T,R[1])}}return k}function Hl(c,s,h,p,_,k=1/0){let S=Math.min(k,_.distance(c[0],h[0]));if(S===0)return S;const T=new um([[0,[0,c.length-1],[0,h.length-1]]],mm);for(;T.length>0;){const A=T.pop();if(A[0]>=S)continue;const B=A[1],z=A[2],R=s?50:100,j=p?50:100;if(hu(B)<=R&&hu(z)<=j){if(!Ho(B,c.length)&&Ho(z,h.length))return NaN;let q;if(s&&p)q=w_(c,B,h,z,_),S=Math.min(S,q);else if(s&&!p){const Y=c.slice(B[0],B[1]+1);for(let K=z[0];K<=z[1];++K)if(q=qs(h[K],Y,_),S=Math.min(S,q),S===0)return S}else if(!s&&p){const Y=h.slice(z[0],z[1]+1);for(let K=B[0];K<=B[1];++K)if(q=qs(c[K],Y,_),S=Math.min(S,q),S===0)return S}else q=Jn(c,B,h,z,_),S=Math.min(S,q)}else{const q=ad(B,s),Y=ad(z,p);Ws(T,S,_,c,h,q[0],Y[0]),Ws(T,S,_,c,h,q[0],Y[1]),Ws(T,S,_,c,h,q[1],Y[0]),Ws(T,S,_,c,h,q[1],Y[1])}}return S}function dd(c){return c.type==="MultiPolygon"?c.coordinates.map(s=>({type:"Polygon",coordinates:s})):c.type==="MultiLineString"?c.coordinates.map(s=>({type:"LineString",coordinates:s})):c.type==="MultiPoint"?c.coordinates.map(s=>({type:"Point",coordinates:s})):[c]}class Gs{constructor(s,h){this.type=Ze,this.geojson=s,this.geometries=h}static parse(s,h){if(s.length!==2)return h.error(`'distance' expression requires exactly one argument, but found ${s.length-1} instead.`);if(Fs(s[1])){const p=s[1];if(p.type==="FeatureCollection")return new Gs(p,p.features.map(_=>dd(_.geometry)).flat());if(p.type==="Feature")return new Gs(p,dd(p.geometry));if("type"in p&&"coordinates"in p)return new Gs(p,dd(p))}return h.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(s){if(s.geometry()!=null&&s.canonicalID()!=null){if(s.geometryType()==="Point")return function(h,p){const _=h.geometry(),k=_.flat().map(A=>rd([A.x,A.y],h.canonical));if(_.length===0)return NaN;const S=new sd(k[0][1]);let T=1/0;for(const A of p){switch(A.type){case"Point":T=Math.min(T,Hl(k,!1,[A.coordinates],!1,S,T));break;case"LineString":T=Math.min(T,Hl(k,!1,A.coordinates,!0,S,T));break;case"Polygon":T=Math.min(T,Ul(k,!1,A.coordinates,S,T))}if(T===0)return T}return T}(s,this.geometries);if(s.geometryType()==="LineString")return function(h,p){const _=h.geometry(),k=_.flat().map(A=>rd([A.x,A.y],h.canonical));if(_.length===0)return NaN;const S=new sd(k[0][1]);let T=1/0;for(const A of p){switch(A.type){case"Point":T=Math.min(T,Hl(k,!0,[A.coordinates],!1,S,T));break;case"LineString":T=Math.min(T,Hl(k,!0,A.coordinates,!0,S,T));break;case"Polygon":T=Math.min(T,Ul(k,!0,A.coordinates,S,T))}if(T===0)return T}return T}(s,this.geometries);if(s.geometryType()==="Polygon")return function(h,p){const _=h.geometry();if(_.length===0||_[0].length===0)return NaN;const k=uu(_,0).map(A=>A.map(B=>B.map(z=>rd([z.x,z.y],h.canonical)))),S=new sd(k[0][0][0][1]);let T=1/0;for(const A of p)for(const B of k){switch(A.type){case"Point":T=Math.min(T,Ul([A.coordinates],!1,B,S,T));break;case"LineString":T=Math.min(T,Ul(A.coordinates,!0,B,S,T));break;case"Polygon":T=Math.min(T,On(B,A.coordinates,S,T))}if(T===0)return T}return T}(s,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const za={"==":h_,"!=":tm,">":d_,"<":nm,">=":im,"<=":p_,array:Qr,at:Jh,boolean:Qr,case:iu,coalesce:su,collator:$l,format:lu,image:nd,in:Qh,"index-of":Pa,interpolate:ir,"interpolate-hcl":ir,"interpolate-lab":ir,length:id,let:ds,literal:Jr,match:ed,number:Qr,"number-format":td,object:Qr,slice:Vl,step:Da,string:Qr,"to-boolean":eo,"to-color":eo,"to-number":eo,"to-string":eo,var:fn,within:Hs,distance:Gs};class Lr{constructor(s,h,p,_){this.name=s,this.type=h,this._evaluate=p,this.args=_}evaluate(s){return this._evaluate(s,this.args)}eachChild(s){this.args.forEach(s)}outputDefined(){return!1}static parse(s,h){const p=s[0],_=Lr.definitions[p];if(!_)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const k=Array.isArray(_)?_[0]:_.type,S=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,T=S.filter(([B])=>!Array.isArray(B)||B.length===s.length-1);let A=null;for(const[B,z]of T){A=new $s(h.registry,ql,h.path,null,h.scope);const R=[];let j=!1;for(let q=1;q<s.length;q++){const Y=s[q],K=Array.isArray(B)?B[q-1]:B.type,re=A.parse(Y,1+R.length,K);if(!re){j=!0;break}R.push(re)}if(!j)if(Array.isArray(B)&&B.length!==R.length)A.error(`Expected ${B.length} arguments, but found ${R.length} instead.`);else{for(let q=0;q<R.length;q++){const Y=Array.isArray(B)?B[q]:B.type,K=R[q];A.concat(q+1).checkSubtype(Y,K.type)}if(A.errors.length===0)return new Lr(p,k,z,R)}}if(T.length===1)h.errors.push(...A.errors);else{const B=(T.length?T:S).map(([R])=>{return j=R,Array.isArray(j)?`(${j.map(U).join(", ")})`:`(${U(j.type)}...)`;var j}).join(" | "),z=[];for(let R=1;R<s.length;R++){const j=h.parse(s[R],1+z.length);if(!j)return null;z.push(U(j.type))}h.error(`Expected arguments of type ${B}, but found (${z.join(", ")}) instead.`)}return null}static register(s,h){Lr.definitions=h;for(const p in h)s[p]=Lr}}function pd(c,[s,h,p,_]){s=s.evaluate(c),h=h.evaluate(c),p=p.evaluate(c);const k=_?_.evaluate(c):1,S=Ia(s,h,p,k);if(S)throw new ni(S);return new kn(s/255,h/255,p/255,k,!1)}function fd(c,s){return c in s}function md(c,s){const h=s[c];return h===void 0?null:h}function Zs(c){return{type:c}}function ql(c){if(c instanceof fn)return ql(c.boundExpression);if(c instanceof Lr&&c.name==="error"||c instanceof $l||c instanceof Hs||c instanceof Gs)return!1;const s=c instanceof eo||c instanceof Qr;let h=!0;return c.eachChild(p=>{h=s?h&&ql(p):h&&p instanceof Jr}),!!h&&Wl(c)&&Gl(c,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Wl(c){if(c instanceof Lr&&(c.name==="get"&&c.args.length===1||c.name==="feature-state"||c.name==="has"&&c.args.length===1||c.name==="properties"||c.name==="geometry-type"||c.name==="id"||/^filter-/.test(c.name))||c instanceof Hs||c instanceof Gs)return!1;let s=!0;return c.eachChild(h=>{s&&!Wl(h)&&(s=!1)}),s}function Na(c){if(c instanceof Lr&&c.name==="feature-state")return!1;let s=!0;return c.eachChild(h=>{s&&!Na(h)&&(s=!1)}),s}function Gl(c,s){if(c instanceof Lr&&s.indexOf(c.name)>=0)return!1;let h=!0;return c.eachChild(p=>{h&&!Gl(p,s)&&(h=!1)}),h}function fu(c){return{result:"success",value:c}}function La(c){return{result:"error",value:c}}function Ra(c){return c["property-type"]==="data-driven"||c["property-type"]==="cross-faded-data-driven"}function gm(c){return!!c.expression&&c.expression.parameters.indexOf("zoom")>-1}function gd(c){return!!c.expression&&c.expression.interpolated}function un(c){return c instanceof Number?"number":c instanceof String?"string":c instanceof Boolean?"boolean":Array.isArray(c)?"array":c===null?"null":typeof c}function mu(c){return typeof c=="object"&&c!==null&&!Array.isArray(c)}function S_(c){return c}function ym(c,s){const h=s.type==="color",p=c.stops&&typeof c.stops[0][0]=="object",_=p||!(p||c.property!==void 0),k=c.type||(gd(s)?"exponential":"interval");if(h||s.type==="padding"){const z=h?kn.parse:gr.parse;(c=Br({},c)).stops&&(c.stops=c.stops.map(R=>[R[0],z(R[1])])),c.default=z(c.default?c.default:s.default)}if(c.colorSpace&&(S=c.colorSpace)!=="rgb"&&S!=="hcl"&&S!=="lab")throw new Error(`Unknown color space: "${c.colorSpace}"`);var S;let T,A,B;if(k==="exponential")T=bm;else if(k==="interval")T=gu;else if(k==="categorical"){T=_m,A=Object.create(null);for(const z of c.stops)A[z[0]]=z[1];B=typeof c.stops[0][0]}else{if(k!=="identity")throw new Error(`Unknown function type "${k}"`);T=xm}if(p){const z={},R=[];for(let Y=0;Y<c.stops.length;Y++){const K=c.stops[Y],re=K[0].zoom;z[re]===void 0&&(z[re]={zoom:re,type:c.type,property:c.property,default:c.default,stops:[]},R.push(re)),z[re].stops.push([K[0].value,K[1]])}const j=[];for(const Y of R)j.push([z[Y].zoom,ym(z[Y],s)]);const q={name:"linear"};return{kind:"composite",interpolationType:q,interpolationFactor:ir.interpolationFactor.bind(void 0,q),zoomStops:j.map(Y=>Y[0]),evaluate:({zoom:Y},K)=>bm({stops:j,base:c.base},s,Y).evaluate(Y,K)}}if(_){const z=k==="exponential"?{name:"exponential",base:c.base!==void 0?c.base:1}:null;return{kind:"camera",interpolationType:z,interpolationFactor:ir.interpolationFactor.bind(void 0,z),zoomStops:c.stops.map(R=>R[0]),evaluate:({zoom:R})=>T(c,s,R,A,B)}}return{kind:"source",evaluate(z,R){const j=R&&R.properties?R.properties[c.property]:void 0;return j===void 0?Va(c.default,s.default):T(c,s,j,A,B)}}}function Va(c,s,h){return c!==void 0?c:s!==void 0?s:h!==void 0?h:void 0}function _m(c,s,h,p,_){return Va(typeof h===_?p[h]:void 0,c.default,s.default)}function gu(c,s,h){if(un(h)!=="number")return Va(c.default,s.default);const p=c.stops.length;if(p===1||h<=c.stops[0][0])return c.stops[0][1];if(h>=c.stops[p-1][0])return c.stops[p-1][1];const _=ru(c.stops.map(k=>k[0]),h);return c.stops[_][1]}function bm(c,s,h){const p=c.base!==void 0?c.base:1;if(un(h)!=="number")return Va(c.default,s.default);const _=c.stops.length;if(_===1||h<=c.stops[0][0])return c.stops[0][1];if(h>=c.stops[_-1][0])return c.stops[_-1][1];const k=ru(c.stops.map(z=>z[0]),h),S=function(z,R,j,q){const Y=q-j,K=z-j;return Y===0?0:R===1?K/Y:(Math.pow(R,K)-1)/(Math.pow(R,Y)-1)}(h,p,c.stops[k][0],c.stops[k+1][0]),T=c.stops[k][1],A=c.stops[k+1][1],B=nr[s.type]||S_;return typeof T.evaluate=="function"?{evaluate(...z){const R=T.evaluate.apply(void 0,z),j=A.evaluate.apply(void 0,z);if(R!==void 0&&j!==void 0)return B(R,j,S,c.colorSpace)}}:B(T,A,S,c.colorSpace)}function xm(c,s,h){switch(s.type){case"color":h=kn.parse(h);break;case"formatted":h=mr.fromString(h.toString());break;case"resolvedImage":h=yr.fromString(h.toString());break;case"padding":h=gr.parse(h);break;default:un(h)===s.type||s.type==="enum"&&s.values[h]||(h=void 0)}return Va(h,c.default,s.default)}Lr.register(za,{error:[{kind:"error"},[ke],(c,[s])=>{throw new ni(s.evaluate(c))}],typeof:[ke,[tt],(c,[s])=>U(si(s.evaluate(c)))],"to-rgba":[H(Ze,4),[vt],(c,[s])=>{const[h,p,_,k]=s.evaluate(c).rgb;return[255*h,255*p,255*_,k]}],rgb:[vt,[Ze,Ze,Ze],pd],rgba:[vt,[Ze,Ze,Ze,Ze],pd],has:{type:Le,overloads:[[[ke],(c,[s])=>fd(s.evaluate(c),c.properties())],[[ke,Wt],(c,[s,h])=>fd(s.evaluate(c),h.evaluate(c))]]},get:{type:tt,overloads:[[[ke],(c,[s])=>md(s.evaluate(c),c.properties())],[[ke,Wt],(c,[s,h])=>md(s.evaluate(c),h.evaluate(c))]]},"feature-state":[tt,[ke],(c,[s])=>md(s.evaluate(c),c.featureState||{})],properties:[Wt,[],c=>c.properties()],"geometry-type":[ke,[],c=>c.geometryType()],id:[tt,[],c=>c.id()],zoom:[Ze,[],c=>c.globals.zoom],"heatmap-density":[Ze,[],c=>c.globals.heatmapDensity||0],"line-progress":[Ze,[],c=>c.globals.lineProgress||0],accumulated:[tt,[],c=>c.globals.accumulated===void 0?null:c.globals.accumulated],"+":[Ze,Zs(Ze),(c,s)=>{let h=0;for(const p of s)h+=p.evaluate(c);return h}],"*":[Ze,Zs(Ze),(c,s)=>{let h=1;for(const p of s)h*=p.evaluate(c);return h}],"-":{type:Ze,overloads:[[[Ze,Ze],(c,[s,h])=>s.evaluate(c)-h.evaluate(c)],[[Ze],(c,[s])=>-s.evaluate(c)]]},"/":[Ze,[Ze,Ze],(c,[s,h])=>s.evaluate(c)/h.evaluate(c)],"%":[Ze,[Ze,Ze],(c,[s,h])=>s.evaluate(c)%h.evaluate(c)],ln2:[Ze,[],()=>Math.LN2],pi:[Ze,[],()=>Math.PI],e:[Ze,[],()=>Math.E],"^":[Ze,[Ze,Ze],(c,[s,h])=>Math.pow(s.evaluate(c),h.evaluate(c))],sqrt:[Ze,[Ze],(c,[s])=>Math.sqrt(s.evaluate(c))],log10:[Ze,[Ze],(c,[s])=>Math.log(s.evaluate(c))/Math.LN10],ln:[Ze,[Ze],(c,[s])=>Math.log(s.evaluate(c))],log2:[Ze,[Ze],(c,[s])=>Math.log(s.evaluate(c))/Math.LN2],sin:[Ze,[Ze],(c,[s])=>Math.sin(s.evaluate(c))],cos:[Ze,[Ze],(c,[s])=>Math.cos(s.evaluate(c))],tan:[Ze,[Ze],(c,[s])=>Math.tan(s.evaluate(c))],asin:[Ze,[Ze],(c,[s])=>Math.asin(s.evaluate(c))],acos:[Ze,[Ze],(c,[s])=>Math.acos(s.evaluate(c))],atan:[Ze,[Ze],(c,[s])=>Math.atan(s.evaluate(c))],min:[Ze,Zs(Ze),(c,s)=>Math.min(...s.map(h=>h.evaluate(c)))],max:[Ze,Zs(Ze),(c,s)=>Math.max(...s.map(h=>h.evaluate(c)))],abs:[Ze,[Ze],(c,[s])=>Math.abs(s.evaluate(c))],round:[Ze,[Ze],(c,[s])=>{const h=s.evaluate(c);return h<0?-Math.round(-h):Math.round(h)}],floor:[Ze,[Ze],(c,[s])=>Math.floor(s.evaluate(c))],ceil:[Ze,[Ze],(c,[s])=>Math.ceil(s.evaluate(c))],"filter-==":[Le,[ke,tt],(c,[s,h])=>c.properties()[s.value]===h.value],"filter-id-==":[Le,[tt],(c,[s])=>c.id()===s.value],"filter-type-==":[Le,[ke],(c,[s])=>c.geometryType()===s.value],"filter-<":[Le,[ke,tt],(c,[s,h])=>{const p=c.properties()[s.value],_=h.value;return typeof p==typeof _&&p<_}],"filter-id-<":[Le,[tt],(c,[s])=>{const h=c.id(),p=s.value;return typeof h==typeof p&&h<p}],"filter->":[Le,[ke,tt],(c,[s,h])=>{const p=c.properties()[s.value],_=h.value;return typeof p==typeof _&&p>_}],"filter-id->":[Le,[tt],(c,[s])=>{const h=c.id(),p=s.value;return typeof h==typeof p&&h>p}],"filter-<=":[Le,[ke,tt],(c,[s,h])=>{const p=c.properties()[s.value],_=h.value;return typeof p==typeof _&&p<=_}],"filter-id-<=":[Le,[tt],(c,[s])=>{const h=c.id(),p=s.value;return typeof h==typeof p&&h<=p}],"filter->=":[Le,[ke,tt],(c,[s,h])=>{const p=c.properties()[s.value],_=h.value;return typeof p==typeof _&&p>=_}],"filter-id->=":[Le,[tt],(c,[s])=>{const h=c.id(),p=s.value;return typeof h==typeof p&&h>=p}],"filter-has":[Le,[tt],(c,[s])=>s.value in c.properties()],"filter-has-id":[Le,[],c=>c.id()!==null&&c.id()!==void 0],"filter-type-in":[Le,[H(ke)],(c,[s])=>s.value.indexOf(c.geometryType())>=0],"filter-id-in":[Le,[H(tt)],(c,[s])=>s.value.indexOf(c.id())>=0],"filter-in-small":[Le,[ke,H(tt)],(c,[s,h])=>h.value.indexOf(c.properties()[s.value])>=0],"filter-in-large":[Le,[ke,H(tt)],(c,[s,h])=>function(p,_,k,S){for(;k<=S;){const T=k+S>>1;if(_[T]===p)return!0;_[T]>p?S=T-1:k=T+1}return!1}(c.properties()[s.value],h.value,0,h.value.length-1)],all:{type:Le,overloads:[[[Le,Le],(c,[s,h])=>s.evaluate(c)&&h.evaluate(c)],[Zs(Le),(c,s)=>{for(const h of s)if(!h.evaluate(c))return!1;return!0}]]},any:{type:Le,overloads:[[[Le,Le],(c,[s,h])=>s.evaluate(c)||h.evaluate(c)],[Zs(Le),(c,s)=>{for(const h of s)if(h.evaluate(c))return!0;return!1}]]},"!":[Le,[Le],(c,[s])=>!s.evaluate(c)],"is-supported-script":[Le,[ke],(c,[s])=>{const h=c.globals&&c.globals.isSupportedScript;return!h||h(s.evaluate(c))}],upcase:[ke,[ke],(c,[s])=>s.evaluate(c).toUpperCase()],downcase:[ke,[ke],(c,[s])=>s.evaluate(c).toLowerCase()],concat:[ke,Zs(tt),(c,s)=>s.map(h=>Rl(h.evaluate(c))).join("")],"resolved-locale":[ke,[Rn],(c,[s])=>s.evaluate(c).resolvedLocale()]});class yu{constructor(s,h){var p;this.expression=s,this._warningHistory={},this._evaluator=new nu,this._defaultValue=h?(p=h).type==="color"&&mu(p.default)?new kn(0,0,0,0):p.type==="color"?kn.parse(p.default)||null:p.type==="padding"?gr.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Nr.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(s,h,p,_,k,S){return this._evaluator.globals=s,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=_,this._evaluator.availableImages=k||null,this._evaluator.formattedSection=S,this.expression.evaluate(this._evaluator)}evaluate(s,h,p,_,k,S){this._evaluator.globals=s,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=_,this._evaluator.availableImages=k||null,this._evaluator.formattedSection=S||null;try{const T=this.expression.evaluate(this._evaluator);if(T==null||typeof T=="number"&&T!=T)return this._defaultValue;if(this._enumValues&&!(T in this._enumValues))throw new ni(`Expected value to be one of ${Object.keys(this._enumValues).map(A=>JSON.stringify(A)).join(", ")}, but found ${JSON.stringify(T)} instead.`);return T}catch(T){return this._warningHistory[T.message]||(this._warningHistory[T.message]=!0,typeof console<"u"&&console.warn(T.message)),this._defaultValue}}}function _u(c){return Array.isArray(c)&&c.length>0&&typeof c[0]=="string"&&c[0]in za}function Fa(c,s){const h=new $s(za,ql,[],s?function(_){const k={color:vt,string:ke,number:Ze,enum:ke,boolean:Le,formatted:Kn,padding:qi,resolvedImage:fr,variableAnchorOffsetCollection:se};return _.type==="array"?H(k[_.value]||tt,_.length):k[_.type]}(s):void 0),p=h.parse(c,void 0,void 0,void 0,s&&s.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?fu(new yu(p,s)):La(h.errors)}class $a{constructor(s,h){this.kind=s,this._styleExpression=h,this.isStateDependent=s!=="constant"&&!Na(h.expression)}evaluateWithoutErrorHandling(s,h,p,_,k,S){return this._styleExpression.evaluateWithoutErrorHandling(s,h,p,_,k,S)}evaluate(s,h,p,_,k,S){return this._styleExpression.evaluate(s,h,p,_,k,S)}}class ja{constructor(s,h,p,_){this.kind=s,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=s!=="camera"&&!Na(h.expression),this.interpolationType=_}evaluateWithoutErrorHandling(s,h,p,_,k,S){return this._styleExpression.evaluateWithoutErrorHandling(s,h,p,_,k,S)}evaluate(s,h,p,_,k,S){return this._styleExpression.evaluate(s,h,p,_,k,S)}interpolationFactor(s,h,p){return this.interpolationType?ir.interpolationFactor(this.interpolationType,s,h,p):0}}function yd(c,s){const h=Fa(c,s);if(h.result==="error")return h;const p=h.value.expression,_=Wl(p);if(!_&&!Ra(s))return La([new ki("","data expressions not supported")]);const k=Gl(p,["zoom"]);if(!k&&!gm(s))return La([new ki("","zoom expressions not supported")]);const S=Zl(p);return S||k?S instanceof ki?La([S]):S instanceof ir&&!gd(s)?La([new ki("",'"interpolate" expressions cannot be used with this property')]):fu(S?new ja(_?"camera":"composite",h.value,S.labels,S instanceof ir?S.interpolation:void 0):new $a(_?"constant":"source",h.value)):La([new ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Ua{constructor(s,h){this._parameters=s,this._specification=h,Br(this,ym(this._parameters,this._specification))}static deserialize(s){return new Ua(s._parameters,s._specification)}static serialize(s){return{_parameters:s._parameters,_specification:s._specification}}}function Zl(c){let s=null;if(c instanceof ds)s=Zl(c.result);else if(c instanceof su){for(const h of c.args)if(s=Zl(h),s)break}else(c instanceof Da||c instanceof ir)&&c.input instanceof Lr&&c.input.name==="zoom"&&(s=c);return s instanceof ki||c.eachChild(h=>{const p=Zl(h);p instanceof ki?s=p:!s&&p?s=new ki("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):s&&p&&s!==p&&(s=new ki("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),s}function bu(c){if(c===!0||c===!1)return!0;if(!Array.isArray(c)||c.length===0)return!1;switch(c[0]){case"has":return c.length>=2&&c[1]!=="$id"&&c[1]!=="$type";case"in":return c.length>=3&&(typeof c[1]!="string"||Array.isArray(c[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return c.length!==3||Array.isArray(c[1])||Array.isArray(c[2]);case"any":case"all":for(const s of c.slice(1))if(!bu(s)&&typeof s!="boolean")return!1;return!0;default:return!0}}const xu={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function _d(c){if(c==null)return{filter:()=>!0,needGeometry:!1};bu(c)||(c=vu(c));const s=Fa(c,xu);if(s.result==="error")throw new Error(s.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,_)=>s.value.evaluate(h,p,{},_),needGeometry:vm(c)}}function E_(c,s){return c<s?-1:c>s?1:0}function vm(c){if(!Array.isArray(c))return!1;if(c[0]==="within"||c[0]==="distance")return!0;for(let s=1;s<c.length;s++)if(vm(c[s]))return!0;return!1}function vu(c){if(!c)return!0;const s=c[0];return c.length<=1?s!=="any":s==="=="?bd(c[1],c[2],"=="):s==="!="?Oi(bd(c[1],c[2],"==")):s==="<"||s===">"||s==="<="||s===">="?bd(c[1],c[2],s):s==="any"?(h=c.slice(1),["any"].concat(h.map(vu))):s==="all"?["all"].concat(c.slice(1).map(vu)):s==="none"?["all"].concat(c.slice(1).map(vu).map(Oi)):s==="in"?Yl(c[1],c.slice(2)):s==="!in"?Oi(Yl(c[1],c.slice(2))):s==="has"?Xl(c[1]):s!=="!has"||Oi(Xl(c[1]));var h}function bd(c,s,h){switch(c){case"$type":return[`filter-type-${h}`,s];case"$id":return[`filter-id-${h}`,s];default:return[`filter-${h}`,c,s]}}function Yl(c,s){if(s.length===0)return!1;switch(c){case"$type":return["filter-type-in",["literal",s]];case"$id":return["filter-id-in",["literal",s]];default:return s.length>200&&!s.some(h=>typeof h!=typeof s[0])?["filter-in-large",c,["literal",s.sort(E_)]]:["filter-in-small",c,["literal",s]]}}function Xl(c){switch(c){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",c]}}function Oi(c){return["!",c]}function Ys(c){const s=typeof c;if(s==="number"||s==="boolean"||s==="string"||c==null)return JSON.stringify(c);if(Array.isArray(c)){let _="[";for(const k of c)_+=`${Ys(k)},`;return`${_}]`}const h=Object.keys(c).sort();let p="{";for(let _=0;_<h.length;_++)p+=`${JSON.stringify(h[_])}:${Ys(c[h[_]])},`;return`${p}}`}function wm(c){let s="";for(const h of yn)s+=`/${Ys(c[h])}`;return s}function km(c){const s=c.value;return s?[new Ve(c.key,s,"constants have been deprecated as of v8")]:[]}function Qn(c){return c instanceof Number||c instanceof String||c instanceof Boolean?c.valueOf():c}function to(c){if(Array.isArray(c))return c.map(to);if(c instanceof Object&&!(c instanceof Number||c instanceof String||c instanceof Boolean)){const s={};for(const h in c)s[h]=to(c[h]);return s}return Qn(c)}function _r(c){const s=c.key,h=c.value,p=c.valueSpec||{},_=c.objectElementValidators||{},k=c.style,S=c.styleSpec,T=c.validateSpec;let A=[];const B=un(h);if(B!=="object")return[new Ve(s,h,`object expected, ${B} found`)];for(const z in h){const R=z.split(".")[0],j=p[R]||p["*"];let q;if(_[R])q=_[R];else if(p[R])q=T;else if(_["*"])q=_["*"];else{if(!p["*"]){A.push(new Ve(s,h[z],`unknown property "${z}"`));continue}q=T}A=A.concat(q({key:(s&&`${s}.`)+z,value:h[z],valueSpec:j,style:k,styleSpec:S,object:h,objectKey:z,validateSpec:T},h))}for(const z in p)_[z]||p[z].required&&p[z].default===void 0&&h[z]===void 0&&A.push(new Ve(s,h,`missing required property "${z}"`));return A}function Kl(c){const s=c.value,h=c.valueSpec,p=c.style,_=c.styleSpec,k=c.key,S=c.arrayElementValidator||c.validateSpec;if(un(s)!=="array")return[new Ve(k,s,`array expected, ${un(s)} found`)];if(h.length&&s.length!==h.length)return[new Ve(k,s,`array length ${h.length} expected, length ${s.length} found`)];if(h["min-length"]&&s.length<h["min-length"])return[new Ve(k,s,`array length at least ${h["min-length"]} expected, length ${s.length} found`)];let T={type:h.value,values:h.values};_.$version<7&&(T.function=h.function),un(h.value)==="object"&&(T=h.value);let A=[];for(let B=0;B<s.length;B++)A=A.concat(S({array:s,arrayIndex:B,value:s[B],valueSpec:T,validateSpec:c.validateSpec,style:p,styleSpec:_,key:`${k}[${B}]`}));return A}function xd(c){const s=c.key,h=c.value,p=c.valueSpec;let _=un(h);return _==="number"&&h!=h&&(_="NaN"),_!=="number"?[new Ve(s,h,`number expected, ${_} found`)]:"minimum"in p&&h<p.minimum?[new Ve(s,h,`${h} is less than the minimum value ${p.minimum}`)]:"maximum"in p&&h>p.maximum?[new Ve(s,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function wu(c){const s=c.valueSpec,h=Qn(c.value.type);let p,_,k,S={};const T=h!=="categorical"&&c.value.property===void 0,A=!T,B=un(c.value.stops)==="array"&&un(c.value.stops[0])==="array"&&un(c.value.stops[0][0])==="object",z=_r({key:c.key,value:c.value,valueSpec:c.styleSpec.function,validateSpec:c.validateSpec,style:c.style,styleSpec:c.styleSpec,objectElementValidators:{stops:function(q){if(h==="identity")return[new Ve(q.key,q.value,'identity function may not have a "stops" property')];let Y=[];const K=q.value;return Y=Y.concat(Kl({key:q.key,value:K,valueSpec:q.valueSpec,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec,arrayElementValidator:R})),un(K)==="array"&&K.length===0&&Y.push(new Ve(q.key,K,"array must have at least one stop")),Y},default:function(q){return q.validateSpec({key:q.key,value:q.value,valueSpec:s,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec})}}});return h==="identity"&&T&&z.push(new Ve(c.key,c.value,'missing required property "property"')),h==="identity"||c.value.stops||z.push(new Ve(c.key,c.value,'missing required property "stops"')),h==="exponential"&&c.valueSpec.expression&&!gd(c.valueSpec)&&z.push(new Ve(c.key,c.value,"exponential functions not supported")),c.styleSpec.$version>=8&&(A&&!Ra(c.valueSpec)?z.push(new Ve(c.key,c.value,"property functions not supported")):T&&!gm(c.valueSpec)&&z.push(new Ve(c.key,c.value,"zoom functions not supported"))),h!=="categorical"&&!B||c.value.property!==void 0||z.push(new Ve(c.key,c.value,'"property" property is required')),z;function R(q){let Y=[];const K=q.value,re=q.key;if(un(K)!=="array")return[new Ve(re,K,`array expected, ${un(K)} found`)];if(K.length!==2)return[new Ve(re,K,`array length 2 expected, length ${K.length} found`)];if(B){if(un(K[0])!=="object")return[new Ve(re,K,`object expected, ${un(K[0])} found`)];if(K[0].zoom===void 0)return[new Ve(re,K,"object stop key must have zoom")];if(K[0].value===void 0)return[new Ve(re,K,"object stop key must have value")];if(k&&k>Qn(K[0].zoom))return[new Ve(re,K[0].zoom,"stop zoom values must appear in ascending order")];Qn(K[0].zoom)!==k&&(k=Qn(K[0].zoom),_=void 0,S={}),Y=Y.concat(_r({key:`${re}[0]`,value:K[0],valueSpec:{zoom:{}},validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec,objectElementValidators:{zoom:xd,value:j}}))}else Y=Y.concat(j({key:`${re}[0]`,value:K[0],valueSpec:{},validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec},K));return _u(to(K[1]))?Y.concat([new Ve(`${re}[1]`,K[1],"expressions are not allowed in function stops.")]):Y.concat(q.validateSpec({key:`${re}[1]`,value:K[1],valueSpec:s,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec}))}function j(q,Y){const K=un(q.value),re=Qn(q.value),ae=q.value!==null?q.value:Y;if(p){if(K!==p)return[new Ve(q.key,ae,`${K} stop domain type must match previous stop domain type ${p}`)]}else p=K;if(K!=="number"&&K!=="string"&&K!=="boolean")return[new Ve(q.key,ae,"stop domain value must be a number, string, or boolean")];if(K!=="number"&&h!=="categorical"){let be=`number expected, ${K} found`;return Ra(s)&&h===void 0&&(be+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ve(q.key,ae,be)]}return h!=="categorical"||K!=="number"||isFinite(re)&&Math.floor(re)===re?h!=="categorical"&&K==="number"&&_!==void 0&&re<_?[new Ve(q.key,ae,"stop domain values must appear in ascending order")]:(_=re,h==="categorical"&&re in S?[new Ve(q.key,ae,"stop domain values must be unique")]:(S[re]=!0,[])):[new Ve(q.key,ae,`integer expected, found ${re}`)]}}function Ha(c){const s=(c.expressionContext==="property"?yd:Fa)(to(c.value),c.valueSpec);if(s.result==="error")return s.value.map(p=>new Ve(`${c.key}${p.key}`,c.value,p.message));const h=s.value.expression||s.value._styleExpression.expression;if(c.expressionContext==="property"&&c.propertyKey==="text-font"&&!h.outputDefined())return[new Ve(c.key,c.value,`Invalid data expression for "${c.propertyKey}". Output values must be contained as literals within the expression.`)];if(c.expressionContext==="property"&&c.propertyType==="layout"&&!Na(h))return[new Ve(c.key,c.value,'"feature-state" data expressions are not supported with layout properties.')];if(c.expressionContext==="filter"&&!Na(h))return[new Ve(c.key,c.value,'"feature-state" data expressions are not supported with filters.')];if(c.expressionContext&&c.expressionContext.indexOf("cluster")===0){if(!Gl(h,["zoom","feature-state"]))return[new Ve(c.key,c.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(c.expressionContext==="cluster-initial"&&!Wl(h))return[new Ve(c.key,c.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function qo(c){const s=c.key,h=c.value,p=c.valueSpec,_=[];return Array.isArray(p.values)?p.values.indexOf(Qn(h))===-1&&_.push(new Ve(s,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(Qn(h))===-1&&_.push(new Ve(s,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),_}function vd(c){return bu(to(c.value))?Ha(Br({},c,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ku(c)}function ku(c){const s=c.value,h=c.key;if(un(s)!=="array")return[new Ve(h,s,`array expected, ${un(s)} found`)];const p=c.styleSpec;let _,k=[];if(s.length<1)return[new Ve(h,s,"filter array must have at least 1 element")];switch(k=k.concat(qo({key:`${h}[0]`,value:s[0],valueSpec:p.filter_operator,style:c.style,styleSpec:c.styleSpec})),Qn(s[0])){case"<":case"<=":case">":case">=":s.length>=2&&Qn(s[1])==="$type"&&k.push(new Ve(h,s,`"$type" cannot be use with operator "${s[0]}"`));case"==":case"!=":s.length!==3&&k.push(new Ve(h,s,`filter array for operator "${s[0]}" must have 3 elements`));case"in":case"!in":s.length>=2&&(_=un(s[1]),_!=="string"&&k.push(new Ve(`${h}[1]`,s[1],`string expected, ${_} found`)));for(let S=2;S<s.length;S++)_=un(s[S]),Qn(s[1])==="$type"?k=k.concat(qo({key:`${h}[${S}]`,value:s[S],valueSpec:p.geometry_type,style:c.style,styleSpec:c.styleSpec})):_!=="string"&&_!=="number"&&_!=="boolean"&&k.push(new Ve(`${h}[${S}]`,s[S],`string, number, or boolean expected, ${_} found`));break;case"any":case"all":case"none":for(let S=1;S<s.length;S++)k=k.concat(ku({key:`${h}[${S}]`,value:s[S],style:c.style,styleSpec:c.styleSpec}));break;case"has":case"!has":_=un(s[1]),s.length!==2?k.push(new Ve(h,s,`filter array for "${s[0]}" operator must have 2 elements`)):_!=="string"&&k.push(new Ve(`${h}[1]`,s[1],`string expected, ${_} found`))}return k}function wd(c,s){const h=c.key,p=c.validateSpec,_=c.style,k=c.styleSpec,S=c.value,T=c.objectKey,A=k[`${s}_${c.layerType}`];if(!A)return[];const B=T.match(/^(.*)-transition$/);if(s==="paint"&&B&&A[B[1]]&&A[B[1]].transition)return p({key:h,value:S,valueSpec:k.transition,style:_,styleSpec:k});const z=c.valueSpec||A[T];if(!z)return[new Ve(h,S,`unknown property "${T}"`)];let R;if(un(S)==="string"&&Ra(z)&&!z.tokens&&(R=/^{([^}]+)}$/.exec(S)))return[new Ve(h,S,`"${T}" does not support interpolation syntax
49
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(R[1])} }\`.`)];const j=[];return c.layerType==="symbol"&&(T==="text-field"&&_&&!_.glyphs&&j.push(new Ve(h,S,'use of "text-field" requires a style "glyphs" property')),T==="text-font"&&mu(to(S))&&Qn(S.type)==="identity"&&j.push(new Ve(h,S,'"text-font" does not support identity functions'))),j.concat(p({key:c.key,value:S,valueSpec:z,style:_,styleSpec:k,expressionContext:"property",propertyType:s,propertyKey:T}))}function Su(c){return wd(c,"paint")}function kd(c){return wd(c,"layout")}function Sd(c){let s=[];const h=c.value,p=c.key,_=c.style,k=c.styleSpec;h.type||h.ref||s.push(new Ve(p,h,'either "type" or "ref" is required'));let S=Qn(h.type);const T=Qn(h.ref);if(h.id){const A=Qn(h.id);for(let B=0;B<c.arrayIndex;B++){const z=_.layers[B];Qn(z.id)===A&&s.push(new Ve(p,h.id,`duplicate layer id "${h.id}", previously used at line ${z.id.__line__}`))}}if("ref"in h){let A;["type","source","source-layer","filter","layout"].forEach(B=>{B in h&&s.push(new Ve(p,h[B],`"${B}" is prohibited for ref layers`))}),_.layers.forEach(B=>{Qn(B.id)===T&&(A=B)}),A?A.ref?s.push(new Ve(p,h.ref,"ref cannot reference another ref layer")):S=Qn(A.type):s.push(new Ve(p,h.ref,`ref layer "${T}" not found`))}else if(S!=="background")if(h.source){const A=_.sources&&_.sources[h.source],B=A&&Qn(A.type);A?B==="vector"&&S==="raster"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a raster source`)):B!=="raster-dem"&&S==="hillshade"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a raster-dem source`)):B==="raster"&&S!=="raster"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a vector source`)):B!=="vector"||h["source-layer"]?B==="raster-dem"&&S!=="hillshade"?s.push(new Ve(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):S!=="line"||!h.paint||!h.paint["line-gradient"]||B==="geojson"&&A.lineMetrics||s.push(new Ve(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new Ve(p,h,`layer "${h.id}" must specify a "source-layer"`)):s.push(new Ve(p,h.source,`source "${h.source}" not found`))}else s.push(new Ve(p,h,'missing required property "source"'));return s=s.concat(_r({key:p,value:h,valueSpec:k.layer,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,objectElementValidators:{"*":()=>[],type:()=>c.validateSpec({key:`${p}.type`,value:h.type,valueSpec:k.layer.type,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,object:h,objectKey:"type"}),filter:vd,layout:A=>_r({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":B=>kd(Br({layerType:S},B))}}),paint:A=>_r({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":B=>Su(Br({layerType:S},B))}})}})),s}function Xs(c){const s=c.value,h=c.key,p=un(s);return p!=="string"?[new Ve(h,s,`string expected, ${p} found`)]:[]}const Eu={promoteId:function({key:c,value:s}){if(un(s)==="string")return Xs({key:c,value:s});{const h=[];for(const p in s)h.push(...Xs({key:`${c}.${p}`,value:s[p]}));return h}}};function Jl(c){const s=c.value,h=c.key,p=c.styleSpec,_=c.style,k=c.validateSpec;if(!s.type)return[new Ve(h,s,'"type" is required')];const S=Qn(s.type);let T;switch(S){case"vector":case"raster":return T=_r({key:h,value:s,valueSpec:p[`source_${S.replace("-","_")}`],style:c.style,styleSpec:p,objectElementValidators:Eu,validateSpec:k}),T;case"raster-dem":return T=function(A){var B;const z=(B=A.sourceName)!==null&&B!==void 0?B:"",R=A.value,j=A.styleSpec,q=j.source_raster_dem,Y=A.style;let K=[];const re=un(R);if(R===void 0)return K;if(re!=="object")return K.push(new Ve("source_raster_dem",R,`object expected, ${re} found`)),K;const ae=Qn(R.encoding)==="custom",be=["redFactor","greenFactor","blueFactor","baseShift"],pe=A.value.encoding?`"${A.value.encoding}"`:"Default";for(const ye in R)!ae&&be.includes(ye)?K.push(new Ve(ye,R[ye],`In "${z}": "${ye}" is only valid when "encoding" is set to "custom". ${pe} encoding found`)):q[ye]?K=K.concat(A.validateSpec({key:ye,value:R[ye],valueSpec:q[ye],validateSpec:A.validateSpec,style:Y,styleSpec:j})):K.push(new Ve(ye,R[ye],`unknown property "${ye}"`));return K}({sourceName:h,value:s,style:c.style,styleSpec:p,validateSpec:k}),T;case"geojson":if(T=_r({key:h,value:s,valueSpec:p.source_geojson,style:_,styleSpec:p,validateSpec:k,objectElementValidators:Eu}),s.cluster)for(const A in s.clusterProperties){const[B,z]=s.clusterProperties[A],R=typeof B=="string"?[B,["accumulated"],["get",A]]:B;T.push(...Ha({key:`${h}.${A}.map`,value:z,validateSpec:k,expressionContext:"cluster-map"})),T.push(...Ha({key:`${h}.${A}.reduce`,value:R,validateSpec:k,expressionContext:"cluster-reduce"}))}return T;case"video":return _r({key:h,value:s,valueSpec:p.source_video,style:_,validateSpec:k,styleSpec:p});case"image":return _r({key:h,value:s,valueSpec:p.source_image,style:_,validateSpec:k,styleSpec:p});case"canvas":return[new Ve(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qo({key:`${h}.type`,value:s.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:_,validateSpec:k,styleSpec:p})}}function Ed(c){const s=c.value,h=c.styleSpec,p=h.light,_=c.style;let k=[];const S=un(s);if(s===void 0)return k;if(S!=="object")return k=k.concat([new Ve("light",s,`object expected, ${S} found`)]),k;for(const T in s){const A=T.match(/^(.*)-transition$/);k=k.concat(A&&p[A[1]]&&p[A[1]].transition?c.validateSpec({key:T,value:s[T],valueSpec:h.transition,validateSpec:c.validateSpec,style:_,styleSpec:h}):p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],validateSpec:c.validateSpec,style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)])}return k}function Cd(c){const s=c.value,h=c.styleSpec,p=h.sky,_=c.style,k=un(s);if(s===void 0)return[];if(k!=="object")return[new Ve("sky",s,`object expected, ${k} found`)];let S=[];for(const T in s)S=S.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return S}function Td(c){const s=c.value,h=c.styleSpec,p=h.terrain,_=c.style;let k=[];const S=un(s);if(s===void 0)return k;if(S!=="object")return k=k.concat([new Ve("terrain",s,`object expected, ${S} found`)]),k;for(const T in s)k=k.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],validateSpec:c.validateSpec,style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return k}function Md(c){let s=[];const h=c.value,p=c.key;if(Array.isArray(h)){const _=[],k=[];for(const S in h)h[S].id&&_.includes(h[S].id)&&s.push(new Ve(p,h,`all the sprites' ids must be unique, but ${h[S].id} is duplicated`)),_.push(h[S].id),h[S].url&&k.includes(h[S].url)&&s.push(new Ve(p,h,`all the sprites' URLs must be unique, but ${h[S].url} is duplicated`)),k.push(h[S].url),s=s.concat(_r({key:`${p}[${S}]`,value:h[S],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:c.validateSpec}));return s}return Xs({key:p,value:h})}const Cu={"*":()=>[],array:Kl,boolean:function(c){const s=c.value,h=c.key,p=un(s);return p!=="boolean"?[new Ve(h,s,`boolean expected, ${p} found`)]:[]},number:xd,color:function(c){const s=c.key,h=c.value,p=un(h);return p!=="string"?[new Ve(s,h,`color expected, ${p} found`)]:kn.parse(String(h))?[]:[new Ve(s,h,`color expected, "${h}" found`)]},constants:km,enum:qo,filter:vd,function:wu,layer:Sd,object:_r,source:Jl,light:Ed,sky:Cd,terrain:Td,projection:function(c){const s=c.value,h=c.styleSpec,p=h.projection,_=c.style,k=un(s);if(s===void 0)return[];if(k!=="object")return[new Ve("projection",s,`object expected, ${k} found`)];let S=[];for(const T in s)S=S.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return S},string:Xs,formatted:function(c){return Xs(c).length===0?[]:Ha(c)},resolvedImage:function(c){return Xs(c).length===0?[]:Ha(c)},padding:function(c){const s=c.key,h=c.value;if(un(h)==="array"){if(h.length<1||h.length>4)return[new Ve(s,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let _=[];for(let k=0;k<h.length;k++)_=_.concat(c.validateSpec({key:`${s}[${k}]`,value:h[k],validateSpec:c.validateSpec,valueSpec:p}));return _}return xd({key:s,value:h,valueSpec:{}})},variableAnchorOffsetCollection:function(c){const s=c.key,h=c.value,p=un(h),_=c.styleSpec;if(p!=="array"||h.length<1||h.length%2!=0)return[new Ve(s,h,"variableAnchorOffsetCollection requires a non-empty array of even length")];let k=[];for(let S=0;S<h.length;S+=2)k=k.concat(qo({key:`${s}[${S}]`,value:h[S],valueSpec:_.layout_symbol["text-anchor"]})),k=k.concat(Kl({key:`${s}[${S+1}]`,value:h[S+1],valueSpec:{length:2,value:"number"},validateSpec:c.validateSpec,style:c.style,styleSpec:_}));return k},sprite:Md};function qa(c){const s=c.value,h=c.valueSpec,p=c.styleSpec;return c.validateSpec=qa,h.expression&&mu(Qn(s))?wu(c):h.expression&&_u(to(s))?Ha(c):h.type&&Cu[h.type]?Cu[h.type](c):_r(Br({},c,{valueSpec:h.type?p[h.type]:h}))}function Sm(c){const s=c.value,h=c.key,p=Xs(c);return p.length||(s.indexOf("{fontstack}")===-1&&p.push(new Ve(h,s,'"glyphs" url must include a "{fontstack}" token')),s.indexOf("{range}")===-1&&p.push(new Ve(h,s,'"glyphs" url must include a "{range}" token'))),p}function Rr(c,s=we){let h=[];return h=h.concat(qa({key:"",value:c,valueSpec:s.$root,styleSpec:s,style:c,validateSpec:qa,objectElementValidators:{glyphs:Sm,"*":()=>[]}})),c.constants&&(h=h.concat(km({key:"constants",value:c.constants,style:c,styleSpec:s,validateSpec:qa}))),Ad(h)}function Ao(c){return function(s){return c({...s,validateSpec:qa})}}function Ad(c){return[].concat(c).sort((s,h)=>s.line-h.line)}function no(c){return function(...s){return Ad(c.apply(this,s))}}Rr.source=no(Ao(Jl)),Rr.sprite=no(Ao(Md)),Rr.glyphs=no(Ao(Sm)),Rr.light=no(Ao(Ed)),Rr.sky=no(Ao(Cd)),Rr.terrain=no(Ao(Td)),Rr.layer=no(Ao(Sd)),Rr.filter=no(Ao(vd)),Rr.paintProperty=no(Ao(Su)),Rr.layoutProperty=no(Ao(kd));const Ks=Rr,C_=Ks.light,T_=Ks.sky,Em=Ks.paintProperty,Cm=Ks.layoutProperty;function Id(c,s){let h=!1;if(s&&s.length)for(const p of s)c.fire(new Mt(new Error(p.message))),h=!0;return h}class Wa{constructor(s,h,p){const _=this.cells=[];if(s instanceof ArrayBuffer){this.arrayBuffer=s;const S=new Int32Array(this.arrayBuffer);s=S[0],this.d=(h=S[1])+2*(p=S[2]);for(let A=0;A<this.d*this.d;A++){const B=S[3+A],z=S[3+A+1];_.push(B===z?null:S.subarray(B,z))}const T=S[3+_.length+1];this.keys=S.subarray(S[3+_.length],T),this.bboxes=S.subarray(T),this.insert=this._insertReadonly}else{this.d=h+2*p;for(let S=0;S<this.d*this.d;S++)_.push([]);this.keys=[],this.bboxes=[]}this.n=h,this.extent=s,this.padding=p,this.scale=h/s,this.uid=0;const k=p/h*s;this.min=-k,this.max=s+k}insert(s,h,p,_,k){this._forEachCell(h,p,_,k,this._insertCell,this.uid++,void 0,void 0),this.keys.push(s),this.bboxes.push(h),this.bboxes.push(p),this.bboxes.push(_),this.bboxes.push(k)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(s,h,p,_,k,S){this.cells[k].push(S)}query(s,h,p,_,k){const S=this.min,T=this.max;if(s<=S&&h<=S&&T<=p&&T<=_&&!k)return Array.prototype.slice.call(this.keys);{const A=[];return this._forEachCell(s,h,p,_,this._queryCell,A,{},k),A}}_queryCell(s,h,p,_,k,S,T,A){const B=this.cells[k];if(B!==null){const z=this.keys,R=this.bboxes;for(let j=0;j<B.length;j++){const q=B[j];if(T[q]===void 0){const Y=4*q;(A?A(R[Y+0],R[Y+1],R[Y+2],R[Y+3]):s<=R[Y+2]&&h<=R[Y+3]&&p>=R[Y+0]&&_>=R[Y+1])?(T[q]=!0,S.push(z[q])):T[q]=!1}}}}_forEachCell(s,h,p,_,k,S,T,A){const B=this._convertToCellCoord(s),z=this._convertToCellCoord(h),R=this._convertToCellCoord(p),j=this._convertToCellCoord(_);for(let q=B;q<=R;q++)for(let Y=z;Y<=j;Y++){const K=this.d*Y+q;if((!A||A(this._convertFromCellCoord(q),this._convertFromCellCoord(Y),this._convertFromCellCoord(q+1),this._convertFromCellCoord(Y+1)))&&k.call(this,s,h,p,_,K,S,T,A))return}}_convertFromCellCoord(s){return(s-this.padding)/this.scale}_convertToCellCoord(s){return Math.max(0,Math.min(this.d-1,Math.floor(s*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const s=this.cells,h=3+this.cells.length+1+1;let p=0;for(let S=0;S<this.cells.length;S++)p+=this.cells[S].length;const _=new Int32Array(h+p+this.keys.length+this.bboxes.length);_[0]=this.extent,_[1]=this.n,_[2]=this.padding;let k=h;for(let S=0;S<s.length;S++){const T=s[S];_[3+S]=k,_.set(T,k),k+=T.length}return _[3+s.length]=k,_.set(this.keys,k),k+=this.keys.length,_[3+s.length+1]=k,_.set(this.bboxes,k),k+=this.bboxes.length,_.buffer}static serialize(s,h){const p=s.toArrayBuffer();return h&&h.push(p),{buffer:p}}static deserialize(s){return new Wa(s.buffer)}}const Vr={};function ut(c,s,h={}){if(Vr[c])throw new Error(`${c} is already registered.`);Object.defineProperty(s,"_classRegistryKey",{value:c,writeable:!1}),Vr[c]={klass:s,omit:h.omit||[],shallow:h.shallow||[]}}ut("Object",Object),ut("TransferableGridIndex",Wa),ut("Color",kn),ut("Error",Error),ut("AJAXError",Ce),ut("ResolvedImage",yr),ut("StylePropertyFunction",Ua),ut("StyleExpression",yu,{omit:["_evaluator"]}),ut("ZoomDependentExpression",ja),ut("ZoomConstantExpression",$a),ut("CompoundExpression",Lr,{omit:["_evaluate"]});for(const c in za)za[c]._classRegistryKey||ut(`Expression_${c}`,za[c]);function Tu(c){return c&&typeof ArrayBuffer<"u"&&(c instanceof ArrayBuffer||c.constructor&&c.constructor.name==="ArrayBuffer")}function Pd(c){return c.$name||c.constructor._classRegistryKey}function Tm(c){return!function(s){if(s===null||typeof s!="object")return!1;const h=Pd(s);return!(!h||h==="Object")}(c)&&(c==null||typeof c=="boolean"||typeof c=="number"||typeof c=="string"||c instanceof Boolean||c instanceof Number||c instanceof String||c instanceof Date||c instanceof RegExp||c instanceof Blob||c instanceof Error||Tu(c)||Ft(c)||ArrayBuffer.isView(c)||c instanceof ImageData)}function Ga(c,s){if(Tm(c))return(Tu(c)||Ft(c))&&s&&s.push(c),ArrayBuffer.isView(c)&&s&&s.push(c.buffer),c instanceof ImageData&&s&&s.push(c.data.buffer),c;if(Array.isArray(c)){const k=[];for(const S of c)k.push(Ga(S,s));return k}if(typeof c!="object")throw new Error("can't serialize object of type "+typeof c);const h=Pd(c);if(!h)throw new Error(`can't serialize object of unregistered class ${c.constructor.name}`);if(!Vr[h])throw new Error(`${h} is not registered.`);const{klass:p}=Vr[h],_=p.serialize?p.serialize(c,s):{};if(p.serialize){if(s&&_===s[s.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const k in c){if(!c.hasOwnProperty(k)||Vr[h].omit.indexOf(k)>=0)continue;const S=c[k];_[k]=Vr[h].shallow.indexOf(k)>=0?S:Ga(S,s)}c instanceof Error&&(_.message=c.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(_.$name=h),_}function Za(c){if(Tm(c))return c;if(Array.isArray(c))return c.map(Za);if(typeof c!="object")throw new Error("can't deserialize object of type "+typeof c);const s=Pd(c)||"Object";if(!Vr[s])throw new Error(`can't deserialize unregistered class ${s}`);const{klass:h}=Vr[s];if(!h)throw new Error(`can't deserialize unregistered class ${s}`);if(h.deserialize)return h.deserialize(c);const p=Object.create(h.prototype);for(const _ of Object.keys(c)){if(_==="$name")continue;const k=c[_];p[_]=Vr[s].shallow.indexOf(_)>=0?k:Za(k)}return p}class Dd{constructor(){this.first=!0}update(s,h){const p=Math.floor(s);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=s,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=h):this.lastFloorZoom<p&&(this.lastIntegerZoom=p,this.lastIntegerZoomTime=h),s!==this.lastZoom&&(this.lastZoom=s,this.lastFloorZoom=p,!0))}}const en={"Latin-1 Supplement":c=>c>=128&&c<=255,"Hangul Jamo":c=>c>=4352&&c<=4607,Khmer:c=>c>=6016&&c<=6143,"General Punctuation":c=>c>=8192&&c<=8303,"Letterlike Symbols":c=>c>=8448&&c<=8527,"Number Forms":c=>c>=8528&&c<=8591,"Miscellaneous Technical":c=>c>=8960&&c<=9215,"Control Pictures":c=>c>=9216&&c<=9279,"Optical Character Recognition":c=>c>=9280&&c<=9311,"Enclosed Alphanumerics":c=>c>=9312&&c<=9471,"Geometric Shapes":c=>c>=9632&&c<=9727,"Miscellaneous Symbols":c=>c>=9728&&c<=9983,"Miscellaneous Symbols and Arrows":c=>c>=11008&&c<=11263,"Ideographic Description Characters":c=>c>=12272&&c<=12287,"CJK Symbols and Punctuation":c=>c>=12288&&c<=12351,Katakana:c=>c>=12448&&c<=12543,Kanbun:c=>c>=12688&&c<=12703,"CJK Strokes":c=>c>=12736&&c<=12783,"Enclosed CJK Letters and Months":c=>c>=12800&&c<=13055,"CJK Compatibility":c=>c>=13056&&c<=13311,"Yijing Hexagram Symbols":c=>c>=19904&&c<=19967,"Private Use Area":c=>c>=57344&&c<=63743,"Vertical Forms":c=>c>=65040&&c<=65055,"CJK Compatibility Forms":c=>c>=65072&&c<=65103,"Small Form Variants":c=>c>=65104&&c<=65135,"Halfwidth and Fullwidth Forms":c=>c>=65280&&c<=65519};function Od(c){for(const s of c)if(zd(s.charCodeAt(0)))return!0;return!1}function M_(c){for(const s of c)if(!Ya(s.charCodeAt(0)))return!1;return!0}function Bd(c){const s=c.map(h=>{try{return new RegExp(`\\p{sc=${h}}`,"u").source}catch{return null}}).filter(h=>h);return new RegExp(s.join("|"),"u")}const A_=Bd(["Arab","Dupl","Mong","Ougr","Syrc"]);function Ya(c){return!A_.test(String.fromCodePoint(c))}const Mm=Bd(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function zd(c){return!(c!==746&&c!==747&&(c<4352||!(en["CJK Compatibility Forms"](c)&&!(c>=65097&&c<=65103)||en["CJK Compatibility"](c)||en["CJK Strokes"](c)||!(!en["CJK Symbols and Punctuation"](c)||c>=12296&&c<=12305||c>=12308&&c<=12319||c===12336)||en["Enclosed CJK Letters and Months"](c)||en["Ideographic Description Characters"](c)||en.Kanbun(c)||en.Katakana(c)&&c!==12540||!(!en["Halfwidth and Fullwidth Forms"](c)||c===65288||c===65289||c===65293||c>=65306&&c<=65310||c===65339||c===65341||c===65343||c>=65371&&c<=65503||c===65507||c>=65512&&c<=65519)||!(!en["Small Form Variants"](c)||c>=65112&&c<=65118||c>=65123&&c<=65126)||en["Vertical Forms"](c)||en["Yijing Hexagram Symbols"](c)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(c))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(c))||Mm.test(String.fromCodePoint(c)))))}function Am(c){return!(zd(c)||function(s){return!!(en["Latin-1 Supplement"](s)&&(s===167||s===169||s===174||s===177||s===188||s===189||s===190||s===215||s===247)||en["General Punctuation"](s)&&(s===8214||s===8224||s===8225||s===8240||s===8241||s===8251||s===8252||s===8258||s===8263||s===8264||s===8265||s===8273)||en["Letterlike Symbols"](s)||en["Number Forms"](s)||en["Miscellaneous Technical"](s)&&(s>=8960&&s<=8967||s>=8972&&s<=8991||s>=8996&&s<=9e3||s===9003||s>=9085&&s<=9114||s>=9150&&s<=9165||s===9167||s>=9169&&s<=9179||s>=9186&&s<=9215)||en["Control Pictures"](s)&&s!==9251||en["Optical Character Recognition"](s)||en["Enclosed Alphanumerics"](s)||en["Geometric Shapes"](s)||en["Miscellaneous Symbols"](s)&&!(s>=9754&&s<=9759)||en["Miscellaneous Symbols and Arrows"](s)&&(s>=11026&&s<=11055||s>=11088&&s<=11097||s>=11192&&s<=11243)||en["CJK Symbols and Punctuation"](s)||en.Katakana(s)||en["Private Use Area"](s)||en["CJK Compatibility Forms"](s)||en["Small Form Variants"](s)||en["Halfwidth and Fullwidth Forms"](s)||s===8734||s===8756||s===8757||s>=9984&&s<=10087||s>=10102&&s<=10131||s===65532||s===65533)}(c))}const I_=Bd(["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 Nd(c){return I_.test(String.fromCodePoint(c))}function P_(c,s){return!(!s&&Nd(c)||c>=2304&&c<=3583||c>=3840&&c<=4255||en.Khmer(c))}function D_(c){for(const s of c)if(Nd(s.charCodeAt(0)))return!0;return!1}const br=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(c){this.pluginStatus=c.pluginStatus,this.pluginURL=c.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(c){this.applyArabicShaping=c.applyArabicShaping,this.processBidirectionalText=c.processBidirectionalText,this.processStyledBidirectionalText=c.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Vn{constructor(s,h){this.zoom=s,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Dd,this.transition={})}isSupportedScript(s){return function(h,p){for(const _ of h)if(!P_(_.charCodeAt(0),p))return!1;return!0}(s,br.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const s=this.zoom,h=s-Math.floor(s),p=this.crossFadingFactor();return s>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*h}}}class Xa{constructor(s,h){this.property=s,this.value=h,this.expression=function(p,_){if(mu(p))return new Ua(p,_);if(_u(p)){const k=yd(p,_);if(k.result==="error")throw new Error(k.value.map(S=>`${S.key}: ${S.message}`).join(", "));return k.value}{let k=p;return _.type==="color"&&typeof p=="string"?k=kn.parse(p):_.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?_.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(k=Nr.parse(p)):k=gr.parse(p),{kind:"constant",evaluate:()=>k}}}(h===void 0?s.specification.default:h,s.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(s,h,p){return this.property.possiblyEvaluate(this,s,h,p)}}class Mu{constructor(s){this.property=s,this.value=new Xa(s,void 0)}transitioned(s,h){return new Im(this.property,this.value,h,Se({},s.transition,this.transition),s.now)}untransitioned(){return new Im(this.property,this.value,null,{},0)}}class Au{constructor(s){this._properties=s,this._values=Object.create(s.defaultTransitionablePropertyValues)}getValue(s){return Xe(this._values[s].value.value)}setValue(s,h){Object.prototype.hasOwnProperty.call(this._values,s)||(this._values[s]=new Mu(this._values[s].property)),this._values[s].value=new Xa(this._values[s].property,h===null?void 0:Xe(h))}getTransition(s){return Xe(this._values[s].transition)}setTransition(s,h){Object.prototype.hasOwnProperty.call(this._values,s)||(this._values[s]=new Mu(this._values[s].property)),this._values[s].transition=Xe(h)||void 0}serialize(){const s={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(s[h]=p);const _=this.getTransition(h);_!==void 0&&(s[`${h}-transition`]=_)}return s}transitioned(s,h){const p=new Ql(this._properties);for(const _ of Object.keys(this._values))p._values[_]=this._values[_].transitioned(s,h._values[_]);return p}untransitioned(){const s=new Ql(this._properties);for(const h of Object.keys(this._values))s._values[h]=this._values[h].untransitioned();return s}}class Im{constructor(s,h,p,_,k){this.property=s,this.value=h,this.begin=k+_.delay||0,this.end=this.begin+_.duration||0,s.specification.transition&&(_.delay||_.duration)&&(this.prior=p)}possiblyEvaluate(s,h,p){const _=s.now||0,k=this.value.possiblyEvaluate(s,h,p),S=this.prior;if(S){if(_>this.end)return this.prior=null,k;if(this.value.isDataDriven())return this.prior=null,k;if(_<this.begin)return S.possiblyEvaluate(s,h,p);{const T=(_-this.begin)/(this.end-this.begin);return this.property.interpolate(S.possiblyEvaluate(s,h,p),k,function(A){if(A<=0)return 0;if(A>=1)return 1;const B=A*A,z=B*A;return 4*(A<.5?z:3*(A-B)+z-.75)}(T))}}return k}}class Ql{constructor(s){this._properties=s,this._values=Object.create(s.defaultTransitioningPropertyValues)}possiblyEvaluate(s,h,p){const _=new tc(this._properties);for(const k of Object.keys(this._values))_._values[k]=this._values[k].possiblyEvaluate(s,h,p);return _}hasTransition(){for(const s of Object.keys(this._values))if(this._values[s].prior)return!0;return!1}}class ec{constructor(s){this._properties=s,this._values=Object.create(s.defaultPropertyValues)}hasValue(s){return this._values[s].value!==void 0}getValue(s){return Xe(this._values[s].value)}setValue(s,h){this._values[s]=new Xa(this._values[s].property,h===null?void 0:Xe(h))}serialize(){const s={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(s[h]=p)}return s}possiblyEvaluate(s,h,p){const _=new tc(this._properties);for(const k of Object.keys(this._values))_._values[k]=this._values[k].possiblyEvaluate(s,h,p);return _}}class Io{constructor(s,h,p){this.property=s,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(s){return this.value.kind==="constant"?this.value.value:s}evaluate(s,h,p,_){return this.property.evaluate(this.value,this.parameters,s,h,p,_)}}class tc{constructor(s){this._properties=s,this._values=Object.create(s.defaultPossiblyEvaluatedValues)}get(s){return this._values[s]}}class ft{constructor(s){this.specification=s}possiblyEvaluate(s,h){if(s.isDataDriven())throw new Error("Value should not be data driven");return s.expression.evaluate(h)}interpolate(s,h,p){const _=nr[this.specification.type];return _?_(s,h,p):s}}class Et{constructor(s,h){this.specification=s,this.overrides=h}possiblyEvaluate(s,h,p,_){return new Io(this,s.expression.kind==="constant"||s.expression.kind==="camera"?{kind:"constant",value:s.expression.evaluate(h,null,{},p,_)}:s.expression,h)}interpolate(s,h,p){if(s.value.kind!=="constant"||h.value.kind!=="constant")return s;if(s.value.value===void 0||h.value.value===void 0)return new Io(this,{kind:"constant",value:void 0},s.parameters);const _=nr[this.specification.type];if(_){const k=_(s.value.value,h.value.value,p);return new Io(this,{kind:"constant",value:k},s.parameters)}return s}evaluate(s,h,p,_,k,S){return s.kind==="constant"?s.value:s.evaluate(h,p,_,k,S)}}class Iu extends Et{possiblyEvaluate(s,h,p,_){if(s.value===void 0)return new Io(this,{kind:"constant",value:void 0},h);if(s.expression.kind==="constant"){const k=s.expression.evaluate(h,null,{},p,_),S=s.property.specification.type==="resolvedImage"&&typeof k!="string"?k.name:k,T=this._calculate(S,S,S,h);return new Io(this,{kind:"constant",value:T},h)}if(s.expression.kind==="camera"){const k=this._calculate(s.expression.evaluate({zoom:h.zoom-1}),s.expression.evaluate({zoom:h.zoom}),s.expression.evaluate({zoom:h.zoom+1}),h);return new Io(this,{kind:"constant",value:k},h)}return new Io(this,s.expression,h)}evaluate(s,h,p,_,k,S){if(s.kind==="source"){const T=s.evaluate(h,p,_,k,S);return this._calculate(T,T,T,h)}return s.kind==="composite"?this._calculate(s.evaluate({zoom:Math.floor(h.zoom)-1},p,_),s.evaluate({zoom:Math.floor(h.zoom)},p,_),s.evaluate({zoom:Math.floor(h.zoom)+1},p,_),h):s.value}_calculate(s,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:s,to:h}:{from:p,to:h}}interpolate(s){return s}}class Pu{constructor(s){this.specification=s}possiblyEvaluate(s,h,p,_){if(s.value!==void 0){if(s.expression.kind==="constant"){const k=s.expression.evaluate(h,null,{},p,_);return this._calculate(k,k,k,h)}return this._calculate(s.expression.evaluate(new Vn(Math.floor(h.zoom-1),h)),s.expression.evaluate(new Vn(Math.floor(h.zoom),h)),s.expression.evaluate(new Vn(Math.floor(h.zoom+1),h)),h)}}_calculate(s,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:s,to:h}:{from:p,to:h}}interpolate(s){return s}}class Ld{constructor(s){this.specification=s}possiblyEvaluate(s,h,p,_){return!!s.expression.evaluate(h,null,{},p,_)}interpolate(){return!1}}class v{constructor(s){this.properties=s,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in s){const p=s[h];p.specification.overridable&&this.overridableProperties.push(h);const _=this.defaultPropertyValues[h]=new Xa(p,void 0),k=this.defaultTransitionablePropertyValues[h]=new Mu(p);this.defaultTransitioningPropertyValues[h]=k.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=_.possiblyEvaluate({})}}}ut("DataDrivenProperty",Et),ut("DataConstantProperty",ft),ut("CrossFadedDataDrivenProperty",Iu),ut("CrossFadedProperty",Pu),ut("ColorRampProperty",Ld);const o="-transition";class d extends rn{constructor(s,h){if(super(),this.id=s.id,this.type=s.type,this._featureFilter={filter:()=>!0,needGeometry:!1},s.type!=="custom"&&(this.metadata=s.metadata,this.minzoom=s.minzoom,this.maxzoom=s.maxzoom,s.type!=="background"&&(this.source=s.source,this.sourceLayer=s["source-layer"],this.filter=s.filter),h.layout&&(this._unevaluatedLayout=new ec(h.layout)),h.paint)){this._transitionablePaint=new Au(h.paint);for(const p in s.paint)this.setPaintProperty(p,s.paint[p],{validate:!1});for(const p in s.layout)this.setLayoutProperty(p,s.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new tc(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(s){return s==="visibility"?this.visibility:this._unevaluatedLayout.getValue(s)}setLayoutProperty(s,h,p={}){h!=null&&this._validate(Cm,`layers.${this.id}.layout.${s}`,s,h,p)||(s!=="visibility"?this._unevaluatedLayout.setValue(s,h):this.visibility=h)}getPaintProperty(s){return s.endsWith(o)?this._transitionablePaint.getTransition(s.slice(0,-11)):this._transitionablePaint.getValue(s)}setPaintProperty(s,h,p={}){if(h!=null&&this._validate(Em,`layers.${this.id}.paint.${s}`,s,h,p))return!1;if(s.endsWith(o))return this._transitionablePaint.setTransition(s.slice(0,-11),h||void 0),!1;{const _=this._transitionablePaint._values[s],k=_.property.specification["property-type"]==="cross-faded-data-driven",S=_.value.isDataDriven(),T=_.value;this._transitionablePaint.setValue(s,h),this._handleSpecialPaintPropertyUpdate(s);const A=this._transitionablePaint._values[s].value;return A.isDataDriven()||S||k||this._handleOverridablePaintPropertyUpdate(s,T,A)}}_handleSpecialPaintPropertyUpdate(s){}_handleOverridablePaintPropertyUpdate(s,h,p){return!1}isHidden(s){return!!(this.minzoom&&s<this.minzoom)||!!(this.maxzoom&&s>=this.maxzoom)||this.visibility==="none"}updateTransitions(s){this._transitioningPaint=this._transitionablePaint.transitioned(s,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(s,h){s.getCrossfadeParameters&&(this._crossfadeParameters=s.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(s,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(s,void 0,h)}serialize(){const s={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&&(s.layout=s.layout||{},s.layout.visibility=this.visibility),$e(s,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(s,h,p,_,k={}){return(!k||k.validate!==!1)&&Id(this,s.call(Ks,{key:h,layerType:this.type,objectKey:p,value:_,styleSpec:we,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const s in this.paint._values){const h=this.paint.get(s);if(h instanceof Io&&Ra(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const m={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class y{constructor(s,h){this._structArray=s,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class x{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(s,h){return s._trim(),h&&(s.isTransferred=!0,h.push(s.arrayBuffer)),{length:s.length,arrayBuffer:s.arrayBuffer}}static deserialize(s){const h=Object.create(this.prototype);return h.arrayBuffer=s.arrayBuffer,h.length=s.length,h.capacity=s.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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(s){this.reserve(s),this.length=s}reserve(s){if(s>this.capacity){this.capacity=Math.max(s,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function M(c,s=1){let h=0,p=0;return{members:c.map(_=>{const k=m[_.type].BYTES_PER_ELEMENT,S=h=P(h,Math.max(s,k)),T=_.components||1;return p=Math.max(p,k),h+=k*T,{name:_.name,type:_.type,components:T,offset:S}}),size:P(h,Math.max(p,s)),alignment:s}}function P(c,s){return Math.ceil(c/s)*s}class O extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.int16[_+0]=h,this.int16[_+1]=p,s}}O.prototype.bytesPerElement=4,ut("StructArrayLayout2i4",O);class N extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.int16[k+0]=h,this.int16[k+1]=p,this.int16[k+2]=_,s}}N.prototype.bytesPerElement=6,ut("StructArrayLayout3i6",N);class V extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_){const k=this.length;return this.resize(k+1),this.emplace(k,s,h,p,_)}emplace(s,h,p,_,k){const S=4*s;return this.int16[S+0]=h,this.int16[S+1]=p,this.int16[S+2]=_,this.int16[S+3]=k,s}}V.prototype.bytesPerElement=8,ut("StructArrayLayout4i8",V);class F extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=6*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=_,this.int16[A+3]=k,this.int16[A+4]=S,this.int16[A+5]=T,s}}F.prototype.bytesPerElement=12,ut("StructArrayLayout2i4i12",F);class Z extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=4*s,B=8*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.uint8[B+4]=_,this.uint8[B+5]=k,this.uint8[B+6]=S,this.uint8[B+7]=T,s}}Z.prototype.bytesPerElement=8,ut("StructArrayLayout2i4ub8",Z);class J extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.float32[_+0]=h,this.float32[_+1]=p,s}}J.prototype.bytesPerElement=8,ut("StructArrayLayout2f8",J);class ee extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z){const R=this.length;return this.resize(R+1),this.emplace(R,s,h,p,_,k,S,T,A,B,z)}emplace(s,h,p,_,k,S,T,A,B,z,R){const j=10*s;return this.uint16[j+0]=h,this.uint16[j+1]=p,this.uint16[j+2]=_,this.uint16[j+3]=k,this.uint16[j+4]=S,this.uint16[j+5]=T,this.uint16[j+6]=A,this.uint16[j+7]=B,this.uint16[j+8]=z,this.uint16[j+9]=R,s}}ee.prototype.bytesPerElement=20,ut("StructArrayLayout10ui20",ee);class oe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z,R,j){const q=this.length;return this.resize(q+1),this.emplace(q,s,h,p,_,k,S,T,A,B,z,R,j)}emplace(s,h,p,_,k,S,T,A,B,z,R,j,q){const Y=12*s;return this.int16[Y+0]=h,this.int16[Y+1]=p,this.int16[Y+2]=_,this.int16[Y+3]=k,this.uint16[Y+4]=S,this.uint16[Y+5]=T,this.uint16[Y+6]=A,this.uint16[Y+7]=B,this.int16[Y+8]=z,this.int16[Y+9]=R,this.int16[Y+10]=j,this.int16[Y+11]=q,s}}oe.prototype.bytesPerElement=24,ut("StructArrayLayout4i4ui4i24",oe);class le extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.float32[k+0]=h,this.float32[k+1]=p,this.float32[k+2]=_,s}}le.prototype.bytesPerElement=12,ut("StructArrayLayout3f12",le);class ce extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.uint32[1*s+0]=h,s}}ce.prototype.bytesPerElement=4,ut("StructArrayLayout1ul4",ce);class he extends x{_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(s,h,p,_,k,S,T,A,B){const z=this.length;return this.resize(z+1),this.emplace(z,s,h,p,_,k,S,T,A,B)}emplace(s,h,p,_,k,S,T,A,B,z){const R=10*s,j=5*s;return this.int16[R+0]=h,this.int16[R+1]=p,this.int16[R+2]=_,this.int16[R+3]=k,this.int16[R+4]=S,this.int16[R+5]=T,this.uint32[j+3]=A,this.uint16[R+8]=B,this.uint16[R+9]=z,s}}he.prototype.bytesPerElement=20,ut("StructArrayLayout6i1ul2ui20",he);class ne extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=6*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=_,this.int16[A+3]=k,this.int16[A+4]=S,this.int16[A+5]=T,s}}ne.prototype.bytesPerElement=12,ut("StructArrayLayout2i2i2i12",ne);class me extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k){const S=this.length;return this.resize(S+1),this.emplace(S,s,h,p,_,k)}emplace(s,h,p,_,k,S){const T=4*s,A=8*s;return this.float32[T+0]=h,this.float32[T+1]=p,this.float32[T+2]=_,this.int16[A+6]=k,this.int16[A+7]=S,s}}me.prototype.bytesPerElement=16,ut("StructArrayLayout2f1f2i16",me);class ge extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=16*s,B=4*s,z=8*s;return this.uint8[A+0]=h,this.uint8[A+1]=p,this.float32[B+1]=_,this.float32[B+2]=k,this.int16[z+6]=S,this.int16[z+7]=T,s}}ge.prototype.bytesPerElement=16,ut("StructArrayLayout2ub2f2i16",ge);class xe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.uint16[k+0]=h,this.uint16[k+1]=p,this.uint16[k+2]=_,s}}xe.prototype.bytesPerElement=6,ut("StructArrayLayout3ui6",xe);class Oe extends x{_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(s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae){const be=this.length;return this.resize(be+1),this.emplace(be,s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae)}emplace(s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae,be){const pe=24*s,ye=12*s,Te=48*s;return this.int16[pe+0]=h,this.int16[pe+1]=p,this.uint16[pe+2]=_,this.uint16[pe+3]=k,this.uint32[ye+2]=S,this.uint32[ye+3]=T,this.uint32[ye+4]=A,this.uint16[pe+10]=B,this.uint16[pe+11]=z,this.uint16[pe+12]=R,this.float32[ye+7]=j,this.float32[ye+8]=q,this.uint8[Te+36]=Y,this.uint8[Te+37]=K,this.uint8[Te+38]=re,this.uint32[ye+10]=ae,this.int16[pe+22]=be,s}}Oe.prototype.bytesPerElement=48,ut("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Oe);class Fe extends x{_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(s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae,be,pe,ye,Te,Re,ot,St,nt,Qe,yt,dt){const lt=this.length;return this.resize(lt+1),this.emplace(lt,s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae,be,pe,ye,Te,Re,ot,St,nt,Qe,yt,dt)}emplace(s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae,be,pe,ye,Te,Re,ot,St,nt,Qe,yt,dt,lt){const De=32*s,bt=16*s;return this.int16[De+0]=h,this.int16[De+1]=p,this.int16[De+2]=_,this.int16[De+3]=k,this.int16[De+4]=S,this.int16[De+5]=T,this.int16[De+6]=A,this.int16[De+7]=B,this.uint16[De+8]=z,this.uint16[De+9]=R,this.uint16[De+10]=j,this.uint16[De+11]=q,this.uint16[De+12]=Y,this.uint16[De+13]=K,this.uint16[De+14]=re,this.uint16[De+15]=ae,this.uint16[De+16]=be,this.uint16[De+17]=pe,this.uint16[De+18]=ye,this.uint16[De+19]=Te,this.uint16[De+20]=Re,this.uint16[De+21]=ot,this.uint16[De+22]=St,this.uint32[bt+12]=nt,this.float32[bt+13]=Qe,this.float32[bt+14]=yt,this.uint16[De+30]=dt,this.uint16[De+31]=lt,s}}Fe.prototype.bytesPerElement=64,ut("StructArrayLayout8i15ui1ul2f2ui64",Fe);class et extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.float32[1*s+0]=h,s}}et.prototype.bytesPerElement=4,ut("StructArrayLayout1f4",et);class at extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.uint16[6*s+0]=h,this.float32[k+1]=p,this.float32[k+2]=_,s}}at.prototype.bytesPerElement=12,ut("StructArrayLayout1ui2f12",at);class Ye extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=4*s;return this.uint32[2*s+0]=h,this.uint16[k+2]=p,this.uint16[k+3]=_,s}}Ye.prototype.bytesPerElement=8,ut("StructArrayLayout1ul2ui8",Ye);class Ge extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.uint16[_+0]=h,this.uint16[_+1]=p,s}}Ge.prototype.bytesPerElement=4,ut("StructArrayLayout2ui4",Ge);class mt extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.uint16[1*s+0]=h,s}}mt.prototype.bytesPerElement=2,ut("StructArrayLayout1ui2",mt);class Bt extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p,_){const k=this.length;return this.resize(k+1),this.emplace(k,s,h,p,_)}emplace(s,h,p,_,k){const S=4*s;return this.float32[S+0]=h,this.float32[S+1]=p,this.float32[S+2]=_,this.float32[S+3]=k,s}}Bt.prototype.bytesPerElement=16,ut("StructArrayLayout4f16",Bt);class Je extends y{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 E(this.anchorPointX,this.anchorPointY)}}Je.prototype.size=20;class it extends he{get(s){return new Je(this,s)}}ut("CollisionBoxArray",it);class Dt extends y{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(s){this._structArray.uint8[this._pos1+37]=s}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(s){this._structArray.uint8[this._pos1+38]=s}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(s){this._structArray.uint32[this._pos4+10]=s}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Dt.prototype.size=48;class Fn extends Oe{get(s){return new Dt(this,s)}}ut("PlacedSymbolArray",Fn);class $t extends y{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(s){this._structArray.uint32[this._pos4+12]=s}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]}}$t.prototype.size=64;class Jt extends Fe{get(s){return new $t(this,s)}}ut("SymbolInstanceArray",Jt);class $n extends et{getoffsetX(s){return this.float32[1*s+0]}}ut("GlyphOffsetArray",$n);class Bi extends N{getx(s){return this.int16[3*s+0]}gety(s){return this.int16[3*s+1]}gettileUnitDistanceFromAnchor(s){return this.int16[3*s+2]}}ut("SymbolLineVertexArray",Bi);class io extends y{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]}}io.prototype.size=12;class jn extends at{get(s){return new io(this,s)}}ut("TextAnchorOffsetArray",jn);class rr extends y{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]}}rr.prototype.size=8;class Gi extends Ye{get(s){return new rr(this,s)}}ut("FeatureIndexArray",Gi);class zi extends O{}class Zi extends O{}class Po extends O{}class Ka extends F{}class Du extends Z{}class Ja extends J{}class Fr extends ee{}class Ou extends oe{}class Rd extends le{}class $r extends ce{}class jr extends ne{}class fs extends ge{}class ro extends xe{}class Ei extends Ge{}const Ni=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:xr}=Ni;class tn{constructor(s=[]){this.segments=s}prepareSegment(s,h,p,_){let k=this.segments[this.segments.length-1];return s>tn.MAX_VERTEX_ARRAY_LENGTH&&st(`Max vertices per segment is ${tn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${s}`),(!k||k.vertexLength+s>tn.MAX_VERTEX_ARRAY_LENGTH||k.sortKey!==_)&&(k={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},_!==void 0&&(k.sortKey=_),this.segments.push(k)),k}get(){return this.segments}destroy(){for(const s of this.segments)for(const h in s.vaos)s.vaos[h].destroy()}static simpleSegment(s,h,p,_){return new tn([{vertexOffset:s,primitiveOffset:h,vertexLength:p,primitiveLength:_,vaos:{},sortKey:0}])}}function Js(c,s){return 256*(c=Ie(Math.floor(c),0,255))+Ie(Math.floor(s),0,255)}tn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ut("SegmentVector",tn);const Qa=M([{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 el={exports:{}},Pm={exports:{}};Pm.exports=function(c,s){var h,p,_,k,S,T,A,B;for(p=c.length-(h=3&c.length),_=s,S=3432918353,T=461845907,B=0;B<p;)A=255&c.charCodeAt(B)|(255&c.charCodeAt(++B))<<8|(255&c.charCodeAt(++B))<<16|(255&c.charCodeAt(++B))<<24,++B,_=27492+(65535&(k=5*(65535&(_=(_^=A=(65535&(A=(A=(65535&A)*S+(((A>>>16)*S&65535)<<16)&4294967295)<<15|A>>>17))*T+(((A>>>16)*T&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(k>>>16)&65535)<<16);switch(A=0,h){case 3:A^=(255&c.charCodeAt(B+2))<<16;case 2:A^=(255&c.charCodeAt(B+1))<<8;case 1:_^=A=(65535&(A=(A=(65535&(A^=255&c.charCodeAt(B)))*S+(((A>>>16)*S&65535)<<16)&4294967295)<<15|A>>>17))*T+(((A>>>16)*T&65535)<<16)&4294967295}return _^=c.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var O_=Pm.exports,Dm={exports:{}};Dm.exports=function(c,s){for(var h,p=c.length,_=s^p,k=0;p>=4;)h=1540483477*(65535&(h=255&c.charCodeAt(k)|(255&c.charCodeAt(++k))<<8|(255&c.charCodeAt(++k))<<16|(255&c.charCodeAt(++k))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++k;switch(p){case 3:_^=(255&c.charCodeAt(k+2))<<16;case 2:_^=(255&c.charCodeAt(k+1))<<8;case 1:_=1540483477*(65535&(_^=255&c.charCodeAt(k)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var ms=O_,Om=Dm.exports;el.exports=ms,el.exports.murmur3=ms,el.exports.murmur2=Om;var Bu=g(el.exports);class nc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(s,h,p,_){this.ids.push(zu(s)),this.positions.push(h,p,_)}getPositions(s){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=zu(s);let p=0,_=this.ids.length-1;for(;p<_;){const S=p+_>>1;this.ids[S]>=h?_=S:p=S+1}const k=[];for(;this.ids[p]===h;)k.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return k}static serialize(s,h){const p=new Float64Array(s.ids),_=new Uint32Array(s.positions);return Nu(p,_,0,p.length-1),h&&h.push(p.buffer,_.buffer),{ids:p,positions:_}}static deserialize(s){const h=new nc;return h.ids=s.ids,h.positions=s.positions,h.indexed=!0,h}}function zu(c){const s=+c;return!isNaN(s)&&s<=Number.MAX_SAFE_INTEGER?s:Bu(String(c))}function Nu(c,s,h,p){for(;h<p;){const _=c[h+p>>1];let k=h-1,S=p+1;for(;;){do k++;while(c[k]<_);do S--;while(c[S]>_);if(k>=S)break;tl(c,k,S),tl(s,3*k,3*S),tl(s,3*k+1,3*S+1),tl(s,3*k+2,3*S+2)}S-h<p-S?(Nu(c,s,h,S),h=S+1):(Nu(c,s,S+1,p),p=S)}}function tl(c,s,h){const p=c[s];c[s]=c[h],c[h]=p}ut("FeaturePositionMap",nc);class ic{constructor(s,h){this.gl=s.gl,this.location=h}}class Bm extends ic{constructor(s,h){super(s,h),this.current=0}set(s){this.current!==s&&(this.current=s,this.gl.uniform1f(this.location,s))}}class WS extends ic{constructor(s,h){super(s,h),this.current=[0,0,0,0]}set(s){s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]&&s[3]===this.current[3]||(this.current=s,this.gl.uniform4f(this.location,s[0],s[1],s[2],s[3]))}}class GS extends ic{constructor(s,h){super(s,h),this.current=kn.transparent}set(s){s.r===this.current.r&&s.g===this.current.g&&s.b===this.current.b&&s.a===this.current.a||(this.current=s,this.gl.uniform4f(this.location,s.r,s.g,s.b,s.a))}}const cW=new Float32Array(16);function B_(c){return[Js(255*c.r,255*c.g),Js(255*c.b,255*c.a)]}class Vd{constructor(s,h,p){this.value=s,this.uniformNames=h.map(_=>`u_${_}`),this.type=p}setUniform(s,h,p){s.set(p.constantOr(this.value))}getBinding(s,h,p){return this.type==="color"?new GS(s,h):new Bm(s,h)}}class Lu{constructor(s,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(s,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=s.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=s.tlbr}setUniform(s,h,p,_){const k=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;k&&s.set(k)}getBinding(s,h,p){return p.substr(0,9)==="u_pattern"?new WS(s,h):new Bm(s,h)}}class Qs{constructor(s,h,p,_){this.expression=s,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(k=>({name:`a_${k}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(s,h,p,_,k){const S=this.paintVertexArray.length,T=this.expression.evaluate(new Vn(0),h,{},_,[],k);this.paintVertexArray.resize(s),this._setPaintValue(S,s,T)}updatePaintArray(s,h,p,_){const k=this.expression.evaluate({zoom:0},p,_);this._setPaintValue(s,h,k)}_setPaintValue(s,h,p){if(this.type==="color"){const _=B_(p);for(let k=s;k<h;k++)this.paintVertexArray.emplace(k,_[0],_[1])}else{for(let _=s;_<h;_++)this.paintVertexArray.emplace(_,p);this.maxValue=Math.max(this.maxValue,Math.abs(p))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Wo{constructor(s,h,p,_,k,S){this.expression=s,this.uniformNames=h.map(T=>`u_${T}_t`),this.type=p,this.useIntegerZoom=_,this.zoom=k,this.maxValue=0,this.paintVertexAttributes=h.map(T=>({name:`a_${T}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new S}populatePaintArray(s,h,p,_,k){const S=this.expression.evaluate(new Vn(this.zoom),h,{},_,[],k),T=this.expression.evaluate(new Vn(this.zoom+1),h,{},_,[],k),A=this.paintVertexArray.length;this.paintVertexArray.resize(s),this._setPaintValue(A,s,S,T)}updatePaintArray(s,h,p,_){const k=this.expression.evaluate({zoom:this.zoom},p,_),S=this.expression.evaluate({zoom:this.zoom+1},p,_);this._setPaintValue(s,h,k,S)}_setPaintValue(s,h,p,_){if(this.type==="color"){const k=B_(p),S=B_(_);for(let T=s;T<h;T++)this.paintVertexArray.emplace(T,k[0],k[1],S[0],S[1])}else{for(let k=s;k<h;k++)this.paintVertexArray.emplace(k,p,_);this.maxValue=Math.max(this.maxValue,Math.abs(p),Math.abs(_))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(s,h){const p=this.useIntegerZoom?Math.floor(h.zoom):h.zoom,_=Ie(this.expression.interpolationFactor(p,this.zoom,this.zoom+1),0,1);s.set(_)}getBinding(s,h,p){return new Bm(s,h)}}class nl{constructor(s,h,p,_,k,S){this.expression=s,this.type=h,this.useIntegerZoom=p,this.zoom=_,this.layerId=S,this.zoomInPaintVertexArray=new k,this.zoomOutPaintVertexArray=new k}populatePaintArray(s,h,p){const _=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(s),this.zoomOutPaintVertexArray.resize(s),this._setPaintValues(_,s,h.patterns&&h.patterns[this.layerId],p)}updatePaintArray(s,h,p,_,k){this._setPaintValues(s,h,p.patterns&&p.patterns[this.layerId],k)}_setPaintValues(s,h,p,_){if(!_||!p)return;const{min:k,mid:S,max:T}=p,A=_[k],B=_[S],z=_[T];if(A&&B&&z)for(let R=s;R<h;R++)this.zoomInPaintVertexArray.emplace(R,B.tl[0],B.tl[1],B.br[0],B.br[1],A.tl[0],A.tl[1],A.br[0],A.br[1],B.pixelRatio,A.pixelRatio),this.zoomOutPaintVertexArray.emplace(R,B.tl[0],B.tl[1],B.br[0],B.br[1],z.tl[0],z.tl[1],z.br[0],z.br[1],B.pixelRatio,z.pixelRatio)}upload(s){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=s.createVertexBuffer(this.zoomInPaintVertexArray,Qa.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=s.createVertexBuffer(this.zoomOutPaintVertexArray,Qa.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ZS{constructor(s,h,p){this.binders={},this._buffers=[];const _=[];for(const k in s.paint._values){if(!p(k))continue;const S=s.paint.get(k);if(!(S instanceof Io&&Ra(S.property.specification)))continue;const T=uW(k,s.type),A=S.value,B=S.property.specification.type,z=S.property.useIntegerZoom,R=S.property.specification["property-type"],j=R==="cross-faded"||R==="cross-faded-data-driven";if(A.kind==="constant")this.binders[k]=j?new Lu(A.value,T):new Vd(A.value,T,B),_.push(`/u_${k}`);else if(A.kind==="source"||j){const q=YS(k,B,"source");this.binders[k]=j?new nl(A,B,z,h,q,s.id):new Qs(A,T,B,q),_.push(`/a_${k}`)}else{const q=YS(k,B,"composite");this.binders[k]=new Wo(A,T,B,z,h,q),_.push(`/z_${k}`)}}this.cacheKey=_.sort().join("")}getMaxValue(s){const h=this.binders[s];return h instanceof Qs||h instanceof Wo?h.maxValue:0}populatePaintArrays(s,h,p,_,k){for(const S in this.binders){const T=this.binders[S];(T instanceof Qs||T instanceof Wo||T instanceof nl)&&T.populatePaintArray(s,h,p,_,k)}}setConstantPatternPositions(s,h){for(const p in this.binders){const _=this.binders[p];_ instanceof Lu&&_.setConstantPatternPositions(s,h)}}updatePaintArrays(s,h,p,_,k){let S=!1;for(const T in s){const A=h.getPositions(T);for(const B of A){const z=p.feature(B.index);for(const R in this.binders){const j=this.binders[R];if((j instanceof Qs||j instanceof Wo||j instanceof nl)&&j.expression.isStateDependent===!0){const q=_.paint.get(R);j.expression=q.value,j.updatePaintArray(B.start,B.end,z,s[T],k),S=!0}}}}return S}defines(){const s=[];for(const h in this.binders){const p=this.binders[h];(p instanceof Vd||p instanceof Lu)&&s.push(...p.uniformNames.map(_=>`#define HAS_UNIFORM_${_}`))}return s}getBinderAttributes(){const s=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Qs||p instanceof Wo)for(let _=0;_<p.paintVertexAttributes.length;_++)s.push(p.paintVertexAttributes[_].name);else if(p instanceof nl)for(let _=0;_<Qa.members.length;_++)s.push(Qa.members[_].name)}return s}getBinderUniforms(){const s=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Vd||p instanceof Lu||p instanceof Wo)for(const _ of p.uniformNames)s.push(_)}return s}getPaintVertexBuffers(){return this._buffers}getUniforms(s,h){const p=[];for(const _ in this.binders){const k=this.binders[_];if(k instanceof Vd||k instanceof Lu||k instanceof Wo){for(const S of k.uniformNames)if(h[S]){const T=k.getBinding(s,h[S],S);p.push({name:S,property:_,binding:T})}}}return p}setUniforms(s,h,p,_){for(const{name:k,property:S,binding:T}of h)this.binders[S].setUniform(T,_,p.get(S),k)}updatePaintBuffers(s){this._buffers=[];for(const h in this.binders){const p=this.binders[h];if(s&&p instanceof nl){const _=s.fromScale===2?p.zoomInPaintVertexBuffer:p.zoomOutPaintVertexBuffer;_&&this._buffers.push(_)}else(p instanceof Qs||p instanceof Wo)&&p.paintVertexBuffer&&this._buffers.push(p.paintVertexBuffer)}}upload(s){for(const h in this.binders){const p=this.binders[h];(p instanceof Qs||p instanceof Wo||p instanceof nl)&&p.upload(s)}this.updatePaintBuffers()}destroy(){for(const s in this.binders){const h=this.binders[s];(h instanceof Qs||h instanceof Wo||h instanceof nl)&&h.destroy()}}}class rc{constructor(s,h,p=()=>!0){this.programConfigurations={};for(const _ of s)this.programConfigurations[_.id]=new ZS(_,h,p);this.needsUpload=!1,this._featureMap=new nc,this._bufferOffset=0}populatePaintArrays(s,h,p,_,k,S){for(const T in this.programConfigurations)this.programConfigurations[T].populatePaintArrays(s,h,_,k,S);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,s),this._bufferOffset=s,this.needsUpload=!0}updatePaintArrays(s,h,p,_){for(const k of p)this.needsUpload=this.programConfigurations[k.id].updatePaintArrays(s,this._featureMap,h,k,_)||this.needsUpload}get(s){return this.programConfigurations[s]}upload(s){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(s);this.needsUpload=!1}}destroy(){for(const s in this.programConfigurations)this.programConfigurations[s].destroy()}}function uW(c,s){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"]}[c]||[c.replace(`${s}-`,"").replace(/-/g,"_")]}function YS(c,s,h){const p={color:{source:J,composite:Bt},number:{source:et,composite:J}},_=function(k){return{"line-pattern":{source:Fr,composite:Fr},"fill-pattern":{source:Fr,composite:Fr},"fill-extrusion-pattern":{source:Fr,composite:Fr}}[k]}(c);return _&&_[h]||p[s][h]}ut("ConstantBinder",Vd),ut("CrossFadedConstantBinder",Lu),ut("SourceExpressionBinder",Qs),ut("CrossFadedCompositeBinder",nl),ut("CompositeExpressionBinder",Wo),ut("ProgramConfiguration",ZS,{omit:["_buffers"]}),ut("ProgramConfigurationSet",rc);const ai=8192,z_=Math.pow(2,14)-1,XS=-z_-1;function oc(c){const s=ai/c.extent,h=c.loadGeometry();for(let p=0;p<h.length;p++){const _=h[p];for(let k=0;k<_.length;k++){const S=_[k],T=Math.round(S.x*s),A=Math.round(S.y*s);S.x=Ie(T,XS,z_),S.y=Ie(A,XS,z_),(T<S.x||T>S.x+1||A<S.y||A>S.y+1)&&st("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function sc(c,s){return{type:c.type,id:c.id,properties:c.properties,geometry:s?oc(c):[]}}function zm(c,s,h,p,_){c.emplaceBack(2*s+(p+1)/2,2*h+(_+1)/2)}class N_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.layoutVertexArray=new Zi,this.indexArray=new ro,this.segments=new tn,this.programConfigurations=new rc(s.layers,s.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){const _=this.layers[0],k=[];let S=null,T=!1;_.type==="circle"&&(S=_.layout.get("circle-sort-key"),T=!S.isConstant());for(const{feature:A,id:B,index:z,sourceLayerIndex:R}of s){const j=this.layers[0]._featureFilter.needGeometry,q=sc(A,j);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),q,p))continue;const Y=T?S.evaluate(q,{},p):void 0,K={id:B,properties:A.properties,type:A.type,sourceLayerIndex:R,index:z,geometry:j?q.geometry:oc(A),patterns:{},sortKey:Y};k.push(K)}T&&k.sort((A,B)=>A.sortKey-B.sortKey);for(const A of k){const{geometry:B,index:z,sourceLayerIndex:R}=A,j=s[z].feature;this.addFeature(A,B,z,p),h.featureIndex.insert(j,B,z,R,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,xr),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(s,h,p,_){for(const k of h)for(const S of k){const T=S.x,A=S.y;if(T<0||T>=ai||A<0||A>=ai)continue;const B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,s.sortKey),z=B.vertexLength;zm(this.layoutVertexArray,T,A,-1,-1),zm(this.layoutVertexArray,T,A,1,-1),zm(this.layoutVertexArray,T,A,1,1),zm(this.layoutVertexArray,T,A,-1,1),this.indexArray.emplaceBack(z,z+1,z+2),this.indexArray.emplaceBack(z,z+3,z+2),B.vertexLength+=4,B.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,{},_)}}function KS(c,s){for(let h=0;h<c.length;h++)if(Ru(s,c[h]))return!0;for(let h=0;h<s.length;h++)if(Ru(c,s[h]))return!0;return!!L_(c,s)}function hW(c,s,h){return!!Ru(c,s)||!!R_(s,c,h)}function JS(c,s){if(c.length===1)return eE(s,c[0]);for(let h=0;h<s.length;h++){const p=s[h];for(let _=0;_<p.length;_++)if(Ru(c,p[_]))return!0}for(let h=0;h<c.length;h++)if(eE(s,c[h]))return!0;for(let h=0;h<s.length;h++)if(L_(c,s[h]))return!0;return!1}function dW(c,s,h){if(c.length>1){if(L_(c,s))return!0;for(let p=0;p<s.length;p++)if(R_(s[p],c,h))return!0}for(let p=0;p<c.length;p++)if(R_(c[p],s,h))return!0;return!1}function L_(c,s){if(c.length===0||s.length===0)return!1;for(let h=0;h<c.length-1;h++){const p=c[h],_=c[h+1];for(let k=0;k<s.length-1;k++)if(pW(p,_,s[k],s[k+1]))return!0}return!1}function pW(c,s,h,p){return Tt(c,h,p)!==Tt(s,h,p)&&Tt(c,s,h)!==Tt(c,s,p)}function R_(c,s,h){const p=h*h;if(s.length===1)return c.distSqr(s[0])<p;for(let _=1;_<s.length;_++)if(QS(c,s[_-1],s[_])<p)return!0;return!1}function QS(c,s,h){const p=s.distSqr(h);if(p===0)return c.distSqr(s);const _=((c.x-s.x)*(h.x-s.x)+(c.y-s.y)*(h.y-s.y))/p;return c.distSqr(_<0?s:_>1?h:h.sub(s)._mult(_)._add(s))}function eE(c,s){let h,p,_,k=!1;for(let S=0;S<c.length;S++){h=c[S];for(let T=0,A=h.length-1;T<h.length;A=T++)p=h[T],_=h[A],p.y>s.y!=_.y>s.y&&s.x<(_.x-p.x)*(s.y-p.y)/(_.y-p.y)+p.x&&(k=!k)}return k}function Ru(c,s){let h=!1;for(let p=0,_=c.length-1;p<c.length;_=p++){const k=c[p],S=c[_];k.y>s.y!=S.y>s.y&&s.x<(S.x-k.x)*(s.y-k.y)/(S.y-k.y)+k.x&&(h=!h)}return h}function fW(c,s,h){const p=h[0],_=h[2];if(c.x<p.x&&s.x<p.x||c.x>_.x&&s.x>_.x||c.y<p.y&&s.y<p.y||c.y>_.y&&s.y>_.y)return!1;const k=Tt(c,s,h[0]);return k!==Tt(c,s,h[1])||k!==Tt(c,s,h[2])||k!==Tt(c,s,h[3])}function Fd(c,s,h){const p=s.paint.get(c).value;return p.kind==="constant"?p.value:h.programConfigurations.get(s.id).getMaxValue(c)}function Nm(c){return Math.sqrt(c[0]*c[0]+c[1]*c[1])}function Lm(c,s,h,p,_){if(!s[0]&&!s[1])return c;const k=E.convert(s)._mult(_);h==="viewport"&&k._rotate(-p);const S=[];for(let T=0;T<c.length;T++)S.push(c[T].sub(k));return S}let tE,nE;ut("CircleBucket",N_,{omit:["layers"]});var mW={get paint(){return nE=nE||new v({"circle-radius":new Et(we.paint_circle["circle-radius"]),"circle-color":new Et(we.paint_circle["circle-color"]),"circle-blur":new Et(we.paint_circle["circle-blur"]),"circle-opacity":new Et(we.paint_circle["circle-opacity"]),"circle-translate":new ft(we.paint_circle["circle-translate"]),"circle-translate-anchor":new ft(we.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ft(we.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ft(we.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Et(we.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Et(we.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Et(we.paint_circle["circle-stroke-opacity"])})},get layout(){return tE=tE||new v({"circle-sort-key":new Et(we.layout_circle["circle-sort-key"])})}},or=1e-6,Vu=typeof Float32Array<"u"?Float32Array:Array;function V_(c){return c[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=1,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c}function iE(c,s,h){var p=s[0],_=s[1],k=s[2],S=s[3],T=s[4],A=s[5],B=s[6],z=s[7],R=s[8],j=s[9],q=s[10],Y=s[11],K=s[12],re=s[13],ae=s[14],be=s[15],pe=h[0],ye=h[1],Te=h[2],Re=h[3];return c[0]=pe*p+ye*T+Te*R+Re*K,c[1]=pe*_+ye*A+Te*j+Re*re,c[2]=pe*k+ye*B+Te*q+Re*ae,c[3]=pe*S+ye*z+Te*Y+Re*be,c[4]=(pe=h[4])*p+(ye=h[5])*T+(Te=h[6])*R+(Re=h[7])*K,c[5]=pe*_+ye*A+Te*j+Re*re,c[6]=pe*k+ye*B+Te*q+Re*ae,c[7]=pe*S+ye*z+Te*Y+Re*be,c[8]=(pe=h[8])*p+(ye=h[9])*T+(Te=h[10])*R+(Re=h[11])*K,c[9]=pe*_+ye*A+Te*j+Re*re,c[10]=pe*k+ye*B+Te*q+Re*ae,c[11]=pe*S+ye*z+Te*Y+Re*be,c[12]=(pe=h[12])*p+(ye=h[13])*T+(Te=h[14])*R+(Re=h[15])*K,c[13]=pe*_+ye*A+Te*j+Re*re,c[14]=pe*k+ye*B+Te*q+Re*ae,c[15]=pe*S+ye*z+Te*Y+Re*be,c}Math.hypot||(Math.hypot=function(){for(var c=0,s=arguments.length;s--;)c+=arguments[s]*arguments[s];return Math.sqrt(c)});var $d,gW=iE;function Rm(c,s,h){var p=s[0],_=s[1],k=s[2],S=s[3];return c[0]=h[0]*p+h[4]*_+h[8]*k+h[12]*S,c[1]=h[1]*p+h[5]*_+h[9]*k+h[13]*S,c[2]=h[2]*p+h[6]*_+h[10]*k+h[14]*S,c[3]=h[3]*p+h[7]*_+h[11]*k+h[15]*S,c}$d=new Vu(4),Vu!=Float32Array&&($d[0]=0,$d[1]=0,$d[2]=0,$d[3]=0);class yW extends d{constructor(s){super(s,mW)}createBucket(s){return new N_(s)}queryRadius(s){const h=s;return Fd("circle-radius",this,h)+Fd("circle-stroke-width",this,h)+Nm(this.paint.get("circle-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T,A){const B=Lm(s,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),S.angle,T),z=this.paint.get("circle-radius").evaluate(h,p)+this.paint.get("circle-stroke-width").evaluate(h,p),R=this.paint.get("circle-pitch-alignment")==="map",j=R?B:function(Y,K){return Y.map(re=>rE(re,K))}(B,A),q=R?z*T:z;for(const Y of _)for(const K of Y){const re=R?K:rE(K,A);let ae=q;const be=Rm([],[K.x,K.y,0,1],A);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ae*=be[3]/S.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ae*=S.cameraToCenterDistance/be[3]),hW(j,re,ae))return!0}return!1}}function rE(c,s){const h=Rm([],[c.x,c.y,0,1],s);return new E(h[0]/h[3],h[1]/h[3])}class oE extends N_{}let sE;ut("HeatmapBucket",oE,{omit:["layers"]});var _W={get paint(){return sE=sE||new v({"heatmap-radius":new Et(we.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Et(we.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ft(we.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ld(we.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ft(we.paint_heatmap["heatmap-opacity"])})}};function F_(c,{width:s,height:h},p,_){if(_){if(_ instanceof Uint8ClampedArray)_=new Uint8Array(_.buffer);else if(_.length!==s*h*p)throw new RangeError(`mismatched image size. expected: ${_.length} but got: ${s*h*p}`)}else _=new Uint8Array(s*h*p);return c.width=s,c.height=h,c.data=_,c}function aE(c,{width:s,height:h},p){if(s===c.width&&h===c.height)return;const _=F_({},{width:s,height:h},p);$_(c,_,{x:0,y:0},{x:0,y:0},{width:Math.min(c.width,s),height:Math.min(c.height,h)},p),c.width=s,c.height=h,c.data=_.data}function $_(c,s,h,p,_,k){if(_.width===0||_.height===0)return s;if(_.width>c.width||_.height>c.height||h.x>c.width-_.width||h.y>c.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>s.width||_.height>s.height||p.x>s.width-_.width||p.y>s.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const S=c.data,T=s.data;if(S===T)throw new Error("srcData equals dstData, so image is already copied");for(let A=0;A<_.height;A++){const B=((h.y+A)*c.width+h.x)*k,z=((p.y+A)*s.width+p.x)*k;for(let R=0;R<_.width*k;R++)T[z+R]=S[B+R]}return s}class jd{constructor(s,h){F_(this,s,1,h)}resize(s){aE(this,s,1)}clone(){return new jd({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,h,p,_,k){$_(s,h,p,_,k,1)}}class oo{constructor(s,h){F_(this,s,4,h)}resize(s){aE(this,s,4)}replace(s,h){h?this.data.set(s):this.data=s instanceof Uint8ClampedArray?new Uint8Array(s.buffer):s}clone(){return new oo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,h,p,_,k){$_(s,h,p,_,k,4)}}function lE(c){const s={},h=c.resolution||256,p=c.clips?c.clips.length:1,_=c.image||new oo({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const k=(S,T,A)=>{s[c.evaluationKey]=A;const B=c.expression.evaluate(s);_.data[S+T+0]=Math.floor(255*B.r/B.a),_.data[S+T+1]=Math.floor(255*B.g/B.a),_.data[S+T+2]=Math.floor(255*B.b/B.a),_.data[S+T+3]=Math.floor(255*B.a)};if(c.clips)for(let S=0,T=0;S<p;++S,T+=4*h)for(let A=0,B=0;A<h;A++,B+=4){const z=A/(h-1),{start:R,end:j}=c.clips[S];k(T,B,R*(1-z)+j*z)}else for(let S=0,T=0;S<h;S++,T+=4)k(0,T,S/(h-1));return _}ut("AlphaImage",jd),ut("RGBAImage",oo);const j_="big-fb";class bW extends d{createBucket(s){return new oE(s)}constructor(s){super(s,_W),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(s){s==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=lE({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(j_)&&this.heatmapFbos.delete(j_)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let cE;var xW={get paint(){return cE=cE||new v({"hillshade-illumination-direction":new ft(we.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ft(we.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ft(we.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ft(we.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ft(we.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ft(we.paint_hillshade["hillshade-accent-color"])})}};class vW extends d{constructor(s){super(s,xW)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const wW=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:kW}=wW;function uE(c,s,h=2){const p=s&&s.length,_=p?s[0]*h:c.length;let k=hE(c,0,_,h,!0);const S=[];if(!k||k.next===k.prev)return S;let T,A,B;if(p&&(k=function(z,R,j,q){const Y=[];for(let K=0,re=R.length;K<re;K++){const ae=hE(z,R[K]*q,K<re-1?R[K+1]*q:z.length,q,!1);ae===ae.next&&(ae.steiner=!0),Y.push(PW(ae))}Y.sort(MW);for(let K=0;K<Y.length;K++)j=AW(Y[K],j);return j}(c,s,k,h)),c.length>80*h){T=1/0,A=1/0;let z=-1/0,R=-1/0;for(let j=h;j<_;j+=h){const q=c[j],Y=c[j+1];q<T&&(T=q),Y<A&&(A=Y),q>z&&(z=q),Y>R&&(R=Y)}B=Math.max(z-T,R-A),B=B!==0?32767/B:0}return Ud(k,S,h,T,A,B,0),S}function hE(c,s,h,p,_){let k;if(_===function(S,T,A,B){let z=0;for(let R=T,j=A-B;R<A;R+=B)z+=(S[j]-S[R])*(S[R+1]+S[j+1]),j=R;return z}(c,s,h,p)>0)for(let S=s;S<h;S+=p)k=fE(S/p|0,c[S],c[S+1],k);else for(let S=h-p;S>=s;S-=p)k=fE(S/p|0,c[S],c[S+1],k);return k&&Vm(k,k.next)&&(qd(k),k=k.next),k}function ac(c,s){if(!c)return c;s||(s=c);let h,p=c;do if(h=!1,p.steiner||!Vm(p,p.next)&&ii(p.prev,p,p.next)!==0)p=p.next;else{if(qd(p),p=s=p.prev,p===p.next)break;h=!0}while(h||p!==s);return s}function Ud(c,s,h,p,_,k,S){if(!c)return;!S&&k&&function(A,B,z,R){let j=A;do j.z===0&&(j.z=U_(j.x,j.y,B,z,R)),j.prevZ=j.prev,j.nextZ=j.next,j=j.next;while(j!==A);j.prevZ.nextZ=null,j.prevZ=null,function(q){let Y,K=1;do{let re,ae=q;q=null;let be=null;for(Y=0;ae;){Y++;let pe=ae,ye=0;for(let Re=0;Re<K&&(ye++,pe=pe.nextZ,pe);Re++);let Te=K;for(;ye>0||Te>0&&pe;)ye!==0&&(Te===0||!pe||ae.z<=pe.z)?(re=ae,ae=ae.nextZ,ye--):(re=pe,pe=pe.nextZ,Te--),be?be.nextZ=re:q=re,re.prevZ=be,be=re;ae=pe}be.nextZ=null,K*=2}while(Y>1)}(j)}(c,p,_,k);let T=c;for(;c.prev!==c.next;){const A=c.prev,B=c.next;if(k?EW(c,p,_,k):SW(c))s.push(A.i,c.i,B.i),qd(c),c=B.next,T=B.next;else if((c=B)===T){S?S===1?Ud(c=CW(ac(c),s),s,h,p,_,k,2):S===2&&TW(c,s,h,p,_,k):Ud(ac(c),s,h,p,_,k,1);break}}}function SW(c){const s=c.prev,h=c,p=c.next;if(ii(s,h,p)>=0)return!1;const _=s.x,k=h.x,S=p.x,T=s.y,A=h.y,B=p.y,z=_<k?_<S?_:S:k<S?k:S,R=T<A?T<B?T:B:A<B?A:B,j=_>k?_>S?_:S:k>S?k:S,q=T>A?T>B?T:B:A>B?A:B;let Y=p.next;for(;Y!==s;){if(Y.x>=z&&Y.x<=j&&Y.y>=R&&Y.y<=q&&Fu(_,T,k,A,S,B,Y.x,Y.y)&&ii(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function EW(c,s,h,p){const _=c.prev,k=c,S=c.next;if(ii(_,k,S)>=0)return!1;const T=_.x,A=k.x,B=S.x,z=_.y,R=k.y,j=S.y,q=T<A?T<B?T:B:A<B?A:B,Y=z<R?z<j?z:j:R<j?R:j,K=T>A?T>B?T:B:A>B?A:B,re=z>R?z>j?z:j:R>j?R:j,ae=U_(q,Y,s,h,p),be=U_(K,re,s,h,p);let pe=c.prevZ,ye=c.nextZ;for(;pe&&pe.z>=ae&&ye&&ye.z<=be;){if(pe.x>=q&&pe.x<=K&&pe.y>=Y&&pe.y<=re&&pe!==_&&pe!==S&&Fu(T,z,A,R,B,j,pe.x,pe.y)&&ii(pe.prev,pe,pe.next)>=0||(pe=pe.prevZ,ye.x>=q&&ye.x<=K&&ye.y>=Y&&ye.y<=re&&ye!==_&&ye!==S&&Fu(T,z,A,R,B,j,ye.x,ye.y)&&ii(ye.prev,ye,ye.next)>=0))return!1;ye=ye.nextZ}for(;pe&&pe.z>=ae;){if(pe.x>=q&&pe.x<=K&&pe.y>=Y&&pe.y<=re&&pe!==_&&pe!==S&&Fu(T,z,A,R,B,j,pe.x,pe.y)&&ii(pe.prev,pe,pe.next)>=0)return!1;pe=pe.prevZ}for(;ye&&ye.z<=be;){if(ye.x>=q&&ye.x<=K&&ye.y>=Y&&ye.y<=re&&ye!==_&&ye!==S&&Fu(T,z,A,R,B,j,ye.x,ye.y)&&ii(ye.prev,ye,ye.next)>=0)return!1;ye=ye.nextZ}return!0}function CW(c,s){let h=c;do{const p=h.prev,_=h.next.next;!Vm(p,_)&&dE(p,h,h.next,_)&&Hd(p,_)&&Hd(_,p)&&(s.push(p.i,h.i,_.i),qd(h),qd(h.next),h=c=_),h=h.next}while(h!==c);return ac(h)}function TW(c,s,h,p,_,k){let S=c;do{let T=S.next.next;for(;T!==S.prev;){if(S.i!==T.i&&DW(S,T)){let A=pE(S,T);return S=ac(S,S.next),A=ac(A,A.next),Ud(S,s,h,p,_,k,0),void Ud(A,s,h,p,_,k,0)}T=T.next}S=S.next}while(S!==c)}function MW(c,s){return c.x-s.x}function AW(c,s){const h=function(_,k){let S=k;const T=_.x,A=_.y;let B,z=-1/0;do{if(A<=S.y&&A>=S.next.y&&S.next.y!==S.y){const K=S.x+(A-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(K<=T&&K>z&&(z=K,B=S.x<S.next.x?S:S.next,K===T))return B}S=S.next}while(S!==k);if(!B)return null;const R=B,j=B.x,q=B.y;let Y=1/0;S=B;do{if(T>=S.x&&S.x>=j&&T!==S.x&&Fu(A<q?T:z,A,j,q,A<q?z:T,A,S.x,S.y)){const K=Math.abs(A-S.y)/(T-S.x);Hd(S,_)&&(K<Y||K===Y&&(S.x>B.x||S.x===B.x&&IW(B,S)))&&(B=S,Y=K)}S=S.next}while(S!==R);return B}(c,s);if(!h)return s;const p=pE(h,c);return ac(p,p.next),ac(h,h.next)}function IW(c,s){return ii(c.prev,c,s.prev)<0&&ii(s.next,c,c.next)<0}function U_(c,s,h,p,_){return(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-h)*_|0)|c<<8))|c<<4))|c<<2))|c<<1))|(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-p)*_|0)|s<<8))|s<<4))|s<<2))|s<<1))<<1}function PW(c){let s=c,h=c;do(s.x<h.x||s.x===h.x&&s.y<h.y)&&(h=s),s=s.next;while(s!==c);return h}function Fu(c,s,h,p,_,k,S,T){return(_-S)*(s-T)>=(c-S)*(k-T)&&(c-S)*(p-T)>=(h-S)*(s-T)&&(h-S)*(k-T)>=(_-S)*(p-T)}function DW(c,s){return c.next.i!==s.i&&c.prev.i!==s.i&&!function(h,p){let _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==p.i&&_.next.i!==p.i&&dE(_,_.next,h,p))return!0;_=_.next}while(_!==h);return!1}(c,s)&&(Hd(c,s)&&Hd(s,c)&&function(h,p){let _=h,k=!1;const S=(h.x+p.x)/2,T=(h.y+p.y)/2;do _.y>T!=_.next.y>T&&_.next.y!==_.y&&S<(_.next.x-_.x)*(T-_.y)/(_.next.y-_.y)+_.x&&(k=!k),_=_.next;while(_!==h);return k}(c,s)&&(ii(c.prev,c,s.prev)||ii(c,s.prev,s))||Vm(c,s)&&ii(c.prev,c,c.next)>0&&ii(s.prev,s,s.next)>0)}function ii(c,s,h){return(s.y-c.y)*(h.x-s.x)-(s.x-c.x)*(h.y-s.y)}function Vm(c,s){return c.x===s.x&&c.y===s.y}function dE(c,s,h,p){const _=$m(ii(c,s,h)),k=$m(ii(c,s,p)),S=$m(ii(h,p,c)),T=$m(ii(h,p,s));return _!==k&&S!==T||!(_!==0||!Fm(c,h,s))||!(k!==0||!Fm(c,p,s))||!(S!==0||!Fm(h,c,p))||!(T!==0||!Fm(h,s,p))}function Fm(c,s,h){return s.x<=Math.max(c.x,h.x)&&s.x>=Math.min(c.x,h.x)&&s.y<=Math.max(c.y,h.y)&&s.y>=Math.min(c.y,h.y)}function $m(c){return c>0?1:c<0?-1:0}function Hd(c,s){return ii(c.prev,c,c.next)<0?ii(c,s,c.next)>=0&&ii(c,c.prev,s)>=0:ii(c,s,c.prev)<0||ii(c,c.next,s)<0}function pE(c,s){const h=H_(c.i,c.x,c.y),p=H_(s.i,s.x,s.y),_=c.next,k=s.prev;return c.next=s,s.prev=c,h.next=_,_.prev=h,p.next=h,h.prev=p,k.next=p,p.prev=k,p}function fE(c,s,h,p){const _=H_(c,s,h);return p?(_.next=p.next,_.prev=p,p.next.prev=_,p.next=_):(_.prev=_,_.next=_),_}function qd(c){c.next.prev=c.prev,c.prev.next=c.next,c.prevZ&&(c.prevZ.nextZ=c.nextZ),c.nextZ&&(c.nextZ.prevZ=c.prevZ)}function H_(c,s,h){return{i:c,x:s,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function q_(c,s,h){const p=h.patternDependencies;let _=!1;for(const k of s){const S=k.paint.get(`${c}-pattern`);S.isConstant()||(_=!0);const T=S.constantOr(null);T&&(_=!0,p[T.to]=!0,p[T.from]=!0)}return _}function W_(c,s,h,p,_){const k=_.patternDependencies;for(const S of s){const T=S.paint.get(`${c}-pattern`).value;if(T.kind!=="constant"){let A=T.evaluate({zoom:p-1},h,{},_.availableImages),B=T.evaluate({zoom:p},h,{},_.availableImages),z=T.evaluate({zoom:p+1},h,{},_.availableImages);A=A&&A.name?A.name:A,B=B&&B.name?B.name:B,z=z&&z.name?z.name:z,k[A]=!0,k[B]=!0,k[z]=!0,h.patterns[S.id]={min:A,mid:B,max:z}}}return h}class G_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Po,this.indexArray=new ro,this.indexArray2=new Ei,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.segments2=new tn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.hasPattern=q_("fill",this.layers,h);const _=this.layers[0].layout.get("fill-sort-key"),k=!_.isConstant(),S=[];for(const{feature:T,id:A,index:B,sourceLayerIndex:z}of s){const R=this.layers[0]._featureFilter.needGeometry,j=sc(T,R);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),j,p))continue;const q=k?_.evaluate(j,{},p,h.availableImages):void 0,Y={id:A,properties:T.properties,type:T.type,sourceLayerIndex:z,index:B,geometry:R?j.geometry:oc(T),patterns:{},sortKey:q};S.push(Y)}k&&S.sort((T,A)=>T.sortKey-A.sortKey);for(const T of S){const{geometry:A,index:B,sourceLayerIndex:z}=T;if(this.hasPattern){const R=W_("fill",this.layers,T,this.zoom,h);this.patternFeatures.push(R)}else this.addFeature(T,A,B,p,{});h.featureIndex.insert(s[B].feature,A,B,z,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}addFeatures(s,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,kW),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.indexBuffer2=s.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(s),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(s,h,p,_,k){for(const S of uu(h,500)){let T=0;for(const q of S)T+=q.length;const A=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray),B=A.vertexLength,z=[],R=[];for(const q of S){if(q.length===0)continue;q!==S[0]&&R.push(z.length/2);const Y=this.segments2.prepareSegment(q.length,this.layoutVertexArray,this.indexArray2),K=Y.vertexLength;this.layoutVertexArray.emplaceBack(q[0].x,q[0].y),this.indexArray2.emplaceBack(K+q.length-1,K),z.push(q[0].x),z.push(q[0].y);for(let re=1;re<q.length;re++)this.layoutVertexArray.emplaceBack(q[re].x,q[re].y),this.indexArray2.emplaceBack(K+re-1,K+re),z.push(q[re].x),z.push(q[re].y);Y.vertexLength+=q.length,Y.primitiveLength+=q.length}const j=uE(z,R);for(let q=0;q<j.length;q+=3)this.indexArray.emplaceBack(B+j[q],B+j[q+1],B+j[q+2]);A.vertexLength+=T,A.primitiveLength+=j.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}}let mE,gE;ut("FillBucket",G_,{omit:["layers","patternFeatures"]});var OW={get paint(){return gE=gE||new v({"fill-antialias":new ft(we.paint_fill["fill-antialias"]),"fill-opacity":new Et(we.paint_fill["fill-opacity"]),"fill-color":new Et(we.paint_fill["fill-color"]),"fill-outline-color":new Et(we.paint_fill["fill-outline-color"]),"fill-translate":new ft(we.paint_fill["fill-translate"]),"fill-translate-anchor":new ft(we.paint_fill["fill-translate-anchor"]),"fill-pattern":new Iu(we.paint_fill["fill-pattern"])})},get layout(){return mE=mE||new v({"fill-sort-key":new Et(we.layout_fill["fill-sort-key"])})}};class BW extends d{constructor(s){super(s,OW)}recalculate(s,h){super.recalculate(s,h);const p=this.paint._values["fill-outline-color"];p.value.kind==="constant"&&p.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(s){return new G_(s)}queryRadius(){return Nm(this.paint.get("fill-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T){return JS(Lm(s,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),S.angle,T),_)}isTileClipped(){return!0}}const zW=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),NW=M([{name:"a_centroid",components:2,type:"Int16"}],4),{members:LW}=zW;var il={},RW=b,yE=$u;function $u(c,s,h,p,_){this.properties={},this.extent=h,this.type=0,this._pbf=c,this._geometry=-1,this._keys=p,this._values=_,c.readFields(VW,this,s)}function VW(c,s,h){c==1?s.id=h.readVarint():c==2?function(p,_){for(var k=p.readVarint()+p.pos;p.pos<k;){var S=_._keys[p.readVarint()],T=_._values[p.readVarint()];_.properties[S]=T}}(h,s):c==3?s.type=h.readVarint():c==4&&(s._geometry=h.pos)}function FW(c){for(var s,h,p=0,_=0,k=c.length,S=k-1;_<k;S=_++)p+=((h=c[S]).x-(s=c[_]).x)*(s.y+h.y);return p}$u.types=["Unknown","Point","LineString","Polygon"],$u.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var s,h=c.readVarint()+c.pos,p=1,_=0,k=0,S=0,T=[];c.pos<h;){if(_<=0){var A=c.readVarint();p=7&A,_=A>>3}if(_--,p===1||p===2)k+=c.readSVarint(),S+=c.readSVarint(),p===1&&(s&&T.push(s),s=[]),s.push(new RW(k,S));else{if(p!==7)throw new Error("unknown command "+p);s&&s.push(s[0].clone())}}return s&&T.push(s),T},$u.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var s=c.readVarint()+c.pos,h=1,p=0,_=0,k=0,S=1/0,T=-1/0,A=1/0,B=-1/0;c.pos<s;){if(p<=0){var z=c.readVarint();h=7&z,p=z>>3}if(p--,h===1||h===2)(_+=c.readSVarint())<S&&(S=_),_>T&&(T=_),(k+=c.readSVarint())<A&&(A=k),k>B&&(B=k);else if(h!==7)throw new Error("unknown command "+h)}return[S,A,T,B]},$u.prototype.toGeoJSON=function(c,s,h){var p,_,k=this.extent*Math.pow(2,h),S=this.extent*c,T=this.extent*s,A=this.loadGeometry(),B=$u.types[this.type];function z(q){for(var Y=0;Y<q.length;Y++){var K=q[Y];q[Y]=[360*(K.x+S)/k-180,360/Math.PI*Math.atan(Math.exp((180-360*(K.y+T)/k)*Math.PI/180))-90]}}switch(this.type){case 1:var R=[];for(p=0;p<A.length;p++)R[p]=A[p][0];z(A=R);break;case 2:for(p=0;p<A.length;p++)z(A[p]);break;case 3:for(A=function(q){var Y=q.length;if(Y<=1)return[q];for(var K,re,ae=[],be=0;be<Y;be++){var pe=FW(q[be]);pe!==0&&(re===void 0&&(re=pe<0),re===pe<0?(K&&ae.push(K),K=[q[be]]):K.push(q[be]))}return K&&ae.push(K),ae}(A),p=0;p<A.length;p++)for(_=0;_<A[p].length;_++)z(A[p][_])}A.length===1?A=A[0]:B="Multi"+B;var j={type:"Feature",geometry:{type:B,coordinates:A},properties:this.properties};return"id"in this&&(j.id=this.id),j};var $W=yE,_E=bE;function bE(c,s){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=c,this._keys=[],this._values=[],this._features=[],c.readFields(jW,this,s),this.length=this._features.length}function jW(c,s,h){c===15?s.version=h.readVarint():c===1?s.name=h.readString():c===5?s.extent=h.readVarint():c===2?s._features.push(h.pos):c===3?s._keys.push(h.readString()):c===4&&s._values.push(function(p){for(var _=null,k=p.readVarint()+p.pos;p.pos<k;){var S=p.readVarint()>>3;_=S===1?p.readString():S===2?p.readFloat():S===3?p.readDouble():S===4?p.readVarint64():S===5?p.readVarint():S===6?p.readSVarint():S===7?p.readBoolean():null}return _}(h))}bE.prototype.feature=function(c){if(c<0||c>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];var s=this._pbf.readVarint()+this._pbf.pos;return new $W(this._pbf,s,this.extent,this._keys,this._values)};var UW=_E;function HW(c,s,h){if(c===3){var p=new UW(h,h.readVarint()+h.pos);p.length&&(s[p.name]=p)}}il.VectorTile=function(c,s){this.layers=c.readFields(HW,{},s)},il.VectorTileFeature=yE,il.VectorTileLayer=_E;const qW=il.VectorTileFeature.types,Z_=Math.pow(2,13);function Wd(c,s,h,p,_,k,S,T){c.emplaceBack(s,h,2*Math.floor(p*Z_)+S,_*Z_*2,k*Z_*2,Math.round(T))}class Y_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.layoutVertexArray=new Ka,this.centroidVertexArray=new zi,this.indexArray=new ro,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.features=[],this.hasPattern=q_("fill-extrusion",this.layers,h);for(const{feature:_,id:k,index:S,sourceLayerIndex:T}of s){const A=this.layers[0]._featureFilter.needGeometry,B=sc(_,A);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),B,p))continue;const z={id:k,sourceLayerIndex:T,index:S,geometry:A?B.geometry:oc(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(W_("fill-extrusion",this.layers,z,this.zoom,h)):this.addFeature(z,z.geometry,S,p,{}),h.featureIndex.insert(_,z.geometry,S,T,this.index,!0)}}addFeatures(s,h,p){for(const _ of this.features){const{geometry:k}=_;this.addFeature(_,k,_.index,h,p)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,LW),this.centroidVertexBuffer=s.createVertexBuffer(this.centroidVertexArray,NW.members,!0),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(s,h,p,_,k){for(const S of uu(h,500)){const T={x:0,y:0,vertexCount:0};let A=0;for(const Y of S)A+=Y.length;let B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of S){if(Y.length===0||GW(Y))continue;let K=0;for(let re=0;re<Y.length;re++){const ae=Y[re];if(re>=1){const be=Y[re-1];if(!WW(ae,be)){B.vertexLength+4>tn.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const pe=ae.sub(be)._perp()._unit(),ye=be.dist(ae);K+ye>32768&&(K=0),Wd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,0,K),Wd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,1,K),T.x+=2*ae.x,T.y+=2*ae.y,T.vertexCount+=2,K+=ye,Wd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,0,K),Wd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,1,K),T.x+=2*be.x,T.y+=2*be.y,T.vertexCount+=2;const Te=B.vertexLength;this.indexArray.emplaceBack(Te,Te+2,Te+1),this.indexArray.emplaceBack(Te+1,Te+2,Te+3),B.vertexLength+=4,B.primitiveLength+=2}}}}if(B.vertexLength+A>tn.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(A,this.layoutVertexArray,this.indexArray)),qW[s.type]!=="Polygon")continue;const z=[],R=[],j=B.vertexLength;for(const Y of S)if(Y.length!==0){Y!==S[0]&&R.push(z.length/2);for(let K=0;K<Y.length;K++){const re=Y[K];Wd(this.layoutVertexArray,re.x,re.y,0,0,1,1,0),T.x+=re.x,T.y+=re.y,T.vertexCount+=1,z.push(re.x),z.push(re.y)}}const q=uE(z,R);for(let Y=0;Y<q.length;Y+=3)this.indexArray.emplaceBack(j+q[Y],j+q[Y+2],j+q[Y+1]);B.primitiveLength+=q.length/3,B.vertexLength+=A;for(let Y=0;Y<T.vertexCount;Y++){const K=Math.floor(T.x/T.vertexCount),re=Math.floor(T.y/T.vertexCount);this.centroidVertexArray.emplaceBack(K,re)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}}function WW(c,s){return c.x===s.x&&(c.x<0||c.x>ai)||c.y===s.y&&(c.y<0||c.y>ai)}function GW(c){return c.every(s=>s.x<0)||c.every(s=>s.x>ai)||c.every(s=>s.y<0)||c.every(s=>s.y>ai)}let xE;ut("FillExtrusionBucket",Y_,{omit:["layers","features"]});var ZW={get paint(){return xE=xE||new v({"fill-extrusion-opacity":new ft(we["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Et(we["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ft(we["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ft(we["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Iu(we["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Et(we["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Et(we["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ft(we["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class YW extends d{constructor(s){super(s,ZW)}createBucket(s){return new Y_(s)}queryRadius(){return Nm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(s,h,p,_,k,S,T,A){const B=Lm(s,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),S.angle,T),z=this.paint.get("fill-extrusion-height").evaluate(h,p),R=this.paint.get("fill-extrusion-base").evaluate(h,p),j=function(Y,K,re,ae){const be=[];for(const pe of Y){const ye=[pe.x,pe.y,0,1];Rm(ye,ye,K),be.push(new E(ye[0]/ye[3],ye[1]/ye[3]))}return be}(B,A),q=function(Y,K,re,ae){const be=[],pe=[],ye=ae[8]*K,Te=ae[9]*K,Re=ae[10]*K,ot=ae[11]*K,St=ae[8]*re,nt=ae[9]*re,Qe=ae[10]*re,yt=ae[11]*re;for(const dt of Y){const lt=[],De=[];for(const bt of dt){const gt=bt.x,Ot=bt.y,Dn=ae[0]*gt+ae[4]*Ot+ae[12],An=ae[1]*gt+ae[5]*Ot+ae[13],yi=ae[2]*gt+ae[6]*Ot+ae[14],Do=ae[3]*gt+ae[7]*Ot+ae[15],Ri=yi+Re,_i=Do+ot,sr=Dn+St,ar=An+nt,lr=yi+Qe,ei=Do+yt,bi=new E((Dn+ye)/_i,(An+Te)/_i);bi.z=Ri/_i,lt.push(bi);const Yi=new E(sr/ei,ar/ei);Yi.z=lr/ei,De.push(Yi)}be.push(lt),pe.push(De)}return[be,pe]}(_,R,z,A);return function(Y,K,re){let ae=1/0;JS(re,K)&&(ae=vE(re,K[0]));for(let be=0;be<K.length;be++){const pe=K[be],ye=Y[be];for(let Te=0;Te<pe.length-1;Te++){const Re=pe[Te],ot=[Re,pe[Te+1],ye[Te+1],ye[Te],Re];KS(re,ot)&&(ae=Math.min(ae,vE(re,ot)))}}return ae!==1/0&&ae}(q[0],q[1],j)}}function Gd(c,s){return c.x*s.x+c.y*s.y}function vE(c,s){if(c.length===1){let h=0;const p=s[h++];let _;for(;!_||p.equals(_);)if(_=s[h++],!_)return 1/0;for(;h<s.length;h++){const k=s[h],S=c[0],T=_.sub(p),A=k.sub(p),B=S.sub(p),z=Gd(T,T),R=Gd(T,A),j=Gd(A,A),q=Gd(B,T),Y=Gd(B,A),K=z*j-R*R,re=(j*q-R*Y)/K,ae=(z*Y-R*q)/K,be=p.z*(1-re-ae)+_.z*re+k.z*ae;if(isFinite(be))return be}return 1/0}{let h=1/0;for(const p of s)h=Math.min(h,p.z);return h}}const XW=M([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:KW}=XW,JW=M([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:QW}=JW,eG=il.VectorTileFeature.types,tG=Math.cos(Math.PI/180*37.5),wE=Math.pow(2,14)/.5;class X_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new Du,this.layoutVertexArray2=new Ja,this.indexArray=new ro,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.hasPattern=q_("line",this.layers,h);const _=this.layers[0].layout.get("line-sort-key"),k=!_.isConstant(),S=[];for(const{feature:T,id:A,index:B,sourceLayerIndex:z}of s){const R=this.layers[0]._featureFilter.needGeometry,j=sc(T,R);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),j,p))continue;const q=k?_.evaluate(j,{},p):void 0,Y={id:A,properties:T.properties,type:T.type,sourceLayerIndex:z,index:B,geometry:R?j.geometry:oc(T),patterns:{},sortKey:q};S.push(Y)}k&&S.sort((T,A)=>T.sortKey-A.sortKey);for(const T of S){const{geometry:A,index:B,sourceLayerIndex:z}=T;if(this.hasPattern){const R=W_("line",this.layers,T,this.zoom,h);this.patternFeatures.push(R)}else this.addFeature(T,A,B,p,{});h.featureIndex.insert(s[B].feature,A,B,z,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}addFeatures(s,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=s.createVertexBuffer(this.layoutVertexArray2,QW)),this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,KW),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(s){if(s.properties&&Object.prototype.hasOwnProperty.call(s.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(s.properties,"mapbox_clip_end"))return{start:+s.properties.mapbox_clip_start,end:+s.properties.mapbox_clip_end}}addFeature(s,h,p,_,k){const S=this.layers[0].layout,T=S.get("line-join").evaluate(s,{}),A=S.get("line-cap"),B=S.get("line-miter-limit"),z=S.get("line-round-limit");this.lineClips=this.lineFeatureClips(s);for(const R of h)this.addLine(R,s,T,A,B,z);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}addLine(s,h,p,_,k,S){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ae=0;ae<s.length-1;ae++)this.totalDistance+=s[ae].dist(s[ae+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const T=eG[h.type]==="Polygon";let A=s.length;for(;A>=2&&s[A-1].equals(s[A-2]);)A--;let B=0;for(;B<A-1&&s[B].equals(s[B+1]);)B++;if(A<(T?3:2))return;p==="bevel"&&(k=1.05);const z=this.overscaling<=16?15*ai/(512*this.overscaling):0,R=this.segments.prepareSegment(10*A,this.layoutVertexArray,this.indexArray);let j,q,Y,K,re;this.e1=this.e2=-1,T&&(j=s[A-2],re=s[B].sub(j)._unit()._perp());for(let ae=B;ae<A;ae++){if(Y=ae===A-1?T?s[B+1]:void 0:s[ae+1],Y&&s[ae].equals(Y))continue;re&&(K=re),j&&(q=j),j=s[ae],re=Y?Y.sub(j)._unit()._perp():K,K=K||re;let be=K.add(re);be.x===0&&be.y===0||be._unit();const pe=K.x*re.x+K.y*re.y,ye=be.x*re.x+be.y*re.y,Te=ye!==0?1/ye:1/0,Re=2*Math.sqrt(2-2*ye),ot=ye<tG&&q&&Y,St=K.x*re.y-K.y*re.x>0;if(ot&&ae>B){const yt=j.dist(q);if(yt>2*z){const dt=j.sub(j.sub(q)._mult(z/yt)._round());this.updateDistance(q,dt),this.addCurrentVertex(dt,K,0,0,R),q=dt}}const nt=q&&Y;let Qe=nt?p:T?"butt":_;if(nt&&Qe==="round"&&(Te<S?Qe="miter":Te<=2&&(Qe="fakeround")),Qe==="miter"&&Te>k&&(Qe="bevel"),Qe==="bevel"&&(Te>2&&(Qe="flipbevel"),Te<k&&(Qe="miter")),q&&this.updateDistance(q,j),Qe==="miter")be._mult(Te),this.addCurrentVertex(j,be,0,0,R);else if(Qe==="flipbevel"){if(Te>100)be=re.mult(-1);else{const yt=Te*K.add(re).mag()/K.sub(re).mag();be._perp()._mult(yt*(St?-1:1))}this.addCurrentVertex(j,be,0,0,R),this.addCurrentVertex(j,be.mult(-1),0,0,R)}else if(Qe==="bevel"||Qe==="fakeround"){const yt=-Math.sqrt(Te*Te-1),dt=St?yt:0,lt=St?0:yt;if(q&&this.addCurrentVertex(j,K,dt,lt,R),Qe==="fakeround"){const De=Math.round(180*Re/Math.PI/20);for(let bt=1;bt<De;bt++){let gt=bt/De;if(gt!==.5){const Dn=gt-.5;gt+=gt*Dn*(gt-1)*((1.0904+pe*(pe*(3.55645-1.43519*pe)-3.2452))*Dn*Dn+(.848013+pe*(.215638*pe-1.06021)))}const Ot=re.sub(K)._mult(gt)._add(K)._unit()._mult(St?-1:1);this.addHalfVertex(j,Ot.x,Ot.y,!1,St,0,R)}}Y&&this.addCurrentVertex(j,re,-dt,-lt,R)}else if(Qe==="butt")this.addCurrentVertex(j,be,0,0,R);else if(Qe==="square"){const yt=q?1:-1;this.addCurrentVertex(j,be,yt,yt,R)}else Qe==="round"&&(q&&(this.addCurrentVertex(j,K,0,0,R),this.addCurrentVertex(j,K,1,1,R,!0)),Y&&(this.addCurrentVertex(j,re,-1,-1,R,!0),this.addCurrentVertex(j,re,0,0,R)));if(ot&&ae<A-1){const yt=j.dist(Y);if(yt>2*z){const dt=j.add(Y.sub(j)._mult(z/yt)._round());this.updateDistance(j,dt),this.addCurrentVertex(dt,re,0,0,R),j=dt}}}}addCurrentVertex(s,h,p,_,k,S=!1){const T=h.y*_-h.x,A=-h.y-h.x*_;this.addHalfVertex(s,h.x+h.y*p,h.y-h.x*p,S,!1,p,k),this.addHalfVertex(s,T,A,S,!0,-_,k),this.distance>wE/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(s,h,p,_,k,S))}addHalfVertex({x:s,y:h},p,_,k,S,T,A){const B=.5*(this.lineClips?this.scaledDistance*(wE-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((s<<1)+(k?1:0),(h<<1)+(S?1:0),Math.round(63*p)+128,Math.round(63*_)+128,1+(T===0?0:T<0?-1:1)|(63&B)<<2,B>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const z=A.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,z),A.primitiveLength++),S?this.e2=z:this.e1=z}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(s,h){this.distance+=s.dist(h),this.updateScaledDistance()}}let kE,SE;ut("LineBucket",X_,{omit:["layers","patternFeatures"]});var EE={get paint(){return SE=SE||new v({"line-opacity":new Et(we.paint_line["line-opacity"]),"line-color":new Et(we.paint_line["line-color"]),"line-translate":new ft(we.paint_line["line-translate"]),"line-translate-anchor":new ft(we.paint_line["line-translate-anchor"]),"line-width":new Et(we.paint_line["line-width"]),"line-gap-width":new Et(we.paint_line["line-gap-width"]),"line-offset":new Et(we.paint_line["line-offset"]),"line-blur":new Et(we.paint_line["line-blur"]),"line-dasharray":new Pu(we.paint_line["line-dasharray"]),"line-pattern":new Iu(we.paint_line["line-pattern"]),"line-gradient":new Ld(we.paint_line["line-gradient"])})},get layout(){return kE=kE||new v({"line-cap":new ft(we.layout_line["line-cap"]),"line-join":new Et(we.layout_line["line-join"]),"line-miter-limit":new ft(we.layout_line["line-miter-limit"]),"line-round-limit":new ft(we.layout_line["line-round-limit"]),"line-sort-key":new Et(we.layout_line["line-sort-key"])})}};class nG extends Et{possiblyEvaluate(s,h){return h=new Vn(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(s,h)}evaluate(s,h,p,_){return h=Se({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(s,h,p,_)}}let jm;class iG extends d{constructor(s){super(s,EE),this.gradientVersion=0,jm||(jm=new nG(EE.paint.properties["line-width"].specification),jm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(s){if(s==="line-gradient"){const h=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof Da,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(s,h){super.recalculate(s,h),this.paint._values["line-floorwidth"]=jm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,s)}createBucket(s){return new X_(s)}queryRadius(s){const h=s,p=CE(Fd("line-width",this,h),Fd("line-gap-width",this,h)),_=Fd("line-offset",this,h);return p/2+Math.abs(_)+Nm(this.paint.get("line-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T){const A=Lm(s,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),S.angle,T),B=T/2*CE(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),z=this.paint.get("line-offset").evaluate(h,p);return z&&(_=function(R,j){const q=[];for(let Y=0;Y<R.length;Y++){const K=R[Y],re=[];for(let ae=0;ae<K.length;ae++){const be=K[ae-1],pe=K[ae],ye=K[ae+1],Te=ae===0?new E(0,0):pe.sub(be)._unit()._perp(),Re=ae===K.length-1?new E(0,0):ye.sub(pe)._unit()._perp(),ot=Te._add(Re)._unit(),St=ot.x*Re.x+ot.y*Re.y;St!==0&&ot._mult(1/St),re.push(ot._mult(j)._add(pe))}q.push(re)}return q}(_,z*T)),function(R,j,q){for(let Y=0;Y<j.length;Y++){const K=j[Y];if(R.length>=3){for(let re=0;re<K.length;re++)if(Ru(R,K[re]))return!0}if(dW(R,K,q))return!0}return!1}(A,_,B)}isTileClipped(){return!0}}function CE(c,s){return s>0?s+2*c:c}const rG=M([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),oG=M([{name:"a_projected_pos",components:3,type:"Float32"}],4);M([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const sG=M([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);M([{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 TE=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),aG=M([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function lG(c,s,h){return c.sections.forEach(p=>{p.text=function(_,k,S){const T=k.layout.get("text-transform").evaluate(S,{});return T==="uppercase"?_=_.toLocaleUpperCase():T==="lowercase"&&(_=_.toLocaleLowerCase()),br.applyArabicShaping&&(_=br.applyArabicShaping(_)),_}(p.text,s,h)}),c}M([{name:"triangle",components:3,type:"Uint16"}]),M([{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"}]),M([{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"}]),M([{type:"Float32",name:"offsetX"}]),M([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),M([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Zd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var hi=24,ME=Mn,AE=function(c,s,h,p,_){var k,S,T=8*_-p-1,A=(1<<T)-1,B=A>>1,z=-7,R=_-1,j=-1,q=c[s+R];for(R+=j,k=q&(1<<-z)-1,q>>=-z,z+=T;z>0;k=256*k+c[s+R],R+=j,z-=8);for(S=k&(1<<-z)-1,k>>=-z,z+=p;z>0;S=256*S+c[s+R],R+=j,z-=8);if(k===0)k=1-B;else{if(k===A)return S?NaN:1/0*(q?-1:1);S+=Math.pow(2,p),k-=B}return(q?-1:1)*S*Math.pow(2,k-p)},IE=function(c,s,h,p,_,k){var S,T,A,B=8*k-_-1,z=(1<<B)-1,R=z>>1,j=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,q=0,Y=1,K=s<0||s===0&&1/s<0?1:0;for(s=Math.abs(s),isNaN(s)||s===1/0?(T=isNaN(s)?1:0,S=z):(S=Math.floor(Math.log(s)/Math.LN2),s*(A=Math.pow(2,-S))<1&&(S--,A*=2),(s+=S+R>=1?j/A:j*Math.pow(2,1-R))*A>=2&&(S++,A/=2),S+R>=z?(T=0,S=z):S+R>=1?(T=(s*A-1)*Math.pow(2,_),S+=R):(T=s*Math.pow(2,R-1)*Math.pow(2,_),S=0));_>=8;c[h+q]=255&T,q+=Y,T/=256,_-=8);for(S=S<<_|T,B+=_;B>0;c[h+q]=255&S,q+=Y,S/=256,B-=8);c[h+q-Y]|=128*K};function Mn(c){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(c)?c:new Uint8Array(c||0),this.pos=0,this.type=0,this.length=this.buf.length}Mn.Varint=0,Mn.Fixed64=1,Mn.Bytes=2,Mn.Fixed32=5;var K_=4294967296,PE=1/K_,DE=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ea(c){return c.type===Mn.Bytes?c.readVarint()+c.pos:c.pos+1}function ju(c,s,h){return h?4294967296*s+(c>>>0):4294967296*(s>>>0)+(c>>>0)}function OE(c,s,h){var p=s<=16383?1:s<=2097151?2:s<=268435455?3:Math.floor(Math.log(s)/(7*Math.LN2));h.realloc(p);for(var _=h.pos-1;_>=c;_--)h.buf[_+p]=h.buf[_]}function cG(c,s){for(var h=0;h<c.length;h++)s.writeVarint(c[h])}function uG(c,s){for(var h=0;h<c.length;h++)s.writeSVarint(c[h])}function hG(c,s){for(var h=0;h<c.length;h++)s.writeFloat(c[h])}function dG(c,s){for(var h=0;h<c.length;h++)s.writeDouble(c[h])}function pG(c,s){for(var h=0;h<c.length;h++)s.writeBoolean(c[h])}function fG(c,s){for(var h=0;h<c.length;h++)s.writeFixed32(c[h])}function mG(c,s){for(var h=0;h<c.length;h++)s.writeSFixed32(c[h])}function gG(c,s){for(var h=0;h<c.length;h++)s.writeFixed64(c[h])}function yG(c,s){for(var h=0;h<c.length;h++)s.writeSFixed64(c[h])}function Um(c,s){return(c[s]|c[s+1]<<8|c[s+2]<<16)+16777216*c[s+3]}function Uu(c,s,h){c[h]=s,c[h+1]=s>>>8,c[h+2]=s>>>16,c[h+3]=s>>>24}function BE(c,s){return(c[s]|c[s+1]<<8|c[s+2]<<16)+(c[s+3]<<24)}Mn.prototype={destroy:function(){this.buf=null},readFields:function(c,s,h){for(h=h||this.length;this.pos<h;){var p=this.readVarint(),_=p>>3,k=this.pos;this.type=7&p,c(_,s,this),this.pos===k&&this.skip(p)}return s},readMessage:function(c,s){return this.readFields(c,s,this.readVarint()+this.pos)},readFixed32:function(){var c=Um(this.buf,this.pos);return this.pos+=4,c},readSFixed32:function(){var c=BE(this.buf,this.pos);return this.pos+=4,c},readFixed64:function(){var c=Um(this.buf,this.pos)+Um(this.buf,this.pos+4)*K_;return this.pos+=8,c},readSFixed64:function(){var c=Um(this.buf,this.pos)+BE(this.buf,this.pos+4)*K_;return this.pos+=8,c},readFloat:function(){var c=AE(this.buf,this.pos,!0,23,4);return this.pos+=4,c},readDouble:function(){var c=AE(this.buf,this.pos,!0,52,8);return this.pos+=8,c},readVarint:function(c){var s,h,p=this.buf;return s=127&(h=p[this.pos++]),h<128?s:(s|=(127&(h=p[this.pos++]))<<7,h<128?s:(s|=(127&(h=p[this.pos++]))<<14,h<128?s:(s|=(127&(h=p[this.pos++]))<<21,h<128?s:function(_,k,S){var T,A,B=S.buf;if(T=(112&(A=B[S.pos++]))>>4,A<128||(T|=(127&(A=B[S.pos++]))<<3,A<128)||(T|=(127&(A=B[S.pos++]))<<10,A<128)||(T|=(127&(A=B[S.pos++]))<<17,A<128)||(T|=(127&(A=B[S.pos++]))<<24,A<128)||(T|=(1&(A=B[S.pos++]))<<31,A<128))return ju(_,T,k);throw new Error("Expected varint not more than 10 bytes")}(s|=(15&(h=p[this.pos]))<<28,c,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var c=this.readVarint();return c%2==1?(c+1)/-2:c/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var c=this.readVarint()+this.pos,s=this.pos;return this.pos=c,c-s>=12&&DE?function(h,p,_){return DE.decode(h.subarray(p,_))}(this.buf,s,c):function(h,p,_){for(var k="",S=p;S<_;){var T,A,B,z=h[S],R=null,j=z>239?4:z>223?3:z>191?2:1;if(S+j>_)break;j===1?z<128&&(R=z):j===2?(192&(T=h[S+1]))==128&&(R=(31&z)<<6|63&T)<=127&&(R=null):j===3?(A=h[S+2],(192&(T=h[S+1]))==128&&(192&A)==128&&((R=(15&z)<<12|(63&T)<<6|63&A)<=2047||R>=55296&&R<=57343)&&(R=null)):j===4&&(A=h[S+2],B=h[S+3],(192&(T=h[S+1]))==128&&(192&A)==128&&(192&B)==128&&((R=(15&z)<<18|(63&T)<<12|(63&A)<<6|63&B)<=65535||R>=1114112)&&(R=null)),R===null?(R=65533,j=1):R>65535&&(R-=65536,k+=String.fromCharCode(R>>>10&1023|55296),R=56320|1023&R),k+=String.fromCharCode(R),S+=j}return k}(this.buf,s,c)},readBytes:function(){var c=this.readVarint()+this.pos,s=this.buf.subarray(this.pos,c);return this.pos=c,s},readPackedVarint:function(c,s){if(this.type!==Mn.Bytes)return c.push(this.readVarint(s));var h=ea(this);for(c=c||[];this.pos<h;)c.push(this.readVarint(s));return c},readPackedSVarint:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSVarint());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSVarint());return c},readPackedBoolean:function(c){if(this.type!==Mn.Bytes)return c.push(this.readBoolean());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readBoolean());return c},readPackedFloat:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFloat());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFloat());return c},readPackedDouble:function(c){if(this.type!==Mn.Bytes)return c.push(this.readDouble());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readDouble());return c},readPackedFixed32:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFixed32());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFixed32());return c},readPackedSFixed32:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSFixed32());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSFixed32());return c},readPackedFixed64:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFixed64());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFixed64());return c},readPackedSFixed64:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSFixed64());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSFixed64());return c},skip:function(c){var s=7&c;if(s===Mn.Varint)for(;this.buf[this.pos++]>127;);else if(s===Mn.Bytes)this.pos=this.readVarint()+this.pos;else if(s===Mn.Fixed32)this.pos+=4;else{if(s!==Mn.Fixed64)throw new Error("Unimplemented type: "+s);this.pos+=8}},writeTag:function(c,s){this.writeVarint(c<<3|s)},realloc:function(c){for(var s=this.length||16;s<this.pos+c;)s*=2;if(s!==this.length){var h=new Uint8Array(s);h.set(this.buf),this.buf=h,this.length=s}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(c){this.realloc(4),Uu(this.buf,c,this.pos),this.pos+=4},writeSFixed32:function(c){this.realloc(4),Uu(this.buf,c,this.pos),this.pos+=4},writeFixed64:function(c){this.realloc(8),Uu(this.buf,-1&c,this.pos),Uu(this.buf,Math.floor(c*PE),this.pos+4),this.pos+=8},writeSFixed64:function(c){this.realloc(8),Uu(this.buf,-1&c,this.pos),Uu(this.buf,Math.floor(c*PE),this.pos+4),this.pos+=8},writeVarint:function(c){(c=+c||0)>268435455||c<0?function(s,h){var p,_;if(s>=0?(p=s%4294967296|0,_=s/4294967296|0):(_=~(-s/4294967296),4294967295^(p=~(-s%4294967296))?p=p+1|0:(p=0,_=_+1|0)),s>=18446744073709552e3||s<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(k,S,T){T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,T.buf[T.pos]=127&(k>>>=7)}(p,0,h),function(k,S){var T=(7&k)<<4;S.buf[S.pos++]|=T|((k>>>=3)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k)))))}(_,h)}(c,this):(this.realloc(4),this.buf[this.pos++]=127&c|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=c>>>7&127))))},writeSVarint:function(c){this.writeVarint(c<0?2*-c-1:2*c)},writeBoolean:function(c){this.writeVarint(!!c)},writeString:function(c){c=String(c),this.realloc(4*c.length),this.pos++;var s=this.pos;this.pos=function(p,_,k){for(var S,T,A=0;A<_.length;A++){if((S=_.charCodeAt(A))>55295&&S<57344){if(!T){S>56319||A+1===_.length?(p[k++]=239,p[k++]=191,p[k++]=189):T=S;continue}if(S<56320){p[k++]=239,p[k++]=191,p[k++]=189,T=S;continue}S=T-55296<<10|S-56320|65536,T=null}else T&&(p[k++]=239,p[k++]=191,p[k++]=189,T=null);S<128?p[k++]=S:(S<2048?p[k++]=S>>6|192:(S<65536?p[k++]=S>>12|224:(p[k++]=S>>18|240,p[k++]=S>>12&63|128),p[k++]=S>>6&63|128),p[k++]=63&S|128)}return k}(this.buf,c,this.pos);var h=this.pos-s;h>=128&&OE(s,h,this),this.pos=s-1,this.writeVarint(h),this.pos+=h},writeFloat:function(c){this.realloc(4),IE(this.buf,c,this.pos,!0,23,4),this.pos+=4},writeDouble:function(c){this.realloc(8),IE(this.buf,c,this.pos,!0,52,8),this.pos+=8},writeBytes:function(c){var s=c.length;this.writeVarint(s),this.realloc(s);for(var h=0;h<s;h++)this.buf[this.pos++]=c[h]},writeRawMessage:function(c,s){this.pos++;var h=this.pos;c(s,this);var p=this.pos-h;p>=128&&OE(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(c,s,h){this.writeTag(c,Mn.Bytes),this.writeRawMessage(s,h)},writePackedVarint:function(c,s){s.length&&this.writeMessage(c,cG,s)},writePackedSVarint:function(c,s){s.length&&this.writeMessage(c,uG,s)},writePackedBoolean:function(c,s){s.length&&this.writeMessage(c,pG,s)},writePackedFloat:function(c,s){s.length&&this.writeMessage(c,hG,s)},writePackedDouble:function(c,s){s.length&&this.writeMessage(c,dG,s)},writePackedFixed32:function(c,s){s.length&&this.writeMessage(c,fG,s)},writePackedSFixed32:function(c,s){s.length&&this.writeMessage(c,mG,s)},writePackedFixed64:function(c,s){s.length&&this.writeMessage(c,gG,s)},writePackedSFixed64:function(c,s){s.length&&this.writeMessage(c,yG,s)},writeBytesField:function(c,s){this.writeTag(c,Mn.Bytes),this.writeBytes(s)},writeFixed32Field:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeFixed32(s)},writeSFixed32Field:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeSFixed32(s)},writeFixed64Field:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeFixed64(s)},writeSFixed64Field:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeSFixed64(s)},writeVarintField:function(c,s){this.writeTag(c,Mn.Varint),this.writeVarint(s)},writeSVarintField:function(c,s){this.writeTag(c,Mn.Varint),this.writeSVarint(s)},writeStringField:function(c,s){this.writeTag(c,Mn.Bytes),this.writeString(s)},writeFloatField:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeFloat(s)},writeDoubleField:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeDouble(s)},writeBooleanField:function(c,s){this.writeVarintField(c,!!s)}};var J_=g(ME);const Q_=3;function _G(c,s,h){c===1&&h.readMessage(bG,s)}function bG(c,s,h){if(c===3){const{id:p,bitmap:_,width:k,height:S,left:T,top:A,advance:B}=h.readMessage(xG,{});s.push({id:p,bitmap:new jd({width:k+2*Q_,height:S+2*Q_},_),metrics:{width:k,height:S,left:T,top:A,advance:B}})}}function xG(c,s,h){c===1?s.id=h.readVarint():c===2?s.bitmap=h.readBytes():c===3?s.width=h.readVarint():c===4?s.height=h.readVarint():c===5?s.left=h.readSVarint():c===6?s.top=h.readSVarint():c===7&&(s.advance=h.readVarint())}const zE=Q_;function NE(c){let s=0,h=0;for(const S of c)s+=S.w*S.h,h=Math.max(h,S.w);c.sort((S,T)=>T.h-S.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(s/.95)),h),h:1/0}];let _=0,k=0;for(const S of c)for(let T=p.length-1;T>=0;T--){const A=p[T];if(!(S.w>A.w||S.h>A.h)){if(S.x=A.x,S.y=A.y,k=Math.max(k,S.y+S.h),_=Math.max(_,S.x+S.w),S.w===A.w&&S.h===A.h){const B=p.pop();T<p.length&&(p[T]=B)}else S.h===A.h?(A.x+=S.w,A.w-=S.w):S.w===A.w?(A.y+=S.h,A.h-=S.h):(p.push({x:A.x+S.w,y:A.y,w:A.w-S.w,h:S.h}),A.y+=S.h,A.h-=S.h);break}}return{w:_,h:k,fill:s/(_*k)||0}}const vr=1;class eb{constructor(s,{pixelRatio:h,version:p,stretchX:_,stretchY:k,content:S,textFitWidth:T,textFitHeight:A}){this.paddedRect=s,this.pixelRatio=h,this.stretchX=_,this.stretchY=k,this.content=S,this.version=p,this.textFitWidth=T,this.textFitHeight=A}get tl(){return[this.paddedRect.x+vr,this.paddedRect.y+vr]}get br(){return[this.paddedRect.x+this.paddedRect.w-vr,this.paddedRect.y+this.paddedRect.h-vr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*vr)/this.pixelRatio,(this.paddedRect.h-2*vr)/this.pixelRatio]}}class LE{constructor(s,h){const p={},_={};this.haveRenderCallbacks=[];const k=[];this.addImages(s,p,k),this.addImages(h,_,k);const{w:S,h:T}=NE(k),A=new oo({width:S||1,height:T||1});for(const B in s){const z=s[B],R=p[B].paddedRect;oo.copy(z.data,A,{x:0,y:0},{x:R.x+vr,y:R.y+vr},z.data)}for(const B in h){const z=h[B],R=_[B].paddedRect,j=R.x+vr,q=R.y+vr,Y=z.data.width,K=z.data.height;oo.copy(z.data,A,{x:0,y:0},{x:j,y:q},z.data),oo.copy(z.data,A,{x:0,y:K-1},{x:j,y:q-1},{width:Y,height:1}),oo.copy(z.data,A,{x:0,y:0},{x:j,y:q+K},{width:Y,height:1}),oo.copy(z.data,A,{x:Y-1,y:0},{x:j-1,y:q},{width:1,height:K}),oo.copy(z.data,A,{x:0,y:0},{x:j+Y,y:q},{width:1,height:K})}this.image=A,this.iconPositions=p,this.patternPositions=_}addImages(s,h,p){for(const _ in s){const k=s[_],S={x:0,y:0,w:k.data.width+2*vr,h:k.data.height+2*vr};p.push(S),h[_]=new eb(S,k),k.hasRenderCallback&&this.haveRenderCallbacks.push(_)}}patchUpdatedImages(s,h){s.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const p in s.updatedImages)this.patchUpdatedImage(this.iconPositions[p],s.getImage(p),h),this.patchUpdatedImage(this.patternPositions[p],s.getImage(p),h)}patchUpdatedImage(s,h,p){if(!s||!h||s.version===h.version)return;s.version=h.version;const[_,k]=s.tl;p.update(h.data,void 0,{x:_,y:k})}}var rl;ut("ImagePosition",eb),ut("ImageAtlas",LE),u.ah=void 0,(rl=u.ah||(u.ah={}))[rl.none=0]="none",rl[rl.horizontal=1]="horizontal",rl[rl.vertical=2]="vertical",rl[rl.horizontalOnly=3]="horizontalOnly";const Yd=-17;class Xd{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(s,h){const p=new Xd;return p.scale=s||1,p.fontStack=h,p}static forImage(s){const h=new Xd;return h.imageName=s,h}}class Hu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(s,h){const p=new Hu;for(let _=0;_<s.sections.length;_++){const k=s.sections[_];k.image?p.addImageSection(k):p.addTextSection(k,h)}return p}length(){return this.text.length}getSection(s){return this.sections[this.sectionIndex[s]]}getSectionIndex(s){return this.sectionIndex[s]}getCharCode(s){return this.text.charCodeAt(s)}verticalizePunctuation(){this.text=function(s){let h="";for(let p=0;p<s.length;p++){const _=s.charCodeAt(p+1)||null,k=s.charCodeAt(p-1)||null;h+=_&&Am(_)&&!Zd[s[p+1]]||k&&Am(k)&&!Zd[s[p-1]]||!Zd[s[p]]?s[p]:Zd[s[p]]}return h}(this.text)}trim(){let s=0;for(let p=0;p<this.text.length&&qm[this.text.charCodeAt(p)];p++)s++;let h=this.text.length;for(let p=this.text.length-1;p>=0&&p>=s&&qm[this.text.charCodeAt(p)];p--)h--;this.text=this.text.substring(s,h),this.sectionIndex=this.sectionIndex.slice(s,h)}substring(s,h){const p=new Hu;return p.text=this.text.substring(s,h),p.sectionIndex=this.sectionIndex.slice(s,h),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((s,h)=>Math.max(s,this.sections[h].scale),0)}addTextSection(s,h){this.text+=s.text,this.sections.push(Xd.forText(s.scale,s.fontStack||h));const p=this.sections.length-1;for(let _=0;_<s.text.length;++_)this.sectionIndex.push(p)}addImageSection(s){const h=s.image?s.image.name:"";if(h.length===0)return void st("Can't add FormattedSection with an empty image.");const p=this.getNextImageSectionCharCode();p?(this.text+=String.fromCharCode(p),this.sections.push(Xd.forImage(h)),this.sectionIndex.push(this.sections.length-1)):st("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Hm(c,s,h,p,_,k,S,T,A,B,z,R,j,q,Y){const K=Hu.fromFeature(c,_);let re;R===u.ah.vertical&&K.verticalizePunctuation();const{processBidirectionalText:ae,processStyledBidirectionalText:be}=br;if(ae&&K.sections.length===1){re=[];const Te=ae(K.toString(),tb(K,B,k,s,p,q));for(const Re of Te){const ot=new Hu;ot.text=Re,ot.sections=K.sections;for(let St=0;St<Re.length;St++)ot.sectionIndex.push(0);re.push(ot)}}else if(be){re=[];const Te=be(K.text,K.sectionIndex,tb(K,B,k,s,p,q));for(const Re of Te){const ot=new Hu;ot.text=Re[0],ot.sectionIndex=Re[1],ot.sections=K.sections,re.push(ot)}}else re=function(Te,Re){const ot=[],St=Te.text;let nt=0;for(const Qe of Re)ot.push(Te.substring(nt,Qe)),nt=Qe;return nt<St.length&&ot.push(Te.substring(nt,St.length)),ot}(K,tb(K,B,k,s,p,q));const pe=[],ye={positionedLines:pe,text:K.toString(),top:z[1],bottom:z[1],left:z[0],right:z[0],writingMode:R,iconsInText:!1,verticalizable:!1};return function(Te,Re,ot,St,nt,Qe,yt,dt,lt,De,bt,gt){let Ot=0,Dn=Yd,An=0,yi=0;const Do=dt==="right"?1:dt==="left"?0:.5;let Ri=0;for(const ei of nt){ei.trim();const bi=ei.getMaxScale(),Yi=(bi-1)*hi,Vi={positionedGlyphs:[],lineOffset:0};Te.positionedLines[Ri]=Vi;const cr=Vi.positionedGlyphs;let Fi=0;if(!ei.length()){Dn+=Qe,++Ri;continue}for(let wr=0;wr<ei.length();wr++){const hn=ei.getSection(wr),Bn=ei.getSectionIndex(wr),Un=ei.getCharCode(wr);let Ur=0,Yn=null,Zu=null,ys=null,_s=hi;const Oo=!(lt===u.ah.horizontal||!bt&&!zd(Un)||bt&&(qm[Un]||(_i=Un,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(_i)))));if(hn.imageName){const lo=St[hn.imageName];if(!lo)continue;ys=hn.imageName,Te.iconsInText=Te.iconsInText||!0,Zu=lo.paddedRect;const Ci=lo.displaySize;hn.scale=hn.scale*hi/gt,Yn={width:Ci[0],height:Ci[1],left:vr,top:-zE,advance:Oo?Ci[1]:Ci[0]},Ur=Yi+(hi-Ci[1]*hn.scale),_s=Yn.advance;const ta=Oo?Ci[0]*hn.scale-hi*bi:Ci[1]*hn.scale-hi*bi;ta>0&&ta>Fi&&(Fi=ta)}else{const lo=ot[hn.fontStack],Ci=lo&&lo[Un];if(Ci&&Ci.rect)Zu=Ci.rect,Yn=Ci.metrics;else{const ta=Re[hn.fontStack],np=ta&&ta[Un];if(!np)continue;Yn=np.metrics}Ur=(bi-hn.scale)*hi}Oo?(Te.verticalizable=!0,cr.push({glyph:Un,imageName:ys,x:Ot,y:Dn+Ur,vertical:Oo,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Bn,metrics:Yn,rect:Zu}),Ot+=_s*hn.scale+De):(cr.push({glyph:Un,imageName:ys,x:Ot,y:Dn+Ur,vertical:Oo,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Bn,metrics:Yn,rect:Zu}),Ot+=Yn.advance*hn.scale+De)}cr.length!==0&&(An=Math.max(Ot-De,An),SG(cr,0,cr.length-1,Do,Fi)),Ot=0;const ao=Qe*bi+Fi;Vi.lineOffset=Math.max(Fi,Yi),Dn+=ao,yi=Math.max(ao,yi),++Ri}var _i;const sr=Dn-Yd,{horizontalAlign:ar,verticalAlign:lr}=nb(yt);(function(ei,bi,Yi,Vi,cr,Fi,ao,wr,hn){const Bn=(bi-Yi)*cr;let Un=0;Un=Fi!==ao?-wr*Vi-Yd:(-Vi*hn+.5)*ao;for(const Ur of ei)for(const Yn of Ur.positionedGlyphs)Yn.x+=Bn,Yn.y+=Un})(Te.positionedLines,Do,ar,lr,An,yi,Qe,sr,nt.length),Te.top+=-lr*sr,Te.bottom=Te.top+sr,Te.left+=-ar*An,Te.right=Te.left+An}(ye,s,h,p,re,S,T,A,R,B,j,Y),!function(Te){for(const Re of Te)if(Re.positionedGlyphs.length!==0)return!1;return!0}(pe)&&ye}const qm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},vG={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},wG={40:!0};function RE(c,s,h,p,_,k){if(s.imageName){const S=p[s.imageName];return S?S.displaySize[0]*s.scale*hi/k+_:0}{const S=h[s.fontStack],T=S&&S[c];return T?T.metrics.advance*s.scale+_:0}}function VE(c,s,h,p){const _=Math.pow(c-s,2);return p?c<s?_/2:2*_:_+Math.abs(h)*h}function kG(c,s,h){let p=0;return c===10&&(p-=1e4),h&&(p+=150),c!==40&&c!==65288||(p+=50),s!==41&&s!==65289||(p+=50),p}function FE(c,s,h,p,_,k){let S=null,T=VE(s,h,_,k);for(const A of p){const B=VE(s-A.x,h,_,k)+A.badness;B<=T&&(S=A,T=B)}return{index:c,x:s,priorBreak:S,badness:T}}function $E(c){return c?$E(c.priorBreak).concat(c.index):[]}function tb(c,s,h,p,_,k){if(!c)return[];const S=[],T=function(R,j,q,Y,K,re){let ae=0;for(let be=0;be<R.length();be++){const pe=R.getSection(be);ae+=RE(R.getCharCode(be),pe,Y,K,j,re)}return ae/Math.max(1,Math.ceil(ae/q))}(c,s,h,p,_,k),A=c.text.indexOf("​")>=0;let B=0;for(let R=0;R<c.length();R++){const j=c.getSection(R),q=c.getCharCode(R);if(qm[q]||(B+=RE(q,j,p,_,s,k)),R<c.length()-1){const Y=!((z=q)<11904)&&(!!en["CJK Compatibility Forms"](z)||!!en["CJK Compatibility"](z)||!!en["CJK Strokes"](z)||!!en["CJK Symbols and Punctuation"](z)||!!en["Enclosed CJK Letters and Months"](z)||!!en["Halfwidth and Fullwidth Forms"](z)||!!en["Ideographic Description Characters"](z)||!!en["Vertical Forms"](z)||Mm.test(String.fromCodePoint(z)));(vG[q]||Y||j.imageName||R!==c.length()-2&&wG[c.getCharCode(R+1)])&&S.push(FE(R+1,B,T,S,kG(q,c.getCharCode(R+1),Y&&A),!1))}}var z;return $E(FE(c.length(),B,T,S,0,!0))}function nb(c){let s=.5,h=.5;switch(c){case"right":case"top-right":case"bottom-right":s=1;break;case"left":case"top-left":case"bottom-left":s=0}switch(c){case"bottom":case"bottom-right":case"bottom-left":h=1;break;case"top":case"top-right":case"top-left":h=0}return{horizontalAlign:s,verticalAlign:h}}function SG(c,s,h,p,_){if(!p&&!_)return;const k=c[h],S=(c[h].x+k.metrics.advance*k.scale)*p;for(let T=s;T<=h;T++)c[T].x-=S,c[T].y+=_}function EG(c,s,h){const{horizontalAlign:p,verticalAlign:_}=nb(h),k=s[0]-c.displaySize[0]*p,S=s[1]-c.displaySize[1]*_;return{image:c,top:S,bottom:S+c.displaySize[1],left:k,right:k+c.displaySize[0]}}function jE(c){var s,h;let p=c.left,_=c.top,k=c.right-p,S=c.bottom-_;const T=(s=c.image.textFitWidth)!==null&&s!==void 0?s:"stretchOrShrink",A=(h=c.image.textFitHeight)!==null&&h!==void 0?h:"stretchOrShrink",B=(c.image.content[2]-c.image.content[0])/(c.image.content[3]-c.image.content[1]);if(A==="proportional"){if(T==="stretchOnly"&&k/S<B||T==="proportional"){const z=Math.ceil(S*B);p*=z/k,k=z}}else if(T==="proportional"&&A==="stretchOnly"&&B!==0&&k/S>B){const z=Math.ceil(k/B);_*=z/S,S=z}return{x1:p,y1:_,x2:p+k,y2:_+S}}function UE(c,s,h,p,_,k){const S=c.image;let T;if(S.content){const re=S.content,ae=S.pixelRatio||1;T=[re[0]/ae,re[1]/ae,S.displaySize[0]-re[2]/ae,S.displaySize[1]-re[3]/ae]}const A=s.left*k,B=s.right*k;let z,R,j,q;h==="width"||h==="both"?(q=_[0]+A-p[3],R=_[0]+B+p[1]):(q=_[0]+(A+B-S.displaySize[0])/2,R=q+S.displaySize[0]);const Y=s.top*k,K=s.bottom*k;return h==="height"||h==="both"?(z=_[1]+Y-p[0],j=_[1]+K+p[2]):(z=_[1]+(Y+K-S.displaySize[1])/2,j=z+S.displaySize[1]),{image:S,top:z,right:R,bottom:j,left:q,collisionPadding:T}}const Kd=255,gs=128,ol=Kd*gs;function HE(c,s){const{expression:h}=s;if(h.kind==="constant")return{kind:"constant",layoutSize:h.evaluate(new Vn(c+1))};if(h.kind==="source")return{kind:"source"};{const{zoomStops:p,interpolationType:_}=h;let k=0;for(;k<p.length&&p[k]<=c;)k++;k=Math.max(0,k-1);let S=k;for(;S<p.length&&p[S]<c+1;)S++;S=Math.min(p.length-1,S);const T=p[k],A=p[S];return h.kind==="composite"?{kind:"composite",minZoom:T,maxZoom:A,interpolationType:_}:{kind:"camera",minZoom:T,maxZoom:A,minSize:h.evaluate(new Vn(T)),maxSize:h.evaluate(new Vn(A)),interpolationType:_}}}function ib(c,s,h){let p="never";const _=c.get(s);return _?p=_:c.get(h)&&(p="always"),p}const CG=il.VectorTileFeature.types,TG=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Wm(c,s,h,p,_,k,S,T,A,B,z,R,j){const q=T?Math.min(ol,Math.round(T[0])):0,Y=T?Math.min(ol,Math.round(T[1])):0;c.emplaceBack(s,h,Math.round(32*p),Math.round(32*_),k,S,(q<<1)+(A?1:0),Y,16*B,16*z,256*R,256*j)}function rb(c,s,h){c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h)}function MG(c){for(const s of c.sections)if(D_(s.text))return!0;return!1}class ob{constructor(s){this.layoutVertexArray=new Ou,this.indexArray=new ro,this.programConfigurations=s,this.segments=new tn,this.dynamicLayoutVertexArray=new Rd,this.opacityVertexArray=new $r,this.hasVisibleVertices=!1,this.placedSymbolArray=new Fn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(s,h,p,_){this.isEmpty()||(p&&(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,rG.members),this.indexBuffer=s.createIndexBuffer(this.indexArray,h),this.dynamicLayoutVertexBuffer=s.createVertexBuffer(this.dynamicLayoutVertexArray,oG.members,!0),this.opacityVertexBuffer=s.createVertexBuffer(this.opacityVertexArray,TG,!0),this.opacityVertexBuffer.itemSize=1),(p||_)&&this.programConfigurations.upload(s))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}ut("SymbolBuffers",ob);class sb{constructor(s,h,p){this.layoutVertexArray=new s,this.layoutAttributes=h,this.indexArray=new p,this.segments=new tn,this.collisionVertexArray=new fs}upload(s){this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=s.createVertexBuffer(this.collisionVertexArray,sG.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ut("CollisionBuffers",sb);class qu{constructor(s){this.collisionBoxArray=s.collisionBoxArray,this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(S=>S.id),this.index=s.index,this.pixelRatio=s.pixelRatio,this.sourceLayerIndex=s.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=V_([]),this.placementViewportMatrix=V_([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=HE(this.zoom,h["text-size"]),this.iconSizeData=HE(this.zoom,h["icon-size"]);const p=this.layers[0].layout,_=p.get("symbol-sort-key"),k=p.get("symbol-z-order");this.canOverlap=ib(p,"text-overlap","text-allow-overlap")!=="never"||ib(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=k!=="viewport-y"&&!_.isConstant(),this.sortFeaturesByY=(k==="viewport-y"||k==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(S=>u.ah[S])),this.stateDependentLayerIds=this.layers.filter(S=>S.isStateDependent()).map(S=>S.id),this.sourceID=s.sourceID}createArrays(){this.text=new ob(new rc(this.layers,this.zoom,s=>/^text/.test(s))),this.icon=new ob(new rc(this.layers,this.zoom,s=>/^icon/.test(s))),this.glyphOffsetArray=new $n,this.lineVertexArray=new Bi,this.symbolInstances=new Jt,this.textAnchorOffsets=new jn}calculateGlyphDependencies(s,h,p,_,k){for(let S=0;S<s.length;S++)if(h[s.charCodeAt(S)]=!0,(p||_)&&k){const T=Zd[s.charAt(S)];T&&(h[T.charCodeAt(0)]=!0)}}populate(s,h,p){const _=this.layers[0],k=_.layout,S=k.get("text-font"),T=k.get("text-field"),A=k.get("icon-image"),B=(T.value.kind!=="constant"||T.value.value instanceof mr&&!T.value.value.isEmpty()||T.value.value.toString().length>0)&&(S.value.kind!=="constant"||S.value.value.length>0),z=A.value.kind!=="constant"||!!A.value.value||Object.keys(A.parameters).length>0,R=k.get("symbol-sort-key");if(this.features=[],!B&&!z)return;const j=h.iconDependencies,q=h.glyphDependencies,Y=h.availableImages,K=new Vn(this.zoom);for(const{feature:re,id:ae,index:be,sourceLayerIndex:pe}of s){const ye=_._featureFilter.needGeometry,Te=sc(re,ye);if(!_._featureFilter.filter(K,Te,p))continue;let Re,ot;if(ye||(Te.geometry=oc(re)),B){const nt=_.getValueAndResolveTokens("text-field",Te,p,Y),Qe=mr.factory(nt),yt=this.hasRTLText=this.hasRTLText||MG(Qe);(!yt||br.getRTLTextPluginStatus()==="unavailable"||yt&&br.isParsed())&&(Re=lG(Qe,_,Te))}if(z){const nt=_.getValueAndResolveTokens("icon-image",Te,p,Y);ot=nt instanceof yr?nt:yr.fromString(nt)}if(!Re&&!ot)continue;const St=this.sortFeaturesByKey?R.evaluate(Te,{},p):void 0;if(this.features.push({id:ae,text:Re,icon:ot,index:be,sourceLayerIndex:pe,geometry:Te.geometry,properties:re.properties,type:CG[re.type],sortKey:St}),ot&&(j[ot.name]=!0),Re){const nt=S.evaluate(Te,{},p).join(","),Qe=k.get("text-rotation-alignment")!=="viewport"&&k.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(u.ah.vertical)>=0;for(const yt of Re.sections)if(yt.image)j[yt.image.name]=!0;else{const dt=Od(Re.toString()),lt=yt.fontStack||nt,De=q[lt]=q[lt]||{};this.calculateGlyphDependencies(yt.text,De,Qe,this.allowVerticalPlacement,dt)}}}k.get("symbol-placement")==="line"&&(this.features=function(re){const ae={},be={},pe=[];let ye=0;function Te(nt){pe.push(re[nt]),ye++}function Re(nt,Qe,yt){const dt=be[nt];return delete be[nt],be[Qe]=dt,pe[dt].geometry[0].pop(),pe[dt].geometry[0]=pe[dt].geometry[0].concat(yt[0]),dt}function ot(nt,Qe,yt){const dt=ae[Qe];return delete ae[Qe],ae[nt]=dt,pe[dt].geometry[0].shift(),pe[dt].geometry[0]=yt[0].concat(pe[dt].geometry[0]),dt}function St(nt,Qe,yt){const dt=yt?Qe[0][Qe[0].length-1]:Qe[0][0];return`${nt}:${dt.x}:${dt.y}`}for(let nt=0;nt<re.length;nt++){const Qe=re[nt],yt=Qe.geometry,dt=Qe.text?Qe.text.toString():null;if(!dt){Te(nt);continue}const lt=St(dt,yt),De=St(dt,yt,!0);if(lt in be&&De in ae&&be[lt]!==ae[De]){const bt=ot(lt,De,yt),gt=Re(lt,De,pe[bt].geometry);delete ae[lt],delete be[De],be[St(dt,pe[gt].geometry,!0)]=gt,pe[bt].geometry=null}else lt in be?Re(lt,De,yt):De in ae?ot(lt,De,yt):(Te(nt),ae[lt]=ye-1,be[De]=ye-1)}return pe.filter(nt=>nt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((re,ae)=>re.sortKey-ae.sortKey)}update(s,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(s,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(s,h,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(s){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(s),this.iconCollisionBox.upload(s)),this.text.upload(s,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(s,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(s,h){const p=this.lineVertexArray.length;if(s.segment!==void 0){let _=s.dist(h[s.segment+1]),k=s.dist(h[s.segment]);const S={};for(let T=s.segment+1;T<h.length;T++)S[T]={x:h[T].x,y:h[T].y,tileUnitDistanceFromAnchor:_},T<h.length-1&&(_+=h[T+1].dist(h[T]));for(let T=s.segment||0;T>=0;T--)S[T]={x:h[T].x,y:h[T].y,tileUnitDistanceFromAnchor:k},T>0&&(k+=h[T-1].dist(h[T]));for(let T=0;T<h.length;T++){const A=S[T];this.lineVertexArray.emplaceBack(A.x,A.y,A.tileUnitDistanceFromAnchor)}}return{lineStartIndex:p,lineLength:this.lineVertexArray.length-p}}addSymbols(s,h,p,_,k,S,T,A,B,z,R,j){const q=s.indexArray,Y=s.layoutVertexArray,K=s.segments.prepareSegment(4*h.length,Y,q,this.canOverlap?S.sortKey:void 0),re=this.glyphOffsetArray.length,ae=K.vertexLength,be=this.allowVerticalPlacement&&T===u.ah.vertical?Math.PI/2:0,pe=S.text&&S.text.sections;for(let ye=0;ye<h.length;ye++){const{tl:Te,tr:Re,bl:ot,br:St,tex:nt,pixelOffsetTL:Qe,pixelOffsetBR:yt,minFontScaleX:dt,minFontScaleY:lt,glyphOffset:De,isSDF:bt,sectionIndex:gt}=h[ye],Ot=K.vertexLength,Dn=De[1];Wm(Y,A.x,A.y,Te.x,Dn+Te.y,nt.x,nt.y,p,bt,Qe.x,Qe.y,dt,lt),Wm(Y,A.x,A.y,Re.x,Dn+Re.y,nt.x+nt.w,nt.y,p,bt,yt.x,Qe.y,dt,lt),Wm(Y,A.x,A.y,ot.x,Dn+ot.y,nt.x,nt.y+nt.h,p,bt,Qe.x,yt.y,dt,lt),Wm(Y,A.x,A.y,St.x,Dn+St.y,nt.x+nt.w,nt.y+nt.h,p,bt,yt.x,yt.y,dt,lt),rb(s.dynamicLayoutVertexArray,A,be),q.emplaceBack(Ot,Ot+1,Ot+2),q.emplaceBack(Ot+1,Ot+2,Ot+3),K.vertexLength+=4,K.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(De[0]),ye!==h.length-1&&gt===h[ye+1].sectionIndex||s.programConfigurations.populatePaintArrays(Y.length,S,S.index,{},j,pe&&pe[gt])}s.placedSymbolArray.emplaceBack(A.x,A.y,re,this.glyphOffsetArray.length-re,ae,B,z,A.segment,p?p[0]:0,p?p[1]:0,_[0],_[1],T,0,!1,0,R)}_addCollisionDebugVertex(s,h,p,_,k,S){return h.emplaceBack(0,0),s.emplaceBack(p.x,p.y,_,k,Math.round(S.x),Math.round(S.y))}addCollisionDebugVertices(s,h,p,_,k,S,T){const A=k.segments.prepareSegment(4,k.layoutVertexArray,k.indexArray),B=A.vertexLength,z=k.layoutVertexArray,R=k.collisionVertexArray,j=T.anchorX,q=T.anchorY;this._addCollisionDebugVertex(z,R,S,j,q,new E(s,h)),this._addCollisionDebugVertex(z,R,S,j,q,new E(p,h)),this._addCollisionDebugVertex(z,R,S,j,q,new E(p,_)),this._addCollisionDebugVertex(z,R,S,j,q,new E(s,_)),A.vertexLength+=4;const Y=k.indexArray;Y.emplaceBack(B,B+1),Y.emplaceBack(B+1,B+2),Y.emplaceBack(B+2,B+3),Y.emplaceBack(B+3,B),A.primitiveLength+=4}addDebugCollisionBoxes(s,h,p,_){for(let k=s;k<h;k++){const S=this.collisionBoxArray.get(k);this.addCollisionDebugVertices(S.x1,S.y1,S.x2,S.y2,_?this.textCollisionBox:this.iconCollisionBox,S.anchorPoint,p)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new sb(jr,TE.members,Ei),this.iconCollisionBox=new sb(jr,TE.members,Ei);for(let s=0;s<this.symbolInstances.length;s++){const h=this.symbolInstances.get(s);this.addDebugCollisionBoxes(h.textBoxStartIndex,h.textBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.iconBoxStartIndex,h.iconBoxEndIndex,h,!1),this.addDebugCollisionBoxes(h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h,!1)}}_deserializeCollisionBoxesForSymbol(s,h,p,_,k,S,T,A,B){const z={};for(let R=h;R<p;R++){const j=s.get(R);z.textBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.textFeatureIndex=j.featureIndex;break}for(let R=_;R<k;R++){const j=s.get(R);z.verticalTextBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.verticalTextFeatureIndex=j.featureIndex;break}for(let R=S;R<T;R++){const j=s.get(R);z.iconBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.iconFeatureIndex=j.featureIndex;break}for(let R=A;R<B;R++){const j=s.get(R);z.verticalIconBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.verticalIconFeatureIndex=j.featureIndex;break}return z}deserializeCollisionBoxes(s){this.collisionArrays=[];for(let h=0;h<this.symbolInstances.length;h++){const p=this.symbolInstances.get(h);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(s,p.textBoxStartIndex,p.textBoxEndIndex,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p.iconBoxStartIndex,p.iconBoxEndIndex,p.verticalIconBoxStartIndex,p.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(s,h){const p=s.placedSymbolArray.get(h),_=p.vertexStartIndex+4*p.numGlyphs;for(let k=p.vertexStartIndex;k<_;k+=4)s.indexArray.emplaceBack(k,k+1,k+2),s.indexArray.emplaceBack(k+1,k+2,k+3)}getSortedSymbolIndexes(s){if(this.sortedAngle===s&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(s),p=Math.cos(s),_=[],k=[],S=[];for(let T=0;T<this.symbolInstances.length;++T){S.push(T);const A=this.symbolInstances.get(T);_.push(0|Math.round(h*A.anchorX+p*A.anchorY)),k.push(A.featureIndex)}return S.sort((T,A)=>_[T]-_[A]||k[A]-k[T]),S}addToSortKeyRanges(s,h){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===h?p.symbolInstanceEnd=s+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:s,symbolInstanceEnd:s+1})}sortFeatures(s){if(this.sortFeaturesByY&&this.sortedAngle!==s&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(s),this.sortedAngle=s,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const h of this.symbolInstanceIndexes){const p=this.symbolInstances.get(h);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((_,k,S)=>{_>=0&&S.indexOf(_)===k&&this.addIndicesForPlacedSymbol(this.text,_)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let qE,WE;ut("SymbolBucket",qu,{omit:["layers","collisionBoxArray","features","compareText"]}),qu.MAX_GLYPHS=65535,qu.addDynamicAttributes=rb;var ab={get paint(){return WE=WE||new v({"icon-opacity":new Et(we.paint_symbol["icon-opacity"]),"icon-color":new Et(we.paint_symbol["icon-color"]),"icon-halo-color":new Et(we.paint_symbol["icon-halo-color"]),"icon-halo-width":new Et(we.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Et(we.paint_symbol["icon-halo-blur"]),"icon-translate":new ft(we.paint_symbol["icon-translate"]),"icon-translate-anchor":new ft(we.paint_symbol["icon-translate-anchor"]),"text-opacity":new Et(we.paint_symbol["text-opacity"]),"text-color":new Et(we.paint_symbol["text-color"],{runtimeType:vt,getOverride:c=>c.textColor,hasOverride:c=>!!c.textColor}),"text-halo-color":new Et(we.paint_symbol["text-halo-color"]),"text-halo-width":new Et(we.paint_symbol["text-halo-width"]),"text-halo-blur":new Et(we.paint_symbol["text-halo-blur"]),"text-translate":new ft(we.paint_symbol["text-translate"]),"text-translate-anchor":new ft(we.paint_symbol["text-translate-anchor"])})},get layout(){return qE=qE||new v({"symbol-placement":new ft(we.layout_symbol["symbol-placement"]),"symbol-spacing":new ft(we.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ft(we.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Et(we.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ft(we.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ft(we.layout_symbol["icon-allow-overlap"]),"icon-overlap":new ft(we.layout_symbol["icon-overlap"]),"icon-ignore-placement":new ft(we.layout_symbol["icon-ignore-placement"]),"icon-optional":new ft(we.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ft(we.layout_symbol["icon-rotation-alignment"]),"icon-size":new Et(we.layout_symbol["icon-size"]),"icon-text-fit":new ft(we.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ft(we.layout_symbol["icon-text-fit-padding"]),"icon-image":new Et(we.layout_symbol["icon-image"]),"icon-rotate":new Et(we.layout_symbol["icon-rotate"]),"icon-padding":new Et(we.layout_symbol["icon-padding"]),"icon-keep-upright":new ft(we.layout_symbol["icon-keep-upright"]),"icon-offset":new Et(we.layout_symbol["icon-offset"]),"icon-anchor":new Et(we.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ft(we.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ft(we.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ft(we.layout_symbol["text-rotation-alignment"]),"text-field":new Et(we.layout_symbol["text-field"]),"text-font":new Et(we.layout_symbol["text-font"]),"text-size":new Et(we.layout_symbol["text-size"]),"text-max-width":new Et(we.layout_symbol["text-max-width"]),"text-line-height":new ft(we.layout_symbol["text-line-height"]),"text-letter-spacing":new Et(we.layout_symbol["text-letter-spacing"]),"text-justify":new Et(we.layout_symbol["text-justify"]),"text-radial-offset":new Et(we.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ft(we.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Et(we.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Et(we.layout_symbol["text-anchor"]),"text-max-angle":new ft(we.layout_symbol["text-max-angle"]),"text-writing-mode":new ft(we.layout_symbol["text-writing-mode"]),"text-rotate":new Et(we.layout_symbol["text-rotate"]),"text-padding":new ft(we.layout_symbol["text-padding"]),"text-keep-upright":new ft(we.layout_symbol["text-keep-upright"]),"text-transform":new Et(we.layout_symbol["text-transform"]),"text-offset":new Et(we.layout_symbol["text-offset"]),"text-allow-overlap":new ft(we.layout_symbol["text-allow-overlap"]),"text-overlap":new ft(we.layout_symbol["text-overlap"]),"text-ignore-placement":new ft(we.layout_symbol["text-ignore-placement"]),"text-optional":new ft(we.layout_symbol["text-optional"])})}};class GE{constructor(s){if(s.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=s.property.overrides?s.property.overrides.runtimeType:To,this.defaultValue=s}evaluate(s){if(s.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(s.formattedSection))return h.getOverride(s.formattedSection)}return s.feature&&s.featureState?this.defaultValue.evaluate(s.feature,s.featureState):this.defaultValue.property.specification.default}eachChild(s){this.defaultValue.isConstant()||s(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ut("FormatSectionOverride",GE,{omit:["defaultValue"]});class Gm extends d{constructor(s){super(s,ab)}recalculate(s,h){if(super.recalculate(s,h),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 p=this.layout.get("text-writing-mode");if(p){const _=[];for(const k of p)_.indexOf(k)<0&&_.push(k);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(s,h,p,_){const k=this.layout.get(s).evaluate(h,{},p,_),S=this._unevaluatedLayout._values[s];return S.isDataDriven()||_u(S.value)||!k?k:function(T,A){return A.replace(/{([^{}]+)}/g,(B,z)=>T&&z in T?String(T[z]):"")}(h.properties,k)}createBucket(s){return new qu(s)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const s of ab.paint.overridableProperties){if(!Gm.hasPaintOverride(this.layout,s))continue;const h=this.paint.get(s),p=new GE(h),_=new yu(p,h.property.specification);let k=null;k=h.value.kind==="constant"||h.value.kind==="source"?new $a("source",_):new ja("composite",_,h.value.zoomStops),this.paint._values[s]=new Io(h.property,k,h.parameters)}}_handleOverridablePaintPropertyUpdate(s,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&Gm.hasPaintOverride(this.layout,s)}static hasPaintOverride(s,h){const p=s.get("text-field"),_=ab.paint.properties[h];let k=!1;const S=T=>{for(const A of T)if(_.overrides&&_.overrides.hasOverride(A))return void(k=!0)};if(p.value.kind==="constant"&&p.value.value instanceof mr)S(p.value.value.sections);else if(p.value.kind==="source"){const T=B=>{k||(B instanceof Jr&&si(B.value)===Kn?S(B.value.sections):B instanceof lu?S(B.sections):B.eachChild(T))},A=p.value;A._styleExpression&&T(A._styleExpression.expression)}return k}}let ZE;var AG={get paint(){return ZE=ZE||new v({"background-color":new ft(we.paint_background["background-color"]),"background-pattern":new Pu(we.paint_background["background-pattern"]),"background-opacity":new ft(we.paint_background["background-opacity"])})}};class IG extends d{constructor(s){super(s,AG)}}let YE;var PG={get paint(){return YE=YE||new v({"raster-opacity":new ft(we.paint_raster["raster-opacity"]),"raster-hue-rotate":new ft(we.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ft(we.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ft(we.paint_raster["raster-brightness-max"]),"raster-saturation":new ft(we.paint_raster["raster-saturation"]),"raster-contrast":new ft(we.paint_raster["raster-contrast"]),"raster-resampling":new ft(we.paint_raster["raster-resampling"]),"raster-fade-duration":new ft(we.paint_raster["raster-fade-duration"])})}};class DG extends d{constructor(s){super(s,PG)}}class OG extends d{constructor(s){super(s,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=s}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 BG{constructor(s){this._methodToThrottle=s,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 lb=63710088e-1;class sl{constructor(s,h){if(isNaN(s)||isNaN(h))throw new Error(`Invalid LngLat object: (${s}, ${h})`);if(this.lng=+s,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new sl(ve(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(s){const h=Math.PI/180,p=this.lat*h,_=s.lat*h,k=Math.sin(p)*Math.sin(_)+Math.cos(p)*Math.cos(_)*Math.cos((s.lng-this.lng)*h);return lb*Math.acos(Math.min(k,1))}static convert(s){if(s instanceof sl)return s;if(Array.isArray(s)&&(s.length===2||s.length===3))return new sl(Number(s[0]),Number(s[1]));if(!Array.isArray(s)&&typeof s=="object"&&s!==null)return new sl(Number("lng"in s?s.lng:s.lon),Number(s.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 XE=2*Math.PI*lb;function KE(c){return XE*Math.cos(c*Math.PI/180)}function JE(c){return(180+c)/360}function QE(c){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c*Math.PI/360)))/360}function eC(c,s){return c/KE(s)}function cb(c){return 360/Math.PI*Math.atan(Math.exp((180-360*c)*Math.PI/180))-90}class Jd{constructor(s,h,p=0){this.x=+s,this.y=+h,this.z=+p}static fromLngLat(s,h=0){const p=sl.convert(s);return new Jd(JE(p.lng),QE(p.lat),eC(h,p.lat))}toLngLat(){return new sl(360*this.x-180,cb(this.y))}toAltitude(){return this.z*KE(cb(this.y))}meterInMercatorCoordinateUnits(){return 1/XE*(s=cb(this.y),1/Math.cos(s*Math.PI/180));var s}}function tC(c,s,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[c*p-2*Math.PI*6378137/2,s*p-2*Math.PI*6378137/2]}class ub{constructor(s,h,p){if(!function(_,k,S){return!(_<0||_>25||S<0||S>=Math.pow(2,_)||k<0||k>=Math.pow(2,_))}(s,h,p))throw new Error(`x=${h}, y=${p}, z=${s} outside of bounds. 0<=x<${Math.pow(2,s)}, 0<=y<${Math.pow(2,s)} 0<=z<=25 `);this.z=s,this.x=h,this.y=p,this.key=Qd(0,s,s,h,p)}equals(s){return this.z===s.z&&this.x===s.x&&this.y===s.y}url(s,h,p){const _=(S=this.y,T=this.z,A=tC(256*(k=this.x),256*(S=Math.pow(2,T)-S-1),T),B=tC(256*(k+1),256*(S+1),T),A[0]+","+A[1]+","+B[0]+","+B[1]);var k,S,T,A,B;const z=function(R,j,q){let Y,K="";for(let re=R;re>0;re--)Y=1<<re-1,K+=(j&Y?1:0)+(q&Y?2:0);return K}(this.z,this.x,this.y);return s[(this.x+this.y)%s.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(p==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,h>1?"@2x":"").replace(/{quadkey}/g,z).replace(/{bbox-epsg-3857}/g,_)}isChildOf(s){const h=this.z-s.z;return h>0&&s.x===this.x>>h&&s.y===this.y>>h}getTilePoint(s){const h=Math.pow(2,this.z);return new E((s.x*h-this.x)*ai,(s.y*h-this.y)*ai)}toString(){return`${this.z}/${this.x}/${this.y}`}}class nC{constructor(s,h){this.wrap=s,this.canonical=h,this.key=Qd(s,h.z,h.z,h.x,h.y)}}class so{constructor(s,h,p,_,k){if(s<p)throw new Error(`overscaledZ should be >= z; overscaledZ = ${s}; z = ${p}`);this.overscaledZ=s,this.wrap=h,this.canonical=new ub(p,+_,+k),this.key=Qd(h,s,p,_,k)}clone(){return new so(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(s){return this.overscaledZ===s.overscaledZ&&this.wrap===s.wrap&&this.canonical.equals(s.canonical)}scaledTo(s){if(s>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${s}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-s;return s>this.canonical.z?new so(s,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new so(s,this.wrap,s,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(s,h){if(s>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${s}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-s;return s>this.canonical.z?Qd(this.wrap*+h,s,this.canonical.z,this.canonical.x,this.canonical.y):Qd(this.wrap*+h,s,s,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(s){if(s.wrap!==this.wrap)return!1;const h=this.canonical.z-s.canonical.z;return s.overscaledZ===0||s.overscaledZ<this.overscaledZ&&s.canonical.x===this.canonical.x>>h&&s.canonical.y===this.canonical.y>>h}children(s){if(this.overscaledZ>=s)return[new so(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,_=2*this.canonical.y;return[new so(h,this.wrap,h,p,_),new so(h,this.wrap,h,p+1,_),new so(h,this.wrap,h,p,_+1),new so(h,this.wrap,h,p+1,_+1)]}isLessThan(s){return this.wrap<s.wrap||!(this.wrap>s.wrap)&&(this.overscaledZ<s.overscaledZ||!(this.overscaledZ>s.overscaledZ)&&(this.canonical.x<s.canonical.x||!(this.canonical.x>s.canonical.x)&&this.canonical.y<s.canonical.y))}wrapped(){return new so(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(s){return new so(this.overscaledZ,s,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new nC(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(s){return this.canonical.getTilePoint(new Jd(s.x-this.wrap,s.y))}}function Qd(c,s,h,p,_){(c*=2)<0&&(c=-1*c-1);const k=1<<h;return(k*k*c+k*_+p).toString(36)+h.toString(36)+s.toString(36)}ut("CanonicalTileID",ub),ut("OverscaledTileID",so,{omit:["posMatrix"]});class iC{constructor(s,h,p,_=1,k=1,S=1,T=0){if(this.uid=s,h.height!==h.width)throw new RangeError("DEM tiles must be square");if(p&&!["mapbox","terrarium","custom"].includes(p))return void st(`"${p}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=h.height;const A=this.dim=h.height-2;switch(this.data=new Uint32Array(h.data.buffer),p){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=_,this.greenFactor=k,this.blueFactor=S,this.baseShift=T;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let B=0;B<A;B++)this.data[this._idx(-1,B)]=this.data[this._idx(0,B)],this.data[this._idx(A,B)]=this.data[this._idx(A-1,B)],this.data[this._idx(B,-1)]=this.data[this._idx(B,0)],this.data[this._idx(B,A)]=this.data[this._idx(B,A-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(A,-1)]=this.data[this._idx(A-1,0)],this.data[this._idx(-1,A)]=this.data[this._idx(0,A-1)],this.data[this._idx(A,A)]=this.data[this._idx(A-1,A-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let B=0;B<A;B++)for(let z=0;z<A;z++){const R=this.get(B,z);R>this.max&&(this.max=R),R<this.min&&(this.min=R)}}get(s,h){const p=new Uint8Array(this.data.buffer),_=4*this._idx(s,h);return this.unpack(p[_],p[_+1],p[_+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(s,h){if(s<-1||s>=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(s+1)}unpack(s,h,p){return s*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new oo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(s,h,p){if(this.dim!==s.dim)throw new Error("dem dimension mismatch");let _=h*this.dim,k=h*this.dim+this.dim,S=p*this.dim,T=p*this.dim+this.dim;switch(h){case-1:_=k-1;break;case 1:k=_+1}switch(p){case-1:S=T-1;break;case 1:T=S+1}const A=-h*this.dim,B=-p*this.dim;for(let z=S;z<T;z++)for(let R=_;R<k;R++)this.data[this._idx(R,z)]=s.data[this._idx(R+A,z+B)]}}ut("DEMData",iC);class rC{constructor(s){this._stringToNumber={},this._numberToString=[];for(let h=0;h<s.length;h++){const p=s[h];this._stringToNumber[p]=h,this._numberToString[h]=p}}encode(s){return this._stringToNumber[s]}decode(s){if(s>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${s} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[s]}}class oC{constructor(s,h,p,_,k){this.type="Feature",this._vectorTileFeature=s,s._z=h,s._x=p,s._y=_,this.properties=s.properties,this.id=k}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(s){this._geometry=s}toJSON(){const s={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(s[h]=this[h]);return s}}class sC{constructor(s,h){this.tileID=s,this.x=s.canonical.x,this.y=s.canonical.y,this.z=s.canonical.z,this.grid=new Wa(ai,16,0),this.grid3D=new Wa(ai,16,0),this.featureIndexArray=new Gi,this.promoteId=h}insert(s,h,p,_,k,S){const T=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,_,k);const A=S?this.grid3D:this.grid;for(let B=0;B<h.length;B++){const z=h[B],R=[1/0,1/0,-1/0,-1/0];for(let j=0;j<z.length;j++){const q=z[j];R[0]=Math.min(R[0],q.x),R[1]=Math.min(R[1],q.y),R[2]=Math.max(R[2],q.x),R[3]=Math.max(R[3],q.y)}R[0]<ai&&R[1]<ai&&R[2]>=0&&R[3]>=0&&A.insert(T,R[0],R[1],R[2],R[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new il.VectorTile(new J_(this.rawTileData)).layers,this.sourceLayerCoder=new rC(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(s,h,p,_){this.loadVTLayers();const k=s.params||{},S=ai/s.tileSize/s.scale,T=_d(k.filter),A=s.queryGeometry,B=s.queryPadding*S,z=lC(A),R=this.grid.query(z.minX-B,z.minY-B,z.maxX+B,z.maxY+B),j=lC(s.cameraQueryGeometry),q=this.grid3D.query(j.minX-B,j.minY-B,j.maxX+B,j.maxY+B,(re,ae,be,pe)=>function(ye,Te,Re,ot,St){for(const Qe of ye)if(Te<=Qe.x&&Re<=Qe.y&&ot>=Qe.x&&St>=Qe.y)return!0;const nt=[new E(Te,Re),new E(Te,St),new E(ot,St),new E(ot,Re)];if(ye.length>2){for(const Qe of nt)if(Ru(ye,Qe))return!0}for(let Qe=0;Qe<ye.length-1;Qe++)if(fW(ye[Qe],ye[Qe+1],nt))return!0;return!1}(s.cameraQueryGeometry,re-B,ae-B,be+B,pe+B));for(const re of q)R.push(re);R.sort(zG);const Y={};let K;for(let re=0;re<R.length;re++){const ae=R[re];if(ae===K)continue;K=ae;const be=this.featureIndexArray.get(ae);let pe=null;this.loadMatchingFeature(Y,be.bucketIndex,be.sourceLayerIndex,be.featureIndex,T,k.layers,k.availableImages,h,p,_,(ye,Te,Re)=>(pe||(pe=oc(ye)),Te.queryIntersectsFeature(A,ye,Re,pe,this.z,s.transform,S,s.pixelPosMatrix)))}return Y}loadMatchingFeature(s,h,p,_,k,S,T,A,B,z,R){const j=this.bucketLayerIDs[h];if(S&&!function(re,ae){for(let be=0;be<re.length;be++)if(ae.indexOf(re[be])>=0)return!0;return!1}(S,j))return;const q=this.sourceLayerCoder.decode(p),Y=this.vtLayers[q].feature(_);if(k.needGeometry){const re=sc(Y,!0);if(!k.filter(new Vn(this.tileID.overscaledZ),re,this.tileID.canonical))return}else if(!k.filter(new Vn(this.tileID.overscaledZ),Y))return;const K=this.getId(Y,q);for(let re=0;re<j.length;re++){const ae=j[re];if(S&&S.indexOf(ae)<0)continue;const be=A[ae];if(!be)continue;let pe={};K&&z&&(pe=z.getState(be.sourceLayer||"_geojsonTileLayer",K));const ye=Se({},B[ae]);ye.paint=aC(ye.paint,be.paint,Y,pe,T),ye.layout=aC(ye.layout,be.layout,Y,pe,T);const Te=!R||R(Y,be,pe);if(!Te)continue;const Re=new oC(Y,this.z,this.x,this.y,K);Re.layer=ye;let ot=s[ae];ot===void 0&&(ot=s[ae]=[]),ot.push({featureIndex:_,feature:Re,intersectionZ:Te})}}lookupSymbolFeatures(s,h,p,_,k,S,T,A){const B={};this.loadVTLayers();const z=_d(k);for(const R of s)this.loadMatchingFeature(B,p,_,R,z,S,T,A,h);return B}hasLayer(s){for(const h of this.bucketLayerIDs)for(const p of h)if(s===p)return!0;return!1}getId(s,h){let p=s.id;return this.promoteId&&(p=s.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[h]],typeof p=="boolean"&&(p=Number(p))),p}}function aC(c,s,h,p,_){return Ae(c,(k,S)=>{const T=s instanceof tc?s.get(S):null;return T&&T.evaluate?T.evaluate(h,p,_):T})}function lC(c){let s=1/0,h=1/0,p=-1/0,_=-1/0;for(const k of c)s=Math.min(s,k.x),h=Math.min(h,k.y),p=Math.max(p,k.x),_=Math.max(_,k.y);return{minX:s,minY:h,maxX:p,maxY:_}}function zG(c,s){return s-c}function cC(c,s,h,p,_){const k=[];for(let S=0;S<c.length;S++){const T=c[S];let A;for(let B=0;B<T.length-1;B++){let z=T[B],R=T[B+1];z.x<s&&R.x<s||(z.x<s?z=new E(s,z.y+(s-z.x)/(R.x-z.x)*(R.y-z.y))._round():R.x<s&&(R=new E(s,z.y+(s-z.x)/(R.x-z.x)*(R.y-z.y))._round()),z.y<h&&R.y<h||(z.y<h?z=new E(z.x+(h-z.y)/(R.y-z.y)*(R.x-z.x),h)._round():R.y<h&&(R=new E(z.x+(h-z.y)/(R.y-z.y)*(R.x-z.x),h)._round()),z.x>=p&&R.x>=p||(z.x>=p?z=new E(p,z.y+(p-z.x)/(R.x-z.x)*(R.y-z.y))._round():R.x>=p&&(R=new E(p,z.y+(p-z.x)/(R.x-z.x)*(R.y-z.y))._round()),z.y>=_&&R.y>=_||(z.y>=_?z=new E(z.x+(_-z.y)/(R.y-z.y)*(R.x-z.x),_)._round():R.y>=_&&(R=new E(z.x+(_-z.y)/(R.y-z.y)*(R.x-z.x),_)._round()),A&&z.equals(A[A.length-1])||(A=[z],k.push(A)),A.push(R)))))}}return k}ut("FeatureIndex",sC,{omit:["rawTileData","sourceLayerCoder"]});class al extends E{constructor(s,h,p,_){super(s,h),this.angle=p,_!==void 0&&(this.segment=_)}clone(){return new al(this.x,this.y,this.angle,this.segment)}}function uC(c,s,h,p,_){if(s.segment===void 0||h===0)return!0;let k=s,S=s.segment+1,T=0;for(;T>-h/2;){if(S--,S<0)return!1;T-=c[S].dist(k),k=c[S]}T+=c[S].dist(c[S+1]),S++;const A=[];let B=0;for(;T<h/2;){const z=c[S],R=c[S+1];if(!R)return!1;let j=c[S-1].angleTo(z)-z.angleTo(R);for(j=Math.abs((j+3*Math.PI)%(2*Math.PI)-Math.PI),A.push({distance:T,angleDelta:j}),B+=j;T-A[0].distance>p;)B-=A.shift().angleDelta;if(B>_)return!1;S++,T+=z.dist(R)}return!0}function hC(c){let s=0;for(let h=0;h<c.length-1;h++)s+=c[h].dist(c[h+1]);return s}function dC(c,s,h){return c?.6*s*h:0}function pC(c,s){return Math.max(c?c.right-c.left:0,s?s.right-s.left:0)}function NG(c,s,h,p,_,k){const S=dC(h,_,k),T=pC(h,p)*k;let A=0;const B=hC(c)/2;for(let z=0;z<c.length-1;z++){const R=c[z],j=c[z+1],q=R.dist(j);if(A+q>B){const Y=(B-A)/q,K=nr.number(R.x,j.x,Y),re=nr.number(R.y,j.y,Y),ae=new al(K,re,j.angleTo(R),z);return ae._round(),!S||uC(c,ae,T,S,s)?ae:void 0}A+=q}}function LG(c,s,h,p,_,k,S,T,A){const B=dC(p,k,S),z=pC(p,_),R=z*S,j=c[0].x===0||c[0].x===A||c[0].y===0||c[0].y===A;return s-R<s/4&&(s=R+s/4),fC(c,j?s/2*T%s:(z/2+2*k)*S*T%s,s,B,h,R,j,!1,A)}function fC(c,s,h,p,_,k,S,T,A){const B=k/2,z=hC(c);let R=0,j=s-h,q=[];for(let Y=0;Y<c.length-1;Y++){const K=c[Y],re=c[Y+1],ae=K.dist(re),be=re.angleTo(K);for(;j+h<R+ae;){j+=h;const pe=(j-R)/ae,ye=nr.number(K.x,re.x,pe),Te=nr.number(K.y,re.y,pe);if(ye>=0&&ye<A&&Te>=0&&Te<A&&j-B>=0&&j+B<=z){const Re=new al(ye,Te,be,Y);Re._round(),p&&!uC(c,Re,k,p,_)||q.push(Re)}}R+=ae}return T||q.length||S||(q=fC(c,R/2,h,p,_,k,S,!0,A)),q}ut("Anchor",al);const Wu=vr;function mC(c,s,h,p){const _=[],k=c.image,S=k.pixelRatio,T=k.paddedRect.w-2*Wu,A=k.paddedRect.h-2*Wu;let B={x1:c.left,y1:c.top,x2:c.right,y2:c.bottom};const z=k.stretchX||[[0,T]],R=k.stretchY||[[0,A]],j=(De,bt)=>De+bt[1]-bt[0],q=z.reduce(j,0),Y=R.reduce(j,0),K=T-q,re=A-Y;let ae=0,be=q,pe=0,ye=Y,Te=0,Re=K,ot=0,St=re;if(k.content&&p){const De=k.content,bt=De[2]-De[0],gt=De[3]-De[1];(k.textFitWidth||k.textFitHeight)&&(B=jE(c)),ae=Zm(z,0,De[0]),pe=Zm(R,0,De[1]),be=Zm(z,De[0],De[2]),ye=Zm(R,De[1],De[3]),Te=De[0]-ae,ot=De[1]-pe,Re=bt-be,St=gt-ye}const nt=B.x1,Qe=B.y1,yt=B.x2-nt,dt=B.y2-Qe,lt=(De,bt,gt,Ot)=>{const Dn=Ym(De.stretch-ae,be,yt,nt),An=Xm(De.fixed-Te,Re,De.stretch,q),yi=Ym(bt.stretch-pe,ye,dt,Qe),Do=Xm(bt.fixed-ot,St,bt.stretch,Y),Ri=Ym(gt.stretch-ae,be,yt,nt),_i=Xm(gt.fixed-Te,Re,gt.stretch,q),sr=Ym(Ot.stretch-pe,ye,dt,Qe),ar=Xm(Ot.fixed-ot,St,Ot.stretch,Y),lr=new E(Dn,yi),ei=new E(Ri,yi),bi=new E(Ri,sr),Yi=new E(Dn,sr),Vi=new E(An/S,Do/S),cr=new E(_i/S,ar/S),Fi=s*Math.PI/180;if(Fi){const hn=Math.sin(Fi),Bn=Math.cos(Fi),Un=[Bn,-hn,hn,Bn];lr._matMult(Un),ei._matMult(Un),Yi._matMult(Un),bi._matMult(Un)}const ao=De.stretch+De.fixed,wr=bt.stretch+bt.fixed;return{tl:lr,tr:ei,bl:Yi,br:bi,tex:{x:k.paddedRect.x+Wu+ao,y:k.paddedRect.y+Wu+wr,w:gt.stretch+gt.fixed-ao,h:Ot.stretch+Ot.fixed-wr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Vi,pixelOffsetBR:cr,minFontScaleX:Re/S/yt,minFontScaleY:St/S/dt,isSDF:h}};if(p&&(k.stretchX||k.stretchY)){const De=gC(z,K,q),bt=gC(R,re,Y);for(let gt=0;gt<De.length-1;gt++){const Ot=De[gt],Dn=De[gt+1];for(let An=0;An<bt.length-1;An++)_.push(lt(Ot,bt[An],Dn,bt[An+1]))}}else _.push(lt({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:T+1},{fixed:0,stretch:A+1}));return _}function Zm(c,s,h){let p=0;for(const _ of c)p+=Math.max(s,Math.min(h,_[1]))-Math.max(s,Math.min(h,_[0]));return p}function gC(c,s,h){const p=[{fixed:-Wu,stretch:0}];for(const[_,k]of c){const S=p[p.length-1];p.push({fixed:_-S.stretch,stretch:S.stretch}),p.push({fixed:_-S.stretch,stretch:S.stretch+(k-_)})}return p.push({fixed:s+Wu,stretch:h}),p}function Ym(c,s,h,p){return c/s*h+p}function Xm(c,s,h,p){return c-s*h/p}class Km{constructor(s,h,p,_,k,S,T,A,B,z){var R;if(this.boxStartIndex=s.length,B){let j=S.top,q=S.bottom;const Y=S.collisionPadding;Y&&(j-=Y[1],q+=Y[3]);let K=q-j;K>0&&(K=Math.max(10,K),this.circleDiameter=K)}else{const j=!((R=S.image)===null||R===void 0)&&R.content&&(S.image.textFitWidth||S.image.textFitHeight)?jE(S):{x1:S.left,y1:S.top,x2:S.right,y2:S.bottom};j.y1=j.y1*T-A[0],j.y2=j.y2*T+A[2],j.x1=j.x1*T-A[3],j.x2=j.x2*T+A[1];const q=S.collisionPadding;if(q&&(j.x1-=q[0]*T,j.y1-=q[1]*T,j.x2+=q[2]*T,j.y2+=q[3]*T),z){const Y=new E(j.x1,j.y1),K=new E(j.x2,j.y1),re=new E(j.x1,j.y2),ae=new E(j.x2,j.y2),be=z*Math.PI/180;Y._rotate(be),K._rotate(be),re._rotate(be),ae._rotate(be),j.x1=Math.min(Y.x,K.x,re.x,ae.x),j.x2=Math.max(Y.x,K.x,re.x,ae.x),j.y1=Math.min(Y.y,K.y,re.y,ae.y),j.y2=Math.max(Y.y,K.y,re.y,ae.y)}s.emplaceBack(h.x,h.y,j.x1,j.y1,j.x2,j.y2,p,_,k)}this.boxEndIndex=s.length}}class RG{constructor(s=[],h=(p,_)=>p<_?-1:p>_?1:0){if(this.data=s,this.length=this.data.length,this.compare=h,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;const s=this.data[0],h=this.data.pop();return--this.length>0&&(this.data[0]=h,this._down(0)),s}peek(){return this.data[0]}_up(s){const{data:h,compare:p}=this,_=h[s];for(;s>0;){const k=s-1>>1,S=h[k];if(p(_,S)>=0)break;h[s]=S,s=k}h[s]=_}_down(s){const{data:h,compare:p}=this,_=this.length>>1,k=h[s];for(;s<_;){let S=1+(s<<1);const T=S+1;if(T<this.length&&p(h[T],h[S])<0&&(S=T),p(h[S],k)>=0)break;h[s]=h[S],s=S}h[s]=k}}function VG(c,s=1,h=!1){let p=1/0,_=1/0,k=-1/0,S=-1/0;const T=c[0];for(let q=0;q<T.length;q++){const Y=T[q];(!q||Y.x<p)&&(p=Y.x),(!q||Y.y<_)&&(_=Y.y),(!q||Y.x>k)&&(k=Y.x),(!q||Y.y>S)&&(S=Y.y)}const A=Math.min(k-p,S-_);let B=A/2;const z=new RG([],FG);if(A===0)return new E(p,_);for(let q=p;q<k;q+=A)for(let Y=_;Y<S;Y+=A)z.push(new Gu(q+B,Y+B,B,c));let R=function(q){let Y=0,K=0,re=0;const ae=q[0];for(let be=0,pe=ae.length,ye=pe-1;be<pe;ye=be++){const Te=ae[be],Re=ae[ye],ot=Te.x*Re.y-Re.x*Te.y;K+=(Te.x+Re.x)*ot,re+=(Te.y+Re.y)*ot,Y+=3*ot}return new Gu(K/Y,re/Y,0,q)}(c),j=z.length;for(;z.length;){const q=z.pop();(q.d>R.d||!R.d)&&(R=q,h&&console.log("found best %d after %d probes",Math.round(1e4*q.d)/1e4,j)),q.max-R.d<=s||(B=q.h/2,z.push(new Gu(q.p.x-B,q.p.y-B,B,c)),z.push(new Gu(q.p.x+B,q.p.y-B,B,c)),z.push(new Gu(q.p.x-B,q.p.y+B,B,c)),z.push(new Gu(q.p.x+B,q.p.y+B,B,c)),j+=4)}return h&&(console.log(`num probes: ${j}`),console.log(`best distance: ${R.d}`)),R.p}function FG(c,s){return s.max-c.max}function Gu(c,s,h,p){this.p=new E(c,s),this.h=h,this.d=function(_,k){let S=!1,T=1/0;for(let A=0;A<k.length;A++){const B=k[A];for(let z=0,R=B.length,j=R-1;z<R;j=z++){const q=B[z],Y=B[j];q.y>_.y!=Y.y>_.y&&_.x<(Y.x-q.x)*(_.y-q.y)/(Y.y-q.y)+q.x&&(S=!S),T=Math.min(T,QS(_,q,Y))}}return(S?1:-1)*Math.sqrt(T)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Li;u.aq=void 0,(Li=u.aq||(u.aq={}))[Li.center=1]="center",Li[Li.left=2]="left",Li[Li.right=3]="right",Li[Li.top=4]="top",Li[Li.bottom=5]="bottom",Li[Li["top-left"]=6]="top-left",Li[Li["top-right"]=7]="top-right",Li[Li["bottom-left"]=8]="bottom-left",Li[Li["bottom-right"]=9]="bottom-right";const ll=7,hb=Number.POSITIVE_INFINITY;function yC(c,s){return s[1]!==hb?function(h,p,_){let k=0,S=0;switch(p=Math.abs(p),_=Math.abs(_),h){case"top-right":case"top-left":case"top":S=_-ll;break;case"bottom-right":case"bottom-left":case"bottom":S=-_+ll}switch(h){case"top-right":case"bottom-right":case"right":k=-p;break;case"top-left":case"bottom-left":case"left":k=p}return[k,S]}(c,s[0],s[1]):function(h,p){let _=0,k=0;p<0&&(p=0);const S=p/Math.SQRT2;switch(h){case"top-right":case"top-left":k=S-ll;break;case"bottom-right":case"bottom-left":k=-S+ll;break;case"bottom":k=-p+ll;break;case"top":k=p-ll}switch(h){case"top-right":case"bottom-right":_=-S;break;case"top-left":case"bottom-left":_=S;break;case"left":_=p;break;case"right":_=-p}return[_,k]}(c,s[0])}function _C(c,s,h){var p;const _=c.layout,k=(p=_.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(s,{},h);if(k){const T=k.values,A=[];for(let B=0;B<T.length;B+=2){const z=A[B]=T[B],R=T[B+1].map(j=>j*hi);z.startsWith("top")?R[1]-=ll:z.startsWith("bottom")&&(R[1]+=ll),A[B+1]=R}return new Nr(A)}const S=_.get("text-variable-anchor");if(S){let T;T=c._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[_.get("text-radial-offset").evaluate(s,{},h)*hi,hb]:_.get("text-offset").evaluate(s,{},h).map(B=>B*hi);const A=[];for(const B of S)A.push(B,yC(B,T));return new Nr(A)}return null}function db(c){switch(c){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function $G(c,s,h,p,_,k,S,T,A,B,z){let R=k.textMaxSize.evaluate(s,{});R===void 0&&(R=S);const j=c.layers[0].layout,q=j.get("icon-offset").evaluate(s,{},z),Y=xC(h.horizontal),K=S/24,re=c.tilePixelRatio*K,ae=c.tilePixelRatio*R/24,be=c.tilePixelRatio*T,pe=c.tilePixelRatio*j.get("symbol-spacing"),ye=j.get("text-padding")*c.tilePixelRatio,Te=function(De,bt,gt,Ot=1){const Dn=De.get("icon-padding").evaluate(bt,{},gt),An=Dn&&Dn.values;return[An[0]*Ot,An[1]*Ot,An[2]*Ot,An[3]*Ot]}(j,s,z,c.tilePixelRatio),Re=j.get("text-max-angle")/180*Math.PI,ot=j.get("text-rotation-alignment")!=="viewport"&&j.get("symbol-placement")!=="point",St=j.get("icon-rotation-alignment")==="map"&&j.get("symbol-placement")!=="point",nt=j.get("symbol-placement"),Qe=pe/2,yt=j.get("icon-text-fit");let dt;p&&yt!=="none"&&(c.allowVerticalPlacement&&h.vertical&&(dt=UE(p,h.vertical,yt,j.get("icon-text-fit-padding"),q,K)),Y&&(p=UE(p,Y,yt,j.get("icon-text-fit-padding"),q,K)));const lt=(De,bt)=>{bt.x<0||bt.x>=ai||bt.y<0||bt.y>=ai||function(gt,Ot,Dn,An,yi,Do,Ri,_i,sr,ar,lr,ei,bi,Yi,Vi,cr,Fi,ao,wr,hn,Bn,Un,Ur,Yn,Zu){const ys=gt.addToLineVertexArray(Ot,Dn);let _s,Oo,lo,Ci,ta=0,np=0,SC=0,EC=0,xb=-1,vb=-1;const na={};let CC=Bu("");if(gt.allowVerticalPlacement&&An.vertical){const Xi=_i.layout.get("text-rotate").evaluate(Bn,{},Yn)+90;lo=new Km(sr,Ot,ar,lr,ei,An.vertical,bi,Yi,Vi,Xi),Ri&&(Ci=new Km(sr,Ot,ar,lr,ei,Ri,Fi,ao,Vi,Xi))}if(yi){const Xi=_i.layout.get("icon-rotate").evaluate(Bn,{}),co=_i.layout.get("icon-text-fit")!=="none",lc=mC(yi,Xi,Ur,co),Zo=Ri?mC(Ri,Xi,Ur,co):void 0;Oo=new Km(sr,Ot,ar,lr,ei,yi,Fi,ao,!1,Xi),ta=4*lc.length;const cc=gt.iconSizeData;let bs=null;cc.kind==="source"?(bs=[gs*_i.layout.get("icon-size").evaluate(Bn,{})],bs[0]>ol&&st(`${gt.layerIds[0]}: Value for "icon-size" is >= ${Kd}. Reduce your "icon-size".`)):cc.kind==="composite"&&(bs=[gs*Un.compositeIconSizes[0].evaluate(Bn,{},Yn),gs*Un.compositeIconSizes[1].evaluate(Bn,{},Yn)],(bs[0]>ol||bs[1]>ol)&&st(`${gt.layerIds[0]}: Value for "icon-size" is >= ${Kd}. Reduce your "icon-size".`)),gt.addSymbols(gt.icon,lc,bs,hn,wr,Bn,u.ah.none,Ot,ys.lineStartIndex,ys.lineLength,-1,Yn),xb=gt.icon.placedSymbolArray.length-1,Zo&&(np=4*Zo.length,gt.addSymbols(gt.icon,Zo,bs,hn,wr,Bn,u.ah.vertical,Ot,ys.lineStartIndex,ys.lineLength,-1,Yn),vb=gt.icon.placedSymbolArray.length-1)}const TC=Object.keys(An.horizontal);for(const Xi of TC){const co=An.horizontal[Xi];if(!_s){CC=Bu(co.text);const Zo=_i.layout.get("text-rotate").evaluate(Bn,{},Yn);_s=new Km(sr,Ot,ar,lr,ei,co,bi,Yi,Vi,Zo)}const lc=co.positionedLines.length===1;if(SC+=bC(gt,Ot,co,Do,_i,Vi,Bn,cr,ys,An.vertical?u.ah.horizontal:u.ah.horizontalOnly,lc?TC:[Xi],na,xb,Un,Yn),lc)break}An.vertical&&(EC+=bC(gt,Ot,An.vertical,Do,_i,Vi,Bn,cr,ys,u.ah.vertical,["vertical"],na,vb,Un,Yn));const HG=_s?_s.boxStartIndex:gt.collisionBoxArray.length,qG=_s?_s.boxEndIndex:gt.collisionBoxArray.length,WG=lo?lo.boxStartIndex:gt.collisionBoxArray.length,GG=lo?lo.boxEndIndex:gt.collisionBoxArray.length,ZG=Oo?Oo.boxStartIndex:gt.collisionBoxArray.length,YG=Oo?Oo.boxEndIndex:gt.collisionBoxArray.length,XG=Ci?Ci.boxStartIndex:gt.collisionBoxArray.length,KG=Ci?Ci.boxEndIndex:gt.collisionBoxArray.length;let Go=-1;const Qm=(Xi,co)=>Xi&&Xi.circleDiameter?Math.max(Xi.circleDiameter,co):co;Go=Qm(_s,Go),Go=Qm(lo,Go),Go=Qm(Oo,Go),Go=Qm(Ci,Go);const MC=Go>-1?1:0;MC&&(Go*=Zu/hi),gt.glyphOffsetArray.length>=qu.MAX_GLYPHS&&st("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Bn.sortKey!==void 0&&gt.addToSortKeyRanges(gt.symbolInstances.length,Bn.sortKey);const JG=_C(_i,Bn,Yn),[QG,eZ]=function(Xi,co){const lc=Xi.length,Zo=co==null?void 0:co.values;if((Zo==null?void 0:Zo.length)>0)for(let cc=0;cc<Zo.length;cc+=2){const bs=Zo[cc+1];Xi.emplaceBack(u.aq[Zo[cc]],bs[0],bs[1])}return[lc,Xi.length]}(gt.textAnchorOffsets,JG);gt.symbolInstances.emplaceBack(Ot.x,Ot.y,na.right>=0?na.right:-1,na.center>=0?na.center:-1,na.left>=0?na.left:-1,na.vertical||-1,xb,vb,CC,HG,qG,WG,GG,ZG,YG,XG,KG,ar,SC,EC,ta,np,MC,0,bi,Go,QG,eZ)}(c,bt,De,h,p,_,dt,c.layers[0],c.collisionBoxArray,s.index,s.sourceLayerIndex,c.index,re,[ye,ye,ye,ye],ot,A,be,Te,St,q,s,k,B,z,S)};if(nt==="line")for(const De of cC(s.geometry,0,0,ai,ai)){const bt=LG(De,pe,Re,h.vertical||Y,p,24,ae,c.overscaling,ai);for(const gt of bt)Y&&jG(c,Y.text,Qe,gt)||lt(De,gt)}else if(nt==="line-center"){for(const De of s.geometry)if(De.length>1){const bt=NG(De,Re,h.vertical||Y,p,24,ae);bt&&lt(De,bt)}}else if(s.type==="Polygon")for(const De of uu(s.geometry,0)){const bt=VG(De,16);lt(De[0],new al(bt.x,bt.y,0))}else if(s.type==="LineString")for(const De of s.geometry)lt(De,new al(De[0].x,De[0].y,0));else if(s.type==="Point")for(const De of s.geometry)for(const bt of De)lt([bt],new al(bt.x,bt.y,0))}function bC(c,s,h,p,_,k,S,T,A,B,z,R,j,q,Y){const K=function(be,pe,ye,Te,Re,ot,St,nt){const Qe=Te.layout.get("text-rotate").evaluate(ot,{})*Math.PI/180,yt=[];for(const dt of pe.positionedLines)for(const lt of dt.positionedGlyphs){if(!lt.rect)continue;const De=lt.rect||{};let bt=zE+1,gt=!0,Ot=1,Dn=0;const An=(Re||nt)&&lt.vertical,yi=lt.metrics.advance*lt.scale/2;if(nt&&pe.verticalizable&&(Dn=dt.lineOffset/2-(lt.imageName?-(hi-lt.metrics.width*lt.scale)/2:(lt.scale-1)*hi)),lt.imageName){const hn=St[lt.imageName];gt=hn.sdf,Ot=hn.pixelRatio,bt=vr/Ot}const Do=Re?[lt.x+yi,lt.y]:[0,0];let Ri=Re?[0,0]:[lt.x+yi+ye[0],lt.y+ye[1]-Dn],_i=[0,0];An&&(_i=Ri,Ri=[0,0]);const sr=lt.metrics.isDoubleResolution?2:1,ar=(lt.metrics.left-bt)*lt.scale-yi+Ri[0],lr=(-lt.metrics.top-bt)*lt.scale+Ri[1],ei=ar+De.w/sr*lt.scale/Ot,bi=lr+De.h/sr*lt.scale/Ot,Yi=new E(ar,lr),Vi=new E(ei,lr),cr=new E(ar,bi),Fi=new E(ei,bi);if(An){const hn=new E(-yi,yi-Yd),Bn=-Math.PI/2,Un=hi/2-yi,Ur=new E(5-Yd-Un,-(lt.imageName?Un:0)),Yn=new E(..._i);Yi._rotateAround(Bn,hn)._add(Ur)._add(Yn),Vi._rotateAround(Bn,hn)._add(Ur)._add(Yn),cr._rotateAround(Bn,hn)._add(Ur)._add(Yn),Fi._rotateAround(Bn,hn)._add(Ur)._add(Yn)}if(Qe){const hn=Math.sin(Qe),Bn=Math.cos(Qe),Un=[Bn,-hn,hn,Bn];Yi._matMult(Un),Vi._matMult(Un),cr._matMult(Un),Fi._matMult(Un)}const ao=new E(0,0),wr=new E(0,0);yt.push({tl:Yi,tr:Vi,bl:cr,br:Fi,tex:De,writingMode:pe.writingMode,glyphOffset:Do,sectionIndex:lt.sectionIndex,isSDF:gt,pixelOffsetTL:ao,pixelOffsetBR:wr,minFontScaleX:0,minFontScaleY:0})}return yt}(0,h,T,_,k,S,p,c.allowVerticalPlacement),re=c.textSizeData;let ae=null;re.kind==="source"?(ae=[gs*_.layout.get("text-size").evaluate(S,{})],ae[0]>ol&&st(`${c.layerIds[0]}: Value for "text-size" is >= ${Kd}. Reduce your "text-size".`)):re.kind==="composite"&&(ae=[gs*q.compositeTextSizes[0].evaluate(S,{},Y),gs*q.compositeTextSizes[1].evaluate(S,{},Y)],(ae[0]>ol||ae[1]>ol)&&st(`${c.layerIds[0]}: Value for "text-size" is >= ${Kd}. Reduce your "text-size".`)),c.addSymbols(c.text,K,ae,T,k,S,B,s,A.lineStartIndex,A.lineLength,j,Y);for(const be of z)R[be]=c.text.placedSymbolArray.length-1;return 4*K.length}function xC(c){for(const s in c)return c[s];return null}function jG(c,s,h,p){const _=c.compareText;if(s in _){const k=_[s];for(let S=k.length-1;S>=0;S--)if(p.dist(k[S])<h)return!0}else _[s]=[];return _[s].push(p),!1}const vC=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class pb{static from(s){if(!(s instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[h,p]=new Uint8Array(s,0,2);if(h!==219)throw new Error("Data does not appear to be in a KDBush format.");const _=p>>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const k=vC[15&p];if(!k)throw new Error("Unrecognized array type.");const[S]=new Uint16Array(s,2,1),[T]=new Uint32Array(s,4,1);return new pb(T,S,k,s)}constructor(s,h=64,p=Float64Array,_){if(isNaN(s)||s<0)throw new Error(`Unpexpected numItems value: ${s}.`);this.numItems=+s,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=s<65536?Uint16Array:Uint32Array;const k=vC.indexOf(this.ArrayType),S=2*s*this.ArrayType.BYTES_PER_ELEMENT,T=s*this.IndexArrayType.BYTES_PER_ELEMENT,A=(8-T%8)%8;if(k<0)throw new Error(`Unexpected typed array class: ${p}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+T+A,2*s),this._pos=2*s,this._finished=!0):(this.data=new ArrayBuffer(8+S+T+A),this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+T+A,2*s),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+k]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=s)}add(s,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=s,this.coords[this._pos++]=h,p}finish(){const s=this._pos>>1;if(s!==this.numItems)throw new Error(`Added ${s} items when expected ${this.numItems}.`);return fb(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(s,h,p,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:k,coords:S,nodeSize:T}=this,A=[0,k.length-1,0],B=[];for(;A.length;){const z=A.pop()||0,R=A.pop()||0,j=A.pop()||0;if(R-j<=T){for(let re=j;re<=R;re++){const ae=S[2*re],be=S[2*re+1];ae>=s&&ae<=p&&be>=h&&be<=_&&B.push(k[re])}continue}const q=j+R>>1,Y=S[2*q],K=S[2*q+1];Y>=s&&Y<=p&&K>=h&&K<=_&&B.push(k[q]),(z===0?s<=Y:h<=K)&&(A.push(j),A.push(q-1),A.push(1-z)),(z===0?p>=Y:_>=K)&&(A.push(q+1),A.push(R),A.push(1-z))}return B}within(s,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:k,nodeSize:S}=this,T=[0,_.length-1,0],A=[],B=p*p;for(;T.length;){const z=T.pop()||0,R=T.pop()||0,j=T.pop()||0;if(R-j<=S){for(let re=j;re<=R;re++)kC(k[2*re],k[2*re+1],s,h)<=B&&A.push(_[re]);continue}const q=j+R>>1,Y=k[2*q],K=k[2*q+1];kC(Y,K,s,h)<=B&&A.push(_[q]),(z===0?s-p<=Y:h-p<=K)&&(T.push(j),T.push(q-1),T.push(1-z)),(z===0?s+p>=Y:h+p>=K)&&(T.push(q+1),T.push(R),T.push(1-z))}return A}}function fb(c,s,h,p,_,k){if(_-p<=h)return;const S=p+_>>1;wC(c,s,S,p,_,k),fb(c,s,h,p,S-1,1-k),fb(c,s,h,S+1,_,1-k)}function wC(c,s,h,p,_,k){for(;_>p;){if(_-p>600){const B=_-p+1,z=h-p+1,R=Math.log(B),j=.5*Math.exp(2*R/3),q=.5*Math.sqrt(R*j*(B-j)/B)*(z-B/2<0?-1:1);wC(c,s,h,Math.max(p,Math.floor(h-z*j/B+q)),Math.min(_,Math.floor(h+(B-z)*j/B+q)),k)}const S=s[2*h+k];let T=p,A=_;for(ep(c,s,p,h),s[2*_+k]>S&&ep(c,s,p,_);T<A;){for(ep(c,s,T,A),T++,A--;s[2*T+k]<S;)T++;for(;s[2*A+k]>S;)A--}s[2*p+k]===S?ep(c,s,p,A):(A++,ep(c,s,A,_)),A<=h&&(p=A+1),h<=A&&(_=A-1)}}function ep(c,s,h,p){mb(c,h,p),mb(s,2*h,2*p),mb(s,2*h+1,2*p+1)}function mb(c,s,h){const p=c[s];c[s]=c[h],c[h]=p}function kC(c,s,h,p){const _=c-h,k=s-p;return _*_+k*k}var gb;u.bg=void 0,(gb=u.bg||(u.bg={})).create="create",gb.load="load",gb.fullLoad="fullLoad";let Jm=null,tp=[];const yb=1e3/60,_b="loadTime",bb="fullLoadTime",UG={mark(c){performance.mark(c)},frame(c){const s=c;Jm!=null&&tp.push(s-Jm),Jm=s},clearMetrics(){Jm=null,tp=[],performance.clearMeasures(_b),performance.clearMeasures(bb);for(const c in u.bg)performance.clearMarks(u.bg[c])},getPerformanceMetrics(){performance.measure(_b,u.bg.create,u.bg.load),performance.measure(bb,u.bg.create,u.bg.fullLoad);const c=performance.getEntriesByName(_b)[0].duration,s=performance.getEntriesByName(bb)[0].duration,h=tp.length,p=1/(tp.reduce((k,S)=>k+S,0)/h/1e3),_=tp.filter(k=>k>yb).reduce((k,S)=>k+(S-yb)/yb,0);return{loadTime:c,fullLoadTime:s,fps:p,percentDroppedFrames:_/(h+_)*100,totalFrames:h}}};u.$=class extends V{},u.A=Vu,u.B=T_,u.C=function(c){if(Vt==null){const s=c.navigator?c.navigator.userAgent:null;Vt=!!c.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return Vt},u.D=ft,u.E=rn,u.F=class{constructor(c,s){this.target=c,this.mapId=s,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new BG(()=>this.process()),this.subscription=function(h,p,_,k){return h.addEventListener(p,_,!1),{unsubscribe:()=>{h.removeEventListener(p,_,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=Nt(self)?c:window}registerMessageHandler(c,s){this.messageHandlers[c]=s}sendAsync(c,s){return new Promise((h,p)=>{const _=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[_]={resolve:h,reject:p},s&&s.signal.addEventListener("abort",()=>{delete this.resolveRejects[_];const T={id:_,type:"<cancel>",origin:location.origin,targetMapId:c.targetMapId,sourceMapId:this.mapId};this.target.postMessage(T)},{once:!0});const k=[],S=Object.assign(Object.assign({},c),{id:_,sourceMapId:this.mapId,origin:location.origin,data:Ga(c.data,k)});this.target.postMessage(S,{transfer:k})})}receive(c){const s=c.data,h=s.id;if(!(s.origin!=="file://"&&location.origin!=="file://"&&s.origin!=="resource://android"&&location.origin!=="resource://android"&&s.origin!==location.origin||s.targetMapId&&this.mapId!==s.targetMapId)){if(s.type==="<cancel>"){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(Nt(self)||s.mustQueue)return this.tasks[h]=s,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,s)}}process(){if(this.taskQueue.length===0)return;const c=this.taskQueue.shift(),s=this.tasks[c];delete this.tasks[c],this.taskQueue.length>0&&this.invoker.trigger(),s&&this.processTask(c,s)}processTask(c,s){return l(this,void 0,void 0,function*(){if(s.type==="<response>"){const _=this.resolveRejects[c];return delete this.resolveRejects[c],_?void(s.error?_.reject(Za(s.error)):_.resolve(Za(s.data))):void 0}if(!this.messageHandlers[s.type])return void this.completeTask(c,new Error(`Could not find a registered handler for ${s.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=Za(s.data),p=new AbortController;this.abortControllers[c]=p;try{const _=yield this.messageHandlers[s.type](s.sourceMapId,h,p);this.completeTask(c,null,_)}catch(_){this.completeTask(c,_)}})}completeTask(c,s,h){const p=[];delete this.abortControllers[c];const _={id:c,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:s?Ga(s):null,data:Ga(h,p)};this.target.postMessage(_,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},u.G=Ln,u.H=function(){var c=new Vu(16);return Vu!=Float32Array&&(c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=0,c[12]=0,c[13]=0,c[14]=0),c[0]=1,c[5]=1,c[10]=1,c[15]=1,c},u.I=eb,u.J=function(c,s,h){var p,_,k,S,T,A,B,z,R,j,q,Y,K=h[0],re=h[1],ae=h[2];return s===c?(c[12]=s[0]*K+s[4]*re+s[8]*ae+s[12],c[13]=s[1]*K+s[5]*re+s[9]*ae+s[13],c[14]=s[2]*K+s[6]*re+s[10]*ae+s[14],c[15]=s[3]*K+s[7]*re+s[11]*ae+s[15]):(_=s[1],k=s[2],S=s[3],T=s[4],A=s[5],B=s[6],z=s[7],R=s[8],j=s[9],q=s[10],Y=s[11],c[0]=p=s[0],c[1]=_,c[2]=k,c[3]=S,c[4]=T,c[5]=A,c[6]=B,c[7]=z,c[8]=R,c[9]=j,c[10]=q,c[11]=Y,c[12]=p*K+T*re+R*ae+s[12],c[13]=_*K+A*re+j*ae+s[13],c[14]=k*K+B*re+q*ae+s[14],c[15]=S*K+z*re+Y*ae+s[15]),c},u.K=function(c,s,h){var p=h[0],_=h[1],k=h[2];return c[0]=s[0]*p,c[1]=s[1]*p,c[2]=s[2]*p,c[3]=s[3]*p,c[4]=s[4]*_,c[5]=s[5]*_,c[6]=s[6]*_,c[7]=s[7]*_,c[8]=s[8]*k,c[9]=s[9]*k,c[10]=s[10]*k,c[11]=s[11]*k,c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15],c},u.L=iE,u.M=function(c,s){const h={};for(let p=0;p<s.length;p++){const _=s[p];_ in c&&(h[_]=c[_])}return h},u.N=sl,u.O=JE,u.P=E,u.Q=QE,u.R=oo,u.S=so,u.T=Au,u.U=W,u.V=te,u.W=Cn,u.X=ai,u.Y=M,u.Z=Jd,u._=l,u.a=Nn,u.a$=function(c,s){var h=c[0],p=c[1],_=c[2],k=c[3],S=c[4],T=c[5],A=c[6],B=c[7],z=c[8],R=c[9],j=c[10],q=c[11],Y=c[12],K=c[13],re=c[14],ae=c[15],be=s[0],pe=s[1],ye=s[2],Te=s[3],Re=s[4],ot=s[5],St=s[6],nt=s[7],Qe=s[8],yt=s[9],dt=s[10],lt=s[11],De=s[12],bt=s[13],gt=s[14],Ot=s[15];return Math.abs(h-be)<=or*Math.max(1,Math.abs(h),Math.abs(be))&&Math.abs(p-pe)<=or*Math.max(1,Math.abs(p),Math.abs(pe))&&Math.abs(_-ye)<=or*Math.max(1,Math.abs(_),Math.abs(ye))&&Math.abs(k-Te)<=or*Math.max(1,Math.abs(k),Math.abs(Te))&&Math.abs(S-Re)<=or*Math.max(1,Math.abs(S),Math.abs(Re))&&Math.abs(T-ot)<=or*Math.max(1,Math.abs(T),Math.abs(ot))&&Math.abs(A-St)<=or*Math.max(1,Math.abs(A),Math.abs(St))&&Math.abs(B-nt)<=or*Math.max(1,Math.abs(B),Math.abs(nt))&&Math.abs(z-Qe)<=or*Math.max(1,Math.abs(z),Math.abs(Qe))&&Math.abs(R-yt)<=or*Math.max(1,Math.abs(R),Math.abs(yt))&&Math.abs(j-dt)<=or*Math.max(1,Math.abs(j),Math.abs(dt))&&Math.abs(q-lt)<=or*Math.max(1,Math.abs(q),Math.abs(lt))&&Math.abs(Y-De)<=or*Math.max(1,Math.abs(Y),Math.abs(De))&&Math.abs(K-bt)<=or*Math.max(1,Math.abs(K),Math.abs(bt))&&Math.abs(re-gt)<=or*Math.max(1,Math.abs(re),Math.abs(gt))&&Math.abs(ae-Ot)<=or*Math.max(1,Math.abs(ae),Math.abs(Ot))},u.a0=tn,u.a1=ub,u.a2=Ve,u.a3=c=>{const s=window.document.createElement("video");return s.muted=!0,new Promise(h=>{s.onloadstart=()=>{h(s)};for(const p of c){const _=window.document.createElement("source");Be(p)||(s.crossOrigin="Anonymous"),_.src=p,s.appendChild(_)}})},u.a4=function(){return Ne++},u.a5=it,u.a6=qu,u.a7=_d,u.a8=sc,u.a9=oC,u.aA=function(c){if(c.type==="custom")return new OG(c);switch(c.type){case"background":return new IG(c);case"circle":return new yW(c);case"fill":return new BW(c);case"fill-extrusion":return new YW(c);case"heatmap":return new bW(c);case"hillshade":return new vW(c);case"line":return new iG(c);case"raster":return new DG(c);case"symbol":return new Gm(c)}},u.aB=Xe,u.aC=function(c,s){if(!c)return[{command:"setStyle",args:[s]}];let h=[];try{if(!qt(c.version,s.version))return[{command:"setStyle",args:[s]}];qt(c.center,s.center)||h.push({command:"setCenter",args:[s.center]}),qt(c.zoom,s.zoom)||h.push({command:"setZoom",args:[s.zoom]}),qt(c.bearing,s.bearing)||h.push({command:"setBearing",args:[s.bearing]}),qt(c.pitch,s.pitch)||h.push({command:"setPitch",args:[s.pitch]}),qt(c.sprite,s.sprite)||h.push({command:"setSprite",args:[s.sprite]}),qt(c.glyphs,s.glyphs)||h.push({command:"setGlyphs",args:[s.glyphs]}),qt(c.transition,s.transition)||h.push({command:"setTransition",args:[s.transition]}),qt(c.light,s.light)||h.push({command:"setLight",args:[s.light]}),qt(c.terrain,s.terrain)||h.push({command:"setTerrain",args:[s.terrain]}),qt(c.sky,s.sky)||h.push({command:"setSky",args:[s.sky]}),qt(c.projection,s.projection)||h.push({command:"setProjection",args:[s.projection]});const p={},_=[];(function(S,T,A,B){let z;for(z in T=T||{},S=S||{})Object.prototype.hasOwnProperty.call(S,z)&&(Object.prototype.hasOwnProperty.call(T,z)||ui(z,A,B));for(z in T)Object.prototype.hasOwnProperty.call(T,z)&&(Object.prototype.hasOwnProperty.call(S,z)?qt(S[z],T[z])||(S[z].type==="geojson"&&T[z].type==="geojson"&&Or(S,T,z)?sn(A,{command:"setGeoJSONSourceData",args:[z,T[z].data]}):mi(z,T,A,B)):vi(z,T,A))})(c.sources,s.sources,_,p);const k=[];c.layers&&c.layers.forEach(S=>{"source"in S&&p[S.source]?h.push({command:"removeLayer",args:[S.id]}):k.push(S)}),h=h.concat(_),function(S,T,A){T=T||[];const B=(S=S||[]).map(Eo),z=T.map(Eo),R=S.reduce(Co,{}),j=T.reduce(Co,{}),q=B.slice(),Y=Object.create(null);let K,re,ae,be,pe;for(let ye=0,Te=0;ye<B.length;ye++)K=B[ye],Object.prototype.hasOwnProperty.call(j,K)?Te++:(sn(A,{command:"removeLayer",args:[K]}),q.splice(q.indexOf(K,Te),1));for(let ye=0,Te=0;ye<z.length;ye++)K=z[z.length-1-ye],q[q.length-1-ye]!==K&&(Object.prototype.hasOwnProperty.call(R,K)?(sn(A,{command:"removeLayer",args:[K]}),q.splice(q.lastIndexOf(K,q.length-Te),1)):Te++,be=q[q.length-ye],sn(A,{command:"addLayer",args:[j[K],be]}),q.splice(q.length-ye,0,K),Y[K]=!0);for(let ye=0;ye<z.length;ye++)if(K=z[ye],re=R[K],ae=j[K],!Y[K]&&!qt(re,ae))if(qt(re.source,ae.source)&&qt(re["source-layer"],ae["source-layer"])&&qt(re.type,ae.type)){for(pe in wi(re.layout,ae.layout,A,K,null,"setLayoutProperty"),wi(re.paint,ae.paint,A,K,null,"setPaintProperty"),qt(re.filter,ae.filter)||sn(A,{command:"setFilter",args:[K,ae.filter]}),qt(re.minzoom,ae.minzoom)&&qt(re.maxzoom,ae.maxzoom)||sn(A,{command:"setLayerZoomRange",args:[K,ae.minzoom,ae.maxzoom]}),re)Object.prototype.hasOwnProperty.call(re,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?wi(re[pe],ae[pe],A,K,pe.slice(6),"setPaintProperty"):qt(re[pe],ae[pe])||sn(A,{command:"setLayerProperty",args:[K,pe,ae[pe]]}));for(pe in ae)Object.prototype.hasOwnProperty.call(ae,pe)&&!Object.prototype.hasOwnProperty.call(re,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?wi(re[pe],ae[pe],A,K,pe.slice(6),"setPaintProperty"):qt(re[pe],ae[pe])||sn(A,{command:"setLayerProperty",args:[K,pe,ae[pe]]}))}else sn(A,{command:"removeLayer",args:[K]}),be=q[q.lastIndexOf(K)+1],sn(A,{command:"addLayer",args:[ae,be]})}(k,s.layers,h)}catch(p){console.warn("Unable to compute style diff:",p),h=[{command:"setStyle",args:[s]}]}return h},u.aD=function(c){const s=[],h=c.id;return h===void 0&&s.push({message:`layers.${h}: missing required property "id"`}),c.render===void 0&&s.push({message:`layers.${h}: missing required method "render"`}),c.renderingMode&&c.renderingMode!=="2d"&&c.renderingMode!=="3d"&&s.push({message:`layers.${h}: property "renderingMode" must be either "2d" or "3d"`}),s},u.aE=function c(s,h){if(Array.isArray(s)){if(!Array.isArray(h)||s.length!==h.length)return!1;for(let p=0;p<s.length;p++)if(!c(s[p],h[p]))return!1;return!0}if(typeof s=="object"&&s!==null&&h!==null){if(typeof h!="object"||Object.keys(s).length!==Object.keys(h).length)return!1;for(const p in s)if(!c(s[p],h[p]))return!1;return!0}return s===h},u.aF=Ae,u.aG=$e,u.aH=class extends ic{constructor(c,s){super(c,s),this.current=0}set(c){this.current!==c&&(this.current=c,this.gl.uniform1i(this.location,c))}},u.aI=Bm,u.aJ=class extends ic{constructor(c,s){super(c,s),this.current=cW}set(c){if(c[12]!==this.current[12]||c[0]!==this.current[0])return this.current=c,void this.gl.uniformMatrix4fv(this.location,!1,c);for(let s=1;s<16;s++)if(c[s]!==this.current[s]){this.current=c,this.gl.uniformMatrix4fv(this.location,!1,c);break}}},u.aK=WS,u.aL=GS,u.aM=kn,u.aN=class extends ic{constructor(c,s){super(c,s),this.current=[0,0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]&&c[2]===this.current[2]||(this.current=c,this.gl.uniform3f(this.location,c[0],c[1],c[2]))}},u.aO=class extends ic{constructor(c,s){super(c,s),this.current=[0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]||(this.current=c,this.gl.uniform2f(this.location,c[0],c[1]))}},u.aP=function(c,s,h,p,_,k,S){var T=1/(s-h),A=1/(p-_),B=1/(k-S);return c[0]=-2*T,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=-2*A,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=2*B,c[11]=0,c[12]=(s+h)*T,c[13]=(_+p)*A,c[14]=(S+k)*B,c[15]=1,c},u.aQ=gW,u.aR=class extends me{},u.aS=aG,u.aT=class extends xe{},u.aU=j_,u.aV=function(c){return c<=1?1:Math.pow(2,Math.ceil(Math.log(c)/Math.LN2))},u.aW=lE,u.aX=zi,u.aY=ro,u.aZ=class extends mt{},u.a_=function(c,s){return c[0]===s[0]&&c[1]===s[1]&&c[2]===s[2]&&c[3]===s[3]&&c[4]===s[4]&&c[5]===s[5]&&c[6]===s[6]&&c[7]===s[7]&&c[8]===s[8]&&c[9]===s[9]&&c[10]===s[10]&&c[11]===s[11]&&c[12]===s[12]&&c[13]===s[13]&&c[14]===s[14]&&c[15]===s[15]},u.aa=function(c){const s={};if(c.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,_,k)=>{const S=_||k;return s[p]=!S||S.toLowerCase(),""}),s["max-age"]){const h=parseInt(s["max-age"],10);isNaN(h)?delete s["max-age"]:s["max-age"]=h}return s},u.ab=function(c,s){const h=[];for(const p in c)p in s||h.push(p);return h},u.ac=Ie,u.ad=function(c,s,h){var p=Math.sin(h),_=Math.cos(h),k=s[0],S=s[1],T=s[2],A=s[3],B=s[4],z=s[5],R=s[6],j=s[7];return s!==c&&(c[8]=s[8],c[9]=s[9],c[10]=s[10],c[11]=s[11],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15]),c[0]=k*_+B*p,c[1]=S*_+z*p,c[2]=T*_+R*p,c[3]=A*_+j*p,c[4]=B*_-k*p,c[5]=z*_-S*p,c[6]=R*_-T*p,c[7]=j*_-A*p,c},u.ae=function(c){var s=new Vu(16);return s[0]=c[0],s[1]=c[1],s[2]=c[2],s[3]=c[3],s[4]=c[4],s[5]=c[5],s[6]=c[6],s[7]=c[7],s[8]=c[8],s[9]=c[9],s[10]=c[10],s[11]=c[11],s[12]=c[12],s[13]=c[13],s[14]=c[14],s[15]=c[15],s},u.af=Rm,u.ag=function(c,s){let h=0,p=0;if(c.kind==="constant")p=c.layoutSize;else if(c.kind!=="source"){const{interpolationType:_,minZoom:k,maxZoom:S}=c,T=_?Ie(ir.interpolationFactor(_,s,k,S),0,1):0;c.kind==="camera"?p=nr.number(c.minSize,c.maxSize,T):h=T}return{uSizeT:h,uSize:p}},u.ai=function(c,{uSize:s,uSizeT:h},{lowerSize:p,upperSize:_}){return c.kind==="source"?p/gs:c.kind==="composite"?nr.number(p/gs,_/gs,h):s},u.aj=rb,u.ak=function(c,s,h,p){const _=s.y-c.y,k=s.x-c.x,S=p.y-h.y,T=p.x-h.x,A=S*k-T*_;if(A===0)return null;const B=(T*(c.y-h.y)-S*(c.x-h.x))/A;return new E(c.x+B*k,c.y+B*_)},u.al=cC,u.am=KS,u.an=V_,u.ao=function(c){let s=1/0,h=1/0,p=-1/0,_=-1/0;for(const k of c)s=Math.min(s,k.x),h=Math.min(h,k.y),p=Math.max(p,k.x),_=Math.max(_,k.y);return[s,h,p,_]},u.ap=hi,u.ar=ib,u.as=function(c,s){var h=s[0],p=s[1],_=s[2],k=s[3],S=s[4],T=s[5],A=s[6],B=s[7],z=s[8],R=s[9],j=s[10],q=s[11],Y=s[12],K=s[13],re=s[14],ae=s[15],be=h*T-p*S,pe=h*A-_*S,ye=h*B-k*S,Te=p*A-_*T,Re=p*B-k*T,ot=_*B-k*A,St=z*K-R*Y,nt=z*re-j*Y,Qe=z*ae-q*Y,yt=R*re-j*K,dt=R*ae-q*K,lt=j*ae-q*re,De=be*lt-pe*dt+ye*yt+Te*Qe-Re*nt+ot*St;return De?(c[0]=(T*lt-A*dt+B*yt)*(De=1/De),c[1]=(_*dt-p*lt-k*yt)*De,c[2]=(K*ot-re*Re+ae*Te)*De,c[3]=(j*Re-R*ot-q*Te)*De,c[4]=(A*Qe-S*lt-B*nt)*De,c[5]=(h*lt-_*Qe+k*nt)*De,c[6]=(re*ye-Y*ot-ae*pe)*De,c[7]=(z*ot-j*ye+q*pe)*De,c[8]=(S*dt-T*Qe+B*St)*De,c[9]=(p*Qe-h*dt-k*St)*De,c[10]=(Y*Re-K*ye+ae*be)*De,c[11]=(R*ye-z*Re-q*be)*De,c[12]=(T*nt-S*yt-A*St)*De,c[13]=(h*yt-p*nt+_*St)*De,c[14]=(K*pe-Y*Te-re*be)*De,c[15]=(z*Te-R*pe+j*be)*De,c):null},u.at=db,u.au=nb,u.av=pb,u.aw=function(){const c={},s=we.$version;for(const h in we.$root){const p=we.$root[h];if(p.required){let _=null;_=h==="version"?s:p.type==="array"?[]:{},_!=null&&(c[h]=_)}}return c},u.ax=Dd,u.ay=He,u.az=function(c){c=c.slice();const s=Object.create(null);for(let h=0;h<c.length;h++)s[c[h].id]=c[h];for(let h=0;h<c.length;h++)"ref"in c[h]&&(c[h]=pr(c[h],s[c[h].ref]));return c},u.b=Ft,u.b0=function(c,s){return c[0]=s[0],c[1]=s[1],c[2]=s[2],c[3]=s[3],c[4]=s[4],c[5]=s[5],c[6]=s[6],c[7]=s[7],c[8]=s[8],c[9]=s[9],c[10]=s[10],c[11]=s[11],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15],c},u.b1=function(c,s,h){return c[0]=s[0]*h[0],c[1]=s[1]*h[1],c[2]=s[2]*h[2],c[3]=s[3]*h[3],c},u.b2=function(c,s){return c[0]*s[0]+c[1]*s[1]+c[2]*s[2]+c[3]*s[3]},u.b3=ve,u.b4=nC,u.b5=eC,u.b6=function(c,s,h,p,_){var k,S=1/Math.tan(s/2);return c[0]=S/h,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=S,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=-1,c[12]=0,c[13]=0,c[15]=0,_!=null&&_!==1/0?(c[10]=(_+p)*(k=1/(p-_)),c[14]=2*_*p*k):(c[10]=-1,c[14]=-2*p),c},u.b7=function(c,s,h){var p=Math.sin(h),_=Math.cos(h),k=s[4],S=s[5],T=s[6],A=s[7],B=s[8],z=s[9],R=s[10],j=s[11];return s!==c&&(c[0]=s[0],c[1]=s[1],c[2]=s[2],c[3]=s[3],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15]),c[4]=k*_+B*p,c[5]=S*_+z*p,c[6]=T*_+R*p,c[7]=A*_+j*p,c[8]=B*_-k*p,c[9]=z*_-S*p,c[10]=R*_-T*p,c[11]=j*_-A*p,c},u.b8=G,u.b9=Q,u.bA=ME,u.bB=function(c){return c.message===pn},u.bC=Fa,u.bD=br,u.ba=function(c){return c*Math.PI/180},u.bb=function(c,s){const{x:h,y:p}=Jd.fromLngLat(s);return!(c<0||c>25||p<0||p>=1||h<0||h>=1)},u.bc=function(c,s){return c[0]=s[0],c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=s[1],c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=s[2],c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c},u.bd=class extends N{},u.be=lb,u.bf=UG,u.bh=Ce,u.bi=function(c,s){Nn.REGISTERED_PROTOCOLS[c]=s},u.bj=function(c){delete Nn.REGISTERED_PROTOCOLS[c]},u.bk=function(c,s){const h={};for(let _=0;_<c.length;_++){const k=s&&s[c[_].id]||wm(c[_]);s&&(s[c[_].id]=k);let S=h[k];S||(S=h[k]=[]),S.push(c[_])}const p=[];for(const _ in h)p.push(h[_]);return p},u.bl=ut,u.bm=rC,u.bn=sC,u.bo=LE,u.bp=function(c){c.bucket.createArrays(),c.bucket.tilePixelRatio=ai/(512*c.bucket.overscaling),c.bucket.compareText={},c.bucket.iconsNeedLinear=!1;const s=c.bucket.layers[0],h=s.layout,p=s._unevaluatedLayout._values,_={layoutIconSize:p["icon-size"].possiblyEvaluate(new Vn(c.bucket.zoom+1),c.canonical),layoutTextSize:p["text-size"].possiblyEvaluate(new Vn(c.bucket.zoom+1),c.canonical),textMaxSize:p["text-size"].possiblyEvaluate(new Vn(18))};if(c.bucket.textSizeData.kind==="composite"){const{minZoom:B,maxZoom:z}=c.bucket.textSizeData;_.compositeTextSizes=[p["text-size"].possiblyEvaluate(new Vn(B),c.canonical),p["text-size"].possiblyEvaluate(new Vn(z),c.canonical)]}if(c.bucket.iconSizeData.kind==="composite"){const{minZoom:B,maxZoom:z}=c.bucket.iconSizeData;_.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new Vn(B),c.canonical),p["icon-size"].possiblyEvaluate(new Vn(z),c.canonical)]}const k=h.get("text-line-height")*hi,S=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point",T=h.get("text-keep-upright"),A=h.get("text-size");for(const B of c.bucket.features){const z=h.get("text-font").evaluate(B,{},c.canonical).join(","),R=A.evaluate(B,{},c.canonical),j=_.layoutTextSize.evaluate(B,{},c.canonical),q=_.layoutIconSize.evaluate(B,{},c.canonical),Y={horizontal:{},vertical:void 0},K=B.text;let re,ae=[0,0];if(K){const ye=K.toString(),Te=h.get("text-letter-spacing").evaluate(B,{},c.canonical)*hi,Re=M_(ye)?Te:0,ot=h.get("text-anchor").evaluate(B,{},c.canonical),St=_C(s,B,c.canonical);if(!St){const dt=h.get("text-radial-offset").evaluate(B,{},c.canonical);ae=dt?yC(ot,[dt*hi,hb]):h.get("text-offset").evaluate(B,{},c.canonical).map(lt=>lt*hi)}let nt=S?"center":h.get("text-justify").evaluate(B,{},c.canonical);const Qe=h.get("symbol-placement")==="point"?h.get("text-max-width").evaluate(B,{},c.canonical)*hi:1/0,yt=()=>{c.bucket.allowVerticalPlacement&&Od(ye)&&(Y.vertical=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Qe,k,ot,"left",Re,ae,u.ah.vertical,!0,j,R))};if(!S&&St){const dt=new Set;if(nt==="auto")for(let De=0;De<St.values.length;De+=2)dt.add(db(St.values[De]));else dt.add(nt);let lt=!1;for(const De of dt)if(!Y.horizontal[De])if(lt)Y.horizontal[De]=Y.horizontal[0];else{const bt=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Qe,k,"center",De,Re,ae,u.ah.horizontal,!1,j,R);bt&&(Y.horizontal[De]=bt,lt=bt.positionedLines.length===1)}yt()}else{nt==="auto"&&(nt=db(ot));const dt=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Qe,k,ot,nt,Re,ae,u.ah.horizontal,!1,j,R);dt&&(Y.horizontal[nt]=dt),yt(),Od(ye)&&S&&T&&(Y.vertical=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Qe,k,ot,nt,Re,ae,u.ah.vertical,!1,j,R))}}let be=!1;if(B.icon&&B.icon.name){const ye=c.imageMap[B.icon.name];ye&&(re=EG(c.imagePositions[B.icon.name],h.get("icon-offset").evaluate(B,{},c.canonical),h.get("icon-anchor").evaluate(B,{},c.canonical)),be=!!ye.sdf,c.bucket.sdfIcons===void 0?c.bucket.sdfIcons=be:c.bucket.sdfIcons!==be&&st("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ye.pixelRatio!==c.bucket.pixelRatio||h.get("icon-rotate").constantOr(1)!==0)&&(c.bucket.iconsNeedLinear=!0))}const pe=xC(Y.horizontal)||Y.vertical;c.bucket.iconsInText=!!pe&&pe.iconsInText,(pe||re)&&$G(c.bucket,B,Y,re,c.imageMap,_,j,q,ae,be,c.canonical)}c.showCollisionBoxes&&c.bucket.generateCollisionDebugBuffers()},u.bq=X_,u.br=G_,u.bs=Y_,u.bt=il,u.bu=J_,u.bv=class{constructor(c){this._marks={start:[c.url,"start"].join("#"),end:[c.url,"end"].join("#"),measure:c.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let c=performance.getEntriesByName(this._marks.measure);return c.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),c=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),c}},u.bw=function(c,s,h,p,_){return l(this,void 0,void 0,function*(){if(te())try{return yield Cn(c,s,h,p,_)}catch{}return function(k,S,T,A,B){const z=k.width,R=k.height;dn&&vn||(dn=new OffscreenCanvas(z,R),vn=dn.getContext("2d",{willReadFrequently:!0})),dn.width=z,dn.height=R,vn.drawImage(k,0,0,z,R);const j=vn.getImageData(S,T,A,B);return vn.clearRect(0,0,z,R),j.data}(c,s,h,p,_)})},u.bx=iC,u.by=g,u.bz=b,u.c=ti,u.d=c=>l(void 0,void 0,void 0,function*(){if(c.byteLength===0)return createImageBitmap(new ImageData(1,1));const s=new Blob([new Uint8Array(c)],{type:"image/png"});try{return createImageBitmap(s)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),u.e=Se,u.f=c=>new Promise((s,h)=>{const p=new Image;p.onload=()=>{s(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=Ht})},p.onerror=()=>h(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 _=new Blob([new Uint8Array(c)],{type:"image/png"});p.src=c.byteLength?URL.createObjectURL(_):Ht}),u.g=Pn,u.h=(c,s)=>Ke(Se(c,{type:"json"}),s),u.i=Nt,u.j=Mt,u.k=At,u.l=(c,s)=>Ke(Se(c,{type:"arrayBuffer"}),s),u.m=Ke,u.n=function(c){return new J_(c).readFields(_G,[])},u.o=jd,u.p=NE,u.q=v,u.r=C_,u.s=Be,u.t=Id,u.u=Ks,u.v=we,u.w=st,u.x=function([c,s,h]){return s+=90,s*=Math.PI/180,h*=Math.PI/180,{x:c*Math.cos(s)*Math.sin(h),y:c*Math.sin(s)*Math.sin(h),z:c*Math.cos(h)}},u.y=nr,u.z=Vn}),r("worker",["./shared"],function(u){class l{constructor(H){this.keyCache={},H&&this.replace(H)}replace(H){this._layerConfigs={},this._layers={},this.update(H,[])}update(H,U){for(const ie of H){this._layerConfigs[ie.id]=ie;const de=this._layers[ie.id]=u.aA(ie);de._featureFilter=u.a7(de.filter),this.keyCache[ie.id]&&delete this.keyCache[ie.id]}for(const ie of U)delete this.keyCache[ie],delete this._layerConfigs[ie],delete this._layers[ie];this.familiesBySource={};const X=u.bk(Object.values(this._layerConfigs),this.keyCache);for(const ie of X){const de=ie.map(Ee=>this._layers[Ee.id]),fe=de[0];if(fe.visibility==="none")continue;const _e=fe.source||"";let ue=this.familiesBySource[_e];ue||(ue=this.familiesBySource[_e]={});const Me=fe.sourceLayer||"_geojsonTileLayer";let ze=ue[Me];ze||(ze=ue[Me]=[]),ze.push(de)}}}class g{constructor(H){const U={},X=[];for(const _e in H){const ue=H[_e],Me=U[_e]={};for(const ze in ue){const Ee=ue[+ze];if(!Ee||Ee.bitmap.width===0||Ee.bitmap.height===0)continue;const We={x:0,y:0,w:Ee.bitmap.width+2,h:Ee.bitmap.height+2};X.push(We),Me[ze]={rect:We,metrics:Ee.metrics}}}const{w:ie,h:de}=u.p(X),fe=new u.o({width:ie||1,height:de||1});for(const _e in H){const ue=H[_e];for(const Me in ue){const ze=ue[+Me];if(!ze||ze.bitmap.width===0||ze.bitmap.height===0)continue;const Ee=U[_e][Me].rect;u.o.copy(ze.bitmap,fe,{x:0,y:0},{x:Ee.x+1,y:Ee.y+1},ze.bitmap)}}this.image=fe,this.positions=U}}u.bl("GlyphAtlas",g);class b{constructor(H){this.tileID=new u.S(H.tileID.overscaledZ,H.tileID.wrap,H.tileID.canonical.z,H.tileID.canonical.x,H.tileID.canonical.y),this.uid=H.uid,this.zoom=H.zoom,this.pixelRatio=H.pixelRatio,this.tileSize=H.tileSize,this.source=H.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=H.showCollisionBoxes,this.collectResourceTiming=!!H.collectResourceTiming,this.returnDependencies=!!H.returnDependencies,this.promoteId=H.promoteId,this.inFlightDependencies=[]}parse(H,U,X,ie){return u._(this,void 0,void 0,function*(){this.status="parsing",this.data=H,this.collisionBoxArray=new u.a5;const de=new u.bm(Object.keys(H.layers).sort()),fe=new u.bn(this.tileID,this.promoteId);fe.bucketLayerIDs=[];const _e={},ue={featureIndex:fe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:X},Me=U.familiesBySource[this.source];for(const Ut in Me){const wn=H.layers[Ut];if(!wn)continue;wn.version===1&&u.w(`Vector tile source "${this.source}" layer "${Ut}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const qn=de.encode(Ut),gi=[];for(let Si=0;Si<wn.length;Si++){const Wi=wn.feature(Si),Aa=fe.getId(Wi,Ut);gi.push({feature:Wi,id:Aa,index:Si,sourceLayerIndex:qn})}for(const Si of Me[Ut]){const Wi=Si[0];Wi.source!==this.source&&u.w(`layer.source = ${Wi.source} does not equal this.source = ${this.source}`),Wi.minzoom&&this.zoom<Math.floor(Wi.minzoom)||Wi.maxzoom&&this.zoom>=Wi.maxzoom||Wi.visibility!=="none"&&(w(Si,this.zoom,X),(_e[Wi.id]=Wi.createBucket({index:fe.bucketLayerIDs.length,layers:Si,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:qn,sourceID:this.source})).populate(gi,ue,this.tileID.canonical),fe.bucketLayerIDs.push(Si.map(Aa=>Aa.id)))}}const ze=u.aF(ue.glyphDependencies,Ut=>Object.keys(Ut).map(Number));this.inFlightDependencies.forEach(Ut=>Ut==null?void 0:Ut.abort()),this.inFlightDependencies=[];let Ee=Promise.resolve({});if(Object.keys(ze).length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),Ee=ie.sendAsync({type:"GG",data:{stacks:ze,source:this.source,tileID:this.tileID,type:"glyphs"}},Ut)}const We=Object.keys(ue.iconDependencies);let xt=Promise.resolve({});if(We.length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),xt=ie.sendAsync({type:"GI",data:{icons:We,source:this.source,tileID:this.tileID,type:"icons"}},Ut)}const kt=Object.keys(ue.patternDependencies);let an=Promise.resolve({});if(kt.length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),an=ie.sendAsync({type:"GI",data:{icons:kt,source:this.source,tileID:this.tileID,type:"patterns"}},Ut)}const[Lt,ln,Kt]=yield Promise.all([Ee,xt,an]),oi=new g(Lt),Zn=new u.bo(ln,Kt);for(const Ut in _e){const wn=_e[Ut];wn instanceof u.a6?(w(wn.layers,this.zoom,X),u.bp({bucket:wn,glyphMap:Lt,glyphPositions:oi.positions,imageMap:ln,imagePositions:Zn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):wn.hasPattern&&(wn instanceof u.bq||wn instanceof u.br||wn instanceof u.bs)&&(w(wn.layers,this.zoom,X),wn.addFeatures(ue,this.tileID.canonical,Zn.patternPositions))}return this.status="done",{buckets:Object.values(_e).filter(Ut=>!Ut.isEmpty()),featureIndex:fe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:oi.image,imageAtlas:Zn,glyphMap:this.returnDependencies?Lt:null,iconMap:this.returnDependencies?ln:null,glyphPositions:this.returnDependencies?oi.positions:null}})}}function w(se,H,U){const X=new u.z(H);for(const ie of se)ie.recalculate(X,U)}class E{constructor(H,U,X){this.actor=H,this.layerIndex=U,this.availableImages=X,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(H,U){return u._(this,void 0,void 0,function*(){const X=yield u.l(H.request,U);try{return{vectorTile:new u.bt.VectorTile(new u.bu(X.data)),rawData:X.data,cacheControl:X.cacheControl,expires:X.expires}}catch(ie){const de=new Uint8Array(X.data);let fe=`Unable to parse the tile at ${H.request.url}, `;throw fe+=de[0]===31&&de[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ie.message}`,new Error(fe)}})}loadTile(H){return u._(this,void 0,void 0,function*(){const U=H.uid,X=!!(H&&H.request&&H.request.collectResourceTiming)&&new u.bv(H.request),ie=new b(H);this.loading[U]=ie;const de=new AbortController;ie.abort=de;try{const fe=yield this.loadVectorTile(H,de);if(delete this.loading[U],!fe)return null;const _e=fe.rawData,ue={};fe.expires&&(ue.expires=fe.expires),fe.cacheControl&&(ue.cacheControl=fe.cacheControl);const Me={};if(X){const Ee=X.finish();Ee&&(Me.resourceTiming=JSON.parse(JSON.stringify(Ee)))}ie.vectorTile=fe.vectorTile;const ze=ie.parse(fe.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[U]=ie,this.fetching[U]={rawTileData:_e,cacheControl:ue,resourceTiming:Me};try{const Ee=yield ze;return u.e({rawTileData:_e.slice(0)},Ee,ue,Me)}finally{delete this.fetching[U]}}catch(fe){throw delete this.loading[U],ie.status="done",this.loaded[U]=ie,fe}})}reloadTile(H){return u._(this,void 0,void 0,function*(){const U=H.uid;if(!this.loaded||!this.loaded[U])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const X=this.loaded[U];if(X.showCollisionBoxes=H.showCollisionBoxes,X.status==="parsing"){const ie=yield X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor);let de;if(this.fetching[U]){const{rawTileData:fe,cacheControl:_e,resourceTiming:ue}=this.fetching[U];delete this.fetching[U],de=u.e({rawTileData:fe.slice(0)},ie,_e,ue)}else de=ie;return de}if(X.status==="done"&&X.vectorTile)return X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(H){return u._(this,void 0,void 0,function*(){const U=this.loading,X=H.uid;U&&U[X]&&U[X].abort&&(U[X].abort.abort(),delete U[X])})}removeTile(H){return u._(this,void 0,void 0,function*(){this.loaded&&this.loaded[H.uid]&&delete this.loaded[H.uid]})}}class C{constructor(){this.loaded={}}loadTile(H){return u._(this,void 0,void 0,function*(){const{uid:U,encoding:X,rawImageData:ie,redFactor:de,greenFactor:fe,blueFactor:_e,baseShift:ue}=H,Me=ie.width+2,ze=ie.height+2,Ee=u.b(ie)?new u.R({width:Me,height:ze},yield u.bw(ie,-1,-1,Me,ze)):ie,We=new u.bx(U,Ee,X,de,fe,_e,ue);return this.loaded=this.loaded||{},this.loaded[U]=We,We})}removeTile(H){const U=this.loaded,X=H.uid;U&&U[X]&&delete U[X]}}function I(se,H){if(se.length!==0){D(se[0],H);for(var U=1;U<se.length;U++)D(se[U],!H)}}function D(se,H){for(var U=0,X=0,ie=0,de=se.length,fe=de-1;ie<de;fe=ie++){var _e=(se[ie][0]-se[fe][0])*(se[fe][1]+se[ie][1]),ue=U+_e;X+=Math.abs(U)>=Math.abs(_e)?U-ue+_e:_e-ue+U,U=ue}U+X>=0!=!!H&&se.reverse()}var L=u.by(function se(H,U){var X,ie=H&&H.type;if(ie==="FeatureCollection")for(X=0;X<H.features.length;X++)se(H.features[X],U);else if(ie==="GeometryCollection")for(X=0;X<H.geometries.length;X++)se(H.geometries[X],U);else if(ie==="Feature")se(H.geometry,U);else if(ie==="Polygon")I(H.coordinates,U);else if(ie==="MultiPolygon")for(X=0;X<H.coordinates.length;X++)I(H.coordinates[X],U);return H});const $=u.bt.VectorTileFeature.prototype.toGeoJSON;var W={exports:{}},te=u.bz,G=u.bt.VectorTileFeature,Q=Ie;function Ie(se,H){this.options=H||{},this.features=se,this.length=se.length}function ve(se,H){this.id=typeof se.id=="number"?se.id:void 0,this.type=se.type,this.rawGeometry=se.type===1?[se.geometry]:se.geometry,this.properties=se.tags,this.extent=H||4096}Ie.prototype.feature=function(se){return new ve(this.features[se],this.options.extent)},ve.prototype.loadGeometry=function(){var se=this.rawGeometry;this.geometry=[];for(var H=0;H<se.length;H++){for(var U=se[H],X=[],ie=0;ie<U.length;ie++)X.push(new te(U[ie][0],U[ie][1]));this.geometry.push(X)}return this.geometry},ve.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var se=this.geometry,H=1/0,U=-1/0,X=1/0,ie=-1/0,de=0;de<se.length;de++)for(var fe=se[de],_e=0;_e<fe.length;_e++){var ue=fe[_e];H=Math.min(H,ue.x),U=Math.max(U,ue.x),X=Math.min(X,ue.y),ie=Math.max(ie,ue.y)}return[H,X,U,ie]},ve.prototype.toGeoJSON=G.prototype.toGeoJSON;var Se=u.bA,Ne=Q;function Ae(se){var H=new Se;return function(U,X){for(var ie in U.layers)X.writeMessage(3,$e,U.layers[ie])}(se,H),H.finish()}function $e(se,H){var U;H.writeVarintField(15,se.version||1),H.writeStringField(1,se.name||""),H.writeVarintField(5,se.extent||4096);var X={keys:[],values:[],keycache:{},valuecache:{}};for(U=0;U<se.length;U++)X.feature=se.feature(U),H.writeMessage(2,Xe,X);var ie=X.keys;for(U=0;U<ie.length;U++)H.writeStringField(3,ie[U]);var de=X.values;for(U=0;U<de.length;U++)H.writeMessage(4,Vt,de[U])}function Xe(se,H){var U=se.feature;U.id!==void 0&&H.writeVarintField(1,U.id),H.writeMessage(2,Pt,se),H.writeVarintField(3,U.type),H.writeMessage(4,Nt,U)}function Pt(se,H){var U=se.feature,X=se.keys,ie=se.values,de=se.keycache,fe=se.valuecache;for(var _e in U.properties){var ue=U.properties[_e],Me=de[_e];if(ue!==null){Me===void 0&&(X.push(_e),de[_e]=Me=X.length-1),H.writeVarint(Me);var ze=typeof ue;ze!=="string"&&ze!=="boolean"&&ze!=="number"&&(ue=JSON.stringify(ue));var Ee=ze+":"+ue,We=fe[Ee];We===void 0&&(ie.push(ue),fe[Ee]=We=ie.length-1),H.writeVarint(We)}}}function st(se,H){return(H<<3)+(7&se)}function Tt(se){return se<<1^se>>31}function Nt(se,H){for(var U=se.loadGeometry(),X=se.type,ie=0,de=0,fe=U.length,_e=0;_e<fe;_e++){var ue=U[_e],Me=1;X===1&&(Me=ue.length),H.writeVarint(st(1,Me));for(var ze=X===3?ue.length-1:ue.length,Ee=0;Ee<ze;Ee++){Ee===1&&X!==1&&H.writeVarint(st(2,ze-1));var We=ue[Ee].x-ie,xt=ue[Ee].y-de;H.writeVarint(Tt(We)),H.writeVarint(Tt(xt)),ie+=We,de+=xt}X===3&&H.writeVarint(st(7,1))}}function Vt(se,H){var U=typeof se;U==="string"?H.writeStringField(1,se):U==="boolean"?H.writeBooleanField(7,se):U==="number"&&(se%1!=0?H.writeDoubleField(3,se):se<0?H.writeSVarintField(6,se):H.writeVarintField(5,se))}W.exports=Ae,W.exports.fromVectorTileJs=Ae,W.exports.fromGeojsonVt=function(se,H){H=H||{};var U={};for(var X in se)U[X]=new Ne(se[X].features,H),U[X].name=X,U[X].version=H.version,U[X].extent=H.extent;return Ae({layers:U})},W.exports.GeoJSONWrapper=Ne;var Ft=u.by(W.exports);const Ht={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:se=>se},Cn=Math.fround||(dn=new Float32Array(1),se=>(dn[0]=+se,dn[0]));var dn;const vn=3,pn=5,ti=6;class Nn{constructor(H){this.options=Object.assign(Object.create(Ht),H),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(H){const{log:U,minZoom:X,maxZoom:ie}=this.options;U&&console.time("total time");const de=`prepare ${H.length} points`;U&&console.time(de),this.points=H;const fe=[];for(let ue=0;ue<H.length;ue++){const Me=H[ue];if(!Me.geometry)continue;const[ze,Ee]=Me.geometry.coordinates,We=Cn(Ce(ze)),xt=Cn(He(Ee));fe.push(We,xt,1/0,ue,-1,1),this.options.reduce&&fe.push(0)}let _e=this.trees[ie+1]=this._createTree(fe);U&&console.timeEnd(de);for(let ue=ie;ue>=X;ue--){const Me=+Date.now();_e=this.trees[ue]=this._createTree(this._cluster(_e,ue)),U&&console.log("z%d: %d clusters in %dms",ue,_e.numItems,+Date.now()-Me)}return U&&console.timeEnd("total time"),this}getClusters(H,U){let X=((H[0]+180)%360+360)%360-180;const ie=Math.max(-90,Math.min(90,H[1]));let de=H[2]===180?180:((H[2]+180)%360+360)%360-180;const fe=Math.max(-90,Math.min(90,H[3]));if(H[2]-H[0]>=360)X=-180,de=180;else if(X>de){const Ee=this.getClusters([X,ie,180,fe],U),We=this.getClusters([-180,ie,de,fe],U);return Ee.concat(We)}const _e=this.trees[this._limitZoom(U)],ue=_e.range(Ce(X),He(fe),Ce(de),He(ie)),Me=_e.data,ze=[];for(const Ee of ue){const We=this.stride*Ee;ze.push(Me[We+pn]>1?Pn(Me,We,this.clusterProps):this.points[Me[We+vn]])}return ze}getChildren(H){const U=this._getOriginId(H),X=this._getOriginZoom(H),ie="No cluster with the specified id.",de=this.trees[X];if(!de)throw new Error(ie);const fe=de.data;if(U*this.stride>=fe.length)throw new Error(ie);const _e=this.options.radius/(this.options.extent*Math.pow(2,X-1)),ue=de.within(fe[U*this.stride],fe[U*this.stride+1],_e),Me=[];for(const ze of ue){const Ee=ze*this.stride;fe[Ee+4]===H&&Me.push(fe[Ee+pn]>1?Pn(fe,Ee,this.clusterProps):this.points[fe[Ee+vn]])}if(Me.length===0)throw new Error(ie);return Me}getLeaves(H,U,X){const ie=[];return this._appendLeaves(ie,H,U=U||10,X=X||0,0),ie}getTile(H,U,X){const ie=this.trees[this._limitZoom(H)],de=Math.pow(2,H),{extent:fe,radius:_e}=this.options,ue=_e/fe,Me=(X-ue)/de,ze=(X+1+ue)/de,Ee={features:[]};return this._addTileFeatures(ie.range((U-ue)/de,Me,(U+1+ue)/de,ze),ie.data,U,X,de,Ee),U===0&&this._addTileFeatures(ie.range(1-ue/de,Me,1,ze),ie.data,de,X,de,Ee),U===de-1&&this._addTileFeatures(ie.range(0,Me,ue/de,ze),ie.data,-1,X,de,Ee),Ee.features.length?Ee:null}getClusterExpansionZoom(H){let U=this._getOriginZoom(H)-1;for(;U<=this.options.maxZoom;){const X=this.getChildren(H);if(U++,X.length!==1)break;H=X[0].properties.cluster_id}return U}_appendLeaves(H,U,X,ie,de){const fe=this.getChildren(U);for(const _e of fe){const ue=_e.properties;if(ue&&ue.cluster?de+ue.point_count<=ie?de+=ue.point_count:de=this._appendLeaves(H,ue.cluster_id,X,ie,de):de<ie?de++:H.push(_e),H.length===X)break}return de}_createTree(H){const U=new u.av(H.length/this.stride|0,this.options.nodeSize,Float32Array);for(let X=0;X<H.length;X+=this.stride)U.add(H[X],H[X+1]);return U.finish(),U.data=H,U}_addTileFeatures(H,U,X,ie,de,fe){for(const _e of H){const ue=_e*this.stride,Me=U[ue+pn]>1;let ze,Ee,We;if(Me)ze=Ln(U,ue,this.clusterProps),Ee=U[ue],We=U[ue+1];else{const an=this.points[U[ue+vn]];ze=an.properties;const[Lt,ln]=an.geometry.coordinates;Ee=Ce(Lt),We=He(ln)}const xt={type:1,geometry:[[Math.round(this.options.extent*(Ee*de-X)),Math.round(this.options.extent*(We*de-ie))]],tags:ze};let kt;kt=Me||this.options.generateId?U[ue+vn]:this.points[U[ue+vn]].id,kt!==void 0&&(xt.id=kt),fe.features.push(xt)}}_limitZoom(H){return Math.max(this.options.minZoom,Math.min(Math.floor(+H),this.options.maxZoom+1))}_cluster(H,U){const{radius:X,extent:ie,reduce:de,minPoints:fe}=this.options,_e=X/(ie*Math.pow(2,U)),ue=H.data,Me=[],ze=this.stride;for(let Ee=0;Ee<ue.length;Ee+=ze){if(ue[Ee+2]<=U)continue;ue[Ee+2]=U;const We=ue[Ee],xt=ue[Ee+1],kt=H.within(ue[Ee],ue[Ee+1],_e),an=ue[Ee+pn];let Lt=an;for(const ln of kt){const Kt=ln*ze;ue[Kt+2]>U&&(Lt+=ue[Kt+pn])}if(Lt>an&&Lt>=fe){let ln,Kt=We*an,oi=xt*an,Zn=-1;const Ut=((Ee/ze|0)<<5)+(U+1)+this.points.length;for(const wn of kt){const qn=wn*ze;if(ue[qn+2]<=U)continue;ue[qn+2]=U;const gi=ue[qn+pn];Kt+=ue[qn]*gi,oi+=ue[qn+1]*gi,ue[qn+4]=Ut,de&&(ln||(ln=this._map(ue,Ee,!0),Zn=this.clusterProps.length,this.clusterProps.push(ln)),de(ln,this._map(ue,qn)))}ue[Ee+4]=Ut,Me.push(Kt/Lt,oi/Lt,1/0,Ut,-1,Lt),de&&Me.push(Zn)}else{for(let ln=0;ln<ze;ln++)Me.push(ue[Ee+ln]);if(Lt>1)for(const ln of kt){const Kt=ln*ze;if(!(ue[Kt+2]<=U)){ue[Kt+2]=U;for(let oi=0;oi<ze;oi++)Me.push(ue[Kt+oi])}}}}return Me}_getOriginId(H){return H-this.points.length>>5}_getOriginZoom(H){return(H-this.points.length)%32}_map(H,U,X){if(H[U+pn]>1){const fe=this.clusterProps[H[U+ti]];return X?Object.assign({},fe):fe}const ie=this.points[H[U+vn]].properties,de=this.options.map(ie);return X&&de===ie?Object.assign({},de):de}}function Pn(se,H,U){return{type:"Feature",id:se[H+vn],properties:Ln(se,H,U),geometry:{type:"Point",coordinates:[(X=se[H],360*(X-.5)),Ke(se[H+1])]}};var X}function Ln(se,H,U){const X=se[H+pn],ie=X>=1e4?`${Math.round(X/1e3)}k`:X>=1e3?Math.round(X/100)/10+"k":X,de=se[H+ti],fe=de===-1?{}:Object.assign({},U[de]);return Object.assign(fe,{cluster:!0,cluster_id:se[H+vn],point_count:X,point_count_abbreviated:ie})}function Ce(se){return se/360+.5}function He(se){const H=Math.sin(se*Math.PI/180),U=.5-.25*Math.log((1+H)/(1-H))/Math.PI;return U<0?0:U>1?1:U}function Ke(se){const H=(180-360*se)*Math.PI/180;return 360*Math.atan(Math.exp(H))/Math.PI-90}function Be(se,H,U,X){let ie=X;const de=H+(U-H>>1);let fe,_e=U-H;const ue=se[H],Me=se[H+1],ze=se[U],Ee=se[U+1];for(let We=H+3;We<U;We+=3){const xt=Rt(se[We],se[We+1],ue,Me,ze,Ee);if(xt>ie)fe=We,ie=xt;else if(xt===ie){const kt=Math.abs(We-de);kt<_e&&(fe=We,_e=kt)}}ie>X&&(fe-H>3&&Be(se,H,fe,X),se[fe+2]=ie,U-fe>3&&Be(se,fe,U,X))}function Rt(se,H,U,X,ie,de){let fe=ie-U,_e=de-X;if(fe!==0||_e!==0){const ue=((se-U)*fe+(H-X)*_e)/(fe*fe+_e*_e);ue>1?(U=ie,X=de):ue>0&&(U+=fe*ue,X+=_e*ue)}return fe=se-U,_e=H-X,fe*fe+_e*_e}function Qt(se,H,U,X){const ie={id:se??null,type:H,geometry:U,tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(H==="Point"||H==="MultiPoint"||H==="LineString")At(ie,U);else if(H==="Polygon")At(ie,U[0]);else if(H==="MultiLineString")for(const de of U)At(ie,de);else if(H==="MultiPolygon")for(const de of U)At(ie,de[0]);return ie}function At(se,H){for(let U=0;U<H.length;U+=3)se.minX=Math.min(se.minX,H[U]),se.minY=Math.min(se.minY,H[U+1]),se.maxX=Math.max(se.maxX,H[U]),se.maxY=Math.max(se.maxY,H[U+1])}function Mt(se,H,U,X){if(!H.geometry)return;const ie=H.geometry.coordinates;if(ie&&ie.length===0)return;const de=H.geometry.type,fe=Math.pow(U.tolerance/((1<<U.maxZoom)*U.extent),2);let _e=[],ue=H.id;if(U.promoteId?ue=H.properties[U.promoteId]:U.generateId&&(ue=X||0),de==="Point")rn(ie,_e);else if(de==="MultiPoint")for(const Me of ie)rn(Me,_e);else if(de==="LineString")we(ie,_e,fe,!1);else if(de==="MultiLineString"){if(U.lineMetrics){for(const Me of ie)_e=[],we(Me,_e,fe,!1),se.push(Qt(ue,"LineString",_e,H.properties));return}yn(ie,_e,fe,!1)}else if(de==="Polygon")yn(ie,_e,fe,!0);else{if(de!=="MultiPolygon"){if(de==="GeometryCollection"){for(const Me of H.geometry.geometries)Mt(se,{id:ue,geometry:Me,properties:H.properties},U,X);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Me of ie){const ze=[];yn(Me,ze,fe,!0),_e.push(ze)}}se.push(Qt(ue,de,_e,H.properties))}function rn(se,H){H.push(pr(se[0]),qt(se[1]),0)}function we(se,H,U,X){let ie,de,fe=0;for(let ue=0;ue<se.length;ue++){const Me=pr(se[ue][0]),ze=qt(se[ue][1]);H.push(Me,ze,0),ue>0&&(fe+=X?(ie*ze-Me*de)/2:Math.sqrt(Math.pow(Me-ie,2)+Math.pow(ze-de,2))),ie=Me,de=ze}const _e=H.length-3;H[2]=1,Be(H,0,_e,U),H[_e+2]=1,H.size=Math.abs(fe),H.start=0,H.end=H.size}function yn(se,H,U,X){for(let ie=0;ie<se.length;ie++){const de=[];we(se[ie],de,U,X),H.push(de)}}function pr(se){return se/360+.5}function qt(se){const H=Math.sin(se*Math.PI/180),U=.5-.25*Math.log((1+H)/(1-H))/Math.PI;return U<0?0:U>1?1:U}function sn(se,H,U,X,ie,de,fe,_e){if(X/=H,de>=(U/=H)&&fe<X)return se;if(fe<U||de>=X)return null;const ue=[];for(const Me of se){const ze=Me.geometry;let Ee=Me.type;const We=ie===0?Me.minX:Me.minY,xt=ie===0?Me.maxX:Me.maxY;if(We>=U&&xt<X){ue.push(Me);continue}if(xt<U||We>=X)continue;let kt=[];if(Ee==="Point"||Ee==="MultiPoint")vi(ze,kt,U,X,ie);else if(Ee==="LineString")ui(ze,kt,U,X,ie,!1,_e.lineMetrics);else if(Ee==="MultiLineString")Or(ze,kt,U,X,ie,!1);else if(Ee==="Polygon")Or(ze,kt,U,X,ie,!0);else if(Ee==="MultiPolygon")for(const an of ze){const Lt=[];Or(an,Lt,U,X,ie,!0),Lt.length&&kt.push(Lt)}if(kt.length){if(_e.lineMetrics&&Ee==="LineString"){for(const an of kt)ue.push(Qt(Me.id,Ee,an,Me.tags));continue}Ee!=="LineString"&&Ee!=="MultiLineString"||(kt.length===1?(Ee="LineString",kt=kt[0]):Ee="MultiLineString"),Ee!=="Point"&&Ee!=="MultiPoint"||(Ee=kt.length===3?"Point":"MultiPoint"),ue.push(Qt(Me.id,Ee,kt,Me.tags))}}return ue.length?ue:null}function vi(se,H,U,X,ie){for(let de=0;de<se.length;de+=3){const fe=se[de+ie];fe>=U&&fe<=X&&wi(H,se[de],se[de+1],se[de+2])}}function ui(se,H,U,X,ie,de,fe){let _e=mi(se);const ue=ie===0?Eo:Co;let Me,ze,Ee=se.start;for(let Lt=0;Lt<se.length-3;Lt+=3){const ln=se[Lt],Kt=se[Lt+1],oi=se[Lt+2],Zn=se[Lt+3],Ut=se[Lt+4],wn=ie===0?ln:Kt,qn=ie===0?Zn:Ut;let gi=!1;fe&&(Me=Math.sqrt(Math.pow(ln-Zn,2)+Math.pow(Kt-Ut,2))),wn<U?qn>U&&(ze=ue(_e,ln,Kt,Zn,Ut,U),fe&&(_e.start=Ee+Me*ze)):wn>X?qn<X&&(ze=ue(_e,ln,Kt,Zn,Ut,X),fe&&(_e.start=Ee+Me*ze)):wi(_e,ln,Kt,oi),qn<U&&wn>=U&&(ze=ue(_e,ln,Kt,Zn,Ut,U),gi=!0),qn>X&&wn<=X&&(ze=ue(_e,ln,Kt,Zn,Ut,X),gi=!0),!de&&gi&&(fe&&(_e.end=Ee+Me*ze),H.push(_e),_e=mi(se)),fe&&(Ee+=Me)}let We=se.length-3;const xt=se[We],kt=se[We+1],an=ie===0?xt:kt;an>=U&&an<=X&&wi(_e,xt,kt,se[We+2]),We=_e.length-3,de&&We>=3&&(_e[We]!==_e[0]||_e[We+1]!==_e[1])&&wi(_e,_e[0],_e[1],_e[2]),_e.length&&H.push(_e)}function mi(se){const H=[];return H.size=se.size,H.start=se.start,H.end=se.end,H}function Or(se,H,U,X,ie,de){for(const fe of se)ui(fe,H,U,X,ie,de,!1)}function wi(se,H,U,X){se.push(H,U,X)}function Eo(se,H,U,X,ie,de){const fe=(de-H)/(X-H);return wi(se,de,U+(ie-U)*fe,1),fe}function Co(se,H,U,X,ie,de){const fe=(de-U)/(ie-U);return wi(se,H+(X-H)*fe,de,1),fe}function Ve(se,H){const U=[];for(let X=0;X<se.length;X++){const ie=se[X],de=ie.type;let fe;if(de==="Point"||de==="MultiPoint"||de==="LineString")fe=Br(ie.geometry,H);else if(de==="MultiLineString"||de==="Polygon"){fe=[];for(const _e of ie.geometry)fe.push(Br(_e,H))}else if(de==="MultiPolygon"){fe=[];for(const _e of ie.geometry){const ue=[];for(const Me of _e)ue.push(Br(Me,H));fe.push(ue)}}U.push(Qt(ie.id,de,fe,ie.tags))}return U}function Br(se,H){const U=[];U.size=se.size,se.start!==void 0&&(U.start=se.start,U.end=se.end);for(let X=0;X<se.length;X+=3)U.push(se[X]+H,se[X+1],se[X+2]);return U}function ki(se,H){if(se.transformed)return se;const U=1<<se.z,X=se.x,ie=se.y;for(const de of se.features){const fe=de.geometry,_e=de.type;if(de.geometry=[],_e===1)for(let ue=0;ue<fe.length;ue+=2)de.geometry.push(zr(fe[ue],fe[ue+1],H,U,X,ie));else for(let ue=0;ue<fe.length;ue++){const Me=[];for(let ze=0;ze<fe[ue].length;ze+=2)Me.push(zr(fe[ue][ze],fe[ue][ze+1],H,U,X,ie));de.geometry.push(Me)}}return se.transformed=!0,se}function zr(se,H,U,X,ie,de){return[Math.round(U*(se*X-ie)),Math.round(U*(H*X-de))]}function To(se,H,U,X,ie){const de=H===ie.maxZoom?0:ie.tolerance/((1<<H)*ie.extent),fe={features:[],numPoints:0,numSimplified:0,numFeatures:se.length,source:null,x:U,y:X,z:H,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const _e of se)Ze(fe,_e,de,ie);return fe}function Ze(se,H,U,X){const ie=H.geometry,de=H.type,fe=[];if(se.minX=Math.min(se.minX,H.minX),se.minY=Math.min(se.minY,H.minY),se.maxX=Math.max(se.maxX,H.maxX),se.maxY=Math.max(se.maxY,H.maxY),de==="Point"||de==="MultiPoint")for(let _e=0;_e<ie.length;_e+=3)fe.push(ie[_e],ie[_e+1]),se.numPoints++,se.numSimplified++;else if(de==="LineString")ke(fe,ie,se,U,!1,!1);else if(de==="MultiLineString"||de==="Polygon")for(let _e=0;_e<ie.length;_e++)ke(fe,ie[_e],se,U,de==="Polygon",_e===0);else if(de==="MultiPolygon")for(let _e=0;_e<ie.length;_e++){const ue=ie[_e];for(let Me=0;Me<ue.length;Me++)ke(fe,ue[Me],se,U,!0,Me===0)}if(fe.length){let _e=H.tags||null;if(de==="LineString"&&X.lineMetrics){_e={};for(const Me in H.tags)_e[Me]=H.tags[Me];_e.mapbox_clip_start=ie.start/ie.size,_e.mapbox_clip_end=ie.end/ie.size}const ue={geometry:fe,type:de==="Polygon"||de==="MultiPolygon"?3:de==="LineString"||de==="MultiLineString"?2:1,tags:_e};H.id!==null&&(ue.id=H.id),se.features.push(ue)}}function ke(se,H,U,X,ie,de){const fe=X*X;if(X>0&&H.size<(ie?fe:X))return void(U.numPoints+=H.length/3);const _e=[];for(let ue=0;ue<H.length;ue+=3)(X===0||H[ue+2]>fe)&&(U.numSimplified++,_e.push(H[ue],H[ue+1])),U.numPoints++;ie&&function(ue,Me){let ze=0;for(let Ee=0,We=ue.length,xt=We-2;Ee<We;xt=Ee,Ee+=2)ze+=(ue[Ee]-ue[xt])*(ue[Ee+1]+ue[xt+1]);if(ze>0===Me)for(let Ee=0,We=ue.length;Ee<We/2;Ee+=2){const xt=ue[Ee],kt=ue[Ee+1];ue[Ee]=ue[We-2-Ee],ue[Ee+1]=ue[We-1-Ee],ue[We-2-Ee]=xt,ue[We-1-Ee]=kt}}(_e,de),se.push(_e)}const Le={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class vt{constructor(H,U){const X=(U=this.options=function(de,fe){for(const _e in fe)de[_e]=fe[_e];return de}(Object.create(Le),U)).debug;if(X&&console.time("preprocess data"),U.maxZoom<0||U.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(U.promoteId&&U.generateId)throw new Error("promoteId and generateId cannot be used together.");let ie=function(de,fe){const _e=[];if(de.type==="FeatureCollection")for(let ue=0;ue<de.features.length;ue++)Mt(_e,de.features[ue],fe,ue);else Mt(_e,de.type==="Feature"?de:{geometry:de},fe);return _e}(H,U);this.tiles={},this.tileCoords=[],X&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",U.indexMaxZoom,U.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ie=function(de,fe){const _e=fe.buffer/fe.extent;let ue=de;const Me=sn(de,1,-1-_e,_e,0,-1,2,fe),ze=sn(de,1,1-_e,2+_e,0,-1,2,fe);return(Me||ze)&&(ue=sn(de,1,-_e,1+_e,0,-1,2,fe)||[],Me&&(ue=Ve(Me,1).concat(ue)),ze&&(ue=ue.concat(Ve(ze,-1)))),ue}(ie,U),ie.length&&this.splitTile(ie,0,0,0),X&&(ie.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(H,U,X,ie,de,fe,_e){const ue=[H,U,X,ie],Me=this.options,ze=Me.debug;for(;ue.length;){ie=ue.pop(),X=ue.pop(),U=ue.pop(),H=ue.pop();const Ee=1<<U,We=Wt(U,X,ie);let xt=this.tiles[We];if(!xt&&(ze>1&&console.time("creation"),xt=this.tiles[We]=To(H,U,X,ie,Me),this.tileCoords.push({z:U,x:X,y:ie}),ze)){ze>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",U,X,ie,xt.numFeatures,xt.numPoints,xt.numSimplified),console.timeEnd("creation"));const gi=`z${U}`;this.stats[gi]=(this.stats[gi]||0)+1,this.total++}if(xt.source=H,de==null){if(U===Me.indexMaxZoom||xt.numPoints<=Me.indexMaxPoints)continue}else{if(U===Me.maxZoom||U===de)continue;if(de!=null){const gi=de-U;if(X!==fe>>gi||ie!==_e>>gi)continue}}if(xt.source=null,H.length===0)continue;ze>1&&console.time("clipping");const kt=.5*Me.buffer/Me.extent,an=.5-kt,Lt=.5+kt,ln=1+kt;let Kt=null,oi=null,Zn=null,Ut=null,wn=sn(H,Ee,X-kt,X+Lt,0,xt.minX,xt.maxX,Me),qn=sn(H,Ee,X+an,X+ln,0,xt.minX,xt.maxX,Me);H=null,wn&&(Kt=sn(wn,Ee,ie-kt,ie+Lt,1,xt.minY,xt.maxY,Me),oi=sn(wn,Ee,ie+an,ie+ln,1,xt.minY,xt.maxY,Me),wn=null),qn&&(Zn=sn(qn,Ee,ie-kt,ie+Lt,1,xt.minY,xt.maxY,Me),Ut=sn(qn,Ee,ie+an,ie+ln,1,xt.minY,xt.maxY,Me),qn=null),ze>1&&console.timeEnd("clipping"),ue.push(Kt||[],U+1,2*X,2*ie),ue.push(oi||[],U+1,2*X,2*ie+1),ue.push(Zn||[],U+1,2*X+1,2*ie),ue.push(Ut||[],U+1,2*X+1,2*ie+1)}}getTile(H,U,X){H=+H,U=+U,X=+X;const ie=this.options,{extent:de,debug:fe}=ie;if(H<0||H>24)return null;const _e=1<<H,ue=Wt(H,U=U+_e&_e-1,X);if(this.tiles[ue])return ki(this.tiles[ue],de);fe>1&&console.log("drilling down to z%d-%d-%d",H,U,X);let Me,ze=H,Ee=U,We=X;for(;!Me&&ze>0;)ze--,Ee>>=1,We>>=1,Me=this.tiles[Wt(ze,Ee,We)];return Me&&Me.source?(fe>1&&(console.log("found parent tile z%d-%d-%d",ze,Ee,We),console.time("drilling down")),this.splitTile(Me.source,ze,Ee,We,H,U,X),fe>1&&console.timeEnd("drilling down"),this.tiles[ue]?ki(this.tiles[ue],de):null):null}}function Wt(se,H,U){return 32*((1<<se)*U+H)+se}function tt(se,H){return H?se.properties[H]:se.id}function Rn(se,H){if(se==null)return!0;if(se.type==="Feature")return tt(se,H)!=null;if(se.type==="FeatureCollection"){const U=new Set;for(const X of se.features){const ie=tt(X,H);if(ie==null||U.has(ie))return!1;U.add(ie)}return!0}return!1}function Kn(se,H){const U=new Map;if(se!=null)if(se.type==="Feature")U.set(tt(se,H),se);else for(const X of se.features)U.set(tt(X,H),X);return U}class qi extends E{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(H,U){return u._(this,void 0,void 0,function*(){const X=H.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ie=this._geoJSONIndex.getTile(X.z,X.x,X.y);if(!ie)return null;const de=new class{constructor(_e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=u.X,this.length=_e.length,this._features=_e}feature(_e){return new class{constructor(ue){this._feature=ue,this.extent=u.X,this.type=ue.type,this.properties=ue.tags,"id"in ue&&!isNaN(ue.id)&&(this.id=parseInt(ue.id,10))}loadGeometry(){if(this._feature.type===1){const ue=[];for(const Me of this._feature.geometry)ue.push([new u.P(Me[0],Me[1])]);return ue}{const ue=[];for(const Me of this._feature.geometry){const ze=[];for(const Ee of Me)ze.push(new u.P(Ee[0],Ee[1]));ue.push(ze)}return ue}}toGeoJSON(ue,Me,ze){return $.call(this,ue,Me,ze)}}(this._features[_e])}}(ie.features);let fe=Ft(de);return fe.byteOffset===0&&fe.byteLength===fe.buffer.byteLength||(fe=new Uint8Array(fe)),{vectorTile:de,rawData:fe.buffer}})}loadData(H){return u._(this,void 0,void 0,function*(){var U;(U=this._pendingRequest)===null||U===void 0||U.abort();const X=!!(H&&H.request&&H.request.collectResourceTiming)&&new u.bv(H.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(H,this._pendingRequest),this._geoJSONIndex=H.cluster?new Nn(function({superclusterOptions:fe,clusterProperties:_e}){if(!_e||!fe)return fe;const ue={},Me={},ze={accumulated:null,zoom:0},Ee={properties:null},We=Object.keys(_e);for(const xt of We){const[kt,an]=_e[xt],Lt=u.bC(an),ln=u.bC(typeof kt=="string"?[kt,["accumulated"],["get",xt]]:kt);ue[xt]=Lt.value,Me[xt]=ln.value}return fe.map=xt=>{Ee.properties=xt;const kt={};for(const an of We)kt[an]=ue[an].evaluate(ze,Ee);return kt},fe.reduce=(xt,kt)=>{Ee.properties=kt;for(const an of We)ze.accumulated=xt[an],xt[an]=Me[an].evaluate(ze,Ee)},fe}(H)).load((yield this._pendingData).features):(ie=yield this._pendingData,new vt(ie,H.geojsonVtOptions)),this.loaded={};const de={};if(X){const fe=X.finish();fe&&(de.resourceTiming={},de.resourceTiming[H.source]=JSON.parse(JSON.stringify(fe)))}return de}catch(de){if(delete this._pendingRequest,u.bB(de))return{abandoned:!0};throw de}var ie})}getData(){return u._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(H){const U=this.loaded;return U&&U[H.uid]?super.reloadTile(H):this.loadTile(H)}loadAndProcessGeoJSON(H,U){return u._(this,void 0,void 0,function*(){let X=yield this.loadGeoJSON(H,U);if(delete this._pendingRequest,typeof X!="object")throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(L(X,!0),H.filter){const ie=u.bC(H.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ie.result==="error")throw new Error(ie.value.map(fe=>`${fe.key}: ${fe.message}`).join(", "));X={type:"FeatureCollection",features:X.features.filter(fe=>ie.value.evaluate({zoom:0},fe))}}return X})}loadGeoJSON(H,U){return u._(this,void 0,void 0,function*(){const{promoteId:X}=H;if(H.request){const ie=yield u.h(H.request,U);return this._dataUpdateable=Rn(ie.data,X)?Kn(ie.data,X):void 0,ie.data}if(typeof H.data=="string")try{const ie=JSON.parse(H.data);return this._dataUpdateable=Rn(ie,X)?Kn(ie,X):void 0,ie}catch{throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`)}if(!H.dataDiff)throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${H.source}`);return function(ie,de,fe){var _e,ue,Me,ze;if(de.removeAll&&ie.clear(),de.remove)for(const Ee of de.remove)ie.delete(Ee);if(de.add)for(const Ee of de.add){const We=tt(Ee,fe);We!=null&&ie.set(We,Ee)}if(de.update)for(const Ee of de.update){let We=ie.get(Ee.id);if(We==null)continue;const xt=!Ee.removeAllProperties&&(((_e=Ee.removeProperties)===null||_e===void 0?void 0:_e.length)>0||((ue=Ee.addOrUpdateProperties)===null||ue===void 0?void 0:ue.length)>0);if((Ee.newGeometry||Ee.removeAllProperties||xt)&&(We=Object.assign({},We),ie.set(Ee.id,We),xt&&(We.properties=Object.assign({},We.properties))),Ee.newGeometry&&(We.geometry=Ee.newGeometry),Ee.removeAllProperties)We.properties={};else if(((Me=Ee.removeProperties)===null||Me===void 0?void 0:Me.length)>0)for(const kt of Ee.removeProperties)Object.prototype.hasOwnProperty.call(We.properties,kt)&&delete We.properties[kt];if(((ze=Ee.addOrUpdateProperties)===null||ze===void 0?void 0:ze.length)>0)for(const{key:kt,value:an}of Ee.addOrUpdateProperties)We.properties[kt]=an}}(this._dataUpdateable,H.dataDiff,X),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(H){return u._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(H){return this._geoJSONIndex.getClusterExpansionZoom(H.clusterId)}getClusterChildren(H){return this._geoJSONIndex.getChildren(H.clusterId)}getClusterLeaves(H){return this._geoJSONIndex.getLeaves(H.clusterId,H.limit,H.offset)}}class fr{constructor(H){this.self=H,this.actor=new u.F(H),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(U,X)=>{if(this.externalWorkerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.externalWorkerSourceTypes[U]=X},this.self.addProtocol=u.bi,this.self.removeProtocol=u.bj,this.self.registerRTLTextPlugin=U=>{if(u.bD.isParsed())throw new Error("RTL text plugin already registered.");u.bD.setMethods(U)},this.actor.registerMessageHandler("LDT",(U,X)=>this._getDEMWorkerSource(U,X.source).loadTile(X)),this.actor.registerMessageHandler("RDT",(U,X)=>u._(this,void 0,void 0,function*(){this._getDEMWorkerSource(U,X.source).removeTile(X)})),this.actor.registerMessageHandler("GCEZ",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterExpansionZoom(X)})),this.actor.registerMessageHandler("GCC",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterChildren(X)})),this.actor.registerMessageHandler("GCL",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterLeaves(X)})),this.actor.registerMessageHandler("LD",(U,X)=>this._getWorkerSource(U,X.type,X.source).loadData(X)),this.actor.registerMessageHandler("GD",(U,X)=>this._getWorkerSource(U,X.type,X.source).getData()),this.actor.registerMessageHandler("LT",(U,X)=>this._getWorkerSource(U,X.type,X.source).loadTile(X)),this.actor.registerMessageHandler("RT",(U,X)=>this._getWorkerSource(U,X.type,X.source).reloadTile(X)),this.actor.registerMessageHandler("AT",(U,X)=>this._getWorkerSource(U,X.type,X.source).abortTile(X)),this.actor.registerMessageHandler("RMT",(U,X)=>this._getWorkerSource(U,X.type,X.source).removeTile(X)),this.actor.registerMessageHandler("RS",(U,X)=>u._(this,void 0,void 0,function*(){if(!this.workerSources[U]||!this.workerSources[U][X.type]||!this.workerSources[U][X.type][X.source])return;const ie=this.workerSources[U][X.type][X.source];delete this.workerSources[U][X.type][X.source],ie.removeSource!==void 0&&ie.removeSource(X)})),this.actor.registerMessageHandler("RM",U=>u._(this,void 0,void 0,function*(){delete this.layerIndexes[U],delete this.availableImages[U],delete this.workerSources[U],delete this.demWorkerSources[U]})),this.actor.registerMessageHandler("SR",(U,X)=>u._(this,void 0,void 0,function*(){this.referrer=X})),this.actor.registerMessageHandler("SRPS",(U,X)=>this._syncRTLPluginState(U,X)),this.actor.registerMessageHandler("IS",(U,X)=>u._(this,void 0,void 0,function*(){this.self.importScripts(X)})),this.actor.registerMessageHandler("SI",(U,X)=>this._setImages(U,X)),this.actor.registerMessageHandler("UL",(U,X)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(U).update(X.layers,X.removedIds)})),this.actor.registerMessageHandler("SL",(U,X)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(U).replace(X)}))}_setImages(H,U){return u._(this,void 0,void 0,function*(){this.availableImages[H]=U;for(const X in this.workerSources[H]){const ie=this.workerSources[H][X];for(const de in ie)ie[de].availableImages=U}})}_syncRTLPluginState(H,U){return u._(this,void 0,void 0,function*(){if(u.bD.isParsed())return u.bD.getState();if(U.pluginStatus!=="loading")return u.bD.setState(U),U;const X=U.pluginURL;if(this.self.importScripts(X),u.bD.isParsed()){const ie={pluginStatus:"loaded",pluginURL:X};return u.bD.setState(ie),ie}throw u.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${X}`)})}_getAvailableImages(H){let U=this.availableImages[H];return U||(U=[]),U}_getLayerIndex(H){let U=this.layerIndexes[H];return U||(U=this.layerIndexes[H]=new l),U}_getWorkerSource(H,U,X){if(this.workerSources[H]||(this.workerSources[H]={}),this.workerSources[H][U]||(this.workerSources[H][U]={}),!this.workerSources[H][U][X]){const ie={sendAsync:(de,fe)=>(de.targetMapId=H,this.actor.sendAsync(de,fe))};switch(U){case"vector":this.workerSources[H][U][X]=new E(ie,this._getLayerIndex(H),this._getAvailableImages(H));break;case"geojson":this.workerSources[H][U][X]=new qi(ie,this._getLayerIndex(H),this._getAvailableImages(H));break;default:this.workerSources[H][U][X]=new this.externalWorkerSourceTypes[U](ie,this._getLayerIndex(H),this._getAvailableImages(H))}}return this.workerSources[H][U][X]}_getDEMWorkerSource(H,U){return this.demWorkerSources[H]||(this.demWorkerSources[H]={}),this.demWorkerSources[H][U]||(this.demWorkerSources[H][U]=new C),this.demWorkerSources[H][U]}}return u.i(self)&&(self.worker=new fr(self)),fr}),r("index",["exports","./shared"],function(u,l){var g="4.7.1";let b,w;const E={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:v=>new Promise((o,d)=>{const m=requestAnimationFrame(o);v.signal.addEventListener("abort",()=>{cancelAnimationFrame(m),d(l.c())})}),getImageData(v,o=0){return this.getImageCanvasContext(v).getImageData(-o,-o,v.width+2*o,v.height+2*o)},getImageCanvasContext(v){const o=window.document.createElement("canvas"),d=o.getContext("2d",{willReadFrequently:!0});if(!d)throw new Error("failed to create canvas 2d context");return o.width=v.width,o.height=v.height,d.drawImage(v,0,0,v.width,v.height),d},resolveURL:v=>(b||(b=document.createElement("a")),b.href=v,b.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(w==null&&(w=matchMedia("(prefers-reduced-motion: reduce)")),w.matches)}};class C{static testProp(o){if(!C.docStyle)return o[0];for(let d=0;d<o.length;d++)if(o[d]in C.docStyle)return o[d];return o[0]}static create(o,d,m){const y=window.document.createElement(o);return d!==void 0&&(y.className=d),m&&m.appendChild(y),y}static createNS(o,d){return window.document.createElementNS(o,d)}static disableDrag(){C.docStyle&&C.selectProp&&(C.userSelect=C.docStyle[C.selectProp],C.docStyle[C.selectProp]="none")}static enableDrag(){C.docStyle&&C.selectProp&&(C.docStyle[C.selectProp]=C.userSelect)}static setTransform(o,d){o.style[C.transformProp]=d}static addEventListener(o,d,m,y={}){o.addEventListener(d,m,"passive"in y?y:y.capture)}static removeEventListener(o,d,m,y={}){o.removeEventListener(d,m,"passive"in y?y:y.capture)}static suppressClickInternal(o){o.preventDefault(),o.stopPropagation(),window.removeEventListener("click",C.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",C.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",C.suppressClickInternal,!0)},0)}static getScale(o){const d=o.getBoundingClientRect();return{x:d.width/o.offsetWidth||1,y:d.height/o.offsetHeight||1,boundingClientRect:d}}static getPoint(o,d,m){const y=d.boundingClientRect;return new l.P((m.clientX-y.left)/d.x-o.clientLeft,(m.clientY-y.top)/d.y-o.clientTop)}static mousePos(o,d){const m=C.getScale(o);return C.getPoint(o,m,d)}static touchPos(o,d){const m=[],y=C.getScale(o);for(let x=0;x<d.length;x++)m.push(C.getPoint(o,y,d[x]));return m}static mouseButton(o){return o.button}static remove(o){o.parentNode&&o.parentNode.removeChild(o)}}C.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,C.selectProp=C.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),C.transformProp=C.testProp(["transform","WebkitTransform"]);const I={supported:!1,testSupport:function(v){!$&&L&&(W?te(v):D=v)}};let D,L,$=!1,W=!1;function te(v){const o=v.createTexture();v.bindTexture(v.TEXTURE_2D,o);try{if(v.texImage2D(v.TEXTURE_2D,0,v.RGBA,v.RGBA,v.UNSIGNED_BYTE,L),v.isContextLost())return;I.supported=!0}catch{}v.deleteTexture(o),$=!0}var G;typeof document<"u"&&(L=document.createElement("img"),L.onload=()=>{D&&te(D),D=null,W=!0},L.onerror=()=>{$=!0,D=null},L.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(v){let o,d,m,y;v.resetRequestQueue=()=>{o=[],d=0,m=0,y={}},v.addThrottleControl=O=>{const N=m++;return y[N]=O,N},v.removeThrottleControl=O=>{delete y[O],M()},v.getImage=(O,N,V=!0)=>new Promise((F,Z)=>{I.supported&&(O.headers||(O.headers={}),O.headers.accept="image/webp,*/*"),l.e(O,{type:"image"}),o.push({abortController:N,requestParameters:O,supportImageRefresh:V,state:"queued",onError:J=>{Z(J)},onSuccess:J=>{F(J)}}),M()});const x=O=>l._(this,void 0,void 0,function*(){O.state="running";const{requestParameters:N,supportImageRefresh:V,onError:F,onSuccess:Z,abortController:J}=O,ee=V===!1&&!l.i(self)&&!l.g(N.url)&&(!N.headers||Object.keys(N.headers).reduce((ce,he)=>ce&&he==="accept",!0));d++;const oe=ee?P(N,J):l.m(N,J);try{const ce=yield oe;delete O.abortController,O.state="completed",ce.data instanceof HTMLImageElement||l.b(ce.data)?Z(ce):ce.data&&Z({data:yield(le=ce.data,typeof createImageBitmap=="function"?l.d(le):l.f(le)),cacheControl:ce.cacheControl,expires:ce.expires})}catch(ce){delete O.abortController,F(ce)}finally{d--,M()}var le}),M=()=>{const O=(()=>{for(const N of Object.keys(y))if(y[N]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let N=d;N<O&&o.length>0;N++){const V=o.shift();V.abortController.signal.aborted?N--:x(V)}},P=(O,N)=>new Promise((V,F)=>{const Z=new Image,J=O.url,ee=O.credentials;ee&&ee==="include"?Z.crossOrigin="use-credentials":(ee&&ee==="same-origin"||!l.s(J))&&(Z.crossOrigin="anonymous"),N.signal.addEventListener("abort",()=>{Z.src="",F(l.c())}),Z.fetchPriority="high",Z.onload=()=>{Z.onerror=Z.onload=null,V({data:Z})},Z.onerror=()=>{Z.onerror=Z.onload=null,N.signal.aborted||F(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."))},Z.src=J})}(G||(G={})),G.resetRequestQueue();class Q{constructor(o){this._transformRequestFn=o}transformRequest(o,d){return this._transformRequestFn&&this._transformRequestFn(o,d)||{url:o}}setTransformRequest(o){this._transformRequestFn=o}}function Ie(v){var o=new l.A(3);return o[0]=v[0],o[1]=v[1],o[2]=v[2],o}var ve,Se=function(v,o,d){return v[0]=o[0]-d[0],v[1]=o[1]-d[1],v[2]=o[2]-d[2],v};ve=new l.A(3),l.A!=Float32Array&&(ve[0]=0,ve[1]=0,ve[2]=0);var Ne=function(v){var o=v[0],d=v[1];return o*o+d*d};function Ae(v){const o=[];if(typeof v=="string")o.push({id:"default",url:v});else if(v&&v.length>0){const d=[];for(const{id:m,url:y}of v){const x=`${m}${y}`;d.indexOf(x)===-1&&(d.push(x),o.push({id:m,url:y}))}}return o}function $e(v,o,d){const m=v.split("?");return m[0]+=`${o}${d}`,m.join("?")}(function(){var v=new l.A(2);l.A!=Float32Array&&(v[0]=0,v[1]=0)})();class Xe{constructor(o,d,m,y){this.context=o,this.format=m,this.texture=o.gl.createTexture(),this.update(d,y)}update(o,d,m){const{width:y,height:x}=o,M=!(this.size&&this.size[0]===y&&this.size[1]===x||m),{context:P}=this,{gl:O}=P;if(this.useMipmap=!!(d&&d.useMipmap),O.bindTexture(O.TEXTURE_2D,this.texture),P.pixelStoreUnpackFlipY.set(!1),P.pixelStoreUnpack.set(1),P.pixelStoreUnpackPremultiplyAlpha.set(this.format===O.RGBA&&(!d||d.premultiply!==!1)),M)this.size=[y,x],o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||l.b(o)?O.texImage2D(O.TEXTURE_2D,0,this.format,this.format,O.UNSIGNED_BYTE,o):O.texImage2D(O.TEXTURE_2D,0,this.format,y,x,0,this.format,O.UNSIGNED_BYTE,o.data);else{const{x:N,y:V}=m||{x:0,y:0};o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||l.b(o)?O.texSubImage2D(O.TEXTURE_2D,0,N,V,O.RGBA,O.UNSIGNED_BYTE,o):O.texSubImage2D(O.TEXTURE_2D,0,N,V,y,x,O.RGBA,O.UNSIGNED_BYTE,o.data)}this.useMipmap&&this.isSizePowerOfTwo()&&O.generateMipmap(O.TEXTURE_2D)}bind(o,d,m){const{context:y}=this,{gl:x}=y;x.bindTexture(x.TEXTURE_2D,this.texture),m!==x.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(m=x.LINEAR),o!==this.filter&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,o),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,m||o),this.filter=o),d!==this.wrap&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,d),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,d),this.wrap=d)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:o}=this.context;o.deleteTexture(this.texture),this.texture=null}}function Pt(v){const{userImage:o}=v;return!!(o&&o.render&&o.render())&&(v.data.replace(new Uint8Array(o.data.buffer)),!0)}class st extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(o){if(this.loaded!==o&&(this.loaded=o,o)){for(const{ids:d,promiseResolve:m}of this.requestors)m(this._getImagesForIds(d));this.requestors=[]}}getImage(o){const d=this.images[o];if(d&&!d.data&&d.spriteData){const m=d.spriteData;d.data=new l.R({width:m.width,height:m.height},m.context.getImageData(m.x,m.y,m.width,m.height).data),d.spriteData=null}return d}addImage(o,d){if(this.images[o])throw new Error(`Image id ${o} already exist, use updateImage instead`);this._validate(o,d)&&(this.images[o]=d)}_validate(o,d){let m=!0;const y=d.data||d.spriteData;return this._validateStretch(d.stretchX,y&&y.width)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "stretchX" value`))),m=!1),this._validateStretch(d.stretchY,y&&y.height)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "stretchY" value`))),m=!1),this._validateContent(d.content,d)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "content" value`))),m=!1),m}_validateStretch(o,d){if(!o)return!0;let m=0;for(const y of o){if(y[0]<m||y[1]<y[0]||d<y[1])return!1;m=y[1]}return!0}_validateContent(o,d){if(!o)return!0;if(o.length!==4)return!1;const m=d.spriteData,y=m&&m.width||d.data.width,x=m&&m.height||d.data.height;return!(o[0]<0||y<o[0]||o[1]<0||x<o[1]||o[2]<0||y<o[2]||o[3]<0||x<o[3]||o[2]<o[0]||o[3]<o[1])}updateImage(o,d,m=!0){const y=this.getImage(o);if(m&&(y.data.width!==d.data.width||y.data.height!==d.data.height))throw new Error(`size mismatch between old image (${y.data.width}x${y.data.height}) and new image (${d.data.width}x${d.data.height}).`);d.version=y.version+1,this.images[o]=d,this.updatedImages[o]=!0}removeImage(o){const d=this.images[o];delete this.images[o],delete this.patterns[o],d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(o){return new Promise((d,m)=>{let y=!0;if(!this.isLoaded())for(const x of o)this.images[x]||(y=!1);this.isLoaded()||y?d(this._getImagesForIds(o)):this.requestors.push({ids:o,promiseResolve:d})})}_getImagesForIds(o){const d={};for(const m of o){let y=this.getImage(m);y||(this.fire(new l.k("styleimagemissing",{id:m})),y=this.getImage(m)),y?d[m]={data:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,textFitWidth:y.textFitWidth,textFitHeight:y.textFitHeight,hasRenderCallback:!!(y.userImage&&y.userImage.render)}:l.w(`Image "${m}" 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 d}getPixelSize(){const{width:o,height:d}=this.atlasImage;return{width:o,height:d}}getPattern(o){const d=this.patterns[o],m=this.getImage(o);if(!m)return null;if(d&&d.position.version===m.version)return d.position;if(d)d.position.version=m.version;else{const y={w:m.data.width+2,h:m.data.height+2,x:0,y:0},x=new l.I(y,m);this.patterns[o]={bin:y,position:x}}return this._updatePatternAtlas(),this.patterns[o].position}bind(o){const d=o.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Xe(o,this.atlasImage,d.RGBA),this.atlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE)}_updatePatternAtlas(){const o=[];for(const x in this.patterns)o.push(this.patterns[x].bin);const{w:d,h:m}=l.p(o),y=this.atlasImage;y.resize({width:d||1,height:m||1});for(const x in this.patterns){const{bin:M}=this.patterns[x],P=M.x+1,O=M.y+1,N=this.getImage(x).data,V=N.width,F=N.height;l.R.copy(N,y,{x:0,y:0},{x:P,y:O},{width:V,height:F}),l.R.copy(N,y,{x:0,y:F-1},{x:P,y:O-1},{width:V,height:1}),l.R.copy(N,y,{x:0,y:0},{x:P,y:O+F},{width:V,height:1}),l.R.copy(N,y,{x:V-1,y:0},{x:P-1,y:O},{width:1,height:F}),l.R.copy(N,y,{x:0,y:0},{x:P+V,y:O},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(o){for(const d of o){if(this.callbackDispatchedThisFrame[d])continue;this.callbackDispatchedThisFrame[d]=!0;const m=this.getImage(d);m||l.w(`Image with ID: "${d}" was not found`),Pt(m)&&this.updateImage(d,m)}}}const Tt=1e20;function Nt(v,o,d,m,y,x,M,P,O){for(let N=o;N<o+m;N++)Vt(v,d*x+N,x,y,M,P,O);for(let N=d;N<d+y;N++)Vt(v,N*x+o,1,m,M,P,O)}function Vt(v,o,d,m,y,x,M){x[0]=0,M[0]=-Tt,M[1]=Tt,y[0]=v[o];for(let P=1,O=0,N=0;P<m;P++){y[P]=v[o+P*d];const V=P*P;do{const F=x[O];N=(y[P]-y[F]+V-F*F)/(P-F)/2}while(N<=M[O]&&--O>-1);O++,x[O]=P,M[O]=N,M[O+1]=Tt}for(let P=0,O=0;P<m;P++){for(;M[O+1]<P;)O++;const N=x[O],V=P-N;v[o+P*d]=y[N]+V*V}}class Ft{constructor(o,d){this.requestManager=o,this.localIdeographFontFamily=d,this.entries={}}setURL(o){this.url=o}getGlyphs(o){return l._(this,void 0,void 0,function*(){const d=[];for(const x in o)for(const M of o[x])d.push(this._getAndCacheGlyphsPromise(x,M));const m=yield Promise.all(d),y={};for(const{stack:x,id:M,glyph:P}of m)y[x]||(y[x]={}),y[x][M]=P&&{id:P.id,bitmap:P.bitmap.clone(),metrics:P.metrics};return y})}_getAndCacheGlyphsPromise(o,d){return l._(this,void 0,void 0,function*(){let m=this.entries[o];m||(m=this.entries[o]={glyphs:{},requests:{},ranges:{}});let y=m.glyphs[d];if(y!==void 0)return{stack:o,id:d,glyph:y};if(y=this._tinySDF(m,o,d),y)return m.glyphs[d]=y,{stack:o,id:d,glyph:y};const x=Math.floor(d/256);if(256*x>65535)throw new Error("glyphs > 65535 not supported");if(m.ranges[x])return{stack:o,id:d,glyph:y};if(!this.url)throw new Error("glyphsUrl is not set");if(!m.requests[x]){const P=Ft.loadGlyphRange(o,x,this.url,this.requestManager);m.requests[x]=P}const M=yield m.requests[x];for(const P in M)this._doesCharSupportLocalGlyph(+P)||(m.glyphs[+P]=M[+P]);return m.ranges[x]=!0,{stack:o,id:d,glyph:M[d]||null}})}_doesCharSupportLocalGlyph(o){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(o))}_tinySDF(o,d,m){const y=this.localIdeographFontFamily;if(!y||!this._doesCharSupportLocalGlyph(m))return;let x=o.tinySDF;if(!x){let P="400";/bold/i.test(d)?P="900":/medium/i.test(d)?P="500":/light/i.test(d)&&(P="200"),x=o.tinySDF=new Ft.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:y,fontWeight:P})}const M=x.draw(String.fromCharCode(m));return{id:m,bitmap:new l.o({width:M.width||60,height:M.height||60},M.data),metrics:{width:M.glyphWidth/2||24,height:M.glyphHeight/2||24,left:M.glyphLeft/2+.5||0,top:M.glyphTop/2-27.5||-8,advance:M.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ft.loadGlyphRange=function(v,o,d,m){return l._(this,void 0,void 0,function*(){const y=256*o,x=y+255,M=m.transformRequest(d.replace("{fontstack}",v).replace("{range}",`${y}-${x}`),"Glyphs"),P=yield l.l(M,new AbortController);if(!P||!P.data)throw new Error(`Could not load glyph range. range: ${o}, ${y}-${x}`);const O={};for(const N of l.n(P.data))O[N.id]=N;return O})},Ft.TinySDF=class{constructor({fontSize:v=24,buffer:o=3,radius:d=8,cutoff:m=.25,fontFamily:y="sans-serif",fontWeight:x="normal",fontStyle:M="normal"}={}){this.buffer=o,this.cutoff=m,this.radius=d;const P=this.size=v+4*o,O=this._createCanvas(P),N=this.ctx=O.getContext("2d",{willReadFrequently:!0});N.font=`${M} ${x} ${v}px ${y}`,N.textBaseline="alphabetic",N.textAlign="left",N.fillStyle="black",this.gridOuter=new Float64Array(P*P),this.gridInner=new Float64Array(P*P),this.f=new Float64Array(P),this.z=new Float64Array(P+1),this.v=new Uint16Array(P)}_createCanvas(v){const o=document.createElement("canvas");return o.width=o.height=v,o}draw(v){const{width:o,actualBoundingBoxAscent:d,actualBoundingBoxDescent:m,actualBoundingBoxLeft:y,actualBoundingBoxRight:x}=this.ctx.measureText(v),M=Math.ceil(d),P=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(x-y))),O=Math.min(this.size-this.buffer,M+Math.ceil(m)),N=P+2*this.buffer,V=O+2*this.buffer,F=Math.max(N*V,0),Z=new Uint8ClampedArray(F),J={data:Z,width:N,height:V,glyphWidth:P,glyphHeight:O,glyphTop:M,glyphLeft:0,glyphAdvance:o};if(P===0||O===0)return J;const{ctx:ee,buffer:oe,gridInner:le,gridOuter:ce}=this;ee.clearRect(oe,oe,P,O),ee.fillText(v,oe,oe+M);const he=ee.getImageData(oe,oe,P,O);ce.fill(Tt,0,F),le.fill(0,0,F);for(let ne=0;ne<O;ne++)for(let me=0;me<P;me++){const ge=he.data[4*(ne*P+me)+3]/255;if(ge===0)continue;const xe=(ne+oe)*N+me+oe;if(ge===1)ce[xe]=0,le[xe]=Tt;else{const Oe=.5-ge;ce[xe]=Oe>0?Oe*Oe:0,le[xe]=Oe<0?Oe*Oe:0}}Nt(ce,0,0,N,V,N,this.f,this.v,this.z),Nt(le,oe,oe,P,O,N,this.f,this.v,this.z);for(let ne=0;ne<F;ne++){const me=Math.sqrt(ce[ne])-Math.sqrt(le[ne]);Z[ne]=Math.round(255-255*(me/this.radius+this.cutoff))}return J}};class Ht{constructor(){this.specification=l.v.light.position}possiblyEvaluate(o,d){return l.x(o.expression.evaluate(d))}interpolate(o,d,m){return{x:l.y.number(o.x,d.x,m),y:l.y.number(o.y,d.y,m),z:l.y.number(o.z,d.z,m)}}}let Cn;class dn extends l.E{constructor(o){super(),Cn=Cn||new l.q({anchor:new l.D(l.v.light.anchor),position:new Ht,color:new l.D(l.v.light.color),intensity:new l.D(l.v.light.intensity)}),this._transitionable=new l.T(Cn),this.setLight(o),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(o,d={}){if(!this._validate(l.r,o,d))for(const m in o){const y=o[m];m.endsWith("-transition")?this._transitionable.setTransition(m.slice(0,-11),y):this._transitionable.setValue(m,y)}}updateTransitions(o){this._transitioning=this._transitionable.transitioned(o,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(o){this.properties=this._transitioning.possiblyEvaluate(o)}_validate(o,d,m){return(!m||m.validate!==!1)&&l.t(this,o.call(l.u,{value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v}))}}const vn=new l.q({"sky-color":new l.D(l.v.sky["sky-color"]),"horizon-color":new l.D(l.v.sky["horizon-color"]),"fog-color":new l.D(l.v.sky["fog-color"]),"fog-ground-blend":new l.D(l.v.sky["fog-ground-blend"]),"horizon-fog-blend":new l.D(l.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new l.D(l.v.sky["sky-horizon-blend"]),"atmosphere-blend":new l.D(l.v.sky["atmosphere-blend"])});class pn extends l.E{constructor(o){super(),this._transitionable=new l.T(vn),this.setSky(o),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.z(0))}setSky(o,d={}){if(!this._validate(l.B,o,d)){o||(o={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const m in o){const y=o[m];m.endsWith("-transition")?this._transitionable.setTransition(m.slice(0,-11),y):this._transitionable.setValue(m,y)}}}getSky(){return this._transitionable.serialize()}updateTransitions(o){this._transitioning=this._transitionable.transitioned(o,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(o){this.properties=this._transitioning.possiblyEvaluate(o)}_validate(o,d,m={}){return(m==null?void 0:m.validate)!==!1&&l.t(this,o.call(l.u,l.e({value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v})))}calculateFogBlendOpacity(o){return o<60?0:o<70?(o-60)/10:1}}class ti{constructor(o,d){this.width=o,this.height=d,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(o,d){const m=o.join(",")+String(d);return this.dashEntry[m]||(this.dashEntry[m]=this.addDash(o,d)),this.dashEntry[m]}getDashRanges(o,d,m){const y=[];let x=o.length%2==1?-o[o.length-1]*m:0,M=o[0]*m,P=!0;y.push({left:x,right:M,isDash:P,zeroLength:o[0]===0});let O=o[0];for(let N=1;N<o.length;N++){P=!P;const V=o[N];x=O*m,O+=V,M=O*m,y.push({left:x,right:M,isDash:P,zeroLength:V===0})}return y}addRoundDash(o,d,m){const y=d/2;for(let x=-m;x<=m;x++){const M=this.width*(this.nextRow+m+x);let P=0,O=o[P];for(let N=0;N<this.width;N++){N/O.right>1&&(O=o[++P]);const V=Math.abs(N-O.left),F=Math.abs(N-O.right),Z=Math.min(V,F);let J;const ee=x/m*(y+1);if(O.isDash){const oe=y-Math.abs(ee);J=Math.sqrt(Z*Z+oe*oe)}else J=y-Math.sqrt(Z*Z+ee*ee);this.data[M+N]=Math.max(0,Math.min(255,J+128))}}}addRegularDash(o){for(let P=o.length-1;P>=0;--P){const O=o[P],N=o[P+1];O.zeroLength?o.splice(P,1):N&&N.isDash===O.isDash&&(N.left=O.left,o.splice(P,1))}const d=o[0],m=o[o.length-1];d.isDash===m.isDash&&(d.left=m.left-this.width,m.right=d.right+this.width);const y=this.width*this.nextRow;let x=0,M=o[x];for(let P=0;P<this.width;P++){P/M.right>1&&(M=o[++x]);const O=Math.abs(P-M.left),N=Math.abs(P-M.right),V=Math.min(O,N);this.data[y+P]=Math.max(0,Math.min(255,(M.isDash?V:-V)+128))}}addDash(o,d){const m=d?7:0,y=2*m+1;if(this.nextRow+y>this.height)return l.w("LineAtlas out of space"),null;let x=0;for(let P=0;P<o.length;P++)x+=o[P];if(x!==0){const P=this.width/x,O=this.getDashRanges(o,this.width,P);d?this.addRoundDash(O,P,m):this.addRegularDash(O)}const M={y:(this.nextRow+m+.5)/this.height,height:2*m/this.height,width:x};return this.nextRow+=y,this.dirty=!0,M}bind(o){const d=o.gl;this.texture?(d.bindTexture(d.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,d.texSubImage2D(d.TEXTURE_2D,0,0,0,this.width,this.height,d.ALPHA,d.UNSIGNED_BYTE,this.data))):(this.texture=d.createTexture(),d.bindTexture(d.TEXTURE_2D,this.texture),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),d.texImage2D(d.TEXTURE_2D,0,d.ALPHA,this.width,this.height,0,d.ALPHA,d.UNSIGNED_BYTE,this.data))}}const Nn="maplibre_preloaded_worker_pool";class Pn{constructor(){this.active={}}acquire(o){if(!this.workers)for(this.workers=[];this.workers.length<Pn.workerCount;)this.workers.push(new Worker(l.a.WORKER_URL));return this.active[o]=!0,this.workers.slice()}release(o){delete this.active[o],this.numActive()===0&&(this.workers.forEach(d=>{d.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Nn]}numActive(){return Object.keys(this.active).length}}const Ln=Math.floor(E.hardwareConcurrency/2);let Ce,He;function Ke(){return Ce||(Ce=new Pn),Ce}Pn.workerCount=l.C(globalThis)?Math.max(Math.min(Ln,3),1):1;class Be{constructor(o,d){this.workerPool=o,this.actors=[],this.currentActor=0,this.id=d;const m=this.workerPool.acquire(d);for(let y=0;y<m.length;y++){const x=new l.F(m[y],d);x.name=`Worker ${y}`,this.actors.push(x)}if(!this.actors.length)throw new Error("No actors found")}broadcast(o,d){const m=[];for(const y of this.actors)m.push(y.sendAsync({type:o,data:d}));return Promise.all(m)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(o=!0){this.actors.forEach(d=>{d.remove()}),this.actors=[],o&&this.workerPool.release(this.id)}registerMessageHandler(o,d){for(const m of this.actors)m.registerMessageHandler(o,d)}}function Rt(){return He||(He=new Be(Ke(),l.G),He.registerMessageHandler("GR",(v,o,d)=>l.m(o,d))),He}function Qt(v,o){const d=l.H();return l.J(d,d,[1,1,0]),l.K(d,d,[.5*v.width,.5*v.height,1]),l.L(d,d,v.calculatePosMatrix(o.toUnwrapped()))}function At(v,o,d,m,y,x){const M=function(F,Z,J){if(F)for(const ee of F){const oe=Z[ee];if(oe&&oe.source===J&&oe.type==="fill-extrusion")return!0}else for(const ee in Z){const oe=Z[ee];if(oe.source===J&&oe.type==="fill-extrusion")return!0}return!1}(y&&y.layers,o,v.id),P=x.maxPitchScaleFactor(),O=v.tilesIn(m,P,M);O.sort(Mt);const N=[];for(const F of O)N.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(o,d,v._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,y,x,P,Qt(v.transform,F.tileID))});const V=function(F){const Z={},J={};for(const ee of F){const oe=ee.queryResults,le=ee.wrappedTileID,ce=J[le]=J[le]||{};for(const he in oe){const ne=oe[he],me=ce[he]=ce[he]||{},ge=Z[he]=Z[he]||[];for(const xe of ne)me[xe.featureIndex]||(me[xe.featureIndex]=!0,ge.push(xe))}}return Z}(N);for(const F in V)V[F].forEach(Z=>{const J=Z.feature,ee=v.getFeatureState(J.layer["source-layer"],J.id);J.source=J.layer.source,J.layer["source-layer"]&&(J.sourceLayer=J.layer["source-layer"]),J.state=ee});return V}function Mt(v,o){const d=v.tileID,m=o.tileID;return d.overscaledZ-m.overscaledZ||d.canonical.y-m.canonical.y||d.wrap-m.wrap||d.canonical.x-m.canonical.x}function rn(v,o,d){return l._(this,void 0,void 0,function*(){let m=v;if(v.url?m=(yield l.h(o.transformRequest(v.url,"Source"),d)).data:yield E.frameAsync(d),!m)return null;const y=l.M(l.e(m,v),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in m&&m.vector_layers&&(y.vectorLayerIds=m.vector_layers.map(x=>x.id)),y})}class we{constructor(o,d){o&&(d?this.setSouthWest(o).setNorthEast(d):Array.isArray(o)&&(o.length===4?this.setSouthWest([o[0],o[1]]).setNorthEast([o[2],o[3]]):this.setSouthWest(o[0]).setNorthEast(o[1])))}setNorthEast(o){return this._ne=o instanceof l.N?new l.N(o.lng,o.lat):l.N.convert(o),this}setSouthWest(o){return this._sw=o instanceof l.N?new l.N(o.lng,o.lat):l.N.convert(o),this}extend(o){const d=this._sw,m=this._ne;let y,x;if(o instanceof l.N)y=o,x=o;else{if(!(o instanceof we))return Array.isArray(o)?o.length===4||o.every(Array.isArray)?this.extend(we.convert(o)):this.extend(l.N.convert(o)):o&&("lng"in o||"lon"in o)&&"lat"in o?this.extend(l.N.convert(o)):this;if(y=o._sw,x=o._ne,!y||!x)return this}return d||m?(d.lng=Math.min(y.lng,d.lng),d.lat=Math.min(y.lat,d.lat),m.lng=Math.max(x.lng,m.lng),m.lat=Math.max(x.lat,m.lat)):(this._sw=new l.N(y.lng,y.lat),this._ne=new l.N(x.lng,x.lat)),this}getCenter(){return new l.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 l.N(this.getWest(),this.getNorth())}getSouthEast(){return new l.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(o){const{lng:d,lat:m}=l.N.convert(o);let y=this._sw.lng<=d&&d<=this._ne.lng;return this._sw.lng>this._ne.lng&&(y=this._sw.lng>=d&&d>=this._ne.lng),this._sw.lat<=m&&m<=this._ne.lat&&y}static convert(o){return o instanceof we?o:o&&new we(o)}static fromLngLat(o,d=0){const m=360*d/40075017,y=m/Math.cos(Math.PI/180*o.lat);return new we(new l.N(o.lng-y,o.lat-m),new l.N(o.lng+y,o.lat+m))}adjustAntiMeridian(){const o=new l.N(this._sw.lng,this._sw.lat),d=new l.N(this._ne.lng,this._ne.lat);return new we(o,o.lng>d.lng?new l.N(d.lng+360,d.lat):d)}}class yn{constructor(o,d,m){this.bounds=we.convert(this.validateBounds(o)),this.minzoom=d||0,this.maxzoom=m||24}validateBounds(o){return Array.isArray(o)&&o.length===4?[Math.max(-180,o[0]),Math.max(-90,o[1]),Math.min(180,o[2]),Math.min(90,o[3])]:[-180,-90,180,90]}contains(o){const d=Math.pow(2,o.z),m=Math.floor(l.O(this.bounds.getWest())*d),y=Math.floor(l.Q(this.bounds.getNorth())*d),x=Math.ceil(l.O(this.bounds.getEast())*d),M=Math.ceil(l.Q(this.bounds.getSouth())*d);return o.x>=m&&o.x<x&&o.y>=y&&o.y<M}}class pr extends l.E{constructor(o,d,m,y){if(super(),this.id=o,this.dispatcher=m,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.e(this,l.M(d,["url","scheme","tileSize","promoteId"])),this._options=l.e({type:"vector"},d),this._collectResourceTiming=d.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(y)}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const o=yield rn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),o&&(l.e(this,o),o.bounds&&(this.tileBounds=new yn(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(o){this._tileJSONRequest=null,this.fire(new l.j(o))}})}loaded(){return this._loaded}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}onAdd(o){this.map=o,this.load()}setSourceProperty(o){this._tileJSONRequest&&this._tileJSONRequest.abort(),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m={request:this.map._requestManager.transformRequest(d,"Tile"),uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,tileSize:this.tileSize*o.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};m.request.collectResourceTiming=this._collectResourceTiming;let y="RT";if(o.actor&&o.state!=="expired"){if(o.state==="loading")return new Promise((x,M)=>{o.reloadPromise={resolve:x,reject:M}})}else o.actor=this.dispatcher.getActor(),y="LT";o.abortController=new AbortController;try{const x=yield o.actor.sendAsync({type:y,data:m},o.abortController);if(delete o.abortController,o.aborted)return;this._afterTileLoadWorkerResponse(o,x)}catch(x){if(delete o.abortController,o.aborted)return;if(x&&x.status!==404)throw x;this._afterTileLoadWorkerResponse(o,null)}})}_afterTileLoadWorkerResponse(o,d){if(d&&d.resourceTiming&&(o.resourceTiming=d.resourceTiming),d&&this.map._refreshExpiredTiles&&o.setExpiryData(d),o.loadVectorData(d,this.map.painter),o.reloadPromise){const m=o.reloadPromise;o.reloadPromise=null,this.loadTile(o).then(m.resolve).catch(m.reject)}}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.actor&&(yield o.actor.sendAsync({type:"AT",data:{uid:o.uid,type:this.type,source:this.id}}))})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.unloadVectorData(),o.actor&&(yield o.actor.sendAsync({type:"RMT",data:{uid:o.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class qt extends l.E{constructor(o,d,m,y){super(),this.id=o,this.dispatcher=m,this.setEventedParent(y),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},d),l.e(this,l.M(d,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const o=yield rn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,o&&(l.e(this,o),o.bounds&&(this.tileBounds=new yn(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(o){this._tileJSONRequest=null,this.fire(new l.j(o))}})}loaded(){return this._loaded}onAdd(o){this.map=o,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(o){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}serialize(){return l.e({},this._options)}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);o.abortController=new AbortController;try{const m=yield G.getImage(this.map._requestManager.transformRequest(d,"Tile"),o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(m&&m.data){this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&o.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const y=this.map.painter.context,x=y.gl,M=m.data;o.texture=this.map.painter.getTileTexture(M.width),o.texture?o.texture.update(M,{useMipmap:!0}):(o.texture=new Xe(y,M,x.RGBA,{useMipmap:!0}),o.texture.bind(x.LINEAR,x.CLAMP_TO_EDGE,x.LINEAR_MIPMAP_NEAREST)),o.state="loaded"}}catch(m){if(delete o.abortController,o.aborted)o.state="unloaded";else if(m)throw o.state="errored",m}})}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController)})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.texture&&this.map.painter.saveTileTexture(o.texture)})}hasTransition(){return!1}}class sn extends qt{constructor(o,d,m,y){super(o,d,m,y),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},d),this.encoding=d.encoding||"mapbox",this.redFactor=d.redFactor,this.greenFactor=d.greenFactor,this.blueFactor=d.blueFactor,this.baseShift=d.baseShift}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m=this.map._requestManager.transformRequest(d,"Tile");o.neighboringTiles=this._getNeighboringTiles(o.tileID),o.abortController=new AbortController;try{const y=yield G.getImage(m,o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(y&&y.data){const x=y.data;this.map._refreshExpiredTiles&&y.cacheControl&&y.expires&&o.setExpiryData({cacheControl:y.cacheControl,expires:y.expires});const M=l.b(x)&&l.U()?x:yield this.readImageNow(x),P={type:this.type,uid:o.uid,source:this.id,rawImageData:M,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!o.actor||o.state==="expired"){o.actor=this.dispatcher.getActor();const O=yield o.actor.sendAsync({type:"LDT",data:P});o.dem=O,o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0,o.state="loaded"}}}catch(y){if(delete o.abortController,o.aborted)o.state="unloaded";else if(y)throw o.state="errored",y}})}readImageNow(o){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.V()){const d=o.width+2,m=o.height+2;try{return new l.R({width:d,height:m},yield l.W(o,-1,-1,d,m))}catch{}}return E.getImageData(o,1)})}_getNeighboringTiles(o){const d=o.canonical,m=Math.pow(2,d.z),y=(d.x-1+m)%m,x=d.x===0?o.wrap-1:o.wrap,M=(d.x+1+m)%m,P=d.x+1===m?o.wrap+1:o.wrap,O={};return O[new l.S(o.overscaledZ,x,d.z,y,d.y).key]={backfilled:!1},O[new l.S(o.overscaledZ,P,d.z,M,d.y).key]={backfilled:!1},d.y>0&&(O[new l.S(o.overscaledZ,x,d.z,y,d.y-1).key]={backfilled:!1},O[new l.S(o.overscaledZ,o.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},O[new l.S(o.overscaledZ,P,d.z,M,d.y-1).key]={backfilled:!1}),d.y+1<m&&(O[new l.S(o.overscaledZ,x,d.z,y,d.y+1).key]={backfilled:!1},O[new l.S(o.overscaledZ,o.wrap,d.z,d.x,d.y+1).key]={backfilled:!1},O[new l.S(o.overscaledZ,P,d.z,M,d.y+1).key]={backfilled:!1}),O}unloadTile(o){return l._(this,void 0,void 0,function*(){o.demTexture&&this.map.painter.saveTileTexture(o.demTexture),o.fbo&&(o.fbo.destroy(),delete o.fbo),o.dem&&delete o.dem,delete o.neighboringTiles,o.state="unloaded",o.actor&&(yield o.actor.sendAsync({type:"RDT",data:{type:this.type,uid:o.uid,source:this.id}}))})}}class vi extends l.E{constructor(o,d,m,y){super(),this.id=o,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=m.getActor(),this.setEventedParent(y),this._data=d.data,this._options=l.e({},d),this._collectResourceTiming=d.collectResourceTiming,d.maxzoom!==void 0&&(this.maxzoom=d.maxzoom),d.type&&(this.type=d.type),d.attribution&&(this.attribution=d.attribution),this.promoteId=d.promoteId;const x=l.X/this.tileSize;d.clusterMaxZoom!==void 0&&this.maxzoom<=d.clusterMaxZoom&&l.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${d.clusterMaxZoom}".`),this.workerOptions=l.e({source:this.id,cluster:d.cluster||!1,geojsonVtOptions:{buffer:(d.buffer!==void 0?d.buffer:128)*x,tolerance:(d.tolerance!==void 0?d.tolerance:.375)*x,extent:l.X,maxZoom:this.maxzoom,lineMetrics:d.lineMetrics||!1,generateId:d.generateId||!1},superclusterOptions:{maxZoom:d.clusterMaxZoom!==void 0?d.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,d.clusterMinPoints||2),extent:l.X,radius:(d.clusterRadius||50)*x,log:!1,generateId:d.generateId||!1},clusterProperties:d.clusterProperties,filter:d.filter},d.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return l._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(o){this.map=o,this.load()}setData(o){return this._data=o,this._updateWorkerData(),this}updateData(o){return this._updateWorkerData(o),this}getData(){return l._(this,void 0,void 0,function*(){const o=l.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:o})})}setClusterOptions(o){return this.workerOptions.cluster=o.cluster,o&&(o.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=o.clusterRadius),o.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=o.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(o){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:o,source:this.id}})}getClusterChildren(o){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:o,source:this.id}})}getClusterLeaves(o,d,m){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:o,limit:d,offset:m}})}_updateWorkerData(o){return l._(this,void 0,void 0,function*(){const d=l.e({type:this.type},this.workerOptions);o?d.dataDiff=o:typeof this._data=="string"?(d.request=this.map._requestManager.transformRequest(E.resolveURL(this._data),"Source"),d.request.collectResourceTiming=this._collectResourceTiming):d.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new l.k("dataloading",{dataType:"source"}));try{const m=yield this.actor.sendAsync({type:"LD",data:d});if(this._pendingLoads--,this._removed||m.abandoned)return void this.fire(new l.k("dataabort",{dataType:"source"}));let y=null;m.resourceTiming&&m.resourceTiming[this.id]&&(y=m.resourceTiming[this.id].slice(0));const x={dataType:"source"};this._collectResourceTiming&&y&&y.length>0&&l.e(x,{resourceTiming:y}),this.fire(new l.k("data",Object.assign(Object.assign({},x),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},x),{sourceDataType:"content"})))}catch(m){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(m))}})}loaded(){return this._pendingLoads===0}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.actor?"RT":"LT";o.actor=this.actor;const m={type:this.type,uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};o.abortController=new AbortController;const y=yield this.actor.sendAsync({type:d,data:m},o.abortController);delete o.abortController,o.unloadVectorData(),o.aborted||o.loadVectorData(y,this.map.painter,d==="RT")})}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.aborted=!0})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:o.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 l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var ui=l.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class mi extends l.E{constructor(o,d,m,y){super(),this.id=o,this.dispatcher=m,this.coordinates=d.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(y),this.options=d}load(o){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const d=yield G.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,d&&d.data&&(this.image=d.data,o&&(this.coordinates=o),this._finishLoading())}catch(d){this._request=null,this._loaded=!0,this.fire(new l.j(d))}})}loaded(){return this._loaded}updateImage(o){return o.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=o.url,this.load(o.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(o){this.map=o,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(o){this.coordinates=o;const d=o.map(l.Z.fromLngLat);this.tileID=function(y){let x=1/0,M=1/0,P=-1/0,O=-1/0;for(const Z of y)x=Math.min(x,Z.x),M=Math.min(M,Z.y),P=Math.max(P,Z.x),O=Math.max(O,Z.y);const N=Math.max(P-x,O-M),V=Math.max(0,Math.floor(-Math.log(N)/Math.LN2)),F=Math.pow(2,V);return new l.a1(V,Math.floor((x+P)/2*F),Math.floor((M+O)/2*F))}(d),this.minzoom=this.maxzoom=this.tileID.z;const m=d.map(y=>this.tileID.getTilePoint(y)._round());return this._boundsArray=new l.$,this._boundsArray.emplaceBack(m[0].x,m[0].y,0,0),this._boundsArray.emplaceBack(m[1].x,m[1].y,l.X,0),this._boundsArray.emplaceBack(m[3].x,m[3].y,0,l.X),this._boundsArray.emplaceBack(m[2].x,m[2].y,l.X,l.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const o=this.map.painter.context,d=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,ui.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Xe(o,this.image,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let m=!1;for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(o){return l._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(o.tileID.canonical)?(this.tiles[String(o.tileID.wrap)]=o,o.buckets={}):o.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Or extends mi{constructor(o,d,m,y){super(o,d,m,y),this.roundZoom=!0,this.type="video",this.options=d}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1;const o=this.options;this.urls=[];for(const d of o.urls)this.urls.push(this.map._requestManager.transformRequest(d,"Source").url);try{const d=yield l.a3(this.urls);if(this._loaded=!0,!d)return;this.video=d,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(d){this.fire(new l.j(d))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(o){if(this.video){const d=this.video.seekable;o<d.start(0)||o>d.end(0)?this.fire(new l.j(new l.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=o}}getVideo(){return this.video}onAdd(o){this.map||(this.map=o,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 o=this.map.painter.context,d=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,ui.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,this.video)):(this.texture=new Xe(o,this.video,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let m=!1;for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,m=!0)}m&&this.fire(new l.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 wi extends mi{constructor(o,d,m,y){super(o,d,m,y),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(x=>!Array.isArray(x)||x.length!==2||x.some(M=>typeof M!="number"))||this.fire(new l.j(new l.a2(`sources.${o}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a2(`sources.${o}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new l.j(new l.a2(`sources.${o}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.a2(`sources.${o}`,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 l.j(new l.a2(`sources.${o}`,null,'missing required property "canvas"'))),this.options=d,this.animate=d.animate===void 0||d.animate}load(){return l._(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 l.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(o){this.map=o,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let o=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,o=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,o=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context,m=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,ui.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?(o||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Xe(d,this.canvas,m.RGBA,{premultiply:!0});let y=!1;for(const x in this.tiles){const M=this.tiles[x];M.state!=="loaded"&&(M.state="loaded",M.texture=this.texture,y=!0)}y&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const o of[this.canvas.width,this.canvas.height])if(isNaN(o)||o<=0)return!0;return!1}}const Eo={},Co=v=>{switch(v){case"geojson":return vi;case"image":return mi;case"raster":return qt;case"raster-dem":return sn;case"vector":return pr;case"video":return Or;case"canvas":return wi}return Eo[v]},Ve="RTLPluginLoaded";class Br extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Rt()}_syncState(o){return this.status=o,this.dispatcher.broadcast("SRPS",{pluginStatus:o,pluginURL:this.url}).catch(d=>{throw this.status="error",d})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(o){return l._(this,arguments,void 0,function*(d,m=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=E.resolveURL(d),!this.url)throw new Error(`requested url ${d} is invalid`);if(this.status==="unavailable"){if(!m)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(Ve))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ki=null;function zr(){return ki||(ki=new Br),ki}class To{constructor(o,d){this.timeAdded=0,this.fadeEndTime=0,this.tileID=o,this.uid=l.a4(),this.uses=0,this.tileSize=d,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(o){const d=o+this.timeAdded;d<this.fadeEndTime||(this.fadeEndTime=d)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(o){this.demTexture&&o.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(o,d,m){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",o){o.featureIndex&&(this.latestFeatureIndex=o.featureIndex,o.rawTileData?(this.latestRawTileData=o.rawTileData,this.latestFeatureIndex.rawTileData=o.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=o.collisionBoxArray,this.buckets=function(y,x){const M={};if(!x)return M;for(const P of y){const O=P.layerIds.map(N=>x.getLayer(N)).filter(Boolean);if(O.length!==0){P.layers=O,P.stateDependentLayerIds&&(P.stateDependentLayers=P.stateDependentLayerIds.map(N=>O.filter(V=>V.id===N)[0]));for(const N of O)M[N.id]=P}}return M}(o.buckets,d.style),this.hasSymbolBuckets=!1;for(const y in this.buckets){const x=this.buckets[y];if(x instanceof l.a6){if(this.hasSymbolBuckets=!0,!m)break;x.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const y in this.buckets){const x=this.buckets[y];if(x instanceof l.a6&&x.hasRTLText){this.hasRTLText=!0,zr().lazyLoad();break}}this.queryPadding=0;for(const y in this.buckets){const x=this.buckets[y];this.queryPadding=Math.max(this.queryPadding,d.style.getLayer(y).queryRadius(x))}o.imageAtlas&&(this.imageAtlas=o.imageAtlas),o.glyphAtlasImage&&(this.glyphAtlasImage=o.glyphAtlasImage)}else this.collisionBoxArray=new l.a5}unloadVectorData(){for(const o in this.buckets)this.buckets[o].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(o){return this.buckets[o.id]}upload(o){for(const m in this.buckets){const y=this.buckets[m];y.uploadPending()&&y.upload(o)}const d=o.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Xe(o,this.imageAtlas.image,d.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Xe(o,this.glyphAtlasImage,d.ALPHA),this.glyphAtlasImage=null)}prepare(o){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(o,this.imageAtlasTexture)}queryRenderedFeatures(o,d,m,y,x,M,P,O,N,V){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:y,cameraQueryGeometry:x,scale:M,tileSize:this.tileSize,pixelPosMatrix:V,transform:O,params:P,queryPadding:this.queryPadding*N},o,d,m):{}}querySourceFeatures(o,d){const m=this.latestFeatureIndex;if(!m||!m.rawTileData)return;const y=m.loadVTLayers(),x=d&&d.sourceLayer?d.sourceLayer:"",M=y._geojsonTileLayer||y[x];if(!M)return;const P=l.a7(d&&d.filter),{z:O,x:N,y:V}=this.tileID.canonical,F={z:O,x:N,y:V};for(let Z=0;Z<M.length;Z++){const J=M.feature(Z);if(P.needGeometry){const le=l.a8(J,!0);if(!P.filter(new l.z(this.tileID.overscaledZ),le,this.tileID.canonical))continue}else if(!P.filter(new l.z(this.tileID.overscaledZ),J))continue;const ee=m.getId(J,x),oe=new l.a9(J,O,N,V,ee);oe.tile=F,o.push(oe)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(o){const d=this.expirationTime;if(o.cacheControl){const m=l.aa(o.cacheControl);m["max-age"]&&(this.expirationTime=Date.now()+1e3*m["max-age"])}else o.expires&&(this.expirationTime=new Date(o.expires).getTime());if(this.expirationTime){const m=Date.now();let y=!1;if(this.expirationTime>m)y=!1;else if(d)if(this.expirationTime<d)y=!0;else{const x=this.expirationTime-d;x?this.expirationTime=m+Math.max(x,3e4):y=!0}else y=!0;y?(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(o,d){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(o).length===0)return;const m=this.latestFeatureIndex.loadVTLayers();for(const y in this.buckets){if(!d.style.hasLayer(y))continue;const x=this.buckets[y],M=x.layers[0].sourceLayer||"_geojsonTileLayer",P=m[M],O=o[M];if(!P||!O||Object.keys(O).length===0)continue;x.update(O,P,this.imageAtlas&&this.imageAtlas.patternPositions||{});const N=d&&d.style&&d.style.getLayer(y);N&&(this.queryPadding=Math.max(this.queryPadding,N.queryRadius(x)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<E.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(o){this.symbolFadeHoldUntil=E.now()+o}setDependencies(o,d){const m={};for(const y of d)m[y]=!0;this.dependencies[o]=m}hasDependency(o,d){for(const m of o){const y=this.dependencies[m];if(y){for(const x of d)if(y[x])return!0}}return!1}}class Ze{constructor(o,d){this.max=o,this.onRemove=d,this.reset()}reset(){for(const o in this.data)for(const d of this.data[o])d.timeout&&clearTimeout(d.timeout),this.onRemove(d.value);return this.data={},this.order=[],this}add(o,d,m){const y=o.wrapped().key;this.data[y]===void 0&&(this.data[y]=[]);const x={value:d,timeout:void 0};if(m!==void 0&&(x.timeout=setTimeout(()=>{this.remove(o,x)},m)),this.data[y].push(x),this.order.push(y),this.order.length>this.max){const M=this._getAndRemoveByKey(this.order[0]);M&&this.onRemove(M)}return this}has(o){return o.wrapped().key in this.data}getAndRemove(o){return this.has(o)?this._getAndRemoveByKey(o.wrapped().key):null}_getAndRemoveByKey(o){const d=this.data[o].shift();return d.timeout&&clearTimeout(d.timeout),this.data[o].length===0&&delete this.data[o],this.order.splice(this.order.indexOf(o),1),d.value}getByKey(o){const d=this.data[o];return d?d[0].value:null}get(o){return this.has(o)?this.data[o.wrapped().key][0].value:null}remove(o,d){if(!this.has(o))return this;const m=o.wrapped().key,y=d===void 0?0:this.data[m].indexOf(d),x=this.data[m][y];return this.data[m].splice(y,1),x.timeout&&clearTimeout(x.timeout),this.data[m].length===0&&delete this.data[m],this.onRemove(x.value),this.order.splice(this.order.indexOf(m),1),this}setMaxSize(o){for(this.max=o;this.order.length>this.max;){const d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}filter(o){const d=[];for(const m in this.data)for(const y of this.data[m])o(y.value)||d.push(y);for(const m of d)this.remove(m.value.tileID,m)}}class ke{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(o,d,m){const y=String(d);if(this.stateChanges[o]=this.stateChanges[o]||{},this.stateChanges[o][y]=this.stateChanges[o][y]||{},l.e(this.stateChanges[o][y],m),this.deletedStates[o]===null){this.deletedStates[o]={};for(const x in this.state[o])x!==y&&(this.deletedStates[o][x]=null)}else if(this.deletedStates[o]&&this.deletedStates[o][y]===null){this.deletedStates[o][y]={};for(const x in this.state[o][y])m[x]||(this.deletedStates[o][y][x]=null)}else for(const x in m)this.deletedStates[o]&&this.deletedStates[o][y]&&this.deletedStates[o][y][x]===null&&delete this.deletedStates[o][y][x]}removeFeatureState(o,d,m){if(this.deletedStates[o]===null)return;const y=String(d);if(this.deletedStates[o]=this.deletedStates[o]||{},m&&d!==void 0)this.deletedStates[o][y]!==null&&(this.deletedStates[o][y]=this.deletedStates[o][y]||{},this.deletedStates[o][y][m]=null);else if(d!==void 0)if(this.stateChanges[o]&&this.stateChanges[o][y])for(m in this.deletedStates[o][y]={},this.stateChanges[o][y])this.deletedStates[o][y][m]=null;else this.deletedStates[o][y]=null;else this.deletedStates[o]=null}getState(o,d){const m=String(d),y=l.e({},(this.state[o]||{})[m],(this.stateChanges[o]||{})[m]);if(this.deletedStates[o]===null)return{};if(this.deletedStates[o]){const x=this.deletedStates[o][d];if(x===null)return{};for(const M in x)delete y[M]}return y}initializeTileState(o,d){o.setFeatureState(this.state,d)}coalesceChanges(o,d){const m={};for(const y in this.stateChanges){this.state[y]=this.state[y]||{};const x={};for(const M in this.stateChanges[y])this.state[y][M]||(this.state[y][M]={}),l.e(this.state[y][M],this.stateChanges[y][M]),x[M]=this.state[y][M];m[y]=x}for(const y in this.deletedStates){this.state[y]=this.state[y]||{};const x={};if(this.deletedStates[y]===null)for(const M in this.state[y])x[M]={},this.state[y][M]={};else for(const M in this.deletedStates[y]){if(this.deletedStates[y][M]===null)this.state[y][M]={};else for(const P of Object.keys(this.deletedStates[y][M]))delete this.state[y][M][P];x[M]=this.state[y][M]}m[y]=m[y]||{},l.e(m[y],x)}if(this.stateChanges={},this.deletedStates={},Object.keys(m).length!==0)for(const y in o)o[y].setFeatureState(m,d)}}class Le extends l.E{constructor(o,d,m){super(),this.id=o,this.dispatcher=m,this.on("data",y=>this._dataHandler(y)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((y,x,M,P)=>{const O=new(Co(x.type))(y,x,M,P);if(O.id!==y)throw new Error(`Expected Source id to be ${y} instead of ${O.id}`);return O})(o,d,m,this),this._tiles={},this._cache=new Ze(0,y=>this._unloadTile(y)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ke,this._didEmitContent=!1,this._updated=!1}onAdd(o){this.map=o,this._maxTileCacheSize=o?o._maxTileCacheSize:null,this._maxTileCacheZoomLevels=o?o._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(o)}onRemove(o){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(o)}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 o in this._tiles){const d=this._tiles[o];if(d.state!=="loaded"&&d.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const o=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,o&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(o,d,m){return l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(o),this._tileLoaded(o,d,m)}catch(y){o.state="errored",y.status!==404?this._source.fire(new l.j(y,{tile:o})):this.update(this.transform,this.terrain)}})}_unloadTile(o){this._source.unloadTile&&this._source.unloadTile(o)}_abortTile(o){this._source.abortTile&&this._source.abortTile(o),this._source.fire(new l.k("dataabort",{tile:o,coord:o.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(o){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const d in this._tiles){const m=this._tiles[d];m.upload(o),m.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(o=>o.tileID).sort(vt).map(o=>o.key)}getRenderableIds(o){const d=[];for(const m in this._tiles)this._isIdRenderable(m,o)&&d.push(this._tiles[m]);return o?d.sort((m,y)=>{const x=m.tileID,M=y.tileID,P=new l.P(x.canonical.x,x.canonical.y)._rotate(this.transform.angle),O=new l.P(M.canonical.x,M.canonical.y)._rotate(this.transform.angle);return x.overscaledZ-M.overscaledZ||O.y-P.y||O.x-P.x}).map(m=>m.tileID.key):d.map(m=>m.tileID).sort(vt).map(m=>m.key)}hasRenderableParent(o){const d=this.findLoadedParent(o,0);return!!d&&this._isIdRenderable(d.tileID.key)}_isIdRenderable(o,d){return this._tiles[o]&&this._tiles[o].hasData()&&!this._coveredTiles[o]&&(d||!this._tiles[o].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const o in this._tiles)this._tiles[o].state!=="errored"&&this._reloadTile(o,"reloading")}}_reloadTile(o,d){return l._(this,void 0,void 0,function*(){const m=this._tiles[o];m&&(m.state!=="loading"&&(m.state=d),yield this._loadTile(m,o,d))})}_tileLoaded(o,d,m){o.timeAdded=E.now(),m==="expired"&&(o.refreshedUponExpiration=!0),this._setTileReloadTimer(d,o),this.getSource().type==="raster-dem"&&o.dem&&this._backfillDEM(o),this._state.initializeTileState(o,this.map?this.map.painter:null),o.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:o,coord:o.tileID}))}_backfillDEM(o){const d=this.getRenderableIds();for(let y=0;y<d.length;y++){const x=d[y];if(o.neighboringTiles&&o.neighboringTiles[x]){const M=this.getTileByID(x);m(o,M),m(M,o)}}function m(y,x){y.needsHillshadePrepare=!0,y.needsTerrainPrepare=!0;let M=x.tileID.canonical.x-y.tileID.canonical.x;const P=x.tileID.canonical.y-y.tileID.canonical.y,O=Math.pow(2,y.tileID.canonical.z),N=x.tileID.key;M===0&&P===0||Math.abs(P)>1||(Math.abs(M)>1&&(Math.abs(M+O)===1?M+=O:Math.abs(M-O)===1&&(M-=O)),x.dem&&y.dem&&(y.dem.backfillBorder(x.dem,M,P),y.neighboringTiles&&y.neighboringTiles[N]&&(y.neighboringTiles[N].backfilled=!0)))}}getTile(o){return this.getTileByID(o.key)}getTileByID(o){return this._tiles[o]}_retainLoadedChildren(o,d,m,y){for(const x in this._tiles){let M=this._tiles[x];if(y[x]||!M.hasData()||M.tileID.overscaledZ<=d||M.tileID.overscaledZ>m)continue;let P=M.tileID;for(;M&&M.tileID.overscaledZ>d+1;){const N=M.tileID.scaledTo(M.tileID.overscaledZ-1);M=this._tiles[N.key],M&&M.hasData()&&(P=N)}let O=P;for(;O.overscaledZ>d;)if(O=O.scaledTo(O.overscaledZ-1),o[O.key]){y[P.key]=P;break}}}findLoadedParent(o,d){if(o.key in this._loadedParentTiles){const m=this._loadedParentTiles[o.key];return m&&m.tileID.overscaledZ>=d?m:null}for(let m=o.overscaledZ-1;m>=d;m--){const y=o.scaledTo(m),x=this._getLoadedTile(y);if(x)return x}}findLoadedSibling(o){return this._getLoadedTile(o)}_getLoadedTile(o){const d=this._tiles[o.key];return d&&d.hasData()?d:this._cache.getByKey(o.wrapped().key)}updateCacheSize(o){const d=Math.ceil(o.width/this._source.tileSize)+1,m=Math.ceil(o.height/this._source.tileSize)+1,y=Math.floor(d*m*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,y):y;this._cache.setMaxSize(x)}handleWrapJump(o){const d=Math.round((o-(this._prevLng===void 0?o:this._prevLng))/360);if(this._prevLng=o,d){const m={};for(const y in this._tiles){const x=this._tiles[y];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+d),m[x.tileID.key]=x}this._tiles=m;for(const y in this._timers)clearTimeout(this._timers[y]),delete this._timers[y];for(const y in this._tiles)this._setTileReloadTimer(y,this._tiles[y])}}_updateCoveredAndRetainedTiles(o,d,m,y,x,M){const P={},O={},N=Object.keys(o),V=E.now();for(const F of N){const Z=o[F],J=this._tiles[F];if(!J||J.fadeEndTime!==0&&J.fadeEndTime<=V)continue;const ee=this.findLoadedParent(Z,d),oe=this.findLoadedSibling(Z),le=ee||oe||null;le&&(this._addTile(le.tileID),P[le.tileID.key]=le.tileID),O[F]=Z}this._retainLoadedChildren(O,y,m,o);for(const F in P)o[F]||(this._coveredTiles[F]=!0,o[F]=P[F]);if(M){const F={},Z={};for(const J of x)this._tiles[J.key].hasData()?F[J.key]=J:Z[J.key]=J;for(const J in Z){const ee=Z[J].children(this._source.maxzoom);this._tiles[ee[0].key]&&this._tiles[ee[1].key]&&this._tiles[ee[2].key]&&this._tiles[ee[3].key]&&(F[ee[0].key]=o[ee[0].key]=ee[0],F[ee[1].key]=o[ee[1].key]=ee[1],F[ee[2].key]=o[ee[2].key]=ee[2],F[ee[3].key]=o[ee[3].key]=ee[3],delete Z[J])}for(const J in Z){const ee=Z[J],oe=this.findLoadedParent(ee,this._source.minzoom),le=this.findLoadedSibling(ee),ce=oe||le||null;if(ce){F[ce.tileID.key]=o[ce.tileID.key]=ce.tileID;for(const he in F)F[he].isChildOf(ce.tileID)&&delete F[he]}}for(const J in this._tiles)F[J]||(this._coveredTiles[J]=!0)}}update(o,d){if(!this._sourceLoaded||this._paused)return;let m;this.transform=o,this.terrain=d,this.updateCacheSize(o),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?m=o.getVisibleUnwrappedCoordinates(this._source.tileID).map(V=>new l.S(V.canonical.z,V.wrap,V.canonical.z,V.canonical.x,V.canonical.y)):(m=o.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:d}),this._source.hasTile&&(m=m.filter(V=>this._source.hasTile(V)))):m=[];const y=o.coveringZoomLevel(this._source),x=Math.max(y-Le.maxOverzooming,this._source.minzoom),M=Math.max(y+Le.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const V={};for(const F of m)if(F.canonical.z>this._source.minzoom){const Z=F.scaledTo(F.canonical.z-1);V[Z.key]=Z;const J=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));V[J.key]=J}m=m.concat(Object.values(V))}const P=m.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,P&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const O=this._updateRetainedTiles(m,y);Wt(this._source.type)&&this._updateCoveredAndRetainedTiles(O,x,M,y,m,d);for(const V in O)this._tiles[V].clearFadeHold();const N=l.ab(this._tiles,O);for(const V of N){const F=this._tiles[V];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(V)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const o in this._tiles)this._tiles[o].holdingForFade()&&this._removeTile(o)}_updateRetainedTiles(o,d){var m;const y={},x={},M=Math.max(d-Le.maxOverzooming,this._source.minzoom),P=Math.max(d+Le.maxUnderzooming,this._source.minzoom),O={};for(const N of o){const V=this._addTile(N);y[N.key]=N,V.hasData()||d<this._source.maxzoom&&(O[N.key]=N)}this._retainLoadedChildren(O,d,P,y);for(const N of o){let V=this._tiles[N.key];if(V.hasData())continue;if(d+1>this._source.maxzoom){const Z=N.children(this._source.maxzoom)[0],J=this.getTile(Z);if(J&&J.hasData()){y[Z.key]=Z;continue}}else{const Z=N.children(this._source.maxzoom);if(y[Z[0].key]&&y[Z[1].key]&&y[Z[2].key]&&y[Z[3].key])continue}let F=V.wasRequested();for(let Z=N.overscaledZ-1;Z>=M;--Z){const J=N.scaledTo(Z);if(x[J.key])break;if(x[J.key]=!0,V=this.getTile(J),!V&&F&&(V=this._addTile(J)),V){const ee=V.hasData();if((ee||!(!((m=this.map)===null||m===void 0)&&m.cancelPendingTileRequestsWhileZooming)||F)&&(y[J.key]=J),F=V.wasRequested(),ee)break}}}return y}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const o in this._tiles){const d=[];let m,y=this._tiles[o].tileID;for(;y.overscaledZ>0;){if(y.key in this._loadedParentTiles){m=this._loadedParentTiles[y.key];break}d.push(y.key);const x=y.scaledTo(y.overscaledZ-1);if(m=this._getLoadedTile(x),m)break;y=x}for(const x of d)this._loadedParentTiles[x]=m}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const o in this._tiles){const d=this._tiles[o].tileID,m=this._getLoadedTile(d);this._loadedSiblingTiles[d.key]=m}}_addTile(o){let d=this._tiles[o.key];if(d)return d;d=this._cache.getAndRemove(o),d&&(this._setTileReloadTimer(o.key,d),d.tileID=o,this._state.initializeTileState(d,this.map?this.map.painter:null),this._cacheTimers[o.key]&&(clearTimeout(this._cacheTimers[o.key]),delete this._cacheTimers[o.key],this._setTileReloadTimer(o.key,d)));const m=d;return d||(d=new To(o,this._source.tileSize*o.overscaleFactor()),this._loadTile(d,o.key,d.state)),d.uses++,this._tiles[o.key]=d,m||this._source.fire(new l.k("dataloading",{tile:d,coord:d.tileID,dataType:"source"})),d}_setTileReloadTimer(o,d){o in this._timers&&(clearTimeout(this._timers[o]),delete this._timers[o]);const m=d.getExpiryTimeout();m&&(this._timers[o]=setTimeout(()=>{this._reloadTile(o,"expired"),delete this._timers[o]},m))}_removeTile(o){const d=this._tiles[o];d&&(d.uses--,delete this._tiles[o],this._timers[o]&&(clearTimeout(this._timers[o]),delete this._timers[o]),d.uses>0||(d.hasData()&&d.state!=="reloading"?this._cache.add(d.tileID,d,d.getExpiryTimeout()):(d.aborted=!0,this._abortTile(d),this._unloadTile(d))))}_dataHandler(o){const d=o.sourceDataType;o.dataType==="source"&&d==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&d==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const o in this._tiles)this._removeTile(o);this._cache.reset()}tilesIn(o,d,m){const y=[],x=this.transform;if(!x)return y;const M=m?x.getCameraQueryGeometry(o):o,P=o.map(ee=>x.pointCoordinate(ee,this.terrain)),O=M.map(ee=>x.pointCoordinate(ee,this.terrain)),N=this.getIds();let V=1/0,F=1/0,Z=-1/0,J=-1/0;for(const ee of O)V=Math.min(V,ee.x),F=Math.min(F,ee.y),Z=Math.max(Z,ee.x),J=Math.max(J,ee.y);for(let ee=0;ee<N.length;ee++){const oe=this._tiles[N[ee]];if(oe.holdingForFade())continue;const le=oe.tileID,ce=Math.pow(2,x.zoom-oe.tileID.overscaledZ),he=d*oe.queryPadding*l.X/oe.tileSize/ce,ne=[le.getTilePoint(new l.Z(V,F)),le.getTilePoint(new l.Z(Z,J))];if(ne[0].x-he<l.X&&ne[0].y-he<l.X&&ne[1].x+he>=0&&ne[1].y+he>=0){const me=P.map(xe=>le.getTilePoint(xe)),ge=O.map(xe=>le.getTilePoint(xe));y.push({tile:oe,tileID:le,queryGeometry:me,cameraQueryGeometry:ge,scale:ce})}}return y}getVisibleCoordinates(o){const d=this.getRenderableIds(o).map(m=>this._tiles[m].tileID);for(const m of d)m.posMatrix=this.transform.calculatePosMatrix(m.toUnwrapped());return d}hasTransition(){if(this._source.hasTransition())return!0;if(Wt(this._source.type)){const o=E.now();for(const d in this._tiles)if(this._tiles[d].fadeEndTime>=o)return!0}return!1}setFeatureState(o,d,m){this._state.updateState(o=o||"_geojsonTileLayer",d,m)}removeFeatureState(o,d,m){this._state.removeFeatureState(o=o||"_geojsonTileLayer",d,m)}getFeatureState(o,d){return this._state.getState(o=o||"_geojsonTileLayer",d)}setDependencies(o,d,m){const y=this._tiles[o];y&&y.setDependencies(d,m)}reloadTilesForDependencies(o,d){for(const m in this._tiles)this._tiles[m].hasDependency(o,d)&&this._reloadTile(m,"reloading");this._cache.filter(m=>!m.hasDependency(o,d))}}function vt(v,o){const d=Math.abs(2*v.wrap)-+(v.wrap<0),m=Math.abs(2*o.wrap)-+(o.wrap<0);return v.overscaledZ-o.overscaledZ||m-d||o.canonical.y-v.canonical.y||o.canonical.x-v.canonical.x}function Wt(v){return v==="raster"||v==="image"||v==="video"}Le.maxOverzooming=10,Le.maxUnderzooming=3;class tt{constructor(o,d){this.reset(o,d)}reset(o,d){this.points=o||[],this._distances=[0];for(let m=1;m<this.points.length;m++)this._distances[m]=this._distances[m-1]+this.points[m].dist(this.points[m-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(d||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(o){if(this.points.length===1)return this.points[0];o=l.ac(o,0,1);let d=1,m=this._distances[d];const y=o*this.paddedLength+this.padding;for(;m<y&&d<this._distances.length;)m=this._distances[++d];const x=d-1,M=this._distances[x],P=m-M,O=P>0?(y-M)/P:0;return this.points[x].mult(1-O).add(this.points[d].mult(O))}}function Rn(v,o){let d=!0;return v==="always"||v!=="never"&&o!=="never"||(d=!1),d}class Kn{constructor(o,d,m){const y=this.boxCells=[],x=this.circleCells=[];this.xCellCount=Math.ceil(o/m),this.yCellCount=Math.ceil(d/m);for(let M=0;M<this.xCellCount*this.yCellCount;M++)y.push([]),x.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=o,this.height=d,this.xScale=this.xCellCount/o,this.yScale=this.yCellCount/d,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(o,d,m,y,x){this._forEachCell(d,m,y,x,this._insertBoxCell,this.boxUid++),this.boxKeys.push(o),this.bboxes.push(d),this.bboxes.push(m),this.bboxes.push(y),this.bboxes.push(x)}insertCircle(o,d,m,y){this._forEachCell(d-y,m-y,d+y,m+y,this._insertCircleCell,this.circleUid++),this.circleKeys.push(o),this.circles.push(d),this.circles.push(m),this.circles.push(y)}_insertBoxCell(o,d,m,y,x,M){this.boxCells[x].push(M)}_insertCircleCell(o,d,m,y,x,M){this.circleCells[x].push(M)}_query(o,d,m,y,x,M,P){if(m<0||o>this.width||y<0||d>this.height)return[];const O=[];if(o<=0&&d<=0&&this.width<=m&&this.height<=y){if(x)return[{key:null,x1:o,y1:d,x2:m,y2:y}];for(let N=0;N<this.boxKeys.length;N++)O.push({key:this.boxKeys[N],x1:this.bboxes[4*N],y1:this.bboxes[4*N+1],x2:this.bboxes[4*N+2],y2:this.bboxes[4*N+3]});for(let N=0;N<this.circleKeys.length;N++){const V=this.circles[3*N],F=this.circles[3*N+1],Z=this.circles[3*N+2];O.push({key:this.circleKeys[N],x1:V-Z,y1:F-Z,x2:V+Z,y2:F+Z})}}else this._forEachCell(o,d,m,y,this._queryCell,O,{hitTest:x,overlapMode:M,seenUids:{box:{},circle:{}}},P);return O}query(o,d,m,y){return this._query(o,d,m,y,!1,null)}hitTest(o,d,m,y,x,M){return this._query(o,d,m,y,!0,x,M).length>0}hitTestCircle(o,d,m,y,x){const M=o-m,P=o+m,O=d-m,N=d+m;if(P<0||M>this.width||N<0||O>this.height)return!1;const V=[];return this._forEachCell(M,O,P,N,this._queryCellCircle,V,{hitTest:!0,overlapMode:y,circle:{x:o,y:d,radius:m},seenUids:{box:{},circle:{}}},x),V.length>0}_queryCell(o,d,m,y,x,M,P,O){const{seenUids:N,hitTest:V,overlapMode:F}=P,Z=this.boxCells[x];if(Z!==null){const ee=this.bboxes;for(const oe of Z)if(!N.box[oe]){N.box[oe]=!0;const le=4*oe,ce=this.boxKeys[oe];if(o<=ee[le+2]&&d<=ee[le+3]&&m>=ee[le+0]&&y>=ee[le+1]&&(!O||O(ce))&&(!V||!Rn(F,ce.overlapMode))&&(M.push({key:ce,x1:ee[le],y1:ee[le+1],x2:ee[le+2],y2:ee[le+3]}),V))return!0}}const J=this.circleCells[x];if(J!==null){const ee=this.circles;for(const oe of J)if(!N.circle[oe]){N.circle[oe]=!0;const le=3*oe,ce=this.circleKeys[oe];if(this._circleAndRectCollide(ee[le],ee[le+1],ee[le+2],o,d,m,y)&&(!O||O(ce))&&(!V||!Rn(F,ce.overlapMode))){const he=ee[le],ne=ee[le+1],me=ee[le+2];if(M.push({key:ce,x1:he-me,y1:ne-me,x2:he+me,y2:ne+me}),V)return!0}}}return!1}_queryCellCircle(o,d,m,y,x,M,P,O){const{circle:N,seenUids:V,overlapMode:F}=P,Z=this.boxCells[x];if(Z!==null){const ee=this.bboxes;for(const oe of Z)if(!V.box[oe]){V.box[oe]=!0;const le=4*oe,ce=this.boxKeys[oe];if(this._circleAndRectCollide(N.x,N.y,N.radius,ee[le+0],ee[le+1],ee[le+2],ee[le+3])&&(!O||O(ce))&&!Rn(F,ce.overlapMode))return M.push(!0),!0}}const J=this.circleCells[x];if(J!==null){const ee=this.circles;for(const oe of J)if(!V.circle[oe]){V.circle[oe]=!0;const le=3*oe,ce=this.circleKeys[oe];if(this._circlesCollide(ee[le],ee[le+1],ee[le+2],N.x,N.y,N.radius)&&(!O||O(ce))&&!Rn(F,ce.overlapMode))return M.push(!0),!0}}}_forEachCell(o,d,m,y,x,M,P,O){const N=this._convertToXCellCoord(o),V=this._convertToYCellCoord(d),F=this._convertToXCellCoord(m),Z=this._convertToYCellCoord(y);for(let J=N;J<=F;J++)for(let ee=V;ee<=Z;ee++)if(x.call(this,o,d,m,y,this.xCellCount*ee+J,M,P,O))return}_convertToXCellCoord(o){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(o*this.xScale)))}_convertToYCellCoord(o){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(o*this.yScale)))}_circlesCollide(o,d,m,y,x,M){const P=y-o,O=x-d,N=m+M;return N*N>P*P+O*O}_circleAndRectCollide(o,d,m,y,x,M,P){const O=(M-y)/2,N=Math.abs(o-(y+O));if(N>O+m)return!1;const V=(P-x)/2,F=Math.abs(d-(x+V));if(F>V+m)return!1;if(N<=O||F<=V)return!0;const Z=N-O,J=F-V;return Z*Z+J*J<=m*m}}function qi(v,o,d,m,y){const x=l.H();return o?(l.K(x,x,[1/y,1/y,1]),d||l.ad(x,x,m.angle)):l.L(x,m.labelPlaneMatrix,v),x}function fr(v,o,d,m,y){if(o){const x=l.ae(v);return l.K(x,x,[y,y,1]),d||l.ad(x,x,-m.angle),x}return m.glCoordMatrix}function se(v,o,d,m){let y;m?(y=[v,o,m(v,o),1],l.af(y,y,d)):(y=[v,o,0,1],an(y,y,d));const x=y[3];return{point:new l.P(y[0]/x,y[1]/x),signedDistanceFromCamera:x,isOccluded:!1}}function H(v,o){return .5+v/o*.5}function U(v,o){return v.x>=-o[0]&&v.x<=o[0]&&v.y>=-o[1]&&v.y<=o[1]}function X(v,o,d,m,y,x,M,P,O,N,V,F,Z,J,ee){const oe=m?v.textSizeData:v.iconSizeData,le=l.ag(oe,d.transform.zoom),ce=[256/d.width*2+1,256/d.height*2+1],he=m?v.text.dynamicLayoutVertexArray:v.icon.dynamicLayoutVertexArray;he.clear();const ne=v.lineVertexArray,me=m?v.text.placedSymbolArray:v.icon.placedSymbolArray,ge=d.transform.width/d.transform.height;let xe=!1;for(let Oe=0;Oe<me.length;Oe++){const Fe=me.get(Oe);if(Fe.hidden||Fe.writingMode===l.ah.vertical&&!xe){kt(Fe.numGlyphs,he);continue}xe=!1;const et=se(Fe.anchorX,Fe.anchorY,o,ee);if(!U(et.point,ce)){kt(Fe.numGlyphs,he);continue}const at=H(d.transform.cameraToCenterDistance,et.signedDistanceFromCamera),Ye=l.ai(oe,le,Fe),Ge=M?Ye/at:Ye*at,mt={getElevation:ee,labelPlaneMatrix:y,lineVertexArray:ne,pitchWithMap:M,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:N,tileAnchorPoint:new l.P(Fe.anchorX,Fe.anchorY),unwrappedTileID:V,width:F,height:Z,translation:J},Bt=fe(mt,Fe,Ge,!1,P,o,x,v.glyphOffsetArray,he,ge,O);xe=Bt.useVertical,(Bt.notEnoughRoom||xe||Bt.needsFlipping&&fe(mt,Fe,Ge,!0,P,o,x,v.glyphOffsetArray,he,ge,O).notEnoughRoom)&&kt(Fe.numGlyphs,he)}m?v.text.dynamicLayoutVertexBuffer.updateData(he):v.icon.dynamicLayoutVertexBuffer.updateData(he)}function ie(v,o,d,m,y,x,M,P){const O=x.glyphStartIndex+x.numGlyphs,N=x.lineStartIndex,V=x.lineStartIndex+x.lineLength,F=o.getoffsetX(x.glyphStartIndex),Z=o.getoffsetX(O-1),J=We(v*F,d,m,y,x.segment,N,V,P,M);if(!J)return null;const ee=We(v*Z,d,m,y,x.segment,N,V,P,M);return ee?P.projectionCache.anyProjectionOccluded?null:{first:J,last:ee}:null}function de(v,o,d,m){return v===l.ah.horizontal&&Math.abs(d.y-o.y)>Math.abs(d.x-o.x)*m?{useVertical:!0}:(v===l.ah.vertical?o.y<d.y:o.x>d.x)?{needsFlipping:!0}:null}function fe(v,o,d,m,y,x,M,P,O,N,V){const F=d/24,Z=o.lineOffsetX*F,J=o.lineOffsetY*F;let ee;if(o.numGlyphs>1){const oe=o.glyphStartIndex+o.numGlyphs,le=o.lineStartIndex,ce=o.lineStartIndex+o.lineLength,he=ie(F,P,Z,J,m,o,V,v);if(!he)return{notEnoughRoom:!0};const ne=se(he.first.point.x,he.first.point.y,M,v.getElevation).point,me=se(he.last.point.x,he.last.point.y,M,v.getElevation).point;if(y&&!m){const ge=de(o.writingMode,ne,me,N);if(ge)return ge}ee=[he.first];for(let ge=o.glyphStartIndex+1;ge<oe-1;ge++)ee.push(We(F*P.getoffsetX(ge),Z,J,m,o.segment,le,ce,v,V));ee.push(he.last)}else{if(y&&!m){const le=se(v.tileAnchorPoint.x,v.tileAnchorPoint.y,x,v.getElevation).point,ce=o.lineStartIndex+o.segment+1,he=new l.P(v.lineVertexArray.getx(ce),v.lineVertexArray.gety(ce)),ne=se(he.x,he.y,x,v.getElevation),me=ne.signedDistanceFromCamera>0?ne.point:function(xe,Oe,Fe,et,at,Ye){return _e(xe,Oe,Fe,1,at,Ye)}(v.tileAnchorPoint,he,le,0,x,v),ge=de(o.writingMode,le,me,N);if(ge)return ge}const oe=We(F*P.getoffsetX(o.glyphStartIndex),Z,J,m,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,v,V);if(!oe||v.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};ee=[oe]}for(const oe of ee)l.aj(O,oe.point,oe.angle);return{}}function _e(v,o,d,m,y,x){const M=v.add(v.sub(o)._unit()),P=y!==void 0?se(M.x,M.y,y,x.getElevation).point:Me(M.x,M.y,x).point,O=d.sub(P);return d.add(O._mult(m/O.mag()))}function ue(v,o,d){const m=o.projectionCache;if(m.projections[v])return m.projections[v];const y=new l.P(o.lineVertexArray.getx(v),o.lineVertexArray.gety(v)),x=Me(y.x,y.y,o);if(x.signedDistanceFromCamera>0)return m.projections[v]=x.point,m.anyProjectionOccluded=m.anyProjectionOccluded||x.isOccluded,x.point;const M=v-d.direction;return function(P,O,N,V,F){return _e(P,O,N,V,void 0,F)}(d.distanceFromAnchor===0?o.tileAnchorPoint:new l.P(o.lineVertexArray.getx(M),o.lineVertexArray.gety(M)),y,d.previousVertex,d.absOffsetX-d.distanceFromAnchor+1,o)}function Me(v,o,d){const m=v+d.translation[0],y=o+d.translation[1];let x;return!d.pitchWithMap&&d.projection.useSpecialProjectionForSymbols?(x=d.projection.projectTileCoordinates(m,y,d.unwrappedTileID,d.getElevation),x.point.x=(.5*x.point.x+.5)*d.width,x.point.y=(.5*-x.point.y+.5)*d.height):(x=se(m,y,d.labelPlaneMatrix,d.getElevation),x.isOccluded=!1),x}function ze(v,o,d){return v._unit()._perp()._mult(o*d)}function Ee(v,o,d,m,y,x,M,P,O){if(P.projectionCache.offsets[v])return P.projectionCache.offsets[v];const N=d.add(o);if(v+O.direction<m||v+O.direction>=y)return P.projectionCache.offsets[v]=N,N;const V=ue(v+O.direction,P,O),F=ze(V.sub(d),M,O.direction),Z=d.add(F),J=V.add(F);return P.projectionCache.offsets[v]=l.ak(x,N,Z,J)||N,P.projectionCache.offsets[v]}function We(v,o,d,m,y,x,M,P,O){const N=m?v-o:v+o;let V=N>0?1:-1,F=0;m&&(V*=-1,F=Math.PI),V<0&&(F+=Math.PI);let Z,J=V>0?x+y:x+y+1;P.projectionCache.cachedAnchorPoint?Z=P.projectionCache.cachedAnchorPoint:(Z=Me(P.tileAnchorPoint.x,P.tileAnchorPoint.y,P).point,P.projectionCache.cachedAnchorPoint=Z);let ee,oe,le=Z,ce=Z,he=0,ne=0;const me=Math.abs(N),ge=[];let xe;for(;he+ne<=me;){if(J+=V,J<x||J>=M)return null;he+=ne,ce=le,oe=ee;const et={absOffsetX:me,direction:V,distanceFromAnchor:he,previousVertex:ce};if(le=ue(J,P,et),d===0)ge.push(ce),xe=le.sub(ce);else{let at;const Ye=le.sub(ce);at=Ye.mag()===0?ze(ue(J+V,P,et).sub(le),d,V):ze(Ye,d,V),oe||(oe=ce.add(at)),ee=Ee(J,at,le,x,M,oe,d,P,et),ge.push(oe),xe=ee.sub(oe)}ne=xe.mag()}const Oe=xe._mult((me-he)/ne)._add(oe||ce),Fe=F+Math.atan2(le.y-ce.y,le.x-ce.x);return ge.push(Oe),{point:Oe,angle:O?Fe:0,path:ge}}const xt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function kt(v,o){for(let d=0;d<v;d++){const m=o.length;o.resize(m+4),o.float32.set(xt,3*m)}}function an(v,o,d){const m=o[0],y=o[1];return v[0]=d[0]*m+d[4]*y+d[12],v[1]=d[1]*m+d[5]*y+d[13],v[3]=d[3]*m+d[7]*y+d[15],v}const Lt=100;class ln{constructor(o,d,m=new Kn(o.width+200,o.height+200,25),y=new Kn(o.width+200,o.height+200,25)){this.transform=o,this.mapProjection=d,this.grid=m,this.ignoredGrid=y,this.pitchFactor=Math.cos(o._pitch)*o.cameraToCenterDistance,this.screenRightBoundary=o.width+Lt,this.screenBottomBoundary=o.height+Lt,this.gridRightBoundary=o.width+200,this.gridBottomBoundary=o.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(o,d,m,y,x,M,P,O,N,V,F){const Z=o.anchorPointX+O[0],J=o.anchorPointY+O[1],ee=this.projectAndGetPerspectiveRatio(y,Z,J,x,V),oe=m*ee.perspectiveRatio;let le;if(M||P)le=this._projectCollisionBox(o,oe,y,x,M,P,O,ee,V,F);else{const ge=ee.point.x+(F?F.x*oe:0),xe=ee.point.y+(F?F.y*oe:0);le={allPointsOccluded:!1,box:[ge+o.x1*oe,xe+o.y1*oe,ge+o.x2*oe,xe+o.y2*oe]}}const[ce,he,ne,me]=le.box;return this.mapProjection.useSpecialProjectionForSymbols&&(M?le.allPointsOccluded:this.mapProjection.isOccluded(Z,J,x))||ee.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(ce,he,ne,me)||d!=="always"&&this.grid.hitTest(ce,he,ne,me,d,N)?{box:[ce,he,ne,me],placeable:!1,offscreen:!1}:{box:[ce,he,ne,me],placeable:!0,offscreen:this.isOffscreen(ce,he,ne,me)}}placeCollisionCircles(o,d,m,y,x,M,P,O,N,V,F,Z,J,ee,oe,le){const ce=[],he=new l.P(d.anchorX,d.anchorY),ne=this.getPerspectiveRatio(M,he.x,he.y,P,le),me=(F?x/ne:x*ne)/l.ap,ge={getElevation:le,labelPlaneMatrix:O,lineVertexArray:m,pitchWithMap:F,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:he,unwrappedTileID:P,width:this.transform.width,height:this.transform.height,translation:oe},xe=ie(me,y,d.lineOffsetX*me,d.lineOffsetY*me,!1,d,!1,ge);let Oe=!1,Fe=!1,et=!0;if(xe){const at=.5*J*ne+ee,Ye=new l.P(-100,-100),Ge=new l.P(this.screenRightBoundary,this.screenBottomBoundary),mt=new tt,Bt=xe.first,Je=xe.last;let it=[];for(let $t=Bt.path.length-1;$t>=1;$t--)it.push(Bt.path[$t]);for(let $t=1;$t<Je.path.length;$t++)it.push(Je.path[$t]);const Dt=2.5*at;if(N){const $t=this.projectPathToScreenSpace(it,ge,N);it=$t.some(Jt=>Jt.signedDistanceFromCamera<=0)?[]:$t.map(Jt=>Jt.point)}let Fn=[];if(it.length>0){const $t=it[0].clone(),Jt=it[0].clone();for(let $n=1;$n<it.length;$n++)$t.x=Math.min($t.x,it[$n].x),$t.y=Math.min($t.y,it[$n].y),Jt.x=Math.max(Jt.x,it[$n].x),Jt.y=Math.max(Jt.y,it[$n].y);Fn=$t.x>=Ye.x&&Jt.x<=Ge.x&&$t.y>=Ye.y&&Jt.y<=Ge.y?[it]:Jt.x<Ye.x||$t.x>Ge.x||Jt.y<Ye.y||$t.y>Ge.y?[]:l.al([it],Ye.x,Ye.y,Ge.x,Ge.y)}for(const $t of Fn){mt.reset($t,.25*at);let Jt=0;Jt=mt.length<=.5*at?1:Math.ceil(mt.paddedLength/Dt)+1;for(let $n=0;$n<Jt;$n++){const Bi=$n/Math.max(Jt-1,1),io=mt.lerp(Bi),jn=io.x+Lt,rr=io.y+Lt;ce.push(jn,rr,at,0);const Gi=jn-at,zi=rr-at,Zi=jn+at,Po=rr+at;if(et=et&&this.isOffscreen(Gi,zi,Zi,Po),Fe=Fe||this.isInsideGrid(Gi,zi,Zi,Po),o!=="always"&&this.grid.hitTestCircle(jn,rr,at,o,Z)&&(Oe=!0,!V))return{circles:[],offscreen:!1,collisionDetected:Oe}}}}return{circles:!V&&Oe||!Fe||ne<this.perspectiveRatioCutoff?[]:ce,offscreen:et,collisionDetected:Oe}}projectPathToScreenSpace(o,d,m){return o.map(y=>se(y.x,y.y,m,d.getElevation))}queryRenderedSymbols(o){if(o.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const d=[];let m=1/0,y=1/0,x=-1/0,M=-1/0;for(const V of o){const F=new l.P(V.x+Lt,V.y+Lt);m=Math.min(m,F.x),y=Math.min(y,F.y),x=Math.max(x,F.x),M=Math.max(M,F.y),d.push(F)}const P=this.grid.query(m,y,x,M).concat(this.ignoredGrid.query(m,y,x,M)),O={},N={};for(const V of P){const F=V.key;if(O[F.bucketInstanceId]===void 0&&(O[F.bucketInstanceId]={}),O[F.bucketInstanceId][F.featureIndex])continue;const Z=[new l.P(V.x1,V.y1),new l.P(V.x2,V.y1),new l.P(V.x2,V.y2),new l.P(V.x1,V.y2)];l.am(d,Z)&&(O[F.bucketInstanceId][F.featureIndex]=!0,N[F.bucketInstanceId]===void 0&&(N[F.bucketInstanceId]=[]),N[F.bucketInstanceId].push(F.featureIndex))}return N}insertCollisionBox(o,d,m,y,x,M){(m?this.ignoredGrid:this.grid).insert({bucketInstanceId:y,featureIndex:x,collisionGroupID:M,overlapMode:d},o[0],o[1],o[2],o[3])}insertCollisionCircles(o,d,m,y,x,M){const P=m?this.ignoredGrid:this.grid,O={bucketInstanceId:y,featureIndex:x,collisionGroupID:M,overlapMode:d};for(let N=0;N<o.length;N+=4)P.insertCircle(O,o[N],o[N+1],o[N+2])}projectAndGetPerspectiveRatio(o,d,m,y,x){let M;x?(M=[d,m,x(d,m),1],l.af(M,M,o)):(M=[d,m,0,1],an(M,M,o));const P=M[3];return{point:new l.P((M[0]/P+1)/2*this.transform.width+Lt,(-M[1]/P+1)/2*this.transform.height+Lt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/P*.5,isOccluded:!1,signedDistanceFromCamera:P}}getPerspectiveRatio(o,d,m,y,x){const M=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(d,m,y,x):se(d,m,o,x);return .5+this.transform.cameraToCenterDistance/M.signedDistanceFromCamera*.5}isOffscreen(o,d,m,y){return m<Lt||o>=this.screenRightBoundary||y<Lt||d>this.screenBottomBoundary}isInsideGrid(o,d,m,y){return m>=0&&o<this.gridRightBoundary&&y>=0&&d<this.gridBottomBoundary}getViewportMatrix(){const o=l.an([]);return l.J(o,o,[-100,-100,0]),o}_projectCollisionBox(o,d,m,y,x,M,P,O,N,V){let F=new l.P(1,0),Z=new l.P(0,1);const J=new l.P(o.anchorPointX+P[0],o.anchorPointY+P[1]);if(M&&!x){const et=this.projectAndGetPerspectiveRatio(m,J.x+1,J.y,y,N).point.sub(O.point).unit(),at=Math.atan(et.y/et.x)+(et.x<0?Math.PI:0),Ye=Math.sin(at),Ge=Math.cos(at);F=new l.P(Ge,Ye),Z=new l.P(-Ye,Ge)}else if(!M&&x){const et=-this.transform.angle,at=Math.sin(et),Ye=Math.cos(et);F=new l.P(Ye,at),Z=new l.P(-at,Ye)}let ee=O.point,oe=d;if(x){ee=J;const et=this.transform.zoom-Math.floor(this.transform.zoom);oe=Math.pow(2,-et),oe*=this.mapProjection.getPitchedTextCorrection(this.transform,J,y),V||(oe*=l.ac(.5+O.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}V&&(ee=ee.add(F.mult(V.x*oe)).add(Z.mult(V.y*oe)));const le=o.x1*oe,ce=o.x2*oe,he=(le+ce)/2,ne=o.y1*oe,me=o.y2*oe,ge=(ne+me)/2,xe=[{offsetX:le,offsetY:ne},{offsetX:he,offsetY:ne},{offsetX:ce,offsetY:ne},{offsetX:ce,offsetY:ge},{offsetX:ce,offsetY:me},{offsetX:he,offsetY:me},{offsetX:le,offsetY:me},{offsetX:le,offsetY:ge}];let Oe=[];for(const{offsetX:et,offsetY:at}of xe)Oe.push(new l.P(ee.x+F.x*et+Z.x*at,ee.y+F.y*et+Z.y*at));let Fe=!1;if(x){const et=Oe.map(at=>this.projectAndGetPerspectiveRatio(m,at.x,at.y,y,N));Fe=et.some(at=>!at.isOccluded),Oe=et.map(at=>at.point)}else Fe=!0;return{box:l.ao(Oe),allPointsOccluded:!Fe}}}function Kt(v,o,d){return o*(l.X/(v.tileSize*Math.pow(2,d-v.tileID.overscaledZ)))}class oi{constructor(o,d,m,y){this.opacity=o?Math.max(0,Math.min(1,o.opacity+(o.placed?d:-d))):y&&m?1:0,this.placed=m}isHidden(){return this.opacity===0&&!this.placed}}class Zn{constructor(o,d,m,y,x){this.text=new oi(o?o.text:null,d,m,x),this.icon=new oi(o?o.icon:null,d,y,x)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ut{constructor(o,d,m){this.text=o,this.icon=d,this.skipFade=m}}class wn{constructor(){this.invProjMatrix=l.H(),this.viewportMatrix=l.H(),this.circles=[]}}class qn{constructor(o,d,m,y,x){this.bucketInstanceId=o,this.featureIndex=d,this.sourceLayerIndex=m,this.bucketIndex=y,this.tileID=x}}class gi{constructor(o){this.crossSourceCollisions=o,this.maxGroupID=0,this.collisionGroups={}}get(o){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[o]){const d=++this.maxGroupID;this.collisionGroups[o]={ID:d,predicate:m=>m.collisionGroupID===d}}return this.collisionGroups[o]}}function Si(v,o,d,m,y){const{horizontalAlign:x,verticalAlign:M}=l.au(v);return new l.P(-(x-.5)*o+m[0]*y,-(M-.5)*d+m[1]*y)}class Wi{constructor(o,d,m,y,x,M){this.transform=o.clone(),this.terrain=m,this.collisionIndex=new ln(this.transform,d),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=y,this.retainedQueryData={},this.collisionGroups=new gi(x),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(o){const d=this.terrain;return d?(m,y)=>d.getElevation(o,m,y):null}getBucketParts(o,d,m,y){const x=m.getBucket(d),M=m.latestFeatureIndex;if(!x||!M||d.id!==x.layerIds[0])return;const P=m.collisionBoxArray,O=x.layers[0].layout,N=x.layers[0].paint,V=Math.pow(2,this.transform.zoom-m.tileID.overscaledZ),F=m.tileSize/l.X,Z=m.tileID.toUnwrapped(),J=this.transform.calculatePosMatrix(Z),ee=O.get("text-pitch-alignment")==="map",oe=O.get("text-rotation-alignment")==="map",le=Kt(m,1,this.transform.zoom),ce=this.collisionIndex.mapProjection.translatePosition(this.transform,m,N.get("text-translate"),N.get("text-translate-anchor")),he=this.collisionIndex.mapProjection.translatePosition(this.transform,m,N.get("icon-translate"),N.get("icon-translate-anchor")),ne=qi(J,ee,oe,this.transform,le);let me=null;if(ee){const xe=fr(J,ee,oe,this.transform,le);me=l.L([],this.transform.labelPlaneMatrix,xe)}this.retainedQueryData[x.bucketInstanceId]=new qn(x.bucketInstanceId,M,x.sourceLayerIndex,x.index,m.tileID);const ge={bucket:x,layout:O,translationText:ce,translationIcon:he,posMatrix:J,unwrappedTileID:Z,textLabelPlaneMatrix:ne,labelToScreenMatrix:me,scale:V,textPixelRatio:F,holdingForFade:m.holdingForFade(),collisionBoxArray:P,partiallyEvaluatedTextSize:l.ag(x.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(x.sourceID)};if(y)for(const xe of x.sortKeyRanges){const{sortKey:Oe,symbolInstanceStart:Fe,symbolInstanceEnd:et}=xe;o.push({sortKey:Oe,symbolInstanceStart:Fe,symbolInstanceEnd:et,parameters:ge})}else o.push({symbolInstanceStart:0,symbolInstanceEnd:x.symbolInstances.length,parameters:ge})}attemptAnchorPlacement(o,d,m,y,x,M,P,O,N,V,F,Z,J,ee,oe,le,ce,he,ne){const me=l.aq[o.textAnchor],ge=[o.textOffset0,o.textOffset1],xe=Si(me,m,y,ge,x),Oe=this.collisionIndex.placeCollisionBox(d,Z,O,N,V,P,M,le,F.predicate,ne,xe);if((!he||this.collisionIndex.placeCollisionBox(he,Z,O,N,V,P,M,ce,F.predicate,ne,xe).placeable)&&Oe.placeable){let Fe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[J.crossTileID]&&this.prevPlacement.placements[J.crossTileID]&&this.prevPlacement.placements[J.crossTileID].text&&(Fe=this.prevPlacement.variableOffsets[J.crossTileID].anchor),J.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[J.crossTileID]={textOffset:ge,width:m,height:y,anchor:me,textBoxScale:x,prevAnchor:Fe},this.markUsedJustification(ee,me,J,oe),ee.allowVerticalPlacement&&(this.markUsedOrientation(ee,oe,J),this.placedOrientations[J.crossTileID]=oe),{shift:xe,placedGlyphBoxes:Oe}}}placeLayerBucketPart(o,d,m){const{bucket:y,layout:x,translationText:M,translationIcon:P,posMatrix:O,unwrappedTileID:N,textLabelPlaneMatrix:V,labelToScreenMatrix:F,textPixelRatio:Z,holdingForFade:J,collisionBoxArray:ee,partiallyEvaluatedTextSize:oe,collisionGroup:le}=o.parameters,ce=x.get("text-optional"),he=x.get("icon-optional"),ne=l.ar(x,"text-overlap","text-allow-overlap"),me=ne==="always",ge=l.ar(x,"icon-overlap","icon-allow-overlap"),xe=ge==="always",Oe=x.get("text-rotation-alignment")==="map",Fe=x.get("text-pitch-alignment")==="map",et=x.get("icon-text-fit")!=="none",at=x.get("symbol-z-order")==="viewport-y",Ye=me&&(xe||!y.hasIconData()||he),Ge=xe&&(me||!y.hasTextData()||ce);!y.collisionArrays&&ee&&y.deserializeCollisionBoxes(ee);const mt=this._getTerrainElevationFunc(this.retainedQueryData[y.bucketInstanceId].tileID),Bt=(Je,it,Dt)=>{var Fn,$t;if(d[Je.crossTileID])return;if(J)return void(this.placements[Je.crossTileID]=new Ut(!1,!1,!1));let Jt=!1,$n=!1,Bi=!0,io=null,jn={box:null,placeable:!1,offscreen:null},rr={box:null,placeable:!1,offscreen:null},Gi=null,zi=null,Zi=null,Po=0,Ka=0,Du=0;it.textFeatureIndex?Po=it.textFeatureIndex:Je.useRuntimeCollisionCircles&&(Po=Je.featureIndex),it.verticalTextFeatureIndex&&(Ka=it.verticalTextFeatureIndex);const Ja=it.textBox;if(Ja){const $r=Ei=>{let Ni=l.ah.horizontal;if(y.allowVerticalPlacement&&!Ei&&this.prevPlacement){const xr=this.prevPlacement.placedOrientations[Je.crossTileID];xr&&(this.placedOrientations[Je.crossTileID]=xr,Ni=xr,this.markUsedOrientation(y,Ni,Je))}return Ni},jr=(Ei,Ni)=>{if(y.allowVerticalPlacement&&Je.numVerticalGlyphVertices>0&&it.verticalTextBox){for(const xr of y.writingModes)if(xr===l.ah.vertical?(jn=Ni(),rr=jn):jn=Ei(),jn&&jn.placeable)break}else jn=Ei()},fs=Je.textAnchorOffsetStartIndex,ro=Je.textAnchorOffsetEndIndex;if(ro===fs){const Ei=(Ni,xr)=>{const tn=this.collisionIndex.placeCollisionBox(Ni,ne,Z,O,N,Fe,Oe,M,le.predicate,mt);return tn&&tn.placeable&&(this.markUsedOrientation(y,xr,Je),this.placedOrientations[Je.crossTileID]=xr),tn};jr(()=>Ei(Ja,l.ah.horizontal),()=>{const Ni=it.verticalTextBox;return y.allowVerticalPlacement&&Je.numVerticalGlyphVertices>0&&Ni?Ei(Ni,l.ah.vertical):{box:null,offscreen:null}}),$r(jn&&jn.placeable)}else{let Ei=l.aq[($t=(Fn=this.prevPlacement)===null||Fn===void 0?void 0:Fn.variableOffsets[Je.crossTileID])===null||$t===void 0?void 0:$t.anchor];const Ni=(tn,Js,Qa)=>{const el=tn.x2-tn.x1,Pm=tn.y2-tn.y1,O_=Je.textBoxScale,Dm=et&&ge==="never"?Js:null;let ms=null,Om=ne==="never"?1:2,Bu="never";Ei&&Om++;for(let nc=0;nc<Om;nc++){for(let zu=fs;zu<ro;zu++){const Nu=y.textAnchorOffsets.get(zu);if(Ei&&Nu.textAnchor!==Ei)continue;const tl=this.attemptAnchorPlacement(Nu,tn,el,Pm,O_,Oe,Fe,Z,O,N,le,Bu,Je,y,Qa,M,P,Dm,mt);if(tl&&(ms=tl.placedGlyphBoxes,ms&&ms.placeable))return Jt=!0,io=tl.shift,ms}Ei?Ei=null:Bu=ne}return m&&!ms&&(ms={box:this.collisionIndex.placeCollisionBox(Ja,"always",Z,O,N,Fe,Oe,M,le.predicate,mt,new l.P(0,0)).box,offscreen:!1,placeable:!1}),ms};jr(()=>Ni(Ja,it.iconBox,l.ah.horizontal),()=>{const tn=it.verticalTextBox;return y.allowVerticalPlacement&&(!jn||!jn.placeable)&&Je.numVerticalGlyphVertices>0&&tn?Ni(tn,it.verticalIconBox,l.ah.vertical):{box:null,occluded:!0,offscreen:null}}),jn&&(Jt=jn.placeable,Bi=jn.offscreen);const xr=$r(jn&&jn.placeable);if(!Jt&&this.prevPlacement){const tn=this.prevPlacement.variableOffsets[Je.crossTileID];tn&&(this.variableOffsets[Je.crossTileID]=tn,this.markUsedJustification(y,tn.anchor,Je,xr))}}}if(Gi=jn,Jt=Gi&&Gi.placeable,Bi=Gi&&Gi.offscreen,Je.useRuntimeCollisionCircles){const $r=y.text.placedSymbolArray.get(Je.centerJustifiedTextSymbolIndex),jr=l.ai(y.textSizeData,oe,$r),fs=x.get("text-padding");zi=this.collisionIndex.placeCollisionCircles(ne,$r,y.lineVertexArray,y.glyphOffsetArray,jr,O,N,V,F,m,Fe,le.predicate,Je.collisionCircleDiameter,fs,M,mt),zi.circles.length&&zi.collisionDetected&&!m&&l.w("Collisions detected, but collision boxes are not shown"),Jt=me||zi.circles.length>0&&!zi.collisionDetected,Bi=Bi&&zi.offscreen}if(it.iconFeatureIndex&&(Du=it.iconFeatureIndex),it.iconBox){const $r=jr=>this.collisionIndex.placeCollisionBox(jr,ge,Z,O,N,Fe,Oe,P,le.predicate,mt,et&&io?io:void 0);rr&&rr.placeable&&it.verticalIconBox?(Zi=$r(it.verticalIconBox),$n=Zi.placeable):(Zi=$r(it.iconBox),$n=Zi.placeable),Bi=Bi&&Zi.offscreen}const Fr=ce||Je.numHorizontalGlyphVertices===0&&Je.numVerticalGlyphVertices===0,Ou=he||Je.numIconVertices===0;Fr||Ou?Ou?Fr||($n=$n&&Jt):Jt=$n&&Jt:$n=Jt=$n&&Jt;const Rd=$n&&Zi.placeable;if(Jt&&Gi.placeable&&this.collisionIndex.insertCollisionBox(Gi.box,ne,x.get("text-ignore-placement"),y.bucketInstanceId,rr&&rr.placeable&&Ka?Ka:Po,le.ID),Rd&&this.collisionIndex.insertCollisionBox(Zi.box,ge,x.get("icon-ignore-placement"),y.bucketInstanceId,Du,le.ID),zi&&Jt&&this.collisionIndex.insertCollisionCircles(zi.circles,ne,x.get("text-ignore-placement"),y.bucketInstanceId,Po,le.ID),m&&this.storeCollisionData(y.bucketInstanceId,Dt,it,Gi,Zi,zi),Je.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(y.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Je.crossTileID]=new Ut(Jt||Ye,$n||Ge,Bi||y.justReloaded),d[Je.crossTileID]=!0};if(at){if(o.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Je=y.getSortedSymbolIndexes(this.transform.angle);for(let it=Je.length-1;it>=0;--it){const Dt=Je[it];Bt(y.symbolInstances.get(Dt),y.collisionArrays[Dt],Dt)}}else for(let Je=o.symbolInstanceStart;Je<o.symbolInstanceEnd;Je++)Bt(y.symbolInstances.get(Je),y.collisionArrays[Je],Je);if(m&&y.bucketInstanceId in this.collisionCircleArrays){const Je=this.collisionCircleArrays[y.bucketInstanceId];l.as(Je.invProjMatrix,O),Je.viewportMatrix=this.collisionIndex.getViewportMatrix()}y.justReloaded=!1}storeCollisionData(o,d,m,y,x,M){if(m.textBox||m.iconBox){let P,O;this.collisionBoxArrays.has(o)?P=this.collisionBoxArrays.get(o):(P=new Map,this.collisionBoxArrays.set(o,P)),P.has(d)?O=P.get(d):(O={text:null,icon:null},P.set(d,O)),m.textBox&&(O.text=y.box),m.iconBox&&(O.icon=x.box)}if(M){let P=this.collisionCircleArrays[o];P===void 0&&(P=this.collisionCircleArrays[o]=new wn);for(let O=0;O<M.circles.length;O+=4)P.circles.push(M.circles[O+0]),P.circles.push(M.circles[O+1]),P.circles.push(M.circles[O+2]),P.circles.push(M.collisionDetected?1:0)}}markUsedJustification(o,d,m,y){let x;x=y===l.ah.vertical?m.verticalPlacedTextSymbolIndex:{left:m.leftJustifiedTextSymbolIndex,center:m.centerJustifiedTextSymbolIndex,right:m.rightJustifiedTextSymbolIndex}[l.at(d)];const M=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex,m.verticalPlacedTextSymbolIndex];for(const P of M)P>=0&&(o.text.placedSymbolArray.get(P).crossTileID=x>=0&&P!==x?0:m.crossTileID)}markUsedOrientation(o,d,m){const y=d===l.ah.horizontal||d===l.ah.horizontalOnly?d:0,x=d===l.ah.vertical?d:0,M=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex];for(const P of M)o.text.placedSymbolArray.get(P).placedOrientation=y;m.verticalPlacedTextSymbolIndex&&(o.text.placedSymbolArray.get(m.verticalPlacedTextSymbolIndex).placedOrientation=x)}commit(o){this.commitTime=o,this.zoomAtLastRecencyCheck=this.transform.zoom;const d=this.prevPlacement;let m=!1;this.prevZoomAdjustment=d?d.zoomAdjustment(this.transform.zoom):0;const y=d?d.symbolFadeChange(o):1,x=d?d.opacities:{},M=d?d.variableOffsets:{},P=d?d.placedOrientations:{};for(const O in this.placements){const N=this.placements[O],V=x[O];V?(this.opacities[O]=new Zn(V,y,N.text,N.icon),m=m||N.text!==V.text.placed||N.icon!==V.icon.placed):(this.opacities[O]=new Zn(null,y,N.text,N.icon,N.skipFade),m=m||N.text||N.icon)}for(const O in x){const N=x[O];if(!this.opacities[O]){const V=new Zn(N,y,!1,!1);V.isHidden()||(this.opacities[O]=V,m=m||N.text.placed||N.icon.placed)}}for(const O in M)this.variableOffsets[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.variableOffsets[O]=M[O]);for(const O in P)this.placedOrientations[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.placedOrientations[O]=P[O]);if(d&&d.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");m?this.lastPlacementChangeTime=o:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=d?d.lastPlacementChangeTime:o)}updateLayerOpacities(o,d){const m={};for(const y of d){const x=y.getBucket(o);x&&y.latestFeatureIndex&&o.id===x.layerIds[0]&&this.updateBucketOpacities(x,y.tileID,m,y.collisionBoxArray)}}updateBucketOpacities(o,d,m,y){o.hasTextData()&&(o.text.opacityVertexArray.clear(),o.text.hasVisibleVertices=!1),o.hasIconData()&&(o.icon.opacityVertexArray.clear(),o.icon.hasVisibleVertices=!1),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexArray.clear(),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexArray.clear();const x=o.layers[0],M=x.layout,P=new Zn(null,0,!1,!1,!0),O=M.get("text-allow-overlap"),N=M.get("icon-allow-overlap"),V=x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"),F=M.get("text-rotation-alignment")==="map",Z=M.get("text-pitch-alignment")==="map",J=M.get("icon-text-fit")!=="none",ee=new Zn(null,0,O&&(N||!o.hasIconData()||M.get("icon-optional")),N&&(O||!o.hasTextData()||M.get("text-optional")),!0);!o.collisionArrays&&y&&(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData())&&o.deserializeCollisionBoxes(y);const oe=(ce,he,ne)=>{for(let me=0;me<he/4;me++)ce.opacityVertexArray.emplaceBack(ne);ce.hasVisibleVertices=ce.hasVisibleVertices||ne!==Ia},le=this.collisionBoxArrays.get(o.bucketInstanceId);for(let ce=0;ce<o.symbolInstances.length;ce++){const he=o.symbolInstances.get(ce),{numHorizontalGlyphVertices:ne,numVerticalGlyphVertices:me,crossTileID:ge}=he;let xe=this.opacities[ge];m[ge]?xe=P:xe||(xe=ee,this.opacities[ge]=xe),m[ge]=!0;const Oe=he.numIconVertices>0,Fe=this.placedOrientations[he.crossTileID],et=Fe===l.ah.vertical,at=Fe===l.ah.horizontal||Fe===l.ah.horizontalOnly;if(ne>0||me>0){const Ge=yr(xe.text);oe(o.text,ne,et?Ia:Ge),oe(o.text,me,at?Ia:Ge);const mt=xe.text.isHidden();[he.rightJustifiedTextSymbolIndex,he.centerJustifiedTextSymbolIndex,he.leftJustifiedTextSymbolIndex].forEach(it=>{it>=0&&(o.text.placedSymbolArray.get(it).hidden=mt||et?1:0)}),he.verticalPlacedTextSymbolIndex>=0&&(o.text.placedSymbolArray.get(he.verticalPlacedTextSymbolIndex).hidden=mt||at?1:0);const Bt=this.variableOffsets[he.crossTileID];Bt&&this.markUsedJustification(o,Bt.anchor,he,Fe);const Je=this.placedOrientations[he.crossTileID];Je&&(this.markUsedJustification(o,"left",he,Je),this.markUsedOrientation(o,Je,he))}if(Oe){const Ge=yr(xe.icon),mt=!(J&&he.verticalPlacedIconSymbolIndex&&et);he.placedIconSymbolIndex>=0&&(oe(o.icon,he.numIconVertices,mt?Ge:Ia),o.icon.placedSymbolArray.get(he.placedIconSymbolIndex).hidden=xe.icon.isHidden()),he.verticalPlacedIconSymbolIndex>=0&&(oe(o.icon,he.numVerticalIconVertices,mt?Ia:Ge),o.icon.placedSymbolArray.get(he.verticalPlacedIconSymbolIndex).hidden=xe.icon.isHidden())}const Ye=le&&le.has(ce)?le.get(ce):{text:null,icon:null};if(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData()){const Ge=o.collisionArrays[ce];if(Ge){let mt=new l.P(0,0);if(Ge.textBox||Ge.verticalTextBox){let Bt=!0;if(V){const Je=this.variableOffsets[ge];Je?(mt=Si(Je.anchor,Je.width,Je.height,Je.textOffset,Je.textBoxScale),F&&mt._rotate(Z?this.transform.angle:-this.transform.angle)):Bt=!1}if(Ge.textBox||Ge.verticalTextBox){let Je;Ge.textBox&&(Je=et),Ge.verticalTextBox&&(Je=at),Aa(o.textCollisionBox.collisionVertexArray,xe.text.placed,!Bt||Je,Ye.text,mt.x,mt.y)}}if(Ge.iconBox||Ge.verticalIconBox){const Bt=!!(!at&&Ge.verticalIconBox);let Je;Ge.iconBox&&(Je=Bt),Ge.verticalIconBox&&(Je=!Bt),Aa(o.iconCollisionBox.collisionVertexArray,xe.icon.placed,Je,Ye.icon,J?mt.x:0,J?mt.y:0)}}}}if(o.sortFeatures(this.transform.angle),this.retainedQueryData[o.bucketInstanceId]&&(this.retainedQueryData[o.bucketInstanceId].featureSortOrder=o.featureSortOrder),o.hasTextData()&&o.text.opacityVertexBuffer&&o.text.opacityVertexBuffer.updateData(o.text.opacityVertexArray),o.hasIconData()&&o.icon.opacityVertexBuffer&&o.icon.opacityVertexBuffer.updateData(o.icon.opacityVertexArray),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexBuffer&&o.iconCollisionBox.collisionVertexBuffer.updateData(o.iconCollisionBox.collisionVertexArray),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexBuffer&&o.textCollisionBox.collisionVertexBuffer.updateData(o.textCollisionBox.collisionVertexArray),o.text.opacityVertexArray.length!==o.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${o.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${o.text.layoutVertexArray.length}) / 4`);if(o.icon.opacityVertexArray.length!==o.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${o.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${o.icon.layoutVertexArray.length}) / 4`);if(o.bucketInstanceId in this.collisionCircleArrays){const ce=this.collisionCircleArrays[o.bucketInstanceId];o.placementInvProjMatrix=ce.invProjMatrix,o.placementViewportMatrix=ce.viewportMatrix,o.collisionCircleArray=ce.circles,delete this.collisionCircleArrays[o.bucketInstanceId]}}symbolFadeChange(o){return this.fadeDuration===0?1:(o-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(o){return Math.max(0,(this.transform.zoom-o)/1.5)}hasTransitions(o){return this.stale||o-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(o,d){const m=this.zoomAtLastRecencyCheck===d?1-this.zoomAdjustment(d):1;return this.zoomAtLastRecencyCheck=d,this.commitTime+this.fadeDuration*m>o}setStale(){this.stale=!0}}function Aa(v,o,d,m,y,x){m&&m.length!==0||(m=[0,0,0,0]);const M=m[0]-Lt,P=m[1]-Lt,O=m[2]-Lt,N=m[3]-Lt;v.emplaceBack(o?1:0,d?1:0,y||0,x||0,M,P),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,O,P),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,O,N),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,M,N)}const kn=Math.pow(2,25),Yh=Math.pow(2,24),Xh=Math.pow(2,17),mr=Math.pow(2,16),gr=Math.pow(2,9),a_=Math.pow(2,8),Nr=Math.pow(2,1);function yr(v){if(v.opacity===0&&!v.placed)return 0;if(v.opacity===1&&v.placed)return 4294967295;const o=v.placed?1:0,d=Math.floor(127*v.opacity);return d*kn+o*Yh+d*Xh+o*mr+d*gr+o*a_+d*Nr+o}const Ia=0;function Fs(){return{isOccluded:(v,o,d)=>!1,getPitchedTextCorrection:(v,o,d)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(v,o,d,m){throw new Error("Not implemented.")},translatePosition:(v,o,d,m)=>function(y,x,M,P,O=!1){if(!M[0]&&!M[1])return[0,0];const N=O?P==="map"?y.angle:0:P==="viewport"?-y.angle:0;if(N){const V=Math.sin(N),F=Math.cos(N);M=[M[0]*F-M[1]*V,M[0]*V+M[1]*F]}return[O?M[0]:Kt(x,M[0],y.zoom),O?M[1]:Kt(x,M[1],y.zoom)]}(v,o,d,m),getCircleRadiusCorrection:v=>1}}class si{constructor(o){this._sortAcrossTiles=o.layout.get("symbol-z-order")!=="viewport-y"&&!o.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(o,d,m,y,x){const M=this._bucketParts;for(;this._currentTileIndex<o.length;)if(d.getBucketParts(M,y,o[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,x())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,M.sort((P,O)=>P.sortKey-O.sortKey));this._currentPartIndex<M.length;)if(d.placeLayerBucketPart(M[this._currentPartIndex],this._seenCrossTileIDs,m),this._currentPartIndex++,x())return!0;return!1}}class Rl{constructor(o,d,m,y,x,M,P,O){this.placement=new Wi(o,Fs(),d,M,P,O),this._currentPlacementIndex=m.length-1,this._forceFullPlacement=y,this._showCollisionBoxes=x,this._done=!1}isDone(){return this._done}continuePlacement(o,d,m){const y=E.now(),x=()=>!this._forceFullPlacement&&E.now()-y>2;for(;this._currentPlacementIndex>=0;){const M=d[o[this._currentPlacementIndex]],P=this.placement.collisionIndex.transform.zoom;if(M.type==="symbol"&&(!M.minzoom||M.minzoom<=P)&&(!M.maxzoom||M.maxzoom>P)){if(this._inProgressLayer||(this._inProgressLayer=new si(M)),this._inProgressLayer.continuePlacement(m[M.source],this.placement,this._showCollisionBoxes,M,x))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(o){return this.placement.commit(o),this.placement}}const Jr=512/l.X/2;class ni{constructor(o,d,m){this.tileID=o,this.bucketInstanceId=m,this._symbolsByKey={};const y=new Map;for(let x=0;x<d.length;x++){const M=d.get(x),P=M.key,O=y.get(P);O?O.push(M):y.set(P,[M])}for(const[x,M]of y){const P={positions:M.map(O=>({x:Math.floor(O.anchorX*Jr),y:Math.floor(O.anchorY*Jr)})),crossTileIDs:M.map(O=>O.crossTileID)};if(P.positions.length>128){const O=new l.av(P.positions.length,16,Uint16Array);for(const{x:N,y:V}of P.positions)O.add(N,V);O.finish(),delete P.positions,P.index=O}this._symbolsByKey[x]=P}}getScaledCoordinates(o,d){const{x:m,y,z:x}=this.tileID.canonical,{x:M,y:P,z:O}=d.canonical,N=Jr/Math.pow(2,O-x),V=(P*l.X+o.anchorY)*N,F=y*l.X*Jr;return{x:Math.floor((M*l.X+o.anchorX)*N-m*l.X*Jr),y:Math.floor(V-F)}}findMatches(o,d,m){const y=this.tileID.canonical.z<d.canonical.z?1:Math.pow(2,this.tileID.canonical.z-d.canonical.z);for(let x=0;x<o.length;x++){const M=o.get(x);if(M.crossTileID)continue;const P=this._symbolsByKey[M.key];if(!P)continue;const O=this.getScaledCoordinates(M,d);if(P.index){const N=P.index.range(O.x-y,O.y-y,O.x+y,O.y+y).sort();for(const V of N){const F=P.crossTileIDs[V];if(!m[F]){m[F]=!0,M.crossTileID=F;break}}}else if(P.positions)for(let N=0;N<P.positions.length;N++){const V=P.positions[N],F=P.crossTileIDs[N];if(Math.abs(V.x-O.x)<=y&&Math.abs(V.y-O.y)<=y&&!m[F]){m[F]=!0,M.crossTileID=F;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:o})=>o)}}class tu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Qr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(o){const d=Math.round((o-this.lng)/360);if(d!==0)for(const m in this.indexes){const y=this.indexes[m],x={};for(const M in y){const P=y[M];P.tileID=P.tileID.unwrapTo(P.tileID.wrap+d),x[P.tileID.key]=P}this.indexes[m]=x}this.lng=o}addBucket(o,d,m){if(this.indexes[o.overscaledZ]&&this.indexes[o.overscaledZ][o.key]){if(this.indexes[o.overscaledZ][o.key].bucketInstanceId===d.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(o.overscaledZ,this.indexes[o.overscaledZ][o.key])}for(let x=0;x<d.symbolInstances.length;x++)d.symbolInstances.get(x).crossTileID=0;this.usedCrossTileIDs[o.overscaledZ]||(this.usedCrossTileIDs[o.overscaledZ]={});const y=this.usedCrossTileIDs[o.overscaledZ];for(const x in this.indexes){const M=this.indexes[x];if(Number(x)>o.overscaledZ)for(const P in M){const O=M[P];O.tileID.isChildOf(o)&&O.findMatches(d.symbolInstances,o,y)}else{const P=M[o.scaledTo(Number(x)).key];P&&P.findMatches(d.symbolInstances,o,y)}}for(let x=0;x<d.symbolInstances.length;x++){const M=d.symbolInstances.get(x);M.crossTileID||(M.crossTileID=m.generate(),y[M.crossTileID]=!0)}return this.indexes[o.overscaledZ]===void 0&&(this.indexes[o.overscaledZ]={}),this.indexes[o.overscaledZ][o.key]=new ni(o,d.symbolInstances,d.bucketInstanceId),!0}removeBucketCrossTileIDs(o,d){for(const m of d.getCrossTileIDsLists())for(const y of m)delete this.usedCrossTileIDs[o][y]}removeStaleBuckets(o){let d=!1;for(const m in this.indexes){const y=this.indexes[m];for(const x in y)o[y[x].bucketInstanceId]||(this.removeBucketCrossTileIDs(m,y[x]),delete y[x],d=!0)}return d}}class Kh{constructor(){this.layerIndexes={},this.crossTileIDs=new tu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(o,d,m){let y=this.layerIndexes[o.id];y===void 0&&(y=this.layerIndexes[o.id]=new Qr);let x=!1;const M={};y.handleWrapJump(m);for(const P of d){const O=P.getBucket(o);O&&o.id===O.layerIds[0]&&(O.bucketInstanceId||(O.bucketInstanceId=++this.maxBucketInstanceId),y.addBucket(P.tileID,O,this.crossTileIDs)&&(x=!0),M[O.bucketInstanceId]=!0)}return y.removeStaleBuckets(M)&&(x=!0),x}pruneUnusedLayers(o){const d={};o.forEach(m=>{d[m]=!0});for(const m in this.layerIndexes)d[m]||delete this.layerIndexes[m]}}const eo=(v,o)=>l.t(v,o&&o.filter(d=>d.identifier!=="source.canvas")),l_=l.aw();class nu extends l.E{constructor(o,d={}){super(),this._rtlPluginLoaded=()=>{for(const m in this.sourceCaches){const y=this.sourceCaches[m].getSource().type;y!=="vector"&&y!=="geojson"||this.sourceCaches[m].reload()}},this.map=o,this.dispatcher=new Be(Ke(),o._getMapId()),this.dispatcher.registerMessageHandler("GG",(m,y)=>this.getGlyphs(m,y)),this.dispatcher.registerMessageHandler("GI",(m,y)=>this.getImages(m,y)),this.imageManager=new st,this.imageManager.setEventedParent(this),this.glyphManager=new Ft(o._requestManager,d.localIdeographFontFamily),this.lineAtlas=new ti(256,512),this.crossTileSymbolIndex=new Kh,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ay()),zr().on(Ve,this._rtlPluginLoaded),this.on("data",m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const y=this.sourceCaches[m.sourceId];if(!y)return;const x=y.getSource();if(x&&x.vectorLayerIds)for(const M in this._layers){const P=this._layers[M];P.source===x.id&&this._validateLayer(P)}})}loadURL(o,d={},m){this.fire(new l.k("dataloading",{dataType:"style"})),d.validate=typeof d.validate!="boolean"||d.validate;const y=this.map._requestManager.transformRequest(o,"Style");this._loadStyleRequest=new AbortController;const x=this._loadStyleRequest;l.h(y,this._loadStyleRequest).then(M=>{this._loadStyleRequest=null,this._load(M.data,d,m)}).catch(M=>{this._loadStyleRequest=null,M&&!x.signal.aborted&&this.fire(new l.j(M))})}loadJSON(o,d={},m){this.fire(new l.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,d.validate=d.validate!==!1,this._load(o,d,m)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(l_,{validate:!1})}_load(o,d,m){var y;const x=d.transformStyle?d.transformStyle(m,o):o;if(!d.validate||!eo(this,l.u(x))){this._loaded=!0,this.stylesheet=x;for(const M in x.sources)this.addSource(M,x.sources[M],{validate:!1});x.sprite?this._loadSprite(x.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(x.glyphs),this._createLayers(),this.light=new dn(this.stylesheet.light),this.sky=new pn(this.stylesheet.sky),this.map.setTerrain((y=this.stylesheet.terrain)!==null&&y!==void 0?y:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const o=l.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",o),this._order=o.map(d=>d.id),this._layers={},this._serializedLayers=null;for(const d of o){const m=l.aA(d);m.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=m}}_loadSprite(o,d=!1,m=void 0){let y;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(x,M,P,O){return l._(this,void 0,void 0,function*(){const N=Ae(x),V=P>1?"@2x":"",F={},Z={};for(const{id:J,url:ee}of N){const oe=M.transformRequest($e(ee,V,".json"),"SpriteJSON");F[J]=l.h(oe,O);const le=M.transformRequest($e(ee,V,".png"),"SpriteImage");Z[J]=G.getImage(le,O)}return yield Promise.all([...Object.values(F),...Object.values(Z)]),function(J,ee){return l._(this,void 0,void 0,function*(){const oe={};for(const le in J){oe[le]={};const ce=E.getImageCanvasContext((yield ee[le]).data),he=(yield J[le]).data;for(const ne in he){const{width:me,height:ge,x:xe,y:Oe,sdf:Fe,pixelRatio:et,stretchX:at,stretchY:Ye,content:Ge,textFitWidth:mt,textFitHeight:Bt}=he[ne];oe[le][ne]={data:null,pixelRatio:et,sdf:Fe,stretchX:at,stretchY:Ye,content:Ge,textFitWidth:mt,textFitHeight:Bt,spriteData:{width:me,height:ge,x:xe,y:Oe,context:ce}}}}return oe})}(F,Z)})}(o,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(x=>{if(this._spriteRequest=null,x)for(const M in x){this._spritesImagesIds[M]=[];const P=this._spritesImagesIds[M]?this._spritesImagesIds[M].filter(O=>!(O in x)):[];for(const O of P)this.imageManager.removeImage(O),this._changedImages[O]=!0;for(const O in x[M]){const N=M==="default"?O:`${M}:${O}`;this._spritesImagesIds[M].push(N),N in this.imageManager.images?this.imageManager.updateImage(N,x[M][O],!1):this.imageManager.addImage(N,x[M][O]),d&&(this._changedImages[N]=!0)}}}).catch(x=>{this._spriteRequest=null,y=x,this.fire(new l.j(y))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),d&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),m&&m(y)})}_unloadSprite(){for(const o of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(o),this._changedImages[o]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(o){const d=this.sourceCaches[o.source];if(!d)return;const m=o.sourceLayer;if(!m)return;const y=d.getSource();(y.type==="geojson"||y.vectorLayerIds&&y.vectorLayerIds.indexOf(m)===-1)&&this.fire(new l.j(new Error(`Source layer "${m}" does not exist on source "${y.id}" as specified by style layer "${o.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const o in this.sourceCaches)if(!this.sourceCaches[o].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(o,d=!1){const m=this._serializedAllLayers();if(!o||o.length===0)return Object.values(d?l.aB(m):m);const y=[];for(const x of o)if(m[x]){const M=d?l.aB(m[x]):m[x];y.push(M)}return y}_serializedAllLayers(){let o=this._serializedLayers;if(o)return o;o=this._serializedLayers={};const d=Object.keys(this._layers);for(const m of d){const y=this._layers[m];y.type!=="custom"&&(o[m]=y.serialize())}return o}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const o in this.sourceCaches)if(this.sourceCaches[o].hasTransition())return!0;for(const o in this._layers)if(this._layers[o].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(o){if(!this._loaded)return;const d=this._changed;if(d){const y=Object.keys(this._updatedLayers),x=Object.keys(this._removedLayers);(y.length||x.length)&&this._updateWorkerLayers(y,x);for(const M in this._updatedSources){const P=this._updatedSources[M];if(P==="reload")this._reloadSource(M);else{if(P!=="clear")throw new Error(`Invalid action ${P}`);this._clearSource(M)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const M in this._updatedPaintProps)this._layers[M].updateTransitions(o);this.light.updateTransitions(o),this.sky.updateTransitions(o),this._resetUpdates()}const m={};for(const y in this.sourceCaches){const x=this.sourceCaches[y];m[y]=x.used,x.used=!1}for(const y of this._order){const x=this._layers[y];x.recalculate(o,this._availableImages),!x.isHidden(o.zoom)&&x.source&&(this.sourceCaches[x.source].used=!0)}for(const y in m){const x=this.sourceCaches[y];!!m[y]!=!!x.used&&x.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:y}))}this.light.recalculate(o),this.sky.recalculate(o),this.z=o.zoom,d&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const o=Object.keys(this._changedImages);if(o.length){for(const d in this.sourceCaches)this.sourceCaches[d].reloadTilesForDependencies(["icons","patterns"],o);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(o,d){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(o,!1),removedIds:d})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(o,d={}){var m;this._checkLoaded();const y=this.serialize();if(o=d.transformStyle?d.transformStyle(y,o):o,((m=d.validate)===null||m===void 0||m)&&eo(this,l.u(o)))return!1;(o=l.aB(o)).layers=l.az(o.layers);const x=l.aC(y,o),M=this._getOperationsToPerform(x);if(M.unimplemented.length>0)throw new Error(`Unimplemented: ${M.unimplemented.join(", ")}.`);if(M.operations.length===0)return!1;for(const P of M.operations)P();return this.stylesheet=o,this._serializedLayers=null,!0}_getOperationsToPerform(o){const d=[],m=[];for(const y of o)switch(y.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":d.push(()=>this.addLayer.apply(this,y.args));break;case"removeLayer":d.push(()=>this.removeLayer.apply(this,y.args));break;case"setPaintProperty":d.push(()=>this.setPaintProperty.apply(this,y.args));break;case"setLayoutProperty":d.push(()=>this.setLayoutProperty.apply(this,y.args));break;case"setFilter":d.push(()=>this.setFilter.apply(this,y.args));break;case"addSource":d.push(()=>this.addSource.apply(this,y.args));break;case"removeSource":d.push(()=>this.removeSource.apply(this,y.args));break;case"setLayerZoomRange":d.push(()=>this.setLayerZoomRange.apply(this,y.args));break;case"setLight":d.push(()=>this.setLight.apply(this,y.args));break;case"setGeoJSONSourceData":d.push(()=>this.setGeoJSONSourceData.apply(this,y.args));break;case"setGlyphs":d.push(()=>this.setGlyphs.apply(this,y.args));break;case"setSprite":d.push(()=>this.setSprite.apply(this,y.args));break;case"setSky":d.push(()=>this.setSky.apply(this,y.args));break;case"setTerrain":d.push(()=>this.map.setTerrain.apply(this,y.args));break;case"setTransition":d.push(()=>{});break;default:m.push(y.command)}return{operations:d,unimplemented:m}}addImage(o,d){if(this.getImage(o))return this.fire(new l.j(new Error(`An image named "${o}" already exists.`)));this.imageManager.addImage(o,d),this._afterImageUpdated(o)}updateImage(o,d){this.imageManager.updateImage(o,d)}getImage(o){return this.imageManager.getImage(o)}removeImage(o){if(!this.getImage(o))return this.fire(new l.j(new Error(`An image named "${o}" does not exist.`)));this.imageManager.removeImage(o),this._afterImageUpdated(o)}_afterImageUpdated(o){this._availableImages=this.imageManager.listImages(),this._changedImages[o]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(o,d,m={}){if(this._checkLoaded(),this.sourceCaches[o]!==void 0)throw new Error(`Source "${o}" already exists.`);if(!d.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(d).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(d.type)>=0&&this._validate(l.u.source,`sources.${o}`,d,null,m))return;this.map&&this.map._collectResourceTiming&&(d.collectResourceTiming=!0);const y=this.sourceCaches[o]=new Le(o,d,this.dispatcher);y.style=this,y.setEventedParent(this,()=>({isSourceLoaded:y.loaded(),source:y.serialize(),sourceId:o})),y.onAdd(this.map),this._changed=!0}removeSource(o){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error("There is no source with this ID");for(const m in this._layers)if(this._layers[m].source===o)return this.fire(new l.j(new Error(`Source "${o}" cannot be removed while layer "${m}" is using it.`)));const d=this.sourceCaches[o];delete this.sourceCaches[o],delete this._updatedSources[o],d.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:o})),d.setEventedParent(null),d.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(o,d){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error(`There is no source with this ID=${o}`);const m=this.sourceCaches[o].getSource();if(m.type!=="geojson")throw new Error(`geojsonSource.type is ${m.type}, which is !== 'geojson`);m.setData(d),this._changed=!0}getSource(o){return this.sourceCaches[o]&&this.sourceCaches[o].getSource()}addLayer(o,d,m={}){this._checkLoaded();const y=o.id;if(this.getLayer(y))return void this.fire(new l.j(new Error(`Layer "${y}" already exists on this map.`)));let x;if(o.type==="custom"){if(eo(this,l.aD(o)))return;x=l.aA(o)}else{if("source"in o&&typeof o.source=="object"&&(this.addSource(y,o.source),o=l.aB(o),o=l.e(o,{source:y})),this._validate(l.u.layer,`layers.${y}`,o,{arrayIndex:-1},m))return;x=l.aA(o),this._validateLayer(x),x.setEventedParent(this,{layer:{id:y}})}const M=d?this._order.indexOf(d):this._order.length;if(d&&M===-1)this.fire(new l.j(new Error(`Cannot add layer "${y}" before non-existing layer "${d}".`)));else{if(this._order.splice(M,0,y),this._layerOrderChanged=!0,this._layers[y]=x,this._removedLayers[y]&&x.source&&x.type!=="custom"){const P=this._removedLayers[y];delete this._removedLayers[y],P.type!==x.type?this._updatedSources[x.source]="clear":(this._updatedSources[x.source]="reload",this.sourceCaches[x.source].pause())}this._updateLayer(x),x.onAdd&&x.onAdd(this.map)}}moveLayer(o,d){if(this._checkLoaded(),this._changed=!0,!this._layers[o])return void this.fire(new l.j(new Error(`The layer '${o}' does not exist in the map's style and cannot be moved.`)));if(o===d)return;const m=this._order.indexOf(o);this._order.splice(m,1);const y=d?this._order.indexOf(d):this._order.length;d&&y===-1?this.fire(new l.j(new Error(`Cannot move layer "${o}" before non-existing layer "${d}".`))):(this._order.splice(y,0,o),this._layerOrderChanged=!0)}removeLayer(o){this._checkLoaded();const d=this._layers[o];if(!d)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${o}".`)));d.setEventedParent(null);const m=this._order.indexOf(o);this._order.splice(m,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[o]=d,delete this._layers[o],this._serializedLayers&&delete this._serializedLayers[o],delete this._updatedLayers[o],delete this._updatedPaintProps[o],d.onRemove&&d.onRemove(this.map)}getLayer(o){return this._layers[o]}getLayersOrder(){return[...this._order]}hasLayer(o){return o in this._layers}setLayerZoomRange(o,d,m){this._checkLoaded();const y=this.getLayer(o);y?y.minzoom===d&&y.maxzoom===m||(d!=null&&(y.minzoom=d),m!=null&&(y.maxzoom=m),this._updateLayer(y)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${o}".`)))}setFilter(o,d,m={}){this._checkLoaded();const y=this.getLayer(o);if(y){if(!l.aE(y.filter,d))return d==null?(y.filter=void 0,void this._updateLayer(y)):void(this._validate(l.u.filter,`layers.${y.id}.filter`,d,null,m)||(y.filter=l.aB(d),this._updateLayer(y)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${o}".`)))}getFilter(o){return l.aB(this.getLayer(o).filter)}setLayoutProperty(o,d,m,y={}){this._checkLoaded();const x=this.getLayer(o);x?l.aE(x.getLayoutProperty(d),m)||(x.setLayoutProperty(d,m,y),this._updateLayer(x)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${o}".`)))}getLayoutProperty(o,d){const m=this.getLayer(o);if(m)return m.getLayoutProperty(d);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${o}".`)))}setPaintProperty(o,d,m,y={}){this._checkLoaded();const x=this.getLayer(o);x?l.aE(x.getPaintProperty(d),m)||(x.setPaintProperty(d,m,y)&&this._updateLayer(x),this._changed=!0,this._updatedPaintProps[o]=!0,this._serializedLayers=null):this.fire(new l.j(new Error(`Cannot style non-existing layer "${o}".`)))}getPaintProperty(o,d){return this.getLayer(o).getPaintProperty(d)}setFeatureState(o,d){this._checkLoaded();const m=o.source,y=o.sourceLayer,x=this.sourceCaches[m];if(x===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const M=x.getSource().type;M==="geojson"&&y?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):M!=="vector"||y?(o.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),x.setFeatureState(y,o.id,d)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(o,d){this._checkLoaded();const m=o.source,y=this.sourceCaches[m];if(y===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const x=y.getSource().type,M=x==="vector"?o.sourceLayer:void 0;x!=="vector"||M?d&&typeof o.id!="string"&&typeof o.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):y.removeFeatureState(M,o.id,d):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(o){this._checkLoaded();const d=o.source,m=o.sourceLayer,y=this.sourceCaches[d];if(y!==void 0)return y.getSource().type!=="vector"||m?(o.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),y.getFeatureState(m,o.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${d}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const o=l.aF(this.sourceCaches,x=>x.serialize()),d=this._serializeByIds(this._order,!0),m=this.map.getTerrain()||void 0,y=this.stylesheet;return l.aG({version:y.version,name:y.name,metadata:y.metadata,light:y.light,sky:y.sky,center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch,sprite:y.sprite,glyphs:y.glyphs,transition:y.transition,sources:o,layers:d,terrain:m},x=>x!==void 0)}_updateLayer(o){this._updatedLayers[o.id]=!0,o.source&&!this._updatedSources[o.source]&&this.sourceCaches[o.source].getSource().type!=="raster"&&(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(o){const d=M=>this._layers[M].type==="fill-extrusion",m={},y=[];for(let M=this._order.length-1;M>=0;M--){const P=this._order[M];if(d(P)){m[P]=M;for(const O of o){const N=O[P];if(N)for(const V of N)y.push(V)}}}y.sort((M,P)=>P.intersectionZ-M.intersectionZ);const x=[];for(let M=this._order.length-1;M>=0;M--){const P=this._order[M];if(d(P))for(let O=y.length-1;O>=0;O--){const N=y[O].feature;if(m[N.layer.id]<M)break;x.push(N),y.pop()}else for(const O of o){const N=O[P];if(N)for(const V of N)x.push(V.feature)}}return x}queryRenderedFeatures(o,d,m){d&&d.filter&&this._validate(l.u.filter,"queryRenderedFeatures.filter",d.filter,null,d);const y={};if(d&&d.layers){if(!Array.isArray(d.layers))return this.fire(new l.j(new Error("parameters.layers must be an Array."))),[];for(const P of d.layers){const O=this._layers[P];if(!O)return this.fire(new l.j(new Error(`The layer '${P}' does not exist in the map's style and cannot be queried for features.`))),[];y[O.source]=!0}}const x=[];d.availableImages=this._availableImages;const M=this._serializedAllLayers();for(const P in this.sourceCaches)d.layers&&!y[P]||x.push(At(this.sourceCaches[P],this._layers,M,o,d,m));return this.placement&&x.push(function(P,O,N,V,F,Z,J){const ee={},oe=Z.queryRenderedSymbols(V),le=[];for(const ce of Object.keys(oe).map(Number))le.push(J[ce]);le.sort(Mt);for(const ce of le){const he=ce.featureIndex.lookupSymbolFeatures(oe[ce.bucketInstanceId],O,ce.bucketIndex,ce.sourceLayerIndex,F.filter,F.layers,F.availableImages,P);for(const ne in he){const me=ee[ne]=ee[ne]||[],ge=he[ne];ge.sort((xe,Oe)=>{const Fe=ce.featureSortOrder;if(Fe){const et=Fe.indexOf(xe.featureIndex);return Fe.indexOf(Oe.featureIndex)-et}return Oe.featureIndex-xe.featureIndex});for(const xe of ge)me.push(xe)}}for(const ce in ee)ee[ce].forEach(he=>{const ne=he.feature,me=N[P[ce].source].getFeatureState(ne.layer["source-layer"],ne.id);ne.source=ne.layer.source,ne.layer["source-layer"]&&(ne.sourceLayer=ne.layer["source-layer"]),ne.state=me});return ee}(this._layers,M,this.sourceCaches,o,d,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(x)}querySourceFeatures(o,d){d&&d.filter&&this._validate(l.u.filter,"querySourceFeatures.filter",d.filter,null,d);const m=this.sourceCaches[o];return m?function(y,x){const M=y.getRenderableIds().map(N=>y.getTileByID(N)),P=[],O={};for(let N=0;N<M.length;N++){const V=M[N],F=V.tileID.canonical.key;O[F]||(O[F]=!0,V.querySourceFeatures(P,x))}return P}(m,d):[]}getLight(){return this.light.getLight()}setLight(o,d={}){this._checkLoaded();const m=this.light.getLight();let y=!1;for(const M in o)if(!l.aE(o[M],m[M])){y=!0;break}if(!y)return;const x={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(o,d),this.light.updateTransitions(x)}getSky(){var o;return(o=this.stylesheet)===null||o===void 0?void 0:o.sky}setSky(o,d={}){const m=this.getSky();let y=!1;if(!o&&!m)return;if(o&&!m)y=!0;else if(!o&&m)y=!0;else for(const M in o)if(!l.aE(o[M],m[M])){y=!0;break}if(!y)return;const x={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=o,this.sky.setSky(o,d),this.sky.updateTransitions(x)}_validate(o,d,m,y,x={}){return(!x||x.validate!==!1)&&eo(this,o.call(l.u,l.e({key:d,style:this.serialize(),value:m,styleSpec:l.v},y)))}_remove(o=!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),zr().off(Ve,this._rtlPluginLoaded);for(const d in this._layers)this._layers[d].setEventedParent(null);for(const d in this.sourceCaches){const m=this.sourceCaches[d];m.setEventedParent(null),m.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),o&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(o)}_clearSource(o){this.sourceCaches[o].clearTiles()}_reloadSource(o){this.sourceCaches[o].resume(),this.sourceCaches[o].reload()}_updateSources(o){for(const d in this.sourceCaches)this.sourceCaches[d].update(o,this.map.terrain)}_generateCollisionBoxes(){for(const o in this.sourceCaches)this._reloadSource(o)}_updatePlacement(o,d,m,y,x=!1){let M=!1,P=!1;const O={};for(const N of this._order){const V=this._layers[N];if(V.type!=="symbol")continue;if(!O[V.source]){const Z=this.sourceCaches[V.source];O[V.source]=Z.getRenderableIds(!0).map(J=>Z.getTileByID(J)).sort((J,ee)=>ee.tileID.overscaledZ-J.tileID.overscaledZ||(J.tileID.isLessThan(ee.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(V,O[V.source],o.center.lng);M=M||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((x=x||this._layerOrderChanged||m===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(E.now(),o.zoom))&&(this.pauseablePlacement=new Rl(o,this.map.terrain,this._order,x,d,m,y,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,O),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(E.now()),P=!0),M&&this.pauseablePlacement.placement.setStale()),P||M)for(const N of this._order){const V=this._layers[N];V.type==="symbol"&&this.placement.updateLayerOpacities(V,O[V.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(E.now())}_releaseSymbolFadeTiles(){for(const o in this.sourceCaches)this.sourceCaches[o].releaseSymbolFadeTiles()}getImages(o,d){return l._(this,void 0,void 0,function*(){const m=yield this.imageManager.getImages(d.icons);this._updateTilesForChangedImages();const y=this.sourceCaches[d.source];return y&&y.setDependencies(d.tileID.key,d.type,d.icons),m})}getGlyphs(o,d){return l._(this,void 0,void 0,function*(){const m=yield this.glyphManager.getGlyphs(d.stacks),y=this.sourceCaches[d.source];return y&&y.setDependencies(d.tileID.key,d.type,[""]),m})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(o,d={}){this._checkLoaded(),o&&this._validate(l.u.glyphs,"glyphs",o,null,d)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=o,this.glyphManager.entries={},this.glyphManager.setURL(o))}addSprite(o,d,m={},y){this._checkLoaded();const x=[{id:o,url:d}],M=[...Ae(this.stylesheet.sprite),...x];this._validate(l.u.sprite,"sprite",M,null,m)||(this.stylesheet.sprite=M,this._loadSprite(x,!0,y))}removeSprite(o){this._checkLoaded();const d=Ae(this.stylesheet.sprite);if(d.find(m=>m.id===o)){if(this._spritesImagesIds[o])for(const m of this._spritesImagesIds[o])this.imageManager.removeImage(m),this._changedImages[m]=!0;d.splice(d.findIndex(m=>m.id===o),1),this.stylesheet.sprite=d.length>0?d:void 0,delete this._spritesImagesIds[o],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${o}" doesn't exists on this map.`)))}getSprite(){return Ae(this.stylesheet.sprite)}setSprite(o,d={},m){this._checkLoaded(),o&&this._validate(l.u.sprite,"sprite",o,null,d)||(this.stylesheet.sprite=o,o?this._loadSprite(o,!0,m):(this._unloadSprite(),m&&m(null)))}}var $s=l.Y([{name:"a_pos",type:"Int16",components:2}]);const ds={prelude:fn(`#ifdef GL_ES
49
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(R[1])} }\`.`)];const j=[];return c.layerType==="symbol"&&(T==="text-field"&&_&&!_.glyphs&&j.push(new Ve(h,S,'use of "text-field" requires a style "glyphs" property')),T==="text-font"&&mu(to(S))&&Qn(S.type)==="identity"&&j.push(new Ve(h,S,'"text-font" does not support identity functions'))),j.concat(p({key:c.key,value:S,valueSpec:z,style:_,styleSpec:k,expressionContext:"property",propertyType:s,propertyKey:T}))}function Su(c){return wd(c,"paint")}function kd(c){return wd(c,"layout")}function Sd(c){let s=[];const h=c.value,p=c.key,_=c.style,k=c.styleSpec;h.type||h.ref||s.push(new Ve(p,h,'either "type" or "ref" is required'));let S=Qn(h.type);const T=Qn(h.ref);if(h.id){const A=Qn(h.id);for(let B=0;B<c.arrayIndex;B++){const z=_.layers[B];Qn(z.id)===A&&s.push(new Ve(p,h.id,`duplicate layer id "${h.id}", previously used at line ${z.id.__line__}`))}}if("ref"in h){let A;["type","source","source-layer","filter","layout"].forEach(B=>{B in h&&s.push(new Ve(p,h[B],`"${B}" is prohibited for ref layers`))}),_.layers.forEach(B=>{Qn(B.id)===T&&(A=B)}),A?A.ref?s.push(new Ve(p,h.ref,"ref cannot reference another ref layer")):S=Qn(A.type):s.push(new Ve(p,h.ref,`ref layer "${T}" not found`))}else if(S!=="background")if(h.source){const A=_.sources&&_.sources[h.source],B=A&&Qn(A.type);A?B==="vector"&&S==="raster"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a raster source`)):B!=="raster-dem"&&S==="hillshade"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a raster-dem source`)):B==="raster"&&S!=="raster"?s.push(new Ve(p,h.source,`layer "${h.id}" requires a vector source`)):B!=="vector"||h["source-layer"]?B==="raster-dem"&&S!=="hillshade"?s.push(new Ve(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):S!=="line"||!h.paint||!h.paint["line-gradient"]||B==="geojson"&&A.lineMetrics||s.push(new Ve(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new Ve(p,h,`layer "${h.id}" must specify a "source-layer"`)):s.push(new Ve(p,h.source,`source "${h.source}" not found`))}else s.push(new Ve(p,h,'missing required property "source"'));return s=s.concat(_r({key:p,value:h,valueSpec:k.layer,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,objectElementValidators:{"*":()=>[],type:()=>c.validateSpec({key:`${p}.type`,value:h.type,valueSpec:k.layer.type,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,object:h,objectKey:"type"}),filter:vd,layout:A=>_r({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":B=>kd(Br({layerType:S},B))}}),paint:A=>_r({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":B=>Su(Br({layerType:S},B))}})}})),s}function Xs(c){const s=c.value,h=c.key,p=un(s);return p!=="string"?[new Ve(h,s,`string expected, ${p} found`)]:[]}const Eu={promoteId:function({key:c,value:s}){if(un(s)==="string")return Xs({key:c,value:s});{const h=[];for(const p in s)h.push(...Xs({key:`${c}.${p}`,value:s[p]}));return h}}};function Jl(c){const s=c.value,h=c.key,p=c.styleSpec,_=c.style,k=c.validateSpec;if(!s.type)return[new Ve(h,s,'"type" is required')];const S=Qn(s.type);let T;switch(S){case"vector":case"raster":return T=_r({key:h,value:s,valueSpec:p[`source_${S.replace("-","_")}`],style:c.style,styleSpec:p,objectElementValidators:Eu,validateSpec:k}),T;case"raster-dem":return T=function(A){var B;const z=(B=A.sourceName)!==null&&B!==void 0?B:"",R=A.value,j=A.styleSpec,q=j.source_raster_dem,Y=A.style;let K=[];const re=un(R);if(R===void 0)return K;if(re!=="object")return K.push(new Ve("source_raster_dem",R,`object expected, ${re} found`)),K;const ae=Qn(R.encoding)==="custom",be=["redFactor","greenFactor","blueFactor","baseShift"],pe=A.value.encoding?`"${A.value.encoding}"`:"Default";for(const ye in R)!ae&&be.includes(ye)?K.push(new Ve(ye,R[ye],`In "${z}": "${ye}" is only valid when "encoding" is set to "custom". ${pe} encoding found`)):q[ye]?K=K.concat(A.validateSpec({key:ye,value:R[ye],valueSpec:q[ye],validateSpec:A.validateSpec,style:Y,styleSpec:j})):K.push(new Ve(ye,R[ye],`unknown property "${ye}"`));return K}({sourceName:h,value:s,style:c.style,styleSpec:p,validateSpec:k}),T;case"geojson":if(T=_r({key:h,value:s,valueSpec:p.source_geojson,style:_,styleSpec:p,validateSpec:k,objectElementValidators:Eu}),s.cluster)for(const A in s.clusterProperties){const[B,z]=s.clusterProperties[A],R=typeof B=="string"?[B,["accumulated"],["get",A]]:B;T.push(...Ha({key:`${h}.${A}.map`,value:z,validateSpec:k,expressionContext:"cluster-map"})),T.push(...Ha({key:`${h}.${A}.reduce`,value:R,validateSpec:k,expressionContext:"cluster-reduce"}))}return T;case"video":return _r({key:h,value:s,valueSpec:p.source_video,style:_,validateSpec:k,styleSpec:p});case"image":return _r({key:h,value:s,valueSpec:p.source_image,style:_,validateSpec:k,styleSpec:p});case"canvas":return[new Ve(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qo({key:`${h}.type`,value:s.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:_,validateSpec:k,styleSpec:p})}}function Ed(c){const s=c.value,h=c.styleSpec,p=h.light,_=c.style;let k=[];const S=un(s);if(s===void 0)return k;if(S!=="object")return k=k.concat([new Ve("light",s,`object expected, ${S} found`)]),k;for(const T in s){const A=T.match(/^(.*)-transition$/);k=k.concat(A&&p[A[1]]&&p[A[1]].transition?c.validateSpec({key:T,value:s[T],valueSpec:h.transition,validateSpec:c.validateSpec,style:_,styleSpec:h}):p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],validateSpec:c.validateSpec,style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)])}return k}function Cd(c){const s=c.value,h=c.styleSpec,p=h.sky,_=c.style,k=un(s);if(s===void 0)return[];if(k!=="object")return[new Ve("sky",s,`object expected, ${k} found`)];let S=[];for(const T in s)S=S.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return S}function Td(c){const s=c.value,h=c.styleSpec,p=h.terrain,_=c.style;let k=[];const S=un(s);if(s===void 0)return k;if(S!=="object")return k=k.concat([new Ve("terrain",s,`object expected, ${S} found`)]),k;for(const T in s)k=k.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],validateSpec:c.validateSpec,style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return k}function Md(c){let s=[];const h=c.value,p=c.key;if(Array.isArray(h)){const _=[],k=[];for(const S in h)h[S].id&&_.includes(h[S].id)&&s.push(new Ve(p,h,`all the sprites' ids must be unique, but ${h[S].id} is duplicated`)),_.push(h[S].id),h[S].url&&k.includes(h[S].url)&&s.push(new Ve(p,h,`all the sprites' URLs must be unique, but ${h[S].url} is duplicated`)),k.push(h[S].url),s=s.concat(_r({key:`${p}[${S}]`,value:h[S],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:c.validateSpec}));return s}return Xs({key:p,value:h})}const Cu={"*":()=>[],array:Kl,boolean:function(c){const s=c.value,h=c.key,p=un(s);return p!=="boolean"?[new Ve(h,s,`boolean expected, ${p} found`)]:[]},number:xd,color:function(c){const s=c.key,h=c.value,p=un(h);return p!=="string"?[new Ve(s,h,`color expected, ${p} found`)]:kn.parse(String(h))?[]:[new Ve(s,h,`color expected, "${h}" found`)]},constants:km,enum:qo,filter:vd,function:wu,layer:Sd,object:_r,source:Jl,light:Ed,sky:Cd,terrain:Td,projection:function(c){const s=c.value,h=c.styleSpec,p=h.projection,_=c.style,k=un(s);if(s===void 0)return[];if(k!=="object")return[new Ve("projection",s,`object expected, ${k} found`)];let S=[];for(const T in s)S=S.concat(p[T]?c.validateSpec({key:T,value:s[T],valueSpec:p[T],style:_,styleSpec:h}):[new Ve(T,s[T],`unknown property "${T}"`)]);return S},string:Xs,formatted:function(c){return Xs(c).length===0?[]:Ha(c)},resolvedImage:function(c){return Xs(c).length===0?[]:Ha(c)},padding:function(c){const s=c.key,h=c.value;if(un(h)==="array"){if(h.length<1||h.length>4)return[new Ve(s,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let _=[];for(let k=0;k<h.length;k++)_=_.concat(c.validateSpec({key:`${s}[${k}]`,value:h[k],validateSpec:c.validateSpec,valueSpec:p}));return _}return xd({key:s,value:h,valueSpec:{}})},variableAnchorOffsetCollection:function(c){const s=c.key,h=c.value,p=un(h),_=c.styleSpec;if(p!=="array"||h.length<1||h.length%2!=0)return[new Ve(s,h,"variableAnchorOffsetCollection requires a non-empty array of even length")];let k=[];for(let S=0;S<h.length;S+=2)k=k.concat(qo({key:`${s}[${S}]`,value:h[S],valueSpec:_.layout_symbol["text-anchor"]})),k=k.concat(Kl({key:`${s}[${S+1}]`,value:h[S+1],valueSpec:{length:2,value:"number"},validateSpec:c.validateSpec,style:c.style,styleSpec:_}));return k},sprite:Md};function qa(c){const s=c.value,h=c.valueSpec,p=c.styleSpec;return c.validateSpec=qa,h.expression&&mu(Qn(s))?wu(c):h.expression&&_u(to(s))?Ha(c):h.type&&Cu[h.type]?Cu[h.type](c):_r(Br({},c,{valueSpec:h.type?p[h.type]:h}))}function Sm(c){const s=c.value,h=c.key,p=Xs(c);return p.length||(s.indexOf("{fontstack}")===-1&&p.push(new Ve(h,s,'"glyphs" url must include a "{fontstack}" token')),s.indexOf("{range}")===-1&&p.push(new Ve(h,s,'"glyphs" url must include a "{range}" token'))),p}function Rr(c,s=we){let h=[];return h=h.concat(qa({key:"",value:c,valueSpec:s.$root,styleSpec:s,style:c,validateSpec:qa,objectElementValidators:{glyphs:Sm,"*":()=>[]}})),c.constants&&(h=h.concat(km({key:"constants",value:c.constants,style:c,styleSpec:s,validateSpec:qa}))),Ad(h)}function Ao(c){return function(s){return c({...s,validateSpec:qa})}}function Ad(c){return[].concat(c).sort((s,h)=>s.line-h.line)}function no(c){return function(...s){return Ad(c.apply(this,s))}}Rr.source=no(Ao(Jl)),Rr.sprite=no(Ao(Md)),Rr.glyphs=no(Ao(Sm)),Rr.light=no(Ao(Ed)),Rr.sky=no(Ao(Cd)),Rr.terrain=no(Ao(Td)),Rr.layer=no(Ao(Sd)),Rr.filter=no(Ao(vd)),Rr.paintProperty=no(Ao(Su)),Rr.layoutProperty=no(Ao(kd));const Ks=Rr,C_=Ks.light,T_=Ks.sky,Em=Ks.paintProperty,Cm=Ks.layoutProperty;function Id(c,s){let h=!1;if(s&&s.length)for(const p of s)c.fire(new Mt(new Error(p.message))),h=!0;return h}class Wa{constructor(s,h,p){const _=this.cells=[];if(s instanceof ArrayBuffer){this.arrayBuffer=s;const S=new Int32Array(this.arrayBuffer);s=S[0],this.d=(h=S[1])+2*(p=S[2]);for(let A=0;A<this.d*this.d;A++){const B=S[3+A],z=S[3+A+1];_.push(B===z?null:S.subarray(B,z))}const T=S[3+_.length+1];this.keys=S.subarray(S[3+_.length],T),this.bboxes=S.subarray(T),this.insert=this._insertReadonly}else{this.d=h+2*p;for(let S=0;S<this.d*this.d;S++)_.push([]);this.keys=[],this.bboxes=[]}this.n=h,this.extent=s,this.padding=p,this.scale=h/s,this.uid=0;const k=p/h*s;this.min=-k,this.max=s+k}insert(s,h,p,_,k){this._forEachCell(h,p,_,k,this._insertCell,this.uid++,void 0,void 0),this.keys.push(s),this.bboxes.push(h),this.bboxes.push(p),this.bboxes.push(_),this.bboxes.push(k)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(s,h,p,_,k,S){this.cells[k].push(S)}query(s,h,p,_,k){const S=this.min,T=this.max;if(s<=S&&h<=S&&T<=p&&T<=_&&!k)return Array.prototype.slice.call(this.keys);{const A=[];return this._forEachCell(s,h,p,_,this._queryCell,A,{},k),A}}_queryCell(s,h,p,_,k,S,T,A){const B=this.cells[k];if(B!==null){const z=this.keys,R=this.bboxes;for(let j=0;j<B.length;j++){const q=B[j];if(T[q]===void 0){const Y=4*q;(A?A(R[Y+0],R[Y+1],R[Y+2],R[Y+3]):s<=R[Y+2]&&h<=R[Y+3]&&p>=R[Y+0]&&_>=R[Y+1])?(T[q]=!0,S.push(z[q])):T[q]=!1}}}}_forEachCell(s,h,p,_,k,S,T,A){const B=this._convertToCellCoord(s),z=this._convertToCellCoord(h),R=this._convertToCellCoord(p),j=this._convertToCellCoord(_);for(let q=B;q<=R;q++)for(let Y=z;Y<=j;Y++){const K=this.d*Y+q;if((!A||A(this._convertFromCellCoord(q),this._convertFromCellCoord(Y),this._convertFromCellCoord(q+1),this._convertFromCellCoord(Y+1)))&&k.call(this,s,h,p,_,K,S,T,A))return}}_convertFromCellCoord(s){return(s-this.padding)/this.scale}_convertToCellCoord(s){return Math.max(0,Math.min(this.d-1,Math.floor(s*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const s=this.cells,h=3+this.cells.length+1+1;let p=0;for(let S=0;S<this.cells.length;S++)p+=this.cells[S].length;const _=new Int32Array(h+p+this.keys.length+this.bboxes.length);_[0]=this.extent,_[1]=this.n,_[2]=this.padding;let k=h;for(let S=0;S<s.length;S++){const T=s[S];_[3+S]=k,_.set(T,k),k+=T.length}return _[3+s.length]=k,_.set(this.keys,k),k+=this.keys.length,_[3+s.length+1]=k,_.set(this.bboxes,k),k+=this.bboxes.length,_.buffer}static serialize(s,h){const p=s.toArrayBuffer();return h&&h.push(p),{buffer:p}}static deserialize(s){return new Wa(s.buffer)}}const Vr={};function ut(c,s,h={}){if(Vr[c])throw new Error(`${c} is already registered.`);Object.defineProperty(s,"_classRegistryKey",{value:c,writeable:!1}),Vr[c]={klass:s,omit:h.omit||[],shallow:h.shallow||[]}}ut("Object",Object),ut("TransferableGridIndex",Wa),ut("Color",kn),ut("Error",Error),ut("AJAXError",Ce),ut("ResolvedImage",yr),ut("StylePropertyFunction",Ua),ut("StyleExpression",yu,{omit:["_evaluator"]}),ut("ZoomDependentExpression",ja),ut("ZoomConstantExpression",$a),ut("CompoundExpression",Lr,{omit:["_evaluate"]});for(const c in za)za[c]._classRegistryKey||ut(`Expression_${c}`,za[c]);function Tu(c){return c&&typeof ArrayBuffer<"u"&&(c instanceof ArrayBuffer||c.constructor&&c.constructor.name==="ArrayBuffer")}function Pd(c){return c.$name||c.constructor._classRegistryKey}function Tm(c){return!function(s){if(s===null||typeof s!="object")return!1;const h=Pd(s);return!(!h||h==="Object")}(c)&&(c==null||typeof c=="boolean"||typeof c=="number"||typeof c=="string"||c instanceof Boolean||c instanceof Number||c instanceof String||c instanceof Date||c instanceof RegExp||c instanceof Blob||c instanceof Error||Tu(c)||Ft(c)||ArrayBuffer.isView(c)||c instanceof ImageData)}function Ga(c,s){if(Tm(c))return(Tu(c)||Ft(c))&&s&&s.push(c),ArrayBuffer.isView(c)&&s&&s.push(c.buffer),c instanceof ImageData&&s&&s.push(c.data.buffer),c;if(Array.isArray(c)){const k=[];for(const S of c)k.push(Ga(S,s));return k}if(typeof c!="object")throw new Error("can't serialize object of type "+typeof c);const h=Pd(c);if(!h)throw new Error(`can't serialize object of unregistered class ${c.constructor.name}`);if(!Vr[h])throw new Error(`${h} is not registered.`);const{klass:p}=Vr[h],_=p.serialize?p.serialize(c,s):{};if(p.serialize){if(s&&_===s[s.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const k in c){if(!c.hasOwnProperty(k)||Vr[h].omit.indexOf(k)>=0)continue;const S=c[k];_[k]=Vr[h].shallow.indexOf(k)>=0?S:Ga(S,s)}c instanceof Error&&(_.message=c.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(_.$name=h),_}function Za(c){if(Tm(c))return c;if(Array.isArray(c))return c.map(Za);if(typeof c!="object")throw new Error("can't deserialize object of type "+typeof c);const s=Pd(c)||"Object";if(!Vr[s])throw new Error(`can't deserialize unregistered class ${s}`);const{klass:h}=Vr[s];if(!h)throw new Error(`can't deserialize unregistered class ${s}`);if(h.deserialize)return h.deserialize(c);const p=Object.create(h.prototype);for(const _ of Object.keys(c)){if(_==="$name")continue;const k=c[_];p[_]=Vr[s].shallow.indexOf(_)>=0?k:Za(k)}return p}class Dd{constructor(){this.first=!0}update(s,h){const p=Math.floor(s);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=s,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=h):this.lastFloorZoom<p&&(this.lastIntegerZoom=p,this.lastIntegerZoomTime=h),s!==this.lastZoom&&(this.lastZoom=s,this.lastFloorZoom=p,!0))}}const en={"Latin-1 Supplement":c=>c>=128&&c<=255,"Hangul Jamo":c=>c>=4352&&c<=4607,Khmer:c=>c>=6016&&c<=6143,"General Punctuation":c=>c>=8192&&c<=8303,"Letterlike Symbols":c=>c>=8448&&c<=8527,"Number Forms":c=>c>=8528&&c<=8591,"Miscellaneous Technical":c=>c>=8960&&c<=9215,"Control Pictures":c=>c>=9216&&c<=9279,"Optical Character Recognition":c=>c>=9280&&c<=9311,"Enclosed Alphanumerics":c=>c>=9312&&c<=9471,"Geometric Shapes":c=>c>=9632&&c<=9727,"Miscellaneous Symbols":c=>c>=9728&&c<=9983,"Miscellaneous Symbols and Arrows":c=>c>=11008&&c<=11263,"Ideographic Description Characters":c=>c>=12272&&c<=12287,"CJK Symbols and Punctuation":c=>c>=12288&&c<=12351,Katakana:c=>c>=12448&&c<=12543,Kanbun:c=>c>=12688&&c<=12703,"CJK Strokes":c=>c>=12736&&c<=12783,"Enclosed CJK Letters and Months":c=>c>=12800&&c<=13055,"CJK Compatibility":c=>c>=13056&&c<=13311,"Yijing Hexagram Symbols":c=>c>=19904&&c<=19967,"Private Use Area":c=>c>=57344&&c<=63743,"Vertical Forms":c=>c>=65040&&c<=65055,"CJK Compatibility Forms":c=>c>=65072&&c<=65103,"Small Form Variants":c=>c>=65104&&c<=65135,"Halfwidth and Fullwidth Forms":c=>c>=65280&&c<=65519};function Od(c){for(const s of c)if(zd(s.charCodeAt(0)))return!0;return!1}function M_(c){for(const s of c)if(!Ya(s.charCodeAt(0)))return!1;return!0}function Bd(c){const s=c.map(h=>{try{return new RegExp(`\\p{sc=${h}}`,"u").source}catch{return null}}).filter(h=>h);return new RegExp(s.join("|"),"u")}const A_=Bd(["Arab","Dupl","Mong","Ougr","Syrc"]);function Ya(c){return!A_.test(String.fromCodePoint(c))}const Mm=Bd(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function zd(c){return!(c!==746&&c!==747&&(c<4352||!(en["CJK Compatibility Forms"](c)&&!(c>=65097&&c<=65103)||en["CJK Compatibility"](c)||en["CJK Strokes"](c)||!(!en["CJK Symbols and Punctuation"](c)||c>=12296&&c<=12305||c>=12308&&c<=12319||c===12336)||en["Enclosed CJK Letters and Months"](c)||en["Ideographic Description Characters"](c)||en.Kanbun(c)||en.Katakana(c)&&c!==12540||!(!en["Halfwidth and Fullwidth Forms"](c)||c===65288||c===65289||c===65293||c>=65306&&c<=65310||c===65339||c===65341||c===65343||c>=65371&&c<=65503||c===65507||c>=65512&&c<=65519)||!(!en["Small Form Variants"](c)||c>=65112&&c<=65118||c>=65123&&c<=65126)||en["Vertical Forms"](c)||en["Yijing Hexagram Symbols"](c)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(c))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(c))||Mm.test(String.fromCodePoint(c)))))}function Am(c){return!(zd(c)||function(s){return!!(en["Latin-1 Supplement"](s)&&(s===167||s===169||s===174||s===177||s===188||s===189||s===190||s===215||s===247)||en["General Punctuation"](s)&&(s===8214||s===8224||s===8225||s===8240||s===8241||s===8251||s===8252||s===8258||s===8263||s===8264||s===8265||s===8273)||en["Letterlike Symbols"](s)||en["Number Forms"](s)||en["Miscellaneous Technical"](s)&&(s>=8960&&s<=8967||s>=8972&&s<=8991||s>=8996&&s<=9e3||s===9003||s>=9085&&s<=9114||s>=9150&&s<=9165||s===9167||s>=9169&&s<=9179||s>=9186&&s<=9215)||en["Control Pictures"](s)&&s!==9251||en["Optical Character Recognition"](s)||en["Enclosed Alphanumerics"](s)||en["Geometric Shapes"](s)||en["Miscellaneous Symbols"](s)&&!(s>=9754&&s<=9759)||en["Miscellaneous Symbols and Arrows"](s)&&(s>=11026&&s<=11055||s>=11088&&s<=11097||s>=11192&&s<=11243)||en["CJK Symbols and Punctuation"](s)||en.Katakana(s)||en["Private Use Area"](s)||en["CJK Compatibility Forms"](s)||en["Small Form Variants"](s)||en["Halfwidth and Fullwidth Forms"](s)||s===8734||s===8756||s===8757||s>=9984&&s<=10087||s>=10102&&s<=10131||s===65532||s===65533)}(c))}const I_=Bd(["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 Nd(c){return I_.test(String.fromCodePoint(c))}function P_(c,s){return!(!s&&Nd(c)||c>=2304&&c<=3583||c>=3840&&c<=4255||en.Khmer(c))}function D_(c){for(const s of c)if(Nd(s.charCodeAt(0)))return!0;return!1}const br=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(c){this.pluginStatus=c.pluginStatus,this.pluginURL=c.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(c){this.applyArabicShaping=c.applyArabicShaping,this.processBidirectionalText=c.processBidirectionalText,this.processStyledBidirectionalText=c.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Vn{constructor(s,h){this.zoom=s,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Dd,this.transition={})}isSupportedScript(s){return function(h,p){for(const _ of h)if(!P_(_.charCodeAt(0),p))return!1;return!0}(s,br.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const s=this.zoom,h=s-Math.floor(s),p=this.crossFadingFactor();return s>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*h}}}class Xa{constructor(s,h){this.property=s,this.value=h,this.expression=function(p,_){if(mu(p))return new Ua(p,_);if(_u(p)){const k=yd(p,_);if(k.result==="error")throw new Error(k.value.map(S=>`${S.key}: ${S.message}`).join(", "));return k.value}{let k=p;return _.type==="color"&&typeof p=="string"?k=kn.parse(p):_.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?_.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(k=Nr.parse(p)):k=gr.parse(p),{kind:"constant",evaluate:()=>k}}}(h===void 0?s.specification.default:h,s.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(s,h,p){return this.property.possiblyEvaluate(this,s,h,p)}}class Mu{constructor(s){this.property=s,this.value=new Xa(s,void 0)}transitioned(s,h){return new Im(this.property,this.value,h,Se({},s.transition,this.transition),s.now)}untransitioned(){return new Im(this.property,this.value,null,{},0)}}class Au{constructor(s){this._properties=s,this._values=Object.create(s.defaultTransitionablePropertyValues)}getValue(s){return Xe(this._values[s].value.value)}setValue(s,h){Object.prototype.hasOwnProperty.call(this._values,s)||(this._values[s]=new Mu(this._values[s].property)),this._values[s].value=new Xa(this._values[s].property,h===null?void 0:Xe(h))}getTransition(s){return Xe(this._values[s].transition)}setTransition(s,h){Object.prototype.hasOwnProperty.call(this._values,s)||(this._values[s]=new Mu(this._values[s].property)),this._values[s].transition=Xe(h)||void 0}serialize(){const s={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(s[h]=p);const _=this.getTransition(h);_!==void 0&&(s[`${h}-transition`]=_)}return s}transitioned(s,h){const p=new Ql(this._properties);for(const _ of Object.keys(this._values))p._values[_]=this._values[_].transitioned(s,h._values[_]);return p}untransitioned(){const s=new Ql(this._properties);for(const h of Object.keys(this._values))s._values[h]=this._values[h].untransitioned();return s}}class Im{constructor(s,h,p,_,k){this.property=s,this.value=h,this.begin=k+_.delay||0,this.end=this.begin+_.duration||0,s.specification.transition&&(_.delay||_.duration)&&(this.prior=p)}possiblyEvaluate(s,h,p){const _=s.now||0,k=this.value.possiblyEvaluate(s,h,p),S=this.prior;if(S){if(_>this.end)return this.prior=null,k;if(this.value.isDataDriven())return this.prior=null,k;if(_<this.begin)return S.possiblyEvaluate(s,h,p);{const T=(_-this.begin)/(this.end-this.begin);return this.property.interpolate(S.possiblyEvaluate(s,h,p),k,function(A){if(A<=0)return 0;if(A>=1)return 1;const B=A*A,z=B*A;return 4*(A<.5?z:3*(A-B)+z-.75)}(T))}}return k}}class Ql{constructor(s){this._properties=s,this._values=Object.create(s.defaultTransitioningPropertyValues)}possiblyEvaluate(s,h,p){const _=new tc(this._properties);for(const k of Object.keys(this._values))_._values[k]=this._values[k].possiblyEvaluate(s,h,p);return _}hasTransition(){for(const s of Object.keys(this._values))if(this._values[s].prior)return!0;return!1}}class ec{constructor(s){this._properties=s,this._values=Object.create(s.defaultPropertyValues)}hasValue(s){return this._values[s].value!==void 0}getValue(s){return Xe(this._values[s].value)}setValue(s,h){this._values[s]=new Xa(this._values[s].property,h===null?void 0:Xe(h))}serialize(){const s={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(s[h]=p)}return s}possiblyEvaluate(s,h,p){const _=new tc(this._properties);for(const k of Object.keys(this._values))_._values[k]=this._values[k].possiblyEvaluate(s,h,p);return _}}class Io{constructor(s,h,p){this.property=s,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(s){return this.value.kind==="constant"?this.value.value:s}evaluate(s,h,p,_){return this.property.evaluate(this.value,this.parameters,s,h,p,_)}}class tc{constructor(s){this._properties=s,this._values=Object.create(s.defaultPossiblyEvaluatedValues)}get(s){return this._values[s]}}class ft{constructor(s){this.specification=s}possiblyEvaluate(s,h){if(s.isDataDriven())throw new Error("Value should not be data driven");return s.expression.evaluate(h)}interpolate(s,h,p){const _=nr[this.specification.type];return _?_(s,h,p):s}}class Et{constructor(s,h){this.specification=s,this.overrides=h}possiblyEvaluate(s,h,p,_){return new Io(this,s.expression.kind==="constant"||s.expression.kind==="camera"?{kind:"constant",value:s.expression.evaluate(h,null,{},p,_)}:s.expression,h)}interpolate(s,h,p){if(s.value.kind!=="constant"||h.value.kind!=="constant")return s;if(s.value.value===void 0||h.value.value===void 0)return new Io(this,{kind:"constant",value:void 0},s.parameters);const _=nr[this.specification.type];if(_){const k=_(s.value.value,h.value.value,p);return new Io(this,{kind:"constant",value:k},s.parameters)}return s}evaluate(s,h,p,_,k,S){return s.kind==="constant"?s.value:s.evaluate(h,p,_,k,S)}}class Iu extends Et{possiblyEvaluate(s,h,p,_){if(s.value===void 0)return new Io(this,{kind:"constant",value:void 0},h);if(s.expression.kind==="constant"){const k=s.expression.evaluate(h,null,{},p,_),S=s.property.specification.type==="resolvedImage"&&typeof k!="string"?k.name:k,T=this._calculate(S,S,S,h);return new Io(this,{kind:"constant",value:T},h)}if(s.expression.kind==="camera"){const k=this._calculate(s.expression.evaluate({zoom:h.zoom-1}),s.expression.evaluate({zoom:h.zoom}),s.expression.evaluate({zoom:h.zoom+1}),h);return new Io(this,{kind:"constant",value:k},h)}return new Io(this,s.expression,h)}evaluate(s,h,p,_,k,S){if(s.kind==="source"){const T=s.evaluate(h,p,_,k,S);return this._calculate(T,T,T,h)}return s.kind==="composite"?this._calculate(s.evaluate({zoom:Math.floor(h.zoom)-1},p,_),s.evaluate({zoom:Math.floor(h.zoom)},p,_),s.evaluate({zoom:Math.floor(h.zoom)+1},p,_),h):s.value}_calculate(s,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:s,to:h}:{from:p,to:h}}interpolate(s){return s}}class Pu{constructor(s){this.specification=s}possiblyEvaluate(s,h,p,_){if(s.value!==void 0){if(s.expression.kind==="constant"){const k=s.expression.evaluate(h,null,{},p,_);return this._calculate(k,k,k,h)}return this._calculate(s.expression.evaluate(new Vn(Math.floor(h.zoom-1),h)),s.expression.evaluate(new Vn(Math.floor(h.zoom),h)),s.expression.evaluate(new Vn(Math.floor(h.zoom+1),h)),h)}}_calculate(s,h,p,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:s,to:h}:{from:p,to:h}}interpolate(s){return s}}class Ld{constructor(s){this.specification=s}possiblyEvaluate(s,h,p,_){return!!s.expression.evaluate(h,null,{},p,_)}interpolate(){return!1}}class v{constructor(s){this.properties=s,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in s){const p=s[h];p.specification.overridable&&this.overridableProperties.push(h);const _=this.defaultPropertyValues[h]=new Xa(p,void 0),k=this.defaultTransitionablePropertyValues[h]=new Mu(p);this.defaultTransitioningPropertyValues[h]=k.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=_.possiblyEvaluate({})}}}ut("DataDrivenProperty",Et),ut("DataConstantProperty",ft),ut("CrossFadedDataDrivenProperty",Iu),ut("CrossFadedProperty",Pu),ut("ColorRampProperty",Ld);const o="-transition";class d extends rn{constructor(s,h){if(super(),this.id=s.id,this.type=s.type,this._featureFilter={filter:()=>!0,needGeometry:!1},s.type!=="custom"&&(this.metadata=s.metadata,this.minzoom=s.minzoom,this.maxzoom=s.maxzoom,s.type!=="background"&&(this.source=s.source,this.sourceLayer=s["source-layer"],this.filter=s.filter),h.layout&&(this._unevaluatedLayout=new ec(h.layout)),h.paint)){this._transitionablePaint=new Au(h.paint);for(const p in s.paint)this.setPaintProperty(p,s.paint[p],{validate:!1});for(const p in s.layout)this.setLayoutProperty(p,s.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new tc(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(s){return s==="visibility"?this.visibility:this._unevaluatedLayout.getValue(s)}setLayoutProperty(s,h,p={}){h!=null&&this._validate(Cm,`layers.${this.id}.layout.${s}`,s,h,p)||(s!=="visibility"?this._unevaluatedLayout.setValue(s,h):this.visibility=h)}getPaintProperty(s){return s.endsWith(o)?this._transitionablePaint.getTransition(s.slice(0,-11)):this._transitionablePaint.getValue(s)}setPaintProperty(s,h,p={}){if(h!=null&&this._validate(Em,`layers.${this.id}.paint.${s}`,s,h,p))return!1;if(s.endsWith(o))return this._transitionablePaint.setTransition(s.slice(0,-11),h||void 0),!1;{const _=this._transitionablePaint._values[s],k=_.property.specification["property-type"]==="cross-faded-data-driven",S=_.value.isDataDriven(),T=_.value;this._transitionablePaint.setValue(s,h),this._handleSpecialPaintPropertyUpdate(s);const A=this._transitionablePaint._values[s].value;return A.isDataDriven()||S||k||this._handleOverridablePaintPropertyUpdate(s,T,A)}}_handleSpecialPaintPropertyUpdate(s){}_handleOverridablePaintPropertyUpdate(s,h,p){return!1}isHidden(s){return!!(this.minzoom&&s<this.minzoom)||!!(this.maxzoom&&s>=this.maxzoom)||this.visibility==="none"}updateTransitions(s){this._transitioningPaint=this._transitionablePaint.transitioned(s,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(s,h){s.getCrossfadeParameters&&(this._crossfadeParameters=s.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(s,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(s,void 0,h)}serialize(){const s={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&&(s.layout=s.layout||{},s.layout.visibility=this.visibility),$e(s,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(s,h,p,_,k={}){return(!k||k.validate!==!1)&&Id(this,s.call(Ks,{key:h,layerType:this.type,objectKey:p,value:_,styleSpec:we,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const s in this.paint._values){const h=this.paint.get(s);if(h instanceof Io&&Ra(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const m={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class y{constructor(s,h){this._structArray=s,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class x{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(s,h){return s._trim(),h&&(s.isTransferred=!0,h.push(s.arrayBuffer)),{length:s.length,arrayBuffer:s.arrayBuffer}}static deserialize(s){const h=Object.create(this.prototype);return h.arrayBuffer=s.arrayBuffer,h.length=s.length,h.capacity=s.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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(s){this.reserve(s),this.length=s}reserve(s){if(s>this.capacity){this.capacity=Math.max(s,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function M(c,s=1){let h=0,p=0;return{members:c.map(_=>{const k=m[_.type].BYTES_PER_ELEMENT,S=h=P(h,Math.max(s,k)),T=_.components||1;return p=Math.max(p,k),h+=k*T,{name:_.name,type:_.type,components:T,offset:S}}),size:P(h,Math.max(p,s)),alignment:s}}function P(c,s){return Math.ceil(c/s)*s}class O extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.int16[_+0]=h,this.int16[_+1]=p,s}}O.prototype.bytesPerElement=4,ut("StructArrayLayout2i4",O);class N extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.int16[k+0]=h,this.int16[k+1]=p,this.int16[k+2]=_,s}}N.prototype.bytesPerElement=6,ut("StructArrayLayout3i6",N);class V extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_){const k=this.length;return this.resize(k+1),this.emplace(k,s,h,p,_)}emplace(s,h,p,_,k){const S=4*s;return this.int16[S+0]=h,this.int16[S+1]=p,this.int16[S+2]=_,this.int16[S+3]=k,s}}V.prototype.bytesPerElement=8,ut("StructArrayLayout4i8",V);class F extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=6*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=_,this.int16[A+3]=k,this.int16[A+4]=S,this.int16[A+5]=T,s}}F.prototype.bytesPerElement=12,ut("StructArrayLayout2i4i12",F);class Z extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=4*s,B=8*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.uint8[B+4]=_,this.uint8[B+5]=k,this.uint8[B+6]=S,this.uint8[B+7]=T,s}}Z.prototype.bytesPerElement=8,ut("StructArrayLayout2i4ub8",Z);class J extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.float32[_+0]=h,this.float32[_+1]=p,s}}J.prototype.bytesPerElement=8,ut("StructArrayLayout2f8",J);class ee extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z){const R=this.length;return this.resize(R+1),this.emplace(R,s,h,p,_,k,S,T,A,B,z)}emplace(s,h,p,_,k,S,T,A,B,z,R){const j=10*s;return this.uint16[j+0]=h,this.uint16[j+1]=p,this.uint16[j+2]=_,this.uint16[j+3]=k,this.uint16[j+4]=S,this.uint16[j+5]=T,this.uint16[j+6]=A,this.uint16[j+7]=B,this.uint16[j+8]=z,this.uint16[j+9]=R,s}}ee.prototype.bytesPerElement=20,ut("StructArrayLayout10ui20",ee);class oe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S,T,A,B,z,R,j){const q=this.length;return this.resize(q+1),this.emplace(q,s,h,p,_,k,S,T,A,B,z,R,j)}emplace(s,h,p,_,k,S,T,A,B,z,R,j,q){const Y=12*s;return this.int16[Y+0]=h,this.int16[Y+1]=p,this.int16[Y+2]=_,this.int16[Y+3]=k,this.uint16[Y+4]=S,this.uint16[Y+5]=T,this.uint16[Y+6]=A,this.uint16[Y+7]=B,this.int16[Y+8]=z,this.int16[Y+9]=R,this.int16[Y+10]=j,this.int16[Y+11]=q,s}}oe.prototype.bytesPerElement=24,ut("StructArrayLayout4i4ui4i24",oe);class le extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.float32[k+0]=h,this.float32[k+1]=p,this.float32[k+2]=_,s}}le.prototype.bytesPerElement=12,ut("StructArrayLayout3f12",le);class ce extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.uint32[1*s+0]=h,s}}ce.prototype.bytesPerElement=4,ut("StructArrayLayout1ul4",ce);class he extends x{_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(s,h,p,_,k,S,T,A,B){const z=this.length;return this.resize(z+1),this.emplace(z,s,h,p,_,k,S,T,A,B)}emplace(s,h,p,_,k,S,T,A,B,z){const R=10*s,j=5*s;return this.int16[R+0]=h,this.int16[R+1]=p,this.int16[R+2]=_,this.int16[R+3]=k,this.int16[R+4]=S,this.int16[R+5]=T,this.uint32[j+3]=A,this.uint16[R+8]=B,this.uint16[R+9]=z,s}}he.prototype.bytesPerElement=20,ut("StructArrayLayout6i1ul2ui20",he);class ne extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=6*s;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=_,this.int16[A+3]=k,this.int16[A+4]=S,this.int16[A+5]=T,s}}ne.prototype.bytesPerElement=12,ut("StructArrayLayout2i2i2i12",ne);class me extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k){const S=this.length;return this.resize(S+1),this.emplace(S,s,h,p,_,k)}emplace(s,h,p,_,k,S){const T=4*s,A=8*s;return this.float32[T+0]=h,this.float32[T+1]=p,this.float32[T+2]=_,this.int16[A+6]=k,this.int16[A+7]=S,s}}me.prototype.bytesPerElement=16,ut("StructArrayLayout2f1f2i16",me);class ge extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,h,p,_,k,S){const T=this.length;return this.resize(T+1),this.emplace(T,s,h,p,_,k,S)}emplace(s,h,p,_,k,S,T){const A=16*s,B=4*s,z=8*s;return this.uint8[A+0]=h,this.uint8[A+1]=p,this.float32[B+1]=_,this.float32[B+2]=k,this.int16[z+6]=S,this.int16[z+7]=T,s}}ge.prototype.bytesPerElement=16,ut("StructArrayLayout2ub2f2i16",ge);class xe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.uint16[k+0]=h,this.uint16[k+1]=p,this.uint16[k+2]=_,s}}xe.prototype.bytesPerElement=6,ut("StructArrayLayout3ui6",xe);class Oe extends x{_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(s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae){const be=this.length;return this.resize(be+1),this.emplace(be,s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae)}emplace(s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae,be){const pe=24*s,ye=12*s,Te=48*s;return this.int16[pe+0]=h,this.int16[pe+1]=p,this.uint16[pe+2]=_,this.uint16[pe+3]=k,this.uint32[ye+2]=S,this.uint32[ye+3]=T,this.uint32[ye+4]=A,this.uint16[pe+10]=B,this.uint16[pe+11]=z,this.uint16[pe+12]=R,this.float32[ye+7]=j,this.float32[ye+8]=q,this.uint8[Te+36]=Y,this.uint8[Te+37]=K,this.uint8[Te+38]=re,this.uint32[ye+10]=ae,this.int16[pe+22]=be,s}}Oe.prototype.bytesPerElement=48,ut("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Oe);class Fe extends x{_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(s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae,be,pe,ye,Te,Re,ot,St,nt,Qe,yt,dt){const lt=this.length;return this.resize(lt+1),this.emplace(lt,s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae,be,pe,ye,Te,Re,ot,St,nt,Qe,yt,dt)}emplace(s,h,p,_,k,S,T,A,B,z,R,j,q,Y,K,re,ae,be,pe,ye,Te,Re,ot,St,nt,Qe,yt,dt,lt){const De=32*s,bt=16*s;return this.int16[De+0]=h,this.int16[De+1]=p,this.int16[De+2]=_,this.int16[De+3]=k,this.int16[De+4]=S,this.int16[De+5]=T,this.int16[De+6]=A,this.int16[De+7]=B,this.uint16[De+8]=z,this.uint16[De+9]=R,this.uint16[De+10]=j,this.uint16[De+11]=q,this.uint16[De+12]=Y,this.uint16[De+13]=K,this.uint16[De+14]=re,this.uint16[De+15]=ae,this.uint16[De+16]=be,this.uint16[De+17]=pe,this.uint16[De+18]=ye,this.uint16[De+19]=Te,this.uint16[De+20]=Re,this.uint16[De+21]=ot,this.uint16[De+22]=St,this.uint32[bt+12]=nt,this.float32[bt+13]=Qe,this.float32[bt+14]=yt,this.uint16[De+30]=dt,this.uint16[De+31]=lt,s}}Fe.prototype.bytesPerElement=64,ut("StructArrayLayout8i15ui1ul2f2ui64",Fe);class et extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.float32[1*s+0]=h,s}}et.prototype.bytesPerElement=4,ut("StructArrayLayout1f4",et);class at extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=3*s;return this.uint16[6*s+0]=h,this.float32[k+1]=p,this.float32[k+2]=_,s}}at.prototype.bytesPerElement=12,ut("StructArrayLayout1ui2f12",at);class Ye extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h,p){const _=this.length;return this.resize(_+1),this.emplace(_,s,h,p)}emplace(s,h,p,_){const k=4*s;return this.uint32[2*s+0]=h,this.uint16[k+2]=p,this.uint16[k+3]=_,s}}Ye.prototype.bytesPerElement=8,ut("StructArrayLayout1ul2ui8",Ye);class Ge extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,h){const p=this.length;return this.resize(p+1),this.emplace(p,s,h)}emplace(s,h,p){const _=2*s;return this.uint16[_+0]=h,this.uint16[_+1]=p,s}}Ge.prototype.bytesPerElement=4,ut("StructArrayLayout2ui4",Ge);class mt extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s){const h=this.length;return this.resize(h+1),this.emplace(h,s)}emplace(s,h){return this.uint16[1*s+0]=h,s}}mt.prototype.bytesPerElement=2,ut("StructArrayLayout1ui2",mt);class Bt extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,h,p,_){const k=this.length;return this.resize(k+1),this.emplace(k,s,h,p,_)}emplace(s,h,p,_,k){const S=4*s;return this.float32[S+0]=h,this.float32[S+1]=p,this.float32[S+2]=_,this.float32[S+3]=k,s}}Bt.prototype.bytesPerElement=16,ut("StructArrayLayout4f16",Bt);class Je extends y{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 E(this.anchorPointX,this.anchorPointY)}}Je.prototype.size=20;class it extends he{get(s){return new Je(this,s)}}ut("CollisionBoxArray",it);class Dt extends y{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(s){this._structArray.uint8[this._pos1+37]=s}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(s){this._structArray.uint8[this._pos1+38]=s}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(s){this._structArray.uint32[this._pos4+10]=s}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Dt.prototype.size=48;class Fn extends Oe{get(s){return new Dt(this,s)}}ut("PlacedSymbolArray",Fn);class $t extends y{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(s){this._structArray.uint32[this._pos4+12]=s}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]}}$t.prototype.size=64;class Jt extends Fe{get(s){return new $t(this,s)}}ut("SymbolInstanceArray",Jt);class $n extends et{getoffsetX(s){return this.float32[1*s+0]}}ut("GlyphOffsetArray",$n);class Bi extends N{getx(s){return this.int16[3*s+0]}gety(s){return this.int16[3*s+1]}gettileUnitDistanceFromAnchor(s){return this.int16[3*s+2]}}ut("SymbolLineVertexArray",Bi);class io extends y{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]}}io.prototype.size=12;class jn extends at{get(s){return new io(this,s)}}ut("TextAnchorOffsetArray",jn);class rr extends y{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]}}rr.prototype.size=8;class Gi extends Ye{get(s){return new rr(this,s)}}ut("FeatureIndexArray",Gi);class zi extends O{}class Zi extends O{}class Po extends O{}class Ka extends F{}class Du extends Z{}class Ja extends J{}class Fr extends ee{}class Ou extends oe{}class Rd extends le{}class $r extends ce{}class jr extends ne{}class fs extends ge{}class ro extends xe{}class Ei extends Ge{}const Ni=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:xr}=Ni;class tn{constructor(s=[]){this.segments=s}prepareSegment(s,h,p,_){let k=this.segments[this.segments.length-1];return s>tn.MAX_VERTEX_ARRAY_LENGTH&&st(`Max vertices per segment is ${tn.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${s}`),(!k||k.vertexLength+s>tn.MAX_VERTEX_ARRAY_LENGTH||k.sortKey!==_)&&(k={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},_!==void 0&&(k.sortKey=_),this.segments.push(k)),k}get(){return this.segments}destroy(){for(const s of this.segments)for(const h in s.vaos)s.vaos[h].destroy()}static simpleSegment(s,h,p,_){return new tn([{vertexOffset:s,primitiveOffset:h,vertexLength:p,primitiveLength:_,vaos:{},sortKey:0}])}}function Js(c,s){return 256*(c=Ie(Math.floor(c),0,255))+Ie(Math.floor(s),0,255)}tn.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ut("SegmentVector",tn);const Qa=M([{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 el={exports:{}},Pm={exports:{}};Pm.exports=function(c,s){var h,p,_,k,S,T,A,B;for(p=c.length-(h=3&c.length),_=s,S=3432918353,T=461845907,B=0;B<p;)A=255&c.charCodeAt(B)|(255&c.charCodeAt(++B))<<8|(255&c.charCodeAt(++B))<<16|(255&c.charCodeAt(++B))<<24,++B,_=27492+(65535&(k=5*(65535&(_=(_^=A=(65535&(A=(A=(65535&A)*S+(((A>>>16)*S&65535)<<16)&4294967295)<<15|A>>>17))*T+(((A>>>16)*T&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(k>>>16)&65535)<<16);switch(A=0,h){case 3:A^=(255&c.charCodeAt(B+2))<<16;case 2:A^=(255&c.charCodeAt(B+1))<<8;case 1:_^=A=(65535&(A=(A=(65535&(A^=255&c.charCodeAt(B)))*S+(((A>>>16)*S&65535)<<16)&4294967295)<<15|A>>>17))*T+(((A>>>16)*T&65535)<<16)&4294967295}return _^=c.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var O_=Pm.exports,Dm={exports:{}};Dm.exports=function(c,s){for(var h,p=c.length,_=s^p,k=0;p>=4;)h=1540483477*(65535&(h=255&c.charCodeAt(k)|(255&c.charCodeAt(++k))<<8|(255&c.charCodeAt(++k))<<16|(255&c.charCodeAt(++k))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++k;switch(p){case 3:_^=(255&c.charCodeAt(k+2))<<16;case 2:_^=(255&c.charCodeAt(k+1))<<8;case 1:_=1540483477*(65535&(_^=255&c.charCodeAt(k)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var ms=O_,Om=Dm.exports;el.exports=ms,el.exports.murmur3=ms,el.exports.murmur2=Om;var Bu=g(el.exports);class nc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(s,h,p,_){this.ids.push(zu(s)),this.positions.push(h,p,_)}getPositions(s){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=zu(s);let p=0,_=this.ids.length-1;for(;p<_;){const S=p+_>>1;this.ids[S]>=h?_=S:p=S+1}const k=[];for(;this.ids[p]===h;)k.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return k}static serialize(s,h){const p=new Float64Array(s.ids),_=new Uint32Array(s.positions);return Nu(p,_,0,p.length-1),h&&h.push(p.buffer,_.buffer),{ids:p,positions:_}}static deserialize(s){const h=new nc;return h.ids=s.ids,h.positions=s.positions,h.indexed=!0,h}}function zu(c){const s=+c;return!isNaN(s)&&s<=Number.MAX_SAFE_INTEGER?s:Bu(String(c))}function Nu(c,s,h,p){for(;h<p;){const _=c[h+p>>1];let k=h-1,S=p+1;for(;;){do k++;while(c[k]<_);do S--;while(c[S]>_);if(k>=S)break;tl(c,k,S),tl(s,3*k,3*S),tl(s,3*k+1,3*S+1),tl(s,3*k+2,3*S+2)}S-h<p-S?(Nu(c,s,h,S),h=S+1):(Nu(c,s,S+1,p),p=S)}}function tl(c,s,h){const p=c[s];c[s]=c[h],c[h]=p}ut("FeaturePositionMap",nc);class ic{constructor(s,h){this.gl=s.gl,this.location=h}}class Bm extends ic{constructor(s,h){super(s,h),this.current=0}set(s){this.current!==s&&(this.current=s,this.gl.uniform1f(this.location,s))}}class WS extends ic{constructor(s,h){super(s,h),this.current=[0,0,0,0]}set(s){s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]&&s[3]===this.current[3]||(this.current=s,this.gl.uniform4f(this.location,s[0],s[1],s[2],s[3]))}}class GS extends ic{constructor(s,h){super(s,h),this.current=kn.transparent}set(s){s.r===this.current.r&&s.g===this.current.g&&s.b===this.current.b&&s.a===this.current.a||(this.current=s,this.gl.uniform4f(this.location,s.r,s.g,s.b,s.a))}}const uW=new Float32Array(16);function B_(c){return[Js(255*c.r,255*c.g),Js(255*c.b,255*c.a)]}class Vd{constructor(s,h,p){this.value=s,this.uniformNames=h.map(_=>`u_${_}`),this.type=p}setUniform(s,h,p){s.set(p.constantOr(this.value))}getBinding(s,h,p){return this.type==="color"?new GS(s,h):new Bm(s,h)}}class Lu{constructor(s,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(s,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=s.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=s.tlbr}setUniform(s,h,p,_){const k=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;k&&s.set(k)}getBinding(s,h,p){return p.substr(0,9)==="u_pattern"?new WS(s,h):new Bm(s,h)}}class Qs{constructor(s,h,p,_){this.expression=s,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(k=>({name:`a_${k}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(s,h,p,_,k){const S=this.paintVertexArray.length,T=this.expression.evaluate(new Vn(0),h,{},_,[],k);this.paintVertexArray.resize(s),this._setPaintValue(S,s,T)}updatePaintArray(s,h,p,_){const k=this.expression.evaluate({zoom:0},p,_);this._setPaintValue(s,h,k)}_setPaintValue(s,h,p){if(this.type==="color"){const _=B_(p);for(let k=s;k<h;k++)this.paintVertexArray.emplace(k,_[0],_[1])}else{for(let _=s;_<h;_++)this.paintVertexArray.emplace(_,p);this.maxValue=Math.max(this.maxValue,Math.abs(p))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Wo{constructor(s,h,p,_,k,S){this.expression=s,this.uniformNames=h.map(T=>`u_${T}_t`),this.type=p,this.useIntegerZoom=_,this.zoom=k,this.maxValue=0,this.paintVertexAttributes=h.map(T=>({name:`a_${T}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new S}populatePaintArray(s,h,p,_,k){const S=this.expression.evaluate(new Vn(this.zoom),h,{},_,[],k),T=this.expression.evaluate(new Vn(this.zoom+1),h,{},_,[],k),A=this.paintVertexArray.length;this.paintVertexArray.resize(s),this._setPaintValue(A,s,S,T)}updatePaintArray(s,h,p,_){const k=this.expression.evaluate({zoom:this.zoom},p,_),S=this.expression.evaluate({zoom:this.zoom+1},p,_);this._setPaintValue(s,h,k,S)}_setPaintValue(s,h,p,_){if(this.type==="color"){const k=B_(p),S=B_(_);for(let T=s;T<h;T++)this.paintVertexArray.emplace(T,k[0],k[1],S[0],S[1])}else{for(let k=s;k<h;k++)this.paintVertexArray.emplace(k,p,_);this.maxValue=Math.max(this.maxValue,Math.abs(p),Math.abs(_))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(s,h){const p=this.useIntegerZoom?Math.floor(h.zoom):h.zoom,_=Ie(this.expression.interpolationFactor(p,this.zoom,this.zoom+1),0,1);s.set(_)}getBinding(s,h,p){return new Bm(s,h)}}class nl{constructor(s,h,p,_,k,S){this.expression=s,this.type=h,this.useIntegerZoom=p,this.zoom=_,this.layerId=S,this.zoomInPaintVertexArray=new k,this.zoomOutPaintVertexArray=new k}populatePaintArray(s,h,p){const _=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(s),this.zoomOutPaintVertexArray.resize(s),this._setPaintValues(_,s,h.patterns&&h.patterns[this.layerId],p)}updatePaintArray(s,h,p,_,k){this._setPaintValues(s,h,p.patterns&&p.patterns[this.layerId],k)}_setPaintValues(s,h,p,_){if(!_||!p)return;const{min:k,mid:S,max:T}=p,A=_[k],B=_[S],z=_[T];if(A&&B&&z)for(let R=s;R<h;R++)this.zoomInPaintVertexArray.emplace(R,B.tl[0],B.tl[1],B.br[0],B.br[1],A.tl[0],A.tl[1],A.br[0],A.br[1],B.pixelRatio,A.pixelRatio),this.zoomOutPaintVertexArray.emplace(R,B.tl[0],B.tl[1],B.br[0],B.br[1],z.tl[0],z.tl[1],z.br[0],z.br[1],B.pixelRatio,z.pixelRatio)}upload(s){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=s.createVertexBuffer(this.zoomInPaintVertexArray,Qa.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=s.createVertexBuffer(this.zoomOutPaintVertexArray,Qa.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ZS{constructor(s,h,p){this.binders={},this._buffers=[];const _=[];for(const k in s.paint._values){if(!p(k))continue;const S=s.paint.get(k);if(!(S instanceof Io&&Ra(S.property.specification)))continue;const T=hW(k,s.type),A=S.value,B=S.property.specification.type,z=S.property.useIntegerZoom,R=S.property.specification["property-type"],j=R==="cross-faded"||R==="cross-faded-data-driven";if(A.kind==="constant")this.binders[k]=j?new Lu(A.value,T):new Vd(A.value,T,B),_.push(`/u_${k}`);else if(A.kind==="source"||j){const q=YS(k,B,"source");this.binders[k]=j?new nl(A,B,z,h,q,s.id):new Qs(A,T,B,q),_.push(`/a_${k}`)}else{const q=YS(k,B,"composite");this.binders[k]=new Wo(A,T,B,z,h,q),_.push(`/z_${k}`)}}this.cacheKey=_.sort().join("")}getMaxValue(s){const h=this.binders[s];return h instanceof Qs||h instanceof Wo?h.maxValue:0}populatePaintArrays(s,h,p,_,k){for(const S in this.binders){const T=this.binders[S];(T instanceof Qs||T instanceof Wo||T instanceof nl)&&T.populatePaintArray(s,h,p,_,k)}}setConstantPatternPositions(s,h){for(const p in this.binders){const _=this.binders[p];_ instanceof Lu&&_.setConstantPatternPositions(s,h)}}updatePaintArrays(s,h,p,_,k){let S=!1;for(const T in s){const A=h.getPositions(T);for(const B of A){const z=p.feature(B.index);for(const R in this.binders){const j=this.binders[R];if((j instanceof Qs||j instanceof Wo||j instanceof nl)&&j.expression.isStateDependent===!0){const q=_.paint.get(R);j.expression=q.value,j.updatePaintArray(B.start,B.end,z,s[T],k),S=!0}}}}return S}defines(){const s=[];for(const h in this.binders){const p=this.binders[h];(p instanceof Vd||p instanceof Lu)&&s.push(...p.uniformNames.map(_=>`#define HAS_UNIFORM_${_}`))}return s}getBinderAttributes(){const s=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Qs||p instanceof Wo)for(let _=0;_<p.paintVertexAttributes.length;_++)s.push(p.paintVertexAttributes[_].name);else if(p instanceof nl)for(let _=0;_<Qa.members.length;_++)s.push(Qa.members[_].name)}return s}getBinderUniforms(){const s=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Vd||p instanceof Lu||p instanceof Wo)for(const _ of p.uniformNames)s.push(_)}return s}getPaintVertexBuffers(){return this._buffers}getUniforms(s,h){const p=[];for(const _ in this.binders){const k=this.binders[_];if(k instanceof Vd||k instanceof Lu||k instanceof Wo){for(const S of k.uniformNames)if(h[S]){const T=k.getBinding(s,h[S],S);p.push({name:S,property:_,binding:T})}}}return p}setUniforms(s,h,p,_){for(const{name:k,property:S,binding:T}of h)this.binders[S].setUniform(T,_,p.get(S),k)}updatePaintBuffers(s){this._buffers=[];for(const h in this.binders){const p=this.binders[h];if(s&&p instanceof nl){const _=s.fromScale===2?p.zoomInPaintVertexBuffer:p.zoomOutPaintVertexBuffer;_&&this._buffers.push(_)}else(p instanceof Qs||p instanceof Wo)&&p.paintVertexBuffer&&this._buffers.push(p.paintVertexBuffer)}}upload(s){for(const h in this.binders){const p=this.binders[h];(p instanceof Qs||p instanceof Wo||p instanceof nl)&&p.upload(s)}this.updatePaintBuffers()}destroy(){for(const s in this.binders){const h=this.binders[s];(h instanceof Qs||h instanceof Wo||h instanceof nl)&&h.destroy()}}}class rc{constructor(s,h,p=()=>!0){this.programConfigurations={};for(const _ of s)this.programConfigurations[_.id]=new ZS(_,h,p);this.needsUpload=!1,this._featureMap=new nc,this._bufferOffset=0}populatePaintArrays(s,h,p,_,k,S){for(const T in this.programConfigurations)this.programConfigurations[T].populatePaintArrays(s,h,_,k,S);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,s),this._bufferOffset=s,this.needsUpload=!0}updatePaintArrays(s,h,p,_){for(const k of p)this.needsUpload=this.programConfigurations[k.id].updatePaintArrays(s,this._featureMap,h,k,_)||this.needsUpload}get(s){return this.programConfigurations[s]}upload(s){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(s);this.needsUpload=!1}}destroy(){for(const s in this.programConfigurations)this.programConfigurations[s].destroy()}}function hW(c,s){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"]}[c]||[c.replace(`${s}-`,"").replace(/-/g,"_")]}function YS(c,s,h){const p={color:{source:J,composite:Bt},number:{source:et,composite:J}},_=function(k){return{"line-pattern":{source:Fr,composite:Fr},"fill-pattern":{source:Fr,composite:Fr},"fill-extrusion-pattern":{source:Fr,composite:Fr}}[k]}(c);return _&&_[h]||p[s][h]}ut("ConstantBinder",Vd),ut("CrossFadedConstantBinder",Lu),ut("SourceExpressionBinder",Qs),ut("CrossFadedCompositeBinder",nl),ut("CompositeExpressionBinder",Wo),ut("ProgramConfiguration",ZS,{omit:["_buffers"]}),ut("ProgramConfigurationSet",rc);const ai=8192,z_=Math.pow(2,14)-1,XS=-z_-1;function oc(c){const s=ai/c.extent,h=c.loadGeometry();for(let p=0;p<h.length;p++){const _=h[p];for(let k=0;k<_.length;k++){const S=_[k],T=Math.round(S.x*s),A=Math.round(S.y*s);S.x=Ie(T,XS,z_),S.y=Ie(A,XS,z_),(T<S.x||T>S.x+1||A<S.y||A>S.y+1)&&st("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function sc(c,s){return{type:c.type,id:c.id,properties:c.properties,geometry:s?oc(c):[]}}function zm(c,s,h,p,_){c.emplaceBack(2*s+(p+1)/2,2*h+(_+1)/2)}class N_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.layoutVertexArray=new Zi,this.indexArray=new ro,this.segments=new tn,this.programConfigurations=new rc(s.layers,s.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){const _=this.layers[0],k=[];let S=null,T=!1;_.type==="circle"&&(S=_.layout.get("circle-sort-key"),T=!S.isConstant());for(const{feature:A,id:B,index:z,sourceLayerIndex:R}of s){const j=this.layers[0]._featureFilter.needGeometry,q=sc(A,j);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),q,p))continue;const Y=T?S.evaluate(q,{},p):void 0,K={id:B,properties:A.properties,type:A.type,sourceLayerIndex:R,index:z,geometry:j?q.geometry:oc(A),patterns:{},sortKey:Y};k.push(K)}T&&k.sort((A,B)=>A.sortKey-B.sortKey);for(const A of k){const{geometry:B,index:z,sourceLayerIndex:R}=A,j=s[z].feature;this.addFeature(A,B,z,p),h.featureIndex.insert(j,B,z,R,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,xr),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(s,h,p,_){for(const k of h)for(const S of k){const T=S.x,A=S.y;if(T<0||T>=ai||A<0||A>=ai)continue;const B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,s.sortKey),z=B.vertexLength;zm(this.layoutVertexArray,T,A,-1,-1),zm(this.layoutVertexArray,T,A,1,-1),zm(this.layoutVertexArray,T,A,1,1),zm(this.layoutVertexArray,T,A,-1,1),this.indexArray.emplaceBack(z,z+1,z+2),this.indexArray.emplaceBack(z,z+3,z+2),B.vertexLength+=4,B.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,{},_)}}function KS(c,s){for(let h=0;h<c.length;h++)if(Ru(s,c[h]))return!0;for(let h=0;h<s.length;h++)if(Ru(c,s[h]))return!0;return!!L_(c,s)}function dW(c,s,h){return!!Ru(c,s)||!!R_(s,c,h)}function JS(c,s){if(c.length===1)return eE(s,c[0]);for(let h=0;h<s.length;h++){const p=s[h];for(let _=0;_<p.length;_++)if(Ru(c,p[_]))return!0}for(let h=0;h<c.length;h++)if(eE(s,c[h]))return!0;for(let h=0;h<s.length;h++)if(L_(c,s[h]))return!0;return!1}function pW(c,s,h){if(c.length>1){if(L_(c,s))return!0;for(let p=0;p<s.length;p++)if(R_(s[p],c,h))return!0}for(let p=0;p<c.length;p++)if(R_(c[p],s,h))return!0;return!1}function L_(c,s){if(c.length===0||s.length===0)return!1;for(let h=0;h<c.length-1;h++){const p=c[h],_=c[h+1];for(let k=0;k<s.length-1;k++)if(fW(p,_,s[k],s[k+1]))return!0}return!1}function fW(c,s,h,p){return Tt(c,h,p)!==Tt(s,h,p)&&Tt(c,s,h)!==Tt(c,s,p)}function R_(c,s,h){const p=h*h;if(s.length===1)return c.distSqr(s[0])<p;for(let _=1;_<s.length;_++)if(QS(c,s[_-1],s[_])<p)return!0;return!1}function QS(c,s,h){const p=s.distSqr(h);if(p===0)return c.distSqr(s);const _=((c.x-s.x)*(h.x-s.x)+(c.y-s.y)*(h.y-s.y))/p;return c.distSqr(_<0?s:_>1?h:h.sub(s)._mult(_)._add(s))}function eE(c,s){let h,p,_,k=!1;for(let S=0;S<c.length;S++){h=c[S];for(let T=0,A=h.length-1;T<h.length;A=T++)p=h[T],_=h[A],p.y>s.y!=_.y>s.y&&s.x<(_.x-p.x)*(s.y-p.y)/(_.y-p.y)+p.x&&(k=!k)}return k}function Ru(c,s){let h=!1;for(let p=0,_=c.length-1;p<c.length;_=p++){const k=c[p],S=c[_];k.y>s.y!=S.y>s.y&&s.x<(S.x-k.x)*(s.y-k.y)/(S.y-k.y)+k.x&&(h=!h)}return h}function mW(c,s,h){const p=h[0],_=h[2];if(c.x<p.x&&s.x<p.x||c.x>_.x&&s.x>_.x||c.y<p.y&&s.y<p.y||c.y>_.y&&s.y>_.y)return!1;const k=Tt(c,s,h[0]);return k!==Tt(c,s,h[1])||k!==Tt(c,s,h[2])||k!==Tt(c,s,h[3])}function Fd(c,s,h){const p=s.paint.get(c).value;return p.kind==="constant"?p.value:h.programConfigurations.get(s.id).getMaxValue(c)}function Nm(c){return Math.sqrt(c[0]*c[0]+c[1]*c[1])}function Lm(c,s,h,p,_){if(!s[0]&&!s[1])return c;const k=E.convert(s)._mult(_);h==="viewport"&&k._rotate(-p);const S=[];for(let T=0;T<c.length;T++)S.push(c[T].sub(k));return S}let tE,nE;ut("CircleBucket",N_,{omit:["layers"]});var gW={get paint(){return nE=nE||new v({"circle-radius":new Et(we.paint_circle["circle-radius"]),"circle-color":new Et(we.paint_circle["circle-color"]),"circle-blur":new Et(we.paint_circle["circle-blur"]),"circle-opacity":new Et(we.paint_circle["circle-opacity"]),"circle-translate":new ft(we.paint_circle["circle-translate"]),"circle-translate-anchor":new ft(we.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ft(we.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ft(we.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Et(we.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Et(we.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Et(we.paint_circle["circle-stroke-opacity"])})},get layout(){return tE=tE||new v({"circle-sort-key":new Et(we.layout_circle["circle-sort-key"])})}},or=1e-6,Vu=typeof Float32Array<"u"?Float32Array:Array;function V_(c){return c[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=1,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c}function iE(c,s,h){var p=s[0],_=s[1],k=s[2],S=s[3],T=s[4],A=s[5],B=s[6],z=s[7],R=s[8],j=s[9],q=s[10],Y=s[11],K=s[12],re=s[13],ae=s[14],be=s[15],pe=h[0],ye=h[1],Te=h[2],Re=h[3];return c[0]=pe*p+ye*T+Te*R+Re*K,c[1]=pe*_+ye*A+Te*j+Re*re,c[2]=pe*k+ye*B+Te*q+Re*ae,c[3]=pe*S+ye*z+Te*Y+Re*be,c[4]=(pe=h[4])*p+(ye=h[5])*T+(Te=h[6])*R+(Re=h[7])*K,c[5]=pe*_+ye*A+Te*j+Re*re,c[6]=pe*k+ye*B+Te*q+Re*ae,c[7]=pe*S+ye*z+Te*Y+Re*be,c[8]=(pe=h[8])*p+(ye=h[9])*T+(Te=h[10])*R+(Re=h[11])*K,c[9]=pe*_+ye*A+Te*j+Re*re,c[10]=pe*k+ye*B+Te*q+Re*ae,c[11]=pe*S+ye*z+Te*Y+Re*be,c[12]=(pe=h[12])*p+(ye=h[13])*T+(Te=h[14])*R+(Re=h[15])*K,c[13]=pe*_+ye*A+Te*j+Re*re,c[14]=pe*k+ye*B+Te*q+Re*ae,c[15]=pe*S+ye*z+Te*Y+Re*be,c}Math.hypot||(Math.hypot=function(){for(var c=0,s=arguments.length;s--;)c+=arguments[s]*arguments[s];return Math.sqrt(c)});var $d,yW=iE;function Rm(c,s,h){var p=s[0],_=s[1],k=s[2],S=s[3];return c[0]=h[0]*p+h[4]*_+h[8]*k+h[12]*S,c[1]=h[1]*p+h[5]*_+h[9]*k+h[13]*S,c[2]=h[2]*p+h[6]*_+h[10]*k+h[14]*S,c[3]=h[3]*p+h[7]*_+h[11]*k+h[15]*S,c}$d=new Vu(4),Vu!=Float32Array&&($d[0]=0,$d[1]=0,$d[2]=0,$d[3]=0);class _W extends d{constructor(s){super(s,gW)}createBucket(s){return new N_(s)}queryRadius(s){const h=s;return Fd("circle-radius",this,h)+Fd("circle-stroke-width",this,h)+Nm(this.paint.get("circle-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T,A){const B=Lm(s,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),S.angle,T),z=this.paint.get("circle-radius").evaluate(h,p)+this.paint.get("circle-stroke-width").evaluate(h,p),R=this.paint.get("circle-pitch-alignment")==="map",j=R?B:function(Y,K){return Y.map(re=>rE(re,K))}(B,A),q=R?z*T:z;for(const Y of _)for(const K of Y){const re=R?K:rE(K,A);let ae=q;const be=Rm([],[K.x,K.y,0,1],A);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ae*=be[3]/S.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ae*=S.cameraToCenterDistance/be[3]),dW(j,re,ae))return!0}return!1}}function rE(c,s){const h=Rm([],[c.x,c.y,0,1],s);return new E(h[0]/h[3],h[1]/h[3])}class oE extends N_{}let sE;ut("HeatmapBucket",oE,{omit:["layers"]});var bW={get paint(){return sE=sE||new v({"heatmap-radius":new Et(we.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Et(we.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ft(we.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ld(we.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ft(we.paint_heatmap["heatmap-opacity"])})}};function F_(c,{width:s,height:h},p,_){if(_){if(_ instanceof Uint8ClampedArray)_=new Uint8Array(_.buffer);else if(_.length!==s*h*p)throw new RangeError(`mismatched image size. expected: ${_.length} but got: ${s*h*p}`)}else _=new Uint8Array(s*h*p);return c.width=s,c.height=h,c.data=_,c}function aE(c,{width:s,height:h},p){if(s===c.width&&h===c.height)return;const _=F_({},{width:s,height:h},p);$_(c,_,{x:0,y:0},{x:0,y:0},{width:Math.min(c.width,s),height:Math.min(c.height,h)},p),c.width=s,c.height=h,c.data=_.data}function $_(c,s,h,p,_,k){if(_.width===0||_.height===0)return s;if(_.width>c.width||_.height>c.height||h.x>c.width-_.width||h.y>c.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>s.width||_.height>s.height||p.x>s.width-_.width||p.y>s.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const S=c.data,T=s.data;if(S===T)throw new Error("srcData equals dstData, so image is already copied");for(let A=0;A<_.height;A++){const B=((h.y+A)*c.width+h.x)*k,z=((p.y+A)*s.width+p.x)*k;for(let R=0;R<_.width*k;R++)T[z+R]=S[B+R]}return s}class jd{constructor(s,h){F_(this,s,1,h)}resize(s){aE(this,s,1)}clone(){return new jd({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,h,p,_,k){$_(s,h,p,_,k,1)}}class oo{constructor(s,h){F_(this,s,4,h)}resize(s){aE(this,s,4)}replace(s,h){h?this.data.set(s):this.data=s instanceof Uint8ClampedArray?new Uint8Array(s.buffer):s}clone(){return new oo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,h,p,_,k){$_(s,h,p,_,k,4)}}function lE(c){const s={},h=c.resolution||256,p=c.clips?c.clips.length:1,_=c.image||new oo({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const k=(S,T,A)=>{s[c.evaluationKey]=A;const B=c.expression.evaluate(s);_.data[S+T+0]=Math.floor(255*B.r/B.a),_.data[S+T+1]=Math.floor(255*B.g/B.a),_.data[S+T+2]=Math.floor(255*B.b/B.a),_.data[S+T+3]=Math.floor(255*B.a)};if(c.clips)for(let S=0,T=0;S<p;++S,T+=4*h)for(let A=0,B=0;A<h;A++,B+=4){const z=A/(h-1),{start:R,end:j}=c.clips[S];k(T,B,R*(1-z)+j*z)}else for(let S=0,T=0;S<h;S++,T+=4)k(0,T,S/(h-1));return _}ut("AlphaImage",jd),ut("RGBAImage",oo);const j_="big-fb";class xW extends d{createBucket(s){return new oE(s)}constructor(s){super(s,bW),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(s){s==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=lE({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(j_)&&this.heatmapFbos.delete(j_)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let cE;var vW={get paint(){return cE=cE||new v({"hillshade-illumination-direction":new ft(we.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ft(we.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ft(we.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ft(we.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ft(we.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ft(we.paint_hillshade["hillshade-accent-color"])})}};class wW extends d{constructor(s){super(s,vW)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const kW=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:SW}=kW;function uE(c,s,h=2){const p=s&&s.length,_=p?s[0]*h:c.length;let k=hE(c,0,_,h,!0);const S=[];if(!k||k.next===k.prev)return S;let T,A,B;if(p&&(k=function(z,R,j,q){const Y=[];for(let K=0,re=R.length;K<re;K++){const ae=hE(z,R[K]*q,K<re-1?R[K+1]*q:z.length,q,!1);ae===ae.next&&(ae.steiner=!0),Y.push(DW(ae))}Y.sort(AW);for(let K=0;K<Y.length;K++)j=IW(Y[K],j);return j}(c,s,k,h)),c.length>80*h){T=1/0,A=1/0;let z=-1/0,R=-1/0;for(let j=h;j<_;j+=h){const q=c[j],Y=c[j+1];q<T&&(T=q),Y<A&&(A=Y),q>z&&(z=q),Y>R&&(R=Y)}B=Math.max(z-T,R-A),B=B!==0?32767/B:0}return Ud(k,S,h,T,A,B,0),S}function hE(c,s,h,p,_){let k;if(_===function(S,T,A,B){let z=0;for(let R=T,j=A-B;R<A;R+=B)z+=(S[j]-S[R])*(S[R+1]+S[j+1]),j=R;return z}(c,s,h,p)>0)for(let S=s;S<h;S+=p)k=fE(S/p|0,c[S],c[S+1],k);else for(let S=h-p;S>=s;S-=p)k=fE(S/p|0,c[S],c[S+1],k);return k&&Vm(k,k.next)&&(qd(k),k=k.next),k}function ac(c,s){if(!c)return c;s||(s=c);let h,p=c;do if(h=!1,p.steiner||!Vm(p,p.next)&&ii(p.prev,p,p.next)!==0)p=p.next;else{if(qd(p),p=s=p.prev,p===p.next)break;h=!0}while(h||p!==s);return s}function Ud(c,s,h,p,_,k,S){if(!c)return;!S&&k&&function(A,B,z,R){let j=A;do j.z===0&&(j.z=U_(j.x,j.y,B,z,R)),j.prevZ=j.prev,j.nextZ=j.next,j=j.next;while(j!==A);j.prevZ.nextZ=null,j.prevZ=null,function(q){let Y,K=1;do{let re,ae=q;q=null;let be=null;for(Y=0;ae;){Y++;let pe=ae,ye=0;for(let Re=0;Re<K&&(ye++,pe=pe.nextZ,pe);Re++);let Te=K;for(;ye>0||Te>0&&pe;)ye!==0&&(Te===0||!pe||ae.z<=pe.z)?(re=ae,ae=ae.nextZ,ye--):(re=pe,pe=pe.nextZ,Te--),be?be.nextZ=re:q=re,re.prevZ=be,be=re;ae=pe}be.nextZ=null,K*=2}while(Y>1)}(j)}(c,p,_,k);let T=c;for(;c.prev!==c.next;){const A=c.prev,B=c.next;if(k?CW(c,p,_,k):EW(c))s.push(A.i,c.i,B.i),qd(c),c=B.next,T=B.next;else if((c=B)===T){S?S===1?Ud(c=TW(ac(c),s),s,h,p,_,k,2):S===2&&MW(c,s,h,p,_,k):Ud(ac(c),s,h,p,_,k,1);break}}}function EW(c){const s=c.prev,h=c,p=c.next;if(ii(s,h,p)>=0)return!1;const _=s.x,k=h.x,S=p.x,T=s.y,A=h.y,B=p.y,z=_<k?_<S?_:S:k<S?k:S,R=T<A?T<B?T:B:A<B?A:B,j=_>k?_>S?_:S:k>S?k:S,q=T>A?T>B?T:B:A>B?A:B;let Y=p.next;for(;Y!==s;){if(Y.x>=z&&Y.x<=j&&Y.y>=R&&Y.y<=q&&Fu(_,T,k,A,S,B,Y.x,Y.y)&&ii(Y.prev,Y,Y.next)>=0)return!1;Y=Y.next}return!0}function CW(c,s,h,p){const _=c.prev,k=c,S=c.next;if(ii(_,k,S)>=0)return!1;const T=_.x,A=k.x,B=S.x,z=_.y,R=k.y,j=S.y,q=T<A?T<B?T:B:A<B?A:B,Y=z<R?z<j?z:j:R<j?R:j,K=T>A?T>B?T:B:A>B?A:B,re=z>R?z>j?z:j:R>j?R:j,ae=U_(q,Y,s,h,p),be=U_(K,re,s,h,p);let pe=c.prevZ,ye=c.nextZ;for(;pe&&pe.z>=ae&&ye&&ye.z<=be;){if(pe.x>=q&&pe.x<=K&&pe.y>=Y&&pe.y<=re&&pe!==_&&pe!==S&&Fu(T,z,A,R,B,j,pe.x,pe.y)&&ii(pe.prev,pe,pe.next)>=0||(pe=pe.prevZ,ye.x>=q&&ye.x<=K&&ye.y>=Y&&ye.y<=re&&ye!==_&&ye!==S&&Fu(T,z,A,R,B,j,ye.x,ye.y)&&ii(ye.prev,ye,ye.next)>=0))return!1;ye=ye.nextZ}for(;pe&&pe.z>=ae;){if(pe.x>=q&&pe.x<=K&&pe.y>=Y&&pe.y<=re&&pe!==_&&pe!==S&&Fu(T,z,A,R,B,j,pe.x,pe.y)&&ii(pe.prev,pe,pe.next)>=0)return!1;pe=pe.prevZ}for(;ye&&ye.z<=be;){if(ye.x>=q&&ye.x<=K&&ye.y>=Y&&ye.y<=re&&ye!==_&&ye!==S&&Fu(T,z,A,R,B,j,ye.x,ye.y)&&ii(ye.prev,ye,ye.next)>=0)return!1;ye=ye.nextZ}return!0}function TW(c,s){let h=c;do{const p=h.prev,_=h.next.next;!Vm(p,_)&&dE(p,h,h.next,_)&&Hd(p,_)&&Hd(_,p)&&(s.push(p.i,h.i,_.i),qd(h),qd(h.next),h=c=_),h=h.next}while(h!==c);return ac(h)}function MW(c,s,h,p,_,k){let S=c;do{let T=S.next.next;for(;T!==S.prev;){if(S.i!==T.i&&OW(S,T)){let A=pE(S,T);return S=ac(S,S.next),A=ac(A,A.next),Ud(S,s,h,p,_,k,0),void Ud(A,s,h,p,_,k,0)}T=T.next}S=S.next}while(S!==c)}function AW(c,s){return c.x-s.x}function IW(c,s){const h=function(_,k){let S=k;const T=_.x,A=_.y;let B,z=-1/0;do{if(A<=S.y&&A>=S.next.y&&S.next.y!==S.y){const K=S.x+(A-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(K<=T&&K>z&&(z=K,B=S.x<S.next.x?S:S.next,K===T))return B}S=S.next}while(S!==k);if(!B)return null;const R=B,j=B.x,q=B.y;let Y=1/0;S=B;do{if(T>=S.x&&S.x>=j&&T!==S.x&&Fu(A<q?T:z,A,j,q,A<q?z:T,A,S.x,S.y)){const K=Math.abs(A-S.y)/(T-S.x);Hd(S,_)&&(K<Y||K===Y&&(S.x>B.x||S.x===B.x&&PW(B,S)))&&(B=S,Y=K)}S=S.next}while(S!==R);return B}(c,s);if(!h)return s;const p=pE(h,c);return ac(p,p.next),ac(h,h.next)}function PW(c,s){return ii(c.prev,c,s.prev)<0&&ii(s.next,c,c.next)<0}function U_(c,s,h,p,_){return(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-h)*_|0)|c<<8))|c<<4))|c<<2))|c<<1))|(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-p)*_|0)|s<<8))|s<<4))|s<<2))|s<<1))<<1}function DW(c){let s=c,h=c;do(s.x<h.x||s.x===h.x&&s.y<h.y)&&(h=s),s=s.next;while(s!==c);return h}function Fu(c,s,h,p,_,k,S,T){return(_-S)*(s-T)>=(c-S)*(k-T)&&(c-S)*(p-T)>=(h-S)*(s-T)&&(h-S)*(k-T)>=(_-S)*(p-T)}function OW(c,s){return c.next.i!==s.i&&c.prev.i!==s.i&&!function(h,p){let _=h;do{if(_.i!==h.i&&_.next.i!==h.i&&_.i!==p.i&&_.next.i!==p.i&&dE(_,_.next,h,p))return!0;_=_.next}while(_!==h);return!1}(c,s)&&(Hd(c,s)&&Hd(s,c)&&function(h,p){let _=h,k=!1;const S=(h.x+p.x)/2,T=(h.y+p.y)/2;do _.y>T!=_.next.y>T&&_.next.y!==_.y&&S<(_.next.x-_.x)*(T-_.y)/(_.next.y-_.y)+_.x&&(k=!k),_=_.next;while(_!==h);return k}(c,s)&&(ii(c.prev,c,s.prev)||ii(c,s.prev,s))||Vm(c,s)&&ii(c.prev,c,c.next)>0&&ii(s.prev,s,s.next)>0)}function ii(c,s,h){return(s.y-c.y)*(h.x-s.x)-(s.x-c.x)*(h.y-s.y)}function Vm(c,s){return c.x===s.x&&c.y===s.y}function dE(c,s,h,p){const _=$m(ii(c,s,h)),k=$m(ii(c,s,p)),S=$m(ii(h,p,c)),T=$m(ii(h,p,s));return _!==k&&S!==T||!(_!==0||!Fm(c,h,s))||!(k!==0||!Fm(c,p,s))||!(S!==0||!Fm(h,c,p))||!(T!==0||!Fm(h,s,p))}function Fm(c,s,h){return s.x<=Math.max(c.x,h.x)&&s.x>=Math.min(c.x,h.x)&&s.y<=Math.max(c.y,h.y)&&s.y>=Math.min(c.y,h.y)}function $m(c){return c>0?1:c<0?-1:0}function Hd(c,s){return ii(c.prev,c,c.next)<0?ii(c,s,c.next)>=0&&ii(c,c.prev,s)>=0:ii(c,s,c.prev)<0||ii(c,c.next,s)<0}function pE(c,s){const h=H_(c.i,c.x,c.y),p=H_(s.i,s.x,s.y),_=c.next,k=s.prev;return c.next=s,s.prev=c,h.next=_,_.prev=h,p.next=h,h.prev=p,k.next=p,p.prev=k,p}function fE(c,s,h,p){const _=H_(c,s,h);return p?(_.next=p.next,_.prev=p,p.next.prev=_,p.next=_):(_.prev=_,_.next=_),_}function qd(c){c.next.prev=c.prev,c.prev.next=c.next,c.prevZ&&(c.prevZ.nextZ=c.nextZ),c.nextZ&&(c.nextZ.prevZ=c.prevZ)}function H_(c,s,h){return{i:c,x:s,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function q_(c,s,h){const p=h.patternDependencies;let _=!1;for(const k of s){const S=k.paint.get(`${c}-pattern`);S.isConstant()||(_=!0);const T=S.constantOr(null);T&&(_=!0,p[T.to]=!0,p[T.from]=!0)}return _}function W_(c,s,h,p,_){const k=_.patternDependencies;for(const S of s){const T=S.paint.get(`${c}-pattern`).value;if(T.kind!=="constant"){let A=T.evaluate({zoom:p-1},h,{},_.availableImages),B=T.evaluate({zoom:p},h,{},_.availableImages),z=T.evaluate({zoom:p+1},h,{},_.availableImages);A=A&&A.name?A.name:A,B=B&&B.name?B.name:B,z=z&&z.name?z.name:z,k[A]=!0,k[B]=!0,k[z]=!0,h.patterns[S.id]={min:A,mid:B,max:z}}}return h}class G_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Po,this.indexArray=new ro,this.indexArray2=new Ei,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.segments2=new tn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.hasPattern=q_("fill",this.layers,h);const _=this.layers[0].layout.get("fill-sort-key"),k=!_.isConstant(),S=[];for(const{feature:T,id:A,index:B,sourceLayerIndex:z}of s){const R=this.layers[0]._featureFilter.needGeometry,j=sc(T,R);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),j,p))continue;const q=k?_.evaluate(j,{},p,h.availableImages):void 0,Y={id:A,properties:T.properties,type:T.type,sourceLayerIndex:z,index:B,geometry:R?j.geometry:oc(T),patterns:{},sortKey:q};S.push(Y)}k&&S.sort((T,A)=>T.sortKey-A.sortKey);for(const T of S){const{geometry:A,index:B,sourceLayerIndex:z}=T;if(this.hasPattern){const R=W_("fill",this.layers,T,this.zoom,h);this.patternFeatures.push(R)}else this.addFeature(T,A,B,p,{});h.featureIndex.insert(s[B].feature,A,B,z,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}addFeatures(s,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,SW),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.indexBuffer2=s.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(s),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(s,h,p,_,k){for(const S of uu(h,500)){let T=0;for(const q of S)T+=q.length;const A=this.segments.prepareSegment(T,this.layoutVertexArray,this.indexArray),B=A.vertexLength,z=[],R=[];for(const q of S){if(q.length===0)continue;q!==S[0]&&R.push(z.length/2);const Y=this.segments2.prepareSegment(q.length,this.layoutVertexArray,this.indexArray2),K=Y.vertexLength;this.layoutVertexArray.emplaceBack(q[0].x,q[0].y),this.indexArray2.emplaceBack(K+q.length-1,K),z.push(q[0].x),z.push(q[0].y);for(let re=1;re<q.length;re++)this.layoutVertexArray.emplaceBack(q[re].x,q[re].y),this.indexArray2.emplaceBack(K+re-1,K+re),z.push(q[re].x),z.push(q[re].y);Y.vertexLength+=q.length,Y.primitiveLength+=q.length}const j=uE(z,R);for(let q=0;q<j.length;q+=3)this.indexArray.emplaceBack(B+j[q],B+j[q+1],B+j[q+2]);A.vertexLength+=T,A.primitiveLength+=j.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}}let mE,gE;ut("FillBucket",G_,{omit:["layers","patternFeatures"]});var BW={get paint(){return gE=gE||new v({"fill-antialias":new ft(we.paint_fill["fill-antialias"]),"fill-opacity":new Et(we.paint_fill["fill-opacity"]),"fill-color":new Et(we.paint_fill["fill-color"]),"fill-outline-color":new Et(we.paint_fill["fill-outline-color"]),"fill-translate":new ft(we.paint_fill["fill-translate"]),"fill-translate-anchor":new ft(we.paint_fill["fill-translate-anchor"]),"fill-pattern":new Iu(we.paint_fill["fill-pattern"])})},get layout(){return mE=mE||new v({"fill-sort-key":new Et(we.layout_fill["fill-sort-key"])})}};class zW extends d{constructor(s){super(s,BW)}recalculate(s,h){super.recalculate(s,h);const p=this.paint._values["fill-outline-color"];p.value.kind==="constant"&&p.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(s){return new G_(s)}queryRadius(){return Nm(this.paint.get("fill-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T){return JS(Lm(s,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),S.angle,T),_)}isTileClipped(){return!0}}const NW=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),LW=M([{name:"a_centroid",components:2,type:"Int16"}],4),{members:RW}=NW;var il={},VW=b,yE=$u;function $u(c,s,h,p,_){this.properties={},this.extent=h,this.type=0,this._pbf=c,this._geometry=-1,this._keys=p,this._values=_,c.readFields(FW,this,s)}function FW(c,s,h){c==1?s.id=h.readVarint():c==2?function(p,_){for(var k=p.readVarint()+p.pos;p.pos<k;){var S=_._keys[p.readVarint()],T=_._values[p.readVarint()];_.properties[S]=T}}(h,s):c==3?s.type=h.readVarint():c==4&&(s._geometry=h.pos)}function $W(c){for(var s,h,p=0,_=0,k=c.length,S=k-1;_<k;S=_++)p+=((h=c[S]).x-(s=c[_]).x)*(s.y+h.y);return p}$u.types=["Unknown","Point","LineString","Polygon"],$u.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var s,h=c.readVarint()+c.pos,p=1,_=0,k=0,S=0,T=[];c.pos<h;){if(_<=0){var A=c.readVarint();p=7&A,_=A>>3}if(_--,p===1||p===2)k+=c.readSVarint(),S+=c.readSVarint(),p===1&&(s&&T.push(s),s=[]),s.push(new VW(k,S));else{if(p!==7)throw new Error("unknown command "+p);s&&s.push(s[0].clone())}}return s&&T.push(s),T},$u.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var s=c.readVarint()+c.pos,h=1,p=0,_=0,k=0,S=1/0,T=-1/0,A=1/0,B=-1/0;c.pos<s;){if(p<=0){var z=c.readVarint();h=7&z,p=z>>3}if(p--,h===1||h===2)(_+=c.readSVarint())<S&&(S=_),_>T&&(T=_),(k+=c.readSVarint())<A&&(A=k),k>B&&(B=k);else if(h!==7)throw new Error("unknown command "+h)}return[S,A,T,B]},$u.prototype.toGeoJSON=function(c,s,h){var p,_,k=this.extent*Math.pow(2,h),S=this.extent*c,T=this.extent*s,A=this.loadGeometry(),B=$u.types[this.type];function z(q){for(var Y=0;Y<q.length;Y++){var K=q[Y];q[Y]=[360*(K.x+S)/k-180,360/Math.PI*Math.atan(Math.exp((180-360*(K.y+T)/k)*Math.PI/180))-90]}}switch(this.type){case 1:var R=[];for(p=0;p<A.length;p++)R[p]=A[p][0];z(A=R);break;case 2:for(p=0;p<A.length;p++)z(A[p]);break;case 3:for(A=function(q){var Y=q.length;if(Y<=1)return[q];for(var K,re,ae=[],be=0;be<Y;be++){var pe=$W(q[be]);pe!==0&&(re===void 0&&(re=pe<0),re===pe<0?(K&&ae.push(K),K=[q[be]]):K.push(q[be]))}return K&&ae.push(K),ae}(A),p=0;p<A.length;p++)for(_=0;_<A[p].length;_++)z(A[p][_])}A.length===1?A=A[0]:B="Multi"+B;var j={type:"Feature",geometry:{type:B,coordinates:A},properties:this.properties};return"id"in this&&(j.id=this.id),j};var jW=yE,_E=bE;function bE(c,s){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=c,this._keys=[],this._values=[],this._features=[],c.readFields(UW,this,s),this.length=this._features.length}function UW(c,s,h){c===15?s.version=h.readVarint():c===1?s.name=h.readString():c===5?s.extent=h.readVarint():c===2?s._features.push(h.pos):c===3?s._keys.push(h.readString()):c===4&&s._values.push(function(p){for(var _=null,k=p.readVarint()+p.pos;p.pos<k;){var S=p.readVarint()>>3;_=S===1?p.readString():S===2?p.readFloat():S===3?p.readDouble():S===4?p.readVarint64():S===5?p.readVarint():S===6?p.readSVarint():S===7?p.readBoolean():null}return _}(h))}bE.prototype.feature=function(c){if(c<0||c>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];var s=this._pbf.readVarint()+this._pbf.pos;return new jW(this._pbf,s,this.extent,this._keys,this._values)};var HW=_E;function qW(c,s,h){if(c===3){var p=new HW(h,h.readVarint()+h.pos);p.length&&(s[p.name]=p)}}il.VectorTile=function(c,s){this.layers=c.readFields(qW,{},s)},il.VectorTileFeature=yE,il.VectorTileLayer=_E;const WW=il.VectorTileFeature.types,Z_=Math.pow(2,13);function Wd(c,s,h,p,_,k,S,T){c.emplaceBack(s,h,2*Math.floor(p*Z_)+S,_*Z_*2,k*Z_*2,Math.round(T))}class Y_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.layoutVertexArray=new Ka,this.centroidVertexArray=new zi,this.indexArray=new ro,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.features=[],this.hasPattern=q_("fill-extrusion",this.layers,h);for(const{feature:_,id:k,index:S,sourceLayerIndex:T}of s){const A=this.layers[0]._featureFilter.needGeometry,B=sc(_,A);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),B,p))continue;const z={id:k,sourceLayerIndex:T,index:S,geometry:A?B.geometry:oc(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(W_("fill-extrusion",this.layers,z,this.zoom,h)):this.addFeature(z,z.geometry,S,p,{}),h.featureIndex.insert(_,z.geometry,S,T,this.index,!0)}}addFeatures(s,h,p){for(const _ of this.features){const{geometry:k}=_;this.addFeature(_,k,_.index,h,p)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,RW),this.centroidVertexBuffer=s.createVertexBuffer(this.centroidVertexArray,LW.members,!0),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(s,h,p,_,k){for(const S of uu(h,500)){const T={x:0,y:0,vertexCount:0};let A=0;for(const Y of S)A+=Y.length;let B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const Y of S){if(Y.length===0||ZW(Y))continue;let K=0;for(let re=0;re<Y.length;re++){const ae=Y[re];if(re>=1){const be=Y[re-1];if(!GW(ae,be)){B.vertexLength+4>tn.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const pe=ae.sub(be)._perp()._unit(),ye=be.dist(ae);K+ye>32768&&(K=0),Wd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,0,K),Wd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,1,K),T.x+=2*ae.x,T.y+=2*ae.y,T.vertexCount+=2,K+=ye,Wd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,0,K),Wd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,1,K),T.x+=2*be.x,T.y+=2*be.y,T.vertexCount+=2;const Te=B.vertexLength;this.indexArray.emplaceBack(Te,Te+2,Te+1),this.indexArray.emplaceBack(Te+1,Te+2,Te+3),B.vertexLength+=4,B.primitiveLength+=2}}}}if(B.vertexLength+A>tn.MAX_VERTEX_ARRAY_LENGTH&&(B=this.segments.prepareSegment(A,this.layoutVertexArray,this.indexArray)),WW[s.type]!=="Polygon")continue;const z=[],R=[],j=B.vertexLength;for(const Y of S)if(Y.length!==0){Y!==S[0]&&R.push(z.length/2);for(let K=0;K<Y.length;K++){const re=Y[K];Wd(this.layoutVertexArray,re.x,re.y,0,0,1,1,0),T.x+=re.x,T.y+=re.y,T.vertexCount+=1,z.push(re.x),z.push(re.y)}}const q=uE(z,R);for(let Y=0;Y<q.length;Y+=3)this.indexArray.emplaceBack(j+q[Y],j+q[Y+2],j+q[Y+1]);B.primitiveLength+=q.length/3,B.vertexLength+=A;for(let Y=0;Y<T.vertexCount;Y++){const K=Math.floor(T.x/T.vertexCount),re=Math.floor(T.y/T.vertexCount);this.centroidVertexArray.emplaceBack(K,re)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}}function GW(c,s){return c.x===s.x&&(c.x<0||c.x>ai)||c.y===s.y&&(c.y<0||c.y>ai)}function ZW(c){return c.every(s=>s.x<0)||c.every(s=>s.x>ai)||c.every(s=>s.y<0)||c.every(s=>s.y>ai)}let xE;ut("FillExtrusionBucket",Y_,{omit:["layers","features"]});var YW={get paint(){return xE=xE||new v({"fill-extrusion-opacity":new ft(we["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Et(we["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ft(we["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ft(we["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Iu(we["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Et(we["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Et(we["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new ft(we["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class XW extends d{constructor(s){super(s,YW)}createBucket(s){return new Y_(s)}queryRadius(){return Nm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(s,h,p,_,k,S,T,A){const B=Lm(s,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),S.angle,T),z=this.paint.get("fill-extrusion-height").evaluate(h,p),R=this.paint.get("fill-extrusion-base").evaluate(h,p),j=function(Y,K,re,ae){const be=[];for(const pe of Y){const ye=[pe.x,pe.y,0,1];Rm(ye,ye,K),be.push(new E(ye[0]/ye[3],ye[1]/ye[3]))}return be}(B,A),q=function(Y,K,re,ae){const be=[],pe=[],ye=ae[8]*K,Te=ae[9]*K,Re=ae[10]*K,ot=ae[11]*K,St=ae[8]*re,nt=ae[9]*re,Qe=ae[10]*re,yt=ae[11]*re;for(const dt of Y){const lt=[],De=[];for(const bt of dt){const gt=bt.x,Ot=bt.y,Dn=ae[0]*gt+ae[4]*Ot+ae[12],An=ae[1]*gt+ae[5]*Ot+ae[13],yi=ae[2]*gt+ae[6]*Ot+ae[14],Do=ae[3]*gt+ae[7]*Ot+ae[15],Ri=yi+Re,_i=Do+ot,sr=Dn+St,ar=An+nt,lr=yi+Qe,ei=Do+yt,bi=new E((Dn+ye)/_i,(An+Te)/_i);bi.z=Ri/_i,lt.push(bi);const Yi=new E(sr/ei,ar/ei);Yi.z=lr/ei,De.push(Yi)}be.push(lt),pe.push(De)}return[be,pe]}(_,R,z,A);return function(Y,K,re){let ae=1/0;JS(re,K)&&(ae=vE(re,K[0]));for(let be=0;be<K.length;be++){const pe=K[be],ye=Y[be];for(let Te=0;Te<pe.length-1;Te++){const Re=pe[Te],ot=[Re,pe[Te+1],ye[Te+1],ye[Te],Re];KS(re,ot)&&(ae=Math.min(ae,vE(re,ot)))}}return ae!==1/0&&ae}(q[0],q[1],j)}}function Gd(c,s){return c.x*s.x+c.y*s.y}function vE(c,s){if(c.length===1){let h=0;const p=s[h++];let _;for(;!_||p.equals(_);)if(_=s[h++],!_)return 1/0;for(;h<s.length;h++){const k=s[h],S=c[0],T=_.sub(p),A=k.sub(p),B=S.sub(p),z=Gd(T,T),R=Gd(T,A),j=Gd(A,A),q=Gd(B,T),Y=Gd(B,A),K=z*j-R*R,re=(j*q-R*Y)/K,ae=(z*Y-R*q)/K,be=p.z*(1-re-ae)+_.z*re+k.z*ae;if(isFinite(be))return be}return 1/0}{let h=1/0;for(const p of s)h=Math.min(h,p.z);return h}}const KW=M([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:JW}=KW,QW=M([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:eG}=QW,tG=il.VectorTileFeature.types,nG=Math.cos(Math.PI/180*37.5),wE=Math.pow(2,14)/.5;class X_{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(h=>h.id),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new Du,this.layoutVertexArray2=new Ja,this.indexArray=new ro,this.programConfigurations=new rc(s.layers,s.zoom),this.segments=new tn,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(s,h,p){this.hasPattern=q_("line",this.layers,h);const _=this.layers[0].layout.get("line-sort-key"),k=!_.isConstant(),S=[];for(const{feature:T,id:A,index:B,sourceLayerIndex:z}of s){const R=this.layers[0]._featureFilter.needGeometry,j=sc(T,R);if(!this.layers[0]._featureFilter.filter(new Vn(this.zoom),j,p))continue;const q=k?_.evaluate(j,{},p):void 0,Y={id:A,properties:T.properties,type:T.type,sourceLayerIndex:z,index:B,geometry:R?j.geometry:oc(T),patterns:{},sortKey:q};S.push(Y)}k&&S.sort((T,A)=>T.sortKey-A.sortKey);for(const T of S){const{geometry:A,index:B,sourceLayerIndex:z}=T;if(this.hasPattern){const R=W_("line",this.layers,T,this.zoom,h);this.patternFeatures.push(R)}else this.addFeature(T,A,B,p,{});h.featureIndex.insert(s[B].feature,A,B,z,this.index)}}update(s,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,h,this.stateDependentLayers,p)}addFeatures(s,h,p){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=s.createVertexBuffer(this.layoutVertexArray2,eG)),this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,JW),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(s){if(s.properties&&Object.prototype.hasOwnProperty.call(s.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(s.properties,"mapbox_clip_end"))return{start:+s.properties.mapbox_clip_start,end:+s.properties.mapbox_clip_end}}addFeature(s,h,p,_,k){const S=this.layers[0].layout,T=S.get("line-join").evaluate(s,{}),A=S.get("line-cap"),B=S.get("line-miter-limit"),z=S.get("line-round-limit");this.lineClips=this.lineFeatureClips(s);for(const R of h)this.addLine(R,s,T,A,B,z);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,p,k,_)}addLine(s,h,p,_,k,S){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ae=0;ae<s.length-1;ae++)this.totalDistance+=s[ae].dist(s[ae+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const T=tG[h.type]==="Polygon";let A=s.length;for(;A>=2&&s[A-1].equals(s[A-2]);)A--;let B=0;for(;B<A-1&&s[B].equals(s[B+1]);)B++;if(A<(T?3:2))return;p==="bevel"&&(k=1.05);const z=this.overscaling<=16?15*ai/(512*this.overscaling):0,R=this.segments.prepareSegment(10*A,this.layoutVertexArray,this.indexArray);let j,q,Y,K,re;this.e1=this.e2=-1,T&&(j=s[A-2],re=s[B].sub(j)._unit()._perp());for(let ae=B;ae<A;ae++){if(Y=ae===A-1?T?s[B+1]:void 0:s[ae+1],Y&&s[ae].equals(Y))continue;re&&(K=re),j&&(q=j),j=s[ae],re=Y?Y.sub(j)._unit()._perp():K,K=K||re;let be=K.add(re);be.x===0&&be.y===0||be._unit();const pe=K.x*re.x+K.y*re.y,ye=be.x*re.x+be.y*re.y,Te=ye!==0?1/ye:1/0,Re=2*Math.sqrt(2-2*ye),ot=ye<nG&&q&&Y,St=K.x*re.y-K.y*re.x>0;if(ot&&ae>B){const yt=j.dist(q);if(yt>2*z){const dt=j.sub(j.sub(q)._mult(z/yt)._round());this.updateDistance(q,dt),this.addCurrentVertex(dt,K,0,0,R),q=dt}}const nt=q&&Y;let Qe=nt?p:T?"butt":_;if(nt&&Qe==="round"&&(Te<S?Qe="miter":Te<=2&&(Qe="fakeround")),Qe==="miter"&&Te>k&&(Qe="bevel"),Qe==="bevel"&&(Te>2&&(Qe="flipbevel"),Te<k&&(Qe="miter")),q&&this.updateDistance(q,j),Qe==="miter")be._mult(Te),this.addCurrentVertex(j,be,0,0,R);else if(Qe==="flipbevel"){if(Te>100)be=re.mult(-1);else{const yt=Te*K.add(re).mag()/K.sub(re).mag();be._perp()._mult(yt*(St?-1:1))}this.addCurrentVertex(j,be,0,0,R),this.addCurrentVertex(j,be.mult(-1),0,0,R)}else if(Qe==="bevel"||Qe==="fakeround"){const yt=-Math.sqrt(Te*Te-1),dt=St?yt:0,lt=St?0:yt;if(q&&this.addCurrentVertex(j,K,dt,lt,R),Qe==="fakeround"){const De=Math.round(180*Re/Math.PI/20);for(let bt=1;bt<De;bt++){let gt=bt/De;if(gt!==.5){const Dn=gt-.5;gt+=gt*Dn*(gt-1)*((1.0904+pe*(pe*(3.55645-1.43519*pe)-3.2452))*Dn*Dn+(.848013+pe*(.215638*pe-1.06021)))}const Ot=re.sub(K)._mult(gt)._add(K)._unit()._mult(St?-1:1);this.addHalfVertex(j,Ot.x,Ot.y,!1,St,0,R)}}Y&&this.addCurrentVertex(j,re,-dt,-lt,R)}else if(Qe==="butt")this.addCurrentVertex(j,be,0,0,R);else if(Qe==="square"){const yt=q?1:-1;this.addCurrentVertex(j,be,yt,yt,R)}else Qe==="round"&&(q&&(this.addCurrentVertex(j,K,0,0,R),this.addCurrentVertex(j,K,1,1,R,!0)),Y&&(this.addCurrentVertex(j,re,-1,-1,R,!0),this.addCurrentVertex(j,re,0,0,R)));if(ot&&ae<A-1){const yt=j.dist(Y);if(yt>2*z){const dt=j.add(Y.sub(j)._mult(z/yt)._round());this.updateDistance(j,dt),this.addCurrentVertex(dt,re,0,0,R),j=dt}}}}addCurrentVertex(s,h,p,_,k,S=!1){const T=h.y*_-h.x,A=-h.y-h.x*_;this.addHalfVertex(s,h.x+h.y*p,h.y-h.x*p,S,!1,p,k),this.addHalfVertex(s,T,A,S,!0,-_,k),this.distance>wE/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(s,h,p,_,k,S))}addHalfVertex({x:s,y:h},p,_,k,S,T,A){const B=.5*(this.lineClips?this.scaledDistance*(wE-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((s<<1)+(k?1:0),(h<<1)+(S?1:0),Math.round(63*p)+128,Math.round(63*_)+128,1+(T===0?0:T<0?-1:1)|(63&B)<<2,B>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const z=A.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,z),A.primitiveLength++),S?this.e2=z:this.e1=z}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(s,h){this.distance+=s.dist(h),this.updateScaledDistance()}}let kE,SE;ut("LineBucket",X_,{omit:["layers","patternFeatures"]});var EE={get paint(){return SE=SE||new v({"line-opacity":new Et(we.paint_line["line-opacity"]),"line-color":new Et(we.paint_line["line-color"]),"line-translate":new ft(we.paint_line["line-translate"]),"line-translate-anchor":new ft(we.paint_line["line-translate-anchor"]),"line-width":new Et(we.paint_line["line-width"]),"line-gap-width":new Et(we.paint_line["line-gap-width"]),"line-offset":new Et(we.paint_line["line-offset"]),"line-blur":new Et(we.paint_line["line-blur"]),"line-dasharray":new Pu(we.paint_line["line-dasharray"]),"line-pattern":new Iu(we.paint_line["line-pattern"]),"line-gradient":new Ld(we.paint_line["line-gradient"])})},get layout(){return kE=kE||new v({"line-cap":new ft(we.layout_line["line-cap"]),"line-join":new Et(we.layout_line["line-join"]),"line-miter-limit":new ft(we.layout_line["line-miter-limit"]),"line-round-limit":new ft(we.layout_line["line-round-limit"]),"line-sort-key":new Et(we.layout_line["line-sort-key"])})}};class iG extends Et{possiblyEvaluate(s,h){return h=new Vn(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(s,h)}evaluate(s,h,p,_){return h=Se({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(s,h,p,_)}}let jm;class rG extends d{constructor(s){super(s,EE),this.gradientVersion=0,jm||(jm=new iG(EE.paint.properties["line-width"].specification),jm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(s){if(s==="line-gradient"){const h=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof Da,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(s,h){super.recalculate(s,h),this.paint._values["line-floorwidth"]=jm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,s)}createBucket(s){return new X_(s)}queryRadius(s){const h=s,p=CE(Fd("line-width",this,h),Fd("line-gap-width",this,h)),_=Fd("line-offset",this,h);return p/2+Math.abs(_)+Nm(this.paint.get("line-translate"))}queryIntersectsFeature(s,h,p,_,k,S,T){const A=Lm(s,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),S.angle,T),B=T/2*CE(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),z=this.paint.get("line-offset").evaluate(h,p);return z&&(_=function(R,j){const q=[];for(let Y=0;Y<R.length;Y++){const K=R[Y],re=[];for(let ae=0;ae<K.length;ae++){const be=K[ae-1],pe=K[ae],ye=K[ae+1],Te=ae===0?new E(0,0):pe.sub(be)._unit()._perp(),Re=ae===K.length-1?new E(0,0):ye.sub(pe)._unit()._perp(),ot=Te._add(Re)._unit(),St=ot.x*Re.x+ot.y*Re.y;St!==0&&ot._mult(1/St),re.push(ot._mult(j)._add(pe))}q.push(re)}return q}(_,z*T)),function(R,j,q){for(let Y=0;Y<j.length;Y++){const K=j[Y];if(R.length>=3){for(let re=0;re<K.length;re++)if(Ru(R,K[re]))return!0}if(pW(R,K,q))return!0}return!1}(A,_,B)}isTileClipped(){return!0}}function CE(c,s){return s>0?s+2*c:c}const oG=M([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),sG=M([{name:"a_projected_pos",components:3,type:"Float32"}],4);M([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const aG=M([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);M([{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 TE=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),lG=M([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function cG(c,s,h){return c.sections.forEach(p=>{p.text=function(_,k,S){const T=k.layout.get("text-transform").evaluate(S,{});return T==="uppercase"?_=_.toLocaleUpperCase():T==="lowercase"&&(_=_.toLocaleLowerCase()),br.applyArabicShaping&&(_=br.applyArabicShaping(_)),_}(p.text,s,h)}),c}M([{name:"triangle",components:3,type:"Uint16"}]),M([{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"}]),M([{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"}]),M([{type:"Float32",name:"offsetX"}]),M([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),M([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Zd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var hi=24,ME=Mn,AE=function(c,s,h,p,_){var k,S,T=8*_-p-1,A=(1<<T)-1,B=A>>1,z=-7,R=_-1,j=-1,q=c[s+R];for(R+=j,k=q&(1<<-z)-1,q>>=-z,z+=T;z>0;k=256*k+c[s+R],R+=j,z-=8);for(S=k&(1<<-z)-1,k>>=-z,z+=p;z>0;S=256*S+c[s+R],R+=j,z-=8);if(k===0)k=1-B;else{if(k===A)return S?NaN:1/0*(q?-1:1);S+=Math.pow(2,p),k-=B}return(q?-1:1)*S*Math.pow(2,k-p)},IE=function(c,s,h,p,_,k){var S,T,A,B=8*k-_-1,z=(1<<B)-1,R=z>>1,j=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,q=0,Y=1,K=s<0||s===0&&1/s<0?1:0;for(s=Math.abs(s),isNaN(s)||s===1/0?(T=isNaN(s)?1:0,S=z):(S=Math.floor(Math.log(s)/Math.LN2),s*(A=Math.pow(2,-S))<1&&(S--,A*=2),(s+=S+R>=1?j/A:j*Math.pow(2,1-R))*A>=2&&(S++,A/=2),S+R>=z?(T=0,S=z):S+R>=1?(T=(s*A-1)*Math.pow(2,_),S+=R):(T=s*Math.pow(2,R-1)*Math.pow(2,_),S=0));_>=8;c[h+q]=255&T,q+=Y,T/=256,_-=8);for(S=S<<_|T,B+=_;B>0;c[h+q]=255&S,q+=Y,S/=256,B-=8);c[h+q-Y]|=128*K};function Mn(c){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(c)?c:new Uint8Array(c||0),this.pos=0,this.type=0,this.length=this.buf.length}Mn.Varint=0,Mn.Fixed64=1,Mn.Bytes=2,Mn.Fixed32=5;var K_=4294967296,PE=1/K_,DE=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ea(c){return c.type===Mn.Bytes?c.readVarint()+c.pos:c.pos+1}function ju(c,s,h){return h?4294967296*s+(c>>>0):4294967296*(s>>>0)+(c>>>0)}function OE(c,s,h){var p=s<=16383?1:s<=2097151?2:s<=268435455?3:Math.floor(Math.log(s)/(7*Math.LN2));h.realloc(p);for(var _=h.pos-1;_>=c;_--)h.buf[_+p]=h.buf[_]}function uG(c,s){for(var h=0;h<c.length;h++)s.writeVarint(c[h])}function hG(c,s){for(var h=0;h<c.length;h++)s.writeSVarint(c[h])}function dG(c,s){for(var h=0;h<c.length;h++)s.writeFloat(c[h])}function pG(c,s){for(var h=0;h<c.length;h++)s.writeDouble(c[h])}function fG(c,s){for(var h=0;h<c.length;h++)s.writeBoolean(c[h])}function mG(c,s){for(var h=0;h<c.length;h++)s.writeFixed32(c[h])}function gG(c,s){for(var h=0;h<c.length;h++)s.writeSFixed32(c[h])}function yG(c,s){for(var h=0;h<c.length;h++)s.writeFixed64(c[h])}function _G(c,s){for(var h=0;h<c.length;h++)s.writeSFixed64(c[h])}function Um(c,s){return(c[s]|c[s+1]<<8|c[s+2]<<16)+16777216*c[s+3]}function Uu(c,s,h){c[h]=s,c[h+1]=s>>>8,c[h+2]=s>>>16,c[h+3]=s>>>24}function BE(c,s){return(c[s]|c[s+1]<<8|c[s+2]<<16)+(c[s+3]<<24)}Mn.prototype={destroy:function(){this.buf=null},readFields:function(c,s,h){for(h=h||this.length;this.pos<h;){var p=this.readVarint(),_=p>>3,k=this.pos;this.type=7&p,c(_,s,this),this.pos===k&&this.skip(p)}return s},readMessage:function(c,s){return this.readFields(c,s,this.readVarint()+this.pos)},readFixed32:function(){var c=Um(this.buf,this.pos);return this.pos+=4,c},readSFixed32:function(){var c=BE(this.buf,this.pos);return this.pos+=4,c},readFixed64:function(){var c=Um(this.buf,this.pos)+Um(this.buf,this.pos+4)*K_;return this.pos+=8,c},readSFixed64:function(){var c=Um(this.buf,this.pos)+BE(this.buf,this.pos+4)*K_;return this.pos+=8,c},readFloat:function(){var c=AE(this.buf,this.pos,!0,23,4);return this.pos+=4,c},readDouble:function(){var c=AE(this.buf,this.pos,!0,52,8);return this.pos+=8,c},readVarint:function(c){var s,h,p=this.buf;return s=127&(h=p[this.pos++]),h<128?s:(s|=(127&(h=p[this.pos++]))<<7,h<128?s:(s|=(127&(h=p[this.pos++]))<<14,h<128?s:(s|=(127&(h=p[this.pos++]))<<21,h<128?s:function(_,k,S){var T,A,B=S.buf;if(T=(112&(A=B[S.pos++]))>>4,A<128||(T|=(127&(A=B[S.pos++]))<<3,A<128)||(T|=(127&(A=B[S.pos++]))<<10,A<128)||(T|=(127&(A=B[S.pos++]))<<17,A<128)||(T|=(127&(A=B[S.pos++]))<<24,A<128)||(T|=(1&(A=B[S.pos++]))<<31,A<128))return ju(_,T,k);throw new Error("Expected varint not more than 10 bytes")}(s|=(15&(h=p[this.pos]))<<28,c,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var c=this.readVarint();return c%2==1?(c+1)/-2:c/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var c=this.readVarint()+this.pos,s=this.pos;return this.pos=c,c-s>=12&&DE?function(h,p,_){return DE.decode(h.subarray(p,_))}(this.buf,s,c):function(h,p,_){for(var k="",S=p;S<_;){var T,A,B,z=h[S],R=null,j=z>239?4:z>223?3:z>191?2:1;if(S+j>_)break;j===1?z<128&&(R=z):j===2?(192&(T=h[S+1]))==128&&(R=(31&z)<<6|63&T)<=127&&(R=null):j===3?(A=h[S+2],(192&(T=h[S+1]))==128&&(192&A)==128&&((R=(15&z)<<12|(63&T)<<6|63&A)<=2047||R>=55296&&R<=57343)&&(R=null)):j===4&&(A=h[S+2],B=h[S+3],(192&(T=h[S+1]))==128&&(192&A)==128&&(192&B)==128&&((R=(15&z)<<18|(63&T)<<12|(63&A)<<6|63&B)<=65535||R>=1114112)&&(R=null)),R===null?(R=65533,j=1):R>65535&&(R-=65536,k+=String.fromCharCode(R>>>10&1023|55296),R=56320|1023&R),k+=String.fromCharCode(R),S+=j}return k}(this.buf,s,c)},readBytes:function(){var c=this.readVarint()+this.pos,s=this.buf.subarray(this.pos,c);return this.pos=c,s},readPackedVarint:function(c,s){if(this.type!==Mn.Bytes)return c.push(this.readVarint(s));var h=ea(this);for(c=c||[];this.pos<h;)c.push(this.readVarint(s));return c},readPackedSVarint:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSVarint());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSVarint());return c},readPackedBoolean:function(c){if(this.type!==Mn.Bytes)return c.push(this.readBoolean());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readBoolean());return c},readPackedFloat:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFloat());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFloat());return c},readPackedDouble:function(c){if(this.type!==Mn.Bytes)return c.push(this.readDouble());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readDouble());return c},readPackedFixed32:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFixed32());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFixed32());return c},readPackedSFixed32:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSFixed32());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSFixed32());return c},readPackedFixed64:function(c){if(this.type!==Mn.Bytes)return c.push(this.readFixed64());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readFixed64());return c},readPackedSFixed64:function(c){if(this.type!==Mn.Bytes)return c.push(this.readSFixed64());var s=ea(this);for(c=c||[];this.pos<s;)c.push(this.readSFixed64());return c},skip:function(c){var s=7&c;if(s===Mn.Varint)for(;this.buf[this.pos++]>127;);else if(s===Mn.Bytes)this.pos=this.readVarint()+this.pos;else if(s===Mn.Fixed32)this.pos+=4;else{if(s!==Mn.Fixed64)throw new Error("Unimplemented type: "+s);this.pos+=8}},writeTag:function(c,s){this.writeVarint(c<<3|s)},realloc:function(c){for(var s=this.length||16;s<this.pos+c;)s*=2;if(s!==this.length){var h=new Uint8Array(s);h.set(this.buf),this.buf=h,this.length=s}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(c){this.realloc(4),Uu(this.buf,c,this.pos),this.pos+=4},writeSFixed32:function(c){this.realloc(4),Uu(this.buf,c,this.pos),this.pos+=4},writeFixed64:function(c){this.realloc(8),Uu(this.buf,-1&c,this.pos),Uu(this.buf,Math.floor(c*PE),this.pos+4),this.pos+=8},writeSFixed64:function(c){this.realloc(8),Uu(this.buf,-1&c,this.pos),Uu(this.buf,Math.floor(c*PE),this.pos+4),this.pos+=8},writeVarint:function(c){(c=+c||0)>268435455||c<0?function(s,h){var p,_;if(s>=0?(p=s%4294967296|0,_=s/4294967296|0):(_=~(-s/4294967296),4294967295^(p=~(-s%4294967296))?p=p+1|0:(p=0,_=_+1|0)),s>=18446744073709552e3||s<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(k,S,T){T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,k>>>=7,T.buf[T.pos++]=127&k|128,T.buf[T.pos]=127&(k>>>=7)}(p,0,h),function(k,S){var T=(7&k)<<4;S.buf[S.pos++]|=T|((k>>>=3)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k)))))}(_,h)}(c,this):(this.realloc(4),this.buf[this.pos++]=127&c|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=c>>>7&127))))},writeSVarint:function(c){this.writeVarint(c<0?2*-c-1:2*c)},writeBoolean:function(c){this.writeVarint(!!c)},writeString:function(c){c=String(c),this.realloc(4*c.length),this.pos++;var s=this.pos;this.pos=function(p,_,k){for(var S,T,A=0;A<_.length;A++){if((S=_.charCodeAt(A))>55295&&S<57344){if(!T){S>56319||A+1===_.length?(p[k++]=239,p[k++]=191,p[k++]=189):T=S;continue}if(S<56320){p[k++]=239,p[k++]=191,p[k++]=189,T=S;continue}S=T-55296<<10|S-56320|65536,T=null}else T&&(p[k++]=239,p[k++]=191,p[k++]=189,T=null);S<128?p[k++]=S:(S<2048?p[k++]=S>>6|192:(S<65536?p[k++]=S>>12|224:(p[k++]=S>>18|240,p[k++]=S>>12&63|128),p[k++]=S>>6&63|128),p[k++]=63&S|128)}return k}(this.buf,c,this.pos);var h=this.pos-s;h>=128&&OE(s,h,this),this.pos=s-1,this.writeVarint(h),this.pos+=h},writeFloat:function(c){this.realloc(4),IE(this.buf,c,this.pos,!0,23,4),this.pos+=4},writeDouble:function(c){this.realloc(8),IE(this.buf,c,this.pos,!0,52,8),this.pos+=8},writeBytes:function(c){var s=c.length;this.writeVarint(s),this.realloc(s);for(var h=0;h<s;h++)this.buf[this.pos++]=c[h]},writeRawMessage:function(c,s){this.pos++;var h=this.pos;c(s,this);var p=this.pos-h;p>=128&&OE(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(c,s,h){this.writeTag(c,Mn.Bytes),this.writeRawMessage(s,h)},writePackedVarint:function(c,s){s.length&&this.writeMessage(c,uG,s)},writePackedSVarint:function(c,s){s.length&&this.writeMessage(c,hG,s)},writePackedBoolean:function(c,s){s.length&&this.writeMessage(c,fG,s)},writePackedFloat:function(c,s){s.length&&this.writeMessage(c,dG,s)},writePackedDouble:function(c,s){s.length&&this.writeMessage(c,pG,s)},writePackedFixed32:function(c,s){s.length&&this.writeMessage(c,mG,s)},writePackedSFixed32:function(c,s){s.length&&this.writeMessage(c,gG,s)},writePackedFixed64:function(c,s){s.length&&this.writeMessage(c,yG,s)},writePackedSFixed64:function(c,s){s.length&&this.writeMessage(c,_G,s)},writeBytesField:function(c,s){this.writeTag(c,Mn.Bytes),this.writeBytes(s)},writeFixed32Field:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeFixed32(s)},writeSFixed32Field:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeSFixed32(s)},writeFixed64Field:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeFixed64(s)},writeSFixed64Field:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeSFixed64(s)},writeVarintField:function(c,s){this.writeTag(c,Mn.Varint),this.writeVarint(s)},writeSVarintField:function(c,s){this.writeTag(c,Mn.Varint),this.writeSVarint(s)},writeStringField:function(c,s){this.writeTag(c,Mn.Bytes),this.writeString(s)},writeFloatField:function(c,s){this.writeTag(c,Mn.Fixed32),this.writeFloat(s)},writeDoubleField:function(c,s){this.writeTag(c,Mn.Fixed64),this.writeDouble(s)},writeBooleanField:function(c,s){this.writeVarintField(c,!!s)}};var J_=g(ME);const Q_=3;function bG(c,s,h){c===1&&h.readMessage(xG,s)}function xG(c,s,h){if(c===3){const{id:p,bitmap:_,width:k,height:S,left:T,top:A,advance:B}=h.readMessage(vG,{});s.push({id:p,bitmap:new jd({width:k+2*Q_,height:S+2*Q_},_),metrics:{width:k,height:S,left:T,top:A,advance:B}})}}function vG(c,s,h){c===1?s.id=h.readVarint():c===2?s.bitmap=h.readBytes():c===3?s.width=h.readVarint():c===4?s.height=h.readVarint():c===5?s.left=h.readSVarint():c===6?s.top=h.readSVarint():c===7&&(s.advance=h.readVarint())}const zE=Q_;function NE(c){let s=0,h=0;for(const S of c)s+=S.w*S.h,h=Math.max(h,S.w);c.sort((S,T)=>T.h-S.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(s/.95)),h),h:1/0}];let _=0,k=0;for(const S of c)for(let T=p.length-1;T>=0;T--){const A=p[T];if(!(S.w>A.w||S.h>A.h)){if(S.x=A.x,S.y=A.y,k=Math.max(k,S.y+S.h),_=Math.max(_,S.x+S.w),S.w===A.w&&S.h===A.h){const B=p.pop();T<p.length&&(p[T]=B)}else S.h===A.h?(A.x+=S.w,A.w-=S.w):S.w===A.w?(A.y+=S.h,A.h-=S.h):(p.push({x:A.x+S.w,y:A.y,w:A.w-S.w,h:S.h}),A.y+=S.h,A.h-=S.h);break}}return{w:_,h:k,fill:s/(_*k)||0}}const vr=1;class eb{constructor(s,{pixelRatio:h,version:p,stretchX:_,stretchY:k,content:S,textFitWidth:T,textFitHeight:A}){this.paddedRect=s,this.pixelRatio=h,this.stretchX=_,this.stretchY=k,this.content=S,this.version=p,this.textFitWidth=T,this.textFitHeight=A}get tl(){return[this.paddedRect.x+vr,this.paddedRect.y+vr]}get br(){return[this.paddedRect.x+this.paddedRect.w-vr,this.paddedRect.y+this.paddedRect.h-vr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*vr)/this.pixelRatio,(this.paddedRect.h-2*vr)/this.pixelRatio]}}class LE{constructor(s,h){const p={},_={};this.haveRenderCallbacks=[];const k=[];this.addImages(s,p,k),this.addImages(h,_,k);const{w:S,h:T}=NE(k),A=new oo({width:S||1,height:T||1});for(const B in s){const z=s[B],R=p[B].paddedRect;oo.copy(z.data,A,{x:0,y:0},{x:R.x+vr,y:R.y+vr},z.data)}for(const B in h){const z=h[B],R=_[B].paddedRect,j=R.x+vr,q=R.y+vr,Y=z.data.width,K=z.data.height;oo.copy(z.data,A,{x:0,y:0},{x:j,y:q},z.data),oo.copy(z.data,A,{x:0,y:K-1},{x:j,y:q-1},{width:Y,height:1}),oo.copy(z.data,A,{x:0,y:0},{x:j,y:q+K},{width:Y,height:1}),oo.copy(z.data,A,{x:Y-1,y:0},{x:j-1,y:q},{width:1,height:K}),oo.copy(z.data,A,{x:0,y:0},{x:j+Y,y:q},{width:1,height:K})}this.image=A,this.iconPositions=p,this.patternPositions=_}addImages(s,h,p){for(const _ in s){const k=s[_],S={x:0,y:0,w:k.data.width+2*vr,h:k.data.height+2*vr};p.push(S),h[_]=new eb(S,k),k.hasRenderCallback&&this.haveRenderCallbacks.push(_)}}patchUpdatedImages(s,h){s.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const p in s.updatedImages)this.patchUpdatedImage(this.iconPositions[p],s.getImage(p),h),this.patchUpdatedImage(this.patternPositions[p],s.getImage(p),h)}patchUpdatedImage(s,h,p){if(!s||!h||s.version===h.version)return;s.version=h.version;const[_,k]=s.tl;p.update(h.data,void 0,{x:_,y:k})}}var rl;ut("ImagePosition",eb),ut("ImageAtlas",LE),u.ah=void 0,(rl=u.ah||(u.ah={}))[rl.none=0]="none",rl[rl.horizontal=1]="horizontal",rl[rl.vertical=2]="vertical",rl[rl.horizontalOnly=3]="horizontalOnly";const Yd=-17;class Xd{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(s,h){const p=new Xd;return p.scale=s||1,p.fontStack=h,p}static forImage(s){const h=new Xd;return h.imageName=s,h}}class Hu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(s,h){const p=new Hu;for(let _=0;_<s.sections.length;_++){const k=s.sections[_];k.image?p.addImageSection(k):p.addTextSection(k,h)}return p}length(){return this.text.length}getSection(s){return this.sections[this.sectionIndex[s]]}getSectionIndex(s){return this.sectionIndex[s]}getCharCode(s){return this.text.charCodeAt(s)}verticalizePunctuation(){this.text=function(s){let h="";for(let p=0;p<s.length;p++){const _=s.charCodeAt(p+1)||null,k=s.charCodeAt(p-1)||null;h+=_&&Am(_)&&!Zd[s[p+1]]||k&&Am(k)&&!Zd[s[p-1]]||!Zd[s[p]]?s[p]:Zd[s[p]]}return h}(this.text)}trim(){let s=0;for(let p=0;p<this.text.length&&qm[this.text.charCodeAt(p)];p++)s++;let h=this.text.length;for(let p=this.text.length-1;p>=0&&p>=s&&qm[this.text.charCodeAt(p)];p--)h--;this.text=this.text.substring(s,h),this.sectionIndex=this.sectionIndex.slice(s,h)}substring(s,h){const p=new Hu;return p.text=this.text.substring(s,h),p.sectionIndex=this.sectionIndex.slice(s,h),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((s,h)=>Math.max(s,this.sections[h].scale),0)}addTextSection(s,h){this.text+=s.text,this.sections.push(Xd.forText(s.scale,s.fontStack||h));const p=this.sections.length-1;for(let _=0;_<s.text.length;++_)this.sectionIndex.push(p)}addImageSection(s){const h=s.image?s.image.name:"";if(h.length===0)return void st("Can't add FormattedSection with an empty image.");const p=this.getNextImageSectionCharCode();p?(this.text+=String.fromCharCode(p),this.sections.push(Xd.forImage(h)),this.sectionIndex.push(this.sections.length-1)):st("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Hm(c,s,h,p,_,k,S,T,A,B,z,R,j,q,Y){const K=Hu.fromFeature(c,_);let re;R===u.ah.vertical&&K.verticalizePunctuation();const{processBidirectionalText:ae,processStyledBidirectionalText:be}=br;if(ae&&K.sections.length===1){re=[];const Te=ae(K.toString(),tb(K,B,k,s,p,q));for(const Re of Te){const ot=new Hu;ot.text=Re,ot.sections=K.sections;for(let St=0;St<Re.length;St++)ot.sectionIndex.push(0);re.push(ot)}}else if(be){re=[];const Te=be(K.text,K.sectionIndex,tb(K,B,k,s,p,q));for(const Re of Te){const ot=new Hu;ot.text=Re[0],ot.sectionIndex=Re[1],ot.sections=K.sections,re.push(ot)}}else re=function(Te,Re){const ot=[],St=Te.text;let nt=0;for(const Qe of Re)ot.push(Te.substring(nt,Qe)),nt=Qe;return nt<St.length&&ot.push(Te.substring(nt,St.length)),ot}(K,tb(K,B,k,s,p,q));const pe=[],ye={positionedLines:pe,text:K.toString(),top:z[1],bottom:z[1],left:z[0],right:z[0],writingMode:R,iconsInText:!1,verticalizable:!1};return function(Te,Re,ot,St,nt,Qe,yt,dt,lt,De,bt,gt){let Ot=0,Dn=Yd,An=0,yi=0;const Do=dt==="right"?1:dt==="left"?0:.5;let Ri=0;for(const ei of nt){ei.trim();const bi=ei.getMaxScale(),Yi=(bi-1)*hi,Vi={positionedGlyphs:[],lineOffset:0};Te.positionedLines[Ri]=Vi;const cr=Vi.positionedGlyphs;let Fi=0;if(!ei.length()){Dn+=Qe,++Ri;continue}for(let wr=0;wr<ei.length();wr++){const hn=ei.getSection(wr),Bn=ei.getSectionIndex(wr),Un=ei.getCharCode(wr);let Ur=0,Yn=null,Zu=null,ys=null,_s=hi;const Oo=!(lt===u.ah.horizontal||!bt&&!zd(Un)||bt&&(qm[Un]||(_i=Un,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(_i)))));if(hn.imageName){const lo=St[hn.imageName];if(!lo)continue;ys=hn.imageName,Te.iconsInText=Te.iconsInText||!0,Zu=lo.paddedRect;const Ci=lo.displaySize;hn.scale=hn.scale*hi/gt,Yn={width:Ci[0],height:Ci[1],left:vr,top:-zE,advance:Oo?Ci[1]:Ci[0]},Ur=Yi+(hi-Ci[1]*hn.scale),_s=Yn.advance;const ta=Oo?Ci[0]*hn.scale-hi*bi:Ci[1]*hn.scale-hi*bi;ta>0&&ta>Fi&&(Fi=ta)}else{const lo=ot[hn.fontStack],Ci=lo&&lo[Un];if(Ci&&Ci.rect)Zu=Ci.rect,Yn=Ci.metrics;else{const ta=Re[hn.fontStack],np=ta&&ta[Un];if(!np)continue;Yn=np.metrics}Ur=(bi-hn.scale)*hi}Oo?(Te.verticalizable=!0,cr.push({glyph:Un,imageName:ys,x:Ot,y:Dn+Ur,vertical:Oo,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Bn,metrics:Yn,rect:Zu}),Ot+=_s*hn.scale+De):(cr.push({glyph:Un,imageName:ys,x:Ot,y:Dn+Ur,vertical:Oo,scale:hn.scale,fontStack:hn.fontStack,sectionIndex:Bn,metrics:Yn,rect:Zu}),Ot+=Yn.advance*hn.scale+De)}cr.length!==0&&(An=Math.max(Ot-De,An),EG(cr,0,cr.length-1,Do,Fi)),Ot=0;const ao=Qe*bi+Fi;Vi.lineOffset=Math.max(Fi,Yi),Dn+=ao,yi=Math.max(ao,yi),++Ri}var _i;const sr=Dn-Yd,{horizontalAlign:ar,verticalAlign:lr}=nb(yt);(function(ei,bi,Yi,Vi,cr,Fi,ao,wr,hn){const Bn=(bi-Yi)*cr;let Un=0;Un=Fi!==ao?-wr*Vi-Yd:(-Vi*hn+.5)*ao;for(const Ur of ei)for(const Yn of Ur.positionedGlyphs)Yn.x+=Bn,Yn.y+=Un})(Te.positionedLines,Do,ar,lr,An,yi,Qe,sr,nt.length),Te.top+=-lr*sr,Te.bottom=Te.top+sr,Te.left+=-ar*An,Te.right=Te.left+An}(ye,s,h,p,re,S,T,A,R,B,j,Y),!function(Te){for(const Re of Te)if(Re.positionedGlyphs.length!==0)return!1;return!0}(pe)&&ye}const qm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},wG={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},kG={40:!0};function RE(c,s,h,p,_,k){if(s.imageName){const S=p[s.imageName];return S?S.displaySize[0]*s.scale*hi/k+_:0}{const S=h[s.fontStack],T=S&&S[c];return T?T.metrics.advance*s.scale+_:0}}function VE(c,s,h,p){const _=Math.pow(c-s,2);return p?c<s?_/2:2*_:_+Math.abs(h)*h}function SG(c,s,h){let p=0;return c===10&&(p-=1e4),h&&(p+=150),c!==40&&c!==65288||(p+=50),s!==41&&s!==65289||(p+=50),p}function FE(c,s,h,p,_,k){let S=null,T=VE(s,h,_,k);for(const A of p){const B=VE(s-A.x,h,_,k)+A.badness;B<=T&&(S=A,T=B)}return{index:c,x:s,priorBreak:S,badness:T}}function $E(c){return c?$E(c.priorBreak).concat(c.index):[]}function tb(c,s,h,p,_,k){if(!c)return[];const S=[],T=function(R,j,q,Y,K,re){let ae=0;for(let be=0;be<R.length();be++){const pe=R.getSection(be);ae+=RE(R.getCharCode(be),pe,Y,K,j,re)}return ae/Math.max(1,Math.ceil(ae/q))}(c,s,h,p,_,k),A=c.text.indexOf("​")>=0;let B=0;for(let R=0;R<c.length();R++){const j=c.getSection(R),q=c.getCharCode(R);if(qm[q]||(B+=RE(q,j,p,_,s,k)),R<c.length()-1){const Y=!((z=q)<11904)&&(!!en["CJK Compatibility Forms"](z)||!!en["CJK Compatibility"](z)||!!en["CJK Strokes"](z)||!!en["CJK Symbols and Punctuation"](z)||!!en["Enclosed CJK Letters and Months"](z)||!!en["Halfwidth and Fullwidth Forms"](z)||!!en["Ideographic Description Characters"](z)||!!en["Vertical Forms"](z)||Mm.test(String.fromCodePoint(z)));(wG[q]||Y||j.imageName||R!==c.length()-2&&kG[c.getCharCode(R+1)])&&S.push(FE(R+1,B,T,S,SG(q,c.getCharCode(R+1),Y&&A),!1))}}var z;return $E(FE(c.length(),B,T,S,0,!0))}function nb(c){let s=.5,h=.5;switch(c){case"right":case"top-right":case"bottom-right":s=1;break;case"left":case"top-left":case"bottom-left":s=0}switch(c){case"bottom":case"bottom-right":case"bottom-left":h=1;break;case"top":case"top-right":case"top-left":h=0}return{horizontalAlign:s,verticalAlign:h}}function EG(c,s,h,p,_){if(!p&&!_)return;const k=c[h],S=(c[h].x+k.metrics.advance*k.scale)*p;for(let T=s;T<=h;T++)c[T].x-=S,c[T].y+=_}function CG(c,s,h){const{horizontalAlign:p,verticalAlign:_}=nb(h),k=s[0]-c.displaySize[0]*p,S=s[1]-c.displaySize[1]*_;return{image:c,top:S,bottom:S+c.displaySize[1],left:k,right:k+c.displaySize[0]}}function jE(c){var s,h;let p=c.left,_=c.top,k=c.right-p,S=c.bottom-_;const T=(s=c.image.textFitWidth)!==null&&s!==void 0?s:"stretchOrShrink",A=(h=c.image.textFitHeight)!==null&&h!==void 0?h:"stretchOrShrink",B=(c.image.content[2]-c.image.content[0])/(c.image.content[3]-c.image.content[1]);if(A==="proportional"){if(T==="stretchOnly"&&k/S<B||T==="proportional"){const z=Math.ceil(S*B);p*=z/k,k=z}}else if(T==="proportional"&&A==="stretchOnly"&&B!==0&&k/S>B){const z=Math.ceil(k/B);_*=z/S,S=z}return{x1:p,y1:_,x2:p+k,y2:_+S}}function UE(c,s,h,p,_,k){const S=c.image;let T;if(S.content){const re=S.content,ae=S.pixelRatio||1;T=[re[0]/ae,re[1]/ae,S.displaySize[0]-re[2]/ae,S.displaySize[1]-re[3]/ae]}const A=s.left*k,B=s.right*k;let z,R,j,q;h==="width"||h==="both"?(q=_[0]+A-p[3],R=_[0]+B+p[1]):(q=_[0]+(A+B-S.displaySize[0])/2,R=q+S.displaySize[0]);const Y=s.top*k,K=s.bottom*k;return h==="height"||h==="both"?(z=_[1]+Y-p[0],j=_[1]+K+p[2]):(z=_[1]+(Y+K-S.displaySize[1])/2,j=z+S.displaySize[1]),{image:S,top:z,right:R,bottom:j,left:q,collisionPadding:T}}const Kd=255,gs=128,ol=Kd*gs;function HE(c,s){const{expression:h}=s;if(h.kind==="constant")return{kind:"constant",layoutSize:h.evaluate(new Vn(c+1))};if(h.kind==="source")return{kind:"source"};{const{zoomStops:p,interpolationType:_}=h;let k=0;for(;k<p.length&&p[k]<=c;)k++;k=Math.max(0,k-1);let S=k;for(;S<p.length&&p[S]<c+1;)S++;S=Math.min(p.length-1,S);const T=p[k],A=p[S];return h.kind==="composite"?{kind:"composite",minZoom:T,maxZoom:A,interpolationType:_}:{kind:"camera",minZoom:T,maxZoom:A,minSize:h.evaluate(new Vn(T)),maxSize:h.evaluate(new Vn(A)),interpolationType:_}}}function ib(c,s,h){let p="never";const _=c.get(s);return _?p=_:c.get(h)&&(p="always"),p}const TG=il.VectorTileFeature.types,MG=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Wm(c,s,h,p,_,k,S,T,A,B,z,R,j){const q=T?Math.min(ol,Math.round(T[0])):0,Y=T?Math.min(ol,Math.round(T[1])):0;c.emplaceBack(s,h,Math.round(32*p),Math.round(32*_),k,S,(q<<1)+(A?1:0),Y,16*B,16*z,256*R,256*j)}function rb(c,s,h){c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h),c.emplaceBack(s.x,s.y,h)}function AG(c){for(const s of c.sections)if(D_(s.text))return!0;return!1}class ob{constructor(s){this.layoutVertexArray=new Ou,this.indexArray=new ro,this.programConfigurations=s,this.segments=new tn,this.dynamicLayoutVertexArray=new Rd,this.opacityVertexArray=new $r,this.hasVisibleVertices=!1,this.placedSymbolArray=new Fn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(s,h,p,_){this.isEmpty()||(p&&(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,oG.members),this.indexBuffer=s.createIndexBuffer(this.indexArray,h),this.dynamicLayoutVertexBuffer=s.createVertexBuffer(this.dynamicLayoutVertexArray,sG.members,!0),this.opacityVertexBuffer=s.createVertexBuffer(this.opacityVertexArray,MG,!0),this.opacityVertexBuffer.itemSize=1),(p||_)&&this.programConfigurations.upload(s))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}ut("SymbolBuffers",ob);class sb{constructor(s,h,p){this.layoutVertexArray=new s,this.layoutAttributes=h,this.indexArray=new p,this.segments=new tn,this.collisionVertexArray=new fs}upload(s){this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=s.createVertexBuffer(this.collisionVertexArray,aG.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ut("CollisionBuffers",sb);class qu{constructor(s){this.collisionBoxArray=s.collisionBoxArray,this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(S=>S.id),this.index=s.index,this.pixelRatio=s.pixelRatio,this.sourceLayerIndex=s.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=V_([]),this.placementViewportMatrix=V_([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=HE(this.zoom,h["text-size"]),this.iconSizeData=HE(this.zoom,h["icon-size"]);const p=this.layers[0].layout,_=p.get("symbol-sort-key"),k=p.get("symbol-z-order");this.canOverlap=ib(p,"text-overlap","text-allow-overlap")!=="never"||ib(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=k!=="viewport-y"&&!_.isConstant(),this.sortFeaturesByY=(k==="viewport-y"||k==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(S=>u.ah[S])),this.stateDependentLayerIds=this.layers.filter(S=>S.isStateDependent()).map(S=>S.id),this.sourceID=s.sourceID}createArrays(){this.text=new ob(new rc(this.layers,this.zoom,s=>/^text/.test(s))),this.icon=new ob(new rc(this.layers,this.zoom,s=>/^icon/.test(s))),this.glyphOffsetArray=new $n,this.lineVertexArray=new Bi,this.symbolInstances=new Jt,this.textAnchorOffsets=new jn}calculateGlyphDependencies(s,h,p,_,k){for(let S=0;S<s.length;S++)if(h[s.charCodeAt(S)]=!0,(p||_)&&k){const T=Zd[s.charAt(S)];T&&(h[T.charCodeAt(0)]=!0)}}populate(s,h,p){const _=this.layers[0],k=_.layout,S=k.get("text-font"),T=k.get("text-field"),A=k.get("icon-image"),B=(T.value.kind!=="constant"||T.value.value instanceof mr&&!T.value.value.isEmpty()||T.value.value.toString().length>0)&&(S.value.kind!=="constant"||S.value.value.length>0),z=A.value.kind!=="constant"||!!A.value.value||Object.keys(A.parameters).length>0,R=k.get("symbol-sort-key");if(this.features=[],!B&&!z)return;const j=h.iconDependencies,q=h.glyphDependencies,Y=h.availableImages,K=new Vn(this.zoom);for(const{feature:re,id:ae,index:be,sourceLayerIndex:pe}of s){const ye=_._featureFilter.needGeometry,Te=sc(re,ye);if(!_._featureFilter.filter(K,Te,p))continue;let Re,ot;if(ye||(Te.geometry=oc(re)),B){const nt=_.getValueAndResolveTokens("text-field",Te,p,Y),Qe=mr.factory(nt),yt=this.hasRTLText=this.hasRTLText||AG(Qe);(!yt||br.getRTLTextPluginStatus()==="unavailable"||yt&&br.isParsed())&&(Re=cG(Qe,_,Te))}if(z){const nt=_.getValueAndResolveTokens("icon-image",Te,p,Y);ot=nt instanceof yr?nt:yr.fromString(nt)}if(!Re&&!ot)continue;const St=this.sortFeaturesByKey?R.evaluate(Te,{},p):void 0;if(this.features.push({id:ae,text:Re,icon:ot,index:be,sourceLayerIndex:pe,geometry:Te.geometry,properties:re.properties,type:TG[re.type],sortKey:St}),ot&&(j[ot.name]=!0),Re){const nt=S.evaluate(Te,{},p).join(","),Qe=k.get("text-rotation-alignment")!=="viewport"&&k.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(u.ah.vertical)>=0;for(const yt of Re.sections)if(yt.image)j[yt.image.name]=!0;else{const dt=Od(Re.toString()),lt=yt.fontStack||nt,De=q[lt]=q[lt]||{};this.calculateGlyphDependencies(yt.text,De,Qe,this.allowVerticalPlacement,dt)}}}k.get("symbol-placement")==="line"&&(this.features=function(re){const ae={},be={},pe=[];let ye=0;function Te(nt){pe.push(re[nt]),ye++}function Re(nt,Qe,yt){const dt=be[nt];return delete be[nt],be[Qe]=dt,pe[dt].geometry[0].pop(),pe[dt].geometry[0]=pe[dt].geometry[0].concat(yt[0]),dt}function ot(nt,Qe,yt){const dt=ae[Qe];return delete ae[Qe],ae[nt]=dt,pe[dt].geometry[0].shift(),pe[dt].geometry[0]=yt[0].concat(pe[dt].geometry[0]),dt}function St(nt,Qe,yt){const dt=yt?Qe[0][Qe[0].length-1]:Qe[0][0];return`${nt}:${dt.x}:${dt.y}`}for(let nt=0;nt<re.length;nt++){const Qe=re[nt],yt=Qe.geometry,dt=Qe.text?Qe.text.toString():null;if(!dt){Te(nt);continue}const lt=St(dt,yt),De=St(dt,yt,!0);if(lt in be&&De in ae&&be[lt]!==ae[De]){const bt=ot(lt,De,yt),gt=Re(lt,De,pe[bt].geometry);delete ae[lt],delete be[De],be[St(dt,pe[gt].geometry,!0)]=gt,pe[bt].geometry=null}else lt in be?Re(lt,De,yt):De in ae?ot(lt,De,yt):(Te(nt),ae[lt]=ye-1,be[De]=ye-1)}return pe.filter(nt=>nt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((re,ae)=>re.sortKey-ae.sortKey)}update(s,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(s,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(s,h,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(s){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(s),this.iconCollisionBox.upload(s)),this.text.upload(s,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(s,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(s,h){const p=this.lineVertexArray.length;if(s.segment!==void 0){let _=s.dist(h[s.segment+1]),k=s.dist(h[s.segment]);const S={};for(let T=s.segment+1;T<h.length;T++)S[T]={x:h[T].x,y:h[T].y,tileUnitDistanceFromAnchor:_},T<h.length-1&&(_+=h[T+1].dist(h[T]));for(let T=s.segment||0;T>=0;T--)S[T]={x:h[T].x,y:h[T].y,tileUnitDistanceFromAnchor:k},T>0&&(k+=h[T-1].dist(h[T]));for(let T=0;T<h.length;T++){const A=S[T];this.lineVertexArray.emplaceBack(A.x,A.y,A.tileUnitDistanceFromAnchor)}}return{lineStartIndex:p,lineLength:this.lineVertexArray.length-p}}addSymbols(s,h,p,_,k,S,T,A,B,z,R,j){const q=s.indexArray,Y=s.layoutVertexArray,K=s.segments.prepareSegment(4*h.length,Y,q,this.canOverlap?S.sortKey:void 0),re=this.glyphOffsetArray.length,ae=K.vertexLength,be=this.allowVerticalPlacement&&T===u.ah.vertical?Math.PI/2:0,pe=S.text&&S.text.sections;for(let ye=0;ye<h.length;ye++){const{tl:Te,tr:Re,bl:ot,br:St,tex:nt,pixelOffsetTL:Qe,pixelOffsetBR:yt,minFontScaleX:dt,minFontScaleY:lt,glyphOffset:De,isSDF:bt,sectionIndex:gt}=h[ye],Ot=K.vertexLength,Dn=De[1];Wm(Y,A.x,A.y,Te.x,Dn+Te.y,nt.x,nt.y,p,bt,Qe.x,Qe.y,dt,lt),Wm(Y,A.x,A.y,Re.x,Dn+Re.y,nt.x+nt.w,nt.y,p,bt,yt.x,Qe.y,dt,lt),Wm(Y,A.x,A.y,ot.x,Dn+ot.y,nt.x,nt.y+nt.h,p,bt,Qe.x,yt.y,dt,lt),Wm(Y,A.x,A.y,St.x,Dn+St.y,nt.x+nt.w,nt.y+nt.h,p,bt,yt.x,yt.y,dt,lt),rb(s.dynamicLayoutVertexArray,A,be),q.emplaceBack(Ot,Ot+1,Ot+2),q.emplaceBack(Ot+1,Ot+2,Ot+3),K.vertexLength+=4,K.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(De[0]),ye!==h.length-1&&gt===h[ye+1].sectionIndex||s.programConfigurations.populatePaintArrays(Y.length,S,S.index,{},j,pe&&pe[gt])}s.placedSymbolArray.emplaceBack(A.x,A.y,re,this.glyphOffsetArray.length-re,ae,B,z,A.segment,p?p[0]:0,p?p[1]:0,_[0],_[1],T,0,!1,0,R)}_addCollisionDebugVertex(s,h,p,_,k,S){return h.emplaceBack(0,0),s.emplaceBack(p.x,p.y,_,k,Math.round(S.x),Math.round(S.y))}addCollisionDebugVertices(s,h,p,_,k,S,T){const A=k.segments.prepareSegment(4,k.layoutVertexArray,k.indexArray),B=A.vertexLength,z=k.layoutVertexArray,R=k.collisionVertexArray,j=T.anchorX,q=T.anchorY;this._addCollisionDebugVertex(z,R,S,j,q,new E(s,h)),this._addCollisionDebugVertex(z,R,S,j,q,new E(p,h)),this._addCollisionDebugVertex(z,R,S,j,q,new E(p,_)),this._addCollisionDebugVertex(z,R,S,j,q,new E(s,_)),A.vertexLength+=4;const Y=k.indexArray;Y.emplaceBack(B,B+1),Y.emplaceBack(B+1,B+2),Y.emplaceBack(B+2,B+3),Y.emplaceBack(B+3,B),A.primitiveLength+=4}addDebugCollisionBoxes(s,h,p,_){for(let k=s;k<h;k++){const S=this.collisionBoxArray.get(k);this.addCollisionDebugVertices(S.x1,S.y1,S.x2,S.y2,_?this.textCollisionBox:this.iconCollisionBox,S.anchorPoint,p)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new sb(jr,TE.members,Ei),this.iconCollisionBox=new sb(jr,TE.members,Ei);for(let s=0;s<this.symbolInstances.length;s++){const h=this.symbolInstances.get(s);this.addDebugCollisionBoxes(h.textBoxStartIndex,h.textBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.iconBoxStartIndex,h.iconBoxEndIndex,h,!1),this.addDebugCollisionBoxes(h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h,!1)}}_deserializeCollisionBoxesForSymbol(s,h,p,_,k,S,T,A,B){const z={};for(let R=h;R<p;R++){const j=s.get(R);z.textBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.textFeatureIndex=j.featureIndex;break}for(let R=_;R<k;R++){const j=s.get(R);z.verticalTextBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.verticalTextFeatureIndex=j.featureIndex;break}for(let R=S;R<T;R++){const j=s.get(R);z.iconBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.iconFeatureIndex=j.featureIndex;break}for(let R=A;R<B;R++){const j=s.get(R);z.verticalIconBox={x1:j.x1,y1:j.y1,x2:j.x2,y2:j.y2,anchorPointX:j.anchorPointX,anchorPointY:j.anchorPointY},z.verticalIconFeatureIndex=j.featureIndex;break}return z}deserializeCollisionBoxes(s){this.collisionArrays=[];for(let h=0;h<this.symbolInstances.length;h++){const p=this.symbolInstances.get(h);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(s,p.textBoxStartIndex,p.textBoxEndIndex,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p.iconBoxStartIndex,p.iconBoxEndIndex,p.verticalIconBoxStartIndex,p.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(s,h){const p=s.placedSymbolArray.get(h),_=p.vertexStartIndex+4*p.numGlyphs;for(let k=p.vertexStartIndex;k<_;k+=4)s.indexArray.emplaceBack(k,k+1,k+2),s.indexArray.emplaceBack(k+1,k+2,k+3)}getSortedSymbolIndexes(s){if(this.sortedAngle===s&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(s),p=Math.cos(s),_=[],k=[],S=[];for(let T=0;T<this.symbolInstances.length;++T){S.push(T);const A=this.symbolInstances.get(T);_.push(0|Math.round(h*A.anchorX+p*A.anchorY)),k.push(A.featureIndex)}return S.sort((T,A)=>_[T]-_[A]||k[A]-k[T]),S}addToSortKeyRanges(s,h){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===h?p.symbolInstanceEnd=s+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:s,symbolInstanceEnd:s+1})}sortFeatures(s){if(this.sortFeaturesByY&&this.sortedAngle!==s&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(s),this.sortedAngle=s,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const h of this.symbolInstanceIndexes){const p=this.symbolInstances.get(h);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((_,k,S)=>{_>=0&&S.indexOf(_)===k&&this.addIndicesForPlacedSymbol(this.text,_)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let qE,WE;ut("SymbolBucket",qu,{omit:["layers","collisionBoxArray","features","compareText"]}),qu.MAX_GLYPHS=65535,qu.addDynamicAttributes=rb;var ab={get paint(){return WE=WE||new v({"icon-opacity":new Et(we.paint_symbol["icon-opacity"]),"icon-color":new Et(we.paint_symbol["icon-color"]),"icon-halo-color":new Et(we.paint_symbol["icon-halo-color"]),"icon-halo-width":new Et(we.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Et(we.paint_symbol["icon-halo-blur"]),"icon-translate":new ft(we.paint_symbol["icon-translate"]),"icon-translate-anchor":new ft(we.paint_symbol["icon-translate-anchor"]),"text-opacity":new Et(we.paint_symbol["text-opacity"]),"text-color":new Et(we.paint_symbol["text-color"],{runtimeType:vt,getOverride:c=>c.textColor,hasOverride:c=>!!c.textColor}),"text-halo-color":new Et(we.paint_symbol["text-halo-color"]),"text-halo-width":new Et(we.paint_symbol["text-halo-width"]),"text-halo-blur":new Et(we.paint_symbol["text-halo-blur"]),"text-translate":new ft(we.paint_symbol["text-translate"]),"text-translate-anchor":new ft(we.paint_symbol["text-translate-anchor"])})},get layout(){return qE=qE||new v({"symbol-placement":new ft(we.layout_symbol["symbol-placement"]),"symbol-spacing":new ft(we.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ft(we.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Et(we.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ft(we.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new ft(we.layout_symbol["icon-allow-overlap"]),"icon-overlap":new ft(we.layout_symbol["icon-overlap"]),"icon-ignore-placement":new ft(we.layout_symbol["icon-ignore-placement"]),"icon-optional":new ft(we.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ft(we.layout_symbol["icon-rotation-alignment"]),"icon-size":new Et(we.layout_symbol["icon-size"]),"icon-text-fit":new ft(we.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new ft(we.layout_symbol["icon-text-fit-padding"]),"icon-image":new Et(we.layout_symbol["icon-image"]),"icon-rotate":new Et(we.layout_symbol["icon-rotate"]),"icon-padding":new Et(we.layout_symbol["icon-padding"]),"icon-keep-upright":new ft(we.layout_symbol["icon-keep-upright"]),"icon-offset":new Et(we.layout_symbol["icon-offset"]),"icon-anchor":new Et(we.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ft(we.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ft(we.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ft(we.layout_symbol["text-rotation-alignment"]),"text-field":new Et(we.layout_symbol["text-field"]),"text-font":new Et(we.layout_symbol["text-font"]),"text-size":new Et(we.layout_symbol["text-size"]),"text-max-width":new Et(we.layout_symbol["text-max-width"]),"text-line-height":new ft(we.layout_symbol["text-line-height"]),"text-letter-spacing":new Et(we.layout_symbol["text-letter-spacing"]),"text-justify":new Et(we.layout_symbol["text-justify"]),"text-radial-offset":new Et(we.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ft(we.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Et(we.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Et(we.layout_symbol["text-anchor"]),"text-max-angle":new ft(we.layout_symbol["text-max-angle"]),"text-writing-mode":new ft(we.layout_symbol["text-writing-mode"]),"text-rotate":new Et(we.layout_symbol["text-rotate"]),"text-padding":new ft(we.layout_symbol["text-padding"]),"text-keep-upright":new ft(we.layout_symbol["text-keep-upright"]),"text-transform":new Et(we.layout_symbol["text-transform"]),"text-offset":new Et(we.layout_symbol["text-offset"]),"text-allow-overlap":new ft(we.layout_symbol["text-allow-overlap"]),"text-overlap":new ft(we.layout_symbol["text-overlap"]),"text-ignore-placement":new ft(we.layout_symbol["text-ignore-placement"]),"text-optional":new ft(we.layout_symbol["text-optional"])})}};class GE{constructor(s){if(s.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=s.property.overrides?s.property.overrides.runtimeType:To,this.defaultValue=s}evaluate(s){if(s.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(s.formattedSection))return h.getOverride(s.formattedSection)}return s.feature&&s.featureState?this.defaultValue.evaluate(s.feature,s.featureState):this.defaultValue.property.specification.default}eachChild(s){this.defaultValue.isConstant()||s(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ut("FormatSectionOverride",GE,{omit:["defaultValue"]});class Gm extends d{constructor(s){super(s,ab)}recalculate(s,h){if(super.recalculate(s,h),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 p=this.layout.get("text-writing-mode");if(p){const _=[];for(const k of p)_.indexOf(k)<0&&_.push(k);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(s,h,p,_){const k=this.layout.get(s).evaluate(h,{},p,_),S=this._unevaluatedLayout._values[s];return S.isDataDriven()||_u(S.value)||!k?k:function(T,A){return A.replace(/{([^{}]+)}/g,(B,z)=>T&&z in T?String(T[z]):"")}(h.properties,k)}createBucket(s){return new qu(s)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const s of ab.paint.overridableProperties){if(!Gm.hasPaintOverride(this.layout,s))continue;const h=this.paint.get(s),p=new GE(h),_=new yu(p,h.property.specification);let k=null;k=h.value.kind==="constant"||h.value.kind==="source"?new $a("source",_):new ja("composite",_,h.value.zoomStops),this.paint._values[s]=new Io(h.property,k,h.parameters)}}_handleOverridablePaintPropertyUpdate(s,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&Gm.hasPaintOverride(this.layout,s)}static hasPaintOverride(s,h){const p=s.get("text-field"),_=ab.paint.properties[h];let k=!1;const S=T=>{for(const A of T)if(_.overrides&&_.overrides.hasOverride(A))return void(k=!0)};if(p.value.kind==="constant"&&p.value.value instanceof mr)S(p.value.value.sections);else if(p.value.kind==="source"){const T=B=>{k||(B instanceof Jr&&si(B.value)===Kn?S(B.value.sections):B instanceof lu?S(B.sections):B.eachChild(T))},A=p.value;A._styleExpression&&T(A._styleExpression.expression)}return k}}let ZE;var IG={get paint(){return ZE=ZE||new v({"background-color":new ft(we.paint_background["background-color"]),"background-pattern":new Pu(we.paint_background["background-pattern"]),"background-opacity":new ft(we.paint_background["background-opacity"])})}};class PG extends d{constructor(s){super(s,IG)}}let YE;var DG={get paint(){return YE=YE||new v({"raster-opacity":new ft(we.paint_raster["raster-opacity"]),"raster-hue-rotate":new ft(we.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ft(we.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ft(we.paint_raster["raster-brightness-max"]),"raster-saturation":new ft(we.paint_raster["raster-saturation"]),"raster-contrast":new ft(we.paint_raster["raster-contrast"]),"raster-resampling":new ft(we.paint_raster["raster-resampling"]),"raster-fade-duration":new ft(we.paint_raster["raster-fade-duration"])})}};class OG extends d{constructor(s){super(s,DG)}}class BG extends d{constructor(s){super(s,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=s}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 zG{constructor(s){this._methodToThrottle=s,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 lb=63710088e-1;class sl{constructor(s,h){if(isNaN(s)||isNaN(h))throw new Error(`Invalid LngLat object: (${s}, ${h})`);if(this.lng=+s,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new sl(ve(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(s){const h=Math.PI/180,p=this.lat*h,_=s.lat*h,k=Math.sin(p)*Math.sin(_)+Math.cos(p)*Math.cos(_)*Math.cos((s.lng-this.lng)*h);return lb*Math.acos(Math.min(k,1))}static convert(s){if(s instanceof sl)return s;if(Array.isArray(s)&&(s.length===2||s.length===3))return new sl(Number(s[0]),Number(s[1]));if(!Array.isArray(s)&&typeof s=="object"&&s!==null)return new sl(Number("lng"in s?s.lng:s.lon),Number(s.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 XE=2*Math.PI*lb;function KE(c){return XE*Math.cos(c*Math.PI/180)}function JE(c){return(180+c)/360}function QE(c){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c*Math.PI/360)))/360}function eC(c,s){return c/KE(s)}function cb(c){return 360/Math.PI*Math.atan(Math.exp((180-360*c)*Math.PI/180))-90}class Jd{constructor(s,h,p=0){this.x=+s,this.y=+h,this.z=+p}static fromLngLat(s,h=0){const p=sl.convert(s);return new Jd(JE(p.lng),QE(p.lat),eC(h,p.lat))}toLngLat(){return new sl(360*this.x-180,cb(this.y))}toAltitude(){return this.z*KE(cb(this.y))}meterInMercatorCoordinateUnits(){return 1/XE*(s=cb(this.y),1/Math.cos(s*Math.PI/180));var s}}function tC(c,s,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[c*p-2*Math.PI*6378137/2,s*p-2*Math.PI*6378137/2]}class ub{constructor(s,h,p){if(!function(_,k,S){return!(_<0||_>25||S<0||S>=Math.pow(2,_)||k<0||k>=Math.pow(2,_))}(s,h,p))throw new Error(`x=${h}, y=${p}, z=${s} outside of bounds. 0<=x<${Math.pow(2,s)}, 0<=y<${Math.pow(2,s)} 0<=z<=25 `);this.z=s,this.x=h,this.y=p,this.key=Qd(0,s,s,h,p)}equals(s){return this.z===s.z&&this.x===s.x&&this.y===s.y}url(s,h,p){const _=(S=this.y,T=this.z,A=tC(256*(k=this.x),256*(S=Math.pow(2,T)-S-1),T),B=tC(256*(k+1),256*(S+1),T),A[0]+","+A[1]+","+B[0]+","+B[1]);var k,S,T,A,B;const z=function(R,j,q){let Y,K="";for(let re=R;re>0;re--)Y=1<<re-1,K+=(j&Y?1:0)+(q&Y?2:0);return K}(this.z,this.x,this.y);return s[(this.x+this.y)%s.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(p==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,h>1?"@2x":"").replace(/{quadkey}/g,z).replace(/{bbox-epsg-3857}/g,_)}isChildOf(s){const h=this.z-s.z;return h>0&&s.x===this.x>>h&&s.y===this.y>>h}getTilePoint(s){const h=Math.pow(2,this.z);return new E((s.x*h-this.x)*ai,(s.y*h-this.y)*ai)}toString(){return`${this.z}/${this.x}/${this.y}`}}class nC{constructor(s,h){this.wrap=s,this.canonical=h,this.key=Qd(s,h.z,h.z,h.x,h.y)}}class so{constructor(s,h,p,_,k){if(s<p)throw new Error(`overscaledZ should be >= z; overscaledZ = ${s}; z = ${p}`);this.overscaledZ=s,this.wrap=h,this.canonical=new ub(p,+_,+k),this.key=Qd(h,s,p,_,k)}clone(){return new so(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(s){return this.overscaledZ===s.overscaledZ&&this.wrap===s.wrap&&this.canonical.equals(s.canonical)}scaledTo(s){if(s>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${s}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-s;return s>this.canonical.z?new so(s,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new so(s,this.wrap,s,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(s,h){if(s>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${s}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-s;return s>this.canonical.z?Qd(this.wrap*+h,s,this.canonical.z,this.canonical.x,this.canonical.y):Qd(this.wrap*+h,s,s,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(s){if(s.wrap!==this.wrap)return!1;const h=this.canonical.z-s.canonical.z;return s.overscaledZ===0||s.overscaledZ<this.overscaledZ&&s.canonical.x===this.canonical.x>>h&&s.canonical.y===this.canonical.y>>h}children(s){if(this.overscaledZ>=s)return[new so(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,_=2*this.canonical.y;return[new so(h,this.wrap,h,p,_),new so(h,this.wrap,h,p+1,_),new so(h,this.wrap,h,p,_+1),new so(h,this.wrap,h,p+1,_+1)]}isLessThan(s){return this.wrap<s.wrap||!(this.wrap>s.wrap)&&(this.overscaledZ<s.overscaledZ||!(this.overscaledZ>s.overscaledZ)&&(this.canonical.x<s.canonical.x||!(this.canonical.x>s.canonical.x)&&this.canonical.y<s.canonical.y))}wrapped(){return new so(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(s){return new so(this.overscaledZ,s,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new nC(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(s){return this.canonical.getTilePoint(new Jd(s.x-this.wrap,s.y))}}function Qd(c,s,h,p,_){(c*=2)<0&&(c=-1*c-1);const k=1<<h;return(k*k*c+k*_+p).toString(36)+h.toString(36)+s.toString(36)}ut("CanonicalTileID",ub),ut("OverscaledTileID",so,{omit:["posMatrix"]});class iC{constructor(s,h,p,_=1,k=1,S=1,T=0){if(this.uid=s,h.height!==h.width)throw new RangeError("DEM tiles must be square");if(p&&!["mapbox","terrarium","custom"].includes(p))return void st(`"${p}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=h.height;const A=this.dim=h.height-2;switch(this.data=new Uint32Array(h.data.buffer),p){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=_,this.greenFactor=k,this.blueFactor=S,this.baseShift=T;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let B=0;B<A;B++)this.data[this._idx(-1,B)]=this.data[this._idx(0,B)],this.data[this._idx(A,B)]=this.data[this._idx(A-1,B)],this.data[this._idx(B,-1)]=this.data[this._idx(B,0)],this.data[this._idx(B,A)]=this.data[this._idx(B,A-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(A,-1)]=this.data[this._idx(A-1,0)],this.data[this._idx(-1,A)]=this.data[this._idx(0,A-1)],this.data[this._idx(A,A)]=this.data[this._idx(A-1,A-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let B=0;B<A;B++)for(let z=0;z<A;z++){const R=this.get(B,z);R>this.max&&(this.max=R),R<this.min&&(this.min=R)}}get(s,h){const p=new Uint8Array(this.data.buffer),_=4*this._idx(s,h);return this.unpack(p[_],p[_+1],p[_+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(s,h){if(s<-1||s>=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(s+1)}unpack(s,h,p){return s*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new oo({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(s,h,p){if(this.dim!==s.dim)throw new Error("dem dimension mismatch");let _=h*this.dim,k=h*this.dim+this.dim,S=p*this.dim,T=p*this.dim+this.dim;switch(h){case-1:_=k-1;break;case 1:k=_+1}switch(p){case-1:S=T-1;break;case 1:T=S+1}const A=-h*this.dim,B=-p*this.dim;for(let z=S;z<T;z++)for(let R=_;R<k;R++)this.data[this._idx(R,z)]=s.data[this._idx(R+A,z+B)]}}ut("DEMData",iC);class rC{constructor(s){this._stringToNumber={},this._numberToString=[];for(let h=0;h<s.length;h++){const p=s[h];this._stringToNumber[p]=h,this._numberToString[h]=p}}encode(s){return this._stringToNumber[s]}decode(s){if(s>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${s} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[s]}}class oC{constructor(s,h,p,_,k){this.type="Feature",this._vectorTileFeature=s,s._z=h,s._x=p,s._y=_,this.properties=s.properties,this.id=k}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(s){this._geometry=s}toJSON(){const s={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(s[h]=this[h]);return s}}class sC{constructor(s,h){this.tileID=s,this.x=s.canonical.x,this.y=s.canonical.y,this.z=s.canonical.z,this.grid=new Wa(ai,16,0),this.grid3D=new Wa(ai,16,0),this.featureIndexArray=new Gi,this.promoteId=h}insert(s,h,p,_,k,S){const T=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,_,k);const A=S?this.grid3D:this.grid;for(let B=0;B<h.length;B++){const z=h[B],R=[1/0,1/0,-1/0,-1/0];for(let j=0;j<z.length;j++){const q=z[j];R[0]=Math.min(R[0],q.x),R[1]=Math.min(R[1],q.y),R[2]=Math.max(R[2],q.x),R[3]=Math.max(R[3],q.y)}R[0]<ai&&R[1]<ai&&R[2]>=0&&R[3]>=0&&A.insert(T,R[0],R[1],R[2],R[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new il.VectorTile(new J_(this.rawTileData)).layers,this.sourceLayerCoder=new rC(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(s,h,p,_){this.loadVTLayers();const k=s.params||{},S=ai/s.tileSize/s.scale,T=_d(k.filter),A=s.queryGeometry,B=s.queryPadding*S,z=lC(A),R=this.grid.query(z.minX-B,z.minY-B,z.maxX+B,z.maxY+B),j=lC(s.cameraQueryGeometry),q=this.grid3D.query(j.minX-B,j.minY-B,j.maxX+B,j.maxY+B,(re,ae,be,pe)=>function(ye,Te,Re,ot,St){for(const Qe of ye)if(Te<=Qe.x&&Re<=Qe.y&&ot>=Qe.x&&St>=Qe.y)return!0;const nt=[new E(Te,Re),new E(Te,St),new E(ot,St),new E(ot,Re)];if(ye.length>2){for(const Qe of nt)if(Ru(ye,Qe))return!0}for(let Qe=0;Qe<ye.length-1;Qe++)if(mW(ye[Qe],ye[Qe+1],nt))return!0;return!1}(s.cameraQueryGeometry,re-B,ae-B,be+B,pe+B));for(const re of q)R.push(re);R.sort(NG);const Y={};let K;for(let re=0;re<R.length;re++){const ae=R[re];if(ae===K)continue;K=ae;const be=this.featureIndexArray.get(ae);let pe=null;this.loadMatchingFeature(Y,be.bucketIndex,be.sourceLayerIndex,be.featureIndex,T,k.layers,k.availableImages,h,p,_,(ye,Te,Re)=>(pe||(pe=oc(ye)),Te.queryIntersectsFeature(A,ye,Re,pe,this.z,s.transform,S,s.pixelPosMatrix)))}return Y}loadMatchingFeature(s,h,p,_,k,S,T,A,B,z,R){const j=this.bucketLayerIDs[h];if(S&&!function(re,ae){for(let be=0;be<re.length;be++)if(ae.indexOf(re[be])>=0)return!0;return!1}(S,j))return;const q=this.sourceLayerCoder.decode(p),Y=this.vtLayers[q].feature(_);if(k.needGeometry){const re=sc(Y,!0);if(!k.filter(new Vn(this.tileID.overscaledZ),re,this.tileID.canonical))return}else if(!k.filter(new Vn(this.tileID.overscaledZ),Y))return;const K=this.getId(Y,q);for(let re=0;re<j.length;re++){const ae=j[re];if(S&&S.indexOf(ae)<0)continue;const be=A[ae];if(!be)continue;let pe={};K&&z&&(pe=z.getState(be.sourceLayer||"_geojsonTileLayer",K));const ye=Se({},B[ae]);ye.paint=aC(ye.paint,be.paint,Y,pe,T),ye.layout=aC(ye.layout,be.layout,Y,pe,T);const Te=!R||R(Y,be,pe);if(!Te)continue;const Re=new oC(Y,this.z,this.x,this.y,K);Re.layer=ye;let ot=s[ae];ot===void 0&&(ot=s[ae]=[]),ot.push({featureIndex:_,feature:Re,intersectionZ:Te})}}lookupSymbolFeatures(s,h,p,_,k,S,T,A){const B={};this.loadVTLayers();const z=_d(k);for(const R of s)this.loadMatchingFeature(B,p,_,R,z,S,T,A,h);return B}hasLayer(s){for(const h of this.bucketLayerIDs)for(const p of h)if(s===p)return!0;return!1}getId(s,h){let p=s.id;return this.promoteId&&(p=s.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[h]],typeof p=="boolean"&&(p=Number(p))),p}}function aC(c,s,h,p,_){return Ae(c,(k,S)=>{const T=s instanceof tc?s.get(S):null;return T&&T.evaluate?T.evaluate(h,p,_):T})}function lC(c){let s=1/0,h=1/0,p=-1/0,_=-1/0;for(const k of c)s=Math.min(s,k.x),h=Math.min(h,k.y),p=Math.max(p,k.x),_=Math.max(_,k.y);return{minX:s,minY:h,maxX:p,maxY:_}}function NG(c,s){return s-c}function cC(c,s,h,p,_){const k=[];for(let S=0;S<c.length;S++){const T=c[S];let A;for(let B=0;B<T.length-1;B++){let z=T[B],R=T[B+1];z.x<s&&R.x<s||(z.x<s?z=new E(s,z.y+(s-z.x)/(R.x-z.x)*(R.y-z.y))._round():R.x<s&&(R=new E(s,z.y+(s-z.x)/(R.x-z.x)*(R.y-z.y))._round()),z.y<h&&R.y<h||(z.y<h?z=new E(z.x+(h-z.y)/(R.y-z.y)*(R.x-z.x),h)._round():R.y<h&&(R=new E(z.x+(h-z.y)/(R.y-z.y)*(R.x-z.x),h)._round()),z.x>=p&&R.x>=p||(z.x>=p?z=new E(p,z.y+(p-z.x)/(R.x-z.x)*(R.y-z.y))._round():R.x>=p&&(R=new E(p,z.y+(p-z.x)/(R.x-z.x)*(R.y-z.y))._round()),z.y>=_&&R.y>=_||(z.y>=_?z=new E(z.x+(_-z.y)/(R.y-z.y)*(R.x-z.x),_)._round():R.y>=_&&(R=new E(z.x+(_-z.y)/(R.y-z.y)*(R.x-z.x),_)._round()),A&&z.equals(A[A.length-1])||(A=[z],k.push(A)),A.push(R)))))}}return k}ut("FeatureIndex",sC,{omit:["rawTileData","sourceLayerCoder"]});class al extends E{constructor(s,h,p,_){super(s,h),this.angle=p,_!==void 0&&(this.segment=_)}clone(){return new al(this.x,this.y,this.angle,this.segment)}}function uC(c,s,h,p,_){if(s.segment===void 0||h===0)return!0;let k=s,S=s.segment+1,T=0;for(;T>-h/2;){if(S--,S<0)return!1;T-=c[S].dist(k),k=c[S]}T+=c[S].dist(c[S+1]),S++;const A=[];let B=0;for(;T<h/2;){const z=c[S],R=c[S+1];if(!R)return!1;let j=c[S-1].angleTo(z)-z.angleTo(R);for(j=Math.abs((j+3*Math.PI)%(2*Math.PI)-Math.PI),A.push({distance:T,angleDelta:j}),B+=j;T-A[0].distance>p;)B-=A.shift().angleDelta;if(B>_)return!1;S++,T+=z.dist(R)}return!0}function hC(c){let s=0;for(let h=0;h<c.length-1;h++)s+=c[h].dist(c[h+1]);return s}function dC(c,s,h){return c?.6*s*h:0}function pC(c,s){return Math.max(c?c.right-c.left:0,s?s.right-s.left:0)}function LG(c,s,h,p,_,k){const S=dC(h,_,k),T=pC(h,p)*k;let A=0;const B=hC(c)/2;for(let z=0;z<c.length-1;z++){const R=c[z],j=c[z+1],q=R.dist(j);if(A+q>B){const Y=(B-A)/q,K=nr.number(R.x,j.x,Y),re=nr.number(R.y,j.y,Y),ae=new al(K,re,j.angleTo(R),z);return ae._round(),!S||uC(c,ae,T,S,s)?ae:void 0}A+=q}}function RG(c,s,h,p,_,k,S,T,A){const B=dC(p,k,S),z=pC(p,_),R=z*S,j=c[0].x===0||c[0].x===A||c[0].y===0||c[0].y===A;return s-R<s/4&&(s=R+s/4),fC(c,j?s/2*T%s:(z/2+2*k)*S*T%s,s,B,h,R,j,!1,A)}function fC(c,s,h,p,_,k,S,T,A){const B=k/2,z=hC(c);let R=0,j=s-h,q=[];for(let Y=0;Y<c.length-1;Y++){const K=c[Y],re=c[Y+1],ae=K.dist(re),be=re.angleTo(K);for(;j+h<R+ae;){j+=h;const pe=(j-R)/ae,ye=nr.number(K.x,re.x,pe),Te=nr.number(K.y,re.y,pe);if(ye>=0&&ye<A&&Te>=0&&Te<A&&j-B>=0&&j+B<=z){const Re=new al(ye,Te,be,Y);Re._round(),p&&!uC(c,Re,k,p,_)||q.push(Re)}}R+=ae}return T||q.length||S||(q=fC(c,R/2,h,p,_,k,S,!0,A)),q}ut("Anchor",al);const Wu=vr;function mC(c,s,h,p){const _=[],k=c.image,S=k.pixelRatio,T=k.paddedRect.w-2*Wu,A=k.paddedRect.h-2*Wu;let B={x1:c.left,y1:c.top,x2:c.right,y2:c.bottom};const z=k.stretchX||[[0,T]],R=k.stretchY||[[0,A]],j=(De,bt)=>De+bt[1]-bt[0],q=z.reduce(j,0),Y=R.reduce(j,0),K=T-q,re=A-Y;let ae=0,be=q,pe=0,ye=Y,Te=0,Re=K,ot=0,St=re;if(k.content&&p){const De=k.content,bt=De[2]-De[0],gt=De[3]-De[1];(k.textFitWidth||k.textFitHeight)&&(B=jE(c)),ae=Zm(z,0,De[0]),pe=Zm(R,0,De[1]),be=Zm(z,De[0],De[2]),ye=Zm(R,De[1],De[3]),Te=De[0]-ae,ot=De[1]-pe,Re=bt-be,St=gt-ye}const nt=B.x1,Qe=B.y1,yt=B.x2-nt,dt=B.y2-Qe,lt=(De,bt,gt,Ot)=>{const Dn=Ym(De.stretch-ae,be,yt,nt),An=Xm(De.fixed-Te,Re,De.stretch,q),yi=Ym(bt.stretch-pe,ye,dt,Qe),Do=Xm(bt.fixed-ot,St,bt.stretch,Y),Ri=Ym(gt.stretch-ae,be,yt,nt),_i=Xm(gt.fixed-Te,Re,gt.stretch,q),sr=Ym(Ot.stretch-pe,ye,dt,Qe),ar=Xm(Ot.fixed-ot,St,Ot.stretch,Y),lr=new E(Dn,yi),ei=new E(Ri,yi),bi=new E(Ri,sr),Yi=new E(Dn,sr),Vi=new E(An/S,Do/S),cr=new E(_i/S,ar/S),Fi=s*Math.PI/180;if(Fi){const hn=Math.sin(Fi),Bn=Math.cos(Fi),Un=[Bn,-hn,hn,Bn];lr._matMult(Un),ei._matMult(Un),Yi._matMult(Un),bi._matMult(Un)}const ao=De.stretch+De.fixed,wr=bt.stretch+bt.fixed;return{tl:lr,tr:ei,bl:Yi,br:bi,tex:{x:k.paddedRect.x+Wu+ao,y:k.paddedRect.y+Wu+wr,w:gt.stretch+gt.fixed-ao,h:Ot.stretch+Ot.fixed-wr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Vi,pixelOffsetBR:cr,minFontScaleX:Re/S/yt,minFontScaleY:St/S/dt,isSDF:h}};if(p&&(k.stretchX||k.stretchY)){const De=gC(z,K,q),bt=gC(R,re,Y);for(let gt=0;gt<De.length-1;gt++){const Ot=De[gt],Dn=De[gt+1];for(let An=0;An<bt.length-1;An++)_.push(lt(Ot,bt[An],Dn,bt[An+1]))}}else _.push(lt({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:T+1},{fixed:0,stretch:A+1}));return _}function Zm(c,s,h){let p=0;for(const _ of c)p+=Math.max(s,Math.min(h,_[1]))-Math.max(s,Math.min(h,_[0]));return p}function gC(c,s,h){const p=[{fixed:-Wu,stretch:0}];for(const[_,k]of c){const S=p[p.length-1];p.push({fixed:_-S.stretch,stretch:S.stretch}),p.push({fixed:_-S.stretch,stretch:S.stretch+(k-_)})}return p.push({fixed:s+Wu,stretch:h}),p}function Ym(c,s,h,p){return c/s*h+p}function Xm(c,s,h,p){return c-s*h/p}class Km{constructor(s,h,p,_,k,S,T,A,B,z){var R;if(this.boxStartIndex=s.length,B){let j=S.top,q=S.bottom;const Y=S.collisionPadding;Y&&(j-=Y[1],q+=Y[3]);let K=q-j;K>0&&(K=Math.max(10,K),this.circleDiameter=K)}else{const j=!((R=S.image)===null||R===void 0)&&R.content&&(S.image.textFitWidth||S.image.textFitHeight)?jE(S):{x1:S.left,y1:S.top,x2:S.right,y2:S.bottom};j.y1=j.y1*T-A[0],j.y2=j.y2*T+A[2],j.x1=j.x1*T-A[3],j.x2=j.x2*T+A[1];const q=S.collisionPadding;if(q&&(j.x1-=q[0]*T,j.y1-=q[1]*T,j.x2+=q[2]*T,j.y2+=q[3]*T),z){const Y=new E(j.x1,j.y1),K=new E(j.x2,j.y1),re=new E(j.x1,j.y2),ae=new E(j.x2,j.y2),be=z*Math.PI/180;Y._rotate(be),K._rotate(be),re._rotate(be),ae._rotate(be),j.x1=Math.min(Y.x,K.x,re.x,ae.x),j.x2=Math.max(Y.x,K.x,re.x,ae.x),j.y1=Math.min(Y.y,K.y,re.y,ae.y),j.y2=Math.max(Y.y,K.y,re.y,ae.y)}s.emplaceBack(h.x,h.y,j.x1,j.y1,j.x2,j.y2,p,_,k)}this.boxEndIndex=s.length}}class VG{constructor(s=[],h=(p,_)=>p<_?-1:p>_?1:0){if(this.data=s,this.length=this.data.length,this.compare=h,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;const s=this.data[0],h=this.data.pop();return--this.length>0&&(this.data[0]=h,this._down(0)),s}peek(){return this.data[0]}_up(s){const{data:h,compare:p}=this,_=h[s];for(;s>0;){const k=s-1>>1,S=h[k];if(p(_,S)>=0)break;h[s]=S,s=k}h[s]=_}_down(s){const{data:h,compare:p}=this,_=this.length>>1,k=h[s];for(;s<_;){let S=1+(s<<1);const T=S+1;if(T<this.length&&p(h[T],h[S])<0&&(S=T),p(h[S],k)>=0)break;h[s]=h[S],s=S}h[s]=k}}function FG(c,s=1,h=!1){let p=1/0,_=1/0,k=-1/0,S=-1/0;const T=c[0];for(let q=0;q<T.length;q++){const Y=T[q];(!q||Y.x<p)&&(p=Y.x),(!q||Y.y<_)&&(_=Y.y),(!q||Y.x>k)&&(k=Y.x),(!q||Y.y>S)&&(S=Y.y)}const A=Math.min(k-p,S-_);let B=A/2;const z=new VG([],$G);if(A===0)return new E(p,_);for(let q=p;q<k;q+=A)for(let Y=_;Y<S;Y+=A)z.push(new Gu(q+B,Y+B,B,c));let R=function(q){let Y=0,K=0,re=0;const ae=q[0];for(let be=0,pe=ae.length,ye=pe-1;be<pe;ye=be++){const Te=ae[be],Re=ae[ye],ot=Te.x*Re.y-Re.x*Te.y;K+=(Te.x+Re.x)*ot,re+=(Te.y+Re.y)*ot,Y+=3*ot}return new Gu(K/Y,re/Y,0,q)}(c),j=z.length;for(;z.length;){const q=z.pop();(q.d>R.d||!R.d)&&(R=q,h&&console.log("found best %d after %d probes",Math.round(1e4*q.d)/1e4,j)),q.max-R.d<=s||(B=q.h/2,z.push(new Gu(q.p.x-B,q.p.y-B,B,c)),z.push(new Gu(q.p.x+B,q.p.y-B,B,c)),z.push(new Gu(q.p.x-B,q.p.y+B,B,c)),z.push(new Gu(q.p.x+B,q.p.y+B,B,c)),j+=4)}return h&&(console.log(`num probes: ${j}`),console.log(`best distance: ${R.d}`)),R.p}function $G(c,s){return s.max-c.max}function Gu(c,s,h,p){this.p=new E(c,s),this.h=h,this.d=function(_,k){let S=!1,T=1/0;for(let A=0;A<k.length;A++){const B=k[A];for(let z=0,R=B.length,j=R-1;z<R;j=z++){const q=B[z],Y=B[j];q.y>_.y!=Y.y>_.y&&_.x<(Y.x-q.x)*(_.y-q.y)/(Y.y-q.y)+q.x&&(S=!S),T=Math.min(T,QS(_,q,Y))}}return(S?1:-1)*Math.sqrt(T)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var Li;u.aq=void 0,(Li=u.aq||(u.aq={}))[Li.center=1]="center",Li[Li.left=2]="left",Li[Li.right=3]="right",Li[Li.top=4]="top",Li[Li.bottom=5]="bottom",Li[Li["top-left"]=6]="top-left",Li[Li["top-right"]=7]="top-right",Li[Li["bottom-left"]=8]="bottom-left",Li[Li["bottom-right"]=9]="bottom-right";const ll=7,hb=Number.POSITIVE_INFINITY;function yC(c,s){return s[1]!==hb?function(h,p,_){let k=0,S=0;switch(p=Math.abs(p),_=Math.abs(_),h){case"top-right":case"top-left":case"top":S=_-ll;break;case"bottom-right":case"bottom-left":case"bottom":S=-_+ll}switch(h){case"top-right":case"bottom-right":case"right":k=-p;break;case"top-left":case"bottom-left":case"left":k=p}return[k,S]}(c,s[0],s[1]):function(h,p){let _=0,k=0;p<0&&(p=0);const S=p/Math.SQRT2;switch(h){case"top-right":case"top-left":k=S-ll;break;case"bottom-right":case"bottom-left":k=-S+ll;break;case"bottom":k=-p+ll;break;case"top":k=p-ll}switch(h){case"top-right":case"bottom-right":_=-S;break;case"top-left":case"bottom-left":_=S;break;case"left":_=p;break;case"right":_=-p}return[_,k]}(c,s[0])}function _C(c,s,h){var p;const _=c.layout,k=(p=_.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(s,{},h);if(k){const T=k.values,A=[];for(let B=0;B<T.length;B+=2){const z=A[B]=T[B],R=T[B+1].map(j=>j*hi);z.startsWith("top")?R[1]-=ll:z.startsWith("bottom")&&(R[1]+=ll),A[B+1]=R}return new Nr(A)}const S=_.get("text-variable-anchor");if(S){let T;T=c._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[_.get("text-radial-offset").evaluate(s,{},h)*hi,hb]:_.get("text-offset").evaluate(s,{},h).map(B=>B*hi);const A=[];for(const B of S)A.push(B,yC(B,T));return new Nr(A)}return null}function db(c){switch(c){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function jG(c,s,h,p,_,k,S,T,A,B,z){let R=k.textMaxSize.evaluate(s,{});R===void 0&&(R=S);const j=c.layers[0].layout,q=j.get("icon-offset").evaluate(s,{},z),Y=xC(h.horizontal),K=S/24,re=c.tilePixelRatio*K,ae=c.tilePixelRatio*R/24,be=c.tilePixelRatio*T,pe=c.tilePixelRatio*j.get("symbol-spacing"),ye=j.get("text-padding")*c.tilePixelRatio,Te=function(De,bt,gt,Ot=1){const Dn=De.get("icon-padding").evaluate(bt,{},gt),An=Dn&&Dn.values;return[An[0]*Ot,An[1]*Ot,An[2]*Ot,An[3]*Ot]}(j,s,z,c.tilePixelRatio),Re=j.get("text-max-angle")/180*Math.PI,ot=j.get("text-rotation-alignment")!=="viewport"&&j.get("symbol-placement")!=="point",St=j.get("icon-rotation-alignment")==="map"&&j.get("symbol-placement")!=="point",nt=j.get("symbol-placement"),Qe=pe/2,yt=j.get("icon-text-fit");let dt;p&&yt!=="none"&&(c.allowVerticalPlacement&&h.vertical&&(dt=UE(p,h.vertical,yt,j.get("icon-text-fit-padding"),q,K)),Y&&(p=UE(p,Y,yt,j.get("icon-text-fit-padding"),q,K)));const lt=(De,bt)=>{bt.x<0||bt.x>=ai||bt.y<0||bt.y>=ai||function(gt,Ot,Dn,An,yi,Do,Ri,_i,sr,ar,lr,ei,bi,Yi,Vi,cr,Fi,ao,wr,hn,Bn,Un,Ur,Yn,Zu){const ys=gt.addToLineVertexArray(Ot,Dn);let _s,Oo,lo,Ci,ta=0,np=0,SC=0,EC=0,xb=-1,vb=-1;const na={};let CC=Bu("");if(gt.allowVerticalPlacement&&An.vertical){const Xi=_i.layout.get("text-rotate").evaluate(Bn,{},Yn)+90;lo=new Km(sr,Ot,ar,lr,ei,An.vertical,bi,Yi,Vi,Xi),Ri&&(Ci=new Km(sr,Ot,ar,lr,ei,Ri,Fi,ao,Vi,Xi))}if(yi){const Xi=_i.layout.get("icon-rotate").evaluate(Bn,{}),co=_i.layout.get("icon-text-fit")!=="none",lc=mC(yi,Xi,Ur,co),Zo=Ri?mC(Ri,Xi,Ur,co):void 0;Oo=new Km(sr,Ot,ar,lr,ei,yi,Fi,ao,!1,Xi),ta=4*lc.length;const cc=gt.iconSizeData;let bs=null;cc.kind==="source"?(bs=[gs*_i.layout.get("icon-size").evaluate(Bn,{})],bs[0]>ol&&st(`${gt.layerIds[0]}: Value for "icon-size" is >= ${Kd}. Reduce your "icon-size".`)):cc.kind==="composite"&&(bs=[gs*Un.compositeIconSizes[0].evaluate(Bn,{},Yn),gs*Un.compositeIconSizes[1].evaluate(Bn,{},Yn)],(bs[0]>ol||bs[1]>ol)&&st(`${gt.layerIds[0]}: Value for "icon-size" is >= ${Kd}. Reduce your "icon-size".`)),gt.addSymbols(gt.icon,lc,bs,hn,wr,Bn,u.ah.none,Ot,ys.lineStartIndex,ys.lineLength,-1,Yn),xb=gt.icon.placedSymbolArray.length-1,Zo&&(np=4*Zo.length,gt.addSymbols(gt.icon,Zo,bs,hn,wr,Bn,u.ah.vertical,Ot,ys.lineStartIndex,ys.lineLength,-1,Yn),vb=gt.icon.placedSymbolArray.length-1)}const TC=Object.keys(An.horizontal);for(const Xi of TC){const co=An.horizontal[Xi];if(!_s){CC=Bu(co.text);const Zo=_i.layout.get("text-rotate").evaluate(Bn,{},Yn);_s=new Km(sr,Ot,ar,lr,ei,co,bi,Yi,Vi,Zo)}const lc=co.positionedLines.length===1;if(SC+=bC(gt,Ot,co,Do,_i,Vi,Bn,cr,ys,An.vertical?u.ah.horizontal:u.ah.horizontalOnly,lc?TC:[Xi],na,xb,Un,Yn),lc)break}An.vertical&&(EC+=bC(gt,Ot,An.vertical,Do,_i,Vi,Bn,cr,ys,u.ah.vertical,["vertical"],na,vb,Un,Yn));const qG=_s?_s.boxStartIndex:gt.collisionBoxArray.length,WG=_s?_s.boxEndIndex:gt.collisionBoxArray.length,GG=lo?lo.boxStartIndex:gt.collisionBoxArray.length,ZG=lo?lo.boxEndIndex:gt.collisionBoxArray.length,YG=Oo?Oo.boxStartIndex:gt.collisionBoxArray.length,XG=Oo?Oo.boxEndIndex:gt.collisionBoxArray.length,KG=Ci?Ci.boxStartIndex:gt.collisionBoxArray.length,JG=Ci?Ci.boxEndIndex:gt.collisionBoxArray.length;let Go=-1;const Qm=(Xi,co)=>Xi&&Xi.circleDiameter?Math.max(Xi.circleDiameter,co):co;Go=Qm(_s,Go),Go=Qm(lo,Go),Go=Qm(Oo,Go),Go=Qm(Ci,Go);const MC=Go>-1?1:0;MC&&(Go*=Zu/hi),gt.glyphOffsetArray.length>=qu.MAX_GLYPHS&&st("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Bn.sortKey!==void 0&&gt.addToSortKeyRanges(gt.symbolInstances.length,Bn.sortKey);const QG=_C(_i,Bn,Yn),[eZ,tZ]=function(Xi,co){const lc=Xi.length,Zo=co==null?void 0:co.values;if((Zo==null?void 0:Zo.length)>0)for(let cc=0;cc<Zo.length;cc+=2){const bs=Zo[cc+1];Xi.emplaceBack(u.aq[Zo[cc]],bs[0],bs[1])}return[lc,Xi.length]}(gt.textAnchorOffsets,QG);gt.symbolInstances.emplaceBack(Ot.x,Ot.y,na.right>=0?na.right:-1,na.center>=0?na.center:-1,na.left>=0?na.left:-1,na.vertical||-1,xb,vb,CC,qG,WG,GG,ZG,YG,XG,KG,JG,ar,SC,EC,ta,np,MC,0,bi,Go,eZ,tZ)}(c,bt,De,h,p,_,dt,c.layers[0],c.collisionBoxArray,s.index,s.sourceLayerIndex,c.index,re,[ye,ye,ye,ye],ot,A,be,Te,St,q,s,k,B,z,S)};if(nt==="line")for(const De of cC(s.geometry,0,0,ai,ai)){const bt=RG(De,pe,Re,h.vertical||Y,p,24,ae,c.overscaling,ai);for(const gt of bt)Y&&UG(c,Y.text,Qe,gt)||lt(De,gt)}else if(nt==="line-center"){for(const De of s.geometry)if(De.length>1){const bt=LG(De,Re,h.vertical||Y,p,24,ae);bt&&lt(De,bt)}}else if(s.type==="Polygon")for(const De of uu(s.geometry,0)){const bt=FG(De,16);lt(De[0],new al(bt.x,bt.y,0))}else if(s.type==="LineString")for(const De of s.geometry)lt(De,new al(De[0].x,De[0].y,0));else if(s.type==="Point")for(const De of s.geometry)for(const bt of De)lt([bt],new al(bt.x,bt.y,0))}function bC(c,s,h,p,_,k,S,T,A,B,z,R,j,q,Y){const K=function(be,pe,ye,Te,Re,ot,St,nt){const Qe=Te.layout.get("text-rotate").evaluate(ot,{})*Math.PI/180,yt=[];for(const dt of pe.positionedLines)for(const lt of dt.positionedGlyphs){if(!lt.rect)continue;const De=lt.rect||{};let bt=zE+1,gt=!0,Ot=1,Dn=0;const An=(Re||nt)&&lt.vertical,yi=lt.metrics.advance*lt.scale/2;if(nt&&pe.verticalizable&&(Dn=dt.lineOffset/2-(lt.imageName?-(hi-lt.metrics.width*lt.scale)/2:(lt.scale-1)*hi)),lt.imageName){const hn=St[lt.imageName];gt=hn.sdf,Ot=hn.pixelRatio,bt=vr/Ot}const Do=Re?[lt.x+yi,lt.y]:[0,0];let Ri=Re?[0,0]:[lt.x+yi+ye[0],lt.y+ye[1]-Dn],_i=[0,0];An&&(_i=Ri,Ri=[0,0]);const sr=lt.metrics.isDoubleResolution?2:1,ar=(lt.metrics.left-bt)*lt.scale-yi+Ri[0],lr=(-lt.metrics.top-bt)*lt.scale+Ri[1],ei=ar+De.w/sr*lt.scale/Ot,bi=lr+De.h/sr*lt.scale/Ot,Yi=new E(ar,lr),Vi=new E(ei,lr),cr=new E(ar,bi),Fi=new E(ei,bi);if(An){const hn=new E(-yi,yi-Yd),Bn=-Math.PI/2,Un=hi/2-yi,Ur=new E(5-Yd-Un,-(lt.imageName?Un:0)),Yn=new E(..._i);Yi._rotateAround(Bn,hn)._add(Ur)._add(Yn),Vi._rotateAround(Bn,hn)._add(Ur)._add(Yn),cr._rotateAround(Bn,hn)._add(Ur)._add(Yn),Fi._rotateAround(Bn,hn)._add(Ur)._add(Yn)}if(Qe){const hn=Math.sin(Qe),Bn=Math.cos(Qe),Un=[Bn,-hn,hn,Bn];Yi._matMult(Un),Vi._matMult(Un),cr._matMult(Un),Fi._matMult(Un)}const ao=new E(0,0),wr=new E(0,0);yt.push({tl:Yi,tr:Vi,bl:cr,br:Fi,tex:De,writingMode:pe.writingMode,glyphOffset:Do,sectionIndex:lt.sectionIndex,isSDF:gt,pixelOffsetTL:ao,pixelOffsetBR:wr,minFontScaleX:0,minFontScaleY:0})}return yt}(0,h,T,_,k,S,p,c.allowVerticalPlacement),re=c.textSizeData;let ae=null;re.kind==="source"?(ae=[gs*_.layout.get("text-size").evaluate(S,{})],ae[0]>ol&&st(`${c.layerIds[0]}: Value for "text-size" is >= ${Kd}. Reduce your "text-size".`)):re.kind==="composite"&&(ae=[gs*q.compositeTextSizes[0].evaluate(S,{},Y),gs*q.compositeTextSizes[1].evaluate(S,{},Y)],(ae[0]>ol||ae[1]>ol)&&st(`${c.layerIds[0]}: Value for "text-size" is >= ${Kd}. Reduce your "text-size".`)),c.addSymbols(c.text,K,ae,T,k,S,B,s,A.lineStartIndex,A.lineLength,j,Y);for(const be of z)R[be]=c.text.placedSymbolArray.length-1;return 4*K.length}function xC(c){for(const s in c)return c[s];return null}function UG(c,s,h,p){const _=c.compareText;if(s in _){const k=_[s];for(let S=k.length-1;S>=0;S--)if(p.dist(k[S])<h)return!0}else _[s]=[];return _[s].push(p),!1}const vC=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class pb{static from(s){if(!(s instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[h,p]=new Uint8Array(s,0,2);if(h!==219)throw new Error("Data does not appear to be in a KDBush format.");const _=p>>4;if(_!==1)throw new Error(`Got v${_} data when expected v1.`);const k=vC[15&p];if(!k)throw new Error("Unrecognized array type.");const[S]=new Uint16Array(s,2,1),[T]=new Uint32Array(s,4,1);return new pb(T,S,k,s)}constructor(s,h=64,p=Float64Array,_){if(isNaN(s)||s<0)throw new Error(`Unpexpected numItems value: ${s}.`);this.numItems=+s,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=s<65536?Uint16Array:Uint32Array;const k=vC.indexOf(this.ArrayType),S=2*s*this.ArrayType.BYTES_PER_ELEMENT,T=s*this.IndexArrayType.BYTES_PER_ELEMENT,A=(8-T%8)%8;if(k<0)throw new Error(`Unexpected typed array class: ${p}.`);_&&_ instanceof ArrayBuffer?(this.data=_,this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+T+A,2*s),this._pos=2*s,this._finished=!0):(this.data=new ArrayBuffer(8+S+T+A),this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+T+A,2*s),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+k]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=s)}add(s,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=s,this.coords[this._pos++]=h,p}finish(){const s=this._pos>>1;if(s!==this.numItems)throw new Error(`Added ${s} items when expected ${this.numItems}.`);return fb(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(s,h,p,_){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:k,coords:S,nodeSize:T}=this,A=[0,k.length-1,0],B=[];for(;A.length;){const z=A.pop()||0,R=A.pop()||0,j=A.pop()||0;if(R-j<=T){for(let re=j;re<=R;re++){const ae=S[2*re],be=S[2*re+1];ae>=s&&ae<=p&&be>=h&&be<=_&&B.push(k[re])}continue}const q=j+R>>1,Y=S[2*q],K=S[2*q+1];Y>=s&&Y<=p&&K>=h&&K<=_&&B.push(k[q]),(z===0?s<=Y:h<=K)&&(A.push(j),A.push(q-1),A.push(1-z)),(z===0?p>=Y:_>=K)&&(A.push(q+1),A.push(R),A.push(1-z))}return B}within(s,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:_,coords:k,nodeSize:S}=this,T=[0,_.length-1,0],A=[],B=p*p;for(;T.length;){const z=T.pop()||0,R=T.pop()||0,j=T.pop()||0;if(R-j<=S){for(let re=j;re<=R;re++)kC(k[2*re],k[2*re+1],s,h)<=B&&A.push(_[re]);continue}const q=j+R>>1,Y=k[2*q],K=k[2*q+1];kC(Y,K,s,h)<=B&&A.push(_[q]),(z===0?s-p<=Y:h-p<=K)&&(T.push(j),T.push(q-1),T.push(1-z)),(z===0?s+p>=Y:h+p>=K)&&(T.push(q+1),T.push(R),T.push(1-z))}return A}}function fb(c,s,h,p,_,k){if(_-p<=h)return;const S=p+_>>1;wC(c,s,S,p,_,k),fb(c,s,h,p,S-1,1-k),fb(c,s,h,S+1,_,1-k)}function wC(c,s,h,p,_,k){for(;_>p;){if(_-p>600){const B=_-p+1,z=h-p+1,R=Math.log(B),j=.5*Math.exp(2*R/3),q=.5*Math.sqrt(R*j*(B-j)/B)*(z-B/2<0?-1:1);wC(c,s,h,Math.max(p,Math.floor(h-z*j/B+q)),Math.min(_,Math.floor(h+(B-z)*j/B+q)),k)}const S=s[2*h+k];let T=p,A=_;for(ep(c,s,p,h),s[2*_+k]>S&&ep(c,s,p,_);T<A;){for(ep(c,s,T,A),T++,A--;s[2*T+k]<S;)T++;for(;s[2*A+k]>S;)A--}s[2*p+k]===S?ep(c,s,p,A):(A++,ep(c,s,A,_)),A<=h&&(p=A+1),h<=A&&(_=A-1)}}function ep(c,s,h,p){mb(c,h,p),mb(s,2*h,2*p),mb(s,2*h+1,2*p+1)}function mb(c,s,h){const p=c[s];c[s]=c[h],c[h]=p}function kC(c,s,h,p){const _=c-h,k=s-p;return _*_+k*k}var gb;u.bg=void 0,(gb=u.bg||(u.bg={})).create="create",gb.load="load",gb.fullLoad="fullLoad";let Jm=null,tp=[];const yb=1e3/60,_b="loadTime",bb="fullLoadTime",HG={mark(c){performance.mark(c)},frame(c){const s=c;Jm!=null&&tp.push(s-Jm),Jm=s},clearMetrics(){Jm=null,tp=[],performance.clearMeasures(_b),performance.clearMeasures(bb);for(const c in u.bg)performance.clearMarks(u.bg[c])},getPerformanceMetrics(){performance.measure(_b,u.bg.create,u.bg.load),performance.measure(bb,u.bg.create,u.bg.fullLoad);const c=performance.getEntriesByName(_b)[0].duration,s=performance.getEntriesByName(bb)[0].duration,h=tp.length,p=1/(tp.reduce((k,S)=>k+S,0)/h/1e3),_=tp.filter(k=>k>yb).reduce((k,S)=>k+(S-yb)/yb,0);return{loadTime:c,fullLoadTime:s,fps:p,percentDroppedFrames:_/(h+_)*100,totalFrames:h}}};u.$=class extends V{},u.A=Vu,u.B=T_,u.C=function(c){if(Vt==null){const s=c.navigator?c.navigator.userAgent:null;Vt=!!c.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return Vt},u.D=ft,u.E=rn,u.F=class{constructor(c,s){this.target=c,this.mapId=s,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new zG(()=>this.process()),this.subscription=function(h,p,_,k){return h.addEventListener(p,_,!1),{unsubscribe:()=>{h.removeEventListener(p,_,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=Nt(self)?c:window}registerMessageHandler(c,s){this.messageHandlers[c]=s}sendAsync(c,s){return new Promise((h,p)=>{const _=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[_]={resolve:h,reject:p},s&&s.signal.addEventListener("abort",()=>{delete this.resolveRejects[_];const T={id:_,type:"<cancel>",origin:location.origin,targetMapId:c.targetMapId,sourceMapId:this.mapId};this.target.postMessage(T)},{once:!0});const k=[],S=Object.assign(Object.assign({},c),{id:_,sourceMapId:this.mapId,origin:location.origin,data:Ga(c.data,k)});this.target.postMessage(S,{transfer:k})})}receive(c){const s=c.data,h=s.id;if(!(s.origin!=="file://"&&location.origin!=="file://"&&s.origin!=="resource://android"&&location.origin!=="resource://android"&&s.origin!==location.origin||s.targetMapId&&this.mapId!==s.targetMapId)){if(s.type==="<cancel>"){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(Nt(self)||s.mustQueue)return this.tasks[h]=s,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,s)}}process(){if(this.taskQueue.length===0)return;const c=this.taskQueue.shift(),s=this.tasks[c];delete this.tasks[c],this.taskQueue.length>0&&this.invoker.trigger(),s&&this.processTask(c,s)}processTask(c,s){return l(this,void 0,void 0,function*(){if(s.type==="<response>"){const _=this.resolveRejects[c];return delete this.resolveRejects[c],_?void(s.error?_.reject(Za(s.error)):_.resolve(Za(s.data))):void 0}if(!this.messageHandlers[s.type])return void this.completeTask(c,new Error(`Could not find a registered handler for ${s.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=Za(s.data),p=new AbortController;this.abortControllers[c]=p;try{const _=yield this.messageHandlers[s.type](s.sourceMapId,h,p);this.completeTask(c,null,_)}catch(_){this.completeTask(c,_)}})}completeTask(c,s,h){const p=[];delete this.abortControllers[c];const _={id:c,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:s?Ga(s):null,data:Ga(h,p)};this.target.postMessage(_,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},u.G=Ln,u.H=function(){var c=new Vu(16);return Vu!=Float32Array&&(c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=0,c[12]=0,c[13]=0,c[14]=0),c[0]=1,c[5]=1,c[10]=1,c[15]=1,c},u.I=eb,u.J=function(c,s,h){var p,_,k,S,T,A,B,z,R,j,q,Y,K=h[0],re=h[1],ae=h[2];return s===c?(c[12]=s[0]*K+s[4]*re+s[8]*ae+s[12],c[13]=s[1]*K+s[5]*re+s[9]*ae+s[13],c[14]=s[2]*K+s[6]*re+s[10]*ae+s[14],c[15]=s[3]*K+s[7]*re+s[11]*ae+s[15]):(_=s[1],k=s[2],S=s[3],T=s[4],A=s[5],B=s[6],z=s[7],R=s[8],j=s[9],q=s[10],Y=s[11],c[0]=p=s[0],c[1]=_,c[2]=k,c[3]=S,c[4]=T,c[5]=A,c[6]=B,c[7]=z,c[8]=R,c[9]=j,c[10]=q,c[11]=Y,c[12]=p*K+T*re+R*ae+s[12],c[13]=_*K+A*re+j*ae+s[13],c[14]=k*K+B*re+q*ae+s[14],c[15]=S*K+z*re+Y*ae+s[15]),c},u.K=function(c,s,h){var p=h[0],_=h[1],k=h[2];return c[0]=s[0]*p,c[1]=s[1]*p,c[2]=s[2]*p,c[3]=s[3]*p,c[4]=s[4]*_,c[5]=s[5]*_,c[6]=s[6]*_,c[7]=s[7]*_,c[8]=s[8]*k,c[9]=s[9]*k,c[10]=s[10]*k,c[11]=s[11]*k,c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15],c},u.L=iE,u.M=function(c,s){const h={};for(let p=0;p<s.length;p++){const _=s[p];_ in c&&(h[_]=c[_])}return h},u.N=sl,u.O=JE,u.P=E,u.Q=QE,u.R=oo,u.S=so,u.T=Au,u.U=W,u.V=te,u.W=Cn,u.X=ai,u.Y=M,u.Z=Jd,u._=l,u.a=Nn,u.a$=function(c,s){var h=c[0],p=c[1],_=c[2],k=c[3],S=c[4],T=c[5],A=c[6],B=c[7],z=c[8],R=c[9],j=c[10],q=c[11],Y=c[12],K=c[13],re=c[14],ae=c[15],be=s[0],pe=s[1],ye=s[2],Te=s[3],Re=s[4],ot=s[5],St=s[6],nt=s[7],Qe=s[8],yt=s[9],dt=s[10],lt=s[11],De=s[12],bt=s[13],gt=s[14],Ot=s[15];return Math.abs(h-be)<=or*Math.max(1,Math.abs(h),Math.abs(be))&&Math.abs(p-pe)<=or*Math.max(1,Math.abs(p),Math.abs(pe))&&Math.abs(_-ye)<=or*Math.max(1,Math.abs(_),Math.abs(ye))&&Math.abs(k-Te)<=or*Math.max(1,Math.abs(k),Math.abs(Te))&&Math.abs(S-Re)<=or*Math.max(1,Math.abs(S),Math.abs(Re))&&Math.abs(T-ot)<=or*Math.max(1,Math.abs(T),Math.abs(ot))&&Math.abs(A-St)<=or*Math.max(1,Math.abs(A),Math.abs(St))&&Math.abs(B-nt)<=or*Math.max(1,Math.abs(B),Math.abs(nt))&&Math.abs(z-Qe)<=or*Math.max(1,Math.abs(z),Math.abs(Qe))&&Math.abs(R-yt)<=or*Math.max(1,Math.abs(R),Math.abs(yt))&&Math.abs(j-dt)<=or*Math.max(1,Math.abs(j),Math.abs(dt))&&Math.abs(q-lt)<=or*Math.max(1,Math.abs(q),Math.abs(lt))&&Math.abs(Y-De)<=or*Math.max(1,Math.abs(Y),Math.abs(De))&&Math.abs(K-bt)<=or*Math.max(1,Math.abs(K),Math.abs(bt))&&Math.abs(re-gt)<=or*Math.max(1,Math.abs(re),Math.abs(gt))&&Math.abs(ae-Ot)<=or*Math.max(1,Math.abs(ae),Math.abs(Ot))},u.a0=tn,u.a1=ub,u.a2=Ve,u.a3=c=>{const s=window.document.createElement("video");return s.muted=!0,new Promise(h=>{s.onloadstart=()=>{h(s)};for(const p of c){const _=window.document.createElement("source");Be(p)||(s.crossOrigin="Anonymous"),_.src=p,s.appendChild(_)}})},u.a4=function(){return Ne++},u.a5=it,u.a6=qu,u.a7=_d,u.a8=sc,u.a9=oC,u.aA=function(c){if(c.type==="custom")return new BG(c);switch(c.type){case"background":return new PG(c);case"circle":return new _W(c);case"fill":return new zW(c);case"fill-extrusion":return new XW(c);case"heatmap":return new xW(c);case"hillshade":return new wW(c);case"line":return new rG(c);case"raster":return new OG(c);case"symbol":return new Gm(c)}},u.aB=Xe,u.aC=function(c,s){if(!c)return[{command:"setStyle",args:[s]}];let h=[];try{if(!qt(c.version,s.version))return[{command:"setStyle",args:[s]}];qt(c.center,s.center)||h.push({command:"setCenter",args:[s.center]}),qt(c.zoom,s.zoom)||h.push({command:"setZoom",args:[s.zoom]}),qt(c.bearing,s.bearing)||h.push({command:"setBearing",args:[s.bearing]}),qt(c.pitch,s.pitch)||h.push({command:"setPitch",args:[s.pitch]}),qt(c.sprite,s.sprite)||h.push({command:"setSprite",args:[s.sprite]}),qt(c.glyphs,s.glyphs)||h.push({command:"setGlyphs",args:[s.glyphs]}),qt(c.transition,s.transition)||h.push({command:"setTransition",args:[s.transition]}),qt(c.light,s.light)||h.push({command:"setLight",args:[s.light]}),qt(c.terrain,s.terrain)||h.push({command:"setTerrain",args:[s.terrain]}),qt(c.sky,s.sky)||h.push({command:"setSky",args:[s.sky]}),qt(c.projection,s.projection)||h.push({command:"setProjection",args:[s.projection]});const p={},_=[];(function(S,T,A,B){let z;for(z in T=T||{},S=S||{})Object.prototype.hasOwnProperty.call(S,z)&&(Object.prototype.hasOwnProperty.call(T,z)||ui(z,A,B));for(z in T)Object.prototype.hasOwnProperty.call(T,z)&&(Object.prototype.hasOwnProperty.call(S,z)?qt(S[z],T[z])||(S[z].type==="geojson"&&T[z].type==="geojson"&&Or(S,T,z)?sn(A,{command:"setGeoJSONSourceData",args:[z,T[z].data]}):mi(z,T,A,B)):vi(z,T,A))})(c.sources,s.sources,_,p);const k=[];c.layers&&c.layers.forEach(S=>{"source"in S&&p[S.source]?h.push({command:"removeLayer",args:[S.id]}):k.push(S)}),h=h.concat(_),function(S,T,A){T=T||[];const B=(S=S||[]).map(Eo),z=T.map(Eo),R=S.reduce(Co,{}),j=T.reduce(Co,{}),q=B.slice(),Y=Object.create(null);let K,re,ae,be,pe;for(let ye=0,Te=0;ye<B.length;ye++)K=B[ye],Object.prototype.hasOwnProperty.call(j,K)?Te++:(sn(A,{command:"removeLayer",args:[K]}),q.splice(q.indexOf(K,Te),1));for(let ye=0,Te=0;ye<z.length;ye++)K=z[z.length-1-ye],q[q.length-1-ye]!==K&&(Object.prototype.hasOwnProperty.call(R,K)?(sn(A,{command:"removeLayer",args:[K]}),q.splice(q.lastIndexOf(K,q.length-Te),1)):Te++,be=q[q.length-ye],sn(A,{command:"addLayer",args:[j[K],be]}),q.splice(q.length-ye,0,K),Y[K]=!0);for(let ye=0;ye<z.length;ye++)if(K=z[ye],re=R[K],ae=j[K],!Y[K]&&!qt(re,ae))if(qt(re.source,ae.source)&&qt(re["source-layer"],ae["source-layer"])&&qt(re.type,ae.type)){for(pe in wi(re.layout,ae.layout,A,K,null,"setLayoutProperty"),wi(re.paint,ae.paint,A,K,null,"setPaintProperty"),qt(re.filter,ae.filter)||sn(A,{command:"setFilter",args:[K,ae.filter]}),qt(re.minzoom,ae.minzoom)&&qt(re.maxzoom,ae.maxzoom)||sn(A,{command:"setLayerZoomRange",args:[K,ae.minzoom,ae.maxzoom]}),re)Object.prototype.hasOwnProperty.call(re,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?wi(re[pe],ae[pe],A,K,pe.slice(6),"setPaintProperty"):qt(re[pe],ae[pe])||sn(A,{command:"setLayerProperty",args:[K,pe,ae[pe]]}));for(pe in ae)Object.prototype.hasOwnProperty.call(ae,pe)&&!Object.prototype.hasOwnProperty.call(re,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?wi(re[pe],ae[pe],A,K,pe.slice(6),"setPaintProperty"):qt(re[pe],ae[pe])||sn(A,{command:"setLayerProperty",args:[K,pe,ae[pe]]}))}else sn(A,{command:"removeLayer",args:[K]}),be=q[q.lastIndexOf(K)+1],sn(A,{command:"addLayer",args:[ae,be]})}(k,s.layers,h)}catch(p){console.warn("Unable to compute style diff:",p),h=[{command:"setStyle",args:[s]}]}return h},u.aD=function(c){const s=[],h=c.id;return h===void 0&&s.push({message:`layers.${h}: missing required property "id"`}),c.render===void 0&&s.push({message:`layers.${h}: missing required method "render"`}),c.renderingMode&&c.renderingMode!=="2d"&&c.renderingMode!=="3d"&&s.push({message:`layers.${h}: property "renderingMode" must be either "2d" or "3d"`}),s},u.aE=function c(s,h){if(Array.isArray(s)){if(!Array.isArray(h)||s.length!==h.length)return!1;for(let p=0;p<s.length;p++)if(!c(s[p],h[p]))return!1;return!0}if(typeof s=="object"&&s!==null&&h!==null){if(typeof h!="object"||Object.keys(s).length!==Object.keys(h).length)return!1;for(const p in s)if(!c(s[p],h[p]))return!1;return!0}return s===h},u.aF=Ae,u.aG=$e,u.aH=class extends ic{constructor(c,s){super(c,s),this.current=0}set(c){this.current!==c&&(this.current=c,this.gl.uniform1i(this.location,c))}},u.aI=Bm,u.aJ=class extends ic{constructor(c,s){super(c,s),this.current=uW}set(c){if(c[12]!==this.current[12]||c[0]!==this.current[0])return this.current=c,void this.gl.uniformMatrix4fv(this.location,!1,c);for(let s=1;s<16;s++)if(c[s]!==this.current[s]){this.current=c,this.gl.uniformMatrix4fv(this.location,!1,c);break}}},u.aK=WS,u.aL=GS,u.aM=kn,u.aN=class extends ic{constructor(c,s){super(c,s),this.current=[0,0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]&&c[2]===this.current[2]||(this.current=c,this.gl.uniform3f(this.location,c[0],c[1],c[2]))}},u.aO=class extends ic{constructor(c,s){super(c,s),this.current=[0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]||(this.current=c,this.gl.uniform2f(this.location,c[0],c[1]))}},u.aP=function(c,s,h,p,_,k,S){var T=1/(s-h),A=1/(p-_),B=1/(k-S);return c[0]=-2*T,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=-2*A,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=2*B,c[11]=0,c[12]=(s+h)*T,c[13]=(_+p)*A,c[14]=(S+k)*B,c[15]=1,c},u.aQ=yW,u.aR=class extends me{},u.aS=lG,u.aT=class extends xe{},u.aU=j_,u.aV=function(c){return c<=1?1:Math.pow(2,Math.ceil(Math.log(c)/Math.LN2))},u.aW=lE,u.aX=zi,u.aY=ro,u.aZ=class extends mt{},u.a_=function(c,s){return c[0]===s[0]&&c[1]===s[1]&&c[2]===s[2]&&c[3]===s[3]&&c[4]===s[4]&&c[5]===s[5]&&c[6]===s[6]&&c[7]===s[7]&&c[8]===s[8]&&c[9]===s[9]&&c[10]===s[10]&&c[11]===s[11]&&c[12]===s[12]&&c[13]===s[13]&&c[14]===s[14]&&c[15]===s[15]},u.aa=function(c){const s={};if(c.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,_,k)=>{const S=_||k;return s[p]=!S||S.toLowerCase(),""}),s["max-age"]){const h=parseInt(s["max-age"],10);isNaN(h)?delete s["max-age"]:s["max-age"]=h}return s},u.ab=function(c,s){const h=[];for(const p in c)p in s||h.push(p);return h},u.ac=Ie,u.ad=function(c,s,h){var p=Math.sin(h),_=Math.cos(h),k=s[0],S=s[1],T=s[2],A=s[3],B=s[4],z=s[5],R=s[6],j=s[7];return s!==c&&(c[8]=s[8],c[9]=s[9],c[10]=s[10],c[11]=s[11],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15]),c[0]=k*_+B*p,c[1]=S*_+z*p,c[2]=T*_+R*p,c[3]=A*_+j*p,c[4]=B*_-k*p,c[5]=z*_-S*p,c[6]=R*_-T*p,c[7]=j*_-A*p,c},u.ae=function(c){var s=new Vu(16);return s[0]=c[0],s[1]=c[1],s[2]=c[2],s[3]=c[3],s[4]=c[4],s[5]=c[5],s[6]=c[6],s[7]=c[7],s[8]=c[8],s[9]=c[9],s[10]=c[10],s[11]=c[11],s[12]=c[12],s[13]=c[13],s[14]=c[14],s[15]=c[15],s},u.af=Rm,u.ag=function(c,s){let h=0,p=0;if(c.kind==="constant")p=c.layoutSize;else if(c.kind!=="source"){const{interpolationType:_,minZoom:k,maxZoom:S}=c,T=_?Ie(ir.interpolationFactor(_,s,k,S),0,1):0;c.kind==="camera"?p=nr.number(c.minSize,c.maxSize,T):h=T}return{uSizeT:h,uSize:p}},u.ai=function(c,{uSize:s,uSizeT:h},{lowerSize:p,upperSize:_}){return c.kind==="source"?p/gs:c.kind==="composite"?nr.number(p/gs,_/gs,h):s},u.aj=rb,u.ak=function(c,s,h,p){const _=s.y-c.y,k=s.x-c.x,S=p.y-h.y,T=p.x-h.x,A=S*k-T*_;if(A===0)return null;const B=(T*(c.y-h.y)-S*(c.x-h.x))/A;return new E(c.x+B*k,c.y+B*_)},u.al=cC,u.am=KS,u.an=V_,u.ao=function(c){let s=1/0,h=1/0,p=-1/0,_=-1/0;for(const k of c)s=Math.min(s,k.x),h=Math.min(h,k.y),p=Math.max(p,k.x),_=Math.max(_,k.y);return[s,h,p,_]},u.ap=hi,u.ar=ib,u.as=function(c,s){var h=s[0],p=s[1],_=s[2],k=s[3],S=s[4],T=s[5],A=s[6],B=s[7],z=s[8],R=s[9],j=s[10],q=s[11],Y=s[12],K=s[13],re=s[14],ae=s[15],be=h*T-p*S,pe=h*A-_*S,ye=h*B-k*S,Te=p*A-_*T,Re=p*B-k*T,ot=_*B-k*A,St=z*K-R*Y,nt=z*re-j*Y,Qe=z*ae-q*Y,yt=R*re-j*K,dt=R*ae-q*K,lt=j*ae-q*re,De=be*lt-pe*dt+ye*yt+Te*Qe-Re*nt+ot*St;return De?(c[0]=(T*lt-A*dt+B*yt)*(De=1/De),c[1]=(_*dt-p*lt-k*yt)*De,c[2]=(K*ot-re*Re+ae*Te)*De,c[3]=(j*Re-R*ot-q*Te)*De,c[4]=(A*Qe-S*lt-B*nt)*De,c[5]=(h*lt-_*Qe+k*nt)*De,c[6]=(re*ye-Y*ot-ae*pe)*De,c[7]=(z*ot-j*ye+q*pe)*De,c[8]=(S*dt-T*Qe+B*St)*De,c[9]=(p*Qe-h*dt-k*St)*De,c[10]=(Y*Re-K*ye+ae*be)*De,c[11]=(R*ye-z*Re-q*be)*De,c[12]=(T*nt-S*yt-A*St)*De,c[13]=(h*yt-p*nt+_*St)*De,c[14]=(K*pe-Y*Te-re*be)*De,c[15]=(z*Te-R*pe+j*be)*De,c):null},u.at=db,u.au=nb,u.av=pb,u.aw=function(){const c={},s=we.$version;for(const h in we.$root){const p=we.$root[h];if(p.required){let _=null;_=h==="version"?s:p.type==="array"?[]:{},_!=null&&(c[h]=_)}}return c},u.ax=Dd,u.ay=He,u.az=function(c){c=c.slice();const s=Object.create(null);for(let h=0;h<c.length;h++)s[c[h].id]=c[h];for(let h=0;h<c.length;h++)"ref"in c[h]&&(c[h]=pr(c[h],s[c[h].ref]));return c},u.b=Ft,u.b0=function(c,s){return c[0]=s[0],c[1]=s[1],c[2]=s[2],c[3]=s[3],c[4]=s[4],c[5]=s[5],c[6]=s[6],c[7]=s[7],c[8]=s[8],c[9]=s[9],c[10]=s[10],c[11]=s[11],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15],c},u.b1=function(c,s,h){return c[0]=s[0]*h[0],c[1]=s[1]*h[1],c[2]=s[2]*h[2],c[3]=s[3]*h[3],c},u.b2=function(c,s){return c[0]*s[0]+c[1]*s[1]+c[2]*s[2]+c[3]*s[3]},u.b3=ve,u.b4=nC,u.b5=eC,u.b6=function(c,s,h,p,_){var k,S=1/Math.tan(s/2);return c[0]=S/h,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=S,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=-1,c[12]=0,c[13]=0,c[15]=0,_!=null&&_!==1/0?(c[10]=(_+p)*(k=1/(p-_)),c[14]=2*_*p*k):(c[10]=-1,c[14]=-2*p),c},u.b7=function(c,s,h){var p=Math.sin(h),_=Math.cos(h),k=s[4],S=s[5],T=s[6],A=s[7],B=s[8],z=s[9],R=s[10],j=s[11];return s!==c&&(c[0]=s[0],c[1]=s[1],c[2]=s[2],c[3]=s[3],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15]),c[4]=k*_+B*p,c[5]=S*_+z*p,c[6]=T*_+R*p,c[7]=A*_+j*p,c[8]=B*_-k*p,c[9]=z*_-S*p,c[10]=R*_-T*p,c[11]=j*_-A*p,c},u.b8=G,u.b9=Q,u.bA=ME,u.bB=function(c){return c.message===pn},u.bC=Fa,u.bD=br,u.ba=function(c){return c*Math.PI/180},u.bb=function(c,s){const{x:h,y:p}=Jd.fromLngLat(s);return!(c<0||c>25||p<0||p>=1||h<0||h>=1)},u.bc=function(c,s){return c[0]=s[0],c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=s[1],c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=s[2],c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c},u.bd=class extends N{},u.be=lb,u.bf=HG,u.bh=Ce,u.bi=function(c,s){Nn.REGISTERED_PROTOCOLS[c]=s},u.bj=function(c){delete Nn.REGISTERED_PROTOCOLS[c]},u.bk=function(c,s){const h={};for(let _=0;_<c.length;_++){const k=s&&s[c[_].id]||wm(c[_]);s&&(s[c[_].id]=k);let S=h[k];S||(S=h[k]=[]),S.push(c[_])}const p=[];for(const _ in h)p.push(h[_]);return p},u.bl=ut,u.bm=rC,u.bn=sC,u.bo=LE,u.bp=function(c){c.bucket.createArrays(),c.bucket.tilePixelRatio=ai/(512*c.bucket.overscaling),c.bucket.compareText={},c.bucket.iconsNeedLinear=!1;const s=c.bucket.layers[0],h=s.layout,p=s._unevaluatedLayout._values,_={layoutIconSize:p["icon-size"].possiblyEvaluate(new Vn(c.bucket.zoom+1),c.canonical),layoutTextSize:p["text-size"].possiblyEvaluate(new Vn(c.bucket.zoom+1),c.canonical),textMaxSize:p["text-size"].possiblyEvaluate(new Vn(18))};if(c.bucket.textSizeData.kind==="composite"){const{minZoom:B,maxZoom:z}=c.bucket.textSizeData;_.compositeTextSizes=[p["text-size"].possiblyEvaluate(new Vn(B),c.canonical),p["text-size"].possiblyEvaluate(new Vn(z),c.canonical)]}if(c.bucket.iconSizeData.kind==="composite"){const{minZoom:B,maxZoom:z}=c.bucket.iconSizeData;_.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new Vn(B),c.canonical),p["icon-size"].possiblyEvaluate(new Vn(z),c.canonical)]}const k=h.get("text-line-height")*hi,S=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point",T=h.get("text-keep-upright"),A=h.get("text-size");for(const B of c.bucket.features){const z=h.get("text-font").evaluate(B,{},c.canonical).join(","),R=A.evaluate(B,{},c.canonical),j=_.layoutTextSize.evaluate(B,{},c.canonical),q=_.layoutIconSize.evaluate(B,{},c.canonical),Y={horizontal:{},vertical:void 0},K=B.text;let re,ae=[0,0];if(K){const ye=K.toString(),Te=h.get("text-letter-spacing").evaluate(B,{},c.canonical)*hi,Re=M_(ye)?Te:0,ot=h.get("text-anchor").evaluate(B,{},c.canonical),St=_C(s,B,c.canonical);if(!St){const dt=h.get("text-radial-offset").evaluate(B,{},c.canonical);ae=dt?yC(ot,[dt*hi,hb]):h.get("text-offset").evaluate(B,{},c.canonical).map(lt=>lt*hi)}let nt=S?"center":h.get("text-justify").evaluate(B,{},c.canonical);const Qe=h.get("symbol-placement")==="point"?h.get("text-max-width").evaluate(B,{},c.canonical)*hi:1/0,yt=()=>{c.bucket.allowVerticalPlacement&&Od(ye)&&(Y.vertical=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Qe,k,ot,"left",Re,ae,u.ah.vertical,!0,j,R))};if(!S&&St){const dt=new Set;if(nt==="auto")for(let De=0;De<St.values.length;De+=2)dt.add(db(St.values[De]));else dt.add(nt);let lt=!1;for(const De of dt)if(!Y.horizontal[De])if(lt)Y.horizontal[De]=Y.horizontal[0];else{const bt=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Qe,k,"center",De,Re,ae,u.ah.horizontal,!1,j,R);bt&&(Y.horizontal[De]=bt,lt=bt.positionedLines.length===1)}yt()}else{nt==="auto"&&(nt=db(ot));const dt=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Qe,k,ot,nt,Re,ae,u.ah.horizontal,!1,j,R);dt&&(Y.horizontal[nt]=dt),yt(),Od(ye)&&S&&T&&(Y.vertical=Hm(K,c.glyphMap,c.glyphPositions,c.imagePositions,z,Qe,k,ot,nt,Re,ae,u.ah.vertical,!1,j,R))}}let be=!1;if(B.icon&&B.icon.name){const ye=c.imageMap[B.icon.name];ye&&(re=CG(c.imagePositions[B.icon.name],h.get("icon-offset").evaluate(B,{},c.canonical),h.get("icon-anchor").evaluate(B,{},c.canonical)),be=!!ye.sdf,c.bucket.sdfIcons===void 0?c.bucket.sdfIcons=be:c.bucket.sdfIcons!==be&&st("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ye.pixelRatio!==c.bucket.pixelRatio||h.get("icon-rotate").constantOr(1)!==0)&&(c.bucket.iconsNeedLinear=!0))}const pe=xC(Y.horizontal)||Y.vertical;c.bucket.iconsInText=!!pe&&pe.iconsInText,(pe||re)&&jG(c.bucket,B,Y,re,c.imageMap,_,j,q,ae,be,c.canonical)}c.showCollisionBoxes&&c.bucket.generateCollisionDebugBuffers()},u.bq=X_,u.br=G_,u.bs=Y_,u.bt=il,u.bu=J_,u.bv=class{constructor(c){this._marks={start:[c.url,"start"].join("#"),end:[c.url,"end"].join("#"),measure:c.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let c=performance.getEntriesByName(this._marks.measure);return c.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),c=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),c}},u.bw=function(c,s,h,p,_){return l(this,void 0,void 0,function*(){if(te())try{return yield Cn(c,s,h,p,_)}catch{}return function(k,S,T,A,B){const z=k.width,R=k.height;dn&&vn||(dn=new OffscreenCanvas(z,R),vn=dn.getContext("2d",{willReadFrequently:!0})),dn.width=z,dn.height=R,vn.drawImage(k,0,0,z,R);const j=vn.getImageData(S,T,A,B);return vn.clearRect(0,0,z,R),j.data}(c,s,h,p,_)})},u.bx=iC,u.by=g,u.bz=b,u.c=ti,u.d=c=>l(void 0,void 0,void 0,function*(){if(c.byteLength===0)return createImageBitmap(new ImageData(1,1));const s=new Blob([new Uint8Array(c)],{type:"image/png"});try{return createImageBitmap(s)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),u.e=Se,u.f=c=>new Promise((s,h)=>{const p=new Image;p.onload=()=>{s(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=Ht})},p.onerror=()=>h(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 _=new Blob([new Uint8Array(c)],{type:"image/png"});p.src=c.byteLength?URL.createObjectURL(_):Ht}),u.g=Pn,u.h=(c,s)=>Ke(Se(c,{type:"json"}),s),u.i=Nt,u.j=Mt,u.k=At,u.l=(c,s)=>Ke(Se(c,{type:"arrayBuffer"}),s),u.m=Ke,u.n=function(c){return new J_(c).readFields(bG,[])},u.o=jd,u.p=NE,u.q=v,u.r=C_,u.s=Be,u.t=Id,u.u=Ks,u.v=we,u.w=st,u.x=function([c,s,h]){return s+=90,s*=Math.PI/180,h*=Math.PI/180,{x:c*Math.cos(s)*Math.sin(h),y:c*Math.sin(s)*Math.sin(h),z:c*Math.cos(h)}},u.y=nr,u.z=Vn}),r("worker",["./shared"],function(u){class l{constructor(H){this.keyCache={},H&&this.replace(H)}replace(H){this._layerConfigs={},this._layers={},this.update(H,[])}update(H,U){for(const ie of H){this._layerConfigs[ie.id]=ie;const de=this._layers[ie.id]=u.aA(ie);de._featureFilter=u.a7(de.filter),this.keyCache[ie.id]&&delete this.keyCache[ie.id]}for(const ie of U)delete this.keyCache[ie],delete this._layerConfigs[ie],delete this._layers[ie];this.familiesBySource={};const X=u.bk(Object.values(this._layerConfigs),this.keyCache);for(const ie of X){const de=ie.map(Ee=>this._layers[Ee.id]),fe=de[0];if(fe.visibility==="none")continue;const _e=fe.source||"";let ue=this.familiesBySource[_e];ue||(ue=this.familiesBySource[_e]={});const Me=fe.sourceLayer||"_geojsonTileLayer";let ze=ue[Me];ze||(ze=ue[Me]=[]),ze.push(de)}}}class g{constructor(H){const U={},X=[];for(const _e in H){const ue=H[_e],Me=U[_e]={};for(const ze in ue){const Ee=ue[+ze];if(!Ee||Ee.bitmap.width===0||Ee.bitmap.height===0)continue;const We={x:0,y:0,w:Ee.bitmap.width+2,h:Ee.bitmap.height+2};X.push(We),Me[ze]={rect:We,metrics:Ee.metrics}}}const{w:ie,h:de}=u.p(X),fe=new u.o({width:ie||1,height:de||1});for(const _e in H){const ue=H[_e];for(const Me in ue){const ze=ue[+Me];if(!ze||ze.bitmap.width===0||ze.bitmap.height===0)continue;const Ee=U[_e][Me].rect;u.o.copy(ze.bitmap,fe,{x:0,y:0},{x:Ee.x+1,y:Ee.y+1},ze.bitmap)}}this.image=fe,this.positions=U}}u.bl("GlyphAtlas",g);class b{constructor(H){this.tileID=new u.S(H.tileID.overscaledZ,H.tileID.wrap,H.tileID.canonical.z,H.tileID.canonical.x,H.tileID.canonical.y),this.uid=H.uid,this.zoom=H.zoom,this.pixelRatio=H.pixelRatio,this.tileSize=H.tileSize,this.source=H.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=H.showCollisionBoxes,this.collectResourceTiming=!!H.collectResourceTiming,this.returnDependencies=!!H.returnDependencies,this.promoteId=H.promoteId,this.inFlightDependencies=[]}parse(H,U,X,ie){return u._(this,void 0,void 0,function*(){this.status="parsing",this.data=H,this.collisionBoxArray=new u.a5;const de=new u.bm(Object.keys(H.layers).sort()),fe=new u.bn(this.tileID,this.promoteId);fe.bucketLayerIDs=[];const _e={},ue={featureIndex:fe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:X},Me=U.familiesBySource[this.source];for(const Ut in Me){const wn=H.layers[Ut];if(!wn)continue;wn.version===1&&u.w(`Vector tile source "${this.source}" layer "${Ut}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const qn=de.encode(Ut),gi=[];for(let Si=0;Si<wn.length;Si++){const Wi=wn.feature(Si),Aa=fe.getId(Wi,Ut);gi.push({feature:Wi,id:Aa,index:Si,sourceLayerIndex:qn})}for(const Si of Me[Ut]){const Wi=Si[0];Wi.source!==this.source&&u.w(`layer.source = ${Wi.source} does not equal this.source = ${this.source}`),Wi.minzoom&&this.zoom<Math.floor(Wi.minzoom)||Wi.maxzoom&&this.zoom>=Wi.maxzoom||Wi.visibility!=="none"&&(w(Si,this.zoom,X),(_e[Wi.id]=Wi.createBucket({index:fe.bucketLayerIDs.length,layers:Si,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:qn,sourceID:this.source})).populate(gi,ue,this.tileID.canonical),fe.bucketLayerIDs.push(Si.map(Aa=>Aa.id)))}}const ze=u.aF(ue.glyphDependencies,Ut=>Object.keys(Ut).map(Number));this.inFlightDependencies.forEach(Ut=>Ut==null?void 0:Ut.abort()),this.inFlightDependencies=[];let Ee=Promise.resolve({});if(Object.keys(ze).length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),Ee=ie.sendAsync({type:"GG",data:{stacks:ze,source:this.source,tileID:this.tileID,type:"glyphs"}},Ut)}const We=Object.keys(ue.iconDependencies);let xt=Promise.resolve({});if(We.length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),xt=ie.sendAsync({type:"GI",data:{icons:We,source:this.source,tileID:this.tileID,type:"icons"}},Ut)}const kt=Object.keys(ue.patternDependencies);let an=Promise.resolve({});if(kt.length){const Ut=new AbortController;this.inFlightDependencies.push(Ut),an=ie.sendAsync({type:"GI",data:{icons:kt,source:this.source,tileID:this.tileID,type:"patterns"}},Ut)}const[Lt,ln,Kt]=yield Promise.all([Ee,xt,an]),oi=new g(Lt),Zn=new u.bo(ln,Kt);for(const Ut in _e){const wn=_e[Ut];wn instanceof u.a6?(w(wn.layers,this.zoom,X),u.bp({bucket:wn,glyphMap:Lt,glyphPositions:oi.positions,imageMap:ln,imagePositions:Zn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):wn.hasPattern&&(wn instanceof u.bq||wn instanceof u.br||wn instanceof u.bs)&&(w(wn.layers,this.zoom,X),wn.addFeatures(ue,this.tileID.canonical,Zn.patternPositions))}return this.status="done",{buckets:Object.values(_e).filter(Ut=>!Ut.isEmpty()),featureIndex:fe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:oi.image,imageAtlas:Zn,glyphMap:this.returnDependencies?Lt:null,iconMap:this.returnDependencies?ln:null,glyphPositions:this.returnDependencies?oi.positions:null}})}}function w(se,H,U){const X=new u.z(H);for(const ie of se)ie.recalculate(X,U)}class E{constructor(H,U,X){this.actor=H,this.layerIndex=U,this.availableImages=X,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(H,U){return u._(this,void 0,void 0,function*(){const X=yield u.l(H.request,U);try{return{vectorTile:new u.bt.VectorTile(new u.bu(X.data)),rawData:X.data,cacheControl:X.cacheControl,expires:X.expires}}catch(ie){const de=new Uint8Array(X.data);let fe=`Unable to parse the tile at ${H.request.url}, `;throw fe+=de[0]===31&&de[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ie.message}`,new Error(fe)}})}loadTile(H){return u._(this,void 0,void 0,function*(){const U=H.uid,X=!!(H&&H.request&&H.request.collectResourceTiming)&&new u.bv(H.request),ie=new b(H);this.loading[U]=ie;const de=new AbortController;ie.abort=de;try{const fe=yield this.loadVectorTile(H,de);if(delete this.loading[U],!fe)return null;const _e=fe.rawData,ue={};fe.expires&&(ue.expires=fe.expires),fe.cacheControl&&(ue.cacheControl=fe.cacheControl);const Me={};if(X){const Ee=X.finish();Ee&&(Me.resourceTiming=JSON.parse(JSON.stringify(Ee)))}ie.vectorTile=fe.vectorTile;const ze=ie.parse(fe.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[U]=ie,this.fetching[U]={rawTileData:_e,cacheControl:ue,resourceTiming:Me};try{const Ee=yield ze;return u.e({rawTileData:_e.slice(0)},Ee,ue,Me)}finally{delete this.fetching[U]}}catch(fe){throw delete this.loading[U],ie.status="done",this.loaded[U]=ie,fe}})}reloadTile(H){return u._(this,void 0,void 0,function*(){const U=H.uid;if(!this.loaded||!this.loaded[U])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const X=this.loaded[U];if(X.showCollisionBoxes=H.showCollisionBoxes,X.status==="parsing"){const ie=yield X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor);let de;if(this.fetching[U]){const{rawTileData:fe,cacheControl:_e,resourceTiming:ue}=this.fetching[U];delete this.fetching[U],de=u.e({rawTileData:fe.slice(0)},ie,_e,ue)}else de=ie;return de}if(X.status==="done"&&X.vectorTile)return X.parse(X.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(H){return u._(this,void 0,void 0,function*(){const U=this.loading,X=H.uid;U&&U[X]&&U[X].abort&&(U[X].abort.abort(),delete U[X])})}removeTile(H){return u._(this,void 0,void 0,function*(){this.loaded&&this.loaded[H.uid]&&delete this.loaded[H.uid]})}}class C{constructor(){this.loaded={}}loadTile(H){return u._(this,void 0,void 0,function*(){const{uid:U,encoding:X,rawImageData:ie,redFactor:de,greenFactor:fe,blueFactor:_e,baseShift:ue}=H,Me=ie.width+2,ze=ie.height+2,Ee=u.b(ie)?new u.R({width:Me,height:ze},yield u.bw(ie,-1,-1,Me,ze)):ie,We=new u.bx(U,Ee,X,de,fe,_e,ue);return this.loaded=this.loaded||{},this.loaded[U]=We,We})}removeTile(H){const U=this.loaded,X=H.uid;U&&U[X]&&delete U[X]}}function I(se,H){if(se.length!==0){D(se[0],H);for(var U=1;U<se.length;U++)D(se[U],!H)}}function D(se,H){for(var U=0,X=0,ie=0,de=se.length,fe=de-1;ie<de;fe=ie++){var _e=(se[ie][0]-se[fe][0])*(se[fe][1]+se[ie][1]),ue=U+_e;X+=Math.abs(U)>=Math.abs(_e)?U-ue+_e:_e-ue+U,U=ue}U+X>=0!=!!H&&se.reverse()}var L=u.by(function se(H,U){var X,ie=H&&H.type;if(ie==="FeatureCollection")for(X=0;X<H.features.length;X++)se(H.features[X],U);else if(ie==="GeometryCollection")for(X=0;X<H.geometries.length;X++)se(H.geometries[X],U);else if(ie==="Feature")se(H.geometry,U);else if(ie==="Polygon")I(H.coordinates,U);else if(ie==="MultiPolygon")for(X=0;X<H.coordinates.length;X++)I(H.coordinates[X],U);return H});const $=u.bt.VectorTileFeature.prototype.toGeoJSON;var W={exports:{}},te=u.bz,G=u.bt.VectorTileFeature,Q=Ie;function Ie(se,H){this.options=H||{},this.features=se,this.length=se.length}function ve(se,H){this.id=typeof se.id=="number"?se.id:void 0,this.type=se.type,this.rawGeometry=se.type===1?[se.geometry]:se.geometry,this.properties=se.tags,this.extent=H||4096}Ie.prototype.feature=function(se){return new ve(this.features[se],this.options.extent)},ve.prototype.loadGeometry=function(){var se=this.rawGeometry;this.geometry=[];for(var H=0;H<se.length;H++){for(var U=se[H],X=[],ie=0;ie<U.length;ie++)X.push(new te(U[ie][0],U[ie][1]));this.geometry.push(X)}return this.geometry},ve.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var se=this.geometry,H=1/0,U=-1/0,X=1/0,ie=-1/0,de=0;de<se.length;de++)for(var fe=se[de],_e=0;_e<fe.length;_e++){var ue=fe[_e];H=Math.min(H,ue.x),U=Math.max(U,ue.x),X=Math.min(X,ue.y),ie=Math.max(ie,ue.y)}return[H,X,U,ie]},ve.prototype.toGeoJSON=G.prototype.toGeoJSON;var Se=u.bA,Ne=Q;function Ae(se){var H=new Se;return function(U,X){for(var ie in U.layers)X.writeMessage(3,$e,U.layers[ie])}(se,H),H.finish()}function $e(se,H){var U;H.writeVarintField(15,se.version||1),H.writeStringField(1,se.name||""),H.writeVarintField(5,se.extent||4096);var X={keys:[],values:[],keycache:{},valuecache:{}};for(U=0;U<se.length;U++)X.feature=se.feature(U),H.writeMessage(2,Xe,X);var ie=X.keys;for(U=0;U<ie.length;U++)H.writeStringField(3,ie[U]);var de=X.values;for(U=0;U<de.length;U++)H.writeMessage(4,Vt,de[U])}function Xe(se,H){var U=se.feature;U.id!==void 0&&H.writeVarintField(1,U.id),H.writeMessage(2,Pt,se),H.writeVarintField(3,U.type),H.writeMessage(4,Nt,U)}function Pt(se,H){var U=se.feature,X=se.keys,ie=se.values,de=se.keycache,fe=se.valuecache;for(var _e in U.properties){var ue=U.properties[_e],Me=de[_e];if(ue!==null){Me===void 0&&(X.push(_e),de[_e]=Me=X.length-1),H.writeVarint(Me);var ze=typeof ue;ze!=="string"&&ze!=="boolean"&&ze!=="number"&&(ue=JSON.stringify(ue));var Ee=ze+":"+ue,We=fe[Ee];We===void 0&&(ie.push(ue),fe[Ee]=We=ie.length-1),H.writeVarint(We)}}}function st(se,H){return(H<<3)+(7&se)}function Tt(se){return se<<1^se>>31}function Nt(se,H){for(var U=se.loadGeometry(),X=se.type,ie=0,de=0,fe=U.length,_e=0;_e<fe;_e++){var ue=U[_e],Me=1;X===1&&(Me=ue.length),H.writeVarint(st(1,Me));for(var ze=X===3?ue.length-1:ue.length,Ee=0;Ee<ze;Ee++){Ee===1&&X!==1&&H.writeVarint(st(2,ze-1));var We=ue[Ee].x-ie,xt=ue[Ee].y-de;H.writeVarint(Tt(We)),H.writeVarint(Tt(xt)),ie+=We,de+=xt}X===3&&H.writeVarint(st(7,1))}}function Vt(se,H){var U=typeof se;U==="string"?H.writeStringField(1,se):U==="boolean"?H.writeBooleanField(7,se):U==="number"&&(se%1!=0?H.writeDoubleField(3,se):se<0?H.writeSVarintField(6,se):H.writeVarintField(5,se))}W.exports=Ae,W.exports.fromVectorTileJs=Ae,W.exports.fromGeojsonVt=function(se,H){H=H||{};var U={};for(var X in se)U[X]=new Ne(se[X].features,H),U[X].name=X,U[X].version=H.version,U[X].extent=H.extent;return Ae({layers:U})},W.exports.GeoJSONWrapper=Ne;var Ft=u.by(W.exports);const Ht={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:se=>se},Cn=Math.fround||(dn=new Float32Array(1),se=>(dn[0]=+se,dn[0]));var dn;const vn=3,pn=5,ti=6;class Nn{constructor(H){this.options=Object.assign(Object.create(Ht),H),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(H){const{log:U,minZoom:X,maxZoom:ie}=this.options;U&&console.time("total time");const de=`prepare ${H.length} points`;U&&console.time(de),this.points=H;const fe=[];for(let ue=0;ue<H.length;ue++){const Me=H[ue];if(!Me.geometry)continue;const[ze,Ee]=Me.geometry.coordinates,We=Cn(Ce(ze)),xt=Cn(He(Ee));fe.push(We,xt,1/0,ue,-1,1),this.options.reduce&&fe.push(0)}let _e=this.trees[ie+1]=this._createTree(fe);U&&console.timeEnd(de);for(let ue=ie;ue>=X;ue--){const Me=+Date.now();_e=this.trees[ue]=this._createTree(this._cluster(_e,ue)),U&&console.log("z%d: %d clusters in %dms",ue,_e.numItems,+Date.now()-Me)}return U&&console.timeEnd("total time"),this}getClusters(H,U){let X=((H[0]+180)%360+360)%360-180;const ie=Math.max(-90,Math.min(90,H[1]));let de=H[2]===180?180:((H[2]+180)%360+360)%360-180;const fe=Math.max(-90,Math.min(90,H[3]));if(H[2]-H[0]>=360)X=-180,de=180;else if(X>de){const Ee=this.getClusters([X,ie,180,fe],U),We=this.getClusters([-180,ie,de,fe],U);return Ee.concat(We)}const _e=this.trees[this._limitZoom(U)],ue=_e.range(Ce(X),He(fe),Ce(de),He(ie)),Me=_e.data,ze=[];for(const Ee of ue){const We=this.stride*Ee;ze.push(Me[We+pn]>1?Pn(Me,We,this.clusterProps):this.points[Me[We+vn]])}return ze}getChildren(H){const U=this._getOriginId(H),X=this._getOriginZoom(H),ie="No cluster with the specified id.",de=this.trees[X];if(!de)throw new Error(ie);const fe=de.data;if(U*this.stride>=fe.length)throw new Error(ie);const _e=this.options.radius/(this.options.extent*Math.pow(2,X-1)),ue=de.within(fe[U*this.stride],fe[U*this.stride+1],_e),Me=[];for(const ze of ue){const Ee=ze*this.stride;fe[Ee+4]===H&&Me.push(fe[Ee+pn]>1?Pn(fe,Ee,this.clusterProps):this.points[fe[Ee+vn]])}if(Me.length===0)throw new Error(ie);return Me}getLeaves(H,U,X){const ie=[];return this._appendLeaves(ie,H,U=U||10,X=X||0,0),ie}getTile(H,U,X){const ie=this.trees[this._limitZoom(H)],de=Math.pow(2,H),{extent:fe,radius:_e}=this.options,ue=_e/fe,Me=(X-ue)/de,ze=(X+1+ue)/de,Ee={features:[]};return this._addTileFeatures(ie.range((U-ue)/de,Me,(U+1+ue)/de,ze),ie.data,U,X,de,Ee),U===0&&this._addTileFeatures(ie.range(1-ue/de,Me,1,ze),ie.data,de,X,de,Ee),U===de-1&&this._addTileFeatures(ie.range(0,Me,ue/de,ze),ie.data,-1,X,de,Ee),Ee.features.length?Ee:null}getClusterExpansionZoom(H){let U=this._getOriginZoom(H)-1;for(;U<=this.options.maxZoom;){const X=this.getChildren(H);if(U++,X.length!==1)break;H=X[0].properties.cluster_id}return U}_appendLeaves(H,U,X,ie,de){const fe=this.getChildren(U);for(const _e of fe){const ue=_e.properties;if(ue&&ue.cluster?de+ue.point_count<=ie?de+=ue.point_count:de=this._appendLeaves(H,ue.cluster_id,X,ie,de):de<ie?de++:H.push(_e),H.length===X)break}return de}_createTree(H){const U=new u.av(H.length/this.stride|0,this.options.nodeSize,Float32Array);for(let X=0;X<H.length;X+=this.stride)U.add(H[X],H[X+1]);return U.finish(),U.data=H,U}_addTileFeatures(H,U,X,ie,de,fe){for(const _e of H){const ue=_e*this.stride,Me=U[ue+pn]>1;let ze,Ee,We;if(Me)ze=Ln(U,ue,this.clusterProps),Ee=U[ue],We=U[ue+1];else{const an=this.points[U[ue+vn]];ze=an.properties;const[Lt,ln]=an.geometry.coordinates;Ee=Ce(Lt),We=He(ln)}const xt={type:1,geometry:[[Math.round(this.options.extent*(Ee*de-X)),Math.round(this.options.extent*(We*de-ie))]],tags:ze};let kt;kt=Me||this.options.generateId?U[ue+vn]:this.points[U[ue+vn]].id,kt!==void 0&&(xt.id=kt),fe.features.push(xt)}}_limitZoom(H){return Math.max(this.options.minZoom,Math.min(Math.floor(+H),this.options.maxZoom+1))}_cluster(H,U){const{radius:X,extent:ie,reduce:de,minPoints:fe}=this.options,_e=X/(ie*Math.pow(2,U)),ue=H.data,Me=[],ze=this.stride;for(let Ee=0;Ee<ue.length;Ee+=ze){if(ue[Ee+2]<=U)continue;ue[Ee+2]=U;const We=ue[Ee],xt=ue[Ee+1],kt=H.within(ue[Ee],ue[Ee+1],_e),an=ue[Ee+pn];let Lt=an;for(const ln of kt){const Kt=ln*ze;ue[Kt+2]>U&&(Lt+=ue[Kt+pn])}if(Lt>an&&Lt>=fe){let ln,Kt=We*an,oi=xt*an,Zn=-1;const Ut=((Ee/ze|0)<<5)+(U+1)+this.points.length;for(const wn of kt){const qn=wn*ze;if(ue[qn+2]<=U)continue;ue[qn+2]=U;const gi=ue[qn+pn];Kt+=ue[qn]*gi,oi+=ue[qn+1]*gi,ue[qn+4]=Ut,de&&(ln||(ln=this._map(ue,Ee,!0),Zn=this.clusterProps.length,this.clusterProps.push(ln)),de(ln,this._map(ue,qn)))}ue[Ee+4]=Ut,Me.push(Kt/Lt,oi/Lt,1/0,Ut,-1,Lt),de&&Me.push(Zn)}else{for(let ln=0;ln<ze;ln++)Me.push(ue[Ee+ln]);if(Lt>1)for(const ln of kt){const Kt=ln*ze;if(!(ue[Kt+2]<=U)){ue[Kt+2]=U;for(let oi=0;oi<ze;oi++)Me.push(ue[Kt+oi])}}}}return Me}_getOriginId(H){return H-this.points.length>>5}_getOriginZoom(H){return(H-this.points.length)%32}_map(H,U,X){if(H[U+pn]>1){const fe=this.clusterProps[H[U+ti]];return X?Object.assign({},fe):fe}const ie=this.points[H[U+vn]].properties,de=this.options.map(ie);return X&&de===ie?Object.assign({},de):de}}function Pn(se,H,U){return{type:"Feature",id:se[H+vn],properties:Ln(se,H,U),geometry:{type:"Point",coordinates:[(X=se[H],360*(X-.5)),Ke(se[H+1])]}};var X}function Ln(se,H,U){const X=se[H+pn],ie=X>=1e4?`${Math.round(X/1e3)}k`:X>=1e3?Math.round(X/100)/10+"k":X,de=se[H+ti],fe=de===-1?{}:Object.assign({},U[de]);return Object.assign(fe,{cluster:!0,cluster_id:se[H+vn],point_count:X,point_count_abbreviated:ie})}function Ce(se){return se/360+.5}function He(se){const H=Math.sin(se*Math.PI/180),U=.5-.25*Math.log((1+H)/(1-H))/Math.PI;return U<0?0:U>1?1:U}function Ke(se){const H=(180-360*se)*Math.PI/180;return 360*Math.atan(Math.exp(H))/Math.PI-90}function Be(se,H,U,X){let ie=X;const de=H+(U-H>>1);let fe,_e=U-H;const ue=se[H],Me=se[H+1],ze=se[U],Ee=se[U+1];for(let We=H+3;We<U;We+=3){const xt=Rt(se[We],se[We+1],ue,Me,ze,Ee);if(xt>ie)fe=We,ie=xt;else if(xt===ie){const kt=Math.abs(We-de);kt<_e&&(fe=We,_e=kt)}}ie>X&&(fe-H>3&&Be(se,H,fe,X),se[fe+2]=ie,U-fe>3&&Be(se,fe,U,X))}function Rt(se,H,U,X,ie,de){let fe=ie-U,_e=de-X;if(fe!==0||_e!==0){const ue=((se-U)*fe+(H-X)*_e)/(fe*fe+_e*_e);ue>1?(U=ie,X=de):ue>0&&(U+=fe*ue,X+=_e*ue)}return fe=se-U,_e=H-X,fe*fe+_e*_e}function Qt(se,H,U,X){const ie={id:se??null,type:H,geometry:U,tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(H==="Point"||H==="MultiPoint"||H==="LineString")At(ie,U);else if(H==="Polygon")At(ie,U[0]);else if(H==="MultiLineString")for(const de of U)At(ie,de);else if(H==="MultiPolygon")for(const de of U)At(ie,de[0]);return ie}function At(se,H){for(let U=0;U<H.length;U+=3)se.minX=Math.min(se.minX,H[U]),se.minY=Math.min(se.minY,H[U+1]),se.maxX=Math.max(se.maxX,H[U]),se.maxY=Math.max(se.maxY,H[U+1])}function Mt(se,H,U,X){if(!H.geometry)return;const ie=H.geometry.coordinates;if(ie&&ie.length===0)return;const de=H.geometry.type,fe=Math.pow(U.tolerance/((1<<U.maxZoom)*U.extent),2);let _e=[],ue=H.id;if(U.promoteId?ue=H.properties[U.promoteId]:U.generateId&&(ue=X||0),de==="Point")rn(ie,_e);else if(de==="MultiPoint")for(const Me of ie)rn(Me,_e);else if(de==="LineString")we(ie,_e,fe,!1);else if(de==="MultiLineString"){if(U.lineMetrics){for(const Me of ie)_e=[],we(Me,_e,fe,!1),se.push(Qt(ue,"LineString",_e,H.properties));return}yn(ie,_e,fe,!1)}else if(de==="Polygon")yn(ie,_e,fe,!0);else{if(de!=="MultiPolygon"){if(de==="GeometryCollection"){for(const Me of H.geometry.geometries)Mt(se,{id:ue,geometry:Me,properties:H.properties},U,X);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Me of ie){const ze=[];yn(Me,ze,fe,!0),_e.push(ze)}}se.push(Qt(ue,de,_e,H.properties))}function rn(se,H){H.push(pr(se[0]),qt(se[1]),0)}function we(se,H,U,X){let ie,de,fe=0;for(let ue=0;ue<se.length;ue++){const Me=pr(se[ue][0]),ze=qt(se[ue][1]);H.push(Me,ze,0),ue>0&&(fe+=X?(ie*ze-Me*de)/2:Math.sqrt(Math.pow(Me-ie,2)+Math.pow(ze-de,2))),ie=Me,de=ze}const _e=H.length-3;H[2]=1,Be(H,0,_e,U),H[_e+2]=1,H.size=Math.abs(fe),H.start=0,H.end=H.size}function yn(se,H,U,X){for(let ie=0;ie<se.length;ie++){const de=[];we(se[ie],de,U,X),H.push(de)}}function pr(se){return se/360+.5}function qt(se){const H=Math.sin(se*Math.PI/180),U=.5-.25*Math.log((1+H)/(1-H))/Math.PI;return U<0?0:U>1?1:U}function sn(se,H,U,X,ie,de,fe,_e){if(X/=H,de>=(U/=H)&&fe<X)return se;if(fe<U||de>=X)return null;const ue=[];for(const Me of se){const ze=Me.geometry;let Ee=Me.type;const We=ie===0?Me.minX:Me.minY,xt=ie===0?Me.maxX:Me.maxY;if(We>=U&&xt<X){ue.push(Me);continue}if(xt<U||We>=X)continue;let kt=[];if(Ee==="Point"||Ee==="MultiPoint")vi(ze,kt,U,X,ie);else if(Ee==="LineString")ui(ze,kt,U,X,ie,!1,_e.lineMetrics);else if(Ee==="MultiLineString")Or(ze,kt,U,X,ie,!1);else if(Ee==="Polygon")Or(ze,kt,U,X,ie,!0);else if(Ee==="MultiPolygon")for(const an of ze){const Lt=[];Or(an,Lt,U,X,ie,!0),Lt.length&&kt.push(Lt)}if(kt.length){if(_e.lineMetrics&&Ee==="LineString"){for(const an of kt)ue.push(Qt(Me.id,Ee,an,Me.tags));continue}Ee!=="LineString"&&Ee!=="MultiLineString"||(kt.length===1?(Ee="LineString",kt=kt[0]):Ee="MultiLineString"),Ee!=="Point"&&Ee!=="MultiPoint"||(Ee=kt.length===3?"Point":"MultiPoint"),ue.push(Qt(Me.id,Ee,kt,Me.tags))}}return ue.length?ue:null}function vi(se,H,U,X,ie){for(let de=0;de<se.length;de+=3){const fe=se[de+ie];fe>=U&&fe<=X&&wi(H,se[de],se[de+1],se[de+2])}}function ui(se,H,U,X,ie,de,fe){let _e=mi(se);const ue=ie===0?Eo:Co;let Me,ze,Ee=se.start;for(let Lt=0;Lt<se.length-3;Lt+=3){const ln=se[Lt],Kt=se[Lt+1],oi=se[Lt+2],Zn=se[Lt+3],Ut=se[Lt+4],wn=ie===0?ln:Kt,qn=ie===0?Zn:Ut;let gi=!1;fe&&(Me=Math.sqrt(Math.pow(ln-Zn,2)+Math.pow(Kt-Ut,2))),wn<U?qn>U&&(ze=ue(_e,ln,Kt,Zn,Ut,U),fe&&(_e.start=Ee+Me*ze)):wn>X?qn<X&&(ze=ue(_e,ln,Kt,Zn,Ut,X),fe&&(_e.start=Ee+Me*ze)):wi(_e,ln,Kt,oi),qn<U&&wn>=U&&(ze=ue(_e,ln,Kt,Zn,Ut,U),gi=!0),qn>X&&wn<=X&&(ze=ue(_e,ln,Kt,Zn,Ut,X),gi=!0),!de&&gi&&(fe&&(_e.end=Ee+Me*ze),H.push(_e),_e=mi(se)),fe&&(Ee+=Me)}let We=se.length-3;const xt=se[We],kt=se[We+1],an=ie===0?xt:kt;an>=U&&an<=X&&wi(_e,xt,kt,se[We+2]),We=_e.length-3,de&&We>=3&&(_e[We]!==_e[0]||_e[We+1]!==_e[1])&&wi(_e,_e[0],_e[1],_e[2]),_e.length&&H.push(_e)}function mi(se){const H=[];return H.size=se.size,H.start=se.start,H.end=se.end,H}function Or(se,H,U,X,ie,de){for(const fe of se)ui(fe,H,U,X,ie,de,!1)}function wi(se,H,U,X){se.push(H,U,X)}function Eo(se,H,U,X,ie,de){const fe=(de-H)/(X-H);return wi(se,de,U+(ie-U)*fe,1),fe}function Co(se,H,U,X,ie,de){const fe=(de-U)/(ie-U);return wi(se,H+(X-H)*fe,de,1),fe}function Ve(se,H){const U=[];for(let X=0;X<se.length;X++){const ie=se[X],de=ie.type;let fe;if(de==="Point"||de==="MultiPoint"||de==="LineString")fe=Br(ie.geometry,H);else if(de==="MultiLineString"||de==="Polygon"){fe=[];for(const _e of ie.geometry)fe.push(Br(_e,H))}else if(de==="MultiPolygon"){fe=[];for(const _e of ie.geometry){const ue=[];for(const Me of _e)ue.push(Br(Me,H));fe.push(ue)}}U.push(Qt(ie.id,de,fe,ie.tags))}return U}function Br(se,H){const U=[];U.size=se.size,se.start!==void 0&&(U.start=se.start,U.end=se.end);for(let X=0;X<se.length;X+=3)U.push(se[X]+H,se[X+1],se[X+2]);return U}function ki(se,H){if(se.transformed)return se;const U=1<<se.z,X=se.x,ie=se.y;for(const de of se.features){const fe=de.geometry,_e=de.type;if(de.geometry=[],_e===1)for(let ue=0;ue<fe.length;ue+=2)de.geometry.push(zr(fe[ue],fe[ue+1],H,U,X,ie));else for(let ue=0;ue<fe.length;ue++){const Me=[];for(let ze=0;ze<fe[ue].length;ze+=2)Me.push(zr(fe[ue][ze],fe[ue][ze+1],H,U,X,ie));de.geometry.push(Me)}}return se.transformed=!0,se}function zr(se,H,U,X,ie,de){return[Math.round(U*(se*X-ie)),Math.round(U*(H*X-de))]}function To(se,H,U,X,ie){const de=H===ie.maxZoom?0:ie.tolerance/((1<<H)*ie.extent),fe={features:[],numPoints:0,numSimplified:0,numFeatures:se.length,source:null,x:U,y:X,z:H,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const _e of se)Ze(fe,_e,de,ie);return fe}function Ze(se,H,U,X){const ie=H.geometry,de=H.type,fe=[];if(se.minX=Math.min(se.minX,H.minX),se.minY=Math.min(se.minY,H.minY),se.maxX=Math.max(se.maxX,H.maxX),se.maxY=Math.max(se.maxY,H.maxY),de==="Point"||de==="MultiPoint")for(let _e=0;_e<ie.length;_e+=3)fe.push(ie[_e],ie[_e+1]),se.numPoints++,se.numSimplified++;else if(de==="LineString")ke(fe,ie,se,U,!1,!1);else if(de==="MultiLineString"||de==="Polygon")for(let _e=0;_e<ie.length;_e++)ke(fe,ie[_e],se,U,de==="Polygon",_e===0);else if(de==="MultiPolygon")for(let _e=0;_e<ie.length;_e++){const ue=ie[_e];for(let Me=0;Me<ue.length;Me++)ke(fe,ue[Me],se,U,!0,Me===0)}if(fe.length){let _e=H.tags||null;if(de==="LineString"&&X.lineMetrics){_e={};for(const Me in H.tags)_e[Me]=H.tags[Me];_e.mapbox_clip_start=ie.start/ie.size,_e.mapbox_clip_end=ie.end/ie.size}const ue={geometry:fe,type:de==="Polygon"||de==="MultiPolygon"?3:de==="LineString"||de==="MultiLineString"?2:1,tags:_e};H.id!==null&&(ue.id=H.id),se.features.push(ue)}}function ke(se,H,U,X,ie,de){const fe=X*X;if(X>0&&H.size<(ie?fe:X))return void(U.numPoints+=H.length/3);const _e=[];for(let ue=0;ue<H.length;ue+=3)(X===0||H[ue+2]>fe)&&(U.numSimplified++,_e.push(H[ue],H[ue+1])),U.numPoints++;ie&&function(ue,Me){let ze=0;for(let Ee=0,We=ue.length,xt=We-2;Ee<We;xt=Ee,Ee+=2)ze+=(ue[Ee]-ue[xt])*(ue[Ee+1]+ue[xt+1]);if(ze>0===Me)for(let Ee=0,We=ue.length;Ee<We/2;Ee+=2){const xt=ue[Ee],kt=ue[Ee+1];ue[Ee]=ue[We-2-Ee],ue[Ee+1]=ue[We-1-Ee],ue[We-2-Ee]=xt,ue[We-1-Ee]=kt}}(_e,de),se.push(_e)}const Le={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class vt{constructor(H,U){const X=(U=this.options=function(de,fe){for(const _e in fe)de[_e]=fe[_e];return de}(Object.create(Le),U)).debug;if(X&&console.time("preprocess data"),U.maxZoom<0||U.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(U.promoteId&&U.generateId)throw new Error("promoteId and generateId cannot be used together.");let ie=function(de,fe){const _e=[];if(de.type==="FeatureCollection")for(let ue=0;ue<de.features.length;ue++)Mt(_e,de.features[ue],fe,ue);else Mt(_e,de.type==="Feature"?de:{geometry:de},fe);return _e}(H,U);this.tiles={},this.tileCoords=[],X&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",U.indexMaxZoom,U.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ie=function(de,fe){const _e=fe.buffer/fe.extent;let ue=de;const Me=sn(de,1,-1-_e,_e,0,-1,2,fe),ze=sn(de,1,1-_e,2+_e,0,-1,2,fe);return(Me||ze)&&(ue=sn(de,1,-_e,1+_e,0,-1,2,fe)||[],Me&&(ue=Ve(Me,1).concat(ue)),ze&&(ue=ue.concat(Ve(ze,-1)))),ue}(ie,U),ie.length&&this.splitTile(ie,0,0,0),X&&(ie.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(H,U,X,ie,de,fe,_e){const ue=[H,U,X,ie],Me=this.options,ze=Me.debug;for(;ue.length;){ie=ue.pop(),X=ue.pop(),U=ue.pop(),H=ue.pop();const Ee=1<<U,We=Wt(U,X,ie);let xt=this.tiles[We];if(!xt&&(ze>1&&console.time("creation"),xt=this.tiles[We]=To(H,U,X,ie,Me),this.tileCoords.push({z:U,x:X,y:ie}),ze)){ze>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",U,X,ie,xt.numFeatures,xt.numPoints,xt.numSimplified),console.timeEnd("creation"));const gi=`z${U}`;this.stats[gi]=(this.stats[gi]||0)+1,this.total++}if(xt.source=H,de==null){if(U===Me.indexMaxZoom||xt.numPoints<=Me.indexMaxPoints)continue}else{if(U===Me.maxZoom||U===de)continue;if(de!=null){const gi=de-U;if(X!==fe>>gi||ie!==_e>>gi)continue}}if(xt.source=null,H.length===0)continue;ze>1&&console.time("clipping");const kt=.5*Me.buffer/Me.extent,an=.5-kt,Lt=.5+kt,ln=1+kt;let Kt=null,oi=null,Zn=null,Ut=null,wn=sn(H,Ee,X-kt,X+Lt,0,xt.minX,xt.maxX,Me),qn=sn(H,Ee,X+an,X+ln,0,xt.minX,xt.maxX,Me);H=null,wn&&(Kt=sn(wn,Ee,ie-kt,ie+Lt,1,xt.minY,xt.maxY,Me),oi=sn(wn,Ee,ie+an,ie+ln,1,xt.minY,xt.maxY,Me),wn=null),qn&&(Zn=sn(qn,Ee,ie-kt,ie+Lt,1,xt.minY,xt.maxY,Me),Ut=sn(qn,Ee,ie+an,ie+ln,1,xt.minY,xt.maxY,Me),qn=null),ze>1&&console.timeEnd("clipping"),ue.push(Kt||[],U+1,2*X,2*ie),ue.push(oi||[],U+1,2*X,2*ie+1),ue.push(Zn||[],U+1,2*X+1,2*ie),ue.push(Ut||[],U+1,2*X+1,2*ie+1)}}getTile(H,U,X){H=+H,U=+U,X=+X;const ie=this.options,{extent:de,debug:fe}=ie;if(H<0||H>24)return null;const _e=1<<H,ue=Wt(H,U=U+_e&_e-1,X);if(this.tiles[ue])return ki(this.tiles[ue],de);fe>1&&console.log("drilling down to z%d-%d-%d",H,U,X);let Me,ze=H,Ee=U,We=X;for(;!Me&&ze>0;)ze--,Ee>>=1,We>>=1,Me=this.tiles[Wt(ze,Ee,We)];return Me&&Me.source?(fe>1&&(console.log("found parent tile z%d-%d-%d",ze,Ee,We),console.time("drilling down")),this.splitTile(Me.source,ze,Ee,We,H,U,X),fe>1&&console.timeEnd("drilling down"),this.tiles[ue]?ki(this.tiles[ue],de):null):null}}function Wt(se,H,U){return 32*((1<<se)*U+H)+se}function tt(se,H){return H?se.properties[H]:se.id}function Rn(se,H){if(se==null)return!0;if(se.type==="Feature")return tt(se,H)!=null;if(se.type==="FeatureCollection"){const U=new Set;for(const X of se.features){const ie=tt(X,H);if(ie==null||U.has(ie))return!1;U.add(ie)}return!0}return!1}function Kn(se,H){const U=new Map;if(se!=null)if(se.type==="Feature")U.set(tt(se,H),se);else for(const X of se.features)U.set(tt(X,H),X);return U}class qi extends E{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(H,U){return u._(this,void 0,void 0,function*(){const X=H.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ie=this._geoJSONIndex.getTile(X.z,X.x,X.y);if(!ie)return null;const de=new class{constructor(_e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=u.X,this.length=_e.length,this._features=_e}feature(_e){return new class{constructor(ue){this._feature=ue,this.extent=u.X,this.type=ue.type,this.properties=ue.tags,"id"in ue&&!isNaN(ue.id)&&(this.id=parseInt(ue.id,10))}loadGeometry(){if(this._feature.type===1){const ue=[];for(const Me of this._feature.geometry)ue.push([new u.P(Me[0],Me[1])]);return ue}{const ue=[];for(const Me of this._feature.geometry){const ze=[];for(const Ee of Me)ze.push(new u.P(Ee[0],Ee[1]));ue.push(ze)}return ue}}toGeoJSON(ue,Me,ze){return $.call(this,ue,Me,ze)}}(this._features[_e])}}(ie.features);let fe=Ft(de);return fe.byteOffset===0&&fe.byteLength===fe.buffer.byteLength||(fe=new Uint8Array(fe)),{vectorTile:de,rawData:fe.buffer}})}loadData(H){return u._(this,void 0,void 0,function*(){var U;(U=this._pendingRequest)===null||U===void 0||U.abort();const X=!!(H&&H.request&&H.request.collectResourceTiming)&&new u.bv(H.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(H,this._pendingRequest),this._geoJSONIndex=H.cluster?new Nn(function({superclusterOptions:fe,clusterProperties:_e}){if(!_e||!fe)return fe;const ue={},Me={},ze={accumulated:null,zoom:0},Ee={properties:null},We=Object.keys(_e);for(const xt of We){const[kt,an]=_e[xt],Lt=u.bC(an),ln=u.bC(typeof kt=="string"?[kt,["accumulated"],["get",xt]]:kt);ue[xt]=Lt.value,Me[xt]=ln.value}return fe.map=xt=>{Ee.properties=xt;const kt={};for(const an of We)kt[an]=ue[an].evaluate(ze,Ee);return kt},fe.reduce=(xt,kt)=>{Ee.properties=kt;for(const an of We)ze.accumulated=xt[an],xt[an]=Me[an].evaluate(ze,Ee)},fe}(H)).load((yield this._pendingData).features):(ie=yield this._pendingData,new vt(ie,H.geojsonVtOptions)),this.loaded={};const de={};if(X){const fe=X.finish();fe&&(de.resourceTiming={},de.resourceTiming[H.source]=JSON.parse(JSON.stringify(fe)))}return de}catch(de){if(delete this._pendingRequest,u.bB(de))return{abandoned:!0};throw de}var ie})}getData(){return u._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(H){const U=this.loaded;return U&&U[H.uid]?super.reloadTile(H):this.loadTile(H)}loadAndProcessGeoJSON(H,U){return u._(this,void 0,void 0,function*(){let X=yield this.loadGeoJSON(H,U);if(delete this._pendingRequest,typeof X!="object")throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(L(X,!0),H.filter){const ie=u.bC(H.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ie.result==="error")throw new Error(ie.value.map(fe=>`${fe.key}: ${fe.message}`).join(", "));X={type:"FeatureCollection",features:X.features.filter(fe=>ie.value.evaluate({zoom:0},fe))}}return X})}loadGeoJSON(H,U){return u._(this,void 0,void 0,function*(){const{promoteId:X}=H;if(H.request){const ie=yield u.h(H.request,U);return this._dataUpdateable=Rn(ie.data,X)?Kn(ie.data,X):void 0,ie.data}if(typeof H.data=="string")try{const ie=JSON.parse(H.data);return this._dataUpdateable=Rn(ie,X)?Kn(ie,X):void 0,ie}catch{throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`)}if(!H.dataDiff)throw new Error(`Input data given to '${H.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${H.source}`);return function(ie,de,fe){var _e,ue,Me,ze;if(de.removeAll&&ie.clear(),de.remove)for(const Ee of de.remove)ie.delete(Ee);if(de.add)for(const Ee of de.add){const We=tt(Ee,fe);We!=null&&ie.set(We,Ee)}if(de.update)for(const Ee of de.update){let We=ie.get(Ee.id);if(We==null)continue;const xt=!Ee.removeAllProperties&&(((_e=Ee.removeProperties)===null||_e===void 0?void 0:_e.length)>0||((ue=Ee.addOrUpdateProperties)===null||ue===void 0?void 0:ue.length)>0);if((Ee.newGeometry||Ee.removeAllProperties||xt)&&(We=Object.assign({},We),ie.set(Ee.id,We),xt&&(We.properties=Object.assign({},We.properties))),Ee.newGeometry&&(We.geometry=Ee.newGeometry),Ee.removeAllProperties)We.properties={};else if(((Me=Ee.removeProperties)===null||Me===void 0?void 0:Me.length)>0)for(const kt of Ee.removeProperties)Object.prototype.hasOwnProperty.call(We.properties,kt)&&delete We.properties[kt];if(((ze=Ee.addOrUpdateProperties)===null||ze===void 0?void 0:ze.length)>0)for(const{key:kt,value:an}of Ee.addOrUpdateProperties)We.properties[kt]=an}}(this._dataUpdateable,H.dataDiff,X),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(H){return u._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(H){return this._geoJSONIndex.getClusterExpansionZoom(H.clusterId)}getClusterChildren(H){return this._geoJSONIndex.getChildren(H.clusterId)}getClusterLeaves(H){return this._geoJSONIndex.getLeaves(H.clusterId,H.limit,H.offset)}}class fr{constructor(H){this.self=H,this.actor=new u.F(H),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(U,X)=>{if(this.externalWorkerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.externalWorkerSourceTypes[U]=X},this.self.addProtocol=u.bi,this.self.removeProtocol=u.bj,this.self.registerRTLTextPlugin=U=>{if(u.bD.isParsed())throw new Error("RTL text plugin already registered.");u.bD.setMethods(U)},this.actor.registerMessageHandler("LDT",(U,X)=>this._getDEMWorkerSource(U,X.source).loadTile(X)),this.actor.registerMessageHandler("RDT",(U,X)=>u._(this,void 0,void 0,function*(){this._getDEMWorkerSource(U,X.source).removeTile(X)})),this.actor.registerMessageHandler("GCEZ",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterExpansionZoom(X)})),this.actor.registerMessageHandler("GCC",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterChildren(X)})),this.actor.registerMessageHandler("GCL",(U,X)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(U,X.type,X.source).getClusterLeaves(X)})),this.actor.registerMessageHandler("LD",(U,X)=>this._getWorkerSource(U,X.type,X.source).loadData(X)),this.actor.registerMessageHandler("GD",(U,X)=>this._getWorkerSource(U,X.type,X.source).getData()),this.actor.registerMessageHandler("LT",(U,X)=>this._getWorkerSource(U,X.type,X.source).loadTile(X)),this.actor.registerMessageHandler("RT",(U,X)=>this._getWorkerSource(U,X.type,X.source).reloadTile(X)),this.actor.registerMessageHandler("AT",(U,X)=>this._getWorkerSource(U,X.type,X.source).abortTile(X)),this.actor.registerMessageHandler("RMT",(U,X)=>this._getWorkerSource(U,X.type,X.source).removeTile(X)),this.actor.registerMessageHandler("RS",(U,X)=>u._(this,void 0,void 0,function*(){if(!this.workerSources[U]||!this.workerSources[U][X.type]||!this.workerSources[U][X.type][X.source])return;const ie=this.workerSources[U][X.type][X.source];delete this.workerSources[U][X.type][X.source],ie.removeSource!==void 0&&ie.removeSource(X)})),this.actor.registerMessageHandler("RM",U=>u._(this,void 0,void 0,function*(){delete this.layerIndexes[U],delete this.availableImages[U],delete this.workerSources[U],delete this.demWorkerSources[U]})),this.actor.registerMessageHandler("SR",(U,X)=>u._(this,void 0,void 0,function*(){this.referrer=X})),this.actor.registerMessageHandler("SRPS",(U,X)=>this._syncRTLPluginState(U,X)),this.actor.registerMessageHandler("IS",(U,X)=>u._(this,void 0,void 0,function*(){this.self.importScripts(X)})),this.actor.registerMessageHandler("SI",(U,X)=>this._setImages(U,X)),this.actor.registerMessageHandler("UL",(U,X)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(U).update(X.layers,X.removedIds)})),this.actor.registerMessageHandler("SL",(U,X)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(U).replace(X)}))}_setImages(H,U){return u._(this,void 0,void 0,function*(){this.availableImages[H]=U;for(const X in this.workerSources[H]){const ie=this.workerSources[H][X];for(const de in ie)ie[de].availableImages=U}})}_syncRTLPluginState(H,U){return u._(this,void 0,void 0,function*(){if(u.bD.isParsed())return u.bD.getState();if(U.pluginStatus!=="loading")return u.bD.setState(U),U;const X=U.pluginURL;if(this.self.importScripts(X),u.bD.isParsed()){const ie={pluginStatus:"loaded",pluginURL:X};return u.bD.setState(ie),ie}throw u.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${X}`)})}_getAvailableImages(H){let U=this.availableImages[H];return U||(U=[]),U}_getLayerIndex(H){let U=this.layerIndexes[H];return U||(U=this.layerIndexes[H]=new l),U}_getWorkerSource(H,U,X){if(this.workerSources[H]||(this.workerSources[H]={}),this.workerSources[H][U]||(this.workerSources[H][U]={}),!this.workerSources[H][U][X]){const ie={sendAsync:(de,fe)=>(de.targetMapId=H,this.actor.sendAsync(de,fe))};switch(U){case"vector":this.workerSources[H][U][X]=new E(ie,this._getLayerIndex(H),this._getAvailableImages(H));break;case"geojson":this.workerSources[H][U][X]=new qi(ie,this._getLayerIndex(H),this._getAvailableImages(H));break;default:this.workerSources[H][U][X]=new this.externalWorkerSourceTypes[U](ie,this._getLayerIndex(H),this._getAvailableImages(H))}}return this.workerSources[H][U][X]}_getDEMWorkerSource(H,U){return this.demWorkerSources[H]||(this.demWorkerSources[H]={}),this.demWorkerSources[H][U]||(this.demWorkerSources[H][U]=new C),this.demWorkerSources[H][U]}}return u.i(self)&&(self.worker=new fr(self)),fr}),r("index",["exports","./shared"],function(u,l){var g="4.7.1";let b,w;const E={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:v=>new Promise((o,d)=>{const m=requestAnimationFrame(o);v.signal.addEventListener("abort",()=>{cancelAnimationFrame(m),d(l.c())})}),getImageData(v,o=0){return this.getImageCanvasContext(v).getImageData(-o,-o,v.width+2*o,v.height+2*o)},getImageCanvasContext(v){const o=window.document.createElement("canvas"),d=o.getContext("2d",{willReadFrequently:!0});if(!d)throw new Error("failed to create canvas 2d context");return o.width=v.width,o.height=v.height,d.drawImage(v,0,0,v.width,v.height),d},resolveURL:v=>(b||(b=document.createElement("a")),b.href=v,b.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(w==null&&(w=matchMedia("(prefers-reduced-motion: reduce)")),w.matches)}};class C{static testProp(o){if(!C.docStyle)return o[0];for(let d=0;d<o.length;d++)if(o[d]in C.docStyle)return o[d];return o[0]}static create(o,d,m){const y=window.document.createElement(o);return d!==void 0&&(y.className=d),m&&m.appendChild(y),y}static createNS(o,d){return window.document.createElementNS(o,d)}static disableDrag(){C.docStyle&&C.selectProp&&(C.userSelect=C.docStyle[C.selectProp],C.docStyle[C.selectProp]="none")}static enableDrag(){C.docStyle&&C.selectProp&&(C.docStyle[C.selectProp]=C.userSelect)}static setTransform(o,d){o.style[C.transformProp]=d}static addEventListener(o,d,m,y={}){o.addEventListener(d,m,"passive"in y?y:y.capture)}static removeEventListener(o,d,m,y={}){o.removeEventListener(d,m,"passive"in y?y:y.capture)}static suppressClickInternal(o){o.preventDefault(),o.stopPropagation(),window.removeEventListener("click",C.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",C.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",C.suppressClickInternal,!0)},0)}static getScale(o){const d=o.getBoundingClientRect();return{x:d.width/o.offsetWidth||1,y:d.height/o.offsetHeight||1,boundingClientRect:d}}static getPoint(o,d,m){const y=d.boundingClientRect;return new l.P((m.clientX-y.left)/d.x-o.clientLeft,(m.clientY-y.top)/d.y-o.clientTop)}static mousePos(o,d){const m=C.getScale(o);return C.getPoint(o,m,d)}static touchPos(o,d){const m=[],y=C.getScale(o);for(let x=0;x<d.length;x++)m.push(C.getPoint(o,y,d[x]));return m}static mouseButton(o){return o.button}static remove(o){o.parentNode&&o.parentNode.removeChild(o)}}C.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,C.selectProp=C.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),C.transformProp=C.testProp(["transform","WebkitTransform"]);const I={supported:!1,testSupport:function(v){!$&&L&&(W?te(v):D=v)}};let D,L,$=!1,W=!1;function te(v){const o=v.createTexture();v.bindTexture(v.TEXTURE_2D,o);try{if(v.texImage2D(v.TEXTURE_2D,0,v.RGBA,v.RGBA,v.UNSIGNED_BYTE,L),v.isContextLost())return;I.supported=!0}catch{}v.deleteTexture(o),$=!0}var G;typeof document<"u"&&(L=document.createElement("img"),L.onload=()=>{D&&te(D),D=null,W=!0},L.onerror=()=>{$=!0,D=null},L.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(v){let o,d,m,y;v.resetRequestQueue=()=>{o=[],d=0,m=0,y={}},v.addThrottleControl=O=>{const N=m++;return y[N]=O,N},v.removeThrottleControl=O=>{delete y[O],M()},v.getImage=(O,N,V=!0)=>new Promise((F,Z)=>{I.supported&&(O.headers||(O.headers={}),O.headers.accept="image/webp,*/*"),l.e(O,{type:"image"}),o.push({abortController:N,requestParameters:O,supportImageRefresh:V,state:"queued",onError:J=>{Z(J)},onSuccess:J=>{F(J)}}),M()});const x=O=>l._(this,void 0,void 0,function*(){O.state="running";const{requestParameters:N,supportImageRefresh:V,onError:F,onSuccess:Z,abortController:J}=O,ee=V===!1&&!l.i(self)&&!l.g(N.url)&&(!N.headers||Object.keys(N.headers).reduce((ce,he)=>ce&&he==="accept",!0));d++;const oe=ee?P(N,J):l.m(N,J);try{const ce=yield oe;delete O.abortController,O.state="completed",ce.data instanceof HTMLImageElement||l.b(ce.data)?Z(ce):ce.data&&Z({data:yield(le=ce.data,typeof createImageBitmap=="function"?l.d(le):l.f(le)),cacheControl:ce.cacheControl,expires:ce.expires})}catch(ce){delete O.abortController,F(ce)}finally{d--,M()}var le}),M=()=>{const O=(()=>{for(const N of Object.keys(y))if(y[N]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let N=d;N<O&&o.length>0;N++){const V=o.shift();V.abortController.signal.aborted?N--:x(V)}},P=(O,N)=>new Promise((V,F)=>{const Z=new Image,J=O.url,ee=O.credentials;ee&&ee==="include"?Z.crossOrigin="use-credentials":(ee&&ee==="same-origin"||!l.s(J))&&(Z.crossOrigin="anonymous"),N.signal.addEventListener("abort",()=>{Z.src="",F(l.c())}),Z.fetchPriority="high",Z.onload=()=>{Z.onerror=Z.onload=null,V({data:Z})},Z.onerror=()=>{Z.onerror=Z.onload=null,N.signal.aborted||F(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."))},Z.src=J})}(G||(G={})),G.resetRequestQueue();class Q{constructor(o){this._transformRequestFn=o}transformRequest(o,d){return this._transformRequestFn&&this._transformRequestFn(o,d)||{url:o}}setTransformRequest(o){this._transformRequestFn=o}}function Ie(v){var o=new l.A(3);return o[0]=v[0],o[1]=v[1],o[2]=v[2],o}var ve,Se=function(v,o,d){return v[0]=o[0]-d[0],v[1]=o[1]-d[1],v[2]=o[2]-d[2],v};ve=new l.A(3),l.A!=Float32Array&&(ve[0]=0,ve[1]=0,ve[2]=0);var Ne=function(v){var o=v[0],d=v[1];return o*o+d*d};function Ae(v){const o=[];if(typeof v=="string")o.push({id:"default",url:v});else if(v&&v.length>0){const d=[];for(const{id:m,url:y}of v){const x=`${m}${y}`;d.indexOf(x)===-1&&(d.push(x),o.push({id:m,url:y}))}}return o}function $e(v,o,d){const m=v.split("?");return m[0]+=`${o}${d}`,m.join("?")}(function(){var v=new l.A(2);l.A!=Float32Array&&(v[0]=0,v[1]=0)})();class Xe{constructor(o,d,m,y){this.context=o,this.format=m,this.texture=o.gl.createTexture(),this.update(d,y)}update(o,d,m){const{width:y,height:x}=o,M=!(this.size&&this.size[0]===y&&this.size[1]===x||m),{context:P}=this,{gl:O}=P;if(this.useMipmap=!!(d&&d.useMipmap),O.bindTexture(O.TEXTURE_2D,this.texture),P.pixelStoreUnpackFlipY.set(!1),P.pixelStoreUnpack.set(1),P.pixelStoreUnpackPremultiplyAlpha.set(this.format===O.RGBA&&(!d||d.premultiply!==!1)),M)this.size=[y,x],o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||l.b(o)?O.texImage2D(O.TEXTURE_2D,0,this.format,this.format,O.UNSIGNED_BYTE,o):O.texImage2D(O.TEXTURE_2D,0,this.format,y,x,0,this.format,O.UNSIGNED_BYTE,o.data);else{const{x:N,y:V}=m||{x:0,y:0};o instanceof HTMLImageElement||o instanceof HTMLCanvasElement||o instanceof HTMLVideoElement||o instanceof ImageData||l.b(o)?O.texSubImage2D(O.TEXTURE_2D,0,N,V,O.RGBA,O.UNSIGNED_BYTE,o):O.texSubImage2D(O.TEXTURE_2D,0,N,V,y,x,O.RGBA,O.UNSIGNED_BYTE,o.data)}this.useMipmap&&this.isSizePowerOfTwo()&&O.generateMipmap(O.TEXTURE_2D)}bind(o,d,m){const{context:y}=this,{gl:x}=y;x.bindTexture(x.TEXTURE_2D,this.texture),m!==x.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(m=x.LINEAR),o!==this.filter&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,o),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,m||o),this.filter=o),d!==this.wrap&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,d),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,d),this.wrap=d)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:o}=this.context;o.deleteTexture(this.texture),this.texture=null}}function Pt(v){const{userImage:o}=v;return!!(o&&o.render&&o.render())&&(v.data.replace(new Uint8Array(o.data.buffer)),!0)}class st extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(o){if(this.loaded!==o&&(this.loaded=o,o)){for(const{ids:d,promiseResolve:m}of this.requestors)m(this._getImagesForIds(d));this.requestors=[]}}getImage(o){const d=this.images[o];if(d&&!d.data&&d.spriteData){const m=d.spriteData;d.data=new l.R({width:m.width,height:m.height},m.context.getImageData(m.x,m.y,m.width,m.height).data),d.spriteData=null}return d}addImage(o,d){if(this.images[o])throw new Error(`Image id ${o} already exist, use updateImage instead`);this._validate(o,d)&&(this.images[o]=d)}_validate(o,d){let m=!0;const y=d.data||d.spriteData;return this._validateStretch(d.stretchX,y&&y.width)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "stretchX" value`))),m=!1),this._validateStretch(d.stretchY,y&&y.height)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "stretchY" value`))),m=!1),this._validateContent(d.content,d)||(this.fire(new l.j(new Error(`Image "${o}" has invalid "content" value`))),m=!1),m}_validateStretch(o,d){if(!o)return!0;let m=0;for(const y of o){if(y[0]<m||y[1]<y[0]||d<y[1])return!1;m=y[1]}return!0}_validateContent(o,d){if(!o)return!0;if(o.length!==4)return!1;const m=d.spriteData,y=m&&m.width||d.data.width,x=m&&m.height||d.data.height;return!(o[0]<0||y<o[0]||o[1]<0||x<o[1]||o[2]<0||y<o[2]||o[3]<0||x<o[3]||o[2]<o[0]||o[3]<o[1])}updateImage(o,d,m=!0){const y=this.getImage(o);if(m&&(y.data.width!==d.data.width||y.data.height!==d.data.height))throw new Error(`size mismatch between old image (${y.data.width}x${y.data.height}) and new image (${d.data.width}x${d.data.height}).`);d.version=y.version+1,this.images[o]=d,this.updatedImages[o]=!0}removeImage(o){const d=this.images[o];delete this.images[o],delete this.patterns[o],d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(o){return new Promise((d,m)=>{let y=!0;if(!this.isLoaded())for(const x of o)this.images[x]||(y=!1);this.isLoaded()||y?d(this._getImagesForIds(o)):this.requestors.push({ids:o,promiseResolve:d})})}_getImagesForIds(o){const d={};for(const m of o){let y=this.getImage(m);y||(this.fire(new l.k("styleimagemissing",{id:m})),y=this.getImage(m)),y?d[m]={data:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,textFitWidth:y.textFitWidth,textFitHeight:y.textFitHeight,hasRenderCallback:!!(y.userImage&&y.userImage.render)}:l.w(`Image "${m}" 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 d}getPixelSize(){const{width:o,height:d}=this.atlasImage;return{width:o,height:d}}getPattern(o){const d=this.patterns[o],m=this.getImage(o);if(!m)return null;if(d&&d.position.version===m.version)return d.position;if(d)d.position.version=m.version;else{const y={w:m.data.width+2,h:m.data.height+2,x:0,y:0},x=new l.I(y,m);this.patterns[o]={bin:y,position:x}}return this._updatePatternAtlas(),this.patterns[o].position}bind(o){const d=o.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Xe(o,this.atlasImage,d.RGBA),this.atlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE)}_updatePatternAtlas(){const o=[];for(const x in this.patterns)o.push(this.patterns[x].bin);const{w:d,h:m}=l.p(o),y=this.atlasImage;y.resize({width:d||1,height:m||1});for(const x in this.patterns){const{bin:M}=this.patterns[x],P=M.x+1,O=M.y+1,N=this.getImage(x).data,V=N.width,F=N.height;l.R.copy(N,y,{x:0,y:0},{x:P,y:O},{width:V,height:F}),l.R.copy(N,y,{x:0,y:F-1},{x:P,y:O-1},{width:V,height:1}),l.R.copy(N,y,{x:0,y:0},{x:P,y:O+F},{width:V,height:1}),l.R.copy(N,y,{x:V-1,y:0},{x:P-1,y:O},{width:1,height:F}),l.R.copy(N,y,{x:0,y:0},{x:P+V,y:O},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(o){for(const d of o){if(this.callbackDispatchedThisFrame[d])continue;this.callbackDispatchedThisFrame[d]=!0;const m=this.getImage(d);m||l.w(`Image with ID: "${d}" was not found`),Pt(m)&&this.updateImage(d,m)}}}const Tt=1e20;function Nt(v,o,d,m,y,x,M,P,O){for(let N=o;N<o+m;N++)Vt(v,d*x+N,x,y,M,P,O);for(let N=d;N<d+y;N++)Vt(v,N*x+o,1,m,M,P,O)}function Vt(v,o,d,m,y,x,M){x[0]=0,M[0]=-Tt,M[1]=Tt,y[0]=v[o];for(let P=1,O=0,N=0;P<m;P++){y[P]=v[o+P*d];const V=P*P;do{const F=x[O];N=(y[P]-y[F]+V-F*F)/(P-F)/2}while(N<=M[O]&&--O>-1);O++,x[O]=P,M[O]=N,M[O+1]=Tt}for(let P=0,O=0;P<m;P++){for(;M[O+1]<P;)O++;const N=x[O],V=P-N;v[o+P*d]=y[N]+V*V}}class Ft{constructor(o,d){this.requestManager=o,this.localIdeographFontFamily=d,this.entries={}}setURL(o){this.url=o}getGlyphs(o){return l._(this,void 0,void 0,function*(){const d=[];for(const x in o)for(const M of o[x])d.push(this._getAndCacheGlyphsPromise(x,M));const m=yield Promise.all(d),y={};for(const{stack:x,id:M,glyph:P}of m)y[x]||(y[x]={}),y[x][M]=P&&{id:P.id,bitmap:P.bitmap.clone(),metrics:P.metrics};return y})}_getAndCacheGlyphsPromise(o,d){return l._(this,void 0,void 0,function*(){let m=this.entries[o];m||(m=this.entries[o]={glyphs:{},requests:{},ranges:{}});let y=m.glyphs[d];if(y!==void 0)return{stack:o,id:d,glyph:y};if(y=this._tinySDF(m,o,d),y)return m.glyphs[d]=y,{stack:o,id:d,glyph:y};const x=Math.floor(d/256);if(256*x>65535)throw new Error("glyphs > 65535 not supported");if(m.ranges[x])return{stack:o,id:d,glyph:y};if(!this.url)throw new Error("glyphsUrl is not set");if(!m.requests[x]){const P=Ft.loadGlyphRange(o,x,this.url,this.requestManager);m.requests[x]=P}const M=yield m.requests[x];for(const P in M)this._doesCharSupportLocalGlyph(+P)||(m.glyphs[+P]=M[+P]);return m.ranges[x]=!0,{stack:o,id:d,glyph:M[d]||null}})}_doesCharSupportLocalGlyph(o){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(o))}_tinySDF(o,d,m){const y=this.localIdeographFontFamily;if(!y||!this._doesCharSupportLocalGlyph(m))return;let x=o.tinySDF;if(!x){let P="400";/bold/i.test(d)?P="900":/medium/i.test(d)?P="500":/light/i.test(d)&&(P="200"),x=o.tinySDF=new Ft.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:y,fontWeight:P})}const M=x.draw(String.fromCharCode(m));return{id:m,bitmap:new l.o({width:M.width||60,height:M.height||60},M.data),metrics:{width:M.glyphWidth/2||24,height:M.glyphHeight/2||24,left:M.glyphLeft/2+.5||0,top:M.glyphTop/2-27.5||-8,advance:M.glyphAdvance/2||24,isDoubleResolution:!0}}}}Ft.loadGlyphRange=function(v,o,d,m){return l._(this,void 0,void 0,function*(){const y=256*o,x=y+255,M=m.transformRequest(d.replace("{fontstack}",v).replace("{range}",`${y}-${x}`),"Glyphs"),P=yield l.l(M,new AbortController);if(!P||!P.data)throw new Error(`Could not load glyph range. range: ${o}, ${y}-${x}`);const O={};for(const N of l.n(P.data))O[N.id]=N;return O})},Ft.TinySDF=class{constructor({fontSize:v=24,buffer:o=3,radius:d=8,cutoff:m=.25,fontFamily:y="sans-serif",fontWeight:x="normal",fontStyle:M="normal"}={}){this.buffer=o,this.cutoff=m,this.radius=d;const P=this.size=v+4*o,O=this._createCanvas(P),N=this.ctx=O.getContext("2d",{willReadFrequently:!0});N.font=`${M} ${x} ${v}px ${y}`,N.textBaseline="alphabetic",N.textAlign="left",N.fillStyle="black",this.gridOuter=new Float64Array(P*P),this.gridInner=new Float64Array(P*P),this.f=new Float64Array(P),this.z=new Float64Array(P+1),this.v=new Uint16Array(P)}_createCanvas(v){const o=document.createElement("canvas");return o.width=o.height=v,o}draw(v){const{width:o,actualBoundingBoxAscent:d,actualBoundingBoxDescent:m,actualBoundingBoxLeft:y,actualBoundingBoxRight:x}=this.ctx.measureText(v),M=Math.ceil(d),P=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(x-y))),O=Math.min(this.size-this.buffer,M+Math.ceil(m)),N=P+2*this.buffer,V=O+2*this.buffer,F=Math.max(N*V,0),Z=new Uint8ClampedArray(F),J={data:Z,width:N,height:V,glyphWidth:P,glyphHeight:O,glyphTop:M,glyphLeft:0,glyphAdvance:o};if(P===0||O===0)return J;const{ctx:ee,buffer:oe,gridInner:le,gridOuter:ce}=this;ee.clearRect(oe,oe,P,O),ee.fillText(v,oe,oe+M);const he=ee.getImageData(oe,oe,P,O);ce.fill(Tt,0,F),le.fill(0,0,F);for(let ne=0;ne<O;ne++)for(let me=0;me<P;me++){const ge=he.data[4*(ne*P+me)+3]/255;if(ge===0)continue;const xe=(ne+oe)*N+me+oe;if(ge===1)ce[xe]=0,le[xe]=Tt;else{const Oe=.5-ge;ce[xe]=Oe>0?Oe*Oe:0,le[xe]=Oe<0?Oe*Oe:0}}Nt(ce,0,0,N,V,N,this.f,this.v,this.z),Nt(le,oe,oe,P,O,N,this.f,this.v,this.z);for(let ne=0;ne<F;ne++){const me=Math.sqrt(ce[ne])-Math.sqrt(le[ne]);Z[ne]=Math.round(255-255*(me/this.radius+this.cutoff))}return J}};class Ht{constructor(){this.specification=l.v.light.position}possiblyEvaluate(o,d){return l.x(o.expression.evaluate(d))}interpolate(o,d,m){return{x:l.y.number(o.x,d.x,m),y:l.y.number(o.y,d.y,m),z:l.y.number(o.z,d.z,m)}}}let Cn;class dn extends l.E{constructor(o){super(),Cn=Cn||new l.q({anchor:new l.D(l.v.light.anchor),position:new Ht,color:new l.D(l.v.light.color),intensity:new l.D(l.v.light.intensity)}),this._transitionable=new l.T(Cn),this.setLight(o),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(o,d={}){if(!this._validate(l.r,o,d))for(const m in o){const y=o[m];m.endsWith("-transition")?this._transitionable.setTransition(m.slice(0,-11),y):this._transitionable.setValue(m,y)}}updateTransitions(o){this._transitioning=this._transitionable.transitioned(o,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(o){this.properties=this._transitioning.possiblyEvaluate(o)}_validate(o,d,m){return(!m||m.validate!==!1)&&l.t(this,o.call(l.u,{value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v}))}}const vn=new l.q({"sky-color":new l.D(l.v.sky["sky-color"]),"horizon-color":new l.D(l.v.sky["horizon-color"]),"fog-color":new l.D(l.v.sky["fog-color"]),"fog-ground-blend":new l.D(l.v.sky["fog-ground-blend"]),"horizon-fog-blend":new l.D(l.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new l.D(l.v.sky["sky-horizon-blend"]),"atmosphere-blend":new l.D(l.v.sky["atmosphere-blend"])});class pn extends l.E{constructor(o){super(),this._transitionable=new l.T(vn),this.setSky(o),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.z(0))}setSky(o,d={}){if(!this._validate(l.B,o,d)){o||(o={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const m in o){const y=o[m];m.endsWith("-transition")?this._transitionable.setTransition(m.slice(0,-11),y):this._transitionable.setValue(m,y)}}}getSky(){return this._transitionable.serialize()}updateTransitions(o){this._transitioning=this._transitionable.transitioned(o,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(o){this.properties=this._transitioning.possiblyEvaluate(o)}_validate(o,d,m={}){return(m==null?void 0:m.validate)!==!1&&l.t(this,o.call(l.u,l.e({value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v})))}calculateFogBlendOpacity(o){return o<60?0:o<70?(o-60)/10:1}}class ti{constructor(o,d){this.width=o,this.height=d,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(o,d){const m=o.join(",")+String(d);return this.dashEntry[m]||(this.dashEntry[m]=this.addDash(o,d)),this.dashEntry[m]}getDashRanges(o,d,m){const y=[];let x=o.length%2==1?-o[o.length-1]*m:0,M=o[0]*m,P=!0;y.push({left:x,right:M,isDash:P,zeroLength:o[0]===0});let O=o[0];for(let N=1;N<o.length;N++){P=!P;const V=o[N];x=O*m,O+=V,M=O*m,y.push({left:x,right:M,isDash:P,zeroLength:V===0})}return y}addRoundDash(o,d,m){const y=d/2;for(let x=-m;x<=m;x++){const M=this.width*(this.nextRow+m+x);let P=0,O=o[P];for(let N=0;N<this.width;N++){N/O.right>1&&(O=o[++P]);const V=Math.abs(N-O.left),F=Math.abs(N-O.right),Z=Math.min(V,F);let J;const ee=x/m*(y+1);if(O.isDash){const oe=y-Math.abs(ee);J=Math.sqrt(Z*Z+oe*oe)}else J=y-Math.sqrt(Z*Z+ee*ee);this.data[M+N]=Math.max(0,Math.min(255,J+128))}}}addRegularDash(o){for(let P=o.length-1;P>=0;--P){const O=o[P],N=o[P+1];O.zeroLength?o.splice(P,1):N&&N.isDash===O.isDash&&(N.left=O.left,o.splice(P,1))}const d=o[0],m=o[o.length-1];d.isDash===m.isDash&&(d.left=m.left-this.width,m.right=d.right+this.width);const y=this.width*this.nextRow;let x=0,M=o[x];for(let P=0;P<this.width;P++){P/M.right>1&&(M=o[++x]);const O=Math.abs(P-M.left),N=Math.abs(P-M.right),V=Math.min(O,N);this.data[y+P]=Math.max(0,Math.min(255,(M.isDash?V:-V)+128))}}addDash(o,d){const m=d?7:0,y=2*m+1;if(this.nextRow+y>this.height)return l.w("LineAtlas out of space"),null;let x=0;for(let P=0;P<o.length;P++)x+=o[P];if(x!==0){const P=this.width/x,O=this.getDashRanges(o,this.width,P);d?this.addRoundDash(O,P,m):this.addRegularDash(O)}const M={y:(this.nextRow+m+.5)/this.height,height:2*m/this.height,width:x};return this.nextRow+=y,this.dirty=!0,M}bind(o){const d=o.gl;this.texture?(d.bindTexture(d.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,d.texSubImage2D(d.TEXTURE_2D,0,0,0,this.width,this.height,d.ALPHA,d.UNSIGNED_BYTE,this.data))):(this.texture=d.createTexture(),d.bindTexture(d.TEXTURE_2D,this.texture),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),d.texImage2D(d.TEXTURE_2D,0,d.ALPHA,this.width,this.height,0,d.ALPHA,d.UNSIGNED_BYTE,this.data))}}const Nn="maplibre_preloaded_worker_pool";class Pn{constructor(){this.active={}}acquire(o){if(!this.workers)for(this.workers=[];this.workers.length<Pn.workerCount;)this.workers.push(new Worker(l.a.WORKER_URL));return this.active[o]=!0,this.workers.slice()}release(o){delete this.active[o],this.numActive()===0&&(this.workers.forEach(d=>{d.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Nn]}numActive(){return Object.keys(this.active).length}}const Ln=Math.floor(E.hardwareConcurrency/2);let Ce,He;function Ke(){return Ce||(Ce=new Pn),Ce}Pn.workerCount=l.C(globalThis)?Math.max(Math.min(Ln,3),1):1;class Be{constructor(o,d){this.workerPool=o,this.actors=[],this.currentActor=0,this.id=d;const m=this.workerPool.acquire(d);for(let y=0;y<m.length;y++){const x=new l.F(m[y],d);x.name=`Worker ${y}`,this.actors.push(x)}if(!this.actors.length)throw new Error("No actors found")}broadcast(o,d){const m=[];for(const y of this.actors)m.push(y.sendAsync({type:o,data:d}));return Promise.all(m)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(o=!0){this.actors.forEach(d=>{d.remove()}),this.actors=[],o&&this.workerPool.release(this.id)}registerMessageHandler(o,d){for(const m of this.actors)m.registerMessageHandler(o,d)}}function Rt(){return He||(He=new Be(Ke(),l.G),He.registerMessageHandler("GR",(v,o,d)=>l.m(o,d))),He}function Qt(v,o){const d=l.H();return l.J(d,d,[1,1,0]),l.K(d,d,[.5*v.width,.5*v.height,1]),l.L(d,d,v.calculatePosMatrix(o.toUnwrapped()))}function At(v,o,d,m,y,x){const M=function(F,Z,J){if(F)for(const ee of F){const oe=Z[ee];if(oe&&oe.source===J&&oe.type==="fill-extrusion")return!0}else for(const ee in Z){const oe=Z[ee];if(oe.source===J&&oe.type==="fill-extrusion")return!0}return!1}(y&&y.layers,o,v.id),P=x.maxPitchScaleFactor(),O=v.tilesIn(m,P,M);O.sort(Mt);const N=[];for(const F of O)N.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(o,d,v._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,y,x,P,Qt(v.transform,F.tileID))});const V=function(F){const Z={},J={};for(const ee of F){const oe=ee.queryResults,le=ee.wrappedTileID,ce=J[le]=J[le]||{};for(const he in oe){const ne=oe[he],me=ce[he]=ce[he]||{},ge=Z[he]=Z[he]||[];for(const xe of ne)me[xe.featureIndex]||(me[xe.featureIndex]=!0,ge.push(xe))}}return Z}(N);for(const F in V)V[F].forEach(Z=>{const J=Z.feature,ee=v.getFeatureState(J.layer["source-layer"],J.id);J.source=J.layer.source,J.layer["source-layer"]&&(J.sourceLayer=J.layer["source-layer"]),J.state=ee});return V}function Mt(v,o){const d=v.tileID,m=o.tileID;return d.overscaledZ-m.overscaledZ||d.canonical.y-m.canonical.y||d.wrap-m.wrap||d.canonical.x-m.canonical.x}function rn(v,o,d){return l._(this,void 0,void 0,function*(){let m=v;if(v.url?m=(yield l.h(o.transformRequest(v.url,"Source"),d)).data:yield E.frameAsync(d),!m)return null;const y=l.M(l.e(m,v),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in m&&m.vector_layers&&(y.vectorLayerIds=m.vector_layers.map(x=>x.id)),y})}class we{constructor(o,d){o&&(d?this.setSouthWest(o).setNorthEast(d):Array.isArray(o)&&(o.length===4?this.setSouthWest([o[0],o[1]]).setNorthEast([o[2],o[3]]):this.setSouthWest(o[0]).setNorthEast(o[1])))}setNorthEast(o){return this._ne=o instanceof l.N?new l.N(o.lng,o.lat):l.N.convert(o),this}setSouthWest(o){return this._sw=o instanceof l.N?new l.N(o.lng,o.lat):l.N.convert(o),this}extend(o){const d=this._sw,m=this._ne;let y,x;if(o instanceof l.N)y=o,x=o;else{if(!(o instanceof we))return Array.isArray(o)?o.length===4||o.every(Array.isArray)?this.extend(we.convert(o)):this.extend(l.N.convert(o)):o&&("lng"in o||"lon"in o)&&"lat"in o?this.extend(l.N.convert(o)):this;if(y=o._sw,x=o._ne,!y||!x)return this}return d||m?(d.lng=Math.min(y.lng,d.lng),d.lat=Math.min(y.lat,d.lat),m.lng=Math.max(x.lng,m.lng),m.lat=Math.max(x.lat,m.lat)):(this._sw=new l.N(y.lng,y.lat),this._ne=new l.N(x.lng,x.lat)),this}getCenter(){return new l.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 l.N(this.getWest(),this.getNorth())}getSouthEast(){return new l.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(o){const{lng:d,lat:m}=l.N.convert(o);let y=this._sw.lng<=d&&d<=this._ne.lng;return this._sw.lng>this._ne.lng&&(y=this._sw.lng>=d&&d>=this._ne.lng),this._sw.lat<=m&&m<=this._ne.lat&&y}static convert(o){return o instanceof we?o:o&&new we(o)}static fromLngLat(o,d=0){const m=360*d/40075017,y=m/Math.cos(Math.PI/180*o.lat);return new we(new l.N(o.lng-y,o.lat-m),new l.N(o.lng+y,o.lat+m))}adjustAntiMeridian(){const o=new l.N(this._sw.lng,this._sw.lat),d=new l.N(this._ne.lng,this._ne.lat);return new we(o,o.lng>d.lng?new l.N(d.lng+360,d.lat):d)}}class yn{constructor(o,d,m){this.bounds=we.convert(this.validateBounds(o)),this.minzoom=d||0,this.maxzoom=m||24}validateBounds(o){return Array.isArray(o)&&o.length===4?[Math.max(-180,o[0]),Math.max(-90,o[1]),Math.min(180,o[2]),Math.min(90,o[3])]:[-180,-90,180,90]}contains(o){const d=Math.pow(2,o.z),m=Math.floor(l.O(this.bounds.getWest())*d),y=Math.floor(l.Q(this.bounds.getNorth())*d),x=Math.ceil(l.O(this.bounds.getEast())*d),M=Math.ceil(l.Q(this.bounds.getSouth())*d);return o.x>=m&&o.x<x&&o.y>=y&&o.y<M}}class pr extends l.E{constructor(o,d,m,y){if(super(),this.id=o,this.dispatcher=m,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.e(this,l.M(d,["url","scheme","tileSize","promoteId"])),this._options=l.e({type:"vector"},d),this._collectResourceTiming=d.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(y)}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const o=yield rn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),o&&(l.e(this,o),o.bounds&&(this.tileBounds=new yn(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(o){this._tileJSONRequest=null,this.fire(new l.j(o))}})}loaded(){return this._loaded}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}onAdd(o){this.map=o,this.load()}setSourceProperty(o){this._tileJSONRequest&&this._tileJSONRequest.abort(),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m={request:this.map._requestManager.transformRequest(d,"Tile"),uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,tileSize:this.tileSize*o.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};m.request.collectResourceTiming=this._collectResourceTiming;let y="RT";if(o.actor&&o.state!=="expired"){if(o.state==="loading")return new Promise((x,M)=>{o.reloadPromise={resolve:x,reject:M}})}else o.actor=this.dispatcher.getActor(),y="LT";o.abortController=new AbortController;try{const x=yield o.actor.sendAsync({type:y,data:m},o.abortController);if(delete o.abortController,o.aborted)return;this._afterTileLoadWorkerResponse(o,x)}catch(x){if(delete o.abortController,o.aborted)return;if(x&&x.status!==404)throw x;this._afterTileLoadWorkerResponse(o,null)}})}_afterTileLoadWorkerResponse(o,d){if(d&&d.resourceTiming&&(o.resourceTiming=d.resourceTiming),d&&this.map._refreshExpiredTiles&&o.setExpiryData(d),o.loadVectorData(d,this.map.painter),o.reloadPromise){const m=o.reloadPromise;o.reloadPromise=null,this.loadTile(o).then(m.resolve).catch(m.reject)}}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.actor&&(yield o.actor.sendAsync({type:"AT",data:{uid:o.uid,type:this.type,source:this.id}}))})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.unloadVectorData(),o.actor&&(yield o.actor.sendAsync({type:"RMT",data:{uid:o.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class qt extends l.E{constructor(o,d,m,y){super(),this.id=o,this.dispatcher=m,this.setEventedParent(y),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},d),l.e(this,l.M(d,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const o=yield rn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,o&&(l.e(this,o),o.bounds&&(this.tileBounds=new yn(o.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(o){this._tileJSONRequest=null,this.fire(new l.j(o))}})}loaded(){return this._loaded}onAdd(o){this.map=o,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(o){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),o(),this.load()}setTiles(o){return this.setSourceProperty(()=>{this._options.tiles=o}),this}setUrl(o){return this.setSourceProperty(()=>{this.url=o,this._options.url=o}),this}serialize(){return l.e({},this._options)}hasTile(o){return!this.tileBounds||this.tileBounds.contains(o.canonical)}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);o.abortController=new AbortController;try{const m=yield G.getImage(this.map._requestManager.transformRequest(d,"Tile"),o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(m&&m.data){this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&o.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const y=this.map.painter.context,x=y.gl,M=m.data;o.texture=this.map.painter.getTileTexture(M.width),o.texture?o.texture.update(M,{useMipmap:!0}):(o.texture=new Xe(y,M,x.RGBA,{useMipmap:!0}),o.texture.bind(x.LINEAR,x.CLAMP_TO_EDGE,x.LINEAR_MIPMAP_NEAREST)),o.state="loaded"}}catch(m){if(delete o.abortController,o.aborted)o.state="unloaded";else if(m)throw o.state="errored",m}})}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController)})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.texture&&this.map.painter.saveTileTexture(o.texture)})}hasTransition(){return!1}}class sn extends qt{constructor(o,d,m,y){super(o,d,m,y),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},d),this.encoding=d.encoding||"mapbox",this.redFactor=d.redFactor,this.greenFactor=d.greenFactor,this.blueFactor=d.blueFactor,this.baseShift=d.baseShift}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),m=this.map._requestManager.transformRequest(d,"Tile");o.neighboringTiles=this._getNeighboringTiles(o.tileID),o.abortController=new AbortController;try{const y=yield G.getImage(m,o.abortController,this.map._refreshExpiredTiles);if(delete o.abortController,o.aborted)return void(o.state="unloaded");if(y&&y.data){const x=y.data;this.map._refreshExpiredTiles&&y.cacheControl&&y.expires&&o.setExpiryData({cacheControl:y.cacheControl,expires:y.expires});const M=l.b(x)&&l.U()?x:yield this.readImageNow(x),P={type:this.type,uid:o.uid,source:this.id,rawImageData:M,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!o.actor||o.state==="expired"){o.actor=this.dispatcher.getActor();const O=yield o.actor.sendAsync({type:"LDT",data:P});o.dem=O,o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0,o.state="loaded"}}}catch(y){if(delete o.abortController,o.aborted)o.state="unloaded";else if(y)throw o.state="errored",y}})}readImageNow(o){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.V()){const d=o.width+2,m=o.height+2;try{return new l.R({width:d,height:m},yield l.W(o,-1,-1,d,m))}catch{}}return E.getImageData(o,1)})}_getNeighboringTiles(o){const d=o.canonical,m=Math.pow(2,d.z),y=(d.x-1+m)%m,x=d.x===0?o.wrap-1:o.wrap,M=(d.x+1+m)%m,P=d.x+1===m?o.wrap+1:o.wrap,O={};return O[new l.S(o.overscaledZ,x,d.z,y,d.y).key]={backfilled:!1},O[new l.S(o.overscaledZ,P,d.z,M,d.y).key]={backfilled:!1},d.y>0&&(O[new l.S(o.overscaledZ,x,d.z,y,d.y-1).key]={backfilled:!1},O[new l.S(o.overscaledZ,o.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},O[new l.S(o.overscaledZ,P,d.z,M,d.y-1).key]={backfilled:!1}),d.y+1<m&&(O[new l.S(o.overscaledZ,x,d.z,y,d.y+1).key]={backfilled:!1},O[new l.S(o.overscaledZ,o.wrap,d.z,d.x,d.y+1).key]={backfilled:!1},O[new l.S(o.overscaledZ,P,d.z,M,d.y+1).key]={backfilled:!1}),O}unloadTile(o){return l._(this,void 0,void 0,function*(){o.demTexture&&this.map.painter.saveTileTexture(o.demTexture),o.fbo&&(o.fbo.destroy(),delete o.fbo),o.dem&&delete o.dem,delete o.neighboringTiles,o.state="unloaded",o.actor&&(yield o.actor.sendAsync({type:"RDT",data:{type:this.type,uid:o.uid,source:this.id}}))})}}class vi extends l.E{constructor(o,d,m,y){super(),this.id=o,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=m.getActor(),this.setEventedParent(y),this._data=d.data,this._options=l.e({},d),this._collectResourceTiming=d.collectResourceTiming,d.maxzoom!==void 0&&(this.maxzoom=d.maxzoom),d.type&&(this.type=d.type),d.attribution&&(this.attribution=d.attribution),this.promoteId=d.promoteId;const x=l.X/this.tileSize;d.clusterMaxZoom!==void 0&&this.maxzoom<=d.clusterMaxZoom&&l.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${d.clusterMaxZoom}".`),this.workerOptions=l.e({source:this.id,cluster:d.cluster||!1,geojsonVtOptions:{buffer:(d.buffer!==void 0?d.buffer:128)*x,tolerance:(d.tolerance!==void 0?d.tolerance:.375)*x,extent:l.X,maxZoom:this.maxzoom,lineMetrics:d.lineMetrics||!1,generateId:d.generateId||!1},superclusterOptions:{maxZoom:d.clusterMaxZoom!==void 0?d.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,d.clusterMinPoints||2),extent:l.X,radius:(d.clusterRadius||50)*x,log:!1,generateId:d.generateId||!1},clusterProperties:d.clusterProperties,filter:d.filter},d.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return l._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(o){this.map=o,this.load()}setData(o){return this._data=o,this._updateWorkerData(),this}updateData(o){return this._updateWorkerData(o),this}getData(){return l._(this,void 0,void 0,function*(){const o=l.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:o})})}setClusterOptions(o){return this.workerOptions.cluster=o.cluster,o&&(o.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=o.clusterRadius),o.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=o.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(o){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:o,source:this.id}})}getClusterChildren(o){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:o,source:this.id}})}getClusterLeaves(o,d,m){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:o,limit:d,offset:m}})}_updateWorkerData(o){return l._(this,void 0,void 0,function*(){const d=l.e({type:this.type},this.workerOptions);o?d.dataDiff=o:typeof this._data=="string"?(d.request=this.map._requestManager.transformRequest(E.resolveURL(this._data),"Source"),d.request.collectResourceTiming=this._collectResourceTiming):d.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new l.k("dataloading",{dataType:"source"}));try{const m=yield this.actor.sendAsync({type:"LD",data:d});if(this._pendingLoads--,this._removed||m.abandoned)return void this.fire(new l.k("dataabort",{dataType:"source"}));let y=null;m.resourceTiming&&m.resourceTiming[this.id]&&(y=m.resourceTiming[this.id].slice(0));const x={dataType:"source"};this._collectResourceTiming&&y&&y.length>0&&l.e(x,{resourceTiming:y}),this.fire(new l.k("data",Object.assign(Object.assign({},x),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},x),{sourceDataType:"content"})))}catch(m){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(m))}})}loaded(){return this._pendingLoads===0}loadTile(o){return l._(this,void 0,void 0,function*(){const d=o.actor?"RT":"LT";o.actor=this.actor;const m={type:this.type,uid:o.uid,tileID:o.tileID,zoom:o.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};o.abortController=new AbortController;const y=yield this.actor.sendAsync({type:d,data:m},o.abortController);delete o.abortController,o.unloadVectorData(),o.aborted||o.loadVectorData(y,this.map.painter,d==="RT")})}abortTile(o){return l._(this,void 0,void 0,function*(){o.abortController&&(o.abortController.abort(),delete o.abortController),o.aborted=!0})}unloadTile(o){return l._(this,void 0,void 0,function*(){o.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:o.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 l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var ui=l.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class mi extends l.E{constructor(o,d,m,y){super(),this.id=o,this.dispatcher=m,this.coordinates=d.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(y),this.options=d}load(o){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const d=yield G.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,d&&d.data&&(this.image=d.data,o&&(this.coordinates=o),this._finishLoading())}catch(d){this._request=null,this._loaded=!0,this.fire(new l.j(d))}})}loaded(){return this._loaded}updateImage(o){return o.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=o.url,this.load(o.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(o){this.map=o,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(o){this.coordinates=o;const d=o.map(l.Z.fromLngLat);this.tileID=function(y){let x=1/0,M=1/0,P=-1/0,O=-1/0;for(const Z of y)x=Math.min(x,Z.x),M=Math.min(M,Z.y),P=Math.max(P,Z.x),O=Math.max(O,Z.y);const N=Math.max(P-x,O-M),V=Math.max(0,Math.floor(-Math.log(N)/Math.LN2)),F=Math.pow(2,V);return new l.a1(V,Math.floor((x+P)/2*F),Math.floor((M+O)/2*F))}(d),this.minzoom=this.maxzoom=this.tileID.z;const m=d.map(y=>this.tileID.getTilePoint(y)._round());return this._boundsArray=new l.$,this._boundsArray.emplaceBack(m[0].x,m[0].y,0,0),this._boundsArray.emplaceBack(m[1].x,m[1].y,l.X,0),this._boundsArray.emplaceBack(m[3].x,m[3].y,0,l.X),this._boundsArray.emplaceBack(m[2].x,m[2].y,l.X,l.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const o=this.map.painter.context,d=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,ui.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Xe(o,this.image,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let m=!1;for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(o){return l._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(o.tileID.canonical)?(this.tiles[String(o.tileID.wrap)]=o,o.buckets={}):o.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Or extends mi{constructor(o,d,m,y){super(o,d,m,y),this.roundZoom=!0,this.type="video",this.options=d}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1;const o=this.options;this.urls=[];for(const d of o.urls)this.urls.push(this.map._requestManager.transformRequest(d,"Source").url);try{const d=yield l.a3(this.urls);if(this._loaded=!0,!d)return;this.video=d,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(d){this.fire(new l.j(d))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(o){if(this.video){const d=this.video.seekable;o<d.start(0)||o>d.end(0)?this.fire(new l.j(new l.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=o}}getVideo(){return this.video}onAdd(o){this.map||(this.map=o,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 o=this.map.painter.context,d=o.gl;this.boundsBuffer||(this.boundsBuffer=o.createVertexBuffer(this._boundsArray,ui.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,this.video)):(this.texture=new Xe(o,this.video,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let m=!1;for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,m=!0)}m&&this.fire(new l.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 wi extends mi{constructor(o,d,m,y){super(o,d,m,y),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(x=>!Array.isArray(x)||x.length!==2||x.some(M=>typeof M!="number"))||this.fire(new l.j(new l.a2(`sources.${o}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a2(`sources.${o}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new l.j(new l.a2(`sources.${o}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.a2(`sources.${o}`,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 l.j(new l.a2(`sources.${o}`,null,'missing required property "canvas"'))),this.options=d,this.animate=d.animate===void 0||d.animate}load(){return l._(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 l.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(o){this.map=o,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let o=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,o=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,o=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context,m=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,ui.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?(o||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Xe(d,this.canvas,m.RGBA,{premultiply:!0});let y=!1;for(const x in this.tiles){const M=this.tiles[x];M.state!=="loaded"&&(M.state="loaded",M.texture=this.texture,y=!0)}y&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const o of[this.canvas.width,this.canvas.height])if(isNaN(o)||o<=0)return!0;return!1}}const Eo={},Co=v=>{switch(v){case"geojson":return vi;case"image":return mi;case"raster":return qt;case"raster-dem":return sn;case"vector":return pr;case"video":return Or;case"canvas":return wi}return Eo[v]},Ve="RTLPluginLoaded";class Br extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Rt()}_syncState(o){return this.status=o,this.dispatcher.broadcast("SRPS",{pluginStatus:o,pluginURL:this.url}).catch(d=>{throw this.status="error",d})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(o){return l._(this,arguments,void 0,function*(d,m=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=E.resolveURL(d),!this.url)throw new Error(`requested url ${d} is invalid`);if(this.status==="unavailable"){if(!m)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(Ve))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let ki=null;function zr(){return ki||(ki=new Br),ki}class To{constructor(o,d){this.timeAdded=0,this.fadeEndTime=0,this.tileID=o,this.uid=l.a4(),this.uses=0,this.tileSize=d,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(o){const d=o+this.timeAdded;d<this.fadeEndTime||(this.fadeEndTime=d)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(o){this.demTexture&&o.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(o,d,m){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",o){o.featureIndex&&(this.latestFeatureIndex=o.featureIndex,o.rawTileData?(this.latestRawTileData=o.rawTileData,this.latestFeatureIndex.rawTileData=o.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=o.collisionBoxArray,this.buckets=function(y,x){const M={};if(!x)return M;for(const P of y){const O=P.layerIds.map(N=>x.getLayer(N)).filter(Boolean);if(O.length!==0){P.layers=O,P.stateDependentLayerIds&&(P.stateDependentLayers=P.stateDependentLayerIds.map(N=>O.filter(V=>V.id===N)[0]));for(const N of O)M[N.id]=P}}return M}(o.buckets,d.style),this.hasSymbolBuckets=!1;for(const y in this.buckets){const x=this.buckets[y];if(x instanceof l.a6){if(this.hasSymbolBuckets=!0,!m)break;x.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const y in this.buckets){const x=this.buckets[y];if(x instanceof l.a6&&x.hasRTLText){this.hasRTLText=!0,zr().lazyLoad();break}}this.queryPadding=0;for(const y in this.buckets){const x=this.buckets[y];this.queryPadding=Math.max(this.queryPadding,d.style.getLayer(y).queryRadius(x))}o.imageAtlas&&(this.imageAtlas=o.imageAtlas),o.glyphAtlasImage&&(this.glyphAtlasImage=o.glyphAtlasImage)}else this.collisionBoxArray=new l.a5}unloadVectorData(){for(const o in this.buckets)this.buckets[o].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(o){return this.buckets[o.id]}upload(o){for(const m in this.buckets){const y=this.buckets[m];y.uploadPending()&&y.upload(o)}const d=o.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Xe(o,this.imageAtlas.image,d.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Xe(o,this.glyphAtlasImage,d.ALPHA),this.glyphAtlasImage=null)}prepare(o){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(o,this.imageAtlasTexture)}queryRenderedFeatures(o,d,m,y,x,M,P,O,N,V){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:y,cameraQueryGeometry:x,scale:M,tileSize:this.tileSize,pixelPosMatrix:V,transform:O,params:P,queryPadding:this.queryPadding*N},o,d,m):{}}querySourceFeatures(o,d){const m=this.latestFeatureIndex;if(!m||!m.rawTileData)return;const y=m.loadVTLayers(),x=d&&d.sourceLayer?d.sourceLayer:"",M=y._geojsonTileLayer||y[x];if(!M)return;const P=l.a7(d&&d.filter),{z:O,x:N,y:V}=this.tileID.canonical,F={z:O,x:N,y:V};for(let Z=0;Z<M.length;Z++){const J=M.feature(Z);if(P.needGeometry){const le=l.a8(J,!0);if(!P.filter(new l.z(this.tileID.overscaledZ),le,this.tileID.canonical))continue}else if(!P.filter(new l.z(this.tileID.overscaledZ),J))continue;const ee=m.getId(J,x),oe=new l.a9(J,O,N,V,ee);oe.tile=F,o.push(oe)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(o){const d=this.expirationTime;if(o.cacheControl){const m=l.aa(o.cacheControl);m["max-age"]&&(this.expirationTime=Date.now()+1e3*m["max-age"])}else o.expires&&(this.expirationTime=new Date(o.expires).getTime());if(this.expirationTime){const m=Date.now();let y=!1;if(this.expirationTime>m)y=!1;else if(d)if(this.expirationTime<d)y=!0;else{const x=this.expirationTime-d;x?this.expirationTime=m+Math.max(x,3e4):y=!0}else y=!0;y?(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(o,d){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(o).length===0)return;const m=this.latestFeatureIndex.loadVTLayers();for(const y in this.buckets){if(!d.style.hasLayer(y))continue;const x=this.buckets[y],M=x.layers[0].sourceLayer||"_geojsonTileLayer",P=m[M],O=o[M];if(!P||!O||Object.keys(O).length===0)continue;x.update(O,P,this.imageAtlas&&this.imageAtlas.patternPositions||{});const N=d&&d.style&&d.style.getLayer(y);N&&(this.queryPadding=Math.max(this.queryPadding,N.queryRadius(x)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<E.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(o){this.symbolFadeHoldUntil=E.now()+o}setDependencies(o,d){const m={};for(const y of d)m[y]=!0;this.dependencies[o]=m}hasDependency(o,d){for(const m of o){const y=this.dependencies[m];if(y){for(const x of d)if(y[x])return!0}}return!1}}class Ze{constructor(o,d){this.max=o,this.onRemove=d,this.reset()}reset(){for(const o in this.data)for(const d of this.data[o])d.timeout&&clearTimeout(d.timeout),this.onRemove(d.value);return this.data={},this.order=[],this}add(o,d,m){const y=o.wrapped().key;this.data[y]===void 0&&(this.data[y]=[]);const x={value:d,timeout:void 0};if(m!==void 0&&(x.timeout=setTimeout(()=>{this.remove(o,x)},m)),this.data[y].push(x),this.order.push(y),this.order.length>this.max){const M=this._getAndRemoveByKey(this.order[0]);M&&this.onRemove(M)}return this}has(o){return o.wrapped().key in this.data}getAndRemove(o){return this.has(o)?this._getAndRemoveByKey(o.wrapped().key):null}_getAndRemoveByKey(o){const d=this.data[o].shift();return d.timeout&&clearTimeout(d.timeout),this.data[o].length===0&&delete this.data[o],this.order.splice(this.order.indexOf(o),1),d.value}getByKey(o){const d=this.data[o];return d?d[0].value:null}get(o){return this.has(o)?this.data[o.wrapped().key][0].value:null}remove(o,d){if(!this.has(o))return this;const m=o.wrapped().key,y=d===void 0?0:this.data[m].indexOf(d),x=this.data[m][y];return this.data[m].splice(y,1),x.timeout&&clearTimeout(x.timeout),this.data[m].length===0&&delete this.data[m],this.onRemove(x.value),this.order.splice(this.order.indexOf(m),1),this}setMaxSize(o){for(this.max=o;this.order.length>this.max;){const d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}filter(o){const d=[];for(const m in this.data)for(const y of this.data[m])o(y.value)||d.push(y);for(const m of d)this.remove(m.value.tileID,m)}}class ke{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(o,d,m){const y=String(d);if(this.stateChanges[o]=this.stateChanges[o]||{},this.stateChanges[o][y]=this.stateChanges[o][y]||{},l.e(this.stateChanges[o][y],m),this.deletedStates[o]===null){this.deletedStates[o]={};for(const x in this.state[o])x!==y&&(this.deletedStates[o][x]=null)}else if(this.deletedStates[o]&&this.deletedStates[o][y]===null){this.deletedStates[o][y]={};for(const x in this.state[o][y])m[x]||(this.deletedStates[o][y][x]=null)}else for(const x in m)this.deletedStates[o]&&this.deletedStates[o][y]&&this.deletedStates[o][y][x]===null&&delete this.deletedStates[o][y][x]}removeFeatureState(o,d,m){if(this.deletedStates[o]===null)return;const y=String(d);if(this.deletedStates[o]=this.deletedStates[o]||{},m&&d!==void 0)this.deletedStates[o][y]!==null&&(this.deletedStates[o][y]=this.deletedStates[o][y]||{},this.deletedStates[o][y][m]=null);else if(d!==void 0)if(this.stateChanges[o]&&this.stateChanges[o][y])for(m in this.deletedStates[o][y]={},this.stateChanges[o][y])this.deletedStates[o][y][m]=null;else this.deletedStates[o][y]=null;else this.deletedStates[o]=null}getState(o,d){const m=String(d),y=l.e({},(this.state[o]||{})[m],(this.stateChanges[o]||{})[m]);if(this.deletedStates[o]===null)return{};if(this.deletedStates[o]){const x=this.deletedStates[o][d];if(x===null)return{};for(const M in x)delete y[M]}return y}initializeTileState(o,d){o.setFeatureState(this.state,d)}coalesceChanges(o,d){const m={};for(const y in this.stateChanges){this.state[y]=this.state[y]||{};const x={};for(const M in this.stateChanges[y])this.state[y][M]||(this.state[y][M]={}),l.e(this.state[y][M],this.stateChanges[y][M]),x[M]=this.state[y][M];m[y]=x}for(const y in this.deletedStates){this.state[y]=this.state[y]||{};const x={};if(this.deletedStates[y]===null)for(const M in this.state[y])x[M]={},this.state[y][M]={};else for(const M in this.deletedStates[y]){if(this.deletedStates[y][M]===null)this.state[y][M]={};else for(const P of Object.keys(this.deletedStates[y][M]))delete this.state[y][M][P];x[M]=this.state[y][M]}m[y]=m[y]||{},l.e(m[y],x)}if(this.stateChanges={},this.deletedStates={},Object.keys(m).length!==0)for(const y in o)o[y].setFeatureState(m,d)}}class Le extends l.E{constructor(o,d,m){super(),this.id=o,this.dispatcher=m,this.on("data",y=>this._dataHandler(y)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((y,x,M,P)=>{const O=new(Co(x.type))(y,x,M,P);if(O.id!==y)throw new Error(`Expected Source id to be ${y} instead of ${O.id}`);return O})(o,d,m,this),this._tiles={},this._cache=new Ze(0,y=>this._unloadTile(y)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ke,this._didEmitContent=!1,this._updated=!1}onAdd(o){this.map=o,this._maxTileCacheSize=o?o._maxTileCacheSize:null,this._maxTileCacheZoomLevels=o?o._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(o)}onRemove(o){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(o)}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 o in this._tiles){const d=this._tiles[o];if(d.state!=="loaded"&&d.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const o=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,o&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(o,d,m){return l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(o),this._tileLoaded(o,d,m)}catch(y){o.state="errored",y.status!==404?this._source.fire(new l.j(y,{tile:o})):this.update(this.transform,this.terrain)}})}_unloadTile(o){this._source.unloadTile&&this._source.unloadTile(o)}_abortTile(o){this._source.abortTile&&this._source.abortTile(o),this._source.fire(new l.k("dataabort",{tile:o,coord:o.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(o){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const d in this._tiles){const m=this._tiles[d];m.upload(o),m.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(o=>o.tileID).sort(vt).map(o=>o.key)}getRenderableIds(o){const d=[];for(const m in this._tiles)this._isIdRenderable(m,o)&&d.push(this._tiles[m]);return o?d.sort((m,y)=>{const x=m.tileID,M=y.tileID,P=new l.P(x.canonical.x,x.canonical.y)._rotate(this.transform.angle),O=new l.P(M.canonical.x,M.canonical.y)._rotate(this.transform.angle);return x.overscaledZ-M.overscaledZ||O.y-P.y||O.x-P.x}).map(m=>m.tileID.key):d.map(m=>m.tileID).sort(vt).map(m=>m.key)}hasRenderableParent(o){const d=this.findLoadedParent(o,0);return!!d&&this._isIdRenderable(d.tileID.key)}_isIdRenderable(o,d){return this._tiles[o]&&this._tiles[o].hasData()&&!this._coveredTiles[o]&&(d||!this._tiles[o].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const o in this._tiles)this._tiles[o].state!=="errored"&&this._reloadTile(o,"reloading")}}_reloadTile(o,d){return l._(this,void 0,void 0,function*(){const m=this._tiles[o];m&&(m.state!=="loading"&&(m.state=d),yield this._loadTile(m,o,d))})}_tileLoaded(o,d,m){o.timeAdded=E.now(),m==="expired"&&(o.refreshedUponExpiration=!0),this._setTileReloadTimer(d,o),this.getSource().type==="raster-dem"&&o.dem&&this._backfillDEM(o),this._state.initializeTileState(o,this.map?this.map.painter:null),o.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:o,coord:o.tileID}))}_backfillDEM(o){const d=this.getRenderableIds();for(let y=0;y<d.length;y++){const x=d[y];if(o.neighboringTiles&&o.neighboringTiles[x]){const M=this.getTileByID(x);m(o,M),m(M,o)}}function m(y,x){y.needsHillshadePrepare=!0,y.needsTerrainPrepare=!0;let M=x.tileID.canonical.x-y.tileID.canonical.x;const P=x.tileID.canonical.y-y.tileID.canonical.y,O=Math.pow(2,y.tileID.canonical.z),N=x.tileID.key;M===0&&P===0||Math.abs(P)>1||(Math.abs(M)>1&&(Math.abs(M+O)===1?M+=O:Math.abs(M-O)===1&&(M-=O)),x.dem&&y.dem&&(y.dem.backfillBorder(x.dem,M,P),y.neighboringTiles&&y.neighboringTiles[N]&&(y.neighboringTiles[N].backfilled=!0)))}}getTile(o){return this.getTileByID(o.key)}getTileByID(o){return this._tiles[o]}_retainLoadedChildren(o,d,m,y){for(const x in this._tiles){let M=this._tiles[x];if(y[x]||!M.hasData()||M.tileID.overscaledZ<=d||M.tileID.overscaledZ>m)continue;let P=M.tileID;for(;M&&M.tileID.overscaledZ>d+1;){const N=M.tileID.scaledTo(M.tileID.overscaledZ-1);M=this._tiles[N.key],M&&M.hasData()&&(P=N)}let O=P;for(;O.overscaledZ>d;)if(O=O.scaledTo(O.overscaledZ-1),o[O.key]){y[P.key]=P;break}}}findLoadedParent(o,d){if(o.key in this._loadedParentTiles){const m=this._loadedParentTiles[o.key];return m&&m.tileID.overscaledZ>=d?m:null}for(let m=o.overscaledZ-1;m>=d;m--){const y=o.scaledTo(m),x=this._getLoadedTile(y);if(x)return x}}findLoadedSibling(o){return this._getLoadedTile(o)}_getLoadedTile(o){const d=this._tiles[o.key];return d&&d.hasData()?d:this._cache.getByKey(o.wrapped().key)}updateCacheSize(o){const d=Math.ceil(o.width/this._source.tileSize)+1,m=Math.ceil(o.height/this._source.tileSize)+1,y=Math.floor(d*m*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,y):y;this._cache.setMaxSize(x)}handleWrapJump(o){const d=Math.round((o-(this._prevLng===void 0?o:this._prevLng))/360);if(this._prevLng=o,d){const m={};for(const y in this._tiles){const x=this._tiles[y];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+d),m[x.tileID.key]=x}this._tiles=m;for(const y in this._timers)clearTimeout(this._timers[y]),delete this._timers[y];for(const y in this._tiles)this._setTileReloadTimer(y,this._tiles[y])}}_updateCoveredAndRetainedTiles(o,d,m,y,x,M){const P={},O={},N=Object.keys(o),V=E.now();for(const F of N){const Z=o[F],J=this._tiles[F];if(!J||J.fadeEndTime!==0&&J.fadeEndTime<=V)continue;const ee=this.findLoadedParent(Z,d),oe=this.findLoadedSibling(Z),le=ee||oe||null;le&&(this._addTile(le.tileID),P[le.tileID.key]=le.tileID),O[F]=Z}this._retainLoadedChildren(O,y,m,o);for(const F in P)o[F]||(this._coveredTiles[F]=!0,o[F]=P[F]);if(M){const F={},Z={};for(const J of x)this._tiles[J.key].hasData()?F[J.key]=J:Z[J.key]=J;for(const J in Z){const ee=Z[J].children(this._source.maxzoom);this._tiles[ee[0].key]&&this._tiles[ee[1].key]&&this._tiles[ee[2].key]&&this._tiles[ee[3].key]&&(F[ee[0].key]=o[ee[0].key]=ee[0],F[ee[1].key]=o[ee[1].key]=ee[1],F[ee[2].key]=o[ee[2].key]=ee[2],F[ee[3].key]=o[ee[3].key]=ee[3],delete Z[J])}for(const J in Z){const ee=Z[J],oe=this.findLoadedParent(ee,this._source.minzoom),le=this.findLoadedSibling(ee),ce=oe||le||null;if(ce){F[ce.tileID.key]=o[ce.tileID.key]=ce.tileID;for(const he in F)F[he].isChildOf(ce.tileID)&&delete F[he]}}for(const J in this._tiles)F[J]||(this._coveredTiles[J]=!0)}}update(o,d){if(!this._sourceLoaded||this._paused)return;let m;this.transform=o,this.terrain=d,this.updateCacheSize(o),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?m=o.getVisibleUnwrappedCoordinates(this._source.tileID).map(V=>new l.S(V.canonical.z,V.wrap,V.canonical.z,V.canonical.x,V.canonical.y)):(m=o.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:d}),this._source.hasTile&&(m=m.filter(V=>this._source.hasTile(V)))):m=[];const y=o.coveringZoomLevel(this._source),x=Math.max(y-Le.maxOverzooming,this._source.minzoom),M=Math.max(y+Le.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const V={};for(const F of m)if(F.canonical.z>this._source.minzoom){const Z=F.scaledTo(F.canonical.z-1);V[Z.key]=Z;const J=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));V[J.key]=J}m=m.concat(Object.values(V))}const P=m.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,P&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const O=this._updateRetainedTiles(m,y);Wt(this._source.type)&&this._updateCoveredAndRetainedTiles(O,x,M,y,m,d);for(const V in O)this._tiles[V].clearFadeHold();const N=l.ab(this._tiles,O);for(const V of N){const F=this._tiles[V];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(V)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const o in this._tiles)this._tiles[o].holdingForFade()&&this._removeTile(o)}_updateRetainedTiles(o,d){var m;const y={},x={},M=Math.max(d-Le.maxOverzooming,this._source.minzoom),P=Math.max(d+Le.maxUnderzooming,this._source.minzoom),O={};for(const N of o){const V=this._addTile(N);y[N.key]=N,V.hasData()||d<this._source.maxzoom&&(O[N.key]=N)}this._retainLoadedChildren(O,d,P,y);for(const N of o){let V=this._tiles[N.key];if(V.hasData())continue;if(d+1>this._source.maxzoom){const Z=N.children(this._source.maxzoom)[0],J=this.getTile(Z);if(J&&J.hasData()){y[Z.key]=Z;continue}}else{const Z=N.children(this._source.maxzoom);if(y[Z[0].key]&&y[Z[1].key]&&y[Z[2].key]&&y[Z[3].key])continue}let F=V.wasRequested();for(let Z=N.overscaledZ-1;Z>=M;--Z){const J=N.scaledTo(Z);if(x[J.key])break;if(x[J.key]=!0,V=this.getTile(J),!V&&F&&(V=this._addTile(J)),V){const ee=V.hasData();if((ee||!(!((m=this.map)===null||m===void 0)&&m.cancelPendingTileRequestsWhileZooming)||F)&&(y[J.key]=J),F=V.wasRequested(),ee)break}}}return y}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const o in this._tiles){const d=[];let m,y=this._tiles[o].tileID;for(;y.overscaledZ>0;){if(y.key in this._loadedParentTiles){m=this._loadedParentTiles[y.key];break}d.push(y.key);const x=y.scaledTo(y.overscaledZ-1);if(m=this._getLoadedTile(x),m)break;y=x}for(const x of d)this._loadedParentTiles[x]=m}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const o in this._tiles){const d=this._tiles[o].tileID,m=this._getLoadedTile(d);this._loadedSiblingTiles[d.key]=m}}_addTile(o){let d=this._tiles[o.key];if(d)return d;d=this._cache.getAndRemove(o),d&&(this._setTileReloadTimer(o.key,d),d.tileID=o,this._state.initializeTileState(d,this.map?this.map.painter:null),this._cacheTimers[o.key]&&(clearTimeout(this._cacheTimers[o.key]),delete this._cacheTimers[o.key],this._setTileReloadTimer(o.key,d)));const m=d;return d||(d=new To(o,this._source.tileSize*o.overscaleFactor()),this._loadTile(d,o.key,d.state)),d.uses++,this._tiles[o.key]=d,m||this._source.fire(new l.k("dataloading",{tile:d,coord:d.tileID,dataType:"source"})),d}_setTileReloadTimer(o,d){o in this._timers&&(clearTimeout(this._timers[o]),delete this._timers[o]);const m=d.getExpiryTimeout();m&&(this._timers[o]=setTimeout(()=>{this._reloadTile(o,"expired"),delete this._timers[o]},m))}_removeTile(o){const d=this._tiles[o];d&&(d.uses--,delete this._tiles[o],this._timers[o]&&(clearTimeout(this._timers[o]),delete this._timers[o]),d.uses>0||(d.hasData()&&d.state!=="reloading"?this._cache.add(d.tileID,d,d.getExpiryTimeout()):(d.aborted=!0,this._abortTile(d),this._unloadTile(d))))}_dataHandler(o){const d=o.sourceDataType;o.dataType==="source"&&d==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&d==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const o in this._tiles)this._removeTile(o);this._cache.reset()}tilesIn(o,d,m){const y=[],x=this.transform;if(!x)return y;const M=m?x.getCameraQueryGeometry(o):o,P=o.map(ee=>x.pointCoordinate(ee,this.terrain)),O=M.map(ee=>x.pointCoordinate(ee,this.terrain)),N=this.getIds();let V=1/0,F=1/0,Z=-1/0,J=-1/0;for(const ee of O)V=Math.min(V,ee.x),F=Math.min(F,ee.y),Z=Math.max(Z,ee.x),J=Math.max(J,ee.y);for(let ee=0;ee<N.length;ee++){const oe=this._tiles[N[ee]];if(oe.holdingForFade())continue;const le=oe.tileID,ce=Math.pow(2,x.zoom-oe.tileID.overscaledZ),he=d*oe.queryPadding*l.X/oe.tileSize/ce,ne=[le.getTilePoint(new l.Z(V,F)),le.getTilePoint(new l.Z(Z,J))];if(ne[0].x-he<l.X&&ne[0].y-he<l.X&&ne[1].x+he>=0&&ne[1].y+he>=0){const me=P.map(xe=>le.getTilePoint(xe)),ge=O.map(xe=>le.getTilePoint(xe));y.push({tile:oe,tileID:le,queryGeometry:me,cameraQueryGeometry:ge,scale:ce})}}return y}getVisibleCoordinates(o){const d=this.getRenderableIds(o).map(m=>this._tiles[m].tileID);for(const m of d)m.posMatrix=this.transform.calculatePosMatrix(m.toUnwrapped());return d}hasTransition(){if(this._source.hasTransition())return!0;if(Wt(this._source.type)){const o=E.now();for(const d in this._tiles)if(this._tiles[d].fadeEndTime>=o)return!0}return!1}setFeatureState(o,d,m){this._state.updateState(o=o||"_geojsonTileLayer",d,m)}removeFeatureState(o,d,m){this._state.removeFeatureState(o=o||"_geojsonTileLayer",d,m)}getFeatureState(o,d){return this._state.getState(o=o||"_geojsonTileLayer",d)}setDependencies(o,d,m){const y=this._tiles[o];y&&y.setDependencies(d,m)}reloadTilesForDependencies(o,d){for(const m in this._tiles)this._tiles[m].hasDependency(o,d)&&this._reloadTile(m,"reloading");this._cache.filter(m=>!m.hasDependency(o,d))}}function vt(v,o){const d=Math.abs(2*v.wrap)-+(v.wrap<0),m=Math.abs(2*o.wrap)-+(o.wrap<0);return v.overscaledZ-o.overscaledZ||m-d||o.canonical.y-v.canonical.y||o.canonical.x-v.canonical.x}function Wt(v){return v==="raster"||v==="image"||v==="video"}Le.maxOverzooming=10,Le.maxUnderzooming=3;class tt{constructor(o,d){this.reset(o,d)}reset(o,d){this.points=o||[],this._distances=[0];for(let m=1;m<this.points.length;m++)this._distances[m]=this._distances[m-1]+this.points[m].dist(this.points[m-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(d||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(o){if(this.points.length===1)return this.points[0];o=l.ac(o,0,1);let d=1,m=this._distances[d];const y=o*this.paddedLength+this.padding;for(;m<y&&d<this._distances.length;)m=this._distances[++d];const x=d-1,M=this._distances[x],P=m-M,O=P>0?(y-M)/P:0;return this.points[x].mult(1-O).add(this.points[d].mult(O))}}function Rn(v,o){let d=!0;return v==="always"||v!=="never"&&o!=="never"||(d=!1),d}class Kn{constructor(o,d,m){const y=this.boxCells=[],x=this.circleCells=[];this.xCellCount=Math.ceil(o/m),this.yCellCount=Math.ceil(d/m);for(let M=0;M<this.xCellCount*this.yCellCount;M++)y.push([]),x.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=o,this.height=d,this.xScale=this.xCellCount/o,this.yScale=this.yCellCount/d,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(o,d,m,y,x){this._forEachCell(d,m,y,x,this._insertBoxCell,this.boxUid++),this.boxKeys.push(o),this.bboxes.push(d),this.bboxes.push(m),this.bboxes.push(y),this.bboxes.push(x)}insertCircle(o,d,m,y){this._forEachCell(d-y,m-y,d+y,m+y,this._insertCircleCell,this.circleUid++),this.circleKeys.push(o),this.circles.push(d),this.circles.push(m),this.circles.push(y)}_insertBoxCell(o,d,m,y,x,M){this.boxCells[x].push(M)}_insertCircleCell(o,d,m,y,x,M){this.circleCells[x].push(M)}_query(o,d,m,y,x,M,P){if(m<0||o>this.width||y<0||d>this.height)return[];const O=[];if(o<=0&&d<=0&&this.width<=m&&this.height<=y){if(x)return[{key:null,x1:o,y1:d,x2:m,y2:y}];for(let N=0;N<this.boxKeys.length;N++)O.push({key:this.boxKeys[N],x1:this.bboxes[4*N],y1:this.bboxes[4*N+1],x2:this.bboxes[4*N+2],y2:this.bboxes[4*N+3]});for(let N=0;N<this.circleKeys.length;N++){const V=this.circles[3*N],F=this.circles[3*N+1],Z=this.circles[3*N+2];O.push({key:this.circleKeys[N],x1:V-Z,y1:F-Z,x2:V+Z,y2:F+Z})}}else this._forEachCell(o,d,m,y,this._queryCell,O,{hitTest:x,overlapMode:M,seenUids:{box:{},circle:{}}},P);return O}query(o,d,m,y){return this._query(o,d,m,y,!1,null)}hitTest(o,d,m,y,x,M){return this._query(o,d,m,y,!0,x,M).length>0}hitTestCircle(o,d,m,y,x){const M=o-m,P=o+m,O=d-m,N=d+m;if(P<0||M>this.width||N<0||O>this.height)return!1;const V=[];return this._forEachCell(M,O,P,N,this._queryCellCircle,V,{hitTest:!0,overlapMode:y,circle:{x:o,y:d,radius:m},seenUids:{box:{},circle:{}}},x),V.length>0}_queryCell(o,d,m,y,x,M,P,O){const{seenUids:N,hitTest:V,overlapMode:F}=P,Z=this.boxCells[x];if(Z!==null){const ee=this.bboxes;for(const oe of Z)if(!N.box[oe]){N.box[oe]=!0;const le=4*oe,ce=this.boxKeys[oe];if(o<=ee[le+2]&&d<=ee[le+3]&&m>=ee[le+0]&&y>=ee[le+1]&&(!O||O(ce))&&(!V||!Rn(F,ce.overlapMode))&&(M.push({key:ce,x1:ee[le],y1:ee[le+1],x2:ee[le+2],y2:ee[le+3]}),V))return!0}}const J=this.circleCells[x];if(J!==null){const ee=this.circles;for(const oe of J)if(!N.circle[oe]){N.circle[oe]=!0;const le=3*oe,ce=this.circleKeys[oe];if(this._circleAndRectCollide(ee[le],ee[le+1],ee[le+2],o,d,m,y)&&(!O||O(ce))&&(!V||!Rn(F,ce.overlapMode))){const he=ee[le],ne=ee[le+1],me=ee[le+2];if(M.push({key:ce,x1:he-me,y1:ne-me,x2:he+me,y2:ne+me}),V)return!0}}}return!1}_queryCellCircle(o,d,m,y,x,M,P,O){const{circle:N,seenUids:V,overlapMode:F}=P,Z=this.boxCells[x];if(Z!==null){const ee=this.bboxes;for(const oe of Z)if(!V.box[oe]){V.box[oe]=!0;const le=4*oe,ce=this.boxKeys[oe];if(this._circleAndRectCollide(N.x,N.y,N.radius,ee[le+0],ee[le+1],ee[le+2],ee[le+3])&&(!O||O(ce))&&!Rn(F,ce.overlapMode))return M.push(!0),!0}}const J=this.circleCells[x];if(J!==null){const ee=this.circles;for(const oe of J)if(!V.circle[oe]){V.circle[oe]=!0;const le=3*oe,ce=this.circleKeys[oe];if(this._circlesCollide(ee[le],ee[le+1],ee[le+2],N.x,N.y,N.radius)&&(!O||O(ce))&&!Rn(F,ce.overlapMode))return M.push(!0),!0}}}_forEachCell(o,d,m,y,x,M,P,O){const N=this._convertToXCellCoord(o),V=this._convertToYCellCoord(d),F=this._convertToXCellCoord(m),Z=this._convertToYCellCoord(y);for(let J=N;J<=F;J++)for(let ee=V;ee<=Z;ee++)if(x.call(this,o,d,m,y,this.xCellCount*ee+J,M,P,O))return}_convertToXCellCoord(o){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(o*this.xScale)))}_convertToYCellCoord(o){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(o*this.yScale)))}_circlesCollide(o,d,m,y,x,M){const P=y-o,O=x-d,N=m+M;return N*N>P*P+O*O}_circleAndRectCollide(o,d,m,y,x,M,P){const O=(M-y)/2,N=Math.abs(o-(y+O));if(N>O+m)return!1;const V=(P-x)/2,F=Math.abs(d-(x+V));if(F>V+m)return!1;if(N<=O||F<=V)return!0;const Z=N-O,J=F-V;return Z*Z+J*J<=m*m}}function qi(v,o,d,m,y){const x=l.H();return o?(l.K(x,x,[1/y,1/y,1]),d||l.ad(x,x,m.angle)):l.L(x,m.labelPlaneMatrix,v),x}function fr(v,o,d,m,y){if(o){const x=l.ae(v);return l.K(x,x,[y,y,1]),d||l.ad(x,x,-m.angle),x}return m.glCoordMatrix}function se(v,o,d,m){let y;m?(y=[v,o,m(v,o),1],l.af(y,y,d)):(y=[v,o,0,1],an(y,y,d));const x=y[3];return{point:new l.P(y[0]/x,y[1]/x),signedDistanceFromCamera:x,isOccluded:!1}}function H(v,o){return .5+v/o*.5}function U(v,o){return v.x>=-o[0]&&v.x<=o[0]&&v.y>=-o[1]&&v.y<=o[1]}function X(v,o,d,m,y,x,M,P,O,N,V,F,Z,J,ee){const oe=m?v.textSizeData:v.iconSizeData,le=l.ag(oe,d.transform.zoom),ce=[256/d.width*2+1,256/d.height*2+1],he=m?v.text.dynamicLayoutVertexArray:v.icon.dynamicLayoutVertexArray;he.clear();const ne=v.lineVertexArray,me=m?v.text.placedSymbolArray:v.icon.placedSymbolArray,ge=d.transform.width/d.transform.height;let xe=!1;for(let Oe=0;Oe<me.length;Oe++){const Fe=me.get(Oe);if(Fe.hidden||Fe.writingMode===l.ah.vertical&&!xe){kt(Fe.numGlyphs,he);continue}xe=!1;const et=se(Fe.anchorX,Fe.anchorY,o,ee);if(!U(et.point,ce)){kt(Fe.numGlyphs,he);continue}const at=H(d.transform.cameraToCenterDistance,et.signedDistanceFromCamera),Ye=l.ai(oe,le,Fe),Ge=M?Ye/at:Ye*at,mt={getElevation:ee,labelPlaneMatrix:y,lineVertexArray:ne,pitchWithMap:M,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:N,tileAnchorPoint:new l.P(Fe.anchorX,Fe.anchorY),unwrappedTileID:V,width:F,height:Z,translation:J},Bt=fe(mt,Fe,Ge,!1,P,o,x,v.glyphOffsetArray,he,ge,O);xe=Bt.useVertical,(Bt.notEnoughRoom||xe||Bt.needsFlipping&&fe(mt,Fe,Ge,!0,P,o,x,v.glyphOffsetArray,he,ge,O).notEnoughRoom)&&kt(Fe.numGlyphs,he)}m?v.text.dynamicLayoutVertexBuffer.updateData(he):v.icon.dynamicLayoutVertexBuffer.updateData(he)}function ie(v,o,d,m,y,x,M,P){const O=x.glyphStartIndex+x.numGlyphs,N=x.lineStartIndex,V=x.lineStartIndex+x.lineLength,F=o.getoffsetX(x.glyphStartIndex),Z=o.getoffsetX(O-1),J=We(v*F,d,m,y,x.segment,N,V,P,M);if(!J)return null;const ee=We(v*Z,d,m,y,x.segment,N,V,P,M);return ee?P.projectionCache.anyProjectionOccluded?null:{first:J,last:ee}:null}function de(v,o,d,m){return v===l.ah.horizontal&&Math.abs(d.y-o.y)>Math.abs(d.x-o.x)*m?{useVertical:!0}:(v===l.ah.vertical?o.y<d.y:o.x>d.x)?{needsFlipping:!0}:null}function fe(v,o,d,m,y,x,M,P,O,N,V){const F=d/24,Z=o.lineOffsetX*F,J=o.lineOffsetY*F;let ee;if(o.numGlyphs>1){const oe=o.glyphStartIndex+o.numGlyphs,le=o.lineStartIndex,ce=o.lineStartIndex+o.lineLength,he=ie(F,P,Z,J,m,o,V,v);if(!he)return{notEnoughRoom:!0};const ne=se(he.first.point.x,he.first.point.y,M,v.getElevation).point,me=se(he.last.point.x,he.last.point.y,M,v.getElevation).point;if(y&&!m){const ge=de(o.writingMode,ne,me,N);if(ge)return ge}ee=[he.first];for(let ge=o.glyphStartIndex+1;ge<oe-1;ge++)ee.push(We(F*P.getoffsetX(ge),Z,J,m,o.segment,le,ce,v,V));ee.push(he.last)}else{if(y&&!m){const le=se(v.tileAnchorPoint.x,v.tileAnchorPoint.y,x,v.getElevation).point,ce=o.lineStartIndex+o.segment+1,he=new l.P(v.lineVertexArray.getx(ce),v.lineVertexArray.gety(ce)),ne=se(he.x,he.y,x,v.getElevation),me=ne.signedDistanceFromCamera>0?ne.point:function(xe,Oe,Fe,et,at,Ye){return _e(xe,Oe,Fe,1,at,Ye)}(v.tileAnchorPoint,he,le,0,x,v),ge=de(o.writingMode,le,me,N);if(ge)return ge}const oe=We(F*P.getoffsetX(o.glyphStartIndex),Z,J,m,o.segment,o.lineStartIndex,o.lineStartIndex+o.lineLength,v,V);if(!oe||v.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};ee=[oe]}for(const oe of ee)l.aj(O,oe.point,oe.angle);return{}}function _e(v,o,d,m,y,x){const M=v.add(v.sub(o)._unit()),P=y!==void 0?se(M.x,M.y,y,x.getElevation).point:Me(M.x,M.y,x).point,O=d.sub(P);return d.add(O._mult(m/O.mag()))}function ue(v,o,d){const m=o.projectionCache;if(m.projections[v])return m.projections[v];const y=new l.P(o.lineVertexArray.getx(v),o.lineVertexArray.gety(v)),x=Me(y.x,y.y,o);if(x.signedDistanceFromCamera>0)return m.projections[v]=x.point,m.anyProjectionOccluded=m.anyProjectionOccluded||x.isOccluded,x.point;const M=v-d.direction;return function(P,O,N,V,F){return _e(P,O,N,V,void 0,F)}(d.distanceFromAnchor===0?o.tileAnchorPoint:new l.P(o.lineVertexArray.getx(M),o.lineVertexArray.gety(M)),y,d.previousVertex,d.absOffsetX-d.distanceFromAnchor+1,o)}function Me(v,o,d){const m=v+d.translation[0],y=o+d.translation[1];let x;return!d.pitchWithMap&&d.projection.useSpecialProjectionForSymbols?(x=d.projection.projectTileCoordinates(m,y,d.unwrappedTileID,d.getElevation),x.point.x=(.5*x.point.x+.5)*d.width,x.point.y=(.5*-x.point.y+.5)*d.height):(x=se(m,y,d.labelPlaneMatrix,d.getElevation),x.isOccluded=!1),x}function ze(v,o,d){return v._unit()._perp()._mult(o*d)}function Ee(v,o,d,m,y,x,M,P,O){if(P.projectionCache.offsets[v])return P.projectionCache.offsets[v];const N=d.add(o);if(v+O.direction<m||v+O.direction>=y)return P.projectionCache.offsets[v]=N,N;const V=ue(v+O.direction,P,O),F=ze(V.sub(d),M,O.direction),Z=d.add(F),J=V.add(F);return P.projectionCache.offsets[v]=l.ak(x,N,Z,J)||N,P.projectionCache.offsets[v]}function We(v,o,d,m,y,x,M,P,O){const N=m?v-o:v+o;let V=N>0?1:-1,F=0;m&&(V*=-1,F=Math.PI),V<0&&(F+=Math.PI);let Z,J=V>0?x+y:x+y+1;P.projectionCache.cachedAnchorPoint?Z=P.projectionCache.cachedAnchorPoint:(Z=Me(P.tileAnchorPoint.x,P.tileAnchorPoint.y,P).point,P.projectionCache.cachedAnchorPoint=Z);let ee,oe,le=Z,ce=Z,he=0,ne=0;const me=Math.abs(N),ge=[];let xe;for(;he+ne<=me;){if(J+=V,J<x||J>=M)return null;he+=ne,ce=le,oe=ee;const et={absOffsetX:me,direction:V,distanceFromAnchor:he,previousVertex:ce};if(le=ue(J,P,et),d===0)ge.push(ce),xe=le.sub(ce);else{let at;const Ye=le.sub(ce);at=Ye.mag()===0?ze(ue(J+V,P,et).sub(le),d,V):ze(Ye,d,V),oe||(oe=ce.add(at)),ee=Ee(J,at,le,x,M,oe,d,P,et),ge.push(oe),xe=ee.sub(oe)}ne=xe.mag()}const Oe=xe._mult((me-he)/ne)._add(oe||ce),Fe=F+Math.atan2(le.y-ce.y,le.x-ce.x);return ge.push(Oe),{point:Oe,angle:O?Fe:0,path:ge}}const xt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function kt(v,o){for(let d=0;d<v;d++){const m=o.length;o.resize(m+4),o.float32.set(xt,3*m)}}function an(v,o,d){const m=o[0],y=o[1];return v[0]=d[0]*m+d[4]*y+d[12],v[1]=d[1]*m+d[5]*y+d[13],v[3]=d[3]*m+d[7]*y+d[15],v}const Lt=100;class ln{constructor(o,d,m=new Kn(o.width+200,o.height+200,25),y=new Kn(o.width+200,o.height+200,25)){this.transform=o,this.mapProjection=d,this.grid=m,this.ignoredGrid=y,this.pitchFactor=Math.cos(o._pitch)*o.cameraToCenterDistance,this.screenRightBoundary=o.width+Lt,this.screenBottomBoundary=o.height+Lt,this.gridRightBoundary=o.width+200,this.gridBottomBoundary=o.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(o,d,m,y,x,M,P,O,N,V,F){const Z=o.anchorPointX+O[0],J=o.anchorPointY+O[1],ee=this.projectAndGetPerspectiveRatio(y,Z,J,x,V),oe=m*ee.perspectiveRatio;let le;if(M||P)le=this._projectCollisionBox(o,oe,y,x,M,P,O,ee,V,F);else{const ge=ee.point.x+(F?F.x*oe:0),xe=ee.point.y+(F?F.y*oe:0);le={allPointsOccluded:!1,box:[ge+o.x1*oe,xe+o.y1*oe,ge+o.x2*oe,xe+o.y2*oe]}}const[ce,he,ne,me]=le.box;return this.mapProjection.useSpecialProjectionForSymbols&&(M?le.allPointsOccluded:this.mapProjection.isOccluded(Z,J,x))||ee.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(ce,he,ne,me)||d!=="always"&&this.grid.hitTest(ce,he,ne,me,d,N)?{box:[ce,he,ne,me],placeable:!1,offscreen:!1}:{box:[ce,he,ne,me],placeable:!0,offscreen:this.isOffscreen(ce,he,ne,me)}}placeCollisionCircles(o,d,m,y,x,M,P,O,N,V,F,Z,J,ee,oe,le){const ce=[],he=new l.P(d.anchorX,d.anchorY),ne=this.getPerspectiveRatio(M,he.x,he.y,P,le),me=(F?x/ne:x*ne)/l.ap,ge={getElevation:le,labelPlaneMatrix:O,lineVertexArray:m,pitchWithMap:F,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:he,unwrappedTileID:P,width:this.transform.width,height:this.transform.height,translation:oe},xe=ie(me,y,d.lineOffsetX*me,d.lineOffsetY*me,!1,d,!1,ge);let Oe=!1,Fe=!1,et=!0;if(xe){const at=.5*J*ne+ee,Ye=new l.P(-100,-100),Ge=new l.P(this.screenRightBoundary,this.screenBottomBoundary),mt=new tt,Bt=xe.first,Je=xe.last;let it=[];for(let $t=Bt.path.length-1;$t>=1;$t--)it.push(Bt.path[$t]);for(let $t=1;$t<Je.path.length;$t++)it.push(Je.path[$t]);const Dt=2.5*at;if(N){const $t=this.projectPathToScreenSpace(it,ge,N);it=$t.some(Jt=>Jt.signedDistanceFromCamera<=0)?[]:$t.map(Jt=>Jt.point)}let Fn=[];if(it.length>0){const $t=it[0].clone(),Jt=it[0].clone();for(let $n=1;$n<it.length;$n++)$t.x=Math.min($t.x,it[$n].x),$t.y=Math.min($t.y,it[$n].y),Jt.x=Math.max(Jt.x,it[$n].x),Jt.y=Math.max(Jt.y,it[$n].y);Fn=$t.x>=Ye.x&&Jt.x<=Ge.x&&$t.y>=Ye.y&&Jt.y<=Ge.y?[it]:Jt.x<Ye.x||$t.x>Ge.x||Jt.y<Ye.y||$t.y>Ge.y?[]:l.al([it],Ye.x,Ye.y,Ge.x,Ge.y)}for(const $t of Fn){mt.reset($t,.25*at);let Jt=0;Jt=mt.length<=.5*at?1:Math.ceil(mt.paddedLength/Dt)+1;for(let $n=0;$n<Jt;$n++){const Bi=$n/Math.max(Jt-1,1),io=mt.lerp(Bi),jn=io.x+Lt,rr=io.y+Lt;ce.push(jn,rr,at,0);const Gi=jn-at,zi=rr-at,Zi=jn+at,Po=rr+at;if(et=et&&this.isOffscreen(Gi,zi,Zi,Po),Fe=Fe||this.isInsideGrid(Gi,zi,Zi,Po),o!=="always"&&this.grid.hitTestCircle(jn,rr,at,o,Z)&&(Oe=!0,!V))return{circles:[],offscreen:!1,collisionDetected:Oe}}}}return{circles:!V&&Oe||!Fe||ne<this.perspectiveRatioCutoff?[]:ce,offscreen:et,collisionDetected:Oe}}projectPathToScreenSpace(o,d,m){return o.map(y=>se(y.x,y.y,m,d.getElevation))}queryRenderedSymbols(o){if(o.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const d=[];let m=1/0,y=1/0,x=-1/0,M=-1/0;for(const V of o){const F=new l.P(V.x+Lt,V.y+Lt);m=Math.min(m,F.x),y=Math.min(y,F.y),x=Math.max(x,F.x),M=Math.max(M,F.y),d.push(F)}const P=this.grid.query(m,y,x,M).concat(this.ignoredGrid.query(m,y,x,M)),O={},N={};for(const V of P){const F=V.key;if(O[F.bucketInstanceId]===void 0&&(O[F.bucketInstanceId]={}),O[F.bucketInstanceId][F.featureIndex])continue;const Z=[new l.P(V.x1,V.y1),new l.P(V.x2,V.y1),new l.P(V.x2,V.y2),new l.P(V.x1,V.y2)];l.am(d,Z)&&(O[F.bucketInstanceId][F.featureIndex]=!0,N[F.bucketInstanceId]===void 0&&(N[F.bucketInstanceId]=[]),N[F.bucketInstanceId].push(F.featureIndex))}return N}insertCollisionBox(o,d,m,y,x,M){(m?this.ignoredGrid:this.grid).insert({bucketInstanceId:y,featureIndex:x,collisionGroupID:M,overlapMode:d},o[0],o[1],o[2],o[3])}insertCollisionCircles(o,d,m,y,x,M){const P=m?this.ignoredGrid:this.grid,O={bucketInstanceId:y,featureIndex:x,collisionGroupID:M,overlapMode:d};for(let N=0;N<o.length;N+=4)P.insertCircle(O,o[N],o[N+1],o[N+2])}projectAndGetPerspectiveRatio(o,d,m,y,x){let M;x?(M=[d,m,x(d,m),1],l.af(M,M,o)):(M=[d,m,0,1],an(M,M,o));const P=M[3];return{point:new l.P((M[0]/P+1)/2*this.transform.width+Lt,(-M[1]/P+1)/2*this.transform.height+Lt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/P*.5,isOccluded:!1,signedDistanceFromCamera:P}}getPerspectiveRatio(o,d,m,y,x){const M=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(d,m,y,x):se(d,m,o,x);return .5+this.transform.cameraToCenterDistance/M.signedDistanceFromCamera*.5}isOffscreen(o,d,m,y){return m<Lt||o>=this.screenRightBoundary||y<Lt||d>this.screenBottomBoundary}isInsideGrid(o,d,m,y){return m>=0&&o<this.gridRightBoundary&&y>=0&&d<this.gridBottomBoundary}getViewportMatrix(){const o=l.an([]);return l.J(o,o,[-100,-100,0]),o}_projectCollisionBox(o,d,m,y,x,M,P,O,N,V){let F=new l.P(1,0),Z=new l.P(0,1);const J=new l.P(o.anchorPointX+P[0],o.anchorPointY+P[1]);if(M&&!x){const et=this.projectAndGetPerspectiveRatio(m,J.x+1,J.y,y,N).point.sub(O.point).unit(),at=Math.atan(et.y/et.x)+(et.x<0?Math.PI:0),Ye=Math.sin(at),Ge=Math.cos(at);F=new l.P(Ge,Ye),Z=new l.P(-Ye,Ge)}else if(!M&&x){const et=-this.transform.angle,at=Math.sin(et),Ye=Math.cos(et);F=new l.P(Ye,at),Z=new l.P(-at,Ye)}let ee=O.point,oe=d;if(x){ee=J;const et=this.transform.zoom-Math.floor(this.transform.zoom);oe=Math.pow(2,-et),oe*=this.mapProjection.getPitchedTextCorrection(this.transform,J,y),V||(oe*=l.ac(.5+O.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}V&&(ee=ee.add(F.mult(V.x*oe)).add(Z.mult(V.y*oe)));const le=o.x1*oe,ce=o.x2*oe,he=(le+ce)/2,ne=o.y1*oe,me=o.y2*oe,ge=(ne+me)/2,xe=[{offsetX:le,offsetY:ne},{offsetX:he,offsetY:ne},{offsetX:ce,offsetY:ne},{offsetX:ce,offsetY:ge},{offsetX:ce,offsetY:me},{offsetX:he,offsetY:me},{offsetX:le,offsetY:me},{offsetX:le,offsetY:ge}];let Oe=[];for(const{offsetX:et,offsetY:at}of xe)Oe.push(new l.P(ee.x+F.x*et+Z.x*at,ee.y+F.y*et+Z.y*at));let Fe=!1;if(x){const et=Oe.map(at=>this.projectAndGetPerspectiveRatio(m,at.x,at.y,y,N));Fe=et.some(at=>!at.isOccluded),Oe=et.map(at=>at.point)}else Fe=!0;return{box:l.ao(Oe),allPointsOccluded:!Fe}}}function Kt(v,o,d){return o*(l.X/(v.tileSize*Math.pow(2,d-v.tileID.overscaledZ)))}class oi{constructor(o,d,m,y){this.opacity=o?Math.max(0,Math.min(1,o.opacity+(o.placed?d:-d))):y&&m?1:0,this.placed=m}isHidden(){return this.opacity===0&&!this.placed}}class Zn{constructor(o,d,m,y,x){this.text=new oi(o?o.text:null,d,m,x),this.icon=new oi(o?o.icon:null,d,y,x)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ut{constructor(o,d,m){this.text=o,this.icon=d,this.skipFade=m}}class wn{constructor(){this.invProjMatrix=l.H(),this.viewportMatrix=l.H(),this.circles=[]}}class qn{constructor(o,d,m,y,x){this.bucketInstanceId=o,this.featureIndex=d,this.sourceLayerIndex=m,this.bucketIndex=y,this.tileID=x}}class gi{constructor(o){this.crossSourceCollisions=o,this.maxGroupID=0,this.collisionGroups={}}get(o){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[o]){const d=++this.maxGroupID;this.collisionGroups[o]={ID:d,predicate:m=>m.collisionGroupID===d}}return this.collisionGroups[o]}}function Si(v,o,d,m,y){const{horizontalAlign:x,verticalAlign:M}=l.au(v);return new l.P(-(x-.5)*o+m[0]*y,-(M-.5)*d+m[1]*y)}class Wi{constructor(o,d,m,y,x,M){this.transform=o.clone(),this.terrain=m,this.collisionIndex=new ln(this.transform,d),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=y,this.retainedQueryData={},this.collisionGroups=new gi(x),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(o){const d=this.terrain;return d?(m,y)=>d.getElevation(o,m,y):null}getBucketParts(o,d,m,y){const x=m.getBucket(d),M=m.latestFeatureIndex;if(!x||!M||d.id!==x.layerIds[0])return;const P=m.collisionBoxArray,O=x.layers[0].layout,N=x.layers[0].paint,V=Math.pow(2,this.transform.zoom-m.tileID.overscaledZ),F=m.tileSize/l.X,Z=m.tileID.toUnwrapped(),J=this.transform.calculatePosMatrix(Z),ee=O.get("text-pitch-alignment")==="map",oe=O.get("text-rotation-alignment")==="map",le=Kt(m,1,this.transform.zoom),ce=this.collisionIndex.mapProjection.translatePosition(this.transform,m,N.get("text-translate"),N.get("text-translate-anchor")),he=this.collisionIndex.mapProjection.translatePosition(this.transform,m,N.get("icon-translate"),N.get("icon-translate-anchor")),ne=qi(J,ee,oe,this.transform,le);let me=null;if(ee){const xe=fr(J,ee,oe,this.transform,le);me=l.L([],this.transform.labelPlaneMatrix,xe)}this.retainedQueryData[x.bucketInstanceId]=new qn(x.bucketInstanceId,M,x.sourceLayerIndex,x.index,m.tileID);const ge={bucket:x,layout:O,translationText:ce,translationIcon:he,posMatrix:J,unwrappedTileID:Z,textLabelPlaneMatrix:ne,labelToScreenMatrix:me,scale:V,textPixelRatio:F,holdingForFade:m.holdingForFade(),collisionBoxArray:P,partiallyEvaluatedTextSize:l.ag(x.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(x.sourceID)};if(y)for(const xe of x.sortKeyRanges){const{sortKey:Oe,symbolInstanceStart:Fe,symbolInstanceEnd:et}=xe;o.push({sortKey:Oe,symbolInstanceStart:Fe,symbolInstanceEnd:et,parameters:ge})}else o.push({symbolInstanceStart:0,symbolInstanceEnd:x.symbolInstances.length,parameters:ge})}attemptAnchorPlacement(o,d,m,y,x,M,P,O,N,V,F,Z,J,ee,oe,le,ce,he,ne){const me=l.aq[o.textAnchor],ge=[o.textOffset0,o.textOffset1],xe=Si(me,m,y,ge,x),Oe=this.collisionIndex.placeCollisionBox(d,Z,O,N,V,P,M,le,F.predicate,ne,xe);if((!he||this.collisionIndex.placeCollisionBox(he,Z,O,N,V,P,M,ce,F.predicate,ne,xe).placeable)&&Oe.placeable){let Fe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[J.crossTileID]&&this.prevPlacement.placements[J.crossTileID]&&this.prevPlacement.placements[J.crossTileID].text&&(Fe=this.prevPlacement.variableOffsets[J.crossTileID].anchor),J.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[J.crossTileID]={textOffset:ge,width:m,height:y,anchor:me,textBoxScale:x,prevAnchor:Fe},this.markUsedJustification(ee,me,J,oe),ee.allowVerticalPlacement&&(this.markUsedOrientation(ee,oe,J),this.placedOrientations[J.crossTileID]=oe),{shift:xe,placedGlyphBoxes:Oe}}}placeLayerBucketPart(o,d,m){const{bucket:y,layout:x,translationText:M,translationIcon:P,posMatrix:O,unwrappedTileID:N,textLabelPlaneMatrix:V,labelToScreenMatrix:F,textPixelRatio:Z,holdingForFade:J,collisionBoxArray:ee,partiallyEvaluatedTextSize:oe,collisionGroup:le}=o.parameters,ce=x.get("text-optional"),he=x.get("icon-optional"),ne=l.ar(x,"text-overlap","text-allow-overlap"),me=ne==="always",ge=l.ar(x,"icon-overlap","icon-allow-overlap"),xe=ge==="always",Oe=x.get("text-rotation-alignment")==="map",Fe=x.get("text-pitch-alignment")==="map",et=x.get("icon-text-fit")!=="none",at=x.get("symbol-z-order")==="viewport-y",Ye=me&&(xe||!y.hasIconData()||he),Ge=xe&&(me||!y.hasTextData()||ce);!y.collisionArrays&&ee&&y.deserializeCollisionBoxes(ee);const mt=this._getTerrainElevationFunc(this.retainedQueryData[y.bucketInstanceId].tileID),Bt=(Je,it,Dt)=>{var Fn,$t;if(d[Je.crossTileID])return;if(J)return void(this.placements[Je.crossTileID]=new Ut(!1,!1,!1));let Jt=!1,$n=!1,Bi=!0,io=null,jn={box:null,placeable:!1,offscreen:null},rr={box:null,placeable:!1,offscreen:null},Gi=null,zi=null,Zi=null,Po=0,Ka=0,Du=0;it.textFeatureIndex?Po=it.textFeatureIndex:Je.useRuntimeCollisionCircles&&(Po=Je.featureIndex),it.verticalTextFeatureIndex&&(Ka=it.verticalTextFeatureIndex);const Ja=it.textBox;if(Ja){const $r=Ei=>{let Ni=l.ah.horizontal;if(y.allowVerticalPlacement&&!Ei&&this.prevPlacement){const xr=this.prevPlacement.placedOrientations[Je.crossTileID];xr&&(this.placedOrientations[Je.crossTileID]=xr,Ni=xr,this.markUsedOrientation(y,Ni,Je))}return Ni},jr=(Ei,Ni)=>{if(y.allowVerticalPlacement&&Je.numVerticalGlyphVertices>0&&it.verticalTextBox){for(const xr of y.writingModes)if(xr===l.ah.vertical?(jn=Ni(),rr=jn):jn=Ei(),jn&&jn.placeable)break}else jn=Ei()},fs=Je.textAnchorOffsetStartIndex,ro=Je.textAnchorOffsetEndIndex;if(ro===fs){const Ei=(Ni,xr)=>{const tn=this.collisionIndex.placeCollisionBox(Ni,ne,Z,O,N,Fe,Oe,M,le.predicate,mt);return tn&&tn.placeable&&(this.markUsedOrientation(y,xr,Je),this.placedOrientations[Je.crossTileID]=xr),tn};jr(()=>Ei(Ja,l.ah.horizontal),()=>{const Ni=it.verticalTextBox;return y.allowVerticalPlacement&&Je.numVerticalGlyphVertices>0&&Ni?Ei(Ni,l.ah.vertical):{box:null,offscreen:null}}),$r(jn&&jn.placeable)}else{let Ei=l.aq[($t=(Fn=this.prevPlacement)===null||Fn===void 0?void 0:Fn.variableOffsets[Je.crossTileID])===null||$t===void 0?void 0:$t.anchor];const Ni=(tn,Js,Qa)=>{const el=tn.x2-tn.x1,Pm=tn.y2-tn.y1,O_=Je.textBoxScale,Dm=et&&ge==="never"?Js:null;let ms=null,Om=ne==="never"?1:2,Bu="never";Ei&&Om++;for(let nc=0;nc<Om;nc++){for(let zu=fs;zu<ro;zu++){const Nu=y.textAnchorOffsets.get(zu);if(Ei&&Nu.textAnchor!==Ei)continue;const tl=this.attemptAnchorPlacement(Nu,tn,el,Pm,O_,Oe,Fe,Z,O,N,le,Bu,Je,y,Qa,M,P,Dm,mt);if(tl&&(ms=tl.placedGlyphBoxes,ms&&ms.placeable))return Jt=!0,io=tl.shift,ms}Ei?Ei=null:Bu=ne}return m&&!ms&&(ms={box:this.collisionIndex.placeCollisionBox(Ja,"always",Z,O,N,Fe,Oe,M,le.predicate,mt,new l.P(0,0)).box,offscreen:!1,placeable:!1}),ms};jr(()=>Ni(Ja,it.iconBox,l.ah.horizontal),()=>{const tn=it.verticalTextBox;return y.allowVerticalPlacement&&(!jn||!jn.placeable)&&Je.numVerticalGlyphVertices>0&&tn?Ni(tn,it.verticalIconBox,l.ah.vertical):{box:null,occluded:!0,offscreen:null}}),jn&&(Jt=jn.placeable,Bi=jn.offscreen);const xr=$r(jn&&jn.placeable);if(!Jt&&this.prevPlacement){const tn=this.prevPlacement.variableOffsets[Je.crossTileID];tn&&(this.variableOffsets[Je.crossTileID]=tn,this.markUsedJustification(y,tn.anchor,Je,xr))}}}if(Gi=jn,Jt=Gi&&Gi.placeable,Bi=Gi&&Gi.offscreen,Je.useRuntimeCollisionCircles){const $r=y.text.placedSymbolArray.get(Je.centerJustifiedTextSymbolIndex),jr=l.ai(y.textSizeData,oe,$r),fs=x.get("text-padding");zi=this.collisionIndex.placeCollisionCircles(ne,$r,y.lineVertexArray,y.glyphOffsetArray,jr,O,N,V,F,m,Fe,le.predicate,Je.collisionCircleDiameter,fs,M,mt),zi.circles.length&&zi.collisionDetected&&!m&&l.w("Collisions detected, but collision boxes are not shown"),Jt=me||zi.circles.length>0&&!zi.collisionDetected,Bi=Bi&&zi.offscreen}if(it.iconFeatureIndex&&(Du=it.iconFeatureIndex),it.iconBox){const $r=jr=>this.collisionIndex.placeCollisionBox(jr,ge,Z,O,N,Fe,Oe,P,le.predicate,mt,et&&io?io:void 0);rr&&rr.placeable&&it.verticalIconBox?(Zi=$r(it.verticalIconBox),$n=Zi.placeable):(Zi=$r(it.iconBox),$n=Zi.placeable),Bi=Bi&&Zi.offscreen}const Fr=ce||Je.numHorizontalGlyphVertices===0&&Je.numVerticalGlyphVertices===0,Ou=he||Je.numIconVertices===0;Fr||Ou?Ou?Fr||($n=$n&&Jt):Jt=$n&&Jt:$n=Jt=$n&&Jt;const Rd=$n&&Zi.placeable;if(Jt&&Gi.placeable&&this.collisionIndex.insertCollisionBox(Gi.box,ne,x.get("text-ignore-placement"),y.bucketInstanceId,rr&&rr.placeable&&Ka?Ka:Po,le.ID),Rd&&this.collisionIndex.insertCollisionBox(Zi.box,ge,x.get("icon-ignore-placement"),y.bucketInstanceId,Du,le.ID),zi&&Jt&&this.collisionIndex.insertCollisionCircles(zi.circles,ne,x.get("text-ignore-placement"),y.bucketInstanceId,Po,le.ID),m&&this.storeCollisionData(y.bucketInstanceId,Dt,it,Gi,Zi,zi),Je.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(y.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Je.crossTileID]=new Ut(Jt||Ye,$n||Ge,Bi||y.justReloaded),d[Je.crossTileID]=!0};if(at){if(o.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Je=y.getSortedSymbolIndexes(this.transform.angle);for(let it=Je.length-1;it>=0;--it){const Dt=Je[it];Bt(y.symbolInstances.get(Dt),y.collisionArrays[Dt],Dt)}}else for(let Je=o.symbolInstanceStart;Je<o.symbolInstanceEnd;Je++)Bt(y.symbolInstances.get(Je),y.collisionArrays[Je],Je);if(m&&y.bucketInstanceId in this.collisionCircleArrays){const Je=this.collisionCircleArrays[y.bucketInstanceId];l.as(Je.invProjMatrix,O),Je.viewportMatrix=this.collisionIndex.getViewportMatrix()}y.justReloaded=!1}storeCollisionData(o,d,m,y,x,M){if(m.textBox||m.iconBox){let P,O;this.collisionBoxArrays.has(o)?P=this.collisionBoxArrays.get(o):(P=new Map,this.collisionBoxArrays.set(o,P)),P.has(d)?O=P.get(d):(O={text:null,icon:null},P.set(d,O)),m.textBox&&(O.text=y.box),m.iconBox&&(O.icon=x.box)}if(M){let P=this.collisionCircleArrays[o];P===void 0&&(P=this.collisionCircleArrays[o]=new wn);for(let O=0;O<M.circles.length;O+=4)P.circles.push(M.circles[O+0]),P.circles.push(M.circles[O+1]),P.circles.push(M.circles[O+2]),P.circles.push(M.collisionDetected?1:0)}}markUsedJustification(o,d,m,y){let x;x=y===l.ah.vertical?m.verticalPlacedTextSymbolIndex:{left:m.leftJustifiedTextSymbolIndex,center:m.centerJustifiedTextSymbolIndex,right:m.rightJustifiedTextSymbolIndex}[l.at(d)];const M=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex,m.verticalPlacedTextSymbolIndex];for(const P of M)P>=0&&(o.text.placedSymbolArray.get(P).crossTileID=x>=0&&P!==x?0:m.crossTileID)}markUsedOrientation(o,d,m){const y=d===l.ah.horizontal||d===l.ah.horizontalOnly?d:0,x=d===l.ah.vertical?d:0,M=[m.leftJustifiedTextSymbolIndex,m.centerJustifiedTextSymbolIndex,m.rightJustifiedTextSymbolIndex];for(const P of M)o.text.placedSymbolArray.get(P).placedOrientation=y;m.verticalPlacedTextSymbolIndex&&(o.text.placedSymbolArray.get(m.verticalPlacedTextSymbolIndex).placedOrientation=x)}commit(o){this.commitTime=o,this.zoomAtLastRecencyCheck=this.transform.zoom;const d=this.prevPlacement;let m=!1;this.prevZoomAdjustment=d?d.zoomAdjustment(this.transform.zoom):0;const y=d?d.symbolFadeChange(o):1,x=d?d.opacities:{},M=d?d.variableOffsets:{},P=d?d.placedOrientations:{};for(const O in this.placements){const N=this.placements[O],V=x[O];V?(this.opacities[O]=new Zn(V,y,N.text,N.icon),m=m||N.text!==V.text.placed||N.icon!==V.icon.placed):(this.opacities[O]=new Zn(null,y,N.text,N.icon,N.skipFade),m=m||N.text||N.icon)}for(const O in x){const N=x[O];if(!this.opacities[O]){const V=new Zn(N,y,!1,!1);V.isHidden()||(this.opacities[O]=V,m=m||N.text.placed||N.icon.placed)}}for(const O in M)this.variableOffsets[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.variableOffsets[O]=M[O]);for(const O in P)this.placedOrientations[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.placedOrientations[O]=P[O]);if(d&&d.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");m?this.lastPlacementChangeTime=o:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=d?d.lastPlacementChangeTime:o)}updateLayerOpacities(o,d){const m={};for(const y of d){const x=y.getBucket(o);x&&y.latestFeatureIndex&&o.id===x.layerIds[0]&&this.updateBucketOpacities(x,y.tileID,m,y.collisionBoxArray)}}updateBucketOpacities(o,d,m,y){o.hasTextData()&&(o.text.opacityVertexArray.clear(),o.text.hasVisibleVertices=!1),o.hasIconData()&&(o.icon.opacityVertexArray.clear(),o.icon.hasVisibleVertices=!1),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexArray.clear(),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexArray.clear();const x=o.layers[0],M=x.layout,P=new Zn(null,0,!1,!1,!0),O=M.get("text-allow-overlap"),N=M.get("icon-allow-overlap"),V=x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"),F=M.get("text-rotation-alignment")==="map",Z=M.get("text-pitch-alignment")==="map",J=M.get("icon-text-fit")!=="none",ee=new Zn(null,0,O&&(N||!o.hasIconData()||M.get("icon-optional")),N&&(O||!o.hasTextData()||M.get("text-optional")),!0);!o.collisionArrays&&y&&(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData())&&o.deserializeCollisionBoxes(y);const oe=(ce,he,ne)=>{for(let me=0;me<he/4;me++)ce.opacityVertexArray.emplaceBack(ne);ce.hasVisibleVertices=ce.hasVisibleVertices||ne!==Ia},le=this.collisionBoxArrays.get(o.bucketInstanceId);for(let ce=0;ce<o.symbolInstances.length;ce++){const he=o.symbolInstances.get(ce),{numHorizontalGlyphVertices:ne,numVerticalGlyphVertices:me,crossTileID:ge}=he;let xe=this.opacities[ge];m[ge]?xe=P:xe||(xe=ee,this.opacities[ge]=xe),m[ge]=!0;const Oe=he.numIconVertices>0,Fe=this.placedOrientations[he.crossTileID],et=Fe===l.ah.vertical,at=Fe===l.ah.horizontal||Fe===l.ah.horizontalOnly;if(ne>0||me>0){const Ge=yr(xe.text);oe(o.text,ne,et?Ia:Ge),oe(o.text,me,at?Ia:Ge);const mt=xe.text.isHidden();[he.rightJustifiedTextSymbolIndex,he.centerJustifiedTextSymbolIndex,he.leftJustifiedTextSymbolIndex].forEach(it=>{it>=0&&(o.text.placedSymbolArray.get(it).hidden=mt||et?1:0)}),he.verticalPlacedTextSymbolIndex>=0&&(o.text.placedSymbolArray.get(he.verticalPlacedTextSymbolIndex).hidden=mt||at?1:0);const Bt=this.variableOffsets[he.crossTileID];Bt&&this.markUsedJustification(o,Bt.anchor,he,Fe);const Je=this.placedOrientations[he.crossTileID];Je&&(this.markUsedJustification(o,"left",he,Je),this.markUsedOrientation(o,Je,he))}if(Oe){const Ge=yr(xe.icon),mt=!(J&&he.verticalPlacedIconSymbolIndex&&et);he.placedIconSymbolIndex>=0&&(oe(o.icon,he.numIconVertices,mt?Ge:Ia),o.icon.placedSymbolArray.get(he.placedIconSymbolIndex).hidden=xe.icon.isHidden()),he.verticalPlacedIconSymbolIndex>=0&&(oe(o.icon,he.numVerticalIconVertices,mt?Ia:Ge),o.icon.placedSymbolArray.get(he.verticalPlacedIconSymbolIndex).hidden=xe.icon.isHidden())}const Ye=le&&le.has(ce)?le.get(ce):{text:null,icon:null};if(o.hasIconCollisionBoxData()||o.hasTextCollisionBoxData()){const Ge=o.collisionArrays[ce];if(Ge){let mt=new l.P(0,0);if(Ge.textBox||Ge.verticalTextBox){let Bt=!0;if(V){const Je=this.variableOffsets[ge];Je?(mt=Si(Je.anchor,Je.width,Je.height,Je.textOffset,Je.textBoxScale),F&&mt._rotate(Z?this.transform.angle:-this.transform.angle)):Bt=!1}if(Ge.textBox||Ge.verticalTextBox){let Je;Ge.textBox&&(Je=et),Ge.verticalTextBox&&(Je=at),Aa(o.textCollisionBox.collisionVertexArray,xe.text.placed,!Bt||Je,Ye.text,mt.x,mt.y)}}if(Ge.iconBox||Ge.verticalIconBox){const Bt=!!(!at&&Ge.verticalIconBox);let Je;Ge.iconBox&&(Je=Bt),Ge.verticalIconBox&&(Je=!Bt),Aa(o.iconCollisionBox.collisionVertexArray,xe.icon.placed,Je,Ye.icon,J?mt.x:0,J?mt.y:0)}}}}if(o.sortFeatures(this.transform.angle),this.retainedQueryData[o.bucketInstanceId]&&(this.retainedQueryData[o.bucketInstanceId].featureSortOrder=o.featureSortOrder),o.hasTextData()&&o.text.opacityVertexBuffer&&o.text.opacityVertexBuffer.updateData(o.text.opacityVertexArray),o.hasIconData()&&o.icon.opacityVertexBuffer&&o.icon.opacityVertexBuffer.updateData(o.icon.opacityVertexArray),o.hasIconCollisionBoxData()&&o.iconCollisionBox.collisionVertexBuffer&&o.iconCollisionBox.collisionVertexBuffer.updateData(o.iconCollisionBox.collisionVertexArray),o.hasTextCollisionBoxData()&&o.textCollisionBox.collisionVertexBuffer&&o.textCollisionBox.collisionVertexBuffer.updateData(o.textCollisionBox.collisionVertexArray),o.text.opacityVertexArray.length!==o.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${o.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${o.text.layoutVertexArray.length}) / 4`);if(o.icon.opacityVertexArray.length!==o.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${o.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${o.icon.layoutVertexArray.length}) / 4`);if(o.bucketInstanceId in this.collisionCircleArrays){const ce=this.collisionCircleArrays[o.bucketInstanceId];o.placementInvProjMatrix=ce.invProjMatrix,o.placementViewportMatrix=ce.viewportMatrix,o.collisionCircleArray=ce.circles,delete this.collisionCircleArrays[o.bucketInstanceId]}}symbolFadeChange(o){return this.fadeDuration===0?1:(o-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(o){return Math.max(0,(this.transform.zoom-o)/1.5)}hasTransitions(o){return this.stale||o-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(o,d){const m=this.zoomAtLastRecencyCheck===d?1-this.zoomAdjustment(d):1;return this.zoomAtLastRecencyCheck=d,this.commitTime+this.fadeDuration*m>o}setStale(){this.stale=!0}}function Aa(v,o,d,m,y,x){m&&m.length!==0||(m=[0,0,0,0]);const M=m[0]-Lt,P=m[1]-Lt,O=m[2]-Lt,N=m[3]-Lt;v.emplaceBack(o?1:0,d?1:0,y||0,x||0,M,P),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,O,P),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,O,N),v.emplaceBack(o?1:0,d?1:0,y||0,x||0,M,N)}const kn=Math.pow(2,25),Yh=Math.pow(2,24),Xh=Math.pow(2,17),mr=Math.pow(2,16),gr=Math.pow(2,9),a_=Math.pow(2,8),Nr=Math.pow(2,1);function yr(v){if(v.opacity===0&&!v.placed)return 0;if(v.opacity===1&&v.placed)return 4294967295;const o=v.placed?1:0,d=Math.floor(127*v.opacity);return d*kn+o*Yh+d*Xh+o*mr+d*gr+o*a_+d*Nr+o}const Ia=0;function Fs(){return{isOccluded:(v,o,d)=>!1,getPitchedTextCorrection:(v,o,d)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(v,o,d,m){throw new Error("Not implemented.")},translatePosition:(v,o,d,m)=>function(y,x,M,P,O=!1){if(!M[0]&&!M[1])return[0,0];const N=O?P==="map"?y.angle:0:P==="viewport"?-y.angle:0;if(N){const V=Math.sin(N),F=Math.cos(N);M=[M[0]*F-M[1]*V,M[0]*V+M[1]*F]}return[O?M[0]:Kt(x,M[0],y.zoom),O?M[1]:Kt(x,M[1],y.zoom)]}(v,o,d,m),getCircleRadiusCorrection:v=>1}}class si{constructor(o){this._sortAcrossTiles=o.layout.get("symbol-z-order")!=="viewport-y"&&!o.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(o,d,m,y,x){const M=this._bucketParts;for(;this._currentTileIndex<o.length;)if(d.getBucketParts(M,y,o[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,x())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,M.sort((P,O)=>P.sortKey-O.sortKey));this._currentPartIndex<M.length;)if(d.placeLayerBucketPart(M[this._currentPartIndex],this._seenCrossTileIDs,m),this._currentPartIndex++,x())return!0;return!1}}class Rl{constructor(o,d,m,y,x,M,P,O){this.placement=new Wi(o,Fs(),d,M,P,O),this._currentPlacementIndex=m.length-1,this._forceFullPlacement=y,this._showCollisionBoxes=x,this._done=!1}isDone(){return this._done}continuePlacement(o,d,m){const y=E.now(),x=()=>!this._forceFullPlacement&&E.now()-y>2;for(;this._currentPlacementIndex>=0;){const M=d[o[this._currentPlacementIndex]],P=this.placement.collisionIndex.transform.zoom;if(M.type==="symbol"&&(!M.minzoom||M.minzoom<=P)&&(!M.maxzoom||M.maxzoom>P)){if(this._inProgressLayer||(this._inProgressLayer=new si(M)),this._inProgressLayer.continuePlacement(m[M.source],this.placement,this._showCollisionBoxes,M,x))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(o){return this.placement.commit(o),this.placement}}const Jr=512/l.X/2;class ni{constructor(o,d,m){this.tileID=o,this.bucketInstanceId=m,this._symbolsByKey={};const y=new Map;for(let x=0;x<d.length;x++){const M=d.get(x),P=M.key,O=y.get(P);O?O.push(M):y.set(P,[M])}for(const[x,M]of y){const P={positions:M.map(O=>({x:Math.floor(O.anchorX*Jr),y:Math.floor(O.anchorY*Jr)})),crossTileIDs:M.map(O=>O.crossTileID)};if(P.positions.length>128){const O=new l.av(P.positions.length,16,Uint16Array);for(const{x:N,y:V}of P.positions)O.add(N,V);O.finish(),delete P.positions,P.index=O}this._symbolsByKey[x]=P}}getScaledCoordinates(o,d){const{x:m,y,z:x}=this.tileID.canonical,{x:M,y:P,z:O}=d.canonical,N=Jr/Math.pow(2,O-x),V=(P*l.X+o.anchorY)*N,F=y*l.X*Jr;return{x:Math.floor((M*l.X+o.anchorX)*N-m*l.X*Jr),y:Math.floor(V-F)}}findMatches(o,d,m){const y=this.tileID.canonical.z<d.canonical.z?1:Math.pow(2,this.tileID.canonical.z-d.canonical.z);for(let x=0;x<o.length;x++){const M=o.get(x);if(M.crossTileID)continue;const P=this._symbolsByKey[M.key];if(!P)continue;const O=this.getScaledCoordinates(M,d);if(P.index){const N=P.index.range(O.x-y,O.y-y,O.x+y,O.y+y).sort();for(const V of N){const F=P.crossTileIDs[V];if(!m[F]){m[F]=!0,M.crossTileID=F;break}}}else if(P.positions)for(let N=0;N<P.positions.length;N++){const V=P.positions[N],F=P.crossTileIDs[N];if(Math.abs(V.x-O.x)<=y&&Math.abs(V.y-O.y)<=y&&!m[F]){m[F]=!0,M.crossTileID=F;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:o})=>o)}}class tu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Qr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(o){const d=Math.round((o-this.lng)/360);if(d!==0)for(const m in this.indexes){const y=this.indexes[m],x={};for(const M in y){const P=y[M];P.tileID=P.tileID.unwrapTo(P.tileID.wrap+d),x[P.tileID.key]=P}this.indexes[m]=x}this.lng=o}addBucket(o,d,m){if(this.indexes[o.overscaledZ]&&this.indexes[o.overscaledZ][o.key]){if(this.indexes[o.overscaledZ][o.key].bucketInstanceId===d.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(o.overscaledZ,this.indexes[o.overscaledZ][o.key])}for(let x=0;x<d.symbolInstances.length;x++)d.symbolInstances.get(x).crossTileID=0;this.usedCrossTileIDs[o.overscaledZ]||(this.usedCrossTileIDs[o.overscaledZ]={});const y=this.usedCrossTileIDs[o.overscaledZ];for(const x in this.indexes){const M=this.indexes[x];if(Number(x)>o.overscaledZ)for(const P in M){const O=M[P];O.tileID.isChildOf(o)&&O.findMatches(d.symbolInstances,o,y)}else{const P=M[o.scaledTo(Number(x)).key];P&&P.findMatches(d.symbolInstances,o,y)}}for(let x=0;x<d.symbolInstances.length;x++){const M=d.symbolInstances.get(x);M.crossTileID||(M.crossTileID=m.generate(),y[M.crossTileID]=!0)}return this.indexes[o.overscaledZ]===void 0&&(this.indexes[o.overscaledZ]={}),this.indexes[o.overscaledZ][o.key]=new ni(o,d.symbolInstances,d.bucketInstanceId),!0}removeBucketCrossTileIDs(o,d){for(const m of d.getCrossTileIDsLists())for(const y of m)delete this.usedCrossTileIDs[o][y]}removeStaleBuckets(o){let d=!1;for(const m in this.indexes){const y=this.indexes[m];for(const x in y)o[y[x].bucketInstanceId]||(this.removeBucketCrossTileIDs(m,y[x]),delete y[x],d=!0)}return d}}class Kh{constructor(){this.layerIndexes={},this.crossTileIDs=new tu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(o,d,m){let y=this.layerIndexes[o.id];y===void 0&&(y=this.layerIndexes[o.id]=new Qr);let x=!1;const M={};y.handleWrapJump(m);for(const P of d){const O=P.getBucket(o);O&&o.id===O.layerIds[0]&&(O.bucketInstanceId||(O.bucketInstanceId=++this.maxBucketInstanceId),y.addBucket(P.tileID,O,this.crossTileIDs)&&(x=!0),M[O.bucketInstanceId]=!0)}return y.removeStaleBuckets(M)&&(x=!0),x}pruneUnusedLayers(o){const d={};o.forEach(m=>{d[m]=!0});for(const m in this.layerIndexes)d[m]||delete this.layerIndexes[m]}}const eo=(v,o)=>l.t(v,o&&o.filter(d=>d.identifier!=="source.canvas")),l_=l.aw();class nu extends l.E{constructor(o,d={}){super(),this._rtlPluginLoaded=()=>{for(const m in this.sourceCaches){const y=this.sourceCaches[m].getSource().type;y!=="vector"&&y!=="geojson"||this.sourceCaches[m].reload()}},this.map=o,this.dispatcher=new Be(Ke(),o._getMapId()),this.dispatcher.registerMessageHandler("GG",(m,y)=>this.getGlyphs(m,y)),this.dispatcher.registerMessageHandler("GI",(m,y)=>this.getImages(m,y)),this.imageManager=new st,this.imageManager.setEventedParent(this),this.glyphManager=new Ft(o._requestManager,d.localIdeographFontFamily),this.lineAtlas=new ti(256,512),this.crossTileSymbolIndex=new Kh,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ay()),zr().on(Ve,this._rtlPluginLoaded),this.on("data",m=>{if(m.dataType!=="source"||m.sourceDataType!=="metadata")return;const y=this.sourceCaches[m.sourceId];if(!y)return;const x=y.getSource();if(x&&x.vectorLayerIds)for(const M in this._layers){const P=this._layers[M];P.source===x.id&&this._validateLayer(P)}})}loadURL(o,d={},m){this.fire(new l.k("dataloading",{dataType:"style"})),d.validate=typeof d.validate!="boolean"||d.validate;const y=this.map._requestManager.transformRequest(o,"Style");this._loadStyleRequest=new AbortController;const x=this._loadStyleRequest;l.h(y,this._loadStyleRequest).then(M=>{this._loadStyleRequest=null,this._load(M.data,d,m)}).catch(M=>{this._loadStyleRequest=null,M&&!x.signal.aborted&&this.fire(new l.j(M))})}loadJSON(o,d={},m){this.fire(new l.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,d.validate=d.validate!==!1,this._load(o,d,m)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(l_,{validate:!1})}_load(o,d,m){var y;const x=d.transformStyle?d.transformStyle(m,o):o;if(!d.validate||!eo(this,l.u(x))){this._loaded=!0,this.stylesheet=x;for(const M in x.sources)this.addSource(M,x.sources[M],{validate:!1});x.sprite?this._loadSprite(x.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(x.glyphs),this._createLayers(),this.light=new dn(this.stylesheet.light),this.sky=new pn(this.stylesheet.sky),this.map.setTerrain((y=this.stylesheet.terrain)!==null&&y!==void 0?y:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const o=l.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",o),this._order=o.map(d=>d.id),this._layers={},this._serializedLayers=null;for(const d of o){const m=l.aA(d);m.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=m}}_loadSprite(o,d=!1,m=void 0){let y;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(x,M,P,O){return l._(this,void 0,void 0,function*(){const N=Ae(x),V=P>1?"@2x":"",F={},Z={};for(const{id:J,url:ee}of N){const oe=M.transformRequest($e(ee,V,".json"),"SpriteJSON");F[J]=l.h(oe,O);const le=M.transformRequest($e(ee,V,".png"),"SpriteImage");Z[J]=G.getImage(le,O)}return yield Promise.all([...Object.values(F),...Object.values(Z)]),function(J,ee){return l._(this,void 0,void 0,function*(){const oe={};for(const le in J){oe[le]={};const ce=E.getImageCanvasContext((yield ee[le]).data),he=(yield J[le]).data;for(const ne in he){const{width:me,height:ge,x:xe,y:Oe,sdf:Fe,pixelRatio:et,stretchX:at,stretchY:Ye,content:Ge,textFitWidth:mt,textFitHeight:Bt}=he[ne];oe[le][ne]={data:null,pixelRatio:et,sdf:Fe,stretchX:at,stretchY:Ye,content:Ge,textFitWidth:mt,textFitHeight:Bt,spriteData:{width:me,height:ge,x:xe,y:Oe,context:ce}}}}return oe})}(F,Z)})}(o,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(x=>{if(this._spriteRequest=null,x)for(const M in x){this._spritesImagesIds[M]=[];const P=this._spritesImagesIds[M]?this._spritesImagesIds[M].filter(O=>!(O in x)):[];for(const O of P)this.imageManager.removeImage(O),this._changedImages[O]=!0;for(const O in x[M]){const N=M==="default"?O:`${M}:${O}`;this._spritesImagesIds[M].push(N),N in this.imageManager.images?this.imageManager.updateImage(N,x[M][O],!1):this.imageManager.addImage(N,x[M][O]),d&&(this._changedImages[N]=!0)}}}).catch(x=>{this._spriteRequest=null,y=x,this.fire(new l.j(y))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),d&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),m&&m(y)})}_unloadSprite(){for(const o of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(o),this._changedImages[o]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(o){const d=this.sourceCaches[o.source];if(!d)return;const m=o.sourceLayer;if(!m)return;const y=d.getSource();(y.type==="geojson"||y.vectorLayerIds&&y.vectorLayerIds.indexOf(m)===-1)&&this.fire(new l.j(new Error(`Source layer "${m}" does not exist on source "${y.id}" as specified by style layer "${o.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const o in this.sourceCaches)if(!this.sourceCaches[o].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(o,d=!1){const m=this._serializedAllLayers();if(!o||o.length===0)return Object.values(d?l.aB(m):m);const y=[];for(const x of o)if(m[x]){const M=d?l.aB(m[x]):m[x];y.push(M)}return y}_serializedAllLayers(){let o=this._serializedLayers;if(o)return o;o=this._serializedLayers={};const d=Object.keys(this._layers);for(const m of d){const y=this._layers[m];y.type!=="custom"&&(o[m]=y.serialize())}return o}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const o in this.sourceCaches)if(this.sourceCaches[o].hasTransition())return!0;for(const o in this._layers)if(this._layers[o].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(o){if(!this._loaded)return;const d=this._changed;if(d){const y=Object.keys(this._updatedLayers),x=Object.keys(this._removedLayers);(y.length||x.length)&&this._updateWorkerLayers(y,x);for(const M in this._updatedSources){const P=this._updatedSources[M];if(P==="reload")this._reloadSource(M);else{if(P!=="clear")throw new Error(`Invalid action ${P}`);this._clearSource(M)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const M in this._updatedPaintProps)this._layers[M].updateTransitions(o);this.light.updateTransitions(o),this.sky.updateTransitions(o),this._resetUpdates()}const m={};for(const y in this.sourceCaches){const x=this.sourceCaches[y];m[y]=x.used,x.used=!1}for(const y of this._order){const x=this._layers[y];x.recalculate(o,this._availableImages),!x.isHidden(o.zoom)&&x.source&&(this.sourceCaches[x.source].used=!0)}for(const y in m){const x=this.sourceCaches[y];!!m[y]!=!!x.used&&x.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:y}))}this.light.recalculate(o),this.sky.recalculate(o),this.z=o.zoom,d&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const o=Object.keys(this._changedImages);if(o.length){for(const d in this.sourceCaches)this.sourceCaches[d].reloadTilesForDependencies(["icons","patterns"],o);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(o,d){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(o,!1),removedIds:d})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(o,d={}){var m;this._checkLoaded();const y=this.serialize();if(o=d.transformStyle?d.transformStyle(y,o):o,((m=d.validate)===null||m===void 0||m)&&eo(this,l.u(o)))return!1;(o=l.aB(o)).layers=l.az(o.layers);const x=l.aC(y,o),M=this._getOperationsToPerform(x);if(M.unimplemented.length>0)throw new Error(`Unimplemented: ${M.unimplemented.join(", ")}.`);if(M.operations.length===0)return!1;for(const P of M.operations)P();return this.stylesheet=o,this._serializedLayers=null,!0}_getOperationsToPerform(o){const d=[],m=[];for(const y of o)switch(y.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":d.push(()=>this.addLayer.apply(this,y.args));break;case"removeLayer":d.push(()=>this.removeLayer.apply(this,y.args));break;case"setPaintProperty":d.push(()=>this.setPaintProperty.apply(this,y.args));break;case"setLayoutProperty":d.push(()=>this.setLayoutProperty.apply(this,y.args));break;case"setFilter":d.push(()=>this.setFilter.apply(this,y.args));break;case"addSource":d.push(()=>this.addSource.apply(this,y.args));break;case"removeSource":d.push(()=>this.removeSource.apply(this,y.args));break;case"setLayerZoomRange":d.push(()=>this.setLayerZoomRange.apply(this,y.args));break;case"setLight":d.push(()=>this.setLight.apply(this,y.args));break;case"setGeoJSONSourceData":d.push(()=>this.setGeoJSONSourceData.apply(this,y.args));break;case"setGlyphs":d.push(()=>this.setGlyphs.apply(this,y.args));break;case"setSprite":d.push(()=>this.setSprite.apply(this,y.args));break;case"setSky":d.push(()=>this.setSky.apply(this,y.args));break;case"setTerrain":d.push(()=>this.map.setTerrain.apply(this,y.args));break;case"setTransition":d.push(()=>{});break;default:m.push(y.command)}return{operations:d,unimplemented:m}}addImage(o,d){if(this.getImage(o))return this.fire(new l.j(new Error(`An image named "${o}" already exists.`)));this.imageManager.addImage(o,d),this._afterImageUpdated(o)}updateImage(o,d){this.imageManager.updateImage(o,d)}getImage(o){return this.imageManager.getImage(o)}removeImage(o){if(!this.getImage(o))return this.fire(new l.j(new Error(`An image named "${o}" does not exist.`)));this.imageManager.removeImage(o),this._afterImageUpdated(o)}_afterImageUpdated(o){this._availableImages=this.imageManager.listImages(),this._changedImages[o]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(o,d,m={}){if(this._checkLoaded(),this.sourceCaches[o]!==void 0)throw new Error(`Source "${o}" already exists.`);if(!d.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(d).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(d.type)>=0&&this._validate(l.u.source,`sources.${o}`,d,null,m))return;this.map&&this.map._collectResourceTiming&&(d.collectResourceTiming=!0);const y=this.sourceCaches[o]=new Le(o,d,this.dispatcher);y.style=this,y.setEventedParent(this,()=>({isSourceLoaded:y.loaded(),source:y.serialize(),sourceId:o})),y.onAdd(this.map),this._changed=!0}removeSource(o){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error("There is no source with this ID");for(const m in this._layers)if(this._layers[m].source===o)return this.fire(new l.j(new Error(`Source "${o}" cannot be removed while layer "${m}" is using it.`)));const d=this.sourceCaches[o];delete this.sourceCaches[o],delete this._updatedSources[o],d.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:o})),d.setEventedParent(null),d.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(o,d){if(this._checkLoaded(),this.sourceCaches[o]===void 0)throw new Error(`There is no source with this ID=${o}`);const m=this.sourceCaches[o].getSource();if(m.type!=="geojson")throw new Error(`geojsonSource.type is ${m.type}, which is !== 'geojson`);m.setData(d),this._changed=!0}getSource(o){return this.sourceCaches[o]&&this.sourceCaches[o].getSource()}addLayer(o,d,m={}){this._checkLoaded();const y=o.id;if(this.getLayer(y))return void this.fire(new l.j(new Error(`Layer "${y}" already exists on this map.`)));let x;if(o.type==="custom"){if(eo(this,l.aD(o)))return;x=l.aA(o)}else{if("source"in o&&typeof o.source=="object"&&(this.addSource(y,o.source),o=l.aB(o),o=l.e(o,{source:y})),this._validate(l.u.layer,`layers.${y}`,o,{arrayIndex:-1},m))return;x=l.aA(o),this._validateLayer(x),x.setEventedParent(this,{layer:{id:y}})}const M=d?this._order.indexOf(d):this._order.length;if(d&&M===-1)this.fire(new l.j(new Error(`Cannot add layer "${y}" before non-existing layer "${d}".`)));else{if(this._order.splice(M,0,y),this._layerOrderChanged=!0,this._layers[y]=x,this._removedLayers[y]&&x.source&&x.type!=="custom"){const P=this._removedLayers[y];delete this._removedLayers[y],P.type!==x.type?this._updatedSources[x.source]="clear":(this._updatedSources[x.source]="reload",this.sourceCaches[x.source].pause())}this._updateLayer(x),x.onAdd&&x.onAdd(this.map)}}moveLayer(o,d){if(this._checkLoaded(),this._changed=!0,!this._layers[o])return void this.fire(new l.j(new Error(`The layer '${o}' does not exist in the map's style and cannot be moved.`)));if(o===d)return;const m=this._order.indexOf(o);this._order.splice(m,1);const y=d?this._order.indexOf(d):this._order.length;d&&y===-1?this.fire(new l.j(new Error(`Cannot move layer "${o}" before non-existing layer "${d}".`))):(this._order.splice(y,0,o),this._layerOrderChanged=!0)}removeLayer(o){this._checkLoaded();const d=this._layers[o];if(!d)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${o}".`)));d.setEventedParent(null);const m=this._order.indexOf(o);this._order.splice(m,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[o]=d,delete this._layers[o],this._serializedLayers&&delete this._serializedLayers[o],delete this._updatedLayers[o],delete this._updatedPaintProps[o],d.onRemove&&d.onRemove(this.map)}getLayer(o){return this._layers[o]}getLayersOrder(){return[...this._order]}hasLayer(o){return o in this._layers}setLayerZoomRange(o,d,m){this._checkLoaded();const y=this.getLayer(o);y?y.minzoom===d&&y.maxzoom===m||(d!=null&&(y.minzoom=d),m!=null&&(y.maxzoom=m),this._updateLayer(y)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${o}".`)))}setFilter(o,d,m={}){this._checkLoaded();const y=this.getLayer(o);if(y){if(!l.aE(y.filter,d))return d==null?(y.filter=void 0,void this._updateLayer(y)):void(this._validate(l.u.filter,`layers.${y.id}.filter`,d,null,m)||(y.filter=l.aB(d),this._updateLayer(y)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${o}".`)))}getFilter(o){return l.aB(this.getLayer(o).filter)}setLayoutProperty(o,d,m,y={}){this._checkLoaded();const x=this.getLayer(o);x?l.aE(x.getLayoutProperty(d),m)||(x.setLayoutProperty(d,m,y),this._updateLayer(x)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${o}".`)))}getLayoutProperty(o,d){const m=this.getLayer(o);if(m)return m.getLayoutProperty(d);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${o}".`)))}setPaintProperty(o,d,m,y={}){this._checkLoaded();const x=this.getLayer(o);x?l.aE(x.getPaintProperty(d),m)||(x.setPaintProperty(d,m,y)&&this._updateLayer(x),this._changed=!0,this._updatedPaintProps[o]=!0,this._serializedLayers=null):this.fire(new l.j(new Error(`Cannot style non-existing layer "${o}".`)))}getPaintProperty(o,d){return this.getLayer(o).getPaintProperty(d)}setFeatureState(o,d){this._checkLoaded();const m=o.source,y=o.sourceLayer,x=this.sourceCaches[m];if(x===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const M=x.getSource().type;M==="geojson"&&y?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):M!=="vector"||y?(o.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),x.setFeatureState(y,o.id,d)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(o,d){this._checkLoaded();const m=o.source,y=this.sourceCaches[m];if(y===void 0)return void this.fire(new l.j(new Error(`The source '${m}' does not exist in the map's style.`)));const x=y.getSource().type,M=x==="vector"?o.sourceLayer:void 0;x!=="vector"||M?d&&typeof o.id!="string"&&typeof o.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):y.removeFeatureState(M,o.id,d):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(o){this._checkLoaded();const d=o.source,m=o.sourceLayer,y=this.sourceCaches[d];if(y!==void 0)return y.getSource().type!=="vector"||m?(o.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),y.getFeatureState(m,o.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${d}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const o=l.aF(this.sourceCaches,x=>x.serialize()),d=this._serializeByIds(this._order,!0),m=this.map.getTerrain()||void 0,y=this.stylesheet;return l.aG({version:y.version,name:y.name,metadata:y.metadata,light:y.light,sky:y.sky,center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch,sprite:y.sprite,glyphs:y.glyphs,transition:y.transition,sources:o,layers:d,terrain:m},x=>x!==void 0)}_updateLayer(o){this._updatedLayers[o.id]=!0,o.source&&!this._updatedSources[o.source]&&this.sourceCaches[o.source].getSource().type!=="raster"&&(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(o){const d=M=>this._layers[M].type==="fill-extrusion",m={},y=[];for(let M=this._order.length-1;M>=0;M--){const P=this._order[M];if(d(P)){m[P]=M;for(const O of o){const N=O[P];if(N)for(const V of N)y.push(V)}}}y.sort((M,P)=>P.intersectionZ-M.intersectionZ);const x=[];for(let M=this._order.length-1;M>=0;M--){const P=this._order[M];if(d(P))for(let O=y.length-1;O>=0;O--){const N=y[O].feature;if(m[N.layer.id]<M)break;x.push(N),y.pop()}else for(const O of o){const N=O[P];if(N)for(const V of N)x.push(V.feature)}}return x}queryRenderedFeatures(o,d,m){d&&d.filter&&this._validate(l.u.filter,"queryRenderedFeatures.filter",d.filter,null,d);const y={};if(d&&d.layers){if(!Array.isArray(d.layers))return this.fire(new l.j(new Error("parameters.layers must be an Array."))),[];for(const P of d.layers){const O=this._layers[P];if(!O)return this.fire(new l.j(new Error(`The layer '${P}' does not exist in the map's style and cannot be queried for features.`))),[];y[O.source]=!0}}const x=[];d.availableImages=this._availableImages;const M=this._serializedAllLayers();for(const P in this.sourceCaches)d.layers&&!y[P]||x.push(At(this.sourceCaches[P],this._layers,M,o,d,m));return this.placement&&x.push(function(P,O,N,V,F,Z,J){const ee={},oe=Z.queryRenderedSymbols(V),le=[];for(const ce of Object.keys(oe).map(Number))le.push(J[ce]);le.sort(Mt);for(const ce of le){const he=ce.featureIndex.lookupSymbolFeatures(oe[ce.bucketInstanceId],O,ce.bucketIndex,ce.sourceLayerIndex,F.filter,F.layers,F.availableImages,P);for(const ne in he){const me=ee[ne]=ee[ne]||[],ge=he[ne];ge.sort((xe,Oe)=>{const Fe=ce.featureSortOrder;if(Fe){const et=Fe.indexOf(xe.featureIndex);return Fe.indexOf(Oe.featureIndex)-et}return Oe.featureIndex-xe.featureIndex});for(const xe of ge)me.push(xe)}}for(const ce in ee)ee[ce].forEach(he=>{const ne=he.feature,me=N[P[ce].source].getFeatureState(ne.layer["source-layer"],ne.id);ne.source=ne.layer.source,ne.layer["source-layer"]&&(ne.sourceLayer=ne.layer["source-layer"]),ne.state=me});return ee}(this._layers,M,this.sourceCaches,o,d,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(x)}querySourceFeatures(o,d){d&&d.filter&&this._validate(l.u.filter,"querySourceFeatures.filter",d.filter,null,d);const m=this.sourceCaches[o];return m?function(y,x){const M=y.getRenderableIds().map(N=>y.getTileByID(N)),P=[],O={};for(let N=0;N<M.length;N++){const V=M[N],F=V.tileID.canonical.key;O[F]||(O[F]=!0,V.querySourceFeatures(P,x))}return P}(m,d):[]}getLight(){return this.light.getLight()}setLight(o,d={}){this._checkLoaded();const m=this.light.getLight();let y=!1;for(const M in o)if(!l.aE(o[M],m[M])){y=!0;break}if(!y)return;const x={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(o,d),this.light.updateTransitions(x)}getSky(){var o;return(o=this.stylesheet)===null||o===void 0?void 0:o.sky}setSky(o,d={}){const m=this.getSky();let y=!1;if(!o&&!m)return;if(o&&!m)y=!0;else if(!o&&m)y=!0;else for(const M in o)if(!l.aE(o[M],m[M])){y=!0;break}if(!y)return;const x={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=o,this.sky.setSky(o,d),this.sky.updateTransitions(x)}_validate(o,d,m,y,x={}){return(!x||x.validate!==!1)&&eo(this,o.call(l.u,l.e({key:d,style:this.serialize(),value:m,styleSpec:l.v},y)))}_remove(o=!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),zr().off(Ve,this._rtlPluginLoaded);for(const d in this._layers)this._layers[d].setEventedParent(null);for(const d in this.sourceCaches){const m=this.sourceCaches[d];m.setEventedParent(null),m.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),o&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(o)}_clearSource(o){this.sourceCaches[o].clearTiles()}_reloadSource(o){this.sourceCaches[o].resume(),this.sourceCaches[o].reload()}_updateSources(o){for(const d in this.sourceCaches)this.sourceCaches[d].update(o,this.map.terrain)}_generateCollisionBoxes(){for(const o in this.sourceCaches)this._reloadSource(o)}_updatePlacement(o,d,m,y,x=!1){let M=!1,P=!1;const O={};for(const N of this._order){const V=this._layers[N];if(V.type!=="symbol")continue;if(!O[V.source]){const Z=this.sourceCaches[V.source];O[V.source]=Z.getRenderableIds(!0).map(J=>Z.getTileByID(J)).sort((J,ee)=>ee.tileID.overscaledZ-J.tileID.overscaledZ||(J.tileID.isLessThan(ee.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(V,O[V.source],o.center.lng);M=M||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((x=x||this._layerOrderChanged||m===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(E.now(),o.zoom))&&(this.pauseablePlacement=new Rl(o,this.map.terrain,this._order,x,d,m,y,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,O),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(E.now()),P=!0),M&&this.pauseablePlacement.placement.setStale()),P||M)for(const N of this._order){const V=this._layers[N];V.type==="symbol"&&this.placement.updateLayerOpacities(V,O[V.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(E.now())}_releaseSymbolFadeTiles(){for(const o in this.sourceCaches)this.sourceCaches[o].releaseSymbolFadeTiles()}getImages(o,d){return l._(this,void 0,void 0,function*(){const m=yield this.imageManager.getImages(d.icons);this._updateTilesForChangedImages();const y=this.sourceCaches[d.source];return y&&y.setDependencies(d.tileID.key,d.type,d.icons),m})}getGlyphs(o,d){return l._(this,void 0,void 0,function*(){const m=yield this.glyphManager.getGlyphs(d.stacks),y=this.sourceCaches[d.source];return y&&y.setDependencies(d.tileID.key,d.type,[""]),m})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(o,d={}){this._checkLoaded(),o&&this._validate(l.u.glyphs,"glyphs",o,null,d)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=o,this.glyphManager.entries={},this.glyphManager.setURL(o))}addSprite(o,d,m={},y){this._checkLoaded();const x=[{id:o,url:d}],M=[...Ae(this.stylesheet.sprite),...x];this._validate(l.u.sprite,"sprite",M,null,m)||(this.stylesheet.sprite=M,this._loadSprite(x,!0,y))}removeSprite(o){this._checkLoaded();const d=Ae(this.stylesheet.sprite);if(d.find(m=>m.id===o)){if(this._spritesImagesIds[o])for(const m of this._spritesImagesIds[o])this.imageManager.removeImage(m),this._changedImages[m]=!0;d.splice(d.findIndex(m=>m.id===o),1),this.stylesheet.sprite=d.length>0?d:void 0,delete this._spritesImagesIds[o],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${o}" doesn't exists on this map.`)))}getSprite(){return Ae(this.stylesheet.sprite)}setSprite(o,d={},m){this._checkLoaded(),o&&this._validate(l.u.sprite,"sprite",o,null,d)||(this.stylesheet.sprite=o,o?this._loadSprite(o,!0,m):(this._unloadSprite(),m&&m(null)))}}var $s=l.Y([{name:"a_pos",type:"Int16",components:2}]);const ds={prelude:fn(`#ifdef GL_ES
50
50
  precision mediump float;
51
51
  #else
52
52
  #if !defined(lowp)
@@ -756,7 +756,7 @@ img.ProseMirror-separator {
756
756
  </template>
757
757
  </VsDialog>
758
758
  </div>
759
- `});I.mount(C)});function l9(t){const e=typeof t;return e==="object"?t:{title:"Підтвердити операцію",text:e==="string"?t:"Ви впевнені що хочете виконати операцію?",cancel:"Скасувати",confirm:"Виконати"}}const c9=({api:t,confirm:e,method:n})=>new Promise(i=>{var b,w,E,C;const{VsDialog:r}=(w=(b=window.app)==null?void 0:b._context)==null?void 0:w.components,{$notify:a}=(C=(E=window.app)==null?void 0:E.config)==null?void 0:C.globalProperties,u=document.querySelector("#modal");if(!u){console.error('Modal root element with id "#modal" not found!');return}const l=document.createElement("div");u.appendChild(l);const g=f.createApp({components:{VsDialog:r},data(){return{visible:!1,getConfirm:l9(e)}},methods:{close(I){this.visible=!1,this.$el.remove(),g.unmount(),i(I||"Success")},async doRequest(){try{const{data:I}=await rt({url:t||"",method:n||"POST"});this.close(I),await a({title:"Успішно!",type:"success",message:"Операція виконана успішно"}),await Kf()}catch{a({title:"Помилка!",type:"error",message:"Сталася помилка"})}}},mounted(){e?this.visible=!0:this.doRequest()},template:`
759
+ `});I.mount(C)});function l9(t){const e=typeof t;return e==="object"?t:{title:"Підтвердити операцію",text:e==="string"?t:"Ви впевнені що хочете виконати операцію?",cancel:"Скасувати",confirm:"Виконати"}}const c9=({api:t,confirm:e,method:n,isId:i,id:r})=>new Promise(a=>{var E,C,I,D;const{VsDialog:u}=(C=(E=window.app)==null?void 0:E._context)==null?void 0:C.components,{$notify:l}=(D=(I=window.app)==null?void 0:I.config)==null?void 0:D.globalProperties,g=document.querySelector("#modal");if(!g){console.error('Modal root element with id "#modal" not found!');return}const b=document.createElement("div");g.appendChild(b);const w=f.createApp({components:{VsDialog:u},data(){return{visible:!1,getConfirm:l9(e)}},methods:{close(L){this.visible=!1,this.$el.remove(),w.unmount(),a(L||"Success")},async doRequest(){try{const{data:L}=await rt({url:t+(i?`/${r}`:""),method:n||"POST"});this.close(L),await l({title:"Успішно!",type:"success",message:"Операція виконана успішно"}),await Kf()}catch{l({title:"Помилка!",type:"error",message:"Сталася помилка"})}}},mounted(){e?this.visible=!0:this.doRequest()},template:`
760
760
  <div style="position: relative; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000;">
761
761
  <VsDialog v-model:visible="visible" size="small" :title="getConfirm?.title">
762
762
  <div class="p-4">
@@ -783,7 +783,7 @@ img.ProseMirror-separator {
783
783
  </div>
784
784
  </VsDialog>
785
785
  </div>
786
- `});g.mount(l)}),u9=({title:t,geom:e,zoom:n,height:i})=>{var g,b;const{VsDialog:r}=(b=(g=window.app)==null?void 0:g._context)==null?void 0:b.components,a=document.querySelector("#app");if(!a){console.error('Modal root element with id "#modal" not found!');return}const u=document.createElement("div");a.appendChild(u),f.createApp({components:{VsDialog:r,VsWidgetMap:ly},data(){return{visible:!0,title:t||"Карта",geometry:e,zoom:n,height:i}},template:`
786
+ `});w.mount(b)}),u9=({title:t,geom:e,zoom:n,height:i})=>{var g,b;const{VsDialog:r}=(b=(g=window.app)==null?void 0:g._context)==null?void 0:b.components,a=document.querySelector("#app");if(!a){console.error('Modal root element with id "#modal" not found!');return}const u=document.createElement("div");a.appendChild(u),f.createApp({components:{VsDialog:r,VsWidgetMap:ly},data(){return{visible:!0,title:t||"Карта",geometry:e,zoom:n,height:i}},template:`
787
787
  <div style="position: relative; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000;">
788
788
  <VsDialog v-model:visible="visible" :title>
789
789
  <VsWidgetMap :geometry :zoom :height/>
@@ -791,4 +791,4 @@ img.ProseMirror-separator {
791
791
  </div>
792
792
  `}).mount(u)},{Fancybox:h9}=Py,$S={$form:a9,$api:c9,$map:u9,$preview:({media:t})=>{const e=document.querySelector("#app");if(!e){console.error('Modal root element with id "#app" not found!');return}const n=document.createElement("div");e.appendChild(n),f.createApp({data(){return{items:Array.isArray(t)?t:[t]}},mounted(){this.$nextTick(()=>{h9.show(this.items.map(r=>{const a=typeof r=="string"&&r.endsWith(".pdf");return{src:r,type:a?"iframe":"image"}}),{groupAll:!0,Thumbs:{autoStart:!0}})})},template:`
793
793
  <div style="display: none;"></div> <!-- Keeps container hidden -->
794
- `}).mount(n)}},d9=async()=>{try{const{data:t}=await rt.get("/api/user-menu");return Kr.value=t,i_(t)}catch(t){return console.error(t),[]}},p9=(t,e)=>{Object.entries(e).forEach(([n,i])=>{t.component(n,i)})},f9={async install(t,{componentsApp:e={},settings:n,routes:i=[]}){ra.value={...ra,...n};try{const a=(await d9()).filter(l=>l==null?void 0:l.component).map(l=>({...l,component:{...s_,...e}[l==null?void 0:l.component]}));p9(t,{...s_,...e}),t.component("admin",eM);const{router:u}=await zA(a.concat(i));window.app={...t,router:u},window.v3plugin={...t.config.globalProperties,...$S},t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...MB,componentsApp:e},$router:u,$v3plugin:$S,$utils:{reloadCardPage:Kf}},t.use(u)}catch(r){console.error(r)}},components:s_},m9={data(){return{formValues:{},scheme:null,table:"",token:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:a}}=await rt.get(`/api/template/table/${n}`),{data:u}=await rt.get(`/api/table/${this.table}/${(r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.id}`);this.token=(u==null?void 0:u.token)||"",this.formValues=u||{};const{data:l}=await rt.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async onlyEditObject(){var e,n,i,r,a,u,l,g,b;const t=this.$refs.form;try{await t.doValidation(),await rt.put(`/api/table/${this.token}`,this.formValues),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(w){const E=((e=w==null?void 0:w.response)==null?void 0:e.data)||"";let C=((a=(r=(i=(n=Object.entries(t==null?void 0:t.formErrors))==null?void 0:n[0])==null?void 0:i[1])==null?void 0:r[0])==null?void 0:a.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(b=(g=(l=(u=Object.entries(t==null?void 0:t.formErrors))==null?void 0:u[0])==null?void 0:l[1])==null?void 0:g[0])==null?void 0:b.message;this.$notify({title:"Помилка!",message:E||C||"Сталася помилка валідаціі",type:"error"})}},async editObjectAndRedirect(){var e,n,i,r,a,u,l,g,b;const t=this.$refs.form;try{await t.doValidation(),await rt.put(`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(w){const E=((e=w==null?void 0:w.response)==null?void 0:e.data)||"";let C=((a=(r=(i=(n=Object.entries(t==null?void 0:t.formErrors))==null?void 0:n[0])==null?void 0:i[1])==null?void 0:r[0])==null?void 0:a.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(b=(g=(l=(u=Object.entries(t==null?void 0:t.formErrors))==null?void 0:u[0])==null?void 0:l[1])==null?void 0:g[0])==null?void 0:b.message;this.$notify({title:"Помилка!",message:E||C||"Сталася помилка валідаціі",type:"error"})}}}},g9={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},y9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},_9={class:"flex items-center gap-[6px]"},b9={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},x9={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 v9(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",g9,[f.createElementVNode("div",y9,[e[4]||(e[4]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),f.createElementVNode("div",_9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Повернутися "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.onlyEditObject&&a.onlyEditObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти "),f.createElementVNode("button",{onClick:e[2]||(e[2]=(...l)=>a.editObjectAndRedirect&&a.editObjectAndRedirect(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти і повернутися ")])]),f.createElementVNode("div",b9,[f.createElementVNode("div",x9,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[3]||(e[3]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const w9=Object.freeze(Object.defineProperty({__proto__:null,default:je(m9,[["render",v9]])},Symbol.toStringTag,{value:"Module"})),k9={data(){return{formValues:{},scheme:null,table:"",token:"",api:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const a=await rt.get(`/api/table-data/${n}`),{data:u}=await rt.get(`/api/template/form/${(i=a==null?void 0:a.data)==null?void 0:i.form}`);this.scheme=(u==null?void 0:u.schema)||u,this.api=(u==null?void 0:u.api)||"",this.token=(r=a==null?void 0:a.data)==null?void 0:r.addToken}catch{}},async createObject(){var e,n,i,r,a,u,l,g,b;const t=this.$refs.form;try{await t.doValidation(),await rt.post(this.api||`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(w){const E=((e=w==null?void 0:w.response)==null?void 0:e.data)||"";let C=((a=(r=(i=(n=Object.entries(t==null?void 0:t.formErrors))==null?void 0:n[0])==null?void 0:i[1])==null?void 0:r[0])==null?void 0:a.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(b=(g=(l=(u=Object.entries(t==null?void 0:t.formErrors))==null?void 0:u[0])==null?void 0:l[1])==null?void 0:g[0])==null?void 0:b.message;this.$notify({title:"Помилка!",message:E||C||"Сталася помилка валідаціі",type:"error"})}}}},S9={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},E9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},C9={class:"flex items-center gap-[6px]"},T9={style:{height:"calc(100vh - 165px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},M9={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 A9(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",S9,[f.createElementVNode("div",E9,[e[3]||(e[3]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),f.createElementVNode("div",C9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Скасувати "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.createObject&&a.createObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти ")])]),f.createElementVNode("div",T9,[f.createElementVNode("div",M9,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[2]||(e[2]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const I9=Object.freeze(Object.defineProperty({__proto__:null,default:je(k9,[["render",A9]])},Symbol.toStringTag,{value:"Module"})),P9={};function D9(t,e,n,i,r,a){const u=f.resolveComponent("router-view");return f.openBlock(),f.createBlock(u)}const jS=Object.freeze(Object.defineProperty({__proto__:null,default:je(P9,[["render",D9]])},Symbol.toStringTag,{value:"Module"})),O9={},B9={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 z9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",B9,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.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),f.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),f.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const N9=je(O9,[["render",z9]]),L9={},R9={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",R9,e[0]||(e[0]=[f.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 F9=je(L9,[["render",V9]]),$9={},j9={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 U9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",j9,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const US=je($9,[["render",U9]]),H9={components:{IconChevronDown:US},props:{route:Object,searchable:String},mounted(){var t,e,n;(t=this.route)!=null&&t.menu&&(n=(e=this.route)==null?void 0:e.menu)!=null&&n.some(i=>{var r,a;return(i==null?void 0:i.path)===this.$route.path.replace("/","")||((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.table)===(i==null?void 0:i.table)&&(i==null?void 0:i.table)})&&(this.isOpen=!0)},watch:{route(t){t!=null&&t.open&&(this.isOpen=!0)}},data(){return{isOpen:!1}},methods:{highLight(t){if(!this.searchable)return t;const e=this.searchable.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`(${e})(\\s*)`,"gi");return t.replace(n,(i,r,a)=>`<span style="color:#1989fa;">${r}</span>${a}`)}}},q9={key:0,class:""},W9={class:"ml-[30px] py-[6px] before:block before:absolute relative w-[196px] flex flex-col gap-[6px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},G9={key:1};function Z9(t,e,n,i,r,a){var g,b,w,E,C,I,D,L,$,W,te,G,Q,Ie,ve;const u=f.resolveComponent("IconChevronDown"),l=f.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(f.openBlock(),f.createElementBlock("div",q9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=Se=>r.isOpen=!r.isOpen),class:f.normalizeClass(["flex items-center justify-start w-full px-3 py-2 text-sm text-left text-gray-800 duration-300 border-none rounded-lg cursor-pointer gap-x-3 focus:outline-none hover:bg-gray-100",[((w=(b=n.route)==null?void 0:b.menu)==null?void 0:w.some(Se=>{var Ne,Ae;return(Se==null?void 0:Se.path)===t.$route.path.replace("/","")||(Se==null?void 0:Se.table)===((Ae=(Ne=t.$route)==null?void 0:Ne.params)==null?void 0:Ae.table)&&(Se==null?void 0:Se.table)}))&&"bg-gray-100"]])},[f.createTextVNode(f.toDisplayString((E=n.route)==null?void 0:E.ua)+" ",1),f.createVNode(u,{class:f.normalizeClass([[r.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var Se;return[f.withDirectives(f.createElementVNode("ul",W9,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Se=n.route)==null?void 0:Se.menu,(Ne,Ae)=>{var $e,Xe;return f.openBlock(),f.createElementBlock("li",{key:Ae,class:"w-full"},[f.createVNode(l,{innerHTML:a.highLight(Ne==null?void 0:Ne.ua),to:"/"+(Ne==null?void 0:Ne.path),class:f.normalizeClass([[((Ne==null?void 0:Ne.path)===t.$route.path.replace("/","")||((Xe=($e=t.$route)==null?void 0:$e.params)==null?void 0:Xe.table)===(Ne==null?void 0:Ne.table)&&(Ne==null?void 0:Ne.table))&&"bg-gray-100"],"inline-block px-3 py-2 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100"])},null,8,["innerHTML","to","class"])])}),128))],512),[[f.vShow,r.isOpen]])]}),_:1})])):(C=n.route)!=null&&C.hidden?f.createCommentVNode("",!0):(f.openBlock(),f.createElementBlock("div",G9,[f.createVNode(l,{innerHTML:a.highLight((I=n.route)==null?void 0:I.ua),to:((L=(D=n.route)==null?void 0:D.path)==null?void 0:L[0])==="/"?($=n.route)==null?void 0:$.path:"/"+((W=n.route)==null?void 0:W.path),class:f.normalizeClass([[(((te=n.route)==null?void 0:te.path.replace("/",""))===t.$route.path.replace("/","")||((Q=(G=t.$route)==null?void 0:G.params)==null?void 0:Q.table)===((Ie=n.route)==null?void 0:Ie.table)&&((ve=n.route)==null?void 0:ve.table))&&"bg-gray-100"],"inline-block 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"])},null,8,["innerHTML","to","class"])]))}const Y9={components:{IconLogout:N9,NavbarItem:je(H9,[["render",Z9]]),IconLogo:F9,IconSearch:r_},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t;return(t=this.searchValue)!=null&&t.trim()?this.filterMenu(Kr.value,this.searchValue):Kr.value},logo(){var t;return((t=ra.value)==null?void 0:t.logo)||"/assets/logo.svg"}},methods:{filterMenu(t,e){return t.map(n=>{var i,r;if(n.menu){const a=this.filterMenu(n.menu,e);if(a.length>0)return{...n,menu:a,open:!0}}else if((r=(i=n.ua)==null?void 0:i.toLowerCase())!=null&&r.includes(e.toLowerCase()))return n;return null}).filter(Boolean)}}},X9={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},K9=["src"],J9={class:"relative"},Q9={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"},eU={class:"flex flex-col flex-wrap w-full pb-3"},tU={key:0,class:"flex flex-col gap-[6px]"},nU={key:1,class:"text-gray-800 text-lg mt-[20px]"};function iU(t,e,n,i,r,a){var b;const u=f.resolveComponent("IconSearch"),l=f.resolveComponent("VsText"),g=f.resolveComponent("NavbarItem");return f.openBlock(),f.createElementBlock("div",X9,[f.createElementVNode("img",{src:a.logo,height:"40",width:"200",class:"my-[20px] ml-[20px]"},null,8,K9),f.createElementVNode("div",J9,[f.createVNode(u,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),f.createVNode(l,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=w=>r.searchValue=w),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:rounded-none [&>input]:border-x-0 [&>input]:pl-[60px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),f.createElementVNode("div",Q9,[f.createElementVNode("nav",eU,[(b=a.data)!=null&&b.length?(f.openBlock(),f.createElementBlock("ul",tU,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.data,(w,E)=>(f.openBlock(),f.createElementBlock("li",{key:E,class:"flex flex-col gap-[6px]"},[f.createVNode(g,{route:w,searchable:r.searchValue},null,8,["route","searchable"])]))),128))])):(f.openBlock(),f.createElementBlock("div",nU,"Не знайдено"))])])])}const rU=je(Y9,[["render",iU]]),oU={},sU={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 aU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",sU,e[0]||(e[0]=[f.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),f.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),f.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const lU={components:{IconQuestion:je(oU,[["render",aU]]),IconUser:LS,AdminNotification:RS},mounted(){this.getUserData()},data(){return{userData:null,isVisible:!1}},watch:{isVisible(t){t?setTimeout(()=>window.addEventListener("click",this.closeOnOutsideClick),0):window.removeEventListener("click",this.closeOnOutsideClick)}},methods:{async getUserData(){try{const{data:t}=await rt.get("/user");this.userData=t}catch{}},async logout(){try{await rt.get("/logout"),await window.history.pushState({},"","/login"),await location.reload(),localStorage.removeItem("user")}catch{}},closeOnOutsideClick(){this.isVisible=!1}},beforeUnmount(){window.removeEventListener("click",this.closeOnOutsideClick)}},cU={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},uU={class:"flex items-center gap-[6px]"},hU={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"},dU={class:"relative"},pU=["src"],fU={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},mU={class:"p-[10px] gap-[6px] items-center border-b flex justify-between"},gU=["src"],yU={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},_U={class:"text-[14px] mr-[10px] text-gray-500"},bU={class:"flex flex-col p-[4px]"};function xU(t,e,n,i,r,a){var w,E,C,I,D,L,$,W,te,G;const u=f.resolveComponent("IconQuestion"),l=f.resolveComponent("AdminNotification"),g=f.resolveComponent("IconUser"),b=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",cU,[f.createElementVNode("div",uU,[f.createElementVNode("a",hU,[f.createVNode(u,{height:"24",width:"24"})]),f.createVNode(l),e[4]||(e[4]=f.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),f.createElementVNode("div",dU,[f.createElementVNode("div",{onClick:e[0]||(e[0]=Q=>r.isVisible=!0),class:"cursor-pointer"},[(E=(w=r.userData)==null?void 0:w.user)!=null&&E.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(I=(C=r.userData)==null?void 0:C.user)==null?void 0:I.avatar,alt:"Image Description"},null,8,pU)):(f.openBlock(),f.createElementBlock("div",fU,[f.createVNode(g)]))]),r.isVisible?(f.openBlock(),f.createElementBlock("div",{key:0,onClick:e[2]||(e[2]=f.withModifiers(()=>{},["stop"])),class:"fixed bg-white w-[180px] top-[55px] right-[20px] shadow-xl rounded-xl z-[1]"},[f.createElementVNode("div",mU,[(L=(D=r.userData)==null?void 0:D.user)!=null&&L.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(W=($=r.userData)==null?void 0:$.user)==null?void 0:W.avatar,alt:"Image Description"},null,8,gU)):(f.openBlock(),f.createElementBlock("div",yU,[f.createVNode(g)])),f.createElementVNode("div",null,[f.createElementVNode("p",_U,f.toDisplayString((G=(te=r.userData)==null?void 0:te.user)==null?void 0:G.username),1)])]),f.createElementVNode("div",bU,[f.createVNode(b,{to:"profile",disabled:!0,class:"p-[8px] block rounded-lg w-full mb-[4px] text-start hover:bg-gray-100 !duration-300"},{default:f.withCtx(()=>e[3]||(e[3]=[f.createTextVNode("Профіль")])),_:1}),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...Q)=>a.logout&&a.logout(...Q)),class:"p-[8px] block rounded-lg w-full text-start hover:bg-gray-100 !duration-300"}," Вийти ")])])):f.createCommentVNode("",!0)])])])}const vU={components:{navbar:rU,AdminHeader:je(lU,[["render",xU]])},computed:{isMenu(){return Kr.value||null},header(){var t;return((t=ra.value)==null?void 0:t.header)||"admin-header"}}},wU={class:"admin-wrapper"},kU={class:"flex flex-col"};function SU(t,e,n,i,r,a){const u=f.resolveComponent("navbar"),l=f.resolveComponent("router-view");return f.openBlock(),f.createElementBlock("div",wU,[f.createVNode(u),f.createElementVNode("div",kU,[a.isMenu?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(a.header))),f.createVNode(l)],64)):f.createCommentVNode("",!0)])])}const EU=Object.freeze(Object.defineProperty({__proto__:null,default:je(vU,[["render",SU],["__scopeId","data-v-98158745"]])},Symbol.toStringTag,{value:"Module"})),CU={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var t,e;return((t=this.data)==null?void 0:t.ua)||((e=this.data)==null?void 0:e.label)||this.data.title||"null"},selectedSortParam(){var t,e;return(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(t){t!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(t){switch(t){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(t){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(t);const e=this.$route.query,{sort:n,...i}=e,r=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...i,...r&&{sort:r}}})},isValueEqualToSelected(t){return`${this.data.name}-${t}`===this.selectedSortParam}}},TU={scope:"col",class:"text-start px-2 py-1"},MU={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"},AU={key:0,d:"m7 15 5 5 5-5"},IU={key:1,d:"m7 9 5-5 5 5"},PU={key:1,class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal"};function DU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("th",TU,[a.getVisibleIcon?(f.openBlock(),f.createElementBlock("button",{key:0,type:"button",class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal flex items-center gap-[6px]",onClick:e[0]||(e[0]=u=>a.handleClickSortBtn(r.currentSort))},[f.createTextVNode(f.toDisplayString(a.label)+" ",1),(f.openBlock(),f.createElementBlock("svg",MU,[r.currentSort==="asc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",AU)):f.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",IU)):f.createCommentVNode("",!0)]))])):(f.openBlock(),f.createElementBlock("p",PU,f.toDisplayString(a.label),1))])}const OU=je(CU,[["render",DU]]),BU={},zU={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 NU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",zU,e[0]||(e[0]=[f.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 LU=je(BU,[["render",NU]]),RU={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},VU={style:{display:"none"}},FU=["height","width","fill"];function $U(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createElementBlock("svg",VU,e[0]||(e[0]=[f.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[f.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)]))),(f.openBlock(),f.createElementBlock("svg",{height:n.height,width:n.width,fill:n.color},e[1]||(e[1]=[f.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,FU))],64)}const jU={components:{IconMore:OS,IconDelete:LU,IconEdit:je(RU,[["render",$U]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null,actions:Array,default:()=>[]},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},computed:{getCustomActions(){return this.actions.filter(t=>typeof t=="object")}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await rt.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);this.formValue=e}catch(e){console.error(e)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var t;try{const{data:e}=await rt.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);await rt.delete(`/api/table/${e==null?void 0:e.token}`),await this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table")}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}finally{this.isDeleteConfirm=!1}},async customButtonAction(t){var e;document.querySelector("body").click(),t!=null&&t.form?(await this.$v3plugin.$form({form:t==null?void 0:t.form,id:(e=this.item)==null?void 0:e.id,api:t==null?void 0:t.api,title:t==null?void 0:t.title}),await this.$emit("update-table")):await this.$v3plugin.$api({confirm:t==null?void 0:t.confirm,api:t==null?void 0:t.api,method:t==null?void 0:t.method})}}},UU={class:"hs-dropdown [--placement:bottom-right] inline-flex"},HU={class:"inline-flex items-center justify-center bg-white border rounded-lg shadow-sm size-7 gap-x-2 border-stone-200 text-stone-800 hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50"},qU={class:"flex flex-col items-start"},WU=["onClick"],GU={class:"text-gray-800"},ZU={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},YU={class:"p-4"},XU={class:"flex justify-end mt-4 gap-x-3"};function KU(t,e,n,i,r,a){const u=f.resolveComponent("IconMore"),l=f.resolveComponent("IconEdit"),g=f.resolveComponent("router-link"),b=f.resolveComponent("IconDelete"),w=f.resolveComponent("VsPopover"),E=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",UU,[f.createVNode(w,{trigger:"click",placement:"bottom-left"},{reference:f.withCtx(()=>[f.createElementVNode("button",HU,[f.createVNode(u,{height:"16",width:"16"})])]),default:f.withCtx(()=>{var C,I,D,L,$;return[f.createElementVNode("div",qU,[(C=n.actions)!=null&&C.includes("edit")&&n.isForm?(f.openBlock(),f.createBlock(g,{key:0,to:`/edit?table=${(D=(I=t.$route)==null?void 0:I.params)==null?void 0:D.catchAll}&id=${(L=n.item)==null?void 0:L.id}`,class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},{default:f.withCtx(()=>[f.createVNode(l,{color:"#000"}),e[4]||(e[4]=f.createTextVNode(" Редагувати "))]),_:1},8,["to"])):f.createCommentVNode("",!0),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.getCustomActions,(W,te)=>(f.openBlock(),f.createElementBlock("button",{key:te,onClick:G=>a.customButtonAction(W),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[f.createVNode(b,{class:"opacity-0"}),f.createElementVNode("span",GU,f.toDisplayString(W==null?void 0:W.label),1)],8,WU))),128)),n.isForm?(f.openBlock(),f.createElementBlock("div",ZU)):f.createCommentVNode("",!0),($=n.actions)!=null&&$.includes("del")?(f.openBlock(),f.createElementBlock("button",{key:2,onClick:e[0]||(e[0]=f.withModifiers((...W)=>a.openConfirm&&a.openConfirm(...W),["stop"])),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[f.createVNode(b),e[5]||(e[5]=f.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])):f.createCommentVNode("",!0)])]}),_:1})]),f.createVNode(E,{visible:r.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=C=>r.isDeleteConfirm=C),size:"small",title:"Ви впевнені?"},{default:f.withCtx(()=>[f.createElementVNode("div",YU,[e[6]||(e[6]=f.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),f.createElementVNode("div",XU,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 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:e[1]||(e[1]=C=>r.isDeleteConfirm=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...C)=>a.deleteElement&&a.deleteElement(...C))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const JU=je(jU,[["render",KU]]),QU={},eH={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 tH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",eH,e[0]||(e[0]=[f.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),f.createElementVNode("path",{d:"M7 20V4"},null,-1),f.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),f.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const nH=je(QU,[["render",tH]]),iH={},rH={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-rosette-discount-check"};function oH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",rH,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1"},null,-1),f.createElementVNode("path",{d:"M9 12l2 2l4 -4"},null,-1)]))}const sH={components:{IconExport:nH,IconChevronDown:US,IconSuccess:je(iH,[["render",oH]])},props:{table:String,columns:Array,page:[String,Number],filterCustom:String,filterState:String,filters:String},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[],activeAction:"",isSuccessTemplate:!1,actions:[{name:"choceAll",function:this.choceAll,label:"Вибрати усі"},{name:"choceVisible",function:this.choceVisible,label:"Вибрати поточні"},{name:"clearAll",function:this.clearAll,label:"Жодного"}]}},watch:{isOpen(t){t||(this.format="",this.cols=[],this.activeAction="",this.isSuccessTemplate=!1)}},methods:{async exportTable(){var t;if(!((t=this.cols)!=null&&t.length)){this.$notify({type:"error",title:"Помилка",message:"Оберіть колонки для експорту!"});return}if(!this.format){this.$notify({type:"error",title:"Помилка",message:"Оберіть формат!"});return}try{const e=await rt.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||null,state:this.filterState||null,custom:this.filterCustom||null},responseType:"blob"}),n=new Blob([e.data],{type:"application/octet-stream"}),i=window.URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(i),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"}),this.isSuccessTemplate=!0}catch(e){console.error("Ошибка при экспорте файла:",e),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(t){this.format=t},choceAll(){var t;this.cols=(t=this.columns)==null?void 0:t.map(e=>e==null?void 0:e.name),this.activeAction="choceAll"},clearAll(){this.cols=[],this.activeAction="clearAll"},choceVisible(){var t,e;this.cols=(e=(t=this.columns)==null?void 0:t.filter(n=>(n==null?void 0:n.hidden)!==!0))==null?void 0:e.map(n=>n==null?void 0:n.name),this.activeAction="choceVisible"}}},aH={key:0,class:"flex flex-col items-center"},lH={key:1,class:"p-4"},cH={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},uH={class:"flex items-center"},hH={class:"flex items-center gap-[10px] ml-auto"},dH=["onClick"],pH={key:0,class:"block h-[8px] w-[8px] rounded-full bg-blue-500"},fH={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},mH={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},gH={class:"mt-2 space-y-2"},yH=["id","onChange"],_H=["for"],bH={key:0,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"},xH={key:1,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function vH(t,e,n,i,r,a){const u=f.resolveComponent("IconExport"),l=f.resolveComponent("IconChevronDown"),g=f.resolveComponent("IconSuccess"),b=f.resolveComponent("VsCheckbox"),w=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=E=>r.isOpen=!0),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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"},[f.createVNode(u,{height:"16",width:"16"}),e[7]||(e[7]=f.createTextVNode(" Експорт ")),f.createVNode(l,{height:"12",width:"16"})]),f.createVNode(w,{visible:r.isOpen,"onUpdate:visible":e[6]||(e[6]=E=>r.isOpen=E),title:"Експорт таблиці",size:"small",closeClickBack:!0},{footer:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",bH,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[2]||(e[2]=E=>r.isOpen=!1)}," Закрити "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[3]||(e[3]=E=>r.isSuccessTemplate=!1)}," Вигрузити ще ")])):(f.openBlock(),f.createElementBlock("div",xH,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=E=>r.isOpen=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[5]||(e[5]=(...E)=>a.exportTable&&a.exportTable(...E))}," Завантажити таблицю ")]))]),default:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",aH,[f.createVNode(g,{height:"100",width:"100",class:"text-green-200 mb-[20px]"}),e[8]||(e[8]=f.createElementVNode("h2",null,"Звіт сформовано і збережено",-1))])):(f.openBlock(),f.createElementBlock("div",lH,[f.createElementVNode("div",cH,[f.createElementVNode("div",uH,[e[9]||(e[9]=f.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),f.createElementVNode("div",hH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.actions,E=>(f.openBlock(),f.createElementBlock("button",{key:E==null?void 0:E.name,onClick:E==null?void 0:E.function,class:"inline-flex items-center gap-[8px] justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border-gray-200 text-nowrap text-start"},[f.createElementVNode("span",{class:f.normalizeClass(["h-[14px] w-[14px] border rounded-full flex items-center justify-center",{"border-blue-500":(E==null?void 0:E.name)===r.activeAction}])},[(E==null?void 0:E.name)===r.activeAction?(f.openBlock(),f.createElementBlock("span",pH)):f.createCommentVNode("",!0)],2),f.createTextVNode(" "+f.toDisplayString(E==null?void 0:E.label),1)],8,dH))),128))])]),f.createElementVNode("div",fH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C,style:{width:"calc((100% - 10px) / 2)"}},[f.createVNode(b,{class:"[&>label]:text-sm [&>label]:text-gray-800 [&>label]:ms-3 !gap-x-[1px] !p-0",modelValue:r.cols,"onUpdate:modelValue":e[1]||(e[1]=I=>r.cols=I),value:E==null?void 0:E.name,label:E==null?void 0:E.ua},null,8,["modelValue","value","label"])]))),128))])]),f.createElementVNode("div",mH,[e[10]||(e[10]=f.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),f.createElementVNode("div",gH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.tableFormats,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C},[f.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"text-blue-600 border-gray-300 rounded-full shrink-0 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:E,onChange:I=>a.selectFormat(E)},null,40,yH),f.createElementVNode("label",{for:E,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+f.toDisplayString(E),9,_H)]))),128))])])]))]),_:1},8,["visible"])],64)}const wH=je(sH,[["render",vH]]),kH={},SH={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 EH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",SH,e[0]||(e[0]=[f.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 CH=je(kH,[["render",EH]]),TH={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(t){this.$emit("update-column",{...this.column,hidden:!t})}},mounted(){var t;((t=this.column)==null?void 0:t.hidden)!==!0&&(this.value=!0)}},MH={class:"flex w-full gap-[8px] items-centr"};function AH(t,e,n,i,r,a){var u,l;return f.openBlock(),f.createElementBlock("label",MH,[f.withDirectives(f.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=g=>r.value=g),type:"checkbox"},null,512),[[f.vModelCheckbox,r.value]]),f.createTextVNode(" "+f.toDisplayString(((u=n.column)==null?void 0:u.ua)||((l=n.column)==null?void 0:l.title)),1)])}const IH={components:{IconColumns:CH,AdminTableColumnsHiddenItem:je(TH,[["render",AH]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(t){const e=this.columns.findIndex(i=>(i==null?void 0:i.name)===(t==null?void 0:t.name)),n=this.columns;n[e]=t,this.$emit("update-columns",[...n])}}},PH={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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"},DH={class:"py-[10px] px-[10px] w-[260px]"},OH={class:"flex flex-col gap-[3px] max-h-[400px] w-full 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 BH(t,e,n,i,r,a){const u=f.resolveComponent("IconColumns"),l=f.resolveComponent("AdminTableColumnsHiddenItem"),g=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(g,{trigger:"click",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",PH,[f.createVNode(u,{height:"20",width:"16"})])]),default:f.withCtx(()=>[f.createElementVNode("div",DH,[e[0]||(e[0]=f.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),f.createElementVNode("ul",OH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(b,w)=>(f.openBlock(),f.createElementBlock("li",{key:w},[f.createVNode(l,{column:b,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const zH=je(IH,[["render",BH]]),NH={},LH={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function RH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",LH,e[0]||(e[0]=[f.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 1C8.55228 1 9 1.44772 9 2V7L14 7C14.5523 7 15 7.44771 15 8C15 8.55228 14.5523 9 14 9L9 9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9.00001L2 9.00001C1.44772 9.00001 1 8.5523 1 8.00001C0.999999 7.44773 1.44771 7.00001 2 7.00001L7 7.00001V2C7 1.44772 7.44772 1 8 1Z"},null,-1)]))}const HS=je(NH,[["render",RH]]),VH={props:{row:Object,column:Object,table:String}};function FH(t,e,n,i,r,a){var u,l,g,b,w,E,C,I;return f.openBlock(),f.createBlock(f.resolveDynamicComponent(((u=n.column)==null?void 0:u.format)==="custom"?(l=n.column)==null?void 0:l.component:`table-format-${((b=(g=n.column)==null?void 0:g.format)==null?void 0:b.toLowerCase())||"text"}`),{onUpdateTable:e[0]||(e[0]=D=>t.$emit("update-table")),name:(w=n.column)==null?void 0:w.name,data:n.row,value:(C=n.row)==null?void 0:C[(E=n.column)==null?void 0:E.name],table:n.table,column:n.column,edit:(I=n.column)==null?void 0:I.edit},null,40,["name","data","value","table","column","edit"])}const qS=je(VH,[["render",FH]]),$H={},jH={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-minus"};function UH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",jH,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const HH={components:{IconPlus:HS,IconMinus:je($H,[["render",UH]])},props:{title:String,defaultValue:{type:Boolean,default:()=>!1}},data(){return{expanded:this.defaultValue}}},qH={class:"hs-accordion"},WH={class:"py-0.5 flex items-center gap-x-0.5 w-full"},GH={class:"text-sm font-medium"},ZH={class:"relative inline-block w-full duration-150 cursor-pointer before:block before:absolute b"};function YH(t,e,n,i,r,a){const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("IconMinus");return f.openBlock(),f.createElementBlock("div",null,[f.createElementVNode("div",null,[f.createElementVNode("div",qH,[f.createElementVNode("div",WH,[f.createElementVNode("div",{onClick:e[0]||(e[0]=g=>r.expanded=!r.expanded),class:"rounded-md cursor-pointer grow"},[f.createElementVNode("span",GH,f.toDisplayString(n.title),1)]),f.createElementVNode("button",{class:"flex items-center justify-center rounded-md size-6 hover:bg-gray-100",onClick:e[1]||(e[1]=g=>r.expanded=!r.expanded)},[r.expanded?(f.openBlock(),f.createBlock(l,{key:1,width:"14"})):(f.openBlock(),f.createBlock(u,{key:0}))])]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>[f.withDirectives(f.createElementVNode("div",ZH,[f.renderSlot(t.$slots,"default",{},void 0,!0)],512),[[f.vShow,r.expanded]])]),_:3})])])])}const XH={components:{AdminComponentIs:qS,AdminTree:je(HH,[["render",YH],["__scopeId","data-v-c6318482"]]),VsNoData:VS,VsWidgetComments:zS,VsWidgetMap:ly,VsWidgetFileList:Kv},props:{table:String,columns:Array,row:Object}},KH={class:"hs-accordion border-gray-100 w-[360px] shrink-0 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",style:{height:"calc(100vh - 310px)"}},JH={class:"border-l",style:{height:"calc(100vh - 360px)"}},QH={class:"flex items-center justify-between py-1 gap-x-4"},eq={class:"col-span-1"},tq={class:"inline-flex items-center gap-x-2 text-[13px] text-gray-500 dark:text-neutral-500"},nq={class:"col-span-2"},iq={class:"font-medium text-[13px] text-gray-800 dark:text-neutral-200"},rq={class:"table-info-card"},oq={class:"table-info-card"};function sq(t,e,n,i,r,a){var C,I,D;const u=f.resolveComponent("AdminComponentIs"),l=f.resolveComponent("AdminTree"),g=f.resolveComponent("VsWidgetMap"),b=f.resolveComponent("VsNoData"),w=f.resolveComponent("VsWidgetComments"),E=f.resolveComponent("VsWidgetFileList");return f.openBlock(),f.createElementBlock("div",KH,[e[0]||(e[0]=f.createElementVNode("div",{class:"p-[10px] pl-[18px] pb-[18px] border-b"},[f.createElementVNode("h2",{class:"text-sm font-medium"},"Інформація про об'єкт")],-1)),f.createElementVNode("div",JH,[(I=(C=t.$route)==null?void 0:C.query)!=null&&I.card?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[n.row?(f.openBlock(),f.createBlock(l,{key:0,defaultValue:!0,title:"Основна інформація",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,L=>(f.openBlock(),f.createElementBlock("dl",QH,[f.createElementVNode("dt",eq,[f.createElementVNode("p",tq,f.toDisplayString((L==null?void 0:L.ua)||(L==null?void 0:L.title))+": ",1)]),f.createElementVNode("dd",nq,[f.createElementVNode("p",iq,[f.createVNode(u,{row:n.row,column:L,table:n.table},null,8,["row","column","table"])])])]))),256))]),_:1})):f.createCommentVNode("",!0),(D=n.row)!=null&&D.geom?(f.openBlock(),f.createBlock(l,{key:1,title:"Карта",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var L,$;return[(L=n.row)!=null&&L.geom?(f.openBlock(),f.createBlock(g,{key:0,geometry:($=n.row)==null?void 0:$.geom,zoom:14},null,8,["geometry"])):(f.openBlock(),f.createBlock(b,{key:1,title:"У об'єкта відсутня геометрія",text:"",class:"[&>div]:h-[200px] [&>div]:min-h-[400px] h-[400px]"}))]}),_:1})):f.createCommentVNode("",!0),f.createVNode(l,{title:"Коментарі",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var L;return[f.createElementVNode("div",rq,[f.createVNode(w,{id:(L=n.row)==null?void 0:L.id},null,8,["id"])])]}),_:1}),f.createVNode(l,{title:"Файли",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var L;return[f.createElementVNode("div",oq,[f.createVNode(E,{id:(L=n.row)==null?void 0:L.id},null,8,["id"])])]}),_:1})],64)):(f.openBlock(),f.createBlock(b,{key:1,text:"Оберіть один з об'єктів в таблиці для відображення інформаціі про нього"}))])])}const aq=je(XH,[["render",sq]]),lq={},cq={class:"hidden xl:block 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 uq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",cq,e[0]||(e[0]=[f.createElementVNode("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"},null,-1),f.createElementVNode("path",{d:"M15 3v18"},null,-1),f.createElementVNode("path",{d:"m8 9 3 3-3 3"},null,-1)]))}const hq=je(lq,[["render",uq]]),dq={},pq={class:"h21yx vs0hq",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"};function fq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",pq,e[0]||(e[0]=[f.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const mq={emits:["filterChange"],props:{scheme:{type:Object},onFilters:{type:Number}},components:{IconFilter:je(dq,[["render",fq]])},data(){return{isFilters:!1}},methods:{closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)}}},gq={key:0,class:"font-medium text-[10px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full dark:bg-neutral-500"},yq={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-white [&::-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 _q(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter"),l=f.resolveComponent("VsFilter");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=g=>r.isFilters=!r.isFilters),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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"},[f.createVNode(u,{height:"16",width:"16"}),e[4]||(e[4]=f.createTextVNode(" Фільтри ")),n.onFilters?(f.openBlock(),f.createElementBlock("span",gq,f.toDisplayString(n.onFilters),1)):f.createCommentVNode("",!0)]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var g;return[f.withDirectives(f.createElementVNode("div",{onClick:e[3]||(e[3]=(...b)=>a.closeFilter&&a.closeFilter(...b)),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)]"},[f.createElementVNode("div",yq,[(g=n.scheme)!=null&&g.length?(f.openBlock(),f.createBlock(l,{key:0,ref:"filter",scheme:n.scheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:e[1]||(e[1]=b=>t.$emit("filterChange",b)),closeFilterBtn:!0,onFilterClose:e[2]||(e[2]=b=>r.isFilters=!1)},null,8,["scheme"])):f.createCommentVNode("",!0)])],512),[[f.vShow,r.isFilters]])]}),_:1})],64)}const bq=je(mq,[["render",_q]]),xq={props:{tabsList:{type:Array,default:()=>[]},filterState:String}},vq={class:"relative flex space-x-1 mb-[20px] after:absolute after:w-[99%] after:bottom-0 after:inset-x-0 after:border-b-2 after:border-gray-200 dark:after:border-neutral-700","aria-label":"Tabs",role:"tablist","aria-orientation":"horizontal"},wq=["onClick"];function kq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("nav",vq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.tabsList,u=>(f.openBlock(),f.createElementBlock("button",{onClick:l=>t.$emit("update:filterState",u==null?void 0:u.name),class:f.normalizeClass(["hs-tab-active:after:bg-gray-800 hs-tab-active:text-gray-800 px-2.5 py-1.5 mb-2 relative inline-flex justify-center items-center gap-x-2 hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 after:absolute after:-bottom-2 after:inset-x-0 after:z-10 after:h-0.5 after:pointer-events-none dark:hs-tab-active:text-neutral-200 dark:hs-tab-active:after:bg-neutral-400 dark:text-neutral-500 dark:hover:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 active",{" font-semibold after:absolute after:bottom-[-8px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":(u==null?void 0:u.name)===n.filterState}])},f.toDisplayString(u==null?void 0:u.label),11,wq))),256))])}const Sq=je(xq,[["render",kq]]),Eq={},Cq={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-filter"};function Tq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Cq,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const Mq={components:{IconFilter2:je(Eq,[["render",Tq]])},props:{filterCustom:String,customList:Array}},Aq={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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"},Iq={class:"flex flex-col gap-[4px]"},Pq=["onClick"];function Dq(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter2"),l=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(l,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",Aq,[f.createVNode(u,{height:"20",width:"20"})])]),default:f.withCtx(()=>[f.createElementVNode("div",Iq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.customList,(g,b)=>(f.openBlock(),f.createElementBlock("button",{onClick:w=>{var E;t.$emit("update:filterCustom",g==null?void 0:g.name),(E=t.$refs)==null||E.popover.togglePopover()},key:b,class:f.normalizeClass(["p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",{"bg-gray-100":n.filterCustom===(g==null?void 0:g.name)}])},f.toDisplayString(g==null?void 0:g.label),11,Pq))),128)),f.createElementVNode("button",{class:"p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",onClick:e[0]||(e[0]=g=>{var b;t.$emit("update:filterCustom",void 0),(b=t.$refs)==null||b.popover.togglePopover()})}," Скинути фільтри ")])]),_:1},512)}const Oq=je(Mq,[["render",Dq]]),Bq={class:"flex items-center gap-x-2"},zq={props:{table:String,title:String},components:{AdminTableControl:JU,AdminTableExport:wH,AdminTableColumnsHidden:zH,AdminTableColumn:OU,AdminNodata:n_,IconPlus:HS,IconSearch:r_,AdminTableCardInfo:aq,IconOpenCard:hq,AdminComponentIs:qS,AdminTableFilters:bq,AdminTableTabs:Sq,AdminTableCustomFilters:Oq,AdminTableCustomButtons:{__name:"admin-table-custom-buttons",props:{slots:Object},setup(t){var l,g,b,w,E;const{asyncTemplateSlot:e}=(E=(w=(b=(g=(l=f.getCurrentInstance())==null?void 0:l.appContext)==null?void 0:g.app)==null?void 0:b.config)==null?void 0:w.globalProperties)==null?void 0:E.utils,n=f.ref(""),i=f.ref(""),r=t,a=()=>{var C,I,D,L,$;if((C=r.slots)!=null&&C.panelLeft||(i.value="div"),(D=(I=r.slots)==null?void 0:I.panelLeft)!=null&&D.includes("<")){const W=e("PanelLeft",(L=r.slots)==null?void 0:L.panelLeft,["name"]);i.value=W}else i.value=($=r.slots)==null?void 0:$.panelLeft},u=()=>{var C,I,D,L,$;if((C=r.slots)!=null&&C.panelRight||(n.value="div"),(D=(I=r.slots)==null?void 0:I.panelRight)!=null&&D.includes("<")){const W=e("PanelRight",(L=r.slots)==null?void 0:L.panelRight,["name"]);n.value=W}else n.value=($=r.slots)==null?void 0:$.panelRight};return a(),u(),(C,I)=>(f.openBlock(),f.createElementBlock("div",Bq,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(i.value))),(f.openBlock(),f.createBlock(f.resolveDynamicComponent(n.value)))]))}}},data(){return{tableData:{},filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",isVisibleCardInfo:!1,onFilters:0,filterState:null,filterCustom:null,visibleColumns:[],initialHiddenColumns:""}},async mounted(){await this.checkUrlMounted(),await this.getTableData(),await this.getFilters()},computed:{defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},columns(){var t,e;return(e=(t=this.tableData)==null?void 0:t.columns)==null?void 0:e.filter(n=>(n==null?void 0:n.hidden)!==!0)},isForm(){var t;return(t=this.tableData)==null?void 0:t.form},isNoData(){var t,e;return!((t=this.tableData)!=null&&t.rows)||!((e=this.columns)!=null&&e.length)},activeCardRow(){var t,e;return((e=(t=this.tableData)==null?void 0:t.rows)==null?void 0:e.find(n=>{var i,r;return(n==null?void 0:n.id)===((r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.card)}))||{}},getActions(){var t;return(t=this.tableData)==null?void 0:t.actions}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue:{handler:((t,e=300)=>{let n;return function(...i){clearTimeout(n),n=setTimeout(()=>{t.apply(this,i)},e)}})(async function(t){var e;await this.getTableData(),this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,search:t||void 0}})},500)},$route:{handler(t,e){var n,i;((n=t==null?void 0:t.params)==null?void 0:n.catchAll)!==((i=e==null?void 0:e.params)==null?void 0:i.catchAll)&&(this.visibleColumns=[],this.unmountedData(),this.getFilters())},deep:!0},limit(t){var e;this.$router.replace({query:{...(e=this.$route)==null?void 0:e.query,limit:t}})},filterState(t){var e;t&&(this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,filterState:t}}),this.getTableData())},filterCustom(t){var e;this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,custom:t}}),this.getTableData()},columns(t){var e,n,i,r;this.visibleColumns=t==null?void 0:t.map(a=>a==null?void 0:a.name),this.initialHiddenColumns===((e=this.visibleColumns)==null?void 0:e.join(","))&&(this.visibleColumns=[]),this.$router.replace({...this.$route,query:{...(n=this.$route)==null?void 0:n.query,columns:(i=this.visibleColumns)!=null&&i.length?(r=this.visibleColumns)==null?void 0:r.join(","):void 0}})}},methods:{async checkUrlMounted(){var t,e,n,i,r,a,u,l,g,b,w,E,C,I,D,L,$;this.page=((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1,this.limit=((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.limit)||20,this.filters=((u=decodeURI((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.filter))==null?void 0:u.replaceAll("+"," "))||null,this.filterState=((g=(l=this.$route)==null?void 0:l.query)==null?void 0:g.filterState)||null,this.filterCustom=((w=(b=this.$route)==null?void 0:b.query)==null?void 0:w.custom)||null,this.searchValue=((C=(E=this.$route)==null?void 0:E.query)==null?void 0:C.search)||"",this.visibleColumns=((L=(D=(I=this.$route)==null?void 0:I.query)==null?void 0:D.columns)==null?void 0:L.split(","))||[],($=this.$route)!=null&&$.query.card&&(this.isVisibleCardInfo=!0)},rowWidth(t){var n,i;const e=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.find(r=>r.name===t);if(e){const r=e==null?void 0:e.width;return typeof r=="number"?`${r}px`:r!=null&&r.includes("px")?r:`${r}px`}},unmountedData(){this.page=1,this.visibleColumns=[],this.filterCustom=null,this.filterState=null,this.isVisibleCardInfo=!1,this.filterScheme=null,this.filters=null,this.onFilters=0,this.searchValue=""},async getTableData(){var t,e,n,i,r,a,u,l,g,b,w;try{const{data:E}=await rt.get(`/api/template/table/${this.table}`),C=await rt.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort)||null,state:this.filterState||null,custom:this.filterCustom||null}});this.tableData={...E,...(C==null?void 0:C.data)||{}},this.initialHiddenColumns=(a=(r=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.filter(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:r.map(I=>I==null?void 0:I.name))==null?void 0:a.join(","),(u=this.visibleColumns)!=null&&u.length?(l=this.tableData)==null||l.columns.forEach(I=>{var D;(D=this.visibleColumns)!=null&&D.includes(I==null?void 0:I.name)?I.hidden=!1:I.hidden=!0}):this.visibleColumns=(w=(b=(g=this.tableData)==null?void 0:g.columns)==null?void 0:b.filter(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:w.map(I=>I==null?void 0:I.name)}catch{}},async getFilters(){var t;try{const{data:e}=await rt.get(`/api/table-filter/${this.table}`);this.filterScheme=(t=e==null?void 0:e.list)==null?void 0:t.map(n=>({...n,label:(n==null?void 0:n.label)||(n==null?void 0:n.ua)}))}catch{}},async handlePageChange(t){const e=this.$route.query;this.page=t,!(!(e!=null&&e.page)&&t===1||e.page===t)&&(await this.$router.replace({query:{...e,page:t}}),await this.getTableData())},async changeLimit(t){this.limit=await t,this.defaultPage=1,await this.getTableData()},async filterChange({url:t,state:e}){var n;this.filters=t!=="no-url"?t:null,this.onFilters=(n=Object.entries(e))==null?void 0:n.length,this.page=1,await this.getTableData()},changeActiveColumn(t){this.activeColumn=t,this.getTableData()},pushToCard(t){var e;((e=this.tableData)==null?void 0:e.card)===!1||this.$router.push(`/card/${this.table}/${t}`)},changeActiveCardInfo(t){var e;this.isVisibleCardInfo&&this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,card:t}})},toggleCardInfo(){var t;this.isVisibleCardInfo=!this.isVisibleCardInfo,this.isVisibleCardInfo||this.$router.push({...this.$route,query:{...(t=this.$route)==null?void 0:t.query,card:void 0}})}}},Nq={class:"w-[calc(100vw - 320px)] bg-gray-50"},Lq={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},Rq={class:"text-xl font-medium"},Vq={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},Fq={class:"bg-white w-full rounded-xl border p-[20px] pr-0"},$q={class:"flex"},jq={class:"flex gap-[6px] ml-auto"},Uq={class:"inline-block w-full align-middle"},Hq={key:0,class:"relative min-w-full divide-y divide-gray-200 table-fixed w-max dark:divide-neutral-700"},qq={class:"sticky top-[-1px] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},Wq={class:"right-0 border-t border-stone-200"},Gq={key:0,class:"w-[70px] sticky right-0 top-0"},Zq={class:"divide-y divide-gray-200"},Yq={class:"px-4 py-3 text-sm text-gray-600"},Xq=["onClick"],Kq=["onClick"],Jq={class:"p-[20px] flex justify-start items-center w-full"},Qq={class:"w-[200px]"},eW={class:"text-sm text-gray-600 dark:text-neutral-400"},tW={class:"font-semibold text-gray-800 dark:text-neutral-200"},nW={key:0},iW={key:0,class:"font-semibold text-gray-800 dark:text-neutral-200"};function rW(t,e,n,i,r,a){var Se,Ne,Ae,$e,Xe,Pt,st,Tt,Nt,Vt,Ft,Ht,Cn,dn,vn,pn,ti,Nn,Pn,Ln,Ce,He,Ke;const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("router-link"),g=f.resolveComponent("AdminTableTabs"),b=f.resolveComponent("IconSearch"),w=f.resolveComponent("VsText"),E=f.resolveComponent("AdminTableCustomButtons"),C=f.resolveComponent("AdminTableCustomFilters"),I=f.resolveComponent("AdminTableColumnsHidden"),D=f.resolveComponent("AdminTableExport"),L=f.resolveComponent("AdminTableFilters"),$=f.resolveComponent("IconOpenCard"),W=f.resolveComponent("AdminTableColumn"),te=f.resolveComponent("AdminComponentIs"),G=f.resolveComponent("AdminTableControl"),Q=f.resolveComponent("AdminNodata"),Ie=f.resolveComponent("VsPagination"),ve=f.resolveComponent("AdminTableCardInfo");return f.openBlock(),f.createElementBlock("div",Nq,[f.createElementVNode("div",Lq,[f.createElementVNode("h2",Rq,f.toDisplayString(n.title),1),a.isForm?(f.openBlock(),f.createBlock(l,{key:0,to:`/add?table=${(Ne=(Se=t.$route)==null?void 0:Se.params)==null?void 0:Ne.catchAll}`,class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"},{default:f.withCtx(()=>[f.createVNode(u,{height:"16",width:"16"}),e[5]||(e[5]=f.createTextVNode(" Додати "))]),_:1},8,["to"])):f.createCommentVNode("",!0)]),f.createElementVNode("div",Vq,[f.createElementVNode("div",Fq,[($e=(Ae=r.tableData)==null?void 0:Ae.filterState)!=null&&$e.length?(f.openBlock(),f.createBlock(g,{key:0,tabsList:(Xe=r.tableData)==null?void 0:Xe.filterState,filterState:r.filterState,"onUpdate:filterState":e[0]||(e[0]=Be=>r.filterState=Be)},null,8,["tabsList","filterState"])):f.createCommentVNode("",!0),f.createElementVNode("div",$q,[f.createElementVNode("div",{class:f.normalizeClass([r.isVisibleCardInfo?"w-[calc(100%-360px)]":"w-full"])},[f.createElementVNode("div",{class:f.normalizeClass(["flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createVNode(b,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),f.createVNode(w,{modelValue:r.searchValue,"onUpdate:modelValue":e[1]||(e[1]=Be=>r.searchValue=Be),placeholder:"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600"},null,8,["modelValue"]),f.createElementVNode("div",jq,[(Pt=r.tableData)!=null&&Pt.slots?(f.openBlock(),f.createBlock(E,{key:0,slots:(st=r.tableData)==null?void 0:st.slots},null,8,["slots"])):f.createCommentVNode("",!0),(Nt=(Tt=r.tableData)==null?void 0:Tt.filterCustom)!=null&&Nt.length?(f.openBlock(),f.createBlock(C,{key:1,customList:(Vt=r.tableData)==null?void 0:Vt.filterCustom,filterCustom:r.filterCustom,"onUpdate:filterCustom":e[2]||(e[2]=Be=>r.filterCustom=Be)},null,8,["customList","filterCustom"])):f.createCommentVNode("",!0),f.createVNode(I,{columns:(Ft=r.tableData)==null?void 0:Ft.columns,onUpdateColumns:e[3]||(e[3]=Be=>r.tableData.columns=Be)},null,8,["columns"]),((Ht=r.tableData)==null?void 0:Ht.export)!==!1?(f.openBlock(),f.createBlock(D,{key:2,table:n.table,columns:(Cn=r.tableData)==null?void 0:Cn.columns,page:r.page,"filter-state":r.filterState,"filter-custom":r.filterCustom,filters:r.filters},null,8,["table","columns","page","filter-state","filter-custom","filters"])):f.createCommentVNode("",!0),(dn=r.filterScheme)!=null&&dn.length?(f.openBlock(),f.createBlock(L,{key:3,scheme:r.filterScheme,onFilters:r.onFilters,onFilterChange:a.filterChange},null,8,["scheme","onFilters","onFilterChange"])):f.createCommentVNode("",!0),f.createElementVNode("button",{onClick:e[4]||(e[4]=(...Be)=>a.toggleCardInfo&&a.toggleCardInfo(...Be)),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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"},[f.createVNode($,{class:f.normalizeClass({"rotate-180 duration-300":!r.isVisibleCardInfo})},null,8,["class"])])])],2),f.createElementVNode("div",{class:f.normalizeClass(["flex items-start justify-start w-full space-y-5",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createElementVNode("div",{style:f.normalizeStyle({height:(pn=(vn=r.tableData)==null?void 0:vn.filterState)!=null&&pn.length?"calc(100vh - 370px)":"calc(100vh - 330px)"}),class:"overflow-x-auto w-full [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[f.createElementVNode("div",Uq,[a.isNoData?(f.openBlock(),f.createBlock(Q,{key:1})):(f.openBlock(),f.createElementBlock("table",Hq,[f.createElementVNode("thead",qq,[f.createElementVNode("tr",Wq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.columns,Be=>(f.openBlock(),f.createBlock(W,{key:Be.name,style:f.normalizeStyle({width:a.rowWidth(Be==null?void 0:Be.name),textAlign:Be==null?void 0:Be.align,wordBreak:Be==null?void 0:Be.wrap}),data:Be,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),(Nn=(ti=a.getActions)==null?void 0:ti.filter(Be=>Be!=="add"))!=null&&Nn.length?(f.openBlock(),f.createElementBlock("th",Gq)):f.createCommentVNode("",!0)])]),f.createElementVNode("tbody",Zq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Pn=r.tableData)==null?void 0:Pn.rows,(Be,Rt)=>{var Qt,At,Mt,rn,we,yn,pr,qt,sn,vi;return f.openBlock(),f.createElementBlock("tr",{key:Rt,class:f.normalizeClass({"bg-gray-50":((At=(Qt=t.$route)==null?void 0:Qt.query)==null?void 0:At.card)===(Be==null?void 0:Be.id)})},[f.createElementVNode("td",Yq,[f.createElementVNode("button",{onClick:()=>a.pushToCard(Be==null?void 0:Be.id),class:f.normalizeClass(["text-sm font-medium",[((Mt=r.tableData)==null?void 0:Mt.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[f.createVNode(te,{row:Be,column:a.columns[0],table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,Xq)]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((rn=a.columns)==null?void 0:rn.slice(1),ui=>(f.openBlock(),f.createElementBlock("td",{onClick:mi=>a.changeActiveCardInfo(Be==null?void 0:Be.id),class:f.normalizeClass(["px-3 py-3 text-sm text-gray-600 text-start",{"cursor-pointer":r.isVisibleCardInfo}]),key:ui.name},[f.createVNode(te,{row:Be,column:ui,table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,Kq))),128)),(yn=(we=a.getActions)==null?void 0:we.filter(ui=>ui!=="add"))!=null&&yn.length?(f.openBlock(),f.createElementBlock("td",{key:0,class:f.normalizeClass(["text-center sticky right-0 w-[80px] px-[10px]",{"bg-gray-50":((qt=(pr=t.$route)==null?void 0:pr.query)==null?void 0:qt.card)===(Be==null?void 0:Be.id),"bg-white":((vi=(sn=t.$route)==null?void 0:sn.query)==null?void 0:vi.card)!==(Be==null?void 0:Be.id)}])},[f.createVNode(G,{actions:a.getActions,isForm:a.isForm,item:Be,table:n.table,onUpdateTable:a.getTableData},null,8,["actions","isForm","item","table","onUpdateTable"])],2)):f.createCommentVNode("",!0)],2)}),128))])]))])],4)],2),f.createElementVNode("div",Jq,[f.createElementVNode("div",Qq,[f.createElementVNode("p",eW,[f.createElementVNode("span",tW,[f.createTextVNode(f.toDisplayString(r.filters||r.searchValue?"Знайдено":"Об'єктів")+" "+f.toDisplayString(((Ln=r.tableData)==null?void 0:Ln.count)||"0 ")+" ",1),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",nW," з")):f.createCommentVNode("",!0)]),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",iW,f.toDisplayString(" "+((Ce=r.tableData)==null?void 0:Ce.filtered)||0),1)):f.createCommentVNode("",!0)])]),Math.ceil(((He=r.tableData)==null?void 0:He.filtered)/r.limit)>1?(f.openBlock(),f.createBlock(Ie,{key:0,goTo:!1,class:"justify-end","default-page":parseInt(a.defaultPage),total:((Ke=r.tableData)==null?void 0:Ke.filtered)||0,pageSize:parseInt(r.limit),onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit,backgroundColor:"#F3F4F6"},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):f.createCommentVNode("",!0)])],2),f.createVNode(f.Transition,{name:"slide-fade"},{default:f.withCtx(()=>{var Be;return[r.isVisibleCardInfo?(f.openBlock(),f.createBlock(ve,{key:0,table:n.table,columns:(Be=r.tableData)==null?void 0:Be.columns,row:a.activeCardRow},null,8,["table","columns","row"])):f.createCommentVNode("",!0)]}),_:1})])])])])}const oW={components:{AdminTable:je(zq,[["render",rW],["__scopeId","data-v-2f0ed31e"]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){Kr!=null&&Kr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){var e;t&&(document.title=(((e=ra.value)==null?void 0:e.titlePrefix)||"")+t)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async checkPageType(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.params)==null?void 0:l.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404"),e!=null&&e.component&&this.$router.replace((r=(i=this.$route)==null?void 0:i.params)==null?void 0:r.catchAll);const n=e==null?void 0:e.table;this.table=n||!1,!n&&this.getInterface()},async getInterface(){var t,e;try{const{data:n}=await rt.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},sW=["innerHTML"];function aW(t,e,n,i,r,a){const u=f.resolveComponent("AdminTable");return r.table?(f.openBlock(),f.createBlock(u,{key:0,table:r.table,title:r.title},null,8,["table","title"])):(f.openBlock(),f.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:r.interface},null,8,sW))}const lW=Object.freeze(Object.defineProperty({__proto__:null,default:je(oW,[["render",aW]])},Symbol.toStringTag,{value:"Module"}));return f9});
794
+ `}).mount(n)}},d9=async()=>{try{const{data:t}=await rt.get("/api/user-menu");return Kr.value=t,i_(t)}catch(t){return console.error(t),[]}},p9=(t,e)=>{Object.entries(e).forEach(([n,i])=>{t.component(n,i)})},f9={async install(t,{componentsApp:e={},settings:n,routes:i=[]}){ra.value={...ra,...n};try{const a=(await d9()).filter(l=>l==null?void 0:l.component).map(l=>({...l,component:{...s_,...e}[l==null?void 0:l.component]}));p9(t,{...s_,...e}),t.component("admin",eM);const{router:u}=await zA(a.concat(i));window.app={...t,router:u},window.v3plugin={...t.config.globalProperties,...$S},t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...MB,componentsApp:e},$router:u,$v3plugin:$S,$utils:{reloadCardPage:Kf}},t.use(u)}catch(r){console.error(r)}},components:s_},m9={data(){return{formValues:{},scheme:null,table:"",token:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:a}}=await rt.get(`/api/template/table/${n}`),{data:u}=await rt.get(`/api/table/${this.table}/${(r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.id}`);this.token=(u==null?void 0:u.token)||"",this.formValues=u||{};const{data:l}=await rt.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async onlyEditObject(){var e,n,i,r,a,u,l,g,b;const t=this.$refs.form;try{await t.doValidation(),await rt.put(`/api/table/${this.token}`,this.formValues),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(w){const E=((e=w==null?void 0:w.response)==null?void 0:e.data)||"";let C=((a=(r=(i=(n=Object.entries(t==null?void 0:t.formErrors))==null?void 0:n[0])==null?void 0:i[1])==null?void 0:r[0])==null?void 0:a.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(b=(g=(l=(u=Object.entries(t==null?void 0:t.formErrors))==null?void 0:u[0])==null?void 0:l[1])==null?void 0:g[0])==null?void 0:b.message;this.$notify({title:"Помилка!",message:E||C||"Сталася помилка валідаціі",type:"error"})}},async editObjectAndRedirect(){var e,n,i,r,a,u,l,g,b;const t=this.$refs.form;try{await t.doValidation(),await rt.put(`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(w){const E=((e=w==null?void 0:w.response)==null?void 0:e.data)||"";let C=((a=(r=(i=(n=Object.entries(t==null?void 0:t.formErrors))==null?void 0:n[0])==null?void 0:i[1])==null?void 0:r[0])==null?void 0:a.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(b=(g=(l=(u=Object.entries(t==null?void 0:t.formErrors))==null?void 0:u[0])==null?void 0:l[1])==null?void 0:g[0])==null?void 0:b.message;this.$notify({title:"Помилка!",message:E||C||"Сталася помилка валідаціі",type:"error"})}}}},g9={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},y9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},_9={class:"flex items-center gap-[6px]"},b9={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},x9={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 v9(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",g9,[f.createElementVNode("div",y9,[e[4]||(e[4]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),f.createElementVNode("div",_9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Повернутися "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.onlyEditObject&&a.onlyEditObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти "),f.createElementVNode("button",{onClick:e[2]||(e[2]=(...l)=>a.editObjectAndRedirect&&a.editObjectAndRedirect(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти і повернутися ")])]),f.createElementVNode("div",b9,[f.createElementVNode("div",x9,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[3]||(e[3]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const w9=Object.freeze(Object.defineProperty({__proto__:null,default:je(m9,[["render",v9]])},Symbol.toStringTag,{value:"Module"})),k9={data(){return{formValues:{},scheme:null,table:"",token:"",api:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const a=await rt.get(`/api/table-data/${n}`),{data:u}=await rt.get(`/api/template/form/${(i=a==null?void 0:a.data)==null?void 0:i.form}`);this.scheme=(u==null?void 0:u.schema)||u,this.api=(u==null?void 0:u.api)||"",this.token=(r=a==null?void 0:a.data)==null?void 0:r.addToken}catch{}},async createObject(){var e,n,i,r,a,u,l,g,b;const t=this.$refs.form;try{await t.doValidation(),await rt.post(this.api||`/api/table/${this.token}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch(w){const E=((e=w==null?void 0:w.response)==null?void 0:e.data)||"";let C=((a=(r=(i=(n=Object.entries(t==null?void 0:t.formErrors))==null?void 0:n[0])==null?void 0:i[1])==null?void 0:r[0])==null?void 0:a.message)==="Це поле обов'язкове"?"Заповніть обов'язкові поля":(b=(g=(l=(u=Object.entries(t==null?void 0:t.formErrors))==null?void 0:u[0])==null?void 0:l[1])==null?void 0:g[0])==null?void 0:b.message;this.$notify({title:"Помилка!",message:E||C||"Сталася помилка валідаціі",type:"error"})}}}},S9={style:{width:"calc(100vw - 260px)"},class:"bg-gray-50"},E9={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},C9={class:"flex items-center gap-[6px]"},T9={style:{height:"calc(100vh - 165px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},M9={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 A9(t,e,n,i,r,a){const u=f.resolveComponent("VsForm");return f.openBlock(),f.createElementBlock("div",S9,[f.createElementVNode("div",E9,[e[3]||(e[3]=f.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),f.createElementVNode("div",C9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"flex items-center px-3 py-2 text-sm font-medium text-gray-800 duration-300 bg-white border border-gray-100 rounded-lg shadow gap-x-2 focus:outline-none hover:bg-gray-50 hover:border-gray-100"}," Скасувати "),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.createObject&&a.createObject(...l)),class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"}," Зберегти ")])]),f.createElementVNode("div",T9,[f.createElementVNode("div",M9,[r.scheme?(f.openBlock(),f.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[2]||(e[2]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):f.createCommentVNode("",!0)])])])}const I9=Object.freeze(Object.defineProperty({__proto__:null,default:je(k9,[["render",A9]])},Symbol.toStringTag,{value:"Module"})),P9={};function D9(t,e,n,i,r,a){const u=f.resolveComponent("router-view");return f.openBlock(),f.createBlock(u)}const jS=Object.freeze(Object.defineProperty({__proto__:null,default:je(P9,[["render",D9]])},Symbol.toStringTag,{value:"Module"})),O9={},B9={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 z9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",B9,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.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),f.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),f.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const N9=je(O9,[["render",z9]]),L9={},R9={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",R9,e[0]||(e[0]=[f.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 F9=je(L9,[["render",V9]]),$9={},j9={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 U9(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",j9,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const US=je($9,[["render",U9]]),H9={components:{IconChevronDown:US},props:{route:Object,searchable:String},mounted(){var t,e,n;(t=this.route)!=null&&t.menu&&(n=(e=this.route)==null?void 0:e.menu)!=null&&n.some(i=>{var r,a;return(i==null?void 0:i.path)===this.$route.path.replace("/","")||((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.table)===(i==null?void 0:i.table)&&(i==null?void 0:i.table)})&&(this.isOpen=!0)},watch:{route(t){t!=null&&t.open&&(this.isOpen=!0)}},data(){return{isOpen:!1}},methods:{highLight(t){if(!this.searchable)return t;const e=this.searchable.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`(${e})(\\s*)`,"gi");return t.replace(n,(i,r,a)=>`<span style="color:#1989fa;">${r}</span>${a}`)}}},q9={key:0,class:""},W9={class:"ml-[30px] py-[6px] before:block before:absolute relative w-[196px] flex flex-col gap-[6px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},G9={key:1};function Z9(t,e,n,i,r,a){var g,b,w,E,C,I,D,L,$,W,te,G,Q,Ie,ve;const u=f.resolveComponent("IconChevronDown"),l=f.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(f.openBlock(),f.createElementBlock("div",q9,[f.createElementVNode("button",{onClick:e[0]||(e[0]=Se=>r.isOpen=!r.isOpen),class:f.normalizeClass(["flex items-center justify-start w-full px-3 py-2 text-sm text-left text-gray-800 duration-300 border-none rounded-lg cursor-pointer gap-x-3 focus:outline-none hover:bg-gray-100",[((w=(b=n.route)==null?void 0:b.menu)==null?void 0:w.some(Se=>{var Ne,Ae;return(Se==null?void 0:Se.path)===t.$route.path.replace("/","")||(Se==null?void 0:Se.table)===((Ae=(Ne=t.$route)==null?void 0:Ne.params)==null?void 0:Ae.table)&&(Se==null?void 0:Se.table)}))&&"bg-gray-100"]])},[f.createTextVNode(f.toDisplayString((E=n.route)==null?void 0:E.ua)+" ",1),f.createVNode(u,{class:f.normalizeClass([[r.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var Se;return[f.withDirectives(f.createElementVNode("ul",W9,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Se=n.route)==null?void 0:Se.menu,(Ne,Ae)=>{var $e,Xe;return f.openBlock(),f.createElementBlock("li",{key:Ae,class:"w-full"},[f.createVNode(l,{innerHTML:a.highLight(Ne==null?void 0:Ne.ua),to:"/"+(Ne==null?void 0:Ne.path),class:f.normalizeClass([[((Ne==null?void 0:Ne.path)===t.$route.path.replace("/","")||((Xe=($e=t.$route)==null?void 0:$e.params)==null?void 0:Xe.table)===(Ne==null?void 0:Ne.table)&&(Ne==null?void 0:Ne.table))&&"bg-gray-100"],"block px-3 py-2 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100"])},null,8,["innerHTML","to","class"])])}),128))],512),[[f.vShow,r.isOpen]])]}),_:1})])):(C=n.route)!=null&&C.hidden?f.createCommentVNode("",!0):(f.openBlock(),f.createElementBlock("div",G9,[f.createVNode(l,{innerHTML:a.highLight((I=n.route)==null?void 0:I.ua),to:((L=(D=n.route)==null?void 0:D.path)==null?void 0:L[0])==="/"?($=n.route)==null?void 0:$.path:"/"+((W=n.route)==null?void 0:W.path),class:f.normalizeClass([[(((te=n.route)==null?void 0:te.path.replace("/",""))===t.$route.path.replace("/","")||((Q=(G=t.$route)==null?void 0:G.params)==null?void 0:Q.table)===((Ie=n.route)==null?void 0:Ie.table)&&((ve=n.route)==null?void 0:ve.table))&&"bg-gray-100"],"inline-block 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"])},null,8,["innerHTML","to","class"])]))}const Y9={components:{IconLogout:N9,NavbarItem:je(H9,[["render",Z9]]),IconLogo:F9,IconSearch:r_},data(){return{activeIndex:null,searchValue:""}},computed:{data(){var t;return(t=this.searchValue)!=null&&t.trim()?this.filterMenu(Kr.value,this.searchValue):Kr.value},logo(){var t;return((t=ra.value)==null?void 0:t.logo)||"/assets/logo.svg"}},methods:{filterMenu(t,e){return t.map(n=>{var i,r;if(n.menu){const a=this.filterMenu(n.menu,e);if(a.length>0)return{...n,menu:a,open:!0}}else if((r=(i=n.ua)==null?void 0:i.toLowerCase())!=null&&r.includes(e.toLowerCase()))return n;return null}).filter(Boolean)}}},X9={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},K9={class:"h-[59px] w-full p-[4px] mb-[10px]"},J9=["src"],Q9={class:"relative mx-[16px] pl"},eU={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"},tU={class:"flex flex-col flex-wrap w-full pb-3"},nU={key:0,class:"flex flex-col gap-[6px]"},iU={key:1,class:"text-gray-800 text-lg mt-[20px]"};function rU(t,e,n,i,r,a){var b;const u=f.resolveComponent("IconSearch"),l=f.resolveComponent("VsText"),g=f.resolveComponent("NavbarItem");return f.openBlock(),f.createElementBlock("div",X9,[f.createElementVNode("div",K9,[f.createElementVNode("img",{src:a.logo,class:"object-contain w-full h-full"},null,8,J9)]),f.createElementVNode("div",Q9,[f.createVNode(u,{height:"16",width:"16",class:"absolute top-[12px] left-[16px] text-gray-500 z-[1]"}),f.createVNode(l,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=w=>r.searchValue=w),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:pl-[40px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),f.createElementVNode("div",eU,[f.createElementVNode("nav",tU,[(b=a.data)!=null&&b.length?(f.openBlock(),f.createElementBlock("ul",nU,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.data,(w,E)=>(f.openBlock(),f.createElementBlock("li",{key:E,class:"flex flex-col gap-[6px]"},[f.createVNode(g,{route:w,searchable:r.searchValue},null,8,["route","searchable"])]))),128))])):(f.openBlock(),f.createElementBlock("div",iU,"Не знайдено"))])])])}const oU=je(Y9,[["render",rU]]),sU={},aU={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 lU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",aU,e[0]||(e[0]=[f.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),f.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),f.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const cU={components:{IconQuestion:je(sU,[["render",lU]]),IconUser:LS,AdminNotification:RS},mounted(){this.getUserData()},data(){return{userData:null,isVisible:!1}},watch:{isVisible(t){t?setTimeout(()=>window.addEventListener("click",this.closeOnOutsideClick),0):window.removeEventListener("click",this.closeOnOutsideClick)}},methods:{async getUserData(){try{const{data:t}=await rt.get("/user");this.userData=t}catch{}},async logout(){try{await rt.get("/logout"),await window.history.pushState({},"","/login"),await location.reload(),localStorage.removeItem("user")}catch{}},closeOnOutsideClick(){this.isVisible=!1}},beforeUnmount(){window.removeEventListener("click",this.closeOnOutsideClick)}},uU={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},hU={class:"flex items-center gap-[6px]"},dU={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"},pU={class:"relative"},fU=["src"],mU={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},gU={class:"p-[10px] gap-[6px] items-center border-b flex justify-between"},yU=["src"],_U={key:1,class:"size-[40px] rounded-full bg-gray-200 flex items-center justify-center"},bU={class:"text-[14px] mr-[10px] text-gray-500"},xU={class:"flex flex-col p-[4px]"};function vU(t,e,n,i,r,a){var w,E,C,I,D,L,$,W,te,G;const u=f.resolveComponent("IconQuestion"),l=f.resolveComponent("AdminNotification"),g=f.resolveComponent("IconUser"),b=f.resolveComponent("router-link");return f.openBlock(),f.createElementBlock("div",uU,[f.createElementVNode("div",hU,[f.createElementVNode("a",dU,[f.createVNode(u,{height:"24",width:"24"})]),f.createVNode(l),e[4]||(e[4]=f.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),f.createElementVNode("div",pU,[f.createElementVNode("div",{onClick:e[0]||(e[0]=Q=>r.isVisible=!0),class:"cursor-pointer"},[(E=(w=r.userData)==null?void 0:w.user)!=null&&E.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(I=(C=r.userData)==null?void 0:C.user)==null?void 0:I.avatar,alt:"Image Description"},null,8,fU)):(f.openBlock(),f.createElementBlock("div",mU,[f.createVNode(g)]))]),r.isVisible?(f.openBlock(),f.createElementBlock("div",{key:0,onClick:e[2]||(e[2]=f.withModifiers(()=>{},["stop"])),class:"fixed bg-white w-[180px] top-[55px] right-[20px] shadow-xl rounded-xl z-[1]"},[f.createElementVNode("div",gU,[(L=(D=r.userData)==null?void 0:D.user)!=null&&L.avatar?(f.openBlock(),f.createElementBlock("img",{key:0,class:"flex-shrink-0 size-[30px] rounded-full",src:(W=($=r.userData)==null?void 0:$.user)==null?void 0:W.avatar,alt:"Image Description"},null,8,yU)):(f.openBlock(),f.createElementBlock("div",_U,[f.createVNode(g)])),f.createElementVNode("div",null,[f.createElementVNode("p",bU,f.toDisplayString((G=(te=r.userData)==null?void 0:te.user)==null?void 0:G.username),1)])]),f.createElementVNode("div",xU,[f.createVNode(b,{to:"profile",disabled:!0,class:"p-[8px] block rounded-lg w-full mb-[4px] text-start hover:bg-gray-100 !duration-300"},{default:f.withCtx(()=>e[3]||(e[3]=[f.createTextVNode("Профіль")])),_:1}),f.createElementVNode("button",{onClick:e[1]||(e[1]=(...Q)=>a.logout&&a.logout(...Q)),class:"p-[8px] block rounded-lg w-full text-start hover:bg-gray-100 !duration-300"}," Вийти ")])])):f.createCommentVNode("",!0)])])])}const wU={components:{navbar:oU,AdminHeader:je(cU,[["render",vU]])},computed:{isMenu(){return Kr.value||null},header(){var t;return((t=ra.value)==null?void 0:t.header)||"admin-header"}}},kU={class:"admin-wrapper"},SU={class:"flex flex-col"};function EU(t,e,n,i,r,a){const u=f.resolveComponent("navbar"),l=f.resolveComponent("router-view");return f.openBlock(),f.createElementBlock("div",kU,[f.createVNode(u),f.createElementVNode("div",SU,[a.isMenu?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(a.header))),f.createVNode(l)],64)):f.createCommentVNode("",!0)])])}const CU=Object.freeze(Object.defineProperty({__proto__:null,default:je(wU,[["render",EU],["__scopeId","data-v-98158745"]])},Symbol.toStringTag,{value:"Module"})),TU={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var t,e;return((t=this.data)==null?void 0:t.ua)||((e=this.data)==null?void 0:e.label)||this.data.title||"null"},selectedSortParam(){var t,e;return(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(t){t!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(t){switch(t){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(t){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(t);const e=this.$route.query,{sort:n,...i}=e,r=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...i,...r&&{sort:r}}})},isValueEqualToSelected(t){return`${this.data.name}-${t}`===this.selectedSortParam}}},MU={scope:"col",class:"text-start px-2 py-1"},AU={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"},IU={key:0,d:"m7 15 5 5 5-5"},PU={key:1,d:"m7 9 5-5 5 5"},DU={key:1,class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal"};function OU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("th",MU,[a.getVisibleIcon?(f.openBlock(),f.createElementBlock("button",{key:0,type:"button",class:"text-sm text-stone-500 px-[4px] py-2.5 text-start font-normal flex items-center gap-[6px]",onClick:e[0]||(e[0]=u=>a.handleClickSortBtn(r.currentSort))},[f.createTextVNode(f.toDisplayString(a.label)+" ",1),(f.openBlock(),f.createElementBlock("svg",AU,[r.currentSort==="asc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",IU)):f.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(f.openBlock(),f.createElementBlock("path",PU)):f.createCommentVNode("",!0)]))])):(f.openBlock(),f.createElementBlock("p",DU,f.toDisplayString(a.label),1))])}const BU=je(TU,[["render",OU]]),zU={},NU={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 LU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",NU,e[0]||(e[0]=[f.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 RU=je(zU,[["render",LU]]),VU={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},FU={style:{display:"none"}},$U=["height","width","fill"];function jU(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createElementBlock("svg",FU,e[0]||(e[0]=[f.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[f.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)]))),(f.openBlock(),f.createElementBlock("svg",{height:n.height,width:n.width,fill:n.color},e[1]||(e[1]=[f.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,$U))],64)}const UU={components:{IconMore:OS,IconDelete:RU,IconEdit:je(VU,[["render",jU]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null,actions:Array,default:()=>[]},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},computed:{getCustomActions(){return this.actions.filter(t=>typeof t=="object")}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await rt.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);this.formValue=e}catch(e){console.error(e)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var t;try{const{data:e}=await rt.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);await rt.delete(`/api/table/${e==null?void 0:e.token}`),await this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table")}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}finally{this.isDeleteConfirm=!1}},async customButtonAction(t){var e,n;document.querySelector("body").click(),t!=null&&t.form?(await this.$v3plugin.$form({form:t==null?void 0:t.form,id:(e=this.item)==null?void 0:e.id,api:t==null?void 0:t.api,title:t==null?void 0:t.title}),await this.$emit("update-table")):await this.$v3plugin.$api({confirm:t==null?void 0:t.confirm,api:t==null?void 0:t.api,method:t==null?void 0:t.method,id:(n=this.item)==null?void 0:n.id,isId:(t==null?void 0:t.isId)||!1})}}},HU={class:"hs-dropdown [--placement:bottom-right] inline-flex"},qU={class:"inline-flex items-center justify-center bg-white border rounded-lg shadow-sm size-7 gap-x-2 border-stone-200 text-stone-800 hover:bg-stone-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-50"},WU={class:"flex flex-col items-start"},GU=["onClick"],ZU={class:"text-gray-800"},YU={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},XU={class:"p-4"},KU={class:"flex justify-end mt-4 gap-x-3"};function JU(t,e,n,i,r,a){const u=f.resolveComponent("IconMore"),l=f.resolveComponent("IconEdit"),g=f.resolveComponent("router-link"),b=f.resolveComponent("IconDelete"),w=f.resolveComponent("VsPopover"),E=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("div",HU,[f.createVNode(w,{trigger:"click",placement:"bottom-left"},{reference:f.withCtx(()=>[f.createElementVNode("button",qU,[f.createVNode(u,{height:"16",width:"16"})])]),default:f.withCtx(()=>{var C,I,D,L,$;return[f.createElementVNode("div",WU,[(C=n.actions)!=null&&C.includes("edit")&&n.isForm?(f.openBlock(),f.createBlock(g,{key:0,to:`/edit?table=${(D=(I=t.$route)==null?void 0:I.params)==null?void 0:D.catchAll}&id=${(L=n.item)==null?void 0:L.id}`,class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},{default:f.withCtx(()=>[f.createVNode(l,{color:"#000"}),e[4]||(e[4]=f.createTextVNode(" Редагувати "))]),_:1},8,["to"])):f.createCommentVNode("",!0),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.getCustomActions,(W,te)=>(f.openBlock(),f.createElementBlock("button",{key:te,onClick:G=>a.customButtonAction(W),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[f.createVNode(b,{class:"opacity-0"}),f.createElementVNode("span",ZU,f.toDisplayString(W==null?void 0:W.label),1)],8,GU))),128)),n.isForm?(f.openBlock(),f.createElementBlock("div",YU)):f.createCommentVNode("",!0),($=n.actions)!=null&&$.includes("del")?(f.openBlock(),f.createElementBlock("button",{key:2,onClick:e[0]||(e[0]=f.withModifiers((...W)=>a.openConfirm&&a.openConfirm(...W),["stop"])),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[f.createVNode(b),e[5]||(e[5]=f.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])):f.createCommentVNode("",!0)])]}),_:1})]),f.createVNode(E,{visible:r.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=C=>r.isDeleteConfirm=C),size:"small",title:"Ви впевнені?"},{default:f.withCtx(()=>[f.createElementVNode("div",XU,[e[6]||(e[6]=f.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),f.createElementVNode("div",KU,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-200 rounded-lg shadow-sm gap-x-2 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:e[1]||(e[1]=C=>r.isDeleteConfirm=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center px-3 py-2 text-sm font-semibold text-white bg-red-500 border border-transparent rounded-lg gap-x-2 hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...C)=>a.deleteElement&&a.deleteElement(...C))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const QU=je(UU,[["render",JU]]),eH={},tH={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 nH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",tH,e[0]||(e[0]=[f.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),f.createElementVNode("path",{d:"M7 20V4"},null,-1),f.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),f.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const iH=je(eH,[["render",nH]]),rH={},oH={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",class:"icon icon-tabler icons-tabler-outline icon-tabler-rosette-discount-check"};function sH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",oH,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 7.2a2.2 2.2 0 0 1 2.2 -2.2h1a2.2 2.2 0 0 0 1.55 -.64l.7 -.7a2.2 2.2 0 0 1 3.12 0l.7 .7c.412 .41 .97 .64 1.55 .64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58 .23 1.138 .64 1.55l.7 .7a2.2 2.2 0 0 1 0 3.12l-.7 .7a2.2 2.2 0 0 0 -.64 1.55v1a2.2 2.2 0 0 1 -2.2 2.2h-1a2.2 2.2 0 0 0 -1.55 .64l-.7 .7a2.2 2.2 0 0 1 -3.12 0l-.7 -.7a2.2 2.2 0 0 0 -1.55 -.64h-1a2.2 2.2 0 0 1 -2.2 -2.2v-1a2.2 2.2 0 0 0 -.64 -1.55l-.7 -.7a2.2 2.2 0 0 1 0 -3.12l.7 -.7a2.2 2.2 0 0 0 .64 -1.55v-1"},null,-1),f.createElementVNode("path",{d:"M9 12l2 2l4 -4"},null,-1)]))}const aH={components:{IconExport:iH,IconChevronDown:US,IconSuccess:je(rH,[["render",sH]])},props:{table:String,columns:Array,page:[String,Number],filterCustom:String,filterState:String,filters:String},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[],activeAction:"",isSuccessTemplate:!1,actions:[{name:"choceAll",function:this.choceAll,label:"Вибрати усі"},{name:"choceVisible",function:this.choceVisible,label:"Вибрати поточні"},{name:"clearAll",function:this.clearAll,label:"Жодного"}]}},watch:{isOpen(t){t||(this.format="",this.cols=[],this.activeAction="",this.isSuccessTemplate=!1)}},methods:{async exportTable(){var t;if(!((t=this.cols)!=null&&t.length)){this.$notify({type:"error",title:"Помилка",message:"Оберіть колонки для експорту!"});return}if(!this.format){this.$notify({type:"error",title:"Помилка",message:"Оберіть формат!"});return}try{const e=await rt.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(","),page:this.page,filter:this.filters||null,state:this.filterState||null,custom:this.filterCustom||null},responseType:"blob"}),n=new Blob([e.data],{type:"application/octet-stream"}),i=window.URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(i),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"}),this.isSuccessTemplate=!0}catch(e){console.error("Ошибка при экспорте файла:",e),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(t){this.format=t},choceAll(){var t;this.cols=(t=this.columns)==null?void 0:t.map(e=>e==null?void 0:e.name),this.activeAction="choceAll"},clearAll(){this.cols=[],this.activeAction="clearAll"},choceVisible(){var t,e;this.cols=(e=(t=this.columns)==null?void 0:t.filter(n=>(n==null?void 0:n.hidden)!==!0))==null?void 0:e.map(n=>n==null?void 0:n.name),this.activeAction="choceVisible"}}},lH={key:0,class:"flex flex-col items-center"},cH={key:1,class:"p-4"},uH={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},hH={class:"flex items-center"},dH={class:"flex items-center gap-[10px] ml-auto"},pH=["onClick"],fH={key:0,class:"block h-[8px] w-[8px] rounded-full bg-blue-500"},mH={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},gH={class:"pb-5 mb-5 border-b border-gray-200 last:pb-0 last:mb-0 last:border-b-0 dark:border-neutral-700"},yH={class:"mt-2 space-y-2"},_H=["id","onChange"],bH=["for"],xH={key:0,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"},vH={key:1,class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function wH(t,e,n,i,r,a){const u=f.resolveComponent("IconExport"),l=f.resolveComponent("IconChevronDown"),g=f.resolveComponent("IconSuccess"),b=f.resolveComponent("VsCheckbox"),w=f.resolveComponent("VsDialog");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=E=>r.isOpen=!0),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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"},[f.createVNode(u,{height:"16",width:"16"}),e[7]||(e[7]=f.createTextVNode(" Експорт ")),f.createVNode(l,{height:"12",width:"16"})]),f.createVNode(w,{visible:r.isOpen,"onUpdate:visible":e[6]||(e[6]=E=>r.isOpen=E),title:"Експорт таблиці",size:"small",closeClickBack:!0},{footer:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",xH,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[2]||(e[2]=E=>r.isOpen=!1)}," Закрити "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[3]||(e[3]=E=>r.isSuccessTemplate=!1)}," Вигрузити ще ")])):(f.openBlock(),f.createElementBlock("div",vH,[f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border border-gray-200 rounded-lg shadow-sm text-nowrap text-start hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[4]||(e[4]=E=>r.isOpen=!1)}," Скасувати "),f.createElementVNode("button",{type:"button",class:"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-white align-middle bg-blue-600 border border-blue-600 rounded-lg shadow-sm text-nowrap gap-x-2 text-start hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[5]||(e[5]=(...E)=>a.exportTable&&a.exportTable(...E))}," Завантажити таблицю ")]))]),default:f.withCtx(()=>[r.isSuccessTemplate?(f.openBlock(),f.createElementBlock("div",lH,[f.createVNode(g,{height:"100",width:"100",class:"text-green-200 mb-[20px]"}),e[8]||(e[8]=f.createElementVNode("h2",null,"Звіт сформовано і збережено",-1))])):(f.openBlock(),f.createElementBlock("div",cH,[f.createElementVNode("div",uH,[f.createElementVNode("div",hH,[e[9]||(e[9]=f.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),f.createElementVNode("div",dH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.actions,E=>(f.openBlock(),f.createElementBlock("button",{key:E==null?void 0:E.name,onClick:E==null?void 0:E.function,class:"inline-flex items-center gap-[8px] justify-center px-3 py-2 text-sm font-medium text-gray-800 align-middle bg-white border-gray-200 text-nowrap text-start"},[f.createElementVNode("span",{class:f.normalizeClass(["h-[14px] w-[14px] border rounded-full flex items-center justify-center",{"border-blue-500":(E==null?void 0:E.name)===r.activeAction}])},[(E==null?void 0:E.name)===r.activeAction?(f.openBlock(),f.createElementBlock("span",fH)):f.createCommentVNode("",!0)],2),f.createTextVNode(" "+f.toDisplayString(E==null?void 0:E.label),1)],8,pH))),128))])]),f.createElementVNode("div",mH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C,style:{width:"calc((100% - 10px) / 2)"}},[f.createVNode(b,{class:"[&>label]:text-sm [&>label]:text-gray-800 [&>label]:ms-3 !gap-x-[1px] !p-0",modelValue:r.cols,"onUpdate:modelValue":e[1]||(e[1]=I=>r.cols=I),value:E==null?void 0:E.name,label:E==null?void 0:E.ua},null,8,["modelValue","value","label"])]))),128))])]),f.createElementVNode("div",gH,[e[10]||(e[10]=f.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),f.createElementVNode("div",yH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(r.tableFormats,(E,C)=>(f.openBlock(),f.createElementBlock("div",{class:"flex items-center",key:C},[f.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"text-blue-600 border-gray-300 rounded-full shrink-0 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:E,onChange:I=>a.selectFormat(E)},null,40,_H),f.createElementVNode("label",{for:E,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+f.toDisplayString(E),9,bH)]))),128))])])]))]),_:1},8,["visible"])],64)}const kH=je(aH,[["render",wH]]),SH={},EH={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 CH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",EH,e[0]||(e[0]=[f.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 TH=je(SH,[["render",CH]]),MH={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(t){this.$emit("update-column",{...this.column,hidden:!t})}},mounted(){var t;((t=this.column)==null?void 0:t.hidden)!==!0&&(this.value=!0)}},AH={class:"flex w-full gap-[8px] items-centr"};function IH(t,e,n,i,r,a){var u,l;return f.openBlock(),f.createElementBlock("label",AH,[f.withDirectives(f.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=g=>r.value=g),type:"checkbox"},null,512),[[f.vModelCheckbox,r.value]]),f.createTextVNode(" "+f.toDisplayString(((u=n.column)==null?void 0:u.ua)||((l=n.column)==null?void 0:l.title)),1)])}const PH={components:{IconColumns:TH,AdminTableColumnsHiddenItem:je(MH,[["render",IH]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(t){const e=this.columns.findIndex(i=>(i==null?void 0:i.name)===(t==null?void 0:t.name)),n=this.columns;n[e]=t,this.$emit("update-columns",[...n])}}},DH={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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"},OH={class:"py-[10px] px-[10px] w-[260px]"},BH={class:"flex flex-col gap-[3px] max-h-[400px] w-full 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 zH(t,e,n,i,r,a){const u=f.resolveComponent("IconColumns"),l=f.resolveComponent("AdminTableColumnsHiddenItem"),g=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(g,{trigger:"click",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",DH,[f.createVNode(u,{height:"20",width:"16"})])]),default:f.withCtx(()=>[f.createElementVNode("div",OH,[e[0]||(e[0]=f.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),f.createElementVNode("ul",BH,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,(b,w)=>(f.openBlock(),f.createElementBlock("li",{key:w},[f.createVNode(l,{column:b,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const NH=je(PH,[["render",zH]]),LH={},RH={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function VH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",RH,e[0]||(e[0]=[f.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 1C8.55228 1 9 1.44772 9 2V7L14 7C14.5523 7 15 7.44771 15 8C15 8.55228 14.5523 9 14 9L9 9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9.00001L2 9.00001C1.44772 9.00001 1 8.5523 1 8.00001C0.999999 7.44773 1.44771 7.00001 2 7.00001L7 7.00001V2C7 1.44772 7.44772 1 8 1Z"},null,-1)]))}const HS=je(LH,[["render",VH]]),FH={props:{row:Object,column:Object,table:String}};function $H(t,e,n,i,r,a){var u,l,g,b,w,E,C,I;return f.openBlock(),f.createBlock(f.resolveDynamicComponent(((u=n.column)==null?void 0:u.format)==="custom"?(l=n.column)==null?void 0:l.component:`table-format-${((b=(g=n.column)==null?void 0:g.format)==null?void 0:b.toLowerCase())||"text"}`),{onUpdateTable:e[0]||(e[0]=D=>t.$emit("update-table")),name:(w=n.column)==null?void 0:w.name,data:n.row,value:(C=n.row)==null?void 0:C[(E=n.column)==null?void 0:E.name],table:n.table,column:n.column,edit:(I=n.column)==null?void 0:I.edit},null,40,["name","data","value","table","column","edit"])}const qS=je(FH,[["render",$H]]),jH={},UH={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-minus"};function HH(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",UH,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M5 12l14 0"},null,-1)]))}const qH={components:{IconPlus:HS,IconMinus:je(jH,[["render",HH]])},props:{title:String,defaultValue:{type:Boolean,default:()=>!1}},data(){return{expanded:this.defaultValue}}},WH={class:"hs-accordion"},GH={class:"py-0.5 flex items-center gap-x-0.5 w-full"},ZH={class:"text-sm font-medium"},YH={class:"relative inline-block w-full duration-150 cursor-pointer before:block before:absolute b"};function XH(t,e,n,i,r,a){const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("IconMinus");return f.openBlock(),f.createElementBlock("div",null,[f.createElementVNode("div",null,[f.createElementVNode("div",WH,[f.createElementVNode("div",GH,[f.createElementVNode("div",{onClick:e[0]||(e[0]=g=>r.expanded=!r.expanded),class:"rounded-md cursor-pointer grow"},[f.createElementVNode("span",ZH,f.toDisplayString(n.title),1)]),f.createElementVNode("button",{class:"flex items-center justify-center rounded-md size-6 hover:bg-gray-100",onClick:e[1]||(e[1]=g=>r.expanded=!r.expanded)},[r.expanded?(f.openBlock(),f.createBlock(l,{key:1,width:"14"})):(f.openBlock(),f.createBlock(u,{key:0}))])]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>[f.withDirectives(f.createElementVNode("div",YH,[f.renderSlot(t.$slots,"default",{},void 0,!0)],512),[[f.vShow,r.expanded]])]),_:3})])])])}const KH={components:{AdminComponentIs:qS,AdminTree:je(qH,[["render",XH],["__scopeId","data-v-c6318482"]]),VsNoData:VS,VsWidgetComments:zS,VsWidgetMap:ly,VsWidgetFileList:Kv},props:{table:String,columns:Array,row:Object}},JH={class:"hs-accordion border-gray-100 w-[360px] shrink-0 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",style:{height:"calc(100vh - 310px)"}},QH={class:"border-l",style:{height:"calc(100vh - 360px)"}},eq={class:"flex items-center justify-between py-1 gap-x-4"},tq={class:"col-span-1"},nq={class:"inline-flex items-center gap-x-2 text-[13px] text-gray-500 dark:text-neutral-500"},iq={class:"col-span-2"},rq={class:"font-medium text-[13px] text-gray-800 dark:text-neutral-200"},oq={class:"table-info-card"},sq={class:"table-info-card"};function aq(t,e,n,i,r,a){var C,I,D;const u=f.resolveComponent("AdminComponentIs"),l=f.resolveComponent("AdminTree"),g=f.resolveComponent("VsWidgetMap"),b=f.resolveComponent("VsNoData"),w=f.resolveComponent("VsWidgetComments"),E=f.resolveComponent("VsWidgetFileList");return f.openBlock(),f.createElementBlock("div",JH,[e[0]||(e[0]=f.createElementVNode("div",{class:"p-[10px] pl-[18px] pb-[18px] border-b"},[f.createElementVNode("h2",{class:"text-sm font-medium"},"Інформація про об'єкт")],-1)),f.createElementVNode("div",QH,[(I=(C=t.$route)==null?void 0:C.query)!=null&&I.card?(f.openBlock(),f.createElementBlock(f.Fragment,{key:0},[n.row?(f.openBlock(),f.createBlock(l,{key:0,defaultValue:!0,title:"Основна інформація",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.columns,L=>(f.openBlock(),f.createElementBlock("dl",eq,[f.createElementVNode("dt",tq,[f.createElementVNode("p",nq,f.toDisplayString((L==null?void 0:L.ua)||(L==null?void 0:L.title))+": ",1)]),f.createElementVNode("dd",iq,[f.createElementVNode("p",rq,[f.createVNode(u,{row:n.row,column:L,table:n.table},null,8,["row","column","table"])])])]))),256))]),_:1})):f.createCommentVNode("",!0),(D=n.row)!=null&&D.geom?(f.openBlock(),f.createBlock(l,{key:1,title:"Карта",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var L,$;return[(L=n.row)!=null&&L.geom?(f.openBlock(),f.createBlock(g,{key:0,geometry:($=n.row)==null?void 0:$.geom,zoom:14},null,8,["geometry"])):(f.openBlock(),f.createBlock(b,{key:1,title:"У об'єкта відсутня геометрія",text:"",class:"[&>div]:h-[200px] [&>div]:min-h-[400px] h-[400px]"}))]}),_:1})):f.createCommentVNode("",!0),f.createVNode(l,{title:"Коментарі",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var L;return[f.createElementVNode("div",oq,[f.createVNode(w,{id:(L=n.row)==null?void 0:L.id},null,8,["id"])])]}),_:1}),f.createVNode(l,{title:"Файли",class:"border-b p-[10px] py-[16px]"},{default:f.withCtx(()=>{var L;return[f.createElementVNode("div",sq,[f.createVNode(E,{id:(L=n.row)==null?void 0:L.id},null,8,["id"])])]}),_:1})],64)):(f.openBlock(),f.createBlock(b,{key:1,text:"Оберіть один з об'єктів в таблиці для відображення інформаціі про нього"}))])])}const lq=je(KH,[["render",aq]]),cq={},uq={class:"hidden xl:block 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 hq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",uq,e[0]||(e[0]=[f.createElementVNode("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"},null,-1),f.createElementVNode("path",{d:"M15 3v18"},null,-1),f.createElementVNode("path",{d:"m8 9 3 3-3 3"},null,-1)]))}const dq=je(cq,[["render",hq]]),pq={},fq={class:"h21yx vs0hq",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"};function mq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",fq,e[0]||(e[0]=[f.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const gq={emits:["filterChange"],props:{scheme:{type:Object},onFilters:{type:Number}},components:{IconFilter:je(pq,[["render",mq]])},data(){return{isFilters:!1}},methods:{closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)}}},yq={key:0,class:"font-medium text-[10px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full dark:bg-neutral-500"},_q={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-white [&::-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 bq(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter"),l=f.resolveComponent("VsFilter");return f.openBlock(),f.createElementBlock(f.Fragment,null,[f.createElementVNode("button",{onClick:e[0]||(e[0]=g=>r.isFilters=!r.isFilters),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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"},[f.createVNode(u,{height:"16",width:"16"}),e[4]||(e[4]=f.createTextVNode(" Фільтри ")),n.onFilters?(f.openBlock(),f.createElementBlock("span",yq,f.toDisplayString(n.onFilters),1)):f.createCommentVNode("",!0)]),f.createVNode(f.Transition,{name:"fade"},{default:f.withCtx(()=>{var g;return[f.withDirectives(f.createElementVNode("div",{onClick:e[3]||(e[3]=(...b)=>a.closeFilter&&a.closeFilter(...b)),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)]"},[f.createElementVNode("div",_q,[(g=n.scheme)!=null&&g.length?(f.openBlock(),f.createBlock(l,{key:0,ref:"filter",scheme:n.scheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:e[1]||(e[1]=b=>t.$emit("filterChange",b)),closeFilterBtn:!0,onFilterClose:e[2]||(e[2]=b=>r.isFilters=!1)},null,8,["scheme"])):f.createCommentVNode("",!0)])],512),[[f.vShow,r.isFilters]])]}),_:1})],64)}const xq=je(gq,[["render",bq]]),vq={props:{tabsList:{type:Array,default:()=>[]},filterState:String}},wq={class:"relative flex space-x-1 mb-[20px] after:absolute after:w-[99%] after:bottom-0 after:inset-x-0 after:border-b-2 after:border-gray-200 dark:after:border-neutral-700","aria-label":"Tabs",role:"tablist","aria-orientation":"horizontal"},kq=["onClick"];function Sq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("nav",wq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.tabsList,u=>(f.openBlock(),f.createElementBlock("button",{onClick:l=>t.$emit("update:filterState",u==null?void 0:u.name),class:f.normalizeClass(["hs-tab-active:after:bg-gray-800 hs-tab-active:text-gray-800 px-2.5 py-1.5 mb-2 relative inline-flex justify-center items-center gap-x-2 hover:bg-gray-100 text-gray-500 hover:text-gray-800 text-sm rounded-lg disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 after:absolute after:-bottom-2 after:inset-x-0 after:z-10 after:h-0.5 after:pointer-events-none dark:hs-tab-active:text-neutral-200 dark:hs-tab-active:after:bg-neutral-400 dark:text-neutral-500 dark:hover:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 active",{" font-semibold after:absolute after:bottom-[-8px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":(u==null?void 0:u.name)===n.filterState}])},f.toDisplayString(u==null?void 0:u.label),11,kq))),256))])}const Eq=je(vq,[["render",Sq]]),Cq={},Tq={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-filter"};function Mq(t,e,n,i,r,a){return f.openBlock(),f.createElementBlock("svg",Tq,e[0]||(e[0]=[f.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),f.createElementVNode("path",{d:"M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z"},null,-1)]))}const Aq={components:{IconFilter2:je(Cq,[["render",Mq]])},props:{filterCustom:String,customList:Array}},Iq={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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"},Pq={class:"flex flex-col gap-[4px]"},Dq=["onClick"];function Oq(t,e,n,i,r,a){const u=f.resolveComponent("IconFilter2"),l=f.resolveComponent("VsPopover");return f.openBlock(),f.createBlock(l,{ref:"popover",placement:"bottom"},{reference:f.withCtx(()=>[f.createElementVNode("button",Iq,[f.createVNode(u,{height:"20",width:"20"})])]),default:f.withCtx(()=>[f.createElementVNode("div",Pq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(n.customList,(g,b)=>(f.openBlock(),f.createElementBlock("button",{onClick:w=>{var E;t.$emit("update:filterCustom",g==null?void 0:g.name),(E=t.$refs)==null||E.popover.togglePopover()},key:b,class:f.normalizeClass(["p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",{"bg-gray-100":n.filterCustom===(g==null?void 0:g.name)}])},f.toDisplayString(g==null?void 0:g.label),11,Dq))),128)),f.createElementVNode("button",{class:"p-[8px] block rounded-lg w-[140px] text-start hover:bg-gray-100 !duration-300",onClick:e[0]||(e[0]=g=>{var b;t.$emit("update:filterCustom",void 0),(b=t.$refs)==null||b.popover.togglePopover()})}," Скинути фільтри ")])]),_:1},512)}const Bq=je(Aq,[["render",Oq]]),zq={class:"flex items-center gap-x-2"},Nq={props:{table:String,title:String},components:{AdminTableControl:QU,AdminTableExport:kH,AdminTableColumnsHidden:NH,AdminTableColumn:BU,AdminNodata:n_,IconPlus:HS,IconSearch:r_,AdminTableCardInfo:lq,IconOpenCard:dq,AdminComponentIs:qS,AdminTableFilters:xq,AdminTableTabs:Eq,AdminTableCustomFilters:Bq,AdminTableCustomButtons:{__name:"admin-table-custom-buttons",props:{slots:Object},setup(t){var l,g,b,w,E;const{asyncTemplateSlot:e}=(E=(w=(b=(g=(l=f.getCurrentInstance())==null?void 0:l.appContext)==null?void 0:g.app)==null?void 0:b.config)==null?void 0:w.globalProperties)==null?void 0:E.utils,n=f.ref(""),i=f.ref(""),r=t,a=()=>{var C,I,D,L,$;if((C=r.slots)!=null&&C.panelLeft||(i.value="div"),(D=(I=r.slots)==null?void 0:I.panelLeft)!=null&&D.includes("<")){const W=e("PanelLeft",(L=r.slots)==null?void 0:L.panelLeft,["name"]);i.value=W}else i.value=($=r.slots)==null?void 0:$.panelLeft},u=()=>{var C,I,D,L,$;if((C=r.slots)!=null&&C.panelRight||(n.value="div"),(D=(I=r.slots)==null?void 0:I.panelRight)!=null&&D.includes("<")){const W=e("PanelRight",(L=r.slots)==null?void 0:L.panelRight,["name"]);n.value=W}else n.value=($=r.slots)==null?void 0:$.panelRight};return a(),u(),(C,I)=>(f.openBlock(),f.createElementBlock("div",zq,[(f.openBlock(),f.createBlock(f.resolveDynamicComponent(i.value))),(f.openBlock(),f.createBlock(f.resolveDynamicComponent(n.value)))]))}}},data(){return{tableData:{},filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",isVisibleCardInfo:!1,onFilters:0,filterState:null,filterCustom:null,visibleColumns:[],initialHiddenColumns:""}},async mounted(){await this.checkUrlMounted(),await this.getTableData(),await this.getFilters()},computed:{defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},columns(){var t,e;return(e=(t=this.tableData)==null?void 0:t.columns)==null?void 0:e.filter(n=>(n==null?void 0:n.hidden)!==!0)},isForm(){var t;return(t=this.tableData)==null?void 0:t.form},isNoData(){var t,e;return!((t=this.tableData)!=null&&t.rows)||!((e=this.columns)!=null&&e.length)},activeCardRow(){var t,e;return((e=(t=this.tableData)==null?void 0:t.rows)==null?void 0:e.find(n=>{var i,r;return(n==null?void 0:n.id)===((r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.card)}))||{}},getActions(){var t;return(t=this.tableData)==null?void 0:t.actions}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue:{handler:((t,e=300)=>{let n;return function(...i){clearTimeout(n),n=setTimeout(()=>{t.apply(this,i)},e)}})(async function(t){var e;await this.getTableData(),this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,search:t||void 0}})},500)},$route:{handler(t,e){var n,i;((n=t==null?void 0:t.params)==null?void 0:n.catchAll)!==((i=e==null?void 0:e.params)==null?void 0:i.catchAll)&&(this.visibleColumns=[],this.unmountedData(),this.getFilters())},deep:!0},limit(t){var e;this.$router.replace({query:{...(e=this.$route)==null?void 0:e.query,limit:t}})},filterState(t){var e;t&&(this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,filterState:t}}),this.getTableData())},filterCustom(t){var e;this.$router.replace({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,custom:t}}),this.getTableData()},columns(t){var e,n,i,r;this.visibleColumns=t==null?void 0:t.map(a=>a==null?void 0:a.name),this.initialHiddenColumns===((e=this.visibleColumns)==null?void 0:e.join(","))&&(this.visibleColumns=[]),this.$router.replace({...this.$route,query:{...(n=this.$route)==null?void 0:n.query,columns:(i=this.visibleColumns)!=null&&i.length?(r=this.visibleColumns)==null?void 0:r.join(","):void 0}})}},methods:{async checkUrlMounted(){var t,e,n,i,r,a,u,l,g,b,w,E,C,I,D,L,$;this.page=((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1,this.limit=((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.limit)||20,this.filters=((u=decodeURI((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.filter))==null?void 0:u.replaceAll("+"," "))||null,this.filterState=((g=(l=this.$route)==null?void 0:l.query)==null?void 0:g.filterState)||null,this.filterCustom=((w=(b=this.$route)==null?void 0:b.query)==null?void 0:w.custom)||null,this.searchValue=((C=(E=this.$route)==null?void 0:E.query)==null?void 0:C.search)||"",this.visibleColumns=((L=(D=(I=this.$route)==null?void 0:I.query)==null?void 0:D.columns)==null?void 0:L.split(","))||[],($=this.$route)!=null&&$.query.card&&(this.isVisibleCardInfo=!0)},rowWidth(t){var n,i;const e=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.find(r=>r.name===t);if(e){const r=e==null?void 0:e.width;return typeof r=="number"?`${r}px`:r!=null&&r.includes("px")?r:`${r}px`}},unmountedData(){this.page=1,this.visibleColumns=[],this.filterCustom=null,this.filterState=null,this.isVisibleCardInfo=!1,this.filterScheme=null,this.filters=null,this.onFilters=0,this.searchValue=""},async getTableData(){var t,e,n,i,r,a,u,l,g,b,w;try{const{data:E}=await rt.get(`/api/template/table/${this.table}`),C=await rt.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort)||null,state:this.filterState||null,custom:this.filterCustom||null}});this.tableData={...E,...(C==null?void 0:C.data)||{}},this.initialHiddenColumns=(a=(r=(i=(n=this.tableData)==null?void 0:n.columns)==null?void 0:i.filter(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:r.map(I=>I==null?void 0:I.name))==null?void 0:a.join(","),(u=this.visibleColumns)!=null&&u.length?(l=this.tableData)==null||l.columns.forEach(I=>{var D;(D=this.visibleColumns)!=null&&D.includes(I==null?void 0:I.name)?I.hidden=!1:I.hidden=!0}):this.visibleColumns=(w=(b=(g=this.tableData)==null?void 0:g.columns)==null?void 0:b.filter(I=>(I==null?void 0:I.hidden)!==!0))==null?void 0:w.map(I=>I==null?void 0:I.name)}catch{}},async getFilters(){var t;try{const{data:e}=await rt.get(`/api/table-filter/${this.table}`);this.filterScheme=(t=e==null?void 0:e.list)==null?void 0:t.map(n=>({...n,label:(n==null?void 0:n.label)||(n==null?void 0:n.ua)}))}catch{}},async handlePageChange(t){const e=this.$route.query;this.page=t,!(!(e!=null&&e.page)&&t===1||e.page===t)&&(await this.$router.replace({query:{...e,page:t}}),await this.getTableData())},async changeLimit(t){this.limit=await t,this.defaultPage=1,await this.getTableData()},async filterChange({url:t,state:e}){var n;this.filters=t!=="no-url"?t:null,this.onFilters=(n=Object.entries(e))==null?void 0:n.length,this.page=1,await this.getTableData()},changeActiveColumn(t){this.activeColumn=t,this.getTableData()},pushToCard(t){var e;((e=this.tableData)==null?void 0:e.card)===!1||this.$router.push(`/card/${this.table}/${t}`)},changeActiveCardInfo(t){var e;this.isVisibleCardInfo&&this.$router.push({...this.$route,query:{...(e=this.$route)==null?void 0:e.query,card:t}})},toggleCardInfo(){var t;this.isVisibleCardInfo=!this.isVisibleCardInfo,this.isVisibleCardInfo||this.$router.push({...this.$route,query:{...(t=this.$route)==null?void 0:t.query,card:void 0}})}}},Lq={class:"w-[calc(100vw - 320px)] bg-gray-50"},Rq={class:"h-[76px] mt-[15px] flex items-center justify-between mx-[20px] px-[20px] bg-white border rounded-xl"},Vq={class:"text-xl font-medium"},Fq={style:{height:"calc(100vh - 155px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},$q={class:"bg-white w-full rounded-xl border p-[20px] pr-0"},jq={class:"flex"},Uq={class:"flex gap-[6px] ml-auto"},Hq={class:"inline-block w-full align-middle"},qq={key:0,class:"relative min-w-full divide-y divide-gray-200 table-fixed w-max dark:divide-neutral-700"},Wq={class:"sticky top-[-1px] bg-white w-full after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},Gq={class:"right-0 border-t border-stone-200"},Zq={key:0,class:"w-[70px] sticky right-0 top-0"},Yq={class:"divide-y divide-gray-200"},Xq={class:"px-4 py-3 text-sm text-gray-600"},Kq=["onClick"],Jq=["onClick"],Qq={class:"p-[20px] flex justify-start items-center w-full"},eW={class:"w-[200px]"},tW={class:"text-sm text-gray-600 dark:text-neutral-400"},nW={class:"font-semibold text-gray-800 dark:text-neutral-200"},iW={key:0},rW={key:0,class:"font-semibold text-gray-800 dark:text-neutral-200"};function oW(t,e,n,i,r,a){var Se,Ne,Ae,$e,Xe,Pt,st,Tt,Nt,Vt,Ft,Ht,Cn,dn,vn,pn,ti,Nn,Pn,Ln,Ce,He,Ke;const u=f.resolveComponent("IconPlus"),l=f.resolveComponent("router-link"),g=f.resolveComponent("AdminTableTabs"),b=f.resolveComponent("IconSearch"),w=f.resolveComponent("VsText"),E=f.resolveComponent("AdminTableCustomButtons"),C=f.resolveComponent("AdminTableCustomFilters"),I=f.resolveComponent("AdminTableColumnsHidden"),D=f.resolveComponent("AdminTableExport"),L=f.resolveComponent("AdminTableFilters"),$=f.resolveComponent("IconOpenCard"),W=f.resolveComponent("AdminTableColumn"),te=f.resolveComponent("AdminComponentIs"),G=f.resolveComponent("AdminTableControl"),Q=f.resolveComponent("AdminNodata"),Ie=f.resolveComponent("VsPagination"),ve=f.resolveComponent("AdminTableCardInfo");return f.openBlock(),f.createElementBlock("div",Lq,[f.createElementVNode("div",Rq,[f.createElementVNode("h2",Vq,f.toDisplayString(n.title),1),a.isForm?(f.openBlock(),f.createBlock(l,{key:0,to:`/add?table=${(Ne=(Se=t.$route)==null?void 0:Se.params)==null?void 0:Ne.catchAll}`,class:"inline-flex items-center px-3 py-2 text-sm font-medium text-white duration-300 bg-blue-600 border border-transparent rounded-lg gap-x-2 hover:bg-blue-700 hover:text-white"},{default:f.withCtx(()=>[f.createVNode(u,{height:"16",width:"16"}),e[5]||(e[5]=f.createTextVNode(" Додати "))]),_:1},8,["to"])):f.createCommentVNode("",!0)]),f.createElementVNode("div",Fq,[f.createElementVNode("div",$q,[($e=(Ae=r.tableData)==null?void 0:Ae.filterState)!=null&&$e.length?(f.openBlock(),f.createBlock(g,{key:0,tabsList:(Xe=r.tableData)==null?void 0:Xe.filterState,filterState:r.filterState,"onUpdate:filterState":e[0]||(e[0]=Be=>r.filterState=Be)},null,8,["tabsList","filterState"])):f.createCommentVNode("",!0),f.createElementVNode("div",jq,[f.createElementVNode("div",{class:f.normalizeClass([r.isVisibleCardInfo?"w-[calc(100%-360px)]":"w-full"])},[f.createElementVNode("div",{class:f.normalizeClass(["flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createVNode(b,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),f.createVNode(w,{modelValue:r.searchValue,"onUpdate:modelValue":e[1]||(e[1]=Be=>r.searchValue=Be),placeholder:"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600"},null,8,["modelValue"]),f.createElementVNode("div",Uq,[(Pt=r.tableData)!=null&&Pt.slots?(f.openBlock(),f.createBlock(E,{key:0,slots:(st=r.tableData)==null?void 0:st.slots},null,8,["slots"])):f.createCommentVNode("",!0),(Nt=(Tt=r.tableData)==null?void 0:Tt.filterCustom)!=null&&Nt.length?(f.openBlock(),f.createBlock(C,{key:1,customList:(Vt=r.tableData)==null?void 0:Vt.filterCustom,filterCustom:r.filterCustom,"onUpdate:filterCustom":e[2]||(e[2]=Be=>r.filterCustom=Be)},null,8,["customList","filterCustom"])):f.createCommentVNode("",!0),f.createVNode(I,{columns:(Ft=r.tableData)==null?void 0:Ft.columns,onUpdateColumns:e[3]||(e[3]=Be=>r.tableData.columns=Be)},null,8,["columns"]),((Ht=r.tableData)==null?void 0:Ht.export)!==!1?(f.openBlock(),f.createBlock(D,{key:2,table:n.table,columns:(Cn=r.tableData)==null?void 0:Cn.columns,page:r.page,"filter-state":r.filterState,"filter-custom":r.filterCustom,filters:r.filters},null,8,["table","columns","page","filter-state","filter-custom","filters"])):f.createCommentVNode("",!0),(dn=r.filterScheme)!=null&&dn.length?(f.openBlock(),f.createBlock(L,{key:3,scheme:r.filterScheme,onFilters:r.onFilters,onFilterChange:a.filterChange},null,8,["scheme","onFilters","onFilterChange"])):f.createCommentVNode("",!0),f.createElementVNode("button",{onClick:e[4]||(e[4]=(...Be)=>a.toggleCardInfo&&a.toggleCardInfo(...Be)),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs 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"},[f.createVNode($,{class:f.normalizeClass({"rotate-180 duration-300":!r.isVisibleCardInfo})},null,8,["class"])])])],2),f.createElementVNode("div",{class:f.normalizeClass(["flex items-start justify-start w-full space-y-5",{"pr-[20px]":!r.isVisibleCardInfo}])},[f.createElementVNode("div",{style:f.normalizeStyle({height:(pn=(vn=r.tableData)==null?void 0:vn.filterState)!=null&&pn.length?"calc(100vh - 370px)":"calc(100vh - 330px)"}),class:"overflow-x-auto w-full [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[f.createElementVNode("div",Hq,[a.isNoData?(f.openBlock(),f.createBlock(Q,{key:1})):(f.openBlock(),f.createElementBlock("table",qq,[f.createElementVNode("thead",Wq,[f.createElementVNode("tr",Gq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList(a.columns,Be=>(f.openBlock(),f.createBlock(W,{key:Be.name,style:f.normalizeStyle({width:a.rowWidth(Be==null?void 0:Be.name),textAlign:Be==null?void 0:Be.align,wordBreak:Be==null?void 0:Be.wrap}),data:Be,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),(Nn=(ti=a.getActions)==null?void 0:ti.filter(Be=>Be!=="add"))!=null&&Nn.length?(f.openBlock(),f.createElementBlock("th",Zq)):f.createCommentVNode("",!0)])]),f.createElementVNode("tbody",Yq,[(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((Pn=r.tableData)==null?void 0:Pn.rows,(Be,Rt)=>{var Qt,At,Mt,rn,we,yn,pr,qt,sn,vi;return f.openBlock(),f.createElementBlock("tr",{key:Rt,class:f.normalizeClass({"bg-gray-50":((At=(Qt=t.$route)==null?void 0:Qt.query)==null?void 0:At.card)===(Be==null?void 0:Be.id)})},[f.createElementVNode("td",Xq,[f.createElementVNode("button",{onClick:()=>a.pushToCard(Be==null?void 0:Be.id),class:f.normalizeClass(["text-sm font-medium",[((Mt=r.tableData)==null?void 0:Mt.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[f.createVNode(te,{row:Be,column:a.columns[0],table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,Kq)]),(f.openBlock(!0),f.createElementBlock(f.Fragment,null,f.renderList((rn=a.columns)==null?void 0:rn.slice(1),ui=>(f.openBlock(),f.createElementBlock("td",{onClick:mi=>a.changeActiveCardInfo(Be==null?void 0:Be.id),class:f.normalizeClass(["px-3 py-3 text-sm text-gray-600 text-start",{"cursor-pointer":r.isVisibleCardInfo}]),key:ui.name},[f.createVNode(te,{row:Be,column:ui,table:n.table,onUpdateTable:a.getTableData},null,8,["row","column","table","onUpdateTable"])],10,Jq))),128)),(yn=(we=a.getActions)==null?void 0:we.filter(ui=>ui!=="add"))!=null&&yn.length?(f.openBlock(),f.createElementBlock("td",{key:0,class:f.normalizeClass(["text-center sticky right-0 w-[80px] px-[10px]",{"bg-gray-50":((qt=(pr=t.$route)==null?void 0:pr.query)==null?void 0:qt.card)===(Be==null?void 0:Be.id),"bg-white":((vi=(sn=t.$route)==null?void 0:sn.query)==null?void 0:vi.card)!==(Be==null?void 0:Be.id)}])},[f.createVNode(G,{actions:a.getActions,isForm:a.isForm,item:Be,table:n.table,onUpdateTable:a.getTableData},null,8,["actions","isForm","item","table","onUpdateTable"])],2)):f.createCommentVNode("",!0)],2)}),128))])]))])],4)],2),f.createElementVNode("div",Qq,[f.createElementVNode("div",eW,[f.createElementVNode("p",tW,[f.createElementVNode("span",nW,[f.createTextVNode(f.toDisplayString(r.filters||r.searchValue?"Знайдено":"Об'єктів")+" "+f.toDisplayString(((Ln=r.tableData)==null?void 0:Ln.count)||"0 ")+" ",1),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",iW," з")):f.createCommentVNode("",!0)]),r.filters||r.searchValue?(f.openBlock(),f.createElementBlock("span",rW,f.toDisplayString(" "+((Ce=r.tableData)==null?void 0:Ce.filtered)||0),1)):f.createCommentVNode("",!0)])]),Math.ceil(((He=r.tableData)==null?void 0:He.filtered)/r.limit)>1?(f.openBlock(),f.createBlock(Ie,{key:0,goTo:!1,class:"justify-end","default-page":parseInt(a.defaultPage),total:((Ke=r.tableData)==null?void 0:Ke.filtered)||0,pageSize:parseInt(r.limit),onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit,backgroundColor:"#F3F4F6"},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):f.createCommentVNode("",!0)])],2),f.createVNode(f.Transition,{name:"slide-fade"},{default:f.withCtx(()=>{var Be;return[r.isVisibleCardInfo?(f.openBlock(),f.createBlock(ve,{key:0,table:n.table,columns:(Be=r.tableData)==null?void 0:Be.columns,row:a.activeCardRow},null,8,["table","columns","row"])):f.createCommentVNode("",!0)]}),_:1})])])])])}const sW={components:{AdminTable:je(Nq,[["render",oW],["__scopeId","data-v-7509554b"]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){Kr!=null&&Kr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){var e;t&&(document.title=(((e=ra.value)==null?void 0:e.titlePrefix)||"")+t)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async checkPageType(){var i,r;const t=this.flattenMenu(Kr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.params)==null?void 0:l.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404"),e!=null&&e.component&&this.$router.replace((r=(i=this.$route)==null?void 0:i.params)==null?void 0:r.catchAll);const n=e==null?void 0:e.table;this.table=n||!1,!n&&this.getInterface()},async getInterface(){var t,e;try{const{data:n}=await rt.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},aW=["innerHTML"];function lW(t,e,n,i,r,a){const u=f.resolveComponent("AdminTable");return r.table?(f.openBlock(),f.createBlock(u,{key:0,table:r.table,title:r.title},null,8,["table","title"])):(f.openBlock(),f.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:r.interface},null,8,aW))}const cW=Object.freeze(Object.defineProperty({__proto__:null,default:je(sW,[["render",lW]])},Symbol.toStringTag,{value:"Module"}));return f9});